@amityco/ts-sdk 7.2.0 → 7.2.1-50ce75a.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 +432 -45
  19. package/dist/index.d.ts +1 -0
  20. package/dist/index.d.ts.map +1 -1
  21. package/dist/index.esm.js +415 -29
  22. package/dist/index.umd.js +4 -4
  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,OAAO,EAA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,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
@@ -106,6 +106,7 @@ const SECOND$1 = 1000;
106
106
  const MINUTE = 60 * SECOND$1;
107
107
  const HOUR = 60 * MINUTE;
108
108
  const DAY = 24 * HOUR;
109
+ const WEEK = 7 * DAY;
109
110
  const YEAR = 365 * DAY;
110
111
  const ACCESS_TOKEN_WATCHER_INTERVAL = 10 * MINUTE;
111
112
 
@@ -528,6 +529,8 @@ const idResolvers = {
528
529
  advertiser: ({ advertiserId }) => advertiserId,
529
530
  pin: ({ placement, referenceId }) => `${placement}#${referenceId}`,
530
531
  pinTarget: ({ targetId }) => targetId,
532
+ notificationTrayItem: ({ _id }) => _id,
533
+ notificationTraySeen: ({ userId }) => userId,
531
534
  };
532
535
  /**
533
536
  * Retrieve the id resolver matching a domain name
@@ -579,6 +582,7 @@ const PAYLOAD2MODEL = {
579
582
  advertisers: 'advertiser',
580
583
  pinTargets: 'pinTarget',
581
584
  pins: 'pin',
585
+ notificationTrayItems: 'notificationTrayItem',
582
586
  };
583
587
  /** hidden */
584
588
  const isOutdated = (prevData, nextData) => {
@@ -22313,6 +22317,14 @@ const pinnedPostLinkedObject = (pinnedPost) => {
22313
22317
  } });
22314
22318
  };
22315
22319
 
22320
+ const notificationTrayLinkedObject = (noti) => {
22321
+ return Object.assign(Object.assign({}, noti), { isSeen: noti.lastSeenAt > noti.lastOccurredAt, isRecent: new Date(noti.lastOccurredAt).getTime() >= Date.now() - WEEK, users: noti.actors
22322
+ .map(({ _id }) => pullFromCache(['user', 'get', _id]))
22323
+ .filter(isNonNullable)
22324
+ .map(({ data }) => data)
22325
+ .map(user => userLinkedObject(user)) });
22326
+ };
22327
+
22316
22328
  const LinkedObject = {
22317
22329
  ad: adLinkedObject,
22318
22330
  comment: commentLinkedObject,
@@ -22326,6 +22338,7 @@ const LinkedObject = {
22326
22338
  reactor: reactorLinkedObject,
22327
22339
  channel: channelLinkedObject,
22328
22340
  pinnedPost: pinnedPostLinkedObject,
22341
+ notificationTray: notificationTrayLinkedObject,
22329
22342
  };
22330
22343
 
22331
22344
  const getChannelMessagePreviewWithUser = (channel) => {
@@ -26227,7 +26240,7 @@ const getUserUnread = (callback) => {
26227
26240
  };
26228
26241
  };
26229
26242
 
26230
- var index$l = /*#__PURE__*/Object.freeze({
26243
+ var index$m = /*#__PURE__*/Object.freeze({
26231
26244
  __proto__: null,
26232
26245
  getActiveClient: getActiveClient,
26233
26246
  getActiveUser: getActiveUser,
@@ -27434,7 +27447,7 @@ const getMyFollowInfo = (callback) => {
27434
27447
  };
27435
27448
  /* end_public_function */
27436
27449
 
27437
- var index$k = /*#__PURE__*/Object.freeze({
27450
+ var index$l = /*#__PURE__*/Object.freeze({
27438
27451
  __proto__: null,
27439
27452
  blockUser: blockUser,
27440
27453
  unBlockUser: unBlockUser,
@@ -28449,9 +28462,9 @@ var AmityUserSearchMatchType;
28449
28462
  AmityUserSearchMatchType["PARTIAL"] = "partial";
28450
28463
  })(AmityUserSearchMatchType || (AmityUserSearchMatchType = {}));
28451
28464
 
28452
- var index$j = /*#__PURE__*/Object.freeze({
28465
+ var index$k = /*#__PURE__*/Object.freeze({
28453
28466
  __proto__: null,
28454
- Relationship: index$k,
28467
+ Relationship: index$l,
28455
28468
  getUserByIds: getUserByIds,
28456
28469
  updateUser: updateUser,
28457
28470
  flagUser: flagUser,
@@ -28715,7 +28728,7 @@ const uploadImage = async (formData, onProgress) => {
28715
28728
  };
28716
28729
  /* end_public_function */
28717
28730
 
28718
- var index$i = /*#__PURE__*/Object.freeze({
28731
+ var index$j = /*#__PURE__*/Object.freeze({
28719
28732
  __proto__: null,
28720
28733
  getFile: getFile,
28721
28734
  uploadFile: uploadFile,
@@ -30582,7 +30595,7 @@ const getReactions = (params, callback, config) => {
30582
30595
  };
30583
30596
  /* end_public_function */
30584
30597
 
30585
- var index$h = /*#__PURE__*/Object.freeze({
30598
+ var index$i = /*#__PURE__*/Object.freeze({
30586
30599
  __proto__: null,
30587
30600
  addReaction: addReaction,
30588
30601
  removeReaction: removeReaction,
@@ -32398,7 +32411,7 @@ const getMessages = (params, callback, config) => {
32398
32411
  };
32399
32412
  /* end_public_function */
32400
32413
 
32401
- var index$g = /*#__PURE__*/Object.freeze({
32414
+ var index$h = /*#__PURE__*/Object.freeze({
32402
32415
  __proto__: null,
32403
32416
  createMessage: createMessage,
32404
32417
  updateMessage: updateMessage,
@@ -32924,7 +32937,7 @@ const stopMessageReceiptSync = (subChannelId) => {
32924
32937
  };
32925
32938
  /* end_public_function */
32926
32939
 
32927
- var index$f = /*#__PURE__*/Object.freeze({
32940
+ var index$g = /*#__PURE__*/Object.freeze({
32928
32941
  __proto__: null,
32929
32942
  getSubChannelByIds: getSubChannels$1,
32930
32943
  createSubChannel: createSubChannel,
@@ -34238,7 +34251,7 @@ const searchMembers$1 = (params, callback, config) => {
34238
34251
  };
34239
34252
  /* end_public_function */
34240
34253
 
34241
- var index$e = /*#__PURE__*/Object.freeze({
34254
+ var index$f = /*#__PURE__*/Object.freeze({
34242
34255
  __proto__: null,
34243
34256
  addMembers: addMembers$1,
34244
34257
  removeMembers: removeMembers$1,
@@ -34441,7 +34454,7 @@ const unmuteMembers = async (channelId, userIds) => {
34441
34454
  };
34442
34455
  /* end_public_function */
34443
34456
 
34444
- var index$d = /*#__PURE__*/Object.freeze({
34457
+ var index$e = /*#__PURE__*/Object.freeze({
34445
34458
  __proto__: null,
34446
34459
  addRole: addRole,
34447
34460
  removeRole: removeRole,
@@ -34451,10 +34464,10 @@ var index$d = /*#__PURE__*/Object.freeze({
34451
34464
  unmuteMembers: unmuteMembers
34452
34465
  });
34453
34466
 
34454
- var index$c = /*#__PURE__*/Object.freeze({
34467
+ var index$d = /*#__PURE__*/Object.freeze({
34455
34468
  __proto__: null,
34456
- Membership: index$e,
34457
- Moderation: index$d,
34469
+ Membership: index$f,
34470
+ Moderation: index$e,
34458
34471
  getChannelByIds: getChannelByIds$1,
34459
34472
  createChannel: createChannel,
34460
34473
  updateChannel: updateChannel,
@@ -35834,7 +35847,7 @@ const searchMembers = (params, callback, config) => {
35834
35847
  };
35835
35848
  /* end_public_function */
35836
35849
 
35837
- var index$b = /*#__PURE__*/Object.freeze({
35850
+ var index$c = /*#__PURE__*/Object.freeze({
35838
35851
  __proto__: null,
35839
35852
  addMembers: addMembers,
35840
35853
  removeMembers: removeMembers,
@@ -36859,7 +36872,7 @@ const unbanMembers = async (communityId, userIds) => {
36859
36872
  };
36860
36873
  /* end_public_function */
36861
36874
 
36862
- var index$a = /*#__PURE__*/Object.freeze({
36875
+ var index$b = /*#__PURE__*/Object.freeze({
36863
36876
  __proto__: null,
36864
36877
  addRoles: addRoles,
36865
36878
  removeRoles: removeRoles,
@@ -36867,10 +36880,10 @@ var index$a = /*#__PURE__*/Object.freeze({
36867
36880
  unbanMembers: unbanMembers
36868
36881
  });
36869
36882
 
36870
- var index$9 = /*#__PURE__*/Object.freeze({
36883
+ var index$a = /*#__PURE__*/Object.freeze({
36871
36884
  __proto__: null,
36872
- Moderation: index$a,
36873
- Membership: index$b,
36885
+ Moderation: index$b,
36886
+ Membership: index$c,
36874
36887
  getCommunityByIds: getCommunities$1,
36875
36888
  createCommunity: createCommunity,
36876
36889
  updateCommunity: updateCommunity,
@@ -37103,7 +37116,7 @@ const getCategories = (params, callback, config) => {
37103
37116
  };
37104
37117
  /* end_public_function */
37105
37118
 
37106
- var index$8 = /*#__PURE__*/Object.freeze({
37119
+ var index$9 = /*#__PURE__*/Object.freeze({
37107
37120
  __proto__: null,
37108
37121
  getCategory: getCategory,
37109
37122
  getCategories: getCategories
@@ -37271,7 +37284,7 @@ getCustomRankingGlobalFeed.locally = (query) => {
37271
37284
  : undefined;
37272
37285
  };
37273
37286
 
37274
- var index$7 = /*#__PURE__*/Object.freeze({
37287
+ var index$8 = /*#__PURE__*/Object.freeze({
37275
37288
  __proto__: null,
37276
37289
  queryGlobalFeed: queryGlobalFeed,
37277
37290
  getCustomRankingGlobalFeed: getCustomRankingGlobalFeed
@@ -38586,7 +38599,7 @@ const getComments = (params, callback, config) => {
38586
38599
  };
38587
38600
  /* end_public_function */
38588
38601
 
38589
- var index$6 = /*#__PURE__*/Object.freeze({
38602
+ var index$7 = /*#__PURE__*/Object.freeze({
38590
38603
  __proto__: null,
38591
38604
  getCommentByIds: getCommentByIds,
38592
38605
  createComment: createComment,
@@ -39593,7 +39606,7 @@ const semanticSearchPosts = (params, callback, config) => {
39593
39606
  };
39594
39607
  };
39595
39608
 
39596
- var index$5 = /*#__PURE__*/Object.freeze({
39609
+ var index$6 = /*#__PURE__*/Object.freeze({
39597
39610
  __proto__: null,
39598
39611
  getPostByIds: getPostByIds,
39599
39612
  createPost: createPost,
@@ -40127,7 +40140,7 @@ const getStreams = (params, callback, config) => {
40127
40140
  };
40128
40141
  };
40129
40142
 
40130
- var index$4 = /*#__PURE__*/Object.freeze({
40143
+ var index$5 = /*#__PURE__*/Object.freeze({
40131
40144
  __proto__: null,
40132
40145
  createStream: createStream,
40133
40146
  updateStream: updateStream,
@@ -40414,7 +40427,7 @@ const getPoll = (pollId, callback) => {
40414
40427
  };
40415
40428
  /* end_public_function */
40416
40429
 
40417
- var index$3 = /*#__PURE__*/Object.freeze({
40430
+ var index$4 = /*#__PURE__*/Object.freeze({
40418
40431
  __proto__: null,
40419
40432
  createPoll: createPoll,
40420
40433
  closePoll: closePoll,
@@ -40425,7 +40438,7 @@ var index$3 = /*#__PURE__*/Object.freeze({
40425
40438
  getPoll: getPoll
40426
40439
  });
40427
40440
 
40428
- 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\nAMSJm9OZph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D+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-----";
40429
40442
  /*
40430
40443
  * The crypto algorithm used for importing key and signing string
40431
40444
  */
@@ -40785,7 +40798,7 @@ const getPlayer = async (parameters) => {
40785
40798
  return video;
40786
40799
  };
40787
40800
 
40788
- var index$2 = /*#__PURE__*/Object.freeze({
40801
+ var index$3 = /*#__PURE__*/Object.freeze({
40789
40802
  __proto__: null,
40790
40803
  getPlayer: getPlayer
40791
40804
  });
@@ -41958,7 +41971,7 @@ const getGlobalStoryTargets = (params, callback, config) => {
41958
41971
  };
41959
41972
  };
41960
41973
 
41961
- var index$1 = /*#__PURE__*/Object.freeze({
41974
+ var index$2 = /*#__PURE__*/Object.freeze({
41962
41975
  __proto__: null,
41963
41976
  createImageStory: createImageStory,
41964
41977
  createVideoStory: createVideoStory,
@@ -41995,7 +42008,7 @@ const getNetworkAds = async () => {
41995
42008
  };
41996
42009
  };
41997
42010
 
41998
- var index = /*#__PURE__*/Object.freeze({
42011
+ var index$1 = /*#__PURE__*/Object.freeze({
41999
42012
  __proto__: null,
42000
42013
  getNetworkAds: getNetworkAds
42001
42014
  });
@@ -42022,4 +42035,377 @@ const createUserToken = async (apiKey, apiRegion, params) => {
42022
42035
  return { accessToken: data.accessToken };
42023
42036
  };
42024
42037
 
42025
- 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 };
42038
+ /* begin_public_function
42039
+ id: notificationTray.getNotificationTraySeen
42040
+ */
42041
+ /**
42042
+ * ```js
42043
+ * import { notificationTray } from '@amityco/ts-sdk'
42044
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
42045
+ * ```
42046
+ *
42047
+ *
42048
+ * @returns A page of {@link Amity.NotificationTraySeen} objects
42049
+ *
42050
+ * @category NotificationTray API
42051
+ * @async
42052
+ * */
42053
+ const getNotificationTraySeen$1 = async () => {
42054
+ const client = getActiveClient();
42055
+ client.log('notificationTray/getNotificationTraySeen', {});
42056
+ const { data: payload } = await client.http.get(`api/v1/notification-tray/tray/seen`);
42057
+ const cachedAt = client.cache && Date.now();
42058
+ if (client.cache) {
42059
+ const cacheKey = ['notificationTraySeen', 'get', client.userId];
42060
+ pushToCache(cacheKey, {
42061
+ userId: client.userId,
42062
+ lastTraySeenAt: payload.lastTraySeenAt,
42063
+ lastTrayOccuredAt: payload.lastTrayOccurredAt,
42064
+ });
42065
+ }
42066
+ return {
42067
+ data: {
42068
+ userId: client.userId,
42069
+ lastTraySeenAt: payload.lastTraySeenAt,
42070
+ lastTrayOccurredAt: payload.lastTrayOccurredAt,
42071
+ isSeen: payload.lastTraySeenAt > payload.lastTrayOccurredAt,
42072
+ },
42073
+ cachedAt,
42074
+ };
42075
+ };
42076
+ /* end_public_function */
42077
+ /**
42078
+ * ```js
42079
+ * import { notificationTray } from '@amityco/ts-sdk'
42080
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
42081
+ * ```
42082
+ *
42083
+ * Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
42084
+ *
42085
+ * @returns A page of {@link Amity.NotificationTraySeen} objects
42086
+ *
42087
+ * @category NotificationTray API
42088
+ * @async
42089
+ * */
42090
+ getNotificationTraySeen$1.locally = () => {
42091
+ var _a;
42092
+ const client = getActiveClient();
42093
+ client.log('notificationTray/getNotificationTraySeen.locally', {});
42094
+ if (!client.cache)
42095
+ return;
42096
+ const queryKey = ['notificationTraySeen', 'get'];
42097
+ const { data, cachedAt } = (_a = pullFromCache(queryKey)) !== null && _a !== void 0 ? _a : {};
42098
+ if (!data)
42099
+ return;
42100
+ return { data, cachedAt };
42101
+ };
42102
+
42103
+ /**
42104
+ * ```js
42105
+ * import { onNotificationTraySeenUpdated } from '@amityco/ts-sdk'
42106
+ * const dispose = onNotificationTraySeenUpdated(data => {
42107
+ * // ...
42108
+ * })
42109
+ * ```
42110
+ *
42111
+ * Fired when an {@link Amity.NotificationTraySeen} has been updated
42112
+ *
42113
+ * @param callback The function to call when the event was fired
42114
+ * @returns an {@link Amity.Unsubscriber} function to stop listening
42115
+ *
42116
+ * @category NotificationTraySeen Events
42117
+ */
42118
+ const onNotificationTraySeenUpdated = (callback) => {
42119
+ const client = getActiveClient();
42120
+ const disposers = [
42121
+ createEventSubscriber(client, 'onNotificationTraySeenUpdated', 'local.notificationTraySeen.updated', payload => callback(payload)),
42122
+ ];
42123
+ return () => {
42124
+ disposers.forEach(fn => fn());
42125
+ };
42126
+ };
42127
+
42128
+ /* begin_public_function
42129
+ id: notificationTray.getNotificationTraySeen
42130
+ */
42131
+ /**
42132
+ * ```js
42133
+ * import { notificationTray } from '@amityco/ts-sdk';
42134
+ *
42135
+ * let notificationTraySeen;
42136
+ *
42137
+ * const unsubscribe = getNotificationTraySeen(response => {
42138
+ * notificationTraySeen = response.data;
42139
+ * });
42140
+ * ```
42141
+ *
42142
+ * Observe all mutation on a given {@link Amity.NotificationTraySeen}
42143
+ *
42144
+ * @param callback the function to call when new data are available
42145
+ * @returns An {@link Amity.Unsubscriber} function to run when willing to stop observing the message
42146
+ *
42147
+ * @category NotificationTraySeen Live Object
42148
+ */
42149
+ const getNotificationTraySeen = (callback) => {
42150
+ const { userId } = getActiveUser();
42151
+ return liveObject(userId, callback, 'userId', getNotificationTraySeen$1, [onNotificationTraySeenUpdated], {
42152
+ callbackDataSelector: (data) => {
42153
+ let isSeen = true;
42154
+ if (data === null || data === void 0 ? void 0 : data.lastTrayOccurredAt) {
42155
+ if (!data.lastTraySeenAt) {
42156
+ isSeen = false;
42157
+ }
42158
+ else {
42159
+ isSeen =
42160
+ convertDateStringToTimestamp(data.lastTraySeenAt) >
42161
+ convertDateStringToTimestamp(data.lastTrayOccurredAt);
42162
+ }
42163
+ }
42164
+ return {
42165
+ lastTrayOccurredAt: data === null || data === void 0 ? void 0 : data.lastTrayOccurredAt,
42166
+ lastTraySeenAt: data === null || data === void 0 ? void 0 : data.lastTraySeenAt,
42167
+ isSeen,
42168
+ };
42169
+ },
42170
+ });
42171
+ };
42172
+ /* end_public_function */
42173
+
42174
+ /**
42175
+ * TODO: handle cache receive cache option, and cache policy
42176
+ * TODO: check if querybyIds is supported
42177
+ */
42178
+ class NotificationTrayItemsPaginationController extends PaginationController {
42179
+ async getRequest(queryParams, token) {
42180
+ const { limit = COLLECTION_DEFAULT_PAGINATION_LIMIT } = queryParams, params = __rest(queryParams, ["limit"]);
42181
+ const options = token ? { token } : { limit };
42182
+ const { data: queryResponse } = await this.http.get(`/api/v1/notification-tray`, {
42183
+ params: Object.assign(Object.assign({}, params), { options }),
42184
+ });
42185
+ return queryResponse;
42186
+ }
42187
+ }
42188
+
42189
+ class NotificationTrayItemsQuerystreamController extends QueryStreamController {
42190
+ constructor(query, cacheKey, notifyChange, preparePayload) {
42191
+ super(query, cacheKey);
42192
+ this.notifyChange = notifyChange;
42193
+ this.preparePayload = preparePayload;
42194
+ }
42195
+ async saveToMainDB(response) {
42196
+ const processedPayload = await this.preparePayload(response);
42197
+ const client = getActiveClient();
42198
+ const cachedAt = client.cache && Date.now();
42199
+ if (client.cache) {
42200
+ ingestInCache(processedPayload, { cachedAt });
42201
+ }
42202
+ }
42203
+ appendToQueryStream(response, direction, refresh = false) {
42204
+ var _a, _b;
42205
+ if (refresh) {
42206
+ pushToCache(this.cacheKey, {
42207
+ data: response.notificationTrayItems.map(getResolver('notificationTrayItem')),
42208
+ });
42209
+ }
42210
+ else {
42211
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
42212
+ const notifications = (_b = collection === null || collection === void 0 ? void 0 : collection.data) !== null && _b !== void 0 ? _b : [];
42213
+ pushToCache(this.cacheKey, Object.assign(Object.assign({}, collection), { data: [
42214
+ ...new Set([
42215
+ ...notifications,
42216
+ ...response.notificationTrayItems.map(getResolver('notificationTrayItem')),
42217
+ ]),
42218
+ ] }));
42219
+ }
42220
+ }
42221
+ }
42222
+
42223
+ const prepareNotificationTrayItemsPayload = (rawPayload) => {
42224
+ const users = rawPayload.users.map(convertRawUserToInternalUser);
42225
+ return Object.assign(Object.assign({}, rawPayload), { users });
42226
+ };
42227
+
42228
+ class NotificationTrayItemsLiveCollectionController extends LiveCollectionController {
42229
+ constructor(query, callback) {
42230
+ const queryStreamId = hash(query);
42231
+ const cacheKey = ['notificationTrayItem', 'collection', queryStreamId];
42232
+ const paginationController = new NotificationTrayItemsPaginationController(query);
42233
+ super(paginationController, queryStreamId, cacheKey, callback);
42234
+ this.query = query;
42235
+ this.queryStreamController = new NotificationTrayItemsQuerystreamController(this.query, this.cacheKey, this.notifyChange.bind(this), prepareNotificationTrayItemsPayload);
42236
+ this.callback = callback.bind(this);
42237
+ this.loadPage({ initial: true });
42238
+ }
42239
+ setup() {
42240
+ var _a;
42241
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
42242
+ if (!collection) {
42243
+ pushToCache(this.cacheKey, {
42244
+ data: [],
42245
+ params: {},
42246
+ });
42247
+ }
42248
+ }
42249
+ async persistModel(queryPayload) {
42250
+ await this.queryStreamController.saveToMainDB(queryPayload);
42251
+ }
42252
+ persistQueryStream({ response, direction, refresh, }) {
42253
+ this.queryStreamController.appendToQueryStream(response, direction, refresh);
42254
+ }
42255
+ // eslint-disable-next-line class-methods-use-this
42256
+ startSubscription() {
42257
+ return [];
42258
+ }
42259
+ notifyChange({ origin, loading, error }) {
42260
+ var _a, _b;
42261
+ const collection = (_a = pullFromCache(this.cacheKey)) === null || _a === void 0 ? void 0 : _a.data;
42262
+ if (!collection)
42263
+ return;
42264
+ const data = ((_b = collection.data
42265
+ .map(id => pullFromCache(['notificationTrayItem', 'get', id]))
42266
+ .filter(isNonNullable)
42267
+ .map(({ data }) => data)) !== null && _b !== void 0 ? _b : []).map(LinkedObject.notificationTray);
42268
+ if (!this.shouldNotify(data) && origin === 'event')
42269
+ return;
42270
+ this.callback({
42271
+ onNextPage: () => this.loadPage({ direction: "next" /* Amity.LiveCollectionPageDirection.NEXT */ }),
42272
+ data,
42273
+ hasNextPage: !!this.paginationController.getNextToken(),
42274
+ loading,
42275
+ error,
42276
+ });
42277
+ }
42278
+ }
42279
+
42280
+ /**
42281
+ * Get notification tray items for a notification tray page
42282
+ *
42283
+ * @param params the limit query parameters
42284
+ * @param callback the callback to be called when the notification tray items are updated
42285
+ * @returns items in the notification tray
42286
+ *
42287
+ * @category Notification tray items Live Collection
42288
+ *
42289
+ */
42290
+ const getNotificationTrayItems = (params, callback, config) => {
42291
+ const { log, cache } = getActiveClient();
42292
+ if (!cache) {
42293
+ console.log(ENABLE_CACHE_MESSAGE);
42294
+ }
42295
+ const timestamp = Date.now();
42296
+ log(`getNotificationTrayItems(tmpid: ${timestamp}) > listen`);
42297
+ const notiTrayItemsLiveCollection = new NotificationTrayItemsLiveCollectionController(params, callback);
42298
+ const disposers = notiTrayItemsLiveCollection.startSubscription();
42299
+ const cacheKey = notiTrayItemsLiveCollection.getCacheKey();
42300
+ disposers.push(() => dropFromCache(cacheKey));
42301
+ return () => {
42302
+ log(`getNotificationTrayItems(tmpid: ${timestamp}) > dispose`);
42303
+ disposers.forEach(fn => fn());
42304
+ };
42305
+ };
42306
+
42307
+ /* begin_public_function
42308
+ id: notificationTrayItem.markSeen
42309
+ */
42310
+ /**
42311
+ * ```js
42312
+ * import { notificationTray } from '@amityco/ts-sdk'
42313
+ * const updated = await notificationTray.markItemsSeen()
42314
+ * ```
42315
+ *
42316
+ * Updates an {@link Amity.NotificationItemSeen}
42317
+ *
42318
+ * @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
42319
+ * @returns the updated {@link Amity.NotificationItemSeen} object
42320
+ *
42321
+ * @category NotificationItemSeen API
42322
+ * @async
42323
+ */
42324
+ const markItemsSeen = async (trayItems) => {
42325
+ const client = getActiveClient();
42326
+ client.log('notificationTray/markItemsSeen', {});
42327
+ const { data: payload } = await client.http.post(`api/v1/notification-tray/items/seen`, {
42328
+ trayItems: trayItems.map(item => ({
42329
+ id: item.id,
42330
+ lastSeenAt: item.lastSeenAt,
42331
+ })),
42332
+ });
42333
+ const updatedData = trayItems
42334
+ .map(patchItem => {
42335
+ var _a;
42336
+ const cacheData = (_a = pullFromCache([
42337
+ 'notificationTrayItem',
42338
+ 'get',
42339
+ patchItem.id,
42340
+ ])) === null || _a === void 0 ? void 0 : _a.data;
42341
+ if (!cacheData)
42342
+ return;
42343
+ const data = Object.assign(Object.assign({}, cacheData), payload);
42344
+ if (client.cache) {
42345
+ const cachedAt = Date.now();
42346
+ pushToCache(['notificationTrayItem', 'get'], data, { cachedAt });
42347
+ }
42348
+ return data;
42349
+ })
42350
+ .filter(Boolean);
42351
+ fireEvent('local.notificationTrayItem.updated', { notificationTrayItems: updatedData });
42352
+ };
42353
+ /* end_public_function */
42354
+
42355
+ /* begin_public_function
42356
+ id: notificationTray.markSeen
42357
+ */
42358
+ /**
42359
+ * ```js
42360
+ * import { notificationTray } from '@amityco/ts-sdk'
42361
+ * const updated = await notificationTray.markTraySeen({
42362
+ * lastSeenAt: Amity.timestamp,
42363
+ * })
42364
+ * ```
42365
+ *
42366
+ * Updates an {@link Amity.NotificationTraySeen}
42367
+ *
42368
+ * @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
42369
+ * @param lastSeenAt The patch data to apply
42370
+ * @returns the updated {@link Amity.NotificationTraySeen} object
42371
+ *
42372
+ * @category Post API
42373
+ * @async
42374
+ */
42375
+ const markTraySeen = async (lastSeenAt) => {
42376
+ var _a;
42377
+ const client = getActiveClient();
42378
+ client.log('notificationTray/markTraySeen', {});
42379
+ const { data: payload } = await client.http.post(`api/v1/notification-tray/tray/seen`, {
42380
+ lastSeenAt,
42381
+ });
42382
+ const cacheData = (_a = pullFromCache([
42383
+ 'notificationTraySeen',
42384
+ 'get',
42385
+ ])) === null || _a === void 0 ? void 0 : _a.data;
42386
+ const data = {
42387
+ userId: client.userId,
42388
+ lastTraySeenAt: payload.lastSeenAt,
42389
+ };
42390
+ const updateCacheData = Object.assign(Object.assign({}, cacheData), data);
42391
+ const cachedAt = client.cache && Date.now();
42392
+ if (client.cache)
42393
+ pushToCache(['notificationTraySeen', 'get', client.userId], updateCacheData, { cachedAt });
42394
+ fireEvent('local.notificationTraySeen.updated', data);
42395
+ return {
42396
+ data: payload,
42397
+ cachedAt,
42398
+ };
42399
+ };
42400
+ /* end_public_function */
42401
+
42402
+ var index = /*#__PURE__*/Object.freeze({
42403
+ __proto__: null,
42404
+ getNotificationTraySeen: getNotificationTraySeen,
42405
+ getNotificationTrayItems: getNotificationTrayItems,
42406
+ markItemsSeen: markItemsSeen,
42407
+ markTraySeen: markTraySeen,
42408
+ onNotificationTraySeenUpdated: onNotificationTraySeenUpdated
42409
+ });
42410
+
42411
+ 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 };