@redacto.io/consent-sdk-react 10.3.0-beta.6 → 10.3.1-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-FT5G2PXK.mjs → chunk-4SCWX74J.mjs} +1 -0
- package/dist/{chunk-EYHKLIAJ.mjs → chunk-RG4PVVKF.mjs} +110 -0
- package/dist/fonts.mjs +1 -1
- package/dist/index.js +14 -10
- package/dist/index.mjs +16 -113
- package/dist/privacy-center.js +324 -4
- package/dist/privacy-center.mjs +30 -5
- package/package.json +1 -1
package/dist/privacy-center.mjs
CHANGED
|
@@ -2,18 +2,25 @@ import {
|
|
|
2
2
|
APPEARANCE_ATTRIBUTE,
|
|
3
3
|
Collapse,
|
|
4
4
|
DEFAULT_APPEARANCE,
|
|
5
|
+
DEFAULT_CONSENT_API_BASE_URL,
|
|
5
6
|
GLASS_BLUR,
|
|
6
7
|
GLASS_RADIUS,
|
|
7
8
|
MOTION,
|
|
8
9
|
NOTICE_ROOT_ATTRIBUTE,
|
|
9
10
|
SANDBOX_TOKEN_HEADER,
|
|
11
|
+
USER_SERVICE_PATH,
|
|
10
12
|
getAppearanceLayout,
|
|
11
13
|
glassPalette,
|
|
14
|
+
loadNoticeWebfont,
|
|
12
15
|
resolveAppearance,
|
|
13
16
|
useIsomorphicLayoutEffect,
|
|
14
17
|
useMediaQuery,
|
|
15
18
|
withIdempotencyKey
|
|
16
|
-
} from "./chunk-
|
|
19
|
+
} from "./chunk-RG4PVVKF.mjs";
|
|
20
|
+
import {
|
|
21
|
+
INHERIT_FONT_FAMILY,
|
|
22
|
+
resolveNoticeFontFamily
|
|
23
|
+
} from "./chunk-4SCWX74J.mjs";
|
|
17
24
|
|
|
18
25
|
// src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx
|
|
19
26
|
import { I18nextProvider } from "react-i18next";
|
|
@@ -13761,11 +13768,17 @@ var poweredByRedacto_default = 'data:image/svg+xml,<svg width="81" height="27" v
|
|
|
13761
13768
|
import { createContext as createContext8, useContext as useContext6, useEffect as useEffect11, useState as useState11 } from "react";
|
|
13762
13769
|
|
|
13763
13770
|
// src/RedactoPrivacyCenter/api/orgBranding.ts
|
|
13764
|
-
|
|
13765
|
-
|
|
13771
|
+
var ORIGIN = /^https?:\/\/(?:\[[0-9a-f:.]+\]|[^\s/?#@:[\]]+)(?::\d+)?(?=[/?#]|$)/i;
|
|
13772
|
+
function originOf(url) {
|
|
13773
|
+
const match = ORIGIN.exec(url.trim());
|
|
13774
|
+
return match ? match[0] : "";
|
|
13775
|
+
}
|
|
13776
|
+
function userServiceBaseUrl(consentBaseUrl) {
|
|
13777
|
+
const origin = originOf(consentBaseUrl) || originOf(DEFAULT_CONSENT_API_BASE_URL);
|
|
13778
|
+
return origin + USER_SERVICE_PATH;
|
|
13766
13779
|
}
|
|
13767
13780
|
async function fetchOrgBranding(slug, baseUrl) {
|
|
13768
|
-
const url = `${
|
|
13781
|
+
const url = `${userServiceBaseUrl(baseUrl)}/public/org-branding/by-slug/${encodeURIComponent(slug)}`;
|
|
13769
13782
|
return apiFetch(url, { method: "GET" });
|
|
13770
13783
|
}
|
|
13771
13784
|
|
|
@@ -13786,7 +13799,8 @@ var OVERRIDDEN_VARS = [
|
|
|
13786
13799
|
"--pc-border-color",
|
|
13787
13800
|
"--pc-success",
|
|
13788
13801
|
"--pc-warning",
|
|
13789
|
-
"--pc-error"
|
|
13802
|
+
"--pc-error",
|
|
13803
|
+
"--pc-font-family"
|
|
13790
13804
|
];
|
|
13791
13805
|
function darken(hex, amount) {
|
|
13792
13806
|
const h = hex.replace("#", "").trim();
|
|
@@ -13818,6 +13832,17 @@ function applyBrandingTheme(theme) {
|
|
|
13818
13832
|
set("--pc-success", theme.success);
|
|
13819
13833
|
set("--pc-warning", theme.warning);
|
|
13820
13834
|
set("--pc-error", theme.danger);
|
|
13835
|
+
applyBrandingFont(theme.font_family);
|
|
13836
|
+
}
|
|
13837
|
+
function applyBrandingFont(fontFamily) {
|
|
13838
|
+
const root = document.documentElement;
|
|
13839
|
+
const stack = resolveNoticeFontFamily({ noticeFont: fontFamily });
|
|
13840
|
+
if (!(fontFamily == null ? void 0 : fontFamily.trim()) || stack === INHERIT_FONT_FAMILY) {
|
|
13841
|
+
root.style.removeProperty("--pc-font-family");
|
|
13842
|
+
return;
|
|
13843
|
+
}
|
|
13844
|
+
root.style.setProperty("--pc-font-family", stack);
|
|
13845
|
+
void loadNoticeWebfont(stack);
|
|
13821
13846
|
}
|
|
13822
13847
|
function clearBrandingTheme() {
|
|
13823
13848
|
if (typeof document === "undefined") return;
|