@terreno/admin-frontend 57.2.0 → 57.3.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/.ai/guidelines/core.md +10 -7
- package/README.md +2 -0
- package/dist/AdminScreenPage.d.ts +18 -0
- package/dist/AdminScreenPage.js +35 -0
- package/dist/AdminScreenPage.js.map +1 -0
- package/dist/AdminScreenRouter.js +4 -3
- package/dist/AdminScreenRouter.js.map +1 -1
- package/dist/DocumentStorageBrowser.js +4 -3
- package/dist/DocumentStorageBrowser.js.map +1 -1
- package/dist/comms/CommsDashboardScreen.d.ts +10 -0
- package/dist/comms/CommsDashboardScreen.js +183 -0
- package/dist/comms/CommsDashboardScreen.js.map +1 -0
- package/dist/comms/CommsDashboardScreenWidget.d.ts +4 -0
- package/dist/comms/CommsDashboardScreenWidget.js +11 -0
- package/dist/comms/CommsDashboardScreenWidget.js.map +1 -0
- package/dist/comms/CommsMessageDetail.d.ts +8 -0
- package/dist/comms/CommsMessageDetail.js +50 -0
- package/dist/comms/CommsMessageDetail.js.map +1 -0
- package/dist/comms/CommsStatCard.d.ts +17 -0
- package/dist/comms/CommsStatCard.js +14 -0
- package/dist/comms/CommsStatCard.js.map +1 -0
- package/dist/comms/CommsStatusBadge.d.ts +5 -0
- package/dist/comms/CommsStatusBadge.js +14 -0
- package/dist/comms/CommsStatusBadge.js.map +1 -0
- package/dist/comms/commsDashboardParams.d.ts +17 -0
- package/dist/comms/commsDashboardParams.js +71 -0
- package/dist/comms/commsDashboardParams.js.map +1 -0
- package/dist/comms/commsMessagePayload.d.ts +49 -0
- package/dist/comms/commsMessagePayload.js +43 -0
- package/dist/comms/commsMessagePayload.js.map +1 -0
- package/dist/comms/commsRetrySummary.d.ts +4 -0
- package/dist/comms/commsRetrySummary.js +12 -0
- package/dist/comms/commsRetrySummary.js.map +1 -0
- package/dist/comms/useCommsDashboardApi.d.ts +78 -0
- package/dist/comms/useCommsDashboardApi.js +60 -0
- package/dist/comms/useCommsDashboardApi.js.map +1 -0
- package/dist/comms/useCommsDashboardUrlFilters.d.ts +5 -0
- package/dist/comms/useCommsDashboardUrlFilters.js +16 -0
- package/dist/comms/useCommsDashboardUrlFilters.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +7 -0
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +2 -0
- package/dist/useAdminBackgroundTask.d.ts +10 -2
- package/dist/useAdminBackgroundTask.js.map +1 -1
- package/dist/useConfigurationApi.d.ts +13 -15
- package/dist/useConfigurationApi.js.map +1 -1
- package/dist/widgets/AIRequestsScreenWidget.js +4 -3
- package/dist/widgets/AIRequestsScreenWidget.js.map +1 -1
- package/dist/widgets/DocumentsScreenWidget.js +2 -2
- package/dist/widgets/DocumentsScreenWidget.js.map +1 -1
- package/dist/widgets/builtInWidgets.js +2 -1
- package/dist/widgets/builtInWidgets.js.map +1 -1
- package/package.json +17 -3
- package/src/AdminActionMenu.test.tsx +1 -1
- package/src/AdminBreadcrumbs.test.tsx +1 -1
- package/src/AdminFieldRenderer.test.tsx +6 -1
- package/src/AdminHome.test.tsx +1 -1
- package/src/AdminModelForm.test.tsx +1 -1
- package/src/AdminModelList.test.tsx +1 -1
- package/src/AdminModelTable.test.tsx +1 -1
- package/src/AdminPrimitiveArrayField.test.tsx +1 -1
- package/src/AdminRolesList.test.tsx +1 -1
- package/src/AdminScreenPage.test.tsx +81 -0
- package/src/AdminScreenPage.tsx +37 -0
- package/src/AdminScreenRouter.test.tsx +2 -1
- package/src/AdminScreenRouter.tsx +18 -5
- package/src/AdminScriptList.test.tsx +1 -1
- package/src/AdminShell.test.tsx +1 -1
- package/src/AdminVersionConfig.test.tsx +1 -1
- package/src/CheckboxListEditor.test.tsx +1 -1
- package/src/ConfigurationScreen.test.tsx +1 -1
- package/src/ConsentFormEditor.test.tsx +1 -1
- package/src/ConsentFormList.test.tsx +1 -1
- package/src/ConsentHistory.test.tsx +1 -1
- package/src/ConsentResponseViewer.test.tsx +1 -1
- package/src/DocumentStorageBrowser.test.tsx +1 -1
- package/src/DocumentStorageBrowser.tsx +10 -3
- package/src/LocaleContentEditor.test.tsx +1 -1
- package/src/adminModelListQueryParams.test.ts +59 -0
- package/src/comms/CommsDashboardScreen.test.tsx +397 -0
- package/src/comms/CommsDashboardScreen.tsx +500 -0
- package/src/comms/CommsDashboardScreenWidget.test.tsx +62 -0
- package/src/comms/CommsDashboardScreenWidget.tsx +20 -0
- package/src/comms/CommsMessageDetail.test.tsx +245 -0
- package/src/comms/CommsMessageDetail.tsx +239 -0
- package/src/comms/CommsStatCard.test.tsx +69 -0
- package/src/comms/CommsStatCard.tsx +60 -0
- package/src/comms/CommsStatusBadge.tsx +14 -0
- package/src/comms/commsDashboardParams.test.ts +75 -0
- package/src/comms/commsDashboardParams.ts +91 -0
- package/src/comms/commsMessagePayload.test.ts +22 -0
- package/src/comms/commsMessagePayload.ts +83 -0
- package/src/comms/commsRetrySummary.ts +10 -0
- package/src/comms/useCommsDashboardApi.test.tsx +144 -0
- package/src/comms/useCommsDashboardApi.tsx +128 -0
- package/src/comms/useCommsDashboardUrlFilters.test.tsx +58 -0
- package/src/comms/useCommsDashboardUrlFilters.tsx +31 -0
- package/src/dynamicHookApi.ts +1 -1
- package/src/index.tsx +14 -0
- package/src/isolated/AdminFieldRenderer.isolated.tsx +1 -1
- package/src/{AdminFilterDrawer.test.tsx → isolated/AdminFilterDrawer.isolated.tsx} +8 -2
- package/src/isolated/AdminNestedArrayField.isolated.tsx +1 -1
- package/src/isolated/AdminObjectPicker.isolated.tsx +1 -1
- package/src/isolated/AdminRefField.isolated.tsx +1 -1
- package/src/isolated/AdminScriptRunModal.isolated.tsx +1 -1
- package/src/isolated/DocumentStorageBrowser.isolated.tsx +1 -1
- package/src/isolated/hooks.isolated.tsx +1 -1
- package/src/types.ts +2 -0
- package/src/useAdminBackgroundTask.ts +7 -5
- package/src/useConfigurationApi.ts +13 -16
- package/src/widgets/AIRequestsScreenWidget.tsx +5 -4
- package/src/widgets/DocumentsScreenWidget.tsx +9 -2
- package/src/widgets/builtInWidgets.ts +2 -0
- package/src/widgets/pluginWidgets.test.tsx +3 -1
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
export interface CommsStatCardProps {
|
|
3
|
+
/** Secondary line under the value, e.g. what the value measures. */
|
|
4
|
+
caption?: string;
|
|
5
|
+
label: string;
|
|
6
|
+
testID?: string;
|
|
7
|
+
/** `alert` tints the card and its text for a failing metric. */
|
|
8
|
+
tone?: "alert" | "neutral";
|
|
9
|
+
value: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* One metric tile in the comms dashboard summary row.
|
|
13
|
+
*
|
|
14
|
+
* The alert tone uses the light error surface with error-colored text so a failing
|
|
15
|
+
* metric stays legible; a saturated fill would leave dark body text unreadable.
|
|
16
|
+
*/
|
|
17
|
+
export declare const CommsStatCard: React.FC<CommsStatCardProps>;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box, Card, Heading, Icon, Text } from "@terreno/ui";
|
|
3
|
+
const CARD_MIN_WIDTH = 148;
|
|
4
|
+
/**
|
|
5
|
+
* One metric tile in the comms dashboard summary row.
|
|
6
|
+
*
|
|
7
|
+
* The alert tone uses the light error surface with error-colored text so a failing
|
|
8
|
+
* metric stays legible; a saturated fill would leave dark body text unreadable.
|
|
9
|
+
*/
|
|
10
|
+
export const CommsStatCard = ({ caption, label, testID, tone = "neutral", value, }) => {
|
|
11
|
+
const isAlert = tone === "alert";
|
|
12
|
+
return (_jsx(Card, { border: isAlert ? "error" : "default", color: isAlert ? "errorLight" : "base", flex: "grow", minHeight: 104, minWidth: CARD_MIN_WIDTH, padding: 4, testID: testID, children: _jsxs(Box, { gap: 1, children: [_jsxs(Box, { alignItems: "center", direction: "row", gap: 1, children: [isAlert ? (_jsx(Icon, { color: "error", iconName: "triangle-exclamation", size: "sm", type: "solid" })) : null, _jsx(Text, { color: isAlert ? "error" : "secondaryDark", size: "sm", truncate: true, children: label })] }), _jsx(Heading, { color: isAlert ? "error" : "primary", size: "lg", children: value }), caption ? (_jsx(Text, { color: isAlert ? "error" : "secondaryLight", size: "sm", children: caption })) : null] }) }));
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=CommsStatCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommsStatCard.js","sourceRoot":"","sources":["../../src/comms/CommsStatCard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,aAAa,CAAC;AAG3D,MAAM,cAAc,GAAG,GAAG,CAAC;AAY3B;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAiC,CAAC,EAC1D,OAAO,EACP,KAAK,EACL,MAAM,EACN,IAAI,GAAG,SAAS,EAChB,KAAK,GACN,EAAE,EAAE;IACH,MAAM,OAAO,GAAG,IAAI,KAAK,OAAO,CAAC;IACjC,OAAO,CACL,KAAC,IAAI,IACH,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EACrC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,EACtC,IAAI,EAAC,MAAM,EACX,SAAS,EAAE,GAAG,EACd,QAAQ,EAAE,cAAc,EACxB,OAAO,EAAE,CAAC,EACV,MAAM,EAAE,MAAM,YAEd,MAAC,GAAG,IAAC,GAAG,EAAE,CAAC,aACT,MAAC,GAAG,IAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAC,KAAK,EAAC,GAAG,EAAE,CAAC,aAC5C,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IAAC,KAAK,EAAC,OAAO,EAAC,QAAQ,EAAC,sBAAsB,EAAC,IAAI,EAAC,IAAI,EAAC,IAAI,EAAC,OAAO,GAAG,CAC9E,CAAC,CAAC,CAAC,IAAI,EACR,KAAC,IAAI,IAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,eAAe,EAAE,IAAI,EAAC,IAAI,EAAC,QAAQ,kBACjE,KAAK,GACD,IACH,EACN,KAAC,OAAO,IAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,IAAI,EAAC,IAAI,YACrD,KAAK,GACE,EACT,OAAO,CAAC,CAAC,CAAC,CACT,KAAC,IAAI,IAAC,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,EAAE,IAAI,EAAC,IAAI,YACzD,OAAO,GACH,CACR,CAAC,CAAC,CAAC,IAAI,IACJ,GACD,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Badge } from "@terreno/ui";
|
|
3
|
+
const STATUS_BADGE = {
|
|
4
|
+
bounced: "warning",
|
|
5
|
+
cancelled: "neutral",
|
|
6
|
+
delivered: "success",
|
|
7
|
+
failed: "error",
|
|
8
|
+
sent: "info",
|
|
9
|
+
};
|
|
10
|
+
export const CommsStatusBadge = ({ status, testID }) => {
|
|
11
|
+
var _a;
|
|
12
|
+
return _jsx(Badge, { status: (_a = STATUS_BADGE[status]) !== null && _a !== void 0 ? _a : "neutral", testID: testID, value: status });
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=CommsStatusBadge.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommsStatusBadge.js","sourceRoot":"","sources":["../../src/comms/CommsStatusBadge.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,KAAK,EAAC,MAAM,aAAa,CAAC;AAGlC,MAAM,YAAY,GAAyE;IACzF,OAAO,EAAE,SAAS;IAClB,SAAS,EAAE,SAAS;IACpB,SAAS,EAAE,SAAS;IACpB,MAAM,EAAE,OAAO;IACf,IAAI,EAAE,MAAM;CACb,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAgD,CAAC,EAAC,MAAM,EAAE,MAAM,EAAC,EAAE,EAAE;;IAChG,OAAO,KAAC,KAAK,IAAC,MAAM,EAAE,MAAA,YAAY,CAAC,MAAM,CAAC,mCAAI,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAI,CAAC;AAC7F,CAAC,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface CommsDashboardFilters {
|
|
2
|
+
channel?: string;
|
|
3
|
+
endDate?: string;
|
|
4
|
+
errorClass?: string;
|
|
5
|
+
page?: number;
|
|
6
|
+
provider?: string;
|
|
7
|
+
q?: string;
|
|
8
|
+
startDate?: string;
|
|
9
|
+
status?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const parseCommsDashboardSearchParams: (params: Record<string, unknown>) => CommsDashboardFilters;
|
|
12
|
+
export declare const serializeCommsDashboardSearchParams: (filters: CommsDashboardFilters) => Record<string, string>;
|
|
13
|
+
export declare const defaultCommsDashboardDateRange: () => {
|
|
14
|
+
endDate: string;
|
|
15
|
+
startDate: string;
|
|
16
|
+
};
|
|
17
|
+
export declare const withDefaultCommsDashboardDates: (filters: CommsDashboardFilters) => CommsDashboardFilters;
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
const asString = (value) => {
|
|
3
|
+
if (Array.isArray(value)) {
|
|
4
|
+
return asString(value[0]);
|
|
5
|
+
}
|
|
6
|
+
if (typeof value !== "string") {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const trimmed = value.trim();
|
|
10
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
11
|
+
};
|
|
12
|
+
export const parseCommsDashboardSearchParams = (params) => {
|
|
13
|
+
const pageValue = asString(params.page);
|
|
14
|
+
const page = pageValue ? Number.parseInt(pageValue, 10) : undefined;
|
|
15
|
+
return {
|
|
16
|
+
channel: asString(params.channel),
|
|
17
|
+
endDate: asString(params.endDate),
|
|
18
|
+
errorClass: asString(params.errorClass),
|
|
19
|
+
page: page && page > 0 ? page : undefined,
|
|
20
|
+
provider: asString(params.provider),
|
|
21
|
+
q: asString(params.q),
|
|
22
|
+
startDate: asString(params.startDate),
|
|
23
|
+
status: asString(params.status),
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
export const serializeCommsDashboardSearchParams = (filters) => {
|
|
27
|
+
var _a;
|
|
28
|
+
const params = {};
|
|
29
|
+
if (filters.channel) {
|
|
30
|
+
params.channel = filters.channel;
|
|
31
|
+
}
|
|
32
|
+
if (filters.provider) {
|
|
33
|
+
params.provider = filters.provider;
|
|
34
|
+
}
|
|
35
|
+
if (filters.status) {
|
|
36
|
+
params.status = filters.status;
|
|
37
|
+
}
|
|
38
|
+
if (filters.errorClass) {
|
|
39
|
+
params.errorClass = filters.errorClass;
|
|
40
|
+
}
|
|
41
|
+
if ((_a = filters.q) === null || _a === void 0 ? void 0 : _a.trim()) {
|
|
42
|
+
params.q = filters.q.trim();
|
|
43
|
+
}
|
|
44
|
+
if (filters.startDate) {
|
|
45
|
+
params.startDate = filters.startDate;
|
|
46
|
+
}
|
|
47
|
+
if (filters.endDate) {
|
|
48
|
+
params.endDate = filters.endDate;
|
|
49
|
+
}
|
|
50
|
+
if (filters.page && filters.page > 1) {
|
|
51
|
+
params.page = String(filters.page);
|
|
52
|
+
}
|
|
53
|
+
return params;
|
|
54
|
+
};
|
|
55
|
+
const DEFAULT_STATS_DAYS = 7;
|
|
56
|
+
export const defaultCommsDashboardDateRange = () => {
|
|
57
|
+
var _a, _b;
|
|
58
|
+
const endDate = DateTime.utc();
|
|
59
|
+
const startDate = endDate.minus({ days: DEFAULT_STATS_DAYS });
|
|
60
|
+
return {
|
|
61
|
+
endDate: (_a = endDate.toISO()) !== null && _a !== void 0 ? _a : "",
|
|
62
|
+
startDate: (_b = startDate.toISO()) !== null && _b !== void 0 ? _b : "",
|
|
63
|
+
};
|
|
64
|
+
};
|
|
65
|
+
export const withDefaultCommsDashboardDates = (filters) => {
|
|
66
|
+
if (filters.startDate || filters.endDate) {
|
|
67
|
+
return filters;
|
|
68
|
+
}
|
|
69
|
+
return Object.assign(Object.assign({}, filters), defaultCommsDashboardDateRange());
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=commsDashboardParams.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commsDashboardParams.js","sourceRoot":"","sources":["../../src/comms/commsDashboardParams.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAa/B,MAAM,QAAQ,GAAG,CAAC,KAAc,EAAsB,EAAE;IACtD,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5B,CAAC;IACD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC;IAC7B,OAAO,OAAO,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;AAClD,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,+BAA+B,GAAG,CAC7C,MAA+B,EACR,EAAE;IACzB,MAAM,SAAS,GAAG,QAAQ,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;IACxC,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;IACpE,OAAO;QACL,OAAO,E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QACtB,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;IACvC,CAAC;IACD,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACpB,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;IACnC,CAAC;IACD,IAAI,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;QACrC,MAAM,CAAC,IAAI,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC,CAAC;AAEF,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAE7B,MAAM,CAAC,MAAM,8BAA8B,GAAG,GAAyC,EAAE;;IACvF,MAAM,OAAO,GAAG,QAAQ,CAAC,GAAG,EAAE,CAAC;IAC/B,MAAM,SAAS,GAAG,OAAO,CAAC,KAAK,CAAC,EAAC,IAAI,EAAE,kBAAkB,EAAC,CAAC,CAAC;IAC5D,OAAO;QACL,OAAO,EAAE,MAAA,OAAO,CAAC,KAAK,EAAE,mCAAI,EAAE;QAC9B,SAAS,EAAE,MAAA,SAAS,CAAC,KAAK,EAAE,mCAAI,EAAE;KACnC,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC5C,OAA8B,EACP,EAAE;IACzB,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,OAAO,EAAE,CAAC;QACzC,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,uCAAW,OAAO,GAAK,8BAA8B,EAAE,EAAE;AAC3D,CAAC,CAAC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
export interface CommsMessageAttempt {
|
|
2
|
+
at?: string;
|
|
3
|
+
error?: string;
|
|
4
|
+
errorClass?: string;
|
|
5
|
+
errorCode?: string;
|
|
6
|
+
provider?: string;
|
|
7
|
+
providerMessageId?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface CommsMessageRow {
|
|
10
|
+
_id?: string;
|
|
11
|
+
attemptCount?: number;
|
|
12
|
+
attempts?: CommsMessageAttempt[];
|
|
13
|
+
channel: string;
|
|
14
|
+
created?: string;
|
|
15
|
+
error?: string;
|
|
16
|
+
errorClass?: string;
|
|
17
|
+
errorCode?: string;
|
|
18
|
+
id?: string;
|
|
19
|
+
metadata?: Record<string, unknown>;
|
|
20
|
+
payload?: unknown;
|
|
21
|
+
provider: string;
|
|
22
|
+
retriedById?: string;
|
|
23
|
+
retriedFromId?: string;
|
|
24
|
+
retryDisabledReason?: string;
|
|
25
|
+
retryable?: boolean;
|
|
26
|
+
retries?: CommsMessageRow[];
|
|
27
|
+
status: string;
|
|
28
|
+
subject?: string;
|
|
29
|
+
templateId?: string;
|
|
30
|
+
to: string;
|
|
31
|
+
userId?: string;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Reads a message row out of a dashboard response.
|
|
35
|
+
*
|
|
36
|
+
* Hosts differ in how they unwrap responses: the example app's Better Auth base query
|
|
37
|
+
* strips `{data}` envelopes unless the body carries `more`, so detail and retry hooks
|
|
38
|
+
* yield the row itself while list responses stay wrapped. Accept both shapes.
|
|
39
|
+
*/
|
|
40
|
+
export declare const unwrapCommsMessage: (payload: unknown) => CommsMessageRow | undefined;
|
|
41
|
+
export declare const commsMessageId: (row: CommsMessageRow) => string;
|
|
42
|
+
/**
|
|
43
|
+
* Prints a comms timestamp for operators. Invalid or missing values stay as-is so a
|
|
44
|
+
* bad provider clock does not blank the cell.
|
|
45
|
+
*/
|
|
46
|
+
export declare const formatCommsTimestamp: ({ empty, value, }: {
|
|
47
|
+
empty?: string;
|
|
48
|
+
value?: string;
|
|
49
|
+
}) => string;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { DateTime } from "luxon";
|
|
2
|
+
/**
|
|
3
|
+
* Reads a message row out of a dashboard response.
|
|
4
|
+
*
|
|
5
|
+
* Hosts differ in how they unwrap responses: the example app's Better Auth base query
|
|
6
|
+
* strips `{data}` envelopes unless the body carries `more`, so detail and retry hooks
|
|
7
|
+
* yield the row itself while list responses stay wrapped. Accept both shapes.
|
|
8
|
+
*/
|
|
9
|
+
export const unwrapCommsMessage = (payload) => {
|
|
10
|
+
var _a;
|
|
11
|
+
if (!payload || typeof payload !== "object") {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const record = payload;
|
|
15
|
+
if (record.data && typeof record.data === "object" && !Array.isArray(record.data)) {
|
|
16
|
+
return unwrapCommsMessage(record.data);
|
|
17
|
+
}
|
|
18
|
+
const rawId = (_a = record._id) !== null && _a !== void 0 ? _a : record.id;
|
|
19
|
+
const id = typeof rawId === "string" ? rawId : rawId != null ? String(rawId) : "";
|
|
20
|
+
if (id.length === 0) {
|
|
21
|
+
return undefined;
|
|
22
|
+
}
|
|
23
|
+
return Object.assign(Object.assign({}, record), { _id: id });
|
|
24
|
+
};
|
|
25
|
+
export const commsMessageId = (row) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
return (_b = (_a = row._id) !== null && _a !== void 0 ? _a : row.id) !== null && _b !== void 0 ? _b : "";
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Prints a comms timestamp for operators. Invalid or missing values stay as-is so a
|
|
31
|
+
* bad provider clock does not blank the cell.
|
|
32
|
+
*/
|
|
33
|
+
export const formatCommsTimestamp = ({ empty = "", value, }) => {
|
|
34
|
+
if (!value) {
|
|
35
|
+
return empty;
|
|
36
|
+
}
|
|
37
|
+
const parsed = DateTime.fromISO(value);
|
|
38
|
+
if (!parsed.isValid) {
|
|
39
|
+
return value;
|
|
40
|
+
}
|
|
41
|
+
return parsed.toLocal().toLocaleString(DateTime.DATETIME_MED);
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=commsMessagePayload.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commsMessagePayload.js","sourceRoot":"","sources":["../../src/comms/commsMessagePayload.ts"],"names":[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AE,CAAC;QACX,OAAO,KAAK,CAAC;IACf,CAAC;IACD,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACvC,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC;QACpB,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,MAAM,CAAC,OAAO,EAAE,CAAC,cAAc,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;AAChE,CAAC,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export const summarizeSkippedReasons = (skipped) => {
|
|
2
|
+
var _a;
|
|
3
|
+
if (skipped.length === 0) {
|
|
4
|
+
return "none skipped";
|
|
5
|
+
}
|
|
6
|
+
const counts = new Map();
|
|
7
|
+
for (const row of skipped) {
|
|
8
|
+
counts.set(row.reason, ((_a = counts.get(row.reason)) !== null && _a !== void 0 ? _a : 0) + 1);
|
|
9
|
+
}
|
|
10
|
+
return [...counts.entries()].map(([reason, count]) => `${count}× ${reason}`).join("; ");
|
|
11
|
+
};
|
|
12
|
+
//# sourceMappingURL=commsRetrySummary.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"commsRetrySummary.js","sourceRoot":"","sources":["../../src/comms/commsRetrySummary.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAA4C,EAAU,EAAE;;IAC9F,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,OAAO,cAAc,CAAC;IACxB,CAAC;IACD,MAAM,MAAM,GAAG,IAAI,GAAG,EAAkB,CAAC;IACzC,KAAK,MAAM,GAAG,IAAI,OAAO,EAAE,CAAC;QAC1B,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,EAAE,CAAC,MAAA,MAAM,CAAC,GAAG,CAAC,GAAG,CAAC,MAAM,CAAC,mCAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;IAC5D,CAAC;IACD,OAAO,CAAC,GAAG,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,KAAK,CAAC,EAAE,EAAE,CAAC,GAAG,KAAK,KAAK,MAAM,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1F,CAAC,CAAC"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import type { AdminApi } from "../types";
|
|
2
|
+
import type { CommsDashboardFilters } from "./commsDashboardParams";
|
|
3
|
+
import type { CommsMessageRow } from "./commsMessagePayload";
|
|
4
|
+
export type { CommsMessageAttempt, CommsMessageRow } from "./commsMessagePayload";
|
|
5
|
+
export interface CommsListResponse {
|
|
6
|
+
data: CommsMessageRow[];
|
|
7
|
+
limit: number;
|
|
8
|
+
more: boolean;
|
|
9
|
+
page: number;
|
|
10
|
+
total: number;
|
|
11
|
+
}
|
|
12
|
+
export interface CommsStatsResponse {
|
|
13
|
+
buckets: Array<{
|
|
14
|
+
channel: string;
|
|
15
|
+
count: number;
|
|
16
|
+
day: string;
|
|
17
|
+
provider: string;
|
|
18
|
+
status: string;
|
|
19
|
+
}>;
|
|
20
|
+
byProvider: Array<{
|
|
21
|
+
bounced: number;
|
|
22
|
+
delivered: number;
|
|
23
|
+
failed: number;
|
|
24
|
+
failureRate: number;
|
|
25
|
+
provider: string;
|
|
26
|
+
sent: number;
|
|
27
|
+
total: number;
|
|
28
|
+
}>;
|
|
29
|
+
totals: {
|
|
30
|
+
bounced: number;
|
|
31
|
+
cancelled: number;
|
|
32
|
+
delivered: number;
|
|
33
|
+
failed: number;
|
|
34
|
+
failureRate: number;
|
|
35
|
+
sent: number;
|
|
36
|
+
total: number;
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
export interface CommsRetryManyResponse {
|
|
40
|
+
retried: CommsMessageRow[];
|
|
41
|
+
skipped: Array<{
|
|
42
|
+
id: string;
|
|
43
|
+
reason: string;
|
|
44
|
+
}>;
|
|
45
|
+
}
|
|
46
|
+
export declare const useCommsDashboardApi: (api: AdminApi) => {
|
|
47
|
+
useDetailQuery: (id: string) => {
|
|
48
|
+
data?: CommsMessageRow | {
|
|
49
|
+
data: CommsMessageRow;
|
|
50
|
+
};
|
|
51
|
+
error?: unknown;
|
|
52
|
+
isLoading: boolean;
|
|
53
|
+
};
|
|
54
|
+
useListQuery: (params: CommsDashboardFilters & {
|
|
55
|
+
limit?: number;
|
|
56
|
+
}) => {
|
|
57
|
+
data?: CommsListResponse;
|
|
58
|
+
error?: unknown;
|
|
59
|
+
isLoading: boolean;
|
|
60
|
+
};
|
|
61
|
+
useRetryManyMutation: () => [(body: Record<string, unknown>) => {
|
|
62
|
+
unwrap: () => Promise<CommsRetryManyResponse>;
|
|
63
|
+
}, {
|
|
64
|
+
isLoading: boolean;
|
|
65
|
+
}];
|
|
66
|
+
useRetryMutation: () => [(id: string) => {
|
|
67
|
+
unwrap: () => Promise<CommsMessageRow | {
|
|
68
|
+
data: CommsMessageRow;
|
|
69
|
+
}>;
|
|
70
|
+
}, {
|
|
71
|
+
isLoading: boolean;
|
|
72
|
+
}];
|
|
73
|
+
useStatsQuery: (params: CommsDashboardFilters) => {
|
|
74
|
+
data?: CommsStatsResponse;
|
|
75
|
+
error?: unknown;
|
|
76
|
+
isLoading: boolean;
|
|
77
|
+
};
|
|
78
|
+
};
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { useMemo } from "react";
|
|
2
|
+
import { asDynamicHookApi } from "../dynamicHookApi";
|
|
3
|
+
const LIST_KEY = "commsDashboardList";
|
|
4
|
+
const DETAIL_KEY = "commsDashboardDetail";
|
|
5
|
+
const STATS_KEY = "commsDashboardStats";
|
|
6
|
+
const RETRY_KEY = "commsDashboardRetry";
|
|
7
|
+
const RETRY_MANY_KEY = "commsDashboardRetryMany";
|
|
8
|
+
export const useCommsDashboardApi = (api) => {
|
|
9
|
+
const enhancedApi = useMemo(() => api.enhanceEndpoints({ addTagTypes: ["commsMessages"] }).injectEndpoints({
|
|
10
|
+
endpoints: (build) => ({
|
|
11
|
+
[DETAIL_KEY]: build.query({
|
|
12
|
+
providesTags: (_result, _error, id) => [
|
|
13
|
+
{ id, type: "commsMessages" },
|
|
14
|
+
],
|
|
15
|
+
query: (id) => ({ method: "GET", url: `/comms/messages/${id}` }),
|
|
16
|
+
}),
|
|
17
|
+
[LIST_KEY]: build.query({
|
|
18
|
+
providesTags: ["commsMessages"],
|
|
19
|
+
query: (params) => ({
|
|
20
|
+
method: "GET",
|
|
21
|
+
params,
|
|
22
|
+
url: "/comms/messages",
|
|
23
|
+
}),
|
|
24
|
+
}),
|
|
25
|
+
[RETRY_KEY]: build.mutation({
|
|
26
|
+
invalidatesTags: ["commsMessages"],
|
|
27
|
+
query: (id) => ({
|
|
28
|
+
method: "POST",
|
|
29
|
+
url: `/comms/messages/${id}/retry`,
|
|
30
|
+
}),
|
|
31
|
+
}),
|
|
32
|
+
[RETRY_MANY_KEY]: build.mutation({
|
|
33
|
+
invalidatesTags: ["commsMessages"],
|
|
34
|
+
query: (body) => ({
|
|
35
|
+
body,
|
|
36
|
+
method: "POST",
|
|
37
|
+
url: "/comms/messages/retryMany",
|
|
38
|
+
}),
|
|
39
|
+
}),
|
|
40
|
+
[STATS_KEY]: build.query({
|
|
41
|
+
providesTags: ["commsMessages"],
|
|
42
|
+
query: (params) => ({
|
|
43
|
+
method: "GET",
|
|
44
|
+
params,
|
|
45
|
+
url: "/comms/stats",
|
|
46
|
+
}),
|
|
47
|
+
}),
|
|
48
|
+
}),
|
|
49
|
+
overrideExisting: true,
|
|
50
|
+
}), [api]);
|
|
51
|
+
const hooks = asDynamicHookApi(enhancedApi);
|
|
52
|
+
return {
|
|
53
|
+
useDetailQuery: hooks.useCommsDashboardDetailQuery,
|
|
54
|
+
useListQuery: hooks.useCommsDashboardListQuery,
|
|
55
|
+
useRetryManyMutation: hooks.useCommsDashboardRetryManyMutation,
|
|
56
|
+
useRetryMutation: hooks.useCommsDashboardRetryMutation,
|
|
57
|
+
useStatsQuery: hooks.useCommsDashboardStatsQuery,
|
|
58
|
+
};
|
|
59
|
+
};
|
|
60
|
+
//# sourceMappingURL=useCommsDashboardApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommsDashboardApi.js","sourceRoot":"","sources":["../../src/comms/useCommsDashboardApi.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AA0CnD,MAAM,QAAQ,GAAG,oBAAoB,CAAC;AACtC,MAAM,UAAU,GAAG,sBAAsB,CAAC;AAC1C,MAAM,SAAS,GAAG,qBAAqB,CAAC;AACxC,MAAM,SAAS,GAAG,qBAAqB,CAAC;AACxC,MAAM,cAAc,GAAG,yBAAyB,CAAC;AAEjD,MAAM,CAAC,MAAM,oBAAoB,GAAG,CAAC,GAAa,EAAE,EAAE;IACpD,MAAM,WAAW,GAAG,OAAO,CACzB,GAAG,EAAE,CACH,GAAG,CAAC,gBAAgB,CAAC,EAAC,WAAW,EAAE,CAAC,eAAe,CAAC,EAAC,CAAC,CAAC,eAAe,CAAC;QACrE,SAAS,EAAE,CAAC,KAAsB,EAAE,EAAE,CAAC,CAAC;YACtC,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;gBACxB,YAAY,EAAE,CAAC,OAAgB,EAAE,MAAe,EAAE,EAAU,EAAE,EAAE,CAAC;oBAC/D,EAAC,EAAE,EAAE,IAAI,EAAE,eAAe,EAAC;iBAC5B;gBACD,KAAK,EAAE,CAAC,EAAU,EAAE,EAAE,CAAC,CAAC,EAAC,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,mBAAmB,EAAE,EAAE,EAAC,CAAC;aACvE,CAAC;YACF,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC;gBACtB,YAAY,EAAE,CAAC,eAAe,CAAC;gBAC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@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { router, useLocalSearchParams } from "expo-router";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { parseCommsDashboardSearchParams, serializeCommsDashboardSearchParams, } from "./commsDashboardParams";
|
|
4
|
+
export const useCommsDashboardUrlFilters = (routeBase) => {
|
|
5
|
+
const params = useLocalSearchParams();
|
|
6
|
+
const filters = useMemo(() => parseCommsDashboardSearchParams(params), [params]);
|
|
7
|
+
const base = routeBase !== null && routeBase !== void 0 ? routeBase : "";
|
|
8
|
+
const onFiltersChange = useCallback((next) => {
|
|
9
|
+
const serialized = serializeCommsDashboardSearchParams(next);
|
|
10
|
+
const query = new URLSearchParams(serialized).toString();
|
|
11
|
+
const path = `${base}/comms`;
|
|
12
|
+
router.replace((query ? `${path}?${query}` : path));
|
|
13
|
+
}, [base]);
|
|
14
|
+
return { filters, onFiltersChange };
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=useCommsDashboardUrlFilters.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCommsDashboardUrlFilters.js","sourceRoot":"","sources":["../../src/comms/useCommsDashboardUrlFilters.tsx"],"names":[],"mappings":"AACA,OAAO,EAAC,MAAM,EAAE,oBAAoB,EAAC,MAAM,aAAa,CAAC;AACzD,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAC3C,OAAO,EAEL,+BAA+B,EAC/B,mCAAmC,GACpC,MAAM,wBAAwB,CAAC;AAEhC,MAAM,CAAC,MAAM,2BAA2B,GAAG,CACzC,SAAkB,EAIlB,EAAE;IACF,MAAM,MAAM,GAAG,oBAAoB,EAAE,CAAC;IACtC,MAAM,OAAO,GAAG,OAAO,CAAC,GAAG,EAAE,CAAC,+BAA+B,CAAC,MAAM,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IACjF,MAAM,IAAI,GAAG,SAAS,aAAT,SAAS,cAAT,SAAS,GAAI,EAAE,CAAC;IAE7B,MAAM,eAAe,GAAG,WAAW,CACjC,CAAC,IAA2B,EAAQ,EAAE;QACpC,MAAM,UAAU,GAAG,mCAAmC,CAAC,IAAI,CAAC,CAAC;QAC7D,MAAM,KAAK,GAAG,IAAI,eAAe,CAAC,UAAU,CAAC,CAAC,QAAQ,EAAE,CAAC;QACzD,MAAM,IAAI,GAAG,GAAG,IAAI,QAAQ,CAAC;QAC7B,MAAM,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,IAAI,IAAI,KAAK,EAAE,CAAC,CAAC,CAAC,IAAI,CAAS,CAAC,CAAC;IAC9D,CAAC,EACD,CAAC,IAAI,CAAC,CACP,CAAC;IAEF,OAAO,EAAC,OAAO,EAAE,eAAe,EAAC,CAAC;AACpC,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -14,6 +14,7 @@ export { AdminProvider, resetAdminWidgetWarningsForTests, useAdminContext, useDe
|
|
|
14
14
|
export { AdminRefField, type AdminRefFieldProps } from "./AdminRefField";
|
|
15
15
|
export { AdminRolesField } from "./AdminRolesField";
|
|
16
16
|
export { AdminRolesList } from "./AdminRolesList";
|
|
17
|
+
export { AdminScreenPage, type AdminScreenPageProps } from "./AdminScreenPage";
|
|
17
18
|
export { AdminScreenRouter, type AdminScreenRouterProps } from "./AdminScreenRouter";
|
|
18
19
|
export { AdminScriptList } from "./AdminScriptList";
|
|
19
20
|
export { AdminScriptRunModal } from "./AdminScriptRunModal";
|
|
@@ -29,6 +30,12 @@ export { ConsentFormList } from "./ConsentFormList";
|
|
|
29
30
|
export { ConsentHistory } from "./ConsentHistory";
|
|
30
31
|
export { ConsentResponseViewer } from "./ConsentResponseViewer";
|
|
31
32
|
export { ADMIN_FILTER_MOBILE_BREAKPOINT, ADMIN_SEARCH_DEBOUNCE_MS } from "./Constants";
|
|
33
|
+
export { CommsDashboardScreen, type CommsDashboardScreenProps } from "./comms/CommsDashboardScreen";
|
|
34
|
+
export { COMMS_ADMIN_WIDGETS, CommsDashboardScreenWidget, } from "./comms/CommsDashboardScreenWidget";
|
|
35
|
+
export { CommsMessageDetail, type CommsMessageDetailProps } from "./comms/CommsMessageDetail";
|
|
36
|
+
export { CommsStatCard, type CommsStatCardProps } from "./comms/CommsStatCard";
|
|
37
|
+
export { CommsStatusBadge } from "./comms/CommsStatusBadge";
|
|
38
|
+
export { type CommsDashboardFilters, parseCommsDashboardSearchParams, serializeCommsDashboardSearchParams, } from "./comms/commsDashboardParams";
|
|
32
39
|
export { DocumentStorageBrowser } from "./DocumentStorageBrowser";
|
|
33
40
|
export { generateConsentHistoryPdf } from "./generateConsentHistoryPdf";
|
|
34
41
|
export { LocaleContentEditor } from "./LocaleContentEditor";
|
package/dist/index.js
CHANGED
|
@@ -13,6 +13,7 @@ export { AdminProvider, resetAdminWidgetWarningsForTests, useAdminContext, useDe
|
|
|
13
13
|
export { AdminRefField } from "./AdminRefField";
|
|
14
14
|
export { AdminRolesField } from "./AdminRolesField";
|
|
15
15
|
export { AdminRolesList } from "./AdminRolesList";
|
|
16
|
+
export { AdminScreenPage } from "./AdminScreenPage";
|
|
16
17
|
export { AdminScreenRouter } from "./AdminScreenRouter";
|
|
17
18
|
export { AdminScriptList } from "./AdminScriptList";
|
|
18
19
|
export { AdminScriptRunModal } from "./AdminScriptRunModal";
|
|
@@ -28,6 +29,12 @@ export { ConsentFormList } from "./ConsentFormList";
|
|
|
28
29
|
export { ConsentHistory } from "./ConsentHistory";
|
|
29
30
|
export { ConsentResponseViewer } from "./ConsentResponseViewer";
|
|
30
31
|
export { ADMIN_FILTER_MOBILE_BREAKPOINT, ADMIN_SEARCH_DEBOUNCE_MS } from "./Constants";
|
|
32
|
+
export { CommsDashboardScreen } from "./comms/CommsDashboardScreen";
|
|
33
|
+
export { COMMS_ADMIN_WIDGETS, CommsDashboardScreenWidget, } from "./comms/CommsDashboardScreenWidget";
|
|
34
|
+
export { CommsMessageDetail } from "./comms/CommsMessageDetail";
|
|
35
|
+
export { CommsStatCard } from "./comms/CommsStatCard";
|
|
36
|
+
export { CommsStatusBadge } from "./comms/CommsStatusBadge";
|
|
37
|
+
export { parseCommsDashboardSearchParams, serializeCommsDashboardSearchParams, } from "./comms/commsDashboardParams";
|
|
31
38
|
export { DocumentStorageBrowser } from "./DocumentStorageBrowser";
|
|
32
39
|
export { generateConsentHistoryPdf } from "./generateConsentHistoryPdf";
|
|
33
40
|
export { LocaleContentEditor } from "./LocaleContentEditor";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAA8B,gBAAgB,EAAC,MAAM,oBAAoB,CAAC;AACjF,OAAO,EAAC,kBAAkB,EAAC,MAAM,sBAAsB,CAAC;AACxD,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,cAAc,EAAuC,MAAM,kBAAkB,CAAC;AACtF,OAAO,EAAC,cAAc,EAAC,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,qBAAqB,EAAC,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAC,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,wBAAwB,EAAC,MAAM,4BAA4B,CAAC;AAEpE,OAAO,EACL,aAAa,EACb,gCAAgC,EAChC,eAAe,EACf,8BAA8B,EAC9B,cAAc,EACd,aAAa,EACb,eAAe,GAChB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAC,aAAa,EAA0B,MAAM,iBAAiB,CAAC;AACvE,OAAO,EAAC,eAAe,EAAC,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAC,cAAc,EA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,qBAAqB,GACtB,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,2BAA2B,EAC3B,2BAA2B,GAC5B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAC,gBAAgB,EAAC,MAAM,4BAA4B,CAAC;AAC5D,OAAO,EAAC,oBAAoB,EAAC,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAC,kBAAkB,EAAC,MAAM,8BAA8B,CAAC;AAChE,OAAO,EAAC,mBAAmB,EAAC,MAAM,+BAA+B,CAAC"}
|
package/dist/types.d.ts
CHANGED
|
@@ -319,6 +319,8 @@ export interface DocumentListResponse {
|
|
|
319
319
|
export interface DocumentStorageBrowserProps {
|
|
320
320
|
api: AdminApi;
|
|
321
321
|
basePath: string;
|
|
322
|
+
/** Route opened by the standard admin screen back arrow. */
|
|
323
|
+
backHref?: string;
|
|
322
324
|
title?: string;
|
|
323
325
|
allowDelete?: boolean;
|
|
324
326
|
allowUpload?: boolean;
|
|
@@ -5,8 +5,16 @@ export interface AdminBackgroundTaskBody {
|
|
|
5
5
|
metadata?: Record<string, unknown>;
|
|
6
6
|
resourceRoute?: string;
|
|
7
7
|
}
|
|
8
|
+
type AdminBackgroundTaskMutation = readonly [
|
|
9
|
+
(body: AdminBackgroundTaskBody) => {
|
|
10
|
+
unwrap: () => Promise<unknown>;
|
|
11
|
+
},
|
|
12
|
+
{
|
|
13
|
+
isLoading: boolean;
|
|
14
|
+
}
|
|
15
|
+
];
|
|
8
16
|
/**
|
|
9
17
|
* RTK Query mutation hook for `POST {adminApiRoot}/background-tasks` (admin enqueue).
|
|
10
18
|
*/
|
|
11
|
-
export declare const useAdminBackgroundTaskMutation: (api: AdminApi, adminApiRoot: string) =>
|
|
12
|
-
|
|
19
|
+
export declare const useAdminBackgroundTaskMutation: (api: AdminApi, adminApiRoot: string) => AdminBackgroundTaskMutation;
|
|
20
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAdminBackgroundTask.js","sourceRoot":"","sources":["../src/useAdminBackgroundTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"useAdminBackgroundTask.js","sourceRoot":"","sources":["../src/useAdminBackgroundTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAE9B,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB,CAAC;AAelD;;GAEG;AACH,MAAM,CAAC,MAAM,8BAA8B,GAAG,CAC5C,GAAa,EACb,YAAoB,EACS,EAAE;IAC/B,MAAM,WAAW,GAAG,OAAO,CAAC,GAAG,EAAE;QAC/B,MAAM,IAAI,GAAG,YAAY,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QAC7C,OAAO,GAAG,CAAC,gBAAgB,CAAC,EAAC,WAAW,EAAE,CAAC,qBAAqB,CAAC,EAAC,CAAC,CAAC,eAAe,CAAC;YAClF,SAAS,EAAE,CAAC,KAAsB,EAAE,EAAE,CAAC,CAAC;gBACtC,uBAAuB,EAAE,KAAK,CAAC,QAAQ,CAAC;oBACtC,eAAe,EAAE,EAAE;oBACnB,KAAK,EAAE,CAAC,IAA6B,EAAE,EAAE,CAAC,CAAC;wBACzC,IAAI;wBACJ,MAAM,EAAE,MAAM;wBACd,GAAG,EAAE,GAAG,IAAI,mBAAmB;qBAChC,CAAC;iBACH,CAAC;aACH,CAAC;YACF,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,GAAG,EAAE,YAAY,CAAC,CAAC,CAAC;IAExB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO,QAAQ,CAAC,kCAAkC,EAAiC,CAAC;AACtF,CAAC,CAAC"}
|
|
@@ -1,28 +1,26 @@
|
|
|
1
1
|
import type { AdminApi } from "./types";
|
|
2
|
-
type
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
type ConfigBody = Record<string, unknown>;
|
|
3
|
+
interface RtkQueryHookResult {
|
|
4
|
+
data?: unknown;
|
|
5
|
+
error?: unknown;
|
|
6
|
+
isLoading: boolean;
|
|
7
|
+
}
|
|
8
|
+
type RtkMutationTrigger = (body: ConfigBody) => {
|
|
9
|
+
unwrap: () => Promise<unknown>;
|
|
10
|
+
};
|
|
5
11
|
interface UseConfigurationApiOptions {
|
|
6
12
|
api: AdminApi;
|
|
7
13
|
basePath: string;
|
|
8
14
|
}
|
|
9
15
|
interface UseConfigurationApiResult {
|
|
10
|
-
useMetaQuery: () =>
|
|
11
|
-
|
|
12
|
-
isLoading: boolean;
|
|
13
|
-
error: RtkError;
|
|
14
|
-
};
|
|
15
|
-
useRefreshSecretsMutation: () => [RtkMutationTrigger, {
|
|
16
|
+
useMetaQuery: () => RtkQueryHookResult;
|
|
17
|
+
useRefreshSecretsMutation: () => readonly [RtkMutationTrigger, {
|
|
16
18
|
isLoading: boolean;
|
|
17
19
|
}];
|
|
18
|
-
useUpdateMutation: () => [RtkMutationTrigger, {
|
|
20
|
+
useUpdateMutation: () => readonly [RtkMutationTrigger, {
|
|
19
21
|
isLoading: boolean;
|
|
20
22
|
}];
|
|
21
|
-
useValuesQuery: () =>
|
|
22
|
-
data: RtkHookResult;
|
|
23
|
-
isLoading: boolean;
|
|
24
|
-
error: RtkError;
|
|
25
|
-
};
|
|
23
|
+
useValuesQuery: () => RtkQueryHookResult;
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* Hook that generates RTK Query hooks for configuration management.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useConfigurationApi.js","sourceRoot":"","sources":["../src/useConfigurationApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,OAAO,EAAC,MAAM,OAAO,CAAC;AAC9B,OAAO,EAAC,gBAAgB,EAAC,MAAM,kBAAkB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AM,EAAE,KAAK;wBACb,GAAG,EAAE,QAAQ;qBACd,CAAC;iBACH,CAAC;aACH,CAAC;YACF,gBAAgB,EAAE,IAAI;SACvB,CAAC,CAAC;IACL,CAAC,EAAE,CAAC,GAAG,EAAE,QAAQ,CAAC,CAAC,CAAC;IAEpB,MAAM,QAAQ,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC/C,OAAO;QACL,YAAY,EAAE,QAAQ,CAAC,kBAAkB;QACzC,yBAAyB,EAAE,QAAQ,CAAC,+BAA+B;QACnE,iBAAiB,EAAE,QAAQ,CAAC,uBAAuB;QACnD,cAAc,EAAE,QAAQ,CAAC,oBAAoB;KAC9C,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { AIRequestExplorer
|
|
2
|
+
import { AIRequestExplorer } from "@terreno/ui";
|
|
3
3
|
import { useCallback, useMemo, useState } from "react";
|
|
4
|
+
import { AdminScreenPage } from "../AdminScreenPage";
|
|
4
5
|
import { asDynamicHookApi } from "../dynamicHookApi";
|
|
5
6
|
const EXPLORER_LIMIT = 20;
|
|
6
7
|
const AI_REQUESTS_ENDPOINT_KEY = "adminAiRequestsExplorer";
|
|
7
|
-
export const AIRequestsScreenWidget = ({ api }) => {
|
|
8
|
+
export const AIRequestsScreenWidget = ({ api, routeBase }) => {
|
|
8
9
|
var _a, _b;
|
|
9
10
|
const [page, setPage] = useState(1);
|
|
10
11
|
const [requestTypeFilter, setRequestTypeFilter] = useState([]);
|
|
@@ -46,7 +47,7 @@ export const AIRequestsScreenWidget = ({ api }) => {
|
|
|
46
47
|
setPage(1);
|
|
47
48
|
}, []);
|
|
48
49
|
const total = (_a = data === null || data === void 0 ? void 0 : data.total) !== null && _a !== void 0 ? _a : 0;
|
|
49
|
-
return (_jsx(
|
|
50
|
+
return (_jsx(AdminScreenPage, { backHref: routeBase, maxWidth: "100%", scroll: true, title: "AI Request Explorer", children: _jsx(AIRequestExplorer, { data: (_b = data === null || data === void 0 ? void 0 : data.data) !== null && _b !== void 0 ? _b : [], endDate: endDate, isLoading: isLoading, onEndDateChange: handleEndDateChange, onPageChange: handlePageChange, onRequestTypeFilterChange: handleRequestTypeFilterChange, onStartDateChange: handleStartDateChange, page: page, requestTypeFilter: requestTypeFilter, startDate: startDate, testID: "admin-ai-explorer", totalCount: total, totalPages: Math.ceil(total / EXPLORER_LIMIT) }) }));
|
|
50
51
|
};
|
|
51
52
|
export const AI_ADMIN_WIDGETS = {
|
|
52
53
|
"ai-requests": AIRequestsScreenWidget,
|