@amityco/ts-sdk 7.1.1-61f30ce0.0 → 7.1.1-6dd179b0.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 (75) hide show
  1. package/dist/@types/domains/notification.d.ts +4 -4
  2. package/dist/@types/domains/notification.d.ts.map +1 -1
  3. package/dist/@types/index.d.ts +1 -0
  4. package/dist/@types/index.d.ts.map +1 -1
  5. package/dist/index.cjs.js +60 -66
  6. package/dist/index.d.ts +1 -1
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.esm.js +60 -66
  9. package/dist/index.umd.js +1 -1
  10. package/dist/notificationTray/api/index.d.ts +3 -0
  11. package/dist/notificationTray/api/index.d.ts.map +1 -0
  12. package/dist/notificationTray/api/markItemsSeen.d.ts +16 -0
  13. package/dist/notificationTray/api/markItemsSeen.d.ts.map +1 -0
  14. package/dist/notificationTray/api/markTraySeen.d.ts +19 -0
  15. package/dist/notificationTray/api/markTraySeen.d.ts.map +1 -0
  16. package/dist/notificationTray/events/index.d.ts.map +1 -0
  17. package/dist/notificationTray/events/onNotificationTraySeenUpdated.d.ts.map +1 -0
  18. package/dist/notificationTray/index.d.ts.map +1 -0
  19. package/dist/{notificationTrayRepository → notificationTray}/internalApi/getNotificationTraySeen.d.ts +4 -4
  20. package/dist/notificationTray/internalApi/getNotificationTraySeen.d.ts.map +1 -0
  21. package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts +2 -2
  22. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +1 -0
  23. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +1 -0
  24. package/dist/notificationTray/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +1 -0
  25. package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems.d.ts +1 -1
  26. package/dist/notificationTray/observers/getNotificationTrayItems.d.ts.map +1 -0
  27. package/dist/notificationTray/observers/getNotificationTraySeen.d.ts.map +1 -0
  28. package/dist/notificationTray/observers/index.d.ts.map +1 -0
  29. package/dist/notificationTray/utils/prepareNotificationTrayItemsPayload.d.ts.map +1 -0
  30. package/dist/utils/linkedObject/notificationTrayLinkedObject.d.ts.map +1 -1
  31. package/package.json +1 -1
  32. package/src/@types/domains/notification.ts +4 -4
  33. package/src/@types/index.ts +1 -0
  34. package/src/index.ts +1 -1
  35. package/src/notificationTray/api/index.ts +2 -0
  36. package/src/{notificationTrayRepository/api/markNotificationItemsSeen.ts → notificationTray/api/markItemsSeen.ts} +4 -4
  37. package/src/{notificationTrayRepository/api/markNotificationTraySeen.ts → notificationTray/api/markTraySeen.ts} +4 -4
  38. package/src/{notificationTrayRepository → notificationTray}/internalApi/getNotificationTraySeen.ts +4 -4
  39. package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.ts +3 -3
  40. package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems.ts +1 -1
  41. package/src/utils/linkedObject/notificationTrayLinkedObject.ts +6 -15
  42. package/dist/notificationTrayRepository/api/index.d.ts +0 -3
  43. package/dist/notificationTrayRepository/api/index.d.ts.map +0 -1
  44. package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts +0 -16
  45. package/dist/notificationTrayRepository/api/markNotificationItemsSeen.d.ts.map +0 -1
  46. package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts +0 -19
  47. package/dist/notificationTrayRepository/api/markNotificationTraySeen.d.ts.map +0 -1
  48. package/dist/notificationTrayRepository/events/index.d.ts.map +0 -1
  49. package/dist/notificationTrayRepository/events/onNotificationTraySeenUpdated.d.ts.map +0 -1
  50. package/dist/notificationTrayRepository/index.d.ts.map +0 -1
  51. package/dist/notificationTrayRepository/internalApi/getNotificationTraySeen.d.ts.map +0 -1
  52. package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsLiveCollectionController.d.ts.map +0 -1
  53. package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts.map +0 -1
  54. package/dist/notificationTrayRepository/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts.map +0 -1
  55. package/dist/notificationTrayRepository/observers/getNotificationTrayItems.d.ts.map +0 -1
  56. package/dist/notificationTrayRepository/observers/getNotificationTraySeen.d.ts.map +0 -1
  57. package/dist/notificationTrayRepository/observers/index.d.ts.map +0 -1
  58. package/dist/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.d.ts.map +0 -1
  59. package/src/notificationTrayRepository/api/index.ts +0 -2
  60. /package/dist/{notificationTrayRepository → notificationTray}/events/index.d.ts +0 -0
  61. /package/dist/{notificationTrayRepository → notificationTray}/events/onNotificationTraySeenUpdated.d.ts +0 -0
  62. /package/dist/{notificationTrayRepository → notificationTray}/index.d.ts +0 -0
  63. /package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.d.ts +0 -0
  64. /package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.d.ts +0 -0
  65. /package/dist/{notificationTrayRepository → notificationTray}/observers/getNotificationTraySeen.d.ts +0 -0
  66. /package/dist/{notificationTrayRepository → notificationTray}/observers/index.d.ts +0 -0
  67. /package/dist/{notificationTrayRepository → notificationTray}/utils/prepareNotificationTrayItemsPayload.d.ts +0 -0
  68. /package/src/{notificationTrayRepository → notificationTray}/events/index.ts +0 -0
  69. /package/src/{notificationTrayRepository → notificationTray}/events/onNotificationTraySeenUpdated.ts +0 -0
  70. /package/src/{notificationTrayRepository → notificationTray}/index.ts +0 -0
  71. /package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsPaginationController.ts +0 -0
  72. /package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTrayItems/NotificationTrayItemsQuerystreamController.ts +0 -0
  73. /package/src/{notificationTrayRepository → notificationTray}/observers/getNotificationTraySeen.ts +0 -0
  74. /package/src/{notificationTrayRepository → notificationTray}/observers/index.ts +0 -0
  75. /package/src/{notificationTrayRepository → notificationTray}/utils/prepareNotificationTrayItemsPayload.ts +0 -0
@@ -0,0 +1,3 @@
1
+ export * from './markItemsSeen';
2
+ export * from './markTraySeen';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,16 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1,19 @@
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
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
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,7 +1,7 @@
1
1
  /**
2
2
  * ```js
3
- * import { NotificationTrayRepository } from '@amityco/ts-sdk'
4
- * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen()
3
+ * import { notificationTray } from '@amityco/ts-sdk'
4
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
5
5
  * ```
6
6
  *
7
7
  *
@@ -14,8 +14,8 @@ export declare const getNotificationTraySeen: {
14
14
  (): Promise<Amity.Cached<Amity.NotificationTraySeen>>;
15
15
  /**
16
16
  * ```js
17
- * import { NotificationTrayRepository } from '@amityco/ts-sdk'
18
- * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen.locally()
17
+ * import { notificationTray } from '@amityco/ts-sdk'
18
+ * const notificationTraySeen = await notificationTray.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/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,9 +1,9 @@
1
1
  import { NotificationTrayItemsPaginationController } from './NotificationTrayItemsPaginationController';
2
2
  import { LiveCollectionController } from '~/core/liveCollection/LiveCollectionController';
3
- export declare class NotificationTrayItemsLiveCollectionController extends LiveCollectionController<'notificationTrayItem', Amity.NotificationTrayItemLiveCollection, Amity.RawNotificationTrayItem, NotificationTrayItemsPaginationController> {
3
+ export declare class NotificationTrayItemsLiveCollectionController extends LiveCollectionController<'notificationTrayItem', Amity.NotificationTrayItemLiveCollection, Amity.NotificationTrayItem, NotificationTrayItemsPaginationController> {
4
4
  private queryStreamController;
5
5
  private query;
6
- constructor(query: Amity.NotificationTrayItemLiveCollection, callback: Amity.LiveCollectionCallback<Amity.RawNotificationTrayItem>);
6
+ constructor(query: Amity.NotificationTrayItemLiveCollection, callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>);
7
7
  protected setup(): void;
8
8
  protected persistModel(queryPayload: Amity.NotificationTrayPayload & Amity.Pagination): Promise<void>;
9
9
  protected persistQueryStream({ response, direction, refresh, }: Amity.LiveCollectionPersistQueryStreamParams<'notificationTrayItem'>): void;
@@ -0,0 +1 @@
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,oBAAoB,EAC1B,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,oBAAoB,CAAC;IAoBpE,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"}
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
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"}
@@ -8,5 +8,5 @@
8
8
  * @category Notification tray items Live Collection
9
9
  *
10
10
  */
11
- export declare const getNotificationTrayItems: (params: Amity.LiveCollectionParams<Amity.NotificationTrayItemLiveCollection>, callback: Amity.LiveCollectionCallback<Amity.RawNotificationTrayItem>, config?: Amity.LiveCollectionConfig) => () => void;
11
+ export declare const getNotificationTrayItems: (params: Amity.LiveCollectionParams<Amity.NotificationTrayItemLiveCollection>, callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>, config?: Amity.LiveCollectionConfig) => () => void;
12
12
  //# sourceMappingURL=getNotificationTrayItems.d.ts.map
@@ -0,0 +1 @@
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,oBAAoB,CAAC,WACzD,MAAM,oBAAoB,eAyBpC,CAAC"}
@@ -0,0 +1 @@
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"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTray/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/notificationTray/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":"AAKA,eAAO,MAAM,4BAA4B,SACjC,MAAM,4BAA4B,KACvC,MAAM,oBAWR,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk",
3
- "version": "7.1.1-61f30ce0.0",
3
+ "version": "7.1.1-6dd179b0.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",
@@ -21,23 +21,24 @@ declare global {
21
21
  type RawNotificationTrayItem = {
22
22
  _id: string;
23
23
  lastSeenAt: Amity.timestamp;
24
- lastOccuredAt: Amity.timestamp;
25
- actorIds: {
24
+ lastOccurredAt: Amity.timestamp;
25
+ actors: {
26
26
  _id: string;
27
27
  lastActedAt: Amity.timestamp;
28
28
  }[];
29
29
  actorsCount: number;
30
- action: TrayAction;
31
30
  trayItemCategory?: TrayItemCategoryType;
32
31
  targetId: string;
33
32
  targetType: string;
34
33
  referenceId?: string;
35
34
  referenceType?: string;
35
+ actionType: TrayAction;
36
36
  actionReferenceId?: string;
37
37
  parentId?: string;
38
38
  data: { communityName: string } | { reactionName: string[] };
39
39
  text: string;
40
40
  templatedText: string;
41
+ daySegment?: Amity.timestamp;
41
42
  };
42
43
 
43
44
  type InternalNotificationTrayItem = RawNotificationTrayItem;
@@ -57,7 +58,6 @@ declare global {
57
58
  >;
58
59
 
59
60
  type NotificationTrayItem = Amity.InternalNotificationTrayItem & {
60
- markRead: () => void;
61
61
  isSeen: boolean;
62
62
  isRecent: boolean;
63
63
  users: Amity.User[];
@@ -37,3 +37,4 @@ export * from './domains/message';
37
37
  export * from './domains/post';
38
38
  export * from './domains/story';
39
39
  export * from './domains/ad';
40
+ export * from './domains/notification';
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 NotificationTrayRepository from './notificationTrayRepository';
53
+ export * as notificationTray from './notificationTray';
@@ -0,0 +1,2 @@
1
+ export * from './markItemsSeen';
2
+ export * from './markTraySeen';
@@ -7,8 +7,8 @@ import { pullFromCache, pushToCache } from '~/cache/api';
7
7
  */
8
8
  /**
9
9
  * ```js
10
- * import { NotificationTrayRepository } from '@amityco/ts-sdk'
11
- * const updated = await NotificationTrayRepository.markNotificationItemsSeen()
10
+ * import { notificationTray } from '@amityco/ts-sdk'
11
+ * const updated = await notificationTray.markItemsSeen()
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 markNotificationItemsSeen = async (patch: Amity.QueryNotificationItemSeen) => {
22
+ export const markItemsSeen = async (patch: Amity.QueryNotificationItemSeen) => {
23
23
  const client = getActiveClient();
24
- client.log('notificationTray/markNotificationItemsSeen', {});
24
+ client.log('notificationTray/markItemsSeen', {});
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 { NotificationTrayRepository } from '@amityco/ts-sdk'
11
- * const updated = await NotificationTrayRepository.markNotificationTraySeen({
10
+ * import { notificationTray } from '@amityco/ts-sdk'
11
+ * const updated = await notificationTray.markTraySeen({
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 markNotificationTraySeen = async (
25
+ export const markTraySeen = async (
26
26
  lastSeenAt: Amity.timestamp,
27
27
  ): Promise<Amity.Cached<Amity.NotificationTraySeenUpdatedPayload>> => {
28
28
  const client = getActiveClient();
29
- client.log('notificationTray/markNotificationTraySeen', {});
29
+ client.log('notificationTray/markTraySeen', {});
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 { NotificationTrayRepository } from '@amityco/ts-sdk'
10
- * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen()
9
+ * import { notificationTray } from '@amityco/ts-sdk'
10
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen()
11
11
  * ```
12
12
  *
13
13
  *
@@ -51,8 +51,8 @@ export const getNotificationTraySeen = async (): Promise<
51
51
 
52
52
  /**
53
53
  * ```js
54
- * import { NotificationTrayRepository } from '@amityco/ts-sdk'
55
- * const notificationTraySeen = await NotificationTrayRepository.getNotificationTraySeen.locally()
54
+ * import { notificationTray } from '@amityco/ts-sdk'
55
+ * const notificationTraySeen = await notificationTray.getNotificationTraySeen.locally()
56
56
  * ```
57
57
  *
58
58
  * Queries a paginable list of {@link Amity.NotificationTraySeen} objects from cache
@@ -3,14 +3,14 @@ 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 '~/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload';
6
+ import { prepareNotificationTrayItemsPayload } from '~/notificationTray/utils/prepareNotificationTrayItemsPayload';
7
7
  import { isNonNullable } from '~/utils';
8
8
  import { LinkedObject } from '~/utils/linkedObject';
9
9
 
10
10
  export class NotificationTrayItemsLiveCollectionController extends LiveCollectionController<
11
11
  'notificationTrayItem',
12
12
  Amity.NotificationTrayItemLiveCollection,
13
- Amity.RawNotificationTrayItem,
13
+ Amity.NotificationTrayItem,
14
14
  NotificationTrayItemsPaginationController
15
15
  > {
16
16
  private queryStreamController: NotificationTrayItemsQuerystreamController;
@@ -19,7 +19,7 @@ export class NotificationTrayItemsLiveCollectionController extends LiveCollectio
19
19
 
20
20
  constructor(
21
21
  query: Amity.NotificationTrayItemLiveCollection,
22
- callback: Amity.LiveCollectionCallback<Amity.RawNotificationTrayItem>,
22
+ callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>,
23
23
  ) {
24
24
  const queryStreamId = hash(query);
25
25
  const cacheKey = ['notificationTrayItem', 'collection', queryStreamId];
@@ -15,7 +15,7 @@ import { NotificationTrayItemsLiveCollectionController } from './getNotification
15
15
  */
16
16
  export const getNotificationTrayItems = (
17
17
  params: Amity.LiveCollectionParams<Amity.NotificationTrayItemLiveCollection>,
18
- callback: Amity.LiveCollectionCallback<Amity.RawNotificationTrayItem>,
18
+ callback: Amity.LiveCollectionCallback<Amity.NotificationTrayItem>,
19
19
  config?: Amity.LiveCollectionConfig,
20
20
  ) => {
21
21
  const { log, cache } = getActiveClient();
@@ -1,28 +1,19 @@
1
- import { markNotificationItemsSeen } from '~/notificationTrayRepository/api/markNotificationItemsSeen';
2
1
  import { pullFromCache } from '~/cache/api';
3
- import { userLinkedObject } from './userLinkedObject';
4
2
  import { isNonNullable } from '..';
5
3
  import { WEEK } from '../constants';
4
+ import { userLinkedObject } from './userLinkedObject';
6
5
 
7
6
  export const notificationTrayLinkedObject = (
8
7
  noti: Amity.InternalNotificationTrayItem,
9
8
  ): Amity.NotificationTrayItem => {
10
9
  return {
11
10
  ...noti,
12
- isSeen: noti.lastSeenAt > noti.lastOccuredAt,
13
- isRecent: new Date(noti.lastOccuredAt).getTime() >= Date.now() - WEEK,
14
- users: noti.actorIds
15
- .map(userId => pullFromCache<Amity.InternalUser>(['user', 'get', userId])?.data)
11
+ isSeen: noti.lastSeenAt > noti.lastOccurredAt,
12
+ isRecent: new Date(noti.lastOccurredAt).getTime() >= Date.now() - WEEK,
13
+ users: noti.actors
14
+ .map(({ _id }) => pullFromCache<Amity.InternalUser>(['user', 'get', _id])!)
16
15
  .filter(isNonNullable)
16
+ .map(({ data }) => data)
17
17
  .map(user => userLinkedObject(user)),
18
- markRead: () =>
19
- markNotificationItemsSeen({
20
- trayItems: [
21
- {
22
- id: noti._id,
23
- lastSeenAt: noti.lastSeenAt,
24
- },
25
- ],
26
- }),
27
18
  };
28
19
  };
@@ -1,3 +0,0 @@
1
- export * from './markNotificationItemsSeen';
2
- export * from './markNotificationTraySeen';
3
- //# sourceMappingURL=index.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/api/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,4BAA4B,CAAC"}
@@ -1,16 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1,19 +0,0 @@
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
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/events/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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 +0,0 @@
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,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/notificationTrayRepository/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/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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
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"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/notificationTrayRepository/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/notificationTrayRepository/utils/prepareNotificationTrayItemsPayload.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,mCAAmC,eAClC,MAAM,uBAAuB,KACxC,MAAM,gCAOR,CAAC"}
@@ -1,2 +0,0 @@
1
- export * from './markNotificationItemsSeen';
2
- export * from './markNotificationTraySeen';