@amityco/ts-sdk 7.27.2-fbc08952.0 → 7.28.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.
Files changed (90) hide show
  1. package/dist/@types/core/errors.d.ts +1 -2
  2. package/dist/@types/core/errors.d.ts.map +1 -1
  3. package/dist/@types/core/transport.d.ts +0 -1
  4. package/dist/@types/core/transport.d.ts.map +1 -1
  5. package/dist/@types/domains/client.d.ts +0 -86
  6. package/dist/@types/domains/client.d.ts.map +1 -1
  7. package/dist/@types/domains/content.d.ts +0 -11
  8. package/dist/@types/domains/content.d.ts.map +1 -1
  9. package/dist/@types/domains/user.d.ts +0 -31
  10. package/dist/@types/domains/user.d.ts.map +1 -1
  11. package/dist/client/api/createClient.d.ts.map +1 -1
  12. package/dist/client/api/index.d.ts +0 -1
  13. package/dist/client/api/index.d.ts.map +1 -1
  14. package/dist/client/index.d.ts +0 -1
  15. package/dist/client/index.d.ts.map +1 -1
  16. package/dist/commentRepository/api/flagComment.d.ts +5 -72
  17. package/dist/commentRepository/api/flagComment.d.ts.map +1 -1
  18. package/dist/core/errors.d.ts +0 -20
  19. package/dist/core/errors.d.ts.map +1 -1
  20. package/dist/core/transports/utils.d.ts.map +1 -1
  21. package/dist/index.cjs.js +54 -666
  22. package/dist/index.d.ts +0 -2
  23. package/dist/index.d.ts.map +1 -1
  24. package/dist/index.esm.js +55 -665
  25. package/dist/index.umd.js +2 -2
  26. package/dist/messageRepository/api/flagMessage.d.ts +6 -73
  27. package/dist/messageRepository/api/flagMessage.d.ts.map +1 -1
  28. package/dist/postRepository/api/flagPost.d.ts +6 -73
  29. package/dist/postRepository/api/flagPost.d.ts.map +1 -1
  30. package/dist/userRepository/api/flagUser.d.ts +9 -50
  31. package/dist/userRepository/api/flagUser.d.ts.map +1 -1
  32. package/dist/userRepository/api/index.d.ts +0 -2
  33. package/dist/userRepository/api/index.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/client/api/getModuleSettings.d.ts +0 -25
  36. package/dist/client/api/getModuleSettings.d.ts.map +0 -1
  37. package/dist/client/api/tests/integration/moduleSettings.integration.test.d.ts +0 -2
  38. package/dist/client/api/tests/integration/moduleSettings.integration.test.d.ts.map +0 -1
  39. package/dist/client/utils/parseModuleSettings.d.ts +0 -9
  40. package/dist/client/utils/parseModuleSettings.d.ts.map +0 -1
  41. package/dist/client/utils/resolveModuleAvailability.d.ts +0 -39
  42. package/dist/client/utils/resolveModuleAvailability.d.ts.map +0 -1
  43. package/dist/client/utils/tests/resolveModuleAvailability.test.d.ts +0 -2
  44. package/dist/client/utils/tests/resolveModuleAvailability.test.d.ts.map +0 -1
  45. package/dist/commentRepository/api/flagCommentWithOptions.d.ts +0 -13
  46. package/dist/commentRepository/api/flagCommentWithOptions.d.ts.map +0 -1
  47. package/dist/commentRepository/api/flagCommentWithReasonString.d.ts +0 -16
  48. package/dist/commentRepository/api/flagCommentWithReasonString.d.ts.map +0 -1
  49. package/dist/commentRepository/api/tests/integration/flagCommentWithOptions.integration.test.d.ts +0 -2
  50. package/dist/commentRepository/api/tests/integration/flagCommentWithOptions.integration.test.d.ts.map +0 -1
  51. package/dist/commentRepository/api/tests/integration/flagCommentWithReasonString.integration.test.d.ts +0 -2
  52. package/dist/commentRepository/api/tests/integration/flagCommentWithReasonString.integration.test.d.ts.map +0 -1
  53. package/dist/core/transports/tests/moduleNotEntitled.test.d.ts +0 -2
  54. package/dist/core/transports/tests/moduleNotEntitled.test.d.ts.map +0 -1
  55. package/dist/messageRepository/api/flagMessageWithOptions.d.ts +0 -13
  56. package/dist/messageRepository/api/flagMessageWithOptions.d.ts.map +0 -1
  57. package/dist/messageRepository/api/flagMessageWithReasonString.d.ts +0 -17
  58. package/dist/messageRepository/api/flagMessageWithReasonString.d.ts.map +0 -1
  59. package/dist/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.d.ts +0 -2
  60. package/dist/messageRepository/api/tests/integration/flagMessage.overloads.integration.test.d.ts.map +0 -1
  61. package/dist/messageRepository/api/tests/integration/flagMessageWithOptions.integration.test.d.ts +0 -2
  62. package/dist/messageRepository/api/tests/integration/flagMessageWithOptions.integration.test.d.ts.map +0 -1
  63. package/dist/messageRepository/api/tests/integration/flagMessageWithReasonString.integration.test.d.ts +0 -2
  64. package/dist/messageRepository/api/tests/integration/flagMessageWithReasonString.integration.test.d.ts.map +0 -1
  65. package/dist/postRepository/api/flagPostWithOptions.d.ts +0 -13
  66. package/dist/postRepository/api/flagPostWithOptions.d.ts.map +0 -1
  67. package/dist/postRepository/api/flagPostWithReasonString.d.ts +0 -16
  68. package/dist/postRepository/api/flagPostWithReasonString.d.ts.map +0 -1
  69. package/dist/postRepository/api/tests/integration/flagPost.overloads.integration.test.d.ts +0 -2
  70. package/dist/postRepository/api/tests/integration/flagPost.overloads.integration.test.d.ts.map +0 -1
  71. package/dist/postRepository/api/tests/integration/flagPostWithOptions.integration.test.d.ts +0 -2
  72. package/dist/postRepository/api/tests/integration/flagPostWithOptions.integration.test.d.ts.map +0 -1
  73. package/dist/postRepository/api/tests/integration/flagPostWithReasonString.integration.test.d.ts +0 -2
  74. package/dist/postRepository/api/tests/integration/flagPostWithReasonString.integration.test.d.ts.map +0 -1
  75. package/dist/userRepository/api/flagUserBehavior.d.ts +0 -29
  76. package/dist/userRepository/api/flagUserBehavior.d.ts.map +0 -1
  77. package/dist/userRepository/api/flagUserProfile.d.ts +0 -29
  78. package/dist/userRepository/api/flagUserProfile.d.ts.map +0 -1
  79. package/dist/userRepository/api/tests/integration/flagUser.overloads.integration.test.d.ts +0 -2
  80. package/dist/userRepository/api/tests/integration/flagUser.overloads.integration.test.d.ts.map +0 -1
  81. package/dist/userRepository/api/tests/integration/flagUserBehavior.integration.test.d.ts +0 -2
  82. package/dist/userRepository/api/tests/integration/flagUserBehavior.integration.test.d.ts.map +0 -1
  83. package/dist/userRepository/api/tests/integration/flagUserProfile.integration.test.d.ts +0 -2
  84. package/dist/userRepository/api/tests/integration/flagUserProfile.integration.test.d.ts.map +0 -1
  85. package/dist/userRepository/utils/submitUserReport.d.ts +0 -10
  86. package/dist/userRepository/utils/submitUserReport.d.ts.map +0 -1
  87. package/dist/userRepository/utils/userReport.d.ts +0 -35
  88. package/dist/userRepository/utils/userReport.d.ts.map +0 -1
  89. package/dist/utils/contentFlag.d.ts +0 -28
  90. package/dist/utils/contentFlag.d.ts.map +0 -1
package/dist/index.cjs.js CHANGED
@@ -58,18 +58,6 @@ exports.UserReportTypeEnum = void 0;
58
58
  UserReportTypeEnum["AVATAR"] = "avatarFileId";
59
59
  UserReportTypeEnum["BEHAVIOR"] = "behavior";
60
60
  })(exports.UserReportTypeEnum || (exports.UserReportTypeEnum = {}));
61
- /**
62
- * The profile field a user is reported for in `UserRepository.flagUserProfile`.
63
- * Each member is the backend `reportType` wire value. There is deliberately no
64
- * behavior member: behavior reports need a reason and go through
65
- * `UserRepository.flagUserBehavior`.
66
- */
67
- exports.UserProfileFieldEnum = void 0;
68
- (function (UserProfileFieldEnum) {
69
- UserProfileFieldEnum["DISPLAY_NAME"] = "displayName";
70
- UserProfileFieldEnum["DESCRIPTION"] = "description";
71
- UserProfileFieldEnum["AVATAR"] = "avatarFileId";
72
- })(exports.UserProfileFieldEnum || (exports.UserProfileFieldEnum = {}));
73
61
 
74
62
  const FileType = Object.freeze({
75
63
  FILE: 'file',
@@ -344,8 +332,8 @@ exports.AmityLiveViewerCountMode = void 0;
344
332
 
345
333
  function getVersion() {
346
334
  try {
347
- // the string ''v7.27.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
348
- return 'v7.27.1-cjs';
335
+ // the string ''v7.28.0-cjs'' should be replaced by actual value by @rollup/plugin-replace
336
+ return 'v7.28.0-cjs';
349
337
  }
350
338
  catch (error) {
351
339
  return '__dev__';
@@ -824,40 +812,6 @@ class ASCConnectionError extends ASCError {
824
812
  this.event = event;
825
813
  }
826
814
  }
827
- /**
828
- * Thrown when the network does not own a module the call needs. Raised from
829
- * any module endpoint under `enforce` enforcement, mapped from app code
830
- * `400325` — never from HTTP 403 alone, which already covers a role problem
831
- * (`400300` / `400301`), a visitor (`403999`) and a bot (`403998`).
832
- *
833
- * `modules` carries **every** key the refusal named, as raw strings, so a
834
- * caller can say which entitlement is absent without a second request.
835
- *
836
- * @category Errors
837
- */
838
- class AmityModuleNotEntitledError extends ASCApiError {
839
- /**
840
- * @param message The server's message, e.g. `Module not entitled: chat, live`
841
- * @param modules Every module key from the rejection's `data.modules`
842
- */
843
- constructor(message, modules = []) {
844
- super(message, 400325 /* Amity.ServerError.MODULE_NOT_ENTITLED */, "error" /* Amity.ErrorLevel.ERROR */);
845
- this.modules = modules;
846
- this.type = 'AmityModuleNotEntitledError';
847
- }
848
- }
849
- /**
850
- * Input sanitization related error
851
- * @category Errors
852
- */
853
- class ASCInvalidParameterError extends ASCError {
854
- /**
855
- * @param message A custom error message
856
- */
857
- constructor(message) {
858
- super(message, 800110 /* Amity.ClientError.INVALID_PARAMETERS */, "error" /* Amity.ErrorLevel.ERROR */);
859
- }
860
- }
861
815
 
862
816
  let activeClient = null;
863
817
  /**
@@ -2007,22 +1961,6 @@ function computeUrl(type, region) {
2007
1961
 
2008
1962
  const uuid = () => uuid__default["default"].v4().toString();
2009
1963
 
2010
- /**
2011
- * Reads the module keys a `MODULE_NOT_ENTITLED` rejection named.
2012
- *
2013
- * Every entry is kept, as a raw string: one call can need more than one
2014
- * module, and a key this build predates is still the only part of the
2015
- * payload a customer can act on.
2016
- *
2017
- * @category Transport
2018
- * @hidden
2019
- */
2020
- const extractNotEntitledModules = (data) => {
2021
- const { modules } = data !== null && data !== void 0 ? data : {};
2022
- if (!Array.isArray(modules))
2023
- return [];
2024
- return modules.filter((module) => typeof module === 'string');
2025
- };
2026
1964
  /**
2027
1965
  * Unwraps v3 server payload (for error handling and type extraction)
2028
1966
  *
@@ -2042,15 +1980,6 @@ const unwrapPayload = (response) => {
2042
1980
  throw new ASCUnknownError(response.code);
2043
1981
  }
2044
1982
  else if (response.status === 'error') {
2045
- /*
2046
- * An entitlement refusal must not arrive as a generic failure: a customer
2047
- * cannot then tell a module they have not bought from an outage. Keyed on
2048
- * the app code, never on the HTTP status, so a role or membership problem
2049
- * still maps to the generic error.
2050
- */
2051
- if (response.code === 400325 /* Amity.ServerError.MODULE_NOT_ENTITLED */) {
2052
- throw new AmityModuleNotEntitledError(response.message, extractNotEntitledModules(response.data));
2053
- }
2054
1983
  throw new ASCApiError(response.message, response.code, "error" /* Amity.ErrorLevel.ERROR */);
2055
1984
  }
2056
1985
  // unjust, but helps force uncast "T | undefined" to allow deconstruction without warnings
@@ -5547,95 +5476,6 @@ const getForYouFeedSetting = async () => {
5547
5476
  };
5548
5477
  /* end_public_function */
5549
5478
 
5550
- const ENFORCEMENT_MODES = ['off', 'shadow', 'enforce'];
5551
- /**
5552
- * An unrecognised mode decodes to `off`, and so does an absent one. A mode
5553
- * this build does not know must not withhold anything — defaulting to
5554
- * `enforce` would let a server-side rename black out a customer's app.
5555
- *
5556
- * @category private
5557
- */
5558
- const parseEnforcement = (mode) => {
5559
- const match = ENFORCEMENT_MODES.find(value => value === mode);
5560
- return match !== null && match !== void 0 ? match : 'off';
5561
- };
5562
- const parseGrants = (modules) => {
5563
- const grants = {};
5564
- Object.entries(modules !== null && modules !== void 0 ? modules : {}).forEach(([key, granted]) => {
5565
- grants[key] = granted === true;
5566
- });
5567
- return grants;
5568
- };
5569
- /**
5570
- * Every catalog entry survives, including one whose key this build has never
5571
- * heard of, so a module added server-side is still listable.
5572
- *
5573
- * @category private
5574
- */
5575
- const parseCatalog = (catalog) => {
5576
- const parsed = {};
5577
- Object.entries(catalog !== null && catalog !== void 0 ? catalog : {}).forEach(([key, definition]) => {
5578
- const rawRequires = definition === null || definition === void 0 ? void 0 : definition.requires;
5579
- const requires = Array.isArray(rawRequires)
5580
- ? rawRequires.filter((entry) => typeof entry === 'string')
5581
- : [];
5582
- parsed[key] = {
5583
- label: typeof (definition === null || definition === void 0 ? void 0 : definition.label) === 'string' ? definition.label : key,
5584
- kind: (definition === null || definition === void 0 ? void 0 : definition.kind) === 'setting' ? 'setting' : 'api',
5585
- requires,
5586
- };
5587
- });
5588
- return parsed;
5589
- };
5590
- /**
5591
- * Decodes `GET /api/v3/network-settings/modules`. Nothing is trimmed: the
5592
- * catalog is the dependency table callers resolve against, and a client that
5593
- * cannot see it has to hardcode one.
5594
- *
5595
- * @category private
5596
- */
5597
- const parseModuleSettings = (raw) => {
5598
- var _a;
5599
- return ({
5600
- enforcement: parseEnforcement((_a = raw === null || raw === void 0 ? void 0 : raw.enforcement) !== null && _a !== void 0 ? _a : raw === null || raw === void 0 ? void 0 : raw.mode),
5601
- modules: parseGrants(raw === null || raw === void 0 ? void 0 : raw.modules),
5602
- catalog: parseCatalog(raw === null || raw === void 0 ? void 0 : raw.catalog),
5603
- });
5604
- };
5605
-
5606
- /* begin_public_function
5607
- id: client.getModuleSettings
5608
- */
5609
- /**
5610
- * ```js
5611
- * import { Client } from '@amityco/ts-sdk'
5612
- * const moduleSettings = await Client.getModuleSettings()
5613
- * ```
5614
- *
5615
- * Fetches the network's module entitlements: which modules the network was
5616
- * granted, whether core is enforcing those grants, and the catalog of all
5617
- * modules with their dependency chains.
5618
- *
5619
- * The payload is returned whole — `catalog` is the dependency table
5620
- * {@link resolveModuleAvailability} reads, and a client that cannot see it has
5621
- * to hardcode one.
5622
- *
5623
- * The read is **advisory**. It tells a host what to offer; under `enforce` the
5624
- * backend refuses a call to an unowned module regardless of what was resolved
5625
- * here, and that refusal arrives as `AmityModuleNotEntitledError`.
5626
- *
5627
- * @returns A Promise of {@link Amity.ModuleSettings} object
5628
- *
5629
- * @category Client API
5630
- * @async
5631
- */
5632
- const getModuleSettings = async () => {
5633
- const client = getActiveClient();
5634
- const { data } = await client.http.get(`/api/v3/network-settings/modules`);
5635
- return parseModuleSettings(data);
5636
- };
5637
- /* end_public_function */
5638
-
5639
5479
  const checkUserPermission = (userId, permission) => {
5640
5480
  var _a;
5641
5481
  const user = (_a = pullFromCache(['user', 'get', userId])) === null || _a === void 0 ? void 0 : _a.data;
@@ -9360,7 +9200,6 @@ const createClient = (apiKey, apiRegion = API_REGIONS.SG, { debugSession = DEFAU
9360
9200
  getMarkerSyncConsistentMode,
9361
9201
  getProductCatalogueSetting,
9362
9202
  getForYouFeedSetting,
9363
- getModuleSettings,
9364
9203
  /**
9365
9204
  * Prefix for the deviceId key in the local storage or async storage.
9366
9205
  * This is allow user to have multiple SDK client and Mqtt client within the same app.
@@ -10406,92 +10245,6 @@ const getUserUnread = (callback) => {
10406
10245
  };
10407
10246
  };
10408
10247
 
10409
- /**
10410
- * ```js
10411
- * import { Client, resolveModuleAvailability } from '@amityco/ts-sdk'
10412
- *
10413
- * const moduleSettings = await Client.getModuleSettings()
10414
- *
10415
- * if (resolveModuleAvailability(moduleSettings, 'live').isAvailable) {
10416
- * // offer the Live entry point
10417
- * }
10418
- * ```
10419
- *
10420
- * Resolves whether one module is usable on this network.
10421
- *
10422
- * Availability is a function of all three fields of
10423
- * {@link Amity.ModuleSettings} — the enforcement mode, the module's own grant,
10424
- * and its prerequisite chain — combined in that order. Reading `modules`
10425
- * directly contradicts the mode: staging answers `mode: 'off'` with
10426
- * `modules: {}`, and every module still works.
10427
- *
10428
- * The dependency table comes from the payload's `catalog`, never from a
10429
- * hardcoded copy, so a chain the backend changes takes effect without an SDK
10430
- * release.
10431
- *
10432
- * The SDK does not hold the settings — the caller keeps what it fetched and
10433
- * resolves against it. With no settings at all (a fetch that never succeeded)
10434
- * the caller reads that as every module available: under `enforce` the backend
10435
- * refuses the calls anyway, so the exposure is a screen that offers too much,
10436
- * not one that withholds what a customer paid for.
10437
- *
10438
- * @param moduleSettings The network's module settings
10439
- * @param moduleKey The module to resolve — an {@link Amity.ModuleKey}, so the
10440
- * 15 keys this build knows complete and type-check while a catalog entry it
10441
- * does not know still resolves.
10442
- * @returns An {@link Amity.ModuleAvailability} answer
10443
- *
10444
- * @category Client API
10445
- */
10446
- const resolveModuleAvailability = (moduleSettings, moduleKey, seen = new Set()) => {
10447
- var _a, _b, _c, _d, _e;
10448
- const isGranted = (_a = moduleSettings.modules[moduleKey]) !== null && _a !== void 0 ? _a : false;
10449
- /*
10450
- * Not enforcing: nothing is withheld, and no graph walk is needed. This has
10451
- * to come first — `off` and `shadow` resolve available whatever the grant
10452
- * says, and a cycle would otherwise return unavailable under `off` too.
10453
- */
10454
- if (moduleSettings.enforcement !== 'enforce') {
10455
- return { moduleKey, isAvailable: true, isGranted };
10456
- }
10457
- // A cycle in `requires` resolves unavailable rather than recursing.
10458
- if (seen.has(moduleKey)) {
10459
- return {
10460
- moduleKey,
10461
- isAvailable: false,
10462
- isGranted,
10463
- reason: 'prerequisiteUnavailable',
10464
- unsatisfied: (_c = (_b = moduleSettings.catalog[moduleKey]) === null || _b === void 0 ? void 0 : _b.requires) !== null && _c !== void 0 ? _c : [],
10465
- };
10466
- }
10467
- // The module's own grant is evaluated before its prerequisites, so
10468
- // `notGranted` is reported in preference when both hold.
10469
- if (!isGranted) {
10470
- return { moduleKey, isAvailable: false, isGranted, reason: 'notGranted' };
10471
- }
10472
- const requires = (_e = (_d = moduleSettings.catalog[moduleKey]) === null || _d === void 0 ? void 0 : _d.requires) !== null && _e !== void 0 ? _e : [];
10473
- if (requires.length === 0)
10474
- return { moduleKey, isAvailable: true, isGranted };
10475
- // `requires` is satisfied by any one entry, transitively.
10476
- const isSatisfied = requires.some(dependency => resolveModuleAvailability(moduleSettings, dependency, new Set([...seen, moduleKey]))
10477
- .isAvailable);
10478
- if (isSatisfied)
10479
- return { moduleKey, isAvailable: true, isGranted };
10480
- /*
10481
- * `unsatisfied` carries the whole `requires` list rather than one entry. Any
10482
- * one of them would have satisfied the requirement, so naming a single
10483
- * module misdirects: telling a Community-only customer "Comment needs post"
10484
- * hides that Story would also have done.
10485
- */
10486
- return {
10487
- moduleKey,
10488
- isAvailable: false,
10489
- isGranted,
10490
- reason: 'prerequisiteUnavailable',
10491
- unsatisfied: requires,
10492
- };
10493
- };
10494
-
10495
10248
  var index$t = /*#__PURE__*/Object.freeze({
10496
10249
  __proto__: null,
10497
10250
  getActiveClient: getActiveClient,
@@ -10515,7 +10268,6 @@ var index$t = /*#__PURE__*/Object.freeze({
10515
10268
  getShareableLinkConfiguration: getShareableLinkConfiguration,
10516
10269
  getProductCatalogueSetting: getProductCatalogueSetting,
10517
10270
  getForYouFeedSetting: getForYouFeedSetting,
10518
- getModuleSettings: getModuleSettings,
10519
10271
  loginAsVisitor: loginAsVisitor,
10520
10272
  loginAsBot: loginAsBot,
10521
10273
  getCurrentUser: getCurrentUser,
@@ -10543,8 +10295,7 @@ var index$t = /*#__PURE__*/Object.freeze({
10543
10295
  startMarkerSync: startMarkerSync,
10544
10296
  startUnreadSync: startUnreadSync,
10545
10297
  stopUnreadSync: stopUnreadSync,
10546
- getMarkerSyncConsistentMode: getMarkerSyncConsistentMode,
10547
- resolveModuleAvailability: resolveModuleAvailability
10298
+ getMarkerSyncConsistentMode: getMarkerSyncConsistentMode
10548
10299
  });
10549
10300
 
10550
10301
  /* begin_public_function
@@ -13475,7 +13226,7 @@ const getWatchSessionStorage = () => {
13475
13226
  return storageInstance;
13476
13227
  };
13477
13228
 
13478
- const privateKey = "MIIEpQIBAAKCAQEAwAEc/oZgYIvKSUG/C3mONYLR4ZPgAjMEX4bJ+xqqakUDRtqlNO+eZs2blQ1Ko0DBkqPExyQezvjibH5W2UZBV5RaBTlTcNVKTToMBEGesAfaEcM3qUyQHxdbFYZv6P4sb14dcwxTQ8usmaV8ooiR1Fcaso5ZWYcZ8Hb46FbQ7OoVumsBtPWwfZ4f003o5VCl6AIM6lcLv9UDLlFVYhE+PeXpRHtfWlGqxMvqC9oinlwhL6nWv6VjQXW4nhcib72dPBzfHT7k/PMKto2SxALYdb68ENiAGuJLWi3AUHSyYCJK2w7wIlWfJUAI0v26ub10IpExr6D5QuW2577jjP93iwIDAQABAoIBAFWfqXhwIIatkFY+9Z1+ZcbDQimgsmMIsUiQaX6Lk7e0cxOj6czDlxYtVtaPiNtow2pLkjNkjkCqiP7tEHnwdK9DvylZOTa2R15NJpK3WLcTqVIGhsn/FL5owfvFah6zSsmXZParZm5zY9NZE03ALZhOB9/cz0e3kf/EbpfeL2mW7MApyiUt5i09ycchroOpcWp73ipIxvgigtZyUGFmsQicWhUs28F0D7w4Qfk76yG3nqXeb+BAMhCaIaa/k/aAxhiZG/ygEQWQrcC8gfe+jyicMAQPDEVS9YuUMGsLjIjKuVLZzp2xirQnhc2i2zVNEIvG6soprPOBEMQugzrtX5ECgYEA3b7KAbBIbDl1e4ZSCWhHdHkiWVZHaopsR/LhqDDNhXjWjq3AesgV6k0j9EdziMn/HmmOso0bz99GTV3JZf4A9ztTLumJlkHbdVtlgOqSjrFLj12rH9KXTheyIhWSpUmm8+WB1xasFbqpvJaGo7F3pd2Fqj1XR4mp5BO7c/t7LJ0CgYEA3aouEzXQ9THRKYocdfY69EI1Il1t/d/RSqqd9BxEjxBgxkM13ZiYIn/R4WW/nCUrlmhxG44Aa2Gob4Ahfsui2xKTg/g/3Zk/rAxAEGkfOLGoenaJMD41fH4wUq3FRYwkvnaMb9Hd6f/TlBHslIRa2NN58bSBGJCyBP2b59+2+EcCgYEAixDVRXvV37GlYUOa/XVdosk5Zoe6oDGRuQm0xbNdoUBoZvDHDvme7ONWEiQha/8qtVsD+CyQ7awcPfb8kK9c0bBt+bTS6d4BkTcxkEkMgtrkBVR8Nqfu5jXsLH4VCv4G61zbMhZw8+ut+az5YX2yCN7Frj9sFlxapMRPQmzMEe0CgYEAumsAzM8ZqNv4mAK65Mnr0rhLj1cbxcKRdUYACOgtEFQpzxN/HZnTeFAe5nx3pI3uFlRHq3DFEYnT6dHMWaJQmAULYpVIwMi9L6gtyJ9fzoI6uqMtxRDMUqKdaSsTGOY/kJ6KhQ/unXi1K3XXjR+yd1+C0q+HUm1+CYxvrZYLfskCgYEArsEy+IQOiqniJ0NE2vVUF+UK/IRZaic9YKcpov5Ot7Vvzm/MnnW4N1ljVskocETBWMmPUvNSExVjPebi+rxd8fa5kY8BJScPTzMFbunZn/wjtGdcM10qdlVQ9doG61A/9P3ezFKCfS4AvF/H/59LcSx2Bh28fp3/efiVIOpVd4Y=";
13229
+ 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-----";
13479
13230
  /*
13480
13231
  * The crypto algorithm used for importing key and signing string
13481
13232
  */
@@ -15274,18 +15025,18 @@ const buildFlagUserBody = (options) => {
15274
15025
  /**
15275
15026
  * ```js
15276
15027
  * import { UserRepository } from '@amityco/ts-sdk'
15277
- *
15278
- * // Typeless report (supported).
15279
15028
  * const flagged = await UserRepository.flagUser('userId')
15029
+ * const flaggedBehavior = await UserRepository.flagUser('userId', {
15030
+ * reportType: 'behavior',
15031
+ * reason: 'Harassment or bullying',
15032
+ * comment: 'optional free-text',
15033
+ * })
15280
15034
  * ```
15281
15035
  *
15282
- * Flags a user. Two call shapes are accepted (see the overloads): id-only, which
15283
- * sends no body and stays supported, and the deprecated structured options object,
15284
- * whose request mapping is unchanged. New code reporting a profile field or behavior
15285
- * should use `flagUserProfile` or `flagUserBehavior`.
15286
- *
15287
15036
  * @param userId The ID of the user to be flagged
15288
- * @param options Deprecated report metadata; omit for a typeless report
15037
+ * @param options Optional report metadata forwarded to the server as the request
15038
+ * body: `reportType`, `reason`, `comment`. Only non-null fields are included.
15039
+ * All validation is server-side; a bodyless call produces a typeless report.
15289
15040
  * @returns the flagged {@link Amity.User}
15290
15041
  *
15291
15042
  * @category User API
@@ -15306,156 +15057,6 @@ const flagUser = async (userId, options) => {
15306
15057
  };
15307
15058
  /* end_public_function */
15308
15059
 
15309
- /**
15310
- * Sends a validated split user report (`flagUserProfile` / `flagUserBehavior`) to the
15311
- * same endpoint as `flagUser`, then persists the returned user and fires `user.flagged`
15312
- * exactly as `flagUser` does, so all three calls share return, cache and event behaviour.
15313
- *
15314
- * Not exported from the public API.
15315
- */
15316
- const submitUserReport = async (apiName, userId, body) => {
15317
- var _a;
15318
- const client = getActiveClient();
15319
- client.log(`user/${apiName}`, { userId, body });
15320
- const { data } = await client.http.post(`/api/v4/me/flags/${encodeURIComponent(userId)}`, body);
15321
- const payload = prepareUserPayload(data);
15322
- if (client.cache) {
15323
- ingestInCache(payload);
15324
- }
15325
- fireEvent('user.flagged', data);
15326
- return (_a = payload.users.find(user => user.userId === userId)) !== null && _a !== void 0 ? _a : payload.users[0];
15327
- };
15328
-
15329
- /** Maximum `comment` length, in string length units, after trimming. */
15330
- const USER_REPORT_COMMENT_MAX_LENGTH = 300;
15331
- const PROFILE_FIELDS = Object.values(exports.UserProfileFieldEnum);
15332
- const BEHAVIOR_REASONS = Object.values(exports.ContentFlagReasonEnum);
15333
- const assertOptionsObject = (apiName, options, shape) => {
15334
- if (typeof options !== 'object' || options === null || Array.isArray(options)) {
15335
- throw new ASCInvalidParameterError(`${apiName}: expected an options object \`${shape}\``);
15336
- }
15337
- return options;
15338
- };
15339
- /**
15340
- * Normalizes an optional reporter `comment`: it must be a string when supplied (`null`
15341
- * is not a valid supplied comment); it is trimmed; a blank result is omitted (the
15342
- * backend rejects `""`); a result longer than 300 characters is rejected before any
15343
- * request. Otherwise the trimmed text is returned unchanged.
15344
- *
15345
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` for a non-string or over-length comment
15346
- */
15347
- const normalizeUserReportComment = (apiName, comment) => {
15348
- if (comment === undefined)
15349
- return undefined;
15350
- if (typeof comment !== 'string') {
15351
- throw new ASCInvalidParameterError(`${apiName}: \`comment\` must be a string when supplied`);
15352
- }
15353
- const trimmed = comment.trim();
15354
- if (trimmed.length === 0)
15355
- return undefined;
15356
- if (trimmed.length > USER_REPORT_COMMENT_MAX_LENGTH) {
15357
- throw new ASCInvalidParameterError(`${apiName}: \`comment\` must be at most ${USER_REPORT_COMMENT_MAX_LENGTH} characters after trimming`);
15358
- }
15359
- return trimmed;
15360
- };
15361
- const withComment = (body, comment) => comment === undefined ? body : Object.assign(Object.assign({}, body), { comment });
15362
- /**
15363
- * Validates `flagUserProfile` options and builds its request body. Untyped callers can
15364
- * pass anything at runtime, so nothing is trusted from the declared type. Any `reason`
15365
- * key is ignored and never sent.
15366
- *
15367
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
15368
- */
15369
- const toUserProfileReportBody = (options) => {
15370
- const apiName = 'flagUserProfile';
15371
- const { field, comment } = assertOptionsObject(apiName, options, '{ field, comment? }');
15372
- if (typeof field !== 'string' || !PROFILE_FIELDS.includes(field)) {
15373
- throw new ASCInvalidParameterError(`${apiName}: \`field\` must be a \`UserProfileFieldEnum\` value`);
15374
- }
15375
- return withComment({ reportType: field }, normalizeUserReportComment(apiName, comment));
15376
- };
15377
- /**
15378
- * Validates `flagUserBehavior` options and builds its request body. `reason` must be one
15379
- * of the nine `ContentFlagReasonEnum` values and is sent as that canonical label;
15380
- * `reportType` is always `behavior`.
15381
- *
15382
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
15383
- */
15384
- const toUserBehaviorReportBody = (options) => {
15385
- const apiName = 'flagUserBehavior';
15386
- const { reason, comment } = assertOptionsObject(apiName, options, '{ reason, comment? }');
15387
- if (typeof reason !== 'string' || !BEHAVIOR_REASONS.includes(reason)) {
15388
- throw new ASCInvalidParameterError(`${apiName}: \`reason\` must be a \`ContentFlagReasonEnum\` value`);
15389
- }
15390
- return withComment({ reportType: 'behavior', reason }, normalizeUserReportComment(apiName, comment));
15391
- };
15392
-
15393
- /* begin_public_function
15394
- id: user.flag_profile
15395
- */
15396
- /**
15397
- * ```js
15398
- * import { UserRepository, UserProfileFieldEnum } from '@amityco/ts-sdk'
15399
- * const flagged = await UserRepository.flagUserProfile('userId', {
15400
- * field: UserProfileFieldEnum.AVATAR,
15401
- * comment: 'Nudity in profile photo',
15402
- * })
15403
- * ```
15404
- *
15405
- * Reports one of a user's profile fields (display name, description or avatar). The
15406
- * call has no reason: profile reports never carry one, so the backend's reason rules
15407
- * cannot be violated from here. A `reason` key passed at runtime is ignored and never sent.
15408
- *
15409
- * `comment` is trimmed; a blank comment is omitted from the request; a comment longer
15410
- * than 300 characters after trimming is rejected before any request. Otherwise the
15411
- * trimmed text is sent unchanged.
15412
- *
15413
- * Sends `POST /api/v4/me/flags/:userId` with `{ reportType: <field>, comment? }`.
15414
- *
15415
- * @param userId The ID of the user to be reported
15416
- * @param options `field` is a `UserProfileFieldEnum` value; `comment` is optional free text
15417
- * @returns the flagged {@link Amity.User}
15418
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is missing or malformed, or `comment` is over 300 characters, before any request is made
15419
- *
15420
- * @category User API
15421
- * @async
15422
- * */
15423
- const flagUserProfile = async (userId, options) => submitUserReport('flagUserProfile', userId, toUserProfileReportBody(options));
15424
- /* end_public_function */
15425
-
15426
- /* begin_public_function
15427
- id: user.flag_behavior
15428
- */
15429
- /**
15430
- * ```js
15431
- * import { UserRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
15432
- * const flagged = await UserRepository.flagUserBehavior('userId', {
15433
- * reason: ContentFlagReasonEnum.Others,
15434
- * comment: 'Impersonating our brand',
15435
- * })
15436
- * ```
15437
- *
15438
- * Reports a user's behavior. `reason` is required and is one of the nine
15439
- * `ContentFlagReasonEnum` values, sent as its canonical label. Reporter text, including
15440
- * the explanation for `Others`, always travels in `comment`; the reason never carries text.
15441
- *
15442
- * `comment` is trimmed; a blank comment is omitted from the request; a comment longer
15443
- * than 300 characters after trimming is rejected before any request. Otherwise the
15444
- * trimmed text is sent unchanged.
15445
- *
15446
- * Sends `POST /api/v4/me/flags/:userId` with `{ reportType: 'behavior', reason, comment? }`.
15447
- *
15448
- * @param userId The ID of the user to be reported
15449
- * @param options `reason` is a `ContentFlagReasonEnum` value; `comment` is optional free text
15450
- * @returns the flagged {@link Amity.User}
15451
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is missing or malformed, `reason` is missing or unknown, or `comment` is over 300 characters, before any request is made
15452
- *
15453
- * @category User API
15454
- * @async
15455
- * */
15456
- const flagUserBehavior = async (userId, options) => submitUserReport('flagUserBehavior', userId, toUserBehaviorReportBody(options));
15457
- /* end_public_function */
15458
-
15459
15060
  /* begin_public_function
15460
15061
  id: user.unflag
15461
15062
  */
@@ -16630,8 +16231,6 @@ var index$r = /*#__PURE__*/Object.freeze({
16630
16231
  getUserByIds: getUserByIds,
16631
16232
  updateUser: updateUser,
16632
16233
  flagUser: flagUser,
16633
- flagUserProfile: flagUserProfile,
16634
- flagUserBehavior: flagUserBehavior,
16635
16234
  unflagUser: unflagUser,
16636
16235
  isUserFlaggedByMe: isUserFlaggedByMe,
16637
16236
  getAllBlockedUsers: getAllBlockedUsers,
@@ -20336,82 +19935,23 @@ getDeliveredUsers.locally = (query) => {
20336
19935
  return { data: users, cachedAt, prevPage, nextPage };
20337
19936
  };
20338
19937
 
20339
- const CONTENT_FLAG_REASONS = Object.values(exports.ContentFlagReasonEnum);
20340
- /**
20341
- * True when a public `flagX(id, input)` argument is the legacy shape (a reason string
20342
- * or nothing). Anything else is routed to the `Amity.ContentFlagOptions` path, whose
20343
- * validation rejects malformed values before any request is made.
20344
- */
20345
- const isLegacyContentFlagReason = (input) => input === undefined || typeof input === 'string';
20346
- /**
20347
- * Validates an `Amity.ContentFlagOptions` argument. Untyped (plain JS) callers can pass
20348
- * anything at runtime, so the checks do not trust the declared type: the value must be a
20349
- * plain object, `reason` must be one of the nine `ContentFlagReasonEnum` values and
20350
- * `detail`, when supplied, must be a string (`null` is not a valid supplied detail).
20351
- *
20352
- * @param apiName used in the error message, e.g. `flagPost`
20353
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when the options are malformed
20354
- */
20355
- const validateContentFlagOptions = (apiName, options) => {
20356
- if (typeof options !== 'object' || options === null || Array.isArray(options)) {
20357
- throw new ASCInvalidParameterError(`${apiName}: expected an options object \`{ reason, detail? }\``);
20358
- }
20359
- const { reason, detail } = options;
20360
- if (typeof reason !== 'string' || !CONTENT_FLAG_REASONS.includes(reason)) {
20361
- throw new ASCInvalidParameterError(`${apiName}: \`reason\` must be a \`ContentFlagReasonEnum\` value`);
20362
- }
20363
- if (detail !== undefined && typeof detail !== 'string') {
20364
- throw new ASCInvalidParameterError(`${apiName}: \`detail\` must be a string when supplied`);
20365
- }
20366
- return { reason: reason, detail };
20367
- };
20368
- /**
20369
- * Builds the request body for validated options. `detail` is forwarded unchanged (empty
20370
- * and whitespace-only strings included) and omitted from the body when `undefined`; the
20371
- * backend enforces the 300-character limit.
20372
- */
20373
- const toContentFlagBody = ({ reason, detail }) => detail === undefined ? { reason } : { reason, detail };
20374
-
20375
- /**
20376
- * New `flagMessage(messageId, { reason, detail? })` implementation. Any category,
20377
- * including `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
20378
- * whitespace-only strings included) and omitted from the request body when `undefined`;
20379
- * the backend enforces the 300-character limit.
20380
- *
20381
- * Not exported from the public API. It is reached through the
20382
- * `MessageRepository.flagMessage(messageId, options)` overload; see `flagMessage.ts`.
20383
- *
20384
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
20385
- */
20386
- const flagMessageWithOptions = async (messageId, options) => {
20387
- const client = getActiveClient();
20388
- client.log('message/flag', messageId);
20389
- const body = toContentFlagBody(validateContentFlagOptions('flagMessage', options));
20390
- const { data: payload } = await client.http.post(`/api/v5/messages/${encodeURIComponent(messageId)}/flags`, body);
20391
- if (client.cache) {
20392
- const messagePayload = await prepareMessagePayload(payload);
20393
- ingestInCache(messagePayload);
20394
- }
20395
- fireEvent('message.flagged', payload);
20396
- return !!payload;
20397
- };
20398
-
19938
+ /* begin_public_function
19939
+ id: message.flag
19940
+ */
20399
19941
  /**
20400
- * Legacy `flagMessage(messageId, reason?)` implementation, kept verbatim so existing
20401
- * callers keep the exact request body they had before the options contract existed:
20402
- *
20403
- * - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
20404
- * - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
20405
- * - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
20406
- * (for `undefined` the message body carries `detail: undefined`, which JSON serialization omits)
19942
+ * ```js
19943
+ * import { MessageRepository } from '@amityco/ts-sdk'
19944
+ * const flagged = await MessageRepository.flagMessage(messageId, reason)
19945
+ * ```
20407
19946
  *
20408
- * Not exported from the public API. It is reached through the deprecated
20409
- * `MessageRepository.flagMessage(messageId, reason)` overload; see `flagMessage.ts`.
19947
+ * @param messageId of the message to flag
19948
+ * @param reason the reason to flag the message
19949
+ * @returns the created report result
20410
19950
  *
20411
- * @deprecated Use `flagMessageWithOptions` (the `{ reason, detail? }` contract) for new code.
20412
- * This path stays available throughout the current major version.
20413
- */
20414
- const flagMessageWithReasonString = async (messageId, reason) => {
19951
+ * @category Message API
19952
+ * @async
19953
+ * */
19954
+ const flagMessage = async (messageId, reason) => {
20415
19955
  const client = getActiveClient();
20416
19956
  client.log('message/flag', messageId);
20417
19957
  const isPredefinedReason = reason &&
@@ -20428,42 +19968,6 @@ const flagMessageWithReasonString = async (messageId, reason) => {
20428
19968
  fireEvent('message.flagged', payload);
20429
19969
  return !!payload;
20430
19970
  };
20431
-
20432
- /* begin_public_function
20433
- id: message.flag
20434
- */
20435
- /**
20436
- * ```js
20437
- * import { MessageRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
20438
- *
20439
- * // No reason.
20440
- * await MessageRepository.flagMessage(messageId)
20441
- *
20442
- * // Category plus optional reporter context (any category, including Others).
20443
- * await MessageRepository.flagMessage(messageId, {
20444
- * reason: ContentFlagReasonEnum.SpamOrScams,
20445
- * detail: 'Repeated promotional links',
20446
- * })
20447
- * ```
20448
- *
20449
- * Reports a message to moderation. Three call shapes are accepted (see the overloads):
20450
- * id-only, an options object, and the deprecated legacy reason string. The public
20451
- * name only dispatches on the input shape; the two implementations are kept separate
20452
- * so the legacy path is untouched by the new contract:
20453
- *
20454
- * - `undefined` or a string → `flagMessageWithReasonString` (unchanged legacy mapping)
20455
- * - anything else → `flagMessageWithOptions` (validated `{ reason, detail? }`)
20456
- *
20457
- * @param messageId The ID of the message to flag
20458
- * @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
20459
- * @returns `true` when the report was created
20460
- *
20461
- * @category Message API
20462
- * @async
20463
- * */
20464
- const flagMessage = (messageId, input) => isLegacyContentFlagReason(input)
20465
- ? flagMessageWithReasonString(messageId, input)
20466
- : flagMessageWithOptions(messageId, input);
20467
19971
  /* end_public_function */
20468
19972
 
20469
19973
  /* begin_public_function
@@ -27609,21 +27113,23 @@ const declineComment = async (commentId, reason) => {
27609
27113
  };
27610
27114
  /* end_public_function */
27611
27115
 
27116
+ /* begin_public_function
27117
+ id: comment.flag
27118
+ */
27612
27119
  /**
27613
- * Legacy `flagComment(commentId, reason?)` implementation, kept verbatim so existing
27614
- * callers keep the exact request body they had before the options contract existed:
27615
- *
27616
- * - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
27617
- * - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
27618
- * - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
27120
+ * ```js
27121
+ * import { CommentRepository } from '@amityco/ts-sdk'
27122
+ * const flagged = await CommentRepository.flagComment(commentId, reason)
27123
+ * ```
27619
27124
  *
27620
- * Not exported from the public API. It is reached through the deprecated
27621
- * `CommentRepository.flagComment(commentId, reason)` overload; see `flagComment.ts`.
27125
+ * @param commentId The ID of the comment to flag
27126
+ * @param reason the reason to flag the comment
27127
+ * @returns the created report result
27622
27128
  *
27623
- * @deprecated Use `flagCommentWithOptions` (the `{ reason, detail? }` contract) for new code.
27624
- * This path stays available throughout the current major version.
27625
- */
27626
- const flagCommentWithReasonString = async (commentId, reason) => {
27129
+ * @category Comment API
27130
+ * @async
27131
+ * */
27132
+ const flagComment = async (commentId, reason) => {
27627
27133
  const client = getActiveClient();
27628
27134
  client.log('comment/flagComment', commentId);
27629
27135
  const isPredefinedReason = reason &&
@@ -27639,65 +27145,6 @@ const flagCommentWithReasonString = async (commentId, reason) => {
27639
27145
  fireEvent('comment.flagged', payload);
27640
27146
  return !!payload;
27641
27147
  };
27642
-
27643
- /**
27644
- * New `flagComment(commentId, { reason, detail? })` implementation. Any category,
27645
- * including `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
27646
- * whitespace-only strings included) and omitted from the request body when `undefined`;
27647
- * the backend enforces the 300-character limit.
27648
- *
27649
- * Not exported from the public API. It is reached through the
27650
- * `CommentRepository.flagComment(commentId, options)` overload; see `flagComment.ts`.
27651
- *
27652
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
27653
- */
27654
- const flagCommentWithOptions = async (commentId, options) => {
27655
- const client = getActiveClient();
27656
- client.log('comment/flagComment', commentId);
27657
- const body = toContentFlagBody(validateContentFlagOptions('flagComment', options));
27658
- const { data: payload } = await client.http.post(`/api/v3/comments/${encodeURIComponent(commentId)}/flag`, body);
27659
- if (client.cache) {
27660
- ingestInCache(payload);
27661
- }
27662
- fireEvent('comment.flagged', payload);
27663
- return !!payload;
27664
- };
27665
-
27666
- /* begin_public_function
27667
- id: comment.flag
27668
- */
27669
- /**
27670
- * ```js
27671
- * import { CommentRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
27672
- *
27673
- * // No reason: sent as Others with an empty detail.
27674
- * await CommentRepository.flagComment(commentId)
27675
- *
27676
- * // Category plus optional reporter context (any category, including Others).
27677
- * await CommentRepository.flagComment(commentId, {
27678
- * reason: ContentFlagReasonEnum.SpamOrScams,
27679
- * detail: 'Repeated promotional links',
27680
- * })
27681
- * ```
27682
- *
27683
- * Reports a comment to moderation. Three call shapes are accepted (see the overloads):
27684
- * id-only, an options object, and the deprecated legacy reason string. The public
27685
- * name only dispatches on the input shape; the two implementations are kept separate
27686
- * so the legacy path is untouched by the new contract:
27687
- *
27688
- * - `undefined` or a string → `flagCommentWithReasonString` (unchanged legacy mapping)
27689
- * - anything else → `flagCommentWithOptions` (validated `{ reason, detail? }`)
27690
- *
27691
- * @param commentId The ID of the comment to flag
27692
- * @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
27693
- * @returns `true` when the report was created
27694
- *
27695
- * @category Comment API
27696
- * @async
27697
- * */
27698
- const flagComment = (commentId, input) => isLegacyContentFlagReason(input)
27699
- ? flagCommentWithReasonString(commentId, input)
27700
- : flagCommentWithOptions(commentId, input);
27701
27148
  /* end_public_function */
27702
27149
 
27703
27150
  /* begin_public_function
@@ -30051,44 +29498,23 @@ const declinePost = async (postId) => {
30051
29498
  };
30052
29499
  /* end_public_function */
30053
29500
 
29501
+ /* begin_public_function
29502
+ id: post.flag
29503
+ */
30054
29504
  /**
30055
- * New `flagPost(postId, { reason, detail? })` implementation. Any category, including
30056
- * `Others`, may carry a `detail`. `detail` is forwarded unchanged (empty and
30057
- * whitespace-only strings included) and omitted from the request body when `undefined`;
30058
- * the backend enforces the 300-character limit.
30059
- *
30060
- * Not exported from the public API. It is reached through the
30061
- * `PostRepository.flagPost(postId, options)` overload; see `flagPost.ts`.
30062
- *
30063
- * @throws {ASCInvalidParameterError} `INVALID_PARAMETERS` when `options` is malformed, before any request is made
30064
- */
30065
- const flagPostWithOptions = async (postId, options) => {
30066
- const client = getActiveClient();
30067
- client.log('post/flagPost', postId);
30068
- const body = toContentFlagBody(validateContentFlagOptions('flagPost', options));
30069
- const { data: payload } = await client.http.post(`/api/v3/posts/${encodeURIComponent(postId)}/flag`, body);
30070
- if (client.cache) {
30071
- ingestInCache(prepareMembershipPayload(payload, 'communityUsers'));
30072
- }
30073
- fireEvent('post.flagged', payload);
30074
- return !!payload;
30075
- };
30076
-
30077
- /**
30078
- * Legacy `flagPost(postId, reason?)` implementation, kept verbatim so existing
30079
- * callers keep the exact request body they had before the options contract existed:
30080
- *
30081
- * - predefined `ContentFlagReasonEnum` value → `{ reason: <value>, detail: '' }`
30082
- * - any other non-empty string (including the literal `'Others'`) → `{ reason: 'Others', detail: <string> }`
30083
- * - `undefined` or `''` → `{ reason: 'Others', detail: '' }`
29505
+ * ```js
29506
+ * import { PostRepository } from '@amityco/ts-sdk'
29507
+ * const flagged = await PostRepository.flagPost(postId, reason)
29508
+ * ```
30084
29509
  *
30085
- * Not exported from the public API. It is reached through the deprecated
30086
- * `PostRepository.flagPost(postId, reason)` overload; see `flagPost.ts`.
29510
+ * @param postId of the post to flag
29511
+ * @param reason the reason to flag the post
29512
+ * @returns a boolean
30087
29513
  *
30088
- * @deprecated Use `flagPostWithOptions` (the `{ reason, detail? }` contract) for new code.
30089
- * This path stays available throughout the current major version.
30090
- */
30091
- const flagPostWithReasonString = async (postId, reason) => {
29514
+ * @category Post API
29515
+ * @async
29516
+ * */
29517
+ const flagPost = async (postId, reason) => {
30092
29518
  const client = getActiveClient();
30093
29519
  client.log('post/flagPost', postId);
30094
29520
  const isPredefinedReason = reason &&
@@ -30104,42 +29530,6 @@ const flagPostWithReasonString = async (postId, reason) => {
30104
29530
  fireEvent('post.flagged', payload);
30105
29531
  return !!payload;
30106
29532
  };
30107
-
30108
- /* begin_public_function
30109
- id: post.flag
30110
- */
30111
- /**
30112
- * ```js
30113
- * import { PostRepository, ContentFlagReasonEnum } from '@amityco/ts-sdk'
30114
- *
30115
- * // No reason.
30116
- * await PostRepository.flagPost(postId)
30117
- *
30118
- * // Category plus optional reporter context (any category, including Others).
30119
- * await PostRepository.flagPost(postId, {
30120
- * reason: ContentFlagReasonEnum.SpamOrScams,
30121
- * detail: 'Repeated promotional links',
30122
- * })
30123
- * ```
30124
- *
30125
- * Reports a post to moderation. Three call shapes are accepted (see the overloads):
30126
- * id-only, an options object, and the deprecated legacy reason string. The public
30127
- * name only dispatches on the input shape; the two implementations are kept separate
30128
- * so the legacy path is untouched by the new contract:
30129
- *
30130
- * - `undefined` or a string → `flagPostWithReasonString` (unchanged legacy mapping)
30131
- * - anything else → `flagPostWithOptions` (validated `{ reason, detail? }`)
30132
- *
30133
- * @param postId The ID of the post to flag
30134
- * @param input an options object `{ reason, detail? }`, a legacy reason string, or nothing
30135
- * @returns `true` when the report was created
30136
- *
30137
- * @category Post API
30138
- * @async
30139
- * */
30140
- const flagPost = (postId, input) => isLegacyContentFlagReason(input)
30141
- ? flagPostWithReasonString(postId, input)
30142
- : flagPostWithOptions(postId, input);
30143
29533
  /* end_public_function */
30144
29534
 
30145
29535
  /* begin_public_function
@@ -37523,7 +36913,6 @@ class AmityAttachmentProductTags {
37523
36913
  exports.API_REGIONS = API_REGIONS;
37524
36914
  exports.AdRepository = index$6;
37525
36915
  exports.AmityAttachmentProductTags = AmityAttachmentProductTags;
37526
- exports.AmityModuleNotEntitledError = AmityModuleNotEntitledError;
37527
36916
  exports.CategoryRepository = index$g;
37528
36917
  exports.ChannelRepository = index$k;
37529
36918
  exports.Client = index$t;
@@ -37632,7 +37021,6 @@ exports.pushToCache = pushToCache;
37632
37021
  exports.queryCache = queryCache;
37633
37022
  exports.queryOptions = queryOptions;
37634
37023
  exports.queryRoles = queryRoles;
37635
- exports.resolveModuleAvailability = resolveModuleAvailability;
37636
37024
  exports.restoreCache = restoreCache;
37637
37025
  exports.runQuery = runQuery;
37638
37026
  exports.sortByChannelSegment = sortByChannelSegment;