@servicetitan/error-boundary 37.0.2 → 38.1.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.
- package/dist/error-boundary.js +14 -7
- package/dist/error-boundary.js.map +1 -1
- package/package.json +6 -6
package/dist/error-boundary.js
CHANGED
|
@@ -6,19 +6,26 @@ function _define_property(obj, key, value) {
|
|
|
6
6
|
configurable: true,
|
|
7
7
|
writable: true
|
|
8
8
|
});
|
|
9
|
-
} else
|
|
10
|
-
obj[key] = value;
|
|
11
|
-
}
|
|
9
|
+
} else obj[key] = value;
|
|
12
10
|
return obj;
|
|
13
11
|
}
|
|
14
12
|
function _ts_decorate(decorators, target, key, desc) {
|
|
15
13
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
16
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
17
|
-
|
|
14
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") {
|
|
15
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
16
|
+
} else {
|
|
17
|
+
for(var i = decorators.length - 1; i >= 0; i--){
|
|
18
|
+
if (d = decorators[i]) {
|
|
19
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
18
23
|
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
19
24
|
}
|
|
20
|
-
function _ts_metadata(
|
|
21
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function")
|
|
25
|
+
function _ts_metadata(metadataKey, metadataValue) {
|
|
26
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") {
|
|
27
|
+
return Reflect.metadata(metadataKey, metadataValue);
|
|
28
|
+
}
|
|
22
29
|
}
|
|
23
30
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
24
31
|
import { Log } from '@servicetitan/log-service';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/error-boundary.tsx"],"sourcesContent":["import { Log } from '@servicetitan/log-service';\nimport { injectDependency, optional } from '@servicetitan/react-ioc';\nimport { Component, ComponentType, FC, PropsWithChildren } from 'react';\n\nexport interface FallbackProps {\n onRefresh?: () => void;\n}\n\nexport type ErrorBoundaryProps = PropsWithChildren<{\n moduleName: string;\n fallback?: ComponentType<FallbackProps>;\n getErrorData?: (error: Error) => Parameters<Log['error']>[0]['data'];\n}>;\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps> {\n state = {\n hasError: false,\n };\n\n @optional()\n @injectDependency(Log)\n declare private logService?: Log;\n\n componentDidCatch(error: Error) {\n if (this.logService) {\n const { moduleName: Module, getErrorData } = this.props;\n const data = { Module, ...getErrorData?.(error) };\n this.logService.error({ error, message: error.message, data }, { skipConsole: true });\n }\n\n this.setState({ hasError: true }); // eslint-disable-line react/no-set-state\n }\n\n render() {\n const { fallback: Fallback = DefaultFallback } = this.props;\n\n const { hasError } = this.state;\n\n if (hasError) {\n const handleRefresh = () => {\n this.setState({ hasError: false }); // eslint-disable-line react/no-set-state\n };\n return <Fallback onRefresh={handleRefresh} />;\n }\n\n return this.props.children;\n }\n}\n\nconst DefaultFallback: FC = () => <h2>Something went wrong</h2>;\n"],"names":["Log","injectDependency","optional","Component","ErrorBoundary","componentDidCatch","error","logService","moduleName","Module","getErrorData","props","data","message","skipConsole","setState","hasError","render","fallback","Fallback","DefaultFallback","state","handleRefresh","onRefresh","children","h2"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/error-boundary.tsx"],"sourcesContent":["import { Log } from '@servicetitan/log-service';\nimport { injectDependency, optional } from '@servicetitan/react-ioc';\nimport { Component, ComponentType, FC, PropsWithChildren } from 'react';\n\nexport interface FallbackProps {\n onRefresh?: () => void;\n}\n\nexport type ErrorBoundaryProps = PropsWithChildren<{\n moduleName: string;\n fallback?: ComponentType<FallbackProps>;\n getErrorData?: (error: Error) => Parameters<Log['error']>[0]['data'];\n}>;\n\nexport class ErrorBoundary extends Component<ErrorBoundaryProps> {\n state = {\n hasError: false,\n };\n\n @optional()\n @injectDependency(Log)\n declare private logService?: Log;\n\n componentDidCatch(error: Error) {\n if (this.logService) {\n const { moduleName: Module, getErrorData } = this.props;\n const data = { Module, ...getErrorData?.(error) };\n this.logService.error({ error, message: error.message, data }, { skipConsole: true });\n }\n\n this.setState({ hasError: true }); // eslint-disable-line react/no-set-state\n }\n\n render() {\n const { fallback: Fallback = DefaultFallback } = this.props;\n\n const { hasError } = this.state;\n\n if (hasError) {\n const handleRefresh = () => {\n this.setState({ hasError: false }); // eslint-disable-line react/no-set-state\n };\n return <Fallback onRefresh={handleRefresh} />;\n }\n\n return this.props.children;\n }\n}\n\nconst DefaultFallback: FC = () => <h2>Something went wrong</h2>;\n"],"names":["Log","injectDependency","optional","Component","ErrorBoundary","componentDidCatch","error","logService","moduleName","Module","getErrorData","props","data","message","skipConsole","setState","hasError","render","fallback","Fallback","DefaultFallback","state","handleRefresh","onRefresh","children","h2"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,GAAG,QAAQ,4BAA4B;AAChD,SAASC,gBAAgB,EAAEC,QAAQ,QAAQ,0BAA0B;AACrE,SAASC,SAAS,QAA8C,QAAQ;AAYxE,OAAO,MAAMC,sBAAsBD;IAS/BE,kBAAkBC,KAAY,EAAE;QAC5B,IAAI,IAAI,CAACC,UAAU,EAAE;YACjB,MAAM,EAAEC,YAAYC,MAAM,EAAEC,YAAY,EAAE,GAAG,IAAI,CAACC,KAAK;YACvD,MAAMC,OAAO;gBAAEH;mBAAWC,yBAAAA,mCAAAA,aAAeJ,MAAlB;YAAyB;YAChD,IAAI,CAACC,UAAU,CAACD,KAAK,CAAC;gBAAEA;gBAAOO,SAASP,MAAMO,OAAO;gBAAED;YAAK,GAAG;gBAAEE,aAAa;YAAK;QACvF;QAEA,IAAI,CAACC,QAAQ,CAAC;YAAEC,UAAU;QAAK,IAAI,yCAAyC;IAChF;IAEAC,SAAS;QACL,MAAM,EAAEC,UAAUC,WAAWC,eAAe,EAAE,GAAG,IAAI,CAACT,KAAK;QAE3D,MAAM,EAAEK,QAAQ,EAAE,GAAG,IAAI,CAACK,KAAK;QAE/B,IAAIL,UAAU;YACV,MAAMM,gBAAgB;gBAClB,IAAI,CAACP,QAAQ,CAAC;oBAAEC,UAAU;gBAAM,IAAI,yCAAyC;YACjF;YACA,qBAAO,KAACG;gBAASI,WAAWD;;QAChC;QAEA,OAAO,IAAI,CAACX,KAAK,CAACa,QAAQ;IAC9B;;QAhCG,gBACHH,uBAAAA,SAAQ;YACJL,UAAU;QACd;;AA8BJ;;;;;;AAEA,MAAMI,kBAAsB,kBAAM,KAACK;kBAAG"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/error-boundary",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "38.1.0",
|
|
4
4
|
"description": "Implementation of React error boundary mechanism",
|
|
5
5
|
"homepage": "https://docs.st.dev/docs/frontend/uikit/error-boundary",
|
|
6
6
|
"repository": {
|
|
@@ -16,8 +16,8 @@
|
|
|
16
16
|
"src"
|
|
17
17
|
],
|
|
18
18
|
"devDependencies": {
|
|
19
|
-
"@servicetitan/log-service": "
|
|
20
|
-
"@servicetitan/react-ioc": "
|
|
19
|
+
"@servicetitan/log-service": "38.1.0",
|
|
20
|
+
"@servicetitan/react-ioc": "38.1.0",
|
|
21
21
|
"@testing-library/dom": "^10.4.1",
|
|
22
22
|
"@testing-library/jest-dom": "^6.9.1",
|
|
23
23
|
"@testing-library/react": "^16.3.2",
|
|
@@ -25,8 +25,8 @@
|
|
|
25
25
|
"react": "~18.3.1"
|
|
26
26
|
},
|
|
27
27
|
"peerDependencies": {
|
|
28
|
-
"@servicetitan/log-service": "
|
|
29
|
-
"@servicetitan/react-ioc": "
|
|
28
|
+
"@servicetitan/log-service": "38.1.0",
|
|
29
|
+
"@servicetitan/react-ioc": "38.1.0",
|
|
30
30
|
"react": ">=17.0.2"
|
|
31
31
|
},
|
|
32
32
|
"publishConfig": {
|
|
@@ -35,5 +35,5 @@
|
|
|
35
35
|
"cli": {
|
|
36
36
|
"webpack": false
|
|
37
37
|
},
|
|
38
|
-
"gitHead": "
|
|
38
|
+
"gitHead": "e8c601a26ad49ca0d6b0b84a9f530f3242d53c7f"
|
|
39
39
|
}
|