@redacto.io/consent-sdk-react-native 5.0.0-beta.2 → 5.0.0-beta.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-IVOOB4JK.mjs → chunk-UVRSRLYW.mjs} +10 -2
- package/dist/index.js +10 -2
- package/dist/index.mjs +1 -1
- package/dist/privacy-center.d.mts +60 -59
- package/dist/privacy-center.d.ts +60 -59
- package/dist/privacy-center.js +60 -22
- package/dist/privacy-center.mjs +54 -23
- package/package.json +1 -1
|
@@ -33,12 +33,20 @@ var languageOptions = [
|
|
|
33
33
|
];
|
|
34
34
|
var codeByLabel = new Map(languageOptions.map((o) => [o.label, o.value]));
|
|
35
35
|
var codeByLower = new Map(languageOptions.map((o) => [o.value.toLowerCase(), o.value]));
|
|
36
|
-
|
|
36
|
+
var englishName = (label) => {
|
|
37
37
|
var _a, _b;
|
|
38
|
+
return (_b = (_a = label.match(/\(([^)]+)\)\s*$/)) == null ? void 0 : _a[1]) != null ? _b : label;
|
|
39
|
+
};
|
|
40
|
+
var codeByName = new Map(
|
|
41
|
+
languageOptions.map((o) => [englishName(o.label).toLowerCase(), o.value])
|
|
42
|
+
);
|
|
43
|
+
function toLanguageCode(lang) {
|
|
44
|
+
var _a, _b, _c;
|
|
38
45
|
if (!lang) return void 0;
|
|
39
46
|
const trimmed = lang.trim();
|
|
40
47
|
if (!trimmed) return void 0;
|
|
41
|
-
|
|
48
|
+
const lower = trimmed.toLowerCase();
|
|
49
|
+
return (_c = (_b = (_a = codeByLabel.get(trimmed)) != null ? _a : codeByName.get(lower)) != null ? _b : codeByLower.get(lower)) != null ? _c : trimmed;
|
|
42
50
|
}
|
|
43
51
|
|
|
44
52
|
export {
|
package/dist/index.js
CHANGED
|
@@ -74,12 +74,20 @@ var languageOptions = [
|
|
|
74
74
|
];
|
|
75
75
|
var codeByLabel = new Map(languageOptions.map((o) => [o.label, o.value]));
|
|
76
76
|
var codeByLower = new Map(languageOptions.map((o) => [o.value.toLowerCase(), o.value]));
|
|
77
|
-
|
|
77
|
+
var englishName = (label) => {
|
|
78
78
|
var _a, _b;
|
|
79
|
+
return (_b = (_a = label.match(/\(([^)]+)\)\s*$/)) == null ? void 0 : _a[1]) != null ? _b : label;
|
|
80
|
+
};
|
|
81
|
+
var codeByName = new Map(
|
|
82
|
+
languageOptions.map((o) => [englishName(o.label).toLowerCase(), o.value])
|
|
83
|
+
);
|
|
84
|
+
function toLanguageCode(lang) {
|
|
85
|
+
var _a, _b, _c;
|
|
79
86
|
if (!lang) return void 0;
|
|
80
87
|
const trimmed = lang.trim();
|
|
81
88
|
if (!trimmed) return void 0;
|
|
82
|
-
|
|
89
|
+
const lower = trimmed.toLowerCase();
|
|
90
|
+
return (_c = (_b = (_a = codeByLabel.get(trimmed)) != null ? _a : codeByName.get(lower)) != null ? _b : codeByLower.get(lower)) != null ? _c : trimmed;
|
|
83
91
|
}
|
|
84
92
|
|
|
85
93
|
// src/RedactoNoticeConsent/api/index.ts
|
package/dist/index.mjs
CHANGED
|
@@ -5,6 +5,63 @@ import * as react_native from 'react-native';
|
|
|
5
5
|
import { StyleProp, ViewStyle, TextStyle, KeyboardTypeOptions, DimensionValue, Animated } from 'react-native';
|
|
6
6
|
import * as lucide_react_native from 'lucide-react-native';
|
|
7
7
|
|
|
8
|
+
interface ThemeColors {
|
|
9
|
+
background: string;
|
|
10
|
+
/** Page canvas. Flat mode keeps this equal to background. */
|
|
11
|
+
canvas: string;
|
|
12
|
+
surface: string;
|
|
13
|
+
text: string;
|
|
14
|
+
textSecondary: string;
|
|
15
|
+
border: string;
|
|
16
|
+
primary: string;
|
|
17
|
+
primaryText: string;
|
|
18
|
+
error: string;
|
|
19
|
+
success: string;
|
|
20
|
+
warning: string;
|
|
21
|
+
/** Hyperlink / accent text color. Falls back to primary. */
|
|
22
|
+
link: string;
|
|
23
|
+
/** Secondary brand color. Falls back to primary. */
|
|
24
|
+
secondary: string;
|
|
25
|
+
/** Quiet gray app background that cards sit on. */
|
|
26
|
+
canvasSubtle: string;
|
|
27
|
+
/** Secondary surface fill — inset rows, pressed states, skeletons. */
|
|
28
|
+
surfaceAlt: string;
|
|
29
|
+
/** Separator lighter than `border` (used inside cards). */
|
|
30
|
+
hairline: string;
|
|
31
|
+
/** Soft tint of `primary` for icon tiles / active pills. */
|
|
32
|
+
primarySoft: string;
|
|
33
|
+
/** Foreground (icon/label) color used on `primarySoft`. */
|
|
34
|
+
primaryOn: string;
|
|
35
|
+
/** Informational accent (badges / info states). */
|
|
36
|
+
info: string;
|
|
37
|
+
/** Soft status tints for badges, empty states, and icon tiles. */
|
|
38
|
+
successSoft: string;
|
|
39
|
+
warningSoft: string;
|
|
40
|
+
errorSoft: string;
|
|
41
|
+
infoSoft: string;
|
|
42
|
+
/** Scrim behind modals / bottom sheets. */
|
|
43
|
+
overlay: string;
|
|
44
|
+
}
|
|
45
|
+
type BrandingMeta = {
|
|
46
|
+
logo_url: string | null;
|
|
47
|
+
icon_url: string | null;
|
|
48
|
+
brand_name: string;
|
|
49
|
+
hide_platform_branding: boolean;
|
|
50
|
+
};
|
|
51
|
+
interface ThemeContextType {
|
|
52
|
+
colors: ThemeColors;
|
|
53
|
+
/** Org branding metadata (logo, brand name). Null until/unless it resolves. */
|
|
54
|
+
branding: BrandingMeta | null;
|
|
55
|
+
/** True while org branding is being fetched (used to gate first paint). */
|
|
56
|
+
isLoading: boolean;
|
|
57
|
+
}
|
|
58
|
+
declare function ThemeProvider({ children, slug, baseUrl, }: {
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
slug?: string;
|
|
61
|
+
baseUrl?: string;
|
|
62
|
+
}): React.JSX.Element;
|
|
63
|
+
declare function useTheme(): ThemeContextType;
|
|
64
|
+
|
|
8
65
|
type Workspace = {
|
|
9
66
|
uuid: string;
|
|
10
67
|
suid: string;
|
|
@@ -636,7 +693,7 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
|
636
693
|
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], noticeUuid?: string, dataElements?: Array<{
|
|
637
694
|
uuid: string;
|
|
638
695
|
selected: boolean;
|
|
639
|
-
}
|
|
696
|
+
}>, language?: string): Promise<unknown>;
|
|
640
697
|
/**
|
|
641
698
|
* Get activities (privacy center)
|
|
642
699
|
*/
|
|
@@ -772,7 +829,7 @@ type FetchUserConsentsParams = {
|
|
|
772
829
|
consentClient?: BaseUrlContextValue['consentClient'];
|
|
773
830
|
};
|
|
774
831
|
declare const fetchUserConsents: (params: FetchUserConsentsParams) => Promise<UserConsentDetail | null>;
|
|
775
|
-
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, }: {
|
|
832
|
+
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, language, }: {
|
|
776
833
|
organizationId: string;
|
|
777
834
|
workspaceId: string;
|
|
778
835
|
purposeId: string;
|
|
@@ -787,6 +844,7 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
|
|
|
787
844
|
uuid: string;
|
|
788
845
|
selected: boolean;
|
|
789
846
|
}>;
|
|
847
|
+
language?: string;
|
|
790
848
|
}) => Promise<boolean | null>;
|
|
791
849
|
declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
|
|
792
850
|
declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
|
|
@@ -817,63 +875,6 @@ interface AuthProviderProps {
|
|
|
817
875
|
declare function AuthProvider({ children, accessToken: initialAccessToken, refreshToken: initialRefreshToken, onError }: AuthProviderProps): React.JSX.Element;
|
|
818
876
|
declare function useAuth(): AuthContextType;
|
|
819
877
|
|
|
820
|
-
interface ThemeColors {
|
|
821
|
-
background: string;
|
|
822
|
-
/** Page canvas. Flat mode keeps this equal to background. */
|
|
823
|
-
canvas: string;
|
|
824
|
-
surface: string;
|
|
825
|
-
text: string;
|
|
826
|
-
textSecondary: string;
|
|
827
|
-
border: string;
|
|
828
|
-
primary: string;
|
|
829
|
-
primaryText: string;
|
|
830
|
-
error: string;
|
|
831
|
-
success: string;
|
|
832
|
-
warning: string;
|
|
833
|
-
/** Hyperlink / accent text color. Falls back to primary. */
|
|
834
|
-
link: string;
|
|
835
|
-
/** Secondary brand color. Falls back to primary. */
|
|
836
|
-
secondary: string;
|
|
837
|
-
/** Quiet gray app background that cards sit on. */
|
|
838
|
-
canvasSubtle: string;
|
|
839
|
-
/** Secondary surface fill — inset rows, pressed states, skeletons. */
|
|
840
|
-
surfaceAlt: string;
|
|
841
|
-
/** Separator lighter than `border` (used inside cards). */
|
|
842
|
-
hairline: string;
|
|
843
|
-
/** Soft tint of `primary` for icon tiles / active pills. */
|
|
844
|
-
primarySoft: string;
|
|
845
|
-
/** Foreground (icon/label) color used on `primarySoft`. */
|
|
846
|
-
primaryOn: string;
|
|
847
|
-
/** Informational accent (badges / info states). */
|
|
848
|
-
info: string;
|
|
849
|
-
/** Soft status tints for badges, empty states, and icon tiles. */
|
|
850
|
-
successSoft: string;
|
|
851
|
-
warningSoft: string;
|
|
852
|
-
errorSoft: string;
|
|
853
|
-
infoSoft: string;
|
|
854
|
-
/** Scrim behind modals / bottom sheets. */
|
|
855
|
-
overlay: string;
|
|
856
|
-
}
|
|
857
|
-
type BrandingMeta = {
|
|
858
|
-
logo_url: string | null;
|
|
859
|
-
icon_url: string | null;
|
|
860
|
-
brand_name: string;
|
|
861
|
-
hide_platform_branding: boolean;
|
|
862
|
-
};
|
|
863
|
-
interface ThemeContextType {
|
|
864
|
-
colors: ThemeColors;
|
|
865
|
-
/** Org branding metadata (logo, brand name). Null until/unless it resolves. */
|
|
866
|
-
branding: BrandingMeta | null;
|
|
867
|
-
/** True while org branding is being fetched (used to gate first paint). */
|
|
868
|
-
isLoading: boolean;
|
|
869
|
-
}
|
|
870
|
-
declare function ThemeProvider({ children, slug, baseUrl, }: {
|
|
871
|
-
children: ReactNode;
|
|
872
|
-
slug?: string;
|
|
873
|
-
baseUrl?: string;
|
|
874
|
-
}): React.JSX.Element;
|
|
875
|
-
declare function useTheme(): ThemeContextType;
|
|
876
|
-
|
|
877
878
|
/**
|
|
878
879
|
* Curated icon registry. The whole Privacy Center draws icons through this one
|
|
879
880
|
* component so sizing, stroke weight and color stay consistent and the icon
|
package/dist/privacy-center.d.ts
CHANGED
|
@@ -5,6 +5,63 @@ import * as react_native from 'react-native';
|
|
|
5
5
|
import { StyleProp, ViewStyle, TextStyle, KeyboardTypeOptions, DimensionValue, Animated } from 'react-native';
|
|
6
6
|
import * as lucide_react_native from 'lucide-react-native';
|
|
7
7
|
|
|
8
|
+
interface ThemeColors {
|
|
9
|
+
background: string;
|
|
10
|
+
/** Page canvas. Flat mode keeps this equal to background. */
|
|
11
|
+
canvas: string;
|
|
12
|
+
surface: string;
|
|
13
|
+
text: string;
|
|
14
|
+
textSecondary: string;
|
|
15
|
+
border: string;
|
|
16
|
+
primary: string;
|
|
17
|
+
primaryText: string;
|
|
18
|
+
error: string;
|
|
19
|
+
success: string;
|
|
20
|
+
warning: string;
|
|
21
|
+
/** Hyperlink / accent text color. Falls back to primary. */
|
|
22
|
+
link: string;
|
|
23
|
+
/** Secondary brand color. Falls back to primary. */
|
|
24
|
+
secondary: string;
|
|
25
|
+
/** Quiet gray app background that cards sit on. */
|
|
26
|
+
canvasSubtle: string;
|
|
27
|
+
/** Secondary surface fill — inset rows, pressed states, skeletons. */
|
|
28
|
+
surfaceAlt: string;
|
|
29
|
+
/** Separator lighter than `border` (used inside cards). */
|
|
30
|
+
hairline: string;
|
|
31
|
+
/** Soft tint of `primary` for icon tiles / active pills. */
|
|
32
|
+
primarySoft: string;
|
|
33
|
+
/** Foreground (icon/label) color used on `primarySoft`. */
|
|
34
|
+
primaryOn: string;
|
|
35
|
+
/** Informational accent (badges / info states). */
|
|
36
|
+
info: string;
|
|
37
|
+
/** Soft status tints for badges, empty states, and icon tiles. */
|
|
38
|
+
successSoft: string;
|
|
39
|
+
warningSoft: string;
|
|
40
|
+
errorSoft: string;
|
|
41
|
+
infoSoft: string;
|
|
42
|
+
/** Scrim behind modals / bottom sheets. */
|
|
43
|
+
overlay: string;
|
|
44
|
+
}
|
|
45
|
+
type BrandingMeta = {
|
|
46
|
+
logo_url: string | null;
|
|
47
|
+
icon_url: string | null;
|
|
48
|
+
brand_name: string;
|
|
49
|
+
hide_platform_branding: boolean;
|
|
50
|
+
};
|
|
51
|
+
interface ThemeContextType {
|
|
52
|
+
colors: ThemeColors;
|
|
53
|
+
/** Org branding metadata (logo, brand name). Null until/unless it resolves. */
|
|
54
|
+
branding: BrandingMeta | null;
|
|
55
|
+
/** True while org branding is being fetched (used to gate first paint). */
|
|
56
|
+
isLoading: boolean;
|
|
57
|
+
}
|
|
58
|
+
declare function ThemeProvider({ children, slug, baseUrl, }: {
|
|
59
|
+
children: ReactNode;
|
|
60
|
+
slug?: string;
|
|
61
|
+
baseUrl?: string;
|
|
62
|
+
}): React.JSX.Element;
|
|
63
|
+
declare function useTheme(): ThemeContextType;
|
|
64
|
+
|
|
8
65
|
type Workspace = {
|
|
9
66
|
uuid: string;
|
|
10
67
|
suid: string;
|
|
@@ -636,7 +693,7 @@ declare function createConsentClient(baseUrl: string, ledgerBaseUrl?: string): {
|
|
|
636
693
|
manageConsent(baseRequest: BaseRequest, purposeId: string, contact: string, status: "revoke" | "regrant" | "renew", authToken?: string, options?: Omit<ApiFetchOptions, "getAuthToken">, nominatorContact?: string, dataElementUuids?: string[], noticeUuid?: string, dataElements?: Array<{
|
|
637
694
|
uuid: string;
|
|
638
695
|
selected: boolean;
|
|
639
|
-
}
|
|
696
|
+
}>, language?: string): Promise<unknown>;
|
|
640
697
|
/**
|
|
641
698
|
* Get activities (privacy center)
|
|
642
699
|
*/
|
|
@@ -772,7 +829,7 @@ type FetchUserConsentsParams = {
|
|
|
772
829
|
consentClient?: BaseUrlContextValue['consentClient'];
|
|
773
830
|
};
|
|
774
831
|
declare const fetchUserConsents: (params: FetchUserConsentsParams) => Promise<UserConsentDetail | null>;
|
|
775
|
-
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, }: {
|
|
832
|
+
declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact, action, authContext, consentClient, nominatorContact, dataElementUuids, noticeUuid, dataElements, language, }: {
|
|
776
833
|
organizationId: string;
|
|
777
834
|
workspaceId: string;
|
|
778
835
|
purposeId: string;
|
|
@@ -787,6 +844,7 @@ declare const manageConsent: ({ organizationId, workspaceId, purposeId, contact,
|
|
|
787
844
|
uuid: string;
|
|
788
845
|
selected: boolean;
|
|
789
846
|
}>;
|
|
847
|
+
language?: string;
|
|
790
848
|
}) => Promise<boolean | null>;
|
|
791
849
|
declare const fetchActivities: (organizationId: string, workspaceId: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<ActivityDetail | null>;
|
|
792
850
|
declare const fetchCaseHistory: (organizationId: string, workspaceId: string, contact: string, offset?: number, limit?: number, authContext?: AuthContext, consentClient?: BaseUrlContextValue["consentClient"], language?: string) => Promise<CaseHistoryDetail | null>;
|
|
@@ -817,63 +875,6 @@ interface AuthProviderProps {
|
|
|
817
875
|
declare function AuthProvider({ children, accessToken: initialAccessToken, refreshToken: initialRefreshToken, onError }: AuthProviderProps): React.JSX.Element;
|
|
818
876
|
declare function useAuth(): AuthContextType;
|
|
819
877
|
|
|
820
|
-
interface ThemeColors {
|
|
821
|
-
background: string;
|
|
822
|
-
/** Page canvas. Flat mode keeps this equal to background. */
|
|
823
|
-
canvas: string;
|
|
824
|
-
surface: string;
|
|
825
|
-
text: string;
|
|
826
|
-
textSecondary: string;
|
|
827
|
-
border: string;
|
|
828
|
-
primary: string;
|
|
829
|
-
primaryText: string;
|
|
830
|
-
error: string;
|
|
831
|
-
success: string;
|
|
832
|
-
warning: string;
|
|
833
|
-
/** Hyperlink / accent text color. Falls back to primary. */
|
|
834
|
-
link: string;
|
|
835
|
-
/** Secondary brand color. Falls back to primary. */
|
|
836
|
-
secondary: string;
|
|
837
|
-
/** Quiet gray app background that cards sit on. */
|
|
838
|
-
canvasSubtle: string;
|
|
839
|
-
/** Secondary surface fill — inset rows, pressed states, skeletons. */
|
|
840
|
-
surfaceAlt: string;
|
|
841
|
-
/** Separator lighter than `border` (used inside cards). */
|
|
842
|
-
hairline: string;
|
|
843
|
-
/** Soft tint of `primary` for icon tiles / active pills. */
|
|
844
|
-
primarySoft: string;
|
|
845
|
-
/** Foreground (icon/label) color used on `primarySoft`. */
|
|
846
|
-
primaryOn: string;
|
|
847
|
-
/** Informational accent (badges / info states). */
|
|
848
|
-
info: string;
|
|
849
|
-
/** Soft status tints for badges, empty states, and icon tiles. */
|
|
850
|
-
successSoft: string;
|
|
851
|
-
warningSoft: string;
|
|
852
|
-
errorSoft: string;
|
|
853
|
-
infoSoft: string;
|
|
854
|
-
/** Scrim behind modals / bottom sheets. */
|
|
855
|
-
overlay: string;
|
|
856
|
-
}
|
|
857
|
-
type BrandingMeta = {
|
|
858
|
-
logo_url: string | null;
|
|
859
|
-
icon_url: string | null;
|
|
860
|
-
brand_name: string;
|
|
861
|
-
hide_platform_branding: boolean;
|
|
862
|
-
};
|
|
863
|
-
interface ThemeContextType {
|
|
864
|
-
colors: ThemeColors;
|
|
865
|
-
/** Org branding metadata (logo, brand name). Null until/unless it resolves. */
|
|
866
|
-
branding: BrandingMeta | null;
|
|
867
|
-
/** True while org branding is being fetched (used to gate first paint). */
|
|
868
|
-
isLoading: boolean;
|
|
869
|
-
}
|
|
870
|
-
declare function ThemeProvider({ children, slug, baseUrl, }: {
|
|
871
|
-
children: ReactNode;
|
|
872
|
-
slug?: string;
|
|
873
|
-
baseUrl?: string;
|
|
874
|
-
}): React.JSX.Element;
|
|
875
|
-
declare function useTheme(): ThemeContextType;
|
|
876
|
-
|
|
877
878
|
/**
|
|
878
879
|
* Curated icon registry. The whole Privacy Center draws icons through this one
|
|
879
880
|
* component so sizing, stroke weight and color stay consistent and the icon
|
package/dist/privacy-center.js
CHANGED
|
@@ -10235,7 +10235,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10235
10235
|
* Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
|
|
10236
10236
|
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
10237
10237
|
*/
|
|
10238
|
-
async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements) {
|
|
10238
|
+
async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements, language) {
|
|
10239
10239
|
if (!useLedger) {
|
|
10240
10240
|
const url2 = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/manage-consent?status=${status}`;
|
|
10241
10241
|
const body2 = { purpose_uuid: purposeId, contact };
|
|
@@ -10245,6 +10245,9 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10245
10245
|
if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
|
|
10246
10246
|
body2.data_element_uuids = dataElementUuids;
|
|
10247
10247
|
}
|
|
10248
|
+
if (language) {
|
|
10249
|
+
body2.language = language;
|
|
10250
|
+
}
|
|
10248
10251
|
return privacyCenterApiFetch(url2, {
|
|
10249
10252
|
...options,
|
|
10250
10253
|
method: "POST",
|
|
@@ -10279,7 +10282,8 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10279
10282
|
selected: purposeSelected,
|
|
10280
10283
|
data_elements: elements
|
|
10281
10284
|
}
|
|
10282
|
-
]
|
|
10285
|
+
],
|
|
10286
|
+
...language ? { language } : {}
|
|
10283
10287
|
};
|
|
10284
10288
|
const url = ledgerUrl(baseRequest, "/submit-consent");
|
|
10285
10289
|
return privacyCenterApiFetch(url, {
|
|
@@ -10719,7 +10723,8 @@ async function manageConsentServer(params) {
|
|
|
10719
10723
|
params.nominatorContact,
|
|
10720
10724
|
params.dataElementUuids,
|
|
10721
10725
|
params.noticeUuid,
|
|
10722
|
-
params.dataElements
|
|
10726
|
+
params.dataElements,
|
|
10727
|
+
params.language
|
|
10723
10728
|
);
|
|
10724
10729
|
if (result && typeof result === "object" && "success" in result) {
|
|
10725
10730
|
return Boolean(result.success);
|
|
@@ -11210,7 +11215,8 @@ var manageConsent = async ({
|
|
|
11210
11215
|
nominatorContact,
|
|
11211
11216
|
dataElementUuids,
|
|
11212
11217
|
noticeUuid,
|
|
11213
|
-
dataElements
|
|
11218
|
+
dataElements,
|
|
11219
|
+
language
|
|
11214
11220
|
}) => {
|
|
11215
11221
|
try {
|
|
11216
11222
|
const accessToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
|
|
@@ -11228,7 +11234,8 @@ var manageConsent = async ({
|
|
|
11228
11234
|
nominatorContact,
|
|
11229
11235
|
dataElementUuids,
|
|
11230
11236
|
noticeUuid,
|
|
11231
|
-
dataElements
|
|
11237
|
+
dataElements,
|
|
11238
|
+
language
|
|
11232
11239
|
});
|
|
11233
11240
|
return result;
|
|
11234
11241
|
} catch (error) {
|
|
@@ -14240,6 +14247,13 @@ var languageOptions = [
|
|
|
14240
14247
|
];
|
|
14241
14248
|
var codeByLabel = new Map(languageOptions.map((o) => [o.label, o.value]));
|
|
14242
14249
|
var codeByLower = new Map(languageOptions.map((o) => [o.value.toLowerCase(), o.value]));
|
|
14250
|
+
var englishName = (label) => {
|
|
14251
|
+
var _a3, _b;
|
|
14252
|
+
return (_b = (_a3 = label.match(/\(([^)]+)\)\s*$/)) == null ? void 0 : _a3[1]) != null ? _b : label;
|
|
14253
|
+
};
|
|
14254
|
+
var codeByName = new Map(
|
|
14255
|
+
languageOptions.map((o) => [englishName(o.label).toLowerCase(), o.value])
|
|
14256
|
+
);
|
|
14243
14257
|
|
|
14244
14258
|
// src/RedactoPrivacyCenter/lib/constants.ts
|
|
14245
14259
|
var PAGE_CHROME_BY_PAGE = {
|
|
@@ -15094,7 +15108,8 @@ function ConsentManager() {
|
|
|
15094
15108
|
dataElements: (_b = selectedRecord == null ? void 0 : selectedRecord.data_elements) == null ? void 0 : _b.map((de) => ({
|
|
15095
15109
|
uuid: de.uuid,
|
|
15096
15110
|
selected: de.selected
|
|
15097
|
-
}))
|
|
15111
|
+
})),
|
|
15112
|
+
language: langParam
|
|
15098
15113
|
});
|
|
15099
15114
|
setIsModalOpen(false);
|
|
15100
15115
|
setSelectedRecord(null);
|
|
@@ -15106,7 +15121,7 @@ function ConsentManager() {
|
|
|
15106
15121
|
setIsManageLoading(false);
|
|
15107
15122
|
}
|
|
15108
15123
|
},
|
|
15109
|
-
[organizationId, workspaceId, email, authContext, consentClient, selectedRecord, fetchData, t]
|
|
15124
|
+
[organizationId, workspaceId, email, authContext, consentClient, selectedRecord, langParam, fetchData, t]
|
|
15110
15125
|
);
|
|
15111
15126
|
const handleExport = (0, import_react25.useCallback)(async () => {
|
|
15112
15127
|
if (!consentData.length) return;
|
|
@@ -15469,6 +15484,7 @@ function ActivitiesList() {
|
|
|
15469
15484
|
() => ({ accessToken, refreshToken, onError, updateTokens }),
|
|
15470
15485
|
[accessToken, refreshToken, onError, updateTokens]
|
|
15471
15486
|
);
|
|
15487
|
+
const { langParam } = useCurrentLanguage();
|
|
15472
15488
|
const [activities, setActivities] = (0, import_react26.useState)([]);
|
|
15473
15489
|
const [totalCount, setTotalCount] = (0, import_react26.useState)(0);
|
|
15474
15490
|
const [isLoading, setIsLoading] = (0, import_react26.useState)(true);
|
|
@@ -15480,7 +15496,7 @@ function ActivitiesList() {
|
|
|
15480
15496
|
var _a3, _b, _c;
|
|
15481
15497
|
if (!organizationId || !workspaceId) return;
|
|
15482
15498
|
try {
|
|
15483
|
-
const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient);
|
|
15499
|
+
const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient, langParam);
|
|
15484
15500
|
if (!response) return;
|
|
15485
15501
|
const rows = (_a3 = response.data) != null ? _a3 : [];
|
|
15486
15502
|
setActivities((prev) => append ? [...prev, ...rows] : rows);
|
|
@@ -15491,7 +15507,7 @@ function ActivitiesList() {
|
|
|
15491
15507
|
if (!append) setActivities([]);
|
|
15492
15508
|
}
|
|
15493
15509
|
},
|
|
15494
|
-
[organizationId, workspaceId, authContext, consentClient]
|
|
15510
|
+
[organizationId, workspaceId, authContext, consentClient, langParam]
|
|
15495
15511
|
);
|
|
15496
15512
|
(0, import_react26.useEffect)(() => {
|
|
15497
15513
|
setIsLoading(true);
|
|
@@ -15621,10 +15637,10 @@ var import_react_i18next14 = require("react-i18next");
|
|
|
15621
15637
|
// src/RedactoPrivacyCenter/lib/dateGroup.ts
|
|
15622
15638
|
var import_react27 = require("react");
|
|
15623
15639
|
var import_react_i18next13 = require("react-i18next");
|
|
15624
|
-
function monthKey(ts) {
|
|
15640
|
+
function monthKey(ts, locale) {
|
|
15625
15641
|
if (!ts) return "";
|
|
15626
15642
|
try {
|
|
15627
|
-
return new Date(ts).toLocaleDateString(void 0, { month: "long", year: "numeric" });
|
|
15643
|
+
return new Date(ts).toLocaleDateString(locale || void 0, { month: "long", year: "numeric" });
|
|
15628
15644
|
} catch {
|
|
15629
15645
|
return "";
|
|
15630
15646
|
}
|
|
@@ -15700,7 +15716,7 @@ function groupByTime(items, getTs, classify) {
|
|
|
15700
15716
|
);
|
|
15701
15717
|
}
|
|
15702
15718
|
function useRelativeDate() {
|
|
15703
|
-
const { t } = (0, import_react_i18next13.useTranslation)();
|
|
15719
|
+
const { t, i18n: i18n2 } = (0, import_react_i18next13.useTranslation)();
|
|
15704
15720
|
return (0, import_react27.useCallback)(
|
|
15705
15721
|
(ts) => {
|
|
15706
15722
|
if (!ts) return "";
|
|
@@ -15713,7 +15729,7 @@ function useRelativeDate() {
|
|
|
15713
15729
|
if (dayDiff <= 0) return t("today", { defaultValue: "Today" });
|
|
15714
15730
|
if (dayDiff === 1) return t("yesterday", { defaultValue: "Yesterday" });
|
|
15715
15731
|
if (dayDiff < 7) return t("daysAgo", { count: dayDiff, defaultValue: "{{count}} days ago" });
|
|
15716
|
-
return d.toLocaleDateString(void 0, {
|
|
15732
|
+
return d.toLocaleDateString(i18n2.language || void 0, {
|
|
15717
15733
|
month: "short",
|
|
15718
15734
|
day: "numeric",
|
|
15719
15735
|
...d.getFullYear() !== now.getFullYear() ? { year: "numeric" } : {}
|
|
@@ -15722,10 +15738,28 @@ function useRelativeDate() {
|
|
|
15722
15738
|
return ts;
|
|
15723
15739
|
}
|
|
15724
15740
|
},
|
|
15725
|
-
[t]
|
|
15741
|
+
[t, i18n2.language]
|
|
15726
15742
|
);
|
|
15727
15743
|
}
|
|
15728
15744
|
|
|
15745
|
+
// src/RedactoPrivacyCenter/lib/receiptEvent.ts
|
|
15746
|
+
function eventLabelKey(eventType) {
|
|
15747
|
+
const v = String(eventType || "").toUpperCase();
|
|
15748
|
+
if (v.includes("GRANT")) {
|
|
15749
|
+
return "consentGranted";
|
|
15750
|
+
}
|
|
15751
|
+
if (v.includes("WITHDRAW") || v.includes("REVOK")) {
|
|
15752
|
+
return "consentRevoked";
|
|
15753
|
+
}
|
|
15754
|
+
if (v.includes("DECLIN")) {
|
|
15755
|
+
return "consentDeclined";
|
|
15756
|
+
}
|
|
15757
|
+
if (v.includes("EXPIR")) {
|
|
15758
|
+
return "consentExpired";
|
|
15759
|
+
}
|
|
15760
|
+
return void 0;
|
|
15761
|
+
}
|
|
15762
|
+
|
|
15729
15763
|
// src/RedactoPrivacyCenter/components/ReceiptsList.tsx
|
|
15730
15764
|
var import_jsx_runtime41 = require("react/jsx-runtime");
|
|
15731
15765
|
var PAGE_SIZE2 = 10;
|
|
@@ -15761,11 +15795,10 @@ function receiptBadgeStatus(eventType) {
|
|
|
15761
15795
|
if (v.includes("EXPIR")) return "warning";
|
|
15762
15796
|
return "secondary";
|
|
15763
15797
|
}
|
|
15764
|
-
var ReceiptRow = import_react28.default.memo(({ item, colors, downloading, onDownload, downloadLabel, dateLabel }) => {
|
|
15798
|
+
var ReceiptRow = import_react28.default.memo(({ item, colors, downloading, onDownload, downloadLabel, dateLabel, eventLabel }) => {
|
|
15765
15799
|
const product = item.product_name_display || item.product_name || "";
|
|
15766
|
-
const
|
|
15767
|
-
const
|
|
15768
|
-
const badgeLabel = event || "-";
|
|
15800
|
+
const primary = product || eventLabel || "-";
|
|
15801
|
+
const badgeLabel = eventLabel || "-";
|
|
15769
15802
|
return /* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native41.View, { style: styles31.row, children: [
|
|
15770
15803
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsx)(NameAvatar, { name: primary, seed: item.uuid || primary, size: "sm" }),
|
|
15771
15804
|
/* @__PURE__ */ (0, import_jsx_runtime41.jsxs)(import_react_native41.View, { style: styles31.body, children: [
|
|
@@ -15792,7 +15825,7 @@ var ReceiptRow = import_react28.default.memo(({ item, colors, downloading, onDow
|
|
|
15792
15825
|
});
|
|
15793
15826
|
ReceiptRow.displayName = "ReceiptRow";
|
|
15794
15827
|
function ReceiptsList() {
|
|
15795
|
-
const { t } = (0, import_react_i18next14.useTranslation)();
|
|
15828
|
+
const { t, i18n: i18n2 } = (0, import_react_i18next14.useTranslation)();
|
|
15796
15829
|
const { accessToken, refreshToken, organizationId, workspaceId, updateTokens, onError } = useAuth();
|
|
15797
15830
|
const { consentClient } = useBaseUrl();
|
|
15798
15831
|
const { colors } = useTheme();
|
|
@@ -15877,14 +15910,18 @@ function ReceiptsList() {
|
|
|
15877
15910
|
const sections = (0, import_react28.useMemo)(() => {
|
|
15878
15911
|
const map = /* @__PURE__ */ new Map();
|
|
15879
15912
|
for (const r of receipts) {
|
|
15880
|
-
const key = monthKey(r.created_at);
|
|
15913
|
+
const key = monthKey(r.created_at, i18n2.language);
|
|
15881
15914
|
const arr = map.get(key);
|
|
15882
15915
|
if (arr) arr.push(r);
|
|
15883
15916
|
else map.set(key, [r]);
|
|
15884
15917
|
}
|
|
15885
15918
|
return Array.from(map, ([title, data]) => ({ title, data }));
|
|
15886
|
-
}, [receipts]);
|
|
15919
|
+
}, [receipts, i18n2.language]);
|
|
15887
15920
|
const downloadLabel = t("download") || "Download";
|
|
15921
|
+
const eventLabelFor = (r) => {
|
|
15922
|
+
const key = eventLabelKey(r.event_type);
|
|
15923
|
+
return key ? t(key) : r.event_type_display || r.event_type || "-";
|
|
15924
|
+
};
|
|
15888
15925
|
const handleScroll = (0, import_react28.useCallback)(
|
|
15889
15926
|
(e) => {
|
|
15890
15927
|
const { layoutMeasurement, contentOffset, contentSize } = e.nativeEvent;
|
|
@@ -15966,7 +16003,8 @@ function ReceiptsList() {
|
|
|
15966
16003
|
downloading: downloadingUuid === item.uuid,
|
|
15967
16004
|
onDownload: handleDownload,
|
|
15968
16005
|
downloadLabel,
|
|
15969
|
-
dateLabel: relativeLabel(item.created_at)
|
|
16006
|
+
dateLabel: relativeLabel(item.created_at),
|
|
16007
|
+
eventLabel: eventLabelFor(item)
|
|
15970
16008
|
}
|
|
15971
16009
|
)
|
|
15972
16010
|
] }, `${item.uuid || item.created_at}-${index}`)) }, section2.title)),
|
package/dist/privacy-center.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
__require,
|
|
3
3
|
languageOptions
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-UVRSRLYW.mjs";
|
|
5
5
|
|
|
6
6
|
// src/RedactoPrivacyCenter/RedactoPrivacyCenter.tsx
|
|
7
7
|
import { useEffect as useEffect20 } from "react";
|
|
@@ -10122,7 +10122,7 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10122
10122
|
* Without a ledger, the legacy Python `/manage-consent?status=` endpoint is
|
|
10123
10123
|
* used with its `{ purpose_uuid, contact, ... }` payload.
|
|
10124
10124
|
*/
|
|
10125
|
-
async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements) {
|
|
10125
|
+
async manageConsent(baseRequest, purposeId, contact, status, authToken, options, nominatorContact, dataElementUuids, noticeUuid, dataElements, language) {
|
|
10126
10126
|
if (!useLedger) {
|
|
10127
10127
|
const url2 = `${baseUrl}/organisations/${baseRequest.organisationUuid}/workspaces/${baseRequest.workspaceUuid}/dsar/privacy-center/manage-consent?status=${status}`;
|
|
10128
10128
|
const body2 = { purpose_uuid: purposeId, contact };
|
|
@@ -10132,6 +10132,9 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10132
10132
|
if (Array.isArray(dataElementUuids) && dataElementUuids.length > 0) {
|
|
10133
10133
|
body2.data_element_uuids = dataElementUuids;
|
|
10134
10134
|
}
|
|
10135
|
+
if (language) {
|
|
10136
|
+
body2.language = language;
|
|
10137
|
+
}
|
|
10135
10138
|
return privacyCenterApiFetch(url2, {
|
|
10136
10139
|
...options,
|
|
10137
10140
|
method: "POST",
|
|
@@ -10166,7 +10169,8 @@ function createConsentClient(baseUrl, ledgerBaseUrl) {
|
|
|
10166
10169
|
selected: purposeSelected,
|
|
10167
10170
|
data_elements: elements
|
|
10168
10171
|
}
|
|
10169
|
-
]
|
|
10172
|
+
],
|
|
10173
|
+
...language ? { language } : {}
|
|
10170
10174
|
};
|
|
10171
10175
|
const url = ledgerUrl(baseRequest, "/submit-consent");
|
|
10172
10176
|
return privacyCenterApiFetch(url, {
|
|
@@ -10606,7 +10610,8 @@ async function manageConsentServer(params) {
|
|
|
10606
10610
|
params.nominatorContact,
|
|
10607
10611
|
params.dataElementUuids,
|
|
10608
10612
|
params.noticeUuid,
|
|
10609
|
-
params.dataElements
|
|
10613
|
+
params.dataElements,
|
|
10614
|
+
params.language
|
|
10610
10615
|
);
|
|
10611
10616
|
if (result && typeof result === "object" && "success" in result) {
|
|
10612
10617
|
return Boolean(result.success);
|
|
@@ -11097,7 +11102,8 @@ var manageConsent = async ({
|
|
|
11097
11102
|
nominatorContact,
|
|
11098
11103
|
dataElementUuids,
|
|
11099
11104
|
noticeUuid,
|
|
11100
|
-
dataElements
|
|
11105
|
+
dataElements,
|
|
11106
|
+
language
|
|
11101
11107
|
}) => {
|
|
11102
11108
|
try {
|
|
11103
11109
|
const accessToken = await ensureValidToken(organizationId, workspaceId, void 0, authContext, consentClient);
|
|
@@ -11115,7 +11121,8 @@ var manageConsent = async ({
|
|
|
11115
11121
|
nominatorContact,
|
|
11116
11122
|
dataElementUuids,
|
|
11117
11123
|
noticeUuid,
|
|
11118
|
-
dataElements
|
|
11124
|
+
dataElements,
|
|
11125
|
+
language
|
|
11119
11126
|
});
|
|
11120
11127
|
return result;
|
|
11121
11128
|
} catch (error) {
|
|
@@ -15081,7 +15088,8 @@ function ConsentManager() {
|
|
|
15081
15088
|
dataElements: (_b = selectedRecord == null ? void 0 : selectedRecord.data_elements) == null ? void 0 : _b.map((de) => ({
|
|
15082
15089
|
uuid: de.uuid,
|
|
15083
15090
|
selected: de.selected
|
|
15084
|
-
}))
|
|
15091
|
+
})),
|
|
15092
|
+
language: langParam
|
|
15085
15093
|
});
|
|
15086
15094
|
setIsModalOpen(false);
|
|
15087
15095
|
setSelectedRecord(null);
|
|
@@ -15093,7 +15101,7 @@ function ConsentManager() {
|
|
|
15093
15101
|
setIsManageLoading(false);
|
|
15094
15102
|
}
|
|
15095
15103
|
},
|
|
15096
|
-
[organizationId, workspaceId, email, authContext, consentClient, selectedRecord, fetchData, t]
|
|
15104
|
+
[organizationId, workspaceId, email, authContext, consentClient, selectedRecord, langParam, fetchData, t]
|
|
15097
15105
|
);
|
|
15098
15106
|
const handleExport = useCallback6(async () => {
|
|
15099
15107
|
if (!consentData.length) return;
|
|
@@ -15456,6 +15464,7 @@ function ActivitiesList() {
|
|
|
15456
15464
|
() => ({ accessToken, refreshToken, onError, updateTokens }),
|
|
15457
15465
|
[accessToken, refreshToken, onError, updateTokens]
|
|
15458
15466
|
);
|
|
15467
|
+
const { langParam } = useCurrentLanguage();
|
|
15459
15468
|
const [activities, setActivities] = useState14([]);
|
|
15460
15469
|
const [totalCount, setTotalCount] = useState14(0);
|
|
15461
15470
|
const [isLoading, setIsLoading] = useState14(true);
|
|
@@ -15467,7 +15476,7 @@ function ActivitiesList() {
|
|
|
15467
15476
|
var _a3, _b, _c;
|
|
15468
15477
|
if (!organizationId || !workspaceId) return;
|
|
15469
15478
|
try {
|
|
15470
|
-
const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient);
|
|
15479
|
+
const response = await fetchActivities(organizationId, workspaceId, nextOffset, PAGE_SIZE, authContext, consentClient, langParam);
|
|
15471
15480
|
if (!response) return;
|
|
15472
15481
|
const rows = (_a3 = response.data) != null ? _a3 : [];
|
|
15473
15482
|
setActivities((prev) => append ? [...prev, ...rows] : rows);
|
|
@@ -15478,7 +15487,7 @@ function ActivitiesList() {
|
|
|
15478
15487
|
if (!append) setActivities([]);
|
|
15479
15488
|
}
|
|
15480
15489
|
},
|
|
15481
|
-
[organizationId, workspaceId, authContext, consentClient]
|
|
15490
|
+
[organizationId, workspaceId, authContext, consentClient, langParam]
|
|
15482
15491
|
);
|
|
15483
15492
|
useEffect12(() => {
|
|
15484
15493
|
setIsLoading(true);
|
|
@@ -15617,10 +15626,10 @@ import { useTranslation as useTranslation13 } from "react-i18next";
|
|
|
15617
15626
|
// src/RedactoPrivacyCenter/lib/dateGroup.ts
|
|
15618
15627
|
import { useCallback as useCallback8 } from "react";
|
|
15619
15628
|
import { useTranslation as useTranslation12 } from "react-i18next";
|
|
15620
|
-
function monthKey(ts) {
|
|
15629
|
+
function monthKey(ts, locale) {
|
|
15621
15630
|
if (!ts) return "";
|
|
15622
15631
|
try {
|
|
15623
|
-
return new Date(ts).toLocaleDateString(void 0, { month: "long", year: "numeric" });
|
|
15632
|
+
return new Date(ts).toLocaleDateString(locale || void 0, { month: "long", year: "numeric" });
|
|
15624
15633
|
} catch {
|
|
15625
15634
|
return "";
|
|
15626
15635
|
}
|
|
@@ -15696,7 +15705,7 @@ function groupByTime(items, getTs, classify) {
|
|
|
15696
15705
|
);
|
|
15697
15706
|
}
|
|
15698
15707
|
function useRelativeDate() {
|
|
15699
|
-
const { t } = useTranslation12();
|
|
15708
|
+
const { t, i18n: i18n2 } = useTranslation12();
|
|
15700
15709
|
return useCallback8(
|
|
15701
15710
|
(ts) => {
|
|
15702
15711
|
if (!ts) return "";
|
|
@@ -15709,7 +15718,7 @@ function useRelativeDate() {
|
|
|
15709
15718
|
if (dayDiff <= 0) return t("today", { defaultValue: "Today" });
|
|
15710
15719
|
if (dayDiff === 1) return t("yesterday", { defaultValue: "Yesterday" });
|
|
15711
15720
|
if (dayDiff < 7) return t("daysAgo", { count: dayDiff, defaultValue: "{{count}} days ago" });
|
|
15712
|
-
return d.toLocaleDateString(void 0, {
|
|
15721
|
+
return d.toLocaleDateString(i18n2.language || void 0, {
|
|
15713
15722
|
month: "short",
|
|
15714
15723
|
day: "numeric",
|
|
15715
15724
|
...d.getFullYear() !== now.getFullYear() ? { year: "numeric" } : {}
|
|
@@ -15718,10 +15727,28 @@ function useRelativeDate() {
|
|
|
15718
15727
|
return ts;
|
|
15719
15728
|
}
|
|
15720
15729
|
},
|
|
15721
|
-
[t]
|
|
15730
|
+
[t, i18n2.language]
|
|
15722
15731
|
);
|
|
15723
15732
|
}
|
|
15724
15733
|
|
|
15734
|
+
// src/RedactoPrivacyCenter/lib/receiptEvent.ts
|
|
15735
|
+
function eventLabelKey(eventType) {
|
|
15736
|
+
const v = String(eventType || "").toUpperCase();
|
|
15737
|
+
if (v.includes("GRANT")) {
|
|
15738
|
+
return "consentGranted";
|
|
15739
|
+
}
|
|
15740
|
+
if (v.includes("WITHDRAW") || v.includes("REVOK")) {
|
|
15741
|
+
return "consentRevoked";
|
|
15742
|
+
}
|
|
15743
|
+
if (v.includes("DECLIN")) {
|
|
15744
|
+
return "consentDeclined";
|
|
15745
|
+
}
|
|
15746
|
+
if (v.includes("EXPIR")) {
|
|
15747
|
+
return "consentExpired";
|
|
15748
|
+
}
|
|
15749
|
+
return void 0;
|
|
15750
|
+
}
|
|
15751
|
+
|
|
15725
15752
|
// src/RedactoPrivacyCenter/components/ReceiptsList.tsx
|
|
15726
15753
|
import { Fragment as Fragment7, jsx as jsx41, jsxs as jsxs25 } from "react/jsx-runtime";
|
|
15727
15754
|
var PAGE_SIZE2 = 10;
|
|
@@ -15757,11 +15784,10 @@ function receiptBadgeStatus(eventType) {
|
|
|
15757
15784
|
if (v.includes("EXPIR")) return "warning";
|
|
15758
15785
|
return "secondary";
|
|
15759
15786
|
}
|
|
15760
|
-
var ReceiptRow = React15.memo(({ item, colors, downloading, onDownload, downloadLabel, dateLabel }) => {
|
|
15787
|
+
var ReceiptRow = React15.memo(({ item, colors, downloading, onDownload, downloadLabel, dateLabel, eventLabel }) => {
|
|
15761
15788
|
const product = item.product_name_display || item.product_name || "";
|
|
15762
|
-
const
|
|
15763
|
-
const
|
|
15764
|
-
const badgeLabel = event || "-";
|
|
15789
|
+
const primary = product || eventLabel || "-";
|
|
15790
|
+
const badgeLabel = eventLabel || "-";
|
|
15765
15791
|
return /* @__PURE__ */ jsxs25(View30, { style: styles31.row, children: [
|
|
15766
15792
|
/* @__PURE__ */ jsx41(NameAvatar, { name: primary, seed: item.uuid || primary, size: "sm" }),
|
|
15767
15793
|
/* @__PURE__ */ jsxs25(View30, { style: styles31.body, children: [
|
|
@@ -15788,7 +15814,7 @@ var ReceiptRow = React15.memo(({ item, colors, downloading, onDownload, download
|
|
|
15788
15814
|
});
|
|
15789
15815
|
ReceiptRow.displayName = "ReceiptRow";
|
|
15790
15816
|
function ReceiptsList() {
|
|
15791
|
-
const { t } = useTranslation13();
|
|
15817
|
+
const { t, i18n: i18n2 } = useTranslation13();
|
|
15792
15818
|
const { accessToken, refreshToken, organizationId, workspaceId, updateTokens, onError } = useAuth();
|
|
15793
15819
|
const { consentClient } = useBaseUrl();
|
|
15794
15820
|
const { colors } = useTheme();
|
|
@@ -15873,14 +15899,18 @@ function ReceiptsList() {
|
|
|
15873
15899
|
const sections = useMemo13(() => {
|
|
15874
15900
|
const map = /* @__PURE__ */ new Map();
|
|
15875
15901
|
for (const r of receipts) {
|
|
15876
|
-
const key = monthKey(r.created_at);
|
|
15902
|
+
const key = monthKey(r.created_at, i18n2.language);
|
|
15877
15903
|
const arr = map.get(key);
|
|
15878
15904
|
if (arr) arr.push(r);
|
|
15879
15905
|
else map.set(key, [r]);
|
|
15880
15906
|
}
|
|
15881
15907
|
return Array.from(map, ([title, data]) => ({ title, data }));
|
|
15882
|
-
}, [receipts]);
|
|
15908
|
+
}, [receipts, i18n2.language]);
|
|
15883
15909
|
const downloadLabel = t("download") || "Download";
|
|
15910
|
+
const eventLabelFor = (r) => {
|
|
15911
|
+
const key = eventLabelKey(r.event_type);
|
|
15912
|
+
return key ? t(key) : r.event_type_display || r.event_type || "-";
|
|
15913
|
+
};
|
|
15884
15914
|
const handleScroll = useCallback9(
|
|
15885
15915
|
(e) => {
|
|
15886
15916
|
const { layoutMeasurement, contentOffset, contentSize } = e.nativeEvent;
|
|
@@ -15962,7 +15992,8 @@ function ReceiptsList() {
|
|
|
15962
15992
|
downloading: downloadingUuid === item.uuid,
|
|
15963
15993
|
onDownload: handleDownload,
|
|
15964
15994
|
downloadLabel,
|
|
15965
|
-
dateLabel: relativeLabel(item.created_at)
|
|
15995
|
+
dateLabel: relativeLabel(item.created_at),
|
|
15996
|
+
eventLabel: eventLabelFor(item)
|
|
15966
15997
|
}
|
|
15967
15998
|
)
|
|
15968
15999
|
] }, `${item.uuid || item.created_at}-${index}`)) }, section2.title)),
|
package/package.json
CHANGED