@enter-pro/cookie-management 0.0.1 → 0.0.2

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 CHANGED
@@ -1,13 +1,13 @@
1
- # @enter/cookie-management
1
+ # @enter-pro/cookie-management
2
2
 
3
- Public Enter wrapper for the internal `@converge/cookie-management` cookie consent SDK.
3
+ Public Enter wrapper for the internal Converge cookie consent SDK.
4
4
 
5
5
  This package intentionally keeps a single public root entry and re-exports the underlying SDK API unchanged.
6
6
 
7
7
  ## Install
8
8
 
9
9
  ```bash
10
- pnpm add @enter/cookie-management
10
+ pnpm add @enter-pro/cookie-management
11
11
  ```
12
12
 
13
13
  ## Usage
@@ -18,7 +18,7 @@ import {
18
18
  SUPPORTED_LANGUAGES,
19
19
  type Data,
20
20
  type SupportedLanguage,
21
- } from '@enter/cookie-management';
21
+ } from '@enter-pro/cookie-management';
22
22
  ```
23
23
 
24
- `@enter/cookie-management/i18n` is not a public entry. Import i18n constants and types from the root package entry instead.
24
+ `@enter-pro/cookie-management/i18n` is not a public entry. Import i18n constants and types from the root package entry instead.
package/dist/index.d.ts CHANGED
@@ -16,6 +16,8 @@ interface InitOptions {
16
16
  locale?: string;
17
17
  theme?: 'light' | 'dark';
18
18
  policyUrl?: string;
19
+ /** When true (default), map --cc-* from host CSS variables. When false, use built-in literals. */
20
+ useHostDesignTokens?: boolean;
19
21
  }
20
22
  type Surface = 'none' | 'banner' | 'notice';
21
23
  interface CookieUIState {
package/dist/index.js CHANGED
@@ -4129,8 +4129,48 @@ var t4 = (t5) => (e4, o5) => {
4129
4129
  }) : customElements.define(t5, e4);
4130
4130
  };
4131
4131
 
4132
+ // ../../converge/cookie-management/src/ui/use-host-design-tokens-property.ts
4133
+ var useHostDesignTokensProperty = {
4134
+ type: Boolean,
4135
+ attribute: "data-use-host-tokens",
4136
+ converter: {
4137
+ fromAttribute: (value) => value !== "false",
4138
+ toAttribute: (value) => value ? "true" : "false"
4139
+ },
4140
+ reflect: true
4141
+ };
4142
+
4143
+ // ../../converge/cookie-management/src/ui/theme-literals.ts
4144
+ var LIGHT_THEME_LITERALS = {
4145
+ bg: "#ffffff",
4146
+ bgModal: "#ffffff",
4147
+ fg: "#171717",
4148
+ muted: "#737373",
4149
+ border: "#e5e5e5",
4150
+ shadowCard: "0 1px 2px rgb(0 0 0 / 0.04), 0 4px 12px rgb(0 0 0 / 0.08), 0 8px 24px rgb(0 0 0 / 0.06)",
4151
+ shadowModal: "0 2px 4px rgb(0 0 0 / 0.04), 0 8px 24px rgb(0 0 0 / 0.1), 0 16px 40px rgb(0 0 0 / 0.08)",
4152
+ accent: "#171717",
4153
+ accentFg: "#fafafa",
4154
+ overlayFallback: "rgba(0, 0, 0, 0.4)",
4155
+ ring: "#e5e5e5",
4156
+ radius: "8px"
4157
+ };
4158
+ var DARK_THEME_LITERALS = {
4159
+ bg: "#27272a",
4160
+ bgModal: "#18181b",
4161
+ fg: "#f5f5f5",
4162
+ muted: "#a3a3a3",
4163
+ border: "rgba(255, 255, 255, 0.15)",
4164
+ shadowCard: "0 1px 2px rgb(0 0 0 / 0.2), 0 8px 24px rgb(0 0 0 / 0.35)",
4165
+ shadowModal: "0 4px 8px rgb(0 0 0 / 0.25), 0 16px 48px rgb(0 0 0 / 0.45)",
4166
+ accent: "#f5f5f5",
4167
+ accentFg: "#0a0a0a",
4168
+ overlayFallback: "rgba(0, 0, 0, 0.68)",
4169
+ ring: "rgba(255, 255, 255, 0.15)"
4170
+ };
4171
+
4132
4172
  // ../../converge/cookie-management/src/ui/styles.ts
4133
- var tokenVars = i`
4173
+ var hostTokenVars = i`
4134
4174
  :host {
4135
4175
  --cc-font-en: 'Schibsted Grotesk', var(--font-schibsted, ui-sans-serif, system-ui, sans-serif);
4136
4176
  --cc-font-zh: 'Microsoft YaHei', 'PingFang SC', 'Hiragino Sans GB', sans-serif;
@@ -4190,6 +4230,43 @@ var tokenVars = i`
4190
4230
  font-family: var(--cc-font-zh);
4191
4231
  }
4192
4232
  `;
4233
+ var literalTokenVars = i`
4234
+ :host([data-use-host-tokens='false']) {
4235
+ --cc-font-en: 'Schibsted Grotesk', ui-sans-serif, system-ui, sans-serif;
4236
+ --cc-bg: ${r(LIGHT_THEME_LITERALS.bg)};
4237
+ --cc-bg-modal: ${r(LIGHT_THEME_LITERALS.bgModal)};
4238
+ --cc-fg: ${r(LIGHT_THEME_LITERALS.fg)};
4239
+ --cc-muted: ${r(LIGHT_THEME_LITERALS.muted)};
4240
+ --cc-border: ${r(LIGHT_THEME_LITERALS.border)};
4241
+ --cc-shadow-card: ${r(LIGHT_THEME_LITERALS.shadowCard)};
4242
+ --cc-shadow-modal: ${r(LIGHT_THEME_LITERALS.shadowModal)};
4243
+ --cc-accent: ${r(LIGHT_THEME_LITERALS.accent)};
4244
+ --cc-accent-fg: ${r(LIGHT_THEME_LITERALS.accentFg)};
4245
+ --cc-overlay-fallback: ${r(LIGHT_THEME_LITERALS.overlayFallback)};
4246
+ --cc-ring: ${r(LIGHT_THEME_LITERALS.ring)};
4247
+ --cc-radius: ${r(LIGHT_THEME_LITERALS.radius)};
4248
+ }
4249
+
4250
+ :host([data-use-host-tokens='false'][data-theme='dark']) {
4251
+ --cc-bg: ${r(DARK_THEME_LITERALS.bg)};
4252
+ --cc-bg-modal: ${r(DARK_THEME_LITERALS.bgModal)};
4253
+ --cc-fg: ${r(DARK_THEME_LITERALS.fg)};
4254
+ --cc-muted: ${r(DARK_THEME_LITERALS.muted)};
4255
+ --cc-border: ${r(DARK_THEME_LITERALS.border)};
4256
+ --cc-shadow-card: ${r(DARK_THEME_LITERALS.shadowCard)};
4257
+ --cc-shadow-modal: ${r(DARK_THEME_LITERALS.shadowModal)};
4258
+ --cc-accent: ${r(DARK_THEME_LITERALS.accent)};
4259
+ --cc-accent-fg: ${r(DARK_THEME_LITERALS.accentFg)};
4260
+ --cc-overlay-fallback: ${r(DARK_THEME_LITERALS.overlayFallback)};
4261
+ --cc-ring: ${r(DARK_THEME_LITERALS.ring)};
4262
+ color-scheme: dark;
4263
+ }
4264
+
4265
+ :host([data-use-host-tokens='false'][data-theme='light']) {
4266
+ --cc-overlay-fallback: ${r(LIGHT_THEME_LITERALS.overlayFallback)};
4267
+ color-scheme: light;
4268
+ }
4269
+ `;
4193
4270
  var controls = i`
4194
4271
  a {
4195
4272
  color: var(--cc-fg);
@@ -4203,7 +4280,7 @@ var controls = i`
4203
4280
  min-height: 40px;
4204
4281
  padding: 0 16px;
4205
4282
  border: 1px solid var(--cc-border);
4206
- border-radius: var(--radius, 8px);
4283
+ border-radius: var(--cc-radius, var(--radius, 8px));
4207
4284
  background: var(--cc-accent);
4208
4285
  color: var(--cc-accent-fg);
4209
4286
  font: inherit;
@@ -4258,7 +4335,7 @@ var controls = i`
4258
4335
  cursor: pointer;
4259
4336
  }
4260
4337
  `;
4261
- var baseStyles = [tokenVars, controls];
4338
+ var baseStyles = [hostTokenVars, literalTokenVars, controls];
4262
4339
 
4263
4340
  // ../../converge/cookie-management/src/ui/components/opt-in-required.ts
4264
4341
  var _OptInRequiredBanner_decorators, _init, _a3;
@@ -4331,6 +4408,7 @@ OptInRequiredBanner.properties = {
4331
4408
  policyUrl: { type: String, attribute: "policy-url" },
4332
4409
  locale: { type: String, reflect: true },
4333
4410
  theme: { type: String, attribute: "data-theme", reflect: true },
4411
+ useHostDesignTokens: useHostDesignTokensProperty,
4334
4412
  visible: { type: Boolean, reflect: true }
4335
4413
  };
4336
4414
  OptInRequiredBanner.styles = [
@@ -4473,6 +4551,7 @@ NoticeOnlyBar.properties = {
4473
4551
  policyUrl: { type: String, attribute: "policy-url" },
4474
4552
  locale: { type: String, reflect: true },
4475
4553
  theme: { type: String, attribute: "data-theme", reflect: true },
4554
+ useHostDesignTokens: useHostDesignTokensProperty,
4476
4555
  visible: { type: Boolean, reflect: true }
4477
4556
  };
4478
4557
  NoticeOnlyBar.styles = [
@@ -4721,6 +4800,7 @@ ConvergePreferenceCenter = __decorateElement(_init3, 0, "ConvergePreferenceCente
4721
4800
  ConvergePreferenceCenter.properties = {
4722
4801
  locale: { type: String, reflect: true },
4723
4802
  theme: { type: String, attribute: "data-theme", reflect: true },
4803
+ useHostDesignTokens: useHostDesignTokensProperty,
4724
4804
  visible: { type: Boolean, reflect: true },
4725
4805
  data: { type: Object, attribute: false },
4726
4806
  functional: { type: Boolean, state: true },
@@ -5009,6 +5089,7 @@ var ConvergeCookieManager = class extends (_a6 = i3) {
5009
5089
  this.data = null;
5010
5090
  this.surface = "none";
5011
5091
  this.prefOpen = false;
5092
+ this.useHostDesignTokens = true;
5012
5093
  }
5013
5094
  emitConsentChange(data) {
5014
5095
  const detail = { data };
@@ -5024,6 +5105,7 @@ var ConvergeCookieManager = class extends (_a6 = i3) {
5024
5105
  return T`
5025
5106
  <converge-opt-in-required
5026
5107
  .theme=${this.theme}
5108
+ .useHostDesignTokens=${this.useHostDesignTokens}
5027
5109
  .visible=${this.surface === "banner" && !this.prefOpen}
5028
5110
  locale=${this.locale}
5029
5111
  policy-url=${this.policyUrl}
@@ -5032,6 +5114,7 @@ var ConvergeCookieManager = class extends (_a6 = i3) {
5032
5114
  ></converge-opt-in-required>
5033
5115
  <converge-notice-only
5034
5116
  .theme=${this.theme}
5117
+ .useHostDesignTokens=${this.useHostDesignTokens}
5035
5118
  .visible=${this.surface === "notice" && !this.prefOpen}
5036
5119
  locale=${this.locale}
5037
5120
  policy-url=${this.policyUrl}
@@ -5039,6 +5122,7 @@ var ConvergeCookieManager = class extends (_a6 = i3) {
5039
5122
  ></converge-notice-only>
5040
5123
  <converge-preference-center
5041
5124
  .theme=${this.theme}
5125
+ .useHostDesignTokens=${this.useHostDesignTokens}
5042
5126
  locale=${this.locale}
5043
5127
  .visible=${this.prefOpen}
5044
5128
  .data=${this.data}
@@ -5053,6 +5137,7 @@ ConvergeCookieManager.properties = {
5053
5137
  policyUrl: { type: String, attribute: "policy-url" },
5054
5138
  locale: { type: String, reflect: true },
5055
5139
  theme: { type: String, attribute: "data-theme", reflect: true },
5140
+ useHostDesignTokens: useHostDesignTokensProperty,
5056
5141
  data: { type: Object, attribute: false },
5057
5142
  surface: { type: String, attribute: false },
5058
5143
  prefOpen: { type: Boolean, attribute: false }
@@ -5098,9 +5183,11 @@ var UIController = class {
5098
5183
  const policyUrl = this.options?.policyUrl ?? "";
5099
5184
  const locale = this.options?.locale ?? "en";
5100
5185
  const theme = this.options?.theme ?? "light";
5186
+ const useHostDesignTokens = this.options?.useHostDesignTokens ?? true;
5101
5187
  root.setAttribute("policy-url", policyUrl);
5102
5188
  root.setAttribute("locale", locale);
5103
5189
  root.setAttribute("data-theme", theme);
5190
+ root.setAttribute("data-use-host-tokens", useHostDesignTokens ? "true" : "false");
5104
5191
  root.dir = getLocaleDir(locale);
5105
5192
  }
5106
5193
  };
@@ -5123,7 +5210,8 @@ var _CookieManager = class _CookieManager {
5123
5210
  this.config = {
5124
5211
  locale: "en",
5125
5212
  policyUrl: DEFAULT_POLICY_URL,
5126
- theme: DEFAULT_THEME
5213
+ theme: DEFAULT_THEME,
5214
+ useHostDesignTokens: true
5127
5215
  };
5128
5216
  }
5129
5217
  static getInstance() {
@@ -5225,7 +5313,8 @@ var _CookieManager = class _CookieManager {
5225
5313
  this.config = {
5226
5314
  theme: options?.theme ?? this.config.theme,
5227
5315
  policyUrl: options?.policyUrl ?? this.config.policyUrl,
5228
- locale: i18n.locale
5316
+ locale: i18n.locale,
5317
+ useHostDesignTokens: options?.useHostDesignTokens ?? this.config.useHostDesignTokens
5229
5318
  };
5230
5319
  this.ui.configure(this.config);
5231
5320
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enter-pro/cookie-management",
3
- "version": "0.0.1",
3
+ "version": "0.0.2",
4
4
  "private": false,
5
5
  "description": "Public Enter cookie consent SDK wrapper.",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  "typescript": "^5.9.2",
26
26
  "vitest": "^3.2.4",
27
27
  "@workspace/typescript-config": "0.0.0",
28
- "@converge/cookie-management": "0.1.1"
28
+ "@converge/cookie-management": "0.1.4"
29
29
  },
30
30
  "publishConfig": {
31
31
  "access": "public"