@ermis-network/ermis-chat-sdk 1.0.0 → 1.0.2
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/README.md +9 -0
- package/dist/index.browser.cjs +12 -5
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.full-bundle.min.js +11 -11
- package/dist/index.browser.full-bundle.min.js.map +1 -1
- package/dist/index.browser.mjs +12 -5
- package/dist/index.browser.mjs.map +1 -1
- package/dist/index.cjs +12 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.mjs +12 -5
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +17 -6
package/dist/index.d.mts
CHANGED
|
@@ -1085,8 +1085,9 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
|
|
|
1085
1085
|
searchPublicChannel(search_term: string, offset?: number, limit?: number): Promise<APIResponse>;
|
|
1086
1086
|
pinChannel(channelType: string, channelId: string): Promise<APIResponse>;
|
|
1087
1087
|
unpinChannel(channelType: string, channelId: string): Promise<APIResponse>;
|
|
1088
|
-
channel(
|
|
1089
|
-
|
|
1088
|
+
channel(type: string, custom?: ChannelData<ErmisChatGenerics>): Channel<ErmisChatGenerics>;
|
|
1089
|
+
channel(type: string, id: string, custom?: ChannelData<ErmisChatGenerics>): Channel<ErmisChatGenerics>;
|
|
1090
|
+
getChannelById: (channelType: string, channelID: string | undefined, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
|
|
1090
1091
|
getChannel: (channelType: string, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
|
|
1091
1092
|
_normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
|
|
1092
1093
|
getUserAgent(): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1085,8 +1085,9 @@ declare class ErmisChat<ErmisChatGenerics extends ExtendableGenerics = DefaultGe
|
|
|
1085
1085
|
searchPublicChannel(search_term: string, offset?: number, limit?: number): Promise<APIResponse>;
|
|
1086
1086
|
pinChannel(channelType: string, channelId: string): Promise<APIResponse>;
|
|
1087
1087
|
unpinChannel(channelType: string, channelId: string): Promise<APIResponse>;
|
|
1088
|
-
channel(
|
|
1089
|
-
|
|
1088
|
+
channel(type: string, custom?: ChannelData<ErmisChatGenerics>): Channel<ErmisChatGenerics>;
|
|
1089
|
+
channel(type: string, id: string, custom?: ChannelData<ErmisChatGenerics>): Channel<ErmisChatGenerics>;
|
|
1090
|
+
getChannelById: (channelType: string, channelID: string | undefined, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
|
|
1090
1091
|
getChannel: (channelType: string, custom: ChannelData<ErmisChatGenerics>) => Channel<ErmisChatGenerics>;
|
|
1091
1092
|
_normalizeExpiration(timeoutOrExpirationDate?: null | number | string | Date): string | null;
|
|
1092
1093
|
getUserAgent(): string;
|
package/dist/index.mjs
CHANGED
|
@@ -3545,17 +3545,24 @@ var ErmisChat = class _ErmisChat {
|
|
|
3545
3545
|
async unpinChannel(channelType, channelId) {
|
|
3546
3546
|
return await this.post(this.baseURL + `/channels/${channelType}/${channelId}/unpin`);
|
|
3547
3547
|
}
|
|
3548
|
-
channel(channelType,
|
|
3548
|
+
channel(channelType, channelIDOrCustom, custom) {
|
|
3549
3549
|
if (!this.userID) {
|
|
3550
3550
|
throw Error("Call connectUser before creating a channel");
|
|
3551
3551
|
}
|
|
3552
3552
|
if (~channelType.indexOf(":")) {
|
|
3553
3553
|
throw Error(`Invalid channel group ${channelType}, can't contain the : character`);
|
|
3554
3554
|
}
|
|
3555
|
-
|
|
3555
|
+
let channelID = void 0;
|
|
3556
|
+
let customData = custom || {};
|
|
3557
|
+
if (typeof channelIDOrCustom === "string") {
|
|
3558
|
+
channelID = channelIDOrCustom;
|
|
3559
|
+
} else if (typeof channelIDOrCustom === "object" && channelIDOrCustom !== null) {
|
|
3560
|
+
customData = channelIDOrCustom;
|
|
3561
|
+
}
|
|
3562
|
+
return this.getChannelById(channelType, channelID, customData);
|
|
3556
3563
|
}
|
|
3557
3564
|
getChannelById = (channelType, channelID, custom) => {
|
|
3558
|
-
const cid = `${channelType}:${channelID}`;
|
|
3565
|
+
const cid = `${channelType}:${channelID || ""}`;
|
|
3559
3566
|
if (cid in this.activeChannels && !this.activeChannels[cid].disconnected) {
|
|
3560
3567
|
const channel2 = this.activeChannels[cid];
|
|
3561
3568
|
if (Object.keys(custom).length > 0) {
|
|
@@ -3598,7 +3605,7 @@ var ErmisChat = class _ErmisChat {
|
|
|
3598
3605
|
return pinExpires;
|
|
3599
3606
|
}
|
|
3600
3607
|
getUserAgent() {
|
|
3601
|
-
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.
|
|
3608
|
+
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.2"}`;
|
|
3602
3609
|
}
|
|
3603
3610
|
setUserAgent(userAgent) {
|
|
3604
3611
|
this.userAgent = userAgent;
|
|
@@ -6932,7 +6939,7 @@ var ErmisAuthProvider = class {
|
|
|
6932
6939
|
return data;
|
|
6933
6940
|
}
|
|
6934
6941
|
getUserAgent() {
|
|
6935
|
-
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.
|
|
6942
|
+
return this.userAgent || `ermis-chat-sdk-javascript-client-${this.node ? "node" : "browser"}-${"1.0.2"}`;
|
|
6936
6943
|
}
|
|
6937
6944
|
setUserAgent(userAgent) {
|
|
6938
6945
|
this.userAgent = userAgent;
|