@jini-ai/admin 0.6.10 → 0.6.12
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/CHANGELOG.md +8 -0
- package/dist/consent/react/ConsentFields.d.ts +1 -1
- package/dist/consent/react/ConsentFields.js +2 -2
- package/dist/consent/react/ConsentSettingsPanel.d.ts +2 -0
- package/dist/consent/react/settings-panel.hooks.d.ts +1 -0
- package/dist/consent/react/settings-panel.hooks.js +1 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -22,7 +22,7 @@ export interface ConsentFieldsProps {
|
|
|
22
22
|
}
|
|
23
23
|
/** Banner copy and its links. Text is always plain text; the engine never renders it as HTML. */
|
|
24
24
|
export declare function ConsentBannerFields({ value, onChange, disabled, problems, dictionary, limits }: ConsentFieldsProps): import("react").JSX.Element;
|
|
25
|
-
/** On/off, region behavior and the
|
|
25
|
+
/** On/off, script policy, region behavior and the version that re-asks visitors when it changes. */
|
|
26
26
|
export declare function ConsentRulesFields({ value, onChange, disabled, problems, dictionary, limits, regionModes }: ConsentFieldsProps & {
|
|
27
27
|
regionModes?: readonly ConsentSettingsView['regionMode'][];
|
|
28
28
|
}): import("react").JSX.Element;
|
|
@@ -46,13 +46,13 @@ export function ConsentBannerFields({ value, onChange, disabled = false, problem
|
|
|
46
46
|
? _jsx("textarea", { className: "jini-input", value: value[key] ?? '', maxLength: limits[key] ?? 2000, rows: 3, onChange: handlers.text(key), ...aria })
|
|
47
47
|
: _jsx("input", { className: "jini-input", type: "text", value: value[key] ?? '', maxLength: limits[key] ?? 2000, onChange: handlers.text(key), ...aria }) }, key)), _jsx("p", { className: "jini-hint", children: t('Link a published privacy page, such as /privacy. The second link is optional.') })] });
|
|
48
48
|
}
|
|
49
|
-
/** On/off, region behavior and the
|
|
49
|
+
/** On/off, script policy, region behavior and the version that re-asks visitors when it changes. */
|
|
50
50
|
export function ConsentRulesFields({ value, onChange, disabled = false, problems, dictionary, limits = {}, regionModes = ['auto', 'opt-in', 'opt-out'] }) {
|
|
51
51
|
const id = useId();
|
|
52
52
|
const t = translator(dictionary);
|
|
53
53
|
const handlers = useConsentSettingsPanel({ value, onChange });
|
|
54
54
|
const modes = regionModes.includes(value.regionMode) ? regionModes : [value.regionMode, ...regionModes];
|
|
55
|
-
return _jsxs("fieldset", { disabled: disabled, className: "jini-consent-settings-fields", children: [_jsx("legend", { children: t('Rules') }), _jsxs("button", { type: "button", className: value.enabled ? 'jini-toggle-row on' : 'jini-toggle-row', role: "switch", "aria-checked": value.enabled, "aria-labelledby": `${id}-enabled`, "aria-describedby": `${id}-hint`, onClick: handlers.toggle, children: [_jsxs("span", { className: "jini-toggle-row-text", children: [_jsx("span", { id: `${id}-enabled`, className: "jini-toggle-row-label", children: t('Enable cookie consent on this site') }), _jsx("span", { id: `${id}-hint`, className: "jini-toggle-row-hint", children: t('Applies to published site pages.') })] }), _jsx("span", { className: "jini-toggle-row-switch", "aria-hidden": "true" })] }), _jsx(Field, { label: t('Region mode'), field: "regionMode", problems: problems, children: aria => _jsx("select", { className: "jini-input", value: value.regionMode, onChange: handlers.region, ...aria, children: modes.map(mode => _jsx("option", { value: mode, children: t(REGION_LABELS[mode]) }, mode)) }) }), _jsx("p", { className: "jini-hint", children: t('California permits optional categories until opt-out. Global Privacy Control always disables analytics and marketing.') }), _jsx(Field, { label: t('Policy version'), field: "policyVersion", problems: problems, children: aria => _jsx(PolicyVersionInput, { value: value.policyVersion, onChange: onChange, maxLength: limits.policyVersion ?? 128, aria: aria }) }), _jsx("p", { className: "jini-hint", children: t('Change the policy version to ask visitors to choose again.') })] });
|
|
55
|
+
return _jsxs("fieldset", { disabled: disabled, className: "jini-consent-settings-fields", children: [_jsx("legend", { children: t('Rules') }), _jsxs("button", { type: "button", className: value.enabled ? 'jini-toggle-row on' : 'jini-toggle-row', role: "switch", "aria-checked": value.enabled, "aria-labelledby": `${id}-enabled`, "aria-describedby": `${id}-hint`, onClick: handlers.toggle, children: [_jsxs("span", { className: "jini-toggle-row-text", children: [_jsx("span", { id: `${id}-enabled`, className: "jini-toggle-row-label", children: t('Enable cookie consent on this site') }), _jsx("span", { id: `${id}-hint`, className: "jini-toggle-row-hint", children: t('Applies to published site pages.') })] }), _jsx("span", { className: "jini-toggle-row-switch", "aria-hidden": "true" })] }), value.enabled && _jsxs("button", { type: "button", className: value.allowUnsafeEval === true ? 'jini-toggle-row on' : 'jini-toggle-row', role: "switch", "aria-checked": value.allowUnsafeEval === true, "aria-labelledby": `${id}-eval`, "aria-describedby": `${id}-eval-hint`, onClick: handlers.toggleUnsafeEval, children: [_jsxs("span", { className: "jini-toggle-row-text", children: [_jsx("span", { id: `${id}-eval`, className: "jini-toggle-row-label", children: t('Allow dynamic code (unsafe-eval)') }), _jsx("span", { id: `${id}-eval-hint`, className: "jini-toggle-row-hint", children: t("Some themes need this. It weakens the site's script protection. Optional scripts still wait for consent.") })] }), _jsx("span", { className: "jini-toggle-row-switch", "aria-hidden": "true" })] }), _jsx(Field, { label: t('Region mode'), field: "regionMode", problems: problems, children: aria => _jsx("select", { className: "jini-input", value: value.regionMode, onChange: handlers.region, ...aria, children: modes.map(mode => _jsx("option", { value: mode, children: t(REGION_LABELS[mode]) }, mode)) }) }), _jsx("p", { className: "jini-hint", children: t('California permits optional categories until opt-out. Global Privacy Control always disables analytics and marketing.') }), _jsx(Field, { label: t('Policy version'), field: "policyVersion", problems: problems, children: aria => _jsx(PolicyVersionInput, { value: value.policyVersion, onChange: onChange, maxLength: limits.policyVersion ?? 128, aria: aria }) }), _jsx("p", { className: "jini-hint", children: t('Change the policy version to ask visitors to choose again.') })] });
|
|
56
56
|
}
|
|
57
57
|
/** Placement, bounded appearance tokens and allowlisted custom CSS. The engine checks contrast and
|
|
58
58
|
* CSS safety; its problems arrive on the `appearance` field and show under the custom CSS. */
|
|
@@ -12,6 +12,8 @@ export interface ConsentAppearanceView {
|
|
|
12
12
|
/** The host's consent configuration. The look fields are optional so older hosts stay valid. */
|
|
13
13
|
export interface ConsentSettingsView {
|
|
14
14
|
enabled: boolean;
|
|
15
|
+
/** Optional for older hosts; omitted means the dynamic code exception is off. */
|
|
16
|
+
allowUnsafeEval?: boolean;
|
|
15
17
|
regionMode: 'auto' | 'opt-in' | 'opt-out';
|
|
16
18
|
policyVersion: string;
|
|
17
19
|
privacyPolicyUrl: string;
|
|
@@ -3,6 +3,7 @@ import type { ConsentAppearanceView, ConsentFieldProblem, ConsentSettingsPanelPr
|
|
|
3
3
|
/** Keep value conversions and toggle behavior out of the view. React owns event signatures. */
|
|
4
4
|
export declare function useConsentSettingsPanel({ value, onChange }: Pick<ConsentSettingsPanelProps, 'value' | 'onChange'>, _options?: {}): {
|
|
5
5
|
toggle: () => void;
|
|
6
|
+
toggleUnsafeEval: () => void;
|
|
6
7
|
region: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
7
8
|
placement: (event: ChangeEvent<HTMLSelectElement>) => void;
|
|
8
9
|
text: (key: keyof ConsentSettingsView) => (event: ChangeEvent<HTMLInputElement | HTMLTextAreaElement>) => void;
|
|
@@ -3,6 +3,7 @@ import { useEffect, useState } from 'react';
|
|
|
3
3
|
export function useConsentSettingsPanel({ value, onChange }, _options = {}) {
|
|
4
4
|
return {
|
|
5
5
|
toggle: () => onChange({ patch: { enabled: !value.enabled } }),
|
|
6
|
+
toggleUnsafeEval: () => onChange({ patch: { allowUnsafeEval: value.allowUnsafeEval !== true } }),
|
|
6
7
|
region: (event) => onChange({ patch: { regionMode: event.target.value } }),
|
|
7
8
|
placement: (event) => onChange({ patch: { placement: event.target.value } }),
|
|
8
9
|
text: (key) => (event) => onChange({ patch: { [key]: event.target.value } }),
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@jini-ai/admin",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.12",
|
|
4
4
|
"description": "Composable admin surface for Jini-hosted products: framework-free contracts, panel registry, and route model in `/core`; React shell and panels in `/react`. Import only the layers you need.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -491,12 +491,12 @@
|
|
|
491
491
|
"react": "^19.2.0",
|
|
492
492
|
"react-dom": "^19.2.0",
|
|
493
493
|
"@testing-library/user-event": "^14.6.1",
|
|
494
|
-
"@jini-ai/
|
|
495
|
-
"@jini-ai/
|
|
496
|
-
"@jini-ai/
|
|
497
|
-
"@jini-ai/
|
|
498
|
-
"@jini-ai/
|
|
499
|
-
"@jini-ai/
|
|
494
|
+
"@jini-ai/ui": "^0.6.12",
|
|
495
|
+
"@jini-ai/agentic": "^0.6.12",
|
|
496
|
+
"@jini-ai/ui-kit": "^0.6.12",
|
|
497
|
+
"@jini-ai/agent-plugins": "^0.6.12",
|
|
498
|
+
"@jini-ai/cms": "^0.6.12",
|
|
499
|
+
"@jini-ai/core": "^0.6.12"
|
|
500
500
|
},
|
|
501
501
|
"typesVersions": {
|
|
502
502
|
"*": {
|