stream-chat 8.56.1 → 8.57.1
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/dist/browser.es.js +57 -39
- package/dist/browser.es.js.map +1 -1
- package/dist/browser.full-bundle.min.js +1 -1
- package/dist/browser.full-bundle.min.js.map +1 -1
- package/dist/browser.js +57 -39
- package/dist/browser.js.map +1 -1
- package/dist/index.es.js +57 -39
- package/dist/index.es.js.map +1 -1
- package/dist/index.js +57 -39
- package/dist/index.js.map +1 -1
- package/dist/types/campaign.d.ts +18 -2
- package/dist/types/campaign.d.ts.map +1 -1
- package/dist/types/channel_manager.d.ts +2 -2
- package/dist/types/channel_manager.d.ts.map +1 -1
- package/dist/types/client.d.ts +33 -10
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/types.d.ts +14 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/campaign.ts +3 -3
- package/src/channel_manager.ts +4 -1
- package/src/client.ts +53 -15
- package/src/types.ts +9 -0
package/src/client.ts
CHANGED
|
@@ -100,6 +100,7 @@ import {
|
|
|
100
100
|
FlagUserResponse,
|
|
101
101
|
GetBlockedUsersAPIResponse,
|
|
102
102
|
GetCallTokenResponse,
|
|
103
|
+
GetCampaignOptions,
|
|
103
104
|
GetChannelTypeResponse,
|
|
104
105
|
GetCommandResponse,
|
|
105
106
|
GetImportResponse,
|
|
@@ -173,6 +174,7 @@ import {
|
|
|
173
174
|
ReservedMessageFields,
|
|
174
175
|
ReviewFlagReportOptions,
|
|
175
176
|
ReviewFlagReportResponse,
|
|
177
|
+
SdkIdentifier,
|
|
176
178
|
SearchAPIResponse,
|
|
177
179
|
SearchMessageSortBase,
|
|
178
180
|
SearchOptions,
|
|
@@ -274,6 +276,7 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
274
276
|
insightMetrics: InsightMetrics;
|
|
275
277
|
defaultWSTimeoutWithFallback: number;
|
|
276
278
|
defaultWSTimeout: number;
|
|
279
|
+
sdkIdentifier?: SdkIdentifier;
|
|
277
280
|
private nextRequestAbortController: AbortController | null = null;
|
|
278
281
|
|
|
279
282
|
/**
|
|
@@ -2916,11 +2919,21 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
2916
2919
|
}
|
|
2917
2920
|
|
|
2918
2921
|
getUserAgent() {
|
|
2919
|
-
|
|
2920
|
-
this.userAgent
|
|
2921
|
-
|
|
2922
|
+
if (this.userAgent) {
|
|
2923
|
+
return this.userAgent;
|
|
2924
|
+
}
|
|
2925
|
+
const version = process.env.PKG_VERSION;
|
|
2926
|
+
if (this.sdkIdentifier) {
|
|
2927
|
+
return `stream-chat-${this.sdkIdentifier.name}-v${this.sdkIdentifier.version}-llc-v${version}`;
|
|
2928
|
+
} else {
|
|
2929
|
+
return `stream-chat-js-v${version}-${this.node ? 'node' : 'browser'}`;
|
|
2930
|
+
}
|
|
2922
2931
|
}
|
|
2923
2932
|
|
|
2933
|
+
/**
|
|
2934
|
+
* @deprecated use sdkIdentifier instead
|
|
2935
|
+
* @param userAgent
|
|
2936
|
+
*/
|
|
2924
2937
|
setUserAgent(userAgent: string) {
|
|
2925
2938
|
this.userAgent = userAgent;
|
|
2926
2939
|
}
|
|
@@ -3407,25 +3420,44 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
3407
3420
|
*/
|
|
3408
3421
|
async createCampaign(params: CampaignData) {
|
|
3409
3422
|
this.validateServerSideAuth();
|
|
3410
|
-
return this.post<
|
|
3423
|
+
return this.post<
|
|
3424
|
+
{
|
|
3425
|
+
campaign: CampaignResponse;
|
|
3426
|
+
users: {
|
|
3427
|
+
next?: string;
|
|
3428
|
+
prev?: string;
|
|
3429
|
+
};
|
|
3430
|
+
} & APIResponse
|
|
3431
|
+
>(this.baseURL + `/campaigns`, { ...params });
|
|
3411
3432
|
}
|
|
3412
3433
|
|
|
3413
|
-
async getCampaign(id: string) {
|
|
3434
|
+
async getCampaign(id: string, options?: GetCampaignOptions) {
|
|
3414
3435
|
this.validateServerSideAuth();
|
|
3415
|
-
return this.get<
|
|
3416
|
-
|
|
3417
|
-
|
|
3436
|
+
return this.get<
|
|
3437
|
+
{
|
|
3438
|
+
campaign: CampaignResponse;
|
|
3439
|
+
users: {
|
|
3440
|
+
next?: string;
|
|
3441
|
+
prev?: string;
|
|
3442
|
+
};
|
|
3443
|
+
} & APIResponse
|
|
3444
|
+
>(this.baseURL + `/campaigns/${encodeURIComponent(id)}`, { ...options?.users });
|
|
3418
3445
|
}
|
|
3419
3446
|
|
|
3420
3447
|
async startCampaign(id: string, options?: { scheduledFor?: string; stopAt?: string }) {
|
|
3421
3448
|
this.validateServerSideAuth();
|
|
3422
|
-
return this.post<
|
|
3423
|
-
this.baseURL + `/campaigns/${encodeURIComponent(id)}/start`,
|
|
3449
|
+
return this.post<
|
|
3424
3450
|
{
|
|
3425
|
-
|
|
3426
|
-
|
|
3427
|
-
|
|
3428
|
-
|
|
3451
|
+
campaign: CampaignResponse;
|
|
3452
|
+
users: {
|
|
3453
|
+
next?: string;
|
|
3454
|
+
prev?: string;
|
|
3455
|
+
};
|
|
3456
|
+
} & APIResponse
|
|
3457
|
+
>(this.baseURL + `/campaigns/${encodeURIComponent(id)}/start`, {
|
|
3458
|
+
scheduled_for: options?.scheduledFor,
|
|
3459
|
+
stop_at: options?.stopAt,
|
|
3460
|
+
});
|
|
3429
3461
|
}
|
|
3430
3462
|
/**
|
|
3431
3463
|
* queryCampaigns - Query Campaigns
|
|
@@ -3458,7 +3490,13 @@ export class StreamChat<StreamChatGenerics extends ExtendableGenerics = DefaultG
|
|
|
3458
3490
|
*/
|
|
3459
3491
|
async updateCampaign(id: string, params: Partial<CampaignData>) {
|
|
3460
3492
|
this.validateServerSideAuth();
|
|
3461
|
-
return this.put<{
|
|
3493
|
+
return this.put<{
|
|
3494
|
+
campaign: CampaignResponse;
|
|
3495
|
+
users: {
|
|
3496
|
+
next?: string;
|
|
3497
|
+
prev?: string;
|
|
3498
|
+
};
|
|
3499
|
+
}>(this.baseURL + `/campaigns/${encodeURIComponent(id)}`, params);
|
|
3462
3500
|
}
|
|
3463
3501
|
|
|
3464
3502
|
/**
|
package/src/types.ts
CHANGED
|
@@ -3000,6 +3000,10 @@ export type QuerySegmentTargetsFilter = {
|
|
|
3000
3000
|
};
|
|
3001
3001
|
export type QuerySegmentTargetsOptions = Pick<Pager, 'next' | 'limit'>;
|
|
3002
3002
|
|
|
3003
|
+
export type GetCampaignOptions = {
|
|
3004
|
+
users?: { limit?: number; next?: string; prev?: string };
|
|
3005
|
+
};
|
|
3006
|
+
|
|
3003
3007
|
export type CampaignSort = {
|
|
3004
3008
|
field: string;
|
|
3005
3009
|
direction?: number;
|
|
@@ -3010,6 +3014,7 @@ export type CampaignQueryOptions = {
|
|
|
3010
3014
|
next?: string;
|
|
3011
3015
|
prev?: string;
|
|
3012
3016
|
sort?: CampaignSort;
|
|
3017
|
+
user_limit?: number;
|
|
3013
3018
|
};
|
|
3014
3019
|
|
|
3015
3020
|
export type SegmentQueryOptions = CampaignQueryOptions;
|
|
@@ -3050,6 +3055,8 @@ export type CampaignStats = {
|
|
|
3050
3055
|
stats_completed_at?: string;
|
|
3051
3056
|
stats_messages_sent?: number;
|
|
3052
3057
|
stats_started_at?: string;
|
|
3058
|
+
stats_users_read?: number;
|
|
3059
|
+
stats_users_sent?: number;
|
|
3053
3060
|
};
|
|
3054
3061
|
export type CampaignResponse = {
|
|
3055
3062
|
created_at: string;
|
|
@@ -3808,3 +3815,5 @@ export type PromoteChannelParams<SCG extends ExtendableGenerics = DefaultGeneric
|
|
|
3808
3815
|
*/
|
|
3809
3816
|
channelToMoveIndexWithinChannels?: number;
|
|
3810
3817
|
};
|
|
3818
|
+
|
|
3819
|
+
export type SdkIdentifier = { name: 'react' | 'react-native' | 'angular'; version: string };
|