@product7/feedback-sdk 1.2.2 → 1.2.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@product7/feedback-sdk",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "description": "JavaScript SDK for integrating Product7 feedback widgets into any website",
5
5
  "main": "dist/feedback-sdk.js",
6
6
  "module": "src/index.js",
@@ -1,11 +1,12 @@
1
1
  import { BaseWidget } from './BaseWidget.js';
2
+
2
3
  export class ButtonWidget extends BaseWidget {
3
4
  constructor(options) {
4
5
  super({ ...options, type: 'button' });
5
6
  this.isMinimized = false;
6
7
  }
7
8
 
8
- _render() {
9
+ render() {
9
10
  const button = document.createElement('div');
10
11
  button.className = `feedback-widget feedback-widget-button theme-${this.options.theme} position-${this.options.position}`;
11
12
  button.innerHTML = `
@@ -36,25 +37,34 @@ export class ButtonWidget extends BaseWidget {
36
37
  return button;
37
38
  }
38
39
 
39
- _attachEvents() {
40
+ attachEvents() {
40
41
  const button = this.element.querySelector('.feedback-trigger-btn');
41
42
  const minimizeIcon = this.element.querySelector('.feedback-minimize-icon');
42
43
  const expandIcon = this.element.querySelector('.feedback-expand-icon');
43
44
 
45
+ // Add click handlers directly to the icons
46
+ minimizeIcon.addEventListener('click', (e) => {
47
+ e.stopPropagation();
48
+ e.preventDefault();
49
+ this.minimize();
50
+ });
51
+
52
+ expandIcon.addEventListener('click', (e) => {
53
+ e.stopPropagation();
54
+ e.preventDefault();
55
+ this.restore();
56
+ });
57
+
58
+ // Main button click handler
44
59
  button.addEventListener('click', (e) => {
45
- const clickedMinimize = e.target.closest('.feedback-minimize-icon');
46
- const clickedExpand = e.target.closest('.feedback-expand-icon');
60
+ // Check if the click originated from an icon
61
+ if (e.target.closest('.feedback-minimize-icon') ||
62
+ e.target.closest('.feedback-expand-icon')) {
63
+ return; // Let the icon handlers deal with it
64
+ }
47
65
 
48
- if (clickedMinimize) {
49
- e.stopPropagation();
50
- this.minimize();
51
- } else if (clickedExpand) {
52
- e.stopPropagation();
53
- this.restore();
54
- } else {
55
- if (!this.isMinimized) {
56
- this.openPanel();
57
- }
66
+ if (!this.isMinimized) {
67
+ this.openPanel();
58
68
  }
59
69
  });
60
70