@muchbetteradventures/consent-manager 5.7.1-beta.2 → 5.8.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.
Files changed (83) hide show
  1. package/README.md +2 -2
  2. package/commonjs/__tests__/consent-manager-builder/analytics.test.js +12 -12
  3. package/commonjs/__tests__/consent-manager-builder/fetch-destinations.test.js +10 -10
  4. package/commonjs/__tests__/consent-manager-builder/index.todo.js +17 -17
  5. package/commonjs/__tests__/consent-manager-builder/preferences.test.js +4 -4
  6. package/commonjs/__tests__/index.test.js +12 -12
  7. package/commonjs/consent-manager/banner.js +58 -31
  8. package/commonjs/consent-manager/buttons.js +62 -13
  9. package/commonjs/consent-manager/categories.js +2 -1
  10. package/commonjs/consent-manager/container.js +6 -6
  11. package/commonjs/consent-manager/dialog.js +47 -19
  12. package/commonjs/consent-manager/font-styles.js +2 -2
  13. package/commonjs/consent-manager/index.js +40 -13
  14. package/commonjs/consent-manager/preference-dialog.js +50 -22
  15. package/commonjs/consent-manager-builder/analytics.js +3 -3
  16. package/commonjs/consent-manager-builder/fetch-destinations.js +9 -9
  17. package/commonjs/consent-manager-builder/index.js +22 -18
  18. package/commonjs/consent-manager-builder/preferences.js +7 -6
  19. package/commonjs/hooks.js +4 -2
  20. package/commonjs/index.js +9 -7
  21. package/commonjs/standalone.js +41 -14
  22. package/esm/__tests__/consent-manager-builder/fetch-destinations.test.js +3 -3
  23. package/esm/__tests__/consent-manager-builder/index.todo.js +1 -1
  24. package/esm/__tests__/consent-manager-builder/preferences.test.js +1 -1
  25. package/esm/consent-manager/banner.js +26 -25
  26. package/esm/consent-manager/buttons.js +29 -7
  27. package/esm/consent-manager/container.js +5 -5
  28. package/esm/consent-manager/dialog.js +4 -2
  29. package/esm/consent-manager/index.js +7 -6
  30. package/esm/consent-manager/preference-dialog.js +10 -8
  31. package/esm/consent-manager-builder/analytics.js +1 -1
  32. package/esm/consent-manager-builder/fetch-destinations.js +6 -6
  33. package/esm/consent-manager-builder/index.js +16 -12
  34. package/esm/consent-manager-builder/preferences.js +1 -1
  35. package/esm/hooks.js +1 -1
  36. package/esm/index.js +3 -2
  37. package/esm/standalone.js +5 -5
  38. package/esm/types.js +1 -0
  39. package/package.json +13 -7
  40. package/standalone/consent-manager.js +3 -3
  41. package/standalone/consent-manager.js.map +1 -1
  42. package/types/consent-manager/banner.d.ts +4 -2
  43. package/types/consent-manager/buttons.d.ts +6 -11
  44. package/types/consent-manager/container.d.ts +5 -2
  45. package/types/consent-manager/index.d.ts +0 -1
  46. package/types/consent-manager-builder/index.d.ts +3 -4
  47. package/types/consent-manager-builder/preferences.d.ts +4 -5
  48. package/types/types.d.ts +10 -10
  49. package/types/src/__tests__/consent-manager-builder/analytics.test.d.ts +0 -1
  50. package/types/src/__tests__/consent-manager-builder/fetch-destinations.test.d.ts +0 -1
  51. package/types/src/__tests__/consent-manager-builder/preferences.test.d.ts +0 -1
  52. package/types/src/__tests__/index.test.d.ts +0 -1
  53. package/types/src/consent-manager/banner.d.ts +0 -20
  54. package/types/src/consent-manager/buttons.d.ts +0 -15
  55. package/types/src/consent-manager/categories.d.ts +0 -3
  56. package/types/src/consent-manager/container.d.ts +0 -36
  57. package/types/src/consent-manager/dialog.d.ts +0 -29
  58. package/types/src/consent-manager/font-styles.d.ts +0 -2
  59. package/types/src/consent-manager/index.d.ts +0 -26
  60. package/types/src/consent-manager/preference-dialog.d.ts +0 -33
  61. package/types/src/consent-manager-builder/analytics.d.ts +0 -12
  62. package/types/src/consent-manager-builder/fetch-destinations.d.ts +0 -2
  63. package/types/src/consent-manager-builder/index.d.ts +0 -101
  64. package/types/src/consent-manager-builder/preferences.d.ts +0 -30
  65. package/types/src/hooks.d.ts +0 -1
  66. package/types/src/index.d.ts +0 -7
  67. package/types/src/standalone.d.ts +0 -5
  68. package/types/src/types.d.ts +0 -87
  69. package/types/stories/0-consent-manager.stories.d.ts +0 -1
  70. package/types/stories/0.1-consent-manager-close-interaction.stories.d.ts +0 -1
  71. package/types/stories/1-standalone.stories.d.ts +0 -1
  72. package/types/stories/1.1-standalone-custom.stories.d.ts +0 -1
  73. package/types/stories/2-category-based.stories.d.ts +0 -1
  74. package/types/stories/3-tool-based.stories.d.ts +0 -1
  75. package/types/stories/4-custom-consent.stories.d.ts +0 -1
  76. package/types/stories/5-custom-categories.stories.d.ts +0 -1
  77. package/types/stories/6-ccpa-gdpr-example.stories.d.ts +0 -1
  78. package/types/stories/7-default-destination-behavior.stories.d.ts +0 -1
  79. package/types/stories/8-floating-banner.stories.d.ts +0 -1
  80. package/types/stories/ImplyConsentOnInteraction.d.ts +0 -2
  81. package/types/stories/components/CookieView.d.ts +0 -3
  82. package/types/stories/components/common-react.d.ts +0 -5
  83. package/types/stories/components/destination-tile.d.ts +0 -15
@@ -1,6 +1,5 @@
1
1
  import React, { PureComponent } from 'react';
2
2
  import { CloseBehavior, CloseBehaviorFunction } from './container';
3
- import { BannerMode } from '../types';
4
3
  interface Props {
5
4
  innerRef: (node: HTMLElement | null) => void;
6
5
  onClose: (forceCloseBehaviour?: CloseBehavior | CloseBehaviorFunction) => void;
@@ -10,7 +9,10 @@ interface Props {
10
9
  backgroundColor: string;
11
10
  textColor: string;
12
11
  showRejectAll: boolean;
13
- bannerMode: BannerMode;
12
+ privacyPolicyLinkHref: string;
13
+ privacyPolicyLinkText?: string;
14
+ cookiePolicyLinkHref: string;
15
+ cookiePolicyLinkText?: string;
14
16
  }
15
17
  export default class Banner extends PureComponent<Props> {
16
18
  static displayName: string;
@@ -1,14 +1,9 @@
1
- /// <reference types="react" />
2
- /// <reference types="emotion" />
3
- export declare const DefaultButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
4
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
1
+ export declare const PrimaryButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
2
+ innerRef?: import("react").LegacyRef<HTMLButtonElement> | undefined;
5
3
  }>;
6
- export declare const TextButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
7
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
4
+ export declare const SecondaryButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
5
+ innerRef?: import("react").LegacyRef<HTMLButtonElement> | undefined;
8
6
  }>;
9
- export declare const GreenButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
10
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
11
- }>;
12
- export declare const RedButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
13
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
7
+ export declare const TertiaryButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
+ innerRef?: import("react").LegacyRef<HTMLButtonElement> | undefined;
14
9
  }>;
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior, BannerMode } from '../types';
2
+ import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior } from '../types';
3
3
  export declare function openDialog(): void;
4
4
  export declare const enum CloseBehavior {
5
5
  ACCEPT = "accept",
@@ -25,12 +25,15 @@ interface ContainerProps {
25
25
  bannerSubContent: React.ReactNode;
26
26
  bannerTextColor: string;
27
27
  bannerBackgroundColor: string;
28
+ privacyPolicyLinkHref: string;
29
+ privacyPolicyLinkText?: string;
30
+ cookiePolicyLinkHref: string;
31
+ cookiePolicyLinkText?: string;
28
32
  preferencesDialogTitle: React.ReactNode;
29
33
  preferencesDialogContent: React.ReactNode;
30
34
  workspaceAddedNewDestinations?: boolean;
31
35
  defaultDestinationBehavior?: DefaultDestinationBehavior;
32
36
  showRejectAll: boolean;
33
- bannerMode: BannerMode;
34
37
  }
35
38
  declare const Container: React.FC<ContainerProps>;
36
39
  export default Container;
@@ -15,7 +15,6 @@ export default class ConsentManager extends PureComponent<ConsentManagerProps, {
15
15
  preferencesDialogTitle: string;
16
16
  defaultDestinationBehavior: string;
17
17
  showRejectAll: boolean;
18
- bannerMode: "blocking";
19
18
  };
20
19
  render(): JSX.Element;
21
20
  getInitialPreferences: () => {};
@@ -1,4 +1,3 @@
1
- /// <reference types="emotion" />
2
1
  import { Component } from 'react';
3
2
  import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior } from '../types';
4
3
  interface Props {
@@ -85,7 +84,7 @@ export default class ConsentManagerBuilder extends Component<Props, State> {
85
84
  havePreferencesChanged: boolean;
86
85
  workspaceAddedNewDestinations: boolean;
87
86
  };
88
- render(): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)> | null;
87
+ render(): import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | null;
89
88
  componentDidMount(): Promise<void>;
90
89
  initialise: () => Promise<void>;
91
90
  handleSetPreferences: (newPreferences: CategoryPreferences) => void;
@@ -93,8 +92,8 @@ export default class ConsentManagerBuilder extends Component<Props, State> {
93
92
  handleSaveConsent: (newPreferences: CategoryPreferences | undefined, shouldReload: boolean) => void;
94
93
  mergePreferences: (args: {
95
94
  destinations: Destination[];
96
- existingPreferences?: CategoryPreferences | undefined;
97
- newPreferences?: CategoryPreferences | undefined;
95
+ existingPreferences?: CategoryPreferences;
96
+ newPreferences?: CategoryPreferences;
98
97
  }) => CategoryPreferences;
99
98
  }
100
99
  export {};
@@ -1,4 +1,3 @@
1
- /// <reference types="node" />
2
1
  import { Preferences } from '../types';
3
2
  import { EventEmitter } from 'events';
4
3
  export interface PreferencesManager {
@@ -8,23 +7,23 @@ export interface PreferencesManager {
8
7
  savePreferences(prefs: SavePreferences): void;
9
8
  }
10
9
  export declare function loadPreferences(): Preferences;
11
- declare type SavePreferences = Preferences & {
10
+ type SavePreferences = Preferences & {
12
11
  cookieDomain?: string;
13
12
  };
14
- export declare const emitter: EventEmitter;
13
+ export declare const emitter: EventEmitter<[never]>;
15
14
  /**
16
15
  * Subscribes to consent preferences changing over time and returns
17
16
  * a cleanup function that can be invoked to remove the instantiated listener.
18
17
  *
19
18
  * @param listener a function to be invoked when ConsentPreferences are saved
20
19
  */
21
- export declare function onPreferencesSaved(listener: (prefs: Preferences) => void): () => EventEmitter;
20
+ export declare function onPreferencesSaved(listener: (prefs: Preferences) => void): () => EventEmitter<[never]>;
22
21
  /**
23
22
  * Subscribes to consent preferences changing over time and returns
24
23
  * a cleanup function that can be invoked to remove the instantiated listener.
25
24
  *
26
25
  * @param listener a function to be invoked when ConsentPreferences are saved
27
26
  */
28
- export declare function onWillShowBanner(listener: (prefs: Preferences) => void): () => EventEmitter;
27
+ export declare function onWillShowBanner(listener: (prefs: Preferences) => void): () => EventEmitter<[never]>;
29
28
  export declare function savePreferences({ destinationPreferences, customPreferences, cookieDomain }: SavePreferences): void;
30
29
  export {};
package/types/types.d.ts CHANGED
@@ -1,15 +1,13 @@
1
- /// <reference types="react" />
2
- /// <reference types="segment-analytics" />
3
1
  import { CloseBehavior, CloseBehaviorFunction } from './consent-manager/container';
4
2
  import { PreferencesManager } from './consent-manager-builder/preferences';
5
- declare type AJS = SegmentAnalytics.AnalyticsJS & {
3
+ type AJS = SegmentAnalytics.AnalyticsJS & {
6
4
  initialized: boolean;
7
5
  track: (event: string, properties: {
8
6
  [key: string]: any;
9
7
  }) => void;
10
8
  addSourceMiddleware: (middleware: Middleware) => void;
11
9
  };
12
- export declare type Middleware = (input: MiddlewareInput) => void;
10
+ export type Middleware = (input: MiddlewareInput) => void;
13
11
  interface MiddlewareInput {
14
12
  payload: {
15
13
  obj: Record<string, any>;
@@ -18,17 +16,16 @@ interface MiddlewareInput {
18
16
  integrations?: Record<string, boolean>;
19
17
  next: (payload: MiddlewareInput['payload']) => void;
20
18
  }
21
- export declare type WindowWithAJS = Window & typeof globalThis & {
19
+ export type WindowWithAJS = Window & typeof globalThis & {
22
20
  analytics?: AJS;
23
21
  };
24
- export declare type WindowWithConsentManagerConfig = Window & typeof globalThis & {
22
+ export type WindowWithConsentManagerConfig = Window & typeof globalThis & {
25
23
  consentManagerConfig?: (args: StandaloneConsentManagerParams) => ConsentManagerInput | ConsentManagerInput;
26
24
  };
27
- export declare type ConsentManagerInput = ConsentManagerProps & {
25
+ export type ConsentManagerInput = ConsentManagerProps & {
28
26
  container: string;
29
27
  };
30
- export declare type DefaultDestinationBehavior = 'enable' | 'disable' | 'imply' | 'ask';
31
- export declare type BannerMode = 'blocking' | 'floating';
28
+ export type DefaultDestinationBehavior = 'enable' | 'disable' | 'imply' | 'ask';
32
29
  interface StandaloneConsentManagerParams {
33
30
  React: unknown;
34
31
  version?: string;
@@ -73,6 +70,10 @@ export interface ConsentManagerProps {
73
70
  bannerSubContent?: string;
74
71
  bannerTextColor?: string;
75
72
  bannerBackgroundColor?: string;
73
+ privacyPolicyLinkHref: string;
74
+ privacyPolicyLinkText?: string;
75
+ cookiePolicyLinkHref: string;
76
+ cookiePolicyLinkText?: string;
76
77
  preferencesDialogTitle?: React.ReactNode;
77
78
  preferencesDialogContent: React.ReactNode;
78
79
  onError?: (error: Error | undefined) => void;
@@ -82,6 +83,5 @@ export interface ConsentManagerProps {
82
83
  defaultDestinationBehavior?: DefaultDestinationBehavior;
83
84
  cdnHost?: string;
84
85
  showRejectAll: boolean;
85
- bannerMode?: BannerMode;
86
86
  }
87
87
  export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1,20 +0,0 @@
1
- import React, { PureComponent } from 'react';
2
- import { CloseBehavior, CloseBehaviorFunction } from './container';
3
- import { BannerMode } from '../types';
4
- interface Props {
5
- innerRef: (node: HTMLElement | null) => void;
6
- onClose: (forceCloseBehaviour?: CloseBehavior | CloseBehaviorFunction) => void;
7
- onChangePreferences: () => void;
8
- content: React.ReactNode;
9
- subContent: React.ReactNode;
10
- backgroundColor: string;
11
- textColor: string;
12
- showRejectAll: boolean;
13
- bannerMode: BannerMode;
14
- }
15
- export default class Banner extends PureComponent<Props> {
16
- static displayName: string;
17
- componentDidMount(): void;
18
- render(): JSX.Element;
19
- }
20
- export {};
@@ -1,15 +0,0 @@
1
- /// <reference types="react" />
2
- /// <reference types="emotion" />
3
- /// <reference types="@emotion/core" />
4
- export declare const DefaultButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
5
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
6
- }>;
7
- export declare const TextButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
8
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
9
- }>;
10
- export declare const GreenButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
11
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
12
- }>;
13
- export declare const RedButton: import("react-emotion").StyledComponent<unknown, any, import("react").ClassAttributes<HTMLButtonElement> & import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
14
- innerRef?: string | ((instance: HTMLButtonElement | null) => void) | import("react").RefObject<HTMLButtonElement> | null | undefined;
15
- }>;
@@ -1,3 +0,0 @@
1
- export declare const MARKETING_AND_ANALYTICS_CATEGORIES: string[];
2
- export declare const ADVERTISING_CATEGORIES: string[];
3
- export declare const FUNCTIONAL_CATEGORIES: string[];
@@ -1,36 +0,0 @@
1
- import React from 'react';
2
- import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior, BannerMode } from '../types';
3
- export declare function openDialog(): void;
4
- export declare const enum CloseBehavior {
5
- ACCEPT = "accept",
6
- DENY = "deny",
7
- DISMISS = "dismiss"
8
- }
9
- export interface CloseBehaviorFunction {
10
- (categories: CategoryPreferences): CategoryPreferences;
11
- }
12
- interface ContainerProps {
13
- setPreferences: (prefs: CategoryPreferences) => void;
14
- saveConsent: (newPreferences?: CategoryPreferences, shouldReload?: boolean) => void;
15
- resetPreferences: () => void;
16
- closeBehavior?: CloseBehavior | CloseBehaviorFunction;
17
- destinations: Destination[];
18
- customCategories?: CustomCategories | undefined;
19
- newDestinations: Destination[];
20
- preferences: CategoryPreferences;
21
- havePreferencesChanged: boolean;
22
- isConsentRequired: boolean;
23
- implyConsentOnInteraction: boolean;
24
- bannerContent: React.ReactNode;
25
- bannerSubContent: React.ReactNode;
26
- bannerTextColor: string;
27
- bannerBackgroundColor: string;
28
- preferencesDialogTitle: React.ReactNode;
29
- preferencesDialogContent: React.ReactNode;
30
- workspaceAddedNewDestinations?: boolean;
31
- defaultDestinationBehavior?: DefaultDestinationBehavior;
32
- showRejectAll: boolean;
33
- bannerMode: BannerMode;
34
- }
35
- declare const Container: React.FC<ContainerProps>;
36
- export default Container;
@@ -1,29 +0,0 @@
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 {};
@@ -1,2 +0,0 @@
1
- declare const _default: string;
2
- export default _default;
@@ -1,26 +0,0 @@
1
- import { PureComponent } from 'react';
2
- import { CategoryPreferences, Destination, ConsentManagerProps } from '../types';
3
- export default class ConsentManager extends PureComponent<ConsentManagerProps, {}> {
4
- static displayName: string;
5
- static defaultProps: {
6
- otherWriteKeys: never[];
7
- shouldRequireConsent: () => boolean;
8
- implyConsentOnInteraction: boolean;
9
- onError: undefined;
10
- cookieDomain: undefined;
11
- customCategories: undefined;
12
- bannerTextColor: string;
13
- bannerSubContent: string;
14
- bannerBackgroundColor: string;
15
- preferencesDialogTitle: string;
16
- defaultDestinationBehavior: string;
17
- showRejectAll: boolean;
18
- bannerMode: "blocking";
19
- };
20
- render(): JSX.Element;
21
- getInitialPreferences: () => {};
22
- handleMapCustomPreferences: (destinations: Destination[], preferences: CategoryPreferences) => {
23
- destinationPreferences: {};
24
- customPreferences: {};
25
- };
26
- }
@@ -1,33 +0,0 @@
1
- import React, { PureComponent } from 'react';
2
- import { Destination, CustomCategories, CategoryPreferences } from '../types';
3
- import { CloseBehavior, CloseBehaviorFunction } from './container';
4
- interface PreferenceDialogProps {
5
- innerRef: (element: HTMLElement | null) => void;
6
- onCancel: () => void;
7
- onSave: () => void;
8
- onChange: (name: string, value: boolean) => void;
9
- onClose: (forceCloseBehaviour?: CloseBehavior | CloseBehaviorFunction) => void;
10
- marketingDestinations: Destination[];
11
- advertisingDestinations: Destination[];
12
- functionalDestinations: Destination[];
13
- marketingAndAnalytics?: boolean | null;
14
- advertising?: boolean | null;
15
- functional?: boolean | null;
16
- customCategories?: CustomCategories;
17
- destinations: Destination[];
18
- preferences: CategoryPreferences;
19
- title: React.ReactNode;
20
- content: React.ReactNode;
21
- }
22
- export default class PreferenceDialog extends PureComponent<PreferenceDialogProps, {}> {
23
- static displayName: string;
24
- static defaultProps: {
25
- marketingAndAnalytics: null;
26
- advertising: null;
27
- functional: null;
28
- };
29
- render(): JSX.Element;
30
- handleChange: (e: any) => void;
31
- handleSubmit: (e: React.FormEvent<HTMLFormElement>) => void;
32
- }
33
- export {};
@@ -1,12 +0,0 @@
1
- import { CategoryPreferences, DefaultDestinationBehavior, Destination } from '../types';
2
- interface AnalyticsParams {
3
- writeKey: string;
4
- destinations: Destination[];
5
- destinationPreferences: CategoryPreferences | null | undefined;
6
- isConsentRequired: boolean;
7
- shouldReload?: boolean;
8
- defaultDestinationBehavior?: DefaultDestinationBehavior;
9
- categoryPreferences: CategoryPreferences | null | undefined;
10
- }
11
- export default function conditionallyLoadAnalytics({ writeKey, destinations, destinationPreferences, isConsentRequired, shouldReload, defaultDestinationBehavior, categoryPreferences }: AnalyticsParams): void;
12
- export {};
@@ -1,2 +0,0 @@
1
- import { Destination } from '../types';
2
- export default function fetchDestinations(cdnHost: string, writeKeys: string[]): Promise<Destination[]>;
@@ -1,101 +0,0 @@
1
- /// <reference types="emotion" />
2
- /// <reference types="@emotion/core" />
3
- import { Component } from 'react';
4
- import { Destination, CategoryPreferences, CustomCategories, DefaultDestinationBehavior } from '../types';
5
- interface Props {
6
- /** Your Segment Write key for your website */
7
- writeKey: string;
8
- /** A list of other write keys you may want to provide */
9
- otherWriteKeys?: string[];
10
- cookieDomain?: string;
11
- /**
12
- * An initial selection of Preferences
13
- */
14
- initialPreferences?: CategoryPreferences;
15
- /**
16
- * Provide a function to define whether or not consent should be required
17
- */
18
- shouldRequireConsent?: () => Promise<boolean> | boolean;
19
- /**
20
- * Render props for the Consent Manager builder
21
- */
22
- children: (props: RenderProps) => React.ReactElement;
23
- /**
24
- * Allows for customizing how to show different categories of consent.
25
- */
26
- mapCustomPreferences?: (destinations: Destination[], preferences: CategoryPreferences) => {
27
- destinationPreferences: CategoryPreferences;
28
- customPreferences: CategoryPreferences;
29
- };
30
- /**
31
- * Allows for adding custom consent categories by mapping a custom category to Segment integrations
32
- */
33
- customCategories?: CustomCategories;
34
- /**
35
- * Specified default behavior for when new destinations are detected on the source(s) of this consent manager.
36
- */
37
- defaultDestinationBehavior?: DefaultDestinationBehavior;
38
- /**
39
- * A callback for dealing with errors in the Consent Manager
40
- */
41
- onError?: (err: Error) => void | Promise<void>;
42
- /**
43
- * CDN to fetch list of integrations from
44
- */
45
- cdnHost?: string;
46
- }
47
- interface RenderProps {
48
- destinations: Destination[];
49
- newDestinations: Destination[];
50
- preferences: CategoryPreferences;
51
- destinationPreferences: CategoryPreferences;
52
- isConsentRequired: boolean;
53
- customCategories?: CustomCategories;
54
- havePreferencesChanged: boolean;
55
- workspaceAddedNewDestinations: boolean;
56
- setPreferences: (newPreferences: CategoryPreferences) => void;
57
- resetPreferences: () => void;
58
- saveConsent: (newPreferences?: CategoryPreferences | boolean, shouldReload?: boolean) => void;
59
- }
60
- interface State {
61
- isLoading: boolean;
62
- destinations: Destination[];
63
- newDestinations: Destination[];
64
- preferences?: CategoryPreferences;
65
- destinationPreferences?: CategoryPreferences;
66
- isConsentRequired: boolean;
67
- havePreferencesChanged: boolean;
68
- workspaceAddedNewDestinations: boolean;
69
- }
70
- export default class ConsentManagerBuilder extends Component<Props, State> {
71
- static displayName: string;
72
- static defaultProps: {
73
- otherWriteKeys: never[];
74
- onError: undefined;
75
- shouldRequireConsent: () => boolean;
76
- initialPreferences: {};
77
- cdnHost: string;
78
- };
79
- state: {
80
- isLoading: boolean;
81
- destinations: never[];
82
- newDestinations: never[];
83
- preferences: {};
84
- destinationPreferences: {};
85
- isConsentRequired: boolean;
86
- havePreferencesChanged: boolean;
87
- workspaceAddedNewDestinations: boolean;
88
- };
89
- render(): import("react").ReactElement<any, string | ((props: any) => import("react").ReactElement<any, string | any | (new (props: any) => Component<any, any, any>)> | null) | (new (props: any) => Component<any, any, any>)> | null;
90
- componentDidMount(): Promise<void>;
91
- initialise: () => Promise<void>;
92
- handleSetPreferences: (newPreferences: CategoryPreferences) => void;
93
- handleResetPreferences: () => void;
94
- handleSaveConsent: (newPreferences: CategoryPreferences | undefined, shouldReload: boolean) => void;
95
- mergePreferences: (args: {
96
- destinations: Destination[];
97
- existingPreferences?: CategoryPreferences | undefined;
98
- newPreferences?: CategoryPreferences | undefined;
99
- }) => CategoryPreferences;
100
- }
101
- export {};
@@ -1,30 +0,0 @@
1
- /// <reference types="node" />
2
- import { Preferences } from '../types';
3
- import { EventEmitter } from 'events';
4
- export interface PreferencesManager {
5
- loadPreferences(): Preferences;
6
- onPreferencesSaved(listener: (prefs: Preferences) => void): void;
7
- onWillShowBanner(listener: (prefs: Preferences) => void): void;
8
- savePreferences(prefs: SavePreferences): void;
9
- }
10
- export declare function loadPreferences(): Preferences;
11
- declare type SavePreferences = Preferences & {
12
- cookieDomain?: string;
13
- };
14
- export declare const emitter: EventEmitter;
15
- /**
16
- * Subscribes to consent preferences changing over time and returns
17
- * a cleanup function that can be invoked to remove the instantiated listener.
18
- *
19
- * @param listener a function to be invoked when ConsentPreferences are saved
20
- */
21
- export declare function onPreferencesSaved(listener: (prefs: Preferences) => void): () => EventEmitter;
22
- /**
23
- * Subscribes to consent preferences changing over time and returns
24
- * a cleanup function that can be invoked to remove the instantiated listener.
25
- *
26
- * @param listener a function to be invoked when ConsentPreferences are saved
27
- */
28
- export declare function onWillShowBanner(listener: (prefs: Preferences) => void): () => EventEmitter;
29
- export declare function savePreferences({ destinationPreferences, customPreferences, cookieDomain }: SavePreferences): void;
30
- export {};
@@ -1 +0,0 @@
1
- export declare const applyIntegrationHooks: (integrations: any) => any;
@@ -1,7 +0,0 @@
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;
@@ -1,5 +0,0 @@
1
- import inEU from '@segment/in-eu';
2
- import { openConsentManager, doNotTrack } from '.';
3
- import * as preferences from './consent-manager-builder/preferences';
4
- export declare const version: string | undefined;
5
- export { openConsentManager, doNotTrack, inEU, preferences };
@@ -1,87 +0,0 @@
1
- /// <reference types="react" />
2
- /// <reference types="segment-analytics" />
3
- import { CloseBehavior, CloseBehaviorFunction } from './consent-manager/container';
4
- import { PreferencesManager } from './consent-manager-builder/preferences';
5
- declare type AJS = SegmentAnalytics.AnalyticsJS & {
6
- initialized: boolean;
7
- track: (event: string, properties: {
8
- [key: string]: any;
9
- }) => void;
10
- addSourceMiddleware: (middleware: Middleware) => void;
11
- };
12
- export declare type Middleware = (input: MiddlewareInput) => void;
13
- interface MiddlewareInput {
14
- payload: {
15
- obj: Record<string, any>;
16
- [key: string]: any;
17
- };
18
- integrations?: Record<string, boolean>;
19
- next: (payload: MiddlewareInput['payload']) => void;
20
- }
21
- export declare type WindowWithAJS = Window & typeof globalThis & {
22
- analytics?: AJS;
23
- };
24
- export declare type WindowWithConsentManagerConfig = Window & typeof globalThis & {
25
- consentManagerConfig?: (args: StandaloneConsentManagerParams) => ConsentManagerInput | ConsentManagerInput;
26
- };
27
- export declare type ConsentManagerInput = ConsentManagerProps & {
28
- container: string;
29
- };
30
- export declare type DefaultDestinationBehavior = 'enable' | 'disable' | 'imply' | 'ask';
31
- export declare type BannerMode = 'blocking' | 'floating';
32
- interface StandaloneConsentManagerParams {
33
- React: unknown;
34
- version?: string;
35
- openConsentManager: () => void;
36
- doNotTrack: () => boolean | null;
37
- inEU: () => boolean;
38
- preferences: PreferencesManager;
39
- inRegions: (regions: string[]) => () => boolean;
40
- }
41
- export interface Preferences {
42
- destinationPreferences?: CategoryPreferences;
43
- customPreferences?: CategoryPreferences;
44
- }
45
- export interface Destination {
46
- id: string;
47
- name: string;
48
- creationName: string;
49
- description: string;
50
- website: string;
51
- category: string;
52
- }
53
- export interface CategoryPreferences {
54
- functional?: boolean | null | undefined;
55
- marketingAndAnalytics?: boolean | null | undefined;
56
- advertising?: boolean | null | undefined;
57
- [category: string]: boolean | null | undefined;
58
- }
59
- export interface CustomCategories {
60
- [key: string]: CustomCategory;
61
- }
62
- interface CustomCategory {
63
- integrations: string[];
64
- purpose: string;
65
- }
66
- export interface ConsentManagerProps {
67
- writeKey: string;
68
- otherWriteKeys?: string[];
69
- shouldRequireConsent?: () => Promise<boolean> | boolean;
70
- implyConsentOnInteraction?: boolean;
71
- cookieDomain?: string;
72
- bannerContent: React.ReactNode;
73
- bannerSubContent?: string;
74
- bannerTextColor?: string;
75
- bannerBackgroundColor?: string;
76
- preferencesDialogTitle?: React.ReactNode;
77
- preferencesDialogContent: React.ReactNode;
78
- onError?: (error: Error | undefined) => void;
79
- closeBehavior?: CloseBehavior | CloseBehaviorFunction;
80
- initialPreferences?: CategoryPreferences;
81
- customCategories?: CustomCategories;
82
- defaultDestinationBehavior?: DefaultDestinationBehavior;
83
- cdnHost?: string;
84
- showRejectAll: boolean;
85
- bannerMode?: BannerMode;
86
- }
87
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- export {};