@talkjs/core 1.7.0 → 1.8.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.
@@ -1698,6 +1698,17 @@ export declare interface ParticipantRef {
1698
1698
  * @returns A promise that resolves when the operation completes. This promise will reject if client-side conversation syncing is disabled.
1699
1699
  */
1700
1700
  delete(): Promise<void>;
1701
+ /**
1702
+ * Subscribe to this participant's state.
1703
+ *
1704
+ * @remarks
1705
+ * While the subscription is active, `onSnapshot` will be called when the participant joins or leaves the conversation, or their attributes change, including attributes on their user.
1706
+ *
1707
+ * Remember to call `.unsubscribe` on the subscription once you are done with it.
1708
+ *
1709
+ * @returns A subscription to the participant
1710
+ */
1711
+ subscribe(onSnapshot?: (snapshot: ParticipantSnapshot | null) => void): SingleParticipantSubscription;
1701
1712
  }
1702
1713
 
1703
1714
  /**
@@ -2279,6 +2290,64 @@ export declare interface SetUserParams {
2279
2290
  pushTokens?: Record<string, true | null> | null;
2280
2291
  }
2281
2292
 
2293
+ /**
2294
+ * The state of a participant subscription when it is actively listening for changes
2295
+ *
2296
+ * @public
2297
+ */
2298
+ export declare interface SingleParticipantActiveState {
2299
+ readonly type: "active";
2300
+ /**
2301
+ * The most recently received snapshot for the participant, or `null` if they are not a participant in that conversation.
2302
+ */
2303
+ readonly latestSnapshot: ParticipantSnapshot | null;
2304
+ }
2305
+
2306
+ /**
2307
+ * A subscription to a specific participant.
2308
+ *
2309
+ * @remarks
2310
+ * Get a SingleParticipantSubscription by calling {@link ParticipantRef.subscribe}
2311
+ *
2312
+ * Remember to `.unsubscribe` the subscription once you are done with it.
2313
+ *
2314
+ * @public
2315
+ */
2316
+ export declare interface SingleParticipantSubscription {
2317
+ /**
2318
+ * The current state of the subscription
2319
+ *
2320
+ * @remarks
2321
+ * An object with the following fields:
2322
+ *
2323
+ * `type` is one of "pending", "active", "unsubscribed", or "error".
2324
+ *
2325
+ * When `type` is "active", includes `latestSnapshot: ParticipantSnapshot | null`, the current state of the participant.
2326
+ * `latestSnapshot` is `null` when the user is not a participant or the conversation does not exist.
2327
+ *
2328
+ * When `type` is "error", includes the `error` field. It is a JS `Error` object explaining what caused the subscription to be terminated.
2329
+ */
2330
+ state: PendingState | SingleParticipantActiveState | UnsubscribedState | ErrorState;
2331
+ /**
2332
+ * Resolves when the subscription starts receiving updates from the server.
2333
+ */
2334
+ readonly connected: Promise<SingleParticipantActiveState>;
2335
+ /**
2336
+ * Resolves when the subscription permanently stops receiving updates from the server.
2337
+ *
2338
+ * @remarks
2339
+ * This is either because you unsubscribed or because the subscription encountered an unrecoverable error.
2340
+ */
2341
+ readonly terminated: Promise<UnsubscribedState | ErrorState>;
2342
+ /**
2343
+ * Unsubscribe from this resource and stop receiving updates.
2344
+ *
2345
+ * @remarks
2346
+ * If the subscription is already in the "unsubscribed" or "error" state, this is a no-op.
2347
+ */
2348
+ unsubscribe(): void;
2349
+ }
2350
+
2282
2351
  export declare type Subscription = {
2283
2352
  unsubscribe: () => void;
2284
2353
  };
@@ -2439,6 +2508,8 @@ export declare interface TalkSession {
2439
2508
  * Creates a search for messages in all the current user's conversations.
2440
2509
  *
2441
2510
  * @remarks
2511
+ * The search feature is available on the Growth plan or higher. On the Basic plan, this method will return an error.
2512
+ *
2442
2513
  * Search is a two-step process. After calling `searchMessages`, call {@link MessageSearch.setQuery} to specify a search query and begin the search.
2443
2514
  *
2444
2515
  * As search can be quite slow, there are two different ways of using search:
@@ -2480,6 +2551,8 @@ export declare interface TalkSession {
2480
2551
  * Creates a search for all the current user's conversations.
2481
2552
  *
2482
2553
  * @remarks
2554
+ * The search feature is available on the Growth plan or higher. On the Basic plan, this method will return an error.
2555
+ *
2483
2556
  * Search is a two-step process. After calling `searchConversations`, call {@link ConversationSearch.setQuery} to specify a search query and begin the search.
2484
2557
  *
2485
2558
  * As search can be quite slow, there are two different ways of using search: