@redacto.io/consent-sdk-react 10.0.0-beta.11 → 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 +67 -3
- package/dist/chunk-FEGTW73Q.mjs +182 -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 +12 -1
- package/dist/index.d.ts +12 -1
- package/dist/index.js +613 -249
- package/dist/index.mjs +235 -85
- package/dist/montserrat.generated-NBTECYRW.mjs +22 -0
- 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 -383
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.test.tsx +0 -934
- package/src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx +0 -2160
- package/src/RedactoNoticeAssisted/api/index.ts +0 -275
- package/src/RedactoNoticeAssisted/api/types.ts +0 -182
- package/src/RedactoNoticeAssisted/assets/redacto-logo.png +0 -0
- package/src/RedactoNoticeAssisted/constants.ts +0 -51
- package/src/RedactoNoticeAssisted/i18n.ts +0 -1408
- 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 -26
- package/src/RedactoNoticeAssisted/useMediaQuery.ts +0 -36
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +0 -1186
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +0 -4299
- package/src/RedactoNoticeConsent/api/index.ts +0 -486
- package/src/RedactoNoticeConsent/api/sandbox.ts +0 -150
- package/src/RedactoNoticeConsent/api/types.ts +0 -505
- 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 -95
- package/src/RedactoNoticeConsent/services/storage.ts +0 -122
- package/src/RedactoNoticeConsent/styles.ts +0 -409
- package/src/RedactoNoticeConsent/types.ts +0 -80
- package/src/RedactoNoticeConsent/useMediaQuery.ts +0 -36
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.test.tsx +0 -369
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +0 -709
- package/src/RedactoNoticeConsentInline/api/index.ts +0 -115
- package/src/RedactoNoticeConsentInline/api/notice-read-routing.test.ts +0 -72
- package/src/RedactoNoticeConsentInline/api/types.ts +0 -185
- 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 -93
- package/src/RedactoPrivacyCenter/api/actions.ts +0 -682
- package/src/RedactoPrivacyCenter/api/client.ts +0 -1003
- package/src/RedactoPrivacyCenter/api/config.ts +0 -33
- package/src/RedactoPrivacyCenter/api/fetcher.ts +0 -275
- 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 -268
- 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 -245
- 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 -1199
- 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 -1821
- 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 -95
- package/src/RedactoPrivacyCenter/components/SelectUserGate.tsx +0 -195
- 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 -155
- 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 -252
- 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 -57
- package/src/RedactoPrivacyCenter/lib/api.ts +0 -759
- package/src/RedactoPrivacyCenter/lib/consent-manager/utils.tsx +0 -67
- package/src/RedactoPrivacyCenter/lib/constants.ts +0 -283
- package/src/RedactoPrivacyCenter/lib/i18n.ts +0 -81
- package/src/RedactoPrivacyCenter/lib/locales.ts +0 -102
- package/src/RedactoPrivacyCenter/lib/queries.ts +0 -141
- package/src/RedactoPrivacyCenter/lib/sandbox.ts +0 -104
- package/src/RedactoPrivacyCenter/lib/types.ts +0 -892
- 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 -798
- package/src/RedactoPrivacyCenter/locales/as/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 -355
- 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 -3108
- package/src/RedactoPrivacyCenter/styles/pcStyles.ts +0 -831
- 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.test.tsx +0 -83
- package/src/RedactoPrivacyCenter/ui/PCAvatar.tsx +0 -93
- 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/shared/notice-consent-status.ts +0 -190
- package/src/shared/sandbox.ts +0 -6
- 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 -1424
- package/tests/ProductSelectionSection.test.tsx +0 -328
- package/tests/RequestSubmit.test.tsx +0 -135
- package/tests/RevokeWarningMessage.test.tsx +0 -151
- package/tests/consentClient.test.ts +0 -217
- 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
|
@@ -2,9 +2,19 @@ import {
|
|
|
2
2
|
SANDBOX_TOKEN_HEADER,
|
|
3
3
|
useMediaQuery
|
|
4
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";
|
|
5
15
|
|
|
6
16
|
// src/RedactoNoticeConsent/RedactoNoticeConsent.tsx
|
|
7
|
-
import { useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
17
|
+
import { useCallback, useEffect as useEffect2, useMemo as useMemo2, useRef, useState } from "react";
|
|
8
18
|
|
|
9
19
|
// src/RedactoNoticeConsent/api/index.ts
|
|
10
20
|
import { jwtDecode as jwtDecode2 } from "jwt-decode";
|
|
@@ -779,6 +789,123 @@ var injectCheckboxStyles = () => {
|
|
|
779
789
|
stylesInjected = true;
|
|
780
790
|
};
|
|
781
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
|
+
|
|
782
909
|
// src/RedactoNoticeConsent/styles.ts
|
|
783
910
|
var styles = {
|
|
784
911
|
overlay: {
|
|
@@ -893,7 +1020,8 @@ var styles = {
|
|
|
893
1020
|
boxSizing: "border-box",
|
|
894
1021
|
textAlign: "left",
|
|
895
1022
|
cursor: "pointer",
|
|
896
|
-
backgroundColor: "#ffffff"
|
|
1023
|
+
backgroundColor: "#ffffff",
|
|
1024
|
+
fontFamily: "inherit"
|
|
897
1025
|
},
|
|
898
1026
|
middleSection: {
|
|
899
1027
|
margin: "0px",
|
|
@@ -1066,7 +1194,8 @@ var styles = {
|
|
|
1066
1194
|
cursor: "pointer",
|
|
1067
1195
|
margin: 0,
|
|
1068
1196
|
boxSizing: "border-box",
|
|
1069
|
-
textAlign: "center"
|
|
1197
|
+
textAlign: "center",
|
|
1198
|
+
fontFamily: "inherit"
|
|
1070
1199
|
},
|
|
1071
1200
|
acceptButton: {
|
|
1072
1201
|
backgroundColor: "#4f87ff",
|
|
@@ -1219,19 +1348,17 @@ var PurposeItem = ({
|
|
|
1219
1348
|
selectedLanguage,
|
|
1220
1349
|
initialDataElementSelections = {}
|
|
1221
1350
|
}) => {
|
|
1222
|
-
const headingStyle =
|
|
1351
|
+
const headingStyle = useMemo2(
|
|
1223
1352
|
() => ({
|
|
1224
|
-
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
1225
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
1353
|
+
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
1226
1354
|
}),
|
|
1227
|
-
[settings]
|
|
1355
|
+
[settings == null ? void 0 : settings.headingColor]
|
|
1228
1356
|
);
|
|
1229
|
-
const textStyle =
|
|
1357
|
+
const textStyle = useMemo2(
|
|
1230
1358
|
() => ({
|
|
1231
|
-
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
1232
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
1359
|
+
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
1233
1360
|
}),
|
|
1234
|
-
[settings]
|
|
1361
|
+
[settings == null ? void 0 : settings.textColor]
|
|
1235
1362
|
);
|
|
1236
1363
|
return /* @__PURE__ */ jsxs("div", { children: [
|
|
1237
1364
|
/* @__PURE__ */ jsxs("div", { style: styles4.optionItem, children: [
|
|
@@ -1536,7 +1663,7 @@ var GuardianForm = ({
|
|
|
1536
1663
|
const [openUpward, setOpenUpward] = useState(false);
|
|
1537
1664
|
const dropdownRef = useRef(null);
|
|
1538
1665
|
const optionsRef = useRef(null);
|
|
1539
|
-
|
|
1666
|
+
useEffect2(() => {
|
|
1540
1667
|
if (!isDropdownOpen) return;
|
|
1541
1668
|
const handleClickOutside = (e) => {
|
|
1542
1669
|
if (dropdownRef.current && !dropdownRef.current.contains(e.target)) {
|
|
@@ -1547,7 +1674,7 @@ var GuardianForm = ({
|
|
|
1547
1674
|
document.addEventListener("mousedown", handleClickOutside);
|
|
1548
1675
|
return () => document.removeEventListener("mousedown", handleClickOutside);
|
|
1549
1676
|
}, [isDropdownOpen]);
|
|
1550
|
-
|
|
1677
|
+
useEffect2(() => {
|
|
1551
1678
|
if (!isDropdownOpen || !dropdownRef.current) return;
|
|
1552
1679
|
const rect = dropdownRef.current.getBoundingClientRect();
|
|
1553
1680
|
const spaceBelow = window.innerHeight - rect.bottom;
|
|
@@ -1589,7 +1716,7 @@ var GuardianForm = ({
|
|
|
1589
1716
|
break;
|
|
1590
1717
|
}
|
|
1591
1718
|
};
|
|
1592
|
-
|
|
1719
|
+
useEffect2(() => {
|
|
1593
1720
|
var _a2;
|
|
1594
1721
|
if (focusedIndex >= 0 && optionsRef.current) {
|
|
1595
1722
|
const option = optionsRef.current.children[focusedIndex];
|
|
@@ -1600,14 +1727,12 @@ var GuardianForm = ({
|
|
|
1600
1727
|
const textColor = (settings == null ? void 0 : settings.textColor) || "#344054";
|
|
1601
1728
|
const bgColor = (settings == null ? void 0 : settings.backgroundColor) || "#ffffff";
|
|
1602
1729
|
const radius = (settings == null ? void 0 : settings.borderRadius) || "8px";
|
|
1603
|
-
const font = (settings == null ? void 0 : settings.font) || "inherit";
|
|
1604
1730
|
const inputStyle = {
|
|
1605
1731
|
width: "100%",
|
|
1606
1732
|
padding: "10px 12px",
|
|
1607
1733
|
border: `1px solid ${borderColor}`,
|
|
1608
1734
|
borderRadius: radius,
|
|
1609
1735
|
fontSize: "13px",
|
|
1610
|
-
fontFamily: font,
|
|
1611
1736
|
color: textColor,
|
|
1612
1737
|
backgroundColor: bgColor,
|
|
1613
1738
|
marginBottom: "2px",
|
|
@@ -1865,7 +1990,6 @@ var GuardianForm = ({
|
|
|
1865
1990
|
style: {
|
|
1866
1991
|
padding: "9px 12px",
|
|
1867
1992
|
fontSize: "13px",
|
|
1868
|
-
fontFamily: font,
|
|
1869
1993
|
color: isSelected ? accentColor : textColor,
|
|
1870
1994
|
backgroundColor: isFocused ? "#F3F4F6" : "transparent",
|
|
1871
1995
|
cursor: "pointer",
|
|
@@ -2406,7 +2530,7 @@ var RedactoNoticeConsent = ({
|
|
|
2406
2530
|
reviewModeButtonText = "Continue"
|
|
2407
2531
|
}) => {
|
|
2408
2532
|
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k, _l, _m, _n, _o, _p, _q;
|
|
2409
|
-
const sandboxParams =
|
|
2533
|
+
const sandboxParams = useMemo2(
|
|
2410
2534
|
() => ({
|
|
2411
2535
|
token,
|
|
2412
2536
|
sandboxUcic: ucic,
|
|
@@ -2416,7 +2540,7 @@ var RedactoNoticeConsent = ({
|
|
|
2416
2540
|
}),
|
|
2417
2541
|
[token, ucic, email, mobile, organisationUuid, workspaceUuid]
|
|
2418
2542
|
);
|
|
2419
|
-
const propValidationError =
|
|
2543
|
+
const propValidationError = useMemo2(() => {
|
|
2420
2544
|
if (!(noticeId == null ? void 0 : noticeId.trim())) {
|
|
2421
2545
|
return "RedactoNoticeConsent: 'noticeId' prop is required and cannot be empty";
|
|
2422
2546
|
}
|
|
@@ -2522,7 +2646,7 @@ var RedactoNoticeConsent = ({
|
|
|
2522
2646
|
const isPollingStatusRef = useRef(false);
|
|
2523
2647
|
const verificationSessionTokenRef = useRef(null);
|
|
2524
2648
|
const isMobile = useMediaQuery("(max-width: 768px)");
|
|
2525
|
-
const responsiveStyles =
|
|
2649
|
+
const responsiveStyles = useMemo2(
|
|
2526
2650
|
() => ({
|
|
2527
2651
|
modal: {
|
|
2528
2652
|
width: isMobile ? "90%" : "700px"
|
|
@@ -2603,28 +2727,29 @@ var RedactoNoticeConsent = ({
|
|
|
2603
2727
|
}),
|
|
2604
2728
|
[isMobile]
|
|
2605
2729
|
);
|
|
2606
|
-
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(
|
|
2607
2735
|
() => ({
|
|
2608
|
-
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
2609
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
2736
|
+
color: (settings == null ? void 0 : settings.headingColor) || "#323B4B"
|
|
2610
2737
|
}),
|
|
2611
|
-
[settings == null ? void 0 : settings.headingColor
|
|
2738
|
+
[settings == null ? void 0 : settings.headingColor]
|
|
2612
2739
|
);
|
|
2613
|
-
const componentTextStyle =
|
|
2740
|
+
const componentTextStyle = useMemo2(
|
|
2614
2741
|
() => ({
|
|
2615
|
-
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2616
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
2742
|
+
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2617
2743
|
}),
|
|
2618
|
-
[settings == null ? void 0 : settings.textColor
|
|
2744
|
+
[settings == null ? void 0 : settings.textColor]
|
|
2619
2745
|
);
|
|
2620
|
-
const sectionStyle =
|
|
2746
|
+
const sectionStyle = useMemo2(
|
|
2621
2747
|
() => ({
|
|
2622
|
-
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2623
|
-
fontFamily: (settings == null ? void 0 : settings.font) || "inherit"
|
|
2748
|
+
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
2624
2749
|
}),
|
|
2625
|
-
[settings == null ? void 0 : settings.textColor
|
|
2750
|
+
[settings == null ? void 0 : settings.textColor]
|
|
2626
2751
|
);
|
|
2627
|
-
const areAllRequiredElementsChecked =
|
|
2752
|
+
const areAllRequiredElementsChecked = useMemo2(() => {
|
|
2628
2753
|
if (!content) return false;
|
|
2629
2754
|
return content.purposes.every((purpose) => {
|
|
2630
2755
|
const requiredElements = purpose.data_elements.filter(
|
|
@@ -2636,7 +2761,7 @@ var RedactoNoticeConsent = ({
|
|
|
2636
2761
|
});
|
|
2637
2762
|
}, [content, selectedDataElements]);
|
|
2638
2763
|
const acceptDisabled = isSubmitting || !areAllRequiredElementsChecked;
|
|
2639
|
-
|
|
2764
|
+
useEffect2(() => {
|
|
2640
2765
|
var _a2, _b2;
|
|
2641
2766
|
clearApiCache();
|
|
2642
2767
|
isRequestInProgressRef.current = false;
|
|
@@ -2699,7 +2824,7 @@ var RedactoNoticeConsent = ({
|
|
|
2699
2824
|
}
|
|
2700
2825
|
isInitialMountRef.current = false;
|
|
2701
2826
|
}, [accessToken]);
|
|
2702
|
-
|
|
2827
|
+
useEffect2(() => {
|
|
2703
2828
|
if (hasAlreadyConsented) {
|
|
2704
2829
|
onAccept == null ? void 0 : onAccept();
|
|
2705
2830
|
}
|
|
@@ -2931,7 +3056,7 @@ var RedactoNoticeConsent = ({
|
|
|
2931
3056
|
isRequestInProgressRef.current = false;
|
|
2932
3057
|
}
|
|
2933
3058
|
};
|
|
2934
|
-
|
|
3059
|
+
useEffect2(() => {
|
|
2935
3060
|
injectCheckboxStyles();
|
|
2936
3061
|
fetchNotice();
|
|
2937
3062
|
}, [
|
|
@@ -3486,7 +3611,7 @@ var RedactoNoticeConsent = ({
|
|
|
3486
3611
|
}
|
|
3487
3612
|
clearConsentState();
|
|
3488
3613
|
}, []);
|
|
3489
|
-
const availableLanguages =
|
|
3614
|
+
const availableLanguages = useMemo2(() => {
|
|
3490
3615
|
if (!content) return [language];
|
|
3491
3616
|
const pinned = ["English"];
|
|
3492
3617
|
if (content.default_language && content.default_language !== "English" && content.default_language !== "en") {
|
|
@@ -3508,7 +3633,7 @@ var RedactoNoticeConsent = ({
|
|
|
3508
3633
|
},
|
|
3509
3634
|
[content]
|
|
3510
3635
|
);
|
|
3511
|
-
const audioSequence =
|
|
3636
|
+
const audioSequence = useMemo2(() => {
|
|
3512
3637
|
if (!ttsAudioUrls || !content) return [];
|
|
3513
3638
|
const sequence = [];
|
|
3514
3639
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -3573,7 +3698,7 @@ var RedactoNoticeConsent = ({
|
|
|
3573
3698
|
}
|
|
3574
3699
|
return sequence;
|
|
3575
3700
|
}, [ttsAudioUrls, content, categorizedPurposes]);
|
|
3576
|
-
const elementIdSequence =
|
|
3701
|
+
const elementIdSequence = useMemo2(() => {
|
|
3577
3702
|
if (!ttsAudioUrls || !content) return [];
|
|
3578
3703
|
const elementIds = [];
|
|
3579
3704
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -3706,7 +3831,7 @@ var RedactoNoticeConsent = ({
|
|
|
3706
3831
|
playAudio();
|
|
3707
3832
|
}
|
|
3708
3833
|
}, [isPlaying, playAudio, pauseAudio]);
|
|
3709
|
-
|
|
3834
|
+
useEffect2(() => {
|
|
3710
3835
|
var _a2;
|
|
3711
3836
|
if (!isPlaying || !content || audioSequence.length === 0) return;
|
|
3712
3837
|
const currentIndex = currentAudioIndex;
|
|
@@ -3740,7 +3865,7 @@ var RedactoNoticeConsent = ({
|
|
|
3740
3865
|
categorizedPurposes,
|
|
3741
3866
|
collapsedPurposes
|
|
3742
3867
|
]);
|
|
3743
|
-
|
|
3868
|
+
useEffect2(() => {
|
|
3744
3869
|
const removeAllHighlights = () => {
|
|
3745
3870
|
document.querySelectorAll(".redacto-tts-highlight").forEach((el) => {
|
|
3746
3871
|
el.classList.remove("redacto-tts-highlight");
|
|
@@ -3776,7 +3901,7 @@ var RedactoNoticeConsent = ({
|
|
|
3776
3901
|
removeAllHighlights();
|
|
3777
3902
|
};
|
|
3778
3903
|
}, [highlightedElementId, isPlaying]);
|
|
3779
|
-
|
|
3904
|
+
useEffect2(() => {
|
|
3780
3905
|
setIsTTSAvailable(false);
|
|
3781
3906
|
setTtsAudioUrls(null);
|
|
3782
3907
|
stopAudio();
|
|
@@ -3808,7 +3933,8 @@ var RedactoNoticeConsent = ({
|
|
|
3808
3933
|
}, [content, selectedLanguage, accessToken, sandboxParams, baseUrl, ledgerBaseUrl, getLanguageCode]);
|
|
3809
3934
|
const modalStyle = {
|
|
3810
3935
|
borderRadius: (settings == null ? void 0 : settings.borderRadius) || "8px",
|
|
3811
|
-
backgroundColor: (settings == null ? void 0 : settings.backgroundColor) || "#ffffff"
|
|
3936
|
+
backgroundColor: (settings == null ? void 0 : settings.backgroundColor) || "#ffffff",
|
|
3937
|
+
fontFamily
|
|
3812
3938
|
};
|
|
3813
3939
|
const buttonStyle = {
|
|
3814
3940
|
borderRadius: (settings == null ? void 0 : settings.borderRadius) || "8px"
|
|
@@ -3842,7 +3968,7 @@ var RedactoNoticeConsent = ({
|
|
|
3842
3968
|
const handleCloseError = () => {
|
|
3843
3969
|
setErrorMessage(null);
|
|
3844
3970
|
};
|
|
3845
|
-
|
|
3971
|
+
useEffect2(() => {
|
|
3846
3972
|
const handleKeyDown = (event) => {
|
|
3847
3973
|
if (!modalRef.current) return;
|
|
3848
3974
|
const focusableElements = modalRef.current.querySelectorAll(
|
|
@@ -3881,13 +4007,13 @@ var RedactoNoticeConsent = ({
|
|
|
3881
4007
|
modal == null ? void 0 : modal.removeEventListener("keydown", handleKeyDown);
|
|
3882
4008
|
};
|
|
3883
4009
|
}, [isLoading, handleDecline]);
|
|
3884
|
-
|
|
4010
|
+
useEffect2(() => {
|
|
3885
4011
|
stopAudio();
|
|
3886
4012
|
}, [selectedLanguage, stopAudio]);
|
|
3887
|
-
|
|
4013
|
+
useEffect2(() => {
|
|
3888
4014
|
stopAudio();
|
|
3889
4015
|
}, [content, stopAudio]);
|
|
3890
|
-
|
|
4016
|
+
useEffect2(() => {
|
|
3891
4017
|
return () => {
|
|
3892
4018
|
var _a2, _b2;
|
|
3893
4019
|
if (abortControllerRef.current) {
|
|
@@ -3913,7 +4039,7 @@ var RedactoNoticeConsent = ({
|
|
|
3913
4039
|
}
|
|
3914
4040
|
};
|
|
3915
4041
|
}, [stopAudio]);
|
|
3916
|
-
|
|
4042
|
+
useEffect2(() => {
|
|
3917
4043
|
const persistedState = getConsentState();
|
|
3918
4044
|
if (!persistedState) return;
|
|
3919
4045
|
if (persistedState.noticeId && persistedState.noticeId !== noticeId) {
|
|
@@ -3963,6 +4089,7 @@ var RedactoNoticeConsent = ({
|
|
|
3963
4089
|
"div",
|
|
3964
4090
|
{
|
|
3965
4091
|
ref: modalRef,
|
|
4092
|
+
...NOTICE_FONT_ROOT_PROPS,
|
|
3966
4093
|
style: {
|
|
3967
4094
|
...styles.modal,
|
|
3968
4095
|
...responsiveStyles.modal,
|
|
@@ -4771,7 +4898,7 @@ var RedactoNoticeConsent = ({
|
|
|
4771
4898
|
};
|
|
4772
4899
|
|
|
4773
4900
|
// src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx
|
|
4774
|
-
import { useEffect as
|
|
4901
|
+
import { useEffect as useEffect4, useMemo as useMemo3, useState as useState3, useRef as useRef2, useCallback as useCallback2, memo } from "react";
|
|
4775
4902
|
|
|
4776
4903
|
// src/RedactoNoticeConsentInline/api/index.ts
|
|
4777
4904
|
var BASE_URL2 = "https://api.redacto.tech/consent";
|
|
@@ -4865,6 +4992,15 @@ var submitConsentEvent2 = async ({
|
|
|
4865
4992
|
|
|
4866
4993
|
// src/RedactoNoticeConsentInline/styles.ts
|
|
4867
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
|
+
},
|
|
4868
5004
|
overlay: {
|
|
4869
5005
|
position: "fixed",
|
|
4870
5006
|
top: 0,
|
|
@@ -5211,11 +5347,11 @@ var styles2 = {
|
|
|
5211
5347
|
};
|
|
5212
5348
|
|
|
5213
5349
|
// src/RedactoNoticeConsentInline/useMediaQuery.ts
|
|
5214
|
-
import { useState as useState2, useEffect as
|
|
5350
|
+
import { useState as useState2, useEffect as useEffect3 } from "react";
|
|
5215
5351
|
var useMediaQuery2 = (query) => {
|
|
5216
5352
|
const getMatches = () => typeof window !== "undefined" ? window.matchMedia(query).matches : false;
|
|
5217
5353
|
const [matches, setMatches] = useState2(getMatches);
|
|
5218
|
-
|
|
5354
|
+
useEffect3(() => {
|
|
5219
5355
|
if (typeof window === "undefined") return;
|
|
5220
5356
|
const media = window.matchMedia(query);
|
|
5221
5357
|
const listener = (e) => {
|
|
@@ -5296,11 +5432,11 @@ var RedactoConsentInlineComponent = ({
|
|
|
5296
5432
|
const [fetchError, setFetchError] = useState3(null);
|
|
5297
5433
|
const [errorMessage, setErrorMessage] = useState3(null);
|
|
5298
5434
|
const hasSubmittedRef = useRef2(false);
|
|
5299
|
-
|
|
5435
|
+
useEffect4(() => {
|
|
5300
5436
|
injectSpinnerAnimation();
|
|
5301
5437
|
}, []);
|
|
5302
5438
|
const isMobile = useMediaQuery2("(max-width: 768px)");
|
|
5303
|
-
const responsiveStyles =
|
|
5439
|
+
const responsiveStyles = useMemo3(
|
|
5304
5440
|
() => ({
|
|
5305
5441
|
optionTitle: {
|
|
5306
5442
|
fontSize: isMobile ? "14px" : "16px"
|
|
@@ -5318,7 +5454,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5318
5454
|
}),
|
|
5319
5455
|
[isMobile]
|
|
5320
5456
|
);
|
|
5321
|
-
const areAllRequiredElementsChecked =
|
|
5457
|
+
const areAllRequiredElementsChecked = useMemo3(() => {
|
|
5322
5458
|
if (!content) return false;
|
|
5323
5459
|
return content.purposes.every((purpose) => {
|
|
5324
5460
|
const requiredElements = purpose.data_elements.filter(
|
|
@@ -5329,10 +5465,10 @@ var RedactoConsentInlineComponent = ({
|
|
|
5329
5465
|
);
|
|
5330
5466
|
});
|
|
5331
5467
|
}, [content, selectedDataElements]);
|
|
5332
|
-
|
|
5468
|
+
useEffect4(() => {
|
|
5333
5469
|
onValidationChange == null ? void 0 : onValidationChange(areAllRequiredElementsChecked);
|
|
5334
5470
|
}, [areAllRequiredElementsChecked, onValidationChange]);
|
|
5335
|
-
|
|
5471
|
+
useEffect4(() => {
|
|
5336
5472
|
if (hasAlreadyConsented) {
|
|
5337
5473
|
onAccept == null ? void 0 : onAccept();
|
|
5338
5474
|
}
|
|
@@ -5443,14 +5579,14 @@ var RedactoConsentInlineComponent = ({
|
|
|
5443
5579
|
}
|
|
5444
5580
|
}
|
|
5445
5581
|
};
|
|
5446
|
-
|
|
5582
|
+
useEffect4(() => {
|
|
5447
5583
|
const controller = new AbortController();
|
|
5448
5584
|
void fetchNotice(controller.signal);
|
|
5449
5585
|
return () => {
|
|
5450
5586
|
controller.abort();
|
|
5451
5587
|
};
|
|
5452
5588
|
}, [org_uuid, workspace_uuid, notice_uuid, language, applicationId, accessToken]);
|
|
5453
|
-
|
|
5589
|
+
useEffect4(() => {
|
|
5454
5590
|
if (!ledgerBaseUrl || applicationId) {
|
|
5455
5591
|
return;
|
|
5456
5592
|
}
|
|
@@ -5604,7 +5740,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5604
5740
|
onAccept
|
|
5605
5741
|
]
|
|
5606
5742
|
);
|
|
5607
|
-
|
|
5743
|
+
useEffect4(() => {
|
|
5608
5744
|
if (accessToken && content && areAllRequiredElementsChecked && !isSubmitting && !isCheckingConsent && !hasAlreadyConsented && !hasSubmittedRef.current) {
|
|
5609
5745
|
hasSubmittedRef.current = true;
|
|
5610
5746
|
const autoSubmit = async () => {
|
|
@@ -5626,7 +5762,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5626
5762
|
hasAlreadyConsented,
|
|
5627
5763
|
handleAcceptWithToken
|
|
5628
5764
|
]);
|
|
5629
|
-
|
|
5765
|
+
useEffect4(() => {
|
|
5630
5766
|
if (!accessToken) {
|
|
5631
5767
|
hasSubmittedRef.current = false;
|
|
5632
5768
|
}
|
|
@@ -5637,11 +5773,20 @@ var RedactoConsentInlineComponent = ({
|
|
|
5637
5773
|
const textStyle = {
|
|
5638
5774
|
color: (settings == null ? void 0 : settings.textColor) || "#344054"
|
|
5639
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
|
+
};
|
|
5640
5785
|
if (hasAlreadyConsented || fetchError) {
|
|
5641
5786
|
return null;
|
|
5642
5787
|
}
|
|
5643
5788
|
if (isLoading) {
|
|
5644
|
-
return /* @__PURE__ */ jsxs2("div", { style:
|
|
5789
|
+
return /* @__PURE__ */ jsxs2("div", { ...NOTICE_FONT_ROOT_PROPS, style: loadingRootStyle, children: [
|
|
5645
5790
|
/* @__PURE__ */ jsx2("div", { style: styles2.loadingSpinner }),
|
|
5646
5791
|
/* @__PURE__ */ jsx2("p", { style: { ...styles2.privacyText, ...textStyle }, children: "Loading..." })
|
|
5647
5792
|
] });
|
|
@@ -5649,7 +5794,7 @@ var RedactoConsentInlineComponent = ({
|
|
|
5649
5794
|
if (!content) {
|
|
5650
5795
|
return null;
|
|
5651
5796
|
}
|
|
5652
|
-
return /* @__PURE__ */ jsxs2("div", {
|
|
5797
|
+
return /* @__PURE__ */ jsxs2("div", { ...NOTICE_FONT_ROOT_PROPS, style: rootStyle, children: [
|
|
5653
5798
|
errorMessage && /* @__PURE__ */ jsx2(
|
|
5654
5799
|
"div",
|
|
5655
5800
|
{
|
|
@@ -5828,7 +5973,7 @@ RedactoConsentInlineComponent.displayName = "RedactoConsentInline";
|
|
|
5828
5973
|
var RedactoConsentInline = memo(RedactoConsentInlineComponent);
|
|
5829
5974
|
|
|
5830
5975
|
// src/RedactoNoticeAssisted/RedactoNoticeAssisted.tsx
|
|
5831
|
-
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";
|
|
5832
5977
|
|
|
5833
5978
|
// src/RedactoNoticeAssisted/styles.ts
|
|
5834
5979
|
var styles3 = {
|
|
@@ -5934,6 +6079,7 @@ var styles3 = {
|
|
|
5934
6079
|
display: "flex",
|
|
5935
6080
|
alignItems: "center",
|
|
5936
6081
|
justifyContent: "center",
|
|
6082
|
+
fontFamily: "inherit",
|
|
5937
6083
|
fontWeight: 400,
|
|
5938
6084
|
fontSize: "12px",
|
|
5939
6085
|
lineHeight: "150%",
|
|
@@ -6311,6 +6457,7 @@ var styles3 = {
|
|
|
6311
6457
|
borderRadius: "8px",
|
|
6312
6458
|
border: "1px solid #d0d5dd",
|
|
6313
6459
|
textAlign: "center",
|
|
6460
|
+
fontFamily: "inherit",
|
|
6314
6461
|
fontSize: "18px",
|
|
6315
6462
|
fontWeight: 500,
|
|
6316
6463
|
color: "#101828",
|
|
@@ -6432,6 +6579,7 @@ var styles3 = {
|
|
|
6432
6579
|
width: "100%",
|
|
6433
6580
|
borderRadius: "8px",
|
|
6434
6581
|
padding: "9px 45px",
|
|
6582
|
+
fontFamily: "inherit",
|
|
6435
6583
|
fontWeight: 400,
|
|
6436
6584
|
fontSize: "16px",
|
|
6437
6585
|
lineHeight: "150%",
|
|
@@ -6731,11 +6879,11 @@ var injectAssistedStyles = () => {
|
|
|
6731
6879
|
};
|
|
6732
6880
|
|
|
6733
6881
|
// src/RedactoNoticeAssisted/useMediaQuery.ts
|
|
6734
|
-
import { useState as useState4, useEffect as
|
|
6882
|
+
import { useState as useState4, useEffect as useEffect5 } from "react";
|
|
6735
6883
|
var useMediaQuery3 = (query) => {
|
|
6736
6884
|
const getMatches = () => typeof window !== "undefined" ? window.matchMedia(query).matches : false;
|
|
6737
6885
|
const [matches, setMatches] = useState4(getMatches);
|
|
6738
|
-
|
|
6886
|
+
useEffect5(() => {
|
|
6739
6887
|
if (typeof window === "undefined") return;
|
|
6740
6888
|
const media = window.matchMedia(query);
|
|
6741
6889
|
const listener = (e) => {
|
|
@@ -8390,10 +8538,10 @@ var RedactoNoticeAssisted = ({
|
|
|
8390
8538
|
const [isVerifying, setIsVerifying] = useState5(false);
|
|
8391
8539
|
const [createError, setCreateError] = useState5(null);
|
|
8392
8540
|
const [otpError, setOtpError] = useState5(null);
|
|
8393
|
-
|
|
8541
|
+
useEffect6(() => {
|
|
8394
8542
|
injectAssistedStyles();
|
|
8395
8543
|
}, []);
|
|
8396
|
-
|
|
8544
|
+
useEffect6(() => {
|
|
8397
8545
|
const controller = new AbortController();
|
|
8398
8546
|
setIsLoading(true);
|
|
8399
8547
|
setFetchError(null);
|
|
@@ -8431,14 +8579,14 @@ var RedactoNoticeAssisted = ({
|
|
|
8431
8579
|
});
|
|
8432
8580
|
return () => controller.abort();
|
|
8433
8581
|
}, [organisationUuid, workspaceUuid, noticeUuid, baseUrl]);
|
|
8434
|
-
|
|
8582
|
+
useEffect6(() => {
|
|
8435
8583
|
if (resendCountdown <= 0) return;
|
|
8436
8584
|
const intervalId = window.setInterval(() => {
|
|
8437
8585
|
setResendCountdown((prev) => prev <= 1 ? 0 : prev - 1);
|
|
8438
8586
|
}, 1e3);
|
|
8439
8587
|
return () => window.clearInterval(intervalId);
|
|
8440
8588
|
}, [resendCountdown]);
|
|
8441
|
-
|
|
8589
|
+
useEffect6(() => {
|
|
8442
8590
|
if (step !== "verify") return;
|
|
8443
8591
|
const id = window.setTimeout(
|
|
8444
8592
|
() => scrollIntoViewSoft(verifyBlockRef.current),
|
|
@@ -8446,7 +8594,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8446
8594
|
);
|
|
8447
8595
|
return () => window.clearTimeout(id);
|
|
8448
8596
|
}, [step]);
|
|
8449
|
-
|
|
8597
|
+
useEffect6(() => {
|
|
8450
8598
|
if (!otpSent) return;
|
|
8451
8599
|
const id = window.setTimeout(
|
|
8452
8600
|
() => scrollIntoViewSoft(otpSectionRef.current),
|
|
@@ -8454,7 +8602,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8454
8602
|
);
|
|
8455
8603
|
return () => window.clearTimeout(id);
|
|
8456
8604
|
}, [otpSent]);
|
|
8457
|
-
|
|
8605
|
+
useEffect6(() => {
|
|
8458
8606
|
if (!isLanguageDropdownOpen) return;
|
|
8459
8607
|
const handleClickOutside = (e) => {
|
|
8460
8608
|
if (languageContainerRef.current && !languageContainerRef.current.contains(e.target)) {
|
|
@@ -8469,7 +8617,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8469
8617
|
const isMobileValid = mobile.replace(/\D/g, "").length >= 10;
|
|
8470
8618
|
const isEmailValid = EMAIL_REGEX.test(email.trim());
|
|
8471
8619
|
const isContactValid = verifyMethod === "email" ? isEmailValid : isMobileValid;
|
|
8472
|
-
const areAllRequiredElementsChecked =
|
|
8620
|
+
const areAllRequiredElementsChecked = useMemo4(() => {
|
|
8473
8621
|
if (!content) return false;
|
|
8474
8622
|
return content.purposes.every((purpose) => {
|
|
8475
8623
|
const requiredElements = purpose.data_elements.filter(
|
|
@@ -8480,7 +8628,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8480
8628
|
);
|
|
8481
8629
|
});
|
|
8482
8630
|
}, [content, selectedDataElements]);
|
|
8483
|
-
const normalizedDefaultLang =
|
|
8631
|
+
const normalizedDefaultLang = useMemo4(() => {
|
|
8484
8632
|
const dl = content == null ? void 0 : content.default_language;
|
|
8485
8633
|
if (!dl) return "English";
|
|
8486
8634
|
return dl === "en" || dl === "EN" ? "English" : dl;
|
|
@@ -8489,7 +8637,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8489
8637
|
(lang) => lang === "English" || lang === "en" || lang === "EN",
|
|
8490
8638
|
[]
|
|
8491
8639
|
);
|
|
8492
|
-
const ts =
|
|
8640
|
+
const ts = useMemo4(
|
|
8493
8641
|
() => makeStaticT(toBcp47Code(selectedLanguage)),
|
|
8494
8642
|
[selectedLanguage]
|
|
8495
8643
|
);
|
|
@@ -8535,7 +8683,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8535
8683
|
},
|
|
8536
8684
|
[content, selectedLanguage, isDefaultLanguage]
|
|
8537
8685
|
);
|
|
8538
|
-
const availableLanguages =
|
|
8686
|
+
const availableLanguages = useMemo4(() => {
|
|
8539
8687
|
if (!content) return [selectedLanguage];
|
|
8540
8688
|
const pinned = ["English"];
|
|
8541
8689
|
if (normalizedDefaultLang && normalizedDefaultLang !== "English") {
|
|
@@ -8552,10 +8700,10 @@ var RedactoNoticeAssisted = ({
|
|
|
8552
8700
|
"--ra-accent": primaryColor,
|
|
8553
8701
|
"--ra-accent-soft": accentSoft
|
|
8554
8702
|
};
|
|
8555
|
-
const fontFamily = (content == null ? void 0 : content.font_preference)
|
|
8703
|
+
const fontFamily = useNoticeFont({ noticeFont: content == null ? void 0 : content.font_preference });
|
|
8556
8704
|
const logoUrl = (content == null ? void 0 : content.logo_url) || redacto_logo_default2;
|
|
8557
8705
|
const linkStyle = { ...styles3.link, color: secondaryColor };
|
|
8558
|
-
const responsive =
|
|
8706
|
+
const responsive = useMemo4(
|
|
8559
8707
|
() => ({
|
|
8560
8708
|
modal: { width: isMobile ? "90%" : "700px" },
|
|
8561
8709
|
title: { fontSize: isMobile ? "16px" : "18px" },
|
|
@@ -8646,7 +8794,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8646
8794
|
setSelectedLanguage(lang);
|
|
8647
8795
|
setIsLanguageDropdownOpen(false);
|
|
8648
8796
|
}, []);
|
|
8649
|
-
const audioSequence =
|
|
8797
|
+
const audioSequence = useMemo4(() => {
|
|
8650
8798
|
if (!ttsAudioUrls || !content) return [];
|
|
8651
8799
|
const sequence = [];
|
|
8652
8800
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -8707,7 +8855,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8707
8855
|
}
|
|
8708
8856
|
return sequence;
|
|
8709
8857
|
}, [ttsAudioUrls, content]);
|
|
8710
|
-
const elementIdSequence =
|
|
8858
|
+
const elementIdSequence = useMemo4(() => {
|
|
8711
8859
|
if (!ttsAudioUrls || !content) return [];
|
|
8712
8860
|
const elementIds = [];
|
|
8713
8861
|
if (ttsAudioUrls.notice_banner_heading_audio_url) {
|
|
@@ -8836,7 +8984,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8836
8984
|
playAudio();
|
|
8837
8985
|
}
|
|
8838
8986
|
}, [isPlaying, playAudio, pauseAudio]);
|
|
8839
|
-
|
|
8987
|
+
useEffect6(() => {
|
|
8840
8988
|
setIsTTSAvailable(false);
|
|
8841
8989
|
setTtsAudioUrls(null);
|
|
8842
8990
|
stopAudio();
|
|
@@ -8867,7 +9015,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8867
9015
|
baseUrl,
|
|
8868
9016
|
stopAudio
|
|
8869
9017
|
]);
|
|
8870
|
-
|
|
9018
|
+
useEffect6(() => {
|
|
8871
9019
|
var _a;
|
|
8872
9020
|
if (!isPlaying || !content || audioSequence.length === 0) return;
|
|
8873
9021
|
const currentIndex = currentAudioIndex;
|
|
@@ -8886,7 +9034,7 @@ var RedactoNoticeAssisted = ({
|
|
|
8886
9034
|
audioOffset += totalPurposeAudioCount;
|
|
8887
9035
|
}
|
|
8888
9036
|
}, [isPlaying, currentAudioIndex, audioSequence, content, collapsedPurposes]);
|
|
8889
|
-
|
|
9037
|
+
useEffect6(() => {
|
|
8890
9038
|
const removeAllHighlights = () => {
|
|
8891
9039
|
document.querySelectorAll(".redacto-tts-highlight").forEach((el) => {
|
|
8892
9040
|
el.classList.remove("redacto-tts-highlight");
|
|
@@ -9775,6 +9923,7 @@ var RedactoNoticeAssisted = ({
|
|
|
9775
9923
|
return /* @__PURE__ */ jsx3("div", { style: styles3.overlay, children: /* @__PURE__ */ jsx3(
|
|
9776
9924
|
"div",
|
|
9777
9925
|
{
|
|
9926
|
+
...NOTICE_FONT_ROOT_PROPS,
|
|
9778
9927
|
style: {
|
|
9779
9928
|
...styles3.modal,
|
|
9780
9929
|
...responsive.modal,
|
|
@@ -9909,7 +10058,7 @@ var MailIcon = ({
|
|
|
9909
10058
|
);
|
|
9910
10059
|
|
|
9911
10060
|
// src/RedactoNoticeConsent/components/DigiLockerCallback.tsx
|
|
9912
|
-
import { useCallback as useCallback4, useEffect as
|
|
10061
|
+
import { useCallback as useCallback4, useEffect as useEffect7, useRef as useRef4, useState as useState6 } from "react";
|
|
9913
10062
|
import { Fragment as Fragment3, jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
9914
10063
|
var DigiLockerCallback = ({
|
|
9915
10064
|
accessToken: propAccessToken,
|
|
@@ -10167,7 +10316,7 @@ var DigiLockerCallback = ({
|
|
|
10167
10316
|
}
|
|
10168
10317
|
}
|
|
10169
10318
|
}, [propAccessToken, baseUrl, onSuccess, onError, redirectToOriginalPage]);
|
|
10170
|
-
|
|
10319
|
+
useEffect7(() => {
|
|
10171
10320
|
injectCheckboxStyles();
|
|
10172
10321
|
handleCallback();
|
|
10173
10322
|
return () => {
|
|
@@ -10385,5 +10534,6 @@ export {
|
|
|
10385
10534
|
DigiLockerCallback,
|
|
10386
10535
|
RedactoNoticeAssisted,
|
|
10387
10536
|
RedactoNoticeConsent,
|
|
10388
|
-
RedactoConsentInline as RedactoNoticeConsentInline
|
|
10537
|
+
RedactoConsentInline as RedactoNoticeConsentInline,
|
|
10538
|
+
configureNoticeFonts
|
|
10389
10539
|
};
|