@parafin/core 3.1.1 → 3.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.
package/index.ts CHANGED
@@ -203,6 +203,7 @@ export const initializeParafinWidget = (
203
203
  props: WidgetProps
204
204
  ) => {
205
205
  let initStartTime = Date.now()
206
+ let hasLoadedOnce = false
206
207
 
207
208
  // @ts-ignore
208
209
  const url = new URL(props.widgetUrlOverride ?? 'https://widget.parafin.com')
@@ -282,10 +283,11 @@ export const initializeParafinWidget = (
282
283
  }
283
284
  break
284
285
  case 'widget-load-complete':
285
- if (props.onEvent) {
286
+ if (props.onEvent && !hasLoadedOnce) {
286
287
  const timeToLoadInMs = Date.now() - initStartTime
287
288
  props.onEvent('widget_loaded', { timeToLoadInMs })
288
289
  }
290
+ hasLoadedOnce = true
289
291
  break
290
292
  }
291
293
  }
package/out/index.js CHANGED
@@ -132,6 +132,7 @@ const emptyMetadata = {
132
132
  };
133
133
  export const initializeParafinWidget = (iframe, props) => {
134
134
  let initStartTime = Date.now();
135
+ let hasLoadedOnce = false;
135
136
  // @ts-ignore
136
137
  const url = new URL(props.widgetUrlOverride ?? 'https://widget.parafin.com');
137
138
  const query = {
@@ -211,10 +212,11 @@ export const initializeParafinWidget = (iframe, props) => {
211
212
  }
212
213
  break;
213
214
  case 'widget-load-complete':
214
- if (props.onEvent) {
215
+ if (props.onEvent && !hasLoadedOnce) {
215
216
  const timeToLoadInMs = Date.now() - initStartTime;
216
217
  props.onEvent('widget_loaded', { timeToLoadInMs });
217
218
  }
219
+ hasLoadedOnce = true;
218
220
  break;
219
221
  }
220
222
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@parafin/core",
3
- "version": "3.1.1",
3
+ "version": "3.1.2",
4
4
  "description": "Parafin embedded core",
5
5
  "author": "Parafin (https://www.parafin.com)",
6
6
  "module": "out/index.js",