@amityco/ts-sdk-react-native 6.33.1 → 6.34.1-6ae6435.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/.env +26 -26
- package/dist/@types/core/payload.d.ts +8 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/community.d.ts +16 -0
- package/dist/@types/domains/community.d.ts.map +1 -1
- package/dist/communityRepository/constants/index.d.ts +6 -0
- package/dist/communityRepository/constants/index.d.ts.map +1 -0
- package/dist/communityRepository/index.d.ts +1 -0
- package/dist/communityRepository/index.d.ts.map +1 -1
- package/dist/communityRepository/observers/index.d.ts +1 -0
- package/dist/communityRepository/observers/index.d.ts.map +1 -1
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityLiveCollectionController.d.ts +14 -0
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityLiveCollectionController.d.ts.map +1 -0
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityPaginationController.d.ts +10 -0
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityPaginationController.d.ts.map +1 -0
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts +16 -0
- package/dist/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.d.ts.map +1 -0
- package/dist/communityRepository/observers/semanticSearch/enums.d.ts +6 -0
- package/dist/communityRepository/observers/semanticSearch/enums.d.ts.map +1 -0
- package/dist/communityRepository/observers/semanticSearch/utils.d.ts +3 -0
- package/dist/communityRepository/observers/semanticSearch/utils.d.ts.map +1 -0
- package/dist/communityRepository/observers/semanticSearchCommunities.d.ts +10 -0
- package/dist/communityRepository/observers/semanticSearchCommunities.d.ts.map +1 -0
- package/dist/communityRepository/utils/payload.d.ts +1 -0
- package/dist/communityRepository/utils/payload.d.ts.map +1 -1
- package/dist/index.cjs.js +224 -22
- package/dist/index.esm.js +224 -22
- package/dist/index.umd.js +3 -3
- package/package.json +1 -1
- package/src/@types/core/payload.ts +7 -0
- package/src/@types/domains/community.ts +24 -0
- package/src/communityRepository/constants/index.ts +5 -0
- package/src/communityRepository/index.ts +1 -0
- package/src/communityRepository/observers/index.ts +2 -0
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityLiveCollectionController.ts +164 -0
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityPaginationController.ts +36 -0
- package/src/communityRepository/observers/semanticSearch/SemanticSearchCommunityQueryStreamController.ts +86 -0
- package/src/communityRepository/observers/semanticSearch/enums.ts +5 -0
- package/src/communityRepository/observers/semanticSearch/utils.ts +16 -0
- package/src/communityRepository/observers/semanticSearchCommunities.ts +42 -0
- package/src/communityRepository/utils/payload.ts +11 -0
package/dist/index.cjs.js
CHANGED
|
@@ -123,8 +123,8 @@ const PostContentType = Object.freeze({
|
|
|
123
123
|
|
|
124
124
|
function getVersion() {
|
|
125
125
|
try {
|
|
126
|
-
// the string ''v6.
|
|
127
|
-
return 'v6.
|
|
126
|
+
// the string ''v6.34.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
|
|
127
|
+
return 'v6.34.0-cjs';
|
|
128
128
|
}
|
|
129
129
|
catch (error) {
|
|
130
130
|
return '__dev__';
|
|
@@ -13772,6 +13772,11 @@ const prepareCommunityRequest = (params) => {
|
|
|
13772
13772
|
return Object.assign(Object.assign(Object.assign({}, restParam), (postSetting ? CommunityPostSettingMaps[postSetting] : undefined)), {
|
|
13773
13773
|
// Convert story setting to the actual value. (Allow by default)
|
|
13774
13774
|
allowCommentInStory: typeof (storySetting === null || storySetting === void 0 ? void 0 : storySetting.enableComment) === 'boolean' ? storySetting.enableComment : true });
|
|
13775
|
+
};
|
|
13776
|
+
const prepareSemanticSearchCommunityPayload = (_a) => {
|
|
13777
|
+
var communityPayload = __rest(_a, ["searchResult"]);
|
|
13778
|
+
const processedCommunityPayload = prepareCommunityPayload(communityPayload);
|
|
13779
|
+
return Object.assign({}, processedCommunityPayload);
|
|
13775
13780
|
};
|
|
13776
13781
|
|
|
13777
13782
|
const preparePostPayload = (payload) => {
|
|
@@ -19846,12 +19851,12 @@ class CommunitiesQueryStreamController$1 extends QueryStreamController {
|
|
|
19846
19851
|
}
|
|
19847
19852
|
}
|
|
19848
19853
|
|
|
19849
|
-
var EnumCommunityActions$
|
|
19854
|
+
var EnumCommunityActions$4;
|
|
19850
19855
|
(function (EnumCommunityActions) {
|
|
19851
19856
|
EnumCommunityActions["OnCommunityCreated"] = "onCommunityCreated";
|
|
19852
19857
|
EnumCommunityActions["OnCommunityDeleted"] = "onCommunityDeleted";
|
|
19853
19858
|
EnumCommunityActions["OnCommunityUpdated"] = "onCommunityUpdated";
|
|
19854
|
-
})(EnumCommunityActions$
|
|
19859
|
+
})(EnumCommunityActions$4 || (EnumCommunityActions$4 = {}));
|
|
19855
19860
|
|
|
19856
19861
|
var EnumCommunityMemberActions$1;
|
|
19857
19862
|
(function (EnumCommunityMemberActions) {
|
|
@@ -20543,8 +20548,8 @@ class SearchCommunityLiveCollectionController extends LiveCollectionController {
|
|
|
20543
20548
|
}
|
|
20544
20549
|
startSubscription() {
|
|
20545
20550
|
return this.queryStreamController.subscribeRTE([
|
|
20546
|
-
{ fn: onCommunityDeleted, action: EnumCommunityActions$
|
|
20547
|
-
{ fn: onCommunityUpdated, action: EnumCommunityActions$
|
|
20551
|
+
{ fn: onCommunityDeleted, action: EnumCommunityActions$4.OnCommunityDeleted },
|
|
20552
|
+
{ fn: onCommunityUpdated, action: EnumCommunityActions$4.OnCommunityUpdated },
|
|
20548
20553
|
{ fn: onCommunityJoined, action: EnumCommunityMemberActions$1.OnCommunityJoined },
|
|
20549
20554
|
{ fn: onCommunityLeft, action: EnumCommunityMemberActions$1.OnCommunityLeft },
|
|
20550
20555
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions$1.OnMemberCountChanged },
|
|
@@ -20644,12 +20649,12 @@ class CommunitiesPaginationController extends PaginationController {
|
|
|
20644
20649
|
}
|
|
20645
20650
|
}
|
|
20646
20651
|
|
|
20647
|
-
var EnumCommunityActions$
|
|
20652
|
+
var EnumCommunityActions$3;
|
|
20648
20653
|
(function (EnumCommunityActions) {
|
|
20649
20654
|
EnumCommunityActions["OnCommunityCreated"] = "onCommunityCreated";
|
|
20650
20655
|
EnumCommunityActions["OnCommunityDeleted"] = "onCommunityDeleted";
|
|
20651
20656
|
EnumCommunityActions["OnCommunityUpdated"] = "onCommunityUpdated";
|
|
20652
|
-
})(EnumCommunityActions$
|
|
20657
|
+
})(EnumCommunityActions$3 || (EnumCommunityActions$3 = {}));
|
|
20653
20658
|
|
|
20654
20659
|
class CommunitiesQueryStreamController extends QueryStreamController {
|
|
20655
20660
|
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
@@ -20685,7 +20690,7 @@ class CommunitiesQueryStreamController extends QueryStreamController {
|
|
|
20685
20690
|
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
20686
20691
|
if (!collection)
|
|
20687
20692
|
return;
|
|
20688
|
-
if (this.query.displayName && action === EnumCommunityActions$
|
|
20693
|
+
if (this.query.displayName && action === EnumCommunityActions$3.OnCommunityCreated) {
|
|
20689
20694
|
return;
|
|
20690
20695
|
}
|
|
20691
20696
|
/*
|
|
@@ -20730,9 +20735,9 @@ class CommunityLiveCollectionController extends LiveCollectionController {
|
|
|
20730
20735
|
}
|
|
20731
20736
|
startSubscription() {
|
|
20732
20737
|
return this.queryStreamController.subscribeRTE([
|
|
20733
|
-
{ fn: onCommunityCreated, action: EnumCommunityActions$
|
|
20734
|
-
{ fn: onCommunityDeleted, action: EnumCommunityActions$
|
|
20735
|
-
{ fn: onCommunityUpdated, action: EnumCommunityActions$
|
|
20738
|
+
{ fn: onCommunityCreated, action: EnumCommunityActions$3.OnCommunityCreated },
|
|
20739
|
+
{ fn: onCommunityDeleted, action: EnumCommunityActions$3.OnCommunityDeleted },
|
|
20740
|
+
{ fn: onCommunityUpdated, action: EnumCommunityActions$3.OnCommunityUpdated },
|
|
20736
20741
|
{ fn: onCommunityJoined, action: EnumCommunityMemberActions$1.OnCommunityJoined },
|
|
20737
20742
|
{ fn: onCommunityLeft, action: EnumCommunityMemberActions$1.OnCommunityLeft },
|
|
20738
20743
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions$1.OnMemberCountChanged },
|
|
@@ -20927,11 +20932,11 @@ class TrendingCommunitiesQueryStreamController extends QueryStreamController {
|
|
|
20927
20932
|
}
|
|
20928
20933
|
}
|
|
20929
20934
|
|
|
20930
|
-
var EnumCommunityActions$
|
|
20935
|
+
var EnumCommunityActions$2;
|
|
20931
20936
|
(function (EnumCommunityActions) {
|
|
20932
20937
|
EnumCommunityActions["OnCommunityDeleted"] = "onCommunityDeleted";
|
|
20933
20938
|
EnumCommunityActions["OnCommunityUpdated"] = "onCommunityUpdated";
|
|
20934
|
-
})(EnumCommunityActions$
|
|
20939
|
+
})(EnumCommunityActions$2 || (EnumCommunityActions$2 = {}));
|
|
20935
20940
|
|
|
20936
20941
|
class TrendingCommunityLiveCollectionController extends LiveCollectionController {
|
|
20937
20942
|
constructor(query, callback) {
|
|
@@ -20962,8 +20967,8 @@ class TrendingCommunityLiveCollectionController extends LiveCollectionController
|
|
|
20962
20967
|
}
|
|
20963
20968
|
startSubscription() {
|
|
20964
20969
|
return this.queryStreamController.subscribeRTE([
|
|
20965
|
-
{ fn: onCommunityDeleted, action: EnumCommunityActions$
|
|
20966
|
-
{ fn: onCommunityUpdated, action: EnumCommunityActions$
|
|
20970
|
+
{ fn: onCommunityDeleted, action: EnumCommunityActions$2.OnCommunityDeleted },
|
|
20971
|
+
{ fn: onCommunityUpdated, action: EnumCommunityActions$2.OnCommunityUpdated },
|
|
20967
20972
|
{ fn: onCommunityJoined, action: EnumCommunityMemberActions$1.OnCommunityJoined },
|
|
20968
20973
|
{ fn: onCommunityLeft, action: EnumCommunityMemberActions$1.OnCommunityLeft },
|
|
20969
20974
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions$1.OnMemberCountChanged },
|
|
@@ -21089,11 +21094,11 @@ class RecommendedCommunitiesQueryStreamController extends QueryStreamController
|
|
|
21089
21094
|
}
|
|
21090
21095
|
}
|
|
21091
21096
|
|
|
21092
|
-
var EnumCommunityActions;
|
|
21097
|
+
var EnumCommunityActions$1;
|
|
21093
21098
|
(function (EnumCommunityActions) {
|
|
21094
21099
|
EnumCommunityActions["OnCommunityDeleted"] = "onCommunityDeleted";
|
|
21095
21100
|
EnumCommunityActions["OnCommunityUpdated"] = "onCommunityUpdated";
|
|
21096
|
-
})(EnumCommunityActions || (EnumCommunityActions = {}));
|
|
21101
|
+
})(EnumCommunityActions$1 || (EnumCommunityActions$1 = {}));
|
|
21097
21102
|
|
|
21098
21103
|
class RecommendedCommunityLiveCollectionController extends LiveCollectionController {
|
|
21099
21104
|
constructor(query, callback) {
|
|
@@ -21124,8 +21129,8 @@ class RecommendedCommunityLiveCollectionController extends LiveCollectionControl
|
|
|
21124
21129
|
}
|
|
21125
21130
|
startSubscription() {
|
|
21126
21131
|
return this.queryStreamController.subscribeRTE([
|
|
21127
|
-
{ fn: onCommunityDeleted, action: EnumCommunityActions.OnCommunityDeleted },
|
|
21128
|
-
{ fn: onCommunityUpdated, action: EnumCommunityActions.OnCommunityUpdated },
|
|
21132
|
+
{ fn: onCommunityDeleted, action: EnumCommunityActions$1.OnCommunityDeleted },
|
|
21133
|
+
{ fn: onCommunityUpdated, action: EnumCommunityActions$1.OnCommunityUpdated },
|
|
21129
21134
|
{ fn: onCommunityJoined, action: EnumCommunityMemberActions$1.OnCommunityJoined },
|
|
21130
21135
|
{ fn: onCommunityLeft, action: EnumCommunityMemberActions$1.OnCommunityLeft },
|
|
21131
21136
|
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions$1.OnMemberCountChanged },
|
|
@@ -21193,6 +21198,201 @@ const getRecommendedCommunities = (params, callback, config) => {
|
|
|
21193
21198
|
};
|
|
21194
21199
|
/* end_public_function */
|
|
21195
21200
|
|
|
21201
|
+
class SemanticSearchCommunityPaginationController extends PaginationController {
|
|
21202
|
+
async getRequest(queryParams, token) {
|
|
21203
|
+
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, communityMembershipStatus } = queryParams, params = __rest(queryParams, ["limit", "communityMembershipStatus"]);
|
|
21204
|
+
const baseOptions = {
|
|
21205
|
+
type: queryParams.limit ? 'pagination' : undefined,
|
|
21206
|
+
};
|
|
21207
|
+
const options = token ? Object.assign(Object.assign({}, baseOptions), { token }) : Object.assign(Object.assign({}, baseOptions), { limit });
|
|
21208
|
+
const { data: queryResponse } = await this.http.get(`/api/v1/semantic-search/communities`, {
|
|
21209
|
+
params: Object.assign(Object.assign({}, params), { filter: communityMembershipStatus !== null && communityMembershipStatus !== void 0 ? communityMembershipStatus : "all" /* AmityCommunityMemberStatusFilter.ALL */, options }),
|
|
21210
|
+
});
|
|
21211
|
+
return queryResponse;
|
|
21212
|
+
}
|
|
21213
|
+
}
|
|
21214
|
+
|
|
21215
|
+
function prepareSemanticCommunitiesReferenceId(response) {
|
|
21216
|
+
return response.communities.map(community => {
|
|
21217
|
+
const score = response.searchResult.find(result => result.communityId === community.communityId);
|
|
21218
|
+
return `${community.communityId}:${score}`;
|
|
21219
|
+
});
|
|
21220
|
+
}
|
|
21221
|
+
|
|
21222
|
+
class SemanticSearchCommunityQueryStreamController extends QueryStreamController {
|
|
21223
|
+
constructor(query, cacheKey, notifyChange, preparePayload) {
|
|
21224
|
+
super(query, cacheKey);
|
|
21225
|
+
this.notifyChange = notifyChange;
|
|
21226
|
+
this.preparePayload = preparePayload;
|
|
21227
|
+
}
|
|
21228
|
+
async saveToMainDB(response) {
|
|
21229
|
+
const processedPayload = this.preparePayload(response);
|
|
21230
|
+
const client = getActiveClient();
|
|
21231
|
+
const cachedAt = client.cache && Date.now();
|
|
21232
|
+
if (client.cache) {
|
|
21233
|
+
ingestInCache(processedPayload, { cachedAt });
|
|
21234
|
+
}
|
|
21235
|
+
}
|
|
21236
|
+
appendToQueryStream(response, direction, refresh = false) {
|
|
21237
|
+
var _a, _b;
|
|
21238
|
+
if (refresh) {
|
|
21239
|
+
pushToCache(this.cacheKey, {
|
|
21240
|
+
data: prepareSemanticCommunitiesReferenceId(response),
|
|
21241
|
+
});
|
|
21242
|
+
}
|
|
21243
|
+
else {
|
|
21244
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
21245
|
+
const communities = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
21246
|
+
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...communities, ...prepareSemanticCommunitiesReferenceId(response)])] }));
|
|
21247
|
+
}
|
|
21248
|
+
}
|
|
21249
|
+
reactor(action) {
|
|
21250
|
+
return (community) => {
|
|
21251
|
+
var _a;
|
|
21252
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
21253
|
+
if (!collection)
|
|
21254
|
+
return;
|
|
21255
|
+
collection.data = [...new Set([community.communityId, ...collection.data])];
|
|
21256
|
+
pushToCache(this.cacheKey, collection);
|
|
21257
|
+
this.notifyChange({ origin: "event" /* Amity.LiveDataOrigin.EVENT */, loading: false });
|
|
21258
|
+
};
|
|
21259
|
+
//
|
|
21260
|
+
}
|
|
21261
|
+
subscribeRTE(createSubscriber) {
|
|
21262
|
+
return createSubscriber.map(subscriber => subscriber.fn(this.reactor(subscriber.action)));
|
|
21263
|
+
}
|
|
21264
|
+
}
|
|
21265
|
+
|
|
21266
|
+
var EnumCommunityActions;
|
|
21267
|
+
(function (EnumCommunityActions) {
|
|
21268
|
+
EnumCommunityActions["OnCommunityCreated"] = "onCommunityCreated";
|
|
21269
|
+
EnumCommunityActions["OnCommunityDeleted"] = "onCommunityDeleted";
|
|
21270
|
+
EnumCommunityActions["OnCommunityUpdated"] = "onCommunityUpdated";
|
|
21271
|
+
})(EnumCommunityActions || (EnumCommunityActions = {}));
|
|
21272
|
+
|
|
21273
|
+
class SemanticSearchCommunityLiveCollectionController extends LiveCollectionController {
|
|
21274
|
+
constructor(query, callback) {
|
|
21275
|
+
const queryStreamId = hash__default["default"](query);
|
|
21276
|
+
const cacheKey = ['community', 'collection', queryStreamId];
|
|
21277
|
+
const paginationController = new SemanticSearchCommunityPaginationController(query);
|
|
21278
|
+
super(paginationController, queryStreamId, cacheKey, callback);
|
|
21279
|
+
this.query = query;
|
|
21280
|
+
this.queryStreamController = new SemanticSearchCommunityQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareSemanticSearchCommunityPayload);
|
|
21281
|
+
this.callback = callback.bind(this);
|
|
21282
|
+
this.loadPage({ initial: true });
|
|
21283
|
+
}
|
|
21284
|
+
setup() {
|
|
21285
|
+
var _a;
|
|
21286
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
21287
|
+
if (!collection) {
|
|
21288
|
+
pushToCache(this.cacheKey, {
|
|
21289
|
+
data: [],
|
|
21290
|
+
params: {},
|
|
21291
|
+
});
|
|
21292
|
+
}
|
|
21293
|
+
}
|
|
21294
|
+
async persistModel(queryPayload) {
|
|
21295
|
+
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
21296
|
+
}
|
|
21297
|
+
persistQueryStream({ response, direction, refresh, }) {
|
|
21298
|
+
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
21299
|
+
}
|
|
21300
|
+
startSubscription() {
|
|
21301
|
+
return this.queryStreamController.subscribeRTE([
|
|
21302
|
+
{ fn: onCommunityCreated, action: EnumCommunityActions.OnCommunityCreated },
|
|
21303
|
+
{ fn: onCommunityDeleted, action: EnumCommunityActions.OnCommunityDeleted },
|
|
21304
|
+
{ fn: onCommunityUpdated, action: EnumCommunityActions.OnCommunityUpdated },
|
|
21305
|
+
{ fn: onCommunityJoined, action: EnumCommunityMemberActions$1.OnCommunityJoined },
|
|
21306
|
+
{ fn: onCommunityLeft, action: EnumCommunityMemberActions$1.OnCommunityLeft },
|
|
21307
|
+
{ fn: onCommunityUserChanged, action: EnumCommunityMemberActions$1.OnMemberCountChanged },
|
|
21308
|
+
{ fn: onLocalCommunityJoined, action: EnumCommunityMemberActions$1.OnCommunityJoined },
|
|
21309
|
+
{ fn: onLocalCommunityLeft, action: EnumCommunityMemberActions$1.OnCommunityLeft },
|
|
21310
|
+
]);
|
|
21311
|
+
}
|
|
21312
|
+
notifyChange({ origin, loading, error }) {
|
|
21313
|
+
var _a, _b;
|
|
21314
|
+
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
21315
|
+
if (!collection)
|
|
21316
|
+
return;
|
|
21317
|
+
const data = this.applyFilter((_b = collection.data
|
|
21318
|
+
.map(communityIdWithScore => {
|
|
21319
|
+
const [communityId, score] = communityIdWithScore.split(':');
|
|
21320
|
+
return {
|
|
21321
|
+
communityId,
|
|
21322
|
+
score: parseFloat(score),
|
|
21323
|
+
};
|
|
21324
|
+
})
|
|
21325
|
+
.sort((a, b) => b.score - a.score)
|
|
21326
|
+
.map(({ communityId }) => pullFromCache(['community', 'get', communityId]))
|
|
21327
|
+
.filter(isNonNullable)
|
|
21328
|
+
.map(({ data }) => data)) !== null && _b !== void 0 ? _b : []);
|
|
21329
|
+
if (!this.shouldNotify(data) && origin === 'event')
|
|
21330
|
+
return;
|
|
21331
|
+
this.callback({
|
|
21332
|
+
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
21333
|
+
data,
|
|
21334
|
+
hasNextPage: !!this.paginationController.getNextToken(),
|
|
21335
|
+
loading,
|
|
21336
|
+
error,
|
|
21337
|
+
});
|
|
21338
|
+
}
|
|
21339
|
+
applyFilter(data) {
|
|
21340
|
+
const { userId } = getActiveClient();
|
|
21341
|
+
let communities = data;
|
|
21342
|
+
if (this.query.categoryIds) {
|
|
21343
|
+
communities = communities.filter(c => {
|
|
21344
|
+
var _a;
|
|
21345
|
+
return (_a = c.categoryIds) === null || _a === void 0 ? void 0 : _a.some((id) => {
|
|
21346
|
+
if (!this.query.categoryIds)
|
|
21347
|
+
return true;
|
|
21348
|
+
if (this.query.categoryIds.length === 0)
|
|
21349
|
+
return true;
|
|
21350
|
+
return this.query.categoryIds.includes(id);
|
|
21351
|
+
});
|
|
21352
|
+
});
|
|
21353
|
+
}
|
|
21354
|
+
if (this.query.tags) {
|
|
21355
|
+
communities = communities.filter(c => { var _a; return (_a = c.tags) === null || _a === void 0 ? void 0 : _a.some(t => { var _a; return (_a = this.query.tags) === null || _a === void 0 ? void 0 : _a.includes(t); }); });
|
|
21356
|
+
}
|
|
21357
|
+
if (this.query.communityMembershipStatus && userId) {
|
|
21358
|
+
communities = filterByCommunityMembership(communities, this.query.communityMembershipStatus, userId);
|
|
21359
|
+
}
|
|
21360
|
+
return communities;
|
|
21361
|
+
}
|
|
21362
|
+
}
|
|
21363
|
+
|
|
21364
|
+
/**
|
|
21365
|
+
* search posts by semantic search
|
|
21366
|
+
*
|
|
21367
|
+
* @returns the associated pinned post(s)
|
|
21368
|
+
*
|
|
21369
|
+
* @category Posts Live Collection
|
|
21370
|
+
*
|
|
21371
|
+
*/
|
|
21372
|
+
const semanticSearchCommunities = (params, callback, config) => {
|
|
21373
|
+
const { log, cache } = getActiveClient();
|
|
21374
|
+
if (!cache) {
|
|
21375
|
+
console.log(ENABLE_CACHE_MESSAGE);
|
|
21376
|
+
}
|
|
21377
|
+
const timestamp = Date.now();
|
|
21378
|
+
log(`semanticSearchCommunities(tmpid: ${timestamp}) > listen`);
|
|
21379
|
+
const semanticSearchPostLiveCollection = new SemanticSearchCommunityLiveCollectionController(params, callback);
|
|
21380
|
+
const disposers = semanticSearchPostLiveCollection.startSubscription();
|
|
21381
|
+
const cacheKey = semanticSearchPostLiveCollection.getCacheKey();
|
|
21382
|
+
disposers.push(() => dropFromCache(cacheKey));
|
|
21383
|
+
return () => {
|
|
21384
|
+
log(`semanticSearchCommunities(tmpid: ${timestamp}) > dispose`);
|
|
21385
|
+
disposers.forEach(fn => fn());
|
|
21386
|
+
};
|
|
21387
|
+
};
|
|
21388
|
+
|
|
21389
|
+
var AmityCommunityMemberStatusFilter;
|
|
21390
|
+
(function (AmityCommunityMemberStatusFilter) {
|
|
21391
|
+
AmityCommunityMemberStatusFilter["ALL"] = "all";
|
|
21392
|
+
AmityCommunityMemberStatusFilter["MEMBER"] = "member";
|
|
21393
|
+
AmityCommunityMemberStatusFilter["NOT_MEMBER"] = "notMember";
|
|
21394
|
+
})(AmityCommunityMemberStatusFilter || (AmityCommunityMemberStatusFilter = {}));
|
|
21395
|
+
|
|
21196
21396
|
/* begin_public_function
|
|
21197
21397
|
id: community.moderation.add_roles
|
|
21198
21398
|
*/
|
|
@@ -21356,7 +21556,9 @@ var index$9 = /*#__PURE__*/Object.freeze({
|
|
|
21356
21556
|
getCommunities: getCommunities,
|
|
21357
21557
|
getCommunity: getCommunity,
|
|
21358
21558
|
getTrendingCommunities: getTrendingCommunities,
|
|
21359
|
-
getRecommendedCommunities: getRecommendedCommunities
|
|
21559
|
+
getRecommendedCommunities: getRecommendedCommunities,
|
|
21560
|
+
semanticSearchCommunities: semanticSearchCommunities,
|
|
21561
|
+
get AmityCommunityMemberStatusFilter () { return AmityCommunityMemberStatusFilter; }
|
|
21360
21562
|
});
|
|
21361
21563
|
|
|
21362
21564
|
/* begin_public_function
|
|
@@ -25230,7 +25432,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
|
|
|
25230
25432
|
getPoll: getPoll
|
|
25231
25433
|
});
|
|
25232
25434
|
|
|
25233
|
-
const privateKey = "-----BEGIN PRIVATE KEY-----\
|
|
25435
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvwIBADANBgkqhkiG9w0BAQEFAASCBKkwggSlAgEAAoIBAQDAARz+hmBgi8pJ\nQb8LeY41gtHhk+ACMwRfhsn7GqpqRQNG2qU0755mzZuVDUqjQMGSo8THJB7O+OJs\nflbZRkFXlFoFOVNw1UpNOgwEQZ6wB9oRwzepTJAfF1sVhm/o/ixvXh1zDFNDy6yZ\npXyiiJHUVxqyjllZhxnwdvjoVtDs6hW6awG09bB9nh/TTejlUKXoAgzqVwu/1QMu\nUVViET495elEe19aUarEy+oL2iKeXCEvqda/pWNBdbieFyJvvZ08HN8dPuT88wq2\njZLEAth1vrwQ2IAa4ktaLcBQdLJgIkrbDvAiVZ8lQAjS/bq5vXQikTGvoPlC5bbn\nvuOM/3eLAgMBAAECggEAVZ+peHAghq2QVj71nX5lxsNCKaCyYwixSJBpfouTt7Rz\nE6PpzMOXFi1W1o+I22jDakuSM2SOQKqI/u0QefB0r0O/KVk5NrZHXk0mkrdYtxOp\nUgaGyf8UvmjB+8VqHrNKyZdk9qtmbnNj01kTTcAtmE4H39zPR7eR/8Rul94vaZbs\nwCnKJS3mLT3JxyGug6lxanveKkjG+CKC1nJQYWaxCJxaFSzbwXQPvDhB+TvrIbee\npd5v4EAyEJohpr+T9oDGGJkb/KARBZCtwLyB976PKJwwBA8MRVL1i5QwawuMiMq5\nUtnOnbGKtCeFzaLbNU0Qi8bqyims84EQxC6DOu1fkQKBgQDdvsoBsEhsOXV7hlIJ\naEd0eSJZVkdqimxH8uGoMM2FeNaOrcB6yBXqTSP0R3OIyf8eaY6yjRvP30ZNXcll\n/gD3O1Mu6YmWQdt1W2WA6pKOsUuPXasf0pdOF7IiFZKlSabz5YHXFqwVuqm8loaj\nsXel3YWqPVdHiankE7tz+3ssnQKBgQDdqi4TNdD1MdEpihx19jr0QjUiXW3939FK\nqp30HESPEGDGQzXdmJgif9HhZb+cJSuWaHEbjgBrYahvgCF+y6LbEpOD+D/dmT+s\nDEAQaR84sah6dokwPjV8fjBSrcVFjCS+doxv0d3p/9OUEeyUhFrY03nxtIEYkLIE\n/Zvn37b4RwKBgQCLENVFe9XfsaVhQ5r9dV2iyTlmh7qgMZG5CbTFs12hQGhm8McO\n+Z7s41YSJCFr/yq1WwP4LJDtrBw99vyQr1zRsG35tNLp3gGRNzGQSQyC2uQFVHw2\np+7mNewsfhUK/gbrXNsyFnDz6635rPlhfbII3sWuP2wWXFqkxE9CbMwR7QKBgQC6\nawDMzxmo2/iYArrkyevSuEuPVxvFwpF1RgAI6C0QVCnPE38dmdN4UB7mfHekje4W\nVEercMURidPp0cxZolCYBQtilUjAyL0vqC3In1/Ogjq6oy3FEMxSop1pKxMY5j+Q\nnoqFD+6deLUrddeNH7J3X4LSr4dSbX4JjG+tlgt+yQKBgQCuwTL4hA6KqeInQ0Ta\n9VQX5Qr8hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
|
|
25234
25436
|
/*
|
|
25235
25437
|
* The crypto algorithm used for importing key and signing string
|
|
25236
25438
|
*/
|