@memobit/libs 3.9.0 → 3.10.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.
@@ -1,22 +1,22 @@
1
1
  import './InputSearch.css';
2
- import { Icon as a } from "../Icon/Icon2.js";
3
- import { Tooltip as N } from "../Tooltip/Tooltip2.js";
4
- import { InputText as j } from "../InputText/InputText2.js";
2
+ import { Icon as c } from "../Icon/Icon2.js";
3
+ import { Tooltip as C } from "../Tooltip/Tooltip2.js";
4
+ import { InputText as S } from "../InputText/InputText2.js";
5
5
  /* empty css */
6
- import { forwardRef as w } from "react";
7
- import { jsx as r, jsxs as S } from "react/jsx-runtime";
8
- var R = w(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m, onBlur: l, onChange: o, onClick: p, onKeyDown: h, onKeyUp: f, placeholder: u = "Search...", readOnly: c = !1, required: d = !1, value: e, className: x = "" }, _) => {
9
- const C = () => {
6
+ import { forwardRef as j } from "react";
7
+ import { jsx as r, jsxs as w } from "react/jsx-runtime";
8
+ var T = j(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m, onBlur: l, onChange: o, onClick: p, onKeyDown: h, onKeyUp: f, placeholder: u = "Search...", readOnly: a = !1, required: d = !1, value: e, className: x = "" }, I) => {
9
+ const N = () => {
10
10
  o?.("");
11
- }, I = e && e.length > 0 && !t && !c;
12
- return /* @__PURE__ */ S("div", {
11
+ }, _ = e && e.length > 0 && !t && !a;
12
+ return /* @__PURE__ */ w("div", {
13
13
  className: `input-search ${x}`,
14
14
  children: [
15
15
  /* @__PURE__ */ r("div", {
16
16
  className: "input-search__icon",
17
- children: /* @__PURE__ */ r(a, { name: "search" })
17
+ children: /* @__PURE__ */ r(c, { name: "search" })
18
18
  }),
19
- /* @__PURE__ */ r(j, {
19
+ /* @__PURE__ */ r(S, {
20
20
  autoComplete: s,
21
21
  autoFocus: i,
22
22
  disabled: t,
@@ -28,18 +28,18 @@ var R = w(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m
28
28
  onKeyDown: h,
29
29
  onKeyUp: f,
30
30
  placeholder: u,
31
- readOnly: c,
31
+ readOnly: a,
32
32
  required: d,
33
33
  value: e,
34
- ref: _
34
+ ref: I
35
35
  }),
36
- I && /* @__PURE__ */ r(N, {
36
+ _ && /* @__PURE__ */ r(C, {
37
37
  title: "Clear search",
38
38
  children: /* @__PURE__ */ r("button", {
39
39
  type: "button",
40
40
  className: "input-search__clear",
41
- onClick: C,
42
- children: /* @__PURE__ */ r(a, {
41
+ onClick: N,
42
+ children: /* @__PURE__ */ r(c, {
43
43
  name: "clear",
44
44
  size: "sm"
45
45
  })
@@ -48,6 +48,7 @@ var R = w(({ autoComplete: s = "off", autoFocus: i, disabled: t, id: n, label: m
48
48
  ]
49
49
  });
50
50
  });
51
+ T.displayName = "InputSearch";
51
52
  export {
52
- R as InputSearch
53
+ T as InputSearch
53
54
  };
@@ -2,7 +2,7 @@ import './InputText.css';
2
2
  /* empty css */
3
3
  import { forwardRef as w } from "react";
4
4
  import { jsx as t, jsxs as i } from "react/jsx-runtime";
5
- var F = w(({ autoComplete: r = "on", autoFocus: l, disabled: m, error: e, highlighted: x, id: s, label: n, maxLength: u, onBlur: c, onChange: h, onClick: o, onKeyDown: d, onKeyUp: f, placeholder: g, readOnly: N = !1, required: p = !1, success: a, value: v }, $) => /* @__PURE__ */ i("div", {
5
+ var y = w(({ autoComplete: r = "on", autoFocus: l, disabled: m, error: e, highlighted: x, id: s, label: n, maxLength: u, onBlur: c, onChange: h, onClick: o, onKeyDown: d, onKeyUp: N, placeholder: f, readOnly: g = !1, required: p = !1, success: a, value: v }, $) => /* @__PURE__ */ i("div", {
6
6
  className: `input-text-wrapper${x ? " input-text-highlighted" : ""}`,
7
7
  children: [
8
8
  n && /* @__PURE__ */ i("label", {
@@ -21,15 +21,15 @@ var F = w(({ autoComplete: r = "on", autoFocus: l, disabled: m, error: e, highli
21
21
  className: `input-text ${e ? "input-text-error" : ""} ${a ? "input-text-success" : ""}`,
22
22
  id: s,
23
23
  maxLength: u,
24
- placeholder: g,
24
+ placeholder: f,
25
25
  ref: $,
26
26
  value: v,
27
27
  onBlur: c,
28
28
  onChange: (j) => h?.(j.target.value),
29
29
  onClick: o,
30
30
  onKeyDown: d,
31
- onKeyUp: f,
32
- readOnly: N,
31
+ onKeyUp: N,
32
+ readOnly: g,
33
33
  required: p
34
34
  }),
35
35
  e && /* @__PURE__ */ t("span", {
@@ -42,6 +42,7 @@ var F = w(({ autoComplete: r = "on", autoFocus: l, disabled: m, error: e, highli
42
42
  })
43
43
  ]
44
44
  }));
45
+ y.displayName = "InputText";
45
46
  export {
46
- F as InputText
47
+ y as InputText
47
48
  };
@@ -1,22 +1,22 @@
1
1
  import './InputTextarea.css';
2
2
  /* empty css */
3
- import { forwardRef as $ } from "react";
4
- import { jsx as e, jsxs as n } from "react/jsx-runtime";
5
- var F = $(({ autoComplete: p = "on", autoFocus: i, cols: l, disabled: m, error: a, id: r, label: s, maxLength: x, onBlur: u, onChange: c, onClick: o, onKeyDown: d, onKeyUp: h, placeholder: N, required: f, rows: g, success: t, value: v }, j) => /* @__PURE__ */ n("div", {
3
+ import { forwardRef as I } from "react";
4
+ import { jsx as a, jsxs as n } from "react/jsx-runtime";
5
+ var T = I(({ autoComplete: p = "on", autoFocus: i, cols: l, disabled: m, error: e, id: r, label: s, maxLength: x, onBlur: u, onChange: c, onClick: o, onKeyDown: d, onKeyUp: h, placeholder: N, required: f, rows: g, success: t, value: v }, j) => /* @__PURE__ */ n("div", {
6
6
  className: "input-textarea-wrapper",
7
7
  children: [
8
8
  s && /* @__PURE__ */ n("label", {
9
9
  htmlFor: r,
10
10
  className: "input-textarea-label",
11
- children: [s, f && /* @__PURE__ */ e("span", {
11
+ children: [s, f && /* @__PURE__ */ a("span", {
12
12
  className: "input-textarea-required",
13
13
  children: "*"
14
14
  })]
15
15
  }),
16
- /* @__PURE__ */ e("textarea", {
16
+ /* @__PURE__ */ a("textarea", {
17
17
  autoComplete: p,
18
18
  autoFocus: i,
19
- className: `input-textarea${a ? " input-textarea-error" : ""}${t ? " input-textarea-success" : ""}`,
19
+ className: `input-textarea${e ? " input-textarea-error" : ""}${t ? " input-textarea-success" : ""}`,
20
20
  cols: l,
21
21
  disabled: m,
22
22
  id: r,
@@ -31,16 +31,17 @@ var F = $(({ autoComplete: p = "on", autoFocus: i, cols: l, disabled: m, error:
31
31
  rows: g,
32
32
  value: v
33
33
  }),
34
- a && /* @__PURE__ */ e("span", {
34
+ e && /* @__PURE__ */ a("span", {
35
35
  className: "input-textarea-error-message",
36
- children: a
36
+ children: e
37
37
  }),
38
- t && /* @__PURE__ */ e("span", {
38
+ t && /* @__PURE__ */ a("span", {
39
39
  className: "input-textarea-success-message",
40
40
  children: t
41
41
  })
42
42
  ]
43
43
  }));
44
+ T.displayName = "InputTextarea";
44
45
  export {
45
- F as InputTextarea
46
+ T as InputTextarea
46
47
  };
@@ -1,85 +1,86 @@
1
1
  import './InputTime.css';
2
- import { Icon as S } from "../Icon/Icon2.js";
3
- import { Popover as T } from "../Popover/Popover2.js";
2
+ import { Icon as R } from "../Icon/Icon2.js";
3
+ import { Popover as S } from "../Popover/Popover2.js";
4
4
  import { TimePicker as j } from "../TimePicker/TimePicker2.js";
5
5
  /* empty css */
6
6
  import { forwardRef as w, useRef as y, useState as E } from "react";
7
- import { jsx as e, jsxs as m } from "react/jsx-runtime";
8
- var v = (i) => i.toString().padStart(2, "0"), O = (i) => {
7
+ import { jsx as e, jsxs as r } from "react/jsx-runtime";
8
+ var b = (i) => i.toString().padStart(2, "0"), O = (i) => {
9
9
  const [n, t] = (i ?? "").split(":").map(Number);
10
10
  return {
11
11
  hours: Number.isFinite(n) ? n : 0,
12
12
  minutes: Number.isFinite(t) ? t : 0,
13
13
  seconds: 0
14
14
  };
15
- }, H = w(({ autoFocus: i, disabled: n, error: t, highlighted: N, id: o, label: c, max: k, min: g, minuteStep: C = 1, onBlur: $, onChange: p, onClick: x, onKeyDown: F, onKeyUp: I, readOnly: u = !1, required: f = !1, success: l, value: h, withClock: a = !1 }, P) => {
16
- const [r, d] = E(!1), b = y(null), R = (s) => {
17
- p?.(`${v(s.hours)}:${v(s.minutes)}`);
15
+ }, q = w(({ autoFocus: i, disabled: n, error: t, highlighted: v, id: o, label: c, max: k, min: g, minuteStep: C = 1, onBlur: $, onChange: p, onClick: I, onKeyDown: T, onKeyUp: x, readOnly: u = !1, required: d = !1, success: a, value: f, withClock: l = !1 }, F) => {
16
+ const [m, h] = E(!1), N = y(null), P = (s) => {
17
+ p?.(`${b(s.hours)}:${b(s.minutes)}`);
18
18
  };
19
- return /* @__PURE__ */ m("div", {
20
- className: `input-time-wrapper${N ? " input-time-highlighted" : ""}`,
19
+ return /* @__PURE__ */ r("div", {
20
+ className: `input-time-wrapper${v ? " input-time-highlighted" : ""}`,
21
21
  children: [
22
- c && /* @__PURE__ */ m("label", {
22
+ c && /* @__PURE__ */ r("label", {
23
23
  htmlFor: o,
24
24
  className: "input-time-label",
25
- children: [c, f && /* @__PURE__ */ e("span", {
25
+ children: [c, d && /* @__PURE__ */ e("span", {
26
26
  className: "input-time-required",
27
27
  children: "*"
28
28
  })]
29
29
  }),
30
- /* @__PURE__ */ m("div", {
31
- ref: b,
32
- className: `input-time-field${a ? " input-time-field--with-clock" : ""}`,
30
+ /* @__PURE__ */ r("div", {
31
+ ref: N,
32
+ className: `input-time-field${l ? " input-time-field--with-clock" : ""}`,
33
33
  children: [/* @__PURE__ */ e("input", {
34
34
  autoFocus: i,
35
35
  disabled: n,
36
36
  type: "time",
37
- className: `input-time${t ? " input-time-error" : ""}${l ? " input-time-success" : ""}`,
37
+ className: `input-time${t ? " input-time-error" : ""}${a ? " input-time-success" : ""}`,
38
38
  id: o,
39
39
  max: k,
40
40
  min: g,
41
- ref: P,
42
- value: h ?? "",
41
+ ref: F,
42
+ value: f ?? "",
43
43
  onBlur: $,
44
44
  onChange: (s) => p?.(s.target.value || void 0),
45
- onClick: x,
46
- onKeyDown: F,
47
- onKeyUp: I,
45
+ onClick: I,
46
+ onKeyDown: T,
47
+ onKeyUp: x,
48
48
  readOnly: u,
49
- required: f
50
- }), a && /* @__PURE__ */ e("button", {
51
- className: `input-time-clock-button${r ? " input-time-clock-button--active" : ""}`,
49
+ required: d
50
+ }), l && /* @__PURE__ */ e("button", {
51
+ className: `input-time-clock-button${m ? " input-time-clock-button--active" : ""}`,
52
52
  disabled: n || u,
53
- onClick: () => d(!r),
53
+ onClick: () => h(!m),
54
54
  title: "Pick on a clock",
55
55
  type: "button",
56
- children: /* @__PURE__ */ e(S, { name: "time" })
56
+ children: /* @__PURE__ */ e(R, { name: "time" })
57
57
  })]
58
58
  }),
59
59
  t && /* @__PURE__ */ e("span", {
60
60
  className: "input-time-error-message",
61
61
  children: t
62
62
  }),
63
- l && /* @__PURE__ */ e("span", {
63
+ a && /* @__PURE__ */ e("span", {
64
64
  className: "input-time-success-message",
65
- children: l
65
+ children: a
66
66
  }),
67
- a && /* @__PURE__ */ e(T, {
68
- visible: r,
69
- onClose: () => d(!1),
70
- anchorEl: b.current,
67
+ l && /* @__PURE__ */ e(S, {
68
+ visible: m,
69
+ onClose: () => h(!1),
70
+ anchorEl: N.current,
71
71
  children: /* @__PURE__ */ e(j, {
72
72
  collapsibleClock: !1,
73
73
  label: "",
74
74
  minuteStep: C,
75
- onChange: R,
76
- value: O(h),
75
+ onChange: P,
76
+ value: O(f),
77
77
  withClock: !0
78
78
  })
79
79
  })
80
80
  ]
81
81
  });
82
82
  });
83
+ q.displayName = "InputTime";
83
84
  export {
84
- H as InputTime
85
+ q as InputTime
85
86
  };
@@ -1,23 +1,23 @@
1
1
  import './InputUrl.css';
2
2
  /* empty css */
3
- import { forwardRef as A, useState as B } from "react";
3
+ import { forwardRef as j, useState as A } from "react";
4
4
  import { jsx as t, jsxs as m } from "react/jsx-runtime";
5
- var F = "Please enter a valid URL (e.g. https://example.com)", I = (l) => {
5
+ var B = "Please enter a valid URL (e.g. https://example.com)", F = (l) => {
6
6
  try {
7
7
  const e = new URL(l);
8
8
  return e.protocol === "http:" || e.protocol === "https:";
9
9
  } catch {
10
10
  return !1;
11
11
  }
12
- }, G = A(({ autoFocus: l, disabled: e, error: f, highlighted: v, id: u, label: i, maxLength: g, onBlur: E, onChange: R, onClick: N, onKeyDown: U, onKeyUp: x, onValidationChange: o, placeholder: L = "https://...", readOnly: w = !1, required: p = !1, success: a, validationErrorMessage: y, value: S }, _) => {
13
- const [c, d] = B(void 0), h = (r) => {
12
+ }, b = j(({ autoFocus: l, disabled: e, error: f, highlighted: v, id: u, label: i, maxLength: g, onBlur: E, onChange: N, onClick: R, onKeyDown: U, onKeyUp: x, onValidationChange: p, placeholder: y = "https://...", readOnly: L = !1, required: o = !1, success: a, validationErrorMessage: w, value: I }, S) => {
13
+ const [c, d] = A(void 0), h = (r) => {
14
14
  if (!r)
15
- return d(void 0), o?.(!0), !0;
16
- const n = I(r);
17
- return d(n ? void 0 : y ?? F), o?.(n), n;
15
+ return d(void 0), p?.(!0), !0;
16
+ const n = F(r);
17
+ return d(n ? void 0 : w ?? B), p?.(n), n;
18
+ }, _ = (r) => {
19
+ N?.(r), c && h(r);
18
20
  }, $ = (r) => {
19
- R?.(r), c && h(r);
20
- }, j = (r) => {
21
21
  h(r.target.value), E?.(r);
22
22
  }, s = f ?? c;
23
23
  return /* @__PURE__ */ m("div", {
@@ -26,7 +26,7 @@ var F = "Please enter a valid URL (e.g. https://example.com)", I = (l) => {
26
26
  i && /* @__PURE__ */ m("label", {
27
27
  htmlFor: u,
28
28
  className: "input-url-label",
29
- children: [i, p && /* @__PURE__ */ t("span", {
29
+ children: [i, o && /* @__PURE__ */ t("span", {
30
30
  className: "input-url-required",
31
31
  children: "*"
32
32
  })]
@@ -38,16 +38,16 @@ var F = "Please enter a valid URL (e.g. https://example.com)", I = (l) => {
38
38
  className: `input-url${s ? " input-url-error" : ""}${a ? " input-url-success" : ""}`,
39
39
  id: u,
40
40
  maxLength: g,
41
- placeholder: L,
42
- ref: _,
43
- value: S,
44
- onBlur: j,
45
- onChange: (r) => $(r.target.value),
46
- onClick: N,
41
+ placeholder: y,
42
+ ref: S,
43
+ value: I,
44
+ onBlur: $,
45
+ onChange: (r) => _(r.target.value),
46
+ onClick: R,
47
47
  onKeyDown: U,
48
48
  onKeyUp: x,
49
- readOnly: w,
50
- required: p
49
+ readOnly: L,
50
+ required: o
51
51
  }),
52
52
  s && /* @__PURE__ */ t("span", {
53
53
  className: "input-url-error-message",
@@ -60,6 +60,7 @@ var F = "Please enter a valid URL (e.g. https://example.com)", I = (l) => {
60
60
  ]
61
61
  });
62
62
  });
63
+ b.displayName = "InputUrl";
63
64
  export {
64
- G as InputUrl
65
+ b as InputUrl
65
66
  };
@@ -1,20 +1,20 @@
1
1
  import './QuantitySelector.css';
2
- import { Button as h } from "../Button/Button2.js";
2
+ import { Button as q } from "../Button/Button2.js";
3
3
  import { InputNumber as I } from "../InputNumber/InputNumber2.js";
4
4
  /* empty css */
5
5
  import { forwardRef as S } from "react";
6
6
  import { jsx as s, jsxs as u } from "react/jsx-runtime";
7
- var D = S(({ disabled: n = !1, error: l, id: d, inputWidth: f, label: y, max: t, min: r = 0, onChange: i, readOnlyInput: q = !1, required: p = !1, step: o = 1, success: a, value: c }, v) => {
7
+ var $ = S(({ disabled: n = !1, error: c, id: d, inputWidth: f, label: y, max: t, min: r = 0, onChange: i, readOnlyInput: p = !1, required: h = !1, step: a = 1, success: o, value: l }, v) => {
8
8
  const N = f || (t !== void 0 ? Math.max(String(t).length, String(r).length, 3) : 3), m = () => {
9
9
  if (n) return;
10
- const e = (c ?? 0) - o;
10
+ const e = (l ?? 0) - a;
11
11
  r !== void 0 && e < r || i?.(e);
12
12
  }, b = () => {
13
13
  if (n) return;
14
- const e = (c ?? 0) + o;
14
+ const e = (l ?? 0) + a;
15
15
  t !== void 0 && e > t || i?.(e);
16
16
  }, g = (e) => {
17
- if (!q) {
17
+ if (!p) {
18
18
  if (e === void 0) {
19
19
  i?.(void 0);
20
20
  return;
@@ -36,18 +36,18 @@ var D = S(({ disabled: n = !1, error: l, id: d, inputWidth: f, label: y, max: t,
36
36
  y && /* @__PURE__ */ u("label", {
37
37
  htmlFor: d,
38
38
  className: "quantity-selector-label",
39
- children: [y, p && /* @__PURE__ */ s("span", {
39
+ children: [y, h && /* @__PURE__ */ s("span", {
40
40
  className: "quantity-selector-required",
41
41
  children: "*"
42
42
  })]
43
43
  }),
44
44
  /* @__PURE__ */ u("div", {
45
- className: `quantity-selector${q ? " quantity-selector-readonly" : ""}${l ? " quantity-selector-error" : ""}${a ? " quantity-selector-success" : ""}`,
45
+ className: `quantity-selector${p ? " quantity-selector-readonly" : ""}${c ? " quantity-selector-error" : ""}${o ? " quantity-selector-success" : ""}`,
46
46
  style: { "--digits": N },
47
47
  children: [
48
- /* @__PURE__ */ s(h, {
48
+ /* @__PURE__ */ s(q, {
49
49
  className: "quantity-selector-button quantity-selector-button-decrease",
50
- disabled: n || r !== void 0 && (c ?? 0) <= r,
50
+ disabled: n || r !== void 0 && (l ?? 0) <= r,
51
51
  onClick: m,
52
52
  size: "small",
53
53
  variant: "default",
@@ -63,13 +63,13 @@ var D = S(({ disabled: n = !1, error: l, id: d, inputWidth: f, label: y, max: t,
63
63
  min: r,
64
64
  onChange: g,
65
65
  ref: v,
66
- step: o,
67
- value: c
66
+ step: a,
67
+ value: l
68
68
  })
69
69
  }),
70
- /* @__PURE__ */ s(h, {
70
+ /* @__PURE__ */ s(q, {
71
71
  className: "quantity-selector-button quantity-selector-button-increase",
72
- disabled: n || t !== void 0 && (c ?? 0) >= t,
72
+ disabled: n || t !== void 0 && (l ?? 0) >= t,
73
73
  onClick: b,
74
74
  size: "small",
75
75
  variant: "default",
@@ -78,17 +78,18 @@ var D = S(({ disabled: n = !1, error: l, id: d, inputWidth: f, label: y, max: t,
78
78
  })
79
79
  ]
80
80
  }),
81
- l && /* @__PURE__ */ s("span", {
81
+ c && /* @__PURE__ */ s("span", {
82
82
  className: "quantity-selector-error-message",
83
- children: l
83
+ children: c
84
84
  }),
85
- a && /* @__PURE__ */ s("span", {
85
+ o && /* @__PURE__ */ s("span", {
86
86
  className: "quantity-selector-success-message",
87
- children: a
87
+ children: o
88
88
  })
89
89
  ]
90
90
  });
91
91
  });
92
+ $.displayName = "QuantitySelector";
92
93
  export {
93
- D as QuantitySelector
94
+ $ as QuantitySelector
94
95
  };
@@ -0,0 +1,78 @@
1
+ export declare type ErrorReportContext = Record<string, unknown>;
2
+
3
+ export declare interface ErrorReportingConfig {
4
+ /** The app id registered in the hub, e.g. `garage`. */
5
+ appId: string;
6
+ /** The hub ingest URL, e.g. `https://hub.memobit.ro/api/errors/ingest`. */
7
+ endpoint: string;
8
+ /** Turns reporting off for this run, e.g. `import.meta.env.PROD` to report only from production builds. Defaults to true. */
9
+ enabled?: boolean;
10
+ /** Shown in the hub next to each error. Defaults to `production`. */
11
+ environment?: string;
12
+ /** Build or commit the errors came from. */
13
+ release?: string;
14
+ /** Also report `console.error` and `console.warn` calls. Defaults to true. */
15
+ captureConsole?: boolean;
16
+ /** Messages to drop, on top of the built-in browser noise filters. */
17
+ ignore?: (string | RegExp)[];
18
+ /** Most events sent per page load or process run. Defaults to 200. */
19
+ maxEventsPerSession?: number;
20
+ }
21
+
22
+ /**
23
+ * Error reporting shared by every memobit app, in the browser and in Node. Errors and
24
+ * warnings are batched and POSTed to the hub's errors/ingest endpoint, which groups them,
25
+ * lists them on the hub's Errors page and emails on new errors and on spikes.
26
+ *
27
+ * React-free on purpose (it ships through the `@memobit/libs/errors` entry), so Node
28
+ * servers can use it too. The hub can switch reporting off — globally, per app, or
29
+ * automatically on a spike — and the reporter then stays quiet for as long as it is told.
30
+ */
31
+ export declare type ErrorReportLevel = 'error' | 'warning';
32
+
33
+ /** Sends whatever is queued now instead of waiting for the next batch. */
34
+ export declare const flushErrorReports: () => Promise<void>;
35
+
36
+ /** Browser apps: call once, before rendering. */
37
+ export declare const installErrorReporting: (config: ErrorReportingConfig) => void;
38
+
39
+ /**
40
+ * Node servers: call once at startup, passing `process`. Unhandled rejections reach
41
+ * Node's uncaught-exception path, so both are covered. Listening there would stop the
42
+ * crash Node normally does, so — unless the server has its own handler — the process
43
+ * still exits with code 1, once the report is sent (or after 3s).
44
+ */
45
+ export declare const installNodeErrorReporting: (nodeProcess: NodeProcessLike, config: ErrorReportingConfig) => void;
46
+
47
+ /**
48
+ * Use in place of `console.*` in app code. `debug` and `info` only write to the console;
49
+ * `warn` and `error` also report to the hub once error reporting is installed — and only
50
+ * once, even though the console capture is on.
51
+ */
52
+ export declare const logger: {
53
+ debug: (message: string, context?: ErrorReportContext) => void;
54
+ info: (message: string, context?: ErrorReportContext) => void;
55
+ warn: (message: string, context?: ErrorReportContext) => void;
56
+ /** `error` is the caught value, if there is one; its stack is kept. */
57
+ error: (message: string, error?: unknown, context?: ErrorReportContext) => void;
58
+ };
59
+
60
+ /** The part of Node's `process` the reporter needs; pass `process` itself. */
61
+ export declare interface NodeProcessLike {
62
+ on(event: 'uncaughtException', listener: (error: Error) => void): unknown;
63
+ listenerCount(event: 'uncaughtException'): number;
64
+ exit(code?: number): void;
65
+ }
66
+
67
+ /** Reports a caught error you handled but still want to know about. */
68
+ declare const reportError_2: (error: unknown, context?: ErrorReportContext) => void;
69
+ export { reportError_2 as reportError }
70
+
71
+ export { }
72
+
73
+
74
+ declare global {
75
+ interface Window {
76
+ __VERSIONS__: FullVersionInfo;
77
+ }
78
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,9 @@
1
+ import { flushErrorReports as o, installErrorReporting as t, installNodeErrorReporting as e, reportError as p } from "./helpers/ErrorReporting.js";
2
+ import { logger as l } from "./helpers/Logger.js";
3
+ export {
4
+ o as flushErrorReports,
5
+ t as installErrorReporting,
6
+ e as installNodeErrorReporting,
7
+ l as logger,
8
+ p as reportError
9
+ };