@ermis-network/ermis-chat-sdk 1.0.7 → 1.0.9
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/index.browser.cjs +16 -2
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.full-bundle.min.js +2 -2
- package/dist/index.browser.full-bundle.min.js.map +1 -1
- package/dist/index.browser.mjs +16 -2
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.cjs +16 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +9 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.mjs +16 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +15 -0
package/dist/index.d.mts
CHANGED
|
@@ -1210,6 +1210,15 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
|
|
|
1210
1210
|
patch<T>(url: string, data?: unknown): Promise<T>;
|
|
1211
1211
|
delete<T>(url: string, params?: AxiosRequestConfig['params']): Promise<T>;
|
|
1212
1212
|
sendFile(url: string, uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse<ErmisChatGenerics>): Promise<SendFileAPIResponse>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Downloads a media file as a Blob via the SDK's configured axiosInstance.
|
|
1215
|
+
* This avoids CORS issues that arise when using `fetch()` directly from the browser,
|
|
1216
|
+
* because axios is routed through the SDK's authenticated transport layer.
|
|
1217
|
+
*
|
|
1218
|
+
* @param url - The full URL of the media file to download.
|
|
1219
|
+
* @returns A Blob of the file content.
|
|
1220
|
+
*/
|
|
1221
|
+
downloadMedia(url: string): Promise<Blob>;
|
|
1213
1222
|
errorFromResponse(response: AxiosResponse<APIErrorResponse>): ErrorFromResponse<APIErrorResponse>;
|
|
1214
1223
|
handleResponse<T>(response: AxiosResponse<T>): T;
|
|
1215
1224
|
dispatchEvent: (event: Event$1<ErmisChatGenerics>) => void;
|
package/dist/index.d.ts
CHANGED
|
@@ -1210,6 +1210,15 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
|
|
|
1210
1210
|
patch<T>(url: string, data?: unknown): Promise<T>;
|
|
1211
1211
|
delete<T>(url: string, params?: AxiosRequestConfig['params']): Promise<T>;
|
|
1212
1212
|
sendFile(url: string, uri: string | NodeJS.ReadableStream | Buffer | File, name?: string, contentType?: string, user?: UserResponse<ErmisChatGenerics>): Promise<SendFileAPIResponse>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Downloads a media file as a Blob via the SDK's configured axiosInstance.
|
|
1215
|
+
* This avoids CORS issues that arise when using `fetch()` directly from the browser,
|
|
1216
|
+
* because axios is routed through the SDK's authenticated transport layer.
|
|
1217
|
+
*
|
|
1218
|
+
* @param url - The full URL of the media file to download.
|
|
1219
|
+
* @returns A Blob of the file content.
|
|
1220
|
+
*/
|
|
1221
|
+
downloadMedia(url: string): Promise<Blob>;
|
|
1213
1222
|
errorFromResponse(response: AxiosResponse<APIErrorResponse>): ErrorFromResponse<APIErrorResponse>;
|
|
1214
1223
|
handleResponse<T>(response: AxiosResponse<T>): T;
|
|
1215
1224
|
dispatchEvent: (event: Event$1<ErmisChatGenerics>) => void;
|
package/dist/index.mjs
CHANGED
|
@@ -3197,6 +3197,20 @@ var ErmisChat = class _ErmisChat {
|
|
|
3197
3197
|
}
|
|
3198
3198
|
});
|
|
3199
3199
|
}
|
|
3200
|
+
/**
|
|
3201
|
+
* Downloads a media file as a Blob via the SDK's configured axiosInstance.
|
|
3202
|
+
* This avoids CORS issues that arise when using `fetch()` directly from the browser,
|
|
3203
|
+
* because axios is routed through the SDK's authenticated transport layer.
|
|
3204
|
+
*
|
|
3205
|
+
* @param url - The full URL of the media file to download.
|
|
3206
|
+
* @returns A Blob of the file content.
|
|
3207
|
+
*/
|
|
3208
|
+
async downloadMedia(url) {
|
|
3209
|
+
const response = await this.axiosInstance.get(url, {
|
|
3210
|
+
responseType: "blob"
|
|
3211
|
+
});
|
|
3212
|
+
return response.data;
|
|
3213
|
+
}
|
|
3200
3214
|
errorFromResponse(response) {
|
|
3201
3215
|
let err;
|
|
3202
3216
|
err = new ErrorFromResponse(`ErmisChat error HTTP code: ${response.status}`);
|
|
@@ -3901,7 +3915,7 @@ var ErmisChat = class _ErmisChat {
|
|
|
3901
3915
|
return pinExpires;
|
|
3902
3916
|
}
|
|
3903
3917
|
getUserAgent() {
|
|
3904
|
-
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.
|
|
3918
|
+
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.9"}`;
|
|
3905
3919
|
}
|
|
3906
3920
|
setUserAgent(userAgent) {
|
|
3907
3921
|
this.userAgent = userAgent;
|
|
@@ -7260,7 +7274,7 @@ var ErmisAuthProvider = class {
|
|
|
7260
7274
|
return data;
|
|
7261
7275
|
}
|
|
7262
7276
|
getUserAgent() {
|
|
7263
|
-
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.
|
|
7277
|
+
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.9"}`;
|
|
7264
7278
|
}
|
|
7265
7279
|
setUserAgent(userAgent) {
|
|
7266
7280
|
this.userAgent = userAgent;
|