@amityco/ts-sdk 7.1.1-1325f22d.0 → 7.1.1-15835b61.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 (72) hide show
  1. package/dist/@types/domains/notification.d.ts +1 -8
  2. package/dist/@types/domains/notification.d.ts.map +1 -1
  3. package/dist/index.cjs.js +18 -23
  4. package/dist/index.d.ts +1 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.esm.js +18 -23
  7. package/dist/index.umd.js +1 -1
  8. package/dist/notificationTrayRepository/api/index.d.ts +3 -0
  9. package/dist/notificationTrayRepository/api/index.d.ts.map +1 -0
  10. package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts +16 -0
  11. package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts.map +1 -0
  12. package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts +19 -0
  13. package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts.map +1 -0
  14. package/dist/notificationTrayRepository/events/index.d.ts.map +1 -0
  15. package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
  16. package/dist/notificationTrayRepository/index.d.ts.map +1 -0
  17. package/dist/{notificationTray → notificationTrayRepository}/internalApi/getNotificationTraySeen.d.ts +5 -5
  18. package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts.map +1 -0
  19. package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
  20. package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
  21. package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
  22. package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts.map +1 -0
  23. package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts.map +1 -0
  24. package/dist/notificationTrayRepository/observers/index.d.ts.map +1 -0
  25. package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts.map +1 -0
  26. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -1
  27. package/package.json +1 -1
  28. package/src/@types/domains/notification.ts +2 -9
  29. package/src/index.ts +1 -1
  30. package/src/notificationTrayRepository/api/index.ts +2 -0
  31. package/src/{notificationTray/api/markItemsSeen.ts → notificationTrayRepository/api/markNotificationItemsSeen.ts} +4 -4
  32. package/src/{notificationTray/api/markTraySeen.ts → notificationTrayRepository/api/markNotificationTraySeen.ts} +4 -4
  33. package/src/{notificationTray → notificationTrayRepository}/internalApi/getNotificationTraySeen.ts +5 -6
  34. package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +3 -5
  35. package/src/utils/linkedObject/notificationTrayLinkedObject.ts +2 -12
  36. package/dist/notificationTray/api/index.d.ts +0 -3
  37. package/dist/notificationTray/api/index.d.ts.map +0 -1
  38. package/dist/notificationTray/api/markItemsSeen.d.ts +0 -16
  39. package/dist/notificationTray/api/markItemsSeen.d.ts.map +0 -1
  40. package/dist/notificationTray/api/markTraySeen.d.ts +0 -19
  41. package/dist/notificationTray/api/markTraySeen.d.ts.map +0 -1
  42. package/dist/notificationTray/events/index.d.ts.map +0 -1
  43. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +0 -1
  44. package/dist/notificationTray/index.d.ts.map +0 -1
  45. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +0 -1
  46. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +0 -1
  47. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +0 -1
  48. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +0 -1
  49. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +0 -1
  50. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +0 -1
  51. package/dist/notificationTray/observers/index.d.ts.map +0 -1
  52. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts.map +0 -1
  53. package/src/notificationTray/api/index.ts +0 -2
  54. /package/dist/{notificationTray → notificationTrayRepository}/events/index.d.ts +0 -0
  55. /package/dist/{notificationTray → notificationTrayRepository}/events/onNotificationTraySeenUpdated.d.ts +0 -0
  56. /package/dist/{notificationTray → notificationTrayRepository}/index.d.ts +0 -0
  57. /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +0 -0
  58. /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +0 -0
  59. /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +0 -0
  60. /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems.d.ts +0 -0
  61. /package/dist/{notificationTray → notificationTrayRepository}/observers/getNotificationTraySeen.d.ts +0 -0
  62. /package/dist/{notificationTray → notificationTrayRepository}/observers/index.d.ts +0 -0
  63. /package/dist/{notificationTray → notificationTrayRepository}/utils/prepareNotificationTrayItemsPayload.d.ts +0 -0
  64. /package/src/{notificationTray → notificationTrayRepository}/events/index.ts +0 -0
  65. /package/src/{notificationTray → notificationTrayRepository}/events/onNotificationTraySeenUpdated.ts +0 -0
  66. /package/src/{notificationTray → notificationTrayRepository}/index.ts +0 -0
  67. /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +0 -0
  68. /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +0 -0
  69. /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTrayItems.ts +0 -0
  70. /package/src/{notificationTray → notificationTrayRepository}/observers/getNotificationTraySeen.ts +0 -0
  71. /package/src/{notificationTray → notificationTrayRepository}/observers/index.ts +0 -0
  72. /package/src/{notificationTray → notificationTrayRepository}/utils/prepareNotificationTrayItemsPayload.ts +0 -0
@@ -0,0 +1,3 @@
1
+ export * from './markNotificationItemsSeen';
2
+ export * from './markNotificationTraySeen';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * ```js
3
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
4
+ * const updated = await NotificationTrayRepository.markNotificationItemsSeen()
5
+ * ```
6
+ *
7
+ * Updates an {@link Amity.NotificationItemSeen}
8
+ *
9
+ * @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
10
+ * @returns the updated {@link Amity.NotificationItemSeen} object
11
+ *
12
+ * @category NotificationItemSeen API
13
+ * @async
14
+ */
15
+ export declare const markNotificationItemsSeen: (patch: Amity.QueryNotificationItemSeen) => Promise<void>;
16
+ //# sourceMappingURL=markNotificationItemsSeen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markNotificationItemsSeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/markNotificationItemsSeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,yBAAyB,UAAiB,MAAM,yBAAyB,kBAoCrF,CAAC"}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * ```js
3
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
4
+ * const updated = await NotificationTrayRepository.markNotificationTraySeen({
5
+ * lastSeenAt: Amity.timestamp,
6
+ * })
7
+ * ```
8
+ *
9
+ * Updates an {@link Amity.NotificationTraySeen}
10
+ *
11
+ * @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
12
+ * @param lastSeenAt The patch data to apply
13
+ * @returns the updated {@link Amity.NotificationTraySeen} object
14
+ *
15
+ * @category Post API
16
+ * @async
17
+ */
18
+ export declare const markNotificationTraySeen: (lastSeenAt: Amity.timestamp) => Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>>;
19
+ //# sourceMappingURL=markNotificationTraySeen.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"markNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/markNotificationTraySeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,wBAAwB,eACvB,MAAM,SAAS,KAC1B,QAAQ,MAAM,MAAM,CAAC,MAAM,kCAAkC,CAAC,CAqChE,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"onNotificationTraySeenUpdated.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/events/onNotificationTraySeenUpdated.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,6BAA6B,aAC9B,MAAM,QAAQ,CAAC,MAAM,4BAA4B,CAAC,KAC3D,MAAM,YAeR,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notificationTrayRepository/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
@@ -1,7 +1,7 @@
1
1
  /**
2
2
  * ```js
3
- * import { notificationTray } from '@amityco/ts-sdk'
4
- * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
3
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
4
+ * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen()
5
5
  * ```
6
6
  *
7
7
  *
@@ -11,11 +11,11 @@
11
11
  * @async
12
12
  * */
13
13
  export declare const getNotificationTraySeen: {
14
- (): Promise<Amity.Cached<Amity.NotificationTraySeen>>;
14
+ (): Promise<Amity.Cached<Amity.InternalNotificationTraySeen>>;
15
15
  /**
16
16
  * ```js
17
- * import { notificationTray } from '@amityco/ts-sdk'
18
- * const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
17
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
18
+ * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen.locally()
19
19
  * ```
20
20
  *
21
21
  * Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/internalApi/getNotificationTraySeen.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,uBAAuB;QAAa,QAC/C,MAAM,MAAM,CAAC,MAAM,4BAA4B,CAAC,CACjD;IA8BD;;;;;;;;;;;;SAYK;eAED,MAAM,MAAM,CAAC,MAAM,2BAA2B,CAAC,GAC/C,SAAS;CAlBZ,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationTrayItemsLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AAExG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAI1F,qBAAa,6CAA8C,SAAQ,wBAAwB,CACzF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,EACxC,KAAK,CAAC,uBAAuB,EAC7B,yCAAyC,CAC1C;IACC,OAAO,CAAC,qBAAqB,CAA6C;IAE1E,OAAO,CAAC,KAAK,CAA2C;gBAGtD,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,uBAAuB,CAAC;IAoBvE,SAAS,CAAC,KAAK;cAYC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC,UAAU;IAI3F,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,sBAAsB,CAAC;IAKvE,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;CAwB1E"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationTrayItemsPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,yCAA0C,SAAQ,oBAAoB,CACjF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,CACzC;IACO,UAAU,CACd,WAAW,EAAE,KAAK,CAAC,kCAAkC,EACrD,KAAK,EAAE,MAAM,GAAG,SAAS;CAiB5B"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"NotificationTrayItemsQuerystreamController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAMpF,qBAAa,0CAA2C,SAAQ,qBAAqB,CACnF,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,kCAAkC,CACzC;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAEsB;gBAG1C,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CACd,QAAQ,EAAE,KAAK,CAAC,uBAAuB,KACpC,KAAK,CAAC,gCAAgC;IAOvC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,uBAAuB;IAW1D,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,uBAAuB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EACnE,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;CAwBlB"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTrayItems.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/observers/getNotificationTrayItems.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,WAC3B,MAAM,oBAAoB,CAAC,MAAM,kCAAkC,CAAC,YAClE,MAAM,sBAAsB,CAAC,MAAM,uBAAuB,CAAC,WAC5D,MAAM,oBAAoB,eAyBpC,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/observers/getNotificationTraySeen.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,kBAAkB,CAAC,MAAM,2BAA2B,CAAC,KACpE,MAAM,YAYR,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/observers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"prepareNotificationTrayItemsPayload.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mCAAmC,eAClC,MAAM,uBAAuB,KACxC,MAAM,gCAOR,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"notificationTrayLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/notificationTrayLinkedObject.ts"],"names":[],"mappings":"AAMA,eAAO,MAAM,4BAA4B,SACjC,MAAM,4BAA4B,KACvC,MAAM,oBAmBR,CAAC"}
1
+ {"version":3,"file":"notificationTrayLinkedObject.d.ts","sourceRoot":"","sources":["../../../src/utils/linkedObject/notificationTrayLinkedObject.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,4BAA4B,SACjC,MAAM,4BAA4B,KACvC,MAAM,oBAaR,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.1.1-1325f22d.0",
3
+ "version": "7.1.1-15835b61.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -22,7 +22,7 @@ declare global {
22
22
  _id: string;
23
23
  lastSeenAt: Amity.timestamp;
24
24
  lastOccuredAt: Amity.timestamp;
25
- actors: {
25
+ actorIds: {
26
26
  _id: string;
27
27
  lastActedAt: Amity.timestamp;
28
28
  }[];
@@ -56,12 +56,7 @@ declare global {
56
56
  Pick<QueryNotificationTrayItem, 'limit'>
57
57
  >;
58
58
 
59
- type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
60
- markRead: () => void;
61
- isSeen: boolean;
62
- isRecent: boolean;
63
- users: Amity.User[];
64
- };
59
+ type NotificationTrayItem = Amity.InternalNotificationTrayItem & { markRead: () => void };
65
60
 
66
61
  type RawNotificationTraySeen = {
67
62
  lastTraySeenAt: Amity.timestamp;
@@ -74,8 +69,6 @@ declare global {
74
69
 
75
70
  type InternalNotificationTraySeen = RawNotificationTraySeen & { userId: string };
76
71
 
77
- type NotificationTraySeen = RawNotificationTraySeen & { userId: string; isSeen: boolean };
78
-
79
72
  type RawNotificationItemSeen = {
80
73
  lastSeenAt: Amity.timestamp;
81
74
  };
package/src/index.ts CHANGED
@@ -50,4 +50,4 @@ export * as AdRepository from './adRepository';
50
50
  // // external apis
51
51
  export * from './external/api';
52
52
 
53
- export * as notificationTray from './notificationTray';
53
+ export * as NotificationTrayRepository from './notificationTrayRepository';
@@ -0,0 +1,2 @@
1
+ export * from './markNotificationItemsSeen';
2
+ export * from './markNotificationTraySeen';
@@ -7,8 +7,8 @@ import { pullFromCache, pushToCache } from '~/cache/api';
7
7
  */
8
8
  /**
9
9
  * ```js
10
- * import { notificationTray } from '@amityco/ts-sdk'
11
- * const updated = await notificationTray.markItemsSeen()
10
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
11
+ * const updated = await NotificationTrayRepository.markNotificationItemsSeen()
12
12
  * ```
13
13
  *
14
14
  * Updates an {@link Amity.NotificationItemSeen}
@@ -19,9 +19,9 @@ import { pullFromCache, pushToCache } from '~/cache/api';
19
19
  * @category NotificationItemSeen API
20
20
  * @async
21
21
  */
22
- export const markItemsSeen = async (patch: Amity.QueryNotificationItemSeen) => {
22
+ export const markNotificationItemsSeen = async (patch: Amity.QueryNotificationItemSeen) => {
23
23
  const client = getActiveClient();
24
- client.log('notificationTray/markItemsSeen', {});
24
+ client.log('notificationTray/markNotificationItemsSeen', {});
25
25
 
26
26
  const { data: payload } = await client.http.put<Amity.RawNotificationTraySeenUpdated>(
27
27
  `api/v1/notification-tray/items/seen`,
@@ -7,8 +7,8 @@ import { pullFromCache, pushToCache } from '~/cache/api';
7
7
  */
8
8
  /**
9
9
  * ```js
10
- * import { notificationTray } from '@amityco/ts-sdk'
11
- * const updated = await notificationTray.markTraySeen({
10
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
11
+ * const updated = await NotificationTrayRepository.markNotificationTraySeen({
12
12
  * lastSeenAt: Amity.timestamp,
13
13
  * })
14
14
  * ```
@@ -22,11 +22,11 @@ import { pullFromCache, pushToCache } from '~/cache/api';
22
22
  * @category Post API
23
23
  * @async
24
24
  */
25
- export const markTraySeen = async (
25
+ export const markNotificationTraySeen = async (
26
26
  lastSeenAt: Amity.timestamp,
27
27
  ): Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>> => {
28
28
  const client = getActiveClient();
29
- client.log('notificationTray/markTraySeen', {});
29
+ client.log('notificationTray/markNotificationTraySeen', {});
30
30
 
31
31
  const { data: payload } = await client.http.put<Amity.NotificationTraySeenUpdatedPayload>(
32
32
  `api/v1/notification-tray/tray/seen`,
@@ -6,8 +6,8 @@ import { pullFromCache, pushToCache } from '~/cache/api';
6
6
  */
7
7
  /**
8
8
  * ```js
9
- * import { notificationTray } from '@amityco/ts-sdk'
10
- * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
9
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
10
+ * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen()
11
11
  * ```
12
12
  *
13
13
  *
@@ -17,7 +17,7 @@ import { pullFromCache, pushToCache } from '~/cache/api';
17
17
  * @async
18
18
  * */
19
19
  export const getNotificationTraySeen = async (): Promise<
20
- Amity.Cached<Amity.NotificationTraySeen>
20
+ Amity.Cached<Amity.InternalNotificationTraySeen>
21
21
  > => {
22
22
  const client = getActiveClient();
23
23
  client.log('notificationTray/getNotificationTraySeen', {});
@@ -42,7 +42,6 @@ export const getNotificationTraySeen = async (): Promise<
42
42
  userId: client.userId!,
43
43
  lastTraySeenAt: payload.lastTraySeenAt,
44
44
  lastTrayOccuredAt: payload.lastTrayOccuredAt,
45
- isSeen: payload.lastTraySeenAt > payload.lastTrayOccuredAt,
46
45
  },
47
46
  cachedAt,
48
47
  };
@@ -51,8 +50,8 @@ export const getNotificationTraySeen = async (): Promise<
51
50
 
52
51
  /**
53
52
  * ```js
54
- * import { notificationTray } from '@amityco/ts-sdk'
55
- * const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
53
+ * import { NotificationTrayRepository } from '@amityco/ts-sdk'
54
+ * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen.locally()
56
55
  * ```
57
56
  *
58
57
  * Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
@@ -3,9 +3,8 @@ import { pullFromCache, pushToCache } from '~/cache/api';
3
3
  import { NotificationTrayItemsPaginationController } from './NotificationTrayItemsPaginationController';
4
4
  import { NotificationTrayItemsQuerystreamController } from './NotificationTrayItemsQuerystreamController';
5
5
  import { LiveCollectionController } from '~/core/liveCollection/LiveCollectionController';
6
- import { prepareNotificationTrayItemsPayload } from '~/notificationTray/utils/prepareNotificationTrayItemsPayload';
6
+ import { prepareNotificationTrayItemsPayload } from '~/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload';
7
7
  import { isNonNullable } from '~/utils';
8
- import { LinkedObject } from '~/utils/linkedObject';
9
8
 
10
9
  export class NotificationTrayItemsLiveCollectionController extends LiveCollectionController<
11
10
  'notificationTrayItem',
@@ -74,14 +73,13 @@ export class NotificationTrayItemsLiveCollectionController extends LiveCollectio
74
73
  )?.data;
75
74
  if (!collection) return;
76
75
 
77
- const data = (
76
+ const data =
78
77
  collection.data
79
78
  .map(id =>
80
79
  pullFromCache<Amity.InternalNotificationTrayItem>(['notificationTrayItem', 'get', id]),
81
80
  )
82
81
  .filter(isNonNullable)
83
- .map(({ data }) => data) ?? []
84
- ).map(LinkedObject.notificationTray);
82
+ .map(({ data }) => data) ?? [];
85
83
 
86
84
  if (!this.shouldNotify(data) && origin === 'event') return;
87
85
 
@@ -1,22 +1,12 @@
1
- import { markItemsSeen } from '~/notificationTray/api/markItemsSeen';
2
- import { pullFromCache } from '~/cache/api';
3
- import { userLinkedObject } from './userLinkedObject';
4
- import { isNonNullable } from '..';
5
- import { WEEK } from '../constants';
1
+ import { markNotificationItemsSeen } from '~/notificationTrayRepository/api/markNotificationItemsSeen';
6
2
 
7
3
  export const notificationTrayLinkedObject = (
8
4
  noti: Amity.InternalNotificationTrayItem,
9
5
  ): Amity.NotificationTrayItem => {
10
6
  return {
11
7
  ...noti,
12
- isSeen: noti.lastSeenAt > noti.lastOccuredAt,
13
- isRecent: new Date(noti.lastOccuredAt).getTime() >= Date.now() - WEEK,
14
- users: noti.actors
15
- .map(userId => pullFromCache<Amity.InternalUser>(['user', 'get', userId])?.data)
16
- .filter(isNonNullable)
17
- .map(user => userLinkedObject(user)),
18
8
  markRead: () =>
19
- markItemsSeen({
9
+ markNotificationItemsSeen({
20
10
  trayItems: [
21
11
  {
22
12
  id: noti._id,
@@ -1,3 +0,0 @@
1
- export * from './markItemsSeen';
2
- export * from './markTraySeen';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -1,16 +0,0 @@
1
- /**
2
- * ```js
3
- * import { notificationTray } from '@amityco/ts-sdk'
4
- * const updated = await notificationTray.markItemsSeen()
5
- * ```
6
- *
7
- * Updates an {@link Amity.NotificationItemSeen}
8
- *
9
- * @param trayItems[] that include id and lastTraySeenAt, The ID of the {@link Amity.NotificationItemSeen} to edit
10
- * @returns the updated {@link Amity.NotificationItemSeen} object
11
- *
12
- * @category NotificationItemSeen API
13
- * @async
14
- */
15
- export declare const markItemsSeen: (patch: Amity.QueryNotificationItemSeen) => Promise<void>;
16
- //# sourceMappingURL=markItemsSeen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markItemsSeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/markItemsSeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;GAaG;AACH,eAAO,MAAM,aAAa,UAAiB,MAAM,yBAAyB,kBAoCzE,CAAC"}
@@ -1,19 +0,0 @@
1
- /**
2
- * ```js
3
- * import { notificationTray } from '@amityco/ts-sdk'
4
- * const updated = await notificationTray.markTraySeen({
5
- * lastSeenAt: Amity.timestamp,
6
- * })
7
- * ```
8
- *
9
- * Updates an {@link Amity.NotificationTraySeen}
10
- *
11
- * @param userId The ID of the {@link Amity.NotificationTraySeen} to edit
12
- * @param lastSeenAt The patch data to apply
13
- * @returns the updated {@link Amity.NotificationTraySeen} object
14
- *
15
- * @category Post API
16
- * @async
17
- */
18
- export declare const markTraySeen: (lastSeenAt: Amity.timestamp) => Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>>;
19
- //# sourceMappingURL=markTraySeen.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"markTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/markTraySeen.ts"],"names":[],"mappings":"AAOA;;;;;;;;;;;;;;;;GAgBG;AACH,eAAO,MAAM,YAAY,eACX,MAAM,SAAS,KAC1B,QAAQ,MAAM,MAAM,CAAC,MAAM,kCAAkC,CAAC,CAqChE,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"onNotificationTraySeenUpdated.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/onNotificationTraySeenUpdated.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;GAcG;AACH,eAAO,MAAM,6BAA6B,aAC9B,MAAM,QAAQ,CAAC,MAAM,4BAA4B,CAAC,KAC3D,MAAM,YAeR,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/notificationTray/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/internalApi/getNotificationTraySeen.ts"],"names":[],"mappings":"AAMA;;;;;;;;;;;KAWK;AACL,eAAO,MAAM,uBAAuB;QAAa,QAC/C,MAAM,MAAM,CAAC,MAAM,oBAAoB,CAAC,CACzC;IA+BD;;;;;;;;;;;;SAYK;eAED,MAAM,MAAM,CAAC,MAAM,2BAA2B,CAAC,GAC/C,SAAS;CAlBZ,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationTrayItemsLiveCollectionController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,yCAAyC,EAAE,MAAM,6CAA6C,CAAC;AAExG,OAAO,EAAE,wBAAwB,EAAE,MAAM,gDAAgD,CAAC;AAK1F,qBAAa,6CAA8C,SAAQ,wBAAwB,CACzF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,EACxC,KAAK,CAAC,uBAAuB,EAC7B,yCAAyC,CAC1C;IACC,OAAO,CAAC,qBAAqB,CAA6C;IAE1E,OAAO,CAAC,KAAK,CAA2C;gBAGtD,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,KAAK,CAAC,sBAAsB,CAAC,KAAK,CAAC,uBAAuB,CAAC;IAoBvE,SAAS,CAAC,KAAK;cAYC,YAAY,CAAC,YAAY,EAAE,KAAK,CAAC,uBAAuB,GAAG,KAAK,CAAC,UAAU;IAI3F,SAAS,CAAC,kBAAkB,CAAC,EAC3B,QAAQ,EACR,SAAS,EACT,OAAO,GACR,EAAE,KAAK,CAAC,sCAAsC,CAAC,sBAAsB,CAAC;IAKvE,iBAAiB;IAIjB,YAAY,CAAC,EAAE,MAAM,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,KAAK,CAAC,0BAA0B;CAyB1E"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationTrayItemsPaginationController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,4CAA4C,CAAC;AAGlF;;;GAGG;AACH,qBAAa,yCAA0C,SAAQ,oBAAoB,CACjF,sBAAsB,EACtB,KAAK,CAAC,kCAAkC,CACzC;IACO,UAAU,CACd,WAAW,EAAE,KAAK,CAAC,kCAAkC,EACrD,KAAK,EAAE,MAAM,GAAG,SAAS;CAiB5B"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"NotificationTrayItemsQuerystreamController.d.ts","sourceRoot":"","sources":["../../../../src/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6CAA6C,CAAC;AAMpF,qBAAa,0CAA2C,SAAQ,qBAAqB,CACnF,KAAK,CAAC,uBAAuB,EAC7B,KAAK,CAAC,kCAAkC,CACzC;IACC,OAAO,CAAC,YAAY,CAAqD;IAEzE,OAAO,CAAC,cAAc,CAEsB;gBAG1C,KAAK,EAAE,KAAK,CAAC,kCAAkC,EAC/C,QAAQ,EAAE,MAAM,EAAE,EAClB,YAAY,EAAE,CAAC,MAAM,EAAE,KAAK,CAAC,0BAA0B,KAAK,IAAI,EAChE,cAAc,EAAE,CACd,QAAQ,EAAE,KAAK,CAAC,uBAAuB,KACpC,KAAK,CAAC,gCAAgC;IAOvC,YAAY,CAAC,QAAQ,EAAE,KAAK,CAAC,uBAAuB;IAW1D,mBAAmB,CACjB,QAAQ,EAAE,KAAK,CAAC,uBAAuB,GAAG,OAAO,CAAC,KAAK,CAAC,UAAU,CAAC,EACnE,SAAS,EAAE,KAAK,CAAC,2BAA2B,EAC5C,OAAO,UAAQ;CAwBlB"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNotificationTrayItems.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/getNotificationTrayItems.ts"],"names":[],"mappings":"AAKA;;;;;;;;;GASG;AACH,eAAO,MAAM,wBAAwB,WAC3B,MAAM,oBAAoB,CAAC,MAAM,kCAAkC,CAAC,YAClE,MAAM,sBAAsB,CAAC,MAAM,uBAAuB,CAAC,WAC5D,MAAM,oBAAoB,eAyBpC,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"getNotificationTraySeen.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/getNotificationTraySeen.ts"],"names":[],"mappings":"AAQA;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,uBAAuB,aACxB,MAAM,kBAAkB,CAAC,MAAM,2BAA2B,CAAC,KACpE,MAAM,YAYR,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/observers/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAC;AAC1C,cAAc,4BAA4B,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"prepareNotificationTrayItemsPayload.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/utils/prepareNotificationTrayItemsPayload.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mCAAmC,eAClC,MAAM,uBAAuB,KACxC,MAAM,gCAOR,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './markItemsSeen';
2
- export * from './markTraySeen';