@parafin/react 7.1.1 → 7.2.0

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.
Files changed (2) hide show
  1. package/out/index.js +6 -1
  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()}`;
@@ -135,6 +138,7 @@ const emptyMetadata = {
135
138
  };
136
139
  const initializeParafinWidget = (iframe, props) => {
137
140
  let initStartTime = Date.now();
141
+ let hasLoadedOnce = false;
138
142
  // @ts-ignore
139
143
  const url = new URL(props.widgetUrlOverride ?? 'https://widget.parafin.com');
140
144
  const query = {
@@ -214,10 +218,11 @@ const initializeParafinWidget = (iframe, props) => {
214
218
  }
215
219
  break;
216
220
  case 'widget-load-complete':
217
- if (props.onEvent) {
221
+ if (props.onEvent && !hasLoadedOnce) {
218
222
  const timeToLoadInMs = Date.now() - initStartTime;
219
223
  props.onEvent('widget_loaded', { timeToLoadInMs });
220
224
  }
225
+ hasLoadedOnce = true;
221
226
  break;
222
227
  }
223
228
  }
package/package.json CHANGED
@@ -1,11 +1,19 @@
1
1
  {
2
2
  "name": "@parafin/react",
3
- "version": "7.1.1",
3
+ "version": "7.2.0",
4
4
  "description": "Parafin React widget",
5
5
  "author": "Parafin (https://www.parafin.com)",
6
- "module": "out/index.js",
7
- "types": "out/index.d.ts",
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.1"
37
+ "@parafin/core": "^3.2.0"
30
38
  }
31
39
  }