@cometchat/chat-sdk-javascript 4.0.7 → 4.0.8

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 CHANGED
@@ -2,134 +2,21 @@
2
2
  <img alt="CometChat" src="https://assets.cometchat.io/website/images/logos/banner.png">
3
3
  </p>
4
4
 
5
- # CometChat Javascript SDK
5
+ # CometChat SDK for Javascript
6
+ The CometChat SDK is a robust toolkit that developers can utilize to swiftly incorporate a reliable and fully-featured chat functionality into an existing or new application. It removes the complexity of building a chat infrastructure from scratch, thus accelerating the development process and reducing time to market.
6
7
 
7
- CometChat enables you to add voice, video & text chat for your website & app.
8
- This guide demonstrates how to add chat to a WebSite using CometChat.
8
+ ## Prerequisites
9
+ - [`Visual Studio Code`](https://code.visualstudio.com/) or any other code editor
10
+ - [`npm`](https://www.npmjs.com/get-npm)
9
11
 
10
12
 
11
- ## Prerequisites :star:
12
- Before you begin, ensure you have met the following requirements:<br/>
13
- ✅ &nbsp; You have [`Visual Studio Code`](https://code.visualstudio.com/) or any other code editor installed in your machine.<br/>
14
- ✅ &nbsp; You have [`npm`](https://www.npmjs.com/get-npm) installed in your machine.<br/>
15
- ✅ &nbsp; You have read [CometChat Key Concepts](https://prodocs.cometchat.com/docs/concepts).<br/>
16
-
17
- <hr/>
18
-
19
- ## Installing CometChat Javascript SDK
20
- ## Setup :wrench:
21
-
22
- To setup Javascript SDK, you need to first register on CometChat Dashboard. [Click here to sign up](https://app.cometchat.com/login).
23
-
24
- ### i. Get your Application Keys :key:
25
-
26
- <a href="https://app.cometchat.io" target="_blank">Signup for CometChat</a> and then:
27
-
28
- 1. Create a new app: Click **Add App** option available → Enter App Name & other information → Create App
29
- 2. At the Top in **QuickStart** section you will find **Auth Key** & **App ID** or else you can head over to the **API & Auth Keys** section and note the **Auth Key** and **App ID**
30
- <img align="center" src="https://files.readme.io/4b771c5-qs_copy.jpg"/>
31
-
32
- <hr/>
33
-
34
- ### ii. Add the CometChat Dependency
35
- <ul>
36
- <li>
37
- <b>Install via NPM</b><br/>
38
- 1. Run the following command to install the CometChat Javascript SDK<br/>
39
-
40
- ```javascript
41
- npm install @cometchat/chat-sdk-javascript@latest --save
42
- ```
43
- </li>
44
-
45
- <li>
46
- <b>Import via CDN</b><br/>
47
- 1. Include the CometChat Javascript library in your HTML code.<br/>
48
-
49
- ```html
50
- <script type="text/javascript" src="https://unpkg.com/@cometchat/chat-sdk-javascript@latest/CometChat.js"></script>
51
- ```
52
-
53
- You can refer to the below link for instructions on how to do so:<br/>
54
- [📝 Add CometChat Dependency](https://prodocs.cometchat.com/docs/js-quick-start#add-the-cometchat-dependency)
55
- </li>
56
- </ul>
57
- <hr/>
58
-
59
- ## Configure CometChat Javascript SDK
60
-
61
- ### i. Initialize CometChat 🌟
62
- We suggest you call the init() method on app startup, preferably in the index.js file.
63
-
64
- ```javascript
65
- var appID = "APP_ID";
66
- var region = "REGION";
67
- var appSetting = new CometChat.AppSettingsBuilder().subscribePresenceForAllUsers().setRegion(region).build();
68
- CometChat.init(appID, appSetting).then(
69
- () => {
70
- console.log("Initialization completed successfully");
71
- },
72
- error => {
73
- console.log("Initialization failed with error:", error);
74
- }
75
- );
76
- ```
77
-
78
- | :information_source: &nbsp; <b> Note: Make sure to replace `region` and `appID` with your credentials.</b> |
79
- |------------------------------------------------------------------------------------------------------------|
80
-
81
- ### ii. Create User 👤
82
- Once initialisation is successful, you will need to create a user. You need to use createUser() method to create user on the fly.
83
- ```javascript
84
- let authKey = "AUTH_KEY";
85
- var uid = "user1";
86
- var name = "Kevin";
87
-
88
- var user = new CometChat.User(uid);
89
-
90
- user.setName(name);
91
-
92
- CometChat.createUser(user, authKey).then(
93
- user => {
94
- console.log("user created", user);
95
- },error => {
96
- console.log("error", error);
97
- }
98
- );
99
- ```
100
- >:information_source: <b>Note: Make sure that UID and name are specified as these are mandatory fields to create a user.</b>
101
- <hr/>
102
-
103
- ### iii. Login User 👤
104
- Once you have created the user successfully, you will need to log the user into CometChat using the login() method.
105
- ```javascript
106
- var UID = "SUPERHERO1";
107
- var authKey = "AUTH_KEY";
108
-
109
- CometChat.getLoggedinUser().then(
110
- user => {
111
- if(!user){
112
- CometChat.login(UID, authKey).then(
113
- user => {
114
- console.log("Login Successful:", { user });
115
- },
116
- error => {
117
- console.log("Login failed with exception:", { error });
118
- }
119
- );
120
- }else{
121
- // User already logged in
122
- }
123
- }, error => {
124
- console.log("getLoggedinUser failed with exception:", { error });
125
- }
126
- );
127
- ```
128
-
129
- | :information_source: &nbsp; <b>Note - The login() method needs to be called only once. Also replace `AUTH_KEY` with Auth Key from your app.</b> |
130
- |------------------------------------------------------------------------------------------------------------|
131
-
13
+ ## Getting Started
132
14
 
15
+ To set up Javascript SDK and utilize CometChat for your chat and calls functionality, you'll need to follow these steps:
16
+ - Register at the [CometChat Dashboard](https://app.cometchat.com/) to create an account.
17
+ - After registering, log into your CometChat account and create a new app. Once created, CometChat will generate an Auth Key and App ID for you. Keep these credentials secure as you'll need them later.
18
+ - Check the [key concepts](https://cometchat.com/docs/sdk/javascript/key-concepts) to understand the basic components of CometChat.
19
+ - Refer to the [Integration Steps](https://cometchat.com/docs/sdk/javascript/setup) in our documentation to integrate the SDK into your app.
133
20
 
134
21
  ## Help and Support
135
- For issues running the project or integrating with our UI Kits, consult our [documentation](https://www.cometchat.com/docs/javascript-chat-sdk/overview) or create a [support ticket](https://help.cometchat.com/hc/en-us) or seek real-time support via the [CometChat Dashboard](https://app.cometchat.com/).
22
+ For issues running the project or integrating with our SDK, consult our [documentation](https://www.cometchat.com/docs/sdk/javascript/overview) or create a [support ticket](https://help.cometchat.com/hc/en-us) or seek real-time support via the [CometChat Dashboard](https://app.cometchat.com/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cometchat/chat-sdk-javascript",
3
- "version": "4.0.7",
3
+ "version": "4.0.8",
4
4
  "description": "A complete chat solution.",
5
5
  "main": "CometChat.js",
6
6
  "scripts": {