@product7/feedback-sdk 1.2.0 → 1.2.2

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.
@@ -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 20 20" fill="currentColor">
1369
- <path d="M2.003 5.884L10 9.882l7.997-3.998A2 2 0 0016 4H4a2 2 0 00-1.997 1.884z"/>
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">
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">
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,55 +1393,57 @@
1387
1393
 
1388
1394
  _attachEvents() {
1389
1395
  const button = this.element.querySelector('.feedback-trigger-btn');
1390
- const closeBtn = this.element.querySelector('.feedback-close-btn');
1391
-
1392
- button.addEventListener('click', this.openPanel);
1393
-
1394
- closeBtn.addEventListener('click', (e) => {
1395
- e.stopPropagation();
1396
- this.toggleMinimize();
1396
+ this.element.querySelector('.feedback-minimize-icon');
1397
+ this.element.querySelector('.feedback-expand-icon');
1398
+
1399
+ button.addEventListener('click', (e) => {
1400
+ const clickedMinimize = e.target.closest('.feedback-minimize-icon');
1401
+ const clickedExpand = e.target.closest('.feedback-expand-icon');
1402
+
1403
+ if (clickedMinimize) {
1404
+ e.stopPropagation();
1405
+ this.minimize();
1406
+ } else if (clickedExpand) {
1407
+ e.stopPropagation();
1408
+ this.restore();
1409
+ } else {
1410
+ if (!this.isMinimized) {
1411
+ this.openPanel();
1412
+ }
1413
+ }
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
  });
1404
1421
 
1405
1422
  button.addEventListener('mouseleave', () => {
1406
- button.style.transform = 'translateY(0)';
1423
+ if (!this.isMinimized) {
1424
+ button.style.transform = 'translateY(0)';
1425
+ }
1407
1426
  });
1408
1427
  }
1409
1428
 
1410
- toggleMinimize() {
1411
- this.isMinimized = !this.isMinimized;
1412
-
1413
- if (this.isMinimized) {
1414
- this.element.classList.add('minimized');
1415
- localStorage.setItem('feedback-widget-minimized', 'true');
1416
- } else {
1417
- this.element.classList.remove('minimized');
1418
- localStorage.removeItem('feedback-widget-minimized');
1419
- }
1429
+ minimize() {
1430
+ this.isMinimized = true;
1431
+ this.element.classList.add('minimized');
1432
+ }
1433
+
1434
+ restore() {
1435
+ this.isMinimized = false;
1436
+ this.element.classList.remove('minimized');
1420
1437
  }
1421
1438
 
1422
1439
  mount(container) {
1423
1440
  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
1441
  }
1431
1442
 
1432
1443
  updateText(text) {
1433
- const button = this.element?.querySelector('.feedback-trigger-btn');
1434
- if (button) {
1435
- const textNode = button.childNodes[button.childNodes.length - 1];
1436
- if (textNode && textNode.nodeType === Node.TEXT_NODE) {
1437
- textNode.textContent = text;
1438
- }
1444
+ const textEl = this.element?.querySelector('.feedback-text');
1445
+ if (textEl) {
1446
+ textEl.textContent = text;
1439
1447
  }
1440
1448
  }
1441
1449
 
@@ -6576,12 +6584,12 @@
6576
6584
  display: flex;
6577
6585
  align-items: center;
6578
6586
  justify-content: center;
6579
- gap: 12px;
6580
- height: 44px;
6581
- overflow: hidden;
6582
- border-radius: 0.5rem;
6587
+ gap: 8px;
6588
+ height: 48px;
6589
+ overflow: visible;
6590
+ border-radius: 9999px;
6583
6591
  border: none;
6584
- padding: 10px 16px;
6592
+ padding: 12px 20px;
6585
6593
  font-size: 14px;
6586
6594
  font-weight: 500;
6587
6595
  font-family: inherit;
@@ -6589,12 +6597,13 @@
6589
6597
  transition: all 0.3s ease;
6590
6598
  color: white;
6591
6599
  background: #155EEF;
6592
- box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.05);
6600
+ box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
6601
+ width: fit-content;
6593
6602
  }
6594
6603
 
6595
6604
  .feedback-trigger-btn:hover:not(:disabled) {
6596
- background: #004EEB;
6597
- box-shadow: 0 1px 2px 0 rgba(16, 24, 40, 0.1);
6605
+ transform: translateY(-2px);
6606
+ box-shadow: 0 6px 12px rgba(0, 0, 0, 0.15);
6598
6607
  }
6599
6608
 
6600
6609
  .feedback-trigger-btn:disabled {
@@ -6607,69 +6616,64 @@
6607
6616
  outline-offset: 2px;
6608
6617
  }
6609
6618
 
6610
- .feedback-close-btn {
6619
+ .feedback-icon {
6620
+ flex-shrink: 0;
6621
+ }
6622
+
6623
+ .feedback-minimize-icon,
6624
+ .feedback-expand-icon {
6611
6625
  position: absolute;
6612
- top: -8px;
6613
- right: -8px;
6626
+ top: -6px;
6627
+ right: -6px;
6614
6628
  width: 24px;
6615
6629
  height: 24px;
6630
+ padding: 4px;
6631
+ display: flex;
6632
+ align-items: center;
6633
+ justify-content: center;
6634
+ background: white;
6616
6635
  border-radius: 50%;
6617
- background: #EF4444;
6618
- border: 2px solid white;
6619
- color: white;
6636
+ opacity: 0;
6637
+ transition: opacity 0.2s ease;
6638
+ box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
6620
6639
  cursor: pointer;
6621
6640
  display: flex;
6622
6641
  align-items: center;
6623
6642
  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
6643
  }
6633
6644
 
6634
- .feedback-close-btn:hover {
6635
- background: #DC2626;
6636
- transform: scale(1.1);
6637
- }
6638
-
6639
- .feedback-close-btn:focus-visible {
6640
- outline: 2px solid #155EEF;
6641
- outline-offset: 2px;
6645
+ .feedback-minimize-icon svg,
6646
+ .feedback-expand-icon svg {
6647
+ width: 16px;
6648
+ height: 16px;
6649
+ display: block;
6650
+ fill: #155EEF;
6642
6651
  }
6643
6652
 
6644
- .feedback-close-btn svg {
6645
- width: 10px;
6646
- height: 10px;
6653
+ /* Show minimize icon on hover when expanded */
6654
+ .feedback-widget-button:not(.minimized) .feedback-trigger-btn:hover .feedback-minimize-icon {
6655
+ opacity: 1;
6647
6656
  }
6648
6657
 
6649
- /* Minimized state */
6650
- .feedback-widget-button.minimized {
6651
- transform: scale(0.4);
6652
- opacity: 0.3;
6653
- transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
6658
+ /* Minimized state - just icon */
6659
+ .feedback-widget-button.minimized .feedback-trigger-btn {
6660
+ padding: 12px;
6661
+ width: 48px;
6662
+ height: 48px;
6663
+ justify-content: center;
6654
6664
  }
6655
6665
 
6656
- .feedback-widget-button.minimized:hover {
6657
- opacity: 0.6;
6658
- transform: scale(0.5);
6666
+ .feedback-widget-button.minimized .feedback-text {
6667
+ display: none;
6659
6668
  }
6660
6669
 
6661
- .feedback-widget-button.minimized .feedback-trigger-btn {
6662
- pointer-events: none;
6670
+ .feedback-widget-button.minimized .feedback-minimize-icon {
6671
+ display: none;
6663
6672
  }
6664
6673
 
6665
- .feedback-widget-button.minimized .feedback-close-btn {
6674
+ /* Show expand icon on hover when minimized */
6675
+ .feedback-widget-button.minimized .feedback-trigger-btn:hover .feedback-expand-icon {
6666
6676
  opacity: 1;
6667
- background: #10B981;
6668
- pointer-events: auto;
6669
- }
6670
-
6671
- .feedback-widget-button.minimized .feedback-close-btn:hover {
6672
- background: #059669;
6673
6677
  }
6674
6678
 
6675
6679
  /* Side Panel Styles */
@@ -6838,7 +6842,7 @@
6838
6842
 
6839
6843
  .feedback-form-group input:focus {
6840
6844
  border-color: #155EEF;
6841
- box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.1);
6845
+ box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
6842
6846
  }
6843
6847
 
6844
6848
  .feedback-form-group input:focus-visible {
@@ -6868,7 +6872,7 @@
6868
6872
 
6869
6873
  .feedback-form-group textarea:focus {
6870
6874
  border-color: #155EEF;
6871
- box-shadow: 0 0 0 3px rgba(21, 94, 239, 0.1);
6875
+ box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.1);
6872
6876
  }
6873
6877
 
6874
6878
  .feedback-form-group textarea:focus-visible {
@@ -6921,11 +6925,11 @@
6921
6925
  }
6922
6926
 
6923
6927
  .feedback-btn-submit:hover:not(:disabled) {
6924
- background: #1A56DB;
6928
+ background: #4338ca;
6925
6929
  }
6926
6930
 
6927
6931
  .feedback-btn-submit:active:not(:disabled) {
6928
- background: #1E429F;
6932
+ background: #3730a3;
6929
6933
  }
6930
6934
 
6931
6935
  .feedback-btn-cancel {
@@ -7132,6 +7136,20 @@
7132
7136
  left: 16px;
7133
7137
  min-width: auto;
7134
7138
  }
7139
+
7140
+ .feedback-minimize-icon,
7141
+ .feedback-expand-icon {
7142
+ top: -4px;
7143
+ right: -4px;
7144
+ width: 20px;
7145
+ height: 20px;
7146
+ }
7147
+
7148
+ .feedback-minimize-icon svg,
7149
+ .feedback-expand-icon svg {
7150
+ width: 14px;
7151
+ height: 14px;
7152
+ }
7135
7153
  }
7136
7154
 
7137
7155
  @media (prefers-reduced-motion: reduce) {
@@ -7139,7 +7157,9 @@
7139
7157
  .feedback-btn,
7140
7158
  .feedback-panel,
7141
7159
  .feedback-panel-backdrop,
7142
- .feedback-success-notification {
7160
+ .feedback-success-notification,
7161
+ .feedback-minimize-icon,
7162
+ .feedback-expand-icon {
7143
7163
  transition: none;
7144
7164
  animation: none;
7145
7165
  }
@@ -7152,36 +7172,6 @@
7152
7172
  .feedback-success-notification {
7153
7173
  display: none !important;
7154
7174
  }
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
7175
  }
7186
7176
  `;
7187
7177