@product7/feedback-sdk 1.1.9 → 1.2.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/dist/feedback-sdk.js +110 -122
- 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/styles/styles.js +68 -86
- package/src/widgets/ButtonWidget.js +43 -37
- package/types/index.d.ts +129 -67
package/dist/feedback-sdk.js
CHANGED
|
@@ -1365,16 +1365,22 @@
|
|
|
1365
1365
|
button.className = `feedback-widget feedback-widget-button theme-${this.options.theme} position-${this.options.position}`;
|
|
1366
1366
|
button.innerHTML = `
|
|
1367
1367
|
<button class="feedback-trigger-btn" type="button">
|
|
1368
|
-
<svg width="20" height="20" viewBox="0 0
|
|
1369
|
-
<path d="
|
|
1370
|
-
<path d="M18 8.118l-8 4-8-4V14a2 2 0 002 2h12a2 2 0 002-2V8.118z"/>
|
|
1371
|
-
</svg>
|
|
1372
|
-
Feedback
|
|
1373
|
-
</button>
|
|
1374
|
-
<button class="feedback-close-btn" type="button" title="Hide feedback button">
|
|
1375
|
-
<svg width="14" height="14" viewBox="0 0 14 14" fill="currentColor">
|
|
1376
|
-
<path d="M14 1.41L12.59 0L7 5.59L1.41 0L0 1.41L5.59 7L0 12.59L1.41 14L7 8.41L12.59 14L14 12.59L8.41 7L14 1.41Z"/>
|
|
1368
|
+
<svg class="feedback-icon" width="20" height="20" viewBox="0 0 256 256" fill="currentColor">
|
|
1369
|
+
<path d="M216,80H184V48a16,16,0,0,0-16-16H40A16,16,0,0,0,24,48V176a8,8,0,0,0,13,6.22L72,154V184a16,16,0,0,0,16,16h93.59L219,230.22a8,8,0,0,0,5,1.78,8,8,0,0,0,8-8V96A16,16,0,0,0,216,80ZM66.55,137.78,40,159.25V48H168v88H71.58A8,8,0,0,0,66.55,137.78ZM216,207.25l-26.55-21.47a8,8,0,0,0-5-1.78H88V152h80a16,16,0,0,0,16-16V96h32Z"/>
|
|
1377
1370
|
</svg>
|
|
1371
|
+
<span class="feedback-text">Feedback</span>
|
|
1372
|
+
|
|
1373
|
+
<div class="feedback-minimize-icon">
|
|
1374
|
+
<svg viewBox="0 0 256 256" fill="currentColor">
|
|
1375
|
+
<path d="M213.66,53.66,163.31,104H192a8,8,0,0,1,0,16H144a8,8,0,0,1-8-8V64a8,8,0,0,1,16,0V92.69l50.34-50.35a8,8,0,0,1,11.32,11.32ZM112,136H64a8,8,0,0,0,0,16H92.69L42.34,202.34a8,8,0,0,0,11.32,11.32L104,163.31V192a8,8,0,0,0,16,0V144A8,8,0,0,0,112,136Z"/>
|
|
1376
|
+
</svg>
|
|
1377
|
+
</div>
|
|
1378
|
+
|
|
1379
|
+
<div class="feedback-expand-icon">
|
|
1380
|
+
<svg viewBox="0 0 256 256" fill="currentColor">
|
|
1381
|
+
<path d="M112,40V64.69L61.66,14.34A8,8,0,0,0,50.34,25.66L100.69,76H72a8,8,0,0,0,0,16h48a8,8,0,0,0,8-8V36A8,8,0,0,0,112,40Zm131.06,70.61a8,8,0,0,0-8.72,1.73L184,162.69V136a8,8,0,0,0-16,0v48a8,8,0,0,0,8,8h48a8,8,0,0,0,0-16H195.31l50.35-50.34A8,8,0,0,0,243.06,110.61Z"/>
|
|
1382
|
+
</svg>
|
|
1383
|
+
</div>
|
|
1378
1384
|
</button>
|
|
1379
1385
|
`;
|
|
1380
1386
|
|
|
@@ -1387,17 +1393,28 @@
|
|
|
1387
1393
|
|
|
1388
1394
|
_attachEvents() {
|
|
1389
1395
|
const button = this.element.querySelector('.feedback-trigger-btn');
|
|
1390
|
-
const
|
|
1396
|
+
const minimizeIcon = this.element.querySelector('.feedback-minimize-icon');
|
|
1397
|
+
const expandIcon = this.element.querySelector('.feedback-expand-icon');
|
|
1391
1398
|
|
|
1392
|
-
button.addEventListener('click',
|
|
1393
|
-
|
|
1394
|
-
|
|
1399
|
+
button.addEventListener('click', (e) => {
|
|
1400
|
+
if (!e.target.closest('.feedback-minimize-icon') &&
|
|
1401
|
+
!e.target.closest('.feedback-expand-icon')) {
|
|
1402
|
+
this.openPanel();
|
|
1403
|
+
}
|
|
1404
|
+
});
|
|
1405
|
+
|
|
1406
|
+
minimizeIcon.addEventListener('click', (e) => {
|
|
1395
1407
|
e.stopPropagation();
|
|
1396
|
-
this.
|
|
1408
|
+
this.minimize();
|
|
1409
|
+
});
|
|
1410
|
+
|
|
1411
|
+
expandIcon.addEventListener('click', (e) => {
|
|
1412
|
+
e.stopPropagation();
|
|
1413
|
+
this.restore();
|
|
1397
1414
|
});
|
|
1398
1415
|
|
|
1399
1416
|
button.addEventListener('mouseenter', () => {
|
|
1400
|
-
if (!this.state.isSubmitting) {
|
|
1417
|
+
if (!this.state.isSubmitting && !this.isMinimized) {
|
|
1401
1418
|
button.style.transform = 'translateY(-2px)';
|
|
1402
1419
|
}
|
|
1403
1420
|
});
|
|
@@ -1407,35 +1424,24 @@
|
|
|
1407
1424
|
});
|
|
1408
1425
|
}
|
|
1409
1426
|
|
|
1410
|
-
|
|
1411
|
-
this.isMinimized =
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
localStorage.removeItem('feedback-widget-minimized');
|
|
1419
|
-
}
|
|
1427
|
+
minimize() {
|
|
1428
|
+
this.isMinimized = true;
|
|
1429
|
+
this.element.classList.add('minimized');
|
|
1430
|
+
}
|
|
1431
|
+
|
|
1432
|
+
restore() {
|
|
1433
|
+
this.isMinimized = false;
|
|
1434
|
+
this.element.classList.remove('minimized');
|
|
1420
1435
|
}
|
|
1421
1436
|
|
|
1422
1437
|
mount(container) {
|
|
1423
1438
|
super.mount(container);
|
|
1424
|
-
|
|
1425
|
-
// Check if it was previously minimized
|
|
1426
|
-
if (localStorage.getItem('feedback-widget-minimized') === 'true') {
|
|
1427
|
-
this.isMinimized = true;
|
|
1428
|
-
this.element.classList.add('minimized');
|
|
1429
|
-
}
|
|
1430
1439
|
}
|
|
1431
1440
|
|
|
1432
1441
|
updateText(text) {
|
|
1433
|
-
const
|
|
1434
|
-
if (
|
|
1435
|
-
|
|
1436
|
-
if (textNode && textNode.nodeType === Node.TEXT_NODE) {
|
|
1437
|
-
textNode.textContent = text;
|
|
1438
|
-
}
|
|
1442
|
+
const textEl = this.element?.querySelector('.feedback-text');
|
|
1443
|
+
if (textEl) {
|
|
1444
|
+
textEl.textContent = text;
|
|
1439
1445
|
}
|
|
1440
1446
|
}
|
|
1441
1447
|
|
|
@@ -6576,12 +6582,12 @@
|
|
|
6576
6582
|
display: flex;
|
|
6577
6583
|
align-items: center;
|
|
6578
6584
|
justify-content: center;
|
|
6579
|
-
gap:
|
|
6580
|
-
height:
|
|
6581
|
-
overflow:
|
|
6582
|
-
border-radius:
|
|
6585
|
+
gap: 8px;
|
|
6586
|
+
height: 48px;
|
|
6587
|
+
overflow: visible;
|
|
6588
|
+
border-radius: 9999px;
|
|
6583
6589
|
border: none;
|
|
6584
|
-
padding:
|
|
6590
|
+
padding: 12px 20px;
|
|
6585
6591
|
font-size: 14px;
|
|
6586
6592
|
font-weight: 500;
|
|
6587
6593
|
font-family: inherit;
|
|
@@ -6589,12 +6595,13 @@
|
|
|
6589
6595
|
transition: all 0.3s ease;
|
|
6590
6596
|
color: white;
|
|
6591
6597
|
background: #155EEF;
|
|
6592
|
-
box-shadow: 0
|
|
6598
|
+
box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
|
|
6599
|
+
width: fit-content;
|
|
6593
6600
|
}
|
|
6594
6601
|
|
|
6595
6602
|
.feedback-trigger-btn:hover:not(:disabled) {
|
|
6596
|
-
|
|
6597
|
-
box-shadow: 0
|
|
6603
|
+
transform: translateY(-2px);
|
|
6604
|
+
box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
|
|
6598
6605
|
}
|
|
6599
6606
|
|
|
6600
6607
|
.feedback-trigger-btn:disabled {
|
|
@@ -6607,69 +6614,64 @@
|
|
|
6607
6614
|
outline-offset: 2px;
|
|
6608
6615
|
}
|
|
6609
6616
|
|
|
6610
|
-
.feedback-
|
|
6617
|
+
.feedback-icon {
|
|
6618
|
+
flex-shrink: 0;
|
|
6619
|
+
}
|
|
6620
|
+
|
|
6621
|
+
.feedback-minimize-icon,
|
|
6622
|
+
.feedback-expand-icon {
|
|
6611
6623
|
position: absolute;
|
|
6612
|
-
top: -
|
|
6613
|
-
right: -
|
|
6624
|
+
top: -6px;
|
|
6625
|
+
right: -6px;
|
|
6614
6626
|
width: 24px;
|
|
6615
6627
|
height: 24px;
|
|
6628
|
+
padding: 4px;
|
|
6629
|
+
display: flex;
|
|
6630
|
+
align-items: center;
|
|
6631
|
+
justify-content: center;
|
|
6632
|
+
background: white;
|
|
6616
6633
|
border-radius: 50%;
|
|
6617
|
-
|
|
6618
|
-
|
|
6619
|
-
|
|
6634
|
+
opacity: 0;
|
|
6635
|
+
transition: opacity 0.2s ease;
|
|
6636
|
+
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
|
|
6620
6637
|
cursor: pointer;
|
|
6621
6638
|
display: flex;
|
|
6622
6639
|
align-items: center;
|
|
6623
6640
|
justify-content: center;
|
|
6624
|
-
opacity: 0;
|
|
6625
|
-
transition: all 0.2s ease;
|
|
6626
|
-
z-index: 10;
|
|
6627
|
-
padding: 0;
|
|
6628
|
-
}
|
|
6629
|
-
|
|
6630
|
-
.feedback-widget-button:hover .feedback-close-btn {
|
|
6631
|
-
opacity: 1;
|
|
6632
|
-
}
|
|
6633
|
-
|
|
6634
|
-
.feedback-close-btn:hover {
|
|
6635
|
-
background: #DC2626;
|
|
6636
|
-
transform: scale(1.1);
|
|
6637
6641
|
}
|
|
6638
6642
|
|
|
6639
|
-
.feedback-
|
|
6640
|
-
|
|
6641
|
-
|
|
6643
|
+
.feedback-minimize-icon svg,
|
|
6644
|
+
.feedback-expand-icon svg {
|
|
6645
|
+
width: 16px;
|
|
6646
|
+
height: 16px;
|
|
6647
|
+
display: block;
|
|
6648
|
+
fill: #155EEF;
|
|
6642
6649
|
}
|
|
6643
6650
|
|
|
6644
|
-
|
|
6645
|
-
|
|
6646
|
-
|
|
6651
|
+
/* Show minimize icon on hover when expanded */
|
|
6652
|
+
.feedback-widget-button:not(.minimized) .feedback-trigger-btn:hover .feedback-minimize-icon {
|
|
6653
|
+
opacity: 1;
|
|
6647
6654
|
}
|
|
6648
6655
|
|
|
6649
|
-
/* Minimized state */
|
|
6650
|
-
.feedback-widget-button.minimized {
|
|
6651
|
-
|
|
6652
|
-
|
|
6653
|
-
|
|
6656
|
+
/* Minimized state - just icon */
|
|
6657
|
+
.feedback-widget-button.minimized .feedback-trigger-btn {
|
|
6658
|
+
padding: 12px;
|
|
6659
|
+
width: 48px;
|
|
6660
|
+
height: 48px;
|
|
6661
|
+
justify-content: center;
|
|
6654
6662
|
}
|
|
6655
6663
|
|
|
6656
|
-
.feedback-widget-button.minimized
|
|
6657
|
-
|
|
6658
|
-
transform: scale(0.5);
|
|
6664
|
+
.feedback-widget-button.minimized .feedback-text {
|
|
6665
|
+
display: none;
|
|
6659
6666
|
}
|
|
6660
6667
|
|
|
6661
|
-
.feedback-widget-button.minimized .feedback-
|
|
6662
|
-
|
|
6668
|
+
.feedback-widget-button.minimized .feedback-minimize-icon {
|
|
6669
|
+
display: none;
|
|
6663
6670
|
}
|
|
6664
6671
|
|
|
6665
|
-
|
|
6672
|
+
/* Show expand icon on hover when minimized */
|
|
6673
|
+
.feedback-widget-button.minimized .feedback-trigger-btn:hover .feedback-expand-icon {
|
|
6666
6674
|
opacity: 1;
|
|
6667
|
-
background: #10B981;
|
|
6668
|
-
pointer-events: auto;
|
|
6669
|
-
}
|
|
6670
|
-
|
|
6671
|
-
.feedback-widget-button.minimized .feedback-close-btn:hover {
|
|
6672
|
-
background: #059669;
|
|
6673
6675
|
}
|
|
6674
6676
|
|
|
6675
6677
|
/* Side Panel Styles */
|
|
@@ -6838,7 +6840,7 @@
|
|
|
6838
6840
|
|
|
6839
6841
|
.feedback-form-group input:focus {
|
|
6840
6842
|
border-color: #155EEF;
|
|
6841
|
-
box-shadow: 0 0 0 3px rgba(
|
|
6843
|
+
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
|
|
6842
6844
|
}
|
|
6843
6845
|
|
|
6844
6846
|
.feedback-form-group input:focus-visible {
|
|
@@ -6868,7 +6870,7 @@
|
|
|
6868
6870
|
|
|
6869
6871
|
.feedback-form-group textarea:focus {
|
|
6870
6872
|
border-color: #155EEF;
|
|
6871
|
-
box-shadow: 0 0 0 3px rgba(
|
|
6873
|
+
box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
|
|
6872
6874
|
}
|
|
6873
6875
|
|
|
6874
6876
|
.feedback-form-group textarea:focus-visible {
|
|
@@ -6921,11 +6923,11 @@
|
|
|
6921
6923
|
}
|
|
6922
6924
|
|
|
6923
6925
|
.feedback-btn-submit:hover:not(:disabled) {
|
|
6924
|
-
background: #
|
|
6926
|
+
background: #4338ca;
|
|
6925
6927
|
}
|
|
6926
6928
|
|
|
6927
6929
|
.feedback-btn-submit:active:not(:disabled) {
|
|
6928
|
-
background: #
|
|
6930
|
+
background: #3730a3;
|
|
6929
6931
|
}
|
|
6930
6932
|
|
|
6931
6933
|
.feedback-btn-cancel {
|
|
@@ -7132,6 +7134,20 @@
|
|
|
7132
7134
|
left: 16px;
|
|
7133
7135
|
min-width: auto;
|
|
7134
7136
|
}
|
|
7137
|
+
|
|
7138
|
+
.feedback-minimize-icon,
|
|
7139
|
+
.feedback-expand-icon {
|
|
7140
|
+
top: -4px;
|
|
7141
|
+
right: -4px;
|
|
7142
|
+
width: 20px;
|
|
7143
|
+
height: 20px;
|
|
7144
|
+
}
|
|
7145
|
+
|
|
7146
|
+
.feedback-minimize-icon svg,
|
|
7147
|
+
.feedback-expand-icon svg {
|
|
7148
|
+
width: 14px;
|
|
7149
|
+
height: 14px;
|
|
7150
|
+
}
|
|
7135
7151
|
}
|
|
7136
7152
|
|
|
7137
7153
|
@media (prefers-reduced-motion: reduce) {
|
|
@@ -7139,7 +7155,9 @@
|
|
|
7139
7155
|
.feedback-btn,
|
|
7140
7156
|
.feedback-panel,
|
|
7141
7157
|
.feedback-panel-backdrop,
|
|
7142
|
-
.feedback-success-notification
|
|
7158
|
+
.feedback-success-notification,
|
|
7159
|
+
.feedback-minimize-icon,
|
|
7160
|
+
.feedback-expand-icon {
|
|
7143
7161
|
transition: none;
|
|
7144
7162
|
animation: none;
|
|
7145
7163
|
}
|
|
@@ -7152,36 +7170,6 @@
|
|
|
7152
7170
|
.feedback-success-notification {
|
|
7153
7171
|
display: none !important;
|
|
7154
7172
|
}
|
|
7155
|
-
|
|
7156
|
-
@media (max-width: 768px) {
|
|
7157
|
-
.feedback-close-btn {
|
|
7158
|
-
top: -6px;
|
|
7159
|
-
right: -6px;
|
|
7160
|
-
width: 20px;
|
|
7161
|
-
height: 20px;
|
|
7162
|
-
}
|
|
7163
|
-
|
|
7164
|
-
.feedback-close-btn svg {
|
|
7165
|
-
width: 8px;
|
|
7166
|
-
height: 8px;
|
|
7167
|
-
}
|
|
7168
|
-
|
|
7169
|
-
.feedback-widget-button.minimized {
|
|
7170
|
-
transform: scale(0.5);
|
|
7171
|
-
}
|
|
7172
|
-
|
|
7173
|
-
.feedback-widget-button.minimized:hover {
|
|
7174
|
-
transform: scale(0.6);
|
|
7175
|
-
}
|
|
7176
|
-
}
|
|
7177
|
-
|
|
7178
|
-
/* Reduced motion support */
|
|
7179
|
-
@media (prefers-reduced-motion: reduce) {
|
|
7180
|
-
.feedback-close-btn,
|
|
7181
|
-
.feedback-widget-button.minimized {
|
|
7182
|
-
transition: none;
|
|
7183
|
-
}
|
|
7184
|
-
}
|
|
7185
7173
|
}
|
|
7186
7174
|
`;
|
|
7187
7175
|
|