@smartico/public-api 0.0.418 → 0.0.420

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 (35) hide show
  1. package/dist/ActivityLog/ActivityLogActivities.d.ts +2 -1
  2. package/dist/ActivityLog/GetActivityLogRequest.d.ts +1 -1
  3. package/dist/ActivityLog/PointChangeSourceType.d.ts +3 -1
  4. package/dist/Base/ClassId.d.ts +1 -0
  5. package/dist/SmarticoAPI.d.ts +4 -4
  6. package/dist/WSAPI/WSAPIMiniGames.d.ts +4 -4
  7. package/dist/WSAPI/WSAPIUser.d.ts +20 -6
  8. package/dist/index.js +51 -25
  9. package/dist/index.js.map +1 -1
  10. package/dist/index.modern.mjs +51 -25
  11. package/dist/index.modern.mjs.map +1 -1
  12. package/docs/api/README.md +5 -0
  13. package/docs/api/classes/WSAPIJackpots.md +3 -1
  14. package/docs/api/classes/WSAPIMiniGames.md +7 -2
  15. package/docs/api/classes/WSAPIUser.md +49 -0
  16. package/docs/api/enumerations/ActivityLogActivities.md +123 -0
  17. package/docs/api/enumerations/PointChangeSourceType.md +6 -0
  18. package/docs/api/interfaces/ActivityLogMeta.md +37 -0
  19. package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelRequest.md +47 -0
  20. package/docs/api/interfaces/SAWPrizeDropAknowledgeCancelResponse.md +41 -0
  21. package/docs/api/interfaces/SAWTemplateUI.md +1 -1
  22. package/docs/api/interfaces/TActivityLogEntry.md +100 -0
  23. package/docs/capabilities/getActivityLogV2.md +62 -0
  24. package/docs/capabilities/getJackpotWinners.md +3 -1
  25. package/docs/capabilities/miniGameWinAcknowledgeRequest.md +1 -1
  26. package/docs/native/PROTOCOL.md +33 -1
  27. package/package.json +1 -1
  28. package/src/ActivityLog/ActivityLogActivities.ts +1 -0
  29. package/src/ActivityLog/GetActivityLogRequest.ts +1 -3
  30. package/src/ActivityLog/PointChangeSourceType.ts +2 -0
  31. package/src/Base/ClassId.ts +2 -0
  32. package/src/SmarticoAPI.ts +11 -2
  33. package/src/WSAPI/WSAPIMiniGames.ts +4 -4
  34. package/src/WSAPI/WSAPIUser.ts +37 -11
  35. package/tsconfig.json +4 -1
@@ -1764,6 +1764,8 @@ class SmarticoAPI {
1764
1764
  endTimeSeconds: number,
1765
1765
  limit: number,
1766
1766
  offset: number,
1767
+ types?: number[],
1768
+ src_types?: number[],
1767
1769
  ): Promise<GetActivityLogResponse> {
1768
1770
  const message = this.buildMessage<GetActivityLogRequest, GetActivityLogResponse>(
1769
1771
  user_ext_id,
@@ -1773,6 +1775,8 @@ class SmarticoAPI {
1773
1775
  endTimeSeconds: Math.floor(endTimeSeconds),
1774
1776
  limit,
1775
1777
  offset,
1778
+ ...(types ? { types } : {}),
1779
+ ...(src_types ? { src_types } : {}),
1776
1780
  },
1777
1781
  );
1778
1782
 
@@ -1786,6 +1790,7 @@ class SmarticoAPI {
1786
1790
  limit: number,
1787
1791
  offset: number,
1788
1792
  types?: number[],
1793
+ src_types?: number[],
1789
1794
  ): Promise<GetActivityLogResponse> {
1790
1795
  const message = this.buildMessage<GetActivityLogRequest, GetActivityLogResponse>(
1791
1796
  user_ext_id,
@@ -1796,6 +1801,7 @@ class SmarticoAPI {
1796
1801
  limit,
1797
1802
  offset,
1798
1803
  ...(types ? { types } : {}),
1804
+ ...(src_types ? { src_types } : {}),
1799
1805
  },
1800
1806
  );
1801
1807
 
@@ -1808,12 +1814,14 @@ class SmarticoAPI {
1808
1814
  endTimeSeconds: number,
1809
1815
  from: number = 0,
1810
1816
  to: number = 50,
1817
+ types?: number[],
1818
+ src_types?: number[],
1811
1819
  ): Promise<TActivityLog[]> {
1812
1820
  const limit = to - from > 50 ? 50 : to - from;
1813
1821
  const offset = from;
1814
1822
 
1815
1823
  return ActivityLogTransform(
1816
- (await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset)).logHistory,
1824
+ (await this.getActivityLog(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory,
1817
1825
  );
1818
1826
  }
1819
1827
 
@@ -1824,12 +1832,13 @@ class SmarticoAPI {
1824
1832
  from: number = 0,
1825
1833
  to: number = 50,
1826
1834
  types?: number[],
1835
+ src_types?: number[],
1827
1836
  ): Promise<TActivityLogEntry[]> {
1828
1837
  const limit = to - from > 50 ? 50 : to - from;
1829
1838
  const offset = from;
1830
1839
 
1831
1840
  return ActivityLogV2Transform(
1832
- (await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types)).logHistory,
1841
+ (await this.getActivityLogV2(user_ext_id, startTimeSeconds, endTimeSeconds, limit, offset, types, src_types)).logHistory,
1833
1842
  );
1834
1843
  }
1835
1844
  }
@@ -545,10 +545,10 @@ export class WSAPIMiniGames extends WSAPIRaffles {
545
545
  * (played with `acknowledge: false`), or the
546
546
  * `client_request_id` of a
547
547
  * {@link getMiniGamesHistory} row.
548
- * @param options.lose Optional. When `true`, finalises the spin as
549
- * lost — the prize is not credited and returns
550
- * to the prize pool (see "Finalising as lost").
551
- * Omit (or pass `false`) to deliver the win.
548
+ * @param lose Optional. When `true`, finalises the spin as
549
+ * lost — the prize is not credited and returns
550
+ * to the prize pool (see "Finalising as lost").
551
+ * Omit (or pass `false`) to deliver the win.
552
552
  *
553
553
  * @example
554
554
  * ```ts
@@ -535,13 +535,18 @@ export class WSAPIUser extends WSAPIBase {
535
535
  * `from` by 50 between calls. Both `startTimeSeconds` and `endTimeSeconds`
536
536
  * are epoch seconds bounding the window the server scans.
537
537
  *
538
+ * **Filtering** — optional server-side filters (SMR-52608):
539
+ * - `types` — {@link ActivityLogActivities} / `type_id` values (e.g. Points=3, Gems=1)
540
+ * - `src_types` — {@link PointChangeSourceType} / `source_type_id` values
541
+ * Omit both for an unfiltered window.
542
+ *
538
543
  * **Subscription model (`onUpdate`)**
539
544
  * The callback fires when the user's `ach_points_balance`,
540
545
  * `ach_gems_balance`, or `ach_diamonds_balance` changes (i.e. whenever a
541
546
  * wallet event lands). The pushed payload is a FIXED re-fetch of the
542
547
  * **last 10 minutes / first 50 entries** — it does NOT honor the original
543
- * call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to`. Consumers
544
- * maintaining a long historical view must re-call `getActivityLog` with
548
+ * call's `startTimeSeconds` / `endTimeSeconds` / `from` / `to` / filters.
549
+ * Consumers maintaining a long historical view must re-call `getActivityLog` with
545
550
  * their own params after receiving an `onUpdate` notification.
546
551
  *
547
552
  * **Refresh**
@@ -565,6 +570,8 @@ export class WSAPIUser extends WSAPIBase {
565
570
  * endTimeSeconds: now,
566
571
  * from: 0,
567
572
  * to: 50,
573
+ * types: [1], // Gems only (ActivityLogActivities.Gems)
574
+ * src_types: [11], // Tournament wins only (PointChangeSourceType.Tournament)
568
575
  * onUpdate: (refreshed) => {
569
576
  * console.log('[smartico] wallet changed — refreshed payload is last 10 min / 50 entries:', refreshed.length, 'rows');
570
577
  * // If the consumer is showing a full 30-day view, re-call getActivityLog with the original params here.
@@ -582,6 +589,8 @@ export class WSAPIUser extends WSAPIBase {
582
589
  endTimeSeconds,
583
590
  from,
584
591
  to,
592
+ types,
593
+ src_types,
585
594
  onUpdate,
586
595
  }: {
587
596
  /** Window start in epoch seconds. */
@@ -592,30 +601,41 @@ export class WSAPIUser extends WSAPIBase {
592
601
  from: number;
593
602
  /** Pagination ceiling (exclusive); server caps `to - from` at 50. */
594
603
  to: number;
604
+ /** Optional — filter by {@link ActivityLogActivities} / `type_id`. */
605
+ types?: number[];
606
+ /** Optional — filter by {@link PointChangeSourceType} / `source_type_id`. */
607
+ src_types?: number[];
595
608
  /** Optional push callback; payload is a fixed 10-min / 50-entry refresh on every wallet change (see Subscription model). */
596
609
  onUpdate?: (data: TActivityLog[]) => void;
597
610
  }): Promise<TActivityLog[]> {
598
611
 
599
- const cacheKey = `${onUpdateContextKey.ActivityLog}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}`;
612
+ const cacheKey = `${onUpdateContextKey.ActivityLog}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${types?.join(',') ?? ''}:${src_types?.join(',') ?? ''}`;
600
613
 
601
614
  if (typeof onUpdate === 'function') {
602
615
  this.onUpdateCallback.set(onUpdateContextKey.ActivityLog, onUpdate);
603
616
  // Remember the requested window so a push refresh re-fetches THIS window
604
617
  // and writes the matching composite cache key (see notifyActivityLogUpdate).
605
- this.activityLogOnUpdateParams = { startTimeSeconds, endTimeSeconds, from, to };
618
+ this.activityLogOnUpdateParams = { startTimeSeconds, endTimeSeconds, from, to, types, src_types };
606
619
  }
607
620
 
608
621
  return await OCache.use(
609
622
  cacheKey,
610
623
  ECacheContext.WSAPI,
611
- () => this.api.getActivityLogT(this.userExtId, startTimeSeconds, endTimeSeconds, from, to),
624
+ () => this.api.getActivityLogT(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types, src_types),
612
625
  CACHE_DATA_SEC,
613
626
  );
614
627
  }
615
628
 
616
629
  /** @hidden Last window passed to `getActivityLog` with an `onUpdate`, so a push
617
630
  * refresh re-fetches the same window and updates its matching composite cache key. */
618
- private activityLogOnUpdateParams: { startTimeSeconds: number; endTimeSeconds: number; from: number; to: number } | undefined;
631
+ private activityLogOnUpdateParams: {
632
+ startTimeSeconds: number;
633
+ endTimeSeconds: number;
634
+ from: number;
635
+ to: number;
636
+ types?: number[];
637
+ src_types?: number[];
638
+ } | undefined;
619
639
 
620
640
  protected async notifyActivityLogUpdate() {
621
641
  const params = this.activityLogOnUpdateParams;
@@ -630,8 +650,10 @@ export class WSAPIUser extends WSAPIBase {
630
650
  params.endTimeSeconds,
631
651
  params.from,
632
652
  params.to,
653
+ params.types,
654
+ params.src_types,
633
655
  );
634
- const cacheKey = `${onUpdateContextKey.ActivityLog}:${params.startTimeSeconds}:${params.endTimeSeconds}:${params.from}:${params.to}`;
656
+ const cacheKey = `${onUpdateContextKey.ActivityLog}:${params.startTimeSeconds}:${params.endTimeSeconds}:${params.from}:${params.to}:${params.types?.join(',') ?? ''}:${params.src_types?.join(',') ?? ''}`;
635
657
 
636
658
  OCache.set(cacheKey, payload, ECacheContext.WSAPI);
637
659
 
@@ -652,8 +674,10 @@ export class WSAPIUser extends WSAPIBase {
652
674
  * **Pagination** — same `from` / `to` offset model as {@link getActivityLog}
653
675
  * (server caps a single response at 50 entries).
654
676
  *
655
- * **Filtering** — pass `types` with {@link ActivityLogActivities} values to
656
- * request a server-side subset (e.g. missions only). Omit for all activity types.
677
+ * **Filtering** — optional server-side filters:
678
+ * - `types` — {@link ActivityLogActivities} values (`type_id`)
679
+ * - `src_types` — {@link PointChangeSourceType} values (`source_type_id`)
680
+ * Omit both for all activity types / sources.
657
681
  *
658
682
  * @returns Array of {@link TActivityLogEntry} ordered newest-first.
659
683
  */
@@ -663,19 +687,21 @@ export class WSAPIUser extends WSAPIBase {
663
687
  from,
664
688
  to,
665
689
  types,
690
+ src_types,
666
691
  }: {
667
692
  startTimeSeconds: number;
668
693
  endTimeSeconds: number;
669
694
  from: number;
670
695
  to: number;
671
696
  types?: number[];
697
+ src_types?: number[];
672
698
  }): Promise<TActivityLogEntry[]> {
673
- const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${types?.join(',') ?? ''}`;
699
+ const cacheKey = `${onUpdateContextKey.ActivityLogV2}:${startTimeSeconds}:${endTimeSeconds}:${from}:${to}:${types?.join(',') ?? ''}:${src_types?.join(',') ?? ''}`;
674
700
 
675
701
  return await OCache.use(
676
702
  cacheKey,
677
703
  ECacheContext.WSAPI,
678
- () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types),
704
+ () => this.api.getActivityLogV2T(this.userExtId, startTimeSeconds, endTimeSeconds, from, to, types, src_types),
679
705
  CACHE_DATA_SEC,
680
706
  );
681
707
  }
package/tsconfig.json CHANGED
@@ -93,7 +93,10 @@
93
93
  "src/Avatars/AvatarCustomized.ts",
94
94
  "src/Avatars/AvatarPrompt.ts",
95
95
  "src/Avatars/AvatarCustomizeResponse.ts",
96
- "src/Avatars/AvatarCustomizeErrorCode.ts"
96
+ "src/Avatars/AvatarCustomizeErrorCode.ts",
97
+ "src/ActivityLog/ActivityLogEntry.ts",
98
+ "src/ActivityLog/ActivityLogActivities.ts",
99
+ "src/ActivityLog/ActivityLogMeta.ts",
97
100
  ],
98
101
  "out": "docs/api",
99
102
  "projectDocuments": ["docs/SmarticoObject.md", "docs/Callbacks.md", "docs/Transforms.md"],