@enter-pro/cookie-management 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.
- package/README.md +24 -0
- package/dist/index.d.ts +84 -0
- package/dist/index.js +5304 -0
- package/package.json +41 -0
package/README.md
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# @enter/cookie-management
|
|
2
|
+
|
|
3
|
+
Public Enter wrapper for the internal `@converge/cookie-management` cookie consent SDK.
|
|
4
|
+
|
|
5
|
+
This package intentionally keeps a single public root entry and re-exports the underlying SDK API unchanged.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
pnpm add @enter/cookie-management
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
```ts
|
|
16
|
+
import {
|
|
17
|
+
cookieManager,
|
|
18
|
+
SUPPORTED_LANGUAGES,
|
|
19
|
+
type Data,
|
|
20
|
+
type SupportedLanguage,
|
|
21
|
+
} from '@enter/cookie-management';
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
`@enter/cookie-management/i18n` is not a public entry. Import i18n constants and types from the root package entry instead.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
interface Preference {
|
|
2
|
+
strictlyNecessary: boolean;
|
|
3
|
+
functional: boolean;
|
|
4
|
+
analytics: boolean;
|
|
5
|
+
advertising: boolean;
|
|
6
|
+
}
|
|
7
|
+
type Mode = 'opt_in' | 'notice_only';
|
|
8
|
+
interface Data {
|
|
9
|
+
countryCode: string;
|
|
10
|
+
hasChoice: boolean;
|
|
11
|
+
preference: Preference | null;
|
|
12
|
+
mode: Mode;
|
|
13
|
+
}
|
|
14
|
+
type ConsentSource = 'opt_in_accept_all' | 'opt_in_reject_all' | 'opt_in_preferences_save' | 'notice_only_dismiss' | 'notice_only_preferences_save';
|
|
15
|
+
interface InitOptions {
|
|
16
|
+
locale?: string;
|
|
17
|
+
theme?: 'light' | 'dark';
|
|
18
|
+
policyUrl?: string;
|
|
19
|
+
}
|
|
20
|
+
type Surface = 'none' | 'banner' | 'notice';
|
|
21
|
+
interface CookieUIState {
|
|
22
|
+
data: Data;
|
|
23
|
+
surface: Surface;
|
|
24
|
+
prefOpen: boolean;
|
|
25
|
+
}
|
|
26
|
+
interface PreferenceValues {
|
|
27
|
+
functional: boolean;
|
|
28
|
+
analytics: boolean;
|
|
29
|
+
advertising: boolean;
|
|
30
|
+
}
|
|
31
|
+
interface ConsentDataChangeDetail {
|
|
32
|
+
data: Data;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
declare class CookieManager {
|
|
36
|
+
private static instance;
|
|
37
|
+
private readonly consentCookie;
|
|
38
|
+
private readonly regionClient;
|
|
39
|
+
private readonly ui;
|
|
40
|
+
private data;
|
|
41
|
+
private surface;
|
|
42
|
+
private prefOpen;
|
|
43
|
+
private listeners;
|
|
44
|
+
private initialized;
|
|
45
|
+
private config;
|
|
46
|
+
static getInstance(): CookieManager;
|
|
47
|
+
onDataChange(fn: (data: Data) => void): () => void;
|
|
48
|
+
getData(): Data | null;
|
|
49
|
+
openPreferenceCenter(): void;
|
|
50
|
+
closePreferenceCenter(): void;
|
|
51
|
+
init(options?: InitOptions): Promise<void>;
|
|
52
|
+
update(options?: InitOptions): void;
|
|
53
|
+
private getDefaultPreference;
|
|
54
|
+
private deriveSurface;
|
|
55
|
+
private syncSurface;
|
|
56
|
+
private syncUI;
|
|
57
|
+
private emit;
|
|
58
|
+
private onConsentDataChange;
|
|
59
|
+
private applyConfig;
|
|
60
|
+
}
|
|
61
|
+
declare const cookieManager: CookieManager;
|
|
62
|
+
|
|
63
|
+
declare const DEFAULT_POLICY_URL = "https://converge.ai/cookie-policy";
|
|
64
|
+
declare const PREFERENCE_ACCEPT_ALL: {
|
|
65
|
+
readonly strictlyNecessary: true;
|
|
66
|
+
readonly functional: true;
|
|
67
|
+
readonly analytics: true;
|
|
68
|
+
readonly advertising: true;
|
|
69
|
+
};
|
|
70
|
+
declare const PREFERENCE_REJECT_OPTIONAL: {
|
|
71
|
+
readonly strictlyNecessary: true;
|
|
72
|
+
readonly functional: false;
|
|
73
|
+
readonly analytics: false;
|
|
74
|
+
readonly advertising: false;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
declare const SUPPORTED_LANGUAGES: readonly ["en", "zh-CN", "zh-TW", "de-DE", "pt-BR", "es-ES", "fr-FR", "id-ID", "it-IT", "ja-JP", "ko-KR", "ru-RU", "ar-SA", "tr-TR"];
|
|
78
|
+
type SupportedLanguage = (typeof SUPPORTED_LANGUAGES)[number];
|
|
79
|
+
declare const FALLBACK_LOCALE: SupportedLanguage;
|
|
80
|
+
type LocaleDir = 'ltr' | 'rtl';
|
|
81
|
+
declare const RTL_LOCALES: readonly SupportedLanguage[];
|
|
82
|
+
declare function getLocaleDir(locale: SupportedLanguage | string): LocaleDir;
|
|
83
|
+
|
|
84
|
+
export { type ConsentDataChangeDetail, type ConsentSource, CookieManager, type CookieUIState, DEFAULT_POLICY_URL, type Data, FALLBACK_LOCALE, type InitOptions, type LocaleDir, type Mode, PREFERENCE_ACCEPT_ALL, PREFERENCE_REJECT_OPTIONAL, type Preference, type PreferenceValues, RTL_LOCALES, SUPPORTED_LANGUAGES, type SupportedLanguage, type Surface, cookieManager, getLocaleDir };
|