@redacto.io/consent-sdk-react-native 5.0.0-beta.9 → 5.0.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.
@@ -11974,7 +11974,11 @@ var resolveContactFromJwt = (decoded) => {
11974
11974
  }
11975
11975
  const userData = decoded.user_data || {};
11976
11976
  const candidate = decoded.contact || decoded.primary_email || userData.primary_email || userData.primary_mobile || userData.org_user_id;
11977
- return typeof candidate === "string" && candidate.trim() !== "" ? candidate : null;
11977
+ if (typeof candidate !== "string") {
11978
+ return null;
11979
+ }
11980
+ const contact = candidate.trim();
11981
+ return contact === "" ? null : contact;
11978
11982
  };
11979
11983
  var isJwtExpired = (token, bufferSeconds = 30) => {
11980
11984
  if (!token || typeof token !== "string") return true;
@@ -12116,6 +12120,23 @@ var formatDateTime = (timestamp) => {
12116
12120
  hours = hours % 12 || 12;
12117
12121
  return `${month} ${day}, ${year} at ${hours}:${minutes} ${ampm}`;
12118
12122
  };
12123
+ var extractCaseRef = (response) => {
12124
+ if (!response || typeof response !== "object") {
12125
+ return null;
12126
+ }
12127
+ const wrapper = response;
12128
+ const candidates = [wrapper.detail, response];
12129
+ for (const candidate of candidates) {
12130
+ if (!candidate || typeof candidate !== "object") {
12131
+ continue;
12132
+ }
12133
+ const { case_id: caseId, uuid } = candidate;
12134
+ if (caseId || uuid) {
12135
+ return { case_id: caseId != null ? caseId : "", uuid: uuid != null ? uuid : "" };
12136
+ }
12137
+ }
12138
+ return null;
12139
+ };
12119
12140
  var generateUuid = () => {
12120
12141
  return "xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g, (c) => {
12121
12142
  const r = Math.random() * 16 | 0;
@@ -12135,9 +12156,10 @@ function extractJwtAuthData(token) {
12135
12156
  if (!decoded) {
12136
12157
  return { email: null, organizationId: null, workspaceId: null, organizationName: null };
12137
12158
  }
12138
- const contact = resolveContactFromJwt(decoded) || getStoredValue("email");
12159
+ const contact = resolveContactFromJwt(decoded);
12139
12160
  return {
12140
- email: typeof contact === "string" && contact.trim() !== "" ? contact : null,
12161
+ // `resolveContactFromJwt` already returns a trimmed, non-empty string or null.
12162
+ email: contact,
12141
12163
  organizationId: decoded.organisation_uuid || null,
12142
12164
  workspaceId: decoded.workspace_uuid || null,
12143
12165
  organizationName: decoded.organisation_name || null
@@ -12146,7 +12168,11 @@ function extractJwtAuthData(token) {
12146
12168
  function syncJwtDataToStore(token) {
12147
12169
  const authData = extractJwtAuthData(token);
12148
12170
  setStoredValue("access_token", token);
12149
- if (authData.email) setStoredValue("email", authData.email);
12171
+ if (authData.email) {
12172
+ setStoredValue("email", authData.email);
12173
+ } else {
12174
+ removeStoredValue("email");
12175
+ }
12150
12176
  if (authData.organizationId) setStoredValue("pc_org_id", authData.organizationId);
12151
12177
  if (authData.workspaceId) setStoredValue("pc_workspace_id", authData.workspaceId);
12152
12178
  return authData;
@@ -14756,6 +14782,11 @@ var useTimePeriodOptions = () => {
14756
14782
  );
14757
14783
  };
14758
14784
  var MAX_DISPLAYED_PURPOSE_NAMES_IN_ERASURE_MODAL = 3;
14785
+ var PRODUCT_SCOPED_REQUEST_TYPES = [
14786
+ "ACCESS" /* ACCESS */,
14787
+ "erasure" /* ERASURE */,
14788
+ "CORRECTION" /* CORRECTION */
14789
+ ];
14759
14790
  var SEARCH_DEBOUNCE_DELAY = 500;
14760
14791
  var FORM_PICKER_GROUP_LIMIT = 100;
14761
14792
  var LEGACY_PRODUCT_GROUP_UUID = "__legacy_flat_purposes__";
@@ -16576,6 +16607,25 @@ var uploadFileWithS2S = async ({
16576
16607
  }
16577
16608
  };
16578
16609
 
16610
+ // src/RedactoPrivacyCenter/lib/requestType.ts
16611
+ var isRequestType = (requestType, expected) => typeof requestType === "string" && requestType.toLowerCase() === expected.toLowerCase();
16612
+ var isProductScopedRequestType = (requestType) => PRODUCT_SCOPED_REQUEST_TYPES.some((type) => isRequestType(requestType, type));
16613
+
16614
+ // src/RedactoPrivacyCenter/lib/erasureConsent.ts
16615
+ var isErasureRequestType = (requestType) => isRequestType(requestType, "erasure" /* ERASURE */);
16616
+ var resolveErasurePurposeNames = (purposeNames, fallback) => {
16617
+ if (purposeNames.length === 0 || purposeNames.length > MAX_DISPLAYED_PURPOSE_NAMES_IN_ERASURE_MODAL) {
16618
+ return fallback;
16619
+ }
16620
+ return purposeNames.join(", ");
16621
+ };
16622
+ var erasureConsentPayload = (requestType, revokeConsentOnFulfilment) => {
16623
+ if (!isErasureRequestType(requestType)) {
16624
+ return {};
16625
+ }
16626
+ return { revoke_consent_on_fulfilment: revokeConsentOnFulfilment };
16627
+ };
16628
+
16579
16629
  // src/RedactoPrivacyCenter/lib/filePicker.ts
16580
16630
  var import_react_native42 = require("react-native");
16581
16631
  async function pickFile() {
@@ -16812,12 +16862,6 @@ var buildGroupDataElements = (group) => {
16812
16862
  // src/RedactoPrivacyCenter/components/Form.tsx
16813
16863
  var import_jsx_runtime43 = require("react/jsx-runtime");
16814
16864
  var TOTAL_STEPS = 3;
16815
- var PRODUCT_SCOPED_REQUEST_TYPES = /* @__PURE__ */ new Set([
16816
- "ACCESS" /* ACCESS */,
16817
- "erasure" /* ERASURE */,
16818
- "CORRECTION" /* CORRECTION */
16819
- ]);
16820
- var isProductScopedRequestType = (rt) => PRODUCT_SCOPED_REQUEST_TYPES.has(rt);
16821
16865
  function Form({ onCreateRequest }) {
16822
16866
  const { t } = (0, import_react_i18next16.useTranslation)();
16823
16867
  const { accessToken, refreshToken, email, organizationId, workspaceId, updateTokens, onError } = useAuth();
@@ -16961,7 +17005,7 @@ function Form({ onCreateRequest }) {
16961
17005
  setSelectedProductKey(null);
16962
17006
  }
16963
17007
  setNominationData({ nominee_email: "", nominee_mobile: "" });
16964
- if (requestType === "grievance" /* GRIEVANCE */ && grievanceOptions.length > 0) {
17008
+ if (isRequestType(requestType, "grievance" /* GRIEVANCE */) && grievanceOptions.length > 0) {
16965
17009
  const resetGrievances = grievanceOptions.reduce(
16966
17010
  (acc, option) => {
16967
17011
  acc[option.value] = false;
@@ -16990,12 +17034,10 @@ function Form({ onCreateRequest }) {
16990
17034
  () => groupPurposes.filter((p) => selectedPurposes.has(p.uuid)).map((p) => p.name).filter(Boolean),
16991
17035
  [groupPurposes, selectedPurposes]
16992
17036
  );
16993
- const selectedErasurePurposeNames = (0, import_react29.useMemo)(() => {
16994
- if (selectedErasurePurposeList.length === 0 || selectedErasurePurposeList.length > MAX_DISPLAYED_PURPOSE_NAMES_IN_ERASURE_MODAL) {
16995
- return t("revokeConsentModalYourPurposes");
16996
- }
16997
- return selectedErasurePurposeList.join(", ");
16998
- }, [selectedErasurePurposeList, t]);
17037
+ const selectedErasurePurposeNames = (0, import_react29.useMemo)(
17038
+ () => resolveErasurePurposeNames(selectedErasurePurposeList, t("revokeConsentModalYourPurposes")),
17039
+ [selectedErasurePurposeList, t]
17040
+ );
16999
17041
  const togglePurpose = (0, import_react29.useCallback)(
17000
17042
  (purpose) => {
17001
17043
  const uuid = purpose.uuid;
@@ -17102,7 +17144,7 @@ function Form({ onCreateRequest }) {
17102
17144
  if (isProductScopedRequestType(requestType)) {
17103
17145
  if (allGroups.length === 0) return false;
17104
17146
  if (!selectedGroup) return false;
17105
- if (requestType === "CORRECTION" /* CORRECTION */) {
17147
+ if (isRequestType(requestType, "CORRECTION" /* CORRECTION */)) {
17106
17148
  if (selectedCorrectionFields.size === 0) return false;
17107
17149
  return Array.from(selectedCorrectionFields).every((fieldUuid) => {
17108
17150
  var _a3, _b;
@@ -17110,15 +17152,15 @@ function Form({ onCreateRequest }) {
17110
17152
  return Boolean(((_a3 = v == null ? void 0 : v.current) == null ? void 0 : _a3.trim()) && ((_b = v == null ? void 0 : v.updated) == null ? void 0 : _b.trim()));
17111
17153
  });
17112
17154
  }
17113
- if (requestType === "ACCESS" /* ACCESS */ || requestType === "erasure" /* ERASURE */) {
17155
+ if (isRequestType(requestType, "ACCESS" /* ACCESS */) || isErasureRequestType(requestType)) {
17114
17156
  return selectedPurposes.size > 0;
17115
17157
  }
17116
17158
  return false;
17117
17159
  }
17118
- if (requestType === "grievance" /* GRIEVANCE */) {
17160
+ if (isRequestType(requestType, "grievance" /* GRIEVANCE */)) {
17119
17161
  return Object.values(selectedGrievances).some(Boolean);
17120
17162
  }
17121
- if (requestType === "nomination" /* NOMINATION */) {
17163
+ if (isRequestType(requestType, "nomination" /* NOMINATION */)) {
17122
17164
  return Boolean(nominationData.nominee_email);
17123
17165
  }
17124
17166
  return false;
@@ -17132,7 +17174,10 @@ function Form({ onCreateRequest }) {
17132
17174
  selectedGrievances,
17133
17175
  nominationData
17134
17176
  ]);
17135
- const isFormValid = (0, import_react29.useMemo)(() => detailsValid && confirmChecked, [detailsValid, confirmChecked]);
17177
+ const isFormValid = (0, import_react29.useMemo)(
17178
+ () => Boolean(contact.trim()) && detailsValid && confirmChecked,
17179
+ [contact, detailsValid, confirmChecked]
17180
+ );
17136
17181
  const handleUpload = (0, import_react29.useCallback)(async () => {
17137
17182
  if (!organizationId || !workspaceId) return;
17138
17183
  const caseUuid = formDataResponse == null ? void 0 : formDataResponse.uuid;
@@ -17184,9 +17229,18 @@ function Form({ onCreateRequest }) {
17184
17229
  const removeUploadedDoc = (0, import_react29.useCallback)((uuid) => {
17185
17230
  setUploadedDocs((prev) => prev.filter((d) => d.uuid !== uuid));
17186
17231
  }, []);
17232
+ const alertSubmitFailed = (0, import_react29.useCallback)(
17233
+ (message) => {
17234
+ import_react_native44.Alert.alert(t("submit"), message || t("unableToSubmit") || "Unable to submit request. Please try again.");
17235
+ },
17236
+ [t]
17237
+ );
17187
17238
  const handleSubmit = (0, import_react29.useCallback)(async (revoke = false) => {
17188
- var _a3, _b, _c, _d;
17189
- if (!organizationId || !workspaceId || !contact || !requestType || !formDataResponse) return;
17239
+ var _a3;
17240
+ if (!organizationId || !workspaceId || !contact || !requestType || !formDataResponse) {
17241
+ alertSubmitFailed();
17242
+ return;
17243
+ }
17190
17244
  setRevokeConsentOnFulfilment(revoke);
17191
17245
  setIsSubmitting(true);
17192
17246
  try {
@@ -17213,27 +17267,27 @@ function Form({ onCreateRequest }) {
17213
17267
  purposes: updatePurposes,
17214
17268
  correction_data: correctionData,
17215
17269
  grievance_types: grievanceTypes,
17216
- ...requestType === "nomination" /* NOMINATION */ ? { nomination_data: nominationData } : {}
17270
+ ...isRequestType(requestType, "nomination" /* NOMINATION */) ? { nomination_data: nominationData } : {}
17217
17271
  },
17218
- time_period: requestType === "ACCESS" /* ACCESS */ ? parseInt(timePeriod || "30", 10) : 0,
17272
+ time_period: isRequestType(requestType, "ACCESS" /* ACCESS */) ? parseInt(timePeriod || "30", 10) : 0,
17219
17273
  requestor_note: additionalNote || "",
17220
- ...requestType === "erasure" /* ERASURE */ ? { revoke_consent_on_fulfilment: revoke } : {},
17274
+ ...erasureConsentPayload(requestType, revoke),
17221
17275
  ...anchorGroup ? { product_uuid: anchorGroup.product_uuid } : {},
17222
17276
  ...(anchorGroup == null ? void 0 : anchorGroup.nominator) ? { data_principal_uuid: anchorGroup.nominator.uuid } : {}
17223
17277
  };
17224
17278
  const response = await createCaseRequest(organizationId, workspaceId, request, false, false, authContext, consentClient);
17225
- const responseAny = response;
17226
- const newCaseId = (_c = (_b = responseAny == null ? void 0 : responseAny.case_id) != null ? _b : (_a3 = responseAny == null ? void 0 : responseAny.detail) == null ? void 0 : _a3.case_id) != null ? _c : null;
17279
+ const caseRef = extractCaseRef(response);
17280
+ const newCaseId = (caseRef == null ? void 0 : caseRef.case_id) || (caseRef == null ? void 0 : caseRef.uuid) || null;
17227
17281
  if (newCaseId) {
17228
17282
  setCaseId(newCaseId);
17229
- setSubmittedProductName((_d = anchorGroup == null ? void 0 : anchorGroup.product_name) != null ? _d : "");
17283
+ setSubmittedProductName((_a3 = anchorGroup == null ? void 0 : anchorGroup.product_name) != null ? _a3 : "");
17230
17284
  setIsSubmitted(true);
17231
17285
  } else {
17232
- import_react_native44.Alert.alert(t("submit"), t("unableToSubmit") || "Unable to submit request. Please try again.");
17286
+ alertSubmitFailed();
17233
17287
  }
17234
17288
  } catch (error) {
17235
17289
  console.warn("Error submitting request:", error);
17236
- import_react_native44.Alert.alert(t("submit"), (error == null ? void 0 : error.message) || t("unableToSubmit") || "Unable to submit request.");
17290
+ alertSubmitFailed(error == null ? void 0 : error.message);
17237
17291
  } finally {
17238
17292
  setIsSubmitting(false);
17239
17293
  }
@@ -17256,11 +17310,13 @@ function Form({ onCreateRequest }) {
17256
17310
  consentClient,
17257
17311
  groupDataElements,
17258
17312
  uploadedDocs,
17259
- t
17313
+ alertSubmitFailed
17260
17314
  ]);
17261
17315
  const handleSubmitClick = (0, import_react29.useCallback)(() => {
17262
- if (!isFormValid) return;
17263
- if (requestType === "erasure" /* ERASURE */) {
17316
+ if (!isFormValid) {
17317
+ return;
17318
+ }
17319
+ if (isErasureRequestType(requestType)) {
17264
17320
  setIsErasureConsentModalOpen(true);
17265
17321
  return;
17266
17322
  }
@@ -17349,7 +17405,7 @@ function Form({ onCreateRequest }) {
17349
17405
  if (groupPurposes.length === 0) {
17350
17406
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles33.placeholder, { color: colors.textSecondary }], children: t("noPurposesAvailable") || "No purposes available" });
17351
17407
  }
17352
- const isErasure = requestType === "erasure" /* ERASURE */;
17408
+ const isErasure = isErasureRequestType(requestType);
17353
17409
  const allPurposesSelected = groupPurposes.every(
17354
17410
  (p) => (p.data_elements || []).every((de) => {
17355
17411
  var _a3;
@@ -17469,18 +17525,18 @@ function Form({ onCreateRequest }) {
17469
17525
  ] }),
17470
17526
  selectedGroup ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: styles33.section, children: [
17471
17527
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles33.sectionLabel, { color: colors.textSecondary }], children: t("requestDetails") }),
17472
- /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: [styles33.sectionCard, elevation.card, { backgroundColor: colors.surface }], children: requestType === "CORRECTION" /* CORRECTION */ ? renderCorrectionFields() : renderPurposeFields() })
17528
+ /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: [styles33.sectionCard, elevation.card, { backgroundColor: colors.surface }], children: isRequestType(requestType, "CORRECTION" /* CORRECTION */) ? renderCorrectionFields() : renderPurposeFields() })
17473
17529
  ] }) : /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: [styles33.hintCard, { backgroundColor: colors.surfaceAlt }], children: [
17474
17530
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(Icon, { name: "circle-alert", size: 18, color: colors.textSecondary }),
17475
17531
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles33.hintText, { color: colors.textSecondary }], children: t("selectProductFirst", { defaultValue: "Select a product to continue" }) })
17476
17532
  ] }),
17477
- requestType === "ACCESS" /* ACCESS */ && selectedGroup ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: styles33.section, children: [
17533
+ isRequestType(requestType, "ACCESS" /* ACCESS */) && selectedGroup ? /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: styles33.section, children: [
17478
17534
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles33.sectionLabel, { color: colors.textSecondary }], children: t("timePeriod") }),
17479
17535
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(PCSelect, { value: timePeriod, options: timePeriodOptions, onChange: setTimePeriod, placeholder: t("timePeriod") })
17480
17536
  ] }) : null
17481
17537
  ] });
17482
17538
  }
17483
- if (requestType === "grievance" /* GRIEVANCE */) {
17539
+ if (isRequestType(requestType, "grievance" /* GRIEVANCE */)) {
17484
17540
  if (grievanceOptions.length === 0) {
17485
17541
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: styles33.stepBody, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles33.placeholder, { color: colors.textSecondary }], children: t("noPurposesAvailable") || "No grievance types available" }) });
17486
17542
  }
@@ -17496,7 +17552,7 @@ function Form({ onCreateRequest }) {
17496
17552
  ] })
17497
17553
  ] }) });
17498
17554
  }
17499
- if (requestType === "nomination" /* NOMINATION */) {
17555
+ if (isRequestType(requestType, "nomination" /* NOMINATION */)) {
17500
17556
  return /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.View, { style: styles33.stepBody, children: /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: styles33.section, children: [
17501
17557
  /* @__PURE__ */ (0, import_jsx_runtime43.jsx)(import_react_native44.Text, { style: [styles33.sectionLabel, { color: colors.textSecondary }], children: t("enterNomineeDetails") }),
17502
17558
  /* @__PURE__ */ (0, import_jsx_runtime43.jsxs)(import_react_native44.View, { style: [styles33.sectionCard, elevation.card, { backgroundColor: colors.surface }], children: [
@@ -18474,10 +18530,26 @@ var styles35 = import_react_native46.StyleSheet.create({
18474
18530
  });
18475
18531
 
18476
18532
  // src/RedactoPrivacyCenter/components/SlimTopBar.tsx
18477
- var import_react34 = require("react");
18533
+ var import_react35 = require("react");
18478
18534
  var import_react_native49 = require("react-native");
18479
18535
  var import_react_i18next19 = require("react-i18next");
18480
18536
 
18537
+ // src/RedactoPrivacyCenter/context/ProfileSwitchContext.tsx
18538
+ var import_react32 = require("react");
18539
+ var import_jsx_runtime46 = require("react/jsx-runtime");
18540
+ var ProfileSwitchContext = (0, import_react32.createContext)({
18541
+ switchProfile: null
18542
+ });
18543
+ function ProfileSwitchProvider({
18544
+ switchProfile,
18545
+ children
18546
+ }) {
18547
+ return /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(ProfileSwitchContext.Provider, { value: { switchProfile }, children });
18548
+ }
18549
+ function useProfileSwitch() {
18550
+ return (0, import_react32.useContext)(ProfileSwitchContext);
18551
+ }
18552
+
18481
18553
  // src/RedactoPrivacyCenter/lib/navigation.ts
18482
18554
  function navigateBack(onBack) {
18483
18555
  var _a3, _b;
@@ -18501,12 +18573,12 @@ function navigateBack(onBack) {
18501
18573
 
18502
18574
  // src/RedactoPrivacyCenter/components/NotificationHub/NotificationBell.tsx
18503
18575
  var import_react_native47 = require("react-native");
18504
- var import_jsx_runtime46 = require("react/jsx-runtime");
18576
+ var import_jsx_runtime47 = require("react/jsx-runtime");
18505
18577
  var NotificationBell = ({ count, onPress }) => {
18506
18578
  const { colors } = useTheme();
18507
18579
  const showBadge = count > 0;
18508
18580
  const badgeLabel = count > 99 ? "99+" : String(count);
18509
- return /* @__PURE__ */ (0, import_jsx_runtime46.jsxs)(
18581
+ return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
18510
18582
  import_react_native47.TouchableOpacity,
18511
18583
  {
18512
18584
  onPress,
@@ -18516,8 +18588,8 @@ var NotificationBell = ({ count, onPress }) => {
18516
18588
  accessibilityRole: "button",
18517
18589
  accessibilityLabel: showBadge ? `Notifications, ${count} unread` : "Notifications",
18518
18590
  children: [
18519
- /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(Icon, { name: "bell", size: 22, color: colors.text }),
18520
- showBadge ? /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.View, { style: [styles36.badge, { backgroundColor: colors.error, borderColor: colors.canvasSubtle }], children: /* @__PURE__ */ (0, import_jsx_runtime46.jsx)(import_react_native47.Text, { style: styles36.badgeText, numberOfLines: 1, children: badgeLabel }) }) : null
18591
+ /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "bell", size: 22, color: colors.text }),
18592
+ showBadge ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native47.View, { style: [styles36.badge, { backgroundColor: colors.error, borderColor: colors.canvasSubtle }], children: /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native47.Text, { style: styles36.badgeText, numberOfLines: 1, children: badgeLabel }) }) : null
18521
18593
  ]
18522
18594
  }
18523
18595
  );
@@ -18549,27 +18621,27 @@ var styles36 = import_react_native47.StyleSheet.create({
18549
18621
  });
18550
18622
 
18551
18623
  // src/RedactoPrivacyCenter/components/NotificationHub/useUnreadCount.ts
18552
- var import_react32 = require("react");
18624
+ var import_react33 = require("react");
18553
18625
  function useUnreadCount() {
18554
18626
  const { accessToken, refreshToken, onError, updateTokens, organizationId, workspaceId } = useAuth();
18555
18627
  const { consentClient } = useBaseUrl();
18556
- const [count, setCount] = (0, import_react32.useState)(0);
18557
- const authContext = (0, import_react32.useMemo)(
18628
+ const [count, setCount] = (0, import_react33.useState)(0);
18629
+ const authContext = (0, import_react33.useMemo)(
18558
18630
  () => ({ accessToken, refreshToken, onError, updateTokens }),
18559
18631
  [accessToken, refreshToken, onError, updateTokens]
18560
18632
  );
18561
- const loadRef = (0, import_react32.useRef)();
18633
+ const loadRef = (0, import_react33.useRef)();
18562
18634
  loadRef.current = async () => {
18563
18635
  if (!organizationId || !workspaceId) return;
18564
18636
  if (isRefreshBlocked(authContext)) return;
18565
18637
  const res = await fetchUnreadCount(organizationId, workspaceId, authContext, consentClient);
18566
18638
  if (res && typeof res.count === "number") setCount(res.count);
18567
18639
  };
18568
- (0, import_react32.useEffect)(() => {
18640
+ (0, import_react33.useEffect)(() => {
18569
18641
  var _a3;
18570
18642
  (_a3 = loadRef.current) == null ? void 0 : _a3.call(loadRef);
18571
18643
  }, [organizationId, workspaceId]);
18572
- (0, import_react32.useEffect)(() => {
18644
+ (0, import_react33.useEffect)(() => {
18573
18645
  const id = setInterval(() => {
18574
18646
  var _a3;
18575
18647
  (_a3 = loadRef.current) == null ? void 0 : _a3.call(loadRef);
@@ -18580,17 +18652,17 @@ function useUnreadCount() {
18580
18652
  }
18581
18653
 
18582
18654
  // src/RedactoPrivacyCenter/components/NavDrawer.tsx
18583
- var import_react33 = require("react");
18655
+ var import_react34 = require("react");
18584
18656
  var import_react_native48 = require("react-native");
18585
18657
  var import_react_i18next18 = require("react-i18next");
18586
- var import_jsx_runtime47 = require("react/jsx-runtime");
18658
+ var import_jsx_runtime48 = require("react/jsx-runtime");
18587
18659
  var NavDrawer = ({ visible, onClose, onBack }) => {
18588
18660
  const { t } = (0, import_react_i18next18.useTranslation)();
18589
18661
  const { colors, branding } = useTheme();
18590
18662
  const { organizationName, email } = useAuth();
18591
18663
  const { currentPage, navigateTo } = useInternalNavigation();
18592
- const [locale, setLocale] = (0, import_react33.useState)(i18n_default.language || "en");
18593
- const items = (0, import_react33.useMemo)(
18664
+ const [locale, setLocale] = (0, import_react34.useState)(i18n_default.language || "en");
18665
+ const items = (0, import_react34.useMemo)(
18594
18666
  () => [
18595
18667
  { page: "home", label: t("privacyCenter") || "Home", icon: "shield", tone: "primary" },
18596
18668
  { page: "consent-manager", label: t("manageConsent") || "Consents", icon: "shield-check", tone: "primary" },
@@ -18605,18 +18677,18 @@ var NavDrawer = ({ visible, onClose, onBack }) => {
18605
18677
  i18n_default.changeLanguage(value);
18606
18678
  };
18607
18679
  const brandName = (branding == null ? void 0 : branding.brand_name) || organizationName || t("privacyCenter") || "Privacy Center";
18608
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(BottomSheet, { visible, onClose, title: t("menu") || "Menu", children: /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles37.body, children: [
18609
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: [styles37.identity, { backgroundColor: colors.surfaceAlt }], children: [
18610
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(PCAvatar, { name: brandName, imageUrl: branding == null ? void 0 : branding.icon_url, size: 40 }),
18611
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { style: styles37.identityText, children: [
18612
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles37.brandName, { color: colors.text }], numberOfLines: 1, children: brandName }),
18613
- email ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles37.email, { color: colors.textSecondary }], numberOfLines: 1, children: email }) : null
18680
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(BottomSheet, { visible, onClose, title: t("menu") || "Menu", children: /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native48.View, { style: styles37.body, children: [
18681
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native48.View, { style: [styles37.identity, { backgroundColor: colors.surfaceAlt }], children: [
18682
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PCAvatar, { name: brandName, imageUrl: branding == null ? void 0 : branding.icon_url, size: 40 }),
18683
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native48.View, { style: styles37.identityText, children: [
18684
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native48.Text, { style: [styles37.brandName, { color: colors.text }], numberOfLines: 1, children: brandName }),
18685
+ email ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native48.Text, { style: [styles37.email, { color: colors.textSecondary }], numberOfLines: 1, children: email }) : null
18614
18686
  ] })
18615
18687
  ] }),
18616
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.View, { style: [styles37.menuGroup, { borderColor: colors.border, backgroundColor: colors.surface }], children: items.map((item, index) => {
18688
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native48.View, { style: [styles37.menuGroup, { borderColor: colors.border, backgroundColor: colors.surface }], children: items.map((item, index) => {
18617
18689
  const isActive = currentPage === item.page;
18618
- return /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(import_react_native48.View, { children: [
18619
- /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
18690
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native48.View, { children: [
18691
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
18620
18692
  import_react_native48.TouchableOpacity,
18621
18693
  {
18622
18694
  style: styles37.menuItem,
@@ -18629,8 +18701,8 @@ var NavDrawer = ({ visible, onClose, onBack }) => {
18629
18701
  accessibilityState: { selected: isActive },
18630
18702
  accessibilityLabel: item.label,
18631
18703
  children: [
18632
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(IconTile, { name: item.icon, tone: item.tone, size: "sm" }),
18633
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18704
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(IconTile, { name: item.icon, tone: item.tone, size: "sm" }),
18705
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18634
18706
  import_react_native48.Text,
18635
18707
  {
18636
18708
  style: [styles37.menuLabel, { color: isActive ? colors.primary : colors.text }],
@@ -18638,14 +18710,14 @@ var NavDrawer = ({ visible, onClose, onBack }) => {
18638
18710
  children: item.label
18639
18711
  }
18640
18712
  ),
18641
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Icon, { name: "chevron-right", size: 18, color: colors.textSecondary })
18713
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: "chevron-right", size: 18, color: colors.textSecondary })
18642
18714
  ]
18643
18715
  }
18644
18716
  ),
18645
- index < items.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.View, { style: [styles37.separator, { backgroundColor: colors.hairline }] }) : null
18717
+ index < items.length - 1 ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native48.View, { style: [styles37.separator, { backgroundColor: colors.hairline }] }) : null
18646
18718
  ] }, item.page);
18647
18719
  }) }),
18648
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18720
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18649
18721
  PCSelect,
18650
18722
  {
18651
18723
  label: t("language"),
@@ -18655,7 +18727,7 @@ var NavDrawer = ({ visible, onClose, onBack }) => {
18655
18727
  placeholder: t("language")
18656
18728
  }
18657
18729
  ),
18658
- onBack ? /* @__PURE__ */ (0, import_jsx_runtime47.jsxs)(
18730
+ onBack ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(
18659
18731
  import_react_native48.TouchableOpacity,
18660
18732
  {
18661
18733
  style: [styles37.actionButton, { borderColor: colors.border, backgroundColor: colors.surface }],
@@ -18666,7 +18738,7 @@ var NavDrawer = ({ visible, onClose, onBack }) => {
18666
18738
  activeOpacity: 0.7,
18667
18739
  accessibilityRole: "button",
18668
18740
  children: [
18669
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(
18741
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18670
18742
  Icon,
18671
18743
  {
18672
18744
  name: onBack === "signout" ? "log-out" : "arrow-left",
@@ -18674,11 +18746,11 @@ var NavDrawer = ({ visible, onClose, onBack }) => {
18674
18746
  color: onBack === "signout" ? colors.error : colors.text
18675
18747
  }
18676
18748
  ),
18677
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(import_react_native48.Text, { style: [styles37.actionLabel, { color: onBack === "signout" ? colors.error : colors.text }], children: onBack === "signout" ? t("signOut") || "Sign Out" : t("back") || "Back" })
18749
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native48.Text, { style: [styles37.actionLabel, { color: onBack === "signout" ? colors.error : colors.text }], children: onBack === "signout" ? t("signOut") || "Sign Out" : t("back") || "Back" })
18678
18750
  ]
18679
18751
  }
18680
18752
  ) : null,
18681
- /* @__PURE__ */ (0, import_jsx_runtime47.jsx)(Footer, { inline: true })
18753
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Footer, { inline: true })
18682
18754
  ] }) });
18683
18755
  };
18684
18756
  var styles37 = import_react_native48.StyleSheet.create({
@@ -18740,7 +18812,7 @@ var styles37 = import_react_native48.StyleSheet.create({
18740
18812
  });
18741
18813
 
18742
18814
  // src/RedactoPrivacyCenter/components/SlimTopBar.tsx
18743
- var import_jsx_runtime48 = require("react/jsx-runtime");
18815
+ var import_jsx_runtime49 = require("react/jsx-runtime");
18744
18816
  var SlimTopBar = ({ mode = "primary", onBack }) => {
18745
18817
  const { t } = (0, import_react_i18next19.useTranslation)();
18746
18818
  const { currentPage, navigateTo } = useInternalNavigation();
@@ -18748,10 +18820,11 @@ var SlimTopBar = ({ mode = "primary", onBack }) => {
18748
18820
  const { organizationName } = useAuth();
18749
18821
  const unreadCount = useUnreadCount();
18750
18822
  const insets = useSafeInsets();
18751
- const [menuOpen, setMenuOpen] = (0, import_react34.useState)(false);
18823
+ const [menuOpen, setMenuOpen] = (0, import_react35.useState)(false);
18824
+ const { switchProfile } = useProfileSwitch();
18752
18825
  const pageChrome = PAGE_CHROME_BY_PAGE[currentPage];
18753
18826
  const isDetail = mode === "detail";
18754
- const brandLabel = (0, import_react34.useMemo)(
18827
+ const brandLabel = (0, import_react35.useMemo)(
18755
18828
  () => (branding == null ? void 0 : branding.brand_name) || organizationName || t("privacyCenter") || "Privacy Center",
18756
18829
  [branding == null ? void 0 : branding.brand_name, organizationName, t]
18757
18830
  );
@@ -18766,16 +18839,16 @@ var SlimTopBar = ({ mode = "primary", onBack }) => {
18766
18839
  }
18767
18840
  navigateBack(onBack);
18768
18841
  };
18769
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
18770
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18842
+ return /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_jsx_runtime49.Fragment, { children: [
18843
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18771
18844
  import_react_native49.View,
18772
18845
  {
18773
18846
  style: [
18774
18847
  styles38.container,
18775
18848
  { backgroundColor: colors.canvasSubtle, borderBottomColor: colors.hairline, paddingTop: insets.top + spacing.xs }
18776
18849
  ],
18777
- children: isDetail ? /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles38.detailRow, children: [
18778
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18850
+ children: isDetail ? /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native49.View, { style: styles38.detailRow, children: [
18851
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18779
18852
  import_react_native49.TouchableOpacity,
18780
18853
  {
18781
18854
  style: styles38.iconButton,
@@ -18784,27 +18857,39 @@ var SlimTopBar = ({ mode = "primary", onBack }) => {
18784
18857
  hitSlop: DEFAULT_HIT_SLOP,
18785
18858
  accessibilityRole: "button",
18786
18859
  accessibilityLabel: t("back") || "Back",
18787
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: "arrow-left", size: 22, color: colors.text })
18860
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Icon, { name: "arrow-left", size: 22, color: colors.text })
18788
18861
  }
18789
18862
  ),
18790
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles38.detailTitle, { color: colors.text }], numberOfLines: 1, children: t((pageChrome == null ? void 0 : pageChrome.titleKey) || "privacyCenter") }),
18791
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: styles38.placeholder })
18792
- ] }) : /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles38.row, children: [
18793
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.View, { style: styles38.brandWrap, children: (branding == null ? void 0 : branding.logo_url) ? /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18863
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native49.Text, { style: [styles38.detailTitle, { color: colors.text }], numberOfLines: 1, children: t((pageChrome == null ? void 0 : pageChrome.titleKey) || "privacyCenter") }),
18864
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native49.View, { style: styles38.placeholder })
18865
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native49.View, { style: styles38.row, children: [
18866
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native49.View, { style: styles38.brandWrap, children: (branding == null ? void 0 : branding.logo_url) ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18794
18867
  BrandImage,
18795
18868
  {
18796
18869
  uri: branding.logo_url,
18797
18870
  height: 24,
18798
18871
  maxWidth: 124,
18799
- fallback: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PCAvatar, { name: brandLabel, imageUrl: branding == null ? void 0 : branding.icon_url, size: 24 })
18872
+ fallback: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PCAvatar, { name: brandLabel, imageUrl: branding == null ? void 0 : branding.icon_url, size: 24 })
18800
18873
  }
18801
- ) : /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles38.brandLockup, children: [
18802
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(PCAvatar, { name: brandLabel, imageUrl: branding == null ? void 0 : branding.icon_url, size: 24 }),
18803
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(import_react_native49.Text, { style: [styles38.brandText, { color: colors.text }], numberOfLines: 1, children: brandLabel })
18874
+ ) : /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native49.View, { style: styles38.brandLockup, children: [
18875
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PCAvatar, { name: brandLabel, imageUrl: branding == null ? void 0 : branding.icon_url, size: 24 }),
18876
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(import_react_native49.Text, { style: [styles38.brandText, { color: colors.text }], numberOfLines: 1, children: brandLabel })
18804
18877
  ] }) }),
18805
- /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react_native49.View, { style: styles38.actions, children: [
18806
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(NotificationBell, { count: unreadCount, onPress: () => navigateTo("notifications") }),
18807
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
18878
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsxs)(import_react_native49.View, { style: styles38.actions, children: [
18879
+ switchProfile ? /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18880
+ import_react_native49.TouchableOpacity,
18881
+ {
18882
+ style: styles38.iconButton,
18883
+ onPress: switchProfile,
18884
+ activeOpacity: 0.7,
18885
+ hitSlop: DEFAULT_HIT_SLOP,
18886
+ accessibilityRole: "button",
18887
+ accessibilityLabel: t("switchProfile"),
18888
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Icon, { name: "users", size: 22, color: colors.text })
18889
+ }
18890
+ ) : null,
18891
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(NotificationBell, { count: unreadCount, onPress: () => navigateTo("notifications") }),
18892
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(
18808
18893
  import_react_native49.TouchableOpacity,
18809
18894
  {
18810
18895
  style: styles38.iconButton,
@@ -18813,14 +18898,14 @@ var SlimTopBar = ({ mode = "primary", onBack }) => {
18813
18898
  hitSlop: DEFAULT_HIT_SLOP,
18814
18899
  accessibilityRole: "button",
18815
18900
  accessibilityLabel: t("menu") || "Menu",
18816
- children: /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Icon, { name: "menu", size: 22, color: colors.text })
18901
+ children: /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(Icon, { name: "menu", size: 22, color: colors.text })
18817
18902
  }
18818
18903
  )
18819
18904
  ] })
18820
18905
  ] })
18821
18906
  }
18822
18907
  ),
18823
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(NavDrawer, { visible: menuOpen, onClose: () => setMenuOpen(false), onBack })
18908
+ /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(NavDrawer, { visible: menuOpen, onClose: () => setMenuOpen(false), onBack })
18824
18909
  ] });
18825
18910
  };
18826
18911
  var styles38 = import_react_native49.StyleSheet.create({
@@ -18881,18 +18966,18 @@ var styles38 = import_react_native49.StyleSheet.create({
18881
18966
 
18882
18967
  // src/RedactoPrivacyCenter/components/PrivacyCenterEmptyState.tsx
18883
18968
  var import_react_i18next20 = require("react-i18next");
18884
- var import_jsx_runtime49 = require("react/jsx-runtime");
18969
+ var import_jsx_runtime50 = require("react/jsx-runtime");
18885
18970
  function PrivacyCenterEmptyState() {
18886
18971
  const { t } = (0, import_react_i18next20.useTranslation)();
18887
- return /* @__PURE__ */ (0, import_jsx_runtime49.jsx)(PCEmpty, { iconName: "shield", title: t("noDataTitle"), description: t("noDataDescription") });
18972
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(PCEmpty, { iconName: "shield", title: t("noDataTitle"), description: t("noDataDescription") });
18888
18973
  }
18889
18974
 
18890
18975
  // src/RedactoPrivacyCenter/components/PrivacyCenterSessionExpired.tsx
18891
18976
  var import_react_i18next21 = require("react-i18next");
18892
- var import_jsx_runtime50 = require("react/jsx-runtime");
18977
+ var import_jsx_runtime51 = require("react/jsx-runtime");
18893
18978
  function PrivacyCenterSessionExpired() {
18894
18979
  const { t } = (0, import_react_i18next21.useTranslation)();
18895
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
18980
+ return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(
18896
18981
  PCEmpty,
18897
18982
  {
18898
18983
  iconName: "shield",
@@ -18906,22 +18991,6 @@ function PrivacyCenterSessionExpired() {
18906
18991
  var import_react36 = require("react");
18907
18992
  var import_react_native51 = require("react-native");
18908
18993
 
18909
- // src/RedactoPrivacyCenter/context/ProfileSwitchContext.tsx
18910
- var import_react35 = require("react");
18911
- var import_jsx_runtime51 = require("react/jsx-runtime");
18912
- var ProfileSwitchContext = (0, import_react35.createContext)({
18913
- switchProfile: null
18914
- });
18915
- function ProfileSwitchProvider({
18916
- switchProfile,
18917
- children
18918
- }) {
18919
- return /* @__PURE__ */ (0, import_jsx_runtime51.jsx)(ProfileSwitchContext.Provider, { value: { switchProfile }, children });
18920
- }
18921
- function useProfileSwitch() {
18922
- return (0, import_react35.useContext)(ProfileSwitchContext);
18923
- }
18924
-
18925
18994
  // src/RedactoPrivacyCenter/components/SelectUser.tsx
18926
18995
  var import_react_native50 = require("react-native");
18927
18996
  var import_react_i18next22 = require("react-i18next");
@@ -21683,6 +21752,7 @@ function Navbar({ mode = "primary", onBack }) {
21683
21752
  const [menuOpen, setMenuOpen] = (0, import_react46.useState)(false);
21684
21753
  const unreadCount = useUnreadCount();
21685
21754
  const { status: pageStatus } = usePageStatus();
21755
+ const { switchProfile } = useProfileSwitch();
21686
21756
  const pageChrome = PAGE_CHROME_BY_PAGE[currentPage] || PAGE_CHROME_BY_PAGE["consent-manager"];
21687
21757
  const isDetail = mode === "detail";
21688
21758
  (0, import_react46.useEffect)(() => {
@@ -21785,6 +21855,36 @@ function Navbar({ mode = "primary", onBack }) {
21785
21855
  ) : null,
21786
21856
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_native69.View, { style: styles57.brandWrap, children: (branding == null ? void 0 : branding.logo_url) ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(BrandImage, { uri: branding.logo_url, height: 34, maxWidth: 170, fallback: brandLockup }) : brandLockup }),
21787
21857
  /* @__PURE__ */ (0, import_jsx_runtime71.jsxs)(import_react_native69.View, { style: styles57.actions, children: [
21858
+ switchProfile ? /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
21859
+ import_react_native69.TouchableOpacity,
21860
+ {
21861
+ style: styles57.iconButton,
21862
+ onPress: switchProfile,
21863
+ activeOpacity: 0.7,
21864
+ hitSlop: DEFAULT_HIT_SLOP,
21865
+ accessibilityRole: "button",
21866
+ accessibilityLabel: t("switchProfile"),
21867
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
21868
+ import_react_native69.View,
21869
+ {
21870
+ style: [
21871
+ styles57.iconCircle,
21872
+ { backgroundColor: colors.surface, borderColor: colors.border }
21873
+ ],
21874
+ children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(import_react_native_svg6.default, { width: 18, height: 18, viewBox: "0 0 24 24", fill: "none", children: /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
21875
+ import_react_native_svg6.Path,
21876
+ {
21877
+ d: "M16 3h5v5 M21 3l-7 7 M8 21H3v-5 M3 21l7-7",
21878
+ stroke: colors.text,
21879
+ strokeWidth: 2,
21880
+ strokeLinecap: "round",
21881
+ strokeLinejoin: "round"
21882
+ }
21883
+ ) })
21884
+ }
21885
+ )
21886
+ }
21887
+ ) : null,
21788
21888
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(NotificationBell, { count: unreadCount, onPress: () => navigateTo("notifications") }),
21789
21889
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(PCSelect, { value: locale, options: languageOptions, onChange: handleLanguageChange, placeholder: t("language"), compact: true }),
21790
21890
  /* @__PURE__ */ (0, import_jsx_runtime71.jsx)(
@@ -21861,6 +21961,21 @@ var styles57 = import_react_native69.StyleSheet.create({
21861
21961
  alignItems: "center",
21862
21962
  justifyContent: "center"
21863
21963
  },
21964
+ iconButton: {
21965
+ width: MIN_TAP_TARGET,
21966
+ height: MIN_TAP_TARGET,
21967
+ alignItems: "center",
21968
+ justifyContent: "center"
21969
+ },
21970
+ // Matches the Flutter navbar's 34pt bordered circle.
21971
+ iconCircle: {
21972
+ width: 34,
21973
+ height: 34,
21974
+ borderRadius: 17,
21975
+ borderWidth: 1,
21976
+ alignItems: "center",
21977
+ justifyContent: "center"
21978
+ },
21864
21979
  pageHeader: {
21865
21980
  marginTop: spacing.sm
21866
21981
  },