@diegotsi/flint-react 2.9.1 → 2.10.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/dist/index.cjs +49 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -3
- package/dist/index.d.ts +5 -3
- package/dist/index.js +42 -7
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FlintUser, Theme, EnvironmentInfo, ConsoleEntry, NetworkEntry, FormErrorEntry, ReportPayload, ReportResult, FlintWidgetProps } from '@diegotsi/flint-core';
|
|
2
|
-
export {
|
|
1
|
+
import { FlintUser, Theme, EnvironmentInfo, ConsoleEntry, NetworkEntry, FormErrorEntry, ReportPayload, ReportResult, FlintWidgetProps, Flint as Flint$1 } from '@diegotsi/flint-core';
|
|
2
|
+
export { FlintConfig, FlintUser, FlintWidgetProps, Locale, ReportPayload, ReportResult, Severity, Theme, ThemeOverride } from '@diegotsi/flint-core';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
|
|
5
5
|
declare type addedNodeMutation = {
|
|
@@ -444,4 +444,6 @@ declare function FlintModal({ user, meta, theme, zIndex, onClose, getEnvironment
|
|
|
444
444
|
|
|
445
445
|
declare function FlintWidget(props: FlintWidgetProps): react.JSX.Element;
|
|
446
446
|
|
|
447
|
-
|
|
447
|
+
declare const Flint: typeof Flint$1;
|
|
448
|
+
|
|
449
|
+
export { Flint, FlintModal, FlintWidget };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { FlintUser, Theme, EnvironmentInfo, ConsoleEntry, NetworkEntry, FormErrorEntry, ReportPayload, ReportResult, FlintWidgetProps } from '@diegotsi/flint-core';
|
|
2
|
-
export {
|
|
1
|
+
import { FlintUser, Theme, EnvironmentInfo, ConsoleEntry, NetworkEntry, FormErrorEntry, ReportPayload, ReportResult, FlintWidgetProps, Flint as Flint$1 } from '@diegotsi/flint-core';
|
|
2
|
+
export { FlintConfig, FlintUser, FlintWidgetProps, Locale, ReportPayload, ReportResult, Severity, Theme, ThemeOverride } from '@diegotsi/flint-core';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
|
|
5
5
|
declare type addedNodeMutation = {
|
|
@@ -444,4 +444,6 @@ declare function FlintModal({ user, meta, theme, zIndex, onClose, getEnvironment
|
|
|
444
444
|
|
|
445
445
|
declare function FlintWidget(props: FlintWidgetProps): react.JSX.Element;
|
|
446
446
|
|
|
447
|
-
|
|
447
|
+
declare const Flint: typeof Flint$1;
|
|
448
|
+
|
|
449
|
+
export { Flint, FlintModal, FlintWidget };
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
// src/FlintModal.tsx
|
|
2
2
|
import {
|
|
3
|
-
Flint
|
|
3
|
+
Flint,
|
|
4
|
+
trackDatadogBugReported
|
|
4
5
|
} from "@diegotsi/flint-core";
|
|
5
6
|
import { useCallback, useEffect as useEffect2, useRef as useRef2, useState as useState2 } from "react";
|
|
6
7
|
import { useTranslation } from "react-i18next";
|
|
@@ -351,6 +352,12 @@ function FlintModal({
|
|
|
351
352
|
setResult(res);
|
|
352
353
|
setStatus("success");
|
|
353
354
|
onSuccess?.(res);
|
|
355
|
+
trackDatadogBugReported({
|
|
356
|
+
bugId: res.id,
|
|
357
|
+
severity: payload.severity,
|
|
358
|
+
url: payload.url,
|
|
359
|
+
title: payload.description.slice(0, 120)
|
|
360
|
+
});
|
|
354
361
|
const events = getReplayEvents();
|
|
355
362
|
if (events.length > 0) {
|
|
356
363
|
submitReplay(serverUrl, projectKey, res.id, events).catch(() => {
|
|
@@ -1431,9 +1438,41 @@ widgetI18n.use(initReactI18next).init({
|
|
|
1431
1438
|
var i18n_default = widgetI18n;
|
|
1432
1439
|
|
|
1433
1440
|
// src/store.ts
|
|
1434
|
-
import { getSnapshot, subscribe } from "@diegotsi/flint-core";
|
|
1441
|
+
import { Flint as CoreFlint, getSnapshot, subscribe } from "@diegotsi/flint-core";
|
|
1435
1442
|
import { useSyncExternalStore } from "react";
|
|
1436
|
-
|
|
1443
|
+
|
|
1444
|
+
// src/replayRecorder.ts
|
|
1445
|
+
function createRrwebRecorder(replayBufferMs) {
|
|
1446
|
+
return async (onEmit) => {
|
|
1447
|
+
const { record } = await import("rrweb");
|
|
1448
|
+
let started = false;
|
|
1449
|
+
const stop = record({
|
|
1450
|
+
emit: (event, isCheckout) => {
|
|
1451
|
+
const checkout = isCheckout || !started;
|
|
1452
|
+
started = true;
|
|
1453
|
+
onEmit(event, checkout);
|
|
1454
|
+
},
|
|
1455
|
+
checkoutEveryNms: replayBufferMs,
|
|
1456
|
+
maskAllInputs: true
|
|
1457
|
+
});
|
|
1458
|
+
return stop ?? void 0;
|
|
1459
|
+
};
|
|
1460
|
+
}
|
|
1461
|
+
|
|
1462
|
+
// src/store.ts
|
|
1463
|
+
import { _setFormErrorCollector } from "@diegotsi/flint-core";
|
|
1464
|
+
var DEFAULT_REPLAY_BUFFER_MS = 6e4;
|
|
1465
|
+
function init(config) {
|
|
1466
|
+
if (config.enableReplay && !config._replayRecorder) {
|
|
1467
|
+
CoreFlint.init({
|
|
1468
|
+
...config,
|
|
1469
|
+
_replayRecorder: createRrwebRecorder(config.replayBufferMs ?? DEFAULT_REPLAY_BUFFER_MS)
|
|
1470
|
+
});
|
|
1471
|
+
return;
|
|
1472
|
+
}
|
|
1473
|
+
CoreFlint.init(config);
|
|
1474
|
+
}
|
|
1475
|
+
var Flint2 = { ...CoreFlint, init };
|
|
1437
1476
|
function useFlintStore() {
|
|
1438
1477
|
return useSyncExternalStore(subscribe, getSnapshot);
|
|
1439
1478
|
}
|
|
@@ -1516,10 +1555,6 @@ function WidgetContent({
|
|
|
1516
1555
|
setOpen(true);
|
|
1517
1556
|
onOpen?.();
|
|
1518
1557
|
};
|
|
1519
|
-
const didInjectReplay = useRef3(false);
|
|
1520
|
-
if (!didInjectReplay.current && config.enableReplay && !Flint3.getInstance()?.stopReplay) {
|
|
1521
|
-
didInjectReplay.current = true;
|
|
1522
|
-
}
|
|
1523
1558
|
const global = Flint3.getInstance();
|
|
1524
1559
|
const label = buttonLabel ?? t("buttonLabel");
|
|
1525
1560
|
return /* @__PURE__ */ jsxs3(Fragment2, { children: [
|