@stream-io/feeds-client 0.3.47 → 0.3.49

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 (49) hide show
  1. package/CHANGELOG.md +21 -0
  2. package/dist/cjs/index.js +1 -1
  3. package/dist/cjs/index.js.map +1 -1
  4. package/dist/cjs/react-bindings.js +1 -1
  5. package/dist/es/index.mjs +2 -2
  6. package/dist/es/index.mjs.map +1 -1
  7. package/dist/es/react-bindings.mjs +1 -1
  8. package/dist/{feeds-client-ykIZW9Hi.mjs → feeds-client-B9b7zUcW.mjs} +182 -196
  9. package/dist/feeds-client-B9b7zUcW.mjs.map +1 -0
  10. package/dist/{feeds-client-CxjZlEtX.js → feeds-client-BDvUG9yF.js} +182 -196
  11. package/dist/feeds-client-BDvUG9yF.js.map +1 -0
  12. package/dist/tsconfig.lib.tsbuildinfo +1 -1
  13. package/dist/types/common/Poll.d.ts +15 -6
  14. package/dist/types/common/Poll.d.ts.map +1 -1
  15. package/dist/types/common/real-time/StableWSConnection.d.ts +3 -3
  16. package/dist/types/common/real-time/StableWSConnection.d.ts.map +1 -1
  17. package/dist/types/feed/event-handlers/activity-updater.d.ts +1 -1
  18. package/dist/types/feed/event-handlers/comment/handle-comment-added.d.ts.map +1 -1
  19. package/dist/types/feed/feed.d.ts +2 -2
  20. package/dist/types/feed/feed.d.ts.map +1 -1
  21. package/dist/types/feeds-client/feeds-client.d.ts +17 -3
  22. package/dist/types/feeds-client/feeds-client.d.ts.map +1 -1
  23. package/dist/types/gen/feeds/FeedApi.d.ts +2 -1
  24. package/dist/types/gen/feeds/FeedApi.d.ts.map +1 -1
  25. package/dist/types/gen/feeds/FeedsApi.d.ts +5 -1
  26. package/dist/types/gen/feeds/FeedsApi.d.ts.map +1 -1
  27. package/dist/types/gen/model-decoders/event-decoder-mapping.d.ts.map +1 -1
  28. package/dist/types/gen/models/index.d.ts +209 -422
  29. package/dist/types/gen/models/index.d.ts.map +1 -1
  30. package/dist/types/gen/moderation/ModerationApi.d.ts.map +1 -1
  31. package/dist/types/types.d.ts +2 -2
  32. package/dist/types/types.d.ts.map +1 -1
  33. package/dist/types/utils/constants.d.ts +1 -1
  34. package/package.json +1 -1
  35. package/src/common/Poll.ts +59 -40
  36. package/src/feed/event-handlers/comment/handle-comment-added.ts +14 -2
  37. package/src/feed/feed.ts +24 -9
  38. package/src/feeds-client/feeds-client.ts +70 -1
  39. package/src/gen/feeds/FeedApi.ts +12 -0
  40. package/src/gen/feeds/FeedsApi.ts +37 -0
  41. package/src/gen/model-decoders/decoders.ts +47 -251
  42. package/src/gen/model-decoders/event-decoder-mapping.ts +3 -2
  43. package/src/gen/models/index.ts +314 -723
  44. package/src/gen/moderation/ModerationApi.ts +1 -0
  45. package/src/test-utils/response-generators.ts +3 -2
  46. package/src/types.ts +2 -2
  47. package/src/utils/constants.ts +1 -1
  48. package/dist/feeds-client-CxjZlEtX.js.map +0 -1
  49. package/dist/feeds-client-ykIZW9Hi.mjs.map +0 -1
@@ -137,7 +137,7 @@ decoders.ActivityResponse = (input) => {
137
137
  own_bookmarks: { type: "BookmarkResponse", isSingle: false },
138
138
  own_reactions: { type: "FeedsReactionResponse", isSingle: false },
139
139
  collections: { type: "EnrichedCollectionResponse", isSingle: false },
140
- reaction_groups: { type: "ReactionGroupResponse", isSingle: false },
140
+ reaction_groups: { type: "FeedsReactionGroupResponse", isSingle: false },
141
141
  user: { type: "UserResponse", isSingle: true },
142
142
  deleted_at: { type: "DatetimeType", isSingle: true },
143
143
  edited_at: { type: "DatetimeType", isSingle: true },
@@ -234,13 +234,12 @@ decoders.AppealItemResponse = (input) => {
234
234
  };
235
235
  return decode(typeMappings, input);
236
236
  };
237
- decoders.Ban = (input) => {
237
+ decoders.BanInfoResponse = (input) => {
238
238
  const typeMappings = {
239
239
  created_at: { type: "DatetimeType", isSingle: true },
240
240
  expires: { type: "DatetimeType", isSingle: true },
241
- channel: { type: "Channel", isSingle: true },
242
- created_by: { type: "User", isSingle: true },
243
- target: { type: "User", isSingle: true }
241
+ created_by: { type: "UserResponse", isSingle: true },
242
+ user: { type: "UserResponse", isSingle: true }
244
243
  };
245
244
  return decode(typeMappings, input);
246
245
  };
@@ -355,30 +354,6 @@ decoders.CallSessionResponse = (input) => {
355
354
  };
356
355
  return decode(typeMappings, input);
357
356
  };
358
- decoders.Channel = (input) => {
359
- const typeMappings = {
360
- created_at: { type: "DatetimeType", isSingle: true },
361
- updated_at: { type: "DatetimeType", isSingle: true },
362
- deleted_at: { type: "DatetimeType", isSingle: true },
363
- last_message_at: { type: "DatetimeType", isSingle: true },
364
- message_count_updated_at: { type: "DatetimeType", isSingle: true },
365
- active_live_locations: { type: "SharedLocation", isSingle: false },
366
- invites: { type: "ChannelMember", isSingle: false },
367
- members: { type: "ChannelMember", isSingle: false },
368
- config: { type: "ChannelConfig", isSingle: true },
369
- created_by: { type: "User", isSingle: true },
370
- members_lookup: { type: "ChannelMemberLookup", isSingle: false },
371
- truncated_by: { type: "User", isSingle: true }
372
- };
373
- return decode(typeMappings, input);
374
- };
375
- decoders.ChannelConfig = (input) => {
376
- const typeMappings = {
377
- created_at: { type: "DatetimeType", isSingle: true },
378
- updated_at: { type: "DatetimeType", isSingle: true }
379
- };
380
- return decode(typeMappings, input);
381
- };
382
357
  decoders.ChannelConfigWithInfo = (input) => {
383
358
  const typeMappings = {
384
359
  created_at: { type: "DatetimeType", isSingle: true },
@@ -387,28 +362,6 @@ decoders.ChannelConfigWithInfo = (input) => {
387
362
  };
388
363
  return decode(typeMappings, input);
389
364
  };
390
- decoders.ChannelMember = (input) => {
391
- const typeMappings = {
392
- created_at: { type: "DatetimeType", isSingle: true },
393
- updated_at: { type: "DatetimeType", isSingle: true },
394
- archived_at: { type: "DatetimeType", isSingle: true },
395
- ban_expires: { type: "DatetimeType", isSingle: true },
396
- deleted_at: { type: "DatetimeType", isSingle: true },
397
- invite_accepted_at: { type: "DatetimeType", isSingle: true },
398
- invite_rejected_at: { type: "DatetimeType", isSingle: true },
399
- pinned_at: { type: "DatetimeType", isSingle: true },
400
- user: { type: "User", isSingle: true }
401
- };
402
- return decode(typeMappings, input);
403
- };
404
- decoders.ChannelMemberLookup = (input) => {
405
- const typeMappings = {
406
- archived_at: { type: "DatetimeType", isSingle: true },
407
- ban_expires: { type: "DatetimeType", isSingle: true },
408
- pinned_at: { type: "DatetimeType", isSingle: true }
409
- };
410
- return decode(typeMappings, input);
411
- };
412
365
  decoders.ChannelMemberResponse = (input) => {
413
366
  const typeMappings = {
414
367
  created_at: { type: "DatetimeType", isSingle: true },
@@ -519,7 +472,7 @@ decoders.CommentResponse = (input) => {
519
472
  deleted_at: { type: "DatetimeType", isSingle: true },
520
473
  edited_at: { type: "DatetimeType", isSingle: true },
521
474
  latest_reactions: { type: "FeedsReactionResponse", isSingle: false },
522
- reaction_groups: { type: "ReactionGroupResponse", isSingle: false }
475
+ reaction_groups: { type: "FeedsReactionGroupResponse", isSingle: false }
523
476
  };
524
477
  return decode(typeMappings, input);
525
478
  };
@@ -589,12 +542,6 @@ decoders.DeleteCommentResponse = (input) => {
589
542
  };
590
543
  return decode(typeMappings, input);
591
544
  };
592
- decoders.Device = (input) => {
593
- const typeMappings = {
594
- created_at: { type: "DatetimeType", isSingle: true }
595
- };
596
- return decode(typeMappings, input);
597
- };
598
545
  decoders.DeviceResponse = (input) => {
599
546
  const typeMappings = {
600
547
  created_at: { type: "DatetimeType", isSingle: true }
@@ -745,6 +692,13 @@ decoders.FeedUpdatedEvent = (input) => {
745
692
  };
746
693
  return decode(typeMappings, input);
747
694
  };
695
+ decoders.FeedsReactionGroupResponse = (input) => {
696
+ const typeMappings = {
697
+ first_reaction_at: { type: "DatetimeType", isSingle: true },
698
+ last_reaction_at: { type: "DatetimeType", isSingle: true }
699
+ };
700
+ return decode(typeMappings, input);
701
+ };
748
702
  decoders.FeedsReactionResponse = (input) => {
749
703
  const typeMappings = {
750
704
  created_at: { type: "DatetimeType", isSingle: true },
@@ -877,7 +831,8 @@ decoders.GetOrCreateFeedResponse = (input) => {
877
831
  decoders.HealthCheckEvent = (input) => {
878
832
  const typeMappings = {
879
833
  created_at: { type: "DatetimeType", isSingle: true },
880
- received_at: { type: "DatetimeType", isSingle: true }
834
+ received_at: { type: "DatetimeType", isSingle: true },
835
+ me: { type: "OwnUserResponse", isSingle: true }
881
836
  };
882
837
  return decode(typeMappings, input);
883
838
  };
@@ -900,40 +855,6 @@ decoders.MembershipLevelResponse = (input) => {
900
855
  };
901
856
  return decode(typeMappings, input);
902
857
  };
903
- decoders.Message = (input) => {
904
- const typeMappings = {
905
- created_at: { type: "DatetimeType", isSingle: true },
906
- updated_at: { type: "DatetimeType", isSingle: true },
907
- latest_reactions: { type: "Reaction", isSingle: false },
908
- mentioned_users: { type: "User", isSingle: false },
909
- own_reactions: { type: "Reaction", isSingle: false },
910
- reaction_groups: { type: "ReactionGroupResponse", isSingle: false },
911
- deleted_at: { type: "DatetimeType", isSingle: true },
912
- message_text_updated_at: { type: "DatetimeType", isSingle: true },
913
- pin_expires: { type: "DatetimeType", isSingle: true },
914
- pinned_at: { type: "DatetimeType", isSingle: true },
915
- thread_participants: { type: "User", isSingle: false },
916
- member: { type: "ChannelMember", isSingle: true },
917
- pinned_by: { type: "User", isSingle: true },
918
- poll: { type: "Poll", isSingle: true },
919
- quoted_message: { type: "Message", isSingle: true },
920
- reminder: { type: "MessageReminder", isSingle: true },
921
- shared_location: { type: "SharedLocation", isSingle: true },
922
- user: { type: "User", isSingle: true }
923
- };
924
- return decode(typeMappings, input);
925
- };
926
- decoders.MessageReminder = (input) => {
927
- const typeMappings = {
928
- created_at: { type: "DatetimeType", isSingle: true },
929
- updated_at: { type: "DatetimeType", isSingle: true },
930
- remind_at: { type: "DatetimeType", isSingle: true },
931
- channel: { type: "Channel", isSingle: true },
932
- message: { type: "Message", isSingle: true },
933
- user: { type: "User", isSingle: true }
934
- };
935
- return decode(typeMappings, input);
936
- };
937
858
  decoders.MessageResponse = (input) => {
938
859
  const typeMappings = {
939
860
  created_at: { type: "DatetimeType", isSingle: true },
@@ -979,7 +900,7 @@ decoders.ModerationFlagResponse = (input) => {
979
900
  decoders.ModerationFlaggedEvent = (input) => {
980
901
  const typeMappings = {
981
902
  created_at: { type: "DatetimeType", isSingle: true },
982
- user: { type: "User", isSingle: true }
903
+ received_at: { type: "DatetimeType", isSingle: true }
983
904
  };
984
905
  return decode(typeMappings, input);
985
906
  };
@@ -994,8 +915,8 @@ decoders.ModerationMarkReviewedEvent = (input) => {
994
915
  };
995
916
  decoders.MuteResponse = (input) => {
996
917
  const typeMappings = {
997
- mutes: { type: "UserMute", isSingle: false },
998
- own_user: { type: "OwnUser", isSingle: true }
918
+ mutes: { type: "UserMuteResponse", isSingle: false },
919
+ own_user: { type: "OwnUserResponse", isSingle: true }
999
920
  };
1000
921
  return decode(typeMappings, input);
1001
922
  };
@@ -1024,18 +945,18 @@ decoders.OwnBatchResponse = (input) => {
1024
945
  };
1025
946
  return decode(typeMappings, input);
1026
947
  };
1027
- decoders.OwnUser = (input) => {
948
+ decoders.OwnUserResponse = (input) => {
1028
949
  const typeMappings = {
1029
950
  created_at: { type: "DatetimeType", isSingle: true },
1030
951
  updated_at: { type: "DatetimeType", isSingle: true },
1031
952
  channel_mutes: { type: "ChannelMute", isSingle: false },
1032
- devices: { type: "Device", isSingle: false },
1033
- mutes: { type: "UserMute", isSingle: false },
953
+ devices: { type: "DeviceResponse", isSingle: false },
954
+ mutes: { type: "UserMuteResponse", isSingle: false },
1034
955
  deactivated_at: { type: "DatetimeType", isSingle: true },
1035
956
  deleted_at: { type: "DatetimeType", isSingle: true },
1036
957
  last_active: { type: "DatetimeType", isSingle: true },
1037
- last_engaged_at: { type: "DatetimeType", isSingle: true },
1038
- push_preferences: { type: "PushPreferences", isSingle: true }
958
+ revoke_tokens_issued_before: { type: "DatetimeType", isSingle: true },
959
+ push_preferences: { type: "PushPreferencesResponse", isSingle: true }
1039
960
  };
1040
961
  return decode(typeMappings, input);
1041
962
  };
@@ -1046,16 +967,6 @@ decoders.PinActivityResponse = (input) => {
1046
967
  };
1047
968
  return decode(typeMappings, input);
1048
969
  };
1049
- decoders.Poll = (input) => {
1050
- const typeMappings = {
1051
- created_at: { type: "DatetimeType", isSingle: true },
1052
- updated_at: { type: "DatetimeType", isSingle: true },
1053
- latest_answers: { type: "PollVote", isSingle: false },
1054
- own_votes: { type: "PollVote", isSingle: false },
1055
- created_by: { type: "User", isSingle: true }
1056
- };
1057
- return decode(typeMappings, input);
1058
- };
1059
970
  decoders.PollClosedFeedEvent = (input) => {
1060
971
  const typeMappings = {
1061
972
  created_at: { type: "DatetimeType", isSingle: true },
@@ -1096,14 +1007,6 @@ decoders.PollUpdatedFeedEvent = (input) => {
1096
1007
  };
1097
1008
  return decode(typeMappings, input);
1098
1009
  };
1099
- decoders.PollVote = (input) => {
1100
- const typeMappings = {
1101
- created_at: { type: "DatetimeType", isSingle: true },
1102
- updated_at: { type: "DatetimeType", isSingle: true },
1103
- user: { type: "User", isSingle: true }
1104
- };
1105
- return decode(typeMappings, input);
1106
- };
1107
1010
  decoders.PollVoteCastedFeedEvent = (input) => {
1108
1011
  const typeMappings = {
1109
1012
  created_at: { type: "DatetimeType", isSingle: true },
@@ -1152,7 +1055,7 @@ decoders.PollVotesResponse = (input) => {
1152
1055
  };
1153
1056
  return decode(typeMappings, input);
1154
1057
  };
1155
- decoders.PushPreferences = (input) => {
1058
+ decoders.PushPreferencesResponse = (input) => {
1156
1059
  const typeMappings = {
1157
1060
  disabled_until: { type: "DatetimeType", isSingle: true }
1158
1061
  };
@@ -1224,6 +1127,12 @@ decoders.QueryModerationConfigsResponse = (input) => {
1224
1127
  };
1225
1128
  return decode(typeMappings, input);
1226
1129
  };
1130
+ decoders.QueryPinnedActivitiesResponse = (input) => {
1131
+ const typeMappings = {
1132
+ pinned_activities: { type: "ActivityPinResponse", isSingle: false }
1133
+ };
1134
+ return decode(typeMappings, input);
1135
+ };
1227
1136
  decoders.QueryPollsResponse = (input) => {
1228
1137
  const typeMappings = {
1229
1138
  polls: { type: "PollResponseData", isSingle: false }
@@ -1240,8 +1149,7 @@ decoders.Reaction = (input) => {
1240
1149
  const typeMappings = {
1241
1150
  created_at: { type: "DatetimeType", isSingle: true },
1242
1151
  updated_at: { type: "DatetimeType", isSingle: true },
1243
- deleted_at: { type: "DatetimeType", isSingle: true },
1244
- user: { type: "User", isSingle: true }
1152
+ deleted_at: { type: "DatetimeType", isSingle: true }
1245
1153
  };
1246
1154
  return decode(typeMappings, input);
1247
1155
  };
@@ -1300,7 +1208,7 @@ decoders.ReviewQueueItemResponse = (input) => {
1300
1208
  created_at: { type: "DatetimeType", isSingle: true },
1301
1209
  updated_at: { type: "DatetimeType", isSingle: true },
1302
1210
  actions: { type: "ActionLogResponse", isSingle: false },
1303
- bans: { type: "Ban", isSingle: false },
1211
+ bans: { type: "BanInfoResponse", isSingle: false },
1304
1212
  flags: { type: "ModerationFlagResponse", isSingle: false },
1305
1213
  completed_at: { type: "DatetimeType", isSingle: true },
1306
1214
  reviewed_at: { type: "DatetimeType", isSingle: true },
@@ -1316,16 +1224,6 @@ decoders.ReviewQueueItemResponse = (input) => {
1316
1224
  };
1317
1225
  return decode(typeMappings, input);
1318
1226
  };
1319
- decoders.SharedLocation = (input) => {
1320
- const typeMappings = {
1321
- created_at: { type: "DatetimeType", isSingle: true },
1322
- updated_at: { type: "DatetimeType", isSingle: true },
1323
- end_at: { type: "DatetimeType", isSingle: true },
1324
- channel: { type: "Channel", isSingle: true },
1325
- message: { type: "Message", isSingle: true }
1326
- };
1327
- return decode(typeMappings, input);
1328
- };
1329
1227
  decoders.SharedLocationResponse = (input) => {
1330
1228
  const typeMappings = {
1331
1229
  created_at: { type: "DatetimeType", isSingle: true },
@@ -1391,7 +1289,7 @@ decoders.ThreadedCommentResponse = (input) => {
1391
1289
  edited_at: { type: "DatetimeType", isSingle: true },
1392
1290
  latest_reactions: { type: "FeedsReactionResponse", isSingle: false },
1393
1291
  replies: { type: "ThreadedCommentResponse", isSingle: false },
1394
- reaction_groups: { type: "ReactionGroupResponse", isSingle: false }
1292
+ reaction_groups: { type: "FeedsReactionGroupResponse", isSingle: false }
1395
1293
  };
1396
1294
  return decode(typeMappings, input);
1397
1295
  };
@@ -1494,47 +1392,22 @@ decoders.UpsertConfigResponse = (input) => {
1494
1392
  };
1495
1393
  decoders.UpsertPushPreferencesResponse = (input) => {
1496
1394
  const typeMappings = {
1497
- user_preferences: { type: "PushPreferences", isSingle: false }
1498
- };
1499
- return decode(typeMappings, input);
1500
- };
1501
- decoders.User = (input) => {
1502
- const typeMappings = {
1503
- ban_expires: { type: "DatetimeType", isSingle: true },
1504
- created_at: { type: "DatetimeType", isSingle: true },
1505
- deactivated_at: { type: "DatetimeType", isSingle: true },
1506
- deleted_at: { type: "DatetimeType", isSingle: true },
1507
- last_active: { type: "DatetimeType", isSingle: true },
1508
- last_engaged_at: { type: "DatetimeType", isSingle: true },
1509
- revoke_tokens_issued_before: { type: "DatetimeType", isSingle: true },
1510
- updated_at: { type: "DatetimeType", isSingle: true }
1395
+ user_preferences: { type: "PushPreferencesResponse", isSingle: false }
1511
1396
  };
1512
1397
  return decode(typeMappings, input);
1513
1398
  };
1514
1399
  decoders.UserBannedEvent = (input) => {
1515
1400
  const typeMappings = {
1516
1401
  created_at: { type: "DatetimeType", isSingle: true },
1517
- created_by: { type: "User", isSingle: true },
1518
1402
  expiration: { type: "DatetimeType", isSingle: true },
1519
- user: { type: "User", isSingle: true }
1403
+ received_at: { type: "DatetimeType", isSingle: true }
1520
1404
  };
1521
1405
  return decode(typeMappings, input);
1522
1406
  };
1523
1407
  decoders.UserDeactivatedEvent = (input) => {
1524
1408
  const typeMappings = {
1525
1409
  created_at: { type: "DatetimeType", isSingle: true },
1526
- created_by: { type: "User", isSingle: true },
1527
- user: { type: "User", isSingle: true }
1528
- };
1529
- return decode(typeMappings, input);
1530
- };
1531
- decoders.UserMute = (input) => {
1532
- const typeMappings = {
1533
- created_at: { type: "DatetimeType", isSingle: true },
1534
- updated_at: { type: "DatetimeType", isSingle: true },
1535
- expires: { type: "DatetimeType", isSingle: true },
1536
- target: { type: "User", isSingle: true },
1537
- user: { type: "User", isSingle: true }
1410
+ received_at: { type: "DatetimeType", isSingle: true }
1538
1411
  };
1539
1412
  return decode(typeMappings, input);
1540
1413
  };
@@ -1548,17 +1421,10 @@ decoders.UserMuteResponse = (input) => {
1548
1421
  };
1549
1422
  return decode(typeMappings, input);
1550
1423
  };
1551
- decoders.UserMutedEvent = (input) => {
1552
- const typeMappings = {
1553
- created_at: { type: "DatetimeType", isSingle: true },
1554
- user: { type: "User", isSingle: true }
1555
- };
1556
- return decode(typeMappings, input);
1557
- };
1558
1424
  decoders.UserReactivatedEvent = (input) => {
1559
1425
  const typeMappings = {
1560
1426
  created_at: { type: "DatetimeType", isSingle: true },
1561
- user: { type: "User", isSingle: true }
1427
+ received_at: { type: "DatetimeType", isSingle: true }
1562
1428
  };
1563
1429
  return decode(typeMappings, input);
1564
1430
  };
@@ -1573,6 +1439,13 @@ decoders.UserResponse = (input) => {
1573
1439
  };
1574
1440
  return decode(typeMappings, input);
1575
1441
  };
1442
+ decoders.UserUnbannedEvent = (input) => {
1443
+ const typeMappings = {
1444
+ created_at: { type: "DatetimeType", isSingle: true },
1445
+ received_at: { type: "DatetimeType", isSingle: true }
1446
+ };
1447
+ return decode(typeMappings, input);
1448
+ };
1576
1449
  decoders.UserUpdatedEvent = (input) => {
1577
1450
  const typeMappings = {
1578
1451
  created_at: { type: "DatetimeType", isSingle: true },
@@ -2017,7 +1890,8 @@ class FeedsApi {
2017
1890
  interest_tags: request?.interest_tags,
2018
1891
  mentioned_user_ids: request?.mentioned_user_ids,
2019
1892
  custom: request?.custom,
2020
- location: request?.location
1893
+ location: request?.location,
1894
+ search_data: request?.search_data
2021
1895
  };
2022
1896
  const response = await this.apiClient.sendRequest(
2023
1897
  "PUT",
@@ -2571,6 +2445,29 @@ class FeedsApi {
2571
2445
  decoders.RejectFeedMemberInviteResponse?.(response.body);
2572
2446
  return { ...response.body, metadata: response.metadata };
2573
2447
  }
2448
+ async queryPinnedActivities(request) {
2449
+ const pathParams = {
2450
+ feed_group_id: request?.feed_group_id,
2451
+ feed_id: request?.feed_id
2452
+ };
2453
+ const body = {
2454
+ limit: request?.limit,
2455
+ next: request?.next,
2456
+ prev: request?.prev,
2457
+ sort: request?.sort,
2458
+ filter: request?.filter
2459
+ };
2460
+ const response = await this.apiClient.sendRequest(
2461
+ "POST",
2462
+ "/api/v2/feeds/feed_groups/{feed_group_id}/feeds/{feed_id}/pinned_activities/query",
2463
+ pathParams,
2464
+ void 0,
2465
+ body,
2466
+ "application/json"
2467
+ );
2468
+ decoders.QueryPinnedActivitiesResponse?.(response.body);
2469
+ return { ...response.body, metadata: response.metadata };
2470
+ }
2574
2471
  async stopWatchingFeed(request) {
2575
2472
  const queryParams = {
2576
2473
  connection_id: request?.connection_id
@@ -4010,7 +3907,7 @@ const getRateLimitFromResponseHeader = (response_headers) => {
4010
3907
  };
4011
3908
  return result;
4012
3909
  };
4013
- const version = "0.3.47";
3910
+ const version = "0.3.49";
4014
3911
  const axios = axiosImport.default ?? axiosImport;
4015
3912
  class ApiClient {
4016
3913
  constructor(apiKey, tokenManager, connectionIdManager, options) {
@@ -4233,8 +4130,8 @@ const eventDecoderMapping = {
4233
4130
  "moderation.mark_reviewed": (data) => decoders.ModerationMarkReviewedEvent(data),
4234
4131
  "user.banned": (data) => decoders.UserBannedEvent(data),
4235
4132
  "user.deactivated": (data) => decoders.UserDeactivatedEvent(data),
4236
- "user.muted": (data) => decoders.UserMutedEvent(data),
4237
4133
  "user.reactivated": (data) => decoders.UserReactivatedEvent(data),
4134
+ "user.unbanned": (data) => decoders.UserUnbannedEvent(data),
4238
4135
  "user.updated": (data) => decoders.UserUpdatedEvent(data)
4239
4136
  };
4240
4137
  const decodeWSEvent = (data) => {
@@ -4460,6 +4357,7 @@ class ModerationApi {
4460
4357
  delete_message: request?.delete_message,
4461
4358
  delete_reaction: request?.delete_reaction,
4462
4359
  delete_user: request?.delete_user,
4360
+ flag: request?.flag,
4463
4361
  mark_reviewed: request?.mark_reviewed,
4464
4362
  reject_appeal: request?.reject_appeal,
4465
4363
  restore: request?.restore,
@@ -4481,11 +4379,6 @@ class ModerationApi {
4481
4379
  }
4482
4380
  class ModerationClient extends ModerationApi {
4483
4381
  }
4484
- const isPollUpdatedEvent = (e) => e.type === "feeds.poll.updated";
4485
- const isPollClosedEventEvent = (e) => e.type === "feeds.poll.closed";
4486
- const isPollVoteCastedEvent = (e) => e.type === "feeds.poll.vote_casted";
4487
- const isPollVoteChangedEvent = (e) => e.type === "feeds.poll.vote_changed";
4488
- const isPollVoteRemovedEvent = (e) => e.type === "feeds.poll.vote_removed";
4489
4382
  const isVoteAnswer = (vote) => !!vote?.answer_text;
4490
4383
  class StreamPoll {
4491
4384
  constructor({ client, poll }) {
@@ -4517,7 +4410,10 @@ class StreamPoll {
4517
4410
  };
4518
4411
  this.handlePollUpdated = (event) => {
4519
4412
  if (event.poll?.id && event.poll.id !== this.id) return;
4520
- if (!isPollUpdatedEvent(event)) return;
4413
+ const currentState = this.data;
4414
+ if (currentState.updated_at && event.poll.updated_at && event.poll.updated_at <= currentState.updated_at) {
4415
+ return;
4416
+ }
4521
4417
  const { id, ...pollData } = event.poll;
4522
4418
  this.state.partialNext({
4523
4419
  ...pollData,
@@ -4526,7 +4422,8 @@ class StreamPoll {
4526
4422
  };
4527
4423
  this.handlePollClosed = (event) => {
4528
4424
  if (event.poll?.id && event.poll.id !== this.id) return;
4529
- if (!isPollClosedEventEvent(event)) return;
4425
+ const currentState = this.data;
4426
+ if (currentState.is_closed) return;
4530
4427
  this.state.partialNext({
4531
4428
  is_closed: true,
4532
4429
  last_activity_at: new Date(event.created_at)
@@ -4534,9 +4431,12 @@ class StreamPoll {
4534
4431
  };
4535
4432
  this.handleVoteCasted = (event) => {
4536
4433
  if (event.poll?.id && event.poll.id !== this.id) return;
4537
- if (!isPollVoteCastedEvent(event)) return;
4538
4434
  const currentState = this.data;
4539
4435
  const isOwnVote = event.poll_vote.user_id === this.client.state.getLatestValue().connected_user?.id;
4436
+ if (isOwnVote) {
4437
+ const alreadyApplied = isVoteAnswer(event.poll_vote) ? currentState.own_answer?.id === event.poll_vote.id : !!event.poll_vote.option_id && currentState.own_votes_by_option_id[event.poll_vote.option_id]?.id === event.poll_vote.id;
4438
+ if (alreadyApplied) return;
4439
+ }
4540
4440
  let latestAnswers = [...currentState.latest_answers];
4541
4441
  let ownAnswer = currentState.own_answer;
4542
4442
  let ownVotesByOptionId = currentState.own_votes_by_option_id;
@@ -4552,7 +4452,10 @@ class StreamPoll {
4552
4452
  }
4553
4453
  }
4554
4454
  if (isVoteAnswer(event.poll_vote)) {
4555
- latestAnswers = [event.poll_vote, ...latestAnswers];
4455
+ latestAnswers = [
4456
+ event.poll_vote,
4457
+ ...latestAnswers.filter((a) => a.id !== event.poll_vote.id)
4458
+ ];
4556
4459
  } else {
4557
4460
  maxVotedOptionIds = getMaxVotedOptionIds(
4558
4461
  event.poll.vote_counts_by_option
@@ -4578,9 +4481,12 @@ class StreamPoll {
4578
4481
  };
4579
4482
  this.handleVoteChanged = (event) => {
4580
4483
  if (event.poll?.id && event.poll.id !== this.id) return;
4581
- if (!isPollVoteChangedEvent(event)) return;
4582
4484
  const currentState = this.data;
4583
4485
  const isOwnVote = event.poll_vote.user_id === this.client.state.getLatestValue().connected_user?.id;
4486
+ if (isOwnVote) {
4487
+ const alreadyApplied = isVoteAnswer(event.poll_vote) ? currentState.own_answer?.id === event.poll_vote.id : !!event.poll_vote.option_id && currentState.own_votes_by_option_id[event.poll_vote.option_id]?.id === event.poll_vote.id;
4488
+ if (alreadyApplied) return;
4489
+ }
4584
4490
  let latestAnswers = [...currentState.latest_answers];
4585
4491
  let ownAnswer = currentState.own_answer;
4586
4492
  let ownVotesByOptionId = currentState.own_votes_by_option_id;
@@ -4639,9 +4545,12 @@ class StreamPoll {
4639
4545
  };
4640
4546
  this.handleVoteRemoved = (event) => {
4641
4547
  if (event.poll?.id && event.poll.id !== this.id) return;
4642
- if (!isPollVoteRemovedEvent(event)) return;
4643
4548
  const currentState = this.data;
4644
4549
  const isOwnVote = event.poll_vote.user_id === this.client.state.getLatestValue().connected_user?.id;
4550
+ if (isOwnVote) {
4551
+ const alreadyApplied = isVoteAnswer(event.poll_vote) ? !currentState.own_answer : !!event.poll_vote.option_id && !(event.poll_vote.option_id in currentState.own_votes_by_option_id);
4552
+ if (alreadyApplied) return;
4553
+ }
4645
4554
  let latestAnswers = [...currentState.latest_answers];
4646
4555
  let ownAnswer = currentState.own_answer;
4647
4556
  const ownVotesByOptionId = { ...currentState.own_votes_by_option_id };
@@ -4785,6 +4694,13 @@ class FeedApi {
4785
4694
  ...request
4786
4695
  });
4787
4696
  }
4697
+ queryPinnedActivities(request) {
4698
+ return this.feedsApi.queryPinnedActivities({
4699
+ feed_id: this.id,
4700
+ feed_group_id: this.group,
4701
+ ...request
4702
+ });
4703
+ }
4788
4704
  stopWatching(request) {
4789
4705
  return this.feedsApi.stopWatchingFeed({
4790
4706
  feed_id: this.id,
@@ -4828,7 +4744,7 @@ const replaceUniqueArrayMerge = (existingArray, arrayToMerge, getKey) => {
4828
4744
  return result;
4829
4745
  };
4830
4746
  const Constants = {
4831
- DEFAULT_COMMENT_PAGINATION: "first"
4747
+ DEFAULT_COMMENT_PAGINATION: "last"
4832
4748
  };
4833
4749
  const isFollowResponse = (data) => {
4834
4750
  return "source_feed" in data && "target_feed" in data;
@@ -5119,8 +5035,21 @@ function handleCommentAdded(payload, fromWs) {
5119
5035
  return currentState;
5120
5036
  }
5121
5037
  const newComments = entityState?.comments ? [...entityState.comments] : [];
5122
- if (entityState.pagination?.sort === "last") {
5038
+ const sort = entityState.pagination?.sort;
5039
+ const hasMorePages = entityState.pagination?.next !== void 0;
5040
+ const isFromCurrentUser = eventTriggeredByConnectedUser.call(this, payload);
5041
+ if (sort === "last") {
5123
5042
  newComments.unshift(comment);
5043
+ } else if (sort === "first") {
5044
+ if (isFromCurrentUser) {
5045
+ newComments.push(comment);
5046
+ } else {
5047
+ if (!hasMorePages) {
5048
+ newComments.push(comment);
5049
+ } else {
5050
+ return currentState;
5051
+ }
5052
+ }
5124
5053
  } else {
5125
5054
  newComments.push(comment);
5126
5055
  }
@@ -6544,11 +6473,11 @@ const _Feed = class _Feed extends FeedApi {
6544
6473
  "app.updated": _Feed.noop,
6545
6474
  "user.banned": _Feed.noop,
6546
6475
  "user.deactivated": _Feed.noop,
6547
- "user.muted": _Feed.noop,
6548
6476
  "user.reactivated": _Feed.noop,
6549
6477
  "user.updated": _Feed.noop,
6550
6478
  "feeds.activity.feedback": handleActivityFeedback.bind(this),
6551
- "feeds.activity.restored": _Feed.noop
6479
+ "feeds.activity.restored": _Feed.noop,
6480
+ "user.unbanned": _Feed.noop
6552
6481
  };
6553
6482
  this.eventDispatcher = new EventDispatcher();
6554
6483
  this.on = this.eventDispatcher.on;
@@ -6598,7 +6527,9 @@ const _Feed = class _Feed extends FeedApi {
6598
6527
  const { last_get_or_create_request_config } = this.state.getLatestValue();
6599
6528
  if (last_get_or_create_request_config?.watch) {
6600
6529
  this.inProgressGetOrCreate = void 0;
6601
- await withRetry(() => this.getOrCreate(last_get_or_create_request_config));
6530
+ await withRetry(
6531
+ () => this.getOrCreate(last_get_or_create_request_config)
6532
+ );
6602
6533
  }
6603
6534
  }
6604
6535
  async getOrCreate(request) {
@@ -6740,6 +6671,16 @@ const _Feed = class _Feed extends FeedApi {
6740
6671
  ({ replies: _r, meta: _m, ...restOfTheCommentResponse }) => restOfTheCommentResponse
6741
6672
  );
6742
6673
  const existingComments = newCommentsByEntityId[entityId]?.comments;
6674
+ let comments = existingComments ? uniqueArrayMerge(
6675
+ existingComments,
6676
+ newComments,
6677
+ (comment) => comment.id
6678
+ ) : newComments;
6679
+ if (data.sort === "first" && existingComments && existingComments.length > 0) {
6680
+ comments = [...comments].sort(
6681
+ (a, b) => new Date(a.created_at).getTime() - new Date(b.created_at).getTime()
6682
+ );
6683
+ }
6743
6684
  newCommentsByEntityId[entityId] = {
6744
6685
  ...newCommentsByEntityId[entityId],
6745
6686
  entity_parent_id: item.entityParentId,
@@ -6748,11 +6689,7 @@ const _Feed = class _Feed extends FeedApi {
6748
6689
  next: item.next,
6749
6690
  sort: data.sort
6750
6691
  },
6751
- comments: existingComments ? uniqueArrayMerge(
6752
- existingComments,
6753
- newComments,
6754
- (comment) => comment.id
6755
- ) : newComments
6692
+ comments
6756
6693
  };
6757
6694
  }
6758
6695
  return {
@@ -7510,13 +7447,62 @@ class FeedsClient extends FeedsApi {
7510
7447
  this.devToken = (userId) => {
7511
7448
  return streamDevToken(userId);
7512
7449
  };
7450
+ this.updatePoll = async (request) => {
7451
+ const poll = this.pollFromState(request.id);
7452
+ const response = await super.updatePoll(request);
7453
+ if (response.poll && poll) {
7454
+ poll.handlePollUpdated({ poll: response.poll, created_at: /* @__PURE__ */ new Date() });
7455
+ }
7456
+ return response;
7457
+ };
7458
+ this.updatePollPartial = async (request) => {
7459
+ const poll = this.pollFromState(request.poll_id);
7460
+ const response = await super.updatePollPartial(request);
7461
+ if (response.poll && poll) {
7462
+ poll.handlePollUpdated({ poll: response.poll, created_at: /* @__PURE__ */ new Date() });
7463
+ }
7464
+ return response;
7465
+ };
7513
7466
  this.closePoll = async (request) => {
7514
- return await this.updatePollPartial({
7467
+ const poll = this.pollFromState(request.poll_id);
7468
+ const response = await super.updatePollPartial({
7515
7469
  poll_id: request.poll_id,
7516
7470
  set: {
7517
7471
  is_closed: true
7518
7472
  }
7519
7473
  });
7474
+ if (response.poll && poll) {
7475
+ poll.handlePollClosed({ poll: response.poll, created_at: /* @__PURE__ */ new Date() });
7476
+ }
7477
+ return response;
7478
+ };
7479
+ this.castPollVote = async (request) => {
7480
+ const poll = this.pollFromState(request.poll_id);
7481
+ const response = await super.castPollVote(request);
7482
+ if (response.poll && response.vote && poll) {
7483
+ const payload = {
7484
+ poll: response.poll,
7485
+ poll_vote: response.vote,
7486
+ created_at: /* @__PURE__ */ new Date()
7487
+ };
7488
+ if (poll.data.enforce_unique_vote && Object.keys(poll.data.own_votes_by_option_id).length > 0) {
7489
+ poll.handleVoteChanged(payload);
7490
+ } else {
7491
+ poll.handleVoteCasted(payload);
7492
+ }
7493
+ }
7494
+ return response;
7495
+ };
7496
+ this.deletePollVote = async (request) => {
7497
+ const response = await super.deletePollVote(request);
7498
+ if (response.poll && response.vote) {
7499
+ this.pollFromState(request.poll_id)?.handleVoteRemoved({
7500
+ poll: response.poll,
7501
+ poll_vote: response.vote,
7502
+ created_at: /* @__PURE__ */ new Date()
7503
+ });
7504
+ }
7505
+ return response;
7520
7506
  };
7521
7507
  this.uploadFile = (request) => {
7522
7508
  return super.uploadFile({
@@ -8097,4 +8083,4 @@ export {
8097
8083
  shouldUpdateState as s,
8098
8084
  uniqueArrayMerge as u
8099
8085
  };
8100
- //# sourceMappingURL=feeds-client-ykIZW9Hi.mjs.map
8086
+ //# sourceMappingURL=feeds-client-B9b7zUcW.mjs.map