@2uinc/frontend-component-xpert-chatbot 1.2.0 → 1.3.0-beta.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 CHANGED
@@ -14,9 +14,11 @@ The Xpert Chatbot Frontend component library purpose is to:
14
14
  See `#project-xpert-platform` via Slack for more info.
15
15
 
16
16
  ## Places it's currently deployed
17
+
17
18
  See `src/client_configurations` folder
18
19
 
19
20
  ## Features included
21
+
20
22
  - Configurable ux, logos, disclaimer, privacy policy, prompts and chat api endpoint
21
23
  - Chatbot launch button
22
24
  - Proactive message to enage visitors
@@ -33,6 +35,7 @@ This project was created with the following:
33
35
  See `package.json` for more info.
34
36
 
35
37
  ## To view component library demo and develop (entry point `src/demo.jsx`):
38
+
36
39
  1. Switch the the correct version of node (install nvm if necessary):
37
40
  ```
38
41
  nvm use
@@ -55,13 +58,14 @@ npm start
55
58
  `
56
59
 
57
60
  ## To verify components within `/dist` folder via script tag:
61
+
58
62
  1. Install serve
59
63
  ```
60
64
  npm i -g serve
61
65
  ```
62
- 2. Serve `/dist` folder
66
+ 2. Build && Serve `/dist` folder
63
67
  ```
64
- serve -s dist
68
+ npm run build && serve -s dist
65
69
  ```
66
70
  3. Configure chatbot by providing `window.XpertChatbotFrontend.xpertKey` or `window.XpertChatbotFrontend.configurations` within `dist/index.html`. Client configurations are located in `src/client_configurations`.
67
71
  4. Go to `http://localhost:3000/` and verify chatbot works as expected.
@@ -88,6 +92,7 @@ npm test
88
92
  ```
89
93
 
90
94
  ## Deployment
95
+
91
96
  We deploy an NPM package to npmjs.org with the name `@2uinc/frontend-component-xpert-chatbot`
92
97
  To install the package, run the following command:
93
98
 
@@ -95,13 +100,21 @@ To install the package, run the following command:
95
100
  $ npm install @2uinc/frontend-component-xpert-chatbot
96
101
  ```
97
102
 
103
+ Also add to page head element:
104
+
105
+ ```
106
+ <link rel="stylesheet" href="https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.css" />
107
+ ```
108
+
109
+ For clients that don't have React, there's the option to pull the resources from CDN.
110
+
98
111
  ### CDN
99
112
 
100
113
  A CDN deployment occurs after the NPM deployment for clients that don't have React. See `publishCmd` in package.json.
101
114
 
102
115
  ```
103
116
  <head>
104
- <link rel="stylesheet href="https://chatbot-frontend.prod.ai.2u.com/@latest/index.css.js" />
117
+ <link rel="stylesheet" href="https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.css" />
105
118
 
106
119
  <script type="importmap">
107
120
  {
@@ -113,16 +126,50 @@ A CDN deployment occurs after the NPM deployment for clients that don't have Rea
113
126
  </script>
114
127
  </head>
115
128
  <body>
116
- <div id="xpert-chatbot-container"></div>
117
- ...
118
129
  <script type="module" defer src="https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.js"></script>
119
130
  </body>
120
131
  ```
121
132
 
122
- ##### NOTE:
123
- Make sure you have a div with the ID `xpert-chatbot-container` for React to render into.
133
+ For environments that don't support script type "importmap" (ie Google Tag Manager), manual creation of the script tag will be required:
134
+
135
+ ```
136
+ <script>
137
+ var scriptElement = document.createElement('script');
138
+ scriptElement.type = "importmap";
139
+ var importMap = {
140
+ "imports": {
141
+ "react": "https://cdn.jsdelivr.net/npm/react@17.0.2/+esm",
142
+ "react-dom": "https://cdn.jsdelivr.net/npm/react-dom@17.0.2/+esm"
143
+ }
144
+ };
145
+ var importMapString = JSON.stringify(importMap);
146
+ var importMapElement = document.createTextNode(importMapString);
147
+ scriptElement.appendChild(importMapElement);
148
+ document.head.appendChild(scriptElement);
149
+ </script>
150
+
151
+ <link rel="stylesheet" href="https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.css" />
152
+
153
+ <script>
154
+ var scriptElement = document.createElement('script');
155
+ scriptElement.setAttribute('type', "module");
156
+ scriptElement.setAttribute('src', "https://chatbot-frontend.prod.ai.2u.com/@latest/index.min.js");
157
+ document.body.appendChild(scriptElement);
158
+ </script>
159
+ ```
124
160
 
125
161
  ## Beta releases
126
- To create a beta release, make a PR to the `beta` branch. Once the PR is merged, a new beta release will be created and published to npmjs.org with the name `@2uinc/frontend-component-xpert-chatbot@beta${beta-version}`.
127
- A CDN release will also be created and published to `https://chatbot-frontend.beta.ai.2u.com/beta${beta-version}/index.min.js` and `https://chatbot-frontend.beta.ai.2u.com/beta${beta-version}/index.css.js`.
162
+
163
+ To create a beta release for testing, make a PR to the `beta` branch. Once the PR is merged, a new beta release will be created and published to npmjs.org with the name:
164
+
165
+ ```
166
+ @2uinc/frontend-component-xpert-chatbot@v{tag-name}
167
+ ```
168
+
169
+ A CDN release will also be created and published to:
170
+
171
+ ```
172
+ https://chatbot-frontend.prod.ai.2u.com/@{tag-name}/index.min.js
173
+ https://chatbot-frontend.prod.ai.2u.com/@{tag-name}/index.min.css
174
+ ```
128
175