@amityco/ts-sdk 7.0.2-46b4d65.0 → 7.0.3-03c332e.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.
@@ -1 +1 @@
1
- {"version":3,"file":"AnalyticsEventCapturer.d.ts","sourceRoot":"","sources":["../../../../src/analytic/service/analytic/AnalyticsEventCapturer.ts"],"names":[],"mappings":";AAQA,qBAAa,sBAAsB;IACjC,WAAW,SAAc;IAEzB,UAAU,SAAQ;IAElB,aAAa,EAAE;QAAE,CAAC,GAAG,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,GAAG,IAAI,CAAA;KAAE,CAAM;IAElE,yBAAyB,EAAE;QAAE,CAAC,GAAG,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,GAAG,IAAI,CAAA;KAAE,CAAM;IAGhF,mBAAmB,EAAE,MAAM,CAAC,OAAO,GAAG,SAAS,CAAa;IAE5D,+BAA+B,EAAE,KAAK,CAAC,KAAK,CAAC,aAAa,CAAC,EAAE,CAAM;IAEnE,eAAe,CAAC,EACd,QAAQ,EACR,UAAU,EACV,cAAsB,GACvB,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,UAAU,EAAE,MAAM,CAAC;QACnB,cAAc,CAAC,EAAE,OAAO,CAAC;KAC1B;IAoBD,MAAM,CAAC,EACL,QAAQ,EACR,SAAS,EACT,WAAW,EACX,YAAY,EACZ,QAAQ,GACT,EAAE;QACD,QAAQ,EAAE,MAAM,CAAC;QACjB,SAAS,EAAE,MAAM,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC,wBAAwB,CAAC;QAC5C,YAAY,EAAE,KAAK,CAAC,yBAAyB,CAAC;QAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC;IAmCD,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC;IASrD,SAAS,CAAC,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AwB,CAAC;QAC5C,YAAY,EAAE,KAAK,CAAC,yBAAyB,CAAC;QAC9C,QAAQ,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;KACnC;IAmCD,gBAAgB,CAAC,MAAM,EAAE,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC;IASrD,SAAS,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa,EAAE,YAAY,EAAE,KAAK,CAAC,yBAAyB;IAuEnF,eAAe;IAQf,iBAAiB,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa;IAI5C,kBAAkB,CAAC,KAAK,EAAE,KAAK,CAAC,aAAa;IAI7C,cAAc,CAAC,EAAE,EAAE,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,WAAW;IAgBjE,eAAe,CAAC,EAAE,EAAE,KAAK,CAAC,UAAU,EAAE,SAAS,EAAE,KAAK,CAAC,WAAW;CAenE"}
package/dist/index.cjs.js CHANGED
@@ -102,8 +102,8 @@ const PostContentType = Object.freeze({
102
102
 
103
103
  function getVersion() {
104
104
  try {
105
- // the string ''v7.0.1-cjs'' should be replaced by actual value by @rollup/plugin-replace
106
- return 'v7.0.1-cjs';
105
+ // the string ''v7.0.2-cjs'' should be replaced by actual value by @rollup/plugin-replace
106
+ return 'v7.0.2-cjs';
107
107
  }
108
108
  catch (error) {
109
109
  return '__dev__';
@@ -4950,12 +4950,14 @@ class AnalyticsEventCapturer {
4950
4950
  }
4951
4951
  isAbleToEnqueue({ uniqueId, expireTime, isHighPriority = false, }) {
4952
4952
  const now = new Date();
4953
- const getRecentViewedDate = () => {
4954
- if (isHighPriority)
4955
- return this._recentHighPriorityViewed[uniqueId];
4956
- return this._recentViewed[uniqueId];
4957
- };
4958
- const recentViewedDate = getRecentViewedDate() || new Date(DAY * -1);
4953
+ // Get the recent view date (if any)
4954
+ const recentViewedDate = isHighPriority
4955
+ ? this._recentHighPriorityViewed[uniqueId]
4956
+ : this._recentViewed[uniqueId];
4957
+ // If this is the first view, always allow it
4958
+ if (!recentViewedDate) {
4959
+ return true;
4960
+ }
4959
4961
  const timeDiff = now.getTime() - recentViewedDate.getTime();
4960
4962
  if (timeDiff < expireTime) {
4961
4963
  // just recently view this post, ignore the event.
@@ -12738,6 +12740,8 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
12738
12740
  referenceType,
12739
12741
  reactionName,
12740
12742
  });
12743
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
12744
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
12741
12745
  const { data } = await client.http.post('/api/v2/reactions', {
12742
12746
  referenceId,
12743
12747
  referenceType,
@@ -12857,6 +12861,8 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
12857
12861
  referenceType,
12858
12862
  reactionName,
12859
12863
  });
12864
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
12865
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
12860
12866
  const { data } = await client.http.delete(`/api/v2/reactions`, {
12861
12867
  data: {
12862
12868
  referenceId,
@@ -13782,6 +13788,8 @@ class ReactionPaginationController extends PaginationController {
13782
13788
  const client = getActiveClient();
13783
13789
  client.log('reaction/queryReactions', queryParams);
13784
13790
  const path = '/api/v3/reactions';
13791
+ if (!['post', 'comment', 'story', 'message'].includes(params.referenceType))
13792
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
13785
13793
  const { data: queryResponse } = await this.http.get(path, {
13786
13794
  params: Object.assign(Object.assign({}, params), { referenceVersion: REFERENCE_API_V5, // Need to put this param to make it can query reaction for message in sub-channel
13787
13795
  options }),
package/dist/index.esm.js CHANGED
@@ -87,8 +87,8 @@ const PostContentType = Object.freeze({
87
87
 
88
88
  function getVersion() {
89
89
  try {
90
- // the string ''v7.0.1-esm'' should be replaced by actual value by @rollup/plugin-replace
91
- return 'v7.0.1-esm';
90
+ // the string ''v7.0.2-esm'' should be replaced by actual value by @rollup/plugin-replace
91
+ return 'v7.0.2-esm';
92
92
  }
93
93
  catch (error) {
94
94
  return '__dev__';
@@ -21042,12 +21042,14 @@ class AnalyticsEventCapturer {
21042
21042
  }
21043
21043
  isAbleToEnqueue({ uniqueId, expireTime, isHighPriority = false, }) {
21044
21044
  const now = new Date();
21045
- const getRecentViewedDate = () => {
21046
- if (isHighPriority)
21047
- return this._recentHighPriorityViewed[uniqueId];
21048
- return this._recentViewed[uniqueId];
21049
- };
21050
- const recentViewedDate = getRecentViewedDate() || new Date(DAY * -1);
21045
+ // Get the recent view date (if any)
21046
+ const recentViewedDate = isHighPriority
21047
+ ? this._recentHighPriorityViewed[uniqueId]
21048
+ : this._recentViewed[uniqueId];
21049
+ // If this is the first view, always allow it
21050
+ if (!recentViewedDate) {
21051
+ return true;
21052
+ }
21051
21053
  const timeDiff = now.getTime() - recentViewedDate.getTime();
21052
21054
  if (timeDiff < expireTime) {
21053
21055
  // just recently view this post, ignore the event.
@@ -28830,6 +28832,8 @@ const addReaction = async (referenceType, referenceId, reactionName) => {
28830
28832
  referenceType,
28831
28833
  reactionName,
28832
28834
  });
28835
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
28836
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
28833
28837
  const { data } = await client.http.post('/api/v2/reactions', {
28834
28838
  referenceId,
28835
28839
  referenceType,
@@ -28949,6 +28953,8 @@ const removeReaction = async (referenceType, referenceId, reactionName) => {
28949
28953
  referenceType,
28950
28954
  reactionName,
28951
28955
  });
28956
+ if (!['post', 'comment', 'story', 'message'].includes(referenceType))
28957
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
28952
28958
  const { data } = await client.http.delete(`/api/v2/reactions`, {
28953
28959
  data: {
28954
28960
  referenceId,
@@ -29874,6 +29880,8 @@ class ReactionPaginationController extends PaginationController {
29874
29880
  const client = getActiveClient();
29875
29881
  client.log('reaction/queryReactions', queryParams);
29876
29882
  const path = '/api/v3/reactions';
29883
+ if (!['post', 'comment', 'story', 'message'].includes(params.referenceType))
29884
+ throw new ASCApiError('The reference type is not valid. It should be one of post, comment, story, or message', 400000 /* Amity.ServerError.BAD_REQUEST */, "error" /* Amity.ErrorLevel.ERROR */);
29877
29885
  const { data: queryResponse } = await this.http.get(path, {
29878
29886
  params: Object.assign(Object.assign({}, params), { referenceVersion: REFERENCE_API_V5, // Need to put this param to make it can query reaction for message in sub-channel
29879
29887
  options }),