@wix/himalaya-cli 0.1571.0 → 0.1572.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.
@@ -66,6 +66,12 @@ export interface MfvNotification {
66
66
  export declare function __resetMfvRouteForTests(): void;
67
67
  /** List the signed-in member's notifications, newest first. MOBILE channel. */
68
68
  export declare function queryNotifications(limit?: number, options?: WixCallOptions): Promise<MfvNotification[]>;
69
+ /** Source member-app MOBILE/UNSEEN aggregate, capped at 100. Requires a bound
70
+ * single-site Member transport; old native binaries and web reject. A missing,
71
+ * malformed or failed result is unavailable, never an authoritative zero. */
72
+ export declare function countUnseenNotifications(options: {
73
+ site: string;
74
+ }): Promise<number>;
69
75
  /** Mark the given notification ids as READ (bulk, by-filter). */
70
76
  export declare function markRead(ids: string[]): Promise<void>;
71
77
  /** Mark ALL of the member's MOBILE notifications that aren't already READ as READ. */
@@ -61,6 +61,23 @@ async function queryNotifications(limit = 25, options) {
61
61
  );
62
62
  return res.viewerFeedNotifications ?? [];
63
63
  }
64
+ async function countUnseenNotifications(options) {
65
+ const site = options?.site;
66
+ if (typeof site !== "string" || !/^[a-f\d]{8}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{4}-[a-f\d]{12}$/i.test(site)) {
67
+ throw new Error("@himalaya/wix-members-feed-viewer: notification count requires its bound site");
68
+ }
69
+ const res = await wixCall(
70
+ "POST",
71
+ "https://apps.wix.com/_api/members-feed-viewer/v1/members-viewer-feed-notifications/count",
72
+ { filter: { channel: "MOBILE", status: "UNSEEN" }, maxCount: 100 },
73
+ { site }
74
+ );
75
+ const count = res?.count;
76
+ if (typeof count !== "number" || !Number.isSafeInteger(count) || count < 0 || count > 100) {
77
+ throw new Error("@himalaya/wix-members-feed-viewer: unavailable unseen notification count");
78
+ }
79
+ return count;
80
+ }
64
81
  async function markRead(ids) {
65
82
  if (!ids.length) return;
66
83
  await mfvCall(
@@ -78,6 +95,7 @@ async function markAllRead() {
78
95
  }
79
96
  export {
80
97
  __resetMfvRouteForTests,
98
+ countUnseenNotifications,
81
99
  markAllRead,
82
100
  markRead,
83
101
  queryNotifications