Skip to content

Commit 0c709b8

Browse files
update directory structure
1 parent 359748a commit 0c709b8

16 files changed

+167
-169
lines changed

README.md

100644100755
Lines changed: 167 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,167 @@
1-
# Channelize-Web-Javascript
2-
Channelize.io web javascript sample apps
1+
# Channelize JavaScript Widget UI kit
2+
3+
This contains the customization capabilities you can achieve by using our JavaScript Sample App created using our [JavaScript SDK](https://docs.channelize.io/javascript-sdk-introduction-overview). This Sample App allows you to add a customized chat widget / docked layout on your website.
4+
5+
### Features : ###
6+
- Highly customization
7+
- Easy to implement
8+
- Ready to use
9+
- Multiple use cases
10+
11+
#### You can also check out our demo [here](https://demo.channelize.io).
12+
13+
## Getting Started
14+
15+
Follow the below steps to add Channelize widget / docked layout on your website.
16+
17+
##### Step 1: Add widget #####
18+
19+
Add the Channelize widget div in the body tag of your website.
20+
21+
```html
22+
<body>
23+
<div id="ch_widget"></div>
24+
</body>
25+
```
26+
27+
##### Step 2: Import Channelize widget file #####
28+
29+
Import the `widget.Channelize.js` file after body tag in your website.
30+
31+
```javascript
32+
<script src="https://cdn.channelize.io/apps/web-widget/1.0.0/widget.Channelize.js"></script>
33+
```
34+
35+
##### Step 3: Import Channelize JS-SDK #####
36+
37+
Import the [`Channelize JS-SDK`](https://docs.channelize.io/javascript-sdk-introduction-overview) after body tag in your website.
38+
39+
```javascript
40+
<script src="https://cdn.channelize.io/apps/web-widget/1.0.0/channelize-websdk-min.js"></script>
41+
```
42+
43+
##### Step 4: Create widget object #####
44+
45+
Create widget object and call the load function which will require your public key as an argument.
46+
47+
```javascript
48+
<script>
49+
const channelizeWidget = new ChannelizeWidget('PUBLIC_KEY');
50+
channelizeWidget.load();
51+
</script>
52+
```
53+
54+
## Customizing the widget
55+
56+
> Pre-requisites: Have Node v8.x+ installed.
57+
58+
1. Update Channelize widget file URL in your index.html file.
59+
```javascript
60+
<script src="./dist/widget.Channelize.js"></script>
61+
```
62+
63+
2. Install required npm packages.
64+
```bash
65+
npm install
66+
```
67+
68+
3. Build your changes.
69+
```bash
70+
npm run build
71+
```
72+
73+
4. Start sample app.
74+
```bash
75+
npm start
76+
```
77+
78+
###### For UI Customizations : ######
79+
80+
- Customize the UI of widget / docked layout as per your choice by changing the values of predefined variables in `./web-widget/src/scss/variables.scss file` or by making changes in the code of the elements/content.
81+
82+
83+
###### For Function Customizations : ######
84+
85+
- Add your functions or make code-level changes.
86+
87+
88+
## Advanced
89+
90+
### Change the application :
91+
If you want to change your current application, you just need to change the `PUBLIC_KEY` in `index.html` file.
92+
93+
```html
94+
...
95+
96+
<script>
97+
const channelizeWidget = new ChannelizeWidget('PUBLIC_KEY');
98+
channelizeWidget.load();
99+
</script>
100+
</html>
101+
```
102+
103+
### Load with already connected user :
104+
If you want to load the Channelize for already connected user, you can use loadWithConnect() method instead of load() method. loadWithConnect() method takes two arguments user-id and access token. you can get access token in the response of login api call.
105+
106+
```html
107+
...
108+
109+
<script>
110+
const channelizeWidget = new ChannelizeWidget('PUBLIC_KEY');
111+
channelizeWidget.loadWithConnect('userId', 'accessToken');
112+
</script>
113+
</html>
114+
```
115+
116+
### Load Recent Conversation Screen :
117+
If you want to open only recent conversation, you can use `loadRecentConversation()` method. It takes two arguments user-id and access token.
118+
119+
```html
120+
...
121+
122+
<script>
123+
const channelizeWidget = new ChannelizeWidget('PUBLIC_KEY');
124+
channelizeWidget.loadRecentConversation('userId', 'accessToken');
125+
</script>
126+
</html>
127+
```
128+
129+
### Load Conversation Window :
130+
If you want to load conversation window, then you can use `loadConversationWindow()` method. It takes two arguments otherMemberId and conversationId.
131+
132+
```html
133+
...
134+
135+
<script>
136+
const channelizeWidget = new ChannelizeWidget('PUBLIC_KEY');
137+
channelizeWidget.loadConversationWindow('otherMemberId', 'conversationId');
138+
</script>
139+
</html>
140+
```
141+
142+
## File Structure of Channelize Sample App :
143+
```
144+
|-- dist
145+
|-- widget.Channelize.js - Channelize Widget Bundle file
146+
|-- node_modules
147+
|-- ... - (node packages)
148+
|-- src
149+
|-- js
150+
|-- components
151+
|-- conversation-window.js - conversation screen class
152+
|-- login.js - login class
153+
|-- recent-conversation.js - recent conversation class
154+
|-- search.js - search class
155+
|-- adapter.js - Channelize JS SDK functions
156+
|-- constants.js - const variables
157+
|-- utility.js - utility functions
158+
|-- widget.js - widget main functions
159+
|-- scss
160+
|-- main.scss - main style class
161+
|-- variables.scss - css variables
162+
|-- index.html - sample file
163+
|-- package.json - npm package
164+
|-- README.md - description file
165+
|-- server.js - server file
166+
|-- webpack.config.js - webpack setting
167+
```
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

web-widget/README.md

Lines changed: 0 additions & 167 deletions
This file was deleted.
File renamed without changes.

0 commit comments

Comments
 (0)