@select-org/select-post-builder 1.1.34 → 1.1.35
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/index.d.ts +2 -22
- package/dist/post-builder.cjs.js +52 -73
- package/dist/post-builder.js +52 -73
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -4,13 +4,11 @@ import { JSX as JSX_2 } from 'react/jsx-runtime';
|
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
5
|
|
|
6
6
|
declare type AppUserPayload = {
|
|
7
|
-
users: Array<UserPayload>;
|
|
8
7
|
background: string;
|
|
9
8
|
username: string;
|
|
10
9
|
relationship: 2;
|
|
11
10
|
refresh_token: string;
|
|
12
11
|
name: string;
|
|
13
|
-
new_user: boolean;
|
|
14
12
|
longitude: number;
|
|
15
13
|
latitude: number;
|
|
16
14
|
jwtoken: string;
|
|
@@ -20,11 +18,10 @@ declare type AppUserPayload = {
|
|
|
20
18
|
avatar: string;
|
|
21
19
|
avatarPlaceholder: string;
|
|
22
20
|
highResolutionAvatar: string;
|
|
23
|
-
twitterUsername: string;
|
|
24
|
-
email: string;
|
|
25
21
|
description: string;
|
|
26
|
-
email_verified: boolean;
|
|
27
22
|
featured_groups: string[];
|
|
23
|
+
new_user?: boolean;
|
|
24
|
+
email?: string;
|
|
28
25
|
};
|
|
29
26
|
|
|
30
27
|
declare type BasePollOptionItem = {
|
|
@@ -253,23 +250,6 @@ declare enum SpecialType {
|
|
|
253
250
|
FEATURED_POST = 1
|
|
254
251
|
}
|
|
255
252
|
|
|
256
|
-
declare type UserPayload = {
|
|
257
|
-
id: string;
|
|
258
|
-
username: string;
|
|
259
|
-
name: string;
|
|
260
|
-
avatar: string;
|
|
261
|
-
avatarPlaceholder: string;
|
|
262
|
-
highResolutionAvatar: string;
|
|
263
|
-
gender: string;
|
|
264
|
-
birthday: string;
|
|
265
|
-
description?: string;
|
|
266
|
-
type?: string;
|
|
267
|
-
latitude?: number;
|
|
268
|
-
longitude?: number;
|
|
269
|
-
relationship?: number;
|
|
270
|
-
interactionIds?: Array<string>;
|
|
271
|
-
};
|
|
272
|
-
|
|
273
253
|
declare type WithModalProps = BaseProps & {
|
|
274
254
|
openModal: boolean;
|
|
275
255
|
onModalOpenChange: (open: boolean) => void;
|
package/dist/post-builder.cjs.js
CHANGED
|
@@ -2506,6 +2506,11 @@ const {
|
|
|
2506
2506
|
getAdapter,
|
|
2507
2507
|
mergeConfig
|
|
2508
2508
|
} = axios;
|
|
2509
|
+
var ConversationType = /* @__PURE__ */ ((ConversationType2) => {
|
|
2510
|
+
ConversationType2[ConversationType2["GROUP"] = 0] = "GROUP";
|
|
2511
|
+
ConversationType2[ConversationType2["USER"] = 1] = "USER";
|
|
2512
|
+
return ConversationType2;
|
|
2513
|
+
})(ConversationType || {});
|
|
2509
2514
|
var PostType = /* @__PURE__ */ ((PostType2) => {
|
|
2510
2515
|
PostType2["Post"] = "post";
|
|
2511
2516
|
PostType2["Comment"] = "comment";
|
|
@@ -4189,10 +4194,12 @@ const asyncCache = (key, fetcher) => {
|
|
|
4189
4194
|
};
|
|
4190
4195
|
class CoreApi {
|
|
4191
4196
|
isAuthorize;
|
|
4197
|
+
baseUrl;
|
|
4192
4198
|
url;
|
|
4193
4199
|
language;
|
|
4194
4200
|
onError;
|
|
4195
4201
|
api;
|
|
4202
|
+
apiV2;
|
|
4196
4203
|
token;
|
|
4197
4204
|
toI18N;
|
|
4198
4205
|
/**
|
|
@@ -4203,13 +4210,14 @@ class CoreApi {
|
|
|
4203
4210
|
*/
|
|
4204
4211
|
constructor(coreUrl, token, toI18N, language) {
|
|
4205
4212
|
this.isAuthorize = false;
|
|
4213
|
+
this.baseUrl = coreUrl;
|
|
4206
4214
|
this.url = `${coreUrl}v1/`;
|
|
4207
4215
|
this.language = language ?? getLanguage();
|
|
4208
4216
|
this.onError = () => {
|
|
4209
4217
|
};
|
|
4210
4218
|
this.toI18N = toI18N;
|
|
4211
|
-
this.initApi();
|
|
4212
4219
|
this.token = token;
|
|
4220
|
+
this.initApi();
|
|
4213
4221
|
}
|
|
4214
4222
|
/**
|
|
4215
4223
|
* Set the 'Authorization' header
|
|
@@ -4246,6 +4254,12 @@ class CoreApi {
|
|
|
4246
4254
|
token: this.token,
|
|
4247
4255
|
isFileStore: false
|
|
4248
4256
|
});
|
|
4257
|
+
this.apiV2 = createApiClient({
|
|
4258
|
+
baseURL: `${this.baseUrl}v2/`,
|
|
4259
|
+
t: this.toI18N,
|
|
4260
|
+
token: this.token,
|
|
4261
|
+
isFileStore: false
|
|
4262
|
+
});
|
|
4249
4263
|
}
|
|
4250
4264
|
getErrorMessage(response) {
|
|
4251
4265
|
if (response && response.response && response.response.data && response.response.data.error) {
|
|
@@ -4257,26 +4271,19 @@ class CoreApi {
|
|
|
4257
4271
|
return null;
|
|
4258
4272
|
}
|
|
4259
4273
|
/**
|
|
4260
|
-
* get
|
|
4274
|
+
* get conversations sorted by last activity
|
|
4261
4275
|
*/
|
|
4262
|
-
|
|
4263
|
-
|
|
4264
|
-
return response.data;
|
|
4265
|
-
}).catch((response) => {
|
|
4266
|
-
throw this.throwHTTPError(response);
|
|
4267
|
-
});
|
|
4268
|
-
}
|
|
4269
|
-
/**
|
|
4270
|
-
* get group conversations sorted by last activity
|
|
4271
|
-
*/
|
|
4272
|
-
fetchGroupConversations(amount, fromTime) {
|
|
4273
|
-
const cacheKey = `group-conversations`;
|
|
4276
|
+
fetchConversationList(amount, fromTime) {
|
|
4277
|
+
const cacheKey = `conversation-list`;
|
|
4274
4278
|
const cachedFetcher = asyncCache(
|
|
4275
4279
|
cacheKey,
|
|
4276
|
-
() => this.
|
|
4277
|
-
amount
|
|
4278
|
-
|
|
4279
|
-
|
|
4280
|
+
() => this.apiV2.get("conversation/list", {
|
|
4281
|
+
params: { from_time: fromTime, amount }
|
|
4282
|
+
}).then(
|
|
4283
|
+
(response) => response?.data?.filter(
|
|
4284
|
+
(data) => data?.conversation_detail?.type === ConversationType.GROUP
|
|
4285
|
+
)
|
|
4286
|
+
).catch((response) => {
|
|
4280
4287
|
throw this.throwHTTPError(response);
|
|
4281
4288
|
})
|
|
4282
4289
|
);
|
|
@@ -4323,25 +4330,6 @@ class CoreApi {
|
|
|
4323
4330
|
l: limit,
|
|
4324
4331
|
o: offset2,
|
|
4325
4332
|
in_china: isUsingChineseProvider
|
|
4326
|
-
// || stringContainsChineseCharacter(query),
|
|
4327
|
-
}
|
|
4328
|
-
}).then((response) => {
|
|
4329
|
-
return response.data;
|
|
4330
|
-
}).catch((response) => {
|
|
4331
|
-
throw this.throwHTTPError(response);
|
|
4332
|
-
});
|
|
4333
|
-
}
|
|
4334
|
-
/**
|
|
4335
|
-
* Get random GIF based on q parameter via a GET request into the backend
|
|
4336
|
-
*
|
|
4337
|
-
* @param {string} query
|
|
4338
|
-
* @returns {Promise<WebImageSearchResponse>}
|
|
4339
|
-
* @memberof CoreApi
|
|
4340
|
-
*/
|
|
4341
|
-
fetchRandomGif(query) {
|
|
4342
|
-
return this.api.get("search/gifs/random", {
|
|
4343
|
-
params: {
|
|
4344
|
-
q: query
|
|
4345
4333
|
}
|
|
4346
4334
|
}).then((response) => {
|
|
4347
4335
|
return response.data;
|
|
@@ -4375,7 +4363,7 @@ class CoreApi {
|
|
|
4375
4363
|
});
|
|
4376
4364
|
}
|
|
4377
4365
|
/**
|
|
4378
|
-
* Fetch
|
|
4366
|
+
* Fetch metadata from url
|
|
4379
4367
|
*/
|
|
4380
4368
|
resolveUrl(url) {
|
|
4381
4369
|
const cacheKey = url;
|
|
@@ -4391,15 +4379,6 @@ class CoreApi {
|
|
|
4391
4379
|
);
|
|
4392
4380
|
return cachedFetcher();
|
|
4393
4381
|
}
|
|
4394
|
-
resolveUrlForText(body) {
|
|
4395
|
-
return this.api.post("url/resolve-text", {
|
|
4396
|
-
body
|
|
4397
|
-
}).then((response) => {
|
|
4398
|
-
return response.data;
|
|
4399
|
-
}).catch((response) => {
|
|
4400
|
-
throw this.throwHTTPError(response);
|
|
4401
|
-
});
|
|
4402
|
-
}
|
|
4403
4382
|
}
|
|
4404
4383
|
const byteToHex = [];
|
|
4405
4384
|
for (let i2 = 0; i2 < 256; ++i2) {
|
|
@@ -4572,11 +4551,11 @@ class MFSApi {
|
|
|
4572
4551
|
isFileStore: false
|
|
4573
4552
|
});
|
|
4574
4553
|
}
|
|
4575
|
-
getRecommendationPost(groupId, postId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["
|
|
4554
|
+
getRecommendationPost(groupId, postId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["user_details", "post_counter"]) {
|
|
4576
4555
|
const cacheKey = `post-recommendation:${groupId}${postId ? `:${postId}` : ``}`;
|
|
4577
4556
|
const cachedFetcher = asyncCache(
|
|
4578
4557
|
cacheKey,
|
|
4579
|
-
() => this.api.post("/recommendation/post", {
|
|
4558
|
+
() => this.api.post("v2/recommendation/post", {
|
|
4580
4559
|
group_id: groupId,
|
|
4581
4560
|
post_id: postId,
|
|
4582
4561
|
included_user_ids: includedUserIds,
|
|
@@ -4594,11 +4573,11 @@ class MFSApi {
|
|
|
4594
4573
|
);
|
|
4595
4574
|
return cachedFetcher();
|
|
4596
4575
|
}
|
|
4597
|
-
getRecommendationGroup(groupId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["
|
|
4576
|
+
getRecommendationGroup(groupId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["user_details"]) {
|
|
4598
4577
|
const cacheKey = `group-recommendation:${groupId}`;
|
|
4599
4578
|
const cachedFetcher = asyncCache(
|
|
4600
4579
|
cacheKey,
|
|
4601
|
-
() => this.api.post("/recommendation/group", {
|
|
4580
|
+
() => this.api.post("v2/recommendation/group", {
|
|
4602
4581
|
group_id: groupId,
|
|
4603
4582
|
included_user_ids: includedUserIds,
|
|
4604
4583
|
excluded_user_ids: excludedUserIds,
|
|
@@ -16370,9 +16349,9 @@ const GroupSelector = ({ store, onGroupSelect }) => {
|
|
|
16370
16349
|
const loadGroups = async () => {
|
|
16371
16350
|
setIsLoading(true);
|
|
16372
16351
|
try {
|
|
16373
|
-
const response = await core2.
|
|
16352
|
+
const response = await core2.fetchConversationList(999, 0);
|
|
16374
16353
|
if (!cancelled) {
|
|
16375
|
-
setGroups(response
|
|
16354
|
+
setGroups(response ?? []);
|
|
16376
16355
|
}
|
|
16377
16356
|
} catch (error) {
|
|
16378
16357
|
} finally {
|
|
@@ -16407,13 +16386,13 @@ const GroupSelector = ({ store, onGroupSelect }) => {
|
|
|
16407
16386
|
)
|
|
16408
16387
|
}
|
|
16409
16388
|
),
|
|
16410
|
-
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { align: "start", children: groups.map((
|
|
16389
|
+
/* @__PURE__ */ jsxRuntime.jsx(SelectContent, { align: "start", children: groups.map((conversation) => /* @__PURE__ */ jsxRuntime.jsxs(SelectItem, { value: conversation.conversation_id, children: [
|
|
16411
16390
|
/* @__PURE__ */ jsxRuntime.jsxs(Avatar, { className: "size-6", children: [
|
|
16412
|
-
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src:
|
|
16413
|
-
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children:
|
|
16391
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarImage, { src: conversation.conversation_detail.avatar ?? void 0 }),
|
|
16392
|
+
/* @__PURE__ */ jsxRuntime.jsx(AvatarFallback, { children: conversation.conversation_detail.name?.charAt(0) })
|
|
16414
16393
|
] }),
|
|
16415
|
-
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children:
|
|
16416
|
-
] },
|
|
16394
|
+
/* @__PURE__ */ jsxRuntime.jsx("span", { className: "text-sm", children: conversation.conversation_detail.name ?? conversation.conversation_id })
|
|
16395
|
+
] }, conversation.conversation_id)) })
|
|
16417
16396
|
] }) });
|
|
16418
16397
|
};
|
|
16419
16398
|
const GifIcon = (props) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -32502,14 +32481,14 @@ const mentionService = (api, mfs, store, user) => {
|
|
|
32502
32481
|
}
|
|
32503
32482
|
const { groupId, postId } = params;
|
|
32504
32483
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
32505
|
-
const apiResults = response.entries?.filter((item) => Boolean(item?.
|
|
32484
|
+
const apiResults = response.entries?.filter((item) => Boolean(item?.user_details))?.map(
|
|
32506
32485
|
(item) => ({
|
|
32507
|
-
id: item?.
|
|
32508
|
-
label: item?.
|
|
32509
|
-
avatar: item?.
|
|
32486
|
+
id: item?.user_details?.id,
|
|
32487
|
+
label: item?.user_details?.name,
|
|
32488
|
+
avatar: item?.user_details?.avatar,
|
|
32510
32489
|
inThisThread: 1,
|
|
32511
|
-
name: item?.
|
|
32512
|
-
selectId: item.
|
|
32490
|
+
name: item?.user_details?.name,
|
|
32491
|
+
selectId: item.user_details?.username,
|
|
32513
32492
|
type: MentionType.User,
|
|
32514
32493
|
from: PostType.Post
|
|
32515
32494
|
})
|
|
@@ -32536,18 +32515,18 @@ const mentionService = (api, mfs, store, user) => {
|
|
|
32536
32515
|
if (!activeGroupId) {
|
|
32537
32516
|
return [];
|
|
32538
32517
|
}
|
|
32539
|
-
const response = await api.
|
|
32540
|
-
return response.
|
|
32541
|
-
(
|
|
32542
|
-
id:
|
|
32543
|
-
label:
|
|
32544
|
-
avatar:
|
|
32518
|
+
const response = await api.fetchConversationList(999, 0);
|
|
32519
|
+
return response.map(
|
|
32520
|
+
(conversation) => ({
|
|
32521
|
+
id: conversation?.conversation_id,
|
|
32522
|
+
label: conversation?.conversation_detail?.name,
|
|
32523
|
+
avatar: conversation?.conversation_detail?.avatar,
|
|
32545
32524
|
inThisThread: 1,
|
|
32546
|
-
name:
|
|
32547
|
-
selectId:
|
|
32525
|
+
name: conversation?.conversation_detail?.name,
|
|
32526
|
+
selectId: conversation?.conversation_detail?.select_id,
|
|
32548
32527
|
type: MentionType.Group,
|
|
32549
32528
|
from: PostType.Post,
|
|
32550
|
-
isCrossExposureEnable:
|
|
32529
|
+
isCrossExposureEnable: conversation?.conversation_detail?.allow_cross_exposure
|
|
32551
32530
|
})
|
|
32552
32531
|
);
|
|
32553
32532
|
};
|
package/dist/post-builder.js
CHANGED
|
@@ -2476,6 +2476,11 @@ const {
|
|
|
2476
2476
|
getAdapter,
|
|
2477
2477
|
mergeConfig
|
|
2478
2478
|
} = axios;
|
|
2479
|
+
var ConversationType = /* @__PURE__ */ ((ConversationType2) => {
|
|
2480
|
+
ConversationType2[ConversationType2["GROUP"] = 0] = "GROUP";
|
|
2481
|
+
ConversationType2[ConversationType2["USER"] = 1] = "USER";
|
|
2482
|
+
return ConversationType2;
|
|
2483
|
+
})(ConversationType || {});
|
|
2479
2484
|
var PostType = /* @__PURE__ */ ((PostType2) => {
|
|
2480
2485
|
PostType2["Post"] = "post";
|
|
2481
2486
|
PostType2["Comment"] = "comment";
|
|
@@ -4159,10 +4164,12 @@ const asyncCache = (key, fetcher) => {
|
|
|
4159
4164
|
};
|
|
4160
4165
|
class CoreApi {
|
|
4161
4166
|
isAuthorize;
|
|
4167
|
+
baseUrl;
|
|
4162
4168
|
url;
|
|
4163
4169
|
language;
|
|
4164
4170
|
onError;
|
|
4165
4171
|
api;
|
|
4172
|
+
apiV2;
|
|
4166
4173
|
token;
|
|
4167
4174
|
toI18N;
|
|
4168
4175
|
/**
|
|
@@ -4173,13 +4180,14 @@ class CoreApi {
|
|
|
4173
4180
|
*/
|
|
4174
4181
|
constructor(coreUrl, token, toI18N, language) {
|
|
4175
4182
|
this.isAuthorize = false;
|
|
4183
|
+
this.baseUrl = coreUrl;
|
|
4176
4184
|
this.url = `${coreUrl}v1/`;
|
|
4177
4185
|
this.language = language ?? getLanguage();
|
|
4178
4186
|
this.onError = () => {
|
|
4179
4187
|
};
|
|
4180
4188
|
this.toI18N = toI18N;
|
|
4181
|
-
this.initApi();
|
|
4182
4189
|
this.token = token;
|
|
4190
|
+
this.initApi();
|
|
4183
4191
|
}
|
|
4184
4192
|
/**
|
|
4185
4193
|
* Set the 'Authorization' header
|
|
@@ -4216,6 +4224,12 @@ class CoreApi {
|
|
|
4216
4224
|
token: this.token,
|
|
4217
4225
|
isFileStore: false
|
|
4218
4226
|
});
|
|
4227
|
+
this.apiV2 = createApiClient({
|
|
4228
|
+
baseURL: `${this.baseUrl}v2/`,
|
|
4229
|
+
t: this.toI18N,
|
|
4230
|
+
token: this.token,
|
|
4231
|
+
isFileStore: false
|
|
4232
|
+
});
|
|
4219
4233
|
}
|
|
4220
4234
|
getErrorMessage(response) {
|
|
4221
4235
|
if (response && response.response && response.response.data && response.response.data.error) {
|
|
@@ -4227,26 +4241,19 @@ class CoreApi {
|
|
|
4227
4241
|
return null;
|
|
4228
4242
|
}
|
|
4229
4243
|
/**
|
|
4230
|
-
* get
|
|
4244
|
+
* get conversations sorted by last activity
|
|
4231
4245
|
*/
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
return response.data;
|
|
4235
|
-
}).catch((response) => {
|
|
4236
|
-
throw this.throwHTTPError(response);
|
|
4237
|
-
});
|
|
4238
|
-
}
|
|
4239
|
-
/**
|
|
4240
|
-
* get group conversations sorted by last activity
|
|
4241
|
-
*/
|
|
4242
|
-
fetchGroupConversations(amount, fromTime) {
|
|
4243
|
-
const cacheKey = `group-conversations`;
|
|
4246
|
+
fetchConversationList(amount, fromTime) {
|
|
4247
|
+
const cacheKey = `conversation-list`;
|
|
4244
4248
|
const cachedFetcher = asyncCache(
|
|
4245
4249
|
cacheKey,
|
|
4246
|
-
() => this.
|
|
4247
|
-
amount
|
|
4248
|
-
|
|
4249
|
-
|
|
4250
|
+
() => this.apiV2.get("conversation/list", {
|
|
4251
|
+
params: { from_time: fromTime, amount }
|
|
4252
|
+
}).then(
|
|
4253
|
+
(response) => response?.data?.filter(
|
|
4254
|
+
(data) => data?.conversation_detail?.type === ConversationType.GROUP
|
|
4255
|
+
)
|
|
4256
|
+
).catch((response) => {
|
|
4250
4257
|
throw this.throwHTTPError(response);
|
|
4251
4258
|
})
|
|
4252
4259
|
);
|
|
@@ -4293,25 +4300,6 @@ class CoreApi {
|
|
|
4293
4300
|
l: limit,
|
|
4294
4301
|
o: offset2,
|
|
4295
4302
|
in_china: isUsingChineseProvider
|
|
4296
|
-
// || stringContainsChineseCharacter(query),
|
|
4297
|
-
}
|
|
4298
|
-
}).then((response) => {
|
|
4299
|
-
return response.data;
|
|
4300
|
-
}).catch((response) => {
|
|
4301
|
-
throw this.throwHTTPError(response);
|
|
4302
|
-
});
|
|
4303
|
-
}
|
|
4304
|
-
/**
|
|
4305
|
-
* Get random GIF based on q parameter via a GET request into the backend
|
|
4306
|
-
*
|
|
4307
|
-
* @param {string} query
|
|
4308
|
-
* @returns {Promise<WebImageSearchResponse>}
|
|
4309
|
-
* @memberof CoreApi
|
|
4310
|
-
*/
|
|
4311
|
-
fetchRandomGif(query) {
|
|
4312
|
-
return this.api.get("search/gifs/random", {
|
|
4313
|
-
params: {
|
|
4314
|
-
q: query
|
|
4315
4303
|
}
|
|
4316
4304
|
}).then((response) => {
|
|
4317
4305
|
return response.data;
|
|
@@ -4345,7 +4333,7 @@ class CoreApi {
|
|
|
4345
4333
|
});
|
|
4346
4334
|
}
|
|
4347
4335
|
/**
|
|
4348
|
-
* Fetch
|
|
4336
|
+
* Fetch metadata from url
|
|
4349
4337
|
*/
|
|
4350
4338
|
resolveUrl(url) {
|
|
4351
4339
|
const cacheKey = url;
|
|
@@ -4361,15 +4349,6 @@ class CoreApi {
|
|
|
4361
4349
|
);
|
|
4362
4350
|
return cachedFetcher();
|
|
4363
4351
|
}
|
|
4364
|
-
resolveUrlForText(body) {
|
|
4365
|
-
return this.api.post("url/resolve-text", {
|
|
4366
|
-
body
|
|
4367
|
-
}).then((response) => {
|
|
4368
|
-
return response.data;
|
|
4369
|
-
}).catch((response) => {
|
|
4370
|
-
throw this.throwHTTPError(response);
|
|
4371
|
-
});
|
|
4372
|
-
}
|
|
4373
4352
|
}
|
|
4374
4353
|
const byteToHex = [];
|
|
4375
4354
|
for (let i2 = 0; i2 < 256; ++i2) {
|
|
@@ -4542,11 +4521,11 @@ class MFSApi {
|
|
|
4542
4521
|
isFileStore: false
|
|
4543
4522
|
});
|
|
4544
4523
|
}
|
|
4545
|
-
getRecommendationPost(groupId, postId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["
|
|
4524
|
+
getRecommendationPost(groupId, postId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["user_details", "post_counter"]) {
|
|
4546
4525
|
const cacheKey = `post-recommendation:${groupId}${postId ? `:${postId}` : ``}`;
|
|
4547
4526
|
const cachedFetcher = asyncCache(
|
|
4548
4527
|
cacheKey,
|
|
4549
|
-
() => this.api.post("/recommendation/post", {
|
|
4528
|
+
() => this.api.post("v2/recommendation/post", {
|
|
4550
4529
|
group_id: groupId,
|
|
4551
4530
|
post_id: postId,
|
|
4552
4531
|
included_user_ids: includedUserIds,
|
|
@@ -4564,11 +4543,11 @@ class MFSApi {
|
|
|
4564
4543
|
);
|
|
4565
4544
|
return cachedFetcher();
|
|
4566
4545
|
}
|
|
4567
|
-
getRecommendationGroup(groupId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["
|
|
4546
|
+
getRecommendationGroup(groupId, offset2 = 0, amount = 10, excludedUserIds = [], includedUserIds = [], keyword = "", scope = ["user_details"]) {
|
|
4568
4547
|
const cacheKey = `group-recommendation:${groupId}`;
|
|
4569
4548
|
const cachedFetcher = asyncCache(
|
|
4570
4549
|
cacheKey,
|
|
4571
|
-
() => this.api.post("/recommendation/group", {
|
|
4550
|
+
() => this.api.post("v2/recommendation/group", {
|
|
4572
4551
|
group_id: groupId,
|
|
4573
4552
|
included_user_ids: includedUserIds,
|
|
4574
4553
|
excluded_user_ids: excludedUserIds,
|
|
@@ -16340,9 +16319,9 @@ const GroupSelector = ({ store, onGroupSelect }) => {
|
|
|
16340
16319
|
const loadGroups = async () => {
|
|
16341
16320
|
setIsLoading(true);
|
|
16342
16321
|
try {
|
|
16343
|
-
const response = await core.
|
|
16322
|
+
const response = await core.fetchConversationList(999, 0);
|
|
16344
16323
|
if (!cancelled) {
|
|
16345
|
-
setGroups(response
|
|
16324
|
+
setGroups(response ?? []);
|
|
16346
16325
|
}
|
|
16347
16326
|
} catch (error) {
|
|
16348
16327
|
} finally {
|
|
@@ -16377,13 +16356,13 @@ const GroupSelector = ({ store, onGroupSelect }) => {
|
|
|
16377
16356
|
)
|
|
16378
16357
|
}
|
|
16379
16358
|
),
|
|
16380
|
-
/* @__PURE__ */ jsx(SelectContent, { align: "start", children: groups.map((
|
|
16359
|
+
/* @__PURE__ */ jsx(SelectContent, { align: "start", children: groups.map((conversation) => /* @__PURE__ */ jsxs(SelectItem, { value: conversation.conversation_id, children: [
|
|
16381
16360
|
/* @__PURE__ */ jsxs(Avatar, { className: "size-6", children: [
|
|
16382
|
-
/* @__PURE__ */ jsx(AvatarImage, { src:
|
|
16383
|
-
/* @__PURE__ */ jsx(AvatarFallback, { children:
|
|
16361
|
+
/* @__PURE__ */ jsx(AvatarImage, { src: conversation.conversation_detail.avatar ?? void 0 }),
|
|
16362
|
+
/* @__PURE__ */ jsx(AvatarFallback, { children: conversation.conversation_detail.name?.charAt(0) })
|
|
16384
16363
|
] }),
|
|
16385
|
-
/* @__PURE__ */ jsx("span", { className: "text-sm", children:
|
|
16386
|
-
] },
|
|
16364
|
+
/* @__PURE__ */ jsx("span", { className: "text-sm", children: conversation.conversation_detail.name ?? conversation.conversation_id })
|
|
16365
|
+
] }, conversation.conversation_id)) })
|
|
16387
16366
|
] }) });
|
|
16388
16367
|
};
|
|
16389
16368
|
const GifIcon = (props) => /* @__PURE__ */ jsx(
|
|
@@ -32472,14 +32451,14 @@ const mentionService = (api, mfs, store, user) => {
|
|
|
32472
32451
|
}
|
|
32473
32452
|
const { groupId, postId } = params;
|
|
32474
32453
|
const response = postId ? await mfs.getRecommendationPost(groupId, postId, 0, 999) : await mfs.getRecommendationGroup(groupId, 0, 999);
|
|
32475
|
-
const apiResults = response.entries?.filter((item) => Boolean(item?.
|
|
32454
|
+
const apiResults = response.entries?.filter((item) => Boolean(item?.user_details))?.map(
|
|
32476
32455
|
(item) => ({
|
|
32477
|
-
id: item?.
|
|
32478
|
-
label: item?.
|
|
32479
|
-
avatar: item?.
|
|
32456
|
+
id: item?.user_details?.id,
|
|
32457
|
+
label: item?.user_details?.name,
|
|
32458
|
+
avatar: item?.user_details?.avatar,
|
|
32480
32459
|
inThisThread: 1,
|
|
32481
|
-
name: item?.
|
|
32482
|
-
selectId: item.
|
|
32460
|
+
name: item?.user_details?.name,
|
|
32461
|
+
selectId: item.user_details?.username,
|
|
32483
32462
|
type: MentionType.User,
|
|
32484
32463
|
from: PostType.Post
|
|
32485
32464
|
})
|
|
@@ -32506,18 +32485,18 @@ const mentionService = (api, mfs, store, user) => {
|
|
|
32506
32485
|
if (!activeGroupId) {
|
|
32507
32486
|
return [];
|
|
32508
32487
|
}
|
|
32509
|
-
const response = await api.
|
|
32510
|
-
return response.
|
|
32511
|
-
(
|
|
32512
|
-
id:
|
|
32513
|
-
label:
|
|
32514
|
-
avatar:
|
|
32488
|
+
const response = await api.fetchConversationList(999, 0);
|
|
32489
|
+
return response.map(
|
|
32490
|
+
(conversation) => ({
|
|
32491
|
+
id: conversation?.conversation_id,
|
|
32492
|
+
label: conversation?.conversation_detail?.name,
|
|
32493
|
+
avatar: conversation?.conversation_detail?.avatar,
|
|
32515
32494
|
inThisThread: 1,
|
|
32516
|
-
name:
|
|
32517
|
-
selectId:
|
|
32495
|
+
name: conversation?.conversation_detail?.name,
|
|
32496
|
+
selectId: conversation?.conversation_detail?.select_id,
|
|
32518
32497
|
type: MentionType.Group,
|
|
32519
32498
|
from: PostType.Post,
|
|
32520
|
-
isCrossExposureEnable:
|
|
32499
|
+
isCrossExposureEnable: conversation?.conversation_detail?.allow_cross_exposure
|
|
32521
32500
|
})
|
|
32522
32501
|
);
|
|
32523
32502
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@select-org/select-post-builder",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.35",
|
|
4
4
|
"description": "A reusable, extensible Post Builder widget for the Select platform and beyond.",
|
|
5
5
|
"main": "./dist/post-builder.cjs.js",
|
|
6
6
|
"module": "./dist/post-builder.js",
|