@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
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,23 @@
|
|
|
1
1
|
import {
|
|
2
|
+
SANDBOX_TOKEN_HEADER,
|
|
2
3
|
useMediaQuery
|
|
3
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-OGL6OC3A.mjs";
|
|
5
|
+
import {
|
|
6
|
+
FONT_FAMILY_SEPARATOR,
|
|
7
|
+
FONT_NAME_QUOTE_CHARACTERS,
|
|
8
|
+
NOTICE_FONT_ENTRY_BY_ID,
|
|
9
|
+
NOTICE_FONT_FACE_STYLE_ID_PREFIX,
|
|
10
|
+
NOTICE_FONT_LOAD_ERROR_MESSAGE,
|
|
11
|
+
NOTICE_FONT_ROOT_PROPS,
|
|
12
|
+
injectNoticeFontStyles,
|
|
13
|
+
resolveNoticeFontFamily
|
|
14
|
+
} from "./chunk-FEGTW73Q.mjs";
|
|
4
15
|
|
|
5
16
|
// src/RedactoNoticeConsent/RedactoNoticeConsent.tsx
|
|
6
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
|
+
import { useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef, useState } from "react";
|
|
7
18
|
|
|
8
19
|
// src/RedactoNoticeConsent/api/index.ts
|
|
9
|
-
import { jwtDecode } from "jwt-decode";
|
|
20
|
+
import { jwtDecode as jwtDecode2 } from "jwt-decode";
|
|
10
21
|
|
|
11
22
|
// src/shared/api-errors.ts
|
|
12
23
|
var ApiError = class extends Error {
|
|
@@ -66,6 +77,141 @@ async function parseApiError(response, fallbackMessage) {
|
|
|
66
77
|
});
|
|
67
78
|
}
|
|
68
79
|
|
|
80
|
+
// src/RedactoNoticeConsent/api/sandbox.ts
|
|
81
|
+
var resolveSandboxAuth = (params) => {
|
|
82
|
+
var _a, _b, _c, _d, _e;
|
|
83
|
+
const token = (_a = params.token) == null ? void 0 : _a.trim();
|
|
84
|
+
if (!token) {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
const organisationUuid = (_b = params.organisationUuid) == null ? void 0 : _b.trim();
|
|
88
|
+
const workspaceUuid = (_c = params.workspaceUuid) == null ? void 0 : _c.trim();
|
|
89
|
+
const ucic = (_d = params.sandboxUcic) == null ? void 0 : _d.trim();
|
|
90
|
+
const subject = (_e = params.sandboxSubject) == null ? void 0 : _e.trim();
|
|
91
|
+
if (!organisationUuid || !workspaceUuid) {
|
|
92
|
+
throw new Error(
|
|
93
|
+
"Sandbox mode requires organisationUuid and workspaceUuid props"
|
|
94
|
+
);
|
|
95
|
+
}
|
|
96
|
+
if (!ucic && !subject) {
|
|
97
|
+
throw new Error("Sandbox mode requires a UCIC, email, or mobile");
|
|
98
|
+
}
|
|
99
|
+
return { token, ucic, subject: subject != null ? subject : "", organisationUuid, workspaceUuid };
|
|
100
|
+
};
|
|
101
|
+
var resolveRequestAuth = (accessToken, sandboxParams, decodeTokenSafely2) => {
|
|
102
|
+
const sandbox = resolveSandboxAuth(sandboxParams);
|
|
103
|
+
if (sandbox) {
|
|
104
|
+
return {
|
|
105
|
+
organisationUuid: sandbox.organisationUuid,
|
|
106
|
+
workspaceUuid: sandbox.workspaceUuid,
|
|
107
|
+
sandbox
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
const decodedToken = accessToken ? decodeTokenSafely2(accessToken) : null;
|
|
111
|
+
if (!decodedToken) {
|
|
112
|
+
throw new Error("Invalid access token");
|
|
113
|
+
}
|
|
114
|
+
const { organisation_uuid, workspace_uuid } = decodedToken;
|
|
115
|
+
if (!organisation_uuid || !workspace_uuid) {
|
|
116
|
+
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
117
|
+
}
|
|
118
|
+
return {
|
|
119
|
+
organisationUuid: organisation_uuid,
|
|
120
|
+
workspaceUuid: workspace_uuid,
|
|
121
|
+
sandbox: null
|
|
122
|
+
};
|
|
123
|
+
};
|
|
124
|
+
var buildAuthHeaders = (accessToken, sandbox) => {
|
|
125
|
+
if (sandbox) {
|
|
126
|
+
return { [SANDBOX_TOKEN_HEADER]: sandbox.token };
|
|
127
|
+
}
|
|
128
|
+
return { Authorization: `Bearer ${accessToken}` };
|
|
129
|
+
};
|
|
130
|
+
var sandboxBodyIdentity = (sandbox) => {
|
|
131
|
+
if (sandbox.ucic) {
|
|
132
|
+
return { org_user_id: sandbox.ucic };
|
|
133
|
+
}
|
|
134
|
+
return sandbox.subject.includes("@") ? { primary_email: sandbox.subject } : { primary_mobile: sandbox.subject };
|
|
135
|
+
};
|
|
136
|
+
var sandboxQueryIdentity = (sandbox) => sandboxBodyIdentity(sandbox);
|
|
137
|
+
|
|
138
|
+
// src/shared/notice-consent-status.ts
|
|
139
|
+
import { jwtDecode } from "jwt-decode";
|
|
140
|
+
var decodeNoticeConsentToken = (token) => {
|
|
141
|
+
try {
|
|
142
|
+
return jwtDecode(token);
|
|
143
|
+
} catch {
|
|
144
|
+
return null;
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
var fetchNoticeConsentStatusForScope = async ({
|
|
148
|
+
accessToken,
|
|
149
|
+
ledgerBaseUrl,
|
|
150
|
+
organisationUuid,
|
|
151
|
+
workspaceUuid,
|
|
152
|
+
noticeUuid,
|
|
153
|
+
signal
|
|
154
|
+
}) => {
|
|
155
|
+
if (!accessToken || !ledgerBaseUrl || !organisationUuid || !workspaceUuid || !noticeUuid) {
|
|
156
|
+
return null;
|
|
157
|
+
}
|
|
158
|
+
try {
|
|
159
|
+
const response = await fetch(
|
|
160
|
+
`${ledgerBaseUrl}/public/organisations/${organisationUuid}/workspaces/${workspaceUuid}/notices/${noticeUuid}/check-consent`,
|
|
161
|
+
{
|
|
162
|
+
method: "POST",
|
|
163
|
+
headers: {
|
|
164
|
+
Authorization: `Bearer ${accessToken}`,
|
|
165
|
+
"Content-Type": "application/json"
|
|
166
|
+
},
|
|
167
|
+
body: "{}",
|
|
168
|
+
signal
|
|
169
|
+
}
|
|
170
|
+
);
|
|
171
|
+
if (!response.ok) {
|
|
172
|
+
return null;
|
|
173
|
+
}
|
|
174
|
+
const data = await response.json();
|
|
175
|
+
const body = data && typeof data === "object" && "detail" in data && data.detail ? data.detail : data;
|
|
176
|
+
if (!body || !Array.isArray(body.purposes)) {
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
return body;
|
|
180
|
+
} catch {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
183
|
+
};
|
|
184
|
+
var fetchNoticeConsentStatus = async ({
|
|
185
|
+
accessToken,
|
|
186
|
+
ledgerBaseUrl,
|
|
187
|
+
noticeUuid,
|
|
188
|
+
signal
|
|
189
|
+
}) => {
|
|
190
|
+
if (!accessToken || !ledgerBaseUrl || !noticeUuid) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
const decodedToken = decodeNoticeConsentToken(accessToken);
|
|
194
|
+
if (!decodedToken) {
|
|
195
|
+
return null;
|
|
196
|
+
}
|
|
197
|
+
const {
|
|
198
|
+
organisation_uuid: ORGANISATION_UUID,
|
|
199
|
+
workspace_uuid: WORKSPACE_UUID
|
|
200
|
+
} = decodedToken;
|
|
201
|
+
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
202
|
+
return null;
|
|
203
|
+
}
|
|
204
|
+
return fetchNoticeConsentStatusForScope({
|
|
205
|
+
accessToken,
|
|
206
|
+
ledgerBaseUrl,
|
|
207
|
+
organisationUuid: ORGANISATION_UUID,
|
|
208
|
+
workspaceUuid: WORKSPACE_UUID,
|
|
209
|
+
noticeUuid,
|
|
210
|
+
signal
|
|
211
|
+
});
|
|
212
|
+
};
|
|
213
|
+
var isNoticeFullyConsented = (status) => status.consented && status.all_mandatory_active;
|
|
214
|
+
|
|
69
215
|
// src/RedactoNoticeConsent/api/index.ts
|
|
70
216
|
var BASE_URL = "https://api.redacto.io/consent";
|
|
71
217
|
var apiCache = /* @__PURE__ */ new Map();
|
|
@@ -85,7 +231,7 @@ function setCachedData(key, data, ttl = CACHE_TTL) {
|
|
|
85
231
|
}
|
|
86
232
|
function decodeTokenSafely(token) {
|
|
87
233
|
try {
|
|
88
|
-
return
|
|
234
|
+
return jwtDecode2(token);
|
|
89
235
|
} catch (error) {
|
|
90
236
|
console.warn("Failed to decode JWT token:", error);
|
|
91
237
|
return null;
|
|
@@ -102,21 +248,19 @@ var fetchConsentContent = async ({
|
|
|
102
248
|
specific_uuid,
|
|
103
249
|
validate_against = "all",
|
|
104
250
|
include_fully_consented_data = false,
|
|
105
|
-
signal
|
|
251
|
+
signal,
|
|
252
|
+
...sandboxParams
|
|
106
253
|
}) => {
|
|
107
|
-
if (!noticeId || !
|
|
108
|
-
throw new Error("noticeId
|
|
109
|
-
}
|
|
110
|
-
const decodedToken = decodeTokenSafely(accessToken);
|
|
111
|
-
if (!decodedToken) {
|
|
112
|
-
throw new Error("Invalid access token");
|
|
254
|
+
if (!noticeId || !validate_against) {
|
|
255
|
+
throw new Error("noticeId is required");
|
|
113
256
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
257
|
+
if (!accessToken && !sandboxParams.token) {
|
|
258
|
+
throw new Error("accessToken or token is required");
|
|
117
259
|
}
|
|
260
|
+
const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
|
|
118
261
|
const apiBaseUrl = baseUrl || BASE_URL;
|
|
119
|
-
const
|
|
262
|
+
const cacheIdentity = sandbox ? `sandbox:${sandbox.organisationUuid}:${sandbox.workspaceUuid}:${sandbox.ucic || sandbox.subject}` : accessToken;
|
|
263
|
+
const cacheKey = `${cacheIdentity}-${noticeId}-${validate_against}-${language}-${specific_uuid || ""}-${include_fully_consented_data}`;
|
|
120
264
|
if (validate_against === "all" && !specific_uuid) {
|
|
121
265
|
const cachedData = getCachedData(cacheKey);
|
|
122
266
|
if (cachedData) {
|
|
@@ -133,10 +277,15 @@ var fetchConsentContent = async ({
|
|
|
133
277
|
if (include_fully_consented_data) {
|
|
134
278
|
url.searchParams.append("include_fully_consented_data", "true");
|
|
135
279
|
}
|
|
280
|
+
if (sandbox) {
|
|
281
|
+
for (const [key, value] of Object.entries(sandboxQueryIdentity(sandbox))) {
|
|
282
|
+
url.searchParams.append(key, value);
|
|
283
|
+
}
|
|
284
|
+
}
|
|
136
285
|
const response = await fetch(url.toString(), {
|
|
137
286
|
method: "GET",
|
|
138
287
|
headers: {
|
|
139
|
-
|
|
288
|
+
...buildAuthHeaders(accessToken, sandbox),
|
|
140
289
|
"Accept-Language": language
|
|
141
290
|
},
|
|
142
291
|
signal
|
|
@@ -164,20 +313,17 @@ var submitConsentEvent = async ({
|
|
|
164
313
|
meta_data,
|
|
165
314
|
guardianVerificationReference,
|
|
166
315
|
selfDeclaredAdult,
|
|
167
|
-
signal
|
|
316
|
+
signal,
|
|
317
|
+
...sandboxParams
|
|
168
318
|
}) => {
|
|
169
|
-
if (!noticeUuid || !
|
|
170
|
-
throw new Error("noticeUuid
|
|
171
|
-
}
|
|
172
|
-
const decodedToken = decodeTokenSafely(accessToken);
|
|
173
|
-
if (!decodedToken) {
|
|
174
|
-
throw new Error("Invalid access token");
|
|
319
|
+
if (!noticeUuid || !Array.isArray(purposes)) {
|
|
320
|
+
throw new Error("noticeUuid and purposes array are required");
|
|
175
321
|
}
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
322
|
+
if (!accessToken && !sandboxParams.token) {
|
|
323
|
+
throw new Error("accessToken or token is required");
|
|
179
324
|
}
|
|
180
|
-
const
|
|
325
|
+
const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
|
|
326
|
+
const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || BASE_URL;
|
|
181
327
|
const validatedPurposes = purposes.map((purpose) => {
|
|
182
328
|
if (!purpose.uuid) {
|
|
183
329
|
throw new Error(`Invalid purpose data: missing uuid`);
|
|
@@ -203,15 +349,16 @@ var submitConsentEvent = async ({
|
|
|
203
349
|
guardian_verification_reference: guardianVerificationReference,
|
|
204
350
|
self_declared_adult: selfDeclaredAdult
|
|
205
351
|
};
|
|
352
|
+
const requestBody = sandbox ? { ...payload, ...sandboxBodyIdentity(sandbox) } : payload;
|
|
206
353
|
const response = await fetch(
|
|
207
354
|
`${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/submit-consent`,
|
|
208
355
|
{
|
|
209
356
|
method: "POST",
|
|
210
357
|
headers: {
|
|
211
|
-
|
|
358
|
+
...buildAuthHeaders(accessToken, sandbox),
|
|
212
359
|
"Content-Type": "application/json"
|
|
213
360
|
},
|
|
214
|
-
body: JSON.stringify(
|
|
361
|
+
body: JSON.stringify(requestBody),
|
|
215
362
|
signal
|
|
216
363
|
}
|
|
217
364
|
);
|
|
@@ -223,112 +370,32 @@ var submitConsentEvent = async ({
|
|
|
223
370
|
}
|
|
224
371
|
apiCache.clear();
|
|
225
372
|
};
|
|
226
|
-
var fetchNoticeConsentStatus = async ({
|
|
227
|
-
accessToken,
|
|
228
|
-
ledgerBaseUrl,
|
|
229
|
-
noticeUuid,
|
|
230
|
-
signal
|
|
231
|
-
}) => {
|
|
232
|
-
if (!accessToken || !ledgerBaseUrl || !noticeUuid) {
|
|
233
|
-
return null;
|
|
234
|
-
}
|
|
235
|
-
const decodedToken = decodeTokenSafely(accessToken);
|
|
236
|
-
if (!decodedToken) {
|
|
237
|
-
return null;
|
|
238
|
-
}
|
|
239
|
-
const { organisation_uuid: ORGANISATION_UUID, workspace_uuid: WORKSPACE_UUID } = decodedToken;
|
|
240
|
-
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
241
|
-
return null;
|
|
242
|
-
}
|
|
243
|
-
try {
|
|
244
|
-
const response = await fetch(
|
|
245
|
-
`${ledgerBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/check-consent`,
|
|
246
|
-
{
|
|
247
|
-
method: "POST",
|
|
248
|
-
headers: {
|
|
249
|
-
Authorization: `Bearer ${accessToken}`,
|
|
250
|
-
"Content-Type": "application/json"
|
|
251
|
-
},
|
|
252
|
-
body: "{}",
|
|
253
|
-
signal
|
|
254
|
-
}
|
|
255
|
-
);
|
|
256
|
-
if (!response.ok) {
|
|
257
|
-
return null;
|
|
258
|
-
}
|
|
259
|
-
const data = await response.json();
|
|
260
|
-
const body = data && typeof data === "object" && "detail" in data && data.detail ? data.detail : data;
|
|
261
|
-
if (!body || !Array.isArray(body.purposes)) {
|
|
262
|
-
return null;
|
|
263
|
-
}
|
|
264
|
-
return body;
|
|
265
|
-
} catch {
|
|
266
|
-
return null;
|
|
267
|
-
}
|
|
268
|
-
};
|
|
269
|
-
var buildLedgerConsentOverlay = (status, configPurposes) => {
|
|
270
|
-
var _a, _b;
|
|
271
|
-
const byUuid = new Map(status.purposes.map((p) => [p.uuid, p]));
|
|
272
|
-
const hasHistory = status.purposes.some(
|
|
273
|
-
(p) => (p.status || "INACTIVE") !== "INACTIVE"
|
|
274
|
-
);
|
|
275
|
-
if (!hasHistory) {
|
|
276
|
-
return null;
|
|
277
|
-
}
|
|
278
|
-
const purpose_selections = {};
|
|
279
|
-
for (const cp of configPurposes) {
|
|
280
|
-
const lp = byUuid.get(cp.uuid);
|
|
281
|
-
const purposeStatus = (lp == null ? void 0 : lp.status) || "INACTIVE";
|
|
282
|
-
const selectedByUuid = new Map(
|
|
283
|
-
((lp == null ? void 0 : lp.data_elements) || []).map((de) => [de.uuid, de.selected])
|
|
284
|
-
);
|
|
285
|
-
const data_elements = {};
|
|
286
|
-
for (const de of cp.data_elements) {
|
|
287
|
-
data_elements[de.uuid] = {
|
|
288
|
-
selected: (_a = selectedByUuid.get(de.uuid)) != null ? _a : false,
|
|
289
|
-
enabled: de.enabled,
|
|
290
|
-
required: de.required
|
|
291
|
-
};
|
|
292
|
-
}
|
|
293
|
-
purpose_selections[cp.uuid] = {
|
|
294
|
-
selected: (_b = lp == null ? void 0 : lp.selected) != null ? _b : false,
|
|
295
|
-
status: purposeStatus,
|
|
296
|
-
needs_reconsent: purposeStatus !== "ACTIVE",
|
|
297
|
-
data_elements
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
const reconsent_required = configPurposes.some(
|
|
301
|
-
(cp) => {
|
|
302
|
-
var _a2;
|
|
303
|
-
return (((_a2 = purpose_selections[cp.uuid]) == null ? void 0 : _a2.status) || "INACTIVE") !== "ACTIVE";
|
|
304
|
-
}
|
|
305
|
-
);
|
|
306
|
-
return { reconsent_required, purpose_selections };
|
|
307
|
-
};
|
|
308
373
|
var fetchTTSAudioUrls = async ({
|
|
309
374
|
accessToken,
|
|
310
375
|
baseUrl,
|
|
376
|
+
ledgerBaseUrl,
|
|
311
377
|
noticeUuid,
|
|
312
378
|
language,
|
|
313
|
-
signal
|
|
379
|
+
signal,
|
|
380
|
+
...sandboxParams
|
|
314
381
|
}) => {
|
|
315
|
-
if (!accessToken || !noticeUuid || !language) {
|
|
316
|
-
throw new Error("accessToken, noticeUuid, and language are required");
|
|
317
|
-
}
|
|
318
|
-
const decodedToken = decodeTokenSafely(accessToken);
|
|
319
|
-
if (!decodedToken) {
|
|
320
|
-
throw new Error("Invalid access token");
|
|
382
|
+
if (!accessToken && !sandboxParams.token || !noticeUuid || !language) {
|
|
383
|
+
throw new Error("accessToken (or token), noticeUuid, and language are required");
|
|
321
384
|
}
|
|
322
|
-
const {
|
|
323
|
-
|
|
324
|
-
|
|
385
|
+
const { organisationUuid: ORGANISATION_UUID, workspaceUuid: WORKSPACE_UUID, sandbox } = resolveRequestAuth(accessToken, sandboxParams, decodeTokenSafely);
|
|
386
|
+
const apiBaseUrl = (sandbox ? null : ledgerBaseUrl) || baseUrl || BASE_URL;
|
|
387
|
+
const url = new URL(
|
|
388
|
+
`${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${language}`
|
|
389
|
+
);
|
|
390
|
+
if (sandbox) {
|
|
391
|
+
for (const [key, value] of Object.entries(sandboxQueryIdentity(sandbox))) {
|
|
392
|
+
url.searchParams.append(key, value);
|
|
393
|
+
}
|
|
325
394
|
}
|
|
326
|
-
const
|
|
327
|
-
const url = `${apiBaseUrl}/public/organisations/${ORGANISATION_UUID}/workspaces/${WORKSPACE_UUID}/notices/${noticeUuid}/audio/${language}`;
|
|
328
|
-
const response = await fetch(url, {
|
|
395
|
+
const response = await fetch(url.toString(), {
|
|
329
396
|
method: "GET",
|
|
330
397
|
headers: {
|
|
331
|
-
|
|
398
|
+
...buildAuthHeaders(accessToken, sandbox),
|
|
332
399
|
Accept: "application/json"
|
|
333
400
|
},
|
|
334
401
|
signal
|
|
@@ -370,7 +437,10 @@ var initiateGuardianVerification = async ({
|
|
|
370
437
|
if (!decodedToken) {
|
|
371
438
|
throw new Error("Invalid access token");
|
|
372
439
|
}
|
|
373
|
-
const {
|
|
440
|
+
const {
|
|
441
|
+
organisation_uuid: ORGANISATION_UUID,
|
|
442
|
+
workspace_uuid: WORKSPACE_UUID
|
|
443
|
+
} = decodedToken;
|
|
374
444
|
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
375
445
|
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
376
446
|
}
|
|
@@ -444,7 +514,10 @@ var verifyGuardianStatus = async ({
|
|
|
444
514
|
if (!decodedToken) {
|
|
445
515
|
throw new Error("Invalid access token");
|
|
446
516
|
}
|
|
447
|
-
const {
|
|
517
|
+
const {
|
|
518
|
+
organisation_uuid: ORGANISATION_UUID,
|
|
519
|
+
workspace_uuid: WORKSPACE_UUID
|
|
520
|
+
} = decodedToken;
|
|
448
521
|
if (!ORGANISATION_UUID || !WORKSPACE_UUID) {
|
|
449
522
|
throw new Error("Invalid token: missing organization or workspace UUID");
|
|
450
523
|
}
|
|
@@ -457,9 +530,7 @@ var verifyGuardianStatus = async ({
|
|
|
457
530
|
Authorization: `Bearer ${accessToken}`,
|
|
458
531
|
"Content-Type": "application/json"
|
|
459
532
|
},
|
|
460
|
-
body: JSON.stringify({
|
|
461
|
-
session_token: sessionToken
|
|
462
|
-
}),
|
|
533
|
+
body: JSON.stringify({ session_token: sessionToken }),
|
|
463
534
|
signal
|
|
464
535
|
}
|
|
465
536
|
);
|
|
@@ -502,7 +573,6 @@ var LANGUAGE_NATIVE_LABELS = {
|
|
|
502
573
|
English: "English",
|
|
503
574
|
Assamese: "\u0985\u09B8\u09AE\u09C0\u09AF\u09BC\u09BE (Assamese)",
|
|
504
575
|
Bengali: "\u09AC\u09BE\u0982\u09B2\u09BE (Bengali)",
|
|
505
|
-
Bhojpuri: "\u092D\u094B\u091C\u092A\u0941\u0930\u0940 (Bhojpuri)",
|
|
506
576
|
Bodo: "\u092C\u0921\u093C\u094B (Bodo)",
|
|
507
577
|
Dogri: "\u0921\u094B\u0917\u0930\u0940 (Dogri)",
|
|
508
578
|
Gujarati: "\u0A97\u0AC1\u0A9C\u0AB0\u0ABE\u0AA4\u0AC0 (Gujarati)",
|
|
@@ -532,7 +602,6 @@ var LANGUAGE_NAME_TO_BCP47 = {
|
|
|
532
602
|
English: "en",
|
|
533
603
|
Assamese: "as",
|
|
534
604
|
Bengali: "bn",
|
|
535
|
-
Bhojpuri: "bho",
|
|
536
605
|
Bodo: "brx",
|
|
537
606
|
Dogri: "doi",
|
|
538
607
|
Gujarati: "gu",
|
|
@@ -720,6 +789,123 @@ var injectCheckboxStyles = () => {
|
|
|
720
789
|
stylesInjected = true;
|
|
721
790
|
};
|
|
722
791
|
|
|
792
|
+
// src/shared/useNoticeFont.ts
|
|
793
|
+
import { useEffect, useMemo } from "react";
|
|
794
|
+
|
|
795
|
+
// src/shared/fonts/font-sources.generated.ts
|
|
796
|
+
var NOTICE_FONT_SOURCE_IMPORTS = {
|
|
797
|
+
"montserrat": () => import("./montserrat.generated-NBTECYRW.mjs")
|
|
798
|
+
};
|
|
799
|
+
|
|
800
|
+
// src/shared/notice-webfont.ts
|
|
801
|
+
var noticeFontOptions = {};
|
|
802
|
+
var configureNoticeFonts = (options) => {
|
|
803
|
+
noticeFontOptions = { ...noticeFontOptions, ...options };
|
|
804
|
+
};
|
|
805
|
+
var toFamilyTokens = (value) => value.split(FONT_FAMILY_SEPARATOR).map(
|
|
806
|
+
(token) => token.trim().replace(FONT_NAME_QUOTE_CHARACTERS, "").toLowerCase()
|
|
807
|
+
);
|
|
808
|
+
var findNoticeFontEntry = (value) => {
|
|
809
|
+
const id = toFamilyTokens(value).find(
|
|
810
|
+
(token) => Boolean(NOTICE_FONT_ENTRY_BY_ID[token])
|
|
811
|
+
);
|
|
812
|
+
if (!id) {
|
|
813
|
+
return void 0;
|
|
814
|
+
}
|
|
815
|
+
return NOTICE_FONT_ENTRY_BY_ID[id];
|
|
816
|
+
};
|
|
817
|
+
var toFontFaceCss = (entry, sources) => sources.map(
|
|
818
|
+
({ weight, url }) => [
|
|
819
|
+
"@font-face {",
|
|
820
|
+
` font-family: "${entry.cssFamily}";`,
|
|
821
|
+
" font-style: normal;",
|
|
822
|
+
` font-weight: ${weight};`,
|
|
823
|
+
// `swap`, never the `auto` default: auto gives most browsers a ~3s block
|
|
824
|
+
// period with INVISIBLE text, which is unacceptable for a consent notice.
|
|
825
|
+
" font-display: swap;",
|
|
826
|
+
// `local()` still leads: the bundled copy is Latin + Latin-Extended only,
|
|
827
|
+
// so a visitor's own installation covers more scripts than ours does.
|
|
828
|
+
` src: local("${entry.cssFamily}"),`,
|
|
829
|
+
// Quoted url(): a data URI carries `,` and `;`, which are hostile to an
|
|
830
|
+
// unquoted url token. Base64 never contains a double quote.
|
|
831
|
+
` url("${url}") format("woff2");`,
|
|
832
|
+
"}"
|
|
833
|
+
].join("\n")
|
|
834
|
+
).join("\n\n");
|
|
835
|
+
var fontSourceLoads = /* @__PURE__ */ new Map();
|
|
836
|
+
var loadFontSources = (entry, importSources) => {
|
|
837
|
+
const pending = fontSourceLoads.get(entry.id);
|
|
838
|
+
if (pending) {
|
|
839
|
+
return pending;
|
|
840
|
+
}
|
|
841
|
+
const load = importSources().then((module) => module.NOTICE_FONT_SOURCES).catch((error) => {
|
|
842
|
+
fontSourceLoads.delete(entry.id);
|
|
843
|
+
throw error;
|
|
844
|
+
});
|
|
845
|
+
fontSourceLoads.set(entry.id, load);
|
|
846
|
+
return load;
|
|
847
|
+
};
|
|
848
|
+
var injectedFontFaceIds = /* @__PURE__ */ new Set();
|
|
849
|
+
var injectFontFace = (entry, sources) => {
|
|
850
|
+
if (injectedFontFaceIds.has(entry.id)) {
|
|
851
|
+
return;
|
|
852
|
+
}
|
|
853
|
+
injectedFontFaceIds.add(entry.id);
|
|
854
|
+
const styleId = `${NOTICE_FONT_FACE_STYLE_ID_PREFIX}${entry.slug}`;
|
|
855
|
+
if (document.getElementById(styleId)) {
|
|
856
|
+
return;
|
|
857
|
+
}
|
|
858
|
+
const style = document.createElement("style");
|
|
859
|
+
style.id = styleId;
|
|
860
|
+
style.textContent = toFontFaceCss(entry, sources);
|
|
861
|
+
document.head.appendChild(style);
|
|
862
|
+
};
|
|
863
|
+
var loadNoticeWebfont = async (value, signal) => {
|
|
864
|
+
if (typeof document === "undefined" || noticeFontOptions.disabled) {
|
|
865
|
+
return;
|
|
866
|
+
}
|
|
867
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
868
|
+
return;
|
|
869
|
+
}
|
|
870
|
+
const entry = findNoticeFontEntry(value);
|
|
871
|
+
if (!entry || entry.source !== "webfont" || injectedFontFaceIds.has(entry.id)) {
|
|
872
|
+
return;
|
|
873
|
+
}
|
|
874
|
+
const importSources = NOTICE_FONT_SOURCE_IMPORTS[entry.slug];
|
|
875
|
+
if (!importSources) {
|
|
876
|
+
return;
|
|
877
|
+
}
|
|
878
|
+
try {
|
|
879
|
+
const sources = await loadFontSources(entry, importSources);
|
|
880
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
881
|
+
return;
|
|
882
|
+
}
|
|
883
|
+
injectFontFace(entry, sources);
|
|
884
|
+
} catch (error) {
|
|
885
|
+
console.error(NOTICE_FONT_LOAD_ERROR_MESSAGE, error);
|
|
886
|
+
}
|
|
887
|
+
};
|
|
888
|
+
|
|
889
|
+
// src/shared/useNoticeFont.ts
|
|
890
|
+
var useNoticeFont = ({
|
|
891
|
+
hostFont,
|
|
892
|
+
noticeFont
|
|
893
|
+
}) => {
|
|
894
|
+
const fontFamily = useMemo(
|
|
895
|
+
() => resolveNoticeFontFamily({ hostFont, noticeFont }),
|
|
896
|
+
[hostFont, noticeFont]
|
|
897
|
+
);
|
|
898
|
+
useEffect(() => {
|
|
899
|
+
injectNoticeFontStyles();
|
|
900
|
+
}, []);
|
|
901
|
+
useEffect(() => {
|
|
902
|
+
const controller = new AbortController();
|
|
903
|
+
void loadNoticeWebfont(fontFamily, controller.signal);
|
|
904
|
+
return () => controller.abort();
|
|
905
|
+
}, [fontFamily]);
|
|
906
|
+
return fontFamily;
|
|
907
|
+
};
|
|
908
|
+
|
|
723
909
|
// src/RedactoNoticeConsent/styles.ts
|
|
724
910
|
var styles = {
|
|
725
911
|
overlay: {
|
|
@@ -834,7 +1020,8 @@ var styles = {
|
|
|
834
1020
|
boxSizing: "border-box",
|
|
835
1021
|
textAlign: "left",
|
|
836
1022
|
cursor: "pointer",
|
|
837
|
-
backgroundColor: "#ffffff"
|
|
1023
|
+
backgroundColor: "#ffffff",
|
|
1024
|
+
fontFamily: "inherit"
|
|
838
1025
|
},
|
|
839
1026
|
middleSection: {
|
|
840
1027
|
margin: "0px",
|
|
@@ -1007,7 +1194,8 @@ var styles = {
|
|
|
1007
1194
|
cursor: "pointer",
|
|
1008
1195
|
margin: 0,
|
|
1009
1196
|
boxSizing: "border-box",
|
|
1010
|
-
textAlign: "center"
|
|
1197
|
+
textAlign: "center",
|
|
1198
|
+
fontFamily: "inherit"
|
|
1011
1199
|
},
|
|
1012
1200
|
acceptButton: {
|
|
1013
1201
|
backgroundColor: "#4f87ff",
|
|
@@ -1160,19 +1348,17 @@ var PurposeItem = ({
|
|
|
1160
1348
|
selectedLanguage,
|
|
1161
1349
|
initialDataElementSelections = {}
|
|
1162
1350
|
}) => {
|
|
1163
|
-
const headingStyle =
|
|
1351
|
+
const headingStyle = useMemo2(
|
|
1164
1352
|
() => ({
|
|
1165
|
-
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
1166
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
1353
|
+
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
1167
1354
|
}),
|
|
1168
|
-
[settings]
|
|
1355
|
+
[settings == null ? void 0 : settings.headingColor]
|
|
1169
1356
|
);
|
|
1170
|
-
const textStyle =
|
|
1357
|
+
const textStyle = useMemo2(
|
|
1171
1358
|
() => ({
|
|
1172
|
-
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
1173
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
1359
|
+
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
1174
1360
|
}),
|
|
1175
|
-
[settings]
|
|
1361
|
+
[settings == null ? void 0 : settings.textColor]
|
|
1176
1362
|
);
|
|
1177
1363
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1178
1364
|
/* @__PURE__ */ jsxs("div", { style: styles4.optionItem, children: [
|
|
@@ -1477,7 +1663,7 @@ var GuardianForm = ({
|
|
|
1477
1663
|
const [openUpward, setOpenUpward] = useState(false);
|
|
1478
1664
|
const dropdownRef = useRef(null);
|
|
1479
1665
|
const optionsRef = useRef(null);
|
|
1480
|
-
|
|
1666
|
+
useEffect2(() => {
|
|
1481
1667
|
if (!isDropdownOpen) return;
|
|
1482
1668
|
const handleClickOutside = (e) => {
|
|
1483
1669
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
@@ -1488,7 +1674,7 @@ var GuardianForm = ({
|
|
|
1488
1674
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1489
1675
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1490
1676
|
}, [isDropdownOpen]);
|
|
1491
|
-
|
|
1677
|
+
useEffect2(() => {
|
|
1492
1678
|
if (!isDropdownOpen || !dropdownRef.current) return;
|
|
1493
1679
|
const rect = dropdownRef.current.getBoundingClientRect();
|
|
1494
1680
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
@@ -1530,7 +1716,7 @@ var GuardianForm = ({
|
|
|
1530
1716
|
break;
|
|
1531
1717
|
}
|
|
1532
1718
|
};
|
|
1533
|
-
|
|
1719
|
+
useEffect2(() => {
|
|
1534
1720
|
var _a2;
|
|
1535
1721
|
if (focusedIndex >= 0 && optionsRef.current) {
|
|
1536
1722
|
const option = optionsRef.current.children[focusedIndex];
|
|
@@ -1541,14 +1727,12 @@ var GuardianForm = ({
|
|
|
1541
1727
|
const textColor = (settings == null ? void 0 : settings.textColor) || "#344054";
|
|
1542
1728
|
const bgColor = (settings == null ? void 0 : settings.backgroundColor) || "#ffffff";
|
|
1543
1729
|
const radius = (settings == null ? void 0 : settings.borderRadius) || "8px";
|
|
1544
|
-
const font = (settings == null ? void 0 : settings.font) || "inherit";
|
|
1545
1730
|
const inputStyle = {
|
|
1546
1731
|
width: "100%",
|
|
1547
1732
|
padding: "10px 12px",
|
|
1548
1733
|
border: `1px solid ${borderColor}`,
|
|
1549
1734
|
borderRadius: radius,
|
|
1550
1735
|
fontSize: "13px",
|
|
1551
|
-
fontFamily: font,
|
|
1552
1736
|
color: textColor,
|
|
1553
1737
|
backgroundColor: bgColor,
|
|
1554
1738
|
marginBottom: "2px",
|
|
@@ -1806,7 +1990,6 @@ var GuardianForm = ({
|
|
|
1806
1990
|
style: {
|
|
1807
1991
|
padding: "9px 12px",
|
|
1808
1992
|
fontSize: "13px",
|
|
1809
|
-
fontFamily: font,
|
|
1810
1993
|
color: isSelected ? accentColor : textColor,
|
|
1811
1994
|
backgroundColor: isFocused ? "#F3F4F6" : "transparent",
|
|
1812
1995
|
cursor: "pointer",
|
|
@@ -2323,6 +2506,12 @@ var RedactoNoticeConsent = ({
|
|
|
2323
2506
|
noticeId,
|
|
2324
2507
|
accessToken,
|
|
2325
2508
|
refreshToken,
|
|
2509
|
+
token,
|
|
2510
|
+
email,
|
|
2511
|
+
mobile,
|
|
2512
|
+
ucic,
|
|
2513
|
+
organisationUuid,
|
|
2514
|
+
workspaceUuid,
|
|
2326
2515
|
baseUrl,
|
|
2327
2516
|
ledgerBaseUrl,
|
|
2328
2517
|
language = "en",
|
|
@@ -2341,15 +2530,43 @@ var RedactoNoticeConsent = ({
|
|
|
2341
2530
|
reviewModeButtonText = "Continue"
|
|
2342
2531
|
}) => {
|
|
2343
2532
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2344
|
-
const
|
|
2533
|
+
const sandboxParams = useMemo2(
|
|
2534
|
+
() => ({
|
|
2535
|
+
token,
|
|
2536
|
+
sandboxUcic: ucic,
|
|
2537
|
+
sandboxSubject: email || mobile,
|
|
2538
|
+
organisationUuid,
|
|
2539
|
+
workspaceUuid
|
|
2540
|
+
}),
|
|
2541
|
+
[token, ucic, email, mobile, organisationUuid, workspaceUuid]
|
|
2542
|
+
);
|
|
2543
|
+
const propValidationError = useMemo2(() => {
|
|
2345
2544
|
if (!(noticeId == null ? void 0 : noticeId.trim())) {
|
|
2346
2545
|
return "RedactoNoticeConsent: 'noticeId' prop is required and cannot be empty";
|
|
2347
2546
|
}
|
|
2547
|
+
if (token == null ? void 0 : token.trim()) {
|
|
2548
|
+
if (!(organisationUuid == null ? void 0 : organisationUuid.trim()) || !(workspaceUuid == null ? void 0 : workspaceUuid.trim())) {
|
|
2549
|
+
return "RedactoNoticeConsent: sandbox mode requires 'organisationUuid' and 'workspaceUuid'";
|
|
2550
|
+
}
|
|
2551
|
+
if (!(email == null ? void 0 : email.trim()) && !(mobile == null ? void 0 : mobile.trim()) && !(ucic == null ? void 0 : ucic.trim())) {
|
|
2552
|
+
return "RedactoNoticeConsent: sandbox mode requires 'email', 'mobile', or 'ucic'";
|
|
2553
|
+
}
|
|
2554
|
+
return null;
|
|
2555
|
+
}
|
|
2348
2556
|
if (!(accessToken == null ? void 0 : accessToken.trim())) {
|
|
2349
2557
|
return "RedactoNoticeConsent: 'accessToken' prop is required and cannot be empty";
|
|
2350
2558
|
}
|
|
2351
2559
|
return null;
|
|
2352
|
-
}, [
|
|
2560
|
+
}, [
|
|
2561
|
+
noticeId,
|
|
2562
|
+
accessToken,
|
|
2563
|
+
token,
|
|
2564
|
+
organisationUuid,
|
|
2565
|
+
workspaceUuid,
|
|
2566
|
+
email,
|
|
2567
|
+
mobile,
|
|
2568
|
+
ucic
|
|
2569
|
+
]);
|
|
2353
2570
|
if (propValidationError) {
|
|
2354
2571
|
return /* @__PURE__ */ jsxs(
|
|
2355
2572
|
"div",
|
|
@@ -2429,7 +2646,7 @@ var RedactoNoticeConsent = ({
|
|
|
2429
2646
|
const isPollingStatusRef = useRef(false);
|
|
2430
2647
|
const verificationSessionTokenRef = useRef(null);
|
|
2431
2648
|
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
2432
|
-
const responsiveStyles =
|
|
2649
|
+
const responsiveStyles = useMemo2(
|
|
2433
2650
|
() => ({
|
|
2434
2651
|
modal: {
|
|
2435
2652
|
width: isMobile ? "90%" : "700px"
|
|
@@ -2510,28 +2727,29 @@ var RedactoNoticeConsent = ({
|
|
|
2510
2727
|
}),
|
|
2511
2728
|
[isMobile]
|
|
2512
2729
|
);
|
|
2513
|
-
const
|
|
2730
|
+
const fontFamily = useNoticeFont({
|
|
2731
|
+
hostFont: settings == null ? void 0 : settings.font,
|
|
2732
|
+
noticeFont: content == null ? void 0 : content.font_preference
|
|
2733
|
+
});
|
|
2734
|
+
const componentHeadingStyle = useMemo2(
|
|
2514
2735
|
() => ({
|
|
2515
|
-
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
2516
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
2736
|
+
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
2517
2737
|
}),
|
|
2518
|
-
[settings == null ? void 0 : settings.headingColor
|
|
2738
|
+
[settings == null ? void 0 : settings.headingColor]
|
|
2519
2739
|
);
|
|
2520
|
-
const componentTextStyle =
|
|
2740
|
+
const componentTextStyle = useMemo2(
|
|
2521
2741
|
() => ({
|
|
2522
|
-
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2523
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
2742
|
+
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2524
2743
|
}),
|
|
2525
|
-
[settings == null ? void 0 : settings.textColor
|
|
2744
|
+
[settings == null ? void 0 : settings.textColor]
|
|
2526
2745
|
);
|
|
2527
|
-
const sectionStyle =
|
|
2746
|
+
const sectionStyle = useMemo2(
|
|
2528
2747
|
() => ({
|
|
2529
|
-
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2530
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
2748
|
+
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2531
2749
|
}),
|
|
2532
|
-
[settings == null ? void 0 : settings.textColor
|
|
2750
|
+
[settings == null ? void 0 : settings.textColor]
|
|
2533
2751
|
);
|
|
2534
|
-
const areAllRequiredElementsChecked =
|
|
2752
|
+
const areAllRequiredElementsChecked = useMemo2(() => {
|
|
2535
2753
|
if (!content) return false;
|
|
2536
2754
|
return content.purposes.every((purpose) => {
|
|
2537
2755
|
const requiredElements = purpose.data_elements.filter(
|
|
@@ -2543,7 +2761,7 @@ var RedactoNoticeConsent = ({
|
|
|
2543
2761
|
});
|
|
2544
2762
|
}, [content, selectedDataElements]);
|
|
2545
2763
|
const acceptDisabled = isSubmitting || !areAllRequiredElementsChecked;
|
|
2546
|
-
|
|
2764
|
+
useEffect2(() => {
|
|
2547
2765
|
var _a2, _b2;
|
|
2548
2766
|
clearApiCache();
|
|
2549
2767
|
isRequestInProgressRef.current = false;
|
|
@@ -2606,7 +2824,7 @@ var RedactoNoticeConsent = ({
|
|
|
2606
2824
|
}
|
|
2607
2825
|
isInitialMountRef.current = false;
|
|
2608
2826
|
}, [accessToken]);
|
|
2609
|
-
|
|
2827
|
+
useEffect2(() => {
|
|
2610
2828
|
if (hasAlreadyConsented) {
|
|
2611
2829
|
onAccept == null ? void 0 : onAccept();
|
|
2612
2830
|
}
|
|
@@ -2679,7 +2897,7 @@ var RedactoNoticeConsent = ({
|
|
|
2679
2897
|
return content.dpo_info[key] || defaultText;
|
|
2680
2898
|
};
|
|
2681
2899
|
const fetchNotice = async () => {
|
|
2682
|
-
var _a2
|
|
2900
|
+
var _a2;
|
|
2683
2901
|
if (isRequestInProgressRef.current) {
|
|
2684
2902
|
return;
|
|
2685
2903
|
}
|
|
@@ -2693,16 +2911,18 @@ var RedactoNoticeConsent = ({
|
|
|
2693
2911
|
setShowAgeVerification(false);
|
|
2694
2912
|
setShowGuardianForm(false);
|
|
2695
2913
|
try {
|
|
2914
|
+
const noticeBaseUrl = ledgerBaseUrl && !applicationId && !token ? ledgerBaseUrl : baseUrl;
|
|
2696
2915
|
const consentContentData = await fetchConsentContent({
|
|
2697
2916
|
noticeId,
|
|
2698
2917
|
accessToken,
|
|
2699
2918
|
refreshToken,
|
|
2700
|
-
baseUrl,
|
|
2919
|
+
baseUrl: noticeBaseUrl,
|
|
2701
2920
|
language,
|
|
2702
2921
|
specific_uuid: applicationId,
|
|
2703
2922
|
validate_against: validateAgainst,
|
|
2704
2923
|
include_fully_consented_data: includeFullyConsentedData,
|
|
2705
|
-
signal: (_a2 = abortControllerRef.current) == null ? void 0 : _a2.signal
|
|
2924
|
+
signal: (_a2 = abortControllerRef.current) == null ? void 0 : _a2.signal,
|
|
2925
|
+
...sandboxParams
|
|
2706
2926
|
});
|
|
2707
2927
|
const activeConfig = consentContentData.detail.active_config;
|
|
2708
2928
|
setContent(activeConfig);
|
|
@@ -2720,24 +2940,8 @@ var RedactoNoticeConsent = ({
|
|
|
2720
2940
|
{}
|
|
2721
2941
|
);
|
|
2722
2942
|
setCollapsedPurposes(initialCollapsedState);
|
|
2723
|
-
|
|
2724
|
-
|
|
2725
|
-
if (ledgerBaseUrl && !applicationId) {
|
|
2726
|
-
const ledgerStatus = await fetchNoticeConsentStatus({
|
|
2727
|
-
accessToken,
|
|
2728
|
-
ledgerBaseUrl,
|
|
2729
|
-
noticeUuid: noticeId,
|
|
2730
|
-
signal: (_b2 = abortControllerRef.current) == null ? void 0 : _b2.signal
|
|
2731
|
-
});
|
|
2732
|
-
if (ledgerStatus) {
|
|
2733
|
-
const overlay = buildLedgerConsentOverlay(
|
|
2734
|
-
ledgerStatus,
|
|
2735
|
-
activeConfig.purposes
|
|
2736
|
-
);
|
|
2737
|
-
isReconsentRequired = (_c2 = overlay == null ? void 0 : overlay.reconsent_required) != null ? _c2 : false;
|
|
2738
|
-
purposeSelections = overlay == null ? void 0 : overlay.purpose_selections;
|
|
2739
|
-
}
|
|
2740
|
-
}
|
|
2943
|
+
const isReconsentRequired = consentContentData.detail.reconsent_required;
|
|
2944
|
+
const purposeSelections = consentContentData.detail.purpose_selections;
|
|
2741
2945
|
const newCategorizedPurposes = isReconsentRequired ? {
|
|
2742
2946
|
alreadyConsented: activeConfig.purposes.filter(
|
|
2743
2947
|
(purpose) => {
|
|
@@ -2768,9 +2972,9 @@ var RedactoNoticeConsent = ({
|
|
|
2768
2972
|
const initialDataElementState = activeConfig.purposes.reduce(
|
|
2769
2973
|
(acc, purpose) => {
|
|
2770
2974
|
purpose.data_elements.forEach((element) => {
|
|
2771
|
-
var _a3,
|
|
2975
|
+
var _a3, _b2;
|
|
2772
2976
|
const combinedId = `${purpose.uuid}-${element.uuid}`;
|
|
2773
|
-
if ((
|
|
2977
|
+
if ((_b2 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
|
|
2774
2978
|
acc[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
2775
2979
|
} else {
|
|
2776
2980
|
acc[combinedId] = false;
|
|
@@ -2786,9 +2990,9 @@ var RedactoNoticeConsent = ({
|
|
|
2786
2990
|
const initialSelections = {};
|
|
2787
2991
|
newCategorizedPurposes.alreadyConsented.forEach((purpose) => {
|
|
2788
2992
|
purpose.data_elements.forEach((element) => {
|
|
2789
|
-
var _a3,
|
|
2993
|
+
var _a3, _b2;
|
|
2790
2994
|
const combinedId = `${purpose.uuid}-${element.uuid}`;
|
|
2791
|
-
if ((
|
|
2995
|
+
if ((_b2 = (_a3 = purposeSelections == null ? void 0 : purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
|
|
2792
2996
|
initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
2793
2997
|
} else {
|
|
2794
2998
|
initialSelections[combinedId] = false;
|
|
@@ -2809,9 +3013,9 @@ var RedactoNoticeConsent = ({
|
|
|
2809
3013
|
activeConfig.purposes.forEach(
|
|
2810
3014
|
(purpose) => {
|
|
2811
3015
|
purpose.data_elements.forEach((element) => {
|
|
2812
|
-
var _a3,
|
|
3016
|
+
var _a3, _b2;
|
|
2813
3017
|
const combinedId = `${purpose.uuid}-${element.uuid}`;
|
|
2814
|
-
if ((
|
|
3018
|
+
if ((_b2 = (_a3 = purposeSelections[purpose.uuid]) == null ? void 0 : _a3.data_elements) == null ? void 0 : _b2[element.uuid]) {
|
|
2815
3019
|
initialSelections[combinedId] = purposeSelections[purpose.uuid].data_elements[element.uuid].selected;
|
|
2816
3020
|
} else {
|
|
2817
3021
|
initialSelections[combinedId] = false;
|
|
@@ -2852,15 +3056,17 @@ var RedactoNoticeConsent = ({
|
|
|
2852
3056
|
isRequestInProgressRef.current = false;
|
|
2853
3057
|
}
|
|
2854
3058
|
};
|
|
2855
|
-
|
|
3059
|
+
useEffect2(() => {
|
|
2856
3060
|
injectCheckboxStyles();
|
|
2857
3061
|
fetchNotice();
|
|
2858
3062
|
}, [
|
|
2859
3063
|
noticeId,
|
|
2860
3064
|
accessToken,
|
|
2861
3065
|
refreshToken,
|
|
3066
|
+
sandboxParams,
|
|
2862
3067
|
language,
|
|
2863
3068
|
applicationId,
|
|
3069
|
+
ledgerBaseUrl,
|
|
2864
3070
|
validateAgainst,
|
|
2865
3071
|
includeFullyConsentedData
|
|
2866
3072
|
// Removed onError and isRefreshingToken from dependencies to prevent duplicate API calls
|
|
@@ -2975,7 +3181,8 @@ var RedactoNoticeConsent = ({
|
|
|
2975
3181
|
meta_data: applicationId ? { specific_uuid: applicationId } : void 0,
|
|
2976
3182
|
guardianVerificationReference: verificationReference || void 0,
|
|
2977
3183
|
selfDeclaredAdult: selfDeclaredAdult || void 0,
|
|
2978
|
-
signal: submitController.signal
|
|
3184
|
+
signal: submitController.signal,
|
|
3185
|
+
...sandboxParams
|
|
2979
3186
|
});
|
|
2980
3187
|
}
|
|
2981
3188
|
onAccept == null ? void 0 : onAccept();
|
|
@@ -3158,7 +3365,7 @@ var RedactoNoticeConsent = ({
|
|
|
3158
3365
|
} finally {
|
|
3159
3366
|
setIsSubmittingGuardian(false);
|
|
3160
3367
|
}
|
|
3161
|
-
}, [accessToken, baseUrl, guardianFormData, digilockerMode, digilockerCallbackUrl, selectedPurposes, selectedDataElements, noticeId, onError]);
|
|
3368
|
+
}, [accessToken, sandboxParams, baseUrl, guardianFormData, digilockerMode, digilockerCallbackUrl, selectedPurposes, selectedDataElements, noticeId, onError]);
|
|
3162
3369
|
const handleAgeVerificationYes = useCallback(() => {
|
|
3163
3370
|
setShowAgeVerification(false);
|
|
3164
3371
|
setIsMinorFlow(false);
|
|
@@ -3215,7 +3422,7 @@ var RedactoNoticeConsent = ({
|
|
|
3215
3422
|
setIsPollingStatus(false);
|
|
3216
3423
|
isPollingStatusRef.current = false;
|
|
3217
3424
|
setIsInitiatingVerification(false);
|
|
3218
|
-
}, [accessToken, baseUrl]);
|
|
3425
|
+
}, [accessToken, sandboxParams, baseUrl]);
|
|
3219
3426
|
const startPopupMonitoring = useCallback((popup) => {
|
|
3220
3427
|
popupCheckIntervalRef.current = window.setInterval(() => {
|
|
3221
3428
|
if (popup.closed) {
|
|
@@ -3243,8 +3450,8 @@ var RedactoNoticeConsent = ({
|
|
|
3243
3450
|
[]
|
|
3244
3451
|
);
|
|
3245
3452
|
const startStatusPolling = useCallback(
|
|
3246
|
-
(
|
|
3247
|
-
verificationSessionTokenRef.current =
|
|
3453
|
+
(token2) => {
|
|
3454
|
+
verificationSessionTokenRef.current = token2;
|
|
3248
3455
|
setIsPollingStatus(true);
|
|
3249
3456
|
isPollingStatusRef.current = true;
|
|
3250
3457
|
setVerificationError(null);
|
|
@@ -3296,7 +3503,7 @@ var RedactoNoticeConsent = ({
|
|
|
3296
3503
|
const response = await verifyGuardianStatus({
|
|
3297
3504
|
accessToken,
|
|
3298
3505
|
baseUrl,
|
|
3299
|
-
sessionToken:
|
|
3506
|
+
sessionToken: token2
|
|
3300
3507
|
});
|
|
3301
3508
|
consecutiveErrors = 0;
|
|
3302
3509
|
if (response.status === "verified") {
|
|
@@ -3366,7 +3573,7 @@ var RedactoNoticeConsent = ({
|
|
|
3366
3573
|
};
|
|
3367
3574
|
statusPollIntervalRef.current = window.setTimeout(poll, POLL_INTERVAL);
|
|
3368
3575
|
},
|
|
3369
|
-
[accessToken, baseUrl, getVerificationErrorMessage]
|
|
3576
|
+
[accessToken, sandboxParams, baseUrl, getVerificationErrorMessage]
|
|
3370
3577
|
);
|
|
3371
3578
|
const handleBackToGuardianForm = useCallback((clearName = false) => {
|
|
3372
3579
|
var _a2, _b2;
|
|
@@ -3404,7 +3611,7 @@ var RedactoNoticeConsent = ({
|
|
|
3404
3611
|
}
|
|
3405
3612
|
clearConsentState();
|
|
3406
3613
|
}, []);
|
|
3407
|
-
const availableLanguages =
|
|
3614
|
+
const availableLanguages = useMemo2(() => {
|
|
3408
3615
|
if (!content) return [language];
|
|
3409
3616
|
const pinned = ["English"];
|
|
3410
3617
|
if (content.default_language && content.default_language !== "English" && content.default_language !== "en") {
|
|
@@ -3426,7 +3633,7 @@ var RedactoNoticeConsent = ({
|
|
|
3426
3633
|
},
|
|
3427
3634
|
[content]
|
|
3428
3635
|
);
|
|
3429
|
-
const audioSequence =
|
|
3636
|
+
const audioSequence = useMemo2(() => {
|
|
3430
3637
|
if (!ttsAudioUrls || !content) return [];
|
|
3431
3638
|
const sequence = [];
|
|
3432
3639
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -3491,7 +3698,7 @@ var RedactoNoticeConsent = ({
|
|
|
3491
3698
|
}
|
|
3492
3699
|
return sequence;
|
|
3493
3700
|
}, [ttsAudioUrls, content, categorizedPurposes]);
|
|
3494
|
-
const elementIdSequence =
|
|
3701
|
+
const elementIdSequence = useMemo2(() => {
|
|
3495
3702
|
if (!ttsAudioUrls || !content) return [];
|
|
3496
3703
|
const elementIds = [];
|
|
3497
3704
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -3624,7 +3831,7 @@ var RedactoNoticeConsent = ({
|
|
|
3624
3831
|
playAudio();
|
|
3625
3832
|
}
|
|
3626
3833
|
}, [isPlaying, playAudio, pauseAudio]);
|
|
3627
|
-
|
|
3834
|
+
useEffect2(() => {
|
|
3628
3835
|
var _a2;
|
|
3629
3836
|
if (!isPlaying || !content || audioSequence.length === 0) return;
|
|
3630
3837
|
const currentIndex = currentAudioIndex;
|
|
@@ -3658,7 +3865,7 @@ var RedactoNoticeConsent = ({
|
|
|
3658
3865
|
categorizedPurposes,
|
|
3659
3866
|
collapsedPurposes
|
|
3660
3867
|
]);
|
|
3661
|
-
|
|
3868
|
+
useEffect2(() => {
|
|
3662
3869
|
const removeAllHighlights = () => {
|
|
3663
3870
|
document.querySelectorAll(".redacto-tts-highlight").forEach((el) => {
|
|
3664
3871
|
el.classList.remove("redacto-tts-highlight");
|
|
@@ -3694,7 +3901,7 @@ var RedactoNoticeConsent = ({
|
|
|
3694
3901
|
removeAllHighlights();
|
|
3695
3902
|
};
|
|
3696
3903
|
}, [highlightedElementId, isPlaying]);
|
|
3697
|
-
|
|
3904
|
+
useEffect2(() => {
|
|
3698
3905
|
setIsTTSAvailable(false);
|
|
3699
3906
|
setTtsAudioUrls(null);
|
|
3700
3907
|
stopAudio();
|
|
@@ -3706,9 +3913,11 @@ var RedactoNoticeConsent = ({
|
|
|
3706
3913
|
fetchTTSAudioUrls({
|
|
3707
3914
|
accessToken,
|
|
3708
3915
|
baseUrl,
|
|
3916
|
+
ledgerBaseUrl,
|
|
3709
3917
|
noticeUuid: content.notice_uuid,
|
|
3710
3918
|
language: languageCode,
|
|
3711
|
-
signal: ttsAbortController.signal
|
|
3919
|
+
signal: ttsAbortController.signal,
|
|
3920
|
+
...sandboxParams
|
|
3712
3921
|
}).then((response) => {
|
|
3713
3922
|
setTtsAudioUrls(response.detail);
|
|
3714
3923
|
setIsTTSAvailable(true);
|
|
@@ -3721,10 +3930,11 @@ var RedactoNoticeConsent = ({
|
|
|
3721
3930
|
return () => {
|
|
3722
3931
|
ttsAbortController.abort();
|
|
3723
3932
|
};
|
|
3724
|
-
}, [content, selectedLanguage, accessToken, baseUrl, getLanguageCode]);
|
|
3933
|
+
}, [content, selectedLanguage, accessToken, sandboxParams, baseUrl, ledgerBaseUrl, getLanguageCode]);
|
|
3725
3934
|
const modalStyle = {
|
|
3726
3935
|
borderRadius: (settings == null ? void 0 : settings.borderRadius) || "8px",
|
|
3727
|
-
backgroundColor: (settings == null ? void 0 : settings.backgroundColor) || "#ffffff"
|
|
3936
|
+
backgroundColor: (settings == null ? void 0 : settings.backgroundColor) || "#ffffff",
|
|
3937
|
+
fontFamily
|
|
3728
3938
|
};
|
|
3729
3939
|
const buttonStyle = {
|
|
3730
3940
|
borderRadius: (settings == null ? void 0 : settings.borderRadius) || "8px"
|
|
@@ -3758,7 +3968,7 @@ var RedactoNoticeConsent = ({
|
|
|
3758
3968
|
const handleCloseError = () => {
|
|
3759
3969
|
setErrorMessage(null);
|
|
3760
3970
|
};
|
|
3761
|
-
|
|
3971
|
+
useEffect2(() => {
|
|
3762
3972
|
const handleKeyDown = (event) => {
|
|
3763
3973
|
if (!modalRef.current) return;
|
|
3764
3974
|
const focusableElements = modalRef.current.querySelectorAll(
|
|
@@ -3797,13 +4007,13 @@ var RedactoNoticeConsent = ({
|
|
|
3797
4007
|
modal == null ? void 0 : modal.removeEventListener("keydown", handleKeyDown);
|
|
3798
4008
|
};
|
|
3799
4009
|
}, [isLoading, handleDecline]);
|
|
3800
|
-
|
|
4010
|
+
useEffect2(() => {
|
|
3801
4011
|
stopAudio();
|
|
3802
4012
|
}, [selectedLanguage, stopAudio]);
|
|
3803
|
-
|
|
4013
|
+
useEffect2(() => {
|
|
3804
4014
|
stopAudio();
|
|
3805
4015
|
}, [content, stopAudio]);
|
|
3806
|
-
|
|
4016
|
+
useEffect2(() => {
|
|
3807
4017
|
return () => {
|
|
3808
4018
|
var _a2, _b2;
|
|
3809
4019
|
if (abortControllerRef.current) {
|
|
@@ -3829,7 +4039,7 @@ var RedactoNoticeConsent = ({
|
|
|
3829
4039
|
}
|
|
3830
4040
|
};
|
|
3831
4041
|
}, [stopAudio]);
|
|
3832
|
-
|
|
4042
|
+
useEffect2(() => {
|
|
3833
4043
|
const persistedState = getConsentState();
|
|
3834
4044
|
if (!persistedState) return;
|
|
3835
4045
|
if (persistedState.noticeId && persistedState.noticeId !== noticeId) {
|
|
@@ -3879,6 +4089,7 @@ var RedactoNoticeConsent = ({
|
|
|
3879
4089
|
"div",
|
|
3880
4090
|
{
|
|
3881
4091
|
ref: modalRef,
|
|
4092
|
+
...NOTICE_FONT_ROOT_PROPS,
|
|
3882
4093
|
style: {
|
|
3883
4094
|
...styles.modal,
|
|
3884
4095
|
...responsiveStyles.modal,
|
|
@@ -4687,7 +4898,7 @@ var RedactoNoticeConsent = ({
|
|
|
4687
4898
|
};
|
|
4688
4899
|
|
|
4689
4900
|
// src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx
|
|
4690
|
-
import { useEffect as
|
|
4901
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState3, useRef as useRef2, useCallback as useCallback2, memo } from "react";
|
|
4691
4902
|
|
|
4692
4903
|
// src/RedactoNoticeConsentInline/api/index.ts
|
|
4693
4904
|
var BASE_URL2 = "https://api.redacto.tech/consent";
|
|
@@ -4695,12 +4906,16 @@ var fetchConsentContent2 = async ({
|
|
|
4695
4906
|
org_uuid,
|
|
4696
4907
|
workspace_uuid,
|
|
4697
4908
|
notice_uuid,
|
|
4909
|
+
accessToken,
|
|
4698
4910
|
baseUrl,
|
|
4699
|
-
|
|
4911
|
+
language,
|
|
4912
|
+
specific_uuid,
|
|
4913
|
+
signal
|
|
4700
4914
|
}) => {
|
|
4701
4915
|
const apiBaseUrl = baseUrl || BASE_URL2;
|
|
4916
|
+
const noticesUrl = `${apiBaseUrl}/public/organisations/${org_uuid}/workspaces/${workspace_uuid}/notices`;
|
|
4702
4917
|
const url = new URL(
|
|
4703
|
-
`${
|
|
4918
|
+
accessToken ? `${noticesUrl}/${notice_uuid}` : `${noticesUrl}/get-notice/${notice_uuid}`
|
|
4704
4919
|
);
|
|
4705
4920
|
if (specific_uuid) {
|
|
4706
4921
|
url.searchParams.append("specific_uuid", specific_uuid);
|
|
@@ -4708,8 +4923,11 @@ var fetchConsentContent2 = async ({
|
|
|
4708
4923
|
const response = await fetch(url.toString(), {
|
|
4709
4924
|
method: "GET",
|
|
4710
4925
|
headers: {
|
|
4711
|
-
"Content-Type": "application/json"
|
|
4712
|
-
|
|
4926
|
+
"Content-Type": "application/json",
|
|
4927
|
+
"Accept-Language": language || "en",
|
|
4928
|
+
...accessToken ? { Authorization: `Bearer ${accessToken}` } : {}
|
|
4929
|
+
},
|
|
4930
|
+
signal
|
|
4713
4931
|
});
|
|
4714
4932
|
if (!response.ok) {
|
|
4715
4933
|
throw await parseApiError(
|
|
@@ -4774,6 +4992,15 @@ var submitConsentEvent2 = async ({
|
|
|
4774
4992
|
|
|
4775
4993
|
// src/RedactoNoticeConsentInline/styles.ts
|
|
4776
4994
|
var styles2 = {
|
|
4995
|
+
// Root of the embedded widget — the host supplies the surrounding card, so this
|
|
4996
|
+
// is layout plus the font the rest of the widget inherits. (`container` below is
|
|
4997
|
+
// a standalone-card variant that the current layout does not use.)
|
|
4998
|
+
root: {
|
|
4999
|
+
display: "flex",
|
|
5000
|
+
flexDirection: "column",
|
|
5001
|
+
gap: "16px",
|
|
5002
|
+
fontFamily: "inherit"
|
|
5003
|
+
},
|
|
4777
5004
|
overlay: {
|
|
4778
5005
|
position: "fixed",
|
|
4779
5006
|
top: 0,
|
|
@@ -5120,11 +5347,11 @@ var styles2 = {
|
|
|
5120
5347
|
};
|
|
5121
5348
|
|
|
5122
5349
|
// src/RedactoNoticeConsentInline/useMediaQuery.ts
|
|
5123
|
-
import { useState as useState2, useEffect as
|
|
5350
|
+
import { useState as useState2, useEffect as useEffect3 } from "react";
|
|
5124
5351
|
var useMediaQuery2 = (query) => {
|
|
5125
5352
|
const getMatches = () => typeof window !== "undefined" ? window.matchMedia(query).matches : false;
|
|
5126
5353
|
const [matches, setMatches] = useState2(getMatches);
|
|
5127
|
-
|
|
5354
|
+
useEffect3(() => {
|
|
5128
5355
|
if (typeof window === "undefined") return;
|
|
5129
5356
|
const media = window.matchMedia(query);
|
|
5130
5357
|
const listener = (e) => {
|
|
@@ -5199,14 +5426,17 @@ var RedactoConsentInlineComponent = ({
|
|
|
5199
5426
|
const [selectedPurposes, setSelectedPurposes] = useState3({});
|
|
5200
5427
|
const [selectedDataElements, setSelectedDataElements] = useState3({});
|
|
5201
5428
|
const [hasAlreadyConsented, setHasAlreadyConsented] = useState3(false);
|
|
5429
|
+
const [isCheckingConsent, setIsCheckingConsent] = useState3(
|
|
5430
|
+
Boolean(ledgerBaseUrl) && !applicationId
|
|
5431
|
+
);
|
|
5202
5432
|
const [fetchError, setFetchError] = useState3(null);
|
|
5203
5433
|
const [errorMessage, setErrorMessage] = useState3(null);
|
|
5204
5434
|
const hasSubmittedRef = useRef2(false);
|
|
5205
|
-
|
|
5435
|
+
useEffect4(() => {
|
|
5206
5436
|
injectSpinnerAnimation();
|
|
5207
5437
|
}, []);
|
|
5208
5438
|
const isMobile = useMediaQuery2("(max-width: 768px)");
|
|
5209
|
-
const responsiveStyles =
|
|
5439
|
+
const responsiveStyles = useMemo3(
|
|
5210
5440
|
() => ({
|
|
5211
5441
|
optionTitle: {
|
|
5212
5442
|
fontSize: isMobile ? "14px" : "16px"
|
|
@@ -5224,7 +5454,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5224
5454
|
}),
|
|
5225
5455
|
[isMobile]
|
|
5226
5456
|
);
|
|
5227
|
-
const areAllRequiredElementsChecked =
|
|
5457
|
+
const areAllRequiredElementsChecked = useMemo3(() => {
|
|
5228
5458
|
if (!content) return false;
|
|
5229
5459
|
return content.purposes.every((purpose) => {
|
|
5230
5460
|
const requiredElements = purpose.data_elements.filter(
|
|
@@ -5235,10 +5465,10 @@ var RedactoConsentInlineComponent = ({
|
|
|
5235
5465
|
);
|
|
5236
5466
|
});
|
|
5237
5467
|
}, [content, selectedDataElements]);
|
|
5238
|
-
|
|
5468
|
+
useEffect4(() => {
|
|
5239
5469
|
onValidationChange == null ? void 0 : onValidationChange(areAllRequiredElementsChecked);
|
|
5240
5470
|
}, [areAllRequiredElementsChecked, onValidationChange]);
|
|
5241
|
-
|
|
5471
|
+
useEffect4(() => {
|
|
5242
5472
|
if (hasAlreadyConsented) {
|
|
5243
5473
|
onAccept == null ? void 0 : onAccept();
|
|
5244
5474
|
}
|
|
@@ -5280,18 +5510,24 @@ var RedactoConsentInlineComponent = ({
|
|
|
5280
5510
|
}
|
|
5281
5511
|
return defaultText;
|
|
5282
5512
|
};
|
|
5283
|
-
const fetchNotice = async () => {
|
|
5513
|
+
const fetchNotice = async (signal) => {
|
|
5284
5514
|
setIsLoading(true);
|
|
5285
5515
|
setFetchError(null);
|
|
5516
|
+
setHasAlreadyConsented(false);
|
|
5286
5517
|
try {
|
|
5287
5518
|
const consentContentData = await fetchConsentContent2({
|
|
5288
5519
|
org_uuid,
|
|
5289
5520
|
workspace_uuid,
|
|
5290
5521
|
notice_uuid,
|
|
5522
|
+
accessToken,
|
|
5291
5523
|
baseUrl,
|
|
5292
5524
|
language,
|
|
5293
|
-
specific_uuid: applicationId
|
|
5525
|
+
specific_uuid: applicationId,
|
|
5526
|
+
signal
|
|
5294
5527
|
});
|
|
5528
|
+
if (signal == null ? void 0 : signal.aborted) {
|
|
5529
|
+
return;
|
|
5530
|
+
}
|
|
5295
5531
|
const activeConfig = consentContentData.detail.active_config;
|
|
5296
5532
|
setContent(activeConfig);
|
|
5297
5533
|
if (activeConfig.default_language) {
|
|
@@ -5327,6 +5563,9 @@ var RedactoConsentInlineComponent = ({
|
|
|
5327
5563
|
);
|
|
5328
5564
|
setSelectedPurposes(initialPurposeState);
|
|
5329
5565
|
} catch (err) {
|
|
5566
|
+
if ((signal == null ? void 0 : signal.aborted) || err instanceof Error && err.name === "AbortError") {
|
|
5567
|
+
return;
|
|
5568
|
+
}
|
|
5330
5569
|
const error = err;
|
|
5331
5570
|
setFetchError(error);
|
|
5332
5571
|
if (error.status === 409) {
|
|
@@ -5335,12 +5574,50 @@ var RedactoConsentInlineComponent = ({
|
|
|
5335
5574
|
onError == null ? void 0 : onError(error);
|
|
5336
5575
|
}
|
|
5337
5576
|
} finally {
|
|
5338
|
-
|
|
5577
|
+
if (!(signal == null ? void 0 : signal.aborted)) {
|
|
5578
|
+
setIsLoading(false);
|
|
5579
|
+
}
|
|
5339
5580
|
}
|
|
5340
5581
|
};
|
|
5341
|
-
|
|
5342
|
-
|
|
5343
|
-
|
|
5582
|
+
useEffect4(() => {
|
|
5583
|
+
const controller = new AbortController();
|
|
5584
|
+
void fetchNotice(controller.signal);
|
|
5585
|
+
return () => {
|
|
5586
|
+
controller.abort();
|
|
5587
|
+
};
|
|
5588
|
+
}, [org_uuid, workspace_uuid, notice_uuid, language, applicationId, accessToken]);
|
|
5589
|
+
useEffect4(() => {
|
|
5590
|
+
if (!ledgerBaseUrl || applicationId) {
|
|
5591
|
+
return;
|
|
5592
|
+
}
|
|
5593
|
+
if (!accessToken || !content) {
|
|
5594
|
+
return;
|
|
5595
|
+
}
|
|
5596
|
+
let active = true;
|
|
5597
|
+
const controller = new AbortController();
|
|
5598
|
+
const checkLedgerConsent = async () => {
|
|
5599
|
+
try {
|
|
5600
|
+
const ledgerStatus = await fetchNoticeConsentStatus({
|
|
5601
|
+
accessToken,
|
|
5602
|
+
ledgerBaseUrl,
|
|
5603
|
+
noticeUuid: notice_uuid,
|
|
5604
|
+
signal: controller.signal
|
|
5605
|
+
});
|
|
5606
|
+
if (active && ledgerStatus && isNoticeFullyConsented(ledgerStatus)) {
|
|
5607
|
+
setHasAlreadyConsented(true);
|
|
5608
|
+
}
|
|
5609
|
+
} finally {
|
|
5610
|
+
if (active) {
|
|
5611
|
+
setIsCheckingConsent(false);
|
|
5612
|
+
}
|
|
5613
|
+
}
|
|
5614
|
+
};
|
|
5615
|
+
checkLedgerConsent();
|
|
5616
|
+
return () => {
|
|
5617
|
+
active = false;
|
|
5618
|
+
controller.abort();
|
|
5619
|
+
};
|
|
5620
|
+
}, [ledgerBaseUrl, applicationId, accessToken, content, notice_uuid]);
|
|
5344
5621
|
const togglePurposeCollapse = (purposeUuid) => {
|
|
5345
5622
|
setCollapsedPurposes((prev) => ({
|
|
5346
5623
|
...prev,
|
|
@@ -5463,8 +5740,8 @@ var RedactoConsentInlineComponent = ({
|
|
|
5463
5740
|
onAccept
|
|
5464
5741
|
]
|
|
5465
5742
|
);
|
|
5466
|
-
|
|
5467
|
-
if (accessToken && content && areAllRequiredElementsChecked && !isSubmitting && !hasSubmittedRef.current) {
|
|
5743
|
+
useEffect4(() => {
|
|
5744
|
+
if (accessToken && content && areAllRequiredElementsChecked && !isSubmitting && !isCheckingConsent && !hasAlreadyConsented && !hasSubmittedRef.current) {
|
|
5468
5745
|
hasSubmittedRef.current = true;
|
|
5469
5746
|
const autoSubmit = async () => {
|
|
5470
5747
|
try {
|
|
@@ -5481,9 +5758,11 @@ var RedactoConsentInlineComponent = ({
|
|
|
5481
5758
|
content,
|
|
5482
5759
|
areAllRequiredElementsChecked,
|
|
5483
5760
|
isSubmitting,
|
|
5761
|
+
isCheckingConsent,
|
|
5762
|
+
hasAlreadyConsented,
|
|
5484
5763
|
handleAcceptWithToken
|
|
5485
5764
|
]);
|
|
5486
|
-
|
|
5765
|
+
useEffect4(() => {
|
|
5487
5766
|
if (!accessToken) {
|
|
5488
5767
|
hasSubmittedRef.current = false;
|
|
5489
5768
|
}
|
|
@@ -5494,11 +5773,20 @@ var RedactoConsentInlineComponent = ({
|
|
|
5494
5773
|
const textStyle = {
|
|
5495
5774
|
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
5496
5775
|
};
|
|
5776
|
+
const fontFamily = useNoticeFont({
|
|
5777
|
+
hostFont: settings == null ? void 0 : settings.font,
|
|
5778
|
+
noticeFont: content == null ? void 0 : content.font_preference
|
|
5779
|
+
});
|
|
5780
|
+
const rootStyle = { ...styles2.root, fontFamily };
|
|
5781
|
+
const loadingRootStyle = {
|
|
5782
|
+
...styles2.loadingContainer,
|
|
5783
|
+
fontFamily
|
|
5784
|
+
};
|
|
5497
5785
|
if (hasAlreadyConsented || fetchError) {
|
|
5498
5786
|
return null;
|
|
5499
5787
|
}
|
|
5500
5788
|
if (isLoading) {
|
|
5501
|
-
return /* @__PURE__ */ jsxs2("div", { style:
|
|
5789
|
+
return /* @__PURE__ */ jsxs2("div", { ...NOTICE_FONT_ROOT_PROPS, style: loadingRootStyle, children: [
|
|
5502
5790
|
/* @__PURE__ */ jsx2("div", { style: styles2.loadingSpinner }),
|
|
5503
5791
|
/* @__PURE__ */ jsx2("p", { style: { ...styles2.privacyText, ...textStyle }, children: "Loading..." })
|
|
5504
5792
|
] });
|
|
@@ -5506,7 +5794,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5506
5794
|
if (!content) {
|
|
5507
5795
|
return null;
|
|
5508
5796
|
}
|
|
5509
|
-
return /* @__PURE__ */ jsxs2("div", {
|
|
5797
|
+
return /* @__PURE__ */ jsxs2("div", { ...NOTICE_FONT_ROOT_PROPS, style: rootStyle, children: [
|
|
5510
5798
|
errorMessage && /* @__PURE__ */ jsx2(
|
|
5511
5799
|
"div",
|
|
5512
5800
|
{
|
|
@@ -5685,7 +5973,7 @@ RedactoConsentInlineComponent.displayName = "RedactoConsentInline";
|
|
|
5685
5973
|
var RedactoConsentInline = memo(RedactoConsentInlineComponent);
|
|
5686
5974
|
|
|
5687
5975
|
// src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx
|
|
5688
|
-
import { useState as useState5, useEffect as
|
|
5976
|
+
import { useState as useState5, useEffect as useEffect6, useMemo as useMemo4, useRef as useRef3, useCallback as useCallback3 } from "react";
|
|
5689
5977
|
|
|
5690
5978
|
// src/RedactoNoticeAssisted/styles.ts
|
|
5691
5979
|
var styles3 = {
|
|
@@ -5791,6 +6079,7 @@ var styles3 = {
|
|
|
5791
6079
|
display: "flex",
|
|
5792
6080
|
alignItems: "center",
|
|
5793
6081
|
justifyContent: "center",
|
|
6082
|
+
fontFamily: "inherit",
|
|
5794
6083
|
fontWeight: 400,
|
|
5795
6084
|
fontSize: "12px",
|
|
5796
6085
|
lineHeight: "150%",
|
|
@@ -6168,6 +6457,7 @@ var styles3 = {
|
|
|
6168
6457
|
borderRadius: "8px",
|
|
6169
6458
|
border: "1px solid #d0d5dd",
|
|
6170
6459
|
textAlign: "center",
|
|
6460
|
+
fontFamily: "inherit",
|
|
6171
6461
|
fontSize: "18px",
|
|
6172
6462
|
fontWeight: 500,
|
|
6173
6463
|
color: "#101828",
|
|
@@ -6289,6 +6579,7 @@ var styles3 = {
|
|
|
6289
6579
|
width: "100%",
|
|
6290
6580
|
borderRadius: "8px",
|
|
6291
6581
|
padding: "9px 45px",
|
|
6582
|
+
fontFamily: "inherit",
|
|
6292
6583
|
fontWeight: 400,
|
|
6293
6584
|
fontSize: "16px",
|
|
6294
6585
|
lineHeight: "150%",
|
|
@@ -6588,11 +6879,11 @@ var injectAssistedStyles = () => {
|
|
|
6588
6879
|
};
|
|
6589
6880
|
|
|
6590
6881
|
// src/RedactoNoticeAssisted/useMediaQuery.ts
|
|
6591
|
-
import { useState as useState4, useEffect as
|
|
6882
|
+
import { useState as useState4, useEffect as useEffect5 } from "react";
|
|
6592
6883
|
var useMediaQuery3 = (query) => {
|
|
6593
6884
|
const getMatches = () => typeof window !== "undefined" ? window.matchMedia(query).matches : false;
|
|
6594
6885
|
const [matches, setMatches] = useState4(getMatches);
|
|
6595
|
-
|
|
6886
|
+
useEffect5(() => {
|
|
6596
6887
|
if (typeof window === "undefined") return;
|
|
6597
6888
|
const media = window.matchMedia(query);
|
|
6598
6889
|
const listener = (e) => {
|
|
@@ -6741,6 +7032,7 @@ var submitAssistedConsent = async ({
|
|
|
6741
7032
|
organisationUuid,
|
|
6742
7033
|
workspaceUuid,
|
|
6743
7034
|
baseUrl,
|
|
7035
|
+
ledgerBaseUrl,
|
|
6744
7036
|
noticeUuid,
|
|
6745
7037
|
purposes,
|
|
6746
7038
|
language,
|
|
@@ -6771,7 +7063,7 @@ var submitAssistedConsent = async ({
|
|
|
6771
7063
|
declined: false,
|
|
6772
7064
|
language: language || void 0
|
|
6773
7065
|
};
|
|
6774
|
-
const url = `${publicScope(baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
|
|
7066
|
+
const url = `${publicScope(ledgerBaseUrl || baseUrl, organisationUuid, workspaceUuid)}/submit-consent`;
|
|
6775
7067
|
const response = await fetch(url, {
|
|
6776
7068
|
method: "POST",
|
|
6777
7069
|
headers: {
|
|
@@ -7898,57 +8190,6 @@ var as = {
|
|
|
7898
8190
|
tryAgain: "\u0985\u09A8\u09C1\u0997\u09CD\u09F0\u09B9 \u0995\u09F0\u09BF \u09AA\u09C1\u09A8\u09F0 \u099A\u09C7\u09B7\u09CD\u099F\u09BE \u0995\u09F0\u0995\u0964",
|
|
7899
8191
|
close: "\u09AC\u09A8\u09CD\u09A7 \u0995\u09F0\u0995"
|
|
7900
8192
|
};
|
|
7901
|
-
var bho = {
|
|
7902
|
-
useEmailInstead: "\u0908\u092E\u0947\u0932 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0940\u0902",
|
|
7903
|
-
useMobileInstead: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0915\u0930\u0940\u0902",
|
|
7904
|
-
emailAddress: "\u0908\u092E\u0947\u0932 \u092A\u0924\u093E",
|
|
7905
|
-
otpHelperEmail: "\u0939\u092E\u0928\u0940 \u090F\u0939 \u0908\u092E\u0947\u0932 \u092A\u0930 \u090F\u0915 \u092C\u0947\u0930 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0939\u094B\u0916\u0947 \u0935\u093E\u0932\u093E \u092A\u093E\u0938\u0935\u0930\u094D\u0921 \u092D\u0947\u091C\u092C\u0964",
|
|
7906
|
-
changeEmail: "\u0908\u092E\u0947\u0932 \u092C\u0926\u0932\u0940\u0902",
|
|
7907
|
-
expandDetails: "{name} \u0915\u0947 \u0935\u093F\u0935\u0930\u0923 \u092B\u0948\u0932\u093E\u0908\u0902",
|
|
7908
|
-
collapseDetails: "{name} \u0915\u0947 \u0935\u093F\u0935\u0930\u0923 \u0938\u092E\u0947\u091F\u0940\u0902",
|
|
7909
|
-
selectAllFor: "{name} \u0916\u093E\u0924\u093F\u0930 \u0938\u092D \u0921\u0947\u091F\u093E \u0924\u0924\u094D\u0935 \u091A\u0941\u0928\u0940\u0902",
|
|
7910
|
-
selectElement: "{name} \u091A\u0941\u0928\u0940\u0902",
|
|
7911
|
-
selectElementRequired: "{name} \u091A\u0941\u0928\u0940\u0902 (\u091C\u0930\u0942\u0930\u0940)",
|
|
7912
|
-
required: "\u091C\u0930\u0942\u0930\u0940",
|
|
7913
|
-
logoAlt: "\u0932\u094B\u0917\u094B",
|
|
7914
|
-
selectLanguage: "\u092D\u093E\u0937\u093E \u091A\u0941\u0928\u0940\u0902",
|
|
7915
|
-
selectLanguageCurrent: "\u092D\u093E\u0937\u093E \u091A\u0941\u0928\u0940\u0902. \u092E\u094C\u091C\u0942\u0926\u093E \u092D\u093E\u0937\u093E: {lang}",
|
|
7916
|
-
opensInNewTab: "\u0928\u092F\u093E \u091F\u0948\u092C \u092E\u0947\u0902 \u0916\u0941\u0932\u0947\u0932\u093E",
|
|
7917
|
-
audioStart: "\u0911\u0921\u093F\u092F\u094B \u092A\u094D\u0932\u0947\u092C\u0948\u0915 \u0936\u0941\u0930\u0942 \u0915\u0930\u0940\u0902",
|
|
7918
|
-
audioPause: "\u0911\u0921\u093F\u092F\u094B \u092A\u094D\u0932\u0947\u092C\u0948\u0915 \u0930\u094B\u0915\u0940\u0902",
|
|
7919
|
-
talkbackStart: "\u091F\u0949\u0915\u092C\u0948\u0915 \u0936\u0941\u0930\u0942 \u0915\u0930\u0940\u0902",
|
|
7920
|
-
talkbackPause: "\u091F\u0949\u0915\u092C\u0948\u0915 \u0930\u094B\u0915\u0940\u0902",
|
|
7921
|
-
mobileNumber: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0928\u0902\u092C\u0930",
|
|
7922
|
-
otpHelper: "\u0939\u092E\u0928\u0940 \u090F\u0939 \u0928\u0902\u092C\u0930 \u092A\u0930 \u090F\u0915 \u092C\u0947\u0930 \u0907\u0938\u094D\u0924\u0947\u092E\u093E\u0932 \u0939\u094B\u0916\u0947 \u0935\u093E\u0932\u093E \u092A\u093E\u0938\u0935\u0930\u094D\u0921 \u092D\u0947\u091C\u092C\u0964",
|
|
7923
|
-
otpSentTo: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092D\u0947\u091C\u0932 \u0917\u0907\u0932",
|
|
7924
|
-
changeMobile: "\u092E\u094B\u092C\u093E\u0907\u0932 \u0928\u0902\u092C\u0930 \u092C\u0926\u0932\u0940\u0902",
|
|
7925
|
-
enterNDigitOtp: "{count}-\u0905\u0902\u0915 \u0915\u0947 \u0913\u091F\u0940\u092A\u0940 (OTP) \u0921\u093E\u0932\u0940\u0902",
|
|
7926
|
-
otpDigit: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0905\u0902\u0915 {index}",
|
|
7927
|
-
resendIn: "{seconds} \u0938\u0947\u0915\u0902\u0921 \u092E\u0947\u0902 \u0913\u091F\u0940\u092A\u0940 (OTP) \u092B\u0947\u0930 \u0938\u0947 \u092D\u0947\u091C\u0940\u0902",
|
|
7928
|
-
sending: "\u092D\u0947\u091C\u0932 \u091C\u093E \u0930\u0939\u0932 \u092C\u093E\u2026",
|
|
7929
|
-
resendOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092B\u0947\u0930 \u0938\u0947 \u092D\u0947\u091C\u0940\u0902",
|
|
7930
|
-
getOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092A\u093E\u0908\u0902",
|
|
7931
|
-
verifying: "\u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0907\u0932 \u091C\u093E \u0930\u0939\u0932 \u092C\u093E\u2026",
|
|
7932
|
-
verifyOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0930\u0940\u0902",
|
|
7933
|
-
sendOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u092D\u0947\u091C\u0940\u0902",
|
|
7934
|
-
confirmOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0915\u0947 \u092A\u0941\u0937\u094D\u091F\u093F \u0915\u0930\u0940\u0902",
|
|
7935
|
-
verifyWithOtp: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0947 \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \u0915\u0930\u0940\u0902",
|
|
7936
|
-
editSelections: "\u091A\u0941\u0928\u093E\u0935 \u092E\u0947\u0902 \u092C\u0926\u0932\u093E\u0935 \u0915\u0930\u0940\u0902",
|
|
7937
|
-
otpIncorrect: "\u0930\u0909\u0930\u093E \u0921\u093E\u0932\u0932 \u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0915\u094B\u0921 \u0917\u0932\u0924 \u092C\u093E\u0964 \u0915\u0943\u092A\u092F\u093E \u091C\u093E\u0901\u091A \u0915\u0930\u0940\u0902 \u0906 \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0940\u0902\u0964",
|
|
7938
|
-
otpExpired: "\u0930\u0909\u0930\u093E \u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0915\u094B\u0921 \u0915\u0947 \u092E\u093F\u092F\u093E\u0926 \u0916\u0924\u092E \u0939\u094B \u0917\u0907\u0932 \u092C\u093E\u0964 \u0915\u0943\u092A\u092F\u093E \u0928\u092F\u093E \u0915\u094B\u0921 \u092E\u093E\u0902\u0917\u0940\u0902\u0964",
|
|
7939
|
-
otpNotFound: "\u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0915\u094B\u0921 \u0928\u093E \u092E\u093F\u0932\u0932\u0964 \u0915\u0943\u092A\u092F\u093E \u0928\u092F\u093E \u0915\u094B\u0921 \u092E\u093E\u0902\u0917\u0940\u0902\u0964",
|
|
7940
|
-
otpVerifyFailed: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0915\u0947 \u0938\u0924\u094D\u092F\u093E\u092A\u0928 \u0928\u093E \u0939\u094B \u0938\u0915\u0932\u0964 \u0915\u0943\u092A\u092F\u093E \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0940\u0902\u0964",
|
|
7941
|
-
otpSendFailed: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0928\u093E \u092D\u0947\u091C\u0932 \u091C\u093E \u0938\u0915\u0932\u0964 \u0915\u0943\u092A\u092F\u093E \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0936\u093F\u0936 \u0915\u0930\u0940\u0902\u0964",
|
|
7942
|
-
consentConfirmed: "\u0938\u0939\u092E\u0924\u093F \u0915\u0947 \u092A\u0941\u0937\u094D\u091F\u093F \u092D\u0907\u0932",
|
|
7943
|
-
recordedUnder: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \xB7 {regulation} \u0915\u0947 \u0924\u0939\u0924 \u0926\u0930\u094D\u091C \u092D\u0907\u0932",
|
|
7944
|
-
recordedUnderAt: "\u0913\u091F\u0940\u092A\u0940 (OTP) \u0938\u0924\u094D\u092F\u093E\u092A\u093F\u0924 \xB7 {regulation} \u0915\u0947 \u0924\u0939\u0924 {time} \u092C\u091C\u0947 \u0926\u0930\u094D\u091C \u092D\u0907\u0932",
|
|
7945
|
-
consentReferenceId: "\u0938\u0939\u092E\u0924\u093F \u0938\u0902\u0926\u0930\u094D\u092D \u0906\u0908\u0921\u0940",
|
|
7946
|
-
proceed: "\u0906\u0917\u0947 \u092C\u0922\u093C\u0940\u0902",
|
|
7947
|
-
loadingNotice: "\u0928\u094B\u091F\u093F\u0938 \u0932\u094B\u0921 \u0939\u094B \u0930\u0939\u0932 \u092C\u093E",
|
|
7948
|
-
loadFailedTitle: "\u0938\u0939\u092E\u0924\u093F \u0928\u094B\u091F\u093F\u0938 \u0932\u094B\u0921 \u0928\u093E \u0939\u094B \u0938\u0915\u0932",
|
|
7949
|
-
tryAgain: "\u0915\u0943\u092A\u092F\u093E \u092B\u0947\u0930 \u0938\u0947 \u0915\u094B\u0938\u093F\u0938 \u0915\u0930\u0940\u0902\u0964",
|
|
7950
|
-
close: "\u092C\u0902\u0926 \u0915\u0930\u0940\u0902"
|
|
7951
|
-
};
|
|
7952
8193
|
var brx = {
|
|
7953
8194
|
useEmailInstead: "\u0907\u092E\u0947\u0932 \u092C\u093E\u0939\u093E\u092F",
|
|
7954
8195
|
useMobileInstead: "\u092E\u092C\u093E\u0907\u0932 \u092C\u093E\u0939\u093E\u092F",
|
|
@@ -8073,7 +8314,6 @@ var STATIC_STRINGS = {
|
|
|
8073
8314
|
te,
|
|
8074
8315
|
ur,
|
|
8075
8316
|
as,
|
|
8076
|
-
bho,
|
|
8077
8317
|
brx,
|
|
8078
8318
|
doi
|
|
8079
8319
|
};
|
|
@@ -8258,6 +8498,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8258
8498
|
workspaceUuid,
|
|
8259
8499
|
noticeUuid,
|
|
8260
8500
|
baseUrl,
|
|
8501
|
+
ledgerBaseUrl,
|
|
8261
8502
|
onDecline,
|
|
8262
8503
|
onComplete
|
|
8263
8504
|
}) => {
|
|
@@ -8297,10 +8538,10 @@ var RedactoNoticeAssisted = ({
|
|
|
8297
8538
|
const [isVerifying, setIsVerifying] = useState5(false);
|
|
8298
8539
|
const [createError, setCreateError] = useState5(null);
|
|
8299
8540
|
const [otpError, setOtpError] = useState5(null);
|
|
8300
|
-
|
|
8541
|
+
useEffect6(() => {
|
|
8301
8542
|
injectAssistedStyles();
|
|
8302
8543
|
}, []);
|
|
8303
|
-
|
|
8544
|
+
useEffect6(() => {
|
|
8304
8545
|
const controller = new AbortController();
|
|
8305
8546
|
setIsLoading(true);
|
|
8306
8547
|
setFetchError(null);
|
|
@@ -8338,14 +8579,14 @@ var RedactoNoticeAssisted = ({
|
|
|
8338
8579
|
});
|
|
8339
8580
|
return () => controller.abort();
|
|
8340
8581
|
}, [organisationUuid, workspaceUuid, noticeUuid, baseUrl]);
|
|
8341
|
-
|
|
8582
|
+
useEffect6(() => {
|
|
8342
8583
|
if (resendCountdown <= 0) return;
|
|
8343
8584
|
const intervalId = window.setInterval(() => {
|
|
8344
8585
|
setResendCountdown((prev) => prev <= 1 ? 0 : prev - 1);
|
|
8345
8586
|
}, 1e3);
|
|
8346
8587
|
return () => window.clearInterval(intervalId);
|
|
8347
8588
|
}, [resendCountdown]);
|
|
8348
|
-
|
|
8589
|
+
useEffect6(() => {
|
|
8349
8590
|
if (step !== "verify") return;
|
|
8350
8591
|
const id = window.setTimeout(
|
|
8351
8592
|
() => scrollIntoViewSoft(verifyBlockRef.current),
|
|
@@ -8353,7 +8594,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8353
8594
|
);
|
|
8354
8595
|
return () => window.clearTimeout(id);
|
|
8355
8596
|
}, [step]);
|
|
8356
|
-
|
|
8597
|
+
useEffect6(() => {
|
|
8357
8598
|
if (!otpSent) return;
|
|
8358
8599
|
const id = window.setTimeout(
|
|
8359
8600
|
() => scrollIntoViewSoft(otpSectionRef.current),
|
|
@@ -8361,7 +8602,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8361
8602
|
);
|
|
8362
8603
|
return () => window.clearTimeout(id);
|
|
8363
8604
|
}, [otpSent]);
|
|
8364
|
-
|
|
8605
|
+
useEffect6(() => {
|
|
8365
8606
|
if (!isLanguageDropdownOpen) return;
|
|
8366
8607
|
const handleClickOutside = (e) => {
|
|
8367
8608
|
if (languageContainerRef.current && !languageContainerRef.current.contains(e.target)) {
|
|
@@ -8376,7 +8617,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8376
8617
|
const isMobileValid = mobile.replace(/\D/g, "").length >= 10;
|
|
8377
8618
|
const isEmailValid = EMAIL_REGEX.test(email.trim());
|
|
8378
8619
|
const isContactValid = verifyMethod === "email" ? isEmailValid : isMobileValid;
|
|
8379
|
-
const areAllRequiredElementsChecked =
|
|
8620
|
+
const areAllRequiredElementsChecked = useMemo4(() => {
|
|
8380
8621
|
if (!content) return false;
|
|
8381
8622
|
return content.purposes.every((purpose) => {
|
|
8382
8623
|
const requiredElements = purpose.data_elements.filter(
|
|
@@ -8387,7 +8628,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8387
8628
|
);
|
|
8388
8629
|
});
|
|
8389
8630
|
}, [content, selectedDataElements]);
|
|
8390
|
-
const normalizedDefaultLang =
|
|
8631
|
+
const normalizedDefaultLang = useMemo4(() => {
|
|
8391
8632
|
const dl = content == null ? void 0 : content.default_language;
|
|
8392
8633
|
if (!dl) return "English";
|
|
8393
8634
|
return dl === "en" || dl === "EN" ? "English" : dl;
|
|
@@ -8396,7 +8637,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8396
8637
|
(lang) => lang === "English" || lang === "en" || lang === "EN",
|
|
8397
8638
|
[]
|
|
8398
8639
|
);
|
|
8399
|
-
const ts =
|
|
8640
|
+
const ts = useMemo4(
|
|
8400
8641
|
() => makeStaticT(toBcp47Code(selectedLanguage)),
|
|
8401
8642
|
[selectedLanguage]
|
|
8402
8643
|
);
|
|
@@ -8442,7 +8683,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8442
8683
|
},
|
|
8443
8684
|
[content, selectedLanguage, isDefaultLanguage]
|
|
8444
8685
|
);
|
|
8445
|
-
const availableLanguages =
|
|
8686
|
+
const availableLanguages = useMemo4(() => {
|
|
8446
8687
|
if (!content) return [selectedLanguage];
|
|
8447
8688
|
const pinned = ["English"];
|
|
8448
8689
|
if (normalizedDefaultLang && normalizedDefaultLang !== "English") {
|
|
@@ -8459,10 +8700,10 @@ var RedactoNoticeAssisted = ({
|
|
|
8459
8700
|
"--ra-accent": primaryColor,
|
|
8460
8701
|
"--ra-accent-soft": accentSoft
|
|
8461
8702
|
};
|
|
8462
|
-
const fontFamily = (content == null ? void 0 : content.font_preference)
|
|
8703
|
+
const fontFamily = useNoticeFont({ noticeFont: content == null ? void 0 : content.font_preference });
|
|
8463
8704
|
const logoUrl = (content == null ? void 0 : content.logo_url) || redacto_logo_default2;
|
|
8464
8705
|
const linkStyle = { ...styles3.link, color: secondaryColor };
|
|
8465
|
-
const responsive =
|
|
8706
|
+
const responsive = useMemo4(
|
|
8466
8707
|
() => ({
|
|
8467
8708
|
modal: { width: isMobile ? "90%" : "700px" },
|
|
8468
8709
|
title: { fontSize: isMobile ? "16px" : "18px" },
|
|
@@ -8553,7 +8794,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8553
8794
|
setSelectedLanguage(lang);
|
|
8554
8795
|
setIsLanguageDropdownOpen(false);
|
|
8555
8796
|
}, []);
|
|
8556
|
-
const audioSequence =
|
|
8797
|
+
const audioSequence = useMemo4(() => {
|
|
8557
8798
|
if (!ttsAudioUrls || !content) return [];
|
|
8558
8799
|
const sequence = [];
|
|
8559
8800
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -8614,7 +8855,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8614
8855
|
}
|
|
8615
8856
|
return sequence;
|
|
8616
8857
|
}, [ttsAudioUrls, content]);
|
|
8617
|
-
const elementIdSequence =
|
|
8858
|
+
const elementIdSequence = useMemo4(() => {
|
|
8618
8859
|
if (!ttsAudioUrls || !content) return [];
|
|
8619
8860
|
const elementIds = [];
|
|
8620
8861
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -8743,7 +8984,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8743
8984
|
playAudio();
|
|
8744
8985
|
}
|
|
8745
8986
|
}, [isPlaying, playAudio, pauseAudio]);
|
|
8746
|
-
|
|
8987
|
+
useEffect6(() => {
|
|
8747
8988
|
setIsTTSAvailable(false);
|
|
8748
8989
|
setTtsAudioUrls(null);
|
|
8749
8990
|
stopAudio();
|
|
@@ -8774,7 +9015,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8774
9015
|
baseUrl,
|
|
8775
9016
|
stopAudio
|
|
8776
9017
|
]);
|
|
8777
|
-
|
|
9018
|
+
useEffect6(() => {
|
|
8778
9019
|
var _a;
|
|
8779
9020
|
if (!isPlaying || !content || audioSequence.length === 0) return;
|
|
8780
9021
|
const currentIndex = currentAudioIndex;
|
|
@@ -8793,7 +9034,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8793
9034
|
audioOffset += totalPurposeAudioCount;
|
|
8794
9035
|
}
|
|
8795
9036
|
}, [isPlaying, currentAudioIndex, audioSequence, content, collapsedPurposes]);
|
|
8796
|
-
|
|
9037
|
+
useEffect6(() => {
|
|
8797
9038
|
const removeAllHighlights = () => {
|
|
8798
9039
|
document.querySelectorAll(".redacto-tts-highlight").forEach((el) => {
|
|
8799
9040
|
el.classList.remove("redacto-tts-highlight");
|
|
@@ -8993,6 +9234,19 @@ var RedactoNoticeAssisted = ({
|
|
|
8993
9234
|
return;
|
|
8994
9235
|
}
|
|
8995
9236
|
const token = verifyDetail.access_token;
|
|
9237
|
+
if (ledgerBaseUrl) {
|
|
9238
|
+
const ledgerStatus = await fetchNoticeConsentStatusForScope({
|
|
9239
|
+
accessToken: token,
|
|
9240
|
+
ledgerBaseUrl,
|
|
9241
|
+
organisationUuid,
|
|
9242
|
+
workspaceUuid,
|
|
9243
|
+
noticeUuid: content.notice_uuid
|
|
9244
|
+
});
|
|
9245
|
+
if (ledgerStatus && isNoticeFullyConsented(ledgerStatus)) {
|
|
9246
|
+
handleSuccess();
|
|
9247
|
+
return;
|
|
9248
|
+
}
|
|
9249
|
+
}
|
|
8996
9250
|
const submitPurposes = content.purposes.map((purpose) => ({
|
|
8997
9251
|
...purpose,
|
|
8998
9252
|
selected: selectedPurposes[purpose.uuid] || false,
|
|
@@ -9006,6 +9260,7 @@ var RedactoNoticeAssisted = ({
|
|
|
9006
9260
|
organisationUuid,
|
|
9007
9261
|
workspaceUuid,
|
|
9008
9262
|
baseUrl,
|
|
9263
|
+
ledgerBaseUrl,
|
|
9009
9264
|
noticeUuid: content.notice_uuid,
|
|
9010
9265
|
purposes: submitPurposes,
|
|
9011
9266
|
language: toBcp47Code(selectedLanguage)
|
|
@@ -9029,6 +9284,7 @@ var RedactoNoticeAssisted = ({
|
|
|
9029
9284
|
otpUuid,
|
|
9030
9285
|
otpValue,
|
|
9031
9286
|
baseUrl,
|
|
9287
|
+
ledgerBaseUrl,
|
|
9032
9288
|
selectedPurposes,
|
|
9033
9289
|
selectedDataElements,
|
|
9034
9290
|
selectedLanguage,
|
|
@@ -9667,6 +9923,7 @@ var RedactoNoticeAssisted = ({
|
|
|
9667
9923
|
return /* @__PURE__ */ jsx3("div", { style: styles3.overlay, children: /* @__PURE__ */ jsx3(
|
|
9668
9924
|
"div",
|
|
9669
9925
|
{
|
|
9926
|
+
...NOTICE_FONT_ROOT_PROPS,
|
|
9670
9927
|
style: {
|
|
9671
9928
|
...styles3.modal,
|
|
9672
9929
|
...responsive.modal,
|
|
@@ -9801,7 +10058,7 @@ var MailIcon = ({
|
|
|
9801
10058
|
);
|
|
9802
10059
|
|
|
9803
10060
|
// src/RedactoNoticeConsent/components/DigiLockerCallback.tsx
|
|
9804
|
-
import { useCallback as useCallback4, useEffect as
|
|
10061
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useRef as useRef4, useState as useState6 } from "react";
|
|
9805
10062
|
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
9806
10063
|
var DigiLockerCallback = ({
|
|
9807
10064
|
accessToken: propAccessToken,
|
|
@@ -10059,7 +10316,7 @@ var DigiLockerCallback = ({
|
|
|
10059
10316
|
}
|
|
10060
10317
|
}
|
|
10061
10318
|
}, [propAccessToken, baseUrl, onSuccess, onError, redirectToOriginalPage]);
|
|
10062
|
-
|
|
10319
|
+
useEffect7(() => {
|
|
10063
10320
|
injectCheckboxStyles();
|
|
10064
10321
|
handleCallback();
|
|
10065
10322
|
return () => {
|
|
@@ -10277,5 +10534,6 @@ export {
|
|
|
10277
10534
|
DigiLockerCallback,
|
|
10278
10535
|
RedactoNoticeAssisted,
|
|
10279
10536
|
RedactoNoticeConsent,
|
|
10280
|
-
RedactoConsentInline as RedactoNoticeConsentInline
|
|
10537
|
+
RedactoConsentInline as RedactoNoticeConsentInline,
|
|
10538
|
+
configureNoticeFonts
|
|
10281
10539
|
};
|