@product7/product7-js 0.1.3 → 0.1.5

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@product7/product7-js",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "JavaScript SDK for integrating Product7 feedback widgets into any website",
5
5
  "main": "dist/product7-js.js",
6
6
  "module": "src/index.js",
@@ -37,16 +37,12 @@ export const messengerComponentsStyles = `
37
37
  }
38
38
 
39
39
  .messenger-message-sender {
40
- font-size: var(--font-size-xs);
41
- font-weight: var(--font-weight-medium);
42
- color: var(--msg-text-secondary);
43
- margin-bottom: 2px;
44
- margin-left: 0;
40
+ display: none;
45
41
  }
46
42
 
47
43
  .messenger-message-bubble {
48
- padding: var(--spacing-3) var(--spacing-4);
49
- border-radius: 1.25rem;
44
+ padding: 7px 13px;
45
+ border-radius: 1.125rem;
50
46
  word-wrap: break-word;
51
47
  max-width: 100%;
52
48
  }
@@ -66,6 +62,7 @@ export const messengerComponentsStyles = `
66
62
 
67
63
  .messenger-message-content {
68
64
  font-size: var(--font-size-base);
65
+ font-weight: var(--font-weight-medium);
69
66
  line-height: var(--line-height-relaxed);
70
67
  }
71
68
 
@@ -240,7 +237,7 @@ export const messengerComponentsStyles = `
240
237
 
241
238
  .messenger-chat-empty h3 {
242
239
  margin: 0 0 var(--spacing-2);
243
- font-size: var(--font-size-xl);
240
+ font-size: var(--font-size-base);
244
241
  font-weight: var(--font-weight-semibold);
245
242
  color: var(--msg-text);
246
243
  }
@@ -560,7 +557,7 @@ export const messengerComponentsStyles = `
560
557
 
561
558
  .messenger-prechat-title {
562
559
  margin: 0 0 var(--spacing-2);
563
- font-size: var(--font-size-lg);
560
+ font-size: var(--font-size-base);
564
561
  font-weight: var(--font-weight-semibold);
565
562
  color: var(--msg-text);
566
563
  }
@@ -90,11 +90,11 @@ export const messengerFeaturesStyles = `
90
90
  EMPTY STATE
91
91
  ======================================== */
92
92
  .messenger-empty-state {
93
+ flex: 1;
93
94
  display: flex;
94
95
  flex-direction: column;
95
96
  align-items: center;
96
97
  justify-content: center;
97
- height: 100%;
98
98
  text-align: center;
99
99
  padding: var(--spacing-10);
100
100
  }
@@ -283,9 +283,14 @@ export const messengerViewsStyles = `
283
283
 
284
284
  .messenger-home-changelog-card-desc {
285
285
  margin: 0;
286
- font-size: var(--font-size-base);
286
+ font-size: var(--font-size-sm);
287
+ font-weight: var(--font-weight-normal);
287
288
  color: var(--msg-text-secondary);
288
289
  line-height: var(--line-height-relaxed);
290
+ display: -webkit-box;
291
+ -webkit-line-clamp: 3;
292
+ -webkit-box-orient: vertical;
293
+ overflow: hidden;
289
294
  }
290
295
 
291
296
  .messenger-home-availability,
@@ -55,7 +55,9 @@ export class HelpView {
55
55
 
56
56
  _updateCollectionsList() {
57
57
  const container = this.element.querySelector('.messenger-help-collections');
58
- const collections = this.state.helpArticles || [];
58
+ const collections = (this.state.helpArticles || []).filter(
59
+ (c) => (c.articleCount || 0) > 0
60
+ );
59
61
  const searchQuery = (this.state.helpSearchQuery || '').toLowerCase();
60
62
 
61
63
  const filtered = searchQuery
@@ -136,7 +138,7 @@ export class HelpView {
136
138
 
137
139
  if (icon.startsWith('ph:')) {
138
140
  return `<span class="messenger-help-collection-icon">
139
- <iconify-icon icon="${icon}" width="22" height="22"></iconify-icon>
141
+ <iconify-icon icon="${icon}"></iconify-icon>
140
142
  </span>`;
141
143
  }
142
144
 
@@ -145,7 +147,7 @@ export class HelpView {
145
147
 
146
148
  _defaultCollectionIcon() {
147
149
  return `<span class="messenger-help-collection-icon">
148
- <iconify-icon icon="ph:book-open-duotone" width="22" height="22"></iconify-icon>
150
+ <iconify-icon icon="ph:book-open-duotone"></iconify-icon>
149
151
  </span>`;
150
152
  }
151
153
 
@@ -37,9 +37,6 @@ export class HomeView {
37
37
  ${this.options.logoUrl ? `<img src="${this.options.logoUrl}" alt="${this.state.teamName}" />` : ''}
38
38
  </div>
39
39
  <div class="messenger-home-avatars">${avatarsHtml}</div>
40
- <button class="sdk-close-btn" aria-label="Close">
41
- <iconify-icon icon="ph:x-duotone" width="18" height="18"></iconify-icon>
42
- </button>
43
40
  </div>
44
41
  <div class="messenger-home-welcome">
45
42
  <span class="messenger-home-greeting">${this.state.greetingMessage}</span>
@@ -184,7 +181,7 @@ export class HomeView {
184
181
  }
185
182
  <div class="messenger-home-changelog-card-content">
186
183
  <h4 class="messenger-home-changelog-card-title">${item.title}</h4>
187
- <p class="messenger-home-changelog-card-desc">${item.description || ''}</p>
184
+ <p class="messenger-home-changelog-card-desc">${this._stripHtml(item.description)}</p>
188
185
  </div>
189
186
  </div>
190
187
  `
@@ -198,6 +195,13 @@ export class HomeView {
198
195
  `;
199
196
  }
200
197
 
198
+ _stripHtml(html) {
199
+ if (!html) return '';
200
+ const tmp = document.createElement('div');
201
+ tmp.innerHTML = html;
202
+ return (tmp.textContent || tmp.innerText || '').trim();
203
+ }
204
+
201
205
  _formatDate(dateString) {
202
206
  if (!dateString) return '';
203
207
  const date = new Date(dateString);
@@ -211,12 +215,6 @@ export class HomeView {
211
215
  }
212
216
 
213
217
  _attachEvents() {
214
- this.element
215
- .querySelector('.sdk-close-btn')
216
- .addEventListener('click', () => {
217
- this.state.setOpen(false);
218
- });
219
-
220
218
  const msgBtn = this.element.querySelector(
221
219
  '.messenger-home-message-btn:not(.messenger-feedback-btn)'
222
220
  );