@parafin/react 7.1.2 → 7.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/out/index.js +15 -2
- package/package.json +12 -4
package/out/index.js
CHANGED
|
@@ -32,6 +32,9 @@ const openParafinDashboard = (props) => {
|
|
|
32
32
|
...('inWebView' in props &&
|
|
33
33
|
props.inWebView !== undefined &&
|
|
34
34
|
props.inWebView !== null && { inWebView: props.inWebView.toString() }),
|
|
35
|
+
...(props.dashboardTargetElementId && {
|
|
36
|
+
isDashboardEmbedded: 'true',
|
|
37
|
+
}),
|
|
35
38
|
...Object.fromEntries(searchParams),
|
|
36
39
|
};
|
|
37
40
|
const url = `${origin}${route}?${new URLSearchParams(query).toString()}`;
|
|
@@ -136,6 +139,7 @@ const emptyMetadata = {
|
|
|
136
139
|
const initializeParafinWidget = (iframe, props) => {
|
|
137
140
|
let initStartTime = Date.now();
|
|
138
141
|
let hasLoadedOnce = false;
|
|
142
|
+
let wasEverHidden = document.hidden;
|
|
139
143
|
// @ts-ignore
|
|
140
144
|
const url = new URL(props.widgetUrlOverride ?? 'https://widget.parafin.com');
|
|
141
145
|
const query = {
|
|
@@ -215,7 +219,7 @@ const initializeParafinWidget = (iframe, props) => {
|
|
|
215
219
|
}
|
|
216
220
|
break;
|
|
217
221
|
case 'widget-load-complete':
|
|
218
|
-
if (props.onEvent && !hasLoadedOnce) {
|
|
222
|
+
if (props.onEvent && !hasLoadedOnce && !wasEverHidden) {
|
|
219
223
|
const timeToLoadInMs = Date.now() - initStartTime;
|
|
220
224
|
props.onEvent('widget_loaded', { timeToLoadInMs });
|
|
221
225
|
}
|
|
@@ -224,8 +228,17 @@ const initializeParafinWidget = (iframe, props) => {
|
|
|
224
228
|
}
|
|
225
229
|
}
|
|
226
230
|
};
|
|
231
|
+
const visibilityHandler = () => {
|
|
232
|
+
if (document.hidden) {
|
|
233
|
+
wasEverHidden = true;
|
|
234
|
+
}
|
|
235
|
+
};
|
|
227
236
|
window.addEventListener('message', messageListener);
|
|
228
|
-
|
|
237
|
+
document.addEventListener('visibilitychange', visibilityHandler);
|
|
238
|
+
return () => {
|
|
239
|
+
window.removeEventListener('message', messageListener);
|
|
240
|
+
document.removeEventListener('visibilitychange', visibilityHandler);
|
|
241
|
+
};
|
|
229
242
|
};
|
|
230
243
|
|
|
231
244
|
const ParafinWidget = (props) => {
|
package/package.json
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@parafin/react",
|
|
3
|
-
"version": "7.1
|
|
3
|
+
"version": "7.2.1",
|
|
4
4
|
"description": "Parafin React widget",
|
|
5
5
|
"author": "Parafin (https://www.parafin.com)",
|
|
6
|
-
"
|
|
7
|
-
"
|
|
6
|
+
"main": "./out/index.js",
|
|
7
|
+
"module": "./out/index.js",
|
|
8
|
+
"types": "./out/index.d.ts",
|
|
8
9
|
"type": "module",
|
|
10
|
+
"exports": {
|
|
11
|
+
".": {
|
|
12
|
+
"types": "./out/index.d.ts",
|
|
13
|
+
"import": "./out/index.js",
|
|
14
|
+
"default": "./out/index.js"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
9
17
|
"license": "MIT",
|
|
10
18
|
"files": [
|
|
11
19
|
"out"
|
|
@@ -26,6 +34,6 @@
|
|
|
26
34
|
"typescript": "^4.9.5"
|
|
27
35
|
},
|
|
28
36
|
"dependencies": {
|
|
29
|
-
"@parafin/core": "^3.1
|
|
37
|
+
"@parafin/core": "^3.2.1"
|
|
30
38
|
}
|
|
31
39
|
}
|