@muchbetteradventures/consent-manager 5.7.1-beta.1 → 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.
- package/README.md +2 -2
- package/commonjs/__tests__/consent-manager-builder/analytics.test.js +12 -12
- package/commonjs/__tests__/consent-manager-builder/fetch-destinations.test.js +10 -10
- package/commonjs/__tests__/consent-manager-builder/index.todo.js +17 -17
- package/commonjs/__tests__/consent-manager-builder/preferences.test.js +4 -4
- package/commonjs/__tests__/index.test.js +12 -12
- package/commonjs/consent-manager/banner.js +58 -31
- package/commonjs/consent-manager/buttons.js +62 -13
- package/commonjs/consent-manager/categories.js +2 -1
- package/commonjs/consent-manager/container.js +6 -6
- package/commonjs/consent-manager/dialog.js +47 -19
- package/commonjs/consent-manager/font-styles.js +2 -2
- package/commonjs/consent-manager/index.js +40 -13
- package/commonjs/consent-manager/preference-dialog.js +50 -22
- package/commonjs/consent-manager-builder/analytics.js +3 -3
- package/commonjs/consent-manager-builder/fetch-destinations.js +9 -9
- package/commonjs/consent-manager-builder/index.js +22 -18
- package/commonjs/consent-manager-builder/preferences.js +7 -6
- package/commonjs/hooks.js +4 -2
- package/commonjs/index.js +9 -7
- package/commonjs/standalone.js +41 -14
- package/esm/__tests__/consent-manager-builder/fetch-destinations.test.js +3 -3
- package/esm/__tests__/consent-manager-builder/index.todo.js +1 -1
- package/esm/__tests__/consent-manager-builder/preferences.test.js +1 -1
- package/esm/consent-manager/banner.js +26 -25
- package/esm/consent-manager/buttons.js +29 -7
- package/esm/consent-manager/container.js +5 -5
- package/esm/consent-manager/dialog.js +4 -2
- package/esm/consent-manager/index.js +7 -6
- package/esm/consent-manager/preference-dialog.js +10 -8
- package/esm/consent-manager-builder/analytics.js +1 -1
- package/esm/consent-manager-builder/fetch-destinations.js +6 -6
- package/esm/consent-manager-builder/index.js +16 -12
- package/esm/consent-manager-builder/preferences.js +1 -1
- package/esm/hooks.js +1 -1
- package/esm/index.js +3 -2
- package/esm/standalone.js +5 -5
- package/esm/types.js +1 -0
- package/package.json +13 -7
- package/standalone/consent-manager.js +3 -3
- package/standalone/consent-manager.js.map +1 -1
- package/types/consent-manager/banner.d.ts +4 -2
- package/types/consent-manager/buttons.d.ts +6 -11
- package/types/consent-manager/container.d.ts +5 -2
- package/types/consent-manager/index.d.ts +0 -1
- package/types/consent-manager-builder/index.d.ts +3 -4
- package/types/consent-manager-builder/preferences.d.ts +4 -5
- package/types/types.d.ts +10 -10
|
@@ -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
|
-
|
|
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
|
-
|
|
2
|
-
|
|
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
|
|
7
|
-
innerRef?:
|
|
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
|
|
10
|
-
innerRef?:
|
|
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
|
|
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 |
|
|
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
|
|
97
|
-
newPreferences?: CategoryPreferences
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
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
|
|
19
|
+
export type WindowWithAJS = Window & typeof globalThis & {
|
|
22
20
|
analytics?: AJS;
|
|
23
21
|
};
|
|
24
|
-
export
|
|
22
|
+
export type WindowWithConsentManagerConfig = Window & typeof globalThis & {
|
|
25
23
|
consentManagerConfig?: (args: StandaloneConsentManagerParams) => ConsentManagerInput | ConsentManagerInput;
|
|
26
24
|
};
|
|
27
|
-
export
|
|
25
|
+
export type ConsentManagerInput = ConsentManagerProps & {
|
|
28
26
|
container: string;
|
|
29
27
|
};
|
|
30
|
-
export
|
|
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 {};
|