@terreno/ui 57.21.0 → 58.0.0-beta.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/.ai/guidelines/core.md +1 -1
- package/CHANGELOG.md +89 -0
- package/dist/ActionSheet.d.ts +9 -9
- package/dist/ActionSheet.d.ts.map +1 -1
- package/dist/ActionSheet.js +11 -4
- package/dist/ActionSheet.js.map +1 -1
- package/dist/AnnouncementNavigator.d.ts +7 -1
- package/dist/AnnouncementNavigator.d.ts.map +1 -1
- package/dist/AnnouncementNavigator.js +15 -16
- package/dist/AnnouncementNavigator.js.map +1 -1
- package/dist/Avatar.d.ts.map +1 -1
- package/dist/Avatar.js +1 -1
- package/dist/Avatar.js.map +1 -1
- package/dist/Box.d.ts.map +1 -1
- package/dist/Box.js +3 -1
- package/dist/Box.js.map +1 -1
- package/dist/Common.d.ts +16 -12
- package/dist/Common.d.ts.map +1 -1
- package/dist/Common.js.map +1 -1
- package/dist/ConsentFormScreen.d.ts.map +1 -1
- package/dist/ConsentFormScreen.js.map +1 -1
- package/dist/ConsentNavigator.d.ts +5 -3
- package/dist/ConsentNavigator.d.ts.map +1 -1
- package/dist/ConsentNavigator.js +4 -4
- package/dist/ConsentNavigator.js.map +1 -1
- package/dist/CustomSelectField.js.map +1 -1
- package/dist/DataTable.d.ts.map +1 -1
- package/dist/DataTable.js +37 -12
- package/dist/DataTable.js.map +1 -1
- package/dist/DateTimeField.js.map +1 -1
- package/dist/DropdownPanel.d.ts +0 -5
- package/dist/DropdownPanel.d.ts.map +1 -1
- package/dist/DropdownPanel.js +0 -5
- package/dist/DropdownPanel.js.map +1 -1
- package/dist/FilterAccordion.d.ts.map +1 -1
- package/dist/FilterAccordion.js.map +1 -1
- package/dist/FilterBoolean.d.ts.map +1 -1
- package/dist/FilterBoolean.js.map +1 -1
- package/dist/FilterSelectMenu.js +1 -1
- package/dist/FilterSelectMenu.js.map +1 -1
- package/dist/GPTChat.d.ts.map +1 -1
- package/dist/GPTChat.js.map +1 -1
- package/dist/Heading.d.ts.map +1 -1
- package/dist/Heading.js +6 -12
- package/dist/Heading.js.map +1 -1
- package/dist/HeightField.d.ts.map +1 -1
- package/dist/HeightField.js +1 -1
- package/dist/HeightField.js.map +1 -1
- package/dist/Hyperlink.d.ts.map +1 -1
- package/dist/Hyperlink.js +6 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Image.d.ts +1 -1
- package/dist/MarkdownEditorField.d.ts.map +1 -1
- package/dist/MarkdownEditorField.js +1 -1
- package/dist/MarkdownEditorField.js.map +1 -1
- package/dist/OfflineBanner.d.ts +3 -2
- package/dist/OfflineBanner.d.ts.map +1 -1
- package/dist/OfflineBanner.js +3 -2
- package/dist/OfflineBanner.js.map +1 -1
- package/dist/OtpField.d.ts.map +1 -1
- package/dist/OtpField.js +6 -3
- package/dist/OtpField.js.map +1 -1
- package/dist/PickerSelect.d.ts +4 -4
- package/dist/PickerSelect.d.ts.map +1 -1
- package/dist/PickerSelect.js.map +1 -1
- package/dist/ProvisionalConsentSigner.d.ts +3 -2
- package/dist/ProvisionalConsentSigner.d.ts.map +1 -1
- package/dist/ProvisionalConsentSigner.js +2 -2
- package/dist/ProvisionalConsentSigner.js.map +1 -1
- package/dist/SidebarNavigation.js +2 -2
- package/dist/SidebarNavigation.js.map +1 -1
- package/dist/SidebarNavigation.native.js +2 -2
- package/dist/SidebarNavigation.native.js.map +1 -1
- package/dist/Skeleton.js.map +1 -1
- package/dist/Text.d.ts.map +1 -1
- package/dist/Text.js +27 -50
- package/dist/Text.js.map +1 -1
- package/dist/TextField.d.ts.map +1 -1
- package/dist/TextField.js.map +1 -1
- package/dist/ThumbsUpDownFeedback.d.ts.map +1 -1
- package/dist/ThumbsUpDownFeedback.js.map +1 -1
- package/dist/ToastNotifications.d.ts.map +1 -1
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/Tooltip.d.ts.map +1 -1
- package/dist/Tooltip.js.map +1 -1
- package/dist/Unifier.d.ts +1 -1
- package/dist/WebAddressAutocomplete.js.map +1 -1
- package/dist/WebDropdownMenu.d.ts +3 -3
- package/dist/WebDropdownMenu.d.ts.map +1 -1
- package/dist/WebDropdownMenu.js +1 -1
- package/dist/WebDropdownMenu.js.map +1 -1
- package/dist/announcementPlatform.d.ts +5 -0
- package/dist/announcementPlatform.d.ts.map +1 -1
- package/dist/announcementPlatform.js +9 -0
- package/dist/announcementPlatform.js.map +1 -1
- package/dist/asks/AskCard.d.ts +2 -2
- package/dist/asks/AskCard.d.ts.map +1 -1
- package/dist/dataTableColumnWidths.d.ts +76 -0
- package/dist/dataTableColumnWidths.d.ts.map +1 -0
- package/dist/dataTableColumnWidths.js +181 -0
- package/dist/dataTableColumnWidths.js.map +1 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/login/LoginScreen.js.map +1 -1
- package/dist/requestClient.d.ts +71 -0
- package/dist/requestClient.d.ts.map +1 -0
- package/dist/requestClient.js +139 -0
- package/dist/requestClient.js.map +1 -0
- package/dist/security/PasswordCard.d.ts.map +1 -1
- package/dist/security/PasswordCard.js.map +1 -1
- package/dist/security/TwoFactorSettingsCard.d.ts.map +1 -1
- package/dist/security/TwoFactorSettingsCard.js +1 -1
- package/dist/security/TwoFactorSettingsCard.js.map +1 -1
- package/dist/signUp/SignUpScreen.js.map +1 -1
- package/dist/table/Table.d.ts.map +1 -1
- package/dist/table/Table.js.map +1 -1
- package/dist/table/TableTitle.d.ts.map +1 -1
- package/dist/table/TableTitle.js +2 -1
- package/dist/table/TableTitle.js.map +1 -1
- package/dist/textFontSizes.d.ts +12 -0
- package/dist/textFontSizes.d.ts.map +1 -0
- package/dist/textFontSizes.js +21 -0
- package/dist/textFontSizes.js.map +1 -0
- package/dist/useAcknowledgeAnnouncement.d.ts +8 -63
- package/dist/useAcknowledgeAnnouncement.d.ts.map +1 -1
- package/dist/useAcknowledgeAnnouncement.js +31 -80
- package/dist/useAcknowledgeAnnouncement.js.map +1 -1
- package/dist/useAnnouncements.d.ts +14 -47
- package/dist/useAnnouncements.d.ts.map +1 -1
- package/dist/useAnnouncements.js +30 -57
- package/dist/useAnnouncements.js.map +1 -1
- package/dist/useConsentForms.d.ts +6 -38
- package/dist/useConsentForms.d.ts.map +1 -1
- package/dist/useConsentForms.js +25 -48
- package/dist/useConsentForms.js.map +1 -1
- package/dist/useProvisionalConsent.d.ts +7 -58
- package/dist/useProvisionalConsent.d.ts.map +1 -1
- package/dist/useProvisionalConsent.js +57 -67
- package/dist/useProvisionalConsent.js.map +1 -1
- package/dist/useSubmitConsent.d.ts +9 -39
- package/dist/useSubmitConsent.d.ts.map +1 -1
- package/dist/useSubmitConsent.js +10 -39
- package/dist/useSubmitConsent.js.map +1 -1
- package/package.json +38 -38
- package/src/ActionSheet.test.tsx +4 -4
- package/src/ActionSheet.tsx +18 -5
- package/src/AnnouncementNavigator.test.tsx +215 -315
- package/src/AnnouncementNavigator.tsx +25 -20
- package/src/Avatar.tsx +2 -9
- package/src/Box.test.tsx +3 -3
- package/src/Box.tsx +4 -2
- package/src/Common.ts +19 -15
- package/src/ConsentFormScreen.tsx +2 -1
- package/src/ConsentNavigator.test.tsx +166 -242
- package/src/ConsentNavigator.tsx +9 -13
- package/src/CustomSelectField.tsx +3 -3
- package/src/DataTable.test.tsx +69 -1
- package/src/DataTable.tsx +72 -19
- package/src/DateTimeField.tsx +4 -4
- package/src/DropdownPanel.tsx +0 -6
- package/src/FilterAccordion.tsx +3 -3
- package/src/FilterBoolean.tsx +3 -3
- package/src/FilterSelectMenu.tsx +1 -1
- package/src/GPTChat.tsx +10 -9
- package/src/Heading.tsx +7 -14
- package/src/HeightField.tsx +9 -2
- package/src/Hyperlink.tsx +6 -3
- package/src/Link.test.tsx +2 -2
- package/src/MarkdownEditorField.tsx +10 -2
- package/src/MarkdownView.test.tsx +10 -6
- package/src/Modal.test.tsx +3 -1
- package/src/ModalSheet.test.tsx +6 -6
- package/src/OfflineBanner.tsx +3 -2
- package/src/OtpField.test.tsx +44 -0
- package/src/OtpField.tsx +8 -4
- package/src/PickerSelect.tsx +3 -2
- package/src/ProvisionalConsentSigner.test.tsx +140 -113
- package/src/ProvisionalConsentSigner.tsx +5 -4
- package/src/SidebarNavigation.native.tsx +2 -2
- package/src/SidebarNavigation.tsx +2 -2
- package/src/Skeleton.tsx +1 -1
- package/src/TapToEdit.test.tsx +2 -2
- package/src/Text.test.tsx +1 -1
- package/src/Text.tsx +25 -51
- package/src/TextField.tsx +2 -1
- package/src/ThumbsUpDownFeedback.tsx +3 -3
- package/src/ToastNotifications.tsx +3 -2
- package/src/ToastNotifications.webModal.test.tsx +4 -1
- package/src/Tooltip.tsx +2 -1
- package/src/UserInactivity.test.tsx +2 -3
- package/src/WebAddressAutocomplete.tsx +3 -3
- package/src/WebDropdownMenu.tsx +16 -5
- package/src/__snapshots__/DataTable.test.tsx.snap +13 -0
- package/src/announcementPlatform.ts +10 -0
- package/src/asks/AskCard.test.tsx +14 -12
- package/src/asks/AskCard.tsx +2 -2
- package/src/bunSetup.ts +42 -0
- package/src/dataTableColumnWidths.test.ts +266 -0
- package/src/dataTableColumnWidths.ts +272 -0
- package/src/index.tsx +9 -2
- package/src/login/LoginScreen.tsx +2 -2
- package/src/requestClient.test.ts +288 -0
- package/src/requestClient.ts +228 -0
- package/src/security/PasswordCard.tsx +7 -5
- package/src/security/TwoFactorSettingsCard.tsx +10 -3
- package/src/signUp/SignUpScreen.tsx +2 -2
- package/src/table/Table.tsx +1 -2
- package/src/table/TableTitle.tsx +2 -1
- package/src/test-utils.tsx +76 -0
- package/src/textFontSizes.ts +31 -0
- package/src/useAcknowledgeAnnouncement.test.ts +101 -193
- package/src/useAcknowledgeAnnouncement.ts +69 -147
- package/src/useAnnouncements.test.ts +122 -186
- package/src/useAnnouncements.ts +49 -105
- package/src/useConsentForms.test.ts +59 -112
- package/src/useConsentForms.ts +37 -87
- package/src/useProvisionalConsent.test.ts +74 -150
- package/src/useProvisionalConsent.ts +79 -125
- package/src/useSubmitConsent.test.ts +59 -85
- package/src/useSubmitConsent.ts +22 -77
package/src/OfflineBanner.tsx
CHANGED
|
@@ -19,8 +19,9 @@ export interface OfflineBannerProps {
|
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
21
21
|
* ```typescript
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* // useSyncStatus from @terreno/syncdb/react
|
|
23
|
+
* const {isOnline, isSyncing, queuedCount} = useSyncStatus();
|
|
24
|
+
* <OfflineBanner isOnline={isOnline} queueLength={queuedCount} isSyncing={isSyncing} />
|
|
24
25
|
* ```
|
|
25
26
|
*/
|
|
26
27
|
export const OfflineBanner: React.FC<OfflineBannerProps> = ({
|
package/src/OtpField.test.tsx
CHANGED
|
@@ -30,6 +30,28 @@ const renderWithFocusSpy = (ui: ReactElement): ReturnType<typeof render> & {focu
|
|
|
30
30
|
return Object.assign(result, {focused});
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
const renderWithSynchronousFocus = (
|
|
34
|
+
ui: ReactElement
|
|
35
|
+
): ReturnType<typeof render> & {getFocusedCell: () => number} => {
|
|
36
|
+
let focusedCell = 1;
|
|
37
|
+
const result = render(ui, {
|
|
38
|
+
createNodeMock: (element: ReactElement) => {
|
|
39
|
+
const props = element.props as {onFocus?: () => void; testID?: string};
|
|
40
|
+
const match = /-cell-(\d+)$/.exec(props.testID ?? "");
|
|
41
|
+
return {
|
|
42
|
+
focus: (): void => {
|
|
43
|
+
if (match) {
|
|
44
|
+
focusedCell = Number(match[1]);
|
|
45
|
+
props.onFocus?.();
|
|
46
|
+
}
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
},
|
|
50
|
+
wrapper: ThemeProvider,
|
|
51
|
+
});
|
|
52
|
+
return Object.assign(result, {getFocusedCell: (): number => focusedCell});
|
|
53
|
+
};
|
|
54
|
+
|
|
33
55
|
const cellValues = (getByTestId: (id: string) => {props: {value?: string}}, length = 6): string[] =>
|
|
34
56
|
Array.from({length}, (_, index) => getByTestId(`otp-cell-${index + 1}`).props.value ?? "");
|
|
35
57
|
|
|
@@ -249,6 +271,28 @@ describe("OtpField", () => {
|
|
|
249
271
|
expect(focused).toEqual([2, 3]);
|
|
250
272
|
});
|
|
251
273
|
|
|
274
|
+
it.each(["uncontrolled", "controlled"])(
|
|
275
|
+
"typing a full code digit by digit works when focus fires synchronously (%s)",
|
|
276
|
+
(mode): void => {
|
|
277
|
+
const onComplete = mock((_code: string) => {});
|
|
278
|
+
const ui =
|
|
279
|
+
mode === "controlled" ? (
|
|
280
|
+
<ControlledOtp onComplete={onComplete} />
|
|
281
|
+
) : (
|
|
282
|
+
<OtpField onComplete={onComplete} testID="otp" />
|
|
283
|
+
);
|
|
284
|
+
const {getByTestId, getFocusedCell} = renderWithSynchronousFocus(ui);
|
|
285
|
+
|
|
286
|
+
"123456".split("").forEach((digit): void => {
|
|
287
|
+
fireEvent.changeText(getByTestId(`otp-cell-${getFocusedCell()}`), digit);
|
|
288
|
+
});
|
|
289
|
+
|
|
290
|
+
expect(cellValues(getByTestId)).toEqual(["1", "2", "3", "4", "5", "6"]);
|
|
291
|
+
expect(onComplete).toHaveBeenCalledTimes(1);
|
|
292
|
+
expect(onComplete).toHaveBeenCalledWith("123456");
|
|
293
|
+
}
|
|
294
|
+
);
|
|
295
|
+
|
|
252
296
|
it("pasting a full code moves focus to the last cell", () => {
|
|
253
297
|
const {getByTestId, focused} = renderWithFocusSpy(<ControlledOtp />);
|
|
254
298
|
fireEvent.changeText(getByTestId("otp-cell-1"), "123456");
|
package/src/OtpField.tsx
CHANGED
|
@@ -4,6 +4,7 @@ import {
|
|
|
4
4
|
Platform,
|
|
5
5
|
type StyleProp,
|
|
6
6
|
TextInput,
|
|
7
|
+
type TextInputInstance,
|
|
7
8
|
type TextInputKeyPressEvent,
|
|
8
9
|
type TextInputProps,
|
|
9
10
|
View,
|
|
@@ -156,9 +157,11 @@ export const OtpField: FC<OtpFieldProps> = ({
|
|
|
156
157
|
// Roving tab stop: only the cell that takes the next digit is in the tab order, so Tab and
|
|
157
158
|
// Shift+Tab leave the field instead of landing on a cell that hands focus back.
|
|
158
159
|
const activeIndex = Math.min(code.length, length - 1);
|
|
160
|
+
const activeIndexRef = useRef(activeIndex);
|
|
161
|
+
activeIndexRef.current = activeIndex;
|
|
159
162
|
|
|
160
163
|
const [focusedIndex, setFocusedIndex] = useState<number | null>(null);
|
|
161
|
-
const inputRefs = useRef<(
|
|
164
|
+
const inputRefs = useRef<(TextInputInstance | null)[]>([]);
|
|
162
165
|
|
|
163
166
|
const focusCell = useCallback((index: number): void => {
|
|
164
167
|
inputRefs.current[index]?.focus();
|
|
@@ -174,6 +177,7 @@ export const OtpField: FC<OtpFieldProps> = ({
|
|
|
174
177
|
|
|
175
178
|
const commit = useCallback(
|
|
176
179
|
(next: string): void => {
|
|
180
|
+
activeIndexRef.current = Math.min(next.length, length - 1);
|
|
177
181
|
if (next === code) {
|
|
178
182
|
return;
|
|
179
183
|
}
|
|
@@ -215,13 +219,13 @@ export const OtpField: FC<OtpFieldProps> = ({
|
|
|
215
219
|
(index: number): void => {
|
|
216
220
|
// Digits fill left to right: a tap past the active cell lands on that cell instead. Keyboard
|
|
217
221
|
// focus never needs this, because only the active cell is a tab stop.
|
|
218
|
-
if (index >
|
|
219
|
-
focusCell(
|
|
222
|
+
if (index > activeIndexRef.current) {
|
|
223
|
+
focusCell(activeIndexRef.current);
|
|
220
224
|
return;
|
|
221
225
|
}
|
|
222
226
|
setFocusedIndex(index);
|
|
223
227
|
},
|
|
224
|
-
[
|
|
228
|
+
[focusCell]
|
|
225
229
|
);
|
|
226
230
|
|
|
227
231
|
const handleBlur = useCallback((index: number): void => {
|
package/src/PickerSelect.tsx
CHANGED
|
@@ -45,6 +45,7 @@ import {
|
|
|
45
45
|
StyleSheet,
|
|
46
46
|
Text,
|
|
47
47
|
TextInput,
|
|
48
|
+
type TextInputInstance,
|
|
48
49
|
type TextInputProps,
|
|
49
50
|
TouchableOpacity,
|
|
50
51
|
View,
|
|
@@ -137,7 +138,7 @@ export interface RNPickerSelectProps {
|
|
|
137
138
|
/**
|
|
138
139
|
* Web only. When true, the dropdown menu renders in a fixed portal on
|
|
139
140
|
* `document.body` instead of a React Native `Modal`, so it floats above
|
|
140
|
-
* ancestor portals / high-zIndex overlays (e.g.
|
|
141
|
+
* ancestor portals / high-zIndex overlays (e.g. a `DropdownPanel`).
|
|
141
142
|
* @default false
|
|
142
143
|
*/
|
|
143
144
|
renderMenuInBodyPortal?: boolean;
|
|
@@ -171,7 +172,7 @@ export const RNPickerSelect = ({
|
|
|
171
172
|
const searchable = !disableSearch;
|
|
172
173
|
const [showPicker, setShowPicker] = useState<boolean>(false);
|
|
173
174
|
const [webSearchQuery, setWebSearchQuery] = useState("");
|
|
174
|
-
const webSearchInputRef = useRef<
|
|
175
|
+
const webSearchInputRef = useRef<TextInputInstance>(null);
|
|
175
176
|
const [animationType, setAnimationType] = useState<ModalProps["animationType"]>(undefined);
|
|
176
177
|
const [orientation, setOrientation] = useState<"portrait" | "landscape">("portrait");
|
|
177
178
|
const [doneDepressed, setDoneDepressed] = useState<boolean>(false);
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import {afterEach, describe, expect, it, mock, spyOn} from "bun:test";
|
|
2
2
|
import {act, fireEvent, waitFor} from "@testing-library/react-native";
|
|
3
3
|
import {DateTime} from "luxon";
|
|
4
|
+
import type React from "react";
|
|
4
5
|
import {ProvisionalConsentSigner} from "./ProvisionalConsentSigner";
|
|
5
6
|
import * as pdfHtmlTemplate from "./pdfHtmlTemplate";
|
|
6
|
-
import {
|
|
7
|
+
import type {TerrenoRequestClient} from "./requestClient";
|
|
8
|
+
import {createFakeRequestClient, renderWithTheme} from "./test-utils";
|
|
7
9
|
import type {ConsentFormPublic} from "./useConsentForms";
|
|
8
|
-
import type {
|
|
10
|
+
import type {ProvisionalConsentStatusRow} from "./useProvisionalConsent";
|
|
9
11
|
|
|
10
12
|
interface QueryState {
|
|
11
13
|
data?: unknown;
|
|
@@ -65,13 +67,17 @@ const rows: ProvisionalConsentStatusRow[] = [
|
|
|
65
67
|
},
|
|
66
68
|
];
|
|
67
69
|
|
|
68
|
-
/**
|
|
70
|
+
/**
|
|
71
|
+
* A fake request client: the status route answers `initial` (hangs while `isLoading`, rejects
|
|
72
|
+
* with `error`), signing runs `signResult`, voiding runs `voidResult`. `refetch` is called for
|
|
73
|
+
* every status request after the first.
|
|
74
|
+
*/
|
|
69
75
|
const buildApi = (
|
|
70
76
|
initial: QueryState,
|
|
71
77
|
signResult: () => Promise<unknown> = () => Promise.resolve({}),
|
|
72
78
|
voidResult: () => Promise<unknown> = () => Promise.resolve({})
|
|
73
79
|
): {
|
|
74
|
-
|
|
80
|
+
client: TerrenoRequestClient;
|
|
75
81
|
refetch: ReturnType<typeof mock>;
|
|
76
82
|
signedBodies: unknown[];
|
|
77
83
|
userIds: string[];
|
|
@@ -81,53 +87,58 @@ const buildApi = (
|
|
|
81
87
|
const userIds: string[] = [];
|
|
82
88
|
const signedBodies: unknown[] = [];
|
|
83
89
|
const voidedArgs: unknown[] = [];
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
90
|
+
const fake = createFakeRequestClient({
|
|
91
|
+
"GET /consent-responses/status": async (args) => {
|
|
92
|
+
if (userIds.length > 0) {
|
|
93
|
+
refetch();
|
|
94
|
+
}
|
|
95
|
+
userIds.push(String(args.params?.userId));
|
|
96
|
+
if (initial.isLoading) {
|
|
97
|
+
return new Promise(() => {});
|
|
98
|
+
}
|
|
99
|
+
if (initial.error) {
|
|
100
|
+
throw initial.error;
|
|
101
|
+
}
|
|
102
|
+
return initial.data;
|
|
103
|
+
},
|
|
104
|
+
"POST /consent-responses/:id/void": async (args, params) => {
|
|
105
|
+
voidedArgs.push({reason: (args.body as {reason: string}).reason, responseId: params.id});
|
|
106
|
+
return voidResult();
|
|
107
|
+
},
|
|
108
|
+
"POST /consent-responses/provisional": async (args) => {
|
|
109
|
+
signedBodies.push(args.body);
|
|
110
|
+
return signResult();
|
|
111
|
+
},
|
|
112
|
+
});
|
|
113
|
+
return {client: fake.client, refetch, signedBodies, userIds, voidedArgs};
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
/** Renders the component and waits for the status request to settle. */
|
|
117
|
+
const renderLoaded = async (
|
|
118
|
+
element: React.ReactElement
|
|
119
|
+
): Promise<ReturnType<typeof renderWithTheme>> => {
|
|
120
|
+
const result = renderWithTheme(element);
|
|
121
|
+
await act(async () => {
|
|
122
|
+
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
123
|
+
});
|
|
124
|
+
return result;
|
|
114
125
|
};
|
|
115
126
|
|
|
116
127
|
describe("ProvisionalConsentSigner", () => {
|
|
117
|
-
it("shows a spinner while statuses load", () => {
|
|
118
|
-
const {
|
|
119
|
-
const {getByTestId, queryByTestId} =
|
|
120
|
-
<ProvisionalConsentSigner
|
|
128
|
+
it("shows a spinner while statuses load", async () => {
|
|
129
|
+
const {client} = buildApi({isLoading: true});
|
|
130
|
+
const {getByTestId, queryByTestId} = await renderLoaded(
|
|
131
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
121
132
|
);
|
|
122
133
|
expect(getByTestId("provisional-consent-signer")).toBeTruthy();
|
|
123
134
|
expect(getByTestId("provisional-consent-loading")).toBeTruthy();
|
|
124
135
|
expect(queryByTestId("provisional-consent-row-form-pending")).toBeNull();
|
|
125
136
|
});
|
|
126
137
|
|
|
127
|
-
it("lists each form with its status for the target user", () => {
|
|
128
|
-
const {
|
|
129
|
-
const {getByTestId, getByText} =
|
|
130
|
-
<ProvisionalConsentSigner
|
|
138
|
+
it("lists each form with its status for the target user", async () => {
|
|
139
|
+
const {client, userIds} = buildApi({data: {data: rows}});
|
|
140
|
+
const {getByTestId, getByText} = await renderLoaded(
|
|
141
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
131
142
|
);
|
|
132
143
|
|
|
133
144
|
expect(userIds).toContain("member-1");
|
|
@@ -142,7 +153,7 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
142
153
|
expect(getByTestId("provisional-consent-status-form-provisional")).toBeTruthy();
|
|
143
154
|
});
|
|
144
155
|
|
|
145
|
-
it("falls back to the signer's email, then to staff", () => {
|
|
156
|
+
it("falls back to the signer's email, then to staff", async () => {
|
|
146
157
|
const byEmail: ProvisionalConsentStatusRow = {
|
|
147
158
|
...rows[1],
|
|
148
159
|
provisional: {responseId: "r", signedAt, signedBy: {email: "dana@example.com", id: "s"}},
|
|
@@ -152,28 +163,32 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
152
163
|
form: makeForm("form-other", "Other"),
|
|
153
164
|
provisional: {responseId: "r2", signedAt, signedBy: null},
|
|
154
165
|
};
|
|
155
|
-
const {
|
|
156
|
-
const {getByText} =
|
|
166
|
+
const {client} = buildApi({data: [byEmail, deletedSigner]});
|
|
167
|
+
const {getByText} = await renderLoaded(
|
|
168
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
169
|
+
);
|
|
157
170
|
expect(
|
|
158
171
|
getByText(`Signed provisionally by dana@example.com on ${formatted(signedAt)}`)
|
|
159
172
|
).toBeTruthy();
|
|
160
173
|
expect(getByText(`Signed provisionally by Staff on ${formatted(signedAt)}`)).toBeTruthy();
|
|
161
174
|
});
|
|
162
175
|
|
|
163
|
-
it("uses the form _id when the row has no id", () => {
|
|
176
|
+
it("uses the form _id when the row has no id", async () => {
|
|
164
177
|
const {id: _omitted, ...formWithoutId} = makeForm("ignored", "Mongo id form");
|
|
165
178
|
const row = {
|
|
166
179
|
form: {...formWithoutId, _id: "mongo-id"},
|
|
167
180
|
isConsented: false,
|
|
168
181
|
status: "pending",
|
|
169
182
|
} as unknown as ProvisionalConsentStatusRow;
|
|
170
|
-
const {
|
|
171
|
-
const {getByTestId} =
|
|
183
|
+
const {client} = buildApi({data: [row]});
|
|
184
|
+
const {getByTestId} = await renderLoaded(
|
|
185
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
186
|
+
);
|
|
172
187
|
expect(getByTestId("provisional-consent-row-mongo-id")).toBeTruthy();
|
|
173
188
|
});
|
|
174
189
|
|
|
175
|
-
it("leaves the date off when it is missing or invalid", () => {
|
|
176
|
-
const {
|
|
190
|
+
it("leaves the date off when it is missing or invalid", async () => {
|
|
191
|
+
const {client} = buildApi({
|
|
177
192
|
data: [
|
|
178
193
|
{form: makeForm("no-date", "No date"), isConsented: true, status: "signed"},
|
|
179
194
|
{
|
|
@@ -184,21 +199,25 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
184
199
|
},
|
|
185
200
|
],
|
|
186
201
|
});
|
|
187
|
-
const {getByText} =
|
|
202
|
+
const {getByText} = await renderLoaded(
|
|
203
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
204
|
+
);
|
|
188
205
|
expect(getByText("Signed by user")).toBeTruthy();
|
|
189
206
|
expect(getByText("Declined by user")).toBeTruthy();
|
|
190
207
|
});
|
|
191
208
|
|
|
192
|
-
it("says so when no forms apply", () => {
|
|
193
|
-
const {
|
|
194
|
-
const {getByTestId} =
|
|
209
|
+
it("says so when no forms apply", async () => {
|
|
210
|
+
const {client} = buildApi({data: {data: []}});
|
|
211
|
+
const {getByTestId} = await renderLoaded(
|
|
212
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
213
|
+
);
|
|
195
214
|
expect(getByTestId("provisional-consent-empty")).toBeTruthy();
|
|
196
215
|
});
|
|
197
216
|
|
|
198
217
|
it("shows the server error with a Retry button that refetches", async () => {
|
|
199
|
-
const {
|
|
200
|
-
const {getByTestId, getByText} =
|
|
201
|
-
<ProvisionalConsentSigner
|
|
218
|
+
const {client, refetch} = buildApi({error: {data: {title: "Access denied"}, status: 405}});
|
|
219
|
+
const {getByTestId, getByText} = await renderLoaded(
|
|
220
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
202
221
|
);
|
|
203
222
|
expect(getByTestId("provisional-consent-error")).toBeTruthy();
|
|
204
223
|
expect(getByText("Access denied")).toBeTruthy();
|
|
@@ -211,9 +230,11 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
211
230
|
});
|
|
212
231
|
});
|
|
213
232
|
|
|
214
|
-
it("shows a generic message when the error has no title", () => {
|
|
215
|
-
const {
|
|
216
|
-
const {getByText} =
|
|
233
|
+
it("shows a generic message when the error has no title", async () => {
|
|
234
|
+
const {client} = buildApi({error: {status: "FETCH_ERROR"}});
|
|
235
|
+
const {getByText} = await renderLoaded(
|
|
236
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
237
|
+
);
|
|
217
238
|
expect(getByText("Could not load consent forms.")).toBeTruthy();
|
|
218
239
|
});
|
|
219
240
|
describe("signing on the user's behalf", () => {
|
|
@@ -237,10 +258,10 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
237
258
|
form: {...row.form, content: {en: content}},
|
|
238
259
|
});
|
|
239
260
|
|
|
240
|
-
it("offers signing only for pending forms", () => {
|
|
241
|
-
const {
|
|
242
|
-
const {getByTestId, queryByTestId} =
|
|
243
|
-
<ProvisionalConsentSigner
|
|
261
|
+
it("offers signing only for pending forms", async () => {
|
|
262
|
+
const {client} = buildApi({data: rows});
|
|
263
|
+
const {getByTestId, queryByTestId} = await renderLoaded(
|
|
264
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
244
265
|
);
|
|
245
266
|
expect(getByTestId("provisional-consent-open-form-pending")).toBeTruthy();
|
|
246
267
|
expect(queryByTestId("provisional-consent-open-form-declined")).toBeNull();
|
|
@@ -249,9 +270,15 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
249
270
|
});
|
|
250
271
|
|
|
251
272
|
it("shows the form content with variables and keeps submit disabled until a note is entered", async () => {
|
|
252
|
-
const {
|
|
253
|
-
|
|
254
|
-
|
|
273
|
+
const {client} = buildApi({
|
|
274
|
+
data: [withContent(rows[0], "Hello {{memberName}}, please agree.")],
|
|
275
|
+
});
|
|
276
|
+
const {getByTestId, getByText} = await renderLoaded(
|
|
277
|
+
<ProvisionalConsentSigner
|
|
278
|
+
client={client}
|
|
279
|
+
userId="member-1"
|
|
280
|
+
variables={{memberName: "Sam"}}
|
|
281
|
+
/>
|
|
255
282
|
);
|
|
256
283
|
|
|
257
284
|
await openForm(getByTestId, "form-pending");
|
|
@@ -284,11 +311,11 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
284
311
|
userId: "member-1",
|
|
285
312
|
};
|
|
286
313
|
const onSigned = mock(() => {});
|
|
287
|
-
const {
|
|
314
|
+
const {client, signedBodies} = buildApi({data: [rows[0]]}, () =>
|
|
288
315
|
Promise.resolve({data: response})
|
|
289
316
|
);
|
|
290
|
-
const {getByTestId, getByText, queryByTestId} =
|
|
291
|
-
<ProvisionalConsentSigner
|
|
317
|
+
const {getByTestId, getByText, queryByTestId} = await renderLoaded(
|
|
318
|
+
<ProvisionalConsentSigner client={client} onSigned={onSigned} userId="member-1" />
|
|
292
319
|
);
|
|
293
320
|
|
|
294
321
|
await openForm(getByTestId, "form-pending");
|
|
@@ -323,9 +350,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
323
350
|
it("shows a server error inline and calls onError", async () => {
|
|
324
351
|
const serverError = {data: {title: "Consent form is not active"}, status: 400};
|
|
325
352
|
const onError = mock(() => {});
|
|
326
|
-
const {
|
|
327
|
-
const {getByTestId, getByText, queryByTestId} =
|
|
328
|
-
<ProvisionalConsentSigner
|
|
353
|
+
const {client} = buildApi({data: [rows[0]]}, () => Promise.reject(serverError));
|
|
354
|
+
const {getByTestId, getByText, queryByTestId} = await renderLoaded(
|
|
355
|
+
<ProvisionalConsentSigner client={client} onError={onError} userId="member-1" />
|
|
329
356
|
);
|
|
330
357
|
|
|
331
358
|
await openForm(getByTestId, "form-pending");
|
|
@@ -346,9 +373,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
346
373
|
});
|
|
347
374
|
|
|
348
375
|
it("shows a generic error when the server gives no title", async () => {
|
|
349
|
-
const {
|
|
350
|
-
const {getByTestId, getByText} =
|
|
351
|
-
<ProvisionalConsentSigner
|
|
376
|
+
const {client} = buildApi({data: [rows[0]]}, () => Promise.reject({status: "FETCH_ERROR"}));
|
|
377
|
+
const {getByTestId, getByText} = await renderLoaded(
|
|
378
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
352
379
|
);
|
|
353
380
|
await openForm(getByTestId, "form-pending");
|
|
354
381
|
act(() => {
|
|
@@ -363,9 +390,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
363
390
|
});
|
|
364
391
|
|
|
365
392
|
it("returns to the list on cancel without signing", async () => {
|
|
366
|
-
const {
|
|
367
|
-
const {getByTestId, queryByTestId} =
|
|
368
|
-
<ProvisionalConsentSigner
|
|
393
|
+
const {client, signedBodies} = buildApi({data: [rows[0]]});
|
|
394
|
+
const {getByTestId, queryByTestId} = await renderLoaded(
|
|
395
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
369
396
|
);
|
|
370
397
|
await openForm(getByTestId, "form-pending");
|
|
371
398
|
act(() => {
|
|
@@ -379,11 +406,11 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
379
406
|
});
|
|
380
407
|
|
|
381
408
|
it("names the signer as staff when the response is not populated", async () => {
|
|
382
|
-
const {
|
|
409
|
+
const {client} = buildApi({data: [rows[0]]}, () =>
|
|
383
410
|
Promise.resolve({_id: "r", agreedAt: signedAt, provisionalSignedBy: "staff-1"})
|
|
384
411
|
);
|
|
385
|
-
const {getByTestId, getByText} =
|
|
386
|
-
<ProvisionalConsentSigner
|
|
412
|
+
const {getByTestId, getByText} = await renderLoaded(
|
|
413
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
387
414
|
);
|
|
388
415
|
await openForm(getByTestId, "form-pending");
|
|
389
416
|
act(() => {
|
|
@@ -425,10 +452,10 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
425
452
|
});
|
|
426
453
|
};
|
|
427
454
|
|
|
428
|
-
it("offers print on provisional, signed, and declined rows, and void on provisional only", () => {
|
|
429
|
-
const {
|
|
430
|
-
const {getByTestId, queryByTestId} =
|
|
431
|
-
<ProvisionalConsentSigner
|
|
455
|
+
it("offers print on provisional, signed, and declined rows, and void on provisional only", async () => {
|
|
456
|
+
const {client} = buildApi({data: rows});
|
|
457
|
+
const {getByTestId, queryByTestId} = await renderLoaded(
|
|
458
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
432
459
|
);
|
|
433
460
|
expect(queryByTestId("provisional-consent-print-form-pending")).toBeNull();
|
|
434
461
|
expect(getByTestId("provisional-consent-print-form-provisional")).toBeTruthy();
|
|
@@ -441,9 +468,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
441
468
|
|
|
442
469
|
it("prints a provisional row with the form content and the provisional block with the note", async () => {
|
|
443
470
|
spyOnPrint();
|
|
444
|
-
const {
|
|
445
|
-
const {getByTestId} =
|
|
446
|
-
<ProvisionalConsentSigner
|
|
471
|
+
const {client} = buildApi({data: rows});
|
|
472
|
+
const {getByTestId} = await renderLoaded(
|
|
473
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
447
474
|
);
|
|
448
475
|
|
|
449
476
|
await press(getByTestId, "provisional-consent-print-form-provisional");
|
|
@@ -457,9 +484,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
457
484
|
|
|
458
485
|
it("prints a signed row without a provisional block", async () => {
|
|
459
486
|
spyOnPrint();
|
|
460
|
-
const {
|
|
461
|
-
const {getByTestId} =
|
|
462
|
-
<ProvisionalConsentSigner
|
|
487
|
+
const {client} = buildApi({data: rows});
|
|
488
|
+
const {getByTestId} = await renderLoaded(
|
|
489
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
463
490
|
);
|
|
464
491
|
|
|
465
492
|
await press(getByTestId, "provisional-consent-print-form-signed");
|
|
@@ -472,9 +499,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
472
499
|
|
|
473
500
|
it("keeps working when printing fails", async () => {
|
|
474
501
|
spyOnPrint(() => Promise.reject(new Error("printer offline")));
|
|
475
|
-
const {
|
|
476
|
-
const {getByTestId} =
|
|
477
|
-
<ProvisionalConsentSigner
|
|
502
|
+
const {client} = buildApi({data: rows});
|
|
503
|
+
const {getByTestId} = await renderLoaded(
|
|
504
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
478
505
|
);
|
|
479
506
|
await press(getByTestId, "provisional-consent-print-form-declined");
|
|
480
507
|
expect(printed).toHaveLength(1);
|
|
@@ -489,9 +516,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
489
516
|
provisionalNote: "Guardian agreed by phone",
|
|
490
517
|
provisionalSignedBy: {_id: "staff-1", name: "Dana Rivera"},
|
|
491
518
|
};
|
|
492
|
-
const {
|
|
493
|
-
const {getByTestId} =
|
|
494
|
-
<ProvisionalConsentSigner
|
|
519
|
+
const {client} = buildApi({data: [rows[0]]}, () => Promise.resolve({data: response}));
|
|
520
|
+
const {getByTestId} = await renderLoaded(
|
|
521
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
495
522
|
);
|
|
496
523
|
await press(getByTestId, "provisional-consent-open-form-pending");
|
|
497
524
|
act(() => {
|
|
@@ -515,9 +542,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
515
542
|
});
|
|
516
543
|
|
|
517
544
|
it("voids with a required reason and refetches", async () => {
|
|
518
|
-
const {
|
|
519
|
-
const {getByTestId} =
|
|
520
|
-
<ProvisionalConsentSigner
|
|
545
|
+
const {client, refetch, voidedArgs} = buildApi({data: rows});
|
|
546
|
+
const {getByTestId} = await renderLoaded(
|
|
547
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
521
548
|
);
|
|
522
549
|
|
|
523
550
|
await press(getByTestId, "provisional-consent-void-form-provisional");
|
|
@@ -546,9 +573,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
546
573
|
});
|
|
547
574
|
|
|
548
575
|
it("closes the void dialog on cancel without voiding", async () => {
|
|
549
|
-
const {
|
|
550
|
-
const {getByTestId, UNSAFE_getByProps} =
|
|
551
|
-
<ProvisionalConsentSigner
|
|
576
|
+
const {client, refetch, voidedArgs} = buildApi({data: rows});
|
|
577
|
+
const {getByTestId, UNSAFE_getByProps} = await renderLoaded(
|
|
578
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
552
579
|
);
|
|
553
580
|
|
|
554
581
|
await press(getByTestId, "provisional-consent-void-form-provisional");
|
|
@@ -565,9 +592,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
565
592
|
});
|
|
566
593
|
|
|
567
594
|
it("does not void without a reason even if the confirm handler runs", async () => {
|
|
568
|
-
const {
|
|
569
|
-
const {getByTestId, UNSAFE_getByProps} =
|
|
570
|
-
<ProvisionalConsentSigner
|
|
595
|
+
const {client, voidedArgs} = buildApi({data: rows});
|
|
596
|
+
const {getByTestId, UNSAFE_getByProps} = await renderLoaded(
|
|
597
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
571
598
|
);
|
|
572
599
|
|
|
573
600
|
await press(getByTestId, "provisional-consent-void-form-provisional");
|
|
@@ -581,9 +608,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
581
608
|
});
|
|
582
609
|
|
|
583
610
|
it("does not sign without a note even if the submit handler runs", async () => {
|
|
584
|
-
const {
|
|
585
|
-
const {getByTestId, UNSAFE_getByProps} =
|
|
586
|
-
<ProvisionalConsentSigner
|
|
611
|
+
const {client, signedBodies} = buildApi({data: [rows[0]]});
|
|
612
|
+
const {getByTestId, UNSAFE_getByProps} = await renderLoaded(
|
|
613
|
+
<ProvisionalConsentSigner client={client} userId="member-1" />
|
|
587
614
|
);
|
|
588
615
|
|
|
589
616
|
await press(getByTestId, "provisional-consent-open-form-pending");
|
|
@@ -601,9 +628,9 @@ describe("ProvisionalConsentSigner", () => {
|
|
|
601
628
|
it("shows a void error in the dialog and calls onError", async () => {
|
|
602
629
|
const failure = {data: {title: "Provisional signature is already voided"}, status: 400};
|
|
603
630
|
const onError = mock(() => {});
|
|
604
|
-
const {
|
|
605
|
-
const {getByTestId, getByText} =
|
|
606
|
-
<ProvisionalConsentSigner
|
|
631
|
+
const {client, refetch} = buildApi({data: rows}, undefined, () => Promise.reject(failure));
|
|
632
|
+
const {getByTestId, getByText} = await renderLoaded(
|
|
633
|
+
<ProvisionalConsentSigner client={client} onError={onError} userId="member-1" />
|
|
607
634
|
);
|
|
608
635
|
|
|
609
636
|
await press(getByTestId, "provisional-consent-void-form-provisional");
|
|
@@ -11,6 +11,7 @@ import {Heading} from "./Heading";
|
|
|
11
11
|
import {MarkdownView} from "./MarkdownView";
|
|
12
12
|
import {Modal} from "./Modal";
|
|
13
13
|
import {buildConsentPdfHtml, printConsentHtml} from "./pdfHtmlTemplate";
|
|
14
|
+
import type {TerrenoRequestClient} from "./requestClient";
|
|
14
15
|
import {Spinner} from "./Spinner";
|
|
15
16
|
import {Text} from "./Text";
|
|
16
17
|
import {TextField} from "./TextField";
|
|
@@ -23,9 +24,9 @@ import {
|
|
|
23
24
|
} from "./useProvisionalConsent";
|
|
24
25
|
|
|
25
26
|
export interface ProvisionalConsentSignerProps {
|
|
26
|
-
/** The consumer's RTK Query api, as passed to `ConsentNavigator`. */
|
|
27
|
-
api: unknown;
|
|
28
27
|
baseUrl?: string;
|
|
28
|
+
/** The app's request client, as passed to `ConsentNavigator`. */
|
|
29
|
+
client: TerrenoRequestClient;
|
|
29
30
|
/** The user whose consent forms are listed and signed on their behalf. */
|
|
30
31
|
userId: string;
|
|
31
32
|
/** Called with the stored response after a provisional signature succeeds. */
|
|
@@ -141,8 +142,8 @@ const rowFormId = (row: ProvisionalConsentStatusRow): string => row.form.id ?? r
|
|
|
141
142
|
* behalf. Requires `consentResponse:signOnBehalf` (or `user.admin` without RBAC) on the server.
|
|
142
143
|
*/
|
|
143
144
|
export const ProvisionalConsentSigner: React.FC<ProvisionalConsentSignerProps> = ({
|
|
144
|
-
api,
|
|
145
145
|
baseUrl,
|
|
146
|
+
client,
|
|
146
147
|
userId,
|
|
147
148
|
onSigned,
|
|
148
149
|
onError,
|
|
@@ -150,8 +151,8 @@ export const ProvisionalConsentSigner: React.FC<ProvisionalConsentSignerProps> =
|
|
|
150
151
|
}) => {
|
|
151
152
|
const {error, isLoading, isSigning, isVoiding, refetch, sign, statuses, voidSignature} =
|
|
152
153
|
useProvisionalConsent({
|
|
153
|
-
api,
|
|
154
154
|
baseUrl,
|
|
155
|
+
client,
|
|
155
156
|
userId,
|
|
156
157
|
});
|
|
157
158
|
const [openFormId, setOpenFormId] = useState<string | null>(null);
|
|
@@ -469,7 +469,7 @@ const SidebarNavigationBase: FC<SidebarNavigationProps> = ({
|
|
|
469
469
|
topItems,
|
|
470
470
|
bottomItems,
|
|
471
471
|
onNavigate,
|
|
472
|
-
initialRouteName,
|
|
472
|
+
initialRouteName: _initialRouteName,
|
|
473
473
|
screenOptions,
|
|
474
474
|
panelStyle,
|
|
475
475
|
itemStyle,
|
|
@@ -478,7 +478,7 @@ const SidebarNavigationBase: FC<SidebarNavigationProps> = ({
|
|
|
478
478
|
const [isSheetOpen, setIsSheetOpen] = useState(false);
|
|
479
479
|
|
|
480
480
|
return (
|
|
481
|
-
<Navigator
|
|
481
|
+
<Navigator router={TabRouter} screenOptions={screenOptions}>
|
|
482
482
|
<View style={{flex: 1}}>
|
|
483
483
|
<SidebarHeader onOpen={() => setIsSheetOpen(true)} />
|
|
484
484
|
<SidebarNavigatorContent
|