@parafin/core 3.1.0 → 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 +5 -2
- package/out/index.js +5 -2
- package/package.json +1 -1
- package/.turbo/turbo-build.log +0 -1
package/index.ts
CHANGED
|
@@ -202,7 +202,8 @@ export const initializeParafinWidget = (
|
|
|
202
202
|
iframe: HTMLIFrameElement,
|
|
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')
|
|
@@ -241,6 +242,7 @@ export const initializeParafinWidget = (
|
|
|
241
242
|
...props,
|
|
242
243
|
route: data?.route,
|
|
243
244
|
onExit: () => {
|
|
245
|
+
initStartTime = Date.now()
|
|
244
246
|
iframe.src = iframeSrc
|
|
245
247
|
props.onExit?.()
|
|
246
248
|
},
|
|
@@ -281,10 +283,11 @@ export const initializeParafinWidget = (
|
|
|
281
283
|
}
|
|
282
284
|
break
|
|
283
285
|
case 'widget-load-complete':
|
|
284
|
-
if (props.onEvent) {
|
|
286
|
+
if (props.onEvent && !hasLoadedOnce) {
|
|
285
287
|
const timeToLoadInMs = Date.now() - initStartTime
|
|
286
288
|
props.onEvent('widget_loaded', { timeToLoadInMs })
|
|
287
289
|
}
|
|
290
|
+
hasLoadedOnce = true
|
|
288
291
|
break
|
|
289
292
|
}
|
|
290
293
|
}
|
package/out/index.js
CHANGED
|
@@ -131,7 +131,8 @@ const emptyMetadata = {
|
|
|
131
131
|
timeToLoadInMs: null,
|
|
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 = {
|
|
@@ -166,6 +167,7 @@ export const initializeParafinWidget = (iframe, props) => {
|
|
|
166
167
|
...props,
|
|
167
168
|
route: data?.route,
|
|
168
169
|
onExit: () => {
|
|
170
|
+
initStartTime = Date.now();
|
|
169
171
|
iframe.src = iframeSrc;
|
|
170
172
|
props.onExit?.();
|
|
171
173
|
},
|
|
@@ -210,10 +212,11 @@ export const initializeParafinWidget = (iframe, props) => {
|
|
|
210
212
|
}
|
|
211
213
|
break;
|
|
212
214
|
case 'widget-load-complete':
|
|
213
|
-
if (props.onEvent) {
|
|
215
|
+
if (props.onEvent && !hasLoadedOnce) {
|
|
214
216
|
const timeToLoadInMs = Date.now() - initStartTime;
|
|
215
217
|
props.onEvent('widget_loaded', { timeToLoadInMs });
|
|
216
218
|
}
|
|
219
|
+
hasLoadedOnce = true;
|
|
217
220
|
break;
|
|
218
221
|
}
|
|
219
222
|
}
|
package/package.json
CHANGED
package/.turbo/turbo-build.log
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
$ tsc
|