@redacto.io/consent-sdk-react 10.4.0-beta.1 → 11.0.0-beta.3
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/README.md +98 -30
- package/dist/{chunk-DGMUTOWJ.mjs → chunk-W45JQYDG.mjs} +65 -1
- package/dist/index.d.mts +39 -5
- package/dist/index.d.ts +39 -5
- package/dist/index.js +418 -293
- package/dist/index.mjs +77 -14
- package/dist/privacy-center.d.mts +67 -22
- package/dist/privacy-center.d.ts +67 -22
- package/dist/privacy-center.js +726 -701
- package/dist/privacy-center.mjs +175 -211
- package/dist/{types-Bwtzvz4W.d.mts → types-B8qroG0j.d.mts} +2 -0
- package/dist/{types-Bwtzvz4W.d.ts → types-B8qroG0j.d.ts} +2 -0
- package/package.json +1 -1
package/dist/privacy-center.mjs
CHANGED
|
@@ -15,10 +15,14 @@ import {
|
|
|
15
15
|
isSafeCustomCss,
|
|
16
16
|
loadNoticeWebfont,
|
|
17
17
|
resolveAppearance,
|
|
18
|
+
resolveEndpoints,
|
|
18
19
|
useIsomorphicLayoutEffect,
|
|
19
20
|
useMediaQuery,
|
|
21
|
+
useResolvedEndpoints,
|
|
22
|
+
warnEndpointUsage,
|
|
23
|
+
warnSlugDeprecated,
|
|
20
24
|
withIdempotencyKey
|
|
21
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-W45JQYDG.mjs";
|
|
22
26
|
import {
|
|
23
27
|
INHERIT_FONT_FAMILY,
|
|
24
28
|
resolveNoticeFontFamily
|
|
@@ -9120,36 +9124,35 @@ var isJwtExpired = (token, bufferSeconds = 5 * 60) => {
|
|
|
9120
9124
|
return true;
|
|
9121
9125
|
}
|
|
9122
9126
|
};
|
|
9123
|
-
var isUserAuthenticated = (
|
|
9127
|
+
var isUserAuthenticated = (_expectedSlug) => {
|
|
9124
9128
|
if (typeof window === "undefined") return false;
|
|
9125
9129
|
const accessToken = sessionStorage.getItem("access_token");
|
|
9126
9130
|
const email = sessionStorage.getItem("email");
|
|
9127
|
-
|
|
9128
|
-
if (!accessToken || !email || !orgSlug) {
|
|
9129
|
-
return false;
|
|
9130
|
-
}
|
|
9131
|
-
return orgSlug === expectedSlug;
|
|
9131
|
+
return Boolean(accessToken && email);
|
|
9132
9132
|
};
|
|
9133
|
-
var getInitialState = (
|
|
9133
|
+
var getInitialState = (_slug) => {
|
|
9134
9134
|
if (typeof window === "undefined") return true;
|
|
9135
|
-
return !isUserAuthenticated(
|
|
9135
|
+
return !isUserAuthenticated();
|
|
9136
9136
|
};
|
|
9137
|
-
var
|
|
9137
|
+
var isSessionForOrganisation = (organizationId) => {
|
|
9138
|
+
const storedOrgId = sessionStorage.getItem("pc_org_id");
|
|
9139
|
+
return Boolean(storedOrgId) && (!organizationId || storedOrgId === organizationId);
|
|
9140
|
+
};
|
|
9141
|
+
var checkAndRefreshAuth = async (_expectedSlug, organizationId, workspaceId, consentClient) => {
|
|
9138
9142
|
if (typeof window === "undefined") return false;
|
|
9139
9143
|
if (getSandboxConfig()) {
|
|
9140
9144
|
return true;
|
|
9141
9145
|
}
|
|
9142
9146
|
const accessToken = sessionStorage.getItem("access_token");
|
|
9143
9147
|
const email = sessionStorage.getItem("email");
|
|
9144
|
-
|
|
9145
|
-
if (orgSlug && orgSlug !== expectedSlug) {
|
|
9148
|
+
if (!isSessionForOrganisation(organizationId)) {
|
|
9146
9149
|
return false;
|
|
9147
9150
|
}
|
|
9148
9151
|
const needsRefresh = !accessToken || accessToken && isJwtExpired(accessToken, TOKEN_EXPIRY_BUFFER_SECONDS);
|
|
9149
|
-
if (!needsRefresh && accessToken && email
|
|
9152
|
+
if (!needsRefresh && accessToken && email) {
|
|
9150
9153
|
return true;
|
|
9151
9154
|
}
|
|
9152
|
-
if (needsRefresh && email
|
|
9155
|
+
if (needsRefresh && email) {
|
|
9153
9156
|
const orgId = organizationId || sessionStorage.getItem("pc_org_id") || "";
|
|
9154
9157
|
const wsId = workspaceId || sessionStorage.getItem("pc_workspace_id") || "";
|
|
9155
9158
|
if (!orgId || !wsId) {
|
|
@@ -9248,7 +9251,7 @@ var signOutPrivacyCenter = () => {
|
|
|
9248
9251
|
removeStorage(REFRESH_TOKEN_STORAGE_KEY);
|
|
9249
9252
|
clearLegacyRefreshTokenCookie();
|
|
9250
9253
|
};
|
|
9251
|
-
var ensureValidToken = async (organizationId, workspaceId,
|
|
9254
|
+
var ensureValidToken = async (organizationId, workspaceId, _slug, authContext, consentClient) => {
|
|
9252
9255
|
if (typeof window === "undefined") return null;
|
|
9253
9256
|
const sandbox = getSandboxConfig();
|
|
9254
9257
|
if (sandbox) {
|
|
@@ -9273,7 +9276,7 @@ var ensureValidToken = async (organizationId, workspaceId, slug, authContext, co
|
|
|
9273
9276
|
return newToken;
|
|
9274
9277
|
}
|
|
9275
9278
|
isRefreshing = true;
|
|
9276
|
-
refreshPromise = performTokenRefresh(organizationId, workspaceId,
|
|
9279
|
+
refreshPromise = performTokenRefresh(organizationId, workspaceId, authContext, consentClient);
|
|
9277
9280
|
try {
|
|
9278
9281
|
const newToken = await refreshPromise;
|
|
9279
9282
|
return newToken;
|
|
@@ -9282,7 +9285,7 @@ var ensureValidToken = async (organizationId, workspaceId, slug, authContext, co
|
|
|
9282
9285
|
refreshPromise = null;
|
|
9283
9286
|
}
|
|
9284
9287
|
};
|
|
9285
|
-
var performTokenRefresh = async (organizationId, workspaceId,
|
|
9288
|
+
var performTokenRefresh = async (organizationId, workspaceId, authContext, consentClient) => {
|
|
9286
9289
|
var _a, _b, _c, _d, _e, _f, _g;
|
|
9287
9290
|
const orgId = organizationId || sessionStorage.getItem("pc_org_id") || "";
|
|
9288
9291
|
const wsId = workspaceId || sessionStorage.getItem("pc_workspace_id") || "";
|
|
@@ -9886,13 +9889,15 @@ var seedSessionStorage = (data) => {
|
|
|
9886
9889
|
return;
|
|
9887
9890
|
}
|
|
9888
9891
|
if (data.accessToken) sessionStorage.setItem("access_token", data.accessToken);
|
|
9892
|
+
if (data.orgId && !data.workspaceId && sessionStorage.getItem("pc_org_id") !== data.orgId) {
|
|
9893
|
+
sessionStorage.removeItem("pc_workspace_id");
|
|
9894
|
+
}
|
|
9889
9895
|
if (data.orgId) sessionStorage.setItem("pc_org_id", data.orgId);
|
|
9890
9896
|
if (data.workspaceId) sessionStorage.setItem("pc_workspace_id", data.workspaceId);
|
|
9891
|
-
if (data.slug) sessionStorage.setItem("pc_org_slug", data.slug);
|
|
9892
9897
|
if (data.contact) sessionStorage.setItem("email", data.contact);
|
|
9893
9898
|
};
|
|
9894
9899
|
var configureSandbox = (props) => {
|
|
9895
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k
|
|
9900
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j, _k;
|
|
9896
9901
|
const token = (_a = props.token) == null ? void 0 : _a.trim();
|
|
9897
9902
|
if (!token) {
|
|
9898
9903
|
setSandboxConfig(null);
|
|
@@ -9903,21 +9908,18 @@ var configureSandbox = (props) => {
|
|
|
9903
9908
|
const ucic = (_g = (_f = props.sandboxUcic) == null ? void 0 : _f.trim()) != null ? _g : "";
|
|
9904
9909
|
const email = (_i = (_h = props.sandboxEmail) == null ? void 0 : _h.trim()) != null ? _i : "";
|
|
9905
9910
|
const mobile = (_k = (_j = props.sandboxMobile) == null ? void 0 : _j.trim()) != null ? _k : "";
|
|
9906
|
-
const slug = (_m = (_l = props.slug) == null ? void 0 : _l.trim()) != null ? _m : "";
|
|
9907
9911
|
setSandboxConfig({
|
|
9908
9912
|
token,
|
|
9909
9913
|
ucic: ucic || void 0,
|
|
9910
9914
|
email: email || void 0,
|
|
9911
9915
|
mobile: mobile || void 0,
|
|
9912
9916
|
organisationUuid,
|
|
9913
|
-
workspaceUuid
|
|
9914
|
-
slug
|
|
9917
|
+
workspaceUuid
|
|
9915
9918
|
});
|
|
9916
9919
|
seedSessionStorage({
|
|
9917
9920
|
accessToken: token,
|
|
9918
9921
|
orgId: organisationUuid,
|
|
9919
9922
|
workspaceId: workspaceUuid,
|
|
9920
|
-
slug,
|
|
9921
9923
|
// The principal precedence (UCIC > email > mobile) the server also applies.
|
|
9922
9924
|
contact: ucic || email || mobile
|
|
9923
9925
|
});
|
|
@@ -9933,7 +9935,6 @@ var syncJwtDataToSessionStorage = (accessToken) => {
|
|
|
9933
9935
|
seedSessionStorage({
|
|
9934
9936
|
orgId: typeof decoded.organisation_uuid === "string" ? decoded.organisation_uuid : void 0,
|
|
9935
9937
|
workspaceId: typeof decoded.workspace_uuid === "string" ? decoded.workspace_uuid : void 0,
|
|
9936
|
-
slug: typeof decoded.organisation_slug === "string" ? decoded.organisation_slug : void 0,
|
|
9937
9938
|
contact: typeof contact === "string" ? contact : void 0
|
|
9938
9939
|
});
|
|
9939
9940
|
};
|
|
@@ -9948,7 +9949,6 @@ var AuthProvider = (props) => {
|
|
|
9948
9949
|
sandboxMobile,
|
|
9949
9950
|
organisationUuid,
|
|
9950
9951
|
workspaceUuid,
|
|
9951
|
-
slug,
|
|
9952
9952
|
onError
|
|
9953
9953
|
} = props;
|
|
9954
9954
|
const [sandboxActive] = useState(() => configureSandbox(props));
|
|
@@ -10032,7 +10032,7 @@ var AuthProvider = (props) => {
|
|
|
10032
10032
|
}
|
|
10033
10033
|
configureSandbox(props);
|
|
10034
10034
|
return () => setSandboxConfig(null);
|
|
10035
|
-
}, [sandboxActive, sandboxToken, sandboxUcic, sandboxEmail, sandboxMobile, organisationUuid, workspaceUuid
|
|
10035
|
+
}, [sandboxActive, sandboxToken, sandboxUcic, sandboxEmail, sandboxMobile, organisationUuid, workspaceUuid]);
|
|
10036
10036
|
const updateTokens = useCallback2((newAccessToken, newRefreshToken) => {
|
|
10037
10037
|
setAccessToken(newAccessToken);
|
|
10038
10038
|
if (newRefreshToken) {
|
|
@@ -10079,9 +10079,13 @@ import { createContext as createContext4, useContext as useContext4, useMemo as
|
|
|
10079
10079
|
|
|
10080
10080
|
// src/RedactoPrivacyCenter/api/client.ts
|
|
10081
10081
|
function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
10082
|
-
|
|
10082
|
+
var _a;
|
|
10083
|
+
warnEndpointUsage(baseUrl, ledgerBaseUrl, { hasBuiltInDefault: false });
|
|
10084
|
+
const endpoints = resolveEndpoints(baseUrl, ledgerBaseUrl);
|
|
10085
|
+
const consentBaseUrl = endpoints.baseUrl;
|
|
10086
|
+
const ledgerConfigured = Boolean(endpoints.ledgerBaseUrl);
|
|
10083
10087
|
const useLedger = () => ledgerConfigured;
|
|
10084
|
-
const ledgerBase = (ledgerBaseUrl != null ?
|
|
10088
|
+
const ledgerBase = ((_a = endpoints.ledgerBaseUrl) != null ? _a : "").replace(/\/$/, "");
|
|
10085
10089
|
async function privacyCenterApiFetch(url, options) {
|
|
10086
10090
|
const { authToken, getAuthToken, headers = {}, ...fetchOptions } = options;
|
|
10087
10091
|
const requestHeaders = new Headers();
|
|
@@ -10179,7 +10183,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10179
10183
|
}
|
|
10180
10184
|
}
|
|
10181
10185
|
function privacyCenterUrl(baseRequest, path) {
|
|
10182
|
-
return `${
|
|
10186
|
+
return `${consentBaseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center${path}`;
|
|
10183
10187
|
}
|
|
10184
10188
|
function ledgerUrl(baseRequest, path) {
|
|
10185
10189
|
if (!useLedger()) {
|
|
@@ -10281,7 +10285,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10281
10285
|
* `channel: "sms"`.
|
|
10282
10286
|
*/
|
|
10283
10287
|
async createOtp(organisationId, workspaceId, email, options, channel = "email") {
|
|
10284
|
-
const url = `${
|
|
10288
|
+
const url = `${consentBaseUrl}/public/organisations/${organisationId}/workspaces/${workspaceId}/otp/create`;
|
|
10285
10289
|
return apiFetch(url, {
|
|
10286
10290
|
...options,
|
|
10287
10291
|
method: "POST",
|
|
@@ -10299,7 +10303,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10299
10303
|
* then rejects it with 403 "Token scope is not permitted".
|
|
10300
10304
|
*/
|
|
10301
10305
|
async verifyOtp(organisationId, workspaceId, otpId, otp, options, purpose = "login") {
|
|
10302
|
-
const url = `${
|
|
10306
|
+
const url = `${consentBaseUrl}/public/organisations/${organisationId}/workspaces/${workspaceId}/otp/verify`;
|
|
10303
10307
|
return apiFetch(url, {
|
|
10304
10308
|
...options,
|
|
10305
10309
|
method: "POST",
|
|
@@ -10310,7 +10314,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10310
10314
|
* Exchange one-time token for JWT tokens (public)
|
|
10311
10315
|
*/
|
|
10312
10316
|
async exchangeToken(token) {
|
|
10313
|
-
const url = `${
|
|
10317
|
+
const url = `${consentBaseUrl}/public/tokens/token-exchange?token=${encodeURIComponent(token)}`;
|
|
10314
10318
|
const response = await fetch(url, {
|
|
10315
10319
|
method: "GET",
|
|
10316
10320
|
headers: { Accept: "application/json" }
|
|
@@ -10331,7 +10335,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10331
10335
|
* Refresh OTP token (public)
|
|
10332
10336
|
*/
|
|
10333
10337
|
async refreshOtpToken(organisationId, workspaceId, refreshToken, options) {
|
|
10334
|
-
const url = `${
|
|
10338
|
+
const url = `${consentBaseUrl}/public/organisations/${organisationId}/workspaces/${workspaceId}/otp/refresh`;
|
|
10335
10339
|
return apiFetch(url, {
|
|
10336
10340
|
...options,
|
|
10337
10341
|
method: "POST",
|
|
@@ -10342,7 +10346,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10342
10346
|
* Get products
|
|
10343
10347
|
*/
|
|
10344
10348
|
async getProducts(baseRequest, skip = 0, limit = 10, options) {
|
|
10345
|
-
const url = `${
|
|
10349
|
+
const url = `${consentBaseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/notice-management/products/?skip=${skip}&limit=${limit}`;
|
|
10346
10350
|
return apiFetch(url, {
|
|
10347
10351
|
...options,
|
|
10348
10352
|
getAuthToken: async () => baseRequest.authToken
|
|
@@ -10434,7 +10438,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10434
10438
|
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
10435
10439
|
*/
|
|
10436
10440
|
async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, productUuid, noticeUuid, dataElements, language, nominatorUuid) {
|
|
10437
|
-
var
|
|
10441
|
+
var _a2;
|
|
10438
10442
|
if (!useLedger()) {
|
|
10439
10443
|
const url2 = privacyCenterUrl(
|
|
10440
10444
|
baseRequest,
|
|
@@ -10484,7 +10488,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10484
10488
|
notice_uuid: noticeUuid,
|
|
10485
10489
|
// Sandbox has no JWT, so the ledger resolves the acting test principal
|
|
10486
10490
|
// from this identity in the body; null (spread no-op) on the live JWT path.
|
|
10487
|
-
...(
|
|
10491
|
+
...(_a2 = sandboxBodyIdentity()) != null ? _a2 : {},
|
|
10488
10492
|
// Pins the action to the card the user acted on. Without it the ledger
|
|
10489
10493
|
// scopes by the notice and applies the answer to every product the
|
|
10490
10494
|
// notice covers, so revoking a purpose held on two products withdrew
|
|
@@ -10835,17 +10839,21 @@ var BaseUrlProvider = ({
|
|
|
10835
10839
|
baseUrl,
|
|
10836
10840
|
ledgerBaseUrl
|
|
10837
10841
|
}) => {
|
|
10842
|
+
const endpoints = useResolvedEndpoints(baseUrl, ledgerBaseUrl, {
|
|
10843
|
+
hasBuiltInDefault: false
|
|
10844
|
+
});
|
|
10838
10845
|
const consentClient = useMemo3(
|
|
10839
10846
|
() => createConsentClient(baseUrl, ledgerBaseUrl),
|
|
10840
10847
|
[baseUrl, ledgerBaseUrl]
|
|
10841
10848
|
);
|
|
10842
10849
|
const value = useMemo3(
|
|
10843
10850
|
() => ({
|
|
10844
|
-
baseUrl,
|
|
10845
|
-
ledgerBaseUrl,
|
|
10846
|
-
consentClient
|
|
10851
|
+
baseUrl: endpoints.baseUrl,
|
|
10852
|
+
ledgerBaseUrl: endpoints.ledgerBaseUrl,
|
|
10853
|
+
consentClient,
|
|
10854
|
+
apiHost: endpoints.apiHost
|
|
10847
10855
|
}),
|
|
10848
|
-
[
|
|
10856
|
+
[endpoints, consentClient]
|
|
10849
10857
|
);
|
|
10850
10858
|
return /* @__PURE__ */ jsx4(BaseUrlContext.Provider, { value, children });
|
|
10851
10859
|
};
|
|
@@ -13900,11 +13908,15 @@ function originOf(url) {
|
|
|
13900
13908
|
return match ? match[0] : "";
|
|
13901
13909
|
}
|
|
13902
13910
|
function userServiceBaseUrl(consentBaseUrl) {
|
|
13911
|
+
const endpoints = resolveEndpoints(consentBaseUrl);
|
|
13912
|
+
if (endpoints.mode === "host") {
|
|
13913
|
+
return endpoints.apiHost + USER_SERVICE_PATH;
|
|
13914
|
+
}
|
|
13903
13915
|
const origin = originOf(consentBaseUrl) || originOf(DEFAULT_CONSENT_API_BASE_URL);
|
|
13904
13916
|
return origin + USER_SERVICE_PATH;
|
|
13905
13917
|
}
|
|
13906
|
-
async function
|
|
13907
|
-
const url = `${userServiceBaseUrl(baseUrl)}/public/org-branding
|
|
13918
|
+
async function fetchOrgBrandingForOrganisation(organisationUuid, baseUrl) {
|
|
13919
|
+
const url = `${userServiceBaseUrl(baseUrl)}/public/org-branding/${encodeURIComponent(organisationUuid)}`;
|
|
13908
13920
|
return apiFetch(url, { method: "GET" });
|
|
13909
13921
|
}
|
|
13910
13922
|
|
|
@@ -14120,6 +14132,7 @@ var LANGUAGE_CODES = [
|
|
|
14120
14132
|
];
|
|
14121
14133
|
var RTL_LANGUAGES = /* @__PURE__ */ new Set(["ur", "sd", "ks"]);
|
|
14122
14134
|
var COUNTRY_CODES = ["+91", "+971", "+65", "+44", "+1"];
|
|
14135
|
+
var LOGO_ALIGNMENTS = ["auto", "left", "center", "right"];
|
|
14123
14136
|
var FONT_FAMILIES = [
|
|
14124
14137
|
"Inter",
|
|
14125
14138
|
"Montserrat",
|
|
@@ -14172,6 +14185,7 @@ var DEFAULT_PRIVACY_CENTER_SETTINGS = {
|
|
|
14172
14185
|
display_name: null,
|
|
14173
14186
|
logo_url: null,
|
|
14174
14187
|
logo_height: null,
|
|
14188
|
+
logo_align: "auto",
|
|
14175
14189
|
inherit_colors: true,
|
|
14176
14190
|
primary_color: null,
|
|
14177
14191
|
accent_color: null,
|
|
@@ -14274,7 +14288,6 @@ var DEFAULT_CONTEXT = {
|
|
|
14274
14288
|
status: "idle",
|
|
14275
14289
|
isCustomised: false,
|
|
14276
14290
|
organisation: { organisationUuid: null, workspaceUuid: null, status: "failed" },
|
|
14277
|
-
slug: "",
|
|
14278
14291
|
builtInSignIn: false,
|
|
14279
14292
|
brandContact: EMPTY_BRAND_CONTACT
|
|
14280
14293
|
};
|
|
@@ -14301,18 +14314,20 @@ var withIdentityOverride = (branding, settings) => {
|
|
|
14301
14314
|
};
|
|
14302
14315
|
var BrandingProvider = ({
|
|
14303
14316
|
children,
|
|
14304
|
-
slug,
|
|
14305
14317
|
baseUrl
|
|
14306
14318
|
}) => {
|
|
14307
14319
|
var _a;
|
|
14308
14320
|
const [branding, setBranding] = useState11(null);
|
|
14309
|
-
const {
|
|
14321
|
+
const { settings, organisation } = usePrivacyCenterSettingsContext();
|
|
14322
|
+
const brandingSettings = settings.branding;
|
|
14323
|
+
const organisationUuid = organisation.organisationUuid;
|
|
14310
14324
|
const scope = usePrivacyCenterScope();
|
|
14311
14325
|
const scopeId = (_a = scope == null ? void 0 : scope.id) != null ? _a : null;
|
|
14312
14326
|
useEffect11(() => {
|
|
14313
|
-
|
|
14327
|
+
setBranding(null);
|
|
14328
|
+
if (!organisationUuid) return;
|
|
14314
14329
|
let cancelled = false;
|
|
14315
|
-
|
|
14330
|
+
fetchOrgBrandingForOrganisation(organisationUuid, baseUrl).then((data) => {
|
|
14316
14331
|
if (!cancelled) setBranding(data);
|
|
14317
14332
|
}).catch((error) => {
|
|
14318
14333
|
console.warn("[RedactoPrivacyCenter] org branding fetch failed:", error);
|
|
@@ -14320,7 +14335,7 @@ var BrandingProvider = ({
|
|
|
14320
14335
|
return () => {
|
|
14321
14336
|
cancelled = true;
|
|
14322
14337
|
};
|
|
14323
|
-
}, [
|
|
14338
|
+
}, [organisationUuid, baseUrl]);
|
|
14324
14339
|
const themeVars = useMemo5(
|
|
14325
14340
|
() => ({
|
|
14326
14341
|
...(branding == null ? void 0 : branding.theme) ? brandingThemeVars(branding.theme) : {},
|
|
@@ -14380,13 +14395,12 @@ var resolvePlaceholders = (text2, context) => {
|
|
|
14380
14395
|
};
|
|
14381
14396
|
|
|
14382
14397
|
// src/RedactoPrivacyCenter/settings/copy.ts
|
|
14383
|
-
var nameFromSlug = (slug) => slug.split("-").filter(Boolean).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join(" ");
|
|
14384
14398
|
var usePlaceholderContext = () => {
|
|
14385
14399
|
var _a, _b;
|
|
14386
14400
|
const branding = useBranding();
|
|
14387
|
-
const {
|
|
14401
|
+
const { brandContact } = usePrivacyCenterSettingsContext();
|
|
14388
14402
|
const organizationName = (_b = (_a = useContext10(OrganizationContext)) == null ? void 0 : _a.organization) == null ? void 0 : _b.name;
|
|
14389
|
-
const brand = (branding == null ? void 0 : branding.brand_name) || organizationName ||
|
|
14403
|
+
const brand = (branding == null ? void 0 : branding.brand_name) || organizationName || "";
|
|
14390
14404
|
const legal = brandContact.legal_entity_name || (branding == null ? void 0 : branding.legal_name) || null;
|
|
14391
14405
|
return useMemo6(() => ({ brand, legal }), [brand, legal]);
|
|
14392
14406
|
};
|
|
@@ -15654,6 +15668,17 @@ function CompactLanguageMenu({ locale, options, onChange }) {
|
|
|
15654
15668
|
|
|
15655
15669
|
// src/RedactoPrivacyCenter/components/AppShell/TopAppBar.tsx
|
|
15656
15670
|
import { Fragment as Fragment3, jsx as jsx37, jsxs as jsxs16 } from "react/jsx-runtime";
|
|
15671
|
+
var LOGO_GROUP_PLACEMENT = {
|
|
15672
|
+
// `left`, not `insetInlineStart`: the translation is physical, so a logical
|
|
15673
|
+
// offset would measure from the right under RTL and land off centre.
|
|
15674
|
+
center: {
|
|
15675
|
+
position: "absolute",
|
|
15676
|
+
left: "50%",
|
|
15677
|
+
transform: "translateX(-50%)"
|
|
15678
|
+
},
|
|
15679
|
+
right: { order: 1 }
|
|
15680
|
+
};
|
|
15681
|
+
var hamburgerLeadsHeader = (logoAlign) => logoAlign === "center" || logoAlign === "right";
|
|
15657
15682
|
var TOP_BAR_LOGO_HEIGHT = 32;
|
|
15658
15683
|
var TOP_BAR_LOGO_MAX_HEIGHT = 40;
|
|
15659
15684
|
var TopAppBar = forwardRef2(function TopAppBar2({ onOpenMobileNav, showHamburger, locale, onLocaleChange, onBack, showNotifications = true }, hamburgerRef) {
|
|
@@ -15716,6 +15741,22 @@ var TopAppBar = forwardRef2(function TopAppBar2({ onOpenMobileNav, showHamburger
|
|
|
15716
15741
|
fontFamily: "inherit",
|
|
15717
15742
|
flexShrink: 0
|
|
15718
15743
|
};
|
|
15744
|
+
const logoAlign = brandingSettings.logo_align;
|
|
15745
|
+
const hamburgerIsOwnItem = hamburgerLeadsHeader(logoAlign);
|
|
15746
|
+
const logoGroupStyle = {
|
|
15747
|
+
display: "flex",
|
|
15748
|
+
alignItems: "center",
|
|
15749
|
+
gap: 8,
|
|
15750
|
+
minWidth: 0,
|
|
15751
|
+
...LOGO_GROUP_PLACEMENT[logoAlign]
|
|
15752
|
+
};
|
|
15753
|
+
const actionsStyle = {
|
|
15754
|
+
display: "flex",
|
|
15755
|
+
alignItems: "center",
|
|
15756
|
+
gap: 8,
|
|
15757
|
+
flexShrink: 0,
|
|
15758
|
+
...logoAlign === "right" ? { order: 0 } : null
|
|
15759
|
+
};
|
|
15719
15760
|
return /* @__PURE__ */ jsxs16(Fragment3, { children: [
|
|
15720
15761
|
/* @__PURE__ */ jsxs16(
|
|
15721
15762
|
"header",
|
|
@@ -15725,8 +15766,16 @@ var TopAppBar = forwardRef2(function TopAppBar2({ onOpenMobileNav, showHamburger
|
|
|
15725
15766
|
style: headerStyle,
|
|
15726
15767
|
...partAttribute("topbar"),
|
|
15727
15768
|
children: [
|
|
15728
|
-
/* @__PURE__ */
|
|
15729
|
-
|
|
15769
|
+
showHamburger && hamburgerIsOwnItem && /* @__PURE__ */ jsx37(
|
|
15770
|
+
HamburgerButton,
|
|
15771
|
+
{
|
|
15772
|
+
ref: hamburgerRef,
|
|
15773
|
+
onClick: onOpenMobileNav,
|
|
15774
|
+
label: t("openSidebarMenu")
|
|
15775
|
+
}
|
|
15776
|
+
),
|
|
15777
|
+
/* @__PURE__ */ jsxs16("div", { style: logoGroupStyle, children: [
|
|
15778
|
+
showHamburger && !hamburgerIsOwnItem && /* @__PURE__ */ jsx37(
|
|
15730
15779
|
HamburgerButton,
|
|
15731
15780
|
{
|
|
15732
15781
|
ref: hamburgerRef,
|
|
@@ -15776,48 +15825,36 @@ var TopAppBar = forwardRef2(function TopAppBar2({ onOpenMobileNav, showHamburger
|
|
|
15776
15825
|
}
|
|
15777
15826
|
)
|
|
15778
15827
|
] }),
|
|
15779
|
-
/* @__PURE__ */ jsxs16(
|
|
15780
|
-
|
|
15781
|
-
|
|
15782
|
-
|
|
15783
|
-
|
|
15784
|
-
|
|
15785
|
-
|
|
15786
|
-
|
|
15787
|
-
|
|
15788
|
-
|
|
15789
|
-
|
|
15790
|
-
|
|
15791
|
-
|
|
15792
|
-
|
|
15793
|
-
|
|
15794
|
-
|
|
15795
|
-
|
|
15796
|
-
|
|
15797
|
-
|
|
15798
|
-
|
|
15799
|
-
|
|
15800
|
-
|
|
15801
|
-
|
|
15802
|
-
|
|
15803
|
-
|
|
15804
|
-
|
|
15805
|
-
|
|
15806
|
-
|
|
15807
|
-
|
|
15808
|
-
|
|
15809
|
-
flexShrink: 0
|
|
15810
|
-
},
|
|
15811
|
-
options: [...languageOptions2],
|
|
15812
|
-
value: languageOptions2.find((opt) => opt.value === locale) || null,
|
|
15813
|
-
onChange: handleLanguageChange
|
|
15814
|
-
}
|
|
15815
|
-
),
|
|
15816
|
-
showNotifications && isSectionEnabled("notifications") && /* @__PURE__ */ jsx37(NotificationBell, {}),
|
|
15817
|
-
/* @__PURE__ */ jsx37(UserMenu, { onBack })
|
|
15818
|
-
]
|
|
15819
|
-
}
|
|
15820
|
-
)
|
|
15828
|
+
/* @__PURE__ */ jsxs16("div", { style: actionsStyle, className: "pc-shell-topbar-actions", children: [
|
|
15829
|
+
!showSwitcher ? null : showHamburger ? /* @__PURE__ */ jsx37(
|
|
15830
|
+
CompactLanguageMenu,
|
|
15831
|
+
{
|
|
15832
|
+
locale,
|
|
15833
|
+
options: languageOptions2,
|
|
15834
|
+
onChange: changeLanguage
|
|
15835
|
+
}
|
|
15836
|
+
) : /* @__PURE__ */ jsx37(
|
|
15837
|
+
PCSelect,
|
|
15838
|
+
{
|
|
15839
|
+
size: "sm",
|
|
15840
|
+
searchable: true,
|
|
15841
|
+
prefix: /* @__PURE__ */ jsx37(Globe2, { size: 12, strokeWidth: 1.8 }),
|
|
15842
|
+
searchPlaceholder: t("searchPlaceholder"),
|
|
15843
|
+
noOptionsMessage: t("noOptionsFound"),
|
|
15844
|
+
style: {
|
|
15845
|
+
width: "auto",
|
|
15846
|
+
minWidth: 120,
|
|
15847
|
+
maxWidth: "min(60vw, 280px)",
|
|
15848
|
+
flexShrink: 0
|
|
15849
|
+
},
|
|
15850
|
+
options: [...languageOptions2],
|
|
15851
|
+
value: languageOptions2.find((opt) => opt.value === locale) || null,
|
|
15852
|
+
onChange: handleLanguageChange
|
|
15853
|
+
}
|
|
15854
|
+
),
|
|
15855
|
+
showNotifications && isSectionEnabled("notifications") && /* @__PURE__ */ jsx37(NotificationBell, {}),
|
|
15856
|
+
/* @__PURE__ */ jsx37(UserMenu, { onBack })
|
|
15857
|
+
] })
|
|
15821
15858
|
]
|
|
15822
15859
|
}
|
|
15823
15860
|
),
|
|
@@ -17952,9 +17989,8 @@ var INVALID_CONTACT_KEYS = {
|
|
|
17952
17989
|
email: "signInInvalidContactEmail",
|
|
17953
17990
|
sms: "signInInvalidContactSms"
|
|
17954
17991
|
};
|
|
17955
|
-
var seedSession = (
|
|
17992
|
+
var seedSession = (organisationUuid, workspaceUuid, sent) => {
|
|
17956
17993
|
try {
|
|
17957
|
-
sessionStorage.setItem("pc_org_slug", slug);
|
|
17958
17994
|
sessionStorage.setItem("pc_org_id", organisationUuid);
|
|
17959
17995
|
sessionStorage.setItem("pc_workspace_id", workspaceUuid);
|
|
17960
17996
|
if (sent.channel === "email") {
|
|
@@ -17963,7 +17999,7 @@ var seedSession = (slug, organisationUuid, workspaceUuid, sent) => {
|
|
|
17963
17999
|
} catch {
|
|
17964
18000
|
}
|
|
17965
18001
|
};
|
|
17966
|
-
function PrivacyCenterSignIn(
|
|
18002
|
+
function PrivacyCenterSignIn() {
|
|
17967
18003
|
var _a;
|
|
17968
18004
|
const { t } = useTranslation22();
|
|
17969
18005
|
const { settings, organisation } = usePrivacyCenterSettingsContext();
|
|
@@ -17978,7 +18014,6 @@ function PrivacyCenterSignIn({ slug }) {
|
|
|
17978
18014
|
const countdown = useCountdown();
|
|
17979
18015
|
const { organisationUuid, workspaceUuid } = organisation;
|
|
17980
18016
|
const orgUnavailable = organisation.status === "failed";
|
|
17981
|
-
const orgPending = organisation.status === "resolving";
|
|
17982
18017
|
const sendCode = useCallback18(
|
|
17983
18018
|
async (contact, channel) => {
|
|
17984
18019
|
const response = await consentClient.createOtp(
|
|
@@ -18044,7 +18079,7 @@ function PrivacyCenterSignIn({ slug }) {
|
|
|
18044
18079
|
setError(t("otpErrorFallback"));
|
|
18045
18080
|
return;
|
|
18046
18081
|
}
|
|
18047
|
-
seedSession(
|
|
18082
|
+
seedSession(organisationUuid, workspaceUuid, sent);
|
|
18048
18083
|
updateTokens(accessToken, (_a2 = result == null ? void 0 : result.refresh_token) != null ? _a2 : void 0);
|
|
18049
18084
|
} catch (verifyError) {
|
|
18050
18085
|
setError(t(otpErrorKey(verifyError)));
|
|
@@ -18101,7 +18136,7 @@ function PrivacyCenterSignIn({ slug }) {
|
|
|
18101
18136
|
{
|
|
18102
18137
|
initialValue: typedContact,
|
|
18103
18138
|
initialCountryCode: (_a = sent == null ? void 0 : sent.countryCode) != null ? _a : null,
|
|
18104
|
-
busy
|
|
18139
|
+
busy,
|
|
18105
18140
|
disabled: orgUnavailable,
|
|
18106
18141
|
error: error != null ? error : orgUnavailable ? t("signInOrgUnavailable") : null,
|
|
18107
18142
|
onSubmit: (value, countryCode) => void handleContact(value, countryCode),
|
|
@@ -18209,7 +18244,7 @@ function PrivacyCenterLayout({ settings, ...props }) {
|
|
|
18209
18244
|
}
|
|
18210
18245
|
function PrivacyCenterLayoutContent({
|
|
18211
18246
|
children,
|
|
18212
|
-
slug,
|
|
18247
|
+
slug = "",
|
|
18213
18248
|
onBack
|
|
18214
18249
|
}) {
|
|
18215
18250
|
const { consentClient } = useBaseUrl();
|
|
@@ -18221,39 +18256,38 @@ function PrivacyCenterLayoutContent({
|
|
|
18221
18256
|
const [isLoadingOrg, setIsLoadingOrg] = useState25(true);
|
|
18222
18257
|
const hasRedirectedRef = useRef15(false);
|
|
18223
18258
|
const authCheckInProgressRef = useRef15(false);
|
|
18259
|
+
useEffect22(() => {
|
|
18260
|
+
if (slug) warnSlugDeprecated();
|
|
18261
|
+
}, [slug]);
|
|
18224
18262
|
useEffect22(() => {
|
|
18225
18263
|
if (typeof window === "undefined") return;
|
|
18226
18264
|
let accessToken = sessionStorage.getItem("access_token");
|
|
18227
18265
|
let orgId = sessionStorage.getItem("pc_org_id");
|
|
18228
18266
|
let workspaceId = sessionStorage.getItem("pc_workspace_id");
|
|
18229
|
-
|
|
18230
|
-
if (authAccessToken && (!accessToken || !orgId || !workspaceId || !orgSlug)) {
|
|
18267
|
+
if (authAccessToken && (!accessToken || !orgId || !workspaceId)) {
|
|
18231
18268
|
const decoded = decodeJwtToken(authAccessToken);
|
|
18232
18269
|
if (decoded) {
|
|
18233
18270
|
accessToken = accessToken || authAccessToken;
|
|
18234
18271
|
orgId = orgId || (typeof decoded.organisation_uuid === "string" ? decoded.organisation_uuid : null);
|
|
18235
18272
|
workspaceId = workspaceId || (typeof decoded.workspace_uuid === "string" ? decoded.workspace_uuid : null);
|
|
18236
|
-
orgSlug = orgSlug || (typeof decoded.organisation_slug === "string" ? decoded.organisation_slug : null);
|
|
18237
18273
|
if (accessToken) sessionStorage.setItem("access_token", accessToken);
|
|
18238
18274
|
if (orgId) sessionStorage.setItem("pc_org_id", orgId);
|
|
18239
18275
|
if (workspaceId) sessionStorage.setItem("pc_workspace_id", workspaceId);
|
|
18240
|
-
if (orgSlug) sessionStorage.setItem("pc_org_slug", orgSlug);
|
|
18241
18276
|
const contact = resolveContactFromJwt(decoded);
|
|
18242
18277
|
if (contact) {
|
|
18243
18278
|
sessionStorage.setItem("email", contact);
|
|
18244
18279
|
}
|
|
18245
18280
|
}
|
|
18246
18281
|
}
|
|
18247
|
-
|
|
18248
|
-
if (accessToken && orgId && workspaceId && effectiveSlug) {
|
|
18282
|
+
if (accessToken && orgId && workspaceId) {
|
|
18249
18283
|
const decoded = decodeJwtToken(accessToken);
|
|
18250
18284
|
const orgNameFromJwt = decoded == null ? void 0 : decoded.organisation_name;
|
|
18251
|
-
const orgName = typeof orgNameFromJwt === "string" && orgNameFromJwt.trim() !== "" ? orgNameFromJwt :
|
|
18285
|
+
const orgName = typeof orgNameFromJwt === "string" && orgNameFromJwt.trim() !== "" ? orgNameFromJwt : "";
|
|
18252
18286
|
setOrganization({
|
|
18253
18287
|
uuid: orgId,
|
|
18254
18288
|
suid: "",
|
|
18255
18289
|
name: orgName,
|
|
18256
|
-
slug:
|
|
18290
|
+
slug: "",
|
|
18257
18291
|
description: "",
|
|
18258
18292
|
domain: "",
|
|
18259
18293
|
workspaces: [{
|
|
@@ -18274,7 +18308,7 @@ function PrivacyCenterLayoutContent({
|
|
|
18274
18308
|
setOrganization(null);
|
|
18275
18309
|
setIsLoadingOrg(false);
|
|
18276
18310
|
}
|
|
18277
|
-
}, [
|
|
18311
|
+
}, [authAccessToken]);
|
|
18278
18312
|
useEffect22(() => {
|
|
18279
18313
|
if (isLoadingOrg || !organization) {
|
|
18280
18314
|
return;
|
|
@@ -18287,7 +18321,7 @@ function PrivacyCenterLayoutContent({
|
|
|
18287
18321
|
authCheckInProgressRef.current = true;
|
|
18288
18322
|
try {
|
|
18289
18323
|
await checkAndRefreshAuth(
|
|
18290
|
-
|
|
18324
|
+
"",
|
|
18291
18325
|
organization == null ? void 0 : organization.uuid,
|
|
18292
18326
|
(_a = organization == null ? void 0 : organization.workspaces[0]) == null ? void 0 : _a.uuid,
|
|
18293
18327
|
consentClient
|
|
@@ -18301,7 +18335,7 @@ function PrivacyCenterLayoutContent({
|
|
|
18301
18335
|
}
|
|
18302
18336
|
};
|
|
18303
18337
|
checkAuth();
|
|
18304
|
-
}, [
|
|
18338
|
+
}, [organization, isLoadingOrg, consentClient, authAccessToken]);
|
|
18305
18339
|
const showSignIn = builtInSignIn && !isLoadingOrg && !organization;
|
|
18306
18340
|
const showPortal = Boolean(organization) && !isLoadingOrg && !isCheckingAuth;
|
|
18307
18341
|
useEffect22(() => {
|
|
@@ -18315,7 +18349,7 @@ function PrivacyCenterLayoutContent({
|
|
|
18315
18349
|
() => expireSession("timeout")
|
|
18316
18350
|
);
|
|
18317
18351
|
if (showSignIn) {
|
|
18318
|
-
return /* @__PURE__ */ jsx53(PrivacyCenterSignIn, {
|
|
18352
|
+
return /* @__PURE__ */ jsx53(PrivacyCenterSignIn, {});
|
|
18319
18353
|
}
|
|
18320
18354
|
if (isLoadingOrg || !organization || isCheckingAuth) {
|
|
18321
18355
|
return /* @__PURE__ */ jsx53("div", { style: {
|
|
@@ -23056,7 +23090,6 @@ function Form({
|
|
|
23056
23090
|
const queryClient = useQueryClient();
|
|
23057
23091
|
const timePeriodOptions = useTimePeriodOptions();
|
|
23058
23092
|
const { organization } = useOrganization();
|
|
23059
|
-
const orgSlug = (organization == null ? void 0 : organization.slug) || (organization == null ? void 0 : organization.name) || "";
|
|
23060
23093
|
const isCaseManagementContext = typeof window !== "undefined" && window.location.pathname.includes("/case-management");
|
|
23061
23094
|
const [requestType, setRequestType] = useState30(null);
|
|
23062
23095
|
const [timePeriod, setTimePeriod] = useState30("");
|
|
@@ -23647,7 +23680,7 @@ function Form({
|
|
|
23647
23680
|
if (!organizationId || !workspaceId) {
|
|
23648
23681
|
throw new Error("Organization ID and Workspace ID are required for file upload");
|
|
23649
23682
|
}
|
|
23650
|
-
const authToken = await ensureValidToken(organizationId, workspaceId,
|
|
23683
|
+
const authToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
|
|
23651
23684
|
if (!authToken) {
|
|
23652
23685
|
throw new Error("Authentication token is required for file upload");
|
|
23653
23686
|
}
|
|
@@ -27863,45 +27896,21 @@ function PrivacyCenterHomePage() {
|
|
|
27863
27896
|
// src/RedactoPrivacyCenter/context/PrivacyCenterSettingsContext.tsx
|
|
27864
27897
|
import { useEffect as useEffect39, useMemo as useMemo30, useState as useState39 } from "react";
|
|
27865
27898
|
|
|
27866
|
-
// src/RedactoPrivacyCenter/api/organizationLookup.ts
|
|
27867
|
-
var cache = /* @__PURE__ */ new Map();
|
|
27868
|
-
var isOrganisation = (value) => typeof value === "object" && value !== null && typeof value.uuid === "string";
|
|
27869
|
-
var fetchOrganisationBySlug = (slug, consentBaseUrl) => {
|
|
27870
|
-
const url = `${userServiceBaseUrl(consentBaseUrl)}/organizations/exists?slug=${encodeURIComponent(slug)}`;
|
|
27871
|
-
const cached = cache.get(url);
|
|
27872
|
-
if (cached) {
|
|
27873
|
-
return cached;
|
|
27874
|
-
}
|
|
27875
|
-
const request = apiFetch(url, { method: "GET" }).then((body) => {
|
|
27876
|
-
if (isOrganisation(body)) {
|
|
27877
|
-
return body;
|
|
27878
|
-
}
|
|
27879
|
-
cache.delete(url);
|
|
27880
|
-
return null;
|
|
27881
|
-
}).catch((error) => {
|
|
27882
|
-
cache.delete(url);
|
|
27883
|
-
console.warn("[RedactoPrivacyCenter] organisation lookup failed:", error);
|
|
27884
|
-
return null;
|
|
27885
|
-
});
|
|
27886
|
-
cache.set(url, request);
|
|
27887
|
-
return request;
|
|
27888
|
-
};
|
|
27889
|
-
|
|
27890
27899
|
// src/RedactoPrivacyCenter/settings/api.ts
|
|
27891
|
-
var
|
|
27900
|
+
var cache = /* @__PURE__ */ new Map();
|
|
27892
27901
|
var freshEntry = (url) => {
|
|
27893
|
-
const entry =
|
|
27902
|
+
const entry = cache.get(url);
|
|
27894
27903
|
if (!entry) {
|
|
27895
27904
|
return null;
|
|
27896
27905
|
}
|
|
27897
27906
|
if (Date.now() >= entry.expiresAt) {
|
|
27898
|
-
|
|
27907
|
+
cache.delete(url);
|
|
27899
27908
|
return null;
|
|
27900
27909
|
}
|
|
27901
27910
|
return entry;
|
|
27902
27911
|
};
|
|
27903
27912
|
var trimTrailingSlash = (url) => url.replace(/\/+$/, "");
|
|
27904
|
-
var privacyCenterSettingsUrl = (baseUrl, organisationUuid, language) => `${trimTrailingSlash(baseUrl)}/public/organisations/${encodeURIComponent(
|
|
27913
|
+
var privacyCenterSettingsUrl = (baseUrl, organisationUuid, language) => `${trimTrailingSlash(resolveEndpoints(baseUrl).baseUrl)}/public/organisations/${encodeURIComponent(
|
|
27905
27914
|
organisationUuid
|
|
27906
27915
|
)}/privacy-center-settings/?${SETTINGS_LANG_PARAM}=${encodeURIComponent(language)}`;
|
|
27907
27916
|
var isSettingsResponse = (value) => typeof value === "object" && value !== null && "settings" in value && typeof value.settings === "object" && value.settings !== null;
|
|
@@ -27913,8 +27922,8 @@ var fetchPublicPrivacyCenterSettings = (baseUrl, organisationUuid, language) =>
|
|
|
27913
27922
|
}
|
|
27914
27923
|
const forget = () => {
|
|
27915
27924
|
var _a;
|
|
27916
|
-
if (((_a =
|
|
27917
|
-
|
|
27925
|
+
if (((_a = cache.get(url)) == null ? void 0 : _a.request) === request) {
|
|
27926
|
+
cache.delete(url);
|
|
27918
27927
|
}
|
|
27919
27928
|
};
|
|
27920
27929
|
const request = apiFetch(url, {
|
|
@@ -27932,7 +27941,7 @@ var fetchPublicPrivacyCenterSettings = (baseUrl, organisationUuid, language) =>
|
|
|
27932
27941
|
}
|
|
27933
27942
|
return null;
|
|
27934
27943
|
});
|
|
27935
|
-
|
|
27944
|
+
cache.set(url, { request, expiresAt: Date.now() + SETTINGS_CACHE_TTL_MS });
|
|
27936
27945
|
return request;
|
|
27937
27946
|
};
|
|
27938
27947
|
var hasCachedPrivacyCenterSettings = (baseUrl, organisationUuid, language) => freshEntry(privacyCenterSettingsUrl(baseUrl, organisationUuid, language)) !== null;
|
|
@@ -27949,15 +27958,15 @@ var readSession = (key) => {
|
|
|
27949
27958
|
var resolveOrganisationIds = ({
|
|
27950
27959
|
organisationUuid,
|
|
27951
27960
|
workspaceUuid,
|
|
27952
|
-
accessToken
|
|
27953
|
-
slug
|
|
27961
|
+
accessToken
|
|
27954
27962
|
}) => {
|
|
27955
27963
|
var _a, _b, _c, _d;
|
|
27956
27964
|
const claims = accessToken ? decodeJwtToken(accessToken) : null;
|
|
27957
|
-
const
|
|
27958
|
-
const
|
|
27965
|
+
const storedOrganisation = readSession("pc_org_id");
|
|
27966
|
+
const organisation = (_b = (_a = clean(organisationUuid)) != null ? _a : clean(claims == null ? void 0 : claims.organisation_uuid)) != null ? _b : storedOrganisation;
|
|
27967
|
+
const sessionMatches = organisation !== null && organisation === storedOrganisation;
|
|
27959
27968
|
return {
|
|
27960
|
-
organisationUuid:
|
|
27969
|
+
organisationUuid: organisation,
|
|
27961
27970
|
workspaceUuid: (_d = (_c = clean(workspaceUuid)) != null ? _c : clean(claims == null ? void 0 : claims.workspace_uuid)) != null ? _d : sessionMatches ? readSession("pc_workspace_id") : null
|
|
27962
27971
|
};
|
|
27963
27972
|
};
|
|
@@ -28042,7 +28051,7 @@ var orderedToggles = (raw, keys, defaults) => {
|
|
|
28042
28051
|
};
|
|
28043
28052
|
var stringList = (raw, max) => Array.isArray(raw) ? raw.filter((item) => typeof item === "string").map((item) => item.trim()).filter(Boolean).slice(0, max) : [];
|
|
28044
28053
|
var resolveBranding = (raw) => {
|
|
28045
|
-
var _a;
|
|
28054
|
+
var _a, _b;
|
|
28046
28055
|
const base = DEFAULT_PRIVACY_CENTER_SETTINGS.branding;
|
|
28047
28056
|
const font = raw.font_family;
|
|
28048
28057
|
return {
|
|
@@ -28050,11 +28059,12 @@ var resolveBranding = (raw) => {
|
|
|
28050
28059
|
display_name: nullableText(raw.display_name, base.display_name),
|
|
28051
28060
|
logo_url: nullableUrl(raw.logo_url, base.logo_url),
|
|
28052
28061
|
logo_height: clampedInt(raw.logo_height, LOGO_HEIGHT_MIN, LOGO_HEIGHT_MAX, base.logo_height),
|
|
28062
|
+
logo_align: (_a = LOGO_ALIGNMENTS.find((value) => value === raw.logo_align)) != null ? _a : base.logo_align,
|
|
28053
28063
|
inherit_colors: bool(raw.inherit_colors, base.inherit_colors),
|
|
28054
28064
|
primary_color: hex(raw.primary_color, base.primary_color),
|
|
28055
28065
|
accent_color: hex(raw.accent_color, base.accent_color),
|
|
28056
28066
|
inherit_font: bool(raw.inherit_font, base.inherit_font),
|
|
28057
|
-
font_family: font === null ? null : (
|
|
28067
|
+
font_family: font === null ? null : (_b = FONT_FAMILIES.find((family) => family === font)) != null ? _b : base.font_family,
|
|
28058
28068
|
style: raw.style === void 0 ? base.style : resolveAppearance(raw.style) === "glass" ? "glass" : "classic",
|
|
28059
28069
|
corner_radius: clampedInt(raw.corner_radius, CORNER_RADIUS_MIN, CORNER_RADIUS_MAX, base.corner_radius)
|
|
28060
28070
|
};
|
|
@@ -28216,55 +28226,9 @@ var resolveBrandContact = (raw) => {
|
|
|
28216
28226
|
// src/RedactoPrivacyCenter/context/PrivacyCenterSettingsContext.tsx
|
|
28217
28227
|
import { jsx as jsx101 } from "react/jsx-runtime";
|
|
28218
28228
|
var requestLanguageFor = (language) => LANGUAGE_CODES.includes(language) ? language : "en";
|
|
28219
|
-
var useResolvedOrganisation = (baseUrl, slug, known, canLookUp) => {
|
|
28220
|
-
const needsLookup = canLookUp && Boolean(slug) && (!known.organisationUuid || !known.workspaceUuid);
|
|
28221
|
-
const lookupKey = `${baseUrl}|${slug}`;
|
|
28222
|
-
const [lookup, setLookup] = useState39(null);
|
|
28223
|
-
useEffect39(() => {
|
|
28224
|
-
if (!needsLookup) {
|
|
28225
|
-
return void 0;
|
|
28226
|
-
}
|
|
28227
|
-
let cancelled = false;
|
|
28228
|
-
void fetchOrganisationBySlug(slug, baseUrl).then((organisation) => {
|
|
28229
|
-
var _a, _b, _c;
|
|
28230
|
-
if (cancelled) {
|
|
28231
|
-
return;
|
|
28232
|
-
}
|
|
28233
|
-
setLookup({
|
|
28234
|
-
key: lookupKey,
|
|
28235
|
-
ids: organisation ? {
|
|
28236
|
-
organisationUuid: organisation.uuid,
|
|
28237
|
-
workspaceUuid: (_c = (_b = (_a = organisation.workspaces) == null ? void 0 : _a[0]) == null ? void 0 : _b.uuid) != null ? _c : null
|
|
28238
|
-
} : null
|
|
28239
|
-
});
|
|
28240
|
-
});
|
|
28241
|
-
return () => {
|
|
28242
|
-
cancelled = true;
|
|
28243
|
-
};
|
|
28244
|
-
}, [needsLookup, slug, baseUrl, lookupKey]);
|
|
28245
|
-
return useMemo30(() => {
|
|
28246
|
-
var _a, _b, _c, _d;
|
|
28247
|
-
if (!needsLookup) {
|
|
28248
|
-
return { ...known, status: "resolved" };
|
|
28249
|
-
}
|
|
28250
|
-
if ((lookup == null ? void 0 : lookup.key) !== lookupKey) {
|
|
28251
|
-
return { ...known, status: "resolving" };
|
|
28252
|
-
}
|
|
28253
|
-
const found = lookup.ids;
|
|
28254
|
-
const sameOrganisation = !known.organisationUuid || known.organisationUuid === (found == null ? void 0 : found.organisationUuid);
|
|
28255
|
-
const organisationUuid = (_b = (_a = known.organisationUuid) != null ? _a : found == null ? void 0 : found.organisationUuid) != null ? _b : null;
|
|
28256
|
-
const workspaceUuid = (_d = known.workspaceUuid) != null ? _d : sameOrganisation ? (_c = found == null ? void 0 : found.workspaceUuid) != null ? _c : null : null;
|
|
28257
|
-
return {
|
|
28258
|
-
organisationUuid,
|
|
28259
|
-
workspaceUuid,
|
|
28260
|
-
status: organisationUuid && workspaceUuid ? "resolved" : "failed"
|
|
28261
|
-
};
|
|
28262
|
-
}, [needsLookup, known, lookup, lookupKey]);
|
|
28263
|
-
};
|
|
28264
28229
|
var PrivacyCenterSettingsProvider = ({
|
|
28265
28230
|
children,
|
|
28266
28231
|
baseUrl,
|
|
28267
|
-
slug,
|
|
28268
28232
|
accessToken,
|
|
28269
28233
|
organisationUuid,
|
|
28270
28234
|
workspaceUuid,
|
|
@@ -28272,11 +28236,13 @@ var PrivacyCenterSettingsProvider = ({
|
|
|
28272
28236
|
builtInSignIn = false
|
|
28273
28237
|
}) => {
|
|
28274
28238
|
const { currentLanguage } = useCurrentLanguage();
|
|
28275
|
-
const
|
|
28276
|
-
|
|
28277
|
-
|
|
28278
|
-
|
|
28279
|
-
|
|
28239
|
+
const organisation = useMemo30(() => {
|
|
28240
|
+
const known = resolveOrganisationIds({ organisationUuid, workspaceUuid, accessToken });
|
|
28241
|
+
return {
|
|
28242
|
+
...known,
|
|
28243
|
+
status: known.organisationUuid && known.workspaceUuid ? "resolved" : "failed"
|
|
28244
|
+
};
|
|
28245
|
+
}, [organisationUuid, workspaceUuid, accessToken]);
|
|
28280
28246
|
const orgUuid = organisation.organisationUuid;
|
|
28281
28247
|
const requestLanguage = requestLanguageFor(currentLanguage);
|
|
28282
28248
|
const [remote, setRemote] = useState39(null);
|
|
@@ -28321,8 +28287,8 @@ var PrivacyCenterSettingsProvider = ({
|
|
|
28321
28287
|
const isCustomised = isPublished || hasHostOverrides(overrides);
|
|
28322
28288
|
useLanguagePolicy(settings, isCustomised);
|
|
28323
28289
|
const value = useMemo30(
|
|
28324
|
-
() => ({ settings, status, isCustomised, organisation,
|
|
28325
|
-
[settings, status, isCustomised, organisation,
|
|
28290
|
+
() => ({ settings, status, isCustomised, organisation, builtInSignIn, brandContact }),
|
|
28291
|
+
[settings, status, isCustomised, organisation, builtInSignIn, brandContact]
|
|
28326
28292
|
);
|
|
28327
28293
|
return /* @__PURE__ */ jsx101(PrivacyCenterSettingsContext.Provider, { value, children });
|
|
28328
28294
|
};
|
|
@@ -31519,7 +31485,7 @@ function SettingsAppearance({ children }) {
|
|
|
31519
31485
|
function RedactoPrivacyCenter({
|
|
31520
31486
|
baseUrl,
|
|
31521
31487
|
ledgerBaseUrl,
|
|
31522
|
-
slug,
|
|
31488
|
+
slug = "",
|
|
31523
31489
|
accessToken,
|
|
31524
31490
|
refreshToken,
|
|
31525
31491
|
token,
|
|
@@ -31546,13 +31512,12 @@ function RedactoPrivacyCenter({
|
|
|
31546
31512
|
PrivacyCenterSettingsProvider,
|
|
31547
31513
|
{
|
|
31548
31514
|
baseUrl,
|
|
31549
|
-
slug,
|
|
31550
31515
|
accessToken,
|
|
31551
31516
|
organisationUuid,
|
|
31552
31517
|
workspaceUuid,
|
|
31553
31518
|
overrides: settings,
|
|
31554
31519
|
builtInSignIn: builtInSignIn && !token,
|
|
31555
|
-
children: /* @__PURE__ */ jsx103(PrivacyCenterRoot, { children: /* @__PURE__ */ jsx103(SettingsAppearance, { children: /* @__PURE__ */ jsx103(BrandingProvider, {
|
|
31520
|
+
children: /* @__PURE__ */ jsx103(PrivacyCenterRoot, { children: /* @__PURE__ */ jsx103(SettingsAppearance, { children: /* @__PURE__ */ jsx103(BrandingProvider, { baseUrl, children: /* @__PURE__ */ jsx103(BaseUrlProvider, { baseUrl, ledgerBaseUrl, children: /* @__PURE__ */ jsx103(
|
|
31556
31521
|
AuthProvider,
|
|
31557
31522
|
{
|
|
31558
31523
|
accessToken,
|
|
@@ -31563,7 +31528,6 @@ function RedactoPrivacyCenter({
|
|
|
31563
31528
|
sandboxMobile: mobile,
|
|
31564
31529
|
organisationUuid,
|
|
31565
31530
|
workspaceUuid,
|
|
31566
|
-
slug,
|
|
31567
31531
|
onError,
|
|
31568
31532
|
children: /* @__PURE__ */ jsx103(NavigationProvider, { initialPage, children: /* @__PURE__ */ jsx103(PageChromeProvider, { children: /* @__PURE__ */ jsx103(PrivacyCenterLayout, { slug, onBack, children: /* @__PURE__ */ jsx103(PrivacyCenterHomePage, {}) }) }) })
|
|
31569
31533
|
}
|