@product7/feedback-sdk 1.6.0 → 1.6.3
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 +5 -5
- package/dist/README.md +5 -5
- package/dist/feedback-sdk.js +323 -181
- package/dist/feedback-sdk.js.map +1 -1
- package/dist/feedback-sdk.min.js +1 -1
- package/dist/feedback-sdk.min.js.map +1 -1
- package/package.json +1 -1
- package/src/index.js +12 -4
- package/src/styles/messenger-views.js +147 -23
- package/src/styles/survey.js +0 -10
- package/src/widgets/MessengerWidget.js +7 -1
- package/src/widgets/SurveyWidget.js +14 -10
- package/src/widgets/messenger/components/NavigationTabs.js +13 -36
- package/src/widgets/messenger/views/ChangelogView.js +21 -30
- package/src/widgets/messenger/views/HelpView.js +110 -68
package/package.json
CHANGED
package/src/index.js
CHANGED
|
@@ -20,15 +20,23 @@ import { TabWidget } from './widgets/TabWidget.js';
|
|
|
20
20
|
import { WidgetFactory } from './widgets/WidgetFactory.js';
|
|
21
21
|
|
|
22
22
|
function injectStyles() {
|
|
23
|
-
if (
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
) {
|
|
23
|
+
if (typeof document === 'undefined') return;
|
|
24
|
+
|
|
25
|
+
if (!document.querySelector('#feedback-sdk-styles')) {
|
|
27
26
|
const style = document.createElement('style');
|
|
28
27
|
style.id = 'feedback-sdk-styles';
|
|
29
28
|
style.textContent = CSS_STYLES;
|
|
30
29
|
document.head.appendChild(style);
|
|
31
30
|
}
|
|
31
|
+
|
|
32
|
+
if (!document.querySelector('#feedback-sdk-iconify')) {
|
|
33
|
+
const script = document.createElement('script');
|
|
34
|
+
script.id = 'feedback-sdk-iconify';
|
|
35
|
+
script.src =
|
|
36
|
+
'https://cdn.jsdelivr.net/npm/iconify-icon@2/dist/iconify-icon.min.js';
|
|
37
|
+
script.async = true;
|
|
38
|
+
document.head.appendChild(script);
|
|
39
|
+
}
|
|
32
40
|
}
|
|
33
41
|
|
|
34
42
|
function autoInit() {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export const messengerViewsStyles = `
|
|
2
|
-
|
|
3
2
|
/* ========================================
|
|
4
3
|
HOME VIEW
|
|
5
4
|
======================================== */
|
|
@@ -453,9 +452,36 @@ export const messengerViewsStyles = `
|
|
|
453
452
|
display: flex;
|
|
454
453
|
flex-direction: column;
|
|
455
454
|
gap: var(--spacing-3);
|
|
456
|
-
padding: var(--spacing-
|
|
455
|
+
padding: var(--spacing-3) var(--spacing-5) var(--spacing-4);
|
|
457
456
|
border-bottom: 1px solid var(--color-border);
|
|
458
|
-
|
|
457
|
+
flex-shrink: 0;
|
|
458
|
+
background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
|
|
459
|
+
position: relative;
|
|
460
|
+
overflow: hidden;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.messenger-help-header::before {
|
|
464
|
+
content: '';
|
|
465
|
+
position: absolute;
|
|
466
|
+
top: -20px;
|
|
467
|
+
left: -20px;
|
|
468
|
+
width: 200px;
|
|
469
|
+
height: 200px;
|
|
470
|
+
background: radial-gradient(circle, rgba(21, 94, 239, 0.12) 0%, transparent 70%);
|
|
471
|
+
filter: blur(30px);
|
|
472
|
+
pointer-events: none;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
.messenger-help-header::after {
|
|
476
|
+
content: '';
|
|
477
|
+
position: absolute;
|
|
478
|
+
top: -10px;
|
|
479
|
+
right: -20px;
|
|
480
|
+
width: 150px;
|
|
481
|
+
height: 150px;
|
|
482
|
+
background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
|
|
483
|
+
filter: blur(25px);
|
|
484
|
+
pointer-events: none;
|
|
459
485
|
}
|
|
460
486
|
|
|
461
487
|
.messenger-help-header-top {
|
|
@@ -467,30 +493,47 @@ export const messengerViewsStyles = `
|
|
|
467
493
|
|
|
468
494
|
.messenger-help-header-top h2 {
|
|
469
495
|
margin: 0;
|
|
470
|
-
font-size: var(--font-size-
|
|
496
|
+
font-size: var(--font-size-md);
|
|
471
497
|
font-weight: var(--font-weight-semibold);
|
|
472
498
|
color: var(--color-text-primary);
|
|
473
499
|
}
|
|
474
500
|
|
|
475
|
-
.messenger-help-
|
|
501
|
+
.messenger-help-close-btn {
|
|
476
502
|
position: absolute;
|
|
477
503
|
right: 0;
|
|
478
504
|
top: 50%;
|
|
479
505
|
transform: translateY(-50%);
|
|
480
506
|
}
|
|
481
507
|
|
|
508
|
+
.messenger-help-search-wrap {
|
|
509
|
+
position: relative;
|
|
510
|
+
width: 100%;
|
|
511
|
+
}
|
|
512
|
+
|
|
513
|
+
.messenger-help-search-icon {
|
|
514
|
+
position: absolute;
|
|
515
|
+
left: var(--spacing-3);
|
|
516
|
+
top: 50%;
|
|
517
|
+
transform: translateY(-50%);
|
|
518
|
+
color: var(--color-text-tertiary);
|
|
519
|
+
display: flex;
|
|
520
|
+
align-items: center;
|
|
521
|
+
pointer-events: none;
|
|
522
|
+
}
|
|
523
|
+
|
|
482
524
|
.messenger-help-search-input {
|
|
483
525
|
width: 100%;
|
|
484
|
-
background:
|
|
526
|
+
background: rgba(255, 255, 255, 0.7);
|
|
485
527
|
border: 1px solid var(--color-border);
|
|
486
528
|
border-radius: var(--radius-md);
|
|
487
|
-
padding: var(--spacing-2) var(--spacing-3);
|
|
529
|
+
padding: var(--spacing-2) var(--spacing-3) var(--spacing-2) calc(var(--spacing-3) + 16px + var(--spacing-2));
|
|
488
530
|
font-size: var(--font-size-base);
|
|
489
531
|
font-weight: var(--font-weight-normal);
|
|
490
532
|
color: var(--color-text-primary);
|
|
491
533
|
font-family: inherit;
|
|
492
534
|
outline: none;
|
|
493
|
-
transition: border-color var(--transition-base);
|
|
535
|
+
transition: border-color var(--transition-base), background var(--transition-base);
|
|
536
|
+
box-sizing: border-box;
|
|
494
537
|
}
|
|
495
538
|
|
|
496
539
|
.messenger-help-search-input:focus {
|
|
@@ -519,7 +562,8 @@ export const messengerViewsStyles = `
|
|
|
519
562
|
.messenger-help-collection {
|
|
520
563
|
display: flex;
|
|
521
564
|
align-items: center;
|
|
522
|
-
|
|
565
|
+
gap: var(--spacing-3);
|
|
566
|
+
padding: var(--spacing-3) var(--spacing-5);
|
|
523
567
|
cursor: pointer;
|
|
524
568
|
transition: background var(--transition-base);
|
|
525
569
|
border-bottom: 1px solid var(--color-border);
|
|
@@ -529,35 +573,75 @@ export const messengerViewsStyles = `
|
|
|
529
573
|
background: var(--color-neutral-50);
|
|
530
574
|
}
|
|
531
575
|
|
|
576
|
+
.messenger-help-collection-icon {
|
|
577
|
+
flex-shrink: 0;
|
|
578
|
+
width: 28px;
|
|
579
|
+
height: 28px;
|
|
580
|
+
display: flex;
|
|
581
|
+
align-items: center;
|
|
582
|
+
justify-content: center;
|
|
583
|
+
color: var(--color-text-secondary);
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.messenger-help-collection-icon svg,
|
|
587
|
+
.messenger-help-collection-icon iconify-icon {
|
|
588
|
+
width: 18px;
|
|
589
|
+
height: 18px;
|
|
590
|
+
display: block;
|
|
591
|
+
}
|
|
592
|
+
|
|
532
593
|
.messenger-help-collection-content {
|
|
533
594
|
flex: 1;
|
|
534
595
|
min-width: 0;
|
|
535
596
|
}
|
|
536
597
|
|
|
537
598
|
.messenger-help-collection-title {
|
|
538
|
-
|
|
539
|
-
font-
|
|
540
|
-
font-weight: var(--font-weight-bold);
|
|
599
|
+
font-size: var(--font-size-sm);
|
|
600
|
+
font-weight: var(--font-weight-medium);
|
|
541
601
|
color: var(--color-text-primary);
|
|
542
602
|
line-height: var(--line-height-snug);
|
|
603
|
+
white-space: nowrap;
|
|
604
|
+
overflow: hidden;
|
|
605
|
+
text-overflow: ellipsis;
|
|
543
606
|
}
|
|
544
607
|
|
|
545
608
|
.messenger-help-collection-desc {
|
|
546
|
-
margin:
|
|
547
|
-
font-size: var(--font-size-
|
|
609
|
+
margin: 2px 0 var(--spacing-1);
|
|
610
|
+
font-size: var(--font-size-xs);
|
|
548
611
|
color: var(--color-text-secondary);
|
|
549
612
|
line-height: var(--line-height-normal);
|
|
613
|
+
white-space: nowrap;
|
|
614
|
+
overflow: hidden;
|
|
615
|
+
text-overflow: ellipsis;
|
|
550
616
|
}
|
|
551
617
|
|
|
552
|
-
.messenger-help-collection-
|
|
553
|
-
|
|
554
|
-
|
|
618
|
+
.messenger-help-collection-meta {
|
|
619
|
+
display: flex;
|
|
620
|
+
align-items: center;
|
|
621
|
+
gap: var(--spacing-2);
|
|
622
|
+
margin-top: 2px;
|
|
555
623
|
}
|
|
556
624
|
|
|
557
|
-
.messenger-help-collection-
|
|
558
|
-
|
|
625
|
+
.messenger-help-collection-avatar {
|
|
626
|
+
width: 16px;
|
|
627
|
+
height: 16px;
|
|
628
|
+
border-radius: var(--radius-full);
|
|
559
629
|
flex-shrink: 0;
|
|
560
|
-
|
|
630
|
+
object-fit: cover;
|
|
631
|
+
}
|
|
632
|
+
|
|
633
|
+
.messenger-help-collection-avatar--initials {
|
|
634
|
+
display: inline-flex;
|
|
635
|
+
align-items: center;
|
|
636
|
+
justify-content: center;
|
|
637
|
+
font-size: 9px;
|
|
638
|
+
font-weight: 600;
|
|
639
|
+
line-height: 1;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
.messenger-help-collection-count {
|
|
643
|
+
font-size: var(--font-size-xs);
|
|
644
|
+
color: var(--color-text-tertiary);
|
|
561
645
|
}
|
|
562
646
|
|
|
563
647
|
.messenger-help-footer {
|
|
@@ -587,19 +671,59 @@ export const messengerViewsStyles = `
|
|
|
587
671
|
======================================== */
|
|
588
672
|
|
|
589
673
|
.messenger-changelog-header {
|
|
674
|
+
padding: var(--spacing-3) var(--spacing-5);
|
|
675
|
+
border-bottom: 1px solid var(--color-border);
|
|
676
|
+
flex-shrink: 0;
|
|
677
|
+
background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
|
|
678
|
+
position: relative;
|
|
679
|
+
overflow: hidden;
|
|
680
|
+
}
|
|
681
|
+
|
|
682
|
+
.messenger-changelog-header::before {
|
|
683
|
+
content: '';
|
|
684
|
+
position: absolute;
|
|
685
|
+
top: -20px;
|
|
686
|
+
left: -20px;
|
|
687
|
+
width: 200px;
|
|
688
|
+
height: 200px;
|
|
689
|
+
background: radial-gradient(circle, rgba(21, 94, 239, 0.12) 0%, transparent 70%);
|
|
690
|
+
filter: blur(30px);
|
|
691
|
+
pointer-events: none;
|
|
692
|
+
}
|
|
693
|
+
|
|
694
|
+
.messenger-changelog-header::after {
|
|
695
|
+
content: '';
|
|
696
|
+
position: absolute;
|
|
697
|
+
top: -10px;
|
|
698
|
+
right: -20px;
|
|
699
|
+
width: 150px;
|
|
700
|
+
height: 150px;
|
|
701
|
+
background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
|
|
702
|
+
filter: blur(25px);
|
|
703
|
+
pointer-events: none;
|
|
704
|
+
}
|
|
705
|
+
|
|
706
|
+
.messenger-changelog-header-top {
|
|
590
707
|
display: flex;
|
|
591
708
|
align-items: center;
|
|
592
709
|
justify-content: center;
|
|
593
|
-
|
|
710
|
+
position: relative;
|
|
594
711
|
}
|
|
595
712
|
|
|
596
|
-
.messenger-changelog-header h2 {
|
|
713
|
+
.messenger-changelog-header-top h2 {
|
|
597
714
|
margin: 0;
|
|
598
|
-
font-size: var(--font-size-
|
|
715
|
+
font-size: var(--font-size-md);
|
|
599
716
|
font-weight: var(--font-weight-semibold);
|
|
600
717
|
color: var(--color-text-primary);
|
|
601
718
|
}
|
|
602
719
|
|
|
720
|
+
.messenger-changelog-close-btn {
|
|
721
|
+
position: absolute;
|
|
722
|
+
right: 0;
|
|
723
|
+
top: 50%;
|
|
724
|
+
transform: translateY(-50%);
|
|
725
|
+
}
|
|
726
|
+
|
|
603
727
|
.messenger-changelog-body {
|
|
604
728
|
flex: 1;
|
|
605
729
|
overflow-y: auto;
|
package/src/styles/survey.js
CHANGED
|
@@ -266,11 +266,6 @@ export const surveyStyles = `
|
|
|
266
266
|
box-shadow: inset 0 0 0 2px var(--color-primary);
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
.feedback-survey-rating-scale-compact .feedback-survey-rating-scale-btn {
|
|
270
|
-
min-height: 50px;
|
|
271
|
-
font-size: clamp(12px, 2vw, 16px);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
269
|
.feedback-survey-labels {
|
|
275
270
|
display: flex;
|
|
276
271
|
justify-content: space-between;
|
|
@@ -545,11 +540,6 @@ export const surveyStyles = `
|
|
|
545
540
|
font-size: clamp(14px, 6vw, 18px);
|
|
546
541
|
}
|
|
547
542
|
|
|
548
|
-
.feedback-survey-rating-scale-compact .feedback-survey-rating-scale-btn {
|
|
549
|
-
min-height: 44px;
|
|
550
|
-
font-size: clamp(11px, 3.7vw, 14px);
|
|
551
|
-
}
|
|
552
|
-
|
|
553
543
|
.feedback-survey-rating-scale + .feedback-survey-labels {
|
|
554
544
|
font-size: var(--font-size-xs);
|
|
555
545
|
}
|
|
@@ -564,11 +564,17 @@ export class MessengerWidget extends BaseWidget {
|
|
|
564
564
|
''
|
|
565
565
|
);
|
|
566
566
|
|
|
567
|
-
|
|
567
|
+
const sorted = [...collections].sort(
|
|
568
|
+
(a, b) => (a.order ?? 0) - (b.order ?? 0)
|
|
569
|
+
);
|
|
570
|
+
|
|
571
|
+
return sorted.map((collection) => ({
|
|
568
572
|
id: collection.id,
|
|
569
573
|
title: collection.title,
|
|
570
574
|
description: collection.description || '',
|
|
571
575
|
articleCount: collection.article_count || 0,
|
|
576
|
+
icon: collection.icon || null,
|
|
577
|
+
author: collection.author || null,
|
|
572
578
|
url:
|
|
573
579
|
collection.url_slug && helpBase
|
|
574
580
|
? `${helpBase}/collections/${collection.url_slug}`
|
|
@@ -151,11 +151,13 @@ export class SurveyWidget extends BaseWidget {
|
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
const npsScale = this._getNPSScale();
|
|
154
|
-
const
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
154
|
+
const npsUsesSegmentedScale = npsScale.values.length <= 7;
|
|
155
|
+
const npsContainerClass = npsUsesSegmentedScale
|
|
156
|
+
? 'feedback-survey-ces feedback-survey-rating-scale'
|
|
157
|
+
: 'feedback-survey-nps';
|
|
158
|
+
const npsButtonClass = npsUsesSegmentedScale
|
|
159
|
+
? 'feedback-survey-nps-btn feedback-survey-ces-btn feedback-survey-rating-scale-btn'
|
|
160
|
+
: 'feedback-survey-nps-btn';
|
|
159
161
|
const npsLowLabel =
|
|
160
162
|
this.surveyOptions.lowLabel ||
|
|
161
163
|
(npsScale.start === 0 ? 'Not likely' : 'Strongly Disagree');
|
|
@@ -415,11 +417,13 @@ export class SurveyWidget extends BaseWidget {
|
|
|
415
417
|
{ length: npsScale },
|
|
416
418
|
(_, index) => start + index
|
|
417
419
|
);
|
|
418
|
-
const
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
420
|
+
const usesSegmentedScale = values.length <= 7;
|
|
421
|
+
const containerClass = usesSegmentedScale
|
|
422
|
+
? 'feedback-survey-ces feedback-survey-rating-scale'
|
|
423
|
+
: 'feedback-survey-nps';
|
|
424
|
+
const buttonClass = usesSegmentedScale
|
|
425
|
+
? 'feedback-survey-page-rating-btn feedback-survey-nps-btn feedback-survey-ces-btn feedback-survey-rating-scale-btn'
|
|
426
|
+
: 'feedback-survey-page-rating-btn feedback-survey-nps-btn';
|
|
423
427
|
return `
|
|
424
428
|
<div class="${containerClass}" data-page-id="${pageId}">
|
|
425
429
|
${values
|
|
@@ -24,24 +24,24 @@ export class NavigationTabs {
|
|
|
24
24
|
|
|
25
25
|
_getTabs() {
|
|
26
26
|
const tabs = [
|
|
27
|
-
{ id: 'home', label: 'Home', icon:
|
|
27
|
+
{ id: 'home', label: 'Home', icon: 'ph:house-simple-duotone' },
|
|
28
28
|
{
|
|
29
29
|
id: 'messages',
|
|
30
30
|
label: 'Messages',
|
|
31
|
-
icon:
|
|
31
|
+
icon: 'ph:chats-duotone',
|
|
32
32
|
badge: this.state.unreadCount,
|
|
33
33
|
},
|
|
34
34
|
];
|
|
35
35
|
|
|
36
36
|
if (this.state.enableHelp) {
|
|
37
|
-
tabs.push({ id: 'help', label: 'Help', icon:
|
|
37
|
+
tabs.push({ id: 'help', label: 'Help', icon: 'ph:books-duotone' });
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
if (this.state.enableChangelog) {
|
|
41
41
|
tabs.push({
|
|
42
42
|
id: 'changelog',
|
|
43
|
-
label: '
|
|
44
|
-
icon:
|
|
43
|
+
label: 'Updates',
|
|
44
|
+
icon: 'ph:megaphone-duotone',
|
|
45
45
|
});
|
|
46
46
|
}
|
|
47
47
|
|
|
@@ -59,12 +59,14 @@ export class NavigationTabs {
|
|
|
59
59
|
: '';
|
|
60
60
|
|
|
61
61
|
return `
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
62
|
+
<button class="messenger-nav-tab ${isActive ? 'active' : ''}" data-tab="${tab.id}">
|
|
63
|
+
<span class="messenger-nav-icon">
|
|
64
|
+
<iconify-icon icon="${tab.icon}" width="22" height="22"></iconify-icon>
|
|
65
|
+
</span>
|
|
66
|
+
<span class="messenger-nav-label">${tab.label}</span>
|
|
67
|
+
${badgeHtml}
|
|
68
|
+
</button>
|
|
69
|
+
`;
|
|
68
70
|
})
|
|
69
71
|
.join('');
|
|
70
72
|
|
|
@@ -117,31 +119,6 @@ export class NavigationTabs {
|
|
|
117
119
|
});
|
|
118
120
|
}
|
|
119
121
|
|
|
120
|
-
_getHomeIcon() {
|
|
121
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 256 256">
|
|
122
|
-
<path d="M40,216H216V120a8,8,0,0,0-2.34-5.66l-80-80a8,8,0,0,0-11.32,0l-80,80A8,8,0,0,0,40,120Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
123
|
-
</svg>`;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
_getMessagesIcon() {
|
|
127
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256"><rect width="256" height="256" fill="none"/><path d="M71.58,144,32,176V48a8,8,0,0,1,8-8H168a8,8,0,0,1,8,8v88a8,8,0,0,1-8,8Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/><path d="M80,144v40a8,8,0,0,0,8,8h96.42L224,224V96a8,8,0,0,0-8-8H176" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/></svg>`;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
_getHelpIcon() {
|
|
131
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 256 256">
|
|
132
|
-
<circle cx="128" cy="128" r="96" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
133
|
-
<circle cx="128" cy="180" r="12"/>
|
|
134
|
-
<path d="M128,144v-8a28,28,0,1,0-28-28" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
135
|
-
</svg>`;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
_getChangelogIcon() {
|
|
139
|
-
return `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 256 256">
|
|
140
|
-
<path d="M160,80V200.67a8,8,0,0,0,3.56,6.65l11,7.33a8,8,0,0,0,12.2-4.72L200,160" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
141
|
-
<path d="M40,200a8,8,0,0,0,13.15,6.12C105.55,162.16,160,160,160,160h40a40,40,0,0,0,0-80H160S105.55,77.84,53.15,33.89A8,8,0,0,0,40,40Z" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="16"/>
|
|
142
|
-
</svg>`;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
122
|
destroy() {
|
|
146
123
|
if (this._unsubscribe) {
|
|
147
124
|
this._unsubscribe();
|
|
@@ -4,6 +4,9 @@ export class ChangelogView {
|
|
|
4
4
|
this.options = options;
|
|
5
5
|
this.element = null;
|
|
6
6
|
this._unsubscribe = null;
|
|
7
|
+
|
|
8
|
+
// Configurable header colour — defaults to Product7 blue
|
|
9
|
+
this._headerBg = `linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%)`;
|
|
7
10
|
}
|
|
8
11
|
|
|
9
12
|
render() {
|
|
@@ -24,7 +27,14 @@ export class ChangelogView {
|
|
|
24
27
|
_updateContent() {
|
|
25
28
|
this.element.innerHTML = `
|
|
26
29
|
<div class="messenger-changelog-header">
|
|
27
|
-
<
|
|
30
|
+
<div class="messenger-changelog-header-top">
|
|
31
|
+
<h2>Latest Updates</h2>
|
|
32
|
+
<button class="sdk-close-btn messenger-changelog-close-btn" aria-label="Close">
|
|
33
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" fill="currentColor" viewBox="0 0 256 256">
|
|
34
|
+
<path d="M205.66,194.34a8,8,0,0,1-11.32,11.32L128,139.31,61.66,205.66a8,8,0,0,1-11.32-11.32L116.69,128,50.34,61.66A8,8,0,0,1,61.66,50.34L128,116.69l66.34-66.35a8,8,0,0,1,11.32,11.32L139.31,128Z"></path>
|
|
35
|
+
</svg>
|
|
36
|
+
</button>
|
|
37
|
+
</div>
|
|
28
38
|
</div>
|
|
29
39
|
|
|
30
40
|
<div class="messenger-changelog-body">
|
|
@@ -58,8 +68,8 @@ export class ChangelogView {
|
|
|
58
68
|
const tagsHtml =
|
|
59
69
|
item.tags && item.tags.length > 0
|
|
60
70
|
? `<div class="messenger-changelog-tags">
|
|
61
|
-
|
|
62
|
-
|
|
71
|
+
${item.tags.map((tag) => `<span class="sdk-badge sdk-badge-primary messenger-changelog-tag">${tag}</span>`).join('')}
|
|
72
|
+
</div>`
|
|
63
73
|
: '';
|
|
64
74
|
|
|
65
75
|
const dateStr = this._formatDate(item.publishedAt || item.date);
|
|
@@ -87,36 +97,11 @@ export class ChangelogView {
|
|
|
87
97
|
`;
|
|
88
98
|
}
|
|
89
99
|
|
|
90
|
-
_renderTeamAvatars() {
|
|
91
|
-
const avatars = this.state.teamAvatars;
|
|
92
|
-
if (!avatars || avatars.length === 0) {
|
|
93
|
-
return `
|
|
94
|
-
<div class="messenger-avatar-stack messenger-avatar-stack-tiny">
|
|
95
|
-
<div class="sdk-avatar sdk-avatar-sm">S</div>
|
|
96
|
-
</div>
|
|
97
|
-
`;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
const avatarItems = avatars
|
|
101
|
-
.slice(0, 2)
|
|
102
|
-
.map((avatar) => {
|
|
103
|
-
if (typeof avatar === 'string' && avatar.startsWith('http')) {
|
|
104
|
-
return `<div class="sdk-avatar sdk-avatar-sm"><img src="${avatar}" alt="Team member" /></div>`;
|
|
105
|
-
}
|
|
106
|
-
return `<div class="sdk-avatar sdk-avatar-sm">${avatar.charAt(0).toUpperCase()}</div>`;
|
|
107
|
-
})
|
|
108
|
-
.join('');
|
|
109
|
-
|
|
110
|
-
return `<div class="messenger-avatar-stack messenger-avatar-stack-tiny">${avatarItems}</div>`;
|
|
111
|
-
}
|
|
112
|
-
|
|
113
100
|
_renderEmptyState() {
|
|
114
101
|
return `
|
|
115
102
|
<div class="messenger-empty-state">
|
|
116
103
|
<div class="messenger-empty-state-icon">
|
|
117
|
-
<
|
|
118
|
-
<path d="M228.54,86.66l-26.46,23.07A40,40,0,0,0,168,72.13L120.89,46.5a40,40,0,0,0-75.44-4l-22-19.2a8,8,0,0,0-10.5,12L35.44,54.77a40,40,0,0,0,50,61.07l47.1,25.64a40,40,0,0,0,75.41,4.07l26.46-23.07a8,8,0,0,0-10.5-12ZM56,96A24,24,0,1,1,77.25,82.75,24,24,0,0,1,56,96Zm144,64a24,24,0,1,1,24-24A24,24,0,0,1,200,160Z"></path>
|
|
119
|
-
</svg>
|
|
104
|
+
<iconify-icon icon="ph:megaphone-duotone" width="48" height="48"></iconify-icon>
|
|
120
105
|
</div>
|
|
121
106
|
<h3>No changelog yet</h3>
|
|
122
107
|
<p>Check back later for updates</p>
|
|
@@ -141,6 +126,12 @@ export class ChangelogView {
|
|
|
141
126
|
}
|
|
142
127
|
|
|
143
128
|
_attachEvents() {
|
|
129
|
+
this.element
|
|
130
|
+
.querySelector('.messenger-changelog-close-btn')
|
|
131
|
+
.addEventListener('click', () => {
|
|
132
|
+
this.state.setOpen(false);
|
|
133
|
+
});
|
|
134
|
+
|
|
144
135
|
this._attachChangelogEvents();
|
|
145
136
|
}
|
|
146
137
|
|
|
@@ -153,7 +144,7 @@ export class ChangelogView {
|
|
|
153
144
|
const changelogItem = this.state.changelogItems.find(
|
|
154
145
|
(n) => n.id === changelogId
|
|
155
146
|
);
|
|
156
|
-
if (changelogItem
|
|
147
|
+
if (changelogItem?.url) {
|
|
157
148
|
window.open(changelogItem.url, '_blank');
|
|
158
149
|
} else if (this.options.onChangelogClick) {
|
|
159
150
|
this.options.onChangelogClick(changelogItem);
|