@product7/feedback-sdk 1.4.5 → 1.4.8
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
CHANGED
|
@@ -2165,6 +2165,7 @@
|
|
|
2165
2165
|
constructor(options) {
|
|
2166
2166
|
super({ ...options, type: 'button' });
|
|
2167
2167
|
this.isMinimized = false;
|
|
2168
|
+
this._hiddenForOpenPanel = false;
|
|
2168
2169
|
}
|
|
2169
2170
|
|
|
2170
2171
|
_render() {
|
|
@@ -2202,6 +2203,21 @@
|
|
|
2202
2203
|
const button = this.element.querySelector('.feedback-trigger-btn');
|
|
2203
2204
|
const minimizeIcon = this.element.querySelector('.feedback-minimize-icon');
|
|
2204
2205
|
const expandIcon = this.element.querySelector('.feedback-expand-icon');
|
|
2206
|
+
const isControlIcon = (target) => {
|
|
2207
|
+
if (!(target instanceof Element)) return false;
|
|
2208
|
+
return Boolean(
|
|
2209
|
+
target.closest('.feedback-minimize-icon') ||
|
|
2210
|
+
target.closest('.feedback-expand-icon')
|
|
2211
|
+
);
|
|
2212
|
+
};
|
|
2213
|
+
const openIfAllowed = (target) => {
|
|
2214
|
+
if (isControlIcon(target)) {
|
|
2215
|
+
return;
|
|
2216
|
+
}
|
|
2217
|
+
if (!this.isMinimized) {
|
|
2218
|
+
this.openPanel();
|
|
2219
|
+
}
|
|
2220
|
+
};
|
|
2205
2221
|
|
|
2206
2222
|
minimizeIcon.addEventListener('click', (e) => {
|
|
2207
2223
|
e.stopPropagation();
|
|
@@ -2216,16 +2232,13 @@
|
|
|
2216
2232
|
});
|
|
2217
2233
|
|
|
2218
2234
|
button.addEventListener('click', (e) => {
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
e.target.closest('.feedback-expand-icon')
|
|
2222
|
-
) {
|
|
2223
|
-
return;
|
|
2224
|
-
}
|
|
2235
|
+
openIfAllowed(e.target);
|
|
2236
|
+
});
|
|
2225
2237
|
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2238
|
+
// Pointer events improve consistency across touch and mouse devices.
|
|
2239
|
+
button.addEventListener('pointerup', (e) => {
|
|
2240
|
+
if (e.pointerType === 'mouse') return;
|
|
2241
|
+
openIfAllowed(e.target);
|
|
2229
2242
|
});
|
|
2230
2243
|
}
|
|
2231
2244
|
|
|
@@ -2239,6 +2252,28 @@
|
|
|
2239
2252
|
this.element.classList.remove('minimized');
|
|
2240
2253
|
}
|
|
2241
2254
|
|
|
2255
|
+
openPanel() {
|
|
2256
|
+
if (!this.state.isOpen) {
|
|
2257
|
+
this._hiddenForOpenPanel = true;
|
|
2258
|
+
this.hide();
|
|
2259
|
+
}
|
|
2260
|
+
super.openPanel();
|
|
2261
|
+
}
|
|
2262
|
+
|
|
2263
|
+
closePanel() {
|
|
2264
|
+
const shouldRestoreButton = this._hiddenForOpenPanel;
|
|
2265
|
+
super.closePanel();
|
|
2266
|
+
|
|
2267
|
+
if (shouldRestoreButton) {
|
|
2268
|
+
setTimeout(() => {
|
|
2269
|
+
if (!this.destroyed) {
|
|
2270
|
+
this.show();
|
|
2271
|
+
}
|
|
2272
|
+
this._hiddenForOpenPanel = false;
|
|
2273
|
+
}, 320);
|
|
2274
|
+
}
|
|
2275
|
+
}
|
|
2276
|
+
|
|
2242
2277
|
mount(container) {
|
|
2243
2278
|
super.mount(container);
|
|
2244
2279
|
}
|
|
@@ -8862,7 +8897,7 @@
|
|
|
8862
8897
|
const feedbackStyles = `
|
|
8863
8898
|
.feedback-widget-button {
|
|
8864
8899
|
position: fixed;
|
|
8865
|
-
z-index: var(--z-
|
|
8900
|
+
z-index: var(--z-notification);
|
|
8866
8901
|
}
|
|
8867
8902
|
|
|
8868
8903
|
.feedback-widget-button.position-bottom-right {
|
|
@@ -8904,6 +8939,8 @@
|
|
|
8904
8939
|
background: var(--color-primary);
|
|
8905
8940
|
box-shadow: var(--shadow-md);
|
|
8906
8941
|
width: fit-content;
|
|
8942
|
+
touch-action: manipulation;
|
|
8943
|
+
-webkit-tap-highlight-color: transparent;
|
|
8907
8944
|
}
|
|
8908
8945
|
|
|
8909
8946
|
.feedback-trigger-btn:hover:not(:disabled) {
|
|
@@ -8942,6 +8979,7 @@
|
|
|
8942
8979
|
transition: opacity var(--transition-base);
|
|
8943
8980
|
box-shadow: var(--shadow-sm);
|
|
8944
8981
|
cursor: pointer;
|
|
8982
|
+
pointer-events: none;
|
|
8945
8983
|
}
|
|
8946
8984
|
|
|
8947
8985
|
.feedback-minimize-icon svg,
|
|
@@ -8954,6 +8992,7 @@
|
|
|
8954
8992
|
|
|
8955
8993
|
.feedback-widget-button:not(.minimized) .feedback-trigger-btn:hover .feedback-minimize-icon {
|
|
8956
8994
|
opacity: 1;
|
|
8995
|
+
pointer-events: auto;
|
|
8957
8996
|
}
|
|
8958
8997
|
|
|
8959
8998
|
.feedback-widget-button.minimized .feedback-trigger-btn {
|
|
@@ -8973,6 +9012,7 @@
|
|
|
8973
9012
|
|
|
8974
9013
|
.feedback-widget-button.minimized .feedback-trigger-btn:hover .feedback-expand-icon {
|
|
8975
9014
|
opacity: 1;
|
|
9015
|
+
pointer-events: auto;
|
|
8976
9016
|
}
|
|
8977
9017
|
|
|
8978
9018
|
.feedback-panel {
|
|
@@ -9077,44 +9117,30 @@
|
|
|
9077
9117
|
}
|
|
9078
9118
|
|
|
9079
9119
|
.feedback-panel {
|
|
9080
|
-
width:
|
|
9120
|
+
width: min(420px, calc(100vw - (var(--spacing-4) * 2)));
|
|
9121
|
+
max-height: min(500px, calc(100vh - 88px));
|
|
9081
9122
|
top: auto;
|
|
9082
|
-
bottom:
|
|
9083
|
-
right:
|
|
9084
|
-
left:
|
|
9085
|
-
|
|
9086
|
-
|
|
9087
|
-
transform: translateY(100%);
|
|
9088
|
-
border-radius: var(--radius-3xl) var(--radius-3xl) 0 0;
|
|
9123
|
+
bottom: 72px;
|
|
9124
|
+
right: var(--spacing-4);
|
|
9125
|
+
left: auto;
|
|
9126
|
+
transform: translateX(calc(100% + 24px));
|
|
9127
|
+
border-radius: var(--radius-2xl);
|
|
9089
9128
|
}
|
|
9090
9129
|
|
|
9091
9130
|
.feedback-panel.open {
|
|
9092
|
-
transform:
|
|
9131
|
+
transform: translateX(0);
|
|
9093
9132
|
}
|
|
9094
9133
|
|
|
9095
9134
|
.feedback-panel-header {
|
|
9096
|
-
padding: var(--spacing-
|
|
9097
|
-
position: relative;
|
|
9098
|
-
}
|
|
9099
|
-
|
|
9100
|
-
.feedback-panel-header::before {
|
|
9101
|
-
content: '';
|
|
9102
|
-
position: absolute;
|
|
9103
|
-
top: var(--spacing-2);
|
|
9104
|
-
left: 50%;
|
|
9105
|
-
transform: translateX(-50%);
|
|
9106
|
-
width: 40px;
|
|
9107
|
-
height: 4px;
|
|
9108
|
-
background: var(--color-neutral-300);
|
|
9109
|
-
border-radius: 2px;
|
|
9135
|
+
padding: var(--spacing-4) var(--spacing-6);
|
|
9110
9136
|
}
|
|
9111
9137
|
|
|
9112
9138
|
.feedback-panel-body {
|
|
9113
|
-
padding: var(--spacing-
|
|
9139
|
+
padding: var(--spacing-6);
|
|
9114
9140
|
}
|
|
9115
9141
|
|
|
9116
9142
|
.feedback-form-group textarea {
|
|
9117
|
-
min-height:
|
|
9143
|
+
min-height: 120px;
|
|
9118
9144
|
}
|
|
9119
9145
|
}
|
|
9120
9146
|
`;
|