@dloizides/ui-feedback 1.20.0 → 1.21.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/index.d.mts +2 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +22 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -4
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1142,6 +1142,10 @@ var styles10 = StyleSheet.create({
|
|
|
1142
1142
|
maxWidth: CONTENT_MAX_WIDTH,
|
|
1143
1143
|
alignItems: "center"
|
|
1144
1144
|
},
|
|
1145
|
+
logo: {
|
|
1146
|
+
alignItems: "center",
|
|
1147
|
+
marginBottom: TITLE_MARGIN_BOTTOM2
|
|
1148
|
+
},
|
|
1145
1149
|
title: {
|
|
1146
1150
|
fontSize: TITLE_FONT_SIZE3,
|
|
1147
1151
|
fontWeight: "bold",
|
|
@@ -1183,7 +1187,8 @@ var ErrorBoundaryFallback = ({
|
|
|
1183
1187
|
showRetry,
|
|
1184
1188
|
reloadIsPrimary,
|
|
1185
1189
|
onRetry,
|
|
1186
|
-
onReload
|
|
1190
|
+
onReload,
|
|
1191
|
+
logo
|
|
1187
1192
|
}) => {
|
|
1188
1193
|
const { theme } = useFeedbackUi();
|
|
1189
1194
|
const warningColor = (theme.semantic.warning ?? theme.semantic.error)["500"];
|
|
@@ -1225,6 +1230,7 @@ var ErrorBoundaryFallback = ({
|
|
|
1225
1230
|
style: [styles10.container, { backgroundColor: theme.colors.background }],
|
|
1226
1231
|
testID: testIDPrefix,
|
|
1227
1232
|
children: /* @__PURE__ */ jsxs(View, { style: styles10.content, children: [
|
|
1233
|
+
logo !== void 0 ? /* @__PURE__ */ jsx(View, { style: styles10.logo, testID: `${testIDPrefix}-logo`, children: logo }) : null,
|
|
1228
1234
|
/* @__PURE__ */ jsx(Text, { style: [styles10.title, { color: theme.colors.text }], children: labels.title }),
|
|
1229
1235
|
/* @__PURE__ */ jsx(ErrorState, { message: labels.message, testID: `${testIDPrefix}-message` }),
|
|
1230
1236
|
hasDetails ? /* @__PURE__ */ jsxs(
|
|
@@ -1327,12 +1333,23 @@ var AppErrorBoundary = class extends Component {
|
|
|
1327
1333
|
if (isHandled) this.setState({ recovering: true });
|
|
1328
1334
|
}
|
|
1329
1335
|
render() {
|
|
1330
|
-
const { children, fallback
|
|
1336
|
+
const { children, fallback } = this.props;
|
|
1331
1337
|
const { hasError, error, recovering } = this.state;
|
|
1338
|
+
if (!hasError) return children;
|
|
1339
|
+
if (typeof fallback === "function")
|
|
1340
|
+
return fallback({
|
|
1341
|
+
error,
|
|
1342
|
+
recovering,
|
|
1343
|
+
retry: this.handleRetry,
|
|
1344
|
+
renderDefault: (logo) => this.renderDefaultFallback(logo)
|
|
1345
|
+
});
|
|
1346
|
+
return this.renderDefaultFallback();
|
|
1347
|
+
}
|
|
1348
|
+
renderDefaultFallback(logo) {
|
|
1349
|
+
const { labels, labelsFor, showDetails, onReload } = this.props;
|
|
1350
|
+
const { error, recovering } = this.state;
|
|
1332
1351
|
const testIDPrefix = this.props.testIDPrefix ?? FEEDBACK_TEST_IDS.errorBoundary;
|
|
1333
1352
|
const resolvedLabels = resolveLabels(labels, labelsFor, error);
|
|
1334
|
-
if (!hasError) return children;
|
|
1335
|
-
if (typeof fallback === "function") return fallback({ error, recovering, retry: this.handleRetry });
|
|
1336
1353
|
if (recovering)
|
|
1337
1354
|
return /* @__PURE__ */ jsx(ErrorBoundaryRecovering, { message: resolvedLabels.updating, testID: `${testIDPrefix}-updating` });
|
|
1338
1355
|
return /* @__PURE__ */ jsx(
|
|
@@ -1340,6 +1357,7 @@ var AppErrorBoundary = class extends Component {
|
|
|
1340
1357
|
{
|
|
1341
1358
|
error,
|
|
1342
1359
|
labels: resolvedLabels,
|
|
1360
|
+
logo,
|
|
1343
1361
|
reloadIsPrimary: this.props.reloadIsPrimary === true,
|
|
1344
1362
|
showDetails: resolveShowDetails(showDetails, error),
|
|
1345
1363
|
showRetry: resolveRetryable(this.props.retryable, error),
|