@graffico/legal 0.3.12 → 0.3.14

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/index.d.ts CHANGED
@@ -4,8 +4,8 @@ import { ReactNode, InputHTMLAttributes, CSSProperties } from 'react';
4
4
  /**
5
5
  * Banner di consenso GDPR. Tipografia compressa su mobile (`text-base` /
6
6
  * `text-[11px]`) per evitare di diventare LCP candidate quando il viewport è
7
- * piccolo; su desktop torna alle dimensioni piene. Non chiudibile via X:
8
- * dismissal passiva non equivale a consenso (EDPB GL 03/2022 §3.1).
7
+ * piccolo; su desktop torna alle dimensioni piene. La X chiude mantenendo le
8
+ * impostazioni di default, senza alcun consenso (Garante 10/06/2021, par. 7.1).
9
9
  * Il testo cita solo le finalità a consenso in uso (`getTrackingPurposes`).
10
10
  */
11
11
  declare const ConsentBanner: () => react_jsx_runtime.JSX.Element;
@@ -34,7 +34,7 @@ declare const TRANSLATIONS: {
34
34
  bannerDescription: string;
35
35
  bannerDescriptionMeasurement: string;
36
36
  bannerDescriptionMarketing: string;
37
- bannerDescriptionMeasurementAndMarketing: string;
37
+ bannerDescriptionExternalContent: string;
38
38
  bannerDescriptionEnd: string;
39
39
  bannerDescriptionTechnicalOnly: string;
40
40
  cookiePolicyLink: string;
@@ -51,6 +51,20 @@ declare const TRANSLATIONS: {
51
51
  measurementDescription: string;
52
52
  marketingTitle: string;
53
53
  marketingDescription: string;
54
+ externalContentTitle: string;
55
+ externalContentDescription: string;
56
+ closeWithoutAccepting: string;
57
+ bannerCloseNotice: string;
58
+ reviewCookieChoices: string;
59
+ providersLabel: string;
60
+ retentionDay: string;
61
+ retentionDays: string;
62
+ retentionWeek: string;
63
+ retentionWeeks: string;
64
+ retentionMonth: string;
65
+ retentionMonths: string;
66
+ retentionYear: string;
67
+ retentionYears: string;
54
68
  consentId: string;
55
69
  consentDate: string;
56
70
  consentPolicyVersion: string;
@@ -149,9 +163,13 @@ declare const TRANSLATIONS: {
149
163
  lawfulBasisPublicTask: string;
150
164
  lawfulBasisNotDeclared: string;
151
165
  profilingTitle: string;
166
+ profilingMarketingNote: string;
152
167
  profilingDeclaredYes: string;
153
168
  profilingDeclaredNo: string;
154
169
  cookieTableTitle: string;
170
+ consentRecordName: string;
171
+ consentRecordPurpose: string;
172
+ consentRecordDuration: string;
155
173
  cookieTableIntro: string;
156
174
  cookieTableName: string;
157
175
  cookieTableProvider: string;
@@ -173,8 +191,6 @@ declare const TRANSLATIONS: {
173
191
  usageTrackingTitle: string;
174
192
  usageTrackingDescription: string;
175
193
  usageTrackingDescriptionTechnicalOnly: string;
176
- usageTrackingDescriptionMarketing: string;
177
- usageTrackingDescriptionMeasurementAndMarketing: string;
178
194
  managePreferencesTitle: string;
179
195
  managePreferencesDescription1: string;
180
196
  managePreferencesDescription2: string;
@@ -229,7 +245,7 @@ declare const TRANSLATIONS: {
229
245
  bannerDescription: string;
230
246
  bannerDescriptionMeasurement: string;
231
247
  bannerDescriptionMarketing: string;
232
- bannerDescriptionMeasurementAndMarketing: string;
248
+ bannerDescriptionExternalContent: string;
233
249
  bannerDescriptionEnd: string;
234
250
  bannerDescriptionTechnicalOnly: string;
235
251
  cookiePolicyLink: string;
@@ -246,6 +262,20 @@ declare const TRANSLATIONS: {
246
262
  measurementDescription: string;
247
263
  marketingTitle: string;
248
264
  marketingDescription: string;
265
+ externalContentTitle: string;
266
+ externalContentDescription: string;
267
+ closeWithoutAccepting: string;
268
+ bannerCloseNotice: string;
269
+ reviewCookieChoices: string;
270
+ providersLabel: string;
271
+ retentionDay: string;
272
+ retentionDays: string;
273
+ retentionWeek: string;
274
+ retentionWeeks: string;
275
+ retentionMonth: string;
276
+ retentionMonths: string;
277
+ retentionYear: string;
278
+ retentionYears: string;
249
279
  consentId: string;
250
280
  consentDate: string;
251
281
  consentPolicyVersion: string;
@@ -344,9 +374,13 @@ declare const TRANSLATIONS: {
344
374
  lawfulBasisPublicTask: string;
345
375
  lawfulBasisNotDeclared: string;
346
376
  profilingTitle: string;
377
+ profilingMarketingNote: string;
347
378
  profilingDeclaredYes: string;
348
379
  profilingDeclaredNo: string;
349
380
  cookieTableTitle: string;
381
+ consentRecordName: string;
382
+ consentRecordPurpose: string;
383
+ consentRecordDuration: string;
350
384
  cookieTableIntro: string;
351
385
  cookieTableName: string;
352
386
  cookieTableProvider: string;
@@ -368,8 +402,6 @@ declare const TRANSLATIONS: {
368
402
  usageTrackingTitle: string;
369
403
  usageTrackingDescription: string;
370
404
  usageTrackingDescriptionTechnicalOnly: string;
371
- usageTrackingDescriptionMarketing: string;
372
- usageTrackingDescriptionMeasurementAndMarketing: string;
373
405
  managePreferencesTitle: string;
374
406
  managePreferencesDescription1: string;
375
407
  managePreferencesDescription2: string;
@@ -444,7 +476,7 @@ interface CookieDeclaration {
444
476
  /**
445
477
  * Categoria di consenso gestita dal CMP.
446
478
  */
447
- type ConsentCategory = "necessary" | "statistical" | "marketing";
479
+ type ConsentCategory = "necessary" | "statistical" | "marketing" | "externalContent";
448
480
  /**
449
481
  * Sottoinsieme di categorie che possono "gating" lo script di un tracker.
450
482
  * Esclude `necessary` perché i tracker tecnici non sono mai opt-in.
@@ -564,21 +596,27 @@ interface CompanyConfig {
564
596
  * Default: `false`.
565
597
  */
566
598
  automatedDecisionMaking?: boolean;
599
+ /** Percorso della privacy policy. Default `/privacy-policy`. */
600
+ privacyPolicyPath?: string;
601
+ /** Percorso della cookie policy. Default `/cookie-policy`. */
602
+ cookiePolicyPath?: string;
567
603
  }
568
604
  /**
569
605
  * Origine della scelta di consenso salvata. Utile per audit.
570
606
  */
571
607
  type ConsentSource = "banner" | "modal" | "gpc-auto" | "api";
572
608
  /**
573
- * Stato di consenso persistito per categoria, con prova legale e TTL.
609
+ * Stato di consenso persistito per categoria, con riferimenti della scelta e TTL.
574
610
  */
575
611
  interface ConsentState {
576
612
  necessary: boolean;
577
613
  statistical: boolean;
578
614
  marketing: boolean;
615
+ /** Mappe, video e altri contenuti ospitati da terzi. */
616
+ externalContent: boolean;
579
617
  consentId?: string;
580
618
  timestamp?: string;
581
- /** Epoch ms oltre cui il consenso scade e va riproposto (Garante: max 6 mesi). */
619
+ /** Epoch ms oltre cui il consenso scade e va riproposto (180 giorni). */
582
620
  expiresAt?: number;
583
621
  /** Versione delle policy al momento del consenso. */
584
622
  policyVersion?: string;
@@ -612,7 +650,7 @@ declare const ServiceGrid: ({ config: configProp, language: langProp, }?: Servic
612
650
  */
613
651
  declare const useLegalLanguage: () => Language;
614
652
  /**
615
- * Stato di consenso corrente (necessary/statistical/marketing + prova legale).
653
+ * Stato di consenso corrente (categorie + riferimenti della scelta).
616
654
  */
617
655
  declare const useConsent: () => ConsentState;
618
656
  /**
@@ -655,14 +693,24 @@ interface ConsentGateProps {
655
693
  */
656
694
  declare function ConsentGate({ category, children, fallback, renderWhileHydrating, }: ConsentGateProps): react_jsx_runtime.JSX.Element;
657
695
 
696
+ interface ConsentPreferencesLinkProps {
697
+ className?: string;
698
+ }
699
+ /**
700
+ * Link da mettere nel footer per rivedere le scelte in ogni momento
701
+ * (Garante 10/06/2021, par. 7.1).
702
+ */
703
+ declare function ConsentPreferencesLink({ className, }: ConsentPreferencesLinkProps): react_jsx_runtime.JSX.Element;
704
+
658
705
  interface Props {
659
706
  language: Language;
660
707
  primaryColor: string;
708
+ privacyPolicyPath?: string;
661
709
  }
662
710
  /**
663
711
  * Card "centro preferenze" della cookie policy: gestisci o resetta consenso.
664
712
  */
665
- declare function PreferenceCard({ language, primaryColor }: Props): react_jsx_runtime.JSX.Element;
713
+ declare function PreferenceCard({ language, primaryColor, privacyPolicyPath, }: Props): react_jsx_runtime.JSX.Element;
666
714
 
667
715
  interface LegalConfigProviderProps {
668
716
  config: CompanyConfig;
@@ -692,7 +740,7 @@ interface ClientState {
692
740
  }
693
741
  /**
694
742
  * Durata di validità del consenso in millisecondi.
695
- * Allineato alla raccomandazione Garante 10/06/2021 (max 6 mesi prima del re-prompt).
743
+ * 180 giorni, circa i 6 mesi indicati dal Garante (10/06/2021) per riproporre il banner.
696
744
  */
697
745
  declare const CONSENT_TTL_MS: number;
698
746
  /**
@@ -719,7 +767,7 @@ interface HydrateOptions {
719
767
  */
720
768
  declare function hydrateFromStorage(opts?: HydrateOptions): void;
721
769
  /**
722
- * Persiste le preferenze e marca prova legale (consentId + timestamp + TTL +
770
+ * Persiste le preferenze con i riferimenti della scelta (consentId + timestamp + TTL +
723
771
  * policyVersion + source).
724
772
  */
725
773
  declare function savePreferences(prefs: ConsentState, source?: ConsentSource): ConsentState;
@@ -986,7 +1034,7 @@ interface UseEmailJSOptions {
986
1034
  }
987
1035
  interface ConsentCheckboxProps extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "name"> {
988
1036
  label?: ReactNode;
989
- /** Link alla privacy policy. Default `/privacy-policy`. */
1037
+ /** Link alla privacy policy. Default `privacyPolicyPath` della config, poi `/privacy-policy`. */
990
1038
  privacyHref?: string;
991
1039
  /** Label del link policy. Default tradotta. */
992
1040
  privacyLabel?: ReactNode;
@@ -1020,6 +1068,19 @@ declare const SERVICE_PRESETS: Record<string, LegalService>;
1020
1068
  */
1021
1069
  declare const resolveService: (ref: string | LegalService) => LegalService;
1022
1070
 
1071
+ /**
1072
+ * Finalità soggette a consenso effettivamente in uso sul sito. Guidano il testo
1073
+ * di banner e cookie policy: l'informativa breve deve citare le finalità dei
1074
+ * tracker che richiedono consenso (Garante 10/06/2021).
1075
+ */
1076
+ type TrackingPurpose = "measurement" | "marketing" | "externalContent";
1077
+ /**
1078
+ * Finalità in uso secondo i `services[]` dichiarati e le categorie richieste
1079
+ * dai tracker/gate montati. La misurazione sparisce solo se è certo che non
1080
+ * serve (nessun servizio ignoto). Lista vuota = solo finalità tecniche.
1081
+ */
1082
+ declare function getTrackingPurposes(services?: ServiceReference[], requested?: readonly ConsentCategory[]): TrackingPurpose[];
1083
+
1023
1084
  declare const DEFAULT_PRIMARY_COLOR = "#2c5282";
1024
1085
 
1025
- export { CONSENT_TTL_MS, type CompanyConfig, ConsentBanner, type ConsentCategory, ConsentCheckbox, ConsentGate, ConsentModeBoot, type ConsentSource, type ConsentState, DEFAULT_PRIMARY_COLOR, type DpoInfo, EmailJSLegal, FloatingConsentToggle, GTMLegal, GoogleAdsLegal, GoogleAnalyticsLegal, HotjarLegal, type Language, LegalConfigProvider, type LegalService, LinkedInInsightLegal, MetaPixelLegal, PreferenceCard, PreferenceModal, type Processor, type RetentionMap, SERVICE_PRESETS, ServiceGrid, type ServiceReference, type TogglePosition, type TrackableCategory, type TranslationKey, type Translator, acceptAll, declineAll, getSnapshot as getConsentSnapshot, hydrateFromStorage, resetConsent, resolveService, savePreferences, setLanguage, setModalOpen, subscribe as subscribeConsent, useAdsConversion, useConsent, useConsentCategory, useEmailJS, useGAEvent, useHotjarEvent, useHotjarIdentify, useIsHydrated, useLegalConfig, useLegalConfigOptional, useLegalLanguage, useLinkedInInsightEvent, useMetaEvent, useModalOpen, useShowBanner, useT };
1086
+ export { CONSENT_TTL_MS, type CompanyConfig, ConsentBanner, type ConsentCategory, ConsentCheckbox, ConsentGate, ConsentModeBoot, ConsentPreferencesLink, type ConsentSource, type ConsentState, DEFAULT_PRIMARY_COLOR, type DpoInfo, EmailJSLegal, FloatingConsentToggle, GTMLegal, GoogleAdsLegal, GoogleAnalyticsLegal, HotjarLegal, type Language, LegalConfigProvider, type LegalService, LinkedInInsightLegal, MetaPixelLegal, PreferenceCard, PreferenceModal, type Processor, type RetentionMap, SERVICE_PRESETS, ServiceGrid, type ServiceReference, type TogglePosition, type TrackableCategory, type TranslationKey, type Translator, acceptAll, declineAll, getSnapshot as getConsentSnapshot, getTrackingPurposes, hydrateFromStorage, resetConsent, resolveService, savePreferences, setLanguage, setModalOpen, subscribe as subscribeConsent, useAdsConversion, useConsent, useConsentCategory, useEmailJS, useGAEvent, useHotjarEvent, useHotjarIdentify, useIsHydrated, useLegalConfig, useLegalConfigOptional, useLegalLanguage, useLinkedInInsightEvent, useMetaEvent, useModalOpen, useShowBanner, useT };