@webority/ui-react 0.11.6 → 0.12.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.
@@ -0,0 +1,46 @@
1
+ import "@webority/ui-elements";
2
+ /**
3
+ * The cookie consent banner: accept all, reject all, or choose per category (analytics,
4
+ * functional, marketing; essential is always on).
5
+ *
6
+ * Wraps the shared `<wui-consent-banner>` element, which owns the buttons, the switches and the
7
+ * settings mode. This wrapper owns the wiring to `@webority/analytics`: it shows the banner when
8
+ * the visitor has not decided yet, and stores their choice with `saveConsent`, which also tells
9
+ * Google Consent Mode, PostHog and the marketing tags. Call `initConsent` from
10
+ * `@webority/analytics` before this renders; it throws otherwise, because a banner with no
11
+ * consent record behind it would ask a question nothing remembers.
12
+ *
13
+ * Any element carrying `data-consent-settings` reopens the banner with the switches showing, so
14
+ * a footer "Cookie settings" link needs no code: withdrawing consent must be as easy as giving it.
15
+ *
16
+ * ```jsx
17
+ * initConsent({ requiresOptIn, cookieDomain: ".example.com" }); // app bootstrap, once
18
+ *
19
+ * <AppConsentBanner policyHref="/cookie-policy" />
20
+ * <a href="#" data-consent-settings>Cookie settings</a>
21
+ * ```
22
+ *
23
+ * @param {object} props
24
+ * @param {string} [props.heading='Cookies on this site'] Heading, and the dialog's accessible name.
25
+ * @param {string} [props.description] The explanation above the buttons.
26
+ * @param {string} [props.policyHref] Link to the cookie policy; no link when omitted.
27
+ * @param {string} [props.policyLabel='Cookie policy'] The policy link's text.
28
+ * @param {string} [props.analyticsDescription] What the analytics category covers.
29
+ * @param {string} [props.functionalDescription] What the functional category covers.
30
+ * @param {string} [props.marketingDescription] What the marketing category covers.
31
+ * @param {"bottom-left"|"bottom-right"} [props.position='bottom-left'] Which corner it pins to.
32
+ * @param {string} [props.className] Extra classes on the element.
33
+ * @param {import('react').CSSProperties} [props.style] Inline style; lands on the element with `className`.
34
+ */
35
+ export default function AppConsentBanner({ heading, description, policyHref, policyLabel, analyticsDescription, functionalDescription, marketingDescription, position, className, style, ...rest }: {
36
+ heading?: string;
37
+ description?: string;
38
+ policyHref?: string;
39
+ policyLabel?: string;
40
+ analyticsDescription?: string;
41
+ functionalDescription?: string;
42
+ marketingDescription?: string;
43
+ position?: "bottom-left" | "bottom-right";
44
+ className?: string;
45
+ style?: import('react').CSSProperties;
46
+ }): import("react").JSX.Element;
@@ -18,6 +18,7 @@ export { default as AppChoiceChip } from "./components/AppChoiceChip.jsx";
18
18
  export { default as AppColorField } from "./components/AppColorField.jsx";
19
19
  export { default as AppCompareTable } from "./components/AppCompareTable.jsx";
20
20
  export { default as AppConfirmDialog } from "./components/AppConfirmDialog.jsx";
21
+ export { default as AppConsentBanner } from "./components/AppConsentBanner.jsx";
21
22
  export { default as AppCopyButton } from "./components/AppCopyButton.jsx";
22
23
  export { default as AppDataTable } from "./components/AppDataTable.jsx";
23
24
  export { default as AppDatePicker } from "./components/AppDatePicker.jsx";