@redacto.io/consent-sdk-react 3.3.0 → 3.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +12 -0
- package/README.md +11 -0
- package/dist/index.d.mts +3 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +321 -155
- package/dist/index.mjs +321 -155
- package/package.json +1 -1
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.test.tsx +123 -1
- package/src/RedactoNoticeConsent/RedactoNoticeConsent.tsx +924 -652
- package/src/RedactoNoticeConsent/api/index.ts +31 -65
- package/src/RedactoNoticeConsent/api/types.ts +47 -33
- package/src/RedactoNoticeConsent/constants.ts +20 -0
- package/src/RedactoNoticeConsent/styles.ts +3 -6
- package/src/RedactoNoticeConsent/types.ts +11 -5
- package/src/RedactoNoticeConsentInline/RedactoNoticeConsentInline.tsx +12 -3
- package/src/RedactoNoticeConsentInline/api/index.ts +26 -64
- package/src/RedactoNoticeConsentInline/api/types.ts +8 -31
- package/src/RedactoNoticeConsentInline/types.ts +9 -4
- package/src/types/react-jsx.d.ts +26 -0
- package/tests/mocks.ts +53 -7
- package/tsconfig.json +1 -5
- package/src/utils/isLegacyApi.ts +0 -12
package/tests/mocks.ts
CHANGED
|
@@ -24,16 +24,28 @@ export const mockConsentContent: ConsentContent = {
|
|
|
24
24
|
decline_button_text: "Decline",
|
|
25
25
|
logo_url: "https://example.com/logo.png",
|
|
26
26
|
privacy_policy_url: "https://example.com/privacy",
|
|
27
|
-
|
|
27
|
+
privacy_center_url: "https://example.com/privacy-center",
|
|
28
28
|
primary_color: "#4f87ff",
|
|
29
29
|
secondary_color: "#ffffff",
|
|
30
30
|
font_preference: "Arial",
|
|
31
31
|
privacy_policy_prefix_text: "",
|
|
32
|
-
vendor_list_prefix_text: "",
|
|
33
32
|
privacy_policy_anchor_text: "Privacy Policy",
|
|
34
|
-
|
|
33
|
+
privacy_center_anchor_text: "Privacy Center",
|
|
35
34
|
purpose_section_heading: "Manage Consent",
|
|
36
35
|
notice_banner_heading: "Privacy Notice",
|
|
36
|
+
dpo_info: {
|
|
37
|
+
grievance_text: "If you have any grievances related to data processing,",
|
|
38
|
+
grievance_anchor_text: "click here",
|
|
39
|
+
grievance_url: "https://example.com/grievance",
|
|
40
|
+
grievance_email: "grievance@example.com",
|
|
41
|
+
grievance_email_connector_text: "or email to",
|
|
42
|
+
dp_board_text: "In case we were not able to resolve your grievance, you can reach out to the Data Protection Board",
|
|
43
|
+
dp_board_anchor_text: "here",
|
|
44
|
+
dp_board_url: "https://example.com/dp-board",
|
|
45
|
+
dpo_text: "To connect with the Data Protection Officer,",
|
|
46
|
+
dpo_anchor_text: "Click here",
|
|
47
|
+
dpo_url: "https://example.com/dpo",
|
|
48
|
+
},
|
|
37
49
|
created_at: "2023-01-01T00:00:00Z",
|
|
38
50
|
updated_at: "2023-01-01T00:00:00Z",
|
|
39
51
|
deployed_at: "2023-01-01T00:00:00Z",
|
|
@@ -42,21 +54,28 @@ export const mockConsentContent: ConsentContent = {
|
|
|
42
54
|
notice_text: "Nos importa tu privacidad.",
|
|
43
55
|
additional_text: "",
|
|
44
56
|
privacy_policy_prefix_text: "",
|
|
45
|
-
vendor_list_prefix_text: "",
|
|
46
57
|
privacy_policy_anchor_text: "Política de Privacidad",
|
|
47
|
-
vendors_list_anchor_text: "Lista de Proveedores",
|
|
48
58
|
confirm_button_text: "Aceptar",
|
|
49
59
|
decline_button_text: "Rechazar",
|
|
50
60
|
purpose_section_heading: "Gestionar Consentimiento",
|
|
51
61
|
notice_banner_heading: "Aviso de Privacidad",
|
|
62
|
+
privacy_center_anchor_text: "Centro de Privacidad",
|
|
52
63
|
purposes: {
|
|
53
|
-
"purpose-1": "Marketing",
|
|
54
|
-
"purpose-1-description": "Usamos datos para marketing.",
|
|
64
|
+
"purpose-1": { name: "Marketing", description: "Usamos datos para marketing." },
|
|
55
65
|
},
|
|
56
66
|
data_elements: {
|
|
57
67
|
"element-1": "Email",
|
|
58
68
|
"element-2": "Phone",
|
|
59
69
|
},
|
|
70
|
+
dpo_info: {
|
|
71
|
+
grievance_text: "Si tiene alguna queja relacionada con el procesamiento de datos,",
|
|
72
|
+
grievance_anchor_text: "haga clic aquí",
|
|
73
|
+
grievance_email_connector_text: "o envíe un correo a",
|
|
74
|
+
dp_board_text: "En caso de que no hayamos podido resolver su queja, puede comunicarse con la Junta de Protección de Datos",
|
|
75
|
+
dp_board_anchor_text: "aquí",
|
|
76
|
+
dpo_text: "Para comunicarse con el Oficial de Protección de Datos,",
|
|
77
|
+
dpo_anchor_text: "Haga clic aquí",
|
|
78
|
+
},
|
|
60
79
|
},
|
|
61
80
|
},
|
|
62
81
|
purposes: [
|
|
@@ -176,6 +195,33 @@ export const mockReconsentContent: ConsentContent = {
|
|
|
176
195
|
},
|
|
177
196
|
} as const;
|
|
178
197
|
|
|
198
|
+
export const mockMagicLinkContent: ConsentContent = {
|
|
199
|
+
...mockConsentContent,
|
|
200
|
+
detail: {
|
|
201
|
+
...mockConsentContent.detail,
|
|
202
|
+
reconsent_required: false,
|
|
203
|
+
purpose_selections: {
|
|
204
|
+
"purpose-1": {
|
|
205
|
+
selected: true,
|
|
206
|
+
status: "ACTIVE",
|
|
207
|
+
needs_reconsent: false,
|
|
208
|
+
data_elements: {
|
|
209
|
+
"element-1": {
|
|
210
|
+
selected: true,
|
|
211
|
+
enabled: true,
|
|
212
|
+
required: false,
|
|
213
|
+
},
|
|
214
|
+
"element-2": {
|
|
215
|
+
selected: true,
|
|
216
|
+
enabled: true,
|
|
217
|
+
required: true,
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
},
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
} as const;
|
|
224
|
+
|
|
179
225
|
export const mockMinorConsentContent: ConsentContent = {
|
|
180
226
|
...mockConsentContent,
|
|
181
227
|
detail: {
|
package/tsconfig.json
CHANGED
package/src/utils/isLegacyApi.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
// @deprecated Remove when production backend supports the new payload format.
|
|
2
|
-
export function isLegacyApi(baseUrl: string): boolean {
|
|
3
|
-
try {
|
|
4
|
-
return new URL(baseUrl).hostname.endsWith(".redacto.io");
|
|
5
|
-
} catch {
|
|
6
|
-
try {
|
|
7
|
-
return new URL(`https://${baseUrl}`).hostname.endsWith(".redacto.io");
|
|
8
|
-
} catch {
|
|
9
|
-
return false;
|
|
10
|
-
}
|
|
11
|
-
}
|
|
12
|
-
}
|