@product7/feedback-sdk 1.6.0 → 1.6.1
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 +347 -134
- 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 +156 -15
- 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 +124 -28
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,48 @@ 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
|
+
/* Search — back to normal style on light bg */
|
|
509
|
+
.messenger-help-search-wrap {
|
|
510
|
+
position: relative;
|
|
511
|
+
width: 100%;
|
|
512
|
+
}
|
|
513
|
+
|
|
514
|
+
.messenger-help-search-icon {
|
|
515
|
+
position: absolute;
|
|
516
|
+
left: var(--spacing-3);
|
|
517
|
+
top: 50%;
|
|
518
|
+
transform: translateY(-50%);
|
|
519
|
+
color: var(--color-text-tertiary);
|
|
520
|
+
display: flex;
|
|
521
|
+
align-items: center;
|
|
522
|
+
pointer-events: none;
|
|
523
|
+
}
|
|
524
|
+
|
|
482
525
|
.messenger-help-search-input {
|
|
483
526
|
width: 100%;
|
|
484
|
-
background:
|
|
527
|
+
background: rgba(255, 255, 255, 0.7);
|
|
485
528
|
border: 1px solid var(--color-border);
|
|
486
529
|
border-radius: var(--radius-md);
|
|
487
|
-
padding: var(--spacing-2) var(--spacing-3);
|
|
530
|
+
padding: var(--spacing-2) var(--spacing-3) var(--spacing-2) calc(var(--spacing-3) + 16px + var(--spacing-2));
|
|
488
531
|
font-size: var(--font-size-base);
|
|
489
532
|
font-weight: var(--font-weight-normal);
|
|
490
533
|
color: var(--color-text-primary);
|
|
491
534
|
font-family: inherit;
|
|
492
535
|
outline: none;
|
|
493
|
-
transition: border-color var(--transition-base);
|
|
536
|
+
transition: border-color var(--transition-base), background var(--transition-base);
|
|
537
|
+
box-sizing: border-box;
|
|
494
538
|
}
|
|
495
539
|
|
|
496
540
|
.messenger-help-search-input:focus {
|
|
@@ -502,6 +546,7 @@ export const messengerViewsStyles = `
|
|
|
502
546
|
color: var(--color-text-tertiary);
|
|
503
547
|
}
|
|
504
548
|
|
|
549
|
+
/* Body */
|
|
505
550
|
.messenger-help-body {
|
|
506
551
|
flex: 1;
|
|
507
552
|
overflow-y: auto;
|
|
@@ -516,9 +561,12 @@ export const messengerViewsStyles = `
|
|
|
516
561
|
padding: 0;
|
|
517
562
|
}
|
|
518
563
|
|
|
564
|
+
/* ── Collection item ─────────────────────────────── */
|
|
565
|
+
|
|
519
566
|
.messenger-help-collection {
|
|
520
567
|
display: flex;
|
|
521
568
|
align-items: center;
|
|
569
|
+
gap: var(--spacing-3);
|
|
522
570
|
padding: var(--spacing-4) var(--spacing-5);
|
|
523
571
|
cursor: pointer;
|
|
524
572
|
transition: background var(--transition-base);
|
|
@@ -529,13 +577,34 @@ export const messengerViewsStyles = `
|
|
|
529
577
|
background: var(--color-neutral-50);
|
|
530
578
|
}
|
|
531
579
|
|
|
580
|
+
/* Icon pill — tinted with primary colour */
|
|
581
|
+
.messenger-help-collection-icon {
|
|
582
|
+
flex-shrink: 0;
|
|
583
|
+
width: 36px;
|
|
584
|
+
height: 36px;
|
|
585
|
+
border-radius: var(--radius-md);
|
|
586
|
+
background: color-mix(in srgb, var(--color-primary) 10%, transparent);
|
|
587
|
+
color: var(--color-primary);
|
|
588
|
+
display: flex;
|
|
589
|
+
align-items: center;
|
|
590
|
+
justify-content: center;
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
.messenger-help-collection-icon svg,
|
|
594
|
+
.messenger-help-collection-icon iconify-icon {
|
|
595
|
+
width: 20px;
|
|
596
|
+
height: 20px;
|
|
597
|
+
display: block;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
/* Content area */
|
|
532
601
|
.messenger-help-collection-content {
|
|
533
602
|
flex: 1;
|
|
534
603
|
min-width: 0;
|
|
535
604
|
}
|
|
536
605
|
|
|
537
606
|
.messenger-help-collection-title {
|
|
538
|
-
margin: 0 0
|
|
607
|
+
margin: 0 0 2px;
|
|
539
608
|
font-size: var(--font-size-md);
|
|
540
609
|
font-weight: var(--font-weight-bold);
|
|
541
610
|
color: var(--color-text-primary);
|
|
@@ -543,10 +612,40 @@ export const messengerViewsStyles = `
|
|
|
543
612
|
}
|
|
544
613
|
|
|
545
614
|
.messenger-help-collection-desc {
|
|
546
|
-
margin: 0 0 var(--spacing-
|
|
547
|
-
font-size: var(--font-size-
|
|
615
|
+
margin: 0 0 var(--spacing-2);
|
|
616
|
+
font-size: var(--font-size-sm);
|
|
548
617
|
color: var(--color-text-secondary);
|
|
549
618
|
line-height: var(--line-height-normal);
|
|
619
|
+
display: -webkit-box;
|
|
620
|
+
-webkit-line-clamp: 2;
|
|
621
|
+
-webkit-box-orient: vertical;
|
|
622
|
+
overflow: hidden;
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/* Meta row: author avatar + article count */
|
|
626
|
+
.messenger-help-collection-meta {
|
|
627
|
+
display: flex;
|
|
628
|
+
align-items: center;
|
|
629
|
+
gap: var(--spacing-2);
|
|
630
|
+
}
|
|
631
|
+
|
|
632
|
+
/* Avatar — shared base */
|
|
633
|
+
.messenger-help-collection-avatar {
|
|
634
|
+
width: 18px;
|
|
635
|
+
height: 18px;
|
|
636
|
+
border-radius: var(--radius-full);
|
|
637
|
+
flex-shrink: 0;
|
|
638
|
+
object-fit: cover;
|
|
639
|
+
}
|
|
640
|
+
|
|
641
|
+
/* Initials fallback */
|
|
642
|
+
.messenger-help-collection-avatar--initials {
|
|
643
|
+
display: inline-flex;
|
|
644
|
+
align-items: center;
|
|
645
|
+
justify-content: center;
|
|
646
|
+
font-size: 9px;
|
|
647
|
+
font-weight: 600;
|
|
648
|
+
line-height: 1;
|
|
550
649
|
}
|
|
551
650
|
|
|
552
651
|
.messenger-help-collection-count {
|
|
@@ -557,9 +656,11 @@ export const messengerViewsStyles = `
|
|
|
557
656
|
.messenger-help-collection-arrow {
|
|
558
657
|
color: var(--color-text-tertiary);
|
|
559
658
|
flex-shrink: 0;
|
|
560
|
-
margin-left:
|
|
659
|
+
margin-left: auto;
|
|
561
660
|
}
|
|
562
661
|
|
|
662
|
+
/* ── Footer (kept for optional use) ─────────────── */
|
|
663
|
+
|
|
563
664
|
.messenger-help-footer {
|
|
564
665
|
padding: var(--spacing-4) var(--spacing-5);
|
|
565
666
|
border-top: 1px solid var(--color-border);
|
|
@@ -587,19 +688,59 @@ export const messengerViewsStyles = `
|
|
|
587
688
|
======================================== */
|
|
588
689
|
|
|
589
690
|
.messenger-changelog-header {
|
|
691
|
+
padding: var(--spacing-3) var(--spacing-5);
|
|
692
|
+
border-bottom: 1px solid var(--color-border);
|
|
693
|
+
flex-shrink: 0;
|
|
694
|
+
background: linear-gradient(180deg, #f0f4ff 0%, #ffffff 100%);
|
|
695
|
+
position: relative;
|
|
696
|
+
overflow: hidden;
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
.messenger-changelog-header::before {
|
|
700
|
+
content: '';
|
|
701
|
+
position: absolute;
|
|
702
|
+
top: -20px;
|
|
703
|
+
left: -20px;
|
|
704
|
+
width: 200px;
|
|
705
|
+
height: 200px;
|
|
706
|
+
background: radial-gradient(circle, rgba(21, 94, 239, 0.12) 0%, transparent 70%);
|
|
707
|
+
filter: blur(30px);
|
|
708
|
+
pointer-events: none;
|
|
709
|
+
}
|
|
710
|
+
|
|
711
|
+
.messenger-changelog-header::after {
|
|
712
|
+
content: '';
|
|
713
|
+
position: absolute;
|
|
714
|
+
top: -10px;
|
|
715
|
+
right: -20px;
|
|
716
|
+
width: 150px;
|
|
717
|
+
height: 150px;
|
|
718
|
+
background: radial-gradient(circle, rgba(139, 92, 246, 0.08) 0%, transparent 70%);
|
|
719
|
+
filter: blur(25px);
|
|
720
|
+
pointer-events: none;
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
.messenger-changelog-header-top {
|
|
590
724
|
display: flex;
|
|
591
725
|
align-items: center;
|
|
592
726
|
justify-content: center;
|
|
593
|
-
|
|
727
|
+
position: relative;
|
|
594
728
|
}
|
|
595
729
|
|
|
596
|
-
.messenger-changelog-header h2 {
|
|
730
|
+
.messenger-changelog-header-top h2 {
|
|
597
731
|
margin: 0;
|
|
598
|
-
font-size: var(--font-size-
|
|
732
|
+
font-size: var(--font-size-md);
|
|
599
733
|
font-weight: var(--font-weight-semibold);
|
|
600
734
|
color: var(--color-text-primary);
|
|
601
735
|
}
|
|
602
736
|
|
|
737
|
+
.messenger-changelog-close-btn {
|
|
738
|
+
position: absolute;
|
|
739
|
+
right: 0;
|
|
740
|
+
top: 50%;
|
|
741
|
+
transform: translateY(-50%);
|
|
742
|
+
}
|
|
743
|
+
|
|
603
744
|
.messenger-changelog-body {
|
|
604
745
|
flex: 1;
|
|
605
746
|
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);
|