@amityco/ts-sdk 7.0.1-fbbf78f.0 → 7.0.2-3f56a68.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/core/linkPreview.d.ts +12 -0
- package/dist/@types/core/linkPreview.d.ts.map +1 -0
- package/dist/@types/domains/client.d.ts +0 -1
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/analytic/service/analytic/AnalyticsEventCapturer.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/client/api/fetchLinkPreview.d.ts +14 -0
- package/dist/client/api/fetchLinkPreview.d.ts.map +1 -0
- package/dist/client/api/index.d.ts +1 -0
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/core/model/index.d.ts +0 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +56 -128
- package/dist/index.esm.js +56 -128
- package/dist/index.umd.js +4 -4
- package/dist/messageRepository/api/createMessage.d.ts.map +1 -1
- package/dist/messageRepository/utils/getMessageFromMainDB.d.ts.map +1 -1
- package/dist/messageRepository/utils/index.d.ts +0 -1
- package/dist/messageRepository/utils/index.d.ts.map +1 -1
- package/dist/messageRepository/utils/prepareMessagePayload.d.ts.map +1 -1
- package/dist/utils/event.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/@types/core/linkPreview.ts +12 -0
- package/src/@types/domains/client.ts +0 -2
- package/src/analytic/service/analytic/AnalyticsEventCapturer.ts +9 -6
- package/src/client/api/createClient.ts +0 -26
- package/src/client/api/fetchLinkPreview.ts +30 -0
- package/src/client/api/index.ts +2 -0
- package/src/core/model/index.ts +0 -1
- package/src/messageRepository/api/createMessage.ts +0 -7
- package/src/messageRepository/observers/getMessages/MessageQueryStreamController.ts +4 -4
- package/src/messageRepository/utils/getMessageFromMainDB.ts +5 -9
- package/src/messageRepository/utils/index.ts +0 -1
- package/src/messageRepository/utils/prepareMessagePayload.ts +17 -22
- package/src/utils/event.ts +2 -19
- package/dist/core/model/localReferenceId.d.ts +0 -2
- package/dist/core/model/localReferenceId.d.ts.map +0 -1
- package/dist/messageRepository/utils/getMessageIdentifierIds.d.ts +0 -2
- package/dist/messageRepository/utils/getMessageIdentifierIds.d.ts.map +0 -1
- package/src/core/model/localReferenceId.ts +0 -12
- package/src/messageRepository/utils/getMessageIdentifierIds.ts +0 -37
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkPreview.d.ts","sourceRoot":"","sources":["../../../src/@types/core/linkPreview.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC;AAEV,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,WAAW,GAAG;YACjB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;YACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;YAC3B,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;YACrB,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;SACtB,CAAC;KACH;CACF"}
|
|
@@ -40,7 +40,6 @@ declare global {
|
|
|
40
40
|
getMessagePreviewSetting: (refresh?: boolean) => Promise<Amity.MessagePreviewSetting>;
|
|
41
41
|
getMarkerSyncConsistentMode: () => boolean;
|
|
42
42
|
prefixDeviceIdKey?: string;
|
|
43
|
-
objectSyncMap: Map<string, string | undefined>;
|
|
44
43
|
};
|
|
45
44
|
type Device = {
|
|
46
45
|
deviceId: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../../src/@types/domains/client.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,KAAK,CAAC;QACd,KAAK,MAAM,GAAG,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,EAAE,GAAG,E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AE,OAAO,CAAC;SACrB,CAAC;QAEF,KAAK,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,EAAE,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,aAAa,CAAC,CAAC;QAEtF,KAAK,UAAU,GAAG,IAAI,CAAC,KAAK,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG;YACxD,WAAW,EAAE,OAAO,CAAC;SACtB,CAAC;KACH;CACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnalyticsEventCapturer.d.ts","sourceRoot":"","sources":["../../../../src/analytic/service/analytic/AnalyticsEventCapturer.ts"],"names":[],"mappings":";AAQA,qBAAa,sBAAsB;IACjC,WAAW,SAAc;IAEzB,UAAU,SAAQ;IAElB,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;KAAE,CAAM;IAElE,yBAAyB,EAAE;QAAE,CAAC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;KAAE,CAAM;IAGhF,mBAAmB,EAAE,MAAM,CAAC,OAAO,GAAG,SAAS,CAAa;IAE5D,+BAA+B,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAM;IAEnE,eAAe,CAAC,EACd,QAAQ,EACR,UAAU,EACV,cAAsB,GACvB,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B;
|
|
1
|
+
{"version":3,"file":"AnalyticsEventCapturer.d.ts","sourceRoot":"","sources":["../../../../src/analytic/service/analytic/AnalyticsEventCapturer.ts"],"names":[],"mappings":";AAQA,qBAAa,sBAAsB;IACjC,WAAW,SAAc;IAEzB,UAAU,SAAQ;IAElB,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,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1 @@
|
|
|
1
|
-
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/client/api/createClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAc,MAAM,0BAA0B,CAAC;AAsBnE;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,YAAY,WACf,MAAM,cACH,CAAA,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;;;;;;;;MAYtD,MAAM,
|
|
1
|
+
{"version":3,"file":"createClient.d.ts","sourceRoot":"","sources":["../../../src/client/api/createClient.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAc,MAAM,0BAA0B,CAAC;AAsBnE;;;;;;;;;;;;;;;KAeK;AACL,eAAO,MAAM,YAAY,WACf,MAAM,cACH,CAAA,kBAAkB,EAAC,MAAM,kBAAkB,CAAC;;;;;;;;MAYtD,MAAM,MAwFR,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ```js
|
|
3
|
+
* import { fetchLinkPreview } from '@amityco/ts-sdk'
|
|
4
|
+
* const { title, description, imageUrl } = fetchLinkPreview('https://www.example.com/')
|
|
5
|
+
* ```
|
|
6
|
+
*
|
|
7
|
+
*
|
|
8
|
+
* @param url the url to fetch link preview
|
|
9
|
+
* @returns A {@link Amity.LinkPreview} instance
|
|
10
|
+
*
|
|
11
|
+
* @category Client API
|
|
12
|
+
* */
|
|
13
|
+
export declare const fetchLinkPreview: (url: string) => Promise<Amity.LinkPreview>;
|
|
14
|
+
//# sourceMappingURL=fetchLinkPreview.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fetchLinkPreview.d.ts","sourceRoot":"","sources":["../../../src/client/api/fetchLinkPreview.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;KAWK;AAEL,eAAO,MAAM,gBAAgB,QAAe,MAAM,KAAG,QAAQ,MAAM,WAAW,CAc7E,CAAC"}
|
|
@@ -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,6BAA6B,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,6BAA6B,CAAC;AAE5C,cAAc,oBAAoB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/model/index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAEhC;;;GAGG;AACH,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,KAAK,CAAC,MAAM,CA+CtD,CAAC;AAEF,aAAa;AACb,eAAO,MAAM,UAAU,2DAA0D,OAMhF,CAAC;AAEF,aAAa;AACb,wBAAgB,aAAa,CAAC,IAAI,GAAE,MAAM,GAAG,SAAoC,GAAG,MAAM,CAEzF;AAED,aAAa;AACb,wBAAgB,WAAW,CAAC,IAAI,GAAE,MAAM,GAAG,SAAoC,GAAG,MAAM,CAEvF"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -102,8 +102,8 @@ const PostContentType = Object.freeze({
|
|
|
102
102
|
|
|
103
103
|
function getVersion() {
|
|
104
104
|
try {
|
|
105
|
-
// the string ''v7.0.
|
|
106
|
-
return 'v7.0.
|
|
105
|
+
// the string ''v7.0.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
106
|
+
return 'v7.0.1-cjs';
|
|
107
107
|
}
|
|
108
108
|
catch (error) {
|
|
109
109
|
return '__dev__';
|
|
@@ -551,18 +551,6 @@ const idResolvers = {
|
|
|
551
551
|
*/
|
|
552
552
|
const getResolver = (name) => idResolvers[name];
|
|
553
553
|
|
|
554
|
-
/*
|
|
555
|
-
* To check if an id is a local referenceId, the id must start with 'LOCAL_'.
|
|
556
|
-
*
|
|
557
|
-
* Example: LOCAL_155f5158-281a-4a9d-a445-9243138d2041
|
|
558
|
-
*
|
|
559
|
-
* @param id as string
|
|
560
|
-
* @returns true if the id is a local referenceId, false otherwise
|
|
561
|
-
*/
|
|
562
|
-
const isLocalId = (id) => {
|
|
563
|
-
return id.startsWith('LOCAL_');
|
|
564
|
-
};
|
|
565
|
-
|
|
566
554
|
/**
|
|
567
555
|
* A map of v3 response keys to a store name.
|
|
568
556
|
* @hidden
|
|
@@ -4962,12 +4950,14 @@ class AnalyticsEventCapturer {
|
|
|
4962
4950
|
}
|
|
4963
4951
|
isAbleToEnqueue({ uniqueId, expireTime, isHighPriority = false, }) {
|
|
4964
4952
|
const now = new Date();
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4953
|
+
// Get the recent view date (if any)
|
|
4954
|
+
const recentViewedDate = isHighPriority
|
|
4955
|
+
? this._recentHighPriorityViewed[uniqueId]
|
|
4956
|
+
: this._recentViewed[uniqueId];
|
|
4957
|
+
// If this is the first view, always allow it
|
|
4958
|
+
if (!recentViewedDate) {
|
|
4959
|
+
return true;
|
|
4960
|
+
}
|
|
4971
4961
|
const timeDiff = now.getTime() - recentViewedDate.getTime();
|
|
4972
4962
|
if (timeDiff < expireTime) {
|
|
4973
4963
|
// just recently view this post, ignore the event.
|
|
@@ -6417,26 +6407,20 @@ function convertFromRaw$2(_a) {
|
|
|
6417
6407
|
} }, rest), { channelId: channelPublicId, creatorId: creatorPublicId, displayName: name, lastActivity: lastMessageTimestamp, latestMessageId: lastMessageId, messageCount: childCount, subChannelId: messageFeedId, isUnreadCountSupport: isUnreadCountSupport$2({ channelType }) });
|
|
6418
6408
|
}
|
|
6419
6409
|
|
|
6420
|
-
const
|
|
6421
|
-
|
|
6422
|
-
const {
|
|
6423
|
-
|
|
6424
|
-
|
|
6425
|
-
|
|
6426
|
-
|
|
6427
|
-
|
|
6428
|
-
|
|
6429
|
-
*
|
|
6430
|
-
* The referenceId is undefined means this message is not a local created message (optimistic creation message).
|
|
6431
|
-
*/
|
|
6432
|
-
referenceId: isLocalId(payload.messageId)
|
|
6433
|
-
? payload.messageId
|
|
6434
|
-
: objectSyncMap.get(payload.messageId) });
|
|
6410
|
+
const mergePayloadWithLocal = (payload) => {
|
|
6411
|
+
var _a, _b, _c;
|
|
6412
|
+
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;
|
|
6413
|
+
if (localMessage) {
|
|
6414
|
+
return Object.assign(Object.assign(Object.assign({}, localMessage), payload), {
|
|
6415
|
+
// NOTE: referenceId is missing in the some payload event. If we have local message data with referenceId, use it instead.
|
|
6416
|
+
referenceId: (_c = localMessage.referenceId) !== null && _c !== void 0 ? _c : payload.referenceId });
|
|
6417
|
+
}
|
|
6418
|
+
return payload;
|
|
6435
6419
|
};
|
|
6436
6420
|
function convertFromRaw$1(message, reactors, event) {
|
|
6437
6421
|
var _a;
|
|
6438
|
-
const
|
|
6439
|
-
const { channelPublicId, childCount, creatorPublicId, mentionedUsers, messageFeedId, myReactions, reactionCount, reactions, referenceId, segment, messageId, creatorId } =
|
|
6422
|
+
const mergeMessage = mergePayloadWithLocal(message);
|
|
6423
|
+
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"]);
|
|
6440
6424
|
let cache;
|
|
6441
6425
|
if (referenceId) {
|
|
6442
6426
|
cache = pullFromCache(['message', 'get', referenceId]);
|
|
@@ -8594,42 +8578,6 @@ const updateSubChannelUnreadFromMessage = (message) => {
|
|
|
8594
8578
|
pushToCache(cacheKeyUnreadCount, updatedCachedUnreadCount);
|
|
8595
8579
|
};
|
|
8596
8580
|
|
|
8597
|
-
/*
|
|
8598
|
-
* To get message identifier ids used as a cache key for the each message.
|
|
8599
|
-
* These ids are used to store in the query stream and use to get messages from cache.
|
|
8600
|
-
*
|
|
8601
|
-
* The query stream data keeps the message identifier ids as follows:
|
|
8602
|
-
* ['server_message_id_1', 'server_message_id_2', 'LOCAL_message_id_1', 'LOCAL_message_id_2']
|
|
8603
|
-
*
|
|
8604
|
-
* Example use case: Message created locally and then created on the server.
|
|
8605
|
-
*
|
|
8606
|
-
* 1. Message created locally has `LOCAL_message_id_2` as referenceId.
|
|
8607
|
-
* 2. The `message.created` event will be fired from server with message payload that has no the referenceId.
|
|
8608
|
-
* 3. SDK use this function to find indentifer id for each message in the payload. If the message is created locally, the identifier id will be the local reference id.
|
|
8609
|
-
* 4. The SDK use this identifier ids to check if the message is already in the query stream before appending it.
|
|
8610
|
-
*
|
|
8611
|
-
* @param The raw message payload from server response
|
|
8612
|
-
* @returns The identifier ids of the messages
|
|
8613
|
-
*/
|
|
8614
|
-
function getMessageIdentifierIds(messages) {
|
|
8615
|
-
const client = getActiveClient();
|
|
8616
|
-
const { objectSyncMap } = client;
|
|
8617
|
-
return messages
|
|
8618
|
-
.map(message => {
|
|
8619
|
-
var _a;
|
|
8620
|
-
/* NOTE: This logic is used to get identifier id for each message.
|
|
8621
|
-
*
|
|
8622
|
-
* if messageId is a local id, use it as identifier id else get identifier id from objectSyncMap.
|
|
8623
|
-
* if find referenceId in objectSyncMap, this means this message is a local created message. The identifier id will be local message id.
|
|
8624
|
-
* if cannot find identifier id in objectSyncMap, this means this message is not a local created message. The identifier id will be server message id.
|
|
8625
|
-
*/
|
|
8626
|
-
if (isLocalId(message.messageId))
|
|
8627
|
-
return message.messageId;
|
|
8628
|
-
return (_a = objectSyncMap.get(message.messageId)) !== null && _a !== void 0 ? _a : message.messageId;
|
|
8629
|
-
})
|
|
8630
|
-
.filter(Boolean);
|
|
8631
|
-
}
|
|
8632
|
-
|
|
8633
8581
|
/**
|
|
8634
8582
|
* ```js
|
|
8635
8583
|
* import { onMessageCreated } from '@amityco/ts-sdk'
|
|
@@ -9329,7 +9277,6 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
9329
9277
|
const sessionState = "notLoggedIn" /* Amity.SessionStates.NOT_LOGGED_IN */;
|
|
9330
9278
|
const sessionHandler = undefined;
|
|
9331
9279
|
const isUnreadCountEnabled = false;
|
|
9332
|
-
const objectSyncMap = new Map();
|
|
9333
9280
|
const client = {
|
|
9334
9281
|
version: `${VERSION}`,
|
|
9335
9282
|
apiKey,
|
|
@@ -9365,29 +9312,6 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
9365
9312
|
* This is allow user to have multiple SDK client and Mqtt client within the same app.
|
|
9366
9313
|
*/
|
|
9367
9314
|
prefixDeviceIdKey,
|
|
9368
|
-
/*
|
|
9369
|
-
* The objectSyncMap is used to keep the map between local referenceId and server id in two ways mapping.
|
|
9370
|
-
*
|
|
9371
|
-
* For objects created locally (optimistic creation), the SDK stores them with their local ID as the cache key, which is used throughout the entire SDK session (in-memory) for syncing updates.
|
|
9372
|
-
* If the payload or response only contains the remote ID of the same object, the SDK will look up the corresponding local ID to retrieve the object through ObjectSyncMap.
|
|
9373
|
-
*
|
|
9374
|
-
* This is useful for syncing updates to the object, as the SDK can find the local ID from the server ID and update the object in the cache correctly.
|
|
9375
|
-
*
|
|
9376
|
-
* Example:
|
|
9377
|
-
* In the case of message optimistically creation. The referenceId is created locally.
|
|
9378
|
-
*
|
|
9379
|
-
* 1. When creating a message optimistically, a local referenceId is created. The objectSyncMap will have the following structure.
|
|
9380
|
-
* {
|
|
9381
|
-
* "LOCAL_uuid": undefined,
|
|
9382
|
-
* }
|
|
9383
|
-
*
|
|
9384
|
-
* 2. After the message was created on the server and SDK received the response from server, the objectSyncMap will be updated to
|
|
9385
|
-
* {
|
|
9386
|
-
* "LOCAL_uuid": "server_message_id",
|
|
9387
|
-
* "server_message_id": "LOCAL_uuid"
|
|
9388
|
-
* }
|
|
9389
|
-
*/
|
|
9390
|
-
objectSyncMap,
|
|
9391
9315
|
};
|
|
9392
9316
|
try {
|
|
9393
9317
|
const activeClient = getActiveClient();
|
|
@@ -9478,6 +9402,28 @@ function setUploadedFileAccessType(accessType) {
|
|
|
9478
9402
|
GlobalFileAccessType$1.getInstance().setFileAccessType(accessType);
|
|
9479
9403
|
}
|
|
9480
9404
|
|
|
9405
|
+
/**
|
|
9406
|
+
* ```js
|
|
9407
|
+
* import { fetchLinkPreview } from '@amityco/ts-sdk'
|
|
9408
|
+
* const { title, description, imageUrl } = fetchLinkPreview('https://www.example.com/')
|
|
9409
|
+
* ```
|
|
9410
|
+
*
|
|
9411
|
+
*
|
|
9412
|
+
* @param url the url to fetch link preview
|
|
9413
|
+
* @returns A {@link Amity.LinkPreview} instance
|
|
9414
|
+
*
|
|
9415
|
+
* @category Client API
|
|
9416
|
+
* */
|
|
9417
|
+
const fetchLinkPreview = async (url) => {
|
|
9418
|
+
const client = getActiveClient();
|
|
9419
|
+
let fetchUrl = url;
|
|
9420
|
+
if (!/^https?:\/\//i.test(url)) {
|
|
9421
|
+
fetchUrl = `https://${url}`;
|
|
9422
|
+
}
|
|
9423
|
+
const { data } = await client.http.get(`/api/v1/link-preview?url=${encodeURIComponent(fetchUrl)}`);
|
|
9424
|
+
return data;
|
|
9425
|
+
};
|
|
9426
|
+
|
|
9481
9427
|
/**
|
|
9482
9428
|
* ```js
|
|
9483
9429
|
* import { onChannelMarkerFetched } from '@amityco/ts-sdk'
|
|
@@ -9845,6 +9791,7 @@ var index$l = /*#__PURE__*/Object.freeze({
|
|
|
9845
9791
|
markerSync: markerSync,
|
|
9846
9792
|
enableUnreadCount: enableUnreadCount,
|
|
9847
9793
|
setUploadedFileAccessType: setUploadedFileAccessType,
|
|
9794
|
+
fetchLinkPreview: fetchLinkPreview,
|
|
9848
9795
|
onConnectionError: onConnectionError,
|
|
9849
9796
|
onClientDisconnected: onClientDisconnected,
|
|
9850
9797
|
onClientBanned: onClientBanned,
|
|
@@ -11674,24 +11621,12 @@ function prepareBlockedUserPayload(response) {
|
|
|
11674
11621
|
}
|
|
11675
11622
|
|
|
11676
11623
|
const convertEventPayload = (eventHandler, sourceModelProp, destinationDomain) => (callback) => eventHandler(sourceModel => {
|
|
11677
|
-
var _a
|
|
11624
|
+
var _a;
|
|
11678
11625
|
if (!sourceModel) {
|
|
11679
11626
|
return sourceModel;
|
|
11680
11627
|
}
|
|
11681
|
-
const
|
|
11682
|
-
const
|
|
11683
|
-
/*
|
|
11684
|
-
* NOTE: For objects created locally (optimistic creation), the SDK stores them with their local ID as the cache key, which is used throughout the entire SDK session (in-memory) for syncing updates.
|
|
11685
|
-
* If the payload or response only contains the remote ID of the same object, the SDK will look up the corresponding local ID to retrieve the object.
|
|
11686
|
-
*/
|
|
11687
|
-
const resolvedId = isLocalId(sourceModel[sourceModelProp])
|
|
11688
|
-
? sourceModel[sourceModelProp]
|
|
11689
|
-
: (_a = objectSyncMap.get(sourceModel[sourceModelProp])) !== null && _a !== void 0 ? _a : sourceModel[sourceModelProp];
|
|
11690
|
-
const model = (_b = pullFromCache([
|
|
11691
|
-
destinationDomain,
|
|
11692
|
-
'get',
|
|
11693
|
-
`${resolvedId}`,
|
|
11694
|
-
])) === null || _b === void 0 ? void 0 : _b.data;
|
|
11628
|
+
const cacheKey = [destinationDomain, 'get', `${sourceModel[sourceModelProp]}`];
|
|
11629
|
+
const model = (_a = pullFromCache(cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
11695
11630
|
if (!model)
|
|
11696
11631
|
return;
|
|
11697
11632
|
return callback(model);
|
|
@@ -14919,7 +14854,6 @@ let uniqueId;
|
|
|
14919
14854
|
const createMessageOptimistic = (bundle) => {
|
|
14920
14855
|
var _a, _b;
|
|
14921
14856
|
const client = getActiveClient();
|
|
14922
|
-
const { objectSyncMap } = client;
|
|
14923
14857
|
if (!client.cache)
|
|
14924
14858
|
return;
|
|
14925
14859
|
/*
|
|
@@ -14952,7 +14886,6 @@ const createMessageOptimistic = (bundle) => {
|
|
|
14952
14886
|
const message = Object.assign({ creatorId: client.userId, creatorPrivateId: getActiveUser()._id, channelSegment: ((_b = subChannel === null || subChannel === void 0 ? void 0 : subChannel.data.messageCount) !== null && _b !== void 0 ? _b : 0) + 1, childrenNumber: 0, createdAt: createdTime, updatedAt: createdTime, syncState: "syncing" /* Amity.SyncState.Syncing */, isDeleted: false }, bundleWithMessageId);
|
|
14953
14887
|
const cachedAt = UNSYNCED_OBJECT_CACHED_AT_VALUE;
|
|
14954
14888
|
pushToCache(['message', 'get', message.messageId], message, { cachedAt });
|
|
14955
|
-
objectSyncMap.set(message.messageId, undefined);
|
|
14956
14889
|
fireEvent('local.message.created', { messages: [message] });
|
|
14957
14890
|
return message;
|
|
14958
14891
|
};
|
|
@@ -14980,15 +14913,12 @@ const createMessageOptimistic = (bundle) => {
|
|
|
14980
14913
|
*/
|
|
14981
14914
|
const createMessage = async (bundle) => {
|
|
14982
14915
|
const client = getActiveClient();
|
|
14983
|
-
const { objectSyncMap } = client;
|
|
14984
14916
|
client.log('message/createMessage', bundle);
|
|
14985
14917
|
const optimisticData = createMessageOptimistic(bundle);
|
|
14986
14918
|
const referenceId = bundle.referenceId || uniqueId || getLocalId();
|
|
14987
14919
|
uniqueId = undefined;
|
|
14988
14920
|
try {
|
|
14989
14921
|
const { data: payload } = await client.http.post('/api/v5/messages', Object.assign(Object.assign({}, convertParams(bundle)), { referenceId }));
|
|
14990
|
-
objectSyncMap.set(referenceId, payload.messages[0].messageId);
|
|
14991
|
-
objectSyncMap.set(payload.messages[0].messageId, referenceId);
|
|
14992
14922
|
const data = await prepareMessagePayload(payload);
|
|
14993
14923
|
const { messages } = data;
|
|
14994
14924
|
const cachedAt = client.cache && Date.now();
|
|
@@ -15743,7 +15673,7 @@ class MessageQueryStreamController extends QueryStreamController {
|
|
|
15743
15673
|
var _a, _b;
|
|
15744
15674
|
if (refresh) {
|
|
15745
15675
|
pushToCache(this.cacheKey, {
|
|
15746
|
-
data:
|
|
15676
|
+
data: response.messages.map(getResolver('message')),
|
|
15747
15677
|
query: this.query,
|
|
15748
15678
|
});
|
|
15749
15679
|
}
|
|
@@ -15751,8 +15681,8 @@ class MessageQueryStreamController extends QueryStreamController {
|
|
|
15751
15681
|
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
15752
15682
|
const messages = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
15753
15683
|
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: direction === 'next'
|
|
15754
|
-
? [...new Set([...messages, ...
|
|
15755
|
-
: [...new Set([...
|
|
15684
|
+
? [...new Set([...messages, ...response.messages.map(getResolver('message'))])]
|
|
15685
|
+
: [...new Set([...response.messages.map(getResolver('message')), ...messages])] }));
|
|
15756
15686
|
}
|
|
15757
15687
|
}
|
|
15758
15688
|
reactor(action) {
|
|
@@ -15819,12 +15749,11 @@ class MessagePaginationController extends PaginationController {
|
|
|
15819
15749
|
|
|
15820
15750
|
const getMessageFromMainDB = (messageId) => {
|
|
15821
15751
|
var _a, _b;
|
|
15822
|
-
const
|
|
15823
|
-
|
|
15824
|
-
|
|
15825
|
-
|
|
15826
|
-
|
|
15827
|
-
return (_b = pullFromCache(['message', 'get', resolvedMessageId])) === null || _b === void 0 ? void 0 : _b.data;
|
|
15752
|
+
const message = (_a = pullFromCache(['message', 'get', messageId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
15753
|
+
if (message)
|
|
15754
|
+
return message;
|
|
15755
|
+
const messages = queryCache(['message', 'get']);
|
|
15756
|
+
return (_b = messages === null || messages === void 0 ? void 0 : messages.find(({ data }) => data.messageId === messageId)) === null || _b === void 0 ? void 0 : _b.data;
|
|
15828
15757
|
};
|
|
15829
15758
|
|
|
15830
15759
|
class MessageLiveCollectionController extends LiveCollectionController {
|
|
@@ -15985,8 +15914,7 @@ var index$g = /*#__PURE__*/Object.freeze({
|
|
|
15985
15914
|
convertFromRaw: convertFromRaw$1,
|
|
15986
15915
|
prepareMessagePayload: prepareMessagePayload,
|
|
15987
15916
|
convertParams: convertParams,
|
|
15988
|
-
convertQueryParams: convertQueryParams$1
|
|
15989
|
-
getMessageIdentifierIds: getMessageIdentifierIds
|
|
15917
|
+
convertQueryParams: convertQueryParams$1
|
|
15990
15918
|
});
|
|
15991
15919
|
|
|
15992
15920
|
/**
|