@amityco/ts-sdk 7.25.1-ef62546f.0 → 7.26.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/payload.d.ts +1 -0
- package/dist/@types/core/payload.d.ts.map +1 -1
- package/dist/@types/domains/client.d.ts +0 -1
- package/dist/@types/domains/client.d.ts.map +1 -1
- package/dist/@types/domains/content.d.ts +6 -1
- package/dist/@types/domains/content.d.ts.map +1 -1
- package/dist/@types/domains/post.d.ts +3 -0
- package/dist/@types/domains/post.d.ts.map +1 -1
- package/dist/@types/index.d.ts +0 -1
- package/dist/@types/index.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/index.cjs.js +105 -106
- package/dist/index.esm.js +106 -107
- package/dist/index.umd.js +2 -2
- package/dist/messagePreview/utils/getSubChannelMessagePreviewWithUser.d.ts +1 -1
- package/dist/postRepository/api/createEventPost.d.ts +36 -0
- package/dist/postRepository/api/createEventPost.d.ts.map +1 -0
- package/dist/postRepository/api/index.d.ts +1 -0
- package/dist/postRepository/api/index.d.ts.map +1 -1
- package/dist/postRepository/api/tests/integration/setup.d.ts +1 -0
- package/dist/postRepository/api/tests/integration/setup.d.ts.map +1 -1
- package/dist/userRepository/observers/index.d.ts +0 -1
- package/dist/userRepository/observers/index.d.ts.map +1 -1
- package/dist/userRepository/observers/searchUserByDisplayName.d.ts +0 -2
- package/dist/userRepository/observers/searchUserByDisplayName.d.ts.map +1 -1
- package/dist/utils/linkedObject/postLinkedObject.d.ts.map +1 -1
- package/dist/utils/postTypePredicate.d.ts +1 -0
- package/dist/utils/postTypePredicate.d.ts.map +1 -1
- package/dist/utils/tests/dummy/comment.d.ts +1 -1
- package/dist/utils/tests/dummy/post.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/@types/domains/liveViewerCount.d.ts +0 -22
- package/dist/@types/domains/liveViewerCount.d.ts.map +0 -1
- package/dist/client/api/getLiveViewerCountConfig.d.ts +0 -24
- package/dist/client/api/getLiveViewerCountConfig.d.ts.map +0 -1
- package/dist/userRepository/observers/searchUsers.d.ts +0 -26
- package/dist/userRepository/observers/searchUsers.d.ts.map +0 -1
- package/dist/userRepository/observers/tests/integrations/searchUsers.integration.test.d.ts +0 -2
- package/dist/userRepository/observers/tests/integrations/searchUsers.integration.test.d.ts.map +0 -1
- package/dist/userRepository/observers/tests/searchUsers.test.d.ts +0 -2
- package/dist/userRepository/observers/tests/searchUsers.test.d.ts.map +0 -1
package/dist/index.esm.js
CHANGED
|
@@ -146,6 +146,7 @@ const PostContentType = Object.freeze({
|
|
|
146
146
|
CLIP: 'clip',
|
|
147
147
|
AUDIO: 'audio',
|
|
148
148
|
ROOM: 'room',
|
|
149
|
+
EVENT: 'event',
|
|
149
150
|
});
|
|
150
151
|
const PostStructureType = Object.freeze({
|
|
151
152
|
TEXT: 'text',
|
|
@@ -154,6 +155,7 @@ const PostStructureType = Object.freeze({
|
|
|
154
155
|
FILE: 'file',
|
|
155
156
|
AUDIO: 'audio',
|
|
156
157
|
MIXED: 'mixed',
|
|
158
|
+
EVENT: 'event',
|
|
157
159
|
});
|
|
158
160
|
|
|
159
161
|
var InvitationTypeEnum;
|
|
@@ -304,17 +306,10 @@ var NotificationRolesFilterTypeEnum;
|
|
|
304
306
|
NotificationRolesFilterTypeEnum["ONLY"] = "only";
|
|
305
307
|
})(NotificationRolesFilterTypeEnum || (NotificationRolesFilterTypeEnum = {}));
|
|
306
308
|
|
|
307
|
-
var AmityLiveViewerCountMode;
|
|
308
|
-
(function (AmityLiveViewerCountMode) {
|
|
309
|
-
AmityLiveViewerCountMode["ALWAYS_SHOW"] = "always";
|
|
310
|
-
AmityLiveViewerCountMode["HIDE_ENTIRELY"] = "hidden";
|
|
311
|
-
AmityLiveViewerCountMode["SHOW_ABOVE_MINIMUM"] = "above-minimum";
|
|
312
|
-
})(AmityLiveViewerCountMode || (AmityLiveViewerCountMode = {}));
|
|
313
|
-
|
|
314
309
|
function getVersion() {
|
|
315
310
|
try {
|
|
316
|
-
// the string ''v7.
|
|
317
|
-
return 'v7.
|
|
311
|
+
// the string ''v7.26.0-esm'' should be replaced by actual value by @rollup/plugin-replace
|
|
312
|
+
return 'v7.26.0-esm';
|
|
318
313
|
}
|
|
319
314
|
catch (error) {
|
|
320
315
|
return '__dev__';
|
|
@@ -5026,51 +5021,6 @@ const getCoreUserSettings = async () => {
|
|
|
5026
5021
|
return data;
|
|
5027
5022
|
};
|
|
5028
5023
|
|
|
5029
|
-
const DEFAULT_CONFIG = {
|
|
5030
|
-
mode: AmityLiveViewerCountMode.ALWAYS_SHOW,
|
|
5031
|
-
threshold: 50,
|
|
5032
|
-
};
|
|
5033
|
-
const isValidMode = (value) => value === AmityLiveViewerCountMode.ALWAYS_SHOW ||
|
|
5034
|
-
value === AmityLiveViewerCountMode.HIDE_ENTIRELY ||
|
|
5035
|
-
value === AmityLiveViewerCountMode.SHOW_ABOVE_MINIMUM;
|
|
5036
|
-
const isValidThreshold = (value) => typeof value === 'number' && Number.isInteger(value) && value >= 1 && value <= 1000;
|
|
5037
|
-
/**
|
|
5038
|
-
* ```js
|
|
5039
|
-
* import { getLiveViewerCountConfig } from '@amityco/ts-sdk'
|
|
5040
|
-
* const config = await getLiveViewerCountConfig()
|
|
5041
|
-
* ```
|
|
5042
|
-
*
|
|
5043
|
-
* Fetches the network-level {@link Amity.LiveViewerCountConfig} governing
|
|
5044
|
-
* how the live viewer count is displayed to viewers on a livestream.
|
|
5045
|
-
*
|
|
5046
|
-
* Cold-read — no observable, no cache. Call once per livestream mount /
|
|
5047
|
-
* rejoin. Admin-driven config changes take effect on the next join, not
|
|
5048
|
-
* mid-stream.
|
|
5049
|
-
*
|
|
5050
|
-
* On a malformed payload (unknown mode, out-of-range or missing threshold)
|
|
5051
|
-
* the SDK falls open to `{ mode: ALWAYS_SHOW, threshold: 50 }` and logs a
|
|
5052
|
-
* warning. Network errors reject.
|
|
5053
|
-
*
|
|
5054
|
-
* @returns A Promise of {@link Amity.LiveViewerCountConfig}
|
|
5055
|
-
*
|
|
5056
|
-
* @category Client API
|
|
5057
|
-
* @async
|
|
5058
|
-
*/
|
|
5059
|
-
/* begin_public_function id: client.getLiveViewerCountConfig */
|
|
5060
|
-
const getLiveViewerCountConfig = async () => {
|
|
5061
|
-
var _a, _b;
|
|
5062
|
-
const client = getActiveClient();
|
|
5063
|
-
const { data } = await client.http.get('/api/v3/network-settings/video-streaming');
|
|
5064
|
-
const mode = (_a = data === null || data === void 0 ? void 0 : data.videoStreaming) === null || _a === void 0 ? void 0 : _a.viewerCountDisplayMode;
|
|
5065
|
-
const threshold = (_b = data === null || data === void 0 ? void 0 : data.videoStreaming) === null || _b === void 0 ? void 0 : _b.viewerCountDisplayMinimum;
|
|
5066
|
-
if (!isValidMode(mode) || !isValidThreshold(threshold)) {
|
|
5067
|
-
client.log('client/getLiveViewerCountConfig', 'malformed videoStreaming settings, falling back to default', { mode, threshold });
|
|
5068
|
-
return DEFAULT_CONFIG;
|
|
5069
|
-
}
|
|
5070
|
-
return { mode, threshold };
|
|
5071
|
-
};
|
|
5072
|
-
/* end_public_function */
|
|
5073
|
-
|
|
5074
5024
|
/* begin_public_function
|
|
5075
5025
|
id: client.getProductCatalogueSetting
|
|
5076
5026
|
*/
|
|
@@ -8520,7 +8470,6 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
|
|
|
8520
8470
|
getCoreUserSettings,
|
|
8521
8471
|
getSocialSettings,
|
|
8522
8472
|
getChatSettings,
|
|
8523
|
-
getLiveViewerCountConfig,
|
|
8524
8473
|
getVisitorDeviceId: getDeviceId,
|
|
8525
8474
|
getMessagePreviewSetting: getMessagePreviewSetting$1,
|
|
8526
8475
|
use: () => setActiveClient(client),
|
|
@@ -9612,7 +9561,6 @@ var index$s = /*#__PURE__*/Object.freeze({
|
|
|
9612
9561
|
setCurrentUserType: setCurrentUserType,
|
|
9613
9562
|
setAccessTokenHandler: setAccessTokenHandler,
|
|
9614
9563
|
getChatSettings: getChatSettings,
|
|
9615
|
-
getLiveViewerCountConfig: getLiveViewerCountConfig,
|
|
9616
9564
|
getCoreUserSettings: getCoreUserSettings,
|
|
9617
9565
|
notifications: notifications,
|
|
9618
9566
|
enableAutoSubscriptions: enableAutoSubscriptions,
|
|
@@ -12415,6 +12363,9 @@ function isAmityRoomPost(post) {
|
|
|
12415
12363
|
'roomId' in post.data &&
|
|
12416
12364
|
post.dataType === 'room');
|
|
12417
12365
|
}
|
|
12366
|
+
function isAmityEventPost(post) {
|
|
12367
|
+
return post.dataType === 'event' || post.structureType === 'event';
|
|
12368
|
+
}
|
|
12418
12369
|
|
|
12419
12370
|
/**
|
|
12420
12371
|
* ```js
|
|
@@ -12526,7 +12477,7 @@ const getWatchSessionStorage = () => {
|
|
|
12526
12477
|
return storageInstance;
|
|
12527
12478
|
};
|
|
12528
12479
|
|
|
12529
|
-
const privateKey = "
|
|
12480
|
+
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-----";
|
|
12530
12481
|
/*
|
|
12531
12482
|
* The crypto algorithm used for importing key and signing string
|
|
12532
12483
|
*/
|
|
@@ -13073,6 +13024,57 @@ const postLinkedObject = (post) => {
|
|
|
13073
13024
|
const room = (_b = pullFromCache(['room', 'get', (_a = post === null || post === void 0 ? void 0 : post.data) === null || _a === void 0 ? void 0 : _a.roomId])) === null || _b === void 0 ? void 0 : _b.data;
|
|
13074
13025
|
return room ? roomLinkedObject(room) : undefined;
|
|
13075
13026
|
},
|
|
13027
|
+
getEventInfo() {
|
|
13028
|
+
var _a, _b;
|
|
13029
|
+
if (!isAmityEventPost(post))
|
|
13030
|
+
return;
|
|
13031
|
+
const readEventId = (data) => {
|
|
13032
|
+
if (data && typeof data === 'object' && 'eventId' in data) {
|
|
13033
|
+
const value = data.eventId;
|
|
13034
|
+
return typeof value === 'string' ? value : undefined;
|
|
13035
|
+
}
|
|
13036
|
+
return undefined;
|
|
13037
|
+
};
|
|
13038
|
+
const parentEventId = readEventId(post.data);
|
|
13039
|
+
const eventId = parentEventId !== null && parentEventId !== void 0 ? parentEventId : (_a = post.children) === null || _a === void 0 ? void 0 : _a.map(childId => { var _a; return (_a = pullFromCache(['post', 'get', childId])) === null || _a === void 0 ? void 0 : _a.data; }).map(child => readEventId(child === null || child === void 0 ? void 0 : child.data)).find(Boolean);
|
|
13040
|
+
if (!eventId)
|
|
13041
|
+
return;
|
|
13042
|
+
const event = (_b = pullFromCache(['event', 'get', eventId])) === null || _b === void 0 ? void 0 : _b.data;
|
|
13043
|
+
if (!event)
|
|
13044
|
+
return;
|
|
13045
|
+
// Inlined event linked-object construction. Calling eventLinkedObject()
|
|
13046
|
+
// here would create a static import cycle (eventLinkObject already
|
|
13047
|
+
// imports postLinkedObject for its `event.post` getter). Snapshot
|
|
13048
|
+
// consumers get the raw event fields plus the getters they need for the
|
|
13049
|
+
// in-post event card (creator, targetCommunity, coverImage, room). The
|
|
13050
|
+
// full linked-object surface — including RSVP methods and `event.post` —
|
|
13051
|
+
// is available via EventRepository.getEvent(eventId).
|
|
13052
|
+
return Object.assign(Object.assign({}, event), { get creator() {
|
|
13053
|
+
const cacheData = pullFromCache(['user', 'get', event.userId]);
|
|
13054
|
+
if (!(cacheData === null || cacheData === void 0 ? void 0 : cacheData.data))
|
|
13055
|
+
return undefined;
|
|
13056
|
+
return userLinkedObject(cacheData.data);
|
|
13057
|
+
},
|
|
13058
|
+
get targetCommunity() {
|
|
13059
|
+
var _a;
|
|
13060
|
+
if (!event.originId)
|
|
13061
|
+
return undefined;
|
|
13062
|
+
const cacheData = (_a = pullFromCache([
|
|
13063
|
+
'community',
|
|
13064
|
+
'get',
|
|
13065
|
+
event.originId,
|
|
13066
|
+
])) === null || _a === void 0 ? void 0 : _a.data;
|
|
13067
|
+
if (!cacheData)
|
|
13068
|
+
return undefined;
|
|
13069
|
+
return communityLinkedObject(cacheData);
|
|
13070
|
+
},
|
|
13071
|
+
get coverImage() {
|
|
13072
|
+
var _a;
|
|
13073
|
+
if (!event.coverImageFileId)
|
|
13074
|
+
return undefined;
|
|
13075
|
+
return (_a = pullFromCache(['file', 'get', event.coverImageFileId])) === null || _a === void 0 ? void 0 : _a.data;
|
|
13076
|
+
} });
|
|
13077
|
+
},
|
|
13076
13078
|
});
|
|
13077
13079
|
};
|
|
13078
13080
|
|
|
@@ -15126,58 +15128,10 @@ class SearchUserLiveCollectionController extends LiveCollectionController {
|
|
|
15126
15128
|
}
|
|
15127
15129
|
}
|
|
15128
15130
|
|
|
15129
|
-
/* begin_public_function
|
|
15130
|
-
id: user.searchUsers
|
|
15131
|
-
*/
|
|
15132
|
-
/**
|
|
15133
|
-
* ```js
|
|
15134
|
-
* import { UserRepository } from '@amityco/ts-sdk'
|
|
15135
|
-
*
|
|
15136
|
-
* let users = []
|
|
15137
|
-
* const unsub = UserRepository.searchUsers(
|
|
15138
|
-
* { displayName: 'jack', searchBy: [SearchUsersByEnum.DISPLAY_NAME] },
|
|
15139
|
-
* response => merge(users, response.data),
|
|
15140
|
-
* )
|
|
15141
|
-
* ```
|
|
15142
|
-
*
|
|
15143
|
-
* Observe all mutations on a list of {@link Amity.InternalUser}s.
|
|
15144
|
-
*
|
|
15145
|
-
* Pass `searchBy` in `params` to restrict which user fields are matched
|
|
15146
|
-
* (e.g. `[SearchUsersByEnum.DISPLAY_NAME]`). When omitted, the backend
|
|
15147
|
-
* default (both `displayName` and `userId`) applies.
|
|
15148
|
-
*
|
|
15149
|
-
* @param params for searching users
|
|
15150
|
-
* @param callback the function to call when new data are available
|
|
15151
|
-
* @param config the configuration for the live collection
|
|
15152
|
-
* @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the users
|
|
15153
|
-
*
|
|
15154
|
-
* @category Category Live Collection
|
|
15155
|
-
*/
|
|
15156
|
-
const searchUsers = (params, callback, config) => {
|
|
15157
|
-
const { log, cache } = getActiveClient();
|
|
15158
|
-
if (!cache) {
|
|
15159
|
-
// eslint-disable-next-line no-console
|
|
15160
|
-
console.log(ENABLE_CACHE_MESSAGE);
|
|
15161
|
-
}
|
|
15162
|
-
const timestamp = Date.now();
|
|
15163
|
-
log(`liveSearchUsers(tmpid: ${timestamp}) > listen`);
|
|
15164
|
-
const searchUsersLiveCollection = new SearchUserLiveCollectionController(params, callback);
|
|
15165
|
-
const disposers = searchUsersLiveCollection.startSubscription();
|
|
15166
|
-
const cacheKey = searchUsersLiveCollection.getCacheKey();
|
|
15167
|
-
disposers.push(() => dropFromCache(cacheKey));
|
|
15168
|
-
return () => {
|
|
15169
|
-
log(`liveSearchUsers(tmpid: ${timestamp}) > dispose`);
|
|
15170
|
-
disposers.forEach(fn => fn());
|
|
15171
|
-
};
|
|
15172
|
-
};
|
|
15173
|
-
/* end_public_function */
|
|
15174
|
-
|
|
15175
15131
|
/* begin_public_function
|
|
15176
15132
|
id: user.search
|
|
15177
15133
|
*/
|
|
15178
15134
|
/**
|
|
15179
|
-
* @deprecated Use {@link searchUsers} instead. `searchUserByDisplayName` will be removed in a future major version.
|
|
15180
|
-
*
|
|
15181
15135
|
* ```js
|
|
15182
15136
|
* import { UserRepository } from '@amityco/ts-sdk'
|
|
15183
15137
|
*
|
|
@@ -15326,7 +15280,6 @@ var index$q = /*#__PURE__*/Object.freeze({
|
|
|
15326
15280
|
getUsers: getUsers,
|
|
15327
15281
|
getBlockedUsers: getBlockedUsers,
|
|
15328
15282
|
getBlockingUsers: getBlockingUsers,
|
|
15329
|
-
searchUsers: searchUsers,
|
|
15330
15283
|
searchUserByDisplayName: searchUserByDisplayName,
|
|
15331
15284
|
getReachedUsers: getReachedUsers,
|
|
15332
15285
|
get AmityUserSearchMatchType () { return AmityUserSearchMatchType; }
|
|
@@ -28434,6 +28387,51 @@ const createRoomPost = async (bundle) => {
|
|
|
28434
28387
|
};
|
|
28435
28388
|
/* end_public_function */
|
|
28436
28389
|
|
|
28390
|
+
/* begin_public_function
|
|
28391
|
+
id: post.create.event_post
|
|
28392
|
+
*/
|
|
28393
|
+
/**
|
|
28394
|
+
* ```js
|
|
28395
|
+
* import { PostRepository } from '@amityco/ts-sdk'
|
|
28396
|
+
* const created = await PostRepository.createEventPost({
|
|
28397
|
+
* targetType: 'community',
|
|
28398
|
+
* targetId: 'communityId',
|
|
28399
|
+
* data: { eventId: 'eventId123', title: 'Summer Meetup', text: 'Come say hi' }
|
|
28400
|
+
* })
|
|
28401
|
+
* ```
|
|
28402
|
+
*
|
|
28403
|
+
* Creates an event {@link Amity.Post} — a post whose content is an event.
|
|
28404
|
+
* The parent post carries the author's caption; the referenced event is
|
|
28405
|
+
* resolved via `post.getEventInfo()`.
|
|
28406
|
+
*
|
|
28407
|
+
* `data.eventId` is REQUIRED; `title` and `text` are OPTIONAL — both blank is
|
|
28408
|
+
* valid and yields a bare event card.
|
|
28409
|
+
*
|
|
28410
|
+
* Media attachments and product tags are rejected by the backend with 400.
|
|
28411
|
+
*
|
|
28412
|
+
* @param bundle The data necessary to create a new event {@link Amity.Post}
|
|
28413
|
+
* @returns The newly created {@link Amity.Post}
|
|
28414
|
+
*
|
|
28415
|
+
* @category Post API
|
|
28416
|
+
* @async
|
|
28417
|
+
*/
|
|
28418
|
+
const createEventPost = async (bundle) => {
|
|
28419
|
+
const client = getActiveClient();
|
|
28420
|
+
client.log('post/createEventPost', bundle);
|
|
28421
|
+
const { data: payload } = await client.http.post('/api/v4/posts', Object.assign(Object.assign({}, bundle), { dataType: 'event' }));
|
|
28422
|
+
fireEvent('post.created', payload);
|
|
28423
|
+
const data = preparePostPayload(payload);
|
|
28424
|
+
const cachedAt = client.cache && Date.now();
|
|
28425
|
+
if (client.cache)
|
|
28426
|
+
ingestInCache(data, { cachedAt });
|
|
28427
|
+
const { posts } = data;
|
|
28428
|
+
return {
|
|
28429
|
+
data: LinkedObject.post(posts[0]),
|
|
28430
|
+
cachedAt,
|
|
28431
|
+
};
|
|
28432
|
+
};
|
|
28433
|
+
/* end_public_function */
|
|
28434
|
+
|
|
28437
28435
|
/* begin_public_function
|
|
28438
28436
|
id: post.pin_product
|
|
28439
28437
|
*/
|
|
@@ -31165,6 +31163,7 @@ var index$b = /*#__PURE__*/Object.freeze({
|
|
|
31165
31163
|
createAudioPost: createAudioPost,
|
|
31166
31164
|
createMixedMediaPost: createMixedMediaPost,
|
|
31167
31165
|
createRoomPost: createRoomPost,
|
|
31166
|
+
createEventPost: createEventPost,
|
|
31168
31167
|
pinProduct: pinProduct,
|
|
31169
31168
|
unpinProduct: unpinProduct,
|
|
31170
31169
|
updateProductTags: updateProductTags,
|
|
@@ -35495,4 +35494,4 @@ class AmityAttachmentProductTags {
|
|
|
35495
35494
|
}
|
|
35496
35495
|
}
|
|
35497
35496
|
|
|
35498
|
-
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityAutoSubscription, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType,
|
|
35497
|
+
export { API_REGIONS, index$5 as AdRepository, AmityAttachmentProductTags, AmityAutoSubscription, AmityChannelNotificationModeEnum, AmityCommunityType, AmityEventOrderOption, AmityEventOriginType, AmityEventResponseStatus, AmityEventSortOption, AmityEventStatus, AmityEventType, AmitySharableContentType, AnalyticsSourceTypeEnum, index$f as CategoryRepository, index$j as ChannelRepository, index$s as Client, index$e as CommentRepository, CommunityNotificationEventNameEnum, 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, NotificationRolesFilterTypeEnum, NotificationSettingsLevelEnum, 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, SearchUsersByEnum, index$6 as StoryRepository, index$a as StreamRepository, index$m as SubChannelRepository, SubscriptionLevels, UserNotificationModuleNameEnum, UserReportTypeEnum, index$q as UserRepository, UserTypeEnum, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, exceedsUntilAtBoundary, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, filterByUntilAt, filterCommentsByBlockUsers, filterPostsByBlockUsers, getBlockUsersId, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveReactionTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkId, 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, validateUntilAt, wipeCache };
|