@redacto.io/consent-sdk-react 10.0.0-beta.1 → 10.0.0-beta.12
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/NOTICE.md +17 -0
- package/README.md +145 -3
- package/dist/chunk-FEGTW73Q.mjs +182 -0
- package/dist/{chunk-6A665OPR.mjs → chunk-OGL6OC3A.mjs} +4 -0
- package/dist/fonts.d.mts +35 -0
- package/dist/fonts.d.ts +35 -0
- package/dist/fonts.js +183 -0
- package/dist/fonts.mjs +10 -0
- package/dist/index.d.mts +44 -5
- package/dist/index.d.ts +44 -5
- package/dist/index.js +950 -476
- package/dist/index.mjs +572 -314
- package/dist/montserrat.generated-NBTECYRW.mjs +22 -0
- package/dist/privacy-center.d.mts +55 -12
- package/dist/privacy-center.d.ts +55 -12
- package/dist/privacy-center.js +848 -950
- package/dist/privacy-center.mjs +698 -802
- package/dist/types-6Aj7faxL.d.mts +57 -0
- package/dist/types-6Aj7faxL.d.ts +57 -0
- package/package.json +10 -1
- package/.turbo/turbo-build.log +0 -22
- package/.turbo/turbo-test.log +0 -203
- package/.turbo/turbo-verify-pack.log +0 -6
- package/CHANGELOG.md +0 -274
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +0 -847
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +0 -2133
- package/src/RedactoNoticeAssisted/api/index.ts +0 -269
- package/src/RedactoNoticeAssisted/api/types.ts +0 -180
- package/src/RedactoNoticeAssisted/assets/redacto-logo.png +0 -0
- package/src/RedactoNoticeAssisted/constants.ts +0 -51
- package/src/RedactoNoticeAssisted/i18n.ts +0 -1463
- package/src/RedactoNoticeAssisted/index.ts +0 -1
- package/src/RedactoNoticeAssisted/injectStyles.ts +0 -251
- package/src/RedactoNoticeAssisted/styles.ts +0 -730
- package/src/RedactoNoticeAssisted/types.ts +0 -24
- package/src/RedactoNoticeAssisted/useMediaQuery.ts +0 -36
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +0 -1152
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +0 -4258
- package/src/RedactoNoticeConsent/api/index.ts +0 -573
- package/src/RedactoNoticeConsent/api/types.ts +0 -490
- package/src/RedactoNoticeConsent/assets/redacto-logo.png +0 -0
- package/src/RedactoNoticeConsent/components/DigiLockerCallback.tsx +0 -602
- package/src/RedactoNoticeConsent/components/index.ts +0 -7
- package/src/RedactoNoticeConsent/constants.ts +0 -20
- package/src/RedactoNoticeConsent/index.ts +0 -1
- package/src/RedactoNoticeConsent/injectStyles.ts +0 -151
- package/src/RedactoNoticeConsent/language-codes.ts +0 -97
- package/src/RedactoNoticeConsent/services/storage.ts +0 -122
- package/src/RedactoNoticeConsent/styles.ts +0 -409
- package/src/RedactoNoticeConsent/types.ts +0 -54
- package/src/RedactoNoticeConsent/useMediaQuery.ts +0 -36
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.test.tsx +0 -369
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +0 -629
- package/src/RedactoNoticeConsentInline/api/index.ts +0 -106
- package/src/RedactoNoticeConsentInline/api/types.ts +0 -183
- package/src/RedactoNoticeConsentInline/assets/redacto-logo.png +0 -0
- package/src/RedactoNoticeConsentInline/index.ts +0 -1
- package/src/RedactoNoticeConsentInline/injectStyles.ts +0 -40
- package/src/RedactoNoticeConsentInline/styles.ts +0 -397
- package/src/RedactoNoticeConsentInline/types.ts +0 -51
- package/src/RedactoNoticeConsentInline/useMediaQuery.ts +0 -36
- package/src/RedactoPrivacyCenter/NotificationsPage.tsx +0 -182
- package/src/RedactoPrivacyCenter/PrivacyCenterActivityPage.tsx +0 -19
- package/src/RedactoPrivacyCenter/PrivacyCenterCaseDetailsPage.tsx +0 -156
- package/src/RedactoPrivacyCenter/PrivacyCenterConsentManagerPage.tsx +0 -17
- package/src/RedactoPrivacyCenter/PrivacyCenterFormPage.tsx +0 -79
- package/src/RedactoPrivacyCenter/PrivacyCenterHomePage.tsx +0 -36
- package/src/RedactoPrivacyCenter/PrivacyCenterLayout.tsx +0 -177
- package/src/RedactoPrivacyCenter/PrivacyCenterMyReceiptPage.tsx +0 -26
- package/src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx +0 -58
- package/src/RedactoPrivacyCenter/api/actions.ts +0 -680
- package/src/RedactoPrivacyCenter/api/client.ts +0 -906
- package/src/RedactoPrivacyCenter/api/config.ts +0 -33
- package/src/RedactoPrivacyCenter/api/fetcher.ts +0 -260
- package/src/RedactoPrivacyCenter/api/orgBranding.ts +0 -16
- package/src/RedactoPrivacyCenter/api/upload.ts +0 -93
- package/src/RedactoPrivacyCenter/assets/character.svg +0 -31
- package/src/RedactoPrivacyCenter/assets/fileAttach.svg +0 -9
- package/src/RedactoPrivacyCenter/assets/greenTick.svg +0 -4
- package/src/RedactoPrivacyCenter/assets/mail.svg +0 -3
- package/src/RedactoPrivacyCenter/assets/poweredByRedacto.svg +0 -9
- package/src/RedactoPrivacyCenter/assets/sentImg.svg +0 -9
- package/src/RedactoPrivacyCenter/assets/uploadFileIcon.svg +0 -9
- package/src/RedactoPrivacyCenter/components/ActivitiesList.tsx +0 -252
- package/src/RedactoPrivacyCenter/components/ActivityTimeline.tsx +0 -239
- package/src/RedactoPrivacyCenter/components/AppShell/AppShell.tsx +0 -240
- package/src/RedactoPrivacyCenter/components/AppShell/MobileNavDrawer.tsx +0 -218
- package/src/RedactoPrivacyCenter/components/AppShell/NavItem.tsx +0 -205
- package/src/RedactoPrivacyCenter/components/AppShell/PageHeader.tsx +0 -107
- package/src/RedactoPrivacyCenter/components/AppShell/SidebarNav.tsx +0 -100
- package/src/RedactoPrivacyCenter/components/AppShell/TopAppBar.tsx +0 -339
- package/src/RedactoPrivacyCenter/components/AppShell/UserMenu.tsx +0 -243
- package/src/RedactoPrivacyCenter/components/AppShell/hooks/useIsTruncated.ts +0 -28
- package/src/RedactoPrivacyCenter/components/AppShell/hooks/useKeyboardShortcut.ts +0 -40
- package/src/RedactoPrivacyCenter/components/AppShell/hooks/useSidebarState.ts +0 -62
- package/src/RedactoPrivacyCenter/components/AppShell/usePrivacyCenterExitAction.ts +0 -36
- package/src/RedactoPrivacyCenter/components/CaseDetails/AttachmentCard.tsx +0 -38
- package/src/RedactoPrivacyCenter/components/CaseDetails/ChatBubble.tsx +0 -31
- package/src/RedactoPrivacyCenter/components/CaseDetails/DocumentRequestCard.tsx +0 -79
- package/src/RedactoPrivacyCenter/components/CaseDetails/FinalizedTooltipWrapper.tsx +0 -25
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessageComposer.tsx +0 -96
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessageItem.tsx +0 -97
- package/src/RedactoPrivacyCenter/components/CaseDetails/MessagesTab.tsx +0 -156
- package/src/RedactoPrivacyCenter/components/CaseDetails/RequestDetailsTab.tsx +0 -171
- package/src/RedactoPrivacyCenter/components/CaseDetails/StatusEvent.tsx +0 -23
- package/src/RedactoPrivacyCenter/components/CaseDetails/useFileUpload.ts +0 -116
- package/src/RedactoPrivacyCenter/components/CaseDetails/useMessagePolling.ts +0 -43
- package/src/RedactoPrivacyCenter/components/CaseDetails/utils.ts +0 -71
- package/src/RedactoPrivacyCenter/components/CaseDetailsModal.tsx +0 -469
- package/src/RedactoPrivacyCenter/components/CaseHistory.tsx +0 -426
- package/src/RedactoPrivacyCenter/components/ConsentManager.tsx +0 -1198
- package/src/RedactoPrivacyCenter/components/ConsentManagerCells.tsx +0 -201
- package/src/RedactoPrivacyCenter/components/ConsentManagerColumns.tsx +0 -138
- package/src/RedactoPrivacyCenter/components/ConsentManagerConstants.ts +0 -7
- package/src/RedactoPrivacyCenter/components/ConsentManagerExpandedRow.tsx +0 -179
- package/src/RedactoPrivacyCenter/components/ConsentManagerGroupedColumns.tsx +0 -318
- package/src/RedactoPrivacyCenter/components/ConsentManagerProductCards.tsx +0 -333
- package/src/RedactoPrivacyCenter/components/ConsentManagerPurposeCards.tsx +0 -102
- package/src/RedactoPrivacyCenter/components/ConsentManagerTableSkeleton.tsx +0 -159
- package/src/RedactoPrivacyCenter/components/DataRequest/CorrectionDataSection.tsx +0 -189
- package/src/RedactoPrivacyCenter/components/DataRequest/GrievanceDataSection.tsx +0 -118
- package/src/RedactoPrivacyCenter/components/DataRequest/NominationDataSection.tsx +0 -66
- package/src/RedactoPrivacyCenter/components/DataRequest/ProductSelectionSection.tsx +0 -222
- package/src/RedactoPrivacyCenter/components/DataRequest/PurposeSelectionSection.tsx +0 -331
- package/src/RedactoPrivacyCenter/components/Form.tsx +0 -1796
- package/src/RedactoPrivacyCenter/components/GrievanceTable.tsx +0 -174
- package/src/RedactoPrivacyCenter/components/GrievanceTablePagination.tsx +0 -337
- package/src/RedactoPrivacyCenter/components/ModifyConsentModal.tsx +0 -334
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationBell.tsx +0 -173
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationCTAButton.tsx +0 -18
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationDropdown.tsx +0 -54
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationDropdownItem.tsx +0 -57
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationIcon.tsx +0 -19
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationListPanel.tsx +0 -92
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationRefreshButton.tsx +0 -20
- package/src/RedactoPrivacyCenter/components/NotificationHub/NotificationRow.tsx +0 -58
- package/src/RedactoPrivacyCenter/components/NotificationHub/StatCard.tsx +0 -10
- package/src/RedactoPrivacyCenter/components/NotificationHub/useNotificationActions.ts +0 -112
- package/src/RedactoPrivacyCenter/components/NotificationHub/utils.ts +0 -27
- package/src/RedactoPrivacyCenter/components/Pagination.tsx +0 -140
- package/src/RedactoPrivacyCenter/components/PrivacyCenterEmptyState.tsx +0 -76
- package/src/RedactoPrivacyCenter/components/PrivacyCenterSessionExpired.tsx +0 -97
- package/src/RedactoPrivacyCenter/components/ReceiptsList.tsx +0 -454
- package/src/RedactoPrivacyCenter/components/RequestSubmit.tsx +0 -270
- package/src/RedactoPrivacyCenter/components/SelectUser.tsx +0 -83
- package/src/RedactoPrivacyCenter/components/SelectUserGate.tsx +0 -193
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/constants.tsx +0 -25
- package/src/RedactoPrivacyCenter/components/SideMenuBarPC/types.ts +0 -21
- package/src/RedactoPrivacyCenter/components/caseHistoryColumns.tsx +0 -159
- package/src/RedactoPrivacyCenter/components/constant.ts +0 -52
- package/src/RedactoPrivacyCenter/components/groupHelpers.ts +0 -119
- package/src/RedactoPrivacyCenter/components/receiptColumns.tsx +0 -203
- package/src/RedactoPrivacyCenter/components/types.ts +0 -123
- package/src/RedactoPrivacyCenter/components/utils.tsx +0 -10
- package/src/RedactoPrivacyCenter/config/routes.ts +0 -9
- package/src/RedactoPrivacyCenter/config/table.ts +0 -25
- package/src/RedactoPrivacyCenter/context/AuthContext.tsx +0 -160
- package/src/RedactoPrivacyCenter/context/BaseUrlContext.tsx +0 -47
- package/src/RedactoPrivacyCenter/context/BrandingContext.tsx +0 -52
- package/src/RedactoPrivacyCenter/context/DataAvailabilityContext.session-expired.test.tsx +0 -92
- package/src/RedactoPrivacyCenter/context/DataAvailabilityContext.tsx +0 -181
- package/src/RedactoPrivacyCenter/context/LocaleContext.tsx +0 -11
- package/src/RedactoPrivacyCenter/context/NavigationContext.tsx +0 -96
- package/src/RedactoPrivacyCenter/context/OrganizationContext.tsx +0 -30
- package/src/RedactoPrivacyCenter/context/PageChromeContext.tsx +0 -80
- package/src/RedactoPrivacyCenter/context/ProfileSwitchContext.tsx +0 -15
- package/src/RedactoPrivacyCenter/context/types.ts +0 -19
- package/src/RedactoPrivacyCenter/lib/api.ts +0 -756
- package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +0 -67
- package/src/RedactoPrivacyCenter/lib/constants.ts +0 -277
- package/src/RedactoPrivacyCenter/lib/i18n.ts +0 -81
- package/src/RedactoPrivacyCenter/lib/locales.ts +0 -105
- package/src/RedactoPrivacyCenter/lib/queries.ts +0 -141
- package/src/RedactoPrivacyCenter/lib/types.ts +0 -868
- package/src/RedactoPrivacyCenter/lib/useCurrentLanguage.ts +0 -37
- package/src/RedactoPrivacyCenter/lib/utils.refresh-circuit.test.ts +0 -127
- package/src/RedactoPrivacyCenter/lib/utils.refresh-storage.test.ts +0 -85
- package/src/RedactoPrivacyCenter/lib/utils.session-expired.test.ts +0 -109
- package/src/RedactoPrivacyCenter/lib/utils.ts +0 -783
- package/src/RedactoPrivacyCenter/locales/as/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/bho/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/bn/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/brx/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/doi/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/en/translation.json +0 -354
- package/src/RedactoPrivacyCenter/locales/gom/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/gu/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/hi/translation.json +0 -343
- package/src/RedactoPrivacyCenter/locales/kn/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/ks/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/mai/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/ml/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/mni-Mtei/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/mr/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/ne/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/or/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/pa/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/sa/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/sat/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/sd/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/ta/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/te/translation.json +0 -340
- package/src/RedactoPrivacyCenter/locales/ur/translation.json +0 -340
- package/src/RedactoPrivacyCenter/styles/applyBrandingTheme.ts +0 -66
- package/src/RedactoPrivacyCenter/styles/base.css +0 -117
- package/src/RedactoPrivacyCenter/styles/injectStyles.ts +0 -3103
- package/src/RedactoPrivacyCenter/styles/pcStyles.ts +0 -814
- package/src/RedactoPrivacyCenter/styles/responsive.ts +0 -138
- package/src/RedactoPrivacyCenter/styles/variables.css +0 -96
- package/src/RedactoPrivacyCenter/table/AdvancedTable.tsx +0 -387
- package/src/RedactoPrivacyCenter/table/AdvancedTablePagination.tsx +0 -468
- package/src/RedactoPrivacyCenter/table/index.ts +0 -2
- package/src/RedactoPrivacyCenter/types/images.d.ts +0 -29
- package/src/RedactoPrivacyCenter/ui/Footer.tsx +0 -69
- package/src/RedactoPrivacyCenter/ui/FormBlockWrapper.tsx +0 -54
- package/src/RedactoPrivacyCenter/ui/PCAccordion.tsx +0 -93
- package/src/RedactoPrivacyCenter/ui/PCActionIcon.tsx +0 -47
- package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +0 -69
- package/src/RedactoPrivacyCenter/ui/PCBadge.tsx +0 -48
- package/src/RedactoPrivacyCenter/ui/PCButton.tsx +0 -77
- package/src/RedactoPrivacyCenter/ui/PCCheckbox.tsx +0 -55
- package/src/RedactoPrivacyCenter/ui/PCCollapse.tsx +0 -107
- package/src/RedactoPrivacyCenter/ui/PCEmpty.tsx +0 -35
- package/src/RedactoPrivacyCenter/ui/PCInput.tsx +0 -132
- package/src/RedactoPrivacyCenter/ui/PCLoader.tsx +0 -31
- package/src/RedactoPrivacyCenter/ui/PCModal.tsx +0 -106
- package/src/RedactoPrivacyCenter/ui/PCPopover.tsx +0 -206
- package/src/RedactoPrivacyCenter/ui/PCSelect.tsx +0 -433
- package/src/RedactoPrivacyCenter/ui/PCTable.tsx +0 -149
- package/src/RedactoPrivacyCenter/ui/PCText.tsx +0 -41
- package/src/RedactoPrivacyCenter/ui/PCTextarea.tsx +0 -43
- package/src/RedactoPrivacyCenter/ui/PCTitle.tsx +0 -37
- package/src/RedactoPrivacyCenter/ui/PCTooltip.tsx +0 -121
- package/src/RedactoPrivacyCenter/ui/SimpleBar.tsx +0 -25
- package/src/RedactoPrivacyCenter/ui/StatusBadge.tsx +0 -53
- package/src/RedactoPrivacyCenter/ui/index.ts +0 -18
- package/src/RedactoPrivacyCenter/utils/cn.ts +0 -28
- package/src/RedactoPrivacyCenter/utils/date.ts +0 -48
- package/src/RedactoPrivacyCenter/utils/status.ts +0 -111
- package/src/RedactoPrivacyCenter/utils/toast.ts +0 -130
- package/src/index.ts +0 -19
- package/src/privacy-center.ts +0 -113
- package/src/shared/api-errors.ts +0 -180
- package/src/types/css.d.ts +0 -4
- package/src/types/images.d.ts +0 -19
- package/src/types/react-jsx.d.ts +0 -26
- package/tests/DataAvailabilityContext.test.tsx +0 -123
- package/tests/Form.test.tsx +0 -1287
- package/tests/ProductSelectionSection.test.tsx +0 -328
- package/tests/RequestSubmit.test.tsx +0 -135
- package/tests/consentClient.test.ts +0 -171
- package/tests/manageConsentServer.test.ts +0 -38
- package/tests/mocks.ts +0 -257
- package/tests/resolveContactFromJwt.test.ts +0 -44
- package/tests/setup.ts +0 -16
- package/tsconfig.json +0 -16
- package/tsup.config.ts +0 -31
- package/vitest.config.ts +0 -16
|
@@ -1,629 +0,0 @@
|
|
|
1
|
-
import { useEffect, useMemo, useState, useRef, useCallback, memo } from "react";
|
|
2
|
-
import { fetchConsentContent, submitConsentEvent } from "./api";
|
|
3
|
-
import type { ConsentContent } from "./api/types";
|
|
4
|
-
import type { Props, TranslationObject } from "./types";
|
|
5
|
-
import { styles } from "./styles";
|
|
6
|
-
import { useMediaQuery } from "./useMediaQuery";
|
|
7
|
-
import { injectSpinnerAnimation } from "./injectStyles";
|
|
8
|
-
|
|
9
|
-
const RedactoConsentInlineComponent = ({
|
|
10
|
-
org_uuid,
|
|
11
|
-
workspace_uuid,
|
|
12
|
-
notice_uuid,
|
|
13
|
-
accessToken,
|
|
14
|
-
baseUrl,
|
|
15
|
-
ledgerBaseUrl,
|
|
16
|
-
language = "en",
|
|
17
|
-
onAccept,
|
|
18
|
-
onError,
|
|
19
|
-
onValidationChange,
|
|
20
|
-
settings,
|
|
21
|
-
applicationId,
|
|
22
|
-
}: Props) => {
|
|
23
|
-
const [content, setContent] = useState<
|
|
24
|
-
ConsentContent["detail"]["active_config"] | null
|
|
25
|
-
>(null);
|
|
26
|
-
const [isLoading, setIsLoading] = useState(true);
|
|
27
|
-
const [isSubmitting, setIsSubmitting] = useState(false);
|
|
28
|
-
const [selectedLanguage, setSelectedLanguage] = useState<string>(language);
|
|
29
|
-
const [collapsedPurposes, setCollapsedPurposes] = useState<
|
|
30
|
-
Record<string, boolean>
|
|
31
|
-
>({});
|
|
32
|
-
const [selectedPurposes, setSelectedPurposes] = useState<
|
|
33
|
-
Record<string, boolean>
|
|
34
|
-
>({});
|
|
35
|
-
const [selectedDataElements, setSelectedDataElements] = useState<
|
|
36
|
-
Record<string, boolean>
|
|
37
|
-
>({});
|
|
38
|
-
const [hasAlreadyConsented, setHasAlreadyConsented] = useState(false);
|
|
39
|
-
const [fetchError, setFetchError] = useState<Error | null>(null);
|
|
40
|
-
const [errorMessage, setErrorMessage] = useState<string | null>(null);
|
|
41
|
-
|
|
42
|
-
// Ref to track if we've already submitted consent to prevent duplicate submissions
|
|
43
|
-
const hasSubmittedRef = useRef(false);
|
|
44
|
-
|
|
45
|
-
// Inject spinner animation for loading indicator
|
|
46
|
-
useEffect(() => {
|
|
47
|
-
injectSpinnerAnimation();
|
|
48
|
-
}, []);
|
|
49
|
-
|
|
50
|
-
// Add media query hooks
|
|
51
|
-
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
52
|
-
|
|
53
|
-
// Responsive styles
|
|
54
|
-
const responsiveStyles = useMemo(
|
|
55
|
-
() => ({
|
|
56
|
-
optionTitle: {
|
|
57
|
-
fontSize: isMobile ? "14px" : "16px",
|
|
58
|
-
},
|
|
59
|
-
optionDescription: {
|
|
60
|
-
fontSize: isMobile ? "11px" : "12px",
|
|
61
|
-
},
|
|
62
|
-
dataElementText: {
|
|
63
|
-
fontSize: isMobile ? "12px" : "14px",
|
|
64
|
-
},
|
|
65
|
-
button: {
|
|
66
|
-
fontSize: isMobile ? "14px" : "16px",
|
|
67
|
-
padding: isMobile ? "10px 20px" : "9px 45px",
|
|
68
|
-
},
|
|
69
|
-
}),
|
|
70
|
-
[isMobile]
|
|
71
|
-
);
|
|
72
|
-
|
|
73
|
-
const areAllRequiredElementsChecked = useMemo(() => {
|
|
74
|
-
if (!content) return false;
|
|
75
|
-
|
|
76
|
-
return content.purposes.every((purpose) => {
|
|
77
|
-
const requiredElements = purpose.data_elements.filter(
|
|
78
|
-
(element) => element.required
|
|
79
|
-
);
|
|
80
|
-
return requiredElements.every(
|
|
81
|
-
(element) => selectedDataElements[`${purpose.uuid}-${element.uuid}`]
|
|
82
|
-
);
|
|
83
|
-
});
|
|
84
|
-
}, [content, selectedDataElements]);
|
|
85
|
-
|
|
86
|
-
// Notify parent component when validation state changes
|
|
87
|
-
useEffect(() => {
|
|
88
|
-
onValidationChange?.(areAllRequiredElementsChecked);
|
|
89
|
-
}, [areAllRequiredElementsChecked, onValidationChange]);
|
|
90
|
-
|
|
91
|
-
useEffect(() => {
|
|
92
|
-
if (hasAlreadyConsented) {
|
|
93
|
-
onAccept?.();
|
|
94
|
-
}
|
|
95
|
-
}, [hasAlreadyConsented, onAccept]);
|
|
96
|
-
|
|
97
|
-
const getTranslatedText = (
|
|
98
|
-
key: string,
|
|
99
|
-
defaultText: string,
|
|
100
|
-
itemId?: string
|
|
101
|
-
): string => {
|
|
102
|
-
if (!content) return defaultText;
|
|
103
|
-
|
|
104
|
-
if (selectedLanguage === "English" || selectedLanguage === "en" || selectedLanguage === "EN") {
|
|
105
|
-
if (
|
|
106
|
-
key === "privacy_policy_anchor_text" &&
|
|
107
|
-
content.privacy_policy_anchor_text
|
|
108
|
-
) {
|
|
109
|
-
return content.privacy_policy_anchor_text;
|
|
110
|
-
}
|
|
111
|
-
return defaultText;
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
if (!content.supported_languages_and_translations) {
|
|
115
|
-
return defaultText;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
const translationMap = content.supported_languages_and_translations[
|
|
119
|
-
selectedLanguage
|
|
120
|
-
] as TranslationObject | undefined;
|
|
121
|
-
|
|
122
|
-
if (!translationMap) {
|
|
123
|
-
return defaultText;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (itemId) {
|
|
127
|
-
if (key === "purposes.name" || key === "purposes.description") {
|
|
128
|
-
const purposeData = translationMap.purposes?.[itemId];
|
|
129
|
-
if (purposeData) {
|
|
130
|
-
if (typeof purposeData === "string") {
|
|
131
|
-
return key === "purposes.name" ? purposeData : defaultText;
|
|
132
|
-
}
|
|
133
|
-
return key === "purposes.name"
|
|
134
|
-
? purposeData.name || defaultText
|
|
135
|
-
: purposeData.description || defaultText;
|
|
136
|
-
}
|
|
137
|
-
return defaultText;
|
|
138
|
-
}
|
|
139
|
-
if (key.startsWith("data_elements.")) {
|
|
140
|
-
return translationMap.data_elements?.[itemId] || defaultText;
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
const value = translationMap[key];
|
|
145
|
-
if (typeof value === "string" && value) {
|
|
146
|
-
return value;
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
return defaultText;
|
|
150
|
-
};
|
|
151
|
-
|
|
152
|
-
const fetchNotice = async () => {
|
|
153
|
-
setIsLoading(true);
|
|
154
|
-
setFetchError(null);
|
|
155
|
-
try {
|
|
156
|
-
const consentContentData = await fetchConsentContent({
|
|
157
|
-
org_uuid,
|
|
158
|
-
workspace_uuid,
|
|
159
|
-
notice_uuid,
|
|
160
|
-
baseUrl,
|
|
161
|
-
language,
|
|
162
|
-
specific_uuid: applicationId,
|
|
163
|
-
});
|
|
164
|
-
const activeConfig = consentContentData.detail.active_config;
|
|
165
|
-
setContent(activeConfig);
|
|
166
|
-
if (activeConfig.default_language) {
|
|
167
|
-
setSelectedLanguage(activeConfig.default_language);
|
|
168
|
-
}
|
|
169
|
-
const initialCollapsedState = activeConfig.purposes.reduce(
|
|
170
|
-
(acc, purpose) => ({
|
|
171
|
-
...acc,
|
|
172
|
-
[purpose.uuid]: true,
|
|
173
|
-
}),
|
|
174
|
-
{}
|
|
175
|
-
);
|
|
176
|
-
setCollapsedPurposes(initialCollapsedState);
|
|
177
|
-
|
|
178
|
-
// Initialize selected states
|
|
179
|
-
// All elements start unchecked, but required elements cannot be unchecked once checked
|
|
180
|
-
const initialDataElementState: Record<string, boolean> =
|
|
181
|
-
activeConfig.purposes.reduce(
|
|
182
|
-
(acc: Record<string, boolean>, purpose) => {
|
|
183
|
-
purpose.data_elements.forEach((element) => {
|
|
184
|
-
const combinedId = `${purpose.uuid}-${element.uuid}`;
|
|
185
|
-
acc[combinedId] = false;
|
|
186
|
-
});
|
|
187
|
-
return acc;
|
|
188
|
-
},
|
|
189
|
-
{}
|
|
190
|
-
);
|
|
191
|
-
setSelectedDataElements(initialDataElementState);
|
|
192
|
-
|
|
193
|
-
// Initialize purpose states - all start unchecked
|
|
194
|
-
const initialPurposeState: Record<string, boolean> =
|
|
195
|
-
activeConfig.purposes.reduce(
|
|
196
|
-
(acc: Record<string, boolean>, purpose) => {
|
|
197
|
-
return {
|
|
198
|
-
...acc,
|
|
199
|
-
[purpose.uuid]: false,
|
|
200
|
-
};
|
|
201
|
-
},
|
|
202
|
-
{}
|
|
203
|
-
);
|
|
204
|
-
setSelectedPurposes(initialPurposeState);
|
|
205
|
-
} catch (err: unknown) {
|
|
206
|
-
const error = err as Error & { status?: number };
|
|
207
|
-
setFetchError(error);
|
|
208
|
-
if (error.status === 409) {
|
|
209
|
-
setHasAlreadyConsented(true);
|
|
210
|
-
} else {
|
|
211
|
-
onError?.(error);
|
|
212
|
-
}
|
|
213
|
-
} finally {
|
|
214
|
-
setIsLoading(false);
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
useEffect(() => {
|
|
219
|
-
fetchNotice();
|
|
220
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
221
|
-
}, [org_uuid, workspace_uuid, notice_uuid, language, applicationId]);
|
|
222
|
-
|
|
223
|
-
const togglePurposeCollapse = (purposeUuid: string) => {
|
|
224
|
-
setCollapsedPurposes((prev) => ({
|
|
225
|
-
...prev,
|
|
226
|
-
[purposeUuid]: !prev[purposeUuid],
|
|
227
|
-
}));
|
|
228
|
-
};
|
|
229
|
-
|
|
230
|
-
const handlePurposeCheckboxChange = (purposeUuid: string) => {
|
|
231
|
-
if (content) {
|
|
232
|
-
const purpose = content.purposes.find((p) => p.uuid === purposeUuid);
|
|
233
|
-
if (purpose) {
|
|
234
|
-
const newPurposeState = !selectedPurposes[purposeUuid];
|
|
235
|
-
|
|
236
|
-
// Update purpose state
|
|
237
|
-
setSelectedPurposes((prev) => ({
|
|
238
|
-
...prev,
|
|
239
|
-
[purposeUuid]: newPurposeState,
|
|
240
|
-
}));
|
|
241
|
-
|
|
242
|
-
// Update ALL data elements (including required) when purpose checkbox is toggled
|
|
243
|
-
setSelectedDataElements((prev) => {
|
|
244
|
-
const updated = { ...prev };
|
|
245
|
-
purpose.data_elements.forEach((el) => {
|
|
246
|
-
const combinedId = `${purposeUuid}-${el.uuid}`;
|
|
247
|
-
updated[combinedId] = newPurposeState;
|
|
248
|
-
});
|
|
249
|
-
return updated;
|
|
250
|
-
});
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
};
|
|
254
|
-
|
|
255
|
-
const handleDataElementCheckboxChange = (
|
|
256
|
-
elementUuid: string,
|
|
257
|
-
purposeUuid: string
|
|
258
|
-
) => {
|
|
259
|
-
if (!content) return;
|
|
260
|
-
|
|
261
|
-
const purpose = content.purposes.find((p) => p.uuid === purposeUuid);
|
|
262
|
-
if (!purpose) return;
|
|
263
|
-
|
|
264
|
-
const dataElement = purpose.data_elements.find(
|
|
265
|
-
(el) => el.uuid === elementUuid
|
|
266
|
-
);
|
|
267
|
-
if (!dataElement) return;
|
|
268
|
-
|
|
269
|
-
const combinedId = `${purposeUuid}-${elementUuid}`;
|
|
270
|
-
const currentState = selectedDataElements[combinedId] || false;
|
|
271
|
-
const newElementState = !currentState;
|
|
272
|
-
|
|
273
|
-
// Update data element state
|
|
274
|
-
setSelectedDataElements((prev) => {
|
|
275
|
-
const newState = {
|
|
276
|
-
...prev,
|
|
277
|
-
[combinedId]: newElementState,
|
|
278
|
-
};
|
|
279
|
-
|
|
280
|
-
// Check if all required elements are checked
|
|
281
|
-
const requiredElements = purpose.data_elements.filter(
|
|
282
|
-
(el) => el.required
|
|
283
|
-
);
|
|
284
|
-
|
|
285
|
-
let shouldCheckPurpose: boolean;
|
|
286
|
-
|
|
287
|
-
if (requiredElements.length > 0) {
|
|
288
|
-
// Has required elements: check purpose when all required are selected
|
|
289
|
-
shouldCheckPurpose = requiredElements.every(
|
|
290
|
-
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
291
|
-
);
|
|
292
|
-
} else {
|
|
293
|
-
// No required elements: check purpose when ANY element is selected
|
|
294
|
-
shouldCheckPurpose = purpose.data_elements.some(
|
|
295
|
-
(el) => newState[`${purposeUuid}-${el.uuid}`]
|
|
296
|
-
);
|
|
297
|
-
}
|
|
298
|
-
|
|
299
|
-
setSelectedPurposes((prevPurposes) => ({
|
|
300
|
-
...prevPurposes,
|
|
301
|
-
[purposeUuid]: shouldCheckPurpose,
|
|
302
|
-
}));
|
|
303
|
-
|
|
304
|
-
return newState;
|
|
305
|
-
});
|
|
306
|
-
};
|
|
307
|
-
|
|
308
|
-
const handleAcceptWithToken = useCallback(
|
|
309
|
-
async (tokenToUse: string) => {
|
|
310
|
-
if (!tokenToUse || !content) {
|
|
311
|
-
setErrorMessage("Unable to submit consent. Please try again.");
|
|
312
|
-
throw new Error("Access token or content not available");
|
|
313
|
-
}
|
|
314
|
-
|
|
315
|
-
try {
|
|
316
|
-
setIsSubmitting(true);
|
|
317
|
-
setErrorMessage(null);
|
|
318
|
-
|
|
319
|
-
await submitConsentEvent({
|
|
320
|
-
org_uuid,
|
|
321
|
-
workspace_uuid,
|
|
322
|
-
accessToken: tokenToUse,
|
|
323
|
-
baseUrl,
|
|
324
|
-
ledgerBaseUrl,
|
|
325
|
-
noticeUuid: content.notice_uuid,
|
|
326
|
-
purposes: content.purposes.map((purpose) => {
|
|
327
|
-
// Check if any required data element is selected
|
|
328
|
-
const hasSelectedRequiredElement = purpose.data_elements.some(
|
|
329
|
-
(element) =>
|
|
330
|
-
element.required &&
|
|
331
|
-
(selectedDataElements[`${purpose.uuid}-${element.uuid}`] ||
|
|
332
|
-
false)
|
|
333
|
-
);
|
|
334
|
-
|
|
335
|
-
// Check if any data element is selected
|
|
336
|
-
const hasSelectedDataElement = purpose.data_elements.some(
|
|
337
|
-
(element) =>
|
|
338
|
-
selectedDataElements[`${purpose.uuid}-${element.uuid}`] || false
|
|
339
|
-
);
|
|
340
|
-
|
|
341
|
-
// Purpose is selected if: purpose checkbox is checked OR any required element is selected OR any data element is selected
|
|
342
|
-
const purposeSelected =
|
|
343
|
-
selectedPurposes[purpose.uuid] ||
|
|
344
|
-
hasSelectedRequiredElement ||
|
|
345
|
-
hasSelectedDataElement;
|
|
346
|
-
|
|
347
|
-
return {
|
|
348
|
-
...purpose,
|
|
349
|
-
selected: purposeSelected,
|
|
350
|
-
data_elements: purpose.data_elements.map((element) => ({
|
|
351
|
-
...element,
|
|
352
|
-
selected:
|
|
353
|
-
selectedDataElements[`${purpose.uuid}-${element.uuid}`] ||
|
|
354
|
-
false,
|
|
355
|
-
})),
|
|
356
|
-
};
|
|
357
|
-
}),
|
|
358
|
-
declined: false,
|
|
359
|
-
meta_data: applicationId
|
|
360
|
-
? { specific_uuid: applicationId }
|
|
361
|
-
: undefined,
|
|
362
|
-
});
|
|
363
|
-
|
|
364
|
-
onAccept?.();
|
|
365
|
-
// Reset ref on success to allow re-submission if needed
|
|
366
|
-
hasSubmittedRef.current = false;
|
|
367
|
-
} catch (error) {
|
|
368
|
-
const err = error as Error;
|
|
369
|
-
// The SDK is a passthrough: server-owned message wins. Only the
|
|
370
|
-
// bare-Error fallback is used when no message is present (e.g. a
|
|
371
|
-
// network failure that never produced a Response).
|
|
372
|
-
const message =
|
|
373
|
-
err.message || "Failed to submit consent. Please try again.";
|
|
374
|
-
setErrorMessage(message);
|
|
375
|
-
// Reset ref on error to allow retry
|
|
376
|
-
hasSubmittedRef.current = false;
|
|
377
|
-
throw error;
|
|
378
|
-
} finally {
|
|
379
|
-
setIsSubmitting(false);
|
|
380
|
-
}
|
|
381
|
-
},
|
|
382
|
-
[
|
|
383
|
-
content,
|
|
384
|
-
org_uuid,
|
|
385
|
-
workspace_uuid,
|
|
386
|
-
baseUrl,
|
|
387
|
-
ledgerBaseUrl,
|
|
388
|
-
selectedDataElements,
|
|
389
|
-
selectedPurposes,
|
|
390
|
-
applicationId,
|
|
391
|
-
onAccept,
|
|
392
|
-
]
|
|
393
|
-
);
|
|
394
|
-
|
|
395
|
-
// Auto-submit consent when all conditions are met
|
|
396
|
-
useEffect(() => {
|
|
397
|
-
if (
|
|
398
|
-
accessToken &&
|
|
399
|
-
content &&
|
|
400
|
-
areAllRequiredElementsChecked &&
|
|
401
|
-
!isSubmitting &&
|
|
402
|
-
!hasSubmittedRef.current
|
|
403
|
-
) {
|
|
404
|
-
hasSubmittedRef.current = true;
|
|
405
|
-
const autoSubmit = async () => {
|
|
406
|
-
try {
|
|
407
|
-
await handleAcceptWithToken(accessToken);
|
|
408
|
-
} catch (err) {
|
|
409
|
-
hasSubmittedRef.current = false;
|
|
410
|
-
onError?.(err as Error);
|
|
411
|
-
}
|
|
412
|
-
};
|
|
413
|
-
autoSubmit();
|
|
414
|
-
}
|
|
415
|
-
}, [
|
|
416
|
-
accessToken,
|
|
417
|
-
content,
|
|
418
|
-
areAllRequiredElementsChecked,
|
|
419
|
-
isSubmitting,
|
|
420
|
-
handleAcceptWithToken,
|
|
421
|
-
]);
|
|
422
|
-
|
|
423
|
-
// Reset submission ref when accessToken changes (allows re-submission with new token)
|
|
424
|
-
useEffect(() => {
|
|
425
|
-
if (!accessToken) {
|
|
426
|
-
hasSubmittedRef.current = false;
|
|
427
|
-
}
|
|
428
|
-
}, [accessToken]);
|
|
429
|
-
|
|
430
|
-
const headingStyle = {
|
|
431
|
-
color: settings?.headingColor || "#101828",
|
|
432
|
-
};
|
|
433
|
-
|
|
434
|
-
const textStyle = {
|
|
435
|
-
color: settings?.textColor || "#344054",
|
|
436
|
-
};
|
|
437
|
-
|
|
438
|
-
if (hasAlreadyConsented || fetchError) {
|
|
439
|
-
return null;
|
|
440
|
-
}
|
|
441
|
-
|
|
442
|
-
if (isLoading) {
|
|
443
|
-
return (
|
|
444
|
-
<div style={styles.loadingContainer}>
|
|
445
|
-
<div style={styles.loadingSpinner}></div>
|
|
446
|
-
<p style={{ ...styles.privacyText, ...textStyle }}>Loading...</p>
|
|
447
|
-
</div>
|
|
448
|
-
);
|
|
449
|
-
}
|
|
450
|
-
|
|
451
|
-
if (!content) {
|
|
452
|
-
return null;
|
|
453
|
-
}
|
|
454
|
-
|
|
455
|
-
return (
|
|
456
|
-
<div style={{ display: "flex", flexDirection: "column", gap: "16px" }}>
|
|
457
|
-
{errorMessage && (
|
|
458
|
-
<div
|
|
459
|
-
role="alert"
|
|
460
|
-
style={{
|
|
461
|
-
backgroundColor: "#FEE2E2",
|
|
462
|
-
color: "#DC2626",
|
|
463
|
-
padding: "12px",
|
|
464
|
-
borderRadius: "6px",
|
|
465
|
-
fontSize: "14px",
|
|
466
|
-
border: "1px solid #FCA5A5",
|
|
467
|
-
}}
|
|
468
|
-
>
|
|
469
|
-
{errorMessage}
|
|
470
|
-
</div>
|
|
471
|
-
)}
|
|
472
|
-
|
|
473
|
-
{content?.purposes?.map((purpose) => (
|
|
474
|
-
<div key={purpose.uuid}>
|
|
475
|
-
<div style={styles.optionItem}>
|
|
476
|
-
<div
|
|
477
|
-
style={styles.optionLeft}
|
|
478
|
-
onClick={() => togglePurposeCollapse(purpose.uuid)}
|
|
479
|
-
role="button"
|
|
480
|
-
tabIndex={0}
|
|
481
|
-
aria-expanded={!collapsedPurposes[purpose.uuid]}
|
|
482
|
-
aria-controls={`purpose-${purpose.uuid}`}
|
|
483
|
-
aria-label={`${collapsedPurposes[purpose.uuid] ? "Expand" : "Collapse"} ${getTranslatedText(
|
|
484
|
-
`purposes.name`,
|
|
485
|
-
purpose.name,
|
|
486
|
-
purpose.uuid
|
|
487
|
-
)} details`}
|
|
488
|
-
onKeyDown={(e) => {
|
|
489
|
-
if (e.key === "Enter" || e.key === " ") {
|
|
490
|
-
e.preventDefault();
|
|
491
|
-
togglePurposeCollapse(purpose.uuid);
|
|
492
|
-
}
|
|
493
|
-
}}
|
|
494
|
-
>
|
|
495
|
-
<div
|
|
496
|
-
style={{
|
|
497
|
-
display: "flex",
|
|
498
|
-
alignItems: "center",
|
|
499
|
-
justifyContent: "center",
|
|
500
|
-
marginLeft: "5px",
|
|
501
|
-
}}
|
|
502
|
-
>
|
|
503
|
-
<svg
|
|
504
|
-
width="7"
|
|
505
|
-
height="12"
|
|
506
|
-
viewBox="0 0 7 12"
|
|
507
|
-
fill="none"
|
|
508
|
-
xmlns="http://www.w3.org/2000/svg"
|
|
509
|
-
stroke={settings?.headingColor || "#323B4B"}
|
|
510
|
-
strokeWidth="2"
|
|
511
|
-
strokeLinecap="round"
|
|
512
|
-
strokeLinejoin="round"
|
|
513
|
-
style={{
|
|
514
|
-
transform: !collapsedPurposes[purpose.uuid]
|
|
515
|
-
? "rotate(90deg)"
|
|
516
|
-
: "rotate(0deg)",
|
|
517
|
-
transition: "transform 0.3s ease",
|
|
518
|
-
}}
|
|
519
|
-
aria-hidden="true"
|
|
520
|
-
>
|
|
521
|
-
<path d="M1 1L6 6L1 11" />
|
|
522
|
-
</svg>
|
|
523
|
-
</div>
|
|
524
|
-
<div style={styles.optionTextContainer}>
|
|
525
|
-
<h2
|
|
526
|
-
style={{
|
|
527
|
-
...styles.optionTitle,
|
|
528
|
-
...responsiveStyles.optionTitle,
|
|
529
|
-
...headingStyle,
|
|
530
|
-
}}
|
|
531
|
-
>
|
|
532
|
-
{getTranslatedText(
|
|
533
|
-
`purposes.name`,
|
|
534
|
-
purpose.name,
|
|
535
|
-
purpose.uuid
|
|
536
|
-
)}
|
|
537
|
-
</h2>
|
|
538
|
-
<h3
|
|
539
|
-
style={{
|
|
540
|
-
...styles.optionDescription,
|
|
541
|
-
...responsiveStyles.optionDescription,
|
|
542
|
-
...textStyle,
|
|
543
|
-
}}
|
|
544
|
-
>
|
|
545
|
-
{getTranslatedText(
|
|
546
|
-
`purposes.description`,
|
|
547
|
-
purpose.description,
|
|
548
|
-
purpose.uuid
|
|
549
|
-
)}
|
|
550
|
-
</h3>
|
|
551
|
-
</div>
|
|
552
|
-
</div>
|
|
553
|
-
<input
|
|
554
|
-
type="checkbox"
|
|
555
|
-
checked={selectedPurposes[purpose.uuid] || false}
|
|
556
|
-
onChange={() => handlePurposeCheckboxChange(purpose.uuid)}
|
|
557
|
-
aria-label={`Select all data elements for ${getTranslatedText(
|
|
558
|
-
`purposes.name`,
|
|
559
|
-
purpose.name,
|
|
560
|
-
purpose.uuid
|
|
561
|
-
)}`}
|
|
562
|
-
/>
|
|
563
|
-
</div>
|
|
564
|
-
{!collapsedPurposes[purpose.uuid] &&
|
|
565
|
-
purpose.data_elements &&
|
|
566
|
-
purpose.data_elements.length > 0 && (
|
|
567
|
-
<div
|
|
568
|
-
id={`purpose-${purpose.uuid}`}
|
|
569
|
-
style={styles.dataElementsContainer}
|
|
570
|
-
>
|
|
571
|
-
{purpose.data_elements.map((dataElement) => (
|
|
572
|
-
<div key={dataElement.uuid} style={styles.dataElementItem}>
|
|
573
|
-
<span
|
|
574
|
-
style={{
|
|
575
|
-
...styles.dataElementText,
|
|
576
|
-
...responsiveStyles.dataElementText,
|
|
577
|
-
...textStyle,
|
|
578
|
-
}}
|
|
579
|
-
>
|
|
580
|
-
{getTranslatedText(
|
|
581
|
-
`data_elements.name`,
|
|
582
|
-
dataElement.name,
|
|
583
|
-
dataElement.uuid
|
|
584
|
-
)}
|
|
585
|
-
{dataElement.required && (
|
|
586
|
-
<span
|
|
587
|
-
style={{
|
|
588
|
-
color: "red",
|
|
589
|
-
marginLeft: "4px",
|
|
590
|
-
}}
|
|
591
|
-
aria-label="required"
|
|
592
|
-
>
|
|
593
|
-
*
|
|
594
|
-
</span>
|
|
595
|
-
)}
|
|
596
|
-
</span>
|
|
597
|
-
<input
|
|
598
|
-
type="checkbox"
|
|
599
|
-
checked={
|
|
600
|
-
selectedDataElements[
|
|
601
|
-
`${purpose.uuid}-${dataElement.uuid}`
|
|
602
|
-
] || false
|
|
603
|
-
}
|
|
604
|
-
onChange={() =>
|
|
605
|
-
handleDataElementCheckboxChange(
|
|
606
|
-
dataElement.uuid,
|
|
607
|
-
purpose.uuid
|
|
608
|
-
)
|
|
609
|
-
}
|
|
610
|
-
aria-label={`Select ${getTranslatedText(
|
|
611
|
-
`data_elements.name`,
|
|
612
|
-
dataElement.name,
|
|
613
|
-
dataElement.uuid
|
|
614
|
-
)}${dataElement.required ? " (required)" : ""}`}
|
|
615
|
-
/>
|
|
616
|
-
</div>
|
|
617
|
-
))}
|
|
618
|
-
</div>
|
|
619
|
-
)}
|
|
620
|
-
</div>
|
|
621
|
-
))}
|
|
622
|
-
</div>
|
|
623
|
-
);
|
|
624
|
-
};
|
|
625
|
-
|
|
626
|
-
RedactoConsentInlineComponent.displayName = "RedactoConsentInline";
|
|
627
|
-
|
|
628
|
-
// Memoize the component to prevent unnecessary re-renders when props haven't changed
|
|
629
|
-
export const RedactoConsentInline = memo(RedactoConsentInlineComponent);
|