aumera-on-screen-widget 0.0.4 → 0.0.6

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.
Binary file
@@ -0,0 +1,5 @@
1
+ <?xml version="1.0" encoding="utf-8"?><!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
2
+ <svg width="800px" height="800px" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">
3
+ <path d="M44 20H28V4" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
4
+ <path d="M4 28H20V44" stroke="#FFFFFF" stroke-width="4" stroke-linecap="round" stroke-linejoin="round"/>
5
+ </svg>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <!-- Uploaded to: SVG Repo, www.svgrepo.com, Generator: SVG Repo Mixer Tools -->
3
+ <svg width="800px" height="800px" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
4
+ <g id="Arrow / Expand">
5
+ <path id="Vector" d="M10 19H5V14M14 5H19V10" stroke="#FFFFFF" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
6
+ </g>
7
+ </svg>
package/df-btn.js CHANGED
@@ -1,7 +1,7 @@
1
1
  const wrapper = document.querySelector("#df-btn");
2
2
  const config = {
3
3
  src: wrapper.getAttribute("src"),
4
- project: wrapper.getAttribute("project"),
4
+ orgId: wrapper.getAttribute("orgId"),
5
5
  width: wrapper.getAttribute("width"),
6
6
  height: wrapper.getAttribute("height"),
7
7
  openText: wrapper.getAttribute("openText"),
@@ -21,8 +21,8 @@ const config = {
21
21
 
22
22
  const origin = config.src.substring(0, config.src.lastIndexOf("/"));
23
23
 
24
- if (!config.project) {
25
- console.warn("Please specify your project ID in attributes!");
24
+ if (!config.orgId) {
25
+ console.warn("Please specify your organization ID in attributes!");
26
26
  } else {
27
27
  const style = document.createElement("style");
28
28
  style.innerHTML = `
@@ -98,13 +98,17 @@ if (!config.project) {
98
98
  }
99
99
 
100
100
  .df-btn-text:before {
101
- min-width: 56px;
102
- height: 48px;
103
101
  background-position: center;
104
102
  background-repeat: no-repeat;
105
- background-size: 24px;
106
- background-image: url('${config.logo || origin + "/assets/logo.svg"}');
107
- content: ''
103
+ background-size: cover;
104
+ background-image: url('${origin + "/assets/chat-agent.jpg"}');
105
+ border-radius: 50%;
106
+ width: 32px;
107
+ height: 32px;
108
+ margin: 8px 12px;
109
+ content: '';
110
+ display: inline-block;
111
+ flex-shrink: 0;
108
112
  }
109
113
 
110
114
  .df-btn:hover {
@@ -122,8 +126,8 @@ if (!config.project) {
122
126
  .df-btn-content {
123
127
  display: block;
124
128
  border: 0;
125
- height: ${config.height || "600px"};
126
- width: ${config.width || "400px"};
129
+ height: ${config.height || "896px"};
130
+ width: ${config.width || "414px"};
127
131
  transition: all .45s cubic-bezier(.4, 0, .2, 1);
128
132
  ${config.position === "left" ? "float: left;" : "float: right;"}
129
133
  opacity: 1;
@@ -137,7 +141,8 @@ if (!config.project) {
137
141
  .df-closed > .df-btn-content {
138
142
  width: 0;
139
143
  height: 0;
140
- opacity: 0
144
+ opacity: 0;
145
+ overflow: hidden;
141
146
  }
142
147
 
143
148
  .maximize-minimize-btn {
@@ -159,18 +164,19 @@ if (!config.project) {
159
164
  bottom: 0 !important;
160
165
  margin: 0 !important;
161
166
  border-radius: 0 !important;
167
+ transition: all .45s cubic-bezier(.4, 0, .2, 1) !important;
162
168
  }
163
169
  .df-btn.df-maximized .df-btn-content {
164
170
  width: 100vw !important;
165
171
  height: calc(100vh - 56px) !important;
166
172
  opacity: 1 !important;
167
173
  display: block !important;
174
+ transition: all .45s cubic-bezier(.4, 0, .2, 1) !important;
168
175
  }
169
176
  .df-btn.df-closed .df-btn-content {
170
177
  width: 0 !important;
171
178
  height: 0 !important;
172
179
  opacity: 0 !important;
173
- display: none !important;
174
180
  }
175
181
  .close-btn {
176
182
  width: 16px;
@@ -216,9 +222,7 @@ if (!config.project) {
216
222
  }
217
223
 
218
224
  .df-btn-text:before {
219
- background-image: url('${
220
- config.logoDark || origin + "/assets/logo_dark.svg"
221
- }')
225
+ background-image: url('${origin + "/assets/chat-agent.jpg"}')
222
226
  }
223
227
 
224
228
  .df-btn:not(.df-closed) > .df-btn-text:before {
@@ -276,7 +280,9 @@ if (!config.project) {
276
280
  <div class="df-btn-header">
277
281
  <div class="df-btn-text">${config.openText || "Chat"}</div>
278
282
  </div>
279
- <iframe class="df-btn-content" src="https://chat.dev.aumera.ai/${detectedLang}/?orgId=1" allow="microphone *"></iframe>
283
+ <iframe class="df-btn-content" src="https://chat.dev.aumera.ai/${detectedLang}/?orgId=${
284
+ config.orgId
285
+ }" allow="microphone *"></iframe>
280
286
  </button>
281
287
  `);
282
288
 
@@ -348,9 +354,12 @@ if (!config.project) {
348
354
  const maxBtn = document.createElement("div");
349
355
  maxBtn.className = "maximize-minimize-btn";
350
356
  const maximized = btn.classList.contains("df-maximized");
357
+ const isDarkMode =
358
+ window.matchMedia &&
359
+ window.matchMedia("(prefers-color-scheme: dark)").matches;
351
360
  maxBtn.innerHTML = `<img class="maximize-minimize-icon" src="${origin}/assets/${
352
361
  maximized ? "collapse" : "expand"
353
- }.svg" alt="${
362
+ }${isDarkMode ? "_dark" : ""}.svg" alt="${
354
363
  maximized ? "Minimize" : "Maximize"
355
364
  }" style="width:24px;height:24px;cursor:pointer;" />`;
356
365
  header.appendChild(maxBtn);
@@ -361,7 +370,9 @@ if (!config.project) {
361
370
  // Add close button (left)
362
371
  const closeBtn = document.createElement("div");
363
372
  closeBtn.className = "close-btn";
364
- closeBtn.innerHTML = `<img src="${origin}/assets/close.svg" alt="Close" style="width:20px;height:20px;cursor:pointer;" />`;
373
+ closeBtn.innerHTML = `<img src="${origin}/assets/close${
374
+ isDarkMode ? "_dark" : ""
375
+ }.svg" alt="Close" style="width:20px;height:20px;cursor:pointer;" />`;
365
376
  header.insertBefore(closeBtn, btnText);
366
377
  closeBtn.addEventListener("click", (e) => {
367
378
  e.stopPropagation();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aumera-on-screen-widget",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "description": "A lightweight, customizable chat widget for websites",
5
5
  "main": "df-btn.js",
6
6
  "scripts": {