x25 19.1.1 → 19.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/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "19.1.1",
2
+ "version": "19.1.2",
3
3
  "name": "x25",
4
4
  "type": "module",
5
5
  "description": "x25",
@@ -11,6 +11,7 @@ type ErrorBoundaryState = {
11
11
  };
12
12
  import React from "react";
13
13
  import type { ErrorType, InfoType } from "./types";
14
+ export declare const setOnCaptureError: (cb: (error: any) => void) => void;
14
15
  declare class ErrorBoundary extends React.Component<ErrorBoundaryProps, ErrorBoundaryState> {
15
16
  handleKey: (event: KeyboardEvent) => void;
16
17
  refresh: () => void;
@@ -1,6 +1,10 @@
1
1
  import React from "react";
2
2
  import { words } from "../index.js";
3
3
  import TheError from "./TheError.js";
4
+ let onCaptureError = null;
5
+ export const setOnCaptureError = (cb) => {
6
+ onCaptureError = cb;
7
+ };
4
8
  const refreshKeyCode = 82, timeoutDelay = 200;
5
9
  class ErrorBoundary extends React.Component {
6
10
  componentDidCatch(error, info) {
@@ -8,6 +12,9 @@ class ErrorBoundary extends React.Component {
8
12
  error,
9
13
  info,
10
14
  });
15
+ if (onCaptureError) {
16
+ onCaptureError(error);
17
+ }
11
18
  }
12
19
  constructor(props) {
13
20
  super(props);
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorBoundary.js","sourceRoot":"","sources":["../../../src/utility/dev/ErrorBoundary.tsx"],"names":[],"mappings":"AAaA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,KAAK,EAAE,MAAM,IAAI,CAAC;AAC3B,OAAO,QAAQ,MAAM,YAAY,CAAC;AAGlC,MAAM,cAAc,GAAG,EAAE,EACvB,YAAY,GAAG,GAAG,CAAC;AAErB,MAAM,aAAc,SAAQ,KAAK,CAAC,SAAiD;IAIjF,iBAAiB,CAAE,KAAgB,EAAE,IAAc;QACjD,IAAI,CAAC,QAA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ACN,UAAU,CAAC,GAAG,EAAE;oBACd,IAAI,CAAC,QAAQ,CAAC;wBACZ,MAAM,EAAG,IAAI;wBACb,KAAK,EAAI,IAAI;wBACb,IAAI,EAAK,IAAI;qBACd,CAAC,CAAC;gBACL,CAAC,EAAE,YAAY,CAAC,CAAC;YACnB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC;IACJ,CAAC;IAED,MAAM;QACJ,MAAM,EACJ,IAAI,EACJ,KAAK,EACL,MAAM,GACP,GAAG,IAAI,CAAC,KAAK,CAAC;QAEf,qBAAqB;QACrB,IAAI,KAAK,EAAE,CAAC;YACV,OAAO,CACL,oBAAC,QAAQ,IACP,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,IAAI,CAAC,SAAS,EACzB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,IAAI,CAAC,OAAO,EACrB,MAAM,EAAE,MAAM,GACd,CACH,CAAC;QACJ,CAAC;QAED,uDAAuD;QACvD,OAAO,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC;IAC7B,CAAC;CAEF;AAED,eAAe,aAAa,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import React from "react";
2
- const TheError = (props) => {
2
+ import { words } from "../index.js";
3
+ const isDev = process.env.NODE_ENV === "development", TheError = (props) => {
3
4
  React.useEffect(() => {
4
5
  if (props.handleKey) {
5
6
  document.addEventListener("keydown", props.handleKey);
@@ -11,23 +12,43 @@ const TheError = (props) => {
11
12
  };
12
13
  }, []);
13
14
  const { error, info, status, refresh } = props;
14
- // render fallback UI
15
+ if (status) {
16
+ return (React.createElement("div", { className: "small", tabIndex: 0 },
17
+ React.createElement("div", { className: "m-2" },
18
+ React.createElement("div", { className: "text-fancy" }, words.TryingToRecover))));
19
+ }
20
+ if (!isDev) {
21
+ return (React.createElement("div", { className: "container mt-5" },
22
+ React.createElement("div", { className: "row justify-content-center" },
23
+ React.createElement("div", { className: "col-lg-6" },
24
+ React.createElement("div", { className: "text-center" },
25
+ React.createElement("div", { className: "alert alert-warning" },
26
+ React.createElement("h5", { className: "mb-3" }, words.Sentry.TellUs.title),
27
+ React.createElement("p", null, words.Sentry.Message),
28
+ React.createElement("p", { className: "small text-muted mb-3" },
29
+ words.Sentry.Hint,
30
+ " ",
31
+ React.createElement("kbd", null, "F5")),
32
+ React.createElement("button", { className: "btn btn-primary", onClick: () => window.location.reload(), type: "button" }, words.UpdateButton)))))));
33
+ }
34
+ // Development mode - show full technical details
15
35
  return (React.createElement("div", { className: "small", tabIndex: 0 },
16
- React.createElement("div", { className: " m-2" }, status ? (React.createElement("div", { className: "text-fancy" }, "Trying to recover app...")) : (React.createElement("div", null,
17
- React.createElement("button", { className: "btn btn-block btn-sm btn-primary", onClick: refresh, type: "button" }, "Recover the app"),
18
- React.createElement("div", { className: "mt-2 mb-2" },
19
- "Press ",
20
- React.createElement("kbd", null, "R"),
21
- " to recover the app, after you've done the changes"),
22
- React.createElement("hr", null),
23
- error ? (React.createElement(React.Fragment, null,
24
- React.createElement("h5", { className: "text-danger" }, error.message),
25
- React.createElement("b", null, "Stack:"),
26
- React.createElement("pre", null, error.stack ? (error.stack.split("").map((line, index) => (React.createElement("div", { key: index }, line)))) : null))) : null,
27
- React.createElement("br", null),
28
- info && info.componentStack ? (React.createElement(React.Fragment, null,
29
- React.createElement("b", null, "React info:"),
30
- React.createElement("pre", null, info.componentStack.split("↵").map((line, index) => React.createElement("div", { key: index }, line))))) : null)))));
36
+ React.createElement("div", { className: " m-2" },
37
+ React.createElement("div", null,
38
+ React.createElement("button", { className: "btn btn-block btn-sm btn-primary", onClick: refresh, type: "button" }, "Recover the app"),
39
+ React.createElement("div", { className: "mt-2 mb-2" },
40
+ "Press ",
41
+ React.createElement("kbd", null, "R"),
42
+ " to recover the app, after you've done the changes"),
43
+ React.createElement("hr", null),
44
+ error ? (React.createElement(React.Fragment, null,
45
+ React.createElement("h5", { className: "text-danger" }, error.message),
46
+ React.createElement("b", null, "Stack:"),
47
+ React.createElement("pre", null, error.stack ? (error.stack.split("↵").map((line, index) => (React.createElement("div", { key: index }, line)))) : null))) : null,
48
+ React.createElement("br", null),
49
+ info && info.componentStack ? (React.createElement(React.Fragment, null,
50
+ React.createElement("b", null, "React info:"),
51
+ React.createElement("pre", null, info.componentStack.split("↵").map((line, index) => React.createElement("div", { key: index }, line))))) : null))));
31
52
  };
32
53
  export default TheError;
33
54
  //# sourceMappingURL=TheError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TheError.js","sourceRoot":"","sources":["../../../src/utility/dev/TheError.tsx"],"names":[],"mappings":"AAUA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,MAAM,QAAQ,GAAG,CAAC,KAAoB,EAAE,EAAE;IACxC,KAAK,CAAC,SAAS,CAAC,GAAG,EAAE;QACnB,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;YACpB,QAAQ,CAAC,gBAAgB,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;QACxD,CAAC;QACD,OAAO,GAAG,EAAE;YACV,IAAI,KAAK,CAAC,SAAS,EAAE,CAAC;gBACpB,QAAQ,CAAC,mBAAmB,CAAC,SAAS,EAAE,KAAK,CAAC,SAAS,CAAC,CAAC;YAC3D,CAAC;QACH,CAAC,CAAC;IACJ,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,KAAK,CAAC;IAE/C,qBAAqB;IACrB,OAAO,CACL,6BAAK,SAAS,EAAC,OAAO,EAAC,QAAQ,EAAE,CAAC;QAChC,6BAAK,SAAS,EAAC,MAAM,IAClB,MAAM,CAAC,CAAC,CAAC,CACR,6BAAK,SAAS,EAAC,YAAY,IAAE,0BAA0B,CAAO,CAC/D,CAAC,CAAC,CAAC,CACF;YACE,gCAAQ,SAAS,EAAC,kCAAkC,EAAC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAC,QAAQ,IACjF,iBAAiB,CACX;YACT,6BAAK,S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