@parafin/react 7.1.0 → 7.1.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.
Files changed (2) hide show
  1. package/out/index.js +5 -2
  2. package/package.json +2 -2
package/out/index.js CHANGED
@@ -134,7 +134,8 @@ const emptyMetadata = {
134
134
  timeToLoadInMs: null,
135
135
  };
136
136
  const initializeParafinWidget = (iframe, props) => {
137
- const initStartTime = Date.now();
137
+ let initStartTime = Date.now();
138
+ let hasLoadedOnce = false;
138
139
  // @ts-ignore
139
140
  const url = new URL(props.widgetUrlOverride ?? 'https://widget.parafin.com');
140
141
  const query = {
@@ -169,6 +170,7 @@ const initializeParafinWidget = (iframe, props) => {
169
170
  ...props,
170
171
  route: data?.route,
171
172
  onExit: () => {
173
+ initStartTime = Date.now();
172
174
  iframe.src = iframeSrc;
173
175
  props.onExit?.();
174
176
  },
@@ -213,10 +215,11 @@ const initializeParafinWidget = (iframe, props) => {
213
215
  }
214
216
  break;
215
217
  case 'widget-load-complete':
216
- if (props.onEvent) {
218
+ if (props.onEvent && !hasLoadedOnce) {
217
219
  const timeToLoadInMs = Date.now() - initStartTime;
218
220
  props.onEvent('widget_loaded', { timeToLoadInMs });
219
221
  }
222
+ hasLoadedOnce = true;
220
223
  break;
221
224
  }
222
225
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parafin/react",
3
- "version": "7.1.0",
3
+ "version": "7.1.2",
4
4
  "description": "Parafin React widget",
5
5
  "author": "Parafin (https://www.parafin.com)",
6
6
  "module": "out/index.js",
@@ -26,6 +26,6 @@
26
26
  "typescript": "^4.9.5"
27
27
  },
28
28
  "dependencies": {
29
- "@parafin/core": "^3.1.0"
29
+ "@parafin/core": "^3.1.2"
30
30
  }
31
31
  }