@ht-sdks/consent-manager 0.0.1

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.
Files changed (110) hide show
  1. package/LICENSE +45 -0
  2. package/README.md +851 -0
  3. package/commonjs/__tests__/consent-manager-builder/analytics.test.js +250 -0
  4. package/commonjs/__tests__/consent-manager-builder/fetch-destinations.test.js +155 -0
  5. package/commonjs/__tests__/consent-manager-builder/index.todo.js +327 -0
  6. package/commonjs/__tests__/consent-manager-builder/preferences.test.js +129 -0
  7. package/commonjs/__tests__/index.test.js +57 -0
  8. package/commonjs/consent-manager/banner.js +89 -0
  9. package/commonjs/consent-manager/buttons.js +18 -0
  10. package/commonjs/consent-manager/cancel-dialog.js +76 -0
  11. package/commonjs/consent-manager/categories.js +29 -0
  12. package/commonjs/consent-manager/container.js +169 -0
  13. package/commonjs/consent-manager/dialog.js +129 -0
  14. package/commonjs/consent-manager/font-styles.js +10 -0
  15. package/commonjs/consent-manager/index.js +244 -0
  16. package/commonjs/consent-manager/preference-dialog.js +178 -0
  17. package/commonjs/consent-manager-builder/analytics.js +76 -0
  18. package/commonjs/consent-manager-builder/fetch-destinations.js +104 -0
  19. package/commonjs/consent-manager-builder/index.js +330 -0
  20. package/commonjs/consent-manager-builder/preferences.js +82 -0
  21. package/commonjs/index.js +39 -0
  22. package/commonjs/standalone.js +86 -0
  23. package/commonjs/types.js +3 -0
  24. package/esm/__tests__/consent-manager-builder/analytics.test.js +245 -0
  25. package/esm/__tests__/consent-manager-builder/fetch-destinations.test.js +150 -0
  26. package/esm/__tests__/consent-manager-builder/index.todo.js +322 -0
  27. package/esm/__tests__/consent-manager-builder/preferences.test.js +124 -0
  28. package/esm/__tests__/index.test.js +55 -0
  29. package/esm/consent-manager/banner.js +65 -0
  30. package/esm/consent-manager/buttons.js +12 -0
  31. package/esm/consent-manager/cancel-dialog.js +52 -0
  32. package/esm/consent-manager/categories.js +26 -0
  33. package/esm/consent-manager/container.js +162 -0
  34. package/esm/consent-manager/dialog.js +105 -0
  35. package/esm/consent-manager/font-styles.js +8 -0
  36. package/esm/consent-manager/index.js +220 -0
  37. package/esm/consent-manager/preference-dialog.js +154 -0
  38. package/esm/consent-manager-builder/analytics.js +73 -0
  39. package/esm/consent-manager-builder/fetch-destinations.js +98 -0
  40. package/esm/consent-manager-builder/index.js +325 -0
  41. package/esm/consent-manager-builder/preferences.js +73 -0
  42. package/esm/index.js +28 -0
  43. package/esm/standalone.js +58 -0
  44. package/esm/types.js +1 -0
  45. package/package.json +168 -0
  46. package/src/__tests__/consent-manager-builder/analytics.test.ts +279 -0
  47. package/src/__tests__/consent-manager-builder/fetch-destinations.test.ts +89 -0
  48. package/src/__tests__/consent-manager-builder/index.todo.js +386 -0
  49. package/src/__tests__/consent-manager-builder/preferences.test.ts +156 -0
  50. package/src/__tests__/index.test.ts +68 -0
  51. package/src/consent-manager/banner.tsx +227 -0
  52. package/src/consent-manager/buttons.tsx +78 -0
  53. package/src/consent-manager/cancel-dialog.tsx +68 -0
  54. package/src/consent-manager/categories.ts +27 -0
  55. package/src/consent-manager/container.tsx +282 -0
  56. package/src/consent-manager/dialog.tsx +236 -0
  57. package/src/consent-manager/font-styles.tsx +14 -0
  58. package/src/consent-manager/index.tsx +327 -0
  59. package/src/consent-manager/preference-dialog.tsx +371 -0
  60. package/src/consent-manager-builder/analytics.ts +104 -0
  61. package/src/consent-manager-builder/fetch-destinations.ts +50 -0
  62. package/src/consent-manager-builder/index.tsx +426 -0
  63. package/src/consent-manager-builder/preferences.ts +100 -0
  64. package/src/index.ts +42 -0
  65. package/src/standalone.tsx +57 -0
  66. package/src/styled.d.ts +7 -0
  67. package/src/types.ts +151 -0
  68. package/standalone/consent-manager.js +23 -0
  69. package/standalone/consent-manager.js.map +1 -0
  70. package/types/__tests__/consent-manager-builder/analytics.test.d.ts +1 -0
  71. package/types/__tests__/consent-manager-builder/fetch-destinations.test.d.ts +1 -0
  72. package/types/__tests__/consent-manager-builder/index.todo.d.ts +1 -0
  73. package/types/__tests__/consent-manager-builder/preferences.test.d.ts +1 -0
  74. package/types/__tests__/index.test.d.ts +1 -0
  75. package/types/consent-manager/banner.d.ts +21 -0
  76. package/types/consent-manager/buttons.d.ts +13 -0
  77. package/types/consent-manager/cancel-dialog.d.ts +19 -0
  78. package/types/consent-manager/categories.d.ts +3 -0
  79. package/types/consent-manager/container.d.ts +35 -0
  80. package/types/consent-manager/dialog.d.ts +29 -0
  81. package/types/consent-manager/font-styles.d.ts +2 -0
  82. package/types/consent-manager/index.d.ts +35 -0
  83. package/types/consent-manager/preference-dialog.d.ts +32 -0
  84. package/types/consent-manager-builder/analytics.d.ts +14 -0
  85. package/types/consent-manager-builder/fetch-destinations.d.ts +2 -0
  86. package/types/consent-manager-builder/index.d.ts +126 -0
  87. package/types/consent-manager-builder/preferences.d.ts +26 -0
  88. package/types/index.d.ts +7 -0
  89. package/types/src/__tests__/consent-manager-builder/analytics.test.d.ts +1 -0
  90. package/types/src/__tests__/consent-manager-builder/fetch-destinations.test.d.ts +1 -0
  91. package/types/src/__tests__/consent-manager-builder/preferences.test.d.ts +1 -0
  92. package/types/src/__tests__/index.test.d.ts +1 -0
  93. package/types/src/consent-manager/banner.d.ts +21 -0
  94. package/types/src/consent-manager/buttons.d.ts +13 -0
  95. package/types/src/consent-manager/cancel-dialog.d.ts +19 -0
  96. package/types/src/consent-manager/categories.d.ts +3 -0
  97. package/types/src/consent-manager/container.d.ts +35 -0
  98. package/types/src/consent-manager/dialog.d.ts +29 -0
  99. package/types/src/consent-manager/font-styles.d.ts +2 -0
  100. package/types/src/consent-manager/index.d.ts +35 -0
  101. package/types/src/consent-manager/preference-dialog.d.ts +32 -0
  102. package/types/src/consent-manager-builder/analytics.d.ts +14 -0
  103. package/types/src/consent-manager-builder/fetch-destinations.d.ts +2 -0
  104. package/types/src/consent-manager-builder/index.d.ts +126 -0
  105. package/types/src/consent-manager-builder/preferences.d.ts +26 -0
  106. package/types/src/index.d.ts +7 -0
  107. package/types/src/standalone.d.ts +5 -0
  108. package/types/src/types.d.ts +131 -0
  109. package/types/standalone.d.ts +5 -0
  110. package/types/types.d.ts +131 -0
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { ActionsBlockProps } from '../types';
3
+ interface BannerProps {
4
+ innerRef: (node: HTMLElement | null) => void;
5
+ onClose: () => void;
6
+ onChangePreferences: () => void;
7
+ content: React.ReactNode;
8
+ subContent: string | undefined;
9
+ actionsBlock?: ((props: ActionsBlockProps) => React.ReactElement) | true;
10
+ backgroundColor: string;
11
+ textColor: string;
12
+ onAcceptAll: () => void;
13
+ onDenyAll: () => void;
14
+ hideCloseButton: boolean;
15
+ asModal?: boolean;
16
+ }
17
+ export default class Banner extends PureComponent<BannerProps> {
18
+ static displayName: string;
19
+ render(): JSX.Element;
20
+ }
21
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export declare const DefaultButton: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: "symbol" | "object" | "big" | "link" | "small" | "sub" | "sup" | "track" | "progress" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "source" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "menuitem" | "keygen" | "noindex" | "webview" | "animate" | "animateMotion" | "animateTransform" | "feDropShadow" | "mpath" | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
6
+ export declare const GreenButton: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: "symbol" | "object" | "big" | "link" | "small" | "sub" | "sup" | "track" | "progress" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "source" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "menuitem" | "keygen" | "noindex" | "webview" | "animate" | "animateMotion" | "animateTransform" | "feDropShadow" | "mpath" | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
10
+ export declare const RedButton: import("@emotion/styled").StyledComponent<{
11
+ theme?: import("@emotion/react").Theme | undefined;
12
+ as?: "symbol" | "object" | "big" | "link" | "small" | "sub" | "sup" | "track" | "progress" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "main" | "map" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "source" | "span" | "strong" | "style" | "summary" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "u" | "ul" | "var" | "video" | "wbr" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | "menuitem" | "keygen" | "noindex" | "webview" | "animate" | "animateMotion" | "animateTransform" | "feDropShadow" | "mpath" | import("react").ComponentClass<any, any> | import("react").FunctionComponent<any> | undefined;
13
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
@@ -0,0 +1,19 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { PreferenceDialogTemplate } from '../types';
3
+ interface Props {
4
+ innerRef: (node: HTMLElement) => void;
5
+ onBack: () => void;
6
+ onConfirm: () => void;
7
+ title: React.ReactNode;
8
+ content: React.ReactNode;
9
+ preferencesDialogTemplate?: PreferenceDialogTemplate;
10
+ }
11
+ export default class CancelDialog extends PureComponent<Props> {
12
+ static displayName: string;
13
+ render(): JSX.Element;
14
+ componentDidMount(): void;
15
+ componentWillUnmount(): void;
16
+ handleSubmit: (e: any) => void;
17
+ handleEsc: (e: KeyboardEvent) => void;
18
+ }
19
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const MARKETING_AND_ANALYTICS_CATEGORIES: string[];
2
+ export declare const ADVERTISING_CATEGORIES: string[];
3
+ export declare const FUNCTIONAL_CATEGORIES: string[];
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior, ActionsBlockProps, PreferenceDialogTemplate, CloseBehavior } from '../types';
3
+ export declare function openDialog(): void;
4
+ export interface CloseBehaviorFunction {
5
+ (categories: CategoryPreferences): CategoryPreferences;
6
+ }
7
+ interface ContainerProps {
8
+ setPreferences: (prefs: CategoryPreferences) => void;
9
+ saveConsent: (newPreferences?: CategoryPreferences, shouldReload?: boolean, devMode?: boolean) => void;
10
+ resetPreferences: () => void;
11
+ closeBehavior?: CloseBehavior | CloseBehaviorFunction;
12
+ destinations: Destination[];
13
+ customCategories?: CustomCategories | undefined;
14
+ newDestinations: Destination[];
15
+ preferences: CategoryPreferences;
16
+ havePreferencesChanged: boolean;
17
+ isConsentRequired: boolean;
18
+ implyConsentOnInteraction: boolean;
19
+ bannerContent: React.ReactNode;
20
+ bannerSubContent: string | undefined;
21
+ bannerActionsBlock?: ((props: ActionsBlockProps) => React.ReactElement) | true;
22
+ bannerTextColor: string;
23
+ bannerBackgroundColor: string;
24
+ bannerHideCloseButton: boolean;
25
+ bannerAsModal?: boolean;
26
+ preferencesDialogTitle: React.ReactNode;
27
+ preferencesDialogContent: React.ReactNode;
28
+ cancelDialogTitle: React.ReactNode;
29
+ cancelDialogContent: React.ReactNode;
30
+ workspaceAddedNewDestinations?: boolean;
31
+ defaultDestinationBehavior?: DefaultDestinationBehavior;
32
+ preferencesDialogTemplate?: PreferenceDialogTemplate;
33
+ }
34
+ declare const Container: React.FC<ContainerProps>;
35
+ export default Container;
@@ -0,0 +1,29 @@
1
+ import React, { PureComponent } from 'react';
2
+ interface DialogProps {
3
+ innerRef: (element: HTMLElement | null) => void;
4
+ onCancel?: () => void;
5
+ onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
6
+ title: React.ReactNode;
7
+ buttons: React.ReactNode;
8
+ width?: string;
9
+ }
10
+ export default class Dialog extends PureComponent<DialogProps, {}> {
11
+ static displayName: string;
12
+ private titleId;
13
+ private container;
14
+ private root;
15
+ private form;
16
+ static defaultProps: {
17
+ onCancel: undefined;
18
+ width: string;
19
+ };
20
+ constructor(props: DialogProps);
21
+ render(): React.ReactPortal;
22
+ componentDidMount(): void;
23
+ componentWillUnmount(): void;
24
+ handleRootRef: (node: HTMLElement) => void;
25
+ handleFormRef: (node: HTMLFormElement) => void;
26
+ handleOverlayClick: (e: any) => void;
27
+ handleEsc: (e: KeyboardEvent) => void;
28
+ }
29
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@emotion/react").SerializedStyles;
2
+ export default _default;
@@ -0,0 +1,35 @@
1
+ import { PureComponent } from 'react';
2
+ import { CategoryPreferences, Destination, ConsentManagerProps, PreferenceDialogTemplate } from '../types';
3
+ export default class ConsentManager extends PureComponent<ConsentManagerProps, {}> {
4
+ static displayName: string;
5
+ static defaultProps: {
6
+ options: undefined;
7
+ shouldRequireConsent: () => boolean;
8
+ implyConsentOnInteraction: boolean;
9
+ onError: undefined;
10
+ cookieDomain: undefined;
11
+ cookieName: undefined;
12
+ cookieExpires: undefined;
13
+ cookieAttributes: {};
14
+ customCategories: undefined;
15
+ bannerActionsBlock: undefined;
16
+ bannerHideCloseButton: boolean;
17
+ bannerTextColor: string;
18
+ bannerContent: string;
19
+ bannerSubContent: string;
20
+ bannerBackgroundColor: string;
21
+ preferencesDialogTitle: string;
22
+ preferencesDialogContent: JSX.Element;
23
+ cancelDialogTitle: string;
24
+ cancelDialogContent: string;
25
+ defaultDestinationBehavior: string;
26
+ preferencesDialogTemplate: PreferenceDialogTemplate;
27
+ };
28
+ render(): JSX.Element;
29
+ mergeTemplates: (newProps: PreferenceDialogTemplate, defaultPreferencesDialogTemplate: PreferenceDialogTemplate) => PreferenceDialogTemplate;
30
+ getInitialPreferences: () => {};
31
+ handleMapCustomPreferences: (destinations: Destination[], preferences: CategoryPreferences) => {
32
+ destinationPreferences: {};
33
+ customPreferences: {};
34
+ };
35
+ }
@@ -0,0 +1,32 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { Destination, CustomCategories, CategoryPreferences, PreferenceDialogTemplate } from '../types';
3
+ interface PreferenceDialogProps {
4
+ innerRef: (element: HTMLElement | null) => void;
5
+ onCancel: () => void;
6
+ onSave: () => void;
7
+ onChange: (name: string, value: boolean) => void;
8
+ marketingDestinations: Destination[];
9
+ advertisingDestinations: Destination[];
10
+ functionalDestinations: Destination[];
11
+ marketingAndAnalytics?: boolean | null;
12
+ advertising?: boolean | null;
13
+ functional?: boolean | null;
14
+ customCategories?: CustomCategories;
15
+ destinations: Destination[];
16
+ preferences: CategoryPreferences;
17
+ title: React.ReactNode;
18
+ content: React.ReactNode;
19
+ preferencesDialogTemplate?: PreferenceDialogTemplate;
20
+ }
21
+ export default class PreferenceDialog extends PureComponent<PreferenceDialogProps, {}> {
22
+ static displayName: string;
23
+ static defaultProps: {
24
+ marketingAndAnalytics: null;
25
+ advertising: null;
26
+ functional: null;
27
+ };
28
+ render(): JSX.Element;
29
+ handleChange: (e: any) => void;
30
+ handleSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
31
+ }
32
+ export {};
@@ -0,0 +1,14 @@
1
+ import { Destination, DefaultDestinationBehavior, CategoryPreferences, HtEventsBrowserOptions } from '../types';
2
+ interface AnalyticsParams {
3
+ writeKey: string;
4
+ options?: HtEventsBrowserOptions;
5
+ destinations: Destination[];
6
+ destinationPreferences: CategoryPreferences | null | undefined;
7
+ isConsentRequired: boolean;
8
+ shouldReload?: boolean;
9
+ devMode?: boolean;
10
+ defaultDestinationBehavior?: DefaultDestinationBehavior;
11
+ categoryPreferences: CategoryPreferences | null | undefined;
12
+ }
13
+ export default function conditionallyLoadAnalytics({ writeKey, options, destinations, destinationPreferences, isConsentRequired, shouldReload, devMode, defaultDestinationBehavior, categoryPreferences }: AnalyticsParams): void;
14
+ export {};
@@ -0,0 +1,2 @@
1
+ import { Destination } from '../types';
2
+ export default function fetchDestinations(cdnHost: string, writeKeys: string[]): Promise<Destination[]>;
@@ -0,0 +1,126 @@
1
+ import { Component } from 'react';
2
+ import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior, HtEventsBrowserOptions } from '../types';
3
+ import { CookieAttributes } from 'js-cookie';
4
+ interface Props {
5
+ /** Your Hightouch Write key for your website */
6
+ writeKey: string;
7
+ /** Options to pass to Hightouch Events Browser SDK */
8
+ options?: HtEventsBrowserOptions;
9
+ cookieDomain?: string;
10
+ cookieName?: string;
11
+ cookieAttributes?: CookieAttributes;
12
+ /**
13
+ * Number of days until the preferences cookie should expire
14
+ */
15
+ cookieExpires?: number;
16
+ /**
17
+ * An initial selection of Preferences
18
+ */
19
+ initialPreferences?: CategoryPreferences;
20
+ /**
21
+ * Provide a function to define whether or not consent should be required
22
+ */
23
+ shouldRequireConsent?: () => Promise<boolean> | boolean;
24
+ /**
25
+ * Render props for the Consent Manager builder
26
+ */
27
+ children: (props: RenderProps) => React.ReactElement;
28
+ /**
29
+ * Allows for customizing how to show different categories of consent.
30
+ */
31
+ mapCustomPreferences?: (destinations: Destination[], preferences: CategoryPreferences) => {
32
+ destinationPreferences: CategoryPreferences;
33
+ customPreferences: CategoryPreferences;
34
+ };
35
+ /**
36
+ * Allows for adding custom consent categories by mapping a custom category to Hightouch integrations
37
+ */
38
+ customCategories?: CustomCategories;
39
+ /**
40
+ * Specified default behavior for when new destinations are detected on the source(s) of this consent manager.
41
+ */
42
+ defaultDestinationBehavior?: DefaultDestinationBehavior;
43
+ /**
44
+ * A callback for dealing with errors in the Consent Manager
45
+ */
46
+ onError?: (err: Error) => void | Promise<void>;
47
+ /**
48
+ * CDN to fetch list of integrations from
49
+ */
50
+ cdnHost?: string;
51
+ /**
52
+ * Default true
53
+ * Reload the page if the trackers have already been initialized so that
54
+ * the user's new preferences can take effect.
55
+ */
56
+ shouldReload?: boolean;
57
+ /**
58
+ * Default false
59
+ * Disable htevents.load for local testing.
60
+ */
61
+ devMode?: boolean;
62
+ /**
63
+ * Default false
64
+ * Use default categories set by Consent Manager instead of destinations
65
+ */
66
+ useDefaultCategories?: boolean;
67
+ }
68
+ interface RenderProps {
69
+ destinations: Destination[];
70
+ newDestinations: Destination[];
71
+ preferences: CategoryPreferences;
72
+ destinationPreferences: CategoryPreferences;
73
+ isConsentRequired: boolean;
74
+ customCategories?: CustomCategories;
75
+ havePreferencesChanged: boolean;
76
+ workspaceAddedNewDestinations: boolean;
77
+ setPreferences: (newPreferences: CategoryPreferences) => void;
78
+ resetPreferences: () => void;
79
+ saveConsent: (newPreferences?: CategoryPreferences | boolean, shouldReload?: boolean, devMode?: boolean) => void;
80
+ }
81
+ interface State {
82
+ isLoading: boolean;
83
+ destinations: Destination[];
84
+ newDestinations: Destination[];
85
+ preferences?: CategoryPreferences;
86
+ destinationPreferences?: CategoryPreferences;
87
+ isConsentRequired: boolean;
88
+ havePreferencesChanged: boolean;
89
+ workspaceAddedNewDestinations: boolean;
90
+ }
91
+ export default class ConsentManagerBuilder extends Component<Props, State> {
92
+ static displayName: string;
93
+ static defaultProps: {
94
+ options: undefined;
95
+ onError: undefined;
96
+ shouldRequireConsent: () => boolean;
97
+ initialPreferences: {};
98
+ cdnHost: string;
99
+ shouldReload: boolean;
100
+ devMode: boolean;
101
+ useDefaultCategories: boolean;
102
+ };
103
+ state: {
104
+ isLoading: boolean;
105
+ destinations: never[];
106
+ newDestinations: never[];
107
+ preferences: {};
108
+ destinationPreferences: {};
109
+ isConsentRequired: boolean;
110
+ havePreferencesChanged: boolean;
111
+ workspaceAddedNewDestinations: boolean;
112
+ useDefaultCategories: boolean;
113
+ };
114
+ render(): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, any> | null) | (new (props: any) => Component<any, any, any>)> | null;
115
+ componentDidMount(): Promise<void>;
116
+ initialise: () => Promise<void>;
117
+ handleSetPreferences: (newPreferences: CategoryPreferences) => void;
118
+ handleResetPreferences: () => void;
119
+ handleSaveConsent: (newPreferences: CategoryPreferences | undefined, shouldReload: boolean, devMode?: boolean | undefined) => void;
120
+ mergePreferences: (args: {
121
+ destinations: Destination[];
122
+ existingPreferences?: CategoryPreferences | undefined;
123
+ newPreferences?: CategoryPreferences | undefined;
124
+ }) => CategoryPreferences;
125
+ }
126
+ export {};
@@ -0,0 +1,26 @@
1
+ /// <reference types="node" />
2
+ import { CookieAttributes } from 'js-cookie';
3
+ import { Preferences } from '../types';
4
+ import { EventEmitter } from 'events';
5
+ export declare const DEFAULT_COOKIE_NAME = "ht-cm-preferences";
6
+ export interface PreferencesManager {
7
+ loadPreferences(cookieName?: string): Preferences;
8
+ onPreferencesSaved(listener: (prefs: Preferences) => void): void;
9
+ savePreferences(prefs: SavePreferences): void;
10
+ }
11
+ export declare function loadPreferences(cookieName?: string): Preferences;
12
+ declare type SavePreferences = Preferences & {
13
+ cookieDomain?: string;
14
+ cookieName?: string;
15
+ cookieExpires?: number;
16
+ cookieAttributes?: CookieAttributes;
17
+ };
18
+ /**
19
+ * Subscribes to consent preferences changing over time and returns
20
+ * a cleanup function that can be invoked to remove the instantiated listener.
21
+ *
22
+ * @param listener a function to be invoked when ConsentPreferences are saved
23
+ */
24
+ export declare function onPreferencesSaved(listener: (prefs: Preferences) => void): () => EventEmitter;
25
+ export declare function savePreferences({ destinationPreferences, customPreferences, cookieDomain, cookieName, cookieExpires, cookieAttributes }: SavePreferences): void;
26
+ export {};
@@ -0,0 +1,7 @@
1
+ import CMB from './consent-manager-builder';
2
+ import CM from './consent-manager';
3
+ export { openDialog as openConsentManager } from './consent-manager/container';
4
+ export { loadPreferences, savePreferences, onPreferencesSaved } from './consent-manager-builder/preferences';
5
+ export declare const ConsentManagerBuilder: typeof CMB;
6
+ export declare const ConsentManager: typeof CM;
7
+ export declare function doNotTrack(): boolean | null;
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,21 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { ActionsBlockProps } from '../types';
3
+ interface BannerProps {
4
+ innerRef: (node: HTMLElement | null) => void;
5
+ onClose: () => void;
6
+ onChangePreferences: () => void;
7
+ content: React.ReactNode;
8
+ subContent: string | undefined;
9
+ actionsBlock?: ((props: ActionsBlockProps) => React.ReactElement) | true;
10
+ backgroundColor: string;
11
+ textColor: string;
12
+ onAcceptAll: () => void;
13
+ onDenyAll: () => void;
14
+ hideCloseButton: boolean;
15
+ asModal?: boolean;
16
+ }
17
+ export default class Banner extends PureComponent<BannerProps> {
18
+ static displayName: string;
19
+ render(): JSX.Element;
20
+ }
21
+ export {};
@@ -0,0 +1,13 @@
1
+ /// <reference types="react" />
2
+ export declare const DefaultButton: import("@emotion/styled").StyledComponent<{
3
+ theme?: import("@emotion/react").Theme | undefined;
4
+ as?: "symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | import("react").FunctionComponent<any> | "big" | "keygen" | "menuitem" | "noindex" | "webview" | "animate" | "animateMotion" | "animateTransform" | "feDropShadow" | "mpath" | import("react").ComponentClass<any, any> | undefined;
5
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
6
+ export declare const GreenButton: import("@emotion/styled").StyledComponent<{
7
+ theme?: import("@emotion/react").Theme | undefined;
8
+ as?: "symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | import("react").FunctionComponent<any> | "big" | "keygen" | "menuitem" | "noindex" | "webview" | "animate" | "animateMotion" | "animateTransform" | "feDropShadow" | "mpath" | import("react").ComponentClass<any, any> | undefined;
9
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
10
+ export declare const RedButton: import("@emotion/styled").StyledComponent<{
11
+ theme?: import("@emotion/react").Theme | undefined;
12
+ as?: "symbol" | "object" | "a" | "abbr" | "address" | "area" | "article" | "aside" | "audio" | "b" | "base" | "bdi" | "bdo" | "blockquote" | "body" | "br" | "button" | "canvas" | "caption" | "cite" | "code" | "col" | "colgroup" | "data" | "datalist" | "dd" | "del" | "details" | "dfn" | "dialog" | "div" | "dl" | "dt" | "em" | "embed" | "fieldset" | "figcaption" | "figure" | "footer" | "form" | "h1" | "h2" | "h3" | "h4" | "h5" | "h6" | "head" | "header" | "hgroup" | "hr" | "html" | "i" | "iframe" | "img" | "input" | "ins" | "kbd" | "label" | "legend" | "li" | "link" | "main" | "map" | "mark" | "menu" | "meta" | "meter" | "nav" | "noscript" | "ol" | "optgroup" | "option" | "output" | "p" | "param" | "picture" | "pre" | "progress" | "q" | "rp" | "rt" | "ruby" | "s" | "samp" | "script" | "section" | "select" | "slot" | "small" | "source" | "span" | "strong" | "style" | "sub" | "summary" | "sup" | "table" | "tbody" | "td" | "template" | "textarea" | "tfoot" | "th" | "thead" | "time" | "title" | "tr" | "track" | "u" | "ul" | "var" | "video" | "wbr" | "circle" | "clipPath" | "defs" | "desc" | "ellipse" | "feBlend" | "feColorMatrix" | "feComponentTransfer" | "feComposite" | "feConvolveMatrix" | "feDiffuseLighting" | "feDisplacementMap" | "feDistantLight" | "feFlood" | "feFuncA" | "feFuncB" | "feFuncG" | "feFuncR" | "feGaussianBlur" | "feImage" | "feMerge" | "feMergeNode" | "feMorphology" | "feOffset" | "fePointLight" | "feSpecularLighting" | "feSpotLight" | "feTile" | "feTurbulence" | "filter" | "foreignObject" | "g" | "image" | "line" | "linearGradient" | "marker" | "mask" | "metadata" | "path" | "pattern" | "polygon" | "polyline" | "radialGradient" | "rect" | "stop" | "svg" | "switch" | "text" | "textPath" | "tspan" | "use" | "view" | import("react").FunctionComponent<any> | "big" | "keygen" | "menuitem" | "noindex" | "webview" | "animate" | "animateMotion" | "animateTransform" | "feDropShadow" | "mpath" | import("react").ComponentClass<any, any> | undefined;
13
+ }, import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, {}>;
@@ -0,0 +1,19 @@
1
+ import React, { PureComponent } from 'react';
2
+ import { PreferenceDialogTemplate } from '../types';
3
+ interface Props {
4
+ innerRef: (node: HTMLElement) => void;
5
+ onBack: () => void;
6
+ onConfirm: () => void;
7
+ title: React.ReactNode;
8
+ content: React.ReactNode;
9
+ preferencesDialogTemplate?: PreferenceDialogTemplate;
10
+ }
11
+ export default class CancelDialog extends PureComponent<Props> {
12
+ static displayName: string;
13
+ render(): JSX.Element;
14
+ componentDidMount(): void;
15
+ componentWillUnmount(): void;
16
+ handleSubmit: (e: any) => void;
17
+ handleEsc: (e: KeyboardEvent) => void;
18
+ }
19
+ export {};
@@ -0,0 +1,3 @@
1
+ export declare const MARKETING_AND_ANALYTICS_CATEGORIES: string[];
2
+ export declare const ADVERTISING_CATEGORIES: string[];
3
+ export declare const FUNCTIONAL_CATEGORIES: string[];
@@ -0,0 +1,35 @@
1
+ import React from 'react';
2
+ import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior, ActionsBlockProps, PreferenceDialogTemplate, CloseBehavior } from '../types';
3
+ export declare function openDialog(): void;
4
+ export interface CloseBehaviorFunction {
5
+ (categories: CategoryPreferences): CategoryPreferences;
6
+ }
7
+ interface ContainerProps {
8
+ setPreferences: (prefs: CategoryPreferences) => void;
9
+ saveConsent: (newPreferences?: CategoryPreferences, shouldReload?: boolean, devMode?: boolean) => void;
10
+ resetPreferences: () => void;
11
+ closeBehavior?: CloseBehavior | CloseBehaviorFunction;
12
+ destinations: Destination[];
13
+ customCategories?: CustomCategories | undefined;
14
+ newDestinations: Destination[];
15
+ preferences: CategoryPreferences;
16
+ havePreferencesChanged: boolean;
17
+ isConsentRequired: boolean;
18
+ implyConsentOnInteraction: boolean;
19
+ bannerContent: React.ReactNode;
20
+ bannerSubContent: string | undefined;
21
+ bannerActionsBlock?: ((props: ActionsBlockProps) => React.ReactElement) | true;
22
+ bannerTextColor: string;
23
+ bannerBackgroundColor: string;
24
+ bannerHideCloseButton: boolean;
25
+ bannerAsModal?: boolean;
26
+ preferencesDialogTitle: React.ReactNode;
27
+ preferencesDialogContent: React.ReactNode;
28
+ cancelDialogTitle: React.ReactNode;
29
+ cancelDialogContent: React.ReactNode;
30
+ workspaceAddedNewDestinations?: boolean;
31
+ defaultDestinationBehavior?: DefaultDestinationBehavior;
32
+ preferencesDialogTemplate?: PreferenceDialogTemplate;
33
+ }
34
+ declare const Container: React.FC<ContainerProps>;
35
+ export default Container;
@@ -0,0 +1,29 @@
1
+ import React, { PureComponent } from 'react';
2
+ interface DialogProps {
3
+ innerRef: (element: HTMLElement | null) => void;
4
+ onCancel?: () => void;
5
+ onSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
6
+ title: React.ReactNode;
7
+ buttons: React.ReactNode;
8
+ width?: string;
9
+ }
10
+ export default class Dialog extends PureComponent<DialogProps, {}> {
11
+ static displayName: string;
12
+ private titleId;
13
+ private container;
14
+ private root;
15
+ private form;
16
+ static defaultProps: {
17
+ onCancel: undefined;
18
+ width: string;
19
+ };
20
+ constructor(props: DialogProps);
21
+ render(): React.ReactPortal;
22
+ componentDidMount(): void;
23
+ componentWillUnmount(): void;
24
+ handleRootRef: (node: HTMLElement) => void;
25
+ handleFormRef: (node: HTMLFormElement) => void;
26
+ handleOverlayClick: (e: any) => void;
27
+ handleEsc: (e: KeyboardEvent) => void;
28
+ }
29
+ export {};
@@ -0,0 +1,2 @@
1
+ declare const _default: import("@emotion/react").SerializedStyles;
2
+ export default _default;
@@ -0,0 +1,35 @@
1
+ import { PureComponent } from 'react';
2
+ import { CategoryPreferences, Destination, ConsentManagerProps, PreferenceDialogTemplate } from '../types';
3
+ export default class ConsentManager extends PureComponent<ConsentManagerProps, {}> {
4
+ static displayName: string;
5
+ static defaultProps: {
6
+ options: undefined;
7
+ shouldRequireConsent: () => boolean;
8
+ implyConsentOnInteraction: boolean;
9
+ onError: undefined;
10
+ cookieDomain: undefined;
11
+ cookieName: undefined;
12
+ cookieExpires: undefined;
13
+ cookieAttributes: {};
14
+ customCategories: undefined;
15
+ bannerActionsBlock: undefined;
16
+ bannerHideCloseButton: boolean;
17
+ bannerTextColor: string;
18
+ bannerContent: string;
19
+ bannerSubContent: string;
20
+ bannerBackgroundColor: string;
21
+ preferencesDialogTitle: string;
22
+ preferencesDialogContent: JSX.Element;
23
+ cancelDialogTitle: string;
24
+ cancelDialogContent: string;
25
+ defaultDestinationBehavior: string;
26
+ preferencesDialogTemplate: PreferenceDialogTemplate;
27
+ };
28
+ render(): JSX.Element;
29
+ mergeTemplates: (newProps: PreferenceDialogTemplate, defaultPreferencesDialogTemplate: PreferenceDialogTemplate) => PreferenceDialogTemplate;
30
+ getInitialPreferences: () => {};
31
+ handleMapCustomPreferences: (destinations: Destination[], preferences: CategoryPreferences) => {
32
+ destinationPreferences: {};
33
+ customPreferences: {};
34
+ };
35
+ }