@terreno/admin-frontend 0.31.0 → 57.0.0-beta.1
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/AdminShell.d.ts +5 -0
- package/dist/AdminShell.js +100 -31
- package/dist/AdminShell.js.map +1 -1
- package/dist/ConsentHistory.d.ts +9 -0
- package/dist/ConsentHistory.js +61 -0
- package/dist/ConsentHistory.js.map +1 -0
- package/dist/generateConsentHistoryPdf.d.ts +2 -0
- package/dist/generateConsentHistoryPdf.js +225 -0
- package/dist/generateConsentHistoryPdf.js.map +1 -0
- package/dist/generateConsentPdf.js +75 -28
- package/dist/generateConsentPdf.js.map +1 -1
- package/dist/index.d.ts +3 -0
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/pdfUtils.d.ts +9 -0
- package/dist/pdfUtils.js +25 -0
- package/dist/pdfUtils.js.map +1 -0
- package/dist/useAdminBackgroundTask.js.map +1 -1
- package/dist/useConsentHistory.d.ts +63 -0
- package/dist/useConsentHistory.js +40 -0
- package/dist/useConsentHistory.js.map +1 -0
- package/package.json +11 -9
- 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/AdminScriptList.test.tsx +1 -1
- package/src/AdminShell.test.tsx +191 -0
- package/src/AdminShell.tsx +331 -144
- 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 +161 -0
- package/src/ConsentHistory.tsx +251 -0
- package/src/ConsentResponseViewer.test.tsx +1 -1
- package/src/DocumentStorageBrowser.test.tsx +1 -1
- package/src/LocaleContentEditor.test.tsx +1 -1
- package/src/generateConsentHistoryPdf.ts +259 -0
- package/src/generateConsentPdf.ts +96 -31
- package/src/index.tsx +3 -0
- package/src/isolated/AdminFieldRenderer.isolated.tsx +1 -1
- package/src/isolated/AdminNestedArrayField.isolated.tsx +1 -1
- package/src/isolated/AdminObjectPicker.isolated.tsx +1 -1
- package/src/isolated/AdminScriptRunModal.isolated.tsx +1 -1
- package/src/isolated/DocumentStorageBrowser.isolated.tsx +1 -1
- package/src/isolated/generateConsentPdf.isolated.ts +5 -0
- package/src/pdfUtils.ts +28 -0
- package/src/useAdminBackgroundTask.ts +1 -0
- package/src/useConsentHistory.test.ts +106 -0
- package/src/useConsentHistory.ts +94 -0
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
import {describe, expect, it, mock} from "bun:test";
|
|
2
|
+
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
3
|
+
import {act, fireEvent, waitFor} from "@testing-library/react-native";
|
|
4
|
+
|
|
5
|
+
import {ConsentHistory} from "./ConsentHistory";
|
|
6
|
+
import type {ConsentHistoryEntry} from "./useConsentHistory";
|
|
7
|
+
|
|
8
|
+
type ConsentHistoryApi = Parameters<typeof ConsentHistory>[0]["api"];
|
|
9
|
+
|
|
10
|
+
const makeEntry = (overrides: Partial<ConsentHistoryEntry> = {}): ConsentHistoryEntry => ({
|
|
11
|
+
_id: "entry-1",
|
|
12
|
+
agreed: true,
|
|
13
|
+
agreedAt: "2026-01-02T03:04:05.000Z",
|
|
14
|
+
form: {
|
|
15
|
+
captureSignature: true,
|
|
16
|
+
checkboxes: [{label: "I have read the terms", required: true}],
|
|
17
|
+
slug: "tos",
|
|
18
|
+
title: "Terms of Service",
|
|
19
|
+
type: "terms",
|
|
20
|
+
version: 3,
|
|
21
|
+
},
|
|
22
|
+
...overrides,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const createApi = (state: {
|
|
26
|
+
data?: unknown;
|
|
27
|
+
error?: unknown;
|
|
28
|
+
isLoading?: boolean;
|
|
29
|
+
refetch?: () => void;
|
|
30
|
+
}): ConsentHistoryApi => {
|
|
31
|
+
const api = {
|
|
32
|
+
enhanceEndpoints: () => ({
|
|
33
|
+
injectEndpoints: () => ({
|
|
34
|
+
useGetMyConsentsQuery: () => ({
|
|
35
|
+
data: state.data,
|
|
36
|
+
error: state.error,
|
|
37
|
+
isLoading: state.isLoading ?? false,
|
|
38
|
+
refetch: state.refetch ?? (() => {}),
|
|
39
|
+
}),
|
|
40
|
+
}),
|
|
41
|
+
}),
|
|
42
|
+
};
|
|
43
|
+
return api as unknown as ConsentHistoryApi;
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
describe("ConsentHistory", () => {
|
|
47
|
+
it("renders a spinner while loading", () => {
|
|
48
|
+
const {queryByTestId} = renderWithTheme(
|
|
49
|
+
<ConsentHistory api={createApi({isLoading: true})} title="History" />
|
|
50
|
+
);
|
|
51
|
+
expect(queryByTestId("consent-history-list")).toBeNull();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it("renders an error state with a retry button", async () => {
|
|
55
|
+
const refetch = mock(() => {});
|
|
56
|
+
const {getByText} = renderWithTheme(
|
|
57
|
+
<ConsentHistory api={createApi({error: new Error("boom"), refetch})} />
|
|
58
|
+
);
|
|
59
|
+
expect(getByText("Failed to load consent history")).toBeTruthy();
|
|
60
|
+
|
|
61
|
+
await act(async () => {
|
|
62
|
+
fireEvent.press(getByText("Retry"));
|
|
63
|
+
// Button debounces presses.
|
|
64
|
+
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
await waitFor(() => {
|
|
68
|
+
expect(refetch).toHaveBeenCalled();
|
|
69
|
+
});
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
it("renders an empty state when there are no entries", () => {
|
|
73
|
+
const {getByText} = renderWithTheme(<ConsentHistory api={createApi({data: []})} />);
|
|
74
|
+
expect(getByText("No consent records found.")).toBeTruthy();
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
it("renders each entry with its form title, type and agreed badge", () => {
|
|
78
|
+
const {getByTestId, getByText} = renderWithTheme(
|
|
79
|
+
<ConsentHistory api={createApi({data: [makeEntry()]})} />
|
|
80
|
+
);
|
|
81
|
+
expect(getByTestId("consent-history-list")).toBeTruthy();
|
|
82
|
+
expect(getByText("Terms of Service")).toBeTruthy();
|
|
83
|
+
expect(getByText("terms")).toBeTruthy();
|
|
84
|
+
expect(getByText("Agreed")).toBeTruthy();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
it("falls back to placeholder text when the form is missing and shows declined entries", () => {
|
|
88
|
+
const {getByText} = renderWithTheme(
|
|
89
|
+
<ConsentHistory api={createApi({data: [makeEntry({agreed: false, form: null})]})} />
|
|
90
|
+
);
|
|
91
|
+
expect(getByText("Unknown Form")).toBeTruthy();
|
|
92
|
+
expect(getByText("Declined")).toBeTruthy();
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
it("expands and collapses the entry details when pressed", () => {
|
|
96
|
+
const {getByTestId, queryByTestId} = renderWithTheme(
|
|
97
|
+
<ConsentHistory api={createApi({data: [makeEntry()]})} />
|
|
98
|
+
);
|
|
99
|
+
expect(queryByTestId("consent-history-item-details-entry-1")).toBeNull();
|
|
100
|
+
fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
|
|
101
|
+
expect(getByTestId("consent-history-item-details-entry-1")).toBeTruthy();
|
|
102
|
+
fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
|
|
103
|
+
expect(queryByTestId("consent-history-item-details-entry-1")).toBeNull();
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it("shows every optional detail when expanded", () => {
|
|
107
|
+
const entry = makeEntry({
|
|
108
|
+
checkboxValues: {"0": true, "1": false},
|
|
109
|
+
contentSnapshot: "# Snapshot",
|
|
110
|
+
ipAddress: "10.0.0.1",
|
|
111
|
+
locale: "en-US",
|
|
112
|
+
signature: "data:image/png;base64,abc",
|
|
113
|
+
signedAt: "2026-01-02T03:05:00.000Z",
|
|
114
|
+
});
|
|
115
|
+
const {getByTestId, getByText} = renderWithTheme(
|
|
116
|
+
<ConsentHistory api={createApi({data: [entry]})} />
|
|
117
|
+
);
|
|
118
|
+
fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
|
|
119
|
+
|
|
120
|
+
expect(getByText("Version:")).toBeTruthy();
|
|
121
|
+
expect(getByText("3")).toBeTruthy();
|
|
122
|
+
expect(getByText("Locale:")).toBeTruthy();
|
|
123
|
+
expect(getByText("en-US")).toBeTruthy();
|
|
124
|
+
expect(getByText("Signed:")).toBeTruthy();
|
|
125
|
+
expect(getByText("IP Address:")).toBeTruthy();
|
|
126
|
+
expect(getByText("10.0.0.1")).toBeTruthy();
|
|
127
|
+
expect(getByText("Checkboxes")).toBeTruthy();
|
|
128
|
+
// Labelled from the form for index 0, generic fallback for index 1.
|
|
129
|
+
expect(getByText("I have read the terms")).toBeTruthy();
|
|
130
|
+
expect(getByText("Checkbox 1")).toBeTruthy();
|
|
131
|
+
expect(getByText("Yes")).toBeTruthy();
|
|
132
|
+
expect(getByText("No")).toBeTruthy();
|
|
133
|
+
expect(getByTestId("consent-history-signature-entry-1")).toBeTruthy();
|
|
134
|
+
expect(getByText("Form Content")).toBeTruthy();
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
it("renders raw date values that cannot be parsed and skips empty ones", () => {
|
|
138
|
+
const {getByTestId, getByText, queryByText} = renderWithTheme(
|
|
139
|
+
<ConsentHistory
|
|
140
|
+
api={createApi({data: [makeEntry({agreedAt: "not-a-date", signedAt: undefined})]})}
|
|
141
|
+
/>
|
|
142
|
+
);
|
|
143
|
+
expect(getByText("not-a-date")).toBeTruthy();
|
|
144
|
+
fireEvent.press(getByTestId("consent-history-item-toggle-entry-1"));
|
|
145
|
+
expect(queryByText("Signed:")).toBeNull();
|
|
146
|
+
});
|
|
147
|
+
|
|
148
|
+
it("renders nothing for a blank date", () => {
|
|
149
|
+
const {getByTestId} = renderWithTheme(
|
|
150
|
+
<ConsentHistory api={createApi({data: [makeEntry({agreedAt: ""})]})} />
|
|
151
|
+
);
|
|
152
|
+
expect(getByTestId("consent-history-item-entry-1")).toBeTruthy();
|
|
153
|
+
});
|
|
154
|
+
|
|
155
|
+
it("unwraps a paginated response body", () => {
|
|
156
|
+
const {getByTestId} = renderWithTheme(
|
|
157
|
+
<ConsentHistory api={createApi({data: {data: [makeEntry()]}})} />
|
|
158
|
+
);
|
|
159
|
+
expect(getByTestId("consent-history-item-entry-1")).toBeTruthy();
|
|
160
|
+
});
|
|
161
|
+
});
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Badge,
|
|
3
|
+
Box,
|
|
4
|
+
Button,
|
|
5
|
+
Card,
|
|
6
|
+
Icon,
|
|
7
|
+
IconButton,
|
|
8
|
+
MarkdownView,
|
|
9
|
+
Page,
|
|
10
|
+
Spinner,
|
|
11
|
+
Text,
|
|
12
|
+
} from "@terreno/ui";
|
|
13
|
+
import {DateTime} from "luxon";
|
|
14
|
+
import React, {useCallback, useState} from "react";
|
|
15
|
+
import {Image, Pressable} from "react-native";
|
|
16
|
+
|
|
17
|
+
import {generateConsentHistoryPdf} from "./generateConsentHistoryPdf";
|
|
18
|
+
import type {ConsentHistoryEntry} from "./useConsentHistory";
|
|
19
|
+
import {useConsentHistory} from "./useConsentHistory";
|
|
20
|
+
|
|
21
|
+
interface ConsentHistoryProps {
|
|
22
|
+
api: Parameters<typeof useConsentHistory>[0];
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
title?: string;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const formatDate = (value: unknown): string => {
|
|
28
|
+
if (!value) {
|
|
29
|
+
return "";
|
|
30
|
+
}
|
|
31
|
+
const dt = DateTime.fromISO(String(value));
|
|
32
|
+
if (!dt.isValid) {
|
|
33
|
+
return String(value);
|
|
34
|
+
}
|
|
35
|
+
return dt.toLocaleString(DateTime.DATETIME_MED);
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const ConsentHistoryItem: React.FC<{entry: ConsentHistoryEntry}> = ({entry}) => {
|
|
39
|
+
const [expanded, setExpanded] = useState(false);
|
|
40
|
+
const [isDownloading, setIsDownloading] = useState(false);
|
|
41
|
+
|
|
42
|
+
const toggle = useCallback(() => {
|
|
43
|
+
setExpanded((prev) => !prev);
|
|
44
|
+
}, []);
|
|
45
|
+
|
|
46
|
+
const handleDownload = useCallback(async () => {
|
|
47
|
+
setIsDownloading(true);
|
|
48
|
+
try {
|
|
49
|
+
await generateConsentHistoryPdf(entry);
|
|
50
|
+
} catch (err) {
|
|
51
|
+
console.error("Failed to generate PDF", err);
|
|
52
|
+
} finally {
|
|
53
|
+
setIsDownloading(false);
|
|
54
|
+
}
|
|
55
|
+
}, [entry]);
|
|
56
|
+
|
|
57
|
+
const formTitle = entry.form?.title ?? "Unknown Form";
|
|
58
|
+
const formType = entry.form?.type ?? "";
|
|
59
|
+
|
|
60
|
+
const checkboxEntries =
|
|
61
|
+
entry.checkboxValues && typeof entry.checkboxValues === "object"
|
|
62
|
+
? Object.entries(entry.checkboxValues)
|
|
63
|
+
: [];
|
|
64
|
+
|
|
65
|
+
return (
|
|
66
|
+
<Card padding={0} testID={`consent-history-item-${entry._id}`}>
|
|
67
|
+
<Pressable onPress={toggle} testID={`consent-history-item-toggle-${entry._id}`}>
|
|
68
|
+
<Box direction="row" gap={3} padding={4}>
|
|
69
|
+
<Box flex="grow" gap={1}>
|
|
70
|
+
<Box alignItems="center" direction="row" gap={2}>
|
|
71
|
+
<Text bold size="md">
|
|
72
|
+
{formTitle}
|
|
73
|
+
</Text>
|
|
74
|
+
{formType ? <Badge status="neutral" value={formType} /> : null}
|
|
75
|
+
</Box>
|
|
76
|
+
<Box alignItems="center" direction="row" gap={2}>
|
|
77
|
+
<Badge
|
|
78
|
+
status={entry.agreed ? "success" : "error"}
|
|
79
|
+
value={entry.agreed ? "Agreed" : "Declined"}
|
|
80
|
+
/>
|
|
81
|
+
<Text color="secondaryDark" size="sm">
|
|
82
|
+
{formatDate(entry.agreedAt)}
|
|
83
|
+
</Text>
|
|
84
|
+
</Box>
|
|
85
|
+
</Box>
|
|
86
|
+
<Box alignItems="center" justifyContent="center">
|
|
87
|
+
<Icon
|
|
88
|
+
color="secondaryDark"
|
|
89
|
+
iconName={expanded ? "chevron-up" : "chevron-down"}
|
|
90
|
+
size="sm"
|
|
91
|
+
/>
|
|
92
|
+
</Box>
|
|
93
|
+
</Box>
|
|
94
|
+
</Pressable>
|
|
95
|
+
|
|
96
|
+
{expanded && (
|
|
97
|
+
<Box gap={3} padding={4} testID={`consent-history-item-details-${entry._id}`}>
|
|
98
|
+
<Box alignItems="center" direction="row" justifyContent="between">
|
|
99
|
+
<Box color="disabled" flex="grow" height={1} />
|
|
100
|
+
<Box marginLeft={2}>
|
|
101
|
+
<IconButton
|
|
102
|
+
accessibilityLabel="Download PDF"
|
|
103
|
+
iconName="download"
|
|
104
|
+
loading={isDownloading}
|
|
105
|
+
onClick={handleDownload}
|
|
106
|
+
testID={`consent-history-download-${entry._id}`}
|
|
107
|
+
tooltipText="Download PDF"
|
|
108
|
+
/>
|
|
109
|
+
</Box>
|
|
110
|
+
</Box>
|
|
111
|
+
|
|
112
|
+
{entry.form?.version !== undefined && (
|
|
113
|
+
<Box alignItems="center" direction="row" gap={2}>
|
|
114
|
+
<Text color="secondaryDark" size="sm">
|
|
115
|
+
Version:
|
|
116
|
+
</Text>
|
|
117
|
+
<Text size="sm">{entry.form.version}</Text>
|
|
118
|
+
</Box>
|
|
119
|
+
)}
|
|
120
|
+
|
|
121
|
+
{entry.locale && (
|
|
122
|
+
<Box alignItems="center" direction="row" gap={2}>
|
|
123
|
+
<Text color="secondaryDark" size="sm">
|
|
124
|
+
Locale:
|
|
125
|
+
</Text>
|
|
126
|
+
<Text size="sm">{entry.locale}</Text>
|
|
127
|
+
</Box>
|
|
128
|
+
)}
|
|
129
|
+
|
|
130
|
+
{entry.signedAt && (
|
|
131
|
+
<Box alignItems="center" direction="row" gap={2}>
|
|
132
|
+
<Text color="secondaryDark" size="sm">
|
|
133
|
+
Signed:
|
|
134
|
+
</Text>
|
|
135
|
+
<Text size="sm">{formatDate(entry.signedAt)}</Text>
|
|
136
|
+
</Box>
|
|
137
|
+
)}
|
|
138
|
+
|
|
139
|
+
{entry.ipAddress && (
|
|
140
|
+
<Box alignItems="center" direction="row" gap={2}>
|
|
141
|
+
<Text color="secondaryDark" size="sm">
|
|
142
|
+
IP Address:
|
|
143
|
+
</Text>
|
|
144
|
+
<Text size="sm">{entry.ipAddress}</Text>
|
|
145
|
+
</Box>
|
|
146
|
+
)}
|
|
147
|
+
|
|
148
|
+
{checkboxEntries.length > 0 && (
|
|
149
|
+
<Box gap={2}>
|
|
150
|
+
<Text bold color="secondaryDark" size="sm">
|
|
151
|
+
Checkboxes
|
|
152
|
+
</Text>
|
|
153
|
+
{checkboxEntries.map(([index, checked]) => {
|
|
154
|
+
const label = entry.form?.checkboxes?.[Number(index)]?.label;
|
|
155
|
+
return (
|
|
156
|
+
<Box alignItems="center" direction="row" gap={2} key={index}>
|
|
157
|
+
<Badge
|
|
158
|
+
status={checked ? "success" : "neutral"}
|
|
159
|
+
value={checked ? "Yes" : "No"}
|
|
160
|
+
/>
|
|
161
|
+
<Text size="sm">{label ?? `Checkbox ${index}`}</Text>
|
|
162
|
+
</Box>
|
|
163
|
+
);
|
|
164
|
+
})}
|
|
165
|
+
</Box>
|
|
166
|
+
)}
|
|
167
|
+
|
|
168
|
+
{entry.signature && (
|
|
169
|
+
<Box gap={2}>
|
|
170
|
+
<Text bold color="secondaryDark" size="sm">
|
|
171
|
+
Signature
|
|
172
|
+
</Text>
|
|
173
|
+
<Box border="default" padding={2} rounding="sm">
|
|
174
|
+
<Image
|
|
175
|
+
accessibilityLabel="Your signature"
|
|
176
|
+
accessible
|
|
177
|
+
resizeMode="contain"
|
|
178
|
+
source={{uri: entry.signature}}
|
|
179
|
+
style={{height: 80, width: "100%"}}
|
|
180
|
+
testID={`consent-history-signature-${entry._id}`}
|
|
181
|
+
/>
|
|
182
|
+
</Box>
|
|
183
|
+
</Box>
|
|
184
|
+
)}
|
|
185
|
+
|
|
186
|
+
{entry.contentSnapshot && (
|
|
187
|
+
<Box gap={2}>
|
|
188
|
+
<Text bold color="secondaryDark" size="sm">
|
|
189
|
+
Form Content
|
|
190
|
+
</Text>
|
|
191
|
+
<Box border="default" padding={3} rounding="sm">
|
|
192
|
+
<MarkdownView>{entry.contentSnapshot}</MarkdownView>
|
|
193
|
+
</Box>
|
|
194
|
+
</Box>
|
|
195
|
+
)}
|
|
196
|
+
</Box>
|
|
197
|
+
)}
|
|
198
|
+
</Card>
|
|
199
|
+
);
|
|
200
|
+
};
|
|
201
|
+
|
|
202
|
+
export const ConsentHistory: React.FC<ConsentHistoryProps> = ({
|
|
203
|
+
api,
|
|
204
|
+
baseUrl,
|
|
205
|
+
title = "My Consents",
|
|
206
|
+
}) => {
|
|
207
|
+
const {entries, isLoading, error, refetch} = useConsentHistory(api, baseUrl);
|
|
208
|
+
|
|
209
|
+
if (isLoading) {
|
|
210
|
+
return (
|
|
211
|
+
<Page maxWidth={800} title={title}>
|
|
212
|
+
<Box alignItems="center" justifyContent="center" padding={6}>
|
|
213
|
+
<Spinner />
|
|
214
|
+
</Box>
|
|
215
|
+
</Page>
|
|
216
|
+
);
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
if (error) {
|
|
220
|
+
return (
|
|
221
|
+
<Page maxWidth={800} title={title}>
|
|
222
|
+
<Box alignItems="center" direction="column" gap={3} padding={6}>
|
|
223
|
+
<Text color="error" size="lg">
|
|
224
|
+
Failed to load consent history
|
|
225
|
+
</Text>
|
|
226
|
+
<Button onClick={refetch} text="Retry" />
|
|
227
|
+
</Box>
|
|
228
|
+
</Page>
|
|
229
|
+
);
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
if (entries.length === 0) {
|
|
233
|
+
return (
|
|
234
|
+
<Page maxWidth={800} title={title}>
|
|
235
|
+
<Box alignItems="center" padding={6}>
|
|
236
|
+
<Text color="secondaryDark">No consent records found.</Text>
|
|
237
|
+
</Box>
|
|
238
|
+
</Page>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
return (
|
|
243
|
+
<Page maxWidth={800} scroll title={title}>
|
|
244
|
+
<Box gap={3} padding={4} testID="consent-history-list">
|
|
245
|
+
{entries.map((entry) => (
|
|
246
|
+
<ConsentHistoryItem entry={entry} key={entry._id} />
|
|
247
|
+
))}
|
|
248
|
+
</Box>
|
|
249
|
+
</Page>
|
|
250
|
+
);
|
|
251
|
+
};
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
7
7
|
import type {AdminApi} from "./types";
|
|
8
8
|
|
|
9
9
|
interface ReadState {
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {afterEach, beforeEach, describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import {Platform} from "react-native";
|
|
7
8
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
8
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
9
9
|
import type {AdminApi} from "./types";
|
|
10
10
|
|
|
11
11
|
mock.module("react-native-webview", () => ({
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
// biome-ignore-all lint/suspicious/noExplicitAny: test mock typing
|
|
3
3
|
import {describe, expect, it, mock} from "bun:test";
|
|
4
4
|
import {renderWithTheme} from "@terreno/ui/src/test-utils";
|
|
5
|
+
import {act, fireEvent} from "@testing-library/react-native";
|
|
5
6
|
import React from "react";
|
|
6
7
|
import type {ReactTestInstance} from "react-test-renderer";
|
|
7
|
-
import {act, fireEvent} from "../../ui/node_modules/@testing-library/react-native";
|
|
8
8
|
import {LocaleContentEditor} from "./LocaleContentEditor";
|
|
9
9
|
|
|
10
10
|
const press = async (el: ReactTestInstance): Promise<void> => {
|