@parafin/react 7.2.0 → 7.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.
- package/out/index.js +23 -4
- package/package.json +3 -3
package/out/index.js
CHANGED
|
@@ -32,6 +32,11 @@ const openParafinDashboard = (props) => {
|
|
|
32
32
|
...('inWebView' in props &&
|
|
33
33
|
props.inWebView !== undefined &&
|
|
34
34
|
props.inWebView !== null && { inWebView: props.inWebView.toString() }),
|
|
35
|
+
...('hideCloseButton' in props &&
|
|
36
|
+
props.hideCloseButton !== undefined &&
|
|
37
|
+
props.hideCloseButton !== null && {
|
|
38
|
+
hideCloseButton: props.hideCloseButton.toString(),
|
|
39
|
+
}),
|
|
35
40
|
...(props.dashboardTargetElementId && {
|
|
36
41
|
isDashboardEmbedded: 'true',
|
|
37
42
|
}),
|
|
@@ -94,7 +99,9 @@ const openParafinDashboard = (props) => {
|
|
|
94
99
|
if (withOnExit)
|
|
95
100
|
onExit();
|
|
96
101
|
dashboardTargetElement.removeChild(frame);
|
|
97
|
-
|
|
102
|
+
if (!props.dashboardTargetElementId) {
|
|
103
|
+
document.body.style.removeProperty('overflow');
|
|
104
|
+
}
|
|
98
105
|
}, 200);
|
|
99
106
|
};
|
|
100
107
|
const messageListener = async (event) => {
|
|
@@ -115,7 +122,9 @@ const openParafinDashboard = (props) => {
|
|
|
115
122
|
dashboardTargetElement.appendChild(frame);
|
|
116
123
|
setTimeout(() => {
|
|
117
124
|
frame.style.opacity = '1';
|
|
118
|
-
|
|
125
|
+
if (!props.dashboardTargetElementId) {
|
|
126
|
+
document.body.style.overflow = 'hidden';
|
|
127
|
+
}
|
|
119
128
|
}, 0);
|
|
120
129
|
return () => cleanup({ withOnExit: false });
|
|
121
130
|
}
|
|
@@ -139,6 +148,7 @@ const emptyMetadata = {
|
|
|
139
148
|
const initializeParafinWidget = (iframe, props) => {
|
|
140
149
|
let initStartTime = Date.now();
|
|
141
150
|
let hasLoadedOnce = false;
|
|
151
|
+
let wasEverHidden = document.hidden;
|
|
142
152
|
// @ts-ignore
|
|
143
153
|
const url = new URL(props.widgetUrlOverride ?? 'https://widget.parafin.com');
|
|
144
154
|
const query = {
|
|
@@ -218,7 +228,7 @@ const initializeParafinWidget = (iframe, props) => {
|
|
|
218
228
|
}
|
|
219
229
|
break;
|
|
220
230
|
case 'widget-load-complete':
|
|
221
|
-
if (props.onEvent && !hasLoadedOnce) {
|
|
231
|
+
if (props.onEvent && !hasLoadedOnce && !wasEverHidden) {
|
|
222
232
|
const timeToLoadInMs = Date.now() - initStartTime;
|
|
223
233
|
props.onEvent('widget_loaded', { timeToLoadInMs });
|
|
224
234
|
}
|
|
@@ -227,8 +237,17 @@ const initializeParafinWidget = (iframe, props) => {
|
|
|
227
237
|
}
|
|
228
238
|
}
|
|
229
239
|
};
|
|
240
|
+
const visibilityHandler = () => {
|
|
241
|
+
if (document.hidden) {
|
|
242
|
+
wasEverHidden = true;
|
|
243
|
+
}
|
|
244
|
+
};
|
|
230
245
|
window.addEventListener('message', messageListener);
|
|
231
|
-
|
|
246
|
+
document.addEventListener('visibilitychange', visibilityHandler);
|
|
247
|
+
return () => {
|
|
248
|
+
window.removeEventListener('message', messageListener);
|
|
249
|
+
document.removeEventListener('visibilitychange', visibilityHandler);
|
|
250
|
+
};
|
|
232
251
|
};
|
|
233
252
|
|
|
234
253
|
const ParafinWidget = (props) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parafin/react",
|
|
3
|
-
"version": "7.2.
|
|
3
|
+
"version": "7.2.2",
|
|
4
4
|
"description": "Parafin React widget",
|
|
5
5
|
"author": "Parafin (https://www.parafin.com)",
|
|
6
6
|
"main": "./out/index.js",
|
|
@@ -31,9 +31,9 @@
|
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/react": ">=16.8.0",
|
|
34
|
-
"typescript": "^
|
|
34
|
+
"typescript": "^5.9.3"
|
|
35
35
|
},
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@parafin/core": "^3.2.
|
|
37
|
+
"@parafin/core": "^3.2.1"
|
|
38
38
|
}
|
|
39
39
|
}
|