stream-chat 7.0.0 → 7.2.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.
package/src/types.ts CHANGED
@@ -103,6 +103,7 @@ export type AppSettingsAPIResponse<StreamChatGenerics extends ExtendableGenerics
103
103
  >;
104
104
  reminders_interval: number;
105
105
  agora_options?: AgoraOptions | null;
106
+ async_moderation_config?: AsyncModerationOptions;
106
107
  async_url_enrich_enabled?: boolean;
107
108
  auto_translation_enabled?: boolean;
108
109
  before_message_send_hook_url?: string;
@@ -1505,6 +1506,14 @@ export type HMSOptions = {
1505
1506
  role_map?: Record<string, string>;
1506
1507
  };
1507
1508
 
1509
+ export type AsyncModerationOptions = {
1510
+ callback?: {
1511
+ mode?: 'CALLBACK_MODE_NONE' | 'CALLBACK_MODE_REST' | 'CALLBACK_MODE_TWIRP';
1512
+ server_url?: string;
1513
+ };
1514
+ timeout_ms?: number;
1515
+ };
1516
+
1508
1517
  export type AppSettings = {
1509
1518
  agora_options?: AgoraOptions | null;
1510
1519
  apn_config?: {
@@ -1518,6 +1527,7 @@ export type AppSettings = {
1518
1527
  p12_cert?: string;
1519
1528
  team_id?: string;
1520
1529
  };
1530
+ async_moderation_config?: AsyncModerationOptions;
1521
1531
  async_url_enrich_enabled?: boolean;
1522
1532
  auto_translation_enabled?: boolean;
1523
1533
  before_message_send_hook_url?: string;
@@ -1763,9 +1773,10 @@ export type CommandVariants<StreamChatGenerics extends ExtendableGenerics = Defa
1763
1773
  | 'unmute'
1764
1774
  | StreamChatGenerics['commandType'];
1765
1775
 
1766
- export type Configs<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
1767
- [channel_type: string]: ChannelConfigWithInfo<StreamChatGenerics> | undefined;
1768
- };
1776
+ export type Configs<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = Record<
1777
+ string,
1778
+ ChannelConfigWithInfo<StreamChatGenerics> | undefined
1779
+ >;
1769
1780
 
1770
1781
  export type ConnectionOpen<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
1771
1782
  connection_id: string;
@@ -1896,7 +1907,7 @@ export type EndpointName =
1896
1907
  | 'GetRateLimits'
1897
1908
  | 'CreateSegment'
1898
1909
  | 'GetSegment'
1899
- | 'ListSegments'
1910
+ | 'QuerySegments'
1900
1911
  | 'UpdateSegment'
1901
1912
  | 'DeleteSegment'
1902
1913
  | 'CreateCampaign'
@@ -2278,46 +2289,71 @@ export type DeleteUserOptions = {
2278
2289
 
2279
2290
  export type SegmentData = {
2280
2291
  description: string;
2281
- // TODO: define this type in more detail
2282
- filter: {
2283
- channel?: object;
2284
- user?: object;
2285
- };
2292
+ filter: {};
2286
2293
  name: string;
2294
+ type: 'channel' | 'user';
2287
2295
  };
2288
2296
 
2289
2297
  export type Segment = {
2290
- app_pk: number;
2291
2298
  created_at: string;
2292
2299
  id: string;
2300
+ in_use: boolean;
2301
+ size: number;
2302
+ status: 'computing' | 'ready';
2293
2303
  updated_at: string;
2294
- recipients?: number;
2295
2304
  } & SegmentData;
2296
2305
 
2306
+ export type CampaignSortField = {
2307
+ field: string;
2308
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
2309
+ value: any;
2310
+ };
2311
+
2312
+ export type CampaignSort = {
2313
+ fields: CampaignSortField[];
2314
+ direction?: 'asc' | 'desc';
2315
+ };
2316
+
2317
+ export type CampaignQueryOptions = {
2318
+ limit?: number;
2319
+ sort?: CampaignSort;
2320
+ };
2321
+
2322
+ export type SegmentQueryOptions = CampaignQueryOptions;
2323
+ export type RecipientQueryOptions = CampaignQueryOptions;
2324
+
2325
+ // TODO: add better typing
2326
+ export type SegmentFilters = {};
2327
+ export type CampaignFilters = {};
2328
+ export type RecipientFilters = {};
2329
+
2297
2330
  export type CampaignData = {
2298
2331
  attachments: Attachment[];
2332
+ channel_type: string;
2299
2333
  defaults: Record<string, string>;
2300
2334
  name: string;
2301
2335
  segment_id: string;
2302
2336
  text: string;
2303
2337
  description?: string;
2304
- push_notifications?: boolean;
2305
2338
  sender_id?: string;
2306
2339
  };
2307
2340
 
2341
+ export type CampaignStatusName = 'draft' | 'stopped' | 'scheduled' | 'completed' | 'failed' | 'in_progress';
2342
+
2308
2343
  export type CampaignStatus = {
2309
- errors: string[];
2310
- status: 'draft' | 'stopped' | 'scheduled' | 'completed' | 'failed' | 'canceled' | 'in_progress';
2344
+ status: CampaignStatusName;
2311
2345
  completed_at?: string;
2346
+ errored_messages?: number;
2312
2347
  failed_at?: string;
2313
- progress?: number;
2314
2348
  resumed_at?: string;
2315
2349
  scheduled_at?: string;
2350
+ scheduled_for?: string;
2351
+ sent_messages?: number;
2316
2352
  stopped_at?: string;
2353
+ task_id?: string;
2317
2354
  };
2318
2355
 
2319
2356
  export type Campaign = {
2320
- app_pk: string;
2321
2357
  created_at: string;
2322
2358
  id: string;
2323
2359
  updated_at: string;
@@ -2325,8 +2361,24 @@ export type Campaign = {
2325
2361
  CampaignStatus;
2326
2362
 
2327
2363
  export type TestCampaignResponse = {
2328
- campaign?: Campaign;
2329
- invalid_users?: Record<string, string>;
2364
+ status: CampaignStatusName;
2365
+ details?: string;
2366
+ results?: Record<string, string>;
2367
+ };
2368
+
2369
+ export type DeleteCampaignOptions = {
2370
+ recipients?: boolean;
2371
+ };
2372
+
2373
+ export type Recipient = {
2374
+ campaign_id: string;
2375
+ channel_cid: string;
2376
+ created_at: string;
2377
+ status: 'pending' | 'sent' | 'failed';
2378
+ updated_at: string;
2379
+ details?: string;
2380
+ message_id?: string;
2381
+ receiver_id?: string;
2330
2382
  };
2331
2383
 
2332
2384
  export type TaskStatus = {
@@ -2404,38 +2456,38 @@ export type PushProviderListResponse = {
2404
2456
  };
2405
2457
 
2406
2458
  export type CreateCallOptions<StreamChatGenerics extends ExtendableGenerics = DefaultGenerics> = {
2407
- id: String;
2408
- type: String;
2409
- options?: Object;
2459
+ id: string;
2460
+ type: string;
2461
+ options?: UR;
2410
2462
  user?: UserResponse<StreamChatGenerics> | null;
2411
2463
  user_id?: string;
2412
2464
  };
2413
2465
 
2414
2466
  export type HMSCall = {
2415
- room: String;
2467
+ room: string;
2416
2468
  };
2417
2469
 
2418
2470
  export type AgoraCall = {
2419
- channel: String;
2471
+ channel: string;
2420
2472
  };
2421
2473
 
2422
2474
  export type Call = {
2423
- id: String;
2424
- provider: String;
2475
+ id: string;
2476
+ provider: string;
2425
2477
  agora?: AgoraCall;
2426
2478
  hms?: HMSCall;
2427
2479
  };
2428
2480
 
2429
2481
  export type CreateCallResponse = APIResponse & {
2430
2482
  call: Call;
2431
- token: String;
2432
- agora_app_id?: String;
2483
+ token: string;
2484
+ agora_app_id?: string;
2433
2485
  agora_uid?: number;
2434
2486
  };
2435
2487
 
2436
2488
  export type GetCallTokenResponse = APIResponse & {
2437
- token: String;
2438
- agora_app_id?: String;
2489
+ token: string;
2490
+ agora_app_id?: string;
2439
2491
  agora_uid?: number;
2440
2492
  };
2441
2493