@amityco/ts-sdk 7.14.1-e31cea3f.0 → 7.15.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/events.d.ts +0 -2
- package/dist/@types/core/events.d.ts.map +1 -1
- package/dist/@types/core/model.d.ts +0 -2
- package/dist/@types/core/model.d.ts.map +1 -1
- package/dist/@types/core/payload.d.ts +0 -5
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/analytics.d.ts +1 -2
- package/dist/@types/domains/analytics.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +0 -6
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +0 -2
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/domains/room.d.ts +0 -1
- package/dist/@types/domains/room.d.ts.map +1 -1
- package/dist/@types/domains/user.d.ts +7 -0
- package/dist/@types/domains/user.d.ts.map +1 -1
- package/dist/@types/index.d.ts +0 -1
- package/dist/@types/index.d.ts.map +1 -1
- package/dist/analytic/service/analytic/AnalyticsEngine.d.ts +0 -2
- package/dist/analytic/service/analytic/AnalyticsEngine.d.ts.map +1 -1
- package/dist/analytic/service/analytic/AnalyticsEventCapturer.d.ts +0 -2
- package/dist/analytic/service/analytic/AnalyticsEventCapturer.d.ts.map +1 -1
- package/dist/analytic/service/analytic/AnalyticsService.d.ts +0 -12
- package/dist/analytic/service/analytic/AnalyticsService.d.ts.map +1 -1
- package/dist/client/api/createClient.d.ts.map +1 -1
- package/dist/client/api/index.d.ts +0 -1
- package/dist/client/api/index.d.ts.map +1 -1
- package/dist/core/events.d.ts +3 -3
- package/dist/core/events.d.ts.map +1 -1
- package/dist/core/model/idResolvers.d.ts.map +1 -1
- package/dist/core/model/index.d.ts.map +1 -1
- package/dist/index.cjs.js +72 -718
- package/dist/index.d.ts +0 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +50 -694
- package/dist/index.umd.js +3 -3
- package/dist/postRepository/api/createAudioPost.d.ts +0 -2
- package/dist/postRepository/api/createAudioPost.d.ts.map +1 -1
- package/dist/postRepository/api/createClipPost.d.ts +0 -2
- package/dist/postRepository/api/createClipPost.d.ts.map +1 -1
- package/dist/postRepository/api/createMixedMediaPost.d.ts +0 -2
- package/dist/postRepository/api/createMixedMediaPost.d.ts.map +1 -1
- package/dist/postRepository/api/createPost.d.ts +0 -3
- package/dist/postRepository/api/createPost.d.ts.map +1 -1
- package/dist/postRepository/api/editPost.d.ts +0 -3
- package/dist/postRepository/api/editPost.d.ts.map +1 -1
- package/dist/postRepository/api/index.d.ts +0 -4
- package/dist/postRepository/api/index.d.ts.map +1 -1
- package/dist/postRepository/observers/enums.d.ts +1 -4
- package/dist/postRepository/observers/enums.d.ts.map +1 -1
- package/dist/roomRepository/api/index.d.ts +0 -1
- package/dist/roomRepository/api/index.d.ts.map +1 -1
- package/dist/roomRepository/events/index.d.ts +0 -2
- package/dist/roomRepository/events/index.d.ts.map +1 -1
- package/dist/roomRepository/observers/enums.d.ts +1 -2
- package/dist/roomRepository/observers/enums.d.ts.map +1 -1
- package/dist/roomRepository/observers/getRoom.d.ts.map +1 -1
- package/dist/roomRepository/observers/utils.d.ts.map +1 -1
- package/dist/utils/linkedObject/index.d.ts +0 -1
- package/dist/utils/linkedObject/index.d.ts.map +1 -1
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/@types/domains/product.d.ts +0 -95
- package/dist/@types/domains/product.d.ts.map +0 -1
- package/dist/client/api/getProductCatalogueSetting.d.ts +0 -15
- package/dist/client/api/getProductCatalogueSetting.d.ts.map +0 -1
- package/dist/postRepository/api/createRoomPost.d.ts +0 -29
- package/dist/postRepository/api/createRoomPost.d.ts.map +0 -1
- package/dist/postRepository/api/pinProduct.d.ts +0 -15
- package/dist/postRepository/api/pinProduct.d.ts.map +0 -1
- package/dist/postRepository/api/unpinProduct.d.ts +0 -14
- package/dist/postRepository/api/unpinProduct.d.ts.map +0 -1
- package/dist/postRepository/api/updateProductTags.d.ts +0 -15
- package/dist/postRepository/api/updateProductTags.d.ts.map +0 -1
- package/dist/productRepository/helpers/AttachmentProductTags.d.ts +0 -41
- package/dist/productRepository/helpers/AttachmentProductTags.d.ts.map +0 -1
- package/dist/productRepository/helpers/index.d.ts +0 -2
- package/dist/productRepository/helpers/index.d.ts.map +0 -1
- package/dist/productRepository/index.d.ts +0 -2
- package/dist/productRepository/index.d.ts.map +0 -1
- package/dist/productRepository/internalApi/getProduct.d.ts +0 -5
- package/dist/productRepository/internalApi/getProduct.d.ts.map +0 -1
- package/dist/productRepository/internalApi/index.d.ts +0 -2
- package/dist/productRepository/internalApi/index.d.ts.map +0 -1
- package/dist/productRepository/observers/getProduct.d.ts +0 -21
- package/dist/productRepository/observers/getProduct.d.ts.map +0 -1
- package/dist/productRepository/observers/index.d.ts +0 -3
- package/dist/productRepository/observers/index.d.ts.map +0 -1
- package/dist/productRepository/observers/searchProducts/LiveCollectionController.d.ts +0 -15
- package/dist/productRepository/observers/searchProducts/LiveCollectionController.d.ts.map +0 -1
- package/dist/productRepository/observers/searchProducts/PaginationController.d.ts +0 -5
- package/dist/productRepository/observers/searchProducts/PaginationController.d.ts.map +0 -1
- package/dist/productRepository/observers/searchProducts/QueryStreamController.d.ts +0 -8
- package/dist/productRepository/observers/searchProducts/QueryStreamController.d.ts.map +0 -1
- package/dist/productRepository/observers/searchProducts.d.ts +0 -25
- package/dist/productRepository/observers/searchProducts.d.ts.map +0 -1
- package/dist/roomRepository/api/updateCohostPermission.d.ts +0 -18
- package/dist/roomRepository/api/updateCohostPermission.d.ts.map +0 -1
- package/dist/roomRepository/events/onLocalRoomDidUpdate.d.ts +0 -17
- package/dist/roomRepository/events/onLocalRoomDidUpdate.d.ts.map +0 -1
- package/dist/roomRepository/events/onRoomDidUpdate.d.ts +0 -17
- package/dist/roomRepository/events/onRoomDidUpdate.d.ts.map +0 -1
- package/dist/utils/linkedObject/productLinkedObject.d.ts +0 -2
- package/dist/utils/linkedObject/productLinkedObject.d.ts.map +0 -1
- package/dist/utils/linkedObject/productTagLinkedObject.d.ts +0 -2
- package/dist/utils/linkedObject/productTagLinkedObject.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -20,6 +20,12 @@ var UserTypeEnum;
|
|
|
20
20
|
UserTypeEnum["VISITOR"] = "visitor";
|
|
21
21
|
UserTypeEnum["BOT"] = "bot";
|
|
22
22
|
})(UserTypeEnum || (UserTypeEnum = {}));
|
|
23
|
+
var SearchUsersByEnum;
|
|
24
|
+
(function (SearchUsersByEnum) {
|
|
25
|
+
SearchUsersByEnum["DISPLAY_NAME"] = "displayName";
|
|
26
|
+
SearchUsersByEnum["PROFILE_HANDLE"] = "profileHandle";
|
|
27
|
+
SearchUsersByEnum["USER_ID"] = "userId";
|
|
28
|
+
})(SearchUsersByEnum || (SearchUsersByEnum = {}));
|
|
23
29
|
|
|
24
30
|
const FileType = Object.freeze({
|
|
25
31
|
FILE: 'file',
|
|
@@ -228,16 +234,10 @@ var AmityEventOrderOption;
|
|
|
228
234
|
AmityEventOrderOption["Descending"] = "desc";
|
|
229
235
|
})(AmityEventOrderOption || (AmityEventOrderOption = {}));
|
|
230
236
|
|
|
231
|
-
var AnalyticsSourceTypeEnum;
|
|
232
|
-
(function (AnalyticsSourceTypeEnum) {
|
|
233
|
-
AnalyticsSourceTypeEnum["POST"] = "post";
|
|
234
|
-
AnalyticsSourceTypeEnum["ROOM"] = "room";
|
|
235
|
-
})(AnalyticsSourceTypeEnum || (AnalyticsSourceTypeEnum = {}));
|
|
236
|
-
|
|
237
237
|
function getVersion() {
|
|
238
238
|
try {
|
|
239
|
-
// the string ''v7.
|
|
240
|
-
return 'v7.
|
|
239
|
+
// the string ''v7.15.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
240
|
+
return 'v7.15.0-esm';
|
|
241
241
|
}
|
|
242
242
|
catch (error) {
|
|
243
243
|
return '__dev__';
|
|
@@ -686,7 +686,6 @@ const idResolvers = {
|
|
|
686
686
|
viewer: ({ userId }) => userId,
|
|
687
687
|
event: ({ eventId }) => eventId,
|
|
688
688
|
eventResponse: ({ userId }) => userId,
|
|
689
|
-
product: ({ productId }) => productId,
|
|
690
689
|
};
|
|
691
690
|
/**
|
|
692
691
|
* Retrieve the id resolver matching a domain name
|
|
@@ -746,7 +745,6 @@ const PAYLOAD2MODEL = {
|
|
|
746
745
|
events: 'event',
|
|
747
746
|
viewers: 'viewer',
|
|
748
747
|
eventResponses: 'eventResponse',
|
|
749
|
-
products: 'product',
|
|
750
748
|
};
|
|
751
749
|
/** hidden */
|
|
752
750
|
const isOutdated = (prevData, nextData) => {
|
|
@@ -23236,29 +23234,6 @@ const getSocialSettings = async () => {
|
|
|
23236
23234
|
return data.socialNetworkSetting;
|
|
23237
23235
|
};
|
|
23238
23236
|
|
|
23239
|
-
/* begin_public_function
|
|
23240
|
-
id: client.getProductCatalogueSetting
|
|
23241
|
-
*/
|
|
23242
|
-
/**
|
|
23243
|
-
* ```js
|
|
23244
|
-
* import { getProductCatalogueSetting } from '@amityco/ts-sdk'
|
|
23245
|
-
* const productCatalogueSetting = await getProductCatalogueSetting()
|
|
23246
|
-
* ```
|
|
23247
|
-
*
|
|
23248
|
-
* Fetches a {@link Amity.ProductCatalogueSetting} object
|
|
23249
|
-
*
|
|
23250
|
-
* @returns A Promise of {@link Amity.ProductCatalogueSetting} object
|
|
23251
|
-
*
|
|
23252
|
-
* @category Client API
|
|
23253
|
-
* @async
|
|
23254
|
-
*/
|
|
23255
|
-
const getProductCatalogueSetting = async () => {
|
|
23256
|
-
const client = getActiveClient();
|
|
23257
|
-
const { data } = await client.http.get(`/api/v3/network-settings/product`);
|
|
23258
|
-
return data;
|
|
23259
|
-
};
|
|
23260
|
-
/* end_public_function */
|
|
23261
|
-
|
|
23262
23237
|
const checkUserPermission = (userId, permission) => {
|
|
23263
23238
|
var _a;
|
|
23264
23239
|
const user = (_a = pullFromCache(['user', 'get', userId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
@@ -23920,36 +23895,6 @@ class AnalyticsEventCapturer {
|
|
|
23920
23895
|
metadata,
|
|
23921
23896
|
});
|
|
23922
23897
|
}
|
|
23923
|
-
markProductAsClicked(product, location, sourceType, sourceId) {
|
|
23924
|
-
const metadata = {
|
|
23925
|
-
location,
|
|
23926
|
-
sourceType,
|
|
23927
|
-
sourceId,
|
|
23928
|
-
};
|
|
23929
|
-
const activityType = "linkClicked" /* Amity.AnalyticEventActivityType.Click */;
|
|
23930
|
-
this.markAs({
|
|
23931
|
-
uniqueId: `${product.productId}.${activityType}.${location}`,
|
|
23932
|
-
contentId: product.productId,
|
|
23933
|
-
contentType: "product" /* Amity.AnalyticEventContentType.Product */,
|
|
23934
|
-
activityType,
|
|
23935
|
-
metadata,
|
|
23936
|
-
});
|
|
23937
|
-
}
|
|
23938
|
-
markProductAsViewed(product, location, sourceType, sourceId) {
|
|
23939
|
-
const metadata = {
|
|
23940
|
-
location,
|
|
23941
|
-
sourceType,
|
|
23942
|
-
sourceId,
|
|
23943
|
-
};
|
|
23944
|
-
const activityType = "view" /* Amity.AnalyticEventActivityType.View */;
|
|
23945
|
-
this.markAs({
|
|
23946
|
-
uniqueId: `${product.productId}.${activityType}.${location}`,
|
|
23947
|
-
contentId: product.productId,
|
|
23948
|
-
contentType: "product" /* Amity.AnalyticEventContentType.Product */,
|
|
23949
|
-
activityType,
|
|
23950
|
-
metadata,
|
|
23951
|
-
});
|
|
23952
|
-
}
|
|
23953
23898
|
}
|
|
23954
23899
|
|
|
23955
23900
|
class AnalyticsEngine {
|
|
@@ -23990,18 +23935,6 @@ class AnalyticsEngine {
|
|
|
23990
23935
|
this._eventCapturer.markStoryAsClicked(story);
|
|
23991
23936
|
}
|
|
23992
23937
|
}
|
|
23993
|
-
markProductAsClicked(product, location, sourceType, sourceId) {
|
|
23994
|
-
if (this._client.sessionState === "established" /* Amity.SessionStates.ESTABLISHED */ ||
|
|
23995
|
-
this._client.sessionState === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
23996
|
-
this._eventCapturer.markProductAsClicked(product, location, sourceType, sourceId);
|
|
23997
|
-
}
|
|
23998
|
-
}
|
|
23999
|
-
markProductAsViewed(product, location, sourceType, sourceId) {
|
|
24000
|
-
if (this._client.sessionState === "established" /* Amity.SessionStates.ESTABLISHED */ ||
|
|
24001
|
-
this._client.sessionState === "tokenExpired" /* Amity.SessionStates.TOKEN_EXPIRED */) {
|
|
24002
|
-
this._eventCapturer.markProductAsViewed(product, location, sourceType, sourceId);
|
|
24003
|
-
}
|
|
24004
|
-
}
|
|
24005
23938
|
established() {
|
|
24006
23939
|
this._eventSyncer.start();
|
|
24007
23940
|
}
|
|
@@ -26198,7 +26131,6 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
26198
26131
|
isUnreadCountEnabled,
|
|
26199
26132
|
useLegacyUnreadCount,
|
|
26200
26133
|
getMarkerSyncConsistentMode,
|
|
26201
|
-
getProductCatalogueSetting,
|
|
26202
26134
|
/**
|
|
26203
26135
|
* Prefix for the deviceId key in the local storage or async storage.
|
|
26204
26136
|
* This is allow user to have multiple SDK client and Mqtt client within the same app.
|
|
@@ -27026,7 +26958,7 @@ const getUserUnread = (callback) => {
|
|
|
27026
26958
|
};
|
|
27027
26959
|
};
|
|
27028
26960
|
|
|
27029
|
-
var index$
|
|
26961
|
+
var index$r = /*#__PURE__*/Object.freeze({
|
|
27030
26962
|
__proto__: null,
|
|
27031
26963
|
getActiveClient: getActiveClient,
|
|
27032
26964
|
getActiveUser: getActiveUser,
|
|
@@ -27047,7 +26979,6 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
27047
26979
|
getLinkPreviewMetadata: getLinkPreviewMetadata,
|
|
27048
26980
|
getSocialSettings: getSocialSettings,
|
|
27049
26981
|
getShareableLinkConfiguration: getShareableLinkConfiguration,
|
|
27050
|
-
getProductCatalogueSetting: getProductCatalogueSetting,
|
|
27051
26982
|
loginAsVisitor: loginAsVisitor,
|
|
27052
26983
|
loginAsBot: loginAsBot,
|
|
27053
26984
|
getCurrentUser: getCurrentUser,
|
|
@@ -28256,7 +28187,7 @@ const getMyFollowInfo = (callback) => {
|
|
|
28256
28187
|
};
|
|
28257
28188
|
/* end_public_function */
|
|
28258
28189
|
|
|
28259
|
-
var index$
|
|
28190
|
+
var index$q = /*#__PURE__*/Object.freeze({
|
|
28260
28191
|
__proto__: null,
|
|
28261
28192
|
blockUser: blockUser,
|
|
28262
28193
|
unBlockUser: unBlockUser,
|
|
@@ -29086,7 +29017,7 @@ const getWatchSessionStorage = () => {
|
|
|
29086
29017
|
return storageInstance;
|
|
29087
29018
|
};
|
|
29088
29019
|
|
|
29089
|
-
const privateKey = "
|
|
29020
|
+
const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUeTGiLdyc4L3GRLHjyK8xgVNXRMH\nbZWJ2a5NAgMBAAECggEASxuE+35zTFO/XydKgmvIGcWL9FbgMlXb7Vcf0nBoG945\nbiz0NVc2paraIhJXc608xbYF3qLmtAE1MVBI0ORyRdBHNxY024l/6H6SH60Ed+uI\nM4ysp5ourY6Vj+DLwpdRiI9YDjqYAQDIUmhNxJP7XPhOMoZI6st+xZQBM34ic/bv\nAMSJm9OZphSp3+qXVkFZztr2mxD2EZSJJLYxi8BCdgM2qhazalbcJ6zDKHCZWVWm\n8RRxDGldyMb/237JxETzP40tAlzOZDmBAbUgEnurDJ93RVDIE3rbZUshwgeQd18a\nem096mWgvB1AIKYgsTAR3pw+V19YWAjq/glP6fz8wQKBgQD/oQq+ukKF0PRgBeM5\ngeTjSwsdGppQLmf5ndujvoiz/TpdjDEPu6R8kigQr1rG2t4K/yfdZoI8RdmJD1al\n3Q7N9hofooSy4rj6E3txzWZCHJjHad2cnCp/O26HiReGAl7wTcfTmNdiFHhZQzm5\nJBkvWAiwuvQMNfEbnXxw6/vIDwKBgQDH7fX8gsc77JLvAWgp1MaQN/sbqVb6JeT1\nFQfR8E/WFCSmzQBtNzd5KgYuCeelwr/8DyYytvN2BzCYZXp73gI1jF3YlW5jVn74\nOY6TwQ095digwo6Z0yuxopdIOApKgAkL9PRKgNrqAf3NAyMua6lOGifzjDojC3KU\nfylQmxMn4wKBgHp2B9O/H0dEBw5JQ8W0+JX6yWQz7mEjGiR2/1W+XXb8hQ1zr709\nw1r6Gb+EghRpnZ3fBpYGGbYOMFx8wKHM+N6qW3F0ReX8v2juFGE8aRSa5oYBrWzt\nU16Idjbv8hj84cZ1PJmdyvDtpYn9rpWHOZl4rxEbPvbqkIsOMyNVqdT5AoGAOSge\nmwIIU2le2FVeohbibXiToWTYKMuMmURZ5/r72AgKMmWJKbAPe+Q3wBG01/7FRBpQ\noU8Ma0HC8s6QJbliiEyIx9JwrJWd1vkdecBHONrtA4ibm/5zD2WcOllLF+FitLhi\n3qnX6+6F0IaFGFBPJrTzlv0P4dTz/OAdv52V7GECgYEA2TttOKBAqWllgOaZOkql\nLVMJVmgR7s6tLi1+cEP8ZcapV9aRbRzTAKXm4f8AEhtlG9F9kCOvHYCYGi6JaiWJ\nZkHjeex3T+eE6Di6y5Bm/Ift5jtVhJ4jCVwHOKTMej79NPUFTJfv8hCo29haBDv6\nRXFrv+T21KCcw8k3sJeJWWQ=\n-----END PRIVATE KEY-----";
|
|
29090
29021
|
/*
|
|
29091
29022
|
* The crypto algorithm used for importing key and signing string
|
|
29092
29023
|
*/
|
|
@@ -30364,28 +30295,6 @@ const communityLinkedObject = (community) => {
|
|
|
30364
30295
|
} });
|
|
30365
30296
|
};
|
|
30366
30297
|
|
|
30367
|
-
const productLinkedObject = (product) => {
|
|
30368
|
-
const analyticsEngineInstance = AnalyticsEngine$1.getInstance();
|
|
30369
|
-
return Object.assign(Object.assign({}, product), { analytics: {
|
|
30370
|
-
markAsClicked: (location, sourceType, sourceId) => {
|
|
30371
|
-
analyticsEngineInstance.markProductAsClicked(product, location, sourceType, sourceId);
|
|
30372
|
-
},
|
|
30373
|
-
markAsViewed: (location, sourceType, sourceId) => {
|
|
30374
|
-
analyticsEngineInstance.markProductAsViewed(product, location, sourceType, sourceId);
|
|
30375
|
-
},
|
|
30376
|
-
} });
|
|
30377
|
-
};
|
|
30378
|
-
|
|
30379
|
-
const productTagLinkedObject = (productTag) => {
|
|
30380
|
-
var _a;
|
|
30381
|
-
const internalProduct = (_a = pullFromCache([
|
|
30382
|
-
'product',
|
|
30383
|
-
'get',
|
|
30384
|
-
productTag.productId,
|
|
30385
|
-
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
30386
|
-
return Object.assign(Object.assign({}, productTag), { product: internalProduct ? productLinkedObject(internalProduct) : undefined });
|
|
30387
|
-
};
|
|
30388
|
-
|
|
30389
30298
|
const postLinkedObject = (post) => {
|
|
30390
30299
|
return shallowClone(post, {
|
|
30391
30300
|
childrenPosts: post.children
|
|
@@ -30398,10 +30307,6 @@ const postLinkedObject = (post) => {
|
|
|
30398
30307
|
analyticsEngineInstance.markPostAsViewed(post.postId);
|
|
30399
30308
|
},
|
|
30400
30309
|
},
|
|
30401
|
-
get productTags() {
|
|
30402
|
-
var _a, _b;
|
|
30403
|
-
return (_b = (_a = post.productTags) === null || _a === void 0 ? void 0 : _a.map(productTag => productTagLinkedObject(productTag))) !== null && _b !== void 0 ? _b : [];
|
|
30404
|
-
},
|
|
30405
30310
|
get latestComments() {
|
|
30406
30311
|
if (!post.comments)
|
|
30407
30312
|
return [];
|
|
@@ -31401,7 +31306,6 @@ const LinkedObject = {
|
|
|
31401
31306
|
room: roomLinkedObject,
|
|
31402
31307
|
event: eventLinkedObject,
|
|
31403
31308
|
eventResponse: eventResponseLinkedObject,
|
|
31404
|
-
product: productLinkedObject,
|
|
31405
31309
|
};
|
|
31406
31310
|
|
|
31407
31311
|
/* begin_public_function
|
|
@@ -32140,7 +32044,7 @@ class SearchUserPaginationController extends PaginationController {
|
|
|
32140
32044
|
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT, displayName } = queryParams, params = __rest(queryParams, ["limit", "displayName"]);
|
|
32141
32045
|
const options = token ? { token } : { limit };
|
|
32142
32046
|
const { data: queryResponse } = await this.http.get(`/api/v3/users`, {
|
|
32143
|
-
params: Object.assign(Object.assign({}, params), { keyword: displayName
|
|
32047
|
+
params: Object.assign(Object.assign({}, params), { keyword: displayName, options, isDeleted: false }),
|
|
32144
32048
|
});
|
|
32145
32049
|
return queryResponse;
|
|
32146
32050
|
}
|
|
@@ -32392,9 +32296,9 @@ var AmityUserSearchMatchType;
|
|
|
32392
32296
|
AmityUserSearchMatchType["PARTIAL"] = "partial";
|
|
32393
32297
|
})(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
|
|
32394
32298
|
|
|
32395
|
-
var index$
|
|
32299
|
+
var index$p = /*#__PURE__*/Object.freeze({
|
|
32396
32300
|
__proto__: null,
|
|
32397
|
-
Relationship: index$
|
|
32301
|
+
Relationship: index$q,
|
|
32398
32302
|
getUserByIds: getUserByIds,
|
|
32399
32303
|
updateUser: updateUser,
|
|
32400
32304
|
flagUser: flagUser,
|
|
@@ -32797,7 +32701,7 @@ const uploadAudio = async (formData, onProgress) => {
|
|
|
32797
32701
|
};
|
|
32798
32702
|
/* end_public_function */
|
|
32799
32703
|
|
|
32800
|
-
var index$
|
|
32704
|
+
var index$o = /*#__PURE__*/Object.freeze({
|
|
32801
32705
|
__proto__: null,
|
|
32802
32706
|
getFile: getFile,
|
|
32803
32707
|
uploadFile: uploadFile,
|
|
@@ -34772,7 +34676,7 @@ const getReactions$1 = (params, callback, config) => {
|
|
|
34772
34676
|
};
|
|
34773
34677
|
/* end_public_function */
|
|
34774
34678
|
|
|
34775
|
-
var index$
|
|
34679
|
+
var index$n = /*#__PURE__*/Object.freeze({
|
|
34776
34680
|
__proto__: null,
|
|
34777
34681
|
addReaction: addReaction,
|
|
34778
34682
|
removeReaction: removeReaction,
|
|
@@ -36544,7 +36448,7 @@ const getMessages = (params, callback, config) => {
|
|
|
36544
36448
|
};
|
|
36545
36449
|
/* end_public_function */
|
|
36546
36450
|
|
|
36547
|
-
var index$
|
|
36451
|
+
var index$m = /*#__PURE__*/Object.freeze({
|
|
36548
36452
|
__proto__: null,
|
|
36549
36453
|
createMessage: createMessage,
|
|
36550
36454
|
updateMessage: updateMessage,
|
|
@@ -37070,7 +36974,7 @@ const stopMessageReceiptSync = (subChannelId) => {
|
|
|
37070
36974
|
};
|
|
37071
36975
|
/* end_public_function */
|
|
37072
36976
|
|
|
37073
|
-
var index$
|
|
36977
|
+
var index$l = /*#__PURE__*/Object.freeze({
|
|
37074
36978
|
__proto__: null,
|
|
37075
36979
|
getSubChannelByIds: getSubChannels$1,
|
|
37076
36980
|
createSubChannel: createSubChannel,
|
|
@@ -38397,7 +38301,7 @@ const searchMembers$1 = (params, callback, config) => {
|
|
|
38397
38301
|
};
|
|
38398
38302
|
/* end_public_function */
|
|
38399
38303
|
|
|
38400
|
-
var index$
|
|
38304
|
+
var index$k = /*#__PURE__*/Object.freeze({
|
|
38401
38305
|
__proto__: null,
|
|
38402
38306
|
addMembers: addMembers$1,
|
|
38403
38307
|
removeMembers: removeMembers$1,
|
|
@@ -38600,7 +38504,7 @@ const unmuteMembers = async (channelId, userIds) => {
|
|
|
38600
38504
|
};
|
|
38601
38505
|
/* end_public_function */
|
|
38602
38506
|
|
|
38603
|
-
var index$
|
|
38507
|
+
var index$j = /*#__PURE__*/Object.freeze({
|
|
38604
38508
|
__proto__: null,
|
|
38605
38509
|
addRole: addRole,
|
|
38606
38510
|
removeRole: removeRole,
|
|
@@ -38610,10 +38514,10 @@ var index$k = /*#__PURE__*/Object.freeze({
|
|
|
38610
38514
|
unmuteMembers: unmuteMembers
|
|
38611
38515
|
});
|
|
38612
38516
|
|
|
38613
|
-
var index$
|
|
38517
|
+
var index$i = /*#__PURE__*/Object.freeze({
|
|
38614
38518
|
__proto__: null,
|
|
38615
|
-
Membership: index$
|
|
38616
|
-
Moderation: index$
|
|
38519
|
+
Membership: index$k,
|
|
38520
|
+
Moderation: index$j,
|
|
38617
38521
|
getChannelByIds: getChannelByIds$1,
|
|
38618
38522
|
createChannel: createChannel,
|
|
38619
38523
|
updateChannel: updateChannel,
|
|
@@ -40016,7 +39920,7 @@ const searchMembers = (params, callback, config) => {
|
|
|
40016
39920
|
};
|
|
40017
39921
|
/* end_public_function */
|
|
40018
39922
|
|
|
40019
|
-
var index$
|
|
39923
|
+
var index$h = /*#__PURE__*/Object.freeze({
|
|
40020
39924
|
__proto__: null,
|
|
40021
39925
|
addMembers: addMembers,
|
|
40022
39926
|
removeMembers: removeMembers,
|
|
@@ -41267,7 +41171,7 @@ const unbanMembers = async (communityId, userIds) => {
|
|
|
41267
41171
|
};
|
|
41268
41172
|
/* end_public_function */
|
|
41269
41173
|
|
|
41270
|
-
var index$
|
|
41174
|
+
var index$g = /*#__PURE__*/Object.freeze({
|
|
41271
41175
|
__proto__: null,
|
|
41272
41176
|
addRoles: addRoles,
|
|
41273
41177
|
removeRoles: removeRoles,
|
|
@@ -41275,10 +41179,10 @@ var index$h = /*#__PURE__*/Object.freeze({
|
|
|
41275
41179
|
unbanMembers: unbanMembers
|
|
41276
41180
|
});
|
|
41277
41181
|
|
|
41278
|
-
var index$
|
|
41182
|
+
var index$f = /*#__PURE__*/Object.freeze({
|
|
41279
41183
|
__proto__: null,
|
|
41280
|
-
Moderation: index$
|
|
41281
|
-
Membership: index$
|
|
41184
|
+
Moderation: index$g,
|
|
41185
|
+
Membership: index$h,
|
|
41282
41186
|
getCommunityByIds: getCommunities$1,
|
|
41283
41187
|
createCommunity: createCommunity,
|
|
41284
41188
|
updateCommunity: updateCommunity,
|
|
@@ -41512,7 +41416,7 @@ const getCategories = (params, callback, config) => {
|
|
|
41512
41416
|
};
|
|
41513
41417
|
/* end_public_function */
|
|
41514
41418
|
|
|
41515
|
-
var index$
|
|
41419
|
+
var index$e = /*#__PURE__*/Object.freeze({
|
|
41516
41420
|
__proto__: null,
|
|
41517
41421
|
getCategory: getCategory,
|
|
41518
41422
|
getCategories: getCategories
|
|
@@ -41631,9 +41535,6 @@ var EnumPostActions;
|
|
|
41631
41535
|
EnumPostActions["OnPostReactionRemoved"] = "onPostReactionRemoved";
|
|
41632
41536
|
EnumPostActions["OnPostApproved"] = "onPostApproved";
|
|
41633
41537
|
EnumPostActions["OnPostDeclined"] = "onPostDeclined";
|
|
41634
|
-
EnumPostActions["OnPostPinProduct"] = "onPostPinProduct";
|
|
41635
|
-
EnumPostActions["OnPostUnpinProduct"] = "onPostUnpinProduct";
|
|
41636
|
-
EnumPostActions["OnPostUpdateProductTags"] = "onPostUpdateProductTags";
|
|
41637
41538
|
})(EnumPostActions || (EnumPostActions = {}));
|
|
41638
41539
|
|
|
41639
41540
|
class CustomRankingGlobalFeedQueryStreamController extends QueryStreamController {
|
|
@@ -42546,7 +42447,7 @@ const getComments = (params, callback, config) => {
|
|
|
42546
42447
|
};
|
|
42547
42448
|
/* end_public_function */
|
|
42548
42449
|
|
|
42549
|
-
var index$
|
|
42450
|
+
var index$d = /*#__PURE__*/Object.freeze({
|
|
42550
42451
|
__proto__: null,
|
|
42551
42452
|
getCommentByIds: getCommentByIds,
|
|
42552
42453
|
createComment: createComment,
|
|
@@ -43439,7 +43340,7 @@ const getCommunityFeed = (params, callback, config) => {
|
|
|
43439
43340
|
};
|
|
43440
43341
|
/* end_public_function */
|
|
43441
43342
|
|
|
43442
|
-
var index$
|
|
43343
|
+
var index$c = /*#__PURE__*/Object.freeze({
|
|
43443
43344
|
__proto__: null,
|
|
43444
43345
|
queryGlobalFeed: queryGlobalFeed,
|
|
43445
43346
|
getCustomRankingGlobalFeed: getCustomRankingGlobalFeed,
|
|
@@ -43555,17 +43456,7 @@ const createPost = async (bundle) => {
|
|
|
43555
43456
|
// eslint-disable-next-line no-param-reassign
|
|
43556
43457
|
delete bundle.dataType;
|
|
43557
43458
|
}
|
|
43558
|
-
const {
|
|
43559
|
-
const processedAttachments = attachments && attachments.length > 0 && bundle.attachmentProductTags
|
|
43560
|
-
? attachments.map(attachment => {
|
|
43561
|
-
var _a;
|
|
43562
|
-
const productTags = (_a = bundle.attachmentProductTags) === null || _a === void 0 ? void 0 : _a.get(attachment.fileId);
|
|
43563
|
-
if (productTags)
|
|
43564
|
-
return Object.assign(Object.assign({}, attachment), { productTags });
|
|
43565
|
-
return attachment;
|
|
43566
|
-
})
|
|
43567
|
-
: attachments;
|
|
43568
|
-
const { data: payload } = await client.http.post('/api/v4/posts', Object.assign(Object.assign({}, rest), { attachments: processedAttachments }));
|
|
43459
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
43569
43460
|
fireEvent('post.created', payload);
|
|
43570
43461
|
const data = preparePostPayload(payload);
|
|
43571
43462
|
const cachedAt = client.cache && Date.now();
|
|
@@ -43602,17 +43493,7 @@ const createPost = async (bundle) => {
|
|
|
43602
43493
|
const editPost = async (postId, patch) => {
|
|
43603
43494
|
const client = getActiveClient();
|
|
43604
43495
|
client.log('user/editPost', patch);
|
|
43605
|
-
const {
|
|
43606
|
-
const processedAttachments = attachments && attachments.length > 0 && patch.attachmentProductTags
|
|
43607
|
-
? attachments.map(attachment => {
|
|
43608
|
-
var _a;
|
|
43609
|
-
const productTags = (_a = patch.attachmentProductTags) === null || _a === void 0 ? void 0 : _a.get(attachment.fileId);
|
|
43610
|
-
if (productTags)
|
|
43611
|
-
return Object.assign(Object.assign({}, attachment), { productTags });
|
|
43612
|
-
return attachment;
|
|
43613
|
-
})
|
|
43614
|
-
: attachments;
|
|
43615
|
-
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, Object.assign(Object.assign({}, patch), { attachments: processedAttachments }));
|
|
43496
|
+
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, patch);
|
|
43616
43497
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
43617
43498
|
const cachedAt = client.cache && Date.now();
|
|
43618
43499
|
if (client.cache)
|
|
@@ -43939,17 +43820,7 @@ const isPostFlaggedByMe = async (postId) => {
|
|
|
43939
43820
|
const createClipPost = async (bundle) => {
|
|
43940
43821
|
const client = getActiveClient();
|
|
43941
43822
|
client.log('post/createPost', bundle);
|
|
43942
|
-
const {
|
|
43943
|
-
const processedAttachments = attachments && attachments.length > 0 && bundle.attachmentProductTags
|
|
43944
|
-
? attachments.map(attachment => {
|
|
43945
|
-
var _a;
|
|
43946
|
-
const productTags = (_a = bundle.attachmentProductTags) === null || _a === void 0 ? void 0 : _a.get(attachment.fileId);
|
|
43947
|
-
if (productTags)
|
|
43948
|
-
return Object.assign(Object.assign({}, attachment), { productTags });
|
|
43949
|
-
return attachment;
|
|
43950
|
-
})
|
|
43951
|
-
: attachments;
|
|
43952
|
-
const { data: payload } = await client.http.post('/api/v4/posts', Object.assign(Object.assign({}, rest), { attachments: processedAttachments }));
|
|
43823
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
43953
43824
|
fireEvent('post.created', payload);
|
|
43954
43825
|
const data = prepareMembershipPayload(payload, 'communityUsers');
|
|
43955
43826
|
const cachedAt = client.cache && Date.now();
|
|
@@ -43988,16 +43859,7 @@ const createClipPost = async (bundle) => {
|
|
|
43988
43859
|
const createAudioPost = async (bundle) => {
|
|
43989
43860
|
const client = getActiveClient();
|
|
43990
43861
|
client.log('post/createAudioPost', bundle);
|
|
43991
|
-
const {
|
|
43992
|
-
const processedAttachments = attachments && attachments.length > 0 && attachmentProductTags
|
|
43993
|
-
? attachments.map(attachment => {
|
|
43994
|
-
const productTags = attachmentProductTags === null || attachmentProductTags === void 0 ? void 0 : attachmentProductTags.get(attachment.fileId);
|
|
43995
|
-
if (productTags)
|
|
43996
|
-
return Object.assign(Object.assign({}, attachment), { productTags });
|
|
43997
|
-
return attachment;
|
|
43998
|
-
})
|
|
43999
|
-
: attachments;
|
|
44000
|
-
const { data: payload } = await client.http.post('/api/v4/posts', Object.assign(Object.assign({}, rest), { attachments: processedAttachments }));
|
|
43862
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
44001
43863
|
fireEvent('post.created', payload);
|
|
44002
43864
|
const data = preparePostPayload(payload);
|
|
44003
43865
|
const cachedAt = client.cache && Date.now();
|
|
@@ -44041,17 +43903,7 @@ const createMixedMediaPost = async (bundle) => {
|
|
|
44041
43903
|
var _a;
|
|
44042
43904
|
const client = getActiveClient();
|
|
44043
43905
|
client.log('post/createMixedMediaPost', bundle);
|
|
44044
|
-
const {
|
|
44045
|
-
const processedAttachments = attachments && attachments.length > 0 && bundle.attachmentProductTags
|
|
44046
|
-
? attachments.map(attachment => {
|
|
44047
|
-
var _a;
|
|
44048
|
-
const productTags = (_a = bundle.attachmentProductTags) === null || _a === void 0 ? void 0 : _a.get(attachment.fileId);
|
|
44049
|
-
if (productTags)
|
|
44050
|
-
return Object.assign(Object.assign({}, attachment), { productTags });
|
|
44051
|
-
return attachment;
|
|
44052
|
-
})
|
|
44053
|
-
: attachments;
|
|
44054
|
-
const { data: payload } = await client.http.post('/api/v4/posts', Object.assign(Object.assign({}, rest), { attachments: processedAttachments }));
|
|
43906
|
+
const { data: payload } = await client.http.post('/api/v4/posts', bundle);
|
|
44055
43907
|
fireEvent('post.created', payload);
|
|
44056
43908
|
const data = preparePostPayload(payload);
|
|
44057
43909
|
const cachedAt = client.cache && Date.now();
|
|
@@ -44064,143 +43916,6 @@ const createMixedMediaPost = async (bundle) => {
|
|
|
44064
43916
|
};
|
|
44065
43917
|
/* end_public_function */
|
|
44066
43918
|
|
|
44067
|
-
/* begin_public_function
|
|
44068
|
-
id: post.create_room_post
|
|
44069
|
-
*/
|
|
44070
|
-
/**
|
|
44071
|
-
* ```js
|
|
44072
|
-
* import { PostRepository } from '@amityco/ts-sdk'
|
|
44073
|
-
* const created = await PostRepository.createRoomPost({
|
|
44074
|
-
* targetType: 'user',
|
|
44075
|
-
* targetId: 'foobar',
|
|
44076
|
-
* data: { text: 'hello world', title: 'Room Title', roomId: 'roomId123' }
|
|
44077
|
-
* }))
|
|
44078
|
-
* ```
|
|
44079
|
-
*
|
|
44080
|
-
* Creates an {@link Amity.Post}
|
|
44081
|
-
*
|
|
44082
|
-
* @param bundle The data necessary to create a new {@link Amity.Post}
|
|
44083
|
-
* @returns The newly created {@link Amity.Post}
|
|
44084
|
-
*
|
|
44085
|
-
* @category Post API
|
|
44086
|
-
* @async
|
|
44087
|
-
*/
|
|
44088
|
-
const createRoomPost = async (bundle) => {
|
|
44089
|
-
const client = getActiveClient();
|
|
44090
|
-
client.log('post/createRoomPost', bundle);
|
|
44091
|
-
const { data: payload } = await client.http.post('/api/v4/posts', Object.assign(Object.assign({}, bundle), { dataType: 'room' }));
|
|
44092
|
-
fireEvent('post.created', payload);
|
|
44093
|
-
const data = preparePostPayload(payload);
|
|
44094
|
-
const cachedAt = client.cache && Date.now();
|
|
44095
|
-
if (client.cache)
|
|
44096
|
-
ingestInCache(data, { cachedAt });
|
|
44097
|
-
const { posts } = data;
|
|
44098
|
-
return {
|
|
44099
|
-
data: LinkedObject.post(posts[0]),
|
|
44100
|
-
cachedAt,
|
|
44101
|
-
};
|
|
44102
|
-
};
|
|
44103
|
-
/* end_public_function */
|
|
44104
|
-
|
|
44105
|
-
/* begin_public_function
|
|
44106
|
-
id: post.pin_product
|
|
44107
|
-
*/
|
|
44108
|
-
/**
|
|
44109
|
-
* ```js
|
|
44110
|
-
* import { PostRepository } from '@amityco/ts-sdk'
|
|
44111
|
-
* const pinProduct = await PostRepository.pinProduct(postId, pinnedProductId)
|
|
44112
|
-
* ```
|
|
44113
|
-
*
|
|
44114
|
-
* @param postId The ID of the post to unpin the product from
|
|
44115
|
-
* @param productId the ID of the product to pin
|
|
44116
|
-
* @returns Amity.Post
|
|
44117
|
-
*
|
|
44118
|
-
* @category Post API
|
|
44119
|
-
* @async
|
|
44120
|
-
* */
|
|
44121
|
-
const pinProduct = async (postId, pinnedProductId) => {
|
|
44122
|
-
const client = getActiveClient();
|
|
44123
|
-
client.log('post/pinProduct', postId);
|
|
44124
|
-
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, {
|
|
44125
|
-
pinnedProductId,
|
|
44126
|
-
});
|
|
44127
|
-
const data = preparePostPayload(payload);
|
|
44128
|
-
const cachedAt = client.cache && Date.now();
|
|
44129
|
-
if (client.cache)
|
|
44130
|
-
ingestInCache(payload, { cachedAt });
|
|
44131
|
-
fireEvent('local.post.updated', payload);
|
|
44132
|
-
return {
|
|
44133
|
-
data: postLinkedObject(data === null || data === void 0 ? void 0 : data.posts[0]),
|
|
44134
|
-
cachedAt,
|
|
44135
|
-
};
|
|
44136
|
-
};
|
|
44137
|
-
/* end_public_function */
|
|
44138
|
-
|
|
44139
|
-
/* begin_public_function
|
|
44140
|
-
id: post.unpin_product
|
|
44141
|
-
*/
|
|
44142
|
-
/**
|
|
44143
|
-
* ```js
|
|
44144
|
-
* import { PostRepository } from '@amityco/ts-sdk'
|
|
44145
|
-
* const unpinProduct = await PostRepository.unpinProduct(postId)
|
|
44146
|
-
* ```
|
|
44147
|
-
*
|
|
44148
|
-
* @param postId The ID of the post to unpin the product from
|
|
44149
|
-
* @returns Amity.Post
|
|
44150
|
-
*
|
|
44151
|
-
* @category Post API
|
|
44152
|
-
* @async
|
|
44153
|
-
* */
|
|
44154
|
-
const unpinProduct = async (postId) => {
|
|
44155
|
-
const client = getActiveClient();
|
|
44156
|
-
client.log('post/unpinProduct', postId);
|
|
44157
|
-
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, { pinnedProductId: null });
|
|
44158
|
-
const data = preparePostPayload(payload);
|
|
44159
|
-
const cachedAt = client.cache && Date.now();
|
|
44160
|
-
if (client.cache)
|
|
44161
|
-
ingestInCache(payload, { cachedAt });
|
|
44162
|
-
fireEvent('local.post.updated', payload);
|
|
44163
|
-
return {
|
|
44164
|
-
data: postLinkedObject(data === null || data === void 0 ? void 0 : data.posts[0]),
|
|
44165
|
-
cachedAt,
|
|
44166
|
-
};
|
|
44167
|
-
};
|
|
44168
|
-
/* end_public_function */
|
|
44169
|
-
|
|
44170
|
-
/* begin_public_function
|
|
44171
|
-
id: post.update_product_tags
|
|
44172
|
-
*/
|
|
44173
|
-
/**
|
|
44174
|
-
* ```js
|
|
44175
|
-
* import { PostRepository } from '@amityco/ts-sdk'
|
|
44176
|
-
* const updateProductTags = await PostRepository.updateProductTags(postId, productTags)
|
|
44177
|
-
* ```
|
|
44178
|
-
*
|
|
44179
|
-
* @param postId of child room
|
|
44180
|
-
* @param productTags the array of product tags to set on the post
|
|
44181
|
-
* @returns Amity.Post
|
|
44182
|
-
*
|
|
44183
|
-
* @category Post API
|
|
44184
|
-
* @async
|
|
44185
|
-
* */
|
|
44186
|
-
const updateProductTags = async (postId, productTags) => {
|
|
44187
|
-
const client = getActiveClient();
|
|
44188
|
-
client.log('post/updateProductTags', postId);
|
|
44189
|
-
const { data: payload } = await client.http.put(`/api/v4/posts/${encodeURIComponent(postId)}`, {
|
|
44190
|
-
productTags,
|
|
44191
|
-
});
|
|
44192
|
-
const data = preparePostPayload(payload);
|
|
44193
|
-
const cachedAt = client.cache && Date.now();
|
|
44194
|
-
if (client.cache)
|
|
44195
|
-
ingestInCache(payload, { cachedAt });
|
|
44196
|
-
fireEvent('local.post.updated', payload);
|
|
44197
|
-
return {
|
|
44198
|
-
data: postLinkedObject(data === null || data === void 0 ? void 0 : data.posts[0]),
|
|
44199
|
-
cachedAt,
|
|
44200
|
-
};
|
|
44201
|
-
};
|
|
44202
|
-
/* end_public_function */
|
|
44203
|
-
|
|
44204
43919
|
/* begin_public_function
|
|
44205
43920
|
id: post.get
|
|
44206
43921
|
*/
|
|
@@ -45553,41 +45268,6 @@ const leaveRoom = async (roomId) => {
|
|
|
45553
45268
|
};
|
|
45554
45269
|
/* end_public_function */
|
|
45555
45270
|
|
|
45556
|
-
/* begin_public_function
|
|
45557
|
-
id: room.update_cohost_permissions
|
|
45558
|
-
*/
|
|
45559
|
-
/**
|
|
45560
|
-
* ```js
|
|
45561
|
-
* import { updateCohostPermission } from '@amityco/ts-sdk'
|
|
45562
|
-
* const updated = await updateCohostPermission('roomId', 'cohostId', true)
|
|
45563
|
-
* ```
|
|
45564
|
-
*
|
|
45565
|
-
* Updates an {@link Amity.InternalRoom}
|
|
45566
|
-
*
|
|
45567
|
-
* @param roomId The ID of the room to update
|
|
45568
|
-
* @param cohostId The ID of the cohost to update
|
|
45569
|
-
* @param canManageProductTags The permission to manage product tags
|
|
45570
|
-
* @returns The updated {@link Amity.InternalRoom}
|
|
45571
|
-
*
|
|
45572
|
-
* @category Room API
|
|
45573
|
-
* @async
|
|
45574
|
-
*/
|
|
45575
|
-
const updateCohostPermission = async (roomId, cohostId, canManageProductTags) => {
|
|
45576
|
-
const client = getActiveClient();
|
|
45577
|
-
client.log('room/updatedCoHostPermission', { roomId, cohostId, canManageProductTags });
|
|
45578
|
-
const { data } = await client.http.put(`/api/v1/rooms/${roomId}/participants/${cohostId}`, { canManageProductTags });
|
|
45579
|
-
fireEvent('local.room.didUpdate', data);
|
|
45580
|
-
const cachedAt = client.cache && Date.now();
|
|
45581
|
-
if (client.cache)
|
|
45582
|
-
ingestInCache(data, { cachedAt });
|
|
45583
|
-
const { rooms } = data;
|
|
45584
|
-
return {
|
|
45585
|
-
data: roomLinkedObject(rooms[0]),
|
|
45586
|
-
cachedAt,
|
|
45587
|
-
};
|
|
45588
|
-
};
|
|
45589
|
-
/* end_public_function */
|
|
45590
|
-
|
|
45591
45271
|
/**
|
|
45592
45272
|
* ```js
|
|
45593
45273
|
* import { onRoomStartBroadcasting } from '@amityco/ts-sdk'
|
|
@@ -45962,30 +45642,6 @@ const onRoomTerminated = (callback) => {
|
|
|
45962
45642
|
return createEventSubscriber(client, 'room/onRoomTerminated', 'room.terminated', filter);
|
|
45963
45643
|
};
|
|
45964
45644
|
|
|
45965
|
-
/**
|
|
45966
|
-
* ```js
|
|
45967
|
-
* import { onRoomDidUpdate } from '@amityco/ts-sdk'
|
|
45968
|
-
* const dispose = onRoomDidUpdate(room => {
|
|
45969
|
-
* // ...
|
|
45970
|
-
* })
|
|
45971
|
-
* ```
|
|
45972
|
-
*
|
|
45973
|
-
* Fired when a {@link Amity.Room} has been updated locally
|
|
45974
|
-
*
|
|
45975
|
-
* @param callback The function to call when the event was fired
|
|
45976
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
45977
|
-
*
|
|
45978
|
-
* @category Room Events
|
|
45979
|
-
*/
|
|
45980
|
-
const onRoomDidUpdate = (callback) => {
|
|
45981
|
-
const client = getActiveClient();
|
|
45982
|
-
const filter = (payload) => {
|
|
45983
|
-
ingestInCache(payload);
|
|
45984
|
-
callback(payload.rooms[0]);
|
|
45985
|
-
};
|
|
45986
|
-
return createEventSubscriber(client, 'room/onRoomDidUpdate', 'local.room.didUpdate', filter);
|
|
45987
|
-
};
|
|
45988
|
-
|
|
45989
45645
|
/**
|
|
45990
45646
|
* ```js
|
|
45991
45647
|
* import { onRoomCreated } from '@amityco/ts-sdk'
|
|
@@ -46134,30 +45790,6 @@ const onRoomLeft = (callback) => {
|
|
|
46134
45790
|
return createEventSubscriber(client, 'room/onRoomLeft', 'local.room.left', filter);
|
|
46135
45791
|
};
|
|
46136
45792
|
|
|
46137
|
-
/**
|
|
46138
|
-
* ```js
|
|
46139
|
-
* import { onLocalRoomDidUpdate } from '@amityco/ts-sdk'
|
|
46140
|
-
* const dispose = onLocalRoomDidUpdate(room => {
|
|
46141
|
-
* // ...
|
|
46142
|
-
* })
|
|
46143
|
-
* ```
|
|
46144
|
-
*
|
|
46145
|
-
* Fired when a {@link Amity.Room} has been updated locally
|
|
46146
|
-
*
|
|
46147
|
-
* @param callback The function to call when the event was fired
|
|
46148
|
-
* @returns an {@link Amity.Unsubscriber} function to stop listening
|
|
46149
|
-
*
|
|
46150
|
-
* @category Room Events
|
|
46151
|
-
*/
|
|
46152
|
-
const onLocalRoomDidUpdate = (callback) => {
|
|
46153
|
-
const client = getActiveClient();
|
|
46154
|
-
const filter = (payload) => {
|
|
46155
|
-
ingestInCache(payload);
|
|
46156
|
-
callback(payload.rooms[0]);
|
|
46157
|
-
};
|
|
46158
|
-
return createEventSubscriber(client, 'room/onLocalRoomDidUpdate', 'room.didUpdate', filter);
|
|
46159
|
-
};
|
|
46160
|
-
|
|
46161
45793
|
/**
|
|
46162
45794
|
* ```js
|
|
46163
45795
|
* import { onRoomParticipantRemoved } from '@amityco/ts-sdk'
|
|
@@ -46191,7 +45823,6 @@ var EnumRoomActions;
|
|
|
46191
45823
|
EnumRoomActions["OnRoomEndBroadcasting"] = "OnRoomEndBroadcasting";
|
|
46192
45824
|
EnumRoomActions["OnRoomParticipantJoined"] = "OnRoomParticipantJoined";
|
|
46193
45825
|
EnumRoomActions["OnRoomParticipantLeft"] = "OnRoomParticipantLeft";
|
|
46194
|
-
EnumRoomActions["OnRoomDidUpdate"] = "OnRoomDidUpdate";
|
|
46195
45826
|
})(EnumRoomActions || (EnumRoomActions = {}));
|
|
46196
45827
|
|
|
46197
45828
|
const convertToRoomEventPayload = (eventHandler) => (callback) => eventHandler((payload) => {
|
|
@@ -46243,17 +45874,10 @@ const getRoomSubscription = () => [
|
|
|
46243
45874
|
fn: convertEventPayload(onRoomCoHostInviteAccepted, 'targetId', 'room'),
|
|
46244
45875
|
action: EnumRoomActions.OnRoomUpdated,
|
|
46245
45876
|
},
|
|
46246
|
-
{
|
|
46247
|
-
fn: onRoomDidUpdate,
|
|
46248
|
-
action: EnumRoomActions.OnRoomDidUpdate,
|
|
46249
|
-
},
|
|
46250
|
-
{
|
|
46251
|
-
fn: onLocalRoomDidUpdate,
|
|
46252
|
-
action: EnumRoomActions.OnRoomDidUpdate,
|
|
46253
|
-
},
|
|
46254
45877
|
];
|
|
46255
45878
|
|
|
46256
45879
|
const getRoom = (roomId, callback) => {
|
|
45880
|
+
// TODO: add callbackDataSelector if there are linked object fields
|
|
46257
45881
|
return liveObject(roomId, callback, '_id', getRoomById, [
|
|
46258
45882
|
onRoomEndBroadcasting,
|
|
46259
45883
|
onRoomStartBroadcasting,
|
|
@@ -46266,8 +45890,6 @@ const getRoom = (roomId, callback) => {
|
|
|
46266
45890
|
onRoomParticipantRemovedLocal,
|
|
46267
45891
|
convertToRoomEventPayload(onRoomParticipantStageJoined),
|
|
46268
45892
|
convertEventPayload(onRoomCoHostInviteAccepted, 'targetId', 'room'),
|
|
46269
|
-
onRoomDidUpdate,
|
|
46270
|
-
onLocalRoomDidUpdate,
|
|
46271
45893
|
], {
|
|
46272
45894
|
callbackDataSelector: (data) => {
|
|
46273
45895
|
if (!data)
|
|
@@ -46460,7 +46082,7 @@ const getRooms = (params, callback, config) => {
|
|
|
46460
46082
|
};
|
|
46461
46083
|
/* end_public_function */
|
|
46462
46084
|
|
|
46463
|
-
var index$
|
|
46085
|
+
var index$b = /*#__PURE__*/Object.freeze({
|
|
46464
46086
|
__proto__: null,
|
|
46465
46087
|
createRoom: createRoom,
|
|
46466
46088
|
updateRoom: updateRoom,
|
|
@@ -46474,7 +46096,6 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
46474
46096
|
WatchSessionStorage: WatchSessionStorage,
|
|
46475
46097
|
getWatchSessionStorage: getWatchSessionStorage,
|
|
46476
46098
|
syncWatchSessions: syncWatchSessions,
|
|
46477
|
-
updateCohostPermission: updateCohostPermission,
|
|
46478
46099
|
onRoomStartBroadcasting: onRoomStartBroadcasting,
|
|
46479
46100
|
onRoomWaitingReconnect: onRoomWaitingReconnect,
|
|
46480
46101
|
onRoomEndBroadcasting: onRoomEndBroadcasting,
|
|
@@ -46488,14 +46109,12 @@ var index$c = /*#__PURE__*/Object.freeze({
|
|
|
46488
46109
|
onRoomParticipantStageLeft: onRoomParticipantStageLeft,
|
|
46489
46110
|
onRoomParticipantStageJoined: onRoomParticipantStageJoined,
|
|
46490
46111
|
onRoomTerminated: onRoomTerminated,
|
|
46491
|
-
onRoomDidUpdate: onRoomDidUpdate,
|
|
46492
46112
|
onRoomCreated: onRoomCreated,
|
|
46493
46113
|
onRoomUpdated: onRoomUpdated,
|
|
46494
46114
|
onRoomDeleted: onRoomDeleted,
|
|
46495
46115
|
onRoomStopped: onRoomStopped,
|
|
46496
46116
|
onRoomParticipantRemoved: onRoomParticipantRemoved,
|
|
46497
46117
|
onRoomLeft: onRoomLeft,
|
|
46498
|
-
onLocalRoomDidUpdate: onLocalRoomDidUpdate,
|
|
46499
46118
|
getRoom: getRoom,
|
|
46500
46119
|
getRooms: getRooms
|
|
46501
46120
|
});
|
|
@@ -46759,7 +46378,7 @@ const getCommunityLiveRoomPosts = (params, callback, config) => {
|
|
|
46759
46378
|
};
|
|
46760
46379
|
/* end_public_function */
|
|
46761
46380
|
|
|
46762
|
-
var index$
|
|
46381
|
+
var index$a = /*#__PURE__*/Object.freeze({
|
|
46763
46382
|
__proto__: null,
|
|
46764
46383
|
getPostByIds: getPostByIds,
|
|
46765
46384
|
createPost: createPost,
|
|
@@ -46775,10 +46394,6 @@ var index$b = /*#__PURE__*/Object.freeze({
|
|
|
46775
46394
|
createClipPost: createClipPost,
|
|
46776
46395
|
createAudioPost: createAudioPost,
|
|
46777
46396
|
createMixedMediaPost: createMixedMediaPost,
|
|
46778
|
-
createRoomPost: createRoomPost,
|
|
46779
|
-
pinProduct: pinProduct,
|
|
46780
|
-
unpinProduct: unpinProduct,
|
|
46781
|
-
updateProductTags: updateProductTags,
|
|
46782
46397
|
onPostCreated: onPostCreated,
|
|
46783
46398
|
onPostUpdated: onPostUpdated,
|
|
46784
46399
|
onPostDeleted: onPostDeleted,
|
|
@@ -47373,7 +46988,7 @@ const getStreams = (params, callback, config) => {
|
|
|
47373
46988
|
};
|
|
47374
46989
|
};
|
|
47375
46990
|
|
|
47376
|
-
var index$
|
|
46991
|
+
var index$9 = /*#__PURE__*/Object.freeze({
|
|
47377
46992
|
__proto__: null,
|
|
47378
46993
|
createStream: createStream,
|
|
47379
46994
|
updateStream: updateStream,
|
|
@@ -47676,7 +47291,7 @@ const stopHeartbeat = (roomId) => {
|
|
|
47676
47291
|
};
|
|
47677
47292
|
/* end_public_function */
|
|
47678
47293
|
|
|
47679
|
-
var index$
|
|
47294
|
+
var index$8 = /*#__PURE__*/Object.freeze({
|
|
47680
47295
|
__proto__: null,
|
|
47681
47296
|
getRoomOnlineUsers: getRoomOnlineUsers,
|
|
47682
47297
|
getRoomUserCount: getRoomUserCount,
|
|
@@ -47984,7 +47599,7 @@ const getPoll = (pollId, callback) => {
|
|
|
47984
47599
|
};
|
|
47985
47600
|
/* end_public_function */
|
|
47986
47601
|
|
|
47987
|
-
var index$
|
|
47602
|
+
var index$7 = /*#__PURE__*/Object.freeze({
|
|
47988
47603
|
__proto__: null,
|
|
47989
47604
|
createPoll: createPoll,
|
|
47990
47605
|
closePoll: closePoll,
|
|
@@ -48288,7 +47903,7 @@ const getPlayer = async (parameters) => {
|
|
|
48288
47903
|
return video;
|
|
48289
47904
|
};
|
|
48290
47905
|
|
|
48291
|
-
var index$
|
|
47906
|
+
var index$6 = /*#__PURE__*/Object.freeze({
|
|
48292
47907
|
__proto__: null,
|
|
48293
47908
|
getPlayer: getPlayer
|
|
48294
47909
|
});
|
|
@@ -49461,7 +49076,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
|
|
|
49461
49076
|
};
|
|
49462
49077
|
};
|
|
49463
49078
|
|
|
49464
|
-
var index$
|
|
49079
|
+
var index$5 = /*#__PURE__*/Object.freeze({
|
|
49465
49080
|
__proto__: null,
|
|
49466
49081
|
createImageStory: createImageStory,
|
|
49467
49082
|
createVideoStory: createVideoStory,
|
|
@@ -49498,7 +49113,7 @@ const getNetworkAds = async () => {
|
|
|
49498
49113
|
};
|
|
49499
49114
|
};
|
|
49500
49115
|
|
|
49501
|
-
var index$
|
|
49116
|
+
var index$4 = /*#__PURE__*/Object.freeze({
|
|
49502
49117
|
__proto__: null,
|
|
49503
49118
|
getNetworkAds: getNetworkAds
|
|
49504
49119
|
});
|
|
@@ -49889,7 +49504,7 @@ const markTraySeen = async (lastSeenAt) => {
|
|
|
49889
49504
|
};
|
|
49890
49505
|
/* end_public_function */
|
|
49891
49506
|
|
|
49892
|
-
var index$
|
|
49507
|
+
var index$3 = /*#__PURE__*/Object.freeze({
|
|
49893
49508
|
__proto__: null,
|
|
49894
49509
|
getNotificationTraySeen: getNotificationTraySeen,
|
|
49895
49510
|
getNotificationTrayItems: getNotificationTrayItems,
|
|
@@ -50187,7 +49802,7 @@ const getInvitations = (params, callback) => {
|
|
|
50187
49802
|
};
|
|
50188
49803
|
};
|
|
50189
49804
|
|
|
50190
|
-
var index$
|
|
49805
|
+
var index$2 = /*#__PURE__*/Object.freeze({
|
|
50191
49806
|
__proto__: null,
|
|
50192
49807
|
cancelInvitation: cancelInvitation,
|
|
50193
49808
|
onLocalInvitationCreated: onLocalInvitationCreated,
|
|
@@ -50336,7 +49951,7 @@ const getReactions = (postId, callback) => {
|
|
|
50336
49951
|
};
|
|
50337
49952
|
};
|
|
50338
49953
|
|
|
50339
|
-
var index$
|
|
49954
|
+
var index$1 = /*#__PURE__*/Object.freeze({
|
|
50340
49955
|
__proto__: null,
|
|
50341
49956
|
createReaction: createReaction,
|
|
50342
49957
|
onLiveReactionCreated: onLiveReactionCreated,
|
|
@@ -50819,7 +50434,7 @@ const getMyEvents = (params, callback, config) => {
|
|
|
50819
50434
|
};
|
|
50820
50435
|
};
|
|
50821
50436
|
|
|
50822
|
-
var index
|
|
50437
|
+
var index = /*#__PURE__*/Object.freeze({
|
|
50823
50438
|
__proto__: null,
|
|
50824
50439
|
createEvent: createEvent,
|
|
50825
50440
|
updateEvent: updateEvent,
|
|
@@ -50840,263 +50455,4 @@ var index$1 = /*#__PURE__*/Object.freeze({
|
|
|
50840
50455
|
getRSVPs: getRSVPs
|
|
50841
50456
|
});
|
|
50842
50457
|
|
|
50843
|
-
|
|
50844
|
-
const client = getActiveClient();
|
|
50845
|
-
client.log('product/getProduct', productId);
|
|
50846
|
-
isInTombstone('product', productId);
|
|
50847
|
-
let payload;
|
|
50848
|
-
try {
|
|
50849
|
-
const response = await client.http.get(`/api/v1/products/${encodeURIComponent(productId)}`);
|
|
50850
|
-
payload = response.data;
|
|
50851
|
-
}
|
|
50852
|
-
catch (error) {
|
|
50853
|
-
if (checkIfShouldGoesToTombstone(error === null || error === void 0 ? void 0 : error.code)) {
|
|
50854
|
-
pushToTombstone('product', productId);
|
|
50855
|
-
}
|
|
50856
|
-
throw error;
|
|
50857
|
-
}
|
|
50858
|
-
const cachedAt = client.cache && Date.now();
|
|
50859
|
-
if (client.cache)
|
|
50860
|
-
ingestInCache(payload, { cachedAt });
|
|
50861
|
-
const { products } = payload;
|
|
50862
|
-
const result = products.find(product => product.productId === productId);
|
|
50863
|
-
return {
|
|
50864
|
-
data: result,
|
|
50865
|
-
cachedAt,
|
|
50866
|
-
};
|
|
50867
|
-
};
|
|
50868
|
-
getProduct$1.locally = (productId) => {
|
|
50869
|
-
const client = getActiveClient();
|
|
50870
|
-
client.log('product/getProduct.locally', productId);
|
|
50871
|
-
if (!client.cache)
|
|
50872
|
-
return;
|
|
50873
|
-
const cached = pullFromCache(['product', 'get', productId]);
|
|
50874
|
-
if (!cached)
|
|
50875
|
-
return;
|
|
50876
|
-
return {
|
|
50877
|
-
data: cached.data,
|
|
50878
|
-
cachedAt: cached.cachedAt,
|
|
50879
|
-
};
|
|
50880
|
-
};
|
|
50881
|
-
|
|
50882
|
-
/* begin_public_function
|
|
50883
|
-
id: product.get
|
|
50884
|
-
*/
|
|
50885
|
-
/**
|
|
50886
|
-
* ```js
|
|
50887
|
-
* import { ProductRepository } from '@amityco/ts-sdk';
|
|
50888
|
-
*
|
|
50889
|
-
* let product;
|
|
50890
|
-
*
|
|
50891
|
-
* const unsub = ProductRepository.getProduct(productId, response => {
|
|
50892
|
-
* product = response.data;
|
|
50893
|
-
* });
|
|
50894
|
-
* ```
|
|
50895
|
-
*
|
|
50896
|
-
* Observe all mutation on a given {@link Amity.Product}
|
|
50897
|
-
*
|
|
50898
|
-
* @param productId the ID of the product to observe
|
|
50899
|
-
* @param callback the function to call when new data are available
|
|
50900
|
-
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the product
|
|
50901
|
-
*
|
|
50902
|
-
* @category Product Live Object
|
|
50903
|
-
*/
|
|
50904
|
-
const getProduct = (productId, callback) => {
|
|
50905
|
-
const responder = (snapshot) => {
|
|
50906
|
-
const { data } = snapshot;
|
|
50907
|
-
callback(Object.assign(Object.assign({}, snapshot), { data: data ? LinkedObject.product(data) : data }));
|
|
50908
|
-
};
|
|
50909
|
-
return liveObject(productId, responder, 'productId', getProduct$1, []);
|
|
50910
|
-
};
|
|
50911
|
-
/* end_public_function */
|
|
50912
|
-
|
|
50913
|
-
class SearchProductPaginationController extends PaginationController {
|
|
50914
|
-
async getRequest(queryParams, token) {
|
|
50915
|
-
const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
|
|
50916
|
-
const options = token ? { token } : { limit };
|
|
50917
|
-
const { data: queryResponse } = await this.http.get(`/api/v1/products/search`, {
|
|
50918
|
-
params: Object.assign(Object.assign({}, params), { options }),
|
|
50919
|
-
});
|
|
50920
|
-
return queryResponse;
|
|
50921
|
-
}
|
|
50922
|
-
}
|
|
50923
|
-
|
|
50924
|
-
class SearchProductQueryStreamController extends QueryStreamController {
|
|
50925
|
-
constructor(query, cacheKey, notifyChange) {
|
|
50926
|
-
super(query, cacheKey);
|
|
50927
|
-
this.notifyChange = notifyChange;
|
|
50928
|
-
}
|
|
50929
|
-
// eslint-disable-next-line class-methods-use-this
|
|
50930
|
-
saveToMainDB(response) {
|
|
50931
|
-
const client = getActiveClient();
|
|
50932
|
-
const cachedAt = client.cache && Date.now();
|
|
50933
|
-
if (client.cache) {
|
|
50934
|
-
ingestInCache(response, { cachedAt });
|
|
50935
|
-
}
|
|
50936
|
-
}
|
|
50937
|
-
appendToQueryStream(response, direction, refresh = false) {
|
|
50938
|
-
var _a, _b;
|
|
50939
|
-
if (refresh) {
|
|
50940
|
-
pushToCache(this.cacheKey, {
|
|
50941
|
-
data: response.products.map(getResolver('product')),
|
|
50942
|
-
});
|
|
50943
|
-
}
|
|
50944
|
-
else {
|
|
50945
|
-
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
50946
|
-
const products = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
|
|
50947
|
-
pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [...new Set([...products, ...response.products.map(getResolver('product'))])] }));
|
|
50948
|
-
}
|
|
50949
|
-
}
|
|
50950
|
-
}
|
|
50951
|
-
|
|
50952
|
-
class SearchProductLiveCollectionController extends LiveCollectionController {
|
|
50953
|
-
constructor(query, callback) {
|
|
50954
|
-
const queryStreamId = hash(query);
|
|
50955
|
-
const cacheKey = ['products', 'collection', queryStreamId];
|
|
50956
|
-
const paginationController = new SearchProductPaginationController(query);
|
|
50957
|
-
super(paginationController, queryStreamId, cacheKey, callback);
|
|
50958
|
-
this.query = query;
|
|
50959
|
-
this.queryStreamController = new SearchProductQueryStreamController(this.query, this.cacheKey, this.notifyChange.bind(this));
|
|
50960
|
-
this.callback = callback.bind(this);
|
|
50961
|
-
this.loadPage({ initial: true });
|
|
50962
|
-
}
|
|
50963
|
-
setup() {
|
|
50964
|
-
var _a;
|
|
50965
|
-
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
50966
|
-
if (!collection) {
|
|
50967
|
-
pushToCache(this.cacheKey, {
|
|
50968
|
-
data: [],
|
|
50969
|
-
params: {},
|
|
50970
|
-
});
|
|
50971
|
-
}
|
|
50972
|
-
}
|
|
50973
|
-
async persistModel(queryPayload) {
|
|
50974
|
-
await this.queryStreamController.saveToMainDB(queryPayload);
|
|
50975
|
-
}
|
|
50976
|
-
persistQueryStream({ response, direction, refresh, }) {
|
|
50977
|
-
this.queryStreamController.appendToQueryStream(response, direction, refresh);
|
|
50978
|
-
}
|
|
50979
|
-
// eslint-disable-next-line class-methods-use-this
|
|
50980
|
-
startSubscription() {
|
|
50981
|
-
return [];
|
|
50982
|
-
}
|
|
50983
|
-
notifyChange({ origin, loading, error }) {
|
|
50984
|
-
var _a, _b;
|
|
50985
|
-
const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
|
|
50986
|
-
if (!collection)
|
|
50987
|
-
return;
|
|
50988
|
-
const data = (_b = collection.data
|
|
50989
|
-
.map(id => pullFromCache(['product', 'get', id]))
|
|
50990
|
-
.filter(isNonNullable)
|
|
50991
|
-
.map(({ data }) => data)
|
|
50992
|
-
.map(LinkedObject.product)) !== null && _b !== void 0 ? _b : [];
|
|
50993
|
-
if (!this.shouldNotify(data) && origin === 'event')
|
|
50994
|
-
return;
|
|
50995
|
-
this.callback({
|
|
50996
|
-
onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
|
|
50997
|
-
data,
|
|
50998
|
-
hasNextPage: !!this.paginationController.getNextToken(),
|
|
50999
|
-
loading,
|
|
51000
|
-
error,
|
|
51001
|
-
});
|
|
51002
|
-
}
|
|
51003
|
-
}
|
|
51004
|
-
|
|
51005
|
-
/* begin_public_function
|
|
51006
|
-
id: product.search
|
|
51007
|
-
*/
|
|
51008
|
-
/**
|
|
51009
|
-
* ```js
|
|
51010
|
-
* import { ProductRepository } from '@amityco/ts-sdk'
|
|
51011
|
-
*
|
|
51012
|
-
* let products = []
|
|
51013
|
-
* const unsub = ProductRepository.searchProducts({
|
|
51014
|
-
* keyword: string,
|
|
51015
|
-
* }, response => merge(products, response.data))
|
|
51016
|
-
* ```
|
|
51017
|
-
*
|
|
51018
|
-
* Observe all mutations on a list of {@link Amity.Product}
|
|
51019
|
-
*
|
|
51020
|
-
* @param params.keyword the search keyword
|
|
51021
|
-
* @param params.isActive filter by active status
|
|
51022
|
-
* @param params.isDeleted filter by deleted status
|
|
51023
|
-
* @param params.sortBy sort option
|
|
51024
|
-
* @param params.sortOrder order option
|
|
51025
|
-
* @param callback the function to call when new data are available
|
|
51026
|
-
* @param config
|
|
51027
|
-
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the products
|
|
51028
|
-
*
|
|
51029
|
-
* @category Products Live Collection
|
|
51030
|
-
*/
|
|
51031
|
-
const searchProducts = (params, callback, config) => {
|
|
51032
|
-
const { log, cache } = getActiveClient();
|
|
51033
|
-
if (!cache) {
|
|
51034
|
-
console.log(ENABLE_CACHE_MESSAGE);
|
|
51035
|
-
}
|
|
51036
|
-
const timestamp = Date.now();
|
|
51037
|
-
log(`searchProducts(tmpid: ${timestamp}) > listen`);
|
|
51038
|
-
const productsLiveCollection = new SearchProductLiveCollectionController(params, callback);
|
|
51039
|
-
const disposers = productsLiveCollection.startSubscription();
|
|
51040
|
-
const cacheKey = productsLiveCollection.getCacheKey();
|
|
51041
|
-
disposers.push(() => dropFromCache(cacheKey));
|
|
51042
|
-
return () => {
|
|
51043
|
-
log(`searchProducts(tmpid: ${timestamp}) > dispose`);
|
|
51044
|
-
disposers.forEach(fn => fn());
|
|
51045
|
-
};
|
|
51046
|
-
};
|
|
51047
|
-
/* end_public_function */
|
|
51048
|
-
|
|
51049
|
-
var index = /*#__PURE__*/Object.freeze({
|
|
51050
|
-
__proto__: null,
|
|
51051
|
-
getProduct: getProduct,
|
|
51052
|
-
searchProducts: searchProducts
|
|
51053
|
-
});
|
|
51054
|
-
|
|
51055
|
-
/**
|
|
51056
|
-
* Helper class for managing product tags per media attachment.
|
|
51057
|
-
*
|
|
51058
|
-
* This class provides a convenient way to organize product tags by file ID,
|
|
51059
|
-
* allowing you to associate multiple products with individual media attachments
|
|
51060
|
-
* (images, videos) in a post.
|
|
51061
|
-
*
|
|
51062
|
-
* @example
|
|
51063
|
-
* ```typescript
|
|
51064
|
-
* const attachmentTags = new AmityAttachmentProductTags();
|
|
51065
|
-
*
|
|
51066
|
-
* // Set tags to specific images
|
|
51067
|
-
*
|
|
51068
|
-
* attachmentTags.set('image-file-2', [
|
|
51069
|
-
* { productId: 'product-3' },
|
|
51070
|
-
* { productId: 'product-4' },
|
|
51071
|
-
* ]);
|
|
51072
|
-
*
|
|
51073
|
-
* // Get tags for a specific file
|
|
51074
|
-
* const tagsOnImage1 = attachmentTags.get('image-file-1');
|
|
51075
|
-
* // Returns: [{ productId: 'product-1' }, { productId: 'product-2' }]
|
|
51076
|
-
* ```
|
|
51077
|
-
*/
|
|
51078
|
-
class AmityAttachmentProductTags {
|
|
51079
|
-
constructor() {
|
|
51080
|
-
this.map = new Map();
|
|
51081
|
-
}
|
|
51082
|
-
/**
|
|
51083
|
-
* Get all product tags associated with a specific file.
|
|
51084
|
-
*
|
|
51085
|
-
* @param fileId - The ID of the file (image/video)
|
|
51086
|
-
* @returns Array of product tags for the file, empty array if none exist
|
|
51087
|
-
*/
|
|
51088
|
-
get(fileId) {
|
|
51089
|
-
return this.map.get(fileId) || [];
|
|
51090
|
-
}
|
|
51091
|
-
/**
|
|
51092
|
-
* Set product tags for a specific file, replacing any existing tags.
|
|
51093
|
-
*
|
|
51094
|
-
* @param fileId - The ID of the file (image/video)
|
|
51095
|
-
* @param tags - Array of product tags to set for the file
|
|
51096
|
-
*/
|
|
51097
|
-
set(fileId, tags) {
|
|
51098
|
-
this.map.set(fileId, tags);
|
|
51099
|
-
}
|
|
51100
|
-
}
|
|
51101
|
-
|
|
51102
|
-
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$g as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index$1 as EventRepository, FeedDataTypeEnum, index$d as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$p as FileRepository, FileType, GET_WATCHER_URLS, index$3 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$2 as LiveReactionRepository, index$7 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$n as MessageRepository, index$8 as PollRepository, PostContentType, index$b as PostRepository, PostStructureType, index as ProductRepository, index$o as ReactionRepository, index$9 as RoomPresenceRepository, index$c as RoomRepository, index$6 as StoryRepository, index$a as StreamRepository, index$m as SubChannelRepository, SubscriptionLevels, index$q as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$4 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|
|
50458
|
+
export { API_REGIONS, index$4 as AdRepository, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, index$e as CategoryRepository, index$i as ChannelRepository, index$r as Client, index$d as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$f as CommunityRepository, ContentFeedType, ContentFlagReasonEnum, DefaultCommunityPostSetting, index as EventRepository, FeedDataTypeEnum, index$c as FeedRepository, FeedSortByEnum, FeedSourceEnum, FeedTypeEnum, FileAccessTypeEnum, index$o as FileRepository, FileType, GET_WATCHER_URLS, index$2 as InvitationRepository, InvitationSortByEnum, InvitationStatusEnum, InvitationTargetTypeEnum, InvitationTypeEnum, JoinRequestStatusEnum, JoinResultStatusEnum, index$1 as LiveReactionRepository, index$6 as LiveStreamPlayer, MembershipAcceptanceTypeEnum, MessageContentType, index$m as MessageRepository, index$7 as PollRepository, PostContentType, index$a as PostRepository, PostStructureType, index$n as ReactionRepository, index$8 as RoomPresenceRepository, index$b as RoomRepository, SearchUsersByEnum, index$5 as StoryRepository, index$9 as StreamRepository, index$l as SubChannelRepository, SubscriptionLevels, index$p as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getRoomStreamerTopic, getRoomWatcherTopic, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index$3 as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
|