@terreno/ui 0.31.0 → 56.0.0-beta.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/LICENSE +203 -21
- package/dist/ActionSheet.d.ts +1 -1
- package/dist/Avatar.js +1 -4
- package/dist/Avatar.js.map +1 -1
- package/dist/Box.js +45 -9
- package/dist/Box.js.map +1 -1
- package/dist/Common.d.ts +21 -39
- package/dist/Common.js.map +1 -1
- package/dist/ConflictSheet.d.ts +53 -0
- package/dist/ConflictSheet.js +132 -0
- package/dist/ConflictSheet.js.map +1 -0
- package/dist/DateTimeActionSheet.d.ts +2 -1
- package/dist/DecimalRangeActionSheet.d.ts +1 -1
- package/dist/EmojiSelector.d.ts +1 -1
- package/dist/ErrorPage.d.ts +1 -1
- package/dist/HeightActionSheet.d.ts +1 -1
- package/dist/Hyperlink.d.ts +2 -1
- package/dist/Hyperlink.js +2 -1
- package/dist/Hyperlink.js.map +1 -1
- package/dist/Image.d.ts +1 -1
- package/dist/ImageBackground.d.ts +1 -1
- package/dist/MobileAddressAutoComplete.d.ts +1 -1
- package/dist/NumberPickerActionSheet.d.ts +1 -1
- package/dist/Page.d.ts +3 -3
- package/dist/PickerSelect.d.ts +1 -1
- package/dist/SidebarNavigation.js +1 -1
- package/dist/SidebarNavigation.js.map +1 -1
- package/dist/SidebarNavigation.native.js +1 -1
- package/dist/SidebarNavigation.native.js.map +1 -1
- package/dist/SplitPage.d.ts +1 -1
- package/dist/SplitPage.js +1 -4
- package/dist/SplitPage.js.map +1 -1
- package/dist/SplitPage.native.d.ts +1 -1
- package/dist/SyncStatusBanner.d.ts +46 -0
- package/dist/SyncStatusBanner.js +29 -0
- package/dist/SyncStatusBanner.js.map +1 -0
- package/dist/Theme.d.ts +1 -1
- package/dist/Theme.js +0 -1
- package/dist/Theme.js.map +1 -1
- package/dist/Toast.d.ts +9 -1
- package/dist/Toast.js +20 -7
- package/dist/Toast.js.map +1 -1
- package/dist/ToastNotifications.js +23 -1
- package/dist/ToastNotifications.js.map +1 -1
- package/dist/UnifiedAddressAutoComplete.d.ts +1 -1
- package/dist/Unifier.js +1 -1
- package/dist/Unifier.js.map +1 -1
- package/dist/conflictFieldDiff.d.ts +14 -0
- package/dist/conflictFieldDiff.js +62 -0
- package/dist/conflictFieldDiff.js.map +1 -0
- package/dist/icons/OfflineIcon.d.ts +1 -1
- package/dist/icons/OnlineIcon.d.ts +1 -1
- package/dist/icons/OutOfficeIcon.d.ts +1 -1
- package/dist/index.d.ts +5 -3
- package/dist/index.js +5 -3
- package/dist/index.js.map +1 -1
- package/dist/pdfHtmlTemplate.d.ts +30 -0
- package/dist/pdfHtmlTemplate.js +170 -0
- package/dist/pdfHtmlTemplate.js.map +1 -0
- package/dist/table/TableTitle.js +1 -3
- package/dist/table/TableTitle.js.map +1 -1
- package/dist/useAppLaunchOrForeground.d.ts +9 -0
- package/dist/useAppLaunchOrForeground.js +27 -0
- package/dist/useAppLaunchOrForeground.js.map +1 -0
- package/package.json +45 -39
- package/src/ActionSheet.test.tsx +37 -80
- package/src/Box.test.tsx +39 -9
- package/src/Box.tsx +46 -7
- package/src/Common.ts +21 -50
- package/src/ConflictSheet.test.tsx +461 -0
- package/src/ConflictSheet.tsx +399 -0
- package/src/ConsentNavigator.test.tsx +8 -6
- package/src/DateTimeField.test.tsx +0 -36
- package/src/Hyperlink.tsx +1 -1
- package/src/PickerSelect.test.tsx +12 -23
- package/src/SidebarNavigation.native.tsx +1 -1
- package/src/SidebarNavigation.tsx +1 -1
- package/src/SyncStatusBanner.test.tsx +204 -0
- package/src/SyncStatusBanner.tsx +148 -0
- package/src/TerrenoProvider.test.tsx +3 -4
- package/src/Theme.tsx +0 -1
- package/src/Toast.test.tsx +60 -0
- package/src/Toast.tsx +46 -1
- package/src/ToastNotifications.test.tsx +82 -0
- package/src/ToastNotifications.tsx +25 -1
- package/src/Unifier.ts +1 -1
- package/src/__snapshots__/AiSuggestionBox.test.tsx.snap +0 -3
- package/src/__snapshots__/Body.test.tsx.snap +0 -16
- package/src/__snapshots__/Box.test.tsx.snap +4 -13
- package/src/__snapshots__/Card.test.tsx.snap +0 -1
- package/src/__snapshots__/Page.test.tsx.snap +0 -84
- package/src/__snapshots__/SplitPage.test.tsx.snap +24 -120
- package/src/__snapshots__/TapToEdit.test.tsx.snap +5 -16
- package/src/__snapshots__/Toast.test.tsx.snap +4 -2
- package/src/bunSetup.ts +21 -6
- package/src/conflictFieldDiff.test.ts +26 -0
- package/src/conflictFieldDiff.ts +78 -0
- package/src/index.tsx +5 -3
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +0 -9
- package/src/pdfHtmlTemplate.ts +219 -0
- package/src/signUp/__snapshots__/OAuthButtons.test.tsx.snap +0 -1
- package/src/signUp/__snapshots__/PasswordRequirements.test.tsx.snap +2 -16
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +1 -17
- package/src/signUp/__snapshots__/Swiper.test.tsx.snap +0 -1
- package/src/table/__snapshots__/Table.test.tsx.snap +22 -87
- package/src/table/__snapshots__/TableHeader.test.tsx.snap +10 -50
- package/src/table/__snapshots__/TableHeaderCell.test.tsx.snap +10 -84
- package/src/table/__snapshots__/TableRow.test.tsx.snap +12 -77
- package/src/useAppLaunchOrForeground.test.tsx +54 -0
- package/src/useAppLaunchOrForeground.ts +30 -0
- package/dist/ConsentHistory.d.ts +0 -9
- package/dist/ConsentHistory.js +0 -70
- package/dist/ConsentHistory.js.map +0 -1
- package/dist/EditableCard.d.ts +0 -3
- package/dist/EditableCard.js +0 -23
- package/dist/EditableCard.js.map +0 -1
- package/dist/generateConsentHistoryPdf.d.ts +0 -2
- package/dist/generateConsentHistoryPdf.js +0 -185
- package/dist/generateConsentHistoryPdf.js.map +0 -1
- package/dist/useConsentHistory.d.ts +0 -63
- package/dist/useConsentHistory.js +0 -40
- package/dist/useConsentHistory.js.map +0 -1
- package/src/ConsentHistory.test.tsx +0 -224
- package/src/ConsentHistory.tsx +0 -249
- package/src/DraggableList.test.tsx +0 -377
- package/src/EditableCard.test.tsx +0 -69
- package/src/EditableCard.tsx +0 -73
- package/src/SidebarNavigation.test.tsx +0 -339
- package/src/__snapshots__/EditableCard.test.tsx.snap +0 -242
- package/src/generateConsentHistoryPdf.test.ts +0 -253
- package/src/generateConsentHistoryPdf.ts +0 -211
- package/src/useConsentHistory.test.ts +0 -106
- package/src/useConsentHistory.ts +0 -94
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
/** Internal/sync metadata — omitted from user-facing conflict diffs. */
|
|
2
|
+
export const CONFLICT_METADATA_FIELDS = new Set([
|
|
3
|
+
"__v",
|
|
4
|
+
"_id",
|
|
5
|
+
"_syncSeq",
|
|
6
|
+
"created",
|
|
7
|
+
"createdAt",
|
|
8
|
+
"deletedAt",
|
|
9
|
+
"pendingMutationId",
|
|
10
|
+
"updated",
|
|
11
|
+
"updatedAt",
|
|
12
|
+
]);
|
|
13
|
+
|
|
14
|
+
export const NO_CONFLICT_DIFF_FIELDS = "No differing fields found";
|
|
15
|
+
|
|
16
|
+
export const parseConflictPayload = (json: string): Record<string, unknown> => {
|
|
17
|
+
try {
|
|
18
|
+
const parsed: unknown = JSON.parse(json);
|
|
19
|
+
if (parsed && typeof parsed === "object") {
|
|
20
|
+
return parsed as Record<string, unknown>;
|
|
21
|
+
}
|
|
22
|
+
} catch {
|
|
23
|
+
// Fall through to the empty shape.
|
|
24
|
+
}
|
|
25
|
+
return {};
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const getChangedConflictFields = ({
|
|
29
|
+
local,
|
|
30
|
+
server,
|
|
31
|
+
}: {
|
|
32
|
+
local: Record<string, unknown>;
|
|
33
|
+
server: Record<string, unknown>;
|
|
34
|
+
}): string[] => {
|
|
35
|
+
const fields = new Set([...Object.keys(local), ...Object.keys(server)]);
|
|
36
|
+
return [...fields]
|
|
37
|
+
.filter((field) => !CONFLICT_METADATA_FIELDS.has(field))
|
|
38
|
+
.filter((field) => JSON.stringify(local[field]) !== JSON.stringify(server[field]))
|
|
39
|
+
.sort();
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const formatConflictFieldLabel = (field: string): string => {
|
|
43
|
+
const spaced = field.replace(/([a-z0-9])([A-Z])/g, "$1 $2").replaceAll("_", " ");
|
|
44
|
+
return `${spaced.charAt(0).toUpperCase()}${spaced.slice(1)}`;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const formatConflictFieldValue = (value: unknown): string => {
|
|
48
|
+
if (value === undefined) {
|
|
49
|
+
return "Not set";
|
|
50
|
+
}
|
|
51
|
+
if (value === null) {
|
|
52
|
+
return "None";
|
|
53
|
+
}
|
|
54
|
+
if (typeof value === "string") {
|
|
55
|
+
return value;
|
|
56
|
+
}
|
|
57
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
58
|
+
return String(value);
|
|
59
|
+
}
|
|
60
|
+
const json = JSON.stringify(value);
|
|
61
|
+
return json.length > 120 ? `${json.slice(0, 120)}…` : json;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const summarizeConflictSide = ({
|
|
65
|
+
data,
|
|
66
|
+
changedFields,
|
|
67
|
+
}: {
|
|
68
|
+
data: Record<string, unknown>;
|
|
69
|
+
changedFields: string[];
|
|
70
|
+
}): string => {
|
|
71
|
+
if (typeof data.title === "string" && data.title.length > 0) {
|
|
72
|
+
return data.title;
|
|
73
|
+
}
|
|
74
|
+
if (changedFields.length === 0) {
|
|
75
|
+
return NO_CONFLICT_DIFF_FIELDS;
|
|
76
|
+
}
|
|
77
|
+
return `${changedFields.length} changed field${changedFields.length === 1 ? "" : "s"}`;
|
|
78
|
+
};
|
package/src/index.tsx
CHANGED
|
@@ -16,11 +16,12 @@ export * from "./Button";
|
|
|
16
16
|
export * from "./Card";
|
|
17
17
|
export * from "./CheckBox";
|
|
18
18
|
export * from "./Common";
|
|
19
|
+
export * from "./ConflictSheet";
|
|
19
20
|
export * from "./ConsentFormScreen";
|
|
20
|
-
export * from "./ConsentHistory";
|
|
21
21
|
export * from "./ConsentNavigator";
|
|
22
22
|
export * from "./Constants";
|
|
23
23
|
export * from "./CustomSelectField";
|
|
24
|
+
export * from "./conflictFieldDiff";
|
|
24
25
|
export * from "./DataTable";
|
|
25
26
|
export * from "./DateTimeActionSheet";
|
|
26
27
|
export * from "./DateTimeField";
|
|
@@ -28,7 +29,6 @@ export * from "./DateUtilities";
|
|
|
28
29
|
export * from "./DecimalRangeActionSheet";
|
|
29
30
|
export * from "./DismissButton";
|
|
30
31
|
export {DraggableList} from "./DraggableList";
|
|
31
|
-
export * from "./EditableCard";
|
|
32
32
|
export * from "./EmailField";
|
|
33
33
|
export {default as EmojiSelector} from "./EmojiSelector";
|
|
34
34
|
export * from "./ErrorBoundary";
|
|
@@ -67,6 +67,7 @@ export * from "./Page";
|
|
|
67
67
|
export * from "./Pagination";
|
|
68
68
|
export * from "./PasswordField";
|
|
69
69
|
export * from "./PhoneNumberField";
|
|
70
|
+
export * from "./pdfHtmlTemplate";
|
|
70
71
|
export * from "./Radio";
|
|
71
72
|
export * from "./RadioField";
|
|
72
73
|
export * from "./ScrollView";
|
|
@@ -83,6 +84,7 @@ export * from "./Slider";
|
|
|
83
84
|
export * from "./SocialLoginButton";
|
|
84
85
|
export * from "./Spinner";
|
|
85
86
|
export * from "./SplitPage";
|
|
87
|
+
export * from "./SyncStatusBanner";
|
|
86
88
|
export {OAuthButtons} from "./signUp/OAuthButtons";
|
|
87
89
|
export {PasswordRequirements} from "./signUp/PasswordRequirements";
|
|
88
90
|
export {
|
|
@@ -127,8 +129,8 @@ export * from "./Unifier";
|
|
|
127
129
|
export * from "./UpgradeRequiredScreen";
|
|
128
130
|
export * from "./UserInactivity";
|
|
129
131
|
export * from "./Utilities";
|
|
132
|
+
export * from "./useAppLaunchOrForeground";
|
|
130
133
|
export * from "./useConsentForms";
|
|
131
|
-
export * from "./useConsentHistory";
|
|
132
134
|
export * from "./useStoredState";
|
|
133
135
|
export * from "./useSubmitConsent";
|
|
134
136
|
export * from "./WebAddressAutocomplete";
|
|
@@ -584,7 +584,6 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
584
584
|
"justifyContent": "center",
|
|
585
585
|
"maxWidth": 400,
|
|
586
586
|
"padding": 16,
|
|
587
|
-
"testID": "login-screen",
|
|
588
587
|
"width": "100%",
|
|
589
588
|
},
|
|
590
589
|
"testID": "login-screen",
|
|
@@ -597,7 +596,6 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
597
596
|
"onPointerLeave": [Function: AsyncFunction],
|
|
598
597
|
"style": {
|
|
599
598
|
"alignSelf": "center",
|
|
600
|
-
"avoidKeyboard": true,
|
|
601
599
|
"backgroundColor": "#FFFFFF",
|
|
602
600
|
"display": "flex",
|
|
603
601
|
"flex": undefined,
|
|
@@ -605,11 +603,8 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
605
603
|
"flexGrow": 1,
|
|
606
604
|
"flexShrink": 1,
|
|
607
605
|
"height": "100%",
|
|
608
|
-
"keyboardOffset": undefined,
|
|
609
606
|
"maxWidth": 800,
|
|
610
607
|
"padding": 8,
|
|
611
|
-
"scroll": true,
|
|
612
|
-
"testID": undefined,
|
|
613
608
|
"width": "100%",
|
|
614
609
|
},
|
|
615
610
|
"testID": undefined,
|
|
@@ -633,7 +628,6 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
633
628
|
"scrollEventThrottle": 50,
|
|
634
629
|
"style": {
|
|
635
630
|
"alignSelf": "center",
|
|
636
|
-
"avoidKeyboard": true,
|
|
637
631
|
"backgroundColor": "#FFFFFF",
|
|
638
632
|
"display": "flex",
|
|
639
633
|
"flex": undefined,
|
|
@@ -641,11 +635,8 @@ exports[`LoginScreen renders correctly with all props 1`] = `
|
|
|
641
635
|
"flexGrow": 1,
|
|
642
636
|
"flexShrink": 1,
|
|
643
637
|
"height": "100%",
|
|
644
|
-
"keyboardOffset": undefined,
|
|
645
638
|
"maxWidth": 800,
|
|
646
639
|
"padding": 8,
|
|
647
|
-
"scroll": true,
|
|
648
|
-
"testID": undefined,
|
|
649
640
|
"width": "100%",
|
|
650
641
|
},
|
|
651
642
|
},
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
import {DateTime} from "luxon";
|
|
2
|
+
import {Platform} from "react-native";
|
|
3
|
+
|
|
4
|
+
interface PdfField {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
interface PdfCheckbox {
|
|
10
|
+
label: string;
|
|
11
|
+
checked: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
interface PdfUserInfo {
|
|
15
|
+
userId: string;
|
|
16
|
+
name?: string;
|
|
17
|
+
email?: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface PdfTemplateData {
|
|
21
|
+
title: string;
|
|
22
|
+
formTitle: string;
|
|
23
|
+
fields: PdfField[];
|
|
24
|
+
checkboxes?: PdfCheckbox[];
|
|
25
|
+
auditTrail?: PdfField[];
|
|
26
|
+
signature?: string;
|
|
27
|
+
contentSnapshot?: string;
|
|
28
|
+
responseId?: string;
|
|
29
|
+
userInfo?: PdfUserInfo;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const escapeHtml = (text: string): string => {
|
|
33
|
+
return text
|
|
34
|
+
.replace(/&/g, "&")
|
|
35
|
+
.replace(/</g, "<")
|
|
36
|
+
.replace(/>/g, ">")
|
|
37
|
+
.replace(/"/g, """);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
const renderField = (field: PdfField): string => {
|
|
41
|
+
return `<tr>
|
|
42
|
+
<td class="field-label">${escapeHtml(field.label)}</td>
|
|
43
|
+
<td class="field-value">${escapeHtml(field.value)}</td>
|
|
44
|
+
</tr>`;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const buildConsentPdfHtml = (data: PdfTemplateData): string => {
|
|
48
|
+
const now = DateTime.now().toLocaleString(DateTime.DATETIME_FULL);
|
|
49
|
+
|
|
50
|
+
const fieldsHtml = data.fields.map(renderField).join("\n");
|
|
51
|
+
|
|
52
|
+
const userInfoHtml = data.userInfo
|
|
53
|
+
? `<div class="section">
|
|
54
|
+
<h2>User Information</h2>
|
|
55
|
+
<table>${renderField({label: "User ID:", value: data.userInfo.userId})}
|
|
56
|
+
${data.userInfo.name ? renderField({label: "Name:", value: data.userInfo.name}) : ""}
|
|
57
|
+
${data.userInfo.email ? renderField({label: "Email:", value: data.userInfo.email}) : ""}
|
|
58
|
+
</table>
|
|
59
|
+
</div>`
|
|
60
|
+
: "";
|
|
61
|
+
|
|
62
|
+
const checkboxesHtml =
|
|
63
|
+
data.checkboxes && data.checkboxes.length > 0
|
|
64
|
+
? `<div class="section">
|
|
65
|
+
<h2>Checkbox Responses</h2>
|
|
66
|
+
${data.checkboxes
|
|
67
|
+
.map(
|
|
68
|
+
(cb) =>
|
|
69
|
+
`<div class="checkbox-row">${cb.checked ? "☑" : "☐"} ${escapeHtml(cb.label)}</div>`
|
|
70
|
+
)
|
|
71
|
+
.join("\n")}
|
|
72
|
+
</div>`
|
|
73
|
+
: "";
|
|
74
|
+
|
|
75
|
+
const auditTrailHtml =
|
|
76
|
+
data.auditTrail && data.auditTrail.length > 0
|
|
77
|
+
? `<div class="section">
|
|
78
|
+
<h2>Audit Trail</h2>
|
|
79
|
+
<table>${data.auditTrail.map(renderField).join("\n")}</table>
|
|
80
|
+
</div>`
|
|
81
|
+
: "";
|
|
82
|
+
|
|
83
|
+
const signatureHtml = data.signature
|
|
84
|
+
? `<div class="section">
|
|
85
|
+
<h2>Signature</h2>
|
|
86
|
+
<img src="${escapeHtml(data.signature)}" class="signature-img" />
|
|
87
|
+
</div>`
|
|
88
|
+
: "";
|
|
89
|
+
|
|
90
|
+
const contentSnapshotHtml = data.contentSnapshot
|
|
91
|
+
? `<div class="section">
|
|
92
|
+
<h2>Content Snapshot</h2>
|
|
93
|
+
<div class="content-snapshot">${escapeHtml(data.contentSnapshot)}</div>
|
|
94
|
+
</div>`
|
|
95
|
+
: "";
|
|
96
|
+
|
|
97
|
+
return `<!DOCTYPE html>
|
|
98
|
+
<html>
|
|
99
|
+
<head>
|
|
100
|
+
<meta charset="utf-8" />
|
|
101
|
+
<style>
|
|
102
|
+
body {
|
|
103
|
+
font-family: Helvetica, Arial, sans-serif;
|
|
104
|
+
margin: 0;
|
|
105
|
+
color: #000;
|
|
106
|
+
font-size: 10pt;
|
|
107
|
+
line-height: 1.4;
|
|
108
|
+
}
|
|
109
|
+
h1 {
|
|
110
|
+
font-size: 18pt;
|
|
111
|
+
margin: 0 0 4mm 0;
|
|
112
|
+
}
|
|
113
|
+
.form-title {
|
|
114
|
+
font-size: 14pt;
|
|
115
|
+
font-weight: normal;
|
|
116
|
+
margin: 0 0 6mm 0;
|
|
117
|
+
}
|
|
118
|
+
hr {
|
|
119
|
+
border: none;
|
|
120
|
+
border-top: 1px solid #c8c8c8;
|
|
121
|
+
margin: 4mm 0;
|
|
122
|
+
}
|
|
123
|
+
h2 {
|
|
124
|
+
font-size: 12pt;
|
|
125
|
+
margin: 6mm 0 4mm 0;
|
|
126
|
+
}
|
|
127
|
+
table {
|
|
128
|
+
border-collapse: collapse;
|
|
129
|
+
}
|
|
130
|
+
.field-label {
|
|
131
|
+
font-size: 9pt;
|
|
132
|
+
font-weight: bold;
|
|
133
|
+
color: #646464;
|
|
134
|
+
width: 45mm;
|
|
135
|
+
padding: 1mm 0;
|
|
136
|
+
vertical-align: top;
|
|
137
|
+
}
|
|
138
|
+
.field-value {
|
|
139
|
+
font-size: 10pt;
|
|
140
|
+
padding: 1mm 0;
|
|
141
|
+
}
|
|
142
|
+
.checkbox-row {
|
|
143
|
+
font-size: 10pt;
|
|
144
|
+
margin-left: 4mm;
|
|
145
|
+
padding: 1mm 0;
|
|
146
|
+
}
|
|
147
|
+
.signature-img {
|
|
148
|
+
width: 80mm;
|
|
149
|
+
height: 30mm;
|
|
150
|
+
object-fit: contain;
|
|
151
|
+
}
|
|
152
|
+
.content-snapshot {
|
|
153
|
+
font-size: 9pt;
|
|
154
|
+
color: #323232;
|
|
155
|
+
white-space: pre-wrap;
|
|
156
|
+
word-wrap: break-word;
|
|
157
|
+
}
|
|
158
|
+
.footer {
|
|
159
|
+
margin-top: 8mm;
|
|
160
|
+
border-top: 1px solid #c8c8c8;
|
|
161
|
+
padding-top: 3mm;
|
|
162
|
+
font-size: 8pt;
|
|
163
|
+
font-style: italic;
|
|
164
|
+
color: #969696;
|
|
165
|
+
display: flex;
|
|
166
|
+
justify-content: space-between;
|
|
167
|
+
}
|
|
168
|
+
.section {
|
|
169
|
+
margin-bottom: 4mm;
|
|
170
|
+
}
|
|
171
|
+
@page {
|
|
172
|
+
size: A4;
|
|
173
|
+
margin: 20mm;
|
|
174
|
+
}
|
|
175
|
+
</style>
|
|
176
|
+
</head>
|
|
177
|
+
<body>
|
|
178
|
+
<h1>${escapeHtml(data.title)}</h1>
|
|
179
|
+
<div class="form-title">${escapeHtml(data.formTitle)}</div>
|
|
180
|
+
<hr />
|
|
181
|
+
|
|
182
|
+
<div class="section">
|
|
183
|
+
<h2>Response Details</h2>
|
|
184
|
+
<table>${fieldsHtml}</table>
|
|
185
|
+
</div>
|
|
186
|
+
|
|
187
|
+
${userInfoHtml}
|
|
188
|
+
${checkboxesHtml}
|
|
189
|
+
${auditTrailHtml}
|
|
190
|
+
${signatureHtml}
|
|
191
|
+
${contentSnapshotHtml}
|
|
192
|
+
|
|
193
|
+
<div class="footer">
|
|
194
|
+
<span>Generated ${escapeHtml(now)}</span>
|
|
195
|
+
${data.responseId ? `<span>Response ID: ${escapeHtml(data.responseId)}</span>` : ""}
|
|
196
|
+
</div>
|
|
197
|
+
</body>
|
|
198
|
+
</html>`;
|
|
199
|
+
};
|
|
200
|
+
|
|
201
|
+
export const sharePdfFromHtml = async (options: {
|
|
202
|
+
html: string;
|
|
203
|
+
filename: string;
|
|
204
|
+
}): Promise<void> => {
|
|
205
|
+
if (Platform.OS === "web") {
|
|
206
|
+
throw new Error("sharePdfFromHtml is only supported on mobile platforms");
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
const Print = await import("expo-print");
|
|
210
|
+
const Sharing = await import("expo-sharing");
|
|
211
|
+
|
|
212
|
+
const {uri} = await Print.printToFileAsync({html: options.html});
|
|
213
|
+
|
|
214
|
+
await Sharing.shareAsync(uri, {
|
|
215
|
+
dialogTitle: options.filename,
|
|
216
|
+
mimeType: "application/pdf",
|
|
217
|
+
UTI: "com.adobe.pdf",
|
|
218
|
+
});
|
|
219
|
+
};
|
|
@@ -42,7 +42,6 @@ exports[`PasswordRequirements renders correctly with empty password 1`] = `
|
|
|
42
42
|
"flexDirection": "row",
|
|
43
43
|
"gap": 8,
|
|
44
44
|
"marginBottom": 4,
|
|
45
|
-
"testID": "password-requirements-minLength",
|
|
46
45
|
},
|
|
47
46
|
"testID": "password-requirements-minLength",
|
|
48
47
|
},
|
|
@@ -86,7 +85,6 @@ exports[`PasswordRequirements renders correctly with empty password 1`] = `
|
|
|
86
85
|
"flexDirection": "row",
|
|
87
86
|
"gap": 8,
|
|
88
87
|
"marginBottom": 4,
|
|
89
|
-
"testID": "password-requirements-uppercase",
|
|
90
88
|
},
|
|
91
89
|
"testID": "password-requirements-uppercase",
|
|
92
90
|
},
|
|
@@ -130,7 +128,6 @@ exports[`PasswordRequirements renders correctly with empty password 1`] = `
|
|
|
130
128
|
"flexDirection": "row",
|
|
131
129
|
"gap": 8,
|
|
132
130
|
"marginBottom": 4,
|
|
133
|
-
"testID": "password-requirements-lowercase",
|
|
134
131
|
},
|
|
135
132
|
"testID": "password-requirements-lowercase",
|
|
136
133
|
},
|
|
@@ -174,7 +171,6 @@ exports[`PasswordRequirements renders correctly with empty password 1`] = `
|
|
|
174
171
|
"flexDirection": "row",
|
|
175
172
|
"gap": 8,
|
|
176
173
|
"marginBottom": 4,
|
|
177
|
-
"testID": "password-requirements-number",
|
|
178
174
|
},
|
|
179
175
|
"testID": "password-requirements-number",
|
|
180
176
|
},
|
|
@@ -218,7 +214,6 @@ exports[`PasswordRequirements renders correctly with empty password 1`] = `
|
|
|
218
214
|
"flexDirection": "row",
|
|
219
215
|
"gap": 8,
|
|
220
216
|
"marginBottom": 4,
|
|
221
|
-
"testID": "password-requirements-special",
|
|
222
217
|
},
|
|
223
218
|
"testID": "password-requirements-special",
|
|
224
219
|
},
|
|
@@ -228,9 +223,7 @@ exports[`PasswordRequirements renders correctly with empty password 1`] = `
|
|
|
228
223
|
"props": {
|
|
229
224
|
"onPointerEnter": [Function: AsyncFunction],
|
|
230
225
|
"onPointerLeave": [Function: AsyncFunction],
|
|
231
|
-
"style": {
|
|
232
|
-
"testID": "password-requirements",
|
|
233
|
-
},
|
|
226
|
+
"style": {},
|
|
234
227
|
"testID": "password-requirements",
|
|
235
228
|
},
|
|
236
229
|
"type": "View",
|
|
@@ -279,7 +272,6 @@ exports[`PasswordRequirements renders correctly with a strong password 1`] = `
|
|
|
279
272
|
"flexDirection": "row",
|
|
280
273
|
"gap": 8,
|
|
281
274
|
"marginBottom": 4,
|
|
282
|
-
"testID": "password-requirements-minLength",
|
|
283
275
|
},
|
|
284
276
|
"testID": "password-requirements-minLength",
|
|
285
277
|
},
|
|
@@ -323,7 +315,6 @@ exports[`PasswordRequirements renders correctly with a strong password 1`] = `
|
|
|
323
315
|
"flexDirection": "row",
|
|
324
316
|
"gap": 8,
|
|
325
317
|
"marginBottom": 4,
|
|
326
|
-
"testID": "password-requirements-uppercase",
|
|
327
318
|
},
|
|
328
319
|
"testID": "password-requirements-uppercase",
|
|
329
320
|
},
|
|
@@ -367,7 +358,6 @@ exports[`PasswordRequirements renders correctly with a strong password 1`] = `
|
|
|
367
358
|
"flexDirection": "row",
|
|
368
359
|
"gap": 8,
|
|
369
360
|
"marginBottom": 4,
|
|
370
|
-
"testID": "password-requirements-lowercase",
|
|
371
361
|
},
|
|
372
362
|
"testID": "password-requirements-lowercase",
|
|
373
363
|
},
|
|
@@ -411,7 +401,6 @@ exports[`PasswordRequirements renders correctly with a strong password 1`] = `
|
|
|
411
401
|
"flexDirection": "row",
|
|
412
402
|
"gap": 8,
|
|
413
403
|
"marginBottom": 4,
|
|
414
|
-
"testID": "password-requirements-number",
|
|
415
404
|
},
|
|
416
405
|
"testID": "password-requirements-number",
|
|
417
406
|
},
|
|
@@ -455,7 +444,6 @@ exports[`PasswordRequirements renders correctly with a strong password 1`] = `
|
|
|
455
444
|
"flexDirection": "row",
|
|
456
445
|
"gap": 8,
|
|
457
446
|
"marginBottom": 4,
|
|
458
|
-
"testID": "password-requirements-special",
|
|
459
447
|
},
|
|
460
448
|
"testID": "password-requirements-special",
|
|
461
449
|
},
|
|
@@ -465,9 +453,7 @@ exports[`PasswordRequirements renders correctly with a strong password 1`] = `
|
|
|
465
453
|
"props": {
|
|
466
454
|
"onPointerEnter": [Function: AsyncFunction],
|
|
467
455
|
"onPointerLeave": [Function: AsyncFunction],
|
|
468
|
-
"style": {
|
|
469
|
-
"testID": "password-requirements",
|
|
470
|
-
},
|
|
456
|
+
"style": {},
|
|
471
457
|
"testID": "password-requirements",
|
|
472
458
|
},
|
|
473
459
|
"type": "View",
|
|
@@ -408,7 +408,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
408
408
|
"flexDirection": "row",
|
|
409
409
|
"gap": 8,
|
|
410
410
|
"marginBottom": 4,
|
|
411
|
-
"testID": "signup-screen-password-requirements-minLength",
|
|
412
411
|
},
|
|
413
412
|
"testID": "signup-screen-password-requirements-minLength",
|
|
414
413
|
},
|
|
@@ -452,7 +451,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
452
451
|
"flexDirection": "row",
|
|
453
452
|
"gap": 8,
|
|
454
453
|
"marginBottom": 4,
|
|
455
|
-
"testID": "signup-screen-password-requirements-uppercase",
|
|
456
454
|
},
|
|
457
455
|
"testID": "signup-screen-password-requirements-uppercase",
|
|
458
456
|
},
|
|
@@ -496,7 +494,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
496
494
|
"flexDirection": "row",
|
|
497
495
|
"gap": 8,
|
|
498
496
|
"marginBottom": 4,
|
|
499
|
-
"testID": "signup-screen-password-requirements-lowercase",
|
|
500
497
|
},
|
|
501
498
|
"testID": "signup-screen-password-requirements-lowercase",
|
|
502
499
|
},
|
|
@@ -540,7 +537,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
540
537
|
"flexDirection": "row",
|
|
541
538
|
"gap": 8,
|
|
542
539
|
"marginBottom": 4,
|
|
543
|
-
"testID": "signup-screen-password-requirements-number",
|
|
544
540
|
},
|
|
545
541
|
"testID": "signup-screen-password-requirements-number",
|
|
546
542
|
},
|
|
@@ -584,7 +580,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
584
580
|
"flexDirection": "row",
|
|
585
581
|
"gap": 8,
|
|
586
582
|
"marginBottom": 4,
|
|
587
|
-
"testID": "signup-screen-password-requirements-special",
|
|
588
583
|
},
|
|
589
584
|
"testID": "signup-screen-password-requirements-special",
|
|
590
585
|
},
|
|
@@ -594,9 +589,7 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
594
589
|
"props": {
|
|
595
590
|
"onPointerEnter": [Function: AsyncFunction],
|
|
596
591
|
"onPointerLeave": [Function: AsyncFunction],
|
|
597
|
-
"style": {
|
|
598
|
-
"testID": "signup-screen-password-requirements",
|
|
599
|
-
},
|
|
592
|
+
"style": {},
|
|
600
593
|
"testID": "signup-screen-password-requirements",
|
|
601
594
|
},
|
|
602
595
|
"type": "View",
|
|
@@ -840,7 +833,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
840
833
|
"justifyContent": "center",
|
|
841
834
|
"maxWidth": 400,
|
|
842
835
|
"padding": 16,
|
|
843
|
-
"testID": "signup-screen",
|
|
844
836
|
"width": "100%",
|
|
845
837
|
},
|
|
846
838
|
"testID": "signup-screen",
|
|
@@ -853,7 +845,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
853
845
|
"onPointerLeave": [Function: AsyncFunction],
|
|
854
846
|
"style": {
|
|
855
847
|
"alignSelf": "center",
|
|
856
|
-
"avoidKeyboard": true,
|
|
857
848
|
"backgroundColor": "#FFFFFF",
|
|
858
849
|
"display": "flex",
|
|
859
850
|
"flex": undefined,
|
|
@@ -861,11 +852,8 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
861
852
|
"flexGrow": 1,
|
|
862
853
|
"flexShrink": 1,
|
|
863
854
|
"height": "100%",
|
|
864
|
-
"keyboardOffset": undefined,
|
|
865
855
|
"maxWidth": 800,
|
|
866
856
|
"padding": 8,
|
|
867
|
-
"scroll": true,
|
|
868
|
-
"testID": undefined,
|
|
869
857
|
"width": "100%",
|
|
870
858
|
},
|
|
871
859
|
"testID": undefined,
|
|
@@ -889,7 +877,6 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
889
877
|
"scrollEventThrottle": 50,
|
|
890
878
|
"style": {
|
|
891
879
|
"alignSelf": "center",
|
|
892
|
-
"avoidKeyboard": true,
|
|
893
880
|
"backgroundColor": "#FFFFFF",
|
|
894
881
|
"display": "flex",
|
|
895
882
|
"flex": undefined,
|
|
@@ -897,11 +884,8 @@ exports[`SignUpScreen renders correctly with all props 1`] = `
|
|
|
897
884
|
"flexGrow": 1,
|
|
898
885
|
"flexShrink": 1,
|
|
899
886
|
"height": "100%",
|
|
900
|
-
"keyboardOffset": undefined,
|
|
901
887
|
"maxWidth": 800,
|
|
902
888
|
"padding": 8,
|
|
903
|
-
"scroll": true,
|
|
904
|
-
"testID": undefined,
|
|
905
889
|
"width": "100%",
|
|
906
890
|
},
|
|
907
891
|
},
|