@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/NOTICE.md
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Third-party font licences
|
|
2
|
+
|
|
3
|
+
`@redacto.io/consent-sdk-react` bundles the webfonts below so a consent notice can render the font
|
|
4
|
+
family chosen in the Redacto console without contacting any third-party server. The files are
|
|
5
|
+
subset to Latin + Latin-Extended and converted to WOFF2; they are derived works of the upstreams
|
|
6
|
+
listed here.
|
|
7
|
+
|
|
8
|
+
| Family | Licence | Upstream |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| Montserrat | OFL-1.1 | https://github.com/google/fonts/tree/main/ofl/montserrat |
|
|
11
|
+
|
|
12
|
+
None of these families carry a Reserved Font Name, so the derived files keep the original family
|
|
13
|
+
names. The full licence text is reproduced in `fonts/licenses/` in the source repository and in
|
|
14
|
+
each family's `LICENSE.txt` alongside the font files.
|
|
15
|
+
|
|
16
|
+
The other font families the console offers (Arial, Georgia, Verdana, …) are **not** redistributed —
|
|
17
|
+
they are referenced by name and resolved from whatever the visitor's device already has.
|
package/README.md
CHANGED
|
@@ -117,6 +117,80 @@ npm install @tanstack/react-query @tanstack/react-table \
|
|
|
117
117
|
|
|
118
118
|
If you only use `RedactoNoticeConsent` or `RedactoNoticeConsentInline`, these peers are not needed.
|
|
119
119
|
|
|
120
|
+
## Sandbox Mode (No Backend Required)
|
|
121
|
+
|
|
122
|
+
Sandbox mode lets you build and test a full consent PoC — **notice → Privacy Center → DSAR** — straight from your app, with **no backend and no token minting**. Instead of your server generating a JWT, you paste a **static sandbox token** into the SDK. Everything you create is recorded as test data, isolated from your live records.
|
|
123
|
+
|
|
124
|
+
Going live is a config swap, not a rewrite: drop the sandbox props and pass a real JWT (see [Backend Server Setup](#backend-server-setup)).
|
|
125
|
+
|
|
126
|
+
### 1. Get your sandbox credentials
|
|
127
|
+
|
|
128
|
+
In the **Redacto Dashboard → API Keys → Sandbox** tab, copy:
|
|
129
|
+
|
|
130
|
+
- your **Sandbox token** (a static string; it never expires and needs no refresh)
|
|
131
|
+
- your **Organization ID** and **Workspace ID** (shown under *Workspace identifiers* on the same page)
|
|
132
|
+
|
|
133
|
+
### 2. Collect consent
|
|
134
|
+
|
|
135
|
+
Pass the sandbox `token`, org/workspace, and a test identity (`email`, `mobile`, or `ucic`). No `accessToken` is needed:
|
|
136
|
+
|
|
137
|
+
```tsx
|
|
138
|
+
import { RedactoNoticeConsent } from "@redacto.io/consent-sdk-react";
|
|
139
|
+
|
|
140
|
+
<RedactoNoticeConsent
|
|
141
|
+
noticeId={NOTICE_UUID}
|
|
142
|
+
token={SANDBOX_TOKEN}
|
|
143
|
+
organisationUuid={ORG_UUID}
|
|
144
|
+
workspaceUuid={WORKSPACE_UUID}
|
|
145
|
+
email="test.user@example.com" // or `mobile`, or `ucic`
|
|
146
|
+
onAccept={() => console.log("consent recorded (test)")}
|
|
147
|
+
onDecline={() => {}}
|
|
148
|
+
/>;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
### 3. Manage consent & raise a DSAR
|
|
152
|
+
|
|
153
|
+
Point the Privacy Center at the same sandbox token and test identity. The same test user can now review the consent from step 2, withdraw it, and file a DSAR — end to end, all as test data:
|
|
154
|
+
|
|
155
|
+
```tsx
|
|
156
|
+
import { RedactoPrivacyCenter } from "@redacto.io/consent-sdk-react/privacy-center";
|
|
157
|
+
|
|
158
|
+
<RedactoPrivacyCenter
|
|
159
|
+
token={SANDBOX_TOKEN}
|
|
160
|
+
organisationUuid={ORG_UUID}
|
|
161
|
+
workspaceUuid={WORKSPACE_UUID}
|
|
162
|
+
email="test.user@example.com" // or `mobile`, or `ucic`
|
|
163
|
+
slug="acme-co"
|
|
164
|
+
onError={(error) => {
|
|
165
|
+
console.error(error);
|
|
166
|
+
return false;
|
|
167
|
+
}}
|
|
168
|
+
/>;
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
### Sandbox props
|
|
172
|
+
|
|
173
|
+
| Prop | Required | Description |
|
|
174
|
+
| --------------------------- | ------------ | --------------------------------------------------------------------------------- |
|
|
175
|
+
| `token` | Yes | Static sandbox token from the Dashboard. Its presence activates sandbox mode. |
|
|
176
|
+
| `organisationUuid` | Yes | Organization ID from the Dashboard. |
|
|
177
|
+
| `workspaceUuid` | Yes | Workspace ID from the Dashboard. |
|
|
178
|
+
| `email` / `mobile` / `ucic` | One required | The test subject. Precedence when more than one is set: `ucic` > `email` > `mobile`. |
|
|
179
|
+
|
|
180
|
+
`RedactoPrivacyCenter` takes the same sandbox props — `token`, `organisationUuid`, `workspaceUuid`, and `email` / `mobile` / `ucic`.
|
|
181
|
+
|
|
182
|
+
### How it works
|
|
183
|
+
|
|
184
|
+
- The SDK sends the sandbox token as an `X-Consent-Token` header and the test identity inside each request (query params on reads, body on writes) — no JWT decode, no token refresh (a `401` fails fast).
|
|
185
|
+
- The server records everything under `environment=test`, namespaced so sandbox data never mixes with — or reads — your live records.
|
|
186
|
+
- Sandbox always talks to the consent server; it never routes to the Go ledger.
|
|
187
|
+
|
|
188
|
+
### Going live
|
|
189
|
+
|
|
190
|
+
Sandbox and production use the same components. To ship, remove the sandbox props and pass a real `accessToken` / `refreshToken` (JWT) minted by your backend — see [Backend Server Setup](#backend-server-setup) below. New records are then written as `environment=live`.
|
|
191
|
+
|
|
192
|
+
> Sandbox is available on `RedactoNoticeConsent` and `RedactoPrivacyCenter`. The inline (`RedactoNoticeConsentInline`) and assisted (`RedactoNoticeAssisted`) widgets are JWT/OTP-only.
|
|
193
|
+
|
|
120
194
|
### Backend Server Setup
|
|
121
195
|
|
|
122
196
|
Before using the SDK components, you need to set up backend server endpoints that generate access tokens by calling Redacto's API. Your server should implement the following endpoints:
|
|
@@ -249,6 +323,7 @@ A modal popup component for consent collection. Displays a full-screen modal wit
|
|
|
249
323
|
| `accessToken` | `string` | Yes | - | Authentication token for API calls |
|
|
250
324
|
| `refreshToken` | `string` | Yes | - | Refresh token for token renewal |
|
|
251
325
|
| `baseUrl` | `string` | No | - | Base URL for the consent API |
|
|
326
|
+
| `ledgerBaseUrl` | `string` | No | - | Go ledger base URL. When set, consent writes and prior-consent checks route through the ledger (falls back: ledger → baseUrl → default). Omit to keep the legacy consent-server path. |
|
|
252
327
|
| `blockUI` | `boolean` | No | `true` | Whether to block UI interaction |
|
|
253
328
|
| `language` | `string` | No | `"en"` | Language code |
|
|
254
329
|
| `settings` | `object` | No | - | Custom styling options |
|
|
@@ -335,6 +410,7 @@ The component automatically submits consent when all of the following conditions
|
|
|
335
410
|
| `accessToken` | `string` | No | - | Authentication token |
|
|
336
411
|
| `refreshToken` | `string` | No | - | Refresh token |
|
|
337
412
|
| `baseUrl` | `string` | No | - | Base URL for the consent API |
|
|
413
|
+
| `ledgerBaseUrl` | `string` | No | - | Go ledger base URL. When set, consent writes and already-consented checks route through the ledger. Omit for legacy behavior. |
|
|
338
414
|
| `language` | `string` | No | `"en"` | Language code |
|
|
339
415
|
| `settings` | `object` | No | - | Custom styling options |
|
|
340
416
|
| `applicationId` | `string` | No | - | Application-specific UUID |
|
|
@@ -365,6 +441,7 @@ A modal, agent-assisted consent widget for collecting consent from an end-user w
|
|
|
365
441
|
| `workspaceUuid` | `string` | Yes | - | Workspace UUID (path segment of the public notice endpoint) |
|
|
366
442
|
| `noticeUuid` | `string` | Yes | - | Notice UUID to fetch and render |
|
|
367
443
|
| `baseUrl` | `string` | No | Production consent API | Base URL for the consent API |
|
|
444
|
+
| `ledgerBaseUrl` | `string` | No | - | Go ledger base URL. When set, the consent write routes through the ledger (falls back: ledger → baseUrl → default). Notice fetch, OTP, and TTS always stay on `baseUrl`. Omit for legacy behavior. |
|
|
368
445
|
| `onDecline` | `() => void` | No | Logs and resets the flow | Called when the agent/customer declines (host should unmount the modal) |
|
|
369
446
|
| `onComplete` | `() => void` | No | Logs and resets the flow | Called when the agent clicks "Proceed" on the confirmed screen |
|
|
370
447
|
|
|
@@ -670,7 +747,7 @@ export function AssistedConsent() {
|
|
|
670
747
|
|
|
671
748
|
### Custom Styling
|
|
672
749
|
|
|
673
|
-
`RedactoNoticeConsent` and `RedactoNoticeConsentInline` support extensive styling customization via the `settings` prop. (`RedactoNoticeAssisted` does not take a `settings` prop — it themes itself from the notice's API configuration, such as primary/secondary colour and font.)
|
|
750
|
+
`RedactoNoticeConsent` and `RedactoNoticeConsentInline` support extensive styling customization via the `settings` prop, which overrides the notice's own API configuration. (`RedactoNoticeAssisted` does not take a `settings` prop — it themes itself entirely from the notice's API configuration, such as primary/secondary colour and font.)
|
|
674
751
|
|
|
675
752
|
```tsx
|
|
676
753
|
const customSettings = {
|
|
@@ -696,7 +773,7 @@ const customSettings = {
|
|
|
696
773
|
textColor: "#e6e6e6",
|
|
697
774
|
borderColor: "white",
|
|
698
775
|
link: "#9810fa",
|
|
699
|
-
font: "Arial, sans-serif", // Optional:
|
|
776
|
+
font: "Arial, sans-serif", // Optional: overrides the notice's Font Family
|
|
700
777
|
};
|
|
701
778
|
|
|
702
779
|
// Use in component
|
|
@@ -714,11 +791,75 @@ const customSettings = {
|
|
|
714
791
|
- `borderColor`: Color for borders
|
|
715
792
|
- `borderRadius`: Border radius for rounded corners
|
|
716
793
|
- `link`: Color for links
|
|
717
|
-
- `font`: Font family (optional)
|
|
794
|
+
- `font`: Font family (optional) — overrides the Font Family configured on the notice
|
|
718
795
|
- `button.accept`: Styles for accept button
|
|
719
796
|
- `button.decline`: Styles for decline button
|
|
720
797
|
- `button.language`: Styles for language selector
|
|
721
798
|
|
|
799
|
+
#### Font family
|
|
800
|
+
|
|
801
|
+
All three notice components apply the **Font Family** selected on the notice in the
|
|
802
|
+
Redacto console (`active_config.font_preference`), so the rendered notice matches the
|
|
803
|
+
console's live preview without any host configuration.
|
|
804
|
+
|
|
805
|
+
Resolution order is `settings.font` → the notice's Font Family → the host page's font.
|
|
806
|
+
Pass `settings.font` only when the host needs to override the configured family; omit it
|
|
807
|
+
and the console selection is used. The selected family is expanded into a full CSS stack
|
|
808
|
+
with a generic fallback (`Times New Roman` becomes `"Times New Roman", Times, serif`).
|
|
809
|
+
|
|
810
|
+
The two sources are deliberately **not** interchangeable. The notice's own Font Family must be one
|
|
811
|
+
of the families above; a stored value that is no longer offered renders as Arial, so the console and
|
|
812
|
+
the notice can never disagree. `settings.font` is a host override and is respected verbatim — pass a
|
|
813
|
+
family you have loaded yourself, or a full stack, and the SDK uses it as-is.
|
|
814
|
+
|
|
815
|
+
**Available families.** One is a self-hosted webfont — Montserrat — and five are system families
|
|
816
|
+
needing no download: Arial, Georgia, Times New Roman, Trebuchet MS, Verdana. The catalogue is
|
|
817
|
+
also importable on its own for building a font picker:
|
|
818
|
+
|
|
819
|
+
```ts
|
|
820
|
+
import {
|
|
821
|
+
NOTICE_FONT_CATALOGUE,
|
|
822
|
+
toNoticeFontValue,
|
|
823
|
+
} from "@redacto.io/consent-sdk-react/fonts";
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
That subpath is data plus one pure function, with no React dependency, so importing it does
|
|
827
|
+
not pull in the notice components.
|
|
828
|
+
|
|
829
|
+
#### Webfont loading
|
|
830
|
+
|
|
831
|
+
**Nothing to set up.** Montserrat ships inside this package, so the font an admin picks in the
|
|
832
|
+
console renders with no configuration, no network request, and no third-party origin to
|
|
833
|
+
allowlist — which matters here because a consent notice renders *before* the visitor has
|
|
834
|
+
consented to anything, and must not disclose their IP to anyone.
|
|
835
|
+
|
|
836
|
+
Loading is on demand: the payload is a lazily-imported module, so a visitor downloads it (214KB)
|
|
837
|
+
only when their notice actually uses Montserrat, and **nothing at all** when the notice uses a
|
|
838
|
+
system family such as Arial or Georgia. `src` leads with `local()`, so a visitor who already has
|
|
839
|
+
the family installed uses their own copy; and `font-display: swap` means notice text is never
|
|
840
|
+
invisible while a font loads.
|
|
841
|
+
|
|
842
|
+
To skip webfont loading entirely — to avoid the payload, or if your CSP omits `data:` from
|
|
843
|
+
`font-src` — call `configureNoticeFonts` once at app bootstrap:
|
|
844
|
+
|
|
845
|
+
```ts
|
|
846
|
+
import { configureNoticeFonts } from "@redacto.io/consent-sdk-react";
|
|
847
|
+
|
|
848
|
+
configureNoticeFonts({ disabled: true });
|
|
849
|
+
```
|
|
850
|
+
|
|
851
|
+
Selections then render via their fallback stack, which is a same-genre face.
|
|
852
|
+
|
|
853
|
+
**Content-Security-Policy.** The fonts are inlined as `data:` URIs, so a host with a `font-src`
|
|
854
|
+
directive must include `data:` (`font-src 'self'` blocks them, and `*` does not match the
|
|
855
|
+
`data:` scheme). A blocked font degrades to the next family in the stack — no error, no blank
|
|
856
|
+
notice.
|
|
857
|
+
|
|
858
|
+
**Non-Latin scripts.** Montserrat carries Latin and Latin-Extended glyphs only. On a notice
|
|
859
|
+
rendered in Hindi, Bengali, Tamil or another non-Latin script, per-glyph fallback means that
|
|
860
|
+
text renders in the device's own face for the script — fully readable, but not in Montserrat.
|
|
861
|
+
System families are unaffected.
|
|
862
|
+
|
|
722
863
|
## Component Comparison
|
|
723
864
|
|
|
724
865
|
| Feature | `RedactoNoticeConsent` | `RedactoNoticeConsentInline` | `RedactoNoticeAssisted` |
|
|
@@ -761,6 +902,7 @@ import { RedactoPrivacyCenter } from "@redacto.io/consent-sdk-react/privacy-cent
|
|
|
761
902
|
| Prop | Type | Required | Default | Description |
|
|
762
903
|
| -------------- | -------------------------------------------------------------------------------------------------------------------------- | -------- | -------------------- | -------------------------------------------------------- |
|
|
763
904
|
| `baseUrl` | `string` | Yes | - | Consent server base URL |
|
|
905
|
+
| `ledgerBaseUrl` | `string` | No | - | Go ledger base URL. When set, user consents, group purposes, receipts, and manage-consent route through the ledger, and the DSAR form's product picker is overlaid from ledger-served consents. Omit to use the legacy `/dsar/privacy-center/*` routes. |
|
|
764
906
|
| `slug` | `string` | Yes | - | Workspace slug |
|
|
765
907
|
| `accessToken` | `string` | Yes | - | JWT access token |
|
|
766
908
|
| `refreshToken` | `string` | Yes | - | JWT refresh token |
|
|
@@ -0,0 +1,182 @@
|
|
|
1
|
+
// src/shared/font-catalogue.generated.ts
|
|
2
|
+
var NOTICE_FONT_CATALOGUE = [
|
|
3
|
+
{
|
|
4
|
+
id: "montserrat",
|
|
5
|
+
slug: "montserrat",
|
|
6
|
+
value: "Montserrat",
|
|
7
|
+
label: "Montserrat",
|
|
8
|
+
cssFamily: "Montserrat",
|
|
9
|
+
stack: 'Montserrat, "Trebuchet MS", "Segoe UI", Arial, sans-serif',
|
|
10
|
+
genericFallback: "sans-serif",
|
|
11
|
+
source: "webfont",
|
|
12
|
+
weights: [400, 500, 600, 700],
|
|
13
|
+
formats: ["woff2", "ttf"]
|
|
14
|
+
},
|
|
15
|
+
{
|
|
16
|
+
id: "arial",
|
|
17
|
+
slug: "arial",
|
|
18
|
+
value: "Arial",
|
|
19
|
+
label: "Arial",
|
|
20
|
+
cssFamily: "Arial",
|
|
21
|
+
stack: "Arial, Helvetica, sans-serif",
|
|
22
|
+
genericFallback: "sans-serif",
|
|
23
|
+
source: "system"
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
id: "georgia",
|
|
27
|
+
slug: "georgia",
|
|
28
|
+
value: "Georgia",
|
|
29
|
+
label: "Georgia",
|
|
30
|
+
cssFamily: "Georgia",
|
|
31
|
+
stack: 'Georgia, "Times New Roman", Times, serif',
|
|
32
|
+
genericFallback: "serif",
|
|
33
|
+
source: "system"
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
id: "times new roman",
|
|
37
|
+
slug: "times-new-roman",
|
|
38
|
+
value: "Times New Roman",
|
|
39
|
+
label: "Times New Roman",
|
|
40
|
+
cssFamily: "Times New Roman",
|
|
41
|
+
stack: '"Times New Roman", Times, serif',
|
|
42
|
+
genericFallback: "serif",
|
|
43
|
+
source: "system"
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
id: "trebuchet ms",
|
|
47
|
+
slug: "trebuchet-ms",
|
|
48
|
+
value: "Trebuchet MS",
|
|
49
|
+
label: "Trebuchet MS",
|
|
50
|
+
cssFamily: "Trebuchet MS",
|
|
51
|
+
stack: '"Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif',
|
|
52
|
+
genericFallback: "sans-serif",
|
|
53
|
+
source: "system"
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
id: "verdana",
|
|
57
|
+
slug: "verdana",
|
|
58
|
+
value: "Verdana",
|
|
59
|
+
label: "Verdana",
|
|
60
|
+
cssFamily: "Verdana",
|
|
61
|
+
stack: "Verdana, Geneva, sans-serif",
|
|
62
|
+
genericFallback: "sans-serif",
|
|
63
|
+
source: "system"
|
|
64
|
+
}
|
|
65
|
+
];
|
|
66
|
+
var NOTICE_FONT_ENTRY_BY_ID = Object.fromEntries(NOTICE_FONT_CATALOGUE.map((entry) => [entry.id, entry]));
|
|
67
|
+
|
|
68
|
+
// src/shared/constants.ts
|
|
69
|
+
var INHERIT_FONT_FAMILY = "inherit";
|
|
70
|
+
var NOTICE_FONT_STACKS = Object.fromEntries(
|
|
71
|
+
NOTICE_FONT_CATALOGUE.map((entry) => [entry.id, entry.stack])
|
|
72
|
+
);
|
|
73
|
+
var NOTICE_FONT_GENERIC_FALLBACK = ", sans-serif";
|
|
74
|
+
var DEFAULT_NOTICE_FONT_ID = "arial";
|
|
75
|
+
var CSS_FONT_KEYWORDS = [
|
|
76
|
+
"inherit",
|
|
77
|
+
"initial",
|
|
78
|
+
"revert",
|
|
79
|
+
"revert-layer",
|
|
80
|
+
"unset",
|
|
81
|
+
"serif",
|
|
82
|
+
"sans-serif",
|
|
83
|
+
"monospace",
|
|
84
|
+
"cursive",
|
|
85
|
+
"fantasy",
|
|
86
|
+
"system-ui",
|
|
87
|
+
"ui-serif",
|
|
88
|
+
"ui-sans-serif",
|
|
89
|
+
"ui-monospace",
|
|
90
|
+
"ui-rounded",
|
|
91
|
+
"math",
|
|
92
|
+
"emoji",
|
|
93
|
+
"fangsong"
|
|
94
|
+
];
|
|
95
|
+
var UNSAFE_FONT_CHARACTERS = /["';{}\\]/g;
|
|
96
|
+
var FONT_NAME_QUOTE_CHARACTERS = /["']/g;
|
|
97
|
+
var FONT_FAMILY_SEPARATOR = ",";
|
|
98
|
+
var NOTICE_FONT_FACE_STYLE_ID_PREFIX = "redacto-notice-font-face-";
|
|
99
|
+
var NOTICE_FONT_LOAD_ERROR_MESSAGE = "[redacto] notice webfont payload failed to load; falling back to the next family in the stack";
|
|
100
|
+
var NOTICE_FONT_ROOT_ATTRIBUTE = "data-redacto-notice-font";
|
|
101
|
+
var NOTICE_FONT_ROOT_PROPS = {
|
|
102
|
+
[NOTICE_FONT_ROOT_ATTRIBUTE]: ""
|
|
103
|
+
};
|
|
104
|
+
var NOTICE_FONT_STYLE_ID = "redacto-notice-font-styles";
|
|
105
|
+
var NOTICE_FONT_CSS = `
|
|
106
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] button,
|
|
107
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] input,
|
|
108
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] optgroup,
|
|
109
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] option,
|
|
110
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] select,
|
|
111
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] textarea {
|
|
112
|
+
font-family: inherit;
|
|
113
|
+
}
|
|
114
|
+
`;
|
|
115
|
+
|
|
116
|
+
// src/shared/notice-font.ts
|
|
117
|
+
var toFontFamilyValue = (value) => {
|
|
118
|
+
var _a;
|
|
119
|
+
if (value.includes(",")) {
|
|
120
|
+
return value;
|
|
121
|
+
}
|
|
122
|
+
const family = value.replace(UNSAFE_FONT_CHARACTERS, "").trim();
|
|
123
|
+
if (!family) {
|
|
124
|
+
return INHERIT_FONT_FAMILY;
|
|
125
|
+
}
|
|
126
|
+
const lowered = family.toLowerCase();
|
|
127
|
+
if (CSS_FONT_KEYWORDS.includes(lowered)) {
|
|
128
|
+
return lowered;
|
|
129
|
+
}
|
|
130
|
+
return (_a = NOTICE_FONT_STACKS[lowered]) != null ? _a : `"${family}"${NOTICE_FONT_GENERIC_FALLBACK}`;
|
|
131
|
+
};
|
|
132
|
+
var toNoticeFontEntry = (fontPreference) => {
|
|
133
|
+
var _a;
|
|
134
|
+
const stored = fontPreference == null ? void 0 : fontPreference.trim();
|
|
135
|
+
if (!stored) {
|
|
136
|
+
return void 0;
|
|
137
|
+
}
|
|
138
|
+
return (_a = NOTICE_FONT_ENTRY_BY_ID[stored.toLowerCase()]) != null ? _a : NOTICE_FONT_ENTRY_BY_ID[DEFAULT_NOTICE_FONT_ID];
|
|
139
|
+
};
|
|
140
|
+
var toNoticeFontValue = (fontPreference) => {
|
|
141
|
+
var _a;
|
|
142
|
+
return (_a = toNoticeFontEntry(fontPreference)) == null ? void 0 : _a.value;
|
|
143
|
+
};
|
|
144
|
+
var resolveNoticeFontFamily = ({
|
|
145
|
+
hostFont,
|
|
146
|
+
noticeFont
|
|
147
|
+
}) => {
|
|
148
|
+
var _a, _b;
|
|
149
|
+
const host = hostFont == null ? void 0 : hostFont.trim();
|
|
150
|
+
if (host) {
|
|
151
|
+
return toFontFamilyValue(host);
|
|
152
|
+
}
|
|
153
|
+
return (_b = (_a = toNoticeFontEntry(noticeFont)) == null ? void 0 : _a.stack) != null ? _b : INHERIT_FONT_FAMILY;
|
|
154
|
+
};
|
|
155
|
+
var fontStylesInjected = false;
|
|
156
|
+
var injectNoticeFontStyles = () => {
|
|
157
|
+
if (fontStylesInjected || typeof document === "undefined") {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
if (document.getElementById(NOTICE_FONT_STYLE_ID)) {
|
|
161
|
+
fontStylesInjected = true;
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
const style = document.createElement("style");
|
|
165
|
+
style.id = NOTICE_FONT_STYLE_ID;
|
|
166
|
+
style.textContent = NOTICE_FONT_CSS;
|
|
167
|
+
document.head.appendChild(style);
|
|
168
|
+
fontStylesInjected = true;
|
|
169
|
+
};
|
|
170
|
+
|
|
171
|
+
export {
|
|
172
|
+
NOTICE_FONT_CATALOGUE,
|
|
173
|
+
NOTICE_FONT_ENTRY_BY_ID,
|
|
174
|
+
FONT_NAME_QUOTE_CHARACTERS,
|
|
175
|
+
FONT_FAMILY_SEPARATOR,
|
|
176
|
+
NOTICE_FONT_FACE_STYLE_ID_PREFIX,
|
|
177
|
+
NOTICE_FONT_LOAD_ERROR_MESSAGE,
|
|
178
|
+
NOTICE_FONT_ROOT_PROPS,
|
|
179
|
+
toNoticeFontValue,
|
|
180
|
+
resolveNoticeFontFamily,
|
|
181
|
+
injectNoticeFontStyles
|
|
182
|
+
};
|
package/dist/fonts.d.mts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { N as NoticeFontEntry, a as NoticeFontSourceValue } from './types-6Aj7faxL.mjs';
|
|
2
|
+
export { b as NoticeFontFormat, c as NoticeFontGenericFallback, d as NoticeSystemFont, e as NoticeWebFont } from './types-6Aj7faxL.mjs';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every font family the console can assign to a notice, in dropdown order
|
|
6
|
+
* (webfonts first, then system families). `source: "webfont"` families ship
|
|
7
|
+
* inside this package and load on demand; `"system"` families need no loading.
|
|
8
|
+
*/
|
|
9
|
+
declare const NOTICE_FONT_CATALOGUE: ReadonlyArray<NoticeFontEntry>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The family a stored `font_preference` will actually render in, canonically
|
|
13
|
+
* cased — the default family when the catalogue no longer offers the stored
|
|
14
|
+
* value, and `undefined` when nothing is stored. Lets a console dropdown show
|
|
15
|
+
* exactly what the notice will render.
|
|
16
|
+
*/
|
|
17
|
+
declare const toNoticeFontValue: (fontPreference?: string) => string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the `font-family` for a notice root. The two sources are deliberately
|
|
20
|
+
* NOT interchangeable:
|
|
21
|
+
*
|
|
22
|
+
* - `hostFont` is the integrator's own `settings.font`. They own it, so it is used
|
|
23
|
+
* as given — a family they loaded themselves, or a full stack, both pass through.
|
|
24
|
+
* - `noticeFont` is the console's stored `font_preference`, which is constrained to
|
|
25
|
+
* the catalogue. A value the console no longer offers resolves to the default
|
|
26
|
+
* family rather than being emitted verbatim, so the console and the rendered
|
|
27
|
+
* notice can never disagree. A side effect worth having: free text stored on the
|
|
28
|
+
* server can no longer reach the emitted CSS at all.
|
|
29
|
+
*
|
|
30
|
+
* Blank on both sides inherits the host page's font — "never set" is not the same
|
|
31
|
+
* as "set to something unavailable".
|
|
32
|
+
*/
|
|
33
|
+
declare const resolveNoticeFontFamily: ({ hostFont, noticeFont, }: NoticeFontSourceValue) => string;
|
|
34
|
+
|
|
35
|
+
export { NOTICE_FONT_CATALOGUE, NoticeFontEntry, resolveNoticeFontFamily, toNoticeFontValue };
|
package/dist/fonts.d.ts
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { N as NoticeFontEntry, a as NoticeFontSourceValue } from './types-6Aj7faxL.js';
|
|
2
|
+
export { b as NoticeFontFormat, c as NoticeFontGenericFallback, d as NoticeSystemFont, e as NoticeWebFont } from './types-6Aj7faxL.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Every font family the console can assign to a notice, in dropdown order
|
|
6
|
+
* (webfonts first, then system families). `source: "webfont"` families ship
|
|
7
|
+
* inside this package and load on demand; `"system"` families need no loading.
|
|
8
|
+
*/
|
|
9
|
+
declare const NOTICE_FONT_CATALOGUE: ReadonlyArray<NoticeFontEntry>;
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* The family a stored `font_preference` will actually render in, canonically
|
|
13
|
+
* cased — the default family when the catalogue no longer offers the stored
|
|
14
|
+
* value, and `undefined` when nothing is stored. Lets a console dropdown show
|
|
15
|
+
* exactly what the notice will render.
|
|
16
|
+
*/
|
|
17
|
+
declare const toNoticeFontValue: (fontPreference?: string) => string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* Resolves the `font-family` for a notice root. The two sources are deliberately
|
|
20
|
+
* NOT interchangeable:
|
|
21
|
+
*
|
|
22
|
+
* - `hostFont` is the integrator's own `settings.font`. They own it, so it is used
|
|
23
|
+
* as given — a family they loaded themselves, or a full stack, both pass through.
|
|
24
|
+
* - `noticeFont` is the console's stored `font_preference`, which is constrained to
|
|
25
|
+
* the catalogue. A value the console no longer offers resolves to the default
|
|
26
|
+
* family rather than being emitted verbatim, so the console and the rendered
|
|
27
|
+
* notice can never disagree. A side effect worth having: free text stored on the
|
|
28
|
+
* server can no longer reach the emitted CSS at all.
|
|
29
|
+
*
|
|
30
|
+
* Blank on both sides inherits the host page's font — "never set" is not the same
|
|
31
|
+
* as "set to something unavailable".
|
|
32
|
+
*/
|
|
33
|
+
declare const resolveNoticeFontFamily: ({ hostFont, noticeFont, }: NoticeFontSourceValue) => string;
|
|
34
|
+
|
|
35
|
+
export { NOTICE_FONT_CATALOGUE, NoticeFontEntry, resolveNoticeFontFamily, toNoticeFontValue };
|
package/dist/fonts.js
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/fonts.ts
|
|
21
|
+
var fonts_exports = {};
|
|
22
|
+
__export(fonts_exports, {
|
|
23
|
+
NOTICE_FONT_CATALOGUE: () => NOTICE_FONT_CATALOGUE,
|
|
24
|
+
resolveNoticeFontFamily: () => resolveNoticeFontFamily,
|
|
25
|
+
toNoticeFontValue: () => toNoticeFontValue
|
|
26
|
+
});
|
|
27
|
+
module.exports = __toCommonJS(fonts_exports);
|
|
28
|
+
|
|
29
|
+
// src/shared/font-catalogue.generated.ts
|
|
30
|
+
var NOTICE_FONT_CATALOGUE = [
|
|
31
|
+
{
|
|
32
|
+
id: "montserrat",
|
|
33
|
+
slug: "montserrat",
|
|
34
|
+
value: "Montserrat",
|
|
35
|
+
label: "Montserrat",
|
|
36
|
+
cssFamily: "Montserrat",
|
|
37
|
+
stack: 'Montserrat, "Trebuchet MS", "Segoe UI", Arial, sans-serif',
|
|
38
|
+
genericFallback: "sans-serif",
|
|
39
|
+
source: "webfont",
|
|
40
|
+
weights: [400, 500, 600, 700],
|
|
41
|
+
formats: ["woff2", "ttf"]
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
id: "arial",
|
|
45
|
+
slug: "arial",
|
|
46
|
+
value: "Arial",
|
|
47
|
+
label: "Arial",
|
|
48
|
+
cssFamily: "Arial",
|
|
49
|
+
stack: "Arial, Helvetica, sans-serif",
|
|
50
|
+
genericFallback: "sans-serif",
|
|
51
|
+
source: "system"
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: "georgia",
|
|
55
|
+
slug: "georgia",
|
|
56
|
+
value: "Georgia",
|
|
57
|
+
label: "Georgia",
|
|
58
|
+
cssFamily: "Georgia",
|
|
59
|
+
stack: 'Georgia, "Times New Roman", Times, serif',
|
|
60
|
+
genericFallback: "serif",
|
|
61
|
+
source: "system"
|
|
62
|
+
},
|
|
63
|
+
{
|
|
64
|
+
id: "times new roman",
|
|
65
|
+
slug: "times-new-roman",
|
|
66
|
+
value: "Times New Roman",
|
|
67
|
+
label: "Times New Roman",
|
|
68
|
+
cssFamily: "Times New Roman",
|
|
69
|
+
stack: '"Times New Roman", Times, serif',
|
|
70
|
+
genericFallback: "serif",
|
|
71
|
+
source: "system"
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
id: "trebuchet ms",
|
|
75
|
+
slug: "trebuchet-ms",
|
|
76
|
+
value: "Trebuchet MS",
|
|
77
|
+
label: "Trebuchet MS",
|
|
78
|
+
cssFamily: "Trebuchet MS",
|
|
79
|
+
stack: '"Trebuchet MS", "Lucida Sans Unicode", "Lucida Grande", sans-serif',
|
|
80
|
+
genericFallback: "sans-serif",
|
|
81
|
+
source: "system"
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
id: "verdana",
|
|
85
|
+
slug: "verdana",
|
|
86
|
+
value: "Verdana",
|
|
87
|
+
label: "Verdana",
|
|
88
|
+
cssFamily: "Verdana",
|
|
89
|
+
stack: "Verdana, Geneva, sans-serif",
|
|
90
|
+
genericFallback: "sans-serif",
|
|
91
|
+
source: "system"
|
|
92
|
+
}
|
|
93
|
+
];
|
|
94
|
+
var NOTICE_FONT_ENTRY_BY_ID = Object.fromEntries(NOTICE_FONT_CATALOGUE.map((entry) => [entry.id, entry]));
|
|
95
|
+
|
|
96
|
+
// src/shared/constants.ts
|
|
97
|
+
var INHERIT_FONT_FAMILY = "inherit";
|
|
98
|
+
var NOTICE_FONT_STACKS = Object.fromEntries(
|
|
99
|
+
NOTICE_FONT_CATALOGUE.map((entry) => [entry.id, entry.stack])
|
|
100
|
+
);
|
|
101
|
+
var NOTICE_FONT_GENERIC_FALLBACK = ", sans-serif";
|
|
102
|
+
var DEFAULT_NOTICE_FONT_ID = "arial";
|
|
103
|
+
var CSS_FONT_KEYWORDS = [
|
|
104
|
+
"inherit",
|
|
105
|
+
"initial",
|
|
106
|
+
"revert",
|
|
107
|
+
"revert-layer",
|
|
108
|
+
"unset",
|
|
109
|
+
"serif",
|
|
110
|
+
"sans-serif",
|
|
111
|
+
"monospace",
|
|
112
|
+
"cursive",
|
|
113
|
+
"fantasy",
|
|
114
|
+
"system-ui",
|
|
115
|
+
"ui-serif",
|
|
116
|
+
"ui-sans-serif",
|
|
117
|
+
"ui-monospace",
|
|
118
|
+
"ui-rounded",
|
|
119
|
+
"math",
|
|
120
|
+
"emoji",
|
|
121
|
+
"fangsong"
|
|
122
|
+
];
|
|
123
|
+
var UNSAFE_FONT_CHARACTERS = /["';{}\\]/g;
|
|
124
|
+
var NOTICE_FONT_ROOT_ATTRIBUTE = "data-redacto-notice-font";
|
|
125
|
+
var NOTICE_FONT_ROOT_PROPS = {
|
|
126
|
+
[NOTICE_FONT_ROOT_ATTRIBUTE]: ""
|
|
127
|
+
};
|
|
128
|
+
var NOTICE_FONT_CSS = `
|
|
129
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] button,
|
|
130
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] input,
|
|
131
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] optgroup,
|
|
132
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] option,
|
|
133
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] select,
|
|
134
|
+
[${NOTICE_FONT_ROOT_ATTRIBUTE}] textarea {
|
|
135
|
+
font-family: inherit;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
// src/shared/notice-font.ts
|
|
140
|
+
var toFontFamilyValue = (value) => {
|
|
141
|
+
var _a;
|
|
142
|
+
if (value.includes(",")) {
|
|
143
|
+
return value;
|
|
144
|
+
}
|
|
145
|
+
const family = value.replace(UNSAFE_FONT_CHARACTERS, "").trim();
|
|
146
|
+
if (!family) {
|
|
147
|
+
return INHERIT_FONT_FAMILY;
|
|
148
|
+
}
|
|
149
|
+
const lowered = family.toLowerCase();
|
|
150
|
+
if (CSS_FONT_KEYWORDS.includes(lowered)) {
|
|
151
|
+
return lowered;
|
|
152
|
+
}
|
|
153
|
+
return (_a = NOTICE_FONT_STACKS[lowered]) != null ? _a : `"${family}"${NOTICE_FONT_GENERIC_FALLBACK}`;
|
|
154
|
+
};
|
|
155
|
+
var toNoticeFontEntry = (fontPreference) => {
|
|
156
|
+
var _a;
|
|
157
|
+
const stored = fontPreference == null ? void 0 : fontPreference.trim();
|
|
158
|
+
if (!stored) {
|
|
159
|
+
return void 0;
|
|
160
|
+
}
|
|
161
|
+
return (_a = NOTICE_FONT_ENTRY_BY_ID[stored.toLowerCase()]) != null ? _a : NOTICE_FONT_ENTRY_BY_ID[DEFAULT_NOTICE_FONT_ID];
|
|
162
|
+
};
|
|
163
|
+
var toNoticeFontValue = (fontPreference) => {
|
|
164
|
+
var _a;
|
|
165
|
+
return (_a = toNoticeFontEntry(fontPreference)) == null ? void 0 : _a.value;
|
|
166
|
+
};
|
|
167
|
+
var resolveNoticeFontFamily = ({
|
|
168
|
+
hostFont,
|
|
169
|
+
noticeFont
|
|
170
|
+
}) => {
|
|
171
|
+
var _a, _b;
|
|
172
|
+
const host = hostFont == null ? void 0 : hostFont.trim();
|
|
173
|
+
if (host) {
|
|
174
|
+
return toFontFamilyValue(host);
|
|
175
|
+
}
|
|
176
|
+
return (_b = (_a = toNoticeFontEntry(noticeFont)) == null ? void 0 : _a.stack) != null ? _b : INHERIT_FONT_FAMILY;
|
|
177
|
+
};
|
|
178
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
179
|
+
0 && (module.exports = {
|
|
180
|
+
NOTICE_FONT_CATALOGUE,
|
|
181
|
+
resolveNoticeFontFamily,
|
|
182
|
+
toNoticeFontValue
|
|
183
|
+
});
|