@amityco/ts-sdk-react-native 7.2.0 → 7.3.1-1cd86e2.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 (80) hide show
  1. package/.env +26 -26
  2. package/dist/@types/core/events.d.ts +4 -0
  3. package/dist/@types/core/events.d.ts.map +1 -1
  4. package/dist/@types/core/model.d.ts +4 -0
  5. package/dist/@types/core/model.d.ts.map +1 -1
  6. package/dist/@types/core/payload.d.ts +24 -0
  7. package/dist/@types/core/payload.d.ts.map +1 -1
  8. package/dist/@types/domains/ad.d.ts +1 -1
  9. package/dist/@types/domains/ad.d.ts.map +1 -1
  10. package/dist/@types/domains/notification.d.ts +78 -0
  11. package/dist/@types/domains/notification.d.ts.map +1 -0
  12. package/dist/@types/index.d.ts +1 -0
  13. package/dist/@types/index.d.ts.map +1 -1
  14. package/dist/core/events.d.ts +3 -3
  15. package/dist/core/events.d.ts.map +1 -1
  16. package/dist/core/model/idResolvers.d.ts.map +1 -1
  17. package/dist/core/model/index.d.ts.map +1 -1
  18. package/dist/index.cjs.js +434 -47
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.esm.js +417 -31
  22. package/dist/index.umd.js +3 -3
  23. package/dist/notificationTray/api/index.d.ts +3 -0
  24. package/dist/notificationTray/api/index.d.ts.map +1 -0
  25. package/dist/notificationTray/api/markItemsSeen.d.ts +16 -0
  26. package/dist/notificationTray/api/markItemsSeen.d.ts.map +1 -0
  27. package/dist/notificationTray/api/markTraySeen.d.ts +19 -0
  28. package/dist/notificationTray/api/markTraySeen.d.ts.map +1 -0
  29. package/dist/notificationTray/events/index.d.ts +2 -0
  30. package/dist/notificationTray/events/index.d.ts.map +1 -0
  31. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts +17 -0
  32. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
  33. package/dist/notificationTray/index.d.ts +4 -0
  34. package/dist/notificationTray/index.d.ts.map +1 -0
  35. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts +30 -0
  36. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +1 -0
  37. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +13 -0
  38. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
  39. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +9 -0
  40. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
  41. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +9 -0
  42. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
  43. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts +12 -0
  44. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +1 -0
  45. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts +20 -0
  46. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +1 -0
  47. package/dist/notificationTray/observers/index.d.ts +3 -0
  48. package/dist/notificationTray/observers/index.d.ts.map +1 -0
  49. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts +2 -0
  50. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts.map +1 -0
  51. package/dist/utils/linkedObject/index.d.ts +1 -0
  52. package/dist/utils/linkedObject/index.d.ts.map +1 -1
  53. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts +2 -0
  54. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -0
  55. package/package.json +1 -1
  56. package/src/@types/core/events.ts +5 -0
  57. package/src/@types/core/model.ts +6 -0
  58. package/src/@types/core/payload.ts +29 -0
  59. package/src/@types/domains/ad.ts +1 -1
  60. package/src/@types/domains/notification.ts +94 -0
  61. package/src/@types/index.ts +1 -0
  62. package/src/core/model/idResolvers.ts +3 -0
  63. package/src/core/model/index.ts +2 -0
  64. package/src/index.ts +2 -0
  65. package/src/notificationTray/api/index.ts +2 -0
  66. package/src/notificationTray/api/markItemsSeen.ts +62 -0
  67. package/src/notificationTray/api/markTraySeen.ts +65 -0
  68. package/src/notificationTray/events/index.ts +1 -0
  69. package/src/notificationTray/events/onNotificationTraySeenUpdated.ts +36 -0
  70. package/src/notificationTray/index.ts +3 -0
  71. package/src/notificationTray/internalApi/getNotificationTraySeen.ts +80 -0
  72. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +96 -0
  73. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +31 -0
  74. package/src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +68 -0
  75. package/src/notificationTray/observers/getNotificationTrayItems.ts +44 -0
  76. package/src/notificationTray/observers/getNotificationTraySeen.ts +60 -0
  77. package/src/notificationTray/observers/index.ts +2 -0
  78. package/src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts +12 -0
  79. package/src/utils/linkedObject/index.ts +2 -0
  80. package/src/utils/linkedObject/notificationTrayLinkedObject.ts +19 -0
package/dist/index.d.ts CHANGED
@@ -25,4 +25,5 @@ export * as LiveStreamPlayer from './liveStreamPlayer';
25
25
  export * as StoryRepository from './storyRepository';
26
26
  export * as AdRepository from './adRepository';
27
27
  export * from './external/api';
28
+ export * as notificationTray from './notificationTray';
28
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,cAAc,UAAU,CAAC;AAEzB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAE5B,OAAO,KAAK,MAAM,MAAM,UAAU,CAAC;AACnC,OAA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,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,cAAc,YAAY,CAAC;AAG3B,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAE3D,cAAc,cAAc,CAAC;AAG7B,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,oBAAoB,MAAM,wBAAwB,CAAC;AAE/D,cAAc,iBAAiB,CAAC;AAGhC,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,kBAAkB,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AACnD,OAAO,KAAK,iBAAiB,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,cAAc,MAAM,kBAAkB,CAAC;AAEnD,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC;AAEvD,OAAO,KAAK,eAAe,MAAM,mBAAmB,CAAC;AAGrD,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAG/C,cAAc,gBAAgB,CAAC;AAE/B,OAAO,KAAK,gBAAgB,MAAM,oBAAoB,CAAC"}
package/dist/index.esm.js CHANGED
@@ -89,8 +89,8 @@ const PostContentType = Object.freeze({
89
89
 
90
90
  function getVersion() {
91
91
  try {
92
- // the string ''v7.2.0-esm'' should be replaced by actual value by @rollup/plugin-replace
93
- return 'v7.2.0-esm';
92
+ // the string ''v7.3.0-esm'' should be replaced by actual value by @rollup/plugin-replace
93
+ return 'v7.3.0-esm';
94
94
  }
95
95
  catch (error) {
96
96
  return '__dev__';
@@ -108,6 +108,7 @@ const SECOND$1 = 1000;
108
108
  const MINUTE = 60 * SECOND$1;
109
109
  const HOUR = 60 * MINUTE;
110
110
  const DAY = 24 * HOUR;
111
+ const WEEK = 7 * DAY;
111
112
  const YEAR = 365 * DAY;
112
113
  const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
113
114
 
@@ -530,6 +531,8 @@ const idResolvers = {
530
531
  advertiser: ({ advertiserId }) => advertiserId,
531
532
  pin: ({ placement, referenceId }) => `${placement}#${referenceId}`,
532
533
  pinTarget: ({ targetId }) => targetId,
534
+ notificationTrayItem: ({ _id }) => _id,
535
+ notificationTraySeen: ({ userId }) => userId,
533
536
  };
534
537
  /**
535
538
  * Retrieve the id resolver matching a domain name
@@ -581,6 +584,7 @@ const PAYLOAD2MODEL = {
581
584
  advertisers: 'advertiser',
582
585
  pinTargets: 'pinTarget',
583
586
  pins: 'pin',
587
+ notificationTrayItems: 'notificationTrayItem',
584
588
  };
585
589
  /** hidden */
586
590
  const isOutdated = (prevData, nextData) => {
@@ -22370,6 +22374,14 @@ const pinnedPostLinkedObject = (pinnedPost) => {
22370
22374
  } });
22371
22375
  };
22372
22376
 
22377
+ const notificationTrayLinkedObject = (noti) => {
22378
+ return Object.assign(Object.assign({}, noti), { isSeen: noti.lastSeenAt > noti.lastOccurredAt, isRecent: new Date(noti.lastOccurredAt).getTime() >= Date.now() - WEEK, users: noti.actors
22379
+ .map(({ publicId }) => pullFromCache(['user', 'get', publicId]))
22380
+ .filter(isNonNullable)
22381
+ .map(({ data }) => data)
22382
+ .map(user => userLinkedObject(user)) });
22383
+ };
22384
+
22373
22385
  const LinkedObject = {
22374
22386
  ad: adLinkedObject,
22375
22387
  comment: commentLinkedObject,
@@ -22383,6 +22395,7 @@ const LinkedObject = {
22383
22395
  reactor: reactorLinkedObject,
22384
22396
  channel: channelLinkedObject,
22385
22397
  pinnedPost: pinnedPostLinkedObject,
22398
+ notificationTray: notificationTrayLinkedObject,
22386
22399
  };
22387
22400
 
22388
22401
  const getChannelMessagePreviewWithUser = (channel) => {
@@ -26372,7 +26385,7 @@ const getUserUnread = (callback) => {
26372
26385
  };
26373
26386
  };
26374
26387
 
26375
- var index$l = /*#__PURE__*/Object.freeze({
26388
+ var index$m = /*#__PURE__*/Object.freeze({
26376
26389
  __proto__: null,
26377
26390
  getActiveClient: getActiveClient,
26378
26391
  getActiveUser: getActiveUser,
@@ -27582,7 +27595,7 @@ const getMyFollowInfo = (callback) => {
27582
27595
  };
27583
27596
  /* end_public_function */
27584
27597
 
27585
- var index$k = /*#__PURE__*/Object.freeze({
27598
+ var index$l = /*#__PURE__*/Object.freeze({
27586
27599
  __proto__: null,
27587
27600
  blockUser: blockUser,
27588
27601
  unBlockUser: unBlockUser,
@@ -28597,9 +28610,9 @@ var AmityUserSearchMatchType;
28597
28610
  AmityUserSearchMatchType["PARTIAL"] = "partial";
28598
28611
  })(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
28599
28612
 
28600
- var index$j = /*#__PURE__*/Object.freeze({
28613
+ var index$k = /*#__PURE__*/Object.freeze({
28601
28614
  __proto__: null,
28602
- Relationship: index$k,
28615
+ Relationship: index$l,
28603
28616
  getUserByIds: getUserByIds,
28604
28617
  updateUser: updateUser,
28605
28618
  flagUser: flagUser,
@@ -28863,7 +28876,7 @@ const uploadImage = async (formData, onProgress) => {
28863
28876
  };
28864
28877
  /* end_public_function */
28865
28878
 
28866
- var index$i = /*#__PURE__*/Object.freeze({
28879
+ var index$j = /*#__PURE__*/Object.freeze({
28867
28880
  __proto__: null,
28868
28881
  getFile: getFile,
28869
28882
  uploadFile: uploadFile,
@@ -30730,7 +30743,7 @@ const getReactions = (params, callback, config) => {
30730
30743
  };
30731
30744
  /* end_public_function */
30732
30745
 
30733
- var index$h = /*#__PURE__*/Object.freeze({
30746
+ var index$i = /*#__PURE__*/Object.freeze({
30734
30747
  __proto__: null,
30735
30748
  addReaction: addReaction,
30736
30749
  removeReaction: removeReaction,
@@ -32546,7 +32559,7 @@ const getMessages = (params, callback, config) => {
32546
32559
  };
32547
32560
  /* end_public_function */
32548
32561
 
32549
- var index$g = /*#__PURE__*/Object.freeze({
32562
+ var index$h = /*#__PURE__*/Object.freeze({
32550
32563
  __proto__: null,
32551
32564
  createMessage: createMessage,
32552
32565
  updateMessage: updateMessage,
@@ -33072,7 +33085,7 @@ const stopMessageReceiptSync = (subChannelId) => {
33072
33085
  };
33073
33086
  /* end_public_function */
33074
33087
 
33075
- var index$f = /*#__PURE__*/Object.freeze({
33088
+ var index$g = /*#__PURE__*/Object.freeze({
33076
33089
  __proto__: null,
33077
33090
  getSubChannelByIds: getSubChannels$1,
33078
33091
  createSubChannel: createSubChannel,
@@ -34386,7 +34399,7 @@ const searchMembers$1 = (params, callback, config) => {
34386
34399
  };
34387
34400
  /* end_public_function */
34388
34401
 
34389
- var index$e = /*#__PURE__*/Object.freeze({
34402
+ var index$f = /*#__PURE__*/Object.freeze({
34390
34403
  __proto__: null,
34391
34404
  addMembers: addMembers$1,
34392
34405
  removeMembers: removeMembers$1,
@@ -34589,7 +34602,7 @@ const unmuteMembers = async (channelId, userIds) => {
34589
34602
  };
34590
34603
  /* end_public_function */
34591
34604
 
34592
- var index$d = /*#__PURE__*/Object.freeze({
34605
+ var index$e = /*#__PURE__*/Object.freeze({
34593
34606
  __proto__: null,
34594
34607
  addRole: addRole,
34595
34608
  removeRole: removeRole,
@@ -34599,10 +34612,10 @@ var index$d = /*#__PURE__*/Object.freeze({
34599
34612
  unmuteMembers: unmuteMembers
34600
34613
  });
34601
34614
 
34602
- var index$c = /*#__PURE__*/Object.freeze({
34615
+ var index$d = /*#__PURE__*/Object.freeze({
34603
34616
  __proto__: null,
34604
- Membership: index$e,
34605
- Moderation: index$d,
34617
+ Membership: index$f,
34618
+ Moderation: index$e,
34606
34619
  getChannelByIds: getChannelByIds$1,
34607
34620
  createChannel: createChannel,
34608
34621
  updateChannel: updateChannel,
@@ -35982,7 +35995,7 @@ const searchMembers = (params, callback, config) => {
35982
35995
  };
35983
35996
  /* end_public_function */
35984
35997
 
35985
- var index$b = /*#__PURE__*/Object.freeze({
35998
+ var index$c = /*#__PURE__*/Object.freeze({
35986
35999
  __proto__: null,
35987
36000
  addMembers: addMembers,
35988
36001
  removeMembers: removeMembers,
@@ -37007,7 +37020,7 @@ const unbanMembers = async (communityId, userIds) => {
37007
37020
  };
37008
37021
  /* end_public_function */
37009
37022
 
37010
- var index$a = /*#__PURE__*/Object.freeze({
37023
+ var index$b = /*#__PURE__*/Object.freeze({
37011
37024
  __proto__: null,
37012
37025
  addRoles: addRoles,
37013
37026
  removeRoles: removeRoles,
@@ -37015,10 +37028,10 @@ var index$a = /*#__PURE__*/Object.freeze({
37015
37028
  unbanMembers: unbanMembers
37016
37029
  });
37017
37030
 
37018
- var index$9 = /*#__PURE__*/Object.freeze({
37031
+ var index$a = /*#__PURE__*/Object.freeze({
37019
37032
  __proto__: null,
37020
- Moderation: index$a,
37021
- Membership: index$b,
37033
+ Moderation: index$b,
37034
+ Membership: index$c,
37022
37035
  getCommunityByIds: getCommunities$1,
37023
37036
  createCommunity: createCommunity,
37024
37037
  updateCommunity: updateCommunity,
@@ -37251,7 +37264,7 @@ const getCategories = (params, callback, config) => {
37251
37264
  };
37252
37265
  /* end_public_function */
37253
37266
 
37254
- var index$8 = /*#__PURE__*/Object.freeze({
37267
+ var index$9 = /*#__PURE__*/Object.freeze({
37255
37268
  __proto__: null,
37256
37269
  getCategory: getCategory,
37257
37270
  getCategories: getCategories
@@ -37419,7 +37432,7 @@ getCustomRankingGlobalFeed.locally = (query) => {
37419
37432
  : undefined;
37420
37433
  };
37421
37434
 
37422
- var index$7 = /*#__PURE__*/Object.freeze({
37435
+ var index$8 = /*#__PURE__*/Object.freeze({
37423
37436
  __proto__: null,
37424
37437
  queryGlobalFeed: queryGlobalFeed,
37425
37438
  getCustomRankingGlobalFeed: getCustomRankingGlobalFeed
@@ -38734,7 +38747,7 @@ const getComments = (params, callback, config) => {
38734
38747
  };
38735
38748
  /* end_public_function */
38736
38749
 
38737
- var index$6 = /*#__PURE__*/Object.freeze({
38750
+ var index$7 = /*#__PURE__*/Object.freeze({
38738
38751
  __proto__: null,
38739
38752
  getCommentByIds: getCommentByIds,
38740
38753
  createComment: createComment,
@@ -39741,7 +39754,7 @@ const semanticSearchPosts = (params, callback, config) => {
39741
39754
  };
39742
39755
  };
39743
39756
 
39744
- var index$5 = /*#__PURE__*/Object.freeze({
39757
+ var index$6 = /*#__PURE__*/Object.freeze({
39745
39758
  __proto__: null,
39746
39759
  getPostByIds: getPostByIds,
39747
39760
  createPost: createPost,
@@ -40270,7 +40283,7 @@ const getStreams = (params, callback, config) => {
40270
40283
  };
40271
40284
  /* end_public_function */
40272
40285
 
40273
- var index$4 = /*#__PURE__*/Object.freeze({
40286
+ var index$5 = /*#__PURE__*/Object.freeze({
40274
40287
  __proto__: null,
40275
40288
  createStream: createStream,
40276
40289
  updateStream: updateStream,
@@ -40557,7 +40570,7 @@ const getPoll = (pollId, callback) => {
40557
40570
  };
40558
40571
  /* end_public_function */
40559
40572
 
40560
- var index$3 = /*#__PURE__*/Object.freeze({
40573
+ var index$4 = /*#__PURE__*/Object.freeze({
40561
40574
  __proto__: null,
40562
40575
  createPoll: createPoll,
40563
40576
  closePoll: closePoll,
@@ -40568,7 +40581,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
40568
40581
  getPoll: getPoll
40569
40582
  });
40570
40583
 
40571
- const privateKey = "-----BEGIN PRIVATE KEY-----\nMIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQDHo80SecH7FuF2\nhFYnb+l26/VN8UMLXAQFLnxciNTEwkGVFMpdezlH8rU2HtUJL4RETogbAOLVY0XM\njs6sPn8G1nALmh9qeDpUtVqFOVtBHxEZ910TLOtQiunjqJKO5nWdqZ71EC3OFluR\niGQkO84BiIFbv37ub7xl3S8XarbtKoLcyVpkDHi+1wx1pgCAn6gtBUgckPL5NR8j\nLseabl3HAXQfhTCKo4tmOFM2Dxwl1IUMmIJrJg/aIU/U0tj/1Eoo7mG0JcNWX19l\nW3EecCbi0ncCJOrkUdwlBrcjaMayaX/ubEwyUe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uGoMM2FeNaOrcB6yBXqTSP0R3OIyf8eaY6yjRvP30ZNXcll\n/gD3O1Mu6YmWQdt1W2WA6pKOsUuPXasf0pdOF7IiFZKlSabz5YHXFqwVuqm8loaj\nsXel3YWqPVdHiankE7tz+3ssnQKBgQDdqi4TNdD1MdEpihx19jr0QjUiXW3939FK\nqp30HESPEGDGQzXdmJgif9HhZb+cJSuWaHEbjgBrYahvgCF+y6LbEpOD+D/dmT+s\nDEAQaR84sah6dokwPjV8fjBSrcVFjCS+doxv0d3p/9OUEeyUhFrY03nxtIEYkLIE\n/Zvn37b4RwKBgQCLENVFe9XfsaVhQ5r9dV2iyTlmh7qgMZG5CbTFs12hQGhm8McO\n+Z7s41YSJCFr/yq1WwP4LJDtrBw99vyQr1zRsG35tNLp3gGRNzGQSQyC2uQFVHw2\np+7mNewsfhUK/gbrXNsyFnDz6635rPlhfbII3sWuP2wWXFqkxE9CbMwR7QKBgQC6\nawDMzxmo2/iYArrkyevSuEuPVxvFwpF1RgAI6C0QVCnPE38dmdN4UB7mfHekje4W\nVEercMURidPp0cxZolCYBQtilUjAyL0vqC3In1/Ogjq6oy3FEMxSop1pKxMY5j+Q\nnoqFD+6deLUrddeNH7J3X4LSr4dSbX4JjG+tlgt+yQKBgQCuwTL4hA6KqeInQ0Ta\n9VQX5Qr8hFlqJz1gpymi/k63tW/Ob8yedbg3WWNWyShwRMFYyY9S81ITFWM95uL6\nvF3x9rmRjwElJw9PMwVu6dmf/CO0Z1wzXSp2VVD12gbrUD/0/d7MUoJ9LgC8X8f/\nn0txLHYGHbx+nf95+JUg6lV3hg==\n-----END PRIVATE KEY-----";
40572
40585
  /*
40573
40586
  * The crypto algorithm used for importing key and signing string
40574
40587
  */
@@ -40928,7 +40941,7 @@ const getPlayer = async (parameters) => {
40928
40941
  return video;
40929
40942
  };
40930
40943
 
40931
- var index$2 = /*#__PURE__*/Object.freeze({
40944
+ var index$3 = /*#__PURE__*/Object.freeze({
40932
40945
  __proto__: null,
40933
40946
  getPlayer: getPlayer
40934
40947
  });
@@ -42100,7 +42113,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
42100
42113
  };
42101
42114
  };
42102
42115
 
42103
- var index$1 = /*#__PURE__*/Object.freeze({
42116
+ var index$2 = /*#__PURE__*/Object.freeze({
42104
42117
  __proto__: null,
42105
42118
  createImageStory: createImageStory,
42106
42119
  createVideoStory: createVideoStory,
@@ -42137,7 +42150,7 @@ const getNetworkAds = async () => {
42137
42150
  };
42138
42151
  };
42139
42152
 
42140
- var index = /*#__PURE__*/Object.freeze({
42153
+ var index$1 = /*#__PURE__*/Object.freeze({
42141
42154
  __proto__: null,
42142
42155
  getNetworkAds: getNetworkAds
42143
42156
  });
@@ -42164,4 +42177,377 @@ const createUserToken = async (apiKey, apiRegion, params) => {
42164
42177
  return { accessToken: data.accessToken };
42165
42178
  };
42166
42179
 
42167
- export { API_REGIONS, index as AdRepository, index$8 as CategoryRepository, index$c as ChannelRepository, index$l as Client, index$6 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$9 as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$7 as FeedRepository, FileAccessTypeEnum, index$i as FileRepository, FileType, index$2 as LiveStreamPlayer, MessageContentType, index$g as MessageRepository, index$3 as PollRepository, PostContentType, index$5 as PostRepository, index$h as ReactionRepository, index$1 as StoryRepository, index$4 as StreamRepository, index$f as SubChannelRepository, SubscriptionLevels, index$j as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };
42180
+ /* begin_public_function
42181
+ id: notificationTray.getNotificationTraySeen
42182
+ */
42183
+ /**
42184
+ * ```js
42185
+ * import { notificationTray } from '@amityco/ts-sdk'
42186
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
42187
+ * ```
42188
+ *
42189
+ *
42190
+ * @returns A page of {@link Amity.NotificationTraySeen} objects
42191
+ *
42192
+ * @category NotificationTray API
42193
+ * @async
42194
+ * */
42195
+ const getNotificationTraySeen$1 = async () => {
42196
+ const client = getActiveClient();
42197
+ client.log('notificationTray/getNotificationTraySeen', {});
42198
+ const { data: payload } = await client.http.get(`api/v1/notification-tray/tray/seen`);
42199
+ const cachedAt = client.cache && Date.now();
42200
+ if (client.cache) {
42201
+ const cacheKey = ['notificationTraySeen', 'get', client.userId];
42202
+ pushToCache(cacheKey, {
42203
+ userId: client.userId,
42204
+ lastTraySeenAt: payload.lastTraySeenAt,
42205
+ lastTrayOccuredAt: payload.lastTrayOccurredAt,
42206
+ });
42207
+ }
42208
+ return {
42209
+ data: {
42210
+ userId: client.userId,
42211
+ lastTraySeenAt: payload.lastTraySeenAt,
42212
+ lastTrayOccurredAt: payload.lastTrayOccurredAt,
42213
+ isSeen: payload.lastTraySeenAt > payload.lastTrayOccurredAt,
42214
+ },
42215
+ cachedAt,
42216
+ };
42217
+ };
42218
+ /* end_public_function */
42219
+ /**
42220
+ * ```js
42221
+ * import { notificationTray } from '@amityco/ts-sdk'
42222
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
42223
+ * ```
42224
+ *
42225
+ * Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
42226
+ *
42227
+ * @returns A page of {@link Amity.NotificationTraySeen} objects
42228
+ *
42229
+ * @category NotificationTray API
42230
+ * @async
42231
+ * */
42232
+ getNotificationTraySeen$1.locally = () => {
42233
+ var _a;
42234
+ const client = getActiveClient();
42235
+ client.log('notificationTray/getNotificationTraySeen.locally', {});
42236
+ if (!client.cache)
42237
+ return;
42238
+ const queryKey = ['notificationTraySeen', 'get'];
42239
+ const { data, cachedAt } = (_a = pullFromCache(queryKey)) !== null && _a !== void 0 ? _a : {};
42240
+ if (!data)
42241
+ return;
42242
+ return { data, cachedAt };
42243
+ };
42244
+
42245
+ /**
42246
+ * ```js
42247
+ * import { onNotificationTraySeenUpdated } from '@amityco/ts-sdk'
42248
+ * const dispose = onNotificationTraySeenUpdated(data => {
42249
+ * // ...
42250
+ * })
42251
+ * ```
42252
+ *
42253
+ * Fired when an {@link Amity.NotificationTraySeen} has been updated
42254
+ *
42255
+ * @param callback The function to call when the event was fired
42256
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
42257
+ *
42258
+ * @category NotificationTraySeen Events
42259
+ */
42260
+ const onNotificationTraySeenUpdated = (callback) => {
42261
+ const client = getActiveClient();
42262
+ const disposers = [
42263
+ createEventSubscriber(client, 'onNotificationTraySeenUpdated', 'local.notificationTraySeen.updated', payload => callback(payload)),
42264
+ ];
42265
+ return () => {
42266
+ disposers.forEach(fn => fn());
42267
+ };
42268
+ };
42269
+
42270
+ /* begin_public_function
42271
+ id: notificationTray.getNotificationTraySeen
42272
+ */
42273
+ /**
42274
+ * ```js
42275
+ * import { notificationTray } from '@amityco/ts-sdk';
42276
+ *
42277
+ * let notificationTraySeen;
42278
+ *
42279
+ * const unsubscribe = getNotificationTraySeen(response => {
42280
+ * notificationTraySeen = response.data;
42281
+ * });
42282
+ * ```
42283
+ *
42284
+ * Observe all mutation on a given {@link Amity.NotificationTraySeen}
42285
+ *
42286
+ * @param callback the function to call when new data are available
42287
+ * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the message
42288
+ *
42289
+ * @category NotificationTraySeen Live Object
42290
+ */
42291
+ const getNotificationTraySeen = (callback) => {
42292
+ const { userId } = getActiveUser();
42293
+ return liveObject(userId, callback, 'userId', getNotificationTraySeen$1, [onNotificationTraySeenUpdated], {
42294
+ callbackDataSelector: (data) => {
42295
+ let isSeen = true;
42296
+ if (data === null || data === void 0 ? void 0 : data.lastTrayOccurredAt) {
42297
+ if (!data.lastTraySeenAt) {
42298
+ isSeen = false;
42299
+ }
42300
+ else {
42301
+ isSeen =
42302
+ convertDateStringToTimestamp(data.lastTraySeenAt) >
42303
+ convertDateStringToTimestamp(data.lastTrayOccurredAt);
42304
+ }
42305
+ }
42306
+ return {
42307
+ lastTrayOccurredAt: data === null || data === void 0 ? void 0 : data.lastTrayOccurredAt,
42308
+ lastTraySeenAt: data === null || data === void 0 ? void 0 : data.lastTraySeenAt,
42309
+ isSeen,
42310
+ };
42311
+ },
42312
+ });
42313
+ };
42314
+ /* end_public_function */
42315
+
42316
+ /**
42317
+ * TODO: handle cache receive cache option, and cache policy
42318
+ * TODO: check if querybyIds is supported
42319
+ */
42320
+ class NotificationTrayItemsPaginationController extends PaginationController {
42321
+ async getRequest(queryParams, token) {
42322
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
42323
+ const options = token ? { token } : { limit };
42324
+ const { data: queryResponse } = await this.http.get(`/api/v1/notification-tray`, {
42325
+ params: Object.assign(Object.assign({}, params), { options }),
42326
+ });
42327
+ return queryResponse;
42328
+ }
42329
+ }
42330
+
42331
+ class NotificationTrayItemsQuerystreamController extends QueryStreamController {
42332
+ constructor(query, cacheKey, notifyChange, preparePayload) {
42333
+ super(query, cacheKey);
42334
+ this.notifyChange = notifyChange;
42335
+ this.preparePayload = preparePayload;
42336
+ }
42337
+ async saveToMainDB(response) {
42338
+ const processedPayload = await this.preparePayload(response);
42339
+ const client = getActiveClient();
42340
+ const cachedAt = client.cache && Date.now();
42341
+ if (client.cache) {
42342
+ ingestInCache(processedPayload, { cachedAt });
42343
+ }
42344
+ }
42345
+ appendToQueryStream(response, direction, refresh = false) {
42346
+ var _a, _b;
42347
+ if (refresh) {
42348
+ pushToCache(this.cacheKey, {
42349
+ data: response.notificationTrayItems.map(getResolver('notificationTrayItem')),
42350
+ });
42351
+ }
42352
+ else {
42353
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
42354
+ const notifications = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
42355
+ pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [
42356
+ ...new Set([
42357
+ ...notifications,
42358
+ ...response.notificationTrayItems.map(getResolver('notificationTrayItem')),
42359
+ ]),
42360
+ ] }));
42361
+ }
42362
+ }
42363
+ }
42364
+
42365
+ const prepareNotificationTrayItemsPayload = (rawPayload) => {
42366
+ const users = rawPayload.users.map(convertRawUserToInternalUser);
42367
+ return Object.assign(Object.assign({}, rawPayload), { users });
42368
+ };
42369
+
42370
+ class NotificationTrayItemsLiveCollectionController extends LiveCollectionController {
42371
+ constructor(query, callback) {
42372
+ const queryStreamId = hash(query);
42373
+ const cacheKey = ['notificationTrayItem', 'collection', queryStreamId];
42374
+ const paginationController = new NotificationTrayItemsPaginationController(query);
42375
+ super(paginationController, queryStreamId, cacheKey, callback);
42376
+ this.query = query;
42377
+ this.queryStreamController = new NotificationTrayItemsQuerystreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareNotificationTrayItemsPayload);
42378
+ this.callback = callback.bind(this);
42379
+ this.loadPage({ initial: true });
42380
+ }
42381
+ setup() {
42382
+ var _a;
42383
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
42384
+ if (!collection) {
42385
+ pushToCache(this.cacheKey, {
42386
+ data: [],
42387
+ params: {},
42388
+ });
42389
+ }
42390
+ }
42391
+ async persistModel(queryPayload) {
42392
+ await this.queryStreamController.saveToMainDB(queryPayload);
42393
+ }
42394
+ persistQueryStream({ response, direction, refresh, }) {
42395
+ this.queryStreamController.appendToQueryStream(response, direction, refresh);
42396
+ }
42397
+ // eslint-disable-next-line class-methods-use-this
42398
+ startSubscription() {
42399
+ return [];
42400
+ }
42401
+ notifyChange({ origin, loading, error }) {
42402
+ var _a, _b;
42403
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
42404
+ if (!collection)
42405
+ return;
42406
+ const data = ((_b = collection.data
42407
+ .map(id => pullFromCache(['notificationTrayItem', 'get', id]))
42408
+ .filter(isNonNullable)
42409
+ .map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.notificationTray);
42410
+ if (!this.shouldNotify(data) && origin === 'event')
42411
+ return;
42412
+ this.callback({
42413
+ onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
42414
+ data,
42415
+ hasNextPage: !!this.paginationController.getNextToken(),
42416
+ loading,
42417
+ error,
42418
+ });
42419
+ }
42420
+ }
42421
+
42422
+ /**
42423
+ * Get notification tray items for a notification tray page
42424
+ *
42425
+ * @param params the limit query parameters
42426
+ * @param callback the callback to be called when the notification tray items are updated
42427
+ * @returns items in the notification tray
42428
+ *
42429
+ * @category Notification tray items Live Collection
42430
+ *
42431
+ */
42432
+ const getNotificationTrayItems = (params, callback, config) => {
42433
+ const { log, cache } = getActiveClient();
42434
+ if (!cache) {
42435
+ console.log(ENABLE_CACHE_MESSAGE);
42436
+ }
42437
+ const timestamp = Date.now();
42438
+ log(`getNotificationTrayItems(tmpid: ${timestamp}) > listen`);
42439
+ const notiTrayItemsLiveCollection = new NotificationTrayItemsLiveCollectionController(params, callback);
42440
+ const disposers = notiTrayItemsLiveCollection.startSubscription();
42441
+ const cacheKey = notiTrayItemsLiveCollection.getCacheKey();
42442
+ disposers.push(() => dropFromCache(cacheKey));
42443
+ return () => {
42444
+ log(`getNotificationTrayItems(tmpid: ${timestamp}) > dispose`);
42445
+ disposers.forEach(fn => fn());
42446
+ };
42447
+ };
42448
+
42449
+ /* begin_public_function
42450
+ id: notificationTrayItem.markSeen
42451
+ */
42452
+ /**
42453
+ * ```js
42454
+ * import { notificationTray } from '@amityco/ts-sdk'
42455
+ * const updated = await notificationTray.markItemsSeen()
42456
+ * ```
42457
+ *
42458
+ * Updates an {@link Amity.NotificationItemSeen}
42459
+ *
42460
+ * @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
42461
+ * @returns the updated {@link Amity.NotificationItemSeen} object
42462
+ *
42463
+ * @category NotificationItemSeen API
42464
+ * @async
42465
+ */
42466
+ const markItemsSeen = async (trayItems) => {
42467
+ const client = getActiveClient();
42468
+ client.log('notificationTray/markItemsSeen', {});
42469
+ const { data: payload } = await client.http.post(`api/v1/notification-tray/items/seen`, {
42470
+ trayItems: trayItems.map(item => ({
42471
+ id: item.id,
42472
+ lastSeenAt: item.lastSeenAt,
42473
+ })),
42474
+ });
42475
+ const updatedData = payload.trayItems
42476
+ .map(patchItem => {
42477
+ var _a;
42478
+ const cacheData = (_a = pullFromCache([
42479
+ 'notificationTrayItem',
42480
+ 'get',
42481
+ patchItem.id,
42482
+ ])) === null || _a === void 0 ? void 0 : _a.data;
42483
+ if (!cacheData)
42484
+ return;
42485
+ const data = Object.assign(Object.assign({}, cacheData), { lastSeenAt: patchItem.lastSeenAt });
42486
+ if (client.cache) {
42487
+ const cachedAt = Date.now();
42488
+ pushToCache(['notificationTrayItem', 'get'], data, { cachedAt });
42489
+ }
42490
+ return data;
42491
+ })
42492
+ .filter(Boolean);
42493
+ fireEvent('local.notificationTrayItem.updated', { notificationTrayItems: updatedData });
42494
+ };
42495
+ /* end_public_function */
42496
+
42497
+ /* begin_public_function
42498
+ id: notificationTray.markSeen
42499
+ */
42500
+ /**
42501
+ * ```js
42502
+ * import { notificationTray } from '@amityco/ts-sdk'
42503
+ * const updated = await notificationTray.markTraySeen({
42504
+ * lastSeenAt: Amity.timestamp,
42505
+ * })
42506
+ * ```
42507
+ *
42508
+ * Updates an {@link Amity.NotificationTraySeen}
42509
+ *
42510
+ * @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
42511
+ * @param lastSeenAt The patch data to apply
42512
+ * @returns the updated {@link Amity.NotificationTraySeen} object
42513
+ *
42514
+ * @category Post API
42515
+ * @async
42516
+ */
42517
+ const markTraySeen = async (lastSeenAt) => {
42518
+ var _a;
42519
+ const client = getActiveClient();
42520
+ client.log('notificationTray/markTraySeen', {});
42521
+ const { data: payload } = await client.http.post(`api/v1/notification-tray/tray/seen`, {
42522
+ lastSeenAt,
42523
+ });
42524
+ const cacheData = (_a = pullFromCache([
42525
+ 'notificationTraySeen',
42526
+ 'get',
42527
+ ])) === null || _a === void 0 ? void 0 : _a.data;
42528
+ const data = {
42529
+ userId: client.userId,
42530
+ lastTraySeenAt: payload.lastSeenAt,
42531
+ };
42532
+ const updateCacheData = Object.assign(Object.assign({}, cacheData), data);
42533
+ const cachedAt = client.cache && Date.now();
42534
+ if (client.cache)
42535
+ pushToCache(['notificationTraySeen', 'get', client.userId], updateCacheData, { cachedAt });
42536
+ fireEvent('local.notificationTraySeen.updated', data);
42537
+ return {
42538
+ data: payload,
42539
+ cachedAt,
42540
+ };
42541
+ };
42542
+ /* end_public_function */
42543
+
42544
+ var index = /*#__PURE__*/Object.freeze({
42545
+ __proto__: null,
42546
+ getNotificationTraySeen: getNotificationTraySeen,
42547
+ getNotificationTrayItems: getNotificationTrayItems,
42548
+ markItemsSeen: markItemsSeen,
42549
+ markTraySeen: markTraySeen,
42550
+ onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
42551
+ });
42552
+
42553
+ export { API_REGIONS, index$1 as AdRepository, index$9 as CategoryRepository, index$d as ChannelRepository, index$m as Client, index$7 as CommentRepository, CommunityPostSettingMaps, CommunityPostSettings, index$a as CommunityRepository, ContentFeedType, DefaultCommunityPostSetting, index$8 as FeedRepository, FileAccessTypeEnum, index$j as FileRepository, FileType, index$3 as LiveStreamPlayer, MessageContentType, index$h as MessageRepository, index$4 as PollRepository, PostContentType, index$6 as PostRepository, index$i as ReactionRepository, index$2 as StoryRepository, index$5 as StreamRepository, index$g as SubChannelRepository, SubscriptionLevels, index$k as UserRepository, VERSION, VideoResolution, VideoSize, VideoTranscodingStatus, backupCache, createQuery, createReport, createUserToken, deleteReport, disableCache, dropFromCache, enableCache, filterByChannelMembership, filterByCommunityMembership, filterByFeedType, filterByPostDataTypes, filterByPropEquality, filterByPropInclusion, filterByPropIntersection, filterBySearchTerm, filterByStringComparePartially, getChannelTopic, getCommentTopic, getCommunityStoriesTopic, getCommunityTopic, getLiveStreamTopic, getMarkedMessageTopic, getMarkerUserFeedTopic, getMessageTopic, getMyFollowersTopic, getMyFollowingsTopic, getNetworkTopic, getPostTopic, getRole, getSmartFeedChannelTopic, getSmartFeedMessageTopic, getSmartFeedSubChannelTopic, getStoryTopic, getSubChannelTopic, getUserTopic, isAfterBefore, isAfterBeforeRaw, isCachable, isFetcher, isFresh, isLocal, isMutator, isOffline, isPaged, isReportedByMe, isSkip, mergeInCache, index as notificationTray, onChannelMarkerFetched, onFeedMarkerFetched, onFeedMarkerUpdated, onMessageMarked, onMessageMarkerFetched, onSubChannelMarkerFetched, onSubChannelMarkerUpdated, onUserMarkerFetched, onUserMarkerFetchedLegacy, pullFromCache, pushToCache, queryCache, queryOptions, queryRoles, restoreCache, runQuery, sortByChannelSegment, sortByDisplayName, sortByFirstCreated, sortByFirstUpdated, sortByLastActivity, sortByLastCreated, sortByLastUpdated, sortByLocalSortingDate, sortByName, sortBySegmentNumber, subscribeTopic, toPage, toPageRaw, toToken, upsertInCache, wipeCache };