Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
54c2d64cce | ||
|
|
e29c919e5e | ||
|
|
0f6bbd597b | ||
|
|
65437a144b | ||
|
|
e7ad64230a | ||
|
|
5af5033148 | ||
|
|
7572ec0c04 | ||
|
|
a24777b915 | ||
|
|
562e7f2244 | ||
|
|
80d8b7102c | ||
|
|
0ccc7e5064 | ||
|
|
3d467d7350 | ||
|
|
db05fe814b | ||
|
|
42df05af28 | ||
|
|
089b3a29ba | ||
|
|
ab16d459ed | ||
|
|
786dd346a9 | ||
|
|
86c873e4e7 | ||
|
|
efe8253f64 | ||
|
|
c0d9911d90 | ||
|
|
103c796e9d | ||
|
|
c6f177a37d | ||
|
|
1a9c51a1fd | ||
|
|
7f5ed75f9e | ||
|
|
4eb2b627f0 | ||
|
|
a92fc02cdf | ||
|
|
7aebe24236 | ||
|
|
c852d7bdae | ||
|
|
24fa3fdcdf | ||
|
|
73eacb09c2 | ||
|
|
2665cfa7b6 | ||
|
|
5c466b664c | ||
|
|
78e2f8fc7f | ||
|
|
13d669b757 | ||
|
|
a3938cacd9 | ||
|
|
2ef602b3ec | ||
|
|
1f55c2406e | ||
|
|
10d1806130 | ||
|
|
6be783bc5a | ||
|
|
fd6fb426b3 | ||
|
|
09925e4cfd | ||
|
|
e6eada5d39 | ||
|
|
1b52060dce | ||
|
|
52977e67fc | ||
|
|
b25f221a50 | ||
|
|
f9d3d9ae97 | ||
|
|
962b9cb640 | ||
|
|
9b9bbc1a9f | ||
|
|
abf2e7d40f | ||
|
|
d500d9412f | ||
|
|
d034ddf990 | ||
|
|
2dfacb0414 | ||
|
|
eb6efa26f6 | ||
|
|
f5a4ceb5bf | ||
|
|
d041fd4bc6 | ||
|
|
e232e6d2a5 | ||
|
|
c738435fe0 | ||
|
|
cca2b20c3d | ||
|
|
105c454d73 | ||
|
|
cf6feefebc | ||
|
|
1857c8f771 | ||
|
|
542ad4ab9c | ||
|
|
9bf8599116 | ||
|
|
170c9a53f1 | ||
|
|
e0d5095099 | ||
|
|
08a8a10478 | ||
|
|
7bbaf14d14 | ||
|
|
b7d0b01122 | ||
|
|
4627266577 | ||
|
|
471ec4b12a | ||
|
|
060a61fd41 | ||
|
|
7cef95225a | ||
|
|
0ae62226bc | ||
|
|
610ab6fdf5 | ||
|
|
81275c0395 | ||
|
|
4a46651839 | ||
|
|
e7f06548fb | ||
|
|
e2a703fc72 | ||
|
|
de75d8374d | ||
|
|
b807fbe69a | ||
|
|
827cd9bcbc | ||
|
|
fa2b607979 | ||
|
|
4fe690e1e2 | ||
|
|
3553daa086 | ||
|
|
a4c5bcfbdf | ||
|
|
026c2696b6 | ||
|
|
6cb4168f44 | ||
|
|
b82ef82f50 | ||
|
|
9a18434f4a | ||
|
|
f126eacf8c | ||
|
|
848b12ce5d | ||
|
|
3d350bd9e5 | ||
|
|
e03dd8c5a6 | ||
|
|
9101a5b48e | ||
|
|
1186f4f620 | ||
|
|
988fcaf855 | ||
|
|
b27031f7c4 | ||
|
|
7ee60e7313 | ||
|
|
671090b1b1 | ||
|
|
0f03bb7446 | ||
|
|
55a1e5bf8f | ||
|
|
33ae035adc | ||
|
|
87d575f335 | ||
|
|
e4329f76b1 | ||
|
|
fa4cf20022 | ||
|
|
2ecfc2e12d | ||
|
|
db2ac80a1e | ||
|
|
99490bfc4d | ||
|
|
fce17654f8 | ||
|
|
419207ac12 | ||
|
|
e30ac71044 | ||
|
|
781e348ded | ||
|
|
e16a18e488 | ||
|
|
7cd3cbaae5 | ||
|
|
60f07fddc9 | ||
|
|
068415849f | ||
|
|
e39e2a361a | ||
|
|
9d3e749c38 | ||
|
|
b7c6cb4d81 | ||
|
|
c41b75e364 | ||
|
|
41630bb8c5 | ||
|
|
b9430e7ab6 | ||
|
|
f1f808d079 | ||
|
|
a8a632e1b0 | ||
|
|
a695ec7319 | ||
|
|
c6730335ef | ||
|
|
247b849759 | ||
|
|
0dee178ded | ||
|
|
9359f26788 | ||
|
|
5630765215 | ||
|
|
ed4a78b109 | ||
|
|
9acb22e2f9 | ||
|
|
6a8361d710 | ||
|
|
502ffee31f | ||
|
|
5a322230ae | ||
|
|
f919c288b2 | ||
|
|
21b948a4f8 | ||
|
|
d04271f942 | ||
|
|
4f08e9ea4d | ||
|
|
67347f1e34 | ||
|
|
75f2b6400d | ||
|
|
26aec1c5af | ||
|
|
0fe7ca0575 | ||
|
|
d745a764fe | ||
|
|
6c273118a2 | ||
|
|
a010a7368a | ||
|
|
08bd00f01f |
@@ -71,7 +71,7 @@ pnpm add @payloadcms/[email protected] @payloadcms/[email protected] \
|
||||
> If your project pulls a different major (e.g. `1.x`), you end up with two copies
|
||||
> and confusing type errors. Pin your project to the same range.
|
||||
|
||||
From here, the guide takes over: **[docs/getting-started.md](./docs/getting-started.md)** —
|
||||
From here, the guide takes over: **[docs/dev/PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** —
|
||||
from an empty project to a working site.
|
||||
|
||||
---
|
||||
@@ -104,7 +104,7 @@ npm version patch # 1.0.0 → 1.0.1
|
||||
npm publish
|
||||
```
|
||||
|
||||
Full checklist and troubleshooting: **[docs/publishing.md](./docs/publishing.md)**.
|
||||
Full checklist and troubleshooting: **[docs/dev/PROGRAMISTA.md §8](./docs/dev/PROGRAMISTA.md)**.
|
||||
|
||||
---
|
||||
|
||||
@@ -112,8 +112,8 @@ Full checklist and troubleshooting: **[docs/publishing.md](./docs/publishing.md)
|
||||
|
||||
Everything lives in the **[docs/](./docs)** directory. To get started:
|
||||
|
||||
- **[getting-started.md](./docs/getting-started.md)** — project setup, step by step
|
||||
- **[publishing.md](./docs/publishing.md)** — releasing new plugin versions
|
||||
- **[AGENT.md](./docs/agent/AGENT.md)** — rules for AI agents (Polish)
|
||||
- **[PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** — setup, deployment, upgrades, releasing (Polish)
|
||||
- **[README.md](./docs/README.md)** — index of the plugin's modules
|
||||
|
||||
---
|
||||
@@ -127,5 +127,5 @@ Everything lives in the **[docs/](./docs)** directory. To get started:
|
||||
| two versions of `lucide-react` | your project pins a different major than the plugin's `^0.400.0` — align them |
|
||||
| `missing secret key … to secure Payload` | `PAYLOAD_SECRET` isn't set in the runtime environment (not a plugin issue) |
|
||||
|
||||
If you get stuck, see **[docs/publishing.md](./docs/publishing.md)** or message the
|
||||
If you get stuck, see **[docs/dev/PROGRAMISTA.md](./docs/dev/PROGRAMISTA.md)** or message the
|
||||
team that maintains the plugin.
|
||||
@@ -0,0 +1,61 @@
|
||||
#!/usr/bin/env node
|
||||
// ipal-skills — copies the ipal-kit agent skills into the project.
|
||||
// pnpm ipal-skills → ./.agents/skills/ipal-*
|
||||
// pnpm ipal-skills --dry-run → show what would change
|
||||
// pnpm ipal-skills --dest .claude/skills
|
||||
// Only folders named ipal-* are touched; the project's own skills stay as they are.
|
||||
// ipal-* folders that no longer exist in the package are removed (renamed/retired skills).
|
||||
|
||||
import { cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync } from 'node:fs'
|
||||
import { dirname, join, relative, resolve } from 'node:path'
|
||||
import { fileURLToPath } from 'node:url'
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
if (args.includes('--help') || args.includes('-h')) {
|
||||
console.log('Usage: ipal-skills [--dest <dir>] [--dry-run]\nDefault dest: .agents/skills')
|
||||
process.exit(0)
|
||||
}
|
||||
const dryRun = args.includes('--dry-run')
|
||||
const destArg = args.indexOf('--dest')
|
||||
const dest = resolve(process.cwd(), destArg >= 0 ? args[destArg + 1] ?? '' : '.agents/skills')
|
||||
|
||||
const pkgRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..')
|
||||
const src = join(pkgRoot, 'docs', 'agent', 'skills')
|
||||
if (!existsSync(src)) {
|
||||
console.error(`ipal-skills: no skills found in ${src} — is @intecion/ipal-kit installed with docs?`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
const isSkillDir = (base, name) => name.startsWith('ipal-') && statSync(join(base, name)).isDirectory()
|
||||
const shipped = readdirSync(src).filter((n) => isSkillDir(src, n))
|
||||
const existing = existsSync(dest) ? readdirSync(dest).filter((n) => isSkillDir(dest, n)) : []
|
||||
const retired = existing.filter((n) => !shipped.includes(n))
|
||||
|
||||
if (!dryRun) mkdirSync(dest, { recursive: true })
|
||||
for (const name of shipped) {
|
||||
const action = existing.includes(name) ? 'update' : 'add '
|
||||
console.log(`${action} ${name}`)
|
||||
if (!dryRun) {
|
||||
rmSync(join(dest, name), { recursive: true, force: true }) // drop files removed upstream
|
||||
cpSync(join(src, name), join(dest, name), { recursive: true })
|
||||
}
|
||||
}
|
||||
for (const name of retired) {
|
||||
console.log(`remove ${name} (no longer in ipal-kit)`)
|
||||
if (!dryRun) rmSync(join(dest, name), { recursive: true, force: true })
|
||||
}
|
||||
console.log(`${dryRun ? '[dry-run] ' : ''}${shipped.length} skill(s) → ${dest}`)
|
||||
|
||||
// Skills ship .ts/.tsx templates and scripts. A Next tsconfig ("include": ["**/*.tsx"]) would
|
||||
// type-check them as project code and break `tsc` / `next build` → they must be excluded.
|
||||
const tsconfig = join(process.cwd(), 'tsconfig.json')
|
||||
const top = relative(process.cwd(), dest).split(/[\\/]/)[0]
|
||||
if (existsSync(tsconfig) && top && !top.startsWith('..')) {
|
||||
const text = readFileSync(tsconfig, 'utf8')
|
||||
const exclude = text.match(/"exclude"\s*:\s*\[([^\]]*)\]/)?.[1] ?? ''
|
||||
if (!exclude.includes(top)) {
|
||||
console.warn(`\n⚠ tsconfig.json does not exclude "${top}" — skill templates would be type-checked and break the build.`)
|
||||
console.warn(` Add it: "exclude": ["node_modules", "${top}"]`)
|
||||
process.exitCode = 1
|
||||
}
|
||||
}
|
||||
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/admin
|
||||
*
|
||||
* Admin-panel UI components (white-label branding, array row labels). Separate export so Payload's
|
||||
* importMap can resolve them by a stable path when ipalKit injects
|
||||
* admin.components.graphics.Logo/Icon.
|
||||
*/
|
||||
export { AdminIcon, AdminLogo, IntecionCredit } from '../modules/branding/index.js';
|
||||
Vendored
+10
@@ -0,0 +1,10 @@
|
||||
export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/admin
|
||||
*
|
||||
* Admin-panel UI components (white-label branding, array row labels). Separate export so Payload's
|
||||
* importMap can resolve them by a stable path when ipalKit injects
|
||||
* admin.components.graphics.Logo/Icon.
|
||||
*/ export { AdminIcon, AdminLogo, IntecionCredit } from '../modules/branding/index.js';
|
||||
|
||||
//# sourceMappingURL=admin.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/admin.ts"],"sourcesContent":["export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js'\n/**\n * Entry point: @intecion/ipal-kit/admin\n *\n * Admin-panel UI components (white-label branding, array row labels). Separate export so Payload's\n * importMap can resolve them by a stable path when ipalKit injects\n * admin.components.graphics.Logo/Icon.\n */\nexport { AdminIcon, AdminLogo, IntecionCredit } from '../modules/branding/index.js'\n"],"names":["RowLabel","AdminIcon","AdminLogo","IntecionCredit"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,2CAA0C;AACnE;;;;;;CAMC,GACD,SAASC,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ,+BAA8B"}
|
||||
Vendored
+21
-1
@@ -1,6 +1,11 @@
|
||||
export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
|
||||
export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
|
||||
export { AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js';
|
||||
export type { A11yClassNames, A11yState, A11yTexts } from '../modules/accessibility/client.js';
|
||||
export { Analytics } from '../modules/analytics/client.js';
|
||||
export type { AnalyticsProps } from '../modules/analytics/client.js';
|
||||
export { pushDataLayer } from '../modules/analytics/client.js';
|
||||
export { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from '../modules/analytics/client.js';
|
||||
/**
|
||||
* Entry point: ipal-kit/client
|
||||
*
|
||||
@@ -8,7 +13,22 @@ export { Analytics } from '../modules/analytics/client.js';
|
||||
* components. Kept separate from the main entry so server bundles don't pull in
|
||||
* client-only code.
|
||||
*/
|
||||
export { ConsentProvider, CookieBanner, CookieButton, useConsent, useConsentContext, } from '../modules/consent/client.js';
|
||||
export { ConsentProvider, ConsentScript, CookieBanner, CookieButton, useConsent, useConsentContext, } from '../modules/consent/client.js';
|
||||
export type { CookieBannerClassNames } from '../modules/consent/client.js';
|
||||
export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js';
|
||||
export type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js';
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js';
|
||||
export { useContactForm } from '../modules/forms/useContactForm.js';
|
||||
export type { ContactFormErrors, ContactFormValues, SubmitAction } from '../modules/forms/useContactForm.js';
|
||||
export { useForm } from '../modules/forms/useForm.js';
|
||||
export type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js';
|
||||
export { buildValidator, checked, custom, email, isEmail, maxLength, minLength, pattern, required, } from '../modules/forms/validators.js';
|
||||
export type { Rule } from '../modules/forms/validators.js';
|
||||
export { buildLocalizedPath, getLocaleCodes, getLocalizedSlugs, switchLocalePath, } from '../modules/i18n/index.js';
|
||||
export type { I18nConfig, LocalizedSlugs } from '../modules/i18n/index.js';
|
||||
export { AlternateLinksProvider, AlternateLinksUpdater, LanguageSwitcher, useAlternateLinks, useSetAlternateLinks, } from '../modules/i18n/index.js';
|
||||
export type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js';
|
||||
export { LocaleView } from '../modules/pages/LocaleView.js';
|
||||
export { Turnstile } from '../modules/turnstile/client.js';
|
||||
export { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js';
|
||||
export type { TurnstileProps } from '../modules/turnstile/client.js';
|
||||
|
||||
Vendored
+15
-1
@@ -1,14 +1,28 @@
|
||||
'use client';
|
||||
export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
|
||||
export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
|
||||
export { AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js';
|
||||
export { Analytics } from '../modules/analytics/client.js';
|
||||
export { pushDataLayer } from '../modules/analytics/client.js';
|
||||
export { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from '../modules/analytics/client.js';
|
||||
/**
|
||||
* Entry point: ipal-kit/client
|
||||
*
|
||||
* Client-side ('use client') exports — React hooks, providers, and UI
|
||||
* components. Kept separate from the main entry so server bundles don't pull in
|
||||
* client-only code.
|
||||
*/ export { ConsentProvider, CookieBanner, CookieButton, useConsent, useConsentContext } from '../modules/consent/client.js';
|
||||
*/ export { ConsentProvider, ConsentScript, CookieBanner, CookieButton, useConsent, useConsentContext } from '../modules/consent/client.js';
|
||||
export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js';
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js';
|
||||
export { useContactForm } from '../modules/forms/useContactForm.js';
|
||||
export { useForm } from '../modules/forms/useForm.js';
|
||||
export { buildValidator, checked, custom, email, isEmail, maxLength, minLength, pattern, required } from '../modules/forms/validators.js';
|
||||
// Pure i18n path helpers — no server/RSC deps, safe to import in client
|
||||
// components (e.g. a LanguageSwitcher that computes locale URLs on the client).
|
||||
export { buildLocalizedPath, getLocaleCodes, getLocalizedSlugs, switchLocalePath } from '../modules/i18n/index.js';
|
||||
export { AlternateLinksProvider, AlternateLinksUpdater, LanguageSwitcher, useAlternateLinks, useSetAlternateLinks } from '../modules/i18n/index.js';
|
||||
export { LocaleView } from '../modules/pages/LocaleView.js';
|
||||
export { Turnstile } from '../modules/turnstile/client.js';
|
||||
export { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js';
|
||||
|
||||
//# sourceMappingURL=client.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\nexport { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js'\nexport { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js'\nexport { Analytics } from '../modules/analytics/client.js'\n/**\n * Entry point: ipal-kit/client\n *\n * Client-side ('use client') exports — React hooks, providers, and UI\n * components. Kept separate from the main entry so server bundles don't pull in\n * client-only code.\n */\nexport {\n ConsentProvider,\n CookieBanner,\n CookieButton,\n useConsent,\n useConsentContext,\n} from '../modules/consent/client.js'\nexport type { CookieBannerClassNames } from '../modules/consent/client.js'\nexport { Turnstile } from '../modules/turnstile/client.js'\nexport type { TurnstileProps } from '../modules/turnstile/client.js'\n"],"names":["MaskedField","TestEmailButton","Analytics","ConsentProvider","CookieBanner","CookieButton","useConsent","useConsentContext","Turnstile"],"mappings":"AAAA;AACA,SAASA,WAAW,QAAQ,wDAAuD;AACnF,SAASC,eAAe,QAAQ,4DAA2D;AAC3F,SAASC,SAAS,QAAQ,iCAAgC;AAC1D;;;;;;CAMC,GACD,SACEC,eAAe,EACfC,YAAY,EACZC,YAAY,EACZC,UAAU,EACVC,iBAAiB,QACZ,+BAA8B;AAErC,SAASC,SAAS,QAAQ,iCAAgC"}
|
||||
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\nexport { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js'\nexport { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js'\nexport { AccessibilityProvider, AccessibilityWidget, useAccessibility } from '../modules/accessibility/client.js'\nexport type { A11yClassNames, A11yState, A11yTexts } from '../modules/accessibility/client.js'\nexport { Analytics } from '../modules/analytics/client.js'\nexport type { AnalyticsProps } from '../modules/analytics/client.js'\n\nexport { pushDataLayer } from '../modules/analytics/client.js'\nexport { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from '../modules/analytics/client.js'\n/**\n * Entry point: ipal-kit/client\n *\n * Client-side ('use client') exports — React hooks, providers, and UI\n * components. Kept separate from the main entry so server bundles don't pull in\n * client-only code.\n */\nexport {\n ConsentProvider,\n ConsentScript,\n CookieBanner,\n CookieButton,\n useConsent,\n useConsentContext,\n} from '../modules/consent/client.js'\nexport type { CookieBannerClassNames } from '../modules/consent/client.js'\nexport { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js'\nexport type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js'\nexport { useContactForm } from '../modules/forms/useContactForm.js'\nexport type { ContactFormErrors, ContactFormValues, SubmitAction } from '../modules/forms/useContactForm.js'\nexport { useForm } from '../modules/forms/useForm.js'\nexport type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js'\nexport {\n buildValidator,\n checked,\n custom,\n email,\n isEmail,\n maxLength,\n minLength,\n pattern,\n required,\n} from '../modules/forms/validators.js'\nexport type { Rule } from '../modules/forms/validators.js'\n// Pure i18n path helpers — no server/RSC deps, safe to import in client\n// components (e.g. a LanguageSwitcher that computes locale URLs on the client).\nexport {\n buildLocalizedPath,\n getLocaleCodes,\n getLocalizedSlugs,\n switchLocalePath,\n} from '../modules/i18n/index.js'\nexport type { I18nConfig, LocalizedSlugs } from '../modules/i18n/index.js'\nexport {\n AlternateLinksProvider,\n AlternateLinksUpdater,\n LanguageSwitcher,\n useAlternateLinks,\n useSetAlternateLinks,\n} from '../modules/i18n/index.js'\nexport type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js'\nexport { LocaleView } from '../modules/pages/LocaleView.js'\nexport { Turnstile } from '../modules/turnstile/client.js'\nexport { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js'\nexport type { TurnstileProps } from '../modules/turnstile/client.js'\n"],"names":["MaskedField","TestEmailButton","AccessibilityProvider","AccessibilityWidget","useAccessibility","Analytics","pushDataLayer","loadClarity","loadLinkedIn","loadMetaPixel","loadTikTok","ConsentProvider","ConsentScript","CookieBanner","CookieButton","useConsent","useConsentContext","formAnalyticsOnSuccess","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","useContactForm","useForm","buildValidator","checked","custom","email","isEmail","maxLength","minLength","pattern","required","buildLocalizedPath","getLocaleCodes","getLocalizedSlugs","switchLocalePath","AlternateLinksProvider","AlternateLinksUpdater","LanguageSwitcher","useAlternateLinks","useSetAlternateLinks","LocaleView","Turnstile","TurnstileProvider","useTurnstile"],"mappings":"AAAA;AACA,SAASA,WAAW,QAAQ,wDAAuD;AACnF,SAASC,eAAe,QAAQ,4DAA2D;AAC3F,SAASC,qBAAqB,EAAEC,mBAAmB,EAAEC,gBAAgB,QAAQ,qCAAoC;AAEjH,SAASC,SAAS,QAAQ,iCAAgC;AAG1D,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,WAAW,EAAEC,YAAY,EAAEC,aAAa,EAAEC,UAAU,QAAQ,iCAAgC;AACrG;;;;;;CAMC,GACD,SACEC,eAAe,EACfC,aAAa,EACbC,YAAY,EACZC,YAAY,EACZC,UAAU,EACVC,iBAAiB,QACZ,+BAA8B;AAErC,SAASC,sBAAsB,QAAQ,oCAAmC;AAE1E,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,iBAAiB,QAAQ,+BAA8B;AACpG,SAASC,cAAc,QAAQ,qCAAoC;AAEnE,SAASC,OAAO,QAAQ,8BAA6B;AAErD,SACEC,cAAc,EACdC,OAAO,EACPC,MAAM,EACNC,KAAK,EACLC,OAAO,EACPC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,QAAQ,QACH,iCAAgC;AAEvC,wEAAwE;AACxE,gFAAgF;AAChF,SACEC,kBAAkB,EAClBC,cAAc,EACdC,iBAAiB,EACjBC,gBAAgB,QACX,2BAA0B;AAEjC,SACEC,sBAAsB,EACtBC,qBAAqB,EACrBC,gBAAgB,EAChBC,iBAAiB,EACjBC,oBAAoB,QACf,2BAA0B;AAEjC,SAASC,UAAU,QAAQ,iCAAgC;AAC3D,SAASC,SAAS,QAAQ,iCAAgC;AAC1D,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,iCAAgC"}
|
||||
Vendored
+1
@@ -7,3 +7,4 @@
|
||||
*/
|
||||
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from '../modules/i18n/index.js';
|
||||
export type { LocaleMiddlewareResult } from '../modules/i18n/index.js';
|
||||
export { createProxy, DEFAULT_PROXY_MATCHER } from '../modules/i18n/index.js';
|
||||
|
||||
Vendored
+1
@@ -5,5 +5,6 @@
|
||||
* client project's middleware.ts. Kept as a thin re-export so the Next-facing
|
||||
* surface is separate from the main package export.
|
||||
*/ export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from '../modules/i18n/index.js';
|
||||
export { createProxy, DEFAULT_PROXY_MATCHER } from '../modules/i18n/index.js';
|
||||
|
||||
//# sourceMappingURL=next-middleware.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/next-middleware.ts"],"sourcesContent":["/**\n * Entry point: ipal-kit/next/middleware\n *\n * Re-exports the locale middleware factory and default matcher for use in a\n * client project's middleware.ts. Kept as a thin re-export so the Next-facing\n * surface is separate from the main package export.\n */\nexport { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from '../modules/i18n/index.js'\nexport type { LocaleMiddlewareResult } from '../modules/i18n/index.js'\n"],"names":["createLocaleMiddleware","DEFAULT_MIDDLEWARE_MATCHER"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,sBAAsB,EAAEC,0BAA0B,QAAQ,2BAA0B"}
|
||||
{"version":3,"sources":["../../src/exports/next-middleware.ts"],"sourcesContent":["/**\n * Entry point: ipal-kit/next/middleware\n *\n * Re-exports the locale middleware factory and default matcher for use in a\n * client project's middleware.ts. Kept as a thin re-export so the Next-facing\n * surface is separate from the main package export.\n */\nexport { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from '../modules/i18n/index.js'\nexport type { LocaleMiddlewareResult } from '../modules/i18n/index.js'\nexport { createProxy, DEFAULT_PROXY_MATCHER } from '../modules/i18n/index.js'\n"],"names":["createLocaleMiddleware","DEFAULT_MIDDLEWARE_MATCHER","createProxy","DEFAULT_PROXY_MATCHER"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,sBAAsB,EAAEC,0BAA0B,QAAQ,2BAA0B;AAE7F,SAASC,WAAW,EAAEC,qBAAqB,QAAQ,2BAA0B"}
|
||||
Vendored
+4
@@ -7,3 +7,7 @@
|
||||
*/
|
||||
export { RenderBlocks } from '../modules/blocks/index.js';
|
||||
export type { BlockComponentMap, BlockData, EnhanceProps, RenderBlocksProps, } from '../modules/blocks/index.js';
|
||||
export { RenderRichText } from '../modules/richtext/index.js';
|
||||
export type { RenderRichTextProps } from '../modules/richtext/index.js';
|
||||
export { JsonLdGraph } from '../modules/seo/index.js';
|
||||
export { MediaPreconnect } from '../modules/storage/MediaPreconnect.js';
|
||||
|
||||
Vendored
+3
@@ -5,5 +5,8 @@
|
||||
* lives here rather than in the main package entry to keep React out of the
|
||||
* server-config bundle.
|
||||
*/ export { RenderBlocks } from '../modules/blocks/index.js';
|
||||
export { RenderRichText } from '../modules/richtext/index.js';
|
||||
export { JsonLdGraph } from '../modules/seo/index.js';
|
||||
export { MediaPreconnect } from '../modules/storage/MediaPreconnect.js';
|
||||
|
||||
//# sourceMappingURL=rsc.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/rsc.ts"],"sourcesContent":["/**\n * Entry point: ipal-kit/rsc\n *\n * Server-component exports. RenderBlocks is a React Server Component, so it\n * lives here rather than in the main package entry to keep React out of the\n * server-config bundle.\n */\nexport { RenderBlocks } from '../modules/blocks/index.js'\nexport type {\n BlockComponentMap,\n BlockData,\n EnhanceProps,\n RenderBlocksProps,\n} from '../modules/blocks/index.js'\n"],"names":["RenderBlocks"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,YAAY,QAAQ,6BAA4B"}
|
||||
{"version":3,"sources":["../../src/exports/rsc.ts"],"sourcesContent":["/**\n * Entry point: ipal-kit/rsc\n *\n * Server-component exports. RenderBlocks is a React Server Component, so it\n * lives here rather than in the main package entry to keep React out of the\n * server-config bundle.\n */\nexport { RenderBlocks } from '../modules/blocks/index.js'\nexport type {\n BlockComponentMap,\n BlockData,\n EnhanceProps,\n RenderBlocksProps,\n} from '../modules/blocks/index.js'\nexport { RenderRichText } from '../modules/richtext/index.js'\nexport type { RenderRichTextProps } from '../modules/richtext/index.js'\nexport { JsonLdGraph } from '../modules/seo/index.js'\nexport { MediaPreconnect } from '../modules/storage/MediaPreconnect.js'\n"],"names":["RenderBlocks","RenderRichText","JsonLdGraph","MediaPreconnect"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,YAAY,QAAQ,6BAA4B;AAOzD,SAASC,cAAc,QAAQ,+BAA8B;AAE7D,SAASC,WAAW,QAAQ,0BAAyB;AACrD,SAASC,eAAe,QAAQ,wCAAuC"}
|
||||
+3
-2
@@ -1,7 +1,8 @@
|
||||
import type { Field } from 'payload';
|
||||
/**
|
||||
* Fields for the CookieSettings global — GDPR consent banner copy, editable
|
||||
* per locale. The privacy-policy link is NOT stored here: it comes from the
|
||||
* pages module (system page role 'privacyPolicy'), keeping one source of truth.
|
||||
* per locale. The privacy-policy link TARGET is NOT stored here: it comes from
|
||||
* the pages module (system page role 'privacyPolicy'), keeping one source of
|
||||
* truth. Only the link's visible text lives here (privacyLinkLabel).
|
||||
*/
|
||||
export declare const cookieSettingsFields: Field[];
|
||||
|
||||
+12
-3
@@ -1,8 +1,9 @@
|
||||
import { CONSENT_CATEGORIES } from '../../modules/consent/index.js';
|
||||
import { CONSENT_CATEGORIES } from '../../modules/consent/categories.js';
|
||||
/**
|
||||
* Fields for the CookieSettings global — GDPR consent banner copy, editable
|
||||
* per locale. The privacy-policy link is NOT stored here: it comes from the
|
||||
* pages module (system page role 'privacyPolicy'), keeping one source of truth.
|
||||
* per locale. The privacy-policy link TARGET is NOT stored here: it comes from
|
||||
* the pages module (system page role 'privacyPolicy'), keeping one source of
|
||||
* truth. Only the link's visible text lives here (privacyLinkLabel).
|
||||
*/ export const cookieSettingsFields = [
|
||||
{
|
||||
name: 'message',
|
||||
@@ -20,6 +21,14 @@ import { CONSENT_CATEGORIES } from '../../modules/consent/index.js';
|
||||
},
|
||||
localized: true
|
||||
},
|
||||
{
|
||||
name: 'privacyLinkLabel',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'Text of the privacy-policy link in the banner, e.g. "Privacy policy". The link target is the page assigned as Privacy Policy in Site Settings → System Pages. Empty → the page title is used.'
|
||||
},
|
||||
localized: true
|
||||
},
|
||||
{
|
||||
name: 'buttons',
|
||||
type: 'group',
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/globals/CookieSettings/fields.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { CONSENT_CATEGORIES } from '../../modules/consent/index.js'\n\n/**\n * Fields for the CookieSettings global — GDPR consent banner copy, editable\n * per locale. The privacy-policy link is NOT stored here: it comes from the\n * pages module (system page role 'privacyPolicy'), keeping one source of truth.\n */\nexport const cookieSettingsFields: Field[] = [\n {\n name: 'message',\n type: 'textarea',\n admin: {\n description: 'Main consent message shown in the banner.',\n },\n localized: true,\n },\n {\n name: 'settingsTitle',\n type: 'text',\n admin: {\n description: 'Heading for the detailed settings panel.',\n },\n localized: true,\n },\n {\n name: 'buttons',\n type: 'group',\n admin: {\n description: 'Button labels.',\n },\n fields: [\n { name: 'acceptAll', type: 'text', localized: true },\n { name: 'reject', type: 'text', localized: true },\n { name: 'settings', type: 'text', localized: true },\n { name: 'save', type: 'text', localized: true },\n { name: 'back', type: 'text', localized: true },\n ],\n },\n {\n name: 'categories',\n type: 'array',\n admin: {\n description: 'Per-category titles and descriptions.',\n },\n fields: [\n {\n name: 'key',\n type: 'select',\n options: CONSENT_CATEGORIES.map((c) => ({ label: c, value: c })),\n required: true,\n },\n { name: 'title', type: 'text', localized: true },\n { name: 'description', type: 'textarea', localized: true },\n ],\n },\n]\n"],"names":["CONSENT_CATEGORIES","cookieSettingsFields","name","type","admin","description","localized","fields","options","map","c","label","value","required"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ,iCAAgC;AAEnE;;;;CAIC,GACD,OAAO,MAAMC,uBAAgC;IAC3C;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAC,WAAW;IACb;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAC,WAAW;IACb;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAE,QAAQ;YACN;gBAAEL,MAAM;gBAAaC,MAAM;gBAAQG,WAAW;YAAK;YACnD;gBAAEJ,MAAM;gBAAUC,MAAM;gBAAQG,WAAW;YAAK;YAChD;gBAAEJ,MAAM;gBAAYC,MAAM;gBAAQG,WAAW;YAAK;YAClD;gBAAEJ,MAAM;gBAAQC,MAAM;gBAAQG,WAAW;YAAK;YAC9C;gBAAEJ,MAAM;gBAAQC,MAAM;gBAAQG,WAAW;YAAK;SAC/C;IACH;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAE,QAAQ;YACN;gBACEL,MAAM;gBACNC,MAAM;gBACNK,SAASR,mBAAmBS,GAAG,CAAC,CAACC,IAAO,CAAA;wBAAEC,OAAOD;wBAAGE,OAAOF;oBAAE,CAAA;gBAC7DG,UAAU;YACZ;YACA;gBAAEX,MAAM;gBAASC,MAAM;gBAAQG,WAAW;YAAK;YAC/C;gBAAEJ,MAAM;gBAAeC,MAAM;gBAAYG,WAAW;YAAK;SAC1D;IACH;CACD,CAAA"}
|
||||
{"version":3,"sources":["../../../src/globals/CookieSettings/fields.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { CONSENT_CATEGORIES } from '../../modules/consent/categories.js'\n\n/**\n * Fields for the CookieSettings global — GDPR consent banner copy, editable\n * per locale. The privacy-policy link TARGET is NOT stored here: it comes from\n * the pages module (system page role 'privacyPolicy'), keeping one source of\n * truth. Only the link's visible text lives here (privacyLinkLabel).\n */\nexport const cookieSettingsFields: Field[] = [\n {\n name: 'message',\n type: 'textarea',\n admin: {\n description: 'Main consent message shown in the banner.',\n },\n localized: true,\n },\n {\n name: 'settingsTitle',\n type: 'text',\n admin: {\n description: 'Heading for the detailed settings panel.',\n },\n localized: true,\n },\n {\n name: 'privacyLinkLabel',\n type: 'text',\n admin: {\n description:\n 'Text of the privacy-policy link in the banner, e.g. \"Privacy policy\". The link target is the page assigned as Privacy Policy in Site Settings → System Pages. Empty → the page title is used.',\n },\n localized: true,\n },\n {\n name: 'buttons',\n type: 'group',\n admin: {\n description: 'Button labels.',\n },\n fields: [\n { name: 'acceptAll', type: 'text', localized: true },\n { name: 'reject', type: 'text', localized: true },\n { name: 'settings', type: 'text', localized: true },\n { name: 'save', type: 'text', localized: true },\n { name: 'back', type: 'text', localized: true },\n ],\n },\n {\n name: 'categories',\n type: 'array',\n admin: {\n description: 'Per-category titles and descriptions.',\n },\n fields: [\n {\n name: 'key',\n type: 'select',\n options: CONSENT_CATEGORIES.map((c) => ({ label: c, value: c })),\n required: true,\n },\n { name: 'title', type: 'text', localized: true },\n { name: 'description', type: 'textarea', localized: true },\n ],\n },\n]\n"],"names":["CONSENT_CATEGORIES","cookieSettingsFields","name","type","admin","description","localized","fields","options","map","c","label","value","required"],"mappings":"AAEA,SAASA,kBAAkB,QAAQ,sCAAqC;AAExE;;;;;CAKC,GACD,OAAO,MAAMC,uBAAgC;IAC3C;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAC,WAAW;IACb;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAC,WAAW;IACb;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aACE;QACJ;QACAC,WAAW;IACb;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAE,QAAQ;YACN;gBAAEL,MAAM;gBAAaC,MAAM;gBAAQG,WAAW;YAAK;YACnD;gBAAEJ,MAAM;gBAAUC,MAAM;gBAAQG,WAAW;YAAK;YAChD;gBAAEJ,MAAM;gBAAYC,MAAM;gBAAQG,WAAW;YAAK;YAClD;gBAAEJ,MAAM;gBAAQC,MAAM;gBAAQG,WAAW;YAAK;YAC9C;gBAAEJ,MAAM;gBAAQC,MAAM;gBAAQG,WAAW;YAAK;SAC/C;IACH;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAE,QAAQ;YACN;gBACEL,MAAM;gBACNC,MAAM;gBACNK,SAASR,mBAAmBS,GAAG,CAAC,CAACC,IAAO,CAAA;wBAAEC,OAAOD;wBAAGE,OAAOF;oBAAE,CAAA;gBAC7DG,UAAU;YACZ;YACA;gBAAEX,MAAM;gBAASC,MAAM;gBAAQG,WAAW;YAAK;YAC/C;gBAAEJ,MAAM;gBAAeC,MAAM;gBAAYG,WAAW;YAAK;SAC1D;IACH;CACD,CAAA"}
|
||||
Vendored
+2
-2
@@ -6,11 +6,11 @@ import { notificationsFields } from './fields.js';
|
||||
*/ export function buildNotifications() {
|
||||
return {
|
||||
slug: 'notifications',
|
||||
label: 'Notifications',
|
||||
access: {
|
||||
read: ()=>true
|
||||
},
|
||||
fields: notificationsFields
|
||||
fields: notificationsFields,
|
||||
label: 'Notifications'
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/globals/Notifications/index.ts"],"sourcesContent":["import type { GlobalConfig } from 'payload'\nimport { notificationsFields } from './fields.js'\n\n/**\n * Builds the Notifications global — localized action-result texts. Readable by\n * any authenticated panel user; server-side helpers read it with overrideAccess\n * so the frontend can resolve texts without a session.\n */\nexport function buildNotifications(): GlobalConfig {\n return {\n slug: 'notifications',\n label: 'Notifications',\n access: {\n read: () => true, // texts are public-facing (shown to end users)\n },\n fields: notificationsFields,\n }\n}\n"],"names":["notificationsFields","buildNotifications","slug","label","access","read","fields"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAa;AAEjD;;;;CAIC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,MAAM;QACNC,OAAO;QACPC,QAAQ;YACNC,MAAM,IAAM;QACd;QACAC,QAAQN;IACV;AACF"}
|
||||
{"version":3,"sources":["../../../src/globals/Notifications/index.ts"],"sourcesContent":["import type { GlobalConfig } from 'payload'\n\nimport { notificationsFields } from './fields.js'\n\n/**\n * Builds the Notifications global — localized action-result texts. Readable by\n * any authenticated panel user; server-side helpers read it with overrideAccess\n * so the frontend can resolve texts without a session.\n */\nexport function buildNotifications(): GlobalConfig {\n return {\n slug: 'notifications',\n access: {\n read: () => true, // texts are public-facing (shown to end users)\n },\n fields: notificationsFields,\n label: 'Notifications',\n }\n}\n"],"names":["notificationsFields","buildNotifications","slug","access","read","fields","label"],"mappings":"AAEA,SAASA,mBAAmB,QAAQ,cAAa;AAEjD;;;;CAIC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,MAAM;QACNC,QAAQ;YACNC,MAAM,IAAM;QACd;QACAC,QAAQL;QACRM,OAAO;IACT;AACF"}
|
||||
+17
-8
@@ -1,17 +1,26 @@
|
||||
'use client';
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { useField } from '@payloadcms/ui';
|
||||
import { useState } from 'react';
|
||||
export const MaskedField = ({ field, path })=>{
|
||||
const { setValue, value } = useField({
|
||||
path
|
||||
});
|
||||
export const MaskedField = (props)=>{
|
||||
const { field, path, value: propValue, setValue: propSetValue, onChange: propOnChange } = props || {};
|
||||
const [internalValue, setInternalValue] = useState(propValue ?? '');
|
||||
const [revealed, setRevealed] = useState(false);
|
||||
const label = typeof field?.label === 'string' ? field.label : field?.name ?? path;
|
||||
const handleChange = (e)=>{
|
||||
const newVal = e.target.value;
|
||||
setInternalValue(newVal);
|
||||
if (typeof propSetValue === 'function') {
|
||||
propSetValue(newVal);
|
||||
}
|
||||
if (typeof propOnChange === 'function') {
|
||||
propOnChange(e);
|
||||
}
|
||||
};
|
||||
const currentValue = propValue !== undefined ? propValue : internalValue;
|
||||
return /*#__PURE__*/ _jsxs("div", {
|
||||
className: "field-type text",
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("label", {
|
||||
label && /*#__PURE__*/ _jsx("label", {
|
||||
className: "field-label",
|
||||
children: label
|
||||
}),
|
||||
@@ -23,12 +32,12 @@ export const MaskedField = ({ field, path })=>{
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("input", {
|
||||
autoComplete: "off",
|
||||
onChange: (e)=>setValue(e.target.value),
|
||||
onChange: handleChange,
|
||||
style: {
|
||||
flex: 1
|
||||
},
|
||||
type: revealed ? 'text' : 'password',
|
||||
value: value ?? ''
|
||||
value: currentValue ?? ''
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
onClick: ()=>setRevealed((r)=>!r),
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/components/MaskedField.tsx"],"sourcesContent":["'use client'\nimport type { TextFieldClientComponent } from 'payload'\n\nimport { useField } from '@payloadcms/ui'\nimport { useState } from 'react'\n\nexport const MaskedField: TextFieldClientComponent = ({ field, path }) => {\n const { setValue, value } = useField<string>({ path })\n const [revealed, setRevealed] = useState(false)\n const label = typeof field?.label === 'string' ? field.label : (field?.name ?? path)\n\n return (\n <div className=\"field-type text\">\n <label className=\"field-label\">{label}</label>\n <div style={{ display: 'flex', gap: '.5rem' }}>\n <input\n autoComplete=\"off\"\n onChange={(e) => setValue(e.target.value)}\n style={{ flex: 1 }}\n type={revealed ? 'text' : 'password'}\n value={value ?? ''}\n />\n <button onClick={() => setRevealed((r) => !r)} type=\"button\">\n {revealed ? 'Hide' : 'Reveal'}\n </button>\n </div>\n </div>\n )\n}\nexport default MaskedField\n"],"names":["useField","useState","MaskedField","field","path","setValue","value","revealed","setRevealed","label","name","div","className","style","display","gap","input","autoComplete","onChange","e","target","flex","type","button","onClick","r"],"mappings":"AAAA;;AAGA,SAASA,QAAQ,QAAQ,iBAAgB;AACzC,SAASC,QAAQ,QAAQ,QAAO;AAEhC,OAAO,MAAMC,cAAwC,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAE;IACnE,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGN,SAAiB;QAAEI;IAAK;IACpD,MAAM,CAACG,UAAUC,YAAY,GAAGP,SAAS;IACzC,MAAMQ,QAAQ,OAAON,OAAOM,UAAU,WAAWN,MAAMM,KAAK,GAAIN,OAAOO,QAAQN;IAE/E,qBACE,MAACO;QAAIC,WAAU;;0BACb,KAACH;gBAAMG,WAAU;0BAAeH;;0BAChC,MAACE;gBAAIE,OAAO;oBAAEC,SAAS;oBAAQC,KAAK;gBAAQ;;kCAC1C,KAACC;wBACCC,cAAa;wBACbC,UAAU,CAACC,IAAMd,SAASc,EAAEC,MAAM,CAACd,KAAK;wBACxCO,OAAO;4BAAEQ,MAAM;wBAAE;wBACjBC,MAAMf,WAAW,SAAS;wBAC1BD,OAAOA,SAAS;;kCAElB,KAACiB;wBAAOC,SAAS,IAAMhB,YAAY,CAACiB,IAAM,CAACA;wBAAIH,MAAK;kCACjDf,WAAW,SAAS;;;;;;AAK/B,EAAC;AACD,eAAeL,YAAW"}
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/components/MaskedField.tsx"],"sourcesContent":["'use client'\nimport type { TextFieldClientComponent } from 'payload'\nimport { useState } from 'react'\n\nexport const MaskedField: TextFieldClientComponent = (props: any) => {\n const { field, path, value: propValue, setValue: propSetValue, onChange: propOnChange } = props || {}\n const [internalValue, setInternalValue] = useState(propValue ?? '')\n const [revealed, setRevealed] = useState(false)\n const label = typeof field?.label === 'string' ? field.label : (field?.name ?? path)\n\n const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {\n const newVal = e.target.value\n setInternalValue(newVal)\n if (typeof propSetValue === 'function') {\n propSetValue(newVal)\n }\n if (typeof propOnChange === 'function') {\n propOnChange(e)\n }\n }\n\n const currentValue = propValue !== undefined ? propValue : internalValue\n\n return (\n <div className=\"field-type text\">\n {label && <label className=\"field-label\">{label}</label>}\n <div style={{ display: 'flex', gap: '.5rem' }}>\n <input\n autoComplete=\"off\"\n onChange={handleChange}\n style={{ flex: 1 }}\n type={revealed ? 'text' : 'password'}\n value={currentValue ?? ''}\n />\n <button onClick={() => setRevealed((r) => !r)} type=\"button\">\n {revealed ? 'Hide' : 'Reveal'}\n </button>\n </div>\n </div>\n )\n}\n\nexport default MaskedField\n"],"names":["useState","MaskedField","props","field","path","value","propValue","setValue","propSetValue","onChange","propOnChange","internalValue","setInternalValue","revealed","setRevealed","label","name","handleChange","e","newVal","target","currentValue","undefined","div","className","style","display","gap","input","autoComplete","flex","type","button","onClick","r"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,QAAO;AAEhC,OAAO,MAAMC,cAAwC,CAACC;IACpD,MAAM,EAAEC,KAAK,EAAEC,IAAI,EAAEC,OAAOC,SAAS,EAAEC,UAAUC,YAAY,EAAEC,UAAUC,YAAY,EAAE,GAAGR,SAAS,CAAC;IACpG,MAAM,CAACS,eAAeC,iBAAiB,GAAGZ,SAASM,aAAa;IAChE,MAAM,CAACO,UAAUC,YAAY,GAAGd,SAAS;IACzC,MAAMe,QAAQ,OAAOZ,OAAOY,UAAU,WAAWZ,MAAMY,KAAK,GAAIZ,OAAOa,QAAQZ;IAE/E,MAAMa,eAAe,CAACC;QACpB,MAAMC,SAASD,EAAEE,MAAM,CAACf,KAAK;QAC7BO,iBAAiBO;QACjB,IAAI,OAAOX,iBAAiB,YAAY;YACtCA,aAAaW;QACf;QACA,IAAI,OAAOT,iBAAiB,YAAY;YACtCA,aAAaQ;QACf;IACF;IAEA,MAAMG,eAAef,cAAcgB,YAAYhB,YAAYK;IAE3D,qBACE,MAACY;QAAIC,WAAU;;YACZT,uBAAS,KAACA;gBAAMS,WAAU;0BAAeT;;0BAC1C,MAACQ;gBAAIE,OAAO;oBAAEC,SAAS;oBAAQC,KAAK;gBAAQ;;kCAC1C,KAACC;wBACCC,cAAa;wBACbpB,UAAUQ;wBACVQ,OAAO;4BAAEK,MAAM;wBAAE;wBACjBC,MAAMlB,WAAW,SAAS;wBAC1BR,OAAOgB,gBAAgB;;kCAEzB,KAACW;wBAAOC,SAAS,IAAMnB,YAAY,CAACoB,IAAM,CAACA;wBAAIH,MAAK;kCACjDlB,WAAW,SAAS;;;;;;AAK/B,EAAC;AAED,eAAeZ,YAAW"}
|
||||
+3
-2
@@ -1,6 +1,7 @@
|
||||
import type { Field } from 'payload';
|
||||
/**
|
||||
* Analytics configuration — GA4 measurement ID and GTM container ID.
|
||||
* IDs are public (exposed client-side), so no read restriction needed.
|
||||
* Analytics / marketing tag IDs. All are PUBLIC (exposed client-side), so no
|
||||
* read restriction. Google tags (GA4/GTM) use Consent Mode; the rest load only
|
||||
* after the matching consent category is granted (see modules/analytics).
|
||||
*/
|
||||
export declare const analyticsFields: Field[];
|
||||
|
||||
+37
-4
@@ -1,12 +1,13 @@
|
||||
/**
|
||||
* Analytics configuration — GA4 measurement ID and GTM container ID.
|
||||
* IDs are public (exposed client-side), so no read restriction needed.
|
||||
* Analytics / marketing tag IDs. All are PUBLIC (exposed client-side), so no
|
||||
* read restriction. Google tags (GA4/GTM) use Consent Mode; the rest load only
|
||||
* after the matching consent category is granted (see modules/analytics).
|
||||
*/ export const analyticsFields = [
|
||||
{
|
||||
name: 'ga4MeasurementId',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'Google Analytics 4 Measurement ID.',
|
||||
description: 'Google Analytics 4 Measurement ID. (Google — Consent Mode)',
|
||||
placeholder: 'G-XXXXXXXXXX'
|
||||
}
|
||||
},
|
||||
@@ -14,9 +15,41 @@
|
||||
name: 'gtmContainerId',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'Google Tag Manager container ID.',
|
||||
description: 'Google Tag Manager container ID. (Google — Consent Mode)',
|
||||
placeholder: 'GTM-XXXXXXX'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'metaPixelId',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'Meta (Facebook) Pixel ID. Loads only after MARKETING consent.',
|
||||
placeholder: '1234567890123456'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'clarityProjectId',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'Microsoft Clarity project ID (heatmaps). Loads only after ANALYTICS consent.',
|
||||
placeholder: 'abcdefghij'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'linkedInPartnerId',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'LinkedIn Insight Tag partner ID. Loads only after MARKETING consent.',
|
||||
placeholder: '1234567'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'tiktokPixelId',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'TikTok Pixel ID. Loads only after MARKETING consent.',
|
||||
placeholder: 'CXXXXXXXXXXXXXXXXXXX'
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/analytics.ts"],"sourcesContent":["import type { Field } from 'payload'\n\n/**\n * Analytics configuration — GA4 measurement ID and GTM container ID.\n * IDs are public (exposed client-side), so no read restriction needed.\n */\nexport const analyticsFields: Field[] = [\n {\n name: 'ga4MeasurementId',\n type: 'text',\n admin: {\n description: 'Google Analytics 4 Measurement ID.',\n placeholder: 'G-XXXXXXXXXX',\n },\n },\n {\n name: 'gtmContainerId',\n type: 'text',\n admin: {\n description: 'Google Tag Manager container ID.',\n placeholder: 'GTM-XXXXXXX',\n },\n },\n]\n"],"names":["analyticsFields","name","type","admin","description","placeholder"],"mappings":"AAEA;;;CAGC,GACD,OAAO,MAAMA,kBAA2B;IACtC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;CACD,CAAA"}
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/analytics.ts"],"sourcesContent":["import type { Field } from 'payload'\n\n/**\n * Analytics / marketing tag IDs. All are PUBLIC (exposed client-side), so no\n * read restriction. Google tags (GA4/GTM) use Consent Mode; the rest load only\n * after the matching consent category is granted (see modules/analytics).\n */\nexport const analyticsFields: Field[] = [\n {\n name: 'ga4MeasurementId',\n type: 'text',\n admin: {\n description: 'Google Analytics 4 Measurement ID. (Google — Consent Mode)',\n placeholder: 'G-XXXXXXXXXX',\n },\n },\n {\n name: 'gtmContainerId',\n type: 'text',\n admin: {\n description: 'Google Tag Manager container ID. (Google — Consent Mode)',\n placeholder: 'GTM-XXXXXXX',\n },\n },\n {\n name: 'metaPixelId',\n type: 'text',\n admin: {\n description: 'Meta (Facebook) Pixel ID. Loads only after MARKETING consent.',\n placeholder: '1234567890123456',\n },\n },\n {\n name: 'clarityProjectId',\n type: 'text',\n admin: {\n description: 'Microsoft Clarity project ID (heatmaps). Loads only after ANALYTICS consent.',\n placeholder: 'abcdefghij',\n },\n },\n {\n name: 'linkedInPartnerId',\n type: 'text',\n admin: {\n description: 'LinkedIn Insight Tag partner ID. Loads only after MARKETING consent.',\n placeholder: '1234567',\n },\n },\n {\n name: 'tiktokPixelId',\n type: 'text',\n admin: {\n description: 'TikTok Pixel ID. Loads only after MARKETING consent.',\n placeholder: 'CXXXXXXXXXXXXXXXXXXX',\n },\n },\n]\n"],"names":["analyticsFields","name","type","admin","description","placeholder"],"mappings":"AAEA;;;;CAIC,GACD,OAAO,MAAMA,kBAA2B;IACtC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACbC,aAAa;QACf;IACF;CACD,CAAA"}
|
||||
+4
@@ -14,6 +14,10 @@ type BuildSiteIntegrationsArgs = {
|
||||
* impossible to enter.)
|
||||
*
|
||||
* Unnamed tabs keep data flat (siteIntegrations.ga4MeasurementId).
|
||||
*
|
||||
* Note: R2 storage credentials are NOT here — storage is infrastructure and
|
||||
* binds at boot, so its config lives in .env (R2_BUCKET, R2_ENDPOINT, ...),
|
||||
* consumed by buildR2Storage. See docs/storage.md.
|
||||
*/
|
||||
export declare function buildSiteIntegrations({ additionalFields, }?: BuildSiteIntegrationsArgs): GlobalConfig;
|
||||
export {};
|
||||
|
||||
+4
-5
@@ -1,7 +1,6 @@
|
||||
import { isAdmin } from '../../modules/access/index.js';
|
||||
import { analyticsFields } from './fields/analytics.js';
|
||||
import { smtpFields } from './fields/smtp.js';
|
||||
import { storageFields } from './fields/storage.js';
|
||||
import { turnstileFields } from './fields/turnstile.js';
|
||||
/**
|
||||
* Builds the SiteIntegrations global.
|
||||
@@ -14,6 +13,10 @@ import { turnstileFields } from './fields/turnstile.js';
|
||||
* impossible to enter.)
|
||||
*
|
||||
* Unnamed tabs keep data flat (siteIntegrations.ga4MeasurementId).
|
||||
*
|
||||
* Note: R2 storage credentials are NOT here — storage is infrastructure and
|
||||
* binds at boot, so its config lives in .env (R2_BUCKET, R2_ENDPOINT, ...),
|
||||
* consumed by buildR2Storage. See docs/storage.md.
|
||||
*/ export function buildSiteIntegrations({ additionalFields } = {}) {
|
||||
return {
|
||||
slug: 'site-integrations',
|
||||
@@ -42,10 +45,6 @@ import { turnstileFields } from './fields/turnstile.js';
|
||||
fields: smtpFields,
|
||||
label: 'SMTP'
|
||||
},
|
||||
{
|
||||
fields: storageFields,
|
||||
label: 'Storage'
|
||||
},
|
||||
...additionalFields?.length ? [
|
||||
{
|
||||
fields: additionalFields,
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/globals/SiteIntegrations/index.ts"],"sourcesContent":["import type { Field, GlobalConfig } from 'payload'\n\nimport { isAdmin } from '../../modules/access/index.js'\nimport { analyticsFields } from './fields/analytics.js'\nimport { smtpFields } from './fields/smtp.js'\nimport { storageFields } from './fields/storage.js'\nimport { turnstileFields } from './fields/turnstile.js'\n\ntype BuildSiteIntegrationsArgs = {\n /** Extra fields injected by the client project */\n additionalFields?: Field[]\n}\n\n/**\n * Builds the SiteIntegrations global.\n *\n * Holds third-party service credentials. Access is enforced at the global\n * level — the whole global requires an authenticated user — so secrets stay\n * out of anonymous API responses while remaining editable in the admin panel\n * and readable via the server-side Local API. (Field-level read:false was\n * avoided because it also hides fields from the admin UI, making them\n * impossible to enter.)\n *\n * Unnamed tabs keep data flat (siteIntegrations.ga4MeasurementId).\n */\nexport function buildSiteIntegrations({\n additionalFields,\n}: BuildSiteIntegrationsArgs = {}): GlobalConfig {\n return {\n slug: 'site-integrations',\n access: {\n // Admin-only — secrets live here. Anonymous and non-admin users get\n // nothing through the API; admins read/edit in the panel and via Local API.\n read: ({ req: { user } }) => isAdmin(user),\n update: ({ req: { user } }) => isAdmin(user),\n },\n admin: {\n group: 'Settings',\n },\n fields: [\n {\n type: 'tabs',\n tabs: [\n { fields: analyticsFields, label: 'Analytics' },\n { fields: turnstileFields, label: 'Turnstile' },\n { fields: smtpFields, label: 'SMTP' },\n { fields: storageFields, label: 'Storage' },\n ...(additionalFields?.length ? [{ fields: additionalFields, label: 'Custom' }] : []),\n ],\n },\n ],\n label: 'Site Integrations',\n }\n}\n"],"names":["isAdmin","analyticsFields","smtpFields","storageFields","turnstileFields","buildSiteIntegrations","additionalFields","slug","access","read","req","user","update","admin","group","fields","type","tabs","label","length"],"mappings":"AAEA,SAASA,OAAO,QAAQ,gCAA+B;AACvD,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,UAAU,QAAQ,mBAAkB;AAC7C,SAASC,aAAa,QAAQ,sBAAqB;AACnD,SAASC,eAAe,QAAQ,wBAAuB;AAOvD;;;;;;;;;;;CAWC,GACD,OAAO,SAASC,sBAAsB,EACpCC,gBAAgB,EACU,GAAG,CAAC,CAAC;IAC/B,OAAO;QACLC,MAAM;QACNC,QAAQ;YACN,oEAAoE;YACpE,4EAA4E;YAC5EC,MAAM,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKX,QAAQW;YACrCC,QAAQ,CAAC,EAAEF,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKX,QAAQW;QACzC;QACAE,OAAO;YACLC,OAAO;QACT;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;oBACJ;wBAAEF,QAAQd;wBAAiBiB,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQX;wBAAiBc,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQb;wBAAYgB,OAAO;oBAAO;oBACpC;wBAAEH,QAAQZ;wBAAee,OAAO;oBAAU;uBACtCZ,kBAAkBa,SAAS;wBAAC;4BAAEJ,QAAQT;4BAAkBY,OAAO;wBAAS;qBAAE,GAAG,EAAE;iBACpF;YACH;SACD;QACDA,OAAO;IACT;AACF"}
|
||||
{"version":3,"sources":["../../../src/globals/SiteIntegrations/index.ts"],"sourcesContent":["import type { Field, GlobalConfig } from 'payload'\n\nimport { isAdmin } from '../../modules/access/index.js'\nimport { analyticsFields } from './fields/analytics.js'\nimport { smtpFields } from './fields/smtp.js'\nimport { turnstileFields } from './fields/turnstile.js'\n\ntype BuildSiteIntegrationsArgs = {\n /** Extra fields injected by the client project */\n additionalFields?: Field[]\n}\n\n/**\n * Builds the SiteIntegrations global.\n *\n * Holds third-party service credentials. Access is enforced at the global\n * level — the whole global requires an authenticated user — so secrets stay\n * out of anonymous API responses while remaining editable in the admin panel\n * and readable via the server-side Local API. (Field-level read:false was\n * avoided because it also hides fields from the admin UI, making them\n * impossible to enter.)\n *\n * Unnamed tabs keep data flat (siteIntegrations.ga4MeasurementId).\n *\n * Note: R2 storage credentials are NOT here — storage is infrastructure and\n * binds at boot, so its config lives in .env (R2_BUCKET, R2_ENDPOINT, ...),\n * consumed by buildR2Storage. See docs/storage.md.\n */\nexport function buildSiteIntegrations({\n additionalFields,\n}: BuildSiteIntegrationsArgs = {}): GlobalConfig {\n return {\n slug: 'site-integrations',\n access: {\n // Admin-only — secrets live here. Anonymous and non-admin users get\n // nothing through the API; admins read/edit in the panel and via Local API.\n read: ({ req: { user } }) => isAdmin(user),\n update: ({ req: { user } }) => isAdmin(user),\n },\n admin: {\n group: 'Settings',\n },\n fields: [\n {\n type: 'tabs',\n tabs: [\n { fields: analyticsFields, label: 'Analytics' },\n { fields: turnstileFields, label: 'Turnstile' },\n { fields: smtpFields, label: 'SMTP' },\n ...(additionalFields?.length ? [{ fields: additionalFields, label: 'Custom' }] : []),\n ],\n },\n ],\n label: 'Site Integrations',\n }\n}\n"],"names":["isAdmin","analyticsFields","smtpFields","turnstileFields","buildSiteIntegrations","additionalFields","slug","access","read","req","user","update","admin","group","fields","type","tabs","label","length"],"mappings":"AAEA,SAASA,OAAO,QAAQ,gCAA+B;AACvD,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,UAAU,QAAQ,mBAAkB;AAC7C,SAASC,eAAe,QAAQ,wBAAuB;AAOvD;;;;;;;;;;;;;;;CAeC,GACD,OAAO,SAASC,sBAAsB,EACpCC,gBAAgB,EACU,GAAG,CAAC,CAAC;IAC/B,OAAO;QACLC,MAAM;QACNC,QAAQ;YACN,oEAAoE;YACpE,4EAA4E;YAC5EC,MAAM,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKV,QAAQU;YACrCC,QAAQ,CAAC,EAAEF,KAAK,EAAEC,IAAI,EAAE,EAAE,GAAKV,QAAQU;QACzC;QACAE,OAAO;YACLC,OAAO;QACT;QACAC,QAAQ;YACN;gBACEC,MAAM;gBACNC,MAAM;oBACJ;wBAAEF,QAAQb;wBAAiBgB,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQX;wBAAiBc,OAAO;oBAAY;oBAC9C;wBAAEH,QAAQZ;wBAAYe,OAAO;oBAAO;uBAChCZ,kBAAkBa,SAAS;wBAAC;4BAAEJ,QAAQT;4BAAkBY,OAAO;wBAAS;qBAAE,GAAG,EAAE;iBACpF;YACH;SACD;QACDA,OAAO;IACT;AACF"}
|
||||
+16
-1
@@ -1,3 +1,4 @@
|
||||
import { validateFaviconField } from '../../../modules/seo/index.js';
|
||||
/**
|
||||
* General site identity fields.
|
||||
* Consumed by SEO/OG (siteName, defaultShareImage) and frontend (logo).
|
||||
@@ -11,6 +12,14 @@
|
||||
localized: true,
|
||||
required: true
|
||||
},
|
||||
{
|
||||
name: 'siteDescription',
|
||||
type: 'textarea',
|
||||
admin: {
|
||||
description: 'Fallback meta description when a page has none. Also used for llms.txt and Open Graph.'
|
||||
},
|
||||
localized: true
|
||||
},
|
||||
{
|
||||
name: 'titleOrder',
|
||||
type: 'select',
|
||||
@@ -79,7 +88,13 @@
|
||||
name: 'favicon',
|
||||
type: 'upload',
|
||||
admin: {
|
||||
description: 'Square source icon (PNG or SVG) for the browser tab. Rendered by the frontend.'
|
||||
description: 'Square icon, PNG or SVG, min. 48×48px (Google requires this to show it in search). Rendered via buildIconsMetadata.'
|
||||
},
|
||||
hooks: {
|
||||
// Warn the editor if the favicon is too small / not square for Google.
|
||||
beforeValidate: [
|
||||
validateFaviconField
|
||||
]
|
||||
},
|
||||
relationTo: 'media'
|
||||
}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/globals/SiteSettings/fields/general.ts"],"sourcesContent":["import type { Field } from 'payload'\n\n/**\n * General site identity fields.\n * Consumed by SEO/OG (siteName, defaultShareImage) and frontend (logo).\n */\nexport const generalFields: Field[] = [\n {\n name: 'siteName',\n type: 'text',\n admin: {\n description: 'Used in page titles and Open Graph metadata.',\n },\n localized: true,\n required: true,\n },\n {\n name: 'titleOrder',\n type: 'select',\n admin: {\n description: 'Which comes first in browser tabs.',\n },\n defaultValue: 'page-first',\n options: [\n { label: 'Page first — About Us | Acme', value: 'page-first' },\n { label: 'Site first — Acme | About Us', value: 'site-first' },\n ],\n },\n {\n name: 'titleSeparator',\n type: 'select',\n admin: {\n description: 'Separates the page title from the site name in browser tabs.',\n },\n defaultValue: '|',\n options: [\n { label: 'Pipe — Page | Site', value: '|' },\n { label: 'Dash — Page – Site', value: '–' },\n { label: 'Hyphen — Page - Site', value: '-' },\n { label: 'Bullet — Page · Site', value: '·' },\n { label: 'Slash — Page / Site', value: '/' },\n ],\n },\n {\n name: 'logo',\n type: 'upload',\n admin: {\n description: 'Primary site logo.',\n },\n relationTo: 'media',\n },\n {\n name: 'defaultShareImage',\n type: 'upload',\n admin: {\n description: 'Fallback Open Graph image when a page has none.',\n },\n relationTo: 'media',\n },\n {\n name: 'favicon',\n type: 'upload',\n admin: {\n description: 'Square source icon (PNG or SVG) for the browser tab. Rendered by the frontend.',\n },\n relationTo: 'media',\n },\n]\n"],"names":["generalFields","name","type","admin","description","localized","required","defaultValue","options","label","value","relationTo"],"mappings":"AAEA;;;CAGC,GACD,OAAO,MAAMA,gBAAyB;IACpC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAC,WAAW;QACXC,UAAU;IACZ;IACA;QACEL,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAG,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAkCC,OAAO;YAAa;YAC/D;gBAAED,OAAO;gBAAkCC,OAAO;YAAa;SAChE;IACH;IACA;QACET,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAG,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAwBC,OAAO;YAAI;YAC5C;gBAAED,OAAO;gBAAwBC,OAAO;YAAI;YAC5C;gBAAED,OAAO;gBAA0BC,OAAO;YAAI;YAC9C;gBAAED,OAAO;gBAA0BC,OAAO;YAAI;YAC9C;gBAAED,OAAO;gBAAyBC,OAAO;YAAI;SAC9C;IACH;IACA;QACET,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAO,YAAY;IACd;IACA;QACEV,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAO,YAAY;IACd;IACA;QACEV,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAO,YAAY;IACd;CACD,CAAA"}
|
||||
{"version":3,"sources":["../../../../src/globals/SiteSettings/fields/general.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { validateFaviconField } from '../../../modules/seo/index.js'\n\n/**\n * General site identity fields.\n * Consumed by SEO/OG (siteName, defaultShareImage) and frontend (logo).\n */\nexport const generalFields: Field[] = [\n {\n name: 'siteName',\n type: 'text',\n admin: {\n description: 'Used in page titles and Open Graph metadata.',\n },\n localized: true,\n required: true,\n },\n {\n name: 'siteDescription',\n type: 'textarea',\n admin: {\n description:\n 'Fallback meta description when a page has none. Also used for llms.txt and Open Graph.',\n },\n localized: true,\n },\n {\n name: 'titleOrder',\n type: 'select',\n admin: {\n description: 'Which comes first in browser tabs.',\n },\n defaultValue: 'page-first',\n options: [\n { label: 'Page first — About Us | Acme', value: 'page-first' },\n { label: 'Site first — Acme | About Us', value: 'site-first' },\n ],\n },\n {\n name: 'titleSeparator',\n type: 'select',\n admin: {\n description: 'Separates the page title from the site name in browser tabs.',\n },\n defaultValue: '|',\n options: [\n { label: 'Pipe — Page | Site', value: '|' },\n { label: 'Dash — Page – Site', value: '–' },\n { label: 'Hyphen — Page - Site', value: '-' },\n { label: 'Bullet — Page · Site', value: '·' },\n { label: 'Slash — Page / Site', value: '/' },\n ],\n },\n {\n name: 'logo',\n type: 'upload',\n admin: {\n description: 'Primary site logo.',\n },\n relationTo: 'media',\n },\n {\n name: 'defaultShareImage',\n type: 'upload',\n admin: {\n description: 'Fallback Open Graph image when a page has none.',\n },\n relationTo: 'media',\n },\n {\n name: 'favicon',\n type: 'upload',\n admin: {\n description:\n 'Square icon, PNG or SVG, min. 48×48px (Google requires this to show it in search). Rendered via buildIconsMetadata.',\n },\n hooks: {\n // Warn the editor if the favicon is too small / not square for Google.\n beforeValidate: [validateFaviconField],\n },\n relationTo: 'media',\n },\n]\n"],"names":["validateFaviconField","generalFields","name","type","admin","description","localized","required","defaultValue","options","label","value","relationTo","hooks","beforeValidate"],"mappings":"AAEA,SAASA,oBAAoB,QAAQ,gCAA+B;AAEpE;;;CAGC,GACD,OAAO,MAAMC,gBAAyB;IACpC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAC,WAAW;QACXC,UAAU;IACZ;IACA;QACEL,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aACE;QACJ;QACAC,WAAW;IACb;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAG,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAkCC,OAAO;YAAa;YAC/D;gBAAED,OAAO;gBAAkCC,OAAO;YAAa;SAChE;IACH;IACA;QACET,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAG,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAwBC,OAAO;YAAI;YAC5C;gBAAED,OAAO;gBAAwBC,OAAO;YAAI;YAC5C;gBAAED,OAAO;gBAA0BC,OAAO;YAAI;YAC9C;gBAAED,OAAO;gBAA0BC,OAAO;YAAI;YAC9C;gBAAED,OAAO;gBAAyBC,OAAO;YAAI;SAC9C;IACH;IACA;QACET,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAO,YAAY;IACd;IACA;QACEV,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;QACAO,YAAY;IACd;IACA;QACEV,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aACE;QACJ;QACAQ,OAAO;YACL,uEAAuE;YACvEC,gBAAgB;gBAACd;aAAqB;QACxC;QACAY,YAAY;IACd;CACD,CAAA"}
|
||||
Vendored
+72
-33
@@ -1,35 +1,74 @@
|
||||
export type { AccessOption, Role } from './modules/access/index.js';
|
||||
export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY, } from './modules/access/index.js';
|
||||
export type { AnalyticsConfig } from './modules/analytics/index.js';
|
||||
export { getAnalyticsConfig } from './modules/analytics/index.js';
|
||||
export { ACCEPT_ALL_CONSENT, CONSENT_CATEGORIES, CONSENT_COOKIE, CONSENT_MAX_AGE, CONSENT_VERSION, DEFAULT_CONSENT, getConsentTexts, parseConsent, REJECT_ALL_CONSENT, serializeConsent, setDefaultConsent, updateConsent, } from './modules/consent/index.js';
|
||||
export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js';
|
||||
export type { ContentCollectionOption, ContentOption, ResolvedRoute, } from './modules/content/index.js';
|
||||
export { archiveFieldName, buildArchivePath, buildEntryPath, getArchiveEntries, parsePageParam, resolveRoute, } from './modules/content/index.js';
|
||||
export type { ArchiveEntries } from './modules/content/index.js';
|
||||
export { graphAdapter } from './modules/email/graphAdapter.js';
|
||||
export type { GraphAdapterArgs } from './modules/email/graphAdapter.js';
|
||||
export { mailAdapter } from './modules/email/mailAdapter.js';
|
||||
export type { MailAdapterArgs } from './modules/email/mailAdapter.js';
|
||||
export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js';
|
||||
export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js';
|
||||
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
|
||||
export type { FormsCollectionOverrides, FormsFieldsOverride, FormsOption, } from './modules/forms/types.js';
|
||||
export { createContentHelpers } from './modules/frontend/index.js';
|
||||
export type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js';
|
||||
export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath, } from './modules/i18n/index.js';
|
||||
export type { LocaleMiddlewareResult } from './modules/i18n/index.js';
|
||||
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from './modules/i18n/index.js';
|
||||
export type { PagesOption, SystemPageRole } from './modules/pages/index.js';
|
||||
export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js';
|
||||
export type { GlobalQueryOptions } from './modules/payload/index.js';
|
||||
export { getGlobal, getSiteIntegrations, getSiteSettings, SITE_INTEGRATIONS_SLUG, SITE_SETTINGS_SLUG, } from './modules/payload/index.js';
|
||||
export { buildSecurityHeaders } from './modules/security/index.js';
|
||||
export type { BuildSecurityHeadersArgs, SecurityHeader } from './modules/security/index.js';
|
||||
export type { PageMetadata, SeoMeta, SeoOption } from './modules/seo/index.js';
|
||||
export { buildHreflangAlternates, buildMetadata, composeTitle } from './modules/seo/index.js';
|
||||
export type { AutoFillMapping, RobotsRules, SitemapEntry } from './modules/seo/index.js';
|
||||
export { buildAutoFillMetaHook, buildRobots, buildSitemapEntries, createMetadataGenerator, createPageMetadata, injectAutoFillMeta, } from './modules/seo/index.js';
|
||||
export { buildSlugField, toSlug } from './modules/slug/index.js';
|
||||
export { ipalKit } from './plugin.js';
|
||||
export type { IpalOptions } from './types.js';
|
||||
export type { I18nConfig, LocaleDefinition, LocalizedSlugs } from './modules/i18n/index.js';
|
||||
export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath, } from './modules/i18n/index.js';
|
||||
export type { PagesOption, SystemPageRole } from './modules/pages/index.js';
|
||||
export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js';
|
||||
export type { AccessOption, Role } from './modules/access/index.js';
|
||||
export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY, } from './modules/access/index.js';
|
||||
export type { GlobalQueryOptions } from './modules/payload/index.js';
|
||||
export { getGlobal, getSiteSettings, getSiteIntegrations, SITE_SETTINGS_SLUG, SITE_INTEGRATIONS_SLUG, } from './modules/payload/index.js';
|
||||
export type { SeoOption, SeoMeta, PageMetadata } from './modules/seo/index.js';
|
||||
export { composeTitle, buildHreflangAlternates, buildMetadata, readSiteMetaConfig, slugsAcrossLocales, } from './modules/seo/index.js';
|
||||
export type { SiteMetaConfig } from './modules/seo/index.js';
|
||||
export type { ContentOption, ContentCollectionOption, ResolvedRoute } from './modules/content/index.js';
|
||||
export { createContentHelpers } from './modules/frontend/index.js';
|
||||
export { resolveRoute, resolveRedirect, resolveNotFoundPage, blocksToMarkdown, createMarkdownRenderer, markdownResponse, prefersMarkdown, markdownHref, MARKDOWN_PREFIX, searchContent, createSearchRoute, archiveFieldName, getArchiveEntries, buildArchivePath, buildEntryPath, parsePageParam, } from './modules/content/index.js';
|
||||
export type { ArchiveEntries } from './modules/content/index.js';
|
||||
export type { SearchResult } from './modules/content/index.js';
|
||||
export { lexicalToMarkdown } from './modules/richtext/index.js';
|
||||
export type { AutoFillMapping, SitemapEntry, RobotsRules, RobotsOptions } from './modules/seo/index.js';
|
||||
export { buildAutoFillMetaHook, injectAutoFillMeta, createMetadataGenerator, createPageMetadata, buildSitemapEntries, buildRobots, AI_ASSISTANT_BOTS, AI_TRAINING_BOTS, } from './modules/seo/index.js';
|
||||
export type { LocaleMiddlewareResult } from './modules/i18n/index.js';
|
||||
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER, } from './modules/i18n/index.js';
|
||||
export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js';
|
||||
export { resolveLocalized } from './modules/i18n/index.js';
|
||||
export { CONSENT_CATEGORIES, DEFAULT_CONSENT, ACCEPT_ALL_CONSENT, REJECT_ALL_CONSENT, CONSENT_COOKIE, CONSENT_VERSION, CONSENT_MAX_AGE, serializeConsent, parseConsent, setDefaultConsent, updateConsent, getConsentTexts, } from './modules/consent/index.js';
|
||||
export type { ConsentCategory, ConsentState, ConsentTexts } from './modules/consent/index.js';
|
||||
export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js';
|
||||
export { graphAdapter } from './modules/email/graphAdapter.js';
|
||||
export { mailAdapter } from './modules/email/mailAdapter.js';
|
||||
export type { MailAdapterArgs } from './modules/email/mailAdapter.js';
|
||||
export type { GraphAdapterArgs } from './modules/email/graphAdapter.js';
|
||||
export type { PanelSmtpAdapterArgs } from './modules/email/panelSmtpAdapter.js';
|
||||
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
|
||||
export type { FormsOption, FormsCollectionOverrides, FormsFieldsOverride, } from './modules/forms/types.js';
|
||||
export { buildValidator, isEmail, required, email, minLength, maxLength, checked, pattern, custom, } from './modules/forms/validators.js';
|
||||
export type { Rule } from './modules/forms/validators.js';
|
||||
export type { FormErrors, FormSubmitAction, Validator } from './modules/forms/useForm.js';
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js';
|
||||
export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
|
||||
export { createHealthRoute } from './modules/health/index.js';
|
||||
export { createMcpRoute } from './modules/mcp/index.js';
|
||||
export { assertEnv, ipalEnvRules } from './modules/env/index.js';
|
||||
export type { EnvRule, EnvKind, AssertEnvOptions, IpalEnvFeatures } from './modules/env/index.js';
|
||||
export type { AnalyticsConfig } from './modules/analytics/index.js';
|
||||
export { getAnalyticsConfig } from './modules/analytics/index.js';
|
||||
export { buildSlugField, toSlug } from './modules/slug/index.js';
|
||||
export { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js';
|
||||
export { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js';
|
||||
export { buildSecurityHeaders } from './modules/security/index.js';
|
||||
export { buildCsp } from './modules/security/index.js';
|
||||
export type { BuildCspArgs } from './modules/security/index.js';
|
||||
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js';
|
||||
export { buildNoindexField } from './modules/seo/index.js';
|
||||
export { rowLabel } from './modules/admin-ui/index.js';
|
||||
export type { RowLabelProps } from './modules/admin-ui/index.js';
|
||||
export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js';
|
||||
export type { LinkAppearance, LinkValue, BuildLinkFieldOptions, BuildLinksFieldOptions, ResolveLinkHrefOptions, } from './modules/links/index.js';
|
||||
export { buildSpeakableJsonLd } from './modules/seo/index.js';
|
||||
export { buildSummaryField } from './modules/seo/index.js';
|
||||
export { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js';
|
||||
export { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js';
|
||||
export { buildArticleJsonLd } from './modules/seo/index.js';
|
||||
export { buildLlmsTxt } from './modules/seo/index.js';
|
||||
export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js';
|
||||
export type { SitemapRouteOptions, SitemapStyleOptions } from './modules/seo/index.js';
|
||||
export { buildR2Storage } from './modules/storage/index.js';
|
||||
export { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js';
|
||||
export type { OptimizeUploadOptions } from './modules/media/index.js';
|
||||
export { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js';
|
||||
export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js';
|
||||
export type { A11yState } from './modules/accessibility/index.js';
|
||||
export type { SecurityHeader, BuildSecurityHeadersArgs } from './modules/security/index.js';
|
||||
export type { NotificationTexts, FormNotificationTexts } from './modules/notifications/index.js';
|
||||
|
||||
Vendored
+50
-14
@@ -1,23 +1,59 @@
|
||||
export { ipalKit } from './plugin.js';
|
||||
export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath } from './modules/i18n/index.js';
|
||||
export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js';
|
||||
export { adminOnly, adminOnlyField, adminOrEditor, adminOrEditorField, adminOrSelf, authenticated, hasMinimumRole, isAdmin, isEditor, requireRole, requireRoleField, ROLE_HIERARCHY } from './modules/access/index.js';
|
||||
export { getAnalyticsConfig } from './modules/analytics/index.js';
|
||||
export { ACCEPT_ALL_CONSENT, CONSENT_CATEGORIES, CONSENT_COOKIE, CONSENT_MAX_AGE, CONSENT_VERSION, DEFAULT_CONSENT, getConsentTexts, parseConsent, REJECT_ALL_CONSENT, serializeConsent, setDefaultConsent, updateConsent } from './modules/consent/index.js';
|
||||
export { archiveFieldName, buildArchivePath, buildEntryPath, getArchiveEntries, parsePageParam, resolveRoute } from './modules/content/index.js';
|
||||
export { graphAdapter } from './modules/email/graphAdapter.js';
|
||||
export { mailAdapter } from './modules/email/mailAdapter.js';
|
||||
export { getGlobal, getSiteSettings, getSiteIntegrations, SITE_SETTINGS_SLUG, SITE_INTEGRATIONS_SLUG } from './modules/payload/index.js';
|
||||
export { composeTitle, buildHreflangAlternates, buildMetadata, readSiteMetaConfig, slugsAcrossLocales } from './modules/seo/index.js';
|
||||
export { createContentHelpers } from './modules/frontend/index.js';
|
||||
export { resolveRoute, resolveRedirect, resolveNotFoundPage, blocksToMarkdown, createMarkdownRenderer, markdownResponse, prefersMarkdown, markdownHref, MARKDOWN_PREFIX, searchContent, createSearchRoute, archiveFieldName, getArchiveEntries, buildArchivePath, buildEntryPath, parsePageParam } from './modules/content/index.js';
|
||||
// Lexical → Markdown (pure, no React) — for AI-readable output.
|
||||
export { lexicalToMarkdown } from './modules/richtext/index.js';
|
||||
export { buildAutoFillMetaHook, injectAutoFillMeta, createMetadataGenerator, createPageMetadata, buildSitemapEntries, buildRobots, AI_ASSISTANT_BOTS, AI_TRAINING_BOTS } from './modules/seo/index.js';
|
||||
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from './modules/i18n/index.js';
|
||||
export { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js';
|
||||
export { resolveLocalized } from './modules/i18n/index.js';
|
||||
export { CONSENT_CATEGORIES, DEFAULT_CONSENT, ACCEPT_ALL_CONSENT, REJECT_ALL_CONSENT, CONSENT_COOKIE, CONSENT_VERSION, CONSENT_MAX_AGE, serializeConsent, parseConsent, setDefaultConsent, updateConsent, getConsentTexts } from './modules/consent/index.js';
|
||||
// Imported straight from the file, NOT from ./modules/email/index.js — that
|
||||
// barrel re-exports sendEmail, which imports 'server-only' and would crash when
|
||||
// Payload loads the config (or runs generate:importmap) as a plain Node script.
|
||||
export { panelSmtpAdapter } from './modules/email/panelSmtpAdapter.js';
|
||||
export { graphAdapter } from './modules/email/graphAdapter.js';
|
||||
export { mailAdapter } from './modules/email/mailAdapter.js';
|
||||
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
|
||||
export { createContentHelpers } from './modules/frontend/index.js';
|
||||
export { buildLocalizedPath, getDefaultLocale, getLocaleCodes, getLocaleDefinition, getLocalizedSlugs, isValidLocale, LOCALE_COOKIE_NAME, matchAcceptLanguage, negotiateLocale, switchLocalePath } from './modules/i18n/index.js';
|
||||
export { createLocaleMiddleware, DEFAULT_MIDDLEWARE_MATCHER } from './modules/i18n/index.js';
|
||||
export { ALL_SYSTEM_PAGE_ROLES, getSystemPagePath } from './modules/pages/index.js';
|
||||
export { getGlobal, getSiteIntegrations, getSiteSettings, SITE_INTEGRATIONS_SLUG, SITE_SETTINGS_SLUG } from './modules/payload/index.js';
|
||||
export { buildSecurityHeaders } from './modules/security/index.js';
|
||||
export { buildHreflangAlternates, buildMetadata, composeTitle } from './modules/seo/index.js';
|
||||
export { buildAutoFillMetaHook, buildRobots, buildSitemapEntries, createMetadataGenerator, createPageMetadata, injectAutoFillMeta } from './modules/seo/index.js';
|
||||
// Validation rules are pure — exported server-side too, for re-validating a
|
||||
// submission inside a server action. (useForm/useContactForm are client-only →
|
||||
// '@intecion/ipal-kit/client'.)
|
||||
export { buildValidator, isEmail, required, email, minLength, maxLength, checked, pattern, custom } from './modules/forms/validators.js';
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js';
|
||||
// Panel-managed form analytics (config-time field builder).
|
||||
export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
|
||||
// Healthcheck route (Coolify/Docker liveness with a real DB round-trip).
|
||||
export { createHealthRoute } from './modules/health/index.js';
|
||||
// Read-only MCP server (Claude/agents connect to the site and query it).
|
||||
export { createMcpRoute } from './modules/mcp/index.js';
|
||||
// Boot-time environment validation (fail fast on misconfigured deploys).
|
||||
export { assertEnv, ipalEnvRules } from './modules/env/index.js';
|
||||
export { getAnalyticsConfig } from './modules/analytics/index.js';
|
||||
export { buildSlugField, toSlug } from './modules/slug/index.js';
|
||||
export { ipalKit } from './plugin.js';
|
||||
export { createLlmsTxtRoute, createSitemapRouteHandler, createManifestHandler } from './modules/seo/index.js';
|
||||
export { getNotificationTexts, resolveFormMessage, NOTIFICATION_FALLBACK } from './modules/notifications/index.js';
|
||||
export { buildSecurityHeaders } from './modules/security/index.js';
|
||||
export { buildCsp } from './modules/security/index.js';
|
||||
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js';
|
||||
export { buildNoindexField } from './modules/seo/index.js';
|
||||
export { rowLabel } from './modules/admin-ui/index.js';
|
||||
export { buildLinkField, buildLinksField, resolveLinkHref } from './modules/links/index.js';
|
||||
export { buildSpeakableJsonLd } from './modules/seo/index.js';
|
||||
export { buildSummaryField } from './modules/seo/index.js';
|
||||
export { buildWebSiteJsonLd, buildBreadcrumbJsonLd, buildSiteNavigationJsonLd } from './modules/seo/index.js';
|
||||
// Local SEO structured data — LocalBusiness (map pack), Service (offering), FAQPage.
|
||||
export { buildLocalBusinessJsonLd, buildFaqJsonLd, buildServiceJsonLd } from './modules/seo/index.js';
|
||||
export { buildArticleJsonLd } from './modules/seo/index.js';
|
||||
export { buildLlmsTxt } from './modules/seo/index.js';
|
||||
export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js';
|
||||
export { buildR2Storage } from './modules/storage/index.js';
|
||||
export { normalizeFilename, normalizeFilenameHook, buildOptimizeUploadHook, buildOptimizeUploadField } from './modules/media/index.js';
|
||||
export { buildRevalidateHook, setPublishedAtHook, buildPreventDeleteSystemPage, buildValidateUniqueRole, trackSlugHistoryHook, buildCrossLocaleFieldSync } from './modules/hooks/index.js';
|
||||
export { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/index.js';
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
@@ -0,0 +1,29 @@
|
||||
import { type A11yState } from './state.js';
|
||||
type A11yContextValue = {
|
||||
reset: () => void;
|
||||
set: <K extends keyof A11yState>(key: K, value: A11yState[K]) => void;
|
||||
state: A11yState;
|
||||
};
|
||||
/**
|
||||
* Provides accessibility preferences, persists them in a cookie, and applies them
|
||||
* as data-attributes on <html> so the project's CSS can react. Like
|
||||
* ConsentProvider for cookies — wrap the app once; the widget/button consume it.
|
||||
*
|
||||
* The plugin ships NO styles: it only sets attributes (data-a11y-*). The project
|
||||
* writes CSS for those it supports (see docs/accessibility.md). This keeps the
|
||||
* design in the project's hands.
|
||||
*
|
||||
* // layout.tsx
|
||||
* import { AccessibilityProvider } from '@intecion/ipal-kit/client'
|
||||
* <AccessibilityProvider>{children}</AccessibilityProvider>
|
||||
*
|
||||
* To avoid a flash, the project can read the a11y-prefs cookie server-side and
|
||||
* set the attributes on <html> during SSR (see docs). This provider re-applies
|
||||
* on the client and keeps them in sync.
|
||||
*/
|
||||
export declare function AccessibilityProvider({ children }: {
|
||||
children: React.ReactNode;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
/** Access accessibility preferences + setters. Use inside AccessibilityProvider. */
|
||||
export declare function useAccessibility(): A11yContextValue;
|
||||
export {};
|
||||
@@ -0,0 +1,87 @@
|
||||
'use client';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { createContext, use, useCallback, useEffect, useState } from 'react';
|
||||
import { A11Y_COOKIE, A11Y_COOKIE_MAX_AGE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './state.js';
|
||||
const A11yContext = /*#__PURE__*/ createContext(null);
|
||||
function readCookie(name) {
|
||||
if (typeof document === 'undefined') {
|
||||
return undefined;
|
||||
}
|
||||
const match = document.cookie.match(new RegExp(`(?:^|; )${name}=([^;]*)`));
|
||||
return match ? decodeURIComponent(match[1]) : undefined;
|
||||
}
|
||||
/**
|
||||
* Provides accessibility preferences, persists them in a cookie, and applies them
|
||||
* as data-attributes on <html> so the project's CSS can react. Like
|
||||
* ConsentProvider for cookies — wrap the app once; the widget/button consume it.
|
||||
*
|
||||
* The plugin ships NO styles: it only sets attributes (data-a11y-*). The project
|
||||
* writes CSS for those it supports (see docs/accessibility.md). This keeps the
|
||||
* design in the project's hands.
|
||||
*
|
||||
* // layout.tsx
|
||||
* import { AccessibilityProvider } from '@intecion/ipal-kit/client'
|
||||
* <AccessibilityProvider>{children}</AccessibilityProvider>
|
||||
*
|
||||
* To avoid a flash, the project can read the a11y-prefs cookie server-side and
|
||||
* set the attributes on <html> during SSR (see docs). This provider re-applies
|
||||
* on the client and keeps them in sync.
|
||||
*/ export function AccessibilityProvider({ children }) {
|
||||
const [state, setState] = useState(A11Y_DEFAULT);
|
||||
// Hydrate from cookie on mount.
|
||||
useEffect(()=>{
|
||||
setState(parseA11y(readCookie(A11Y_COOKIE)));
|
||||
}, []);
|
||||
// Apply attributes to <html> whenever state changes.
|
||||
useEffect(()=>{
|
||||
const el = document.documentElement;
|
||||
const attrs = a11yAttributes(state);
|
||||
for (const [attr, value] of Object.entries(attrs)){
|
||||
if (value === null) {
|
||||
el.removeAttribute(attr);
|
||||
} else {
|
||||
el.setAttribute(attr, value);
|
||||
}
|
||||
}
|
||||
}, [
|
||||
state
|
||||
]);
|
||||
const persist = useCallback((next)=>{
|
||||
document.cookie = `${A11Y_COOKIE}=${encodeURIComponent(serializeA11y(next))}; path=/; max-age=${A11Y_COOKIE_MAX_AGE}; samesite=lax`;
|
||||
}, []);
|
||||
const set = useCallback((key, value)=>{
|
||||
setState((prev)=>{
|
||||
const next = {
|
||||
...prev,
|
||||
[key]: value
|
||||
};
|
||||
persist(next);
|
||||
return next;
|
||||
});
|
||||
}, [
|
||||
persist
|
||||
]);
|
||||
const reset = useCallback(()=>{
|
||||
setState(A11Y_DEFAULT);
|
||||
persist(A11Y_DEFAULT);
|
||||
}, [
|
||||
persist
|
||||
]);
|
||||
return /*#__PURE__*/ _jsx(A11yContext, {
|
||||
value: {
|
||||
reset,
|
||||
set,
|
||||
state
|
||||
},
|
||||
children: children
|
||||
});
|
||||
}
|
||||
/** Access accessibility preferences + setters. Use inside AccessibilityProvider. */ export function useAccessibility() {
|
||||
const ctx = use(A11yContext);
|
||||
if (!ctx) {
|
||||
throw new Error('useAccessibility must be used within <AccessibilityProvider>');
|
||||
}
|
||||
return ctx;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=AccessibilityProvider.js.map
|
||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,51 @@
|
||||
export type A11yTexts = {
|
||||
bigCursor?: string;
|
||||
close?: string;
|
||||
contrast?: string;
|
||||
contrastHigh?: string;
|
||||
contrastInverted?: string;
|
||||
grayscale?: string;
|
||||
lineHeight?: string;
|
||||
open?: string;
|
||||
readableFont?: string;
|
||||
reduceMotion?: string;
|
||||
reset?: string;
|
||||
textSize?: string;
|
||||
title?: string;
|
||||
underlineLinks?: string;
|
||||
};
|
||||
export type A11yClassNames = {
|
||||
active?: string;
|
||||
button?: string;
|
||||
closeButton?: string;
|
||||
control?: string;
|
||||
label?: string;
|
||||
panel?: string;
|
||||
resetButton?: string;
|
||||
row?: string;
|
||||
};
|
||||
/**
|
||||
* Accessibility toolbar: a floating button that opens a panel of options (text
|
||||
* size, line height, contrast, grayscale, underline links, readable font, reduce
|
||||
* motion, big cursor). Choices persist in a cookie and apply as data-attributes
|
||||
* on <html> (the project's CSS styles them).
|
||||
*
|
||||
* Unstyled by default — pass classNames to match the project's design (like
|
||||
* CookieBanner). Wrap the app in <AccessibilityProvider> first.
|
||||
*
|
||||
* <AccessibilityWidget classNames={{ button: 'a11y-btn', panel: 'a11y-panel' }} />
|
||||
*
|
||||
* Labels default to English; localize per locale by passing `texts` for the
|
||||
* active language. Keep the translations in the project (or a localized global)
|
||||
* and pass the active locale's set — the plugin stays content-agnostic:
|
||||
*
|
||||
* const A11Y: Record<string, A11yTexts> = {
|
||||
* pl: { title: 'Dostępność', textSize: 'Rozmiar tekstu', … },
|
||||
* de: { title: 'Barrierefreiheit', … },
|
||||
* }
|
||||
* <AccessibilityWidget texts={A11Y[locale]} classNames={…} />
|
||||
*/
|
||||
export declare function AccessibilityWidget({ classNames, texts, }: {
|
||||
classNames?: A11yClassNames;
|
||||
texts?: A11yTexts;
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
'use client';
|
||||
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
||||
import { useState } from 'react';
|
||||
import { useAccessibility } from './AccessibilityProvider.js';
|
||||
/**
|
||||
* English defaults. The widget is end-user facing and multilingual projects run
|
||||
* in many locales, so the plugin ships a neutral English baseline — NOT Polish.
|
||||
* Localize by passing `texts` for the active locale (see the component doc).
|
||||
*/ const DEFAULT_TEXTS = {
|
||||
bigCursor: 'Large cursor',
|
||||
close: 'Close',
|
||||
contrast: 'Contrast',
|
||||
contrastHigh: 'High',
|
||||
contrastInverted: 'Inverted',
|
||||
grayscale: 'Grayscale',
|
||||
lineHeight: 'Line spacing',
|
||||
open: 'Open accessibility panel',
|
||||
readableFont: 'Readable font',
|
||||
reduceMotion: 'Reduce motion',
|
||||
reset: 'Reset',
|
||||
textSize: 'Text size',
|
||||
title: 'Accessibility',
|
||||
underlineLinks: 'Underline links'
|
||||
};
|
||||
/**
|
||||
* Accessibility toolbar: a floating button that opens a panel of options (text
|
||||
* size, line height, contrast, grayscale, underline links, readable font, reduce
|
||||
* motion, big cursor). Choices persist in a cookie and apply as data-attributes
|
||||
* on <html> (the project's CSS styles them).
|
||||
*
|
||||
* Unstyled by default — pass classNames to match the project's design (like
|
||||
* CookieBanner). Wrap the app in <AccessibilityProvider> first.
|
||||
*
|
||||
* <AccessibilityWidget classNames={{ button: 'a11y-btn', panel: 'a11y-panel' }} />
|
||||
*
|
||||
* Labels default to English; localize per locale by passing `texts` for the
|
||||
* active language. Keep the translations in the project (or a localized global)
|
||||
* and pass the active locale's set — the plugin stays content-agnostic:
|
||||
*
|
||||
* const A11Y: Record<string, A11yTexts> = {
|
||||
* pl: { title: 'Dostępność', textSize: 'Rozmiar tekstu', … },
|
||||
* de: { title: 'Barrierefreiheit', … },
|
||||
* }
|
||||
* <AccessibilityWidget texts={A11Y[locale]} classNames={…} />
|
||||
*/ export function AccessibilityWidget({ classNames, texts }) {
|
||||
const { reset, set, state } = useAccessibility();
|
||||
const [open, setOpen] = useState(false);
|
||||
const t = {
|
||||
...DEFAULT_TEXTS,
|
||||
...texts
|
||||
};
|
||||
const cn = classNames ?? {};
|
||||
const toggle = (key)=>set(key, !state[key]);
|
||||
const isActive = (on)=>on ? cn.active ?? '' : '';
|
||||
return /*#__PURE__*/ _jsxs(_Fragment, {
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
"aria-expanded": open,
|
||||
"aria-label": t.open,
|
||||
className: cn.button,
|
||||
onClick: ()=>setOpen((o)=>!o),
|
||||
type: "button",
|
||||
children: /*#__PURE__*/ _jsx("span", {
|
||||
"aria-hidden": "true",
|
||||
children: "♿"
|
||||
})
|
||||
}),
|
||||
open && /*#__PURE__*/ _jsxs("div", {
|
||||
"aria-label": t.title,
|
||||
className: cn.panel,
|
||||
role: "dialog",
|
||||
children: [
|
||||
/*#__PURE__*/ _jsxs("div", {
|
||||
className: cn.row,
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("span", {
|
||||
className: cn.label,
|
||||
children: t.textSize
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("div", {
|
||||
className: cn.control,
|
||||
children: [
|
||||
0,
|
||||
1,
|
||||
2,
|
||||
3
|
||||
].map((n)=>/*#__PURE__*/ _jsxs("button", {
|
||||
className: isActive(state.textSize === n),
|
||||
onClick: ()=>set('textSize', n),
|
||||
type: "button",
|
||||
children: [
|
||||
"A",
|
||||
n > 0 ? '+'.repeat(n) : ''
|
||||
]
|
||||
}, n))
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ _jsxs("div", {
|
||||
className: cn.row,
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("span", {
|
||||
className: cn.label,
|
||||
children: t.lineHeight
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("div", {
|
||||
className: cn.control,
|
||||
children: [
|
||||
0,
|
||||
1,
|
||||
2
|
||||
].map((n)=>/*#__PURE__*/ _jsx("button", {
|
||||
className: isActive(state.lineHeight === n),
|
||||
onClick: ()=>set('lineHeight', n),
|
||||
type: "button",
|
||||
children: n === 0 ? '—' : '≡'.repeat(n)
|
||||
}, n))
|
||||
})
|
||||
]
|
||||
}),
|
||||
/*#__PURE__*/ _jsxs("div", {
|
||||
className: cn.row,
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("span", {
|
||||
className: cn.label,
|
||||
children: t.contrast
|
||||
}),
|
||||
/*#__PURE__*/ _jsxs("div", {
|
||||
className: cn.control,
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: isActive(state.contrast === 'high'),
|
||||
onClick: ()=>set('contrast', state.contrast === 'high' ? 'default' : 'high'),
|
||||
type: "button",
|
||||
children: t.contrastHigh
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: isActive(state.contrast === 'inverted'),
|
||||
onClick: ()=>set('contrast', state.contrast === 'inverted' ? 'default' : 'inverted'),
|
||||
type: "button",
|
||||
children: t.contrastInverted
|
||||
})
|
||||
]
|
||||
})
|
||||
]
|
||||
}),
|
||||
[
|
||||
[
|
||||
'grayscale',
|
||||
t.grayscale
|
||||
],
|
||||
[
|
||||
'underlineLinks',
|
||||
t.underlineLinks
|
||||
],
|
||||
[
|
||||
'readableFont',
|
||||
t.readableFont
|
||||
],
|
||||
[
|
||||
'reduceMotion',
|
||||
t.reduceMotion
|
||||
],
|
||||
[
|
||||
'bigCursor',
|
||||
t.bigCursor
|
||||
]
|
||||
].map(([key, label])=>/*#__PURE__*/ _jsxs("div", {
|
||||
className: cn.row,
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("span", {
|
||||
className: cn.label,
|
||||
children: label
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
"aria-pressed": Boolean(state[key]),
|
||||
className: `${cn.control ?? ''} ${isActive(Boolean(state[key]))}`,
|
||||
onClick: ()=>toggle(key),
|
||||
type: "button",
|
||||
children: state[key] ? 'ON' : 'OFF'
|
||||
})
|
||||
]
|
||||
}, key)),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: cn.resetButton,
|
||||
onClick: reset,
|
||||
type: "button",
|
||||
children: t.reset
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: cn.closeButton,
|
||||
onClick: ()=>setOpen(false),
|
||||
type: "button",
|
||||
children: t.close
|
||||
})
|
||||
]
|
||||
})
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=AccessibilityWidget.js.map
|
||||
File diff suppressed because one or more lines are too long
+5
@@ -0,0 +1,5 @@
|
||||
export { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js';
|
||||
export { AccessibilityWidget } from './AccessibilityWidget.js';
|
||||
export type { A11yClassNames, A11yTexts } from './AccessibilityWidget.js';
|
||||
export type { A11yState } from './state.js';
|
||||
export { A11Y_COOKIE, a11yAttributes, parseA11y } from './state.js';
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
'use client';
|
||||
export { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js';
|
||||
export { AccessibilityWidget } from './AccessibilityWidget.js';
|
||||
export { A11Y_COOKIE, a11yAttributes, parseA11y } from './state.js';
|
||||
|
||||
//# sourceMappingURL=client.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/accessibility/client.ts"],"sourcesContent":["'use client'\nexport { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js'\nexport { AccessibilityWidget } from './AccessibilityWidget.js'\nexport type { A11yClassNames, A11yTexts } from './AccessibilityWidget.js'\nexport type { A11yState } from './state.js'\nexport { A11Y_COOKIE, a11yAttributes, parseA11y } from './state.js'\n"],"names":["AccessibilityProvider","useAccessibility","AccessibilityWidget","A11Y_COOKIE","a11yAttributes","parseA11y"],"mappings":"AAAA;AACA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,6BAA4B;AACpF,SAASC,mBAAmB,QAAQ,2BAA0B;AAG9D,SAASC,WAAW,EAAEC,cAAc,EAAEC,SAAS,QAAQ,aAAY"}
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
export { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js';
|
||||
export { AccessibilityWidget } from './AccessibilityWidget.js';
|
||||
export type { A11yClassNames, A11yTexts } from './AccessibilityWidget.js';
|
||||
export { A11Y_COOKIE, A11Y_COOKIE_MAX_AGE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y, } from './state.js';
|
||||
export type { A11yState } from './state.js';
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
export { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js';
|
||||
export { AccessibilityWidget } from './AccessibilityWidget.js';
|
||||
export { A11Y_COOKIE, A11Y_COOKIE_MAX_AGE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './state.js';
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/accessibility/index.ts"],"sourcesContent":["export { AccessibilityProvider, useAccessibility } from './AccessibilityProvider.js'\nexport { AccessibilityWidget } from './AccessibilityWidget.js'\nexport type { A11yClassNames, A11yTexts } from './AccessibilityWidget.js'\nexport {\n A11Y_COOKIE,\n A11Y_COOKIE_MAX_AGE,\n A11Y_DEFAULT,\n a11yAttributes,\n parseA11y,\n serializeA11y,\n} from './state.js'\nexport type { A11yState } from './state.js'\n"],"names":["AccessibilityProvider","useAccessibility","AccessibilityWidget","A11Y_COOKIE","A11Y_COOKIE_MAX_AGE","A11Y_DEFAULT","a11yAttributes","parseA11y","serializeA11y"],"mappings":"AAAA,SAASA,qBAAqB,EAAEC,gBAAgB,QAAQ,6BAA4B;AACpF,SAASC,mBAAmB,QAAQ,2BAA0B;AAE9D,SACEC,WAAW,EACXC,mBAAmB,EACnBC,YAAY,EACZC,cAAc,EACdC,SAAS,EACTC,aAAa,QACR,aAAY"}
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Accessibility preferences state. Each option maps to a data-attribute on
|
||||
* <html> (e.g. data-a11y-contrast="high"); the PROJECT's CSS reacts to those
|
||||
* attributes. The plugin sets the attributes and persists the choice — it does
|
||||
* NOT ship styles, so it never fights the project's design.
|
||||
*/
|
||||
export type A11yState = {
|
||||
/** Larger cursor. */
|
||||
bigCursor: boolean;
|
||||
/** 'default' | 'high' (high contrast) | 'inverted' (dark-on-light flip). */
|
||||
contrast: 'default' | 'high' | 'inverted';
|
||||
/** Grayscale filter on the whole page. */
|
||||
grayscale: boolean;
|
||||
/** Line spacing: 0 = default, 1..2 = looser. */
|
||||
lineHeight: 0 | 1 | 2;
|
||||
/** Readable font (project maps this to a dyslexia-friendly / simple font). */
|
||||
readableFont: boolean;
|
||||
/** Stop animations / transitions (prefers-reduced-motion equivalent). */
|
||||
reduceMotion: boolean;
|
||||
/** Text size step: 0 = default, 1..3 = larger. */
|
||||
textSize: 0 | 1 | 2 | 3;
|
||||
/** Underline all links (WCAG: don't rely on color alone). */
|
||||
underlineLinks: boolean;
|
||||
};
|
||||
export declare const A11Y_DEFAULT: A11yState;
|
||||
export declare const A11Y_COOKIE = "a11y-prefs";
|
||||
export declare const A11Y_COOKIE_MAX_AGE: number;
|
||||
/** Serialize for the cookie (compact). */
|
||||
export declare function serializeA11y(state: A11yState): string;
|
||||
/** Parse from the cookie; falls back to defaults on any bad value. */
|
||||
export declare function parseA11y(raw: null | string | undefined): A11yState;
|
||||
/**
|
||||
* Maps state → data-attributes to set on <html>. Returns { attr: value|null };
|
||||
* null means remove the attribute (option is at default). The project's CSS
|
||||
* targets these, e.g. `[data-a11y-contrast="high"] { … }`.
|
||||
*/
|
||||
export declare function a11yAttributes(state: A11yState): Record<string, null | string>;
|
||||
Vendored
+53
@@ -0,0 +1,53 @@
|
||||
/**
|
||||
* Accessibility preferences state. Each option maps to a data-attribute on
|
||||
* <html> (e.g. data-a11y-contrast="high"); the PROJECT's CSS reacts to those
|
||||
* attributes. The plugin sets the attributes and persists the choice — it does
|
||||
* NOT ship styles, so it never fights the project's design.
|
||||
*/ export const A11Y_DEFAULT = {
|
||||
bigCursor: false,
|
||||
contrast: 'default',
|
||||
grayscale: false,
|
||||
lineHeight: 0,
|
||||
readableFont: false,
|
||||
reduceMotion: false,
|
||||
textSize: 0,
|
||||
underlineLinks: false
|
||||
};
|
||||
export const A11Y_COOKIE = 'a11y-prefs';
|
||||
export const A11Y_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 // 1 year
|
||||
;
|
||||
/** Serialize for the cookie (compact). */ export function serializeA11y(state) {
|
||||
return JSON.stringify(state);
|
||||
}
|
||||
/** Parse from the cookie; falls back to defaults on any bad value. */ export function parseA11y(raw) {
|
||||
if (!raw) {
|
||||
return A11Y_DEFAULT;
|
||||
}
|
||||
try {
|
||||
const parsed = JSON.parse(raw);
|
||||
return {
|
||||
...A11Y_DEFAULT,
|
||||
...parsed
|
||||
};
|
||||
} catch {
|
||||
return A11Y_DEFAULT;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Maps state → data-attributes to set on <html>. Returns { attr: value|null };
|
||||
* null means remove the attribute (option is at default). The project's CSS
|
||||
* targets these, e.g. `[data-a11y-contrast="high"] { … }`.
|
||||
*/ export function a11yAttributes(state) {
|
||||
return {
|
||||
'data-a11y-contrast': state.contrast !== 'default' ? state.contrast : null,
|
||||
'data-a11y-cursor': state.bigCursor ? 'big' : null,
|
||||
'data-a11y-font': state.readableFont ? 'readable' : null,
|
||||
'data-a11y-grayscale': state.grayscale ? 'on' : null,
|
||||
'data-a11y-line': state.lineHeight > 0 ? String(state.lineHeight) : null,
|
||||
'data-a11y-motion': state.reduceMotion ? 'reduce' : null,
|
||||
'data-a11y-text': state.textSize > 0 ? String(state.textSize) : null,
|
||||
'data-a11y-underline': state.underlineLinks ? 'on' : null
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=state.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/accessibility/state.ts"],"sourcesContent":["/**\n * Accessibility preferences state. Each option maps to a data-attribute on\n * <html> (e.g. data-a11y-contrast=\"high\"); the PROJECT's CSS reacts to those\n * attributes. The plugin sets the attributes and persists the choice — it does\n * NOT ship styles, so it never fights the project's design.\n */\nexport type A11yState = {\n /** Larger cursor. */\n bigCursor: boolean\n /** 'default' | 'high' (high contrast) | 'inverted' (dark-on-light flip). */\n contrast: 'default' | 'high' | 'inverted'\n /** Grayscale filter on the whole page. */\n grayscale: boolean\n /** Line spacing: 0 = default, 1..2 = looser. */\n lineHeight: 0 | 1 | 2\n /** Readable font (project maps this to a dyslexia-friendly / simple font). */\n readableFont: boolean\n /** Stop animations / transitions (prefers-reduced-motion equivalent). */\n reduceMotion: boolean\n /** Text size step: 0 = default, 1..3 = larger. */\n textSize: 0 | 1 | 2 | 3\n /** Underline all links (WCAG: don't rely on color alone). */\n underlineLinks: boolean\n}\n\nexport const A11Y_DEFAULT: A11yState = {\n bigCursor: false,\n contrast: 'default',\n grayscale: false,\n lineHeight: 0,\n readableFont: false,\n reduceMotion: false,\n textSize: 0,\n underlineLinks: false,\n}\n\nexport const A11Y_COOKIE = 'a11y-prefs'\nexport const A11Y_COOKIE_MAX_AGE = 60 * 60 * 24 * 365 // 1 year\n\n/** Serialize for the cookie (compact). */\nexport function serializeA11y(state: A11yState): string {\n return JSON.stringify(state)\n}\n\n/** Parse from the cookie; falls back to defaults on any bad value. */\nexport function parseA11y(raw: null | string | undefined): A11yState {\n if (!raw) {return A11Y_DEFAULT}\n try {\n const parsed = JSON.parse(raw) as Partial<A11yState>\n return { ...A11Y_DEFAULT, ...parsed }\n } catch {\n return A11Y_DEFAULT\n }\n}\n\n/**\n * Maps state → data-attributes to set on <html>. Returns { attr: value|null };\n * null means remove the attribute (option is at default). The project's CSS\n * targets these, e.g. `[data-a11y-contrast=\"high\"] { … }`.\n */\nexport function a11yAttributes(state: A11yState): Record<string, null | string> {\n return {\n 'data-a11y-contrast': state.contrast !== 'default' ? state.contrast : null,\n 'data-a11y-cursor': state.bigCursor ? 'big' : null,\n 'data-a11y-font': state.readableFont ? 'readable' : null,\n 'data-a11y-grayscale': state.grayscale ? 'on' : null,\n 'data-a11y-line': state.lineHeight > 0 ? String(state.lineHeight) : null,\n 'data-a11y-motion': state.reduceMotion ? 'reduce' : null,\n 'data-a11y-text': state.textSize > 0 ? String(state.textSize) : null,\n 'data-a11y-underline': state.underlineLinks ? 'on' : null,\n }\n}\n"],"names":["A11Y_DEFAULT","bigCursor","contrast","grayscale","lineHeight","readableFont","reduceMotion","textSize","underlineLinks","A11Y_COOKIE","A11Y_COOKIE_MAX_AGE","serializeA11y","state","JSON","stringify","parseA11y","raw","parsed","parse","a11yAttributes","String"],"mappings":"AAAA;;;;;CAKC,GAoBD,OAAO,MAAMA,eAA0B;IACrCC,WAAW;IACXC,UAAU;IACVC,WAAW;IACXC,YAAY;IACZC,cAAc;IACdC,cAAc;IACdC,UAAU;IACVC,gBAAgB;AAClB,EAAC;AAED,OAAO,MAAMC,cAAc,aAAY;AACvC,OAAO,MAAMC,sBAAsB,KAAK,KAAK,KAAK,IAAI,SAAS;CAAV;AAErD,wCAAwC,GACxC,OAAO,SAASC,cAAcC,KAAgB;IAC5C,OAAOC,KAAKC,SAAS,CAACF;AACxB;AAEA,oEAAoE,GACpE,OAAO,SAASG,UAAUC,GAA8B;IACtD,IAAI,CAACA,KAAK;QAAC,OAAOhB;IAAY;IAC9B,IAAI;QACF,MAAMiB,SAASJ,KAAKK,KAAK,CAACF;QAC1B,OAAO;YAAE,GAAGhB,YAAY;YAAE,GAAGiB,MAAM;QAAC;IACtC,EAAE,OAAM;QACN,OAAOjB;IACT;AACF;AAEA;;;;CAIC,GACD,OAAO,SAASmB,eAAeP,KAAgB;IAC7C,OAAO;QACL,sBAAsBA,MAAMV,QAAQ,KAAK,YAAYU,MAAMV,QAAQ,GAAG;QACtE,oBAAoBU,MAAMX,SAAS,GAAG,QAAQ;QAC9C,kBAAkBW,MAAMP,YAAY,GAAG,aAAa;QACpD,uBAAuBO,MAAMT,SAAS,GAAG,OAAO;QAChD,kBAAkBS,MAAMR,UAAU,GAAG,IAAIgB,OAAOR,MAAMR,UAAU,IAAI;QACpE,oBAAoBQ,MAAMN,YAAY,GAAG,WAAW;QACpD,kBAAkBM,MAAML,QAAQ,GAAG,IAAIa,OAAOR,MAAML,QAAQ,IAAI;QAChE,uBAAuBK,MAAMJ,cAAc,GAAG,OAAO;IACvD;AACF"}
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
export type RowLabelProps = {
|
||||
/** Shown with the row number when every path is empty, e.g. "Button" → "Button 02". */
|
||||
fallback?: string;
|
||||
/** Dot paths inside the row, tried in order — the first non-empty text wins. */
|
||||
fields?: string[];
|
||||
};
|
||||
/**
|
||||
* Array row title in the admin panel: shows the row's own content ("Contact us",
|
||||
* "Fast delivery") instead of "Item 01", so an editor finds the right row
|
||||
* without expanding every one. Wire it with `rowLabel()`.
|
||||
*/
|
||||
export declare function RowLabel({ fallback, fields }: RowLabelProps): import("react/jsx-runtime").JSX.Element;
|
||||
+54
@@ -0,0 +1,54 @@
|
||||
'use client';
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { useRowLabel } from '@payloadcms/ui';
|
||||
const at = (obj, path)=>path.split('.').reduce((o, k)=>o && typeof o === 'object' ? o[k] : undefined, obj);
|
||||
const toText = (v)=>{
|
||||
if (typeof v === 'string') {
|
||||
return v.trim();
|
||||
}
|
||||
if (typeof v === 'number') {
|
||||
return String(v);
|
||||
}
|
||||
// populated relationship / upload → its title, name, filename or alt
|
||||
if (v && typeof v === 'object') {
|
||||
for (const k of [
|
||||
'title',
|
||||
'name',
|
||||
'label',
|
||||
'alt',
|
||||
'filename'
|
||||
]){
|
||||
const t = v[k];
|
||||
if (typeof t === 'string' && t.trim()) {
|
||||
return t.trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
return '';
|
||||
};
|
||||
/**
|
||||
* Array row title in the admin panel: shows the row's own content ("Contact us",
|
||||
* "Fast delivery") instead of "Item 01", so an editor finds the right row
|
||||
* without expanding every one. Wire it with `rowLabel()`.
|
||||
*/ export function RowLabel({ fallback = 'Item', fields = [
|
||||
'heading',
|
||||
'title',
|
||||
'label',
|
||||
'link.label',
|
||||
'name'
|
||||
] }) {
|
||||
const { data, rowNumber } = useRowLabel();
|
||||
for (const f of fields){
|
||||
const text = toText(at(data, f));
|
||||
if (text) {
|
||||
return /*#__PURE__*/ _jsx("span", {
|
||||
children: text.length > 60 ? `${text.slice(0, 57)}…` : text
|
||||
});
|
||||
}
|
||||
}
|
||||
return /*#__PURE__*/ _jsx("span", {
|
||||
children: `${fallback} ${String((rowNumber ?? 0) + 1).padStart(2, '0')}`
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=RowLabelComponent.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/admin-ui/RowLabelComponent.tsx"],"sourcesContent":["'use client'\nimport { useRowLabel } from '@payloadcms/ui'\n\nexport type RowLabelProps = {\n /** Shown with the row number when every path is empty, e.g. \"Button\" → \"Button 02\". */\n fallback?: string\n /** Dot paths inside the row, tried in order — the first non-empty text wins. */\n fields?: string[]\n}\n\nconst at = (obj: unknown, path: string): unknown =>\n path.split('.').reduce<unknown>((o, k) => (o && typeof o === 'object' ? (o as Record<string, unknown>)[k] : undefined), obj)\n\nconst toText = (v: unknown): string => {\n if (typeof v === 'string') {return v.trim()}\n if (typeof v === 'number') {return String(v)}\n // populated relationship / upload → its title, name, filename or alt\n if (v && typeof v === 'object') {\n for (const k of ['title', 'name', 'label', 'alt', 'filename']) {\n const t = (v as Record<string, unknown>)[k]\n if (typeof t === 'string' && t.trim()) {return t.trim()}\n }\n }\n return ''\n}\n\n/**\n * Array row title in the admin panel: shows the row's own content (\"Contact us\",\n * \"Fast delivery\") instead of \"Item 01\", so an editor finds the right row\n * without expanding every one. Wire it with `rowLabel()`.\n */\nexport function RowLabel({ fallback = 'Item', fields = ['heading', 'title', 'label', 'link.label', 'name'] }: RowLabelProps) {\n const { data, rowNumber } = useRowLabel<Record<string, unknown>>()\n for (const f of fields) {\n const text = toText(at(data, f))\n if (text) {return <span>{text.length > 60 ? `${text.slice(0, 57)}…` : text}</span>}\n }\n return <span>{`${fallback} ${String((rowNumber ?? 0) + 1).padStart(2, '0')}`}</span>\n}\n"],"names":["useRowLabel","at","obj","path","split","reduce","o","k","undefined","toText","v","trim","String","t","RowLabel","fallback","fields","data","rowNumber","f","text","span","length","slice","padStart"],"mappings":"AAAA;;AACA,SAASA,WAAW,QAAQ,iBAAgB;AAS5C,MAAMC,KAAK,CAACC,KAAcC,OACxBA,KAAKC,KAAK,CAAC,KAAKC,MAAM,CAAU,CAACC,GAAGC,IAAOD,KAAK,OAAOA,MAAM,WAAW,AAACA,CAA6B,CAACC,EAAE,GAAGC,WAAYN;AAE1H,MAAMO,SAAS,CAACC;IACd,IAAI,OAAOA,MAAM,UAAU;QAAC,OAAOA,EAAEC,IAAI;IAAE;IAC3C,IAAI,OAAOD,MAAM,UAAU;QAAC,OAAOE,OAAOF;IAAE;IAC5C,qEAAqE;IACrE,IAAIA,KAAK,OAAOA,MAAM,UAAU;QAC9B,KAAK,MAAMH,KAAK;YAAC;YAAS;YAAQ;YAAS;YAAO;SAAW,CAAE;YAC7D,MAAMM,IAAI,AAACH,CAA6B,CAACH,EAAE;YAC3C,IAAI,OAAOM,MAAM,YAAYA,EAAEF,IAAI,IAAI;gBAAC,OAAOE,EAAEF,IAAI;YAAE;QACzD;IACF;IACA,OAAO;AACT;AAEA;;;;CAIC,GACD,OAAO,SAASG,SAAS,EAAEC,WAAW,MAAM,EAAEC,SAAS;IAAC;IAAW;IAAS;IAAS;IAAc;CAAO,EAAiB;IACzH,MAAM,EAAEC,IAAI,EAAEC,SAAS,EAAE,GAAGlB;IAC5B,KAAK,MAAMmB,KAAKH,OAAQ;QACtB,MAAMI,OAAOX,OAAOR,GAAGgB,MAAME;QAC7B,IAAIC,MAAM;YAAC,qBAAO,KAACC;0BAAMD,KAAKE,MAAM,GAAG,KAAK,GAAGF,KAAKG,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC,GAAGH;;QAAY;IACpF;IACA,qBAAO,KAACC;kBAAM,GAAGN,SAAS,CAAC,EAAEH,OAAO,AAACM,CAAAA,aAAa,CAAA,IAAK,GAAGM,QAAQ,CAAC,GAAG,MAAM;;AAC9E"}
|
||||
Vendored
+2
@@ -0,0 +1,2 @@
|
||||
export { rowLabel } from './rowLabel.js';
|
||||
export type { RowLabelProps } from './RowLabelComponent.js';
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export { rowLabel } from './rowLabel.js';
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/admin-ui/index.ts"],"sourcesContent":["export { rowLabel } from './rowLabel.js'\nexport type { RowLabelProps } from './RowLabelComponent.js'\n"],"names":["rowLabel"],"mappings":"AAAA,SAASA,QAAQ,QAAQ,gBAAe"}
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
import type { RowLabelProps } from './RowLabelComponent.js';
|
||||
/**
|
||||
* Readable array rows in the panel. Spread into an array field's `admin.components`:
|
||||
*
|
||||
* { name: 'items', type: 'array', labels: { singular: 'Feature', plural: 'Features' },
|
||||
* admin: { initCollapsed: true, components: rowLabel(['heading'], 'Feature') }, fields: [...] }
|
||||
*
|
||||
* Rows then read "Fast delivery", "24/7 support"… instead of "Feature 01, Feature 02".
|
||||
* After adding it to a project: `pnpm payload generate:importmap`.
|
||||
*/
|
||||
export declare function rowLabel(fields: string | string[], fallback?: string): {
|
||||
RowLabel: {
|
||||
path: string;
|
||||
clientProps: RowLabelProps;
|
||||
};
|
||||
};
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Readable array rows in the panel. Spread into an array field's `admin.components`:
|
||||
*
|
||||
* { name: 'items', type: 'array', labels: { singular: 'Feature', plural: 'Features' },
|
||||
* admin: { initCollapsed: true, components: rowLabel(['heading'], 'Feature') }, fields: [...] }
|
||||
*
|
||||
* Rows then read "Fast delivery", "24/7 support"… instead of "Feature 01, Feature 02".
|
||||
* After adding it to a project: `pnpm payload generate:importmap`.
|
||||
*/ export function rowLabel(fields, fallback = 'Item') {
|
||||
const clientProps = {
|
||||
fields: Array.isArray(fields) ? fields : [
|
||||
fields
|
||||
],
|
||||
fallback
|
||||
};
|
||||
return {
|
||||
RowLabel: {
|
||||
path: '@intecion/ipal-kit/admin#RowLabel',
|
||||
clientProps
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
//# sourceMappingURL=rowLabel.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/admin-ui/rowLabel.ts"],"sourcesContent":["import type { RowLabelProps } from './RowLabelComponent.js'\n\n/**\n * Readable array rows in the panel. Spread into an array field's `admin.components`:\n *\n * { name: 'items', type: 'array', labels: { singular: 'Feature', plural: 'Features' },\n * admin: { initCollapsed: true, components: rowLabel(['heading'], 'Feature') }, fields: [...] }\n *\n * Rows then read \"Fast delivery\", \"24/7 support\"… instead of \"Feature 01, Feature 02\".\n * After adding it to a project: `pnpm payload generate:importmap`.\n */\nexport function rowLabel(fields: string | string[], fallback = 'Item') {\n const clientProps: RowLabelProps = { fields: Array.isArray(fields) ? fields : [fields], fallback }\n return { RowLabel: { path: '@intecion/ipal-kit/admin#RowLabel', clientProps } }\n}\n"],"names":["rowLabel","fields","fallback","clientProps","Array","isArray","RowLabel","path"],"mappings":"AAEA;;;;;;;;CAQC,GACD,OAAO,SAASA,SAASC,MAAyB,EAAEC,WAAW,MAAM;IACnE,MAAMC,cAA6B;QAAEF,QAAQG,MAAMC,OAAO,CAACJ,UAAUA,SAAS;YAACA;SAAO;QAAEC;IAAS;IACjG,OAAO;QAAEI,UAAU;YAAEC,MAAM;YAAqCJ;QAAY;IAAE;AAChF"}
|
||||
+32
-9
@@ -4,16 +4,39 @@ declare global {
|
||||
dataLayer?: unknown[];
|
||||
}
|
||||
}
|
||||
export type AnalyticsProps = {
|
||||
/**
|
||||
* Core Web Vitals mode: hold back every tag's NETWORK load until the first
|
||||
* user interaction (scroll, pointer, touch, key) or `deferTimeoutMs` after the
|
||||
* window `load` event — whichever comes first. Keeps ~100+ KiB of third-party
|
||||
* JS out of the FCP/LCP window.
|
||||
*
|
||||
* Consent is unaffected: the Consent Mode default is still pushed immediately
|
||||
* (a synchronous dataLayer push, no network), and non-Google pixels still
|
||||
* require their consent category. Defer changes WHEN a tag loads, never WHETHER.
|
||||
*
|
||||
* Trade-off: visitors who leave before interacting and before the timeout are
|
||||
* not counted (slightly fewer sessions in GA). Default false.
|
||||
*/
|
||||
defer?: boolean;
|
||||
/** Fallback delay after window `load`, in ms. Default 3500. */
|
||||
deferTimeoutMs?: number;
|
||||
} & AnalyticsConfig;
|
||||
/**
|
||||
* Loads Google Analytics — GTM if a container ID is set, otherwise GA4 gtag.
|
||||
* Loads every configured analytics / marketing tag, each respecting consent:
|
||||
*
|
||||
* Consent Mode is initialised to the visitor's stored consent BEFORE the tag
|
||||
* loads (via setDefaultConsent from the consent module), so tags respect the
|
||||
* choice from the first hit; useConsent sends an update the moment the visitor
|
||||
* decides. IDs are public and come from SiteIntegrations, passed in as props
|
||||
* (the client project reads them server-side).
|
||||
* - **Google (GA4 / GTM)** — Consent Mode: the visitor's stored choice is set as
|
||||
* the default BEFORE the tag loads (always immediately, even with `defer`),
|
||||
* and useConsent pushes an update the moment they decide. GTM wins if both
|
||||
* IDs are set.
|
||||
* - **Non-Google (Meta Pixel, Clarity, LinkedIn, TikTok)** — no Consent Mode, so
|
||||
* each loads ONLY after its category is granted (marketing for
|
||||
* Pixel/LinkedIn/TikTok, analytics for Clarity). Reacts live to the banner.
|
||||
* - **`defer`** (opt-in) — additionally waits for first interaction / idle
|
||||
* after load, for better LCP/INP. See AnalyticsProps.defer.
|
||||
*
|
||||
* Renders nothing — it only injects the scripts. Mount once, high in the tree
|
||||
* (e.g. root layout), inside ConsentProvider.
|
||||
* All IDs are public and come from SiteIntegrations (getAnalyticsConfig), passed
|
||||
* in as props. Renders nothing. Mount once, high in the tree, INSIDE
|
||||
* <ConsentProvider> (required — it reads live consent state).
|
||||
*/
|
||||
export declare function Analytics({ ga4MeasurementId, gtmContainerId }: AnalyticsConfig): null;
|
||||
export declare function Analytics(props: AnalyticsProps): null;
|
||||
|
||||
Vendored
+129
-17
@@ -1,7 +1,9 @@
|
||||
'use client';
|
||||
import { useEffect } from 'react';
|
||||
import { useEffect, useRef, useState } from 'react';
|
||||
import { useConsentContext } from '../consent/client.js';
|
||||
import { gtag } from '../consent/googleConsent.js';
|
||||
import { CONSENT_COOKIE, DEFAULT_CONSENT, parseConsent, setDefaultConsent } from '../consent/index.js';
|
||||
import { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from './pixels.js';
|
||||
const GTM_SCRIPT = (id)=>`https://www.googletagmanager.com/gtm.js?id=${id}`;
|
||||
const GA4_SCRIPT = (id)=>`https://www.googletagmanager.com/gtag/js?id=${id}`;
|
||||
/** Reads the current consent state from cookie, or defaults if none. */ function readConsent() {
|
||||
@@ -20,25 +22,106 @@ function injectScript(src) {
|
||||
s.async = true;
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
/**
|
||||
* Loads Google Analytics — GTM if a container ID is set, otherwise GA4 gtag.
|
||||
*
|
||||
* Consent Mode is initialised to the visitor's stored consent BEFORE the tag
|
||||
* loads (via setDefaultConsent from the consent module), so tags respect the
|
||||
* choice from the first hit; useConsent sends an update the moment the visitor
|
||||
* decides. IDs are public and come from SiteIntegrations, passed in as props
|
||||
* (the client project reads them server-side).
|
||||
*
|
||||
* Renders nothing — it only injects the scripts. Mount once, high in the tree
|
||||
* (e.g. root layout), inside ConsentProvider.
|
||||
*/ export function Analytics({ ga4MeasurementId, gtmContainerId }) {
|
||||
const INTERACTION_EVENTS = [
|
||||
'scroll',
|
||||
'pointerdown',
|
||||
'touchstart',
|
||||
'keydown'
|
||||
];
|
||||
/** True once third-party tags may load (immediately, or per `defer` rules). */ function useDeferredReady(defer, timeoutMs) {
|
||||
const [ready, setReady] = useState(!defer);
|
||||
useEffect(()=>{
|
||||
if (!defer || ready) {
|
||||
return;
|
||||
}
|
||||
let timer;
|
||||
const fire = ()=>setReady(true);
|
||||
const onLoad = ()=>{
|
||||
timer = setTimeout(()=>{
|
||||
if ('requestIdleCallback' in window) {
|
||||
window.requestIdleCallback(fire, {
|
||||
timeout: 1000
|
||||
});
|
||||
} else {
|
||||
fire();
|
||||
}
|
||||
}, timeoutMs);
|
||||
};
|
||||
for (const e of INTERACTION_EVENTS){
|
||||
window.addEventListener(e, fire, {
|
||||
once: true,
|
||||
passive: true
|
||||
});
|
||||
}
|
||||
if (document.readyState === 'complete') {
|
||||
onLoad();
|
||||
} else {
|
||||
window.addEventListener('load', onLoad, {
|
||||
once: true
|
||||
});
|
||||
}
|
||||
return ()=>{
|
||||
for (const e of INTERACTION_EVENTS){
|
||||
window.removeEventListener(e, fire);
|
||||
}
|
||||
window.removeEventListener('load', onLoad);
|
||||
if (timer) {
|
||||
clearTimeout(timer);
|
||||
}
|
||||
};
|
||||
}, [
|
||||
defer,
|
||||
ready,
|
||||
timeoutMs
|
||||
]);
|
||||
return ready;
|
||||
}
|
||||
/**
|
||||
* Loads every configured analytics / marketing tag, each respecting consent:
|
||||
*
|
||||
* - **Google (GA4 / GTM)** — Consent Mode: the visitor's stored choice is set as
|
||||
* the default BEFORE the tag loads (always immediately, even with `defer`),
|
||||
* and useConsent pushes an update the moment they decide. GTM wins if both
|
||||
* IDs are set.
|
||||
* - **Non-Google (Meta Pixel, Clarity, LinkedIn, TikTok)** — no Consent Mode, so
|
||||
* each loads ONLY after its category is granted (marketing for
|
||||
* Pixel/LinkedIn/TikTok, analytics for Clarity). Reacts live to the banner.
|
||||
* - **`defer`** (opt-in) — additionally waits for first interaction / idle
|
||||
* after load, for better LCP/INP. See AnalyticsProps.defer.
|
||||
*
|
||||
* All IDs are public and come from SiteIntegrations (getAnalyticsConfig), passed
|
||||
* in as props. Renders nothing. Mount once, high in the tree, INSIDE
|
||||
* <ConsentProvider> (required — it reads live consent state).
|
||||
*/ export function Analytics(props) {
|
||||
const { clarityProjectId, defer = false, deferTimeoutMs = 3500, ga4MeasurementId, gtmContainerId, linkedInPartnerId, metaPixelId, tiktokPixelId } = props;
|
||||
// Live consent state — drives the non-Google pixels.
|
||||
const { state } = useConsentContext();
|
||||
const ready = useDeferredReady(defer, deferTimeoutMs);
|
||||
const defaultConsentSet = useRef(false);
|
||||
// --- Consent Mode default: immediately, once — never deferred ---
|
||||
// No network cost, and it must precede any gtag('config') / GTM start, or
|
||||
// Google assumes "granted".
|
||||
useEffect(()=>{
|
||||
if (defaultConsentSet.current) {
|
||||
return;
|
||||
}
|
||||
if (!ga4MeasurementId && !gtmContainerId) {
|
||||
return;
|
||||
}
|
||||
// 1. Consent Mode default = the visitor's stored choice, before tags load.
|
||||
setDefaultConsent(readConsent());
|
||||
// 2. Load the tag.
|
||||
defaultConsentSet.current = true;
|
||||
}, [
|
||||
ga4MeasurementId,
|
||||
gtmContainerId
|
||||
]);
|
||||
// --- Google: load once `ready`; Consent Mode handles gating ---
|
||||
useEffect(()=>{
|
||||
if (!ready) {
|
||||
return;
|
||||
}
|
||||
if (!ga4MeasurementId && !gtmContainerId) {
|
||||
return;
|
||||
}
|
||||
if (gtmContainerId) {
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
window.dataLayer.push({
|
||||
@@ -48,15 +131,44 @@ function injectScript(src) {
|
||||
injectScript(GTM_SCRIPT(gtmContainerId));
|
||||
} else if (ga4MeasurementId) {
|
||||
injectScript(GA4_SCRIPT(ga4MeasurementId));
|
||||
// Uses the shared gtag (pushes `arguments`, as Google's tags expect);
|
||||
// real gtag.js wires itself up once the script loads.
|
||||
gtag('js', new Date());
|
||||
gtag('config', ga4MeasurementId);
|
||||
}
|
||||
}, [
|
||||
ready,
|
||||
ga4MeasurementId,
|
||||
gtmContainerId
|
||||
]);
|
||||
// --- Non-Google: each when `ready` AND its consent category is granted ---
|
||||
// Loaders are idempotent, so re-running on state changes is safe; a tag loads
|
||||
// the first time both conditions hold and never doubles up.
|
||||
useEffect(()=>{
|
||||
if (!ready) {
|
||||
return;
|
||||
}
|
||||
if (state.marketing) {
|
||||
if (metaPixelId) {
|
||||
loadMetaPixel(metaPixelId);
|
||||
}
|
||||
if (linkedInPartnerId) {
|
||||
loadLinkedIn(linkedInPartnerId);
|
||||
}
|
||||
if (tiktokPixelId) {
|
||||
loadTikTok(tiktokPixelId);
|
||||
}
|
||||
}
|
||||
if (state.analytics && clarityProjectId) {
|
||||
loadClarity(clarityProjectId);
|
||||
}
|
||||
}, [
|
||||
ready,
|
||||
state.marketing,
|
||||
state.analytics,
|
||||
metaPixelId,
|
||||
linkedInPartnerId,
|
||||
tiktokPixelId,
|
||||
clarityProjectId
|
||||
]);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+3
@@ -1 +1,4 @@
|
||||
export { Analytics } from './Analytics.js';
|
||||
export type { AnalyticsProps } from './Analytics.js';
|
||||
export { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from './pixels.js';
|
||||
export { pushDataLayer } from './pushDataLayer.js';
|
||||
|
||||
Vendored
+4
@@ -1,4 +1,8 @@
|
||||
'use client';
|
||||
export { Analytics } from './Analytics.js';
|
||||
// Low-level pixel loaders — exported for manual conversion events if a project
|
||||
// needs them (Analytics loads them automatically, consent-gated).
|
||||
export { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from './pixels.js';
|
||||
export { pushDataLayer } from './pushDataLayer.js';
|
||||
|
||||
//# sourceMappingURL=client.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/analytics/client.ts"],"sourcesContent":["'use client'\nexport { Analytics } from './Analytics.js'\n"],"names":["Analytics"],"mappings":"AAAA;AACA,SAASA,SAAS,QAAQ,iBAAgB"}
|
||||
{"version":3,"sources":["../../../src/modules/analytics/client.ts"],"sourcesContent":["'use client'\nexport { Analytics } from './Analytics.js'\nexport type { AnalyticsProps } from './Analytics.js'\n// Low-level pixel loaders — exported for manual conversion events if a project\n// needs them (Analytics loads them automatically, consent-gated).\nexport { loadClarity, loadLinkedIn, loadMetaPixel, loadTikTok } from './pixels.js'\nexport { pushDataLayer } from './pushDataLayer.js'\n"],"names":["Analytics","loadClarity","loadLinkedIn","loadMetaPixel","loadTikTok","pushDataLayer"],"mappings":"AAAA;AACA,SAASA,SAAS,QAAQ,iBAAgB;AAE1C,+EAA+E;AAC/E,kEAAkE;AAClE,SAASC,WAAW,EAAEC,YAAY,EAAEC,aAAa,EAAEC,UAAU,QAAQ,cAAa;AAClF,SAASC,aAAa,QAAQ,qBAAoB"}
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
import type { BasePayload } from 'payload';
|
||||
import type { AnalyticsConfig } from './types.js';
|
||||
/**
|
||||
* Reads the public analytics IDs from SiteIntegrations, server-side.
|
||||
*
|
||||
* Returns only the two public IDs (GA4 / GTM) — safe to pass to the client
|
||||
* Reads the public analytics / marketing tag IDs from SiteIntegrations,
|
||||
* server-side. All are public (exposed client-side), so safe to pass to the
|
||||
* <Analytics> component. Does NOT expose any secret from SiteIntegrations.
|
||||
*/
|
||||
export declare function getAnalyticsConfig(payload: BasePayload): Promise<AnalyticsConfig>;
|
||||
|
||||
+7
-4
@@ -1,14 +1,17 @@
|
||||
import { getSiteIntegrations } from '../payload/index.js';
|
||||
/**
|
||||
* Reads the public analytics IDs from SiteIntegrations, server-side.
|
||||
*
|
||||
* Returns only the two public IDs (GA4 / GTM) — safe to pass to the client
|
||||
* Reads the public analytics / marketing tag IDs from SiteIntegrations,
|
||||
* server-side. All are public (exposed client-side), so safe to pass to the
|
||||
* <Analytics> component. Does NOT expose any secret from SiteIntegrations.
|
||||
*/ export async function getAnalyticsConfig(payload) {
|
||||
const integrations = await getSiteIntegrations(payload);
|
||||
return {
|
||||
clarityProjectId: integrations.clarityProjectId ?? null,
|
||||
ga4MeasurementId: integrations.ga4MeasurementId ?? null,
|
||||
gtmContainerId: integrations.gtmContainerId ?? null
|
||||
gtmContainerId: integrations.gtmContainerId ?? null,
|
||||
linkedInPartnerId: integrations.linkedInPartnerId ?? null,
|
||||
metaPixelId: integrations.metaPixelId ?? null,
|
||||
tiktokPixelId: integrations.tiktokPixelId ?? null
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/analytics/getAnalyticsConfig.ts"],"sourcesContent":["import type { BasePayload } from 'payload'\n\nimport type { AnalyticsConfig } from './types.js'\n\nimport { getSiteIntegrations } from '../payload/index.js'\n\n/**\n * Reads the public analytics IDs from SiteIntegrations, server-side.\n *\n * Returns only the two public IDs (GA4 / GTM) — safe to pass to the client\n * <Analytics> component. Does NOT expose any secret from SiteIntegrations.\n */\nexport async function getAnalyticsConfig(payload: BasePayload): Promise<AnalyticsConfig> {\n const integrations = await getSiteIntegrations<AnalyticsConfig>(payload)\n return {\n ga4MeasurementId: integrations.ga4MeasurementId ?? null,\n gtmContainerId: integrations.gtmContainerId ?? null,\n }\n}\n"],"names":["getSiteIntegrations","getAnalyticsConfig","payload","integrations","ga4MeasurementId","gtmContainerId"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,sBAAqB;AAEzD;;;;;CAKC,GACD,OAAO,eAAeC,mBAAmBC,OAAoB;IAC3D,MAAMC,eAAe,MAAMH,oBAAqCE;IAChE,OAAO;QACLE,kBAAkBD,aAAaC,gBAAgB,IAAI;QACnDC,gBAAgBF,aAAaE,cAAc,IAAI;IACjD;AACF"}
|
||||
{"version":3,"sources":["../../../src/modules/analytics/getAnalyticsConfig.ts"],"sourcesContent":["import type { BasePayload } from 'payload'\n\nimport type { AnalyticsConfig } from './types.js'\n\nimport { getSiteIntegrations } from '../payload/index.js'\n\n/**\n * Reads the public analytics / marketing tag IDs from SiteIntegrations,\n * server-side. All are public (exposed client-side), so safe to pass to the\n * <Analytics> component. Does NOT expose any secret from SiteIntegrations.\n */\nexport async function getAnalyticsConfig(payload: BasePayload): Promise<AnalyticsConfig> {\n const integrations = await getSiteIntegrations<AnalyticsConfig>(payload)\n return {\n clarityProjectId: integrations.clarityProjectId ?? null,\n ga4MeasurementId: integrations.ga4MeasurementId ?? null,\n gtmContainerId: integrations.gtmContainerId ?? null,\n linkedInPartnerId: integrations.linkedInPartnerId ?? null,\n metaPixelId: integrations.metaPixelId ?? null,\n tiktokPixelId: integrations.tiktokPixelId ?? null,\n }\n}\n"],"names":["getSiteIntegrations","getAnalyticsConfig","payload","integrations","clarityProjectId","ga4MeasurementId","gtmContainerId","linkedInPartnerId","metaPixelId","tiktokPixelId"],"mappings":"AAIA,SAASA,mBAAmB,QAAQ,sBAAqB;AAEzD;;;;CAIC,GACD,OAAO,eAAeC,mBAAmBC,OAAoB;IAC3D,MAAMC,eAAe,MAAMH,oBAAqCE;IAChE,OAAO;QACLE,kBAAkBD,aAAaC,gBAAgB,IAAI;QACnDC,kBAAkBF,aAAaE,gBAAgB,IAAI;QACnDC,gBAAgBH,aAAaG,cAAc,IAAI;QAC/CC,mBAAmBJ,aAAaI,iBAAiB,IAAI;QACrDC,aAAaL,aAAaK,WAAW,IAAI;QACzCC,eAAeN,aAAaM,aAAa,IAAI;IAC/C;AACF"}
|
||||
Vendored
+21
@@ -0,0 +1,21 @@
|
||||
/**
|
||||
* Loaders for non-Google marketing/analytics pixels. Each is idempotent (guards
|
||||
* against double-init) and loads the vendor's own script + bootstrap.
|
||||
*
|
||||
* These are the one place `any` is unavoidable: vendor SDK bootstraps attach
|
||||
* untyped globals (fbq, clarity, lintrk, ttq) to `window`. Casts are contained
|
||||
* here; nothing else in the kit uses `any`.
|
||||
*
|
||||
* CONSENT: these vendors have no Google Consent Mode — the caller (Analytics)
|
||||
* loads each ONLY after the matching consent category is granted:
|
||||
* Meta Pixel / LinkedIn / TikTok → marketing
|
||||
* Microsoft Clarity → analytics
|
||||
*/
|
||||
/** Meta (Facebook) Pixel — fires PageView on load. */
|
||||
export declare function loadMetaPixel(id: string): void;
|
||||
/** Microsoft Clarity — heatmaps / session recordings (analytics category). */
|
||||
export declare function loadClarity(id: string): void;
|
||||
/** LinkedIn Insight Tag (marketing). */
|
||||
export declare function loadLinkedIn(partnerId: string): void;
|
||||
/** TikTok Pixel (marketing) — fires page view on load. */
|
||||
export declare function loadTikTok(id: string): void;
|
||||
Vendored
+134
@@ -0,0 +1,134 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */ /**
|
||||
* Loaders for non-Google marketing/analytics pixels. Each is idempotent (guards
|
||||
* against double-init) and loads the vendor's own script + bootstrap.
|
||||
*
|
||||
* These are the one place `any` is unavoidable: vendor SDK bootstraps attach
|
||||
* untyped globals (fbq, clarity, lintrk, ttq) to `window`. Casts are contained
|
||||
* here; nothing else in the kit uses `any`.
|
||||
*
|
||||
* CONSENT: these vendors have no Google Consent Mode — the caller (Analytics)
|
||||
* loads each ONLY after the matching consent category is granted:
|
||||
* Meta Pixel / LinkedIn / TikTok → marketing
|
||||
* Microsoft Clarity → analytics
|
||||
*/ /** Meta (Facebook) Pixel — fires PageView on load. */ export function loadMetaPixel(id) {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
const w = window;
|
||||
if (w.fbq) {
|
||||
return;
|
||||
}
|
||||
const n = w.fbq = function(...args) {
|
||||
if (n.callMethod) {
|
||||
n.callMethod.apply(n, args);
|
||||
} else {
|
||||
n.queue.push(args);
|
||||
}
|
||||
};
|
||||
if (!w._fbq) {
|
||||
w._fbq = n;
|
||||
}
|
||||
n.push = n;
|
||||
n.loaded = true;
|
||||
n.version = '2.0';
|
||||
n.queue = [];
|
||||
const s = document.createElement('script');
|
||||
s.async = true;
|
||||
s.src = 'https://connect.facebook.net/en_US/fbevents.js';
|
||||
document.head.appendChild(s);
|
||||
w.fbq('init', id);
|
||||
w.fbq('track', 'PageView');
|
||||
}
|
||||
/** Microsoft Clarity — heatmaps / session recordings (analytics category). */ export function loadClarity(id) {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
const w = window;
|
||||
if (w.clarity) {
|
||||
return;
|
||||
}
|
||||
w.clarity = function(...a) {
|
||||
;
|
||||
(w.clarity.q = w.clarity.q || []).push(a);
|
||||
};
|
||||
const s = document.createElement('script');
|
||||
s.async = true;
|
||||
s.src = `https://www.clarity.ms/tag/${id}`;
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
/** LinkedIn Insight Tag (marketing). */ export function loadLinkedIn(partnerId) {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
const w = window;
|
||||
w._linkedin_partner_id = partnerId;
|
||||
w._linkedin_data_partner_ids = w._linkedin_data_partner_ids || [];
|
||||
if (w._linkedin_data_partner_ids.includes(partnerId)) {
|
||||
if (document.getElementById('ipal-linkedin-insight')) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
w._linkedin_data_partner_ids.push(partnerId);
|
||||
}
|
||||
if (document.getElementById('ipal-linkedin-insight')) {
|
||||
return;
|
||||
}
|
||||
const s = document.createElement('script');
|
||||
s.async = true;
|
||||
s.id = 'ipal-linkedin-insight';
|
||||
s.src = 'https://snap.licdn.com/li.lms-analytics/insight.min.js';
|
||||
document.head.appendChild(s);
|
||||
}
|
||||
/** TikTok Pixel (marketing) — fires page view on load. */ export function loadTikTok(id) {
|
||||
if (typeof window === 'undefined') {
|
||||
return;
|
||||
}
|
||||
const w = window;
|
||||
if (w.ttq) {
|
||||
return;
|
||||
}
|
||||
w.TiktokAnalyticsObject = 'ttq';
|
||||
const ttq = w.ttq = [];
|
||||
ttq.methods = [
|
||||
'page',
|
||||
'track',
|
||||
'identify',
|
||||
'instances',
|
||||
'debug',
|
||||
'on',
|
||||
'off',
|
||||
'once',
|
||||
'ready',
|
||||
'alias',
|
||||
'group',
|
||||
'enableCookie',
|
||||
'disableCookie'
|
||||
];
|
||||
ttq.setAndDefer = function(t, e) {
|
||||
t[e] = function(...args) {
|
||||
t.push([
|
||||
e,
|
||||
...args
|
||||
]);
|
||||
};
|
||||
};
|
||||
for (const m of ttq.methods){
|
||||
ttq.setAndDefer(ttq, m);
|
||||
}
|
||||
ttq.load = function(e) {
|
||||
const url = 'https://analytics.tiktok.com/i18n/pixel/events.js';
|
||||
ttq._i = ttq._i || {};
|
||||
ttq._i[e] = [];
|
||||
ttq._i[e]._u = url;
|
||||
ttq._t = ttq._t || {};
|
||||
ttq._t[e] = Number(new Date());
|
||||
const s = document.createElement('script');
|
||||
s.async = true;
|
||||
s.src = `${url}?sdkid=${e}&lib=ttq`;
|
||||
document.head.appendChild(s);
|
||||
};
|
||||
ttq.load(id);
|
||||
ttq.page();
|
||||
}
|
||||
|
||||
//# sourceMappingURL=pixels.js.map
|
||||
Vendored
+1
File diff suppressed because one or more lines are too long
+19
@@ -0,0 +1,19 @@
|
||||
/**
|
||||
* Pushes an event onto the GTM `window.dataLayer`. SSR-safe (no-op on the
|
||||
* server), and tolerant of GTM not being present yet — the array is created so
|
||||
* the event is buffered and picked up once GTM loads.
|
||||
*
|
||||
* The bridge between the form engine and GTM: fire a `form_submit` event after
|
||||
* a successful submit so a Meta Pixel / GA "Lead" tag can trigger on it.
|
||||
*
|
||||
* import { pushDataLayer } from '@intecion/ipal-kit/client'
|
||||
* const f = useContactForm({
|
||||
* submitAction,
|
||||
* onSuccess: (_r, v) => pushDataLayer('form_submit', { form_name: v.topic || 'kontakt' }),
|
||||
* })
|
||||
*
|
||||
* The GTM "Lead" tag then reads `form_name` via a Data Layer Variable
|
||||
* (`DLV – form_name`) and fires on the custom event `form_submit`. Consent still
|
||||
* gates the tag in GTM (ad_storage) — this only emits the event.
|
||||
*/
|
||||
export declare function pushDataLayer(event: string, params?: Record<string, unknown>): void;
|
||||
+28
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Pushes an event onto the GTM `window.dataLayer`. SSR-safe (no-op on the
|
||||
* server), and tolerant of GTM not being present yet — the array is created so
|
||||
* the event is buffered and picked up once GTM loads.
|
||||
*
|
||||
* The bridge between the form engine and GTM: fire a `form_submit` event after
|
||||
* a successful submit so a Meta Pixel / GA "Lead" tag can trigger on it.
|
||||
*
|
||||
* import { pushDataLayer } from '@intecion/ipal-kit/client'
|
||||
* const f = useContactForm({
|
||||
* submitAction,
|
||||
* onSuccess: (_r, v) => pushDataLayer('form_submit', { form_name: v.topic || 'kontakt' }),
|
||||
* })
|
||||
*
|
||||
* The GTM "Lead" tag then reads `form_name` via a Data Layer Variable
|
||||
* (`DLV – form_name`) and fires on the custom event `form_submit`. Consent still
|
||||
* gates the tag in GTM (ad_storage) — this only emits the event.
|
||||
*/ export function pushDataLayer(event, params = {}) {
|
||||
if (typeof window === 'undefined') return;
|
||||
const w = window;
|
||||
w.dataLayer = w.dataLayer || [];
|
||||
w.dataLayer.push({
|
||||
event,
|
||||
...params
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=pushDataLayer.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/analytics/pushDataLayer.ts"],"sourcesContent":["/**\n * Pushes an event onto the GTM `window.dataLayer`. SSR-safe (no-op on the\n * server), and tolerant of GTM not being present yet — the array is created so\n * the event is buffered and picked up once GTM loads.\n *\n * The bridge between the form engine and GTM: fire a `form_submit` event after\n * a successful submit so a Meta Pixel / GA \"Lead\" tag can trigger on it.\n *\n * import { pushDataLayer } from '@intecion/ipal-kit/client'\n * const f = useContactForm({\n * submitAction,\n * onSuccess: (_r, v) => pushDataLayer('form_submit', { form_name: v.topic || 'kontakt' }),\n * })\n *\n * The GTM \"Lead\" tag then reads `form_name` via a Data Layer Variable\n * (`DLV – form_name`) and fires on the custom event `form_submit`. Consent still\n * gates the tag in GTM (ad_storage) — this only emits the event.\n */\nexport function pushDataLayer(event: string, params: Record<string, unknown> = {}): void {\n if (typeof window === 'undefined') return\n const w = window as unknown as { dataLayer?: unknown[] }\n w.dataLayer = w.dataLayer || []\n w.dataLayer.push({ event, ...params })\n}\n"],"names":["pushDataLayer","event","params","window","w","dataLayer","push"],"mappings":"AAAA;;;;;;;;;;;;;;;;;CAiBC,GACD,OAAO,SAASA,cAAcC,KAAa,EAAEC,SAAkC,CAAC,CAAC;IAC/E,IAAI,OAAOC,WAAW,aAAa;IACnC,MAAMC,IAAID;IACVC,EAAEC,SAAS,GAAGD,EAAEC,SAAS,IAAI,EAAE;IAC/BD,EAAEC,SAAS,CAACC,IAAI,CAAC;QAAEL;QAAO,GAAGC,MAAM;IAAC;AACtC"}
|
||||
Vendored
+13
-3
@@ -1,9 +1,19 @@
|
||||
/**
|
||||
* Analytics IDs, read from SiteIntegrations (public — safe on the client).
|
||||
* Analytics / marketing tag IDs, read from SiteIntegrations (all public — safe
|
||||
* on the client). Google tags (GA4/GTM) use Consent Mode; the rest load only
|
||||
* after the matching consent category is granted (see Analytics).
|
||||
*/
|
||||
export type AnalyticsConfig = {
|
||||
/** GA4 Measurement ID, e.g. 'G-XXXXXXXXXX'. */
|
||||
/** Microsoft Clarity project ID. (analytics consent) */
|
||||
clarityProjectId?: null | string;
|
||||
/** GA4 Measurement ID, e.g. 'G-XXXXXXXXXX'. (Google — Consent Mode) */
|
||||
ga4MeasurementId?: null | string;
|
||||
/** GTM Container ID, e.g. 'GTM-XXXXXXX'. */
|
||||
/** GTM Container ID, e.g. 'GTM-XXXXXXX'. (Google — Consent Mode) */
|
||||
gtmContainerId?: null | string;
|
||||
/** LinkedIn Insight Tag partner ID. (marketing consent) */
|
||||
linkedInPartnerId?: null | string;
|
||||
/** Meta (Facebook) Pixel ID, ~15–16 digits. (marketing consent) */
|
||||
metaPixelId?: null | string;
|
||||
/** TikTok Pixel ID. (marketing consent) */
|
||||
tiktokPixelId?: null | string;
|
||||
};
|
||||
|
||||
Vendored
+3
-1
@@ -1,5 +1,7 @@
|
||||
/**
|
||||
* Analytics IDs, read from SiteIntegrations (public — safe on the client).
|
||||
* Analytics / marketing tag IDs, read from SiteIntegrations (all public — safe
|
||||
* on the client). Google tags (GA4/GTM) use Consent Mode; the rest load only
|
||||
* after the matching consent category is granted (see Analytics).
|
||||
*/ export { };
|
||||
|
||||
//# sourceMappingURL=types.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/analytics/types.ts"],"sourcesContent":["/**\n * Analytics IDs, read from SiteIntegrations (public — safe on the client).\n */\nexport type AnalyticsConfig = {\n /** GA4 Measurement ID, e.g. 'G-XXXXXXXXXX'. */\n ga4MeasurementId?: null | string\n /** GTM Container ID, e.g. 'GTM-XXXXXXX'. */\n gtmContainerId?: null | string\n}\n"],"names":[],"mappings":"AAAA;;CAEC,GACD,WAKC"}
|
||||
{"version":3,"sources":["../../../src/modules/analytics/types.ts"],"sourcesContent":["/**\n * Analytics / marketing tag IDs, read from SiteIntegrations (all public — safe\n * on the client). Google tags (GA4/GTM) use Consent Mode; the rest load only\n * after the matching consent category is granted (see Analytics).\n */\nexport type AnalyticsConfig = {\n /** Microsoft Clarity project ID. (analytics consent) */\n clarityProjectId?: null | string\n /** GA4 Measurement ID, e.g. 'G-XXXXXXXXXX'. (Google — Consent Mode) */\n ga4MeasurementId?: null | string\n /** GTM Container ID, e.g. 'GTM-XXXXXXX'. (Google — Consent Mode) */\n gtmContainerId?: null | string\n /** LinkedIn Insight Tag partner ID. (marketing consent) */\n linkedInPartnerId?: null | string\n /** Meta (Facebook) Pixel ID, ~15–16 digits. (marketing consent) */\n metaPixelId?: null | string\n /** TikTok Pixel ID. (marketing consent) */\n tiktokPixelId?: null | string\n}\n"],"names":[],"mappings":"AAAA;;;;CAIC,GACD,WAaC"}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
import type { Payload } from 'payload';
|
||||
/**
|
||||
* White-label admin branding: the Payload admin panel's logo (login + nav) and
|
||||
* icon, pulled from the project's SiteSettings so each client sees THEIR brand,
|
||||
* set by the editor in the panel — not hardcoded per project. Wired
|
||||
* automatically by `ipalKit({ whiteLabel: true })` (it injects
|
||||
* admin.components.graphics.Logo/Icon pointing here).
|
||||
*
|
||||
* Server Components — they read the SiteSettings global at render, using the
|
||||
* `payload` instance Payload itself passes to admin server components. NO
|
||||
* `import('@payload-config')`: a variable-specifier import isn't traced by the
|
||||
* Next bundler ("Cannot find module '@payload-config'") — same bug class as the
|
||||
* old 2FA import. Everything is wrapped in try/catch: no payload prop, DB not
|
||||
* ready, etc. → site name text, then null (Payload's own default) — never
|
||||
* throws, never blocks the panel.
|
||||
*
|
||||
* A0: no client brand in code. The logo/name come from the panel; if nothing is
|
||||
* set, nothing is forced.
|
||||
*/
|
||||
type BrandingProps = {
|
||||
/** Upload field to render as the image. Default 'logo' (Logo) / 'favicon' (Icon). */
|
||||
imageField?: string;
|
||||
/** Injected by Payload — current admin locale (object or code). */
|
||||
locale?: {
|
||||
code?: string;
|
||||
} | string;
|
||||
/** Field holding the site name. Default 'siteName'. */
|
||||
nameField?: string;
|
||||
/** Injected by Payload into admin server components. */
|
||||
payload?: Payload;
|
||||
/** SiteSettings global slug. Default 'site-settings'. */
|
||||
settingsSlug?: string;
|
||||
};
|
||||
/**
|
||||
* Admin panel logo — this is the LARGE logo on the login / unauthorized screens
|
||||
* (Payload uses `graphics.Icon` for the small nav glyph). SiteSettings `logo`,
|
||||
* falls back to `siteName` text. Sized generously for the login screen.
|
||||
*/
|
||||
export declare function AdminLogo(props?: BrandingProps): Promise<import("react/jsx-runtime").JSX.Element | null>;
|
||||
/** Admin panel icon (small nav glyph). SiteSettings `favicon`, falls back to initials. */
|
||||
export declare function AdminIcon(props?: BrandingProps): Promise<import("react/jsx-runtime").JSX.Element | null>;
|
||||
/**
|
||||
* Discreet vendor credit: "Technology supported by Intecion.com". This is the
|
||||
* PLUGIN VENDOR's credit (Intecion ships ipal-kit, the framework), not client
|
||||
* data — a sensible default here is fine and A0-safe. The client's own brand
|
||||
* still owns the logo/name; this is a small line stating who supports the tech.
|
||||
* Text/URL overridable; turn it off with `whiteLabel: { credit: false }`.
|
||||
*
|
||||
* Wired by ipalKit into admin.components.afterNavLinks (nav) AND afterLogin
|
||||
* (login screen footer). `variant` adjusts placement:
|
||||
* - 'nav' → left-aligned line under the nav links
|
||||
* - 'login' → centered line below the login form
|
||||
*/
|
||||
export declare function IntecionCredit(props?: {
|
||||
text?: string;
|
||||
url?: string;
|
||||
variant?: 'login' | 'nav';
|
||||
}): import("react/jsx-runtime").JSX.Element;
|
||||
export {};
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
/** A localized text field may arrive as a string or a { locale: value } map. */ function pickText(value, locale) {
|
||||
if (typeof value === 'string') {
|
||||
return value;
|
||||
}
|
||||
if (value && typeof value === 'object') {
|
||||
const map = value;
|
||||
const preferred = locale ? map[locale] : undefined;
|
||||
if (typeof preferred === 'string') {
|
||||
return preferred;
|
||||
}
|
||||
const first = Object.values(map).find((v)=>typeof v === 'string');
|
||||
return first ?? null;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
async function loadBranding(props, settingsSlug, nameField, imageField) {
|
||||
const { payload } = props;
|
||||
if (!payload) {
|
||||
return {
|
||||
name: null,
|
||||
url: null
|
||||
};
|
||||
}
|
||||
try {
|
||||
const locale = typeof props.locale === 'string' ? props.locale : props.locale?.code;
|
||||
const settings = await payload.findGlobal({
|
||||
slug: settingsSlug,
|
||||
depth: 1,
|
||||
...locale ? {
|
||||
locale: locale
|
||||
} : {}
|
||||
});
|
||||
const name = pickText(settings[nameField], locale);
|
||||
const image = settings[imageField];
|
||||
const url = image && typeof image === 'object' && typeof image.url === 'string' ? image.url : null;
|
||||
return {
|
||||
name,
|
||||
url
|
||||
};
|
||||
} catch (error) {
|
||||
console.warn('[ipal] admin branding: falling back to Payload default:', error);
|
||||
return {
|
||||
name: null,
|
||||
url: null
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Admin panel logo — this is the LARGE logo on the login / unauthorized screens
|
||||
* (Payload uses `graphics.Icon` for the small nav glyph). SiteSettings `logo`,
|
||||
* falls back to `siteName` text. Sized generously for the login screen.
|
||||
*/ export async function AdminLogo(props = {}) {
|
||||
const { imageField = 'logo', nameField = 'siteName', settingsSlug = 'site-settings' } = props;
|
||||
const { name, url } = await loadBranding(props, settingsSlug, nameField, imageField);
|
||||
if (url) {
|
||||
return /*#__PURE__*/ _jsx("img", {
|
||||
alt: name ?? '',
|
||||
src: url,
|
||||
style: {
|
||||
height: 'auto',
|
||||
maxHeight: 120,
|
||||
maxWidth: 420,
|
||||
width: 'auto'
|
||||
}
|
||||
});
|
||||
}
|
||||
if (name) {
|
||||
return /*#__PURE__*/ _jsx("div", {
|
||||
style: {
|
||||
fontSize: '2rem',
|
||||
fontWeight: 600
|
||||
},
|
||||
children: name
|
||||
});
|
||||
}
|
||||
return null // nothing configured → Payload's default
|
||||
;
|
||||
}
|
||||
/** Admin panel icon (small nav glyph). SiteSettings `favicon`, falls back to initials. */ export async function AdminIcon(props = {}) {
|
||||
const { imageField = 'favicon', nameField = 'siteName', settingsSlug = 'site-settings' } = props;
|
||||
const { name, url } = await loadBranding(props, settingsSlug, nameField, imageField);
|
||||
if (url) {
|
||||
return /*#__PURE__*/ _jsx("img", {
|
||||
alt: name ?? '',
|
||||
src: url,
|
||||
style: {
|
||||
height: 'auto',
|
||||
maxHeight: 28,
|
||||
maxWidth: 28,
|
||||
width: 'auto'
|
||||
}
|
||||
});
|
||||
}
|
||||
if (name) {
|
||||
return /*#__PURE__*/ _jsx("div", {
|
||||
style: {
|
||||
fontWeight: 700
|
||||
},
|
||||
children: name.slice(0, 2).toUpperCase()
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Discreet vendor credit: "Technology supported by Intecion.com". This is the
|
||||
* PLUGIN VENDOR's credit (Intecion ships ipal-kit, the framework), not client
|
||||
* data — a sensible default here is fine and A0-safe. The client's own brand
|
||||
* still owns the logo/name; this is a small line stating who supports the tech.
|
||||
* Text/URL overridable; turn it off with `whiteLabel: { credit: false }`.
|
||||
*
|
||||
* Wired by ipalKit into admin.components.afterNavLinks (nav) AND afterLogin
|
||||
* (login screen footer). `variant` adjusts placement:
|
||||
* - 'nav' → left-aligned line under the nav links
|
||||
* - 'login' → centered line below the login form
|
||||
*/ export function IntecionCredit(props = {}) {
|
||||
const { text = 'Technology supported by Intecion.com', url = 'https://intecion.com', variant = 'nav' } = props;
|
||||
const style = variant === 'login' ? {
|
||||
color: 'inherit',
|
||||
display: 'block',
|
||||
fontSize: '0.75rem',
|
||||
marginTop: '2rem',
|
||||
opacity: 0.6,
|
||||
padding: '0.5rem',
|
||||
textAlign: 'center',
|
||||
textDecoration: 'none'
|
||||
} : {
|
||||
color: 'inherit',
|
||||
display: 'block',
|
||||
fontSize: '0.75rem',
|
||||
opacity: 0.6,
|
||||
padding: '0.75rem 1rem',
|
||||
textDecoration: 'none'
|
||||
};
|
||||
return /*#__PURE__*/ _jsx("a", {
|
||||
href: url,
|
||||
rel: "noopener noreferrer",
|
||||
style: style,
|
||||
target: "_blank",
|
||||
children: text
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=adminGraphics.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -0,0 +1 @@
|
||||
export { AdminIcon, AdminLogo, IntecionCredit } from './adminGraphics.js';
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
export { AdminIcon, AdminLogo, IntecionCredit } from './adminGraphics.js';
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/branding/index.ts"],"sourcesContent":["export { AdminIcon, AdminLogo, IntecionCredit } from './adminGraphics.js'\n"],"names":["AdminIcon","AdminLogo","IntecionCredit"],"mappings":"AAAA,SAASA,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ,qBAAoB"}
|
||||
+49
@@ -0,0 +1,49 @@
|
||||
import type { ConsentCategory } from './categories.js';
|
||||
type ConsentScriptProps = {
|
||||
/** Default true. */
|
||||
async?: boolean;
|
||||
/** Extra attributes on the <script> (e.g. { 'data-domain': 'x.com' }). */
|
||||
attributes?: Record<string, string>;
|
||||
/**
|
||||
* Consent category that must be granted before the script loads. Typically
|
||||
* 'analytics' (GA, Plausible) or 'marketing' (Meta Pixel, ads, chat widgets).
|
||||
*/
|
||||
category: ConsentCategory;
|
||||
/**
|
||||
* Inline JS to run once granted. If `src` is also set, it runs after the
|
||||
* external script loads (so init code can rely on the library). A plain
|
||||
* string of code — NOT user input (you control it), it goes into a <script>.
|
||||
*/
|
||||
code?: string;
|
||||
defer?: boolean;
|
||||
/** Stable id used to dedupe — the script is injected at most once. */
|
||||
id?: string;
|
||||
/** External script URL. Injected only once the category is granted. */
|
||||
src?: string;
|
||||
};
|
||||
/**
|
||||
* Loads a third-party script ONLY after the visitor has granted consent for its
|
||||
* category — the GDPR-correct default for anything that isn't strictly
|
||||
* necessary. Renders nothing until then. Reacts live to the consent context, so
|
||||
* a script appears the moment the visitor accepts in the banner, with no reload.
|
||||
*
|
||||
* Use this for third parties that have NO Google Consent Mode of their own (Meta
|
||||
* Pixel, LinkedIn Insight, chat widgets, custom analytics). GA/GTM are better
|
||||
* handled by Consent Mode (the module's updateConsent already does that) — reach
|
||||
* for ConsentScript when a vendor can't be gated that way.
|
||||
*
|
||||
* Must be rendered inside <ConsentProvider>.
|
||||
*
|
||||
* <ConsentScript category="marketing" src="https://connect.facebook.net/en_US/fbevents.js" />
|
||||
* <ConsentScript category="analytics"
|
||||
* src="https://plausible.io/js/script.js"
|
||||
* attributes={{ 'data-domain': 'example.com' }} />
|
||||
* <ConsentScript category="marketing" code={`fbq('init','123');fbq('track','PageView')`} />
|
||||
*
|
||||
* Note on withdrawal: once a script has loaded it keeps running for that page
|
||||
* (a <script> tag can't be truly unloaded) — withdrawing consent stops the NEXT
|
||||
* load. For vendors that support it, prefer Consent Mode so running tags honor
|
||||
* the change immediately; ConsentScript gates the initial load.
|
||||
*/
|
||||
export declare function ConsentScript({ id, async: asyncAttr, attributes, category, code, defer, src, }: ConsentScriptProps): null;
|
||||
export default ConsentScript;
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
'use client';
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useConsentContext } from './ConsentContext.js';
|
||||
/**
|
||||
* Loads a third-party script ONLY after the visitor has granted consent for its
|
||||
* category — the GDPR-correct default for anything that isn't strictly
|
||||
* necessary. Renders nothing until then. Reacts live to the consent context, so
|
||||
* a script appears the moment the visitor accepts in the banner, with no reload.
|
||||
*
|
||||
* Use this for third parties that have NO Google Consent Mode of their own (Meta
|
||||
* Pixel, LinkedIn Insight, chat widgets, custom analytics). GA/GTM are better
|
||||
* handled by Consent Mode (the module's updateConsent already does that) — reach
|
||||
* for ConsentScript when a vendor can't be gated that way.
|
||||
*
|
||||
* Must be rendered inside <ConsentProvider>.
|
||||
*
|
||||
* <ConsentScript category="marketing" src="https://connect.facebook.net/en_US/fbevents.js" />
|
||||
* <ConsentScript category="analytics"
|
||||
* src="https://plausible.io/js/script.js"
|
||||
* attributes={{ 'data-domain': 'example.com' }} />
|
||||
* <ConsentScript category="marketing" code={`fbq('init','123');fbq('track','PageView')`} />
|
||||
*
|
||||
* Note on withdrawal: once a script has loaded it keeps running for that page
|
||||
* (a <script> tag can't be truly unloaded) — withdrawing consent stops the NEXT
|
||||
* load. For vendors that support it, prefer Consent Mode so running tags honor
|
||||
* the change immediately; ConsentScript gates the initial load.
|
||||
*/ export function ConsentScript({ id, async: asyncAttr = true, attributes, category, code, defer, src }) {
|
||||
const { state } = useConsentContext();
|
||||
const granted = state[category] === true;
|
||||
const injectedRef = useRef(false);
|
||||
useEffect(()=>{
|
||||
if (!granted || injectedRef.current) {
|
||||
return;
|
||||
}
|
||||
if (!src && !code) {
|
||||
return;
|
||||
}
|
||||
const dedupeId = id ?? (src ? `ipal-cs-${src}` : undefined);
|
||||
if (dedupeId && document.getElementById(dedupeId)) {
|
||||
injectedRef.current = true;
|
||||
return;
|
||||
}
|
||||
injectedRef.current = true;
|
||||
const runInline = ()=>{
|
||||
if (!code) {
|
||||
return;
|
||||
}
|
||||
const inline = document.createElement('script');
|
||||
if (dedupeId) {
|
||||
inline.id = `${dedupeId}-inline`;
|
||||
}
|
||||
inline.textContent = code;
|
||||
document.head.appendChild(inline);
|
||||
};
|
||||
if (src) {
|
||||
const el = document.createElement('script');
|
||||
el.src = src;
|
||||
if (dedupeId) {
|
||||
el.id = dedupeId;
|
||||
}
|
||||
if (asyncAttr) {
|
||||
el.async = true;
|
||||
}
|
||||
if (defer) {
|
||||
el.defer = true;
|
||||
}
|
||||
if (attributes) {
|
||||
for (const [k, v] of Object.entries(attributes)){
|
||||
el.setAttribute(k, v);
|
||||
}
|
||||
}
|
||||
el.addEventListener('load', runInline, {
|
||||
once: true
|
||||
});
|
||||
document.head.appendChild(el);
|
||||
} else {
|
||||
runInline();
|
||||
}
|
||||
// Deliberately no removal on cleanup: a loaded third-party script can't be
|
||||
// meaningfully unloaded. Withdrawal is handled by not re-injecting (and, for
|
||||
// vendors that support it, Consent Mode). See the component doc.
|
||||
}, [
|
||||
granted,
|
||||
src,
|
||||
code,
|
||||
id,
|
||||
attributes,
|
||||
asyncAttr,
|
||||
defer
|
||||
]);
|
||||
return null;
|
||||
}
|
||||
export default ConsentScript;
|
||||
|
||||
//# sourceMappingURL=ConsentScript.js.map
|
||||
+1
File diff suppressed because one or more lines are too long
Vendored
+14
-1
@@ -4,6 +4,7 @@ import { Cookie } from 'lucide-react';
|
||||
import { useEffect, useState } from 'react';
|
||||
import { CONSENT_CATEGORIES } from './categories.js';
|
||||
import { useConsentContext } from './ConsentContext.js';
|
||||
import { useIsMounted } from './useIsMounted.js';
|
||||
/**
|
||||
* Colours and radius come from CSS custom properties with built-in fallbacks,
|
||||
* so the banner looks right with no setup, and re-skinning per client means
|
||||
@@ -36,6 +37,7 @@ const bodyText = 'text-[var(--ipal-text,#404040)] dark:text-[var(--ipal-text-dar
|
||||
const strongText = 'text-[var(--ipal-text-strong,#171717)] dark:text-[var(--ipal-text-strong-dark,#f5f5f5)]';
|
||||
const mutedText = 'text-[var(--ipal-text-muted,#737373)] dark:text-[var(--ipal-text-muted-dark,#a3a3a3)]';
|
||||
export function CookieBanner({ classNames } = {}) {
|
||||
const isMounted = useIsMounted();
|
||||
const { acceptAll, decided, rejectAll, savePreferences, state, texts } = useConsentContext();
|
||||
const [showSettings, setShowSettings] = useState(false);
|
||||
const [choices, setChoices] = useState(state);
|
||||
@@ -44,6 +46,12 @@ export function CookieBanner({ classNames } = {}) {
|
||||
}, [
|
||||
state
|
||||
]);
|
||||
// Render nothing until mounted — avoids the React 19 hydration mismatch that
|
||||
// projects used to work around with a setTimeout ConsentWrapper. No wrapper
|
||||
// needed now.
|
||||
if (!isMounted) {
|
||||
return null;
|
||||
}
|
||||
if (decided) {
|
||||
return null;
|
||||
}
|
||||
@@ -60,7 +68,7 @@ export function CookieBanner({ classNames } = {}) {
|
||||
const primaryClass = classNames?.primaryButton ?? defaults.primaryButton;
|
||||
const secondaryClass = classNames?.secondaryButton ?? defaults.secondaryButton;
|
||||
return /*#__PURE__*/ _jsx("div", {
|
||||
"aria-label": "Cookie consent",
|
||||
"aria-label": texts.settingsTitle,
|
||||
className: rootClass,
|
||||
"data-ipal": "banner",
|
||||
role: "dialog",
|
||||
@@ -99,16 +107,19 @@ export function CookieBanner({ classNames } = {}) {
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: secondaryClass,
|
||||
"data-ipal": "settings",
|
||||
onClick: ()=>setShowSettings(true),
|
||||
children: texts.buttons.settings
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: secondaryClass,
|
||||
"data-ipal": "reject",
|
||||
onClick: rejectAll,
|
||||
children: texts.buttons.reject
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: primaryClass,
|
||||
"data-ipal": "accept",
|
||||
onClick: acceptAll,
|
||||
children: texts.buttons.acceptAll
|
||||
})
|
||||
@@ -160,11 +171,13 @@ export function CookieBanner({ classNames } = {}) {
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: secondaryClass,
|
||||
"data-ipal": "back",
|
||||
onClick: ()=>setShowSettings(false),
|
||||
children: texts.buttons.back
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: primaryClass,
|
||||
"data-ipal": "save",
|
||||
onClick: ()=>savePreferences(choices),
|
||||
children: texts.buttons.save
|
||||
})
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+10
-2
@@ -2,6 +2,7 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { Cookie } from 'lucide-react';
|
||||
import { useConsentContext } from './ConsentContext.js';
|
||||
import { useIsMounted } from './useIsMounted.js';
|
||||
/**
|
||||
* Floating "cookie settings" button — lets visitors reopen the consent panel
|
||||
* after deciding (GDPR: withdrawing consent must be as easy as giving it).
|
||||
@@ -12,13 +13,20 @@ import { useConsentContext } from './ConsentContext.js';
|
||||
* palette applies to both without touching either component. Pass className to
|
||||
* replace the styling outright.
|
||||
*/ export function CookieButton({ className } = {}) {
|
||||
const { decided, reopen } = useConsentContext();
|
||||
const isMounted = useIsMounted();
|
||||
const { decided, reopen, texts } = useConsentContext();
|
||||
// Render nothing until mounted — prevents hydration mismatch (no project
|
||||
// ConsentWrapper workaround needed).
|
||||
if (!isMounted) {
|
||||
return null;
|
||||
}
|
||||
if (!decided) {
|
||||
return null;
|
||||
}
|
||||
const cls = className ?? 'fixed bottom-4 left-4 z-40 flex h-11 w-11 items-center justify-center rounded-full border shadow-md transition-colors ' + 'bg-[var(--ipal-surface,#fff)] border-[var(--ipal-border,#e5e5e5)] hover:bg-[var(--ipal-hover,#f5f5f5)] ' + 'dark:bg-[var(--ipal-surface-dark,#171717)] dark:border-[var(--ipal-border-dark,#262626)] dark:hover:bg-[var(--ipal-hover-dark,#262626)]';
|
||||
return /*#__PURE__*/ _jsx("button", {
|
||||
"aria-label": "Cookie settings",
|
||||
// a11y label per locale: the panel's "settings title" (Cookie Settings global)
|
||||
"aria-label": texts.settingsTitle,
|
||||
className: cls,
|
||||
"data-ipal": "cookie-button",
|
||||
onClick: reopen,
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/consent/CookieButton.tsx"],"sourcesContent":["'use client'\nimport { Cookie } from 'lucide-react'\n\nimport { useConsentContext } from './ConsentContext.js'\n\n/**\n * Floating \"cookie settings\" button — lets visitors reopen the consent panel\n * after deciding (GDPR: withdrawing consent must be as easy as giving it).\n * Hidden while the banner is showing.\n *\n * Colours follow the same CSS custom properties as CookieBanner\n * (--ipal-surface, --ipal-border, --ipal-hover, --ipal-text), so a client's\n * palette applies to both without touching either component. Pass className to\n * replace the styling outright.\n */\nexport function CookieButton({ className }: { className?: string } = {}) {\n const { decided, reopen } = useConsentContext()\n\n if (!decided) {return null}\n\n const cls =\n className ??\n 'fixed bottom-4 left-4 z-40 flex h-11 w-11 items-center justify-center rounded-full border shadow-md transition-colors ' +\n 'bg-[var(--ipal-surface,#fff)] border-[var(--ipal-border,#e5e5e5)] hover:bg-[var(--ipal-hover,#f5f5f5)] ' +\n 'dark:bg-[var(--ipal-surface-dark,#171717)] dark:border-[var(--ipal-border-dark,#262626)] dark:hover:bg-[var(--ipal-hover-dark,#262626)]'\n\n return (\n <button aria-label=\"Cookie settings\" className={cls} data-ipal=\"cookie-button\" onClick={reopen}>\n <Cookie\n aria-hidden=\"true\"\n className=\"h-5 w-5 text-[var(--ipal-text,#525252)] dark:text-[var(--ipal-text-dark,#d4d4d4)]\"\n />\n </button>\n )\n}\n"],"names":["Cookie","useConsentContext","CookieButton","className","decided","reopen","cls","button","aria-label","data-ipal","onClick","aria-hidden"],"mappings":"AAAA;;AACA,SAASA,MAAM,QAAQ,eAAc;AAErC,SAASC,iBAAiB,QAAQ,sBAAqB;AAEvD;;;;;;;;;CASC,GACD,OAAO,SAASC,aAAa,EAAEC,SAAS,EAA0B,GAAG,CAAC,CAAC;IACrE,MAAM,EAAEC,OAAO,EAAEC,MAAM,EAAE,GAAGJ;IAE5B,IAAI,CAACG,SAAS;QAAC,OAAO;IAAI;IAE1B,MAAME,MACJH,aACA,2HACE,4GACA;IAEJ,qBACE,KAACI;QAAOC,cAAW;QAAkBL,WAAWG;QAAKG,aAAU;QAAgBC,SAASL;kBACtF,cAAA,KAACL;YACCW,eAAY;YACZR,WAAU;;;AAIlB"}
|
||||
{"version":3,"sources":["../../../src/modules/consent/CookieButton.tsx"],"sourcesContent":["'use client'\nimport { Cookie } from 'lucide-react'\n\nimport { useConsentContext } from './ConsentContext.js'\nimport { useIsMounted } from './useIsMounted.js'\n\n/**\n * Floating \"cookie settings\" button — lets visitors reopen the consent panel\n * after deciding (GDPR: withdrawing consent must be as easy as giving it).\n * Hidden while the banner is showing.\n *\n * Colours follow the same CSS custom properties as CookieBanner\n * (--ipal-surface, --ipal-border, --ipal-hover, --ipal-text), so a client's\n * palette applies to both without touching either component. Pass className to\n * replace the styling outright.\n */\nexport function CookieButton({ className }: { className?: string } = {}) {\n const isMounted = useIsMounted()\n const { decided, reopen, texts } = useConsentContext()\n\n // Render nothing until mounted — prevents hydration mismatch (no project\n // ConsentWrapper workaround needed).\n if (!isMounted) {return null}\n if (!decided) {return null}\n\n const cls =\n className ??\n 'fixed bottom-4 left-4 z-40 flex h-11 w-11 items-center justify-center rounded-full border shadow-md transition-colors ' +\n 'bg-[var(--ipal-surface,#fff)] border-[var(--ipal-border,#e5e5e5)] hover:bg-[var(--ipal-hover,#f5f5f5)] ' +\n 'dark:bg-[var(--ipal-surface-dark,#171717)] dark:border-[var(--ipal-border-dark,#262626)] dark:hover:bg-[var(--ipal-hover-dark,#262626)]'\n\n return (\n <button\n // a11y label per locale: the panel's \"settings title\" (Cookie Settings global)\n aria-label={texts.settingsTitle}\n className={cls}\n data-ipal=\"cookie-button\"\n onClick={reopen}\n >\n <Cookie\n aria-hidden=\"true\"\n className=\"h-5 w-5 text-[var(--ipal-text,#525252)] dark:text-[var(--ipal-text-dark,#d4d4d4)]\"\n />\n </button>\n )\n}\n"],"names":["Cookie","useConsentContext","useIsMounted","CookieButton","className","isMounted","decided","reopen","texts","cls","button","aria-label","settingsTitle","data-ipal","onClick","aria-hidden"],"mappings":"AAAA;;AACA,SAASA,MAAM,QAAQ,eAAc;AAErC,SAASC,iBAAiB,QAAQ,sBAAqB;AACvD,SAASC,YAAY,QAAQ,oBAAmB;AAEhD;;;;;;;;;CASC,GACD,OAAO,SAASC,aAAa,EAAEC,SAAS,EAA0B,GAAG,CAAC,CAAC;IACrE,MAAMC,YAAYH;IAClB,MAAM,EAAEI,OAAO,EAAEC,MAAM,EAAEC,KAAK,EAAE,GAAGP;IAEnC,yEAAyE;IACzE,qCAAqC;IACrC,IAAI,CAACI,WAAW;QAAC,OAAO;IAAI;IAC5B,IAAI,CAACC,SAAS;QAAC,OAAO;IAAI;IAE1B,MAAMG,MACJL,aACA,2HACE,4GACA;IAEJ,qBACE,KAACM;QACC,+EAA+E;QAC/EC,cAAYH,MAAMI,aAAa;QAC/BR,WAAWK;QACXI,aAAU;QACVC,SAASP;kBAET,cAAA,KAACP;YACCe,eAAY;YACZX,WAAU;;;AAIlB"}
|
||||
Vendored
+1
@@ -1,4 +1,5 @@
|
||||
export { ConsentProvider, useConsentContext } from './ConsentContext.js';
|
||||
export { ConsentScript } from './ConsentScript.js';
|
||||
export { CookieBanner } from './CookieBanner.js';
|
||||
export type { CookieBannerClassNames } from './CookieBanner.js';
|
||||
export { CookieButton } from './CookieButton.js';
|
||||
|
||||
Vendored
+1
@@ -1,5 +1,6 @@
|
||||
'use client';
|
||||
export { ConsentProvider, useConsentContext } from './ConsentContext.js';
|
||||
export { ConsentScript } from './ConsentScript.js';
|
||||
export { CookieBanner } from './CookieBanner.js';
|
||||
export { CookieButton } from './CookieButton.js';
|
||||
// Client-only consent exports — hook, provider, and UI components.
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/consent/client.ts"],"sourcesContent":["'use client'\nexport { ConsentProvider, useConsentContext } from './ConsentContext.js'\nexport { CookieBanner } from './CookieBanner.js'\nexport type { CookieBannerClassNames } from './CookieBanner.js'\nexport { CookieButton } from './CookieButton.js'\n// Client-only consent exports — hook, provider, and UI components.\nexport { useConsent } from './useConsent.js'\n"],"names":["ConsentProvider","useConsentContext","CookieBanner","CookieButton","useConsent"],"mappings":"AAAA;AACA,SAASA,eAAe,EAAEC,iBAAiB,QAAQ,sBAAqB;AACxE,SAASC,YAAY,QAAQ,oBAAmB;AAEhD,SAASC,YAAY,QAAQ,oBAAmB;AAChD,mEAAmE;AACnE,SAASC,UAAU,QAAQ,kBAAiB"}
|
||||
{"version":3,"sources":["../../../src/modules/consent/client.ts"],"sourcesContent":["'use client'\nexport { ConsentProvider, useConsentContext } from './ConsentContext.js'\nexport { ConsentScript } from './ConsentScript.js'\nexport { CookieBanner } from './CookieBanner.js'\nexport type { CookieBannerClassNames } from './CookieBanner.js'\nexport { CookieButton } from './CookieButton.js'\n// Client-only consent exports — hook, provider, and UI components.\nexport { useConsent } from './useConsent.js'\n"],"names":["ConsentProvider","useConsentContext","ConsentScript","CookieBanner","CookieButton","useConsent"],"mappings":"AAAA;AACA,SAASA,eAAe,EAAEC,iBAAiB,QAAQ,sBAAqB;AACxE,SAASC,aAAa,QAAQ,qBAAoB;AAClD,SAASC,YAAY,QAAQ,oBAAmB;AAEhD,SAASC,YAAY,QAAQ,oBAAmB;AAChD,mEAAmE;AACnE,SAASC,UAAU,QAAQ,kBAAiB"}
|
||||
+21
-10
@@ -1,25 +1,36 @@
|
||||
import type { BasePayload } from 'payload';
|
||||
import type { I18nConfig } from '../i18n/index.js';
|
||||
import type { ConsentTexts } from './texts.js';
|
||||
type PrivacyPage = {
|
||||
slug?: null | Record<string, unknown>;
|
||||
title?: unknown;
|
||||
} | null;
|
||||
type GetConsentTextsArgs = {
|
||||
config: I18nConfig;
|
||||
locale?: string;
|
||||
payload: BasePayload;
|
||||
/**
|
||||
* Privacy-policy label + the system page (from SiteSettings.privacyPolicy,
|
||||
* read with locale:'all') to link to. Optional — omit for no link.
|
||||
* Privacy-policy link. Omit it — the page is read automatically from
|
||||
* SiteSettings → System Pages → Privacy Policy, and the link text from
|
||||
* CookieSettings → privacyLinkLabel (per locale, editable in the panel).
|
||||
*
|
||||
* - `false` → no link.
|
||||
* - `{ page }` → use this page (SiteSettings.privacyPolicy read with locale:'all').
|
||||
* - `label` → DEPRECATED (hardcoded text); used only when the panel field is empty.
|
||||
*/
|
||||
privacyPolicy?: {
|
||||
label: string;
|
||||
page: {
|
||||
slug?: null | Record<string, unknown>;
|
||||
} | null;
|
||||
};
|
||||
/** @deprecated Set CookieSettings → privacyLinkLabel in the panel instead. */
|
||||
label?: string;
|
||||
page?: PrivacyPage;
|
||||
} | false;
|
||||
/** SiteSettings global slug for the automatic privacy page lookup. Default 'site-settings'. */
|
||||
settingsSlug?: string;
|
||||
};
|
||||
/**
|
||||
* Resolves consent banner texts from the CookieSettings global, falling back to
|
||||
* English defaults per field. The privacy-policy link is built from the pages
|
||||
* module (system page role), not stored in CookieSettings — one source of truth.
|
||||
* English defaults per field. The privacy-policy link target comes from the
|
||||
* pages module (system page role, read automatically); its text from
|
||||
* CookieSettings.privacyLinkLabel — both editable in the panel, per locale.
|
||||
*/
|
||||
export declare function getConsentTexts({ config, locale, payload, privacyPolicy, }: GetConsentTextsArgs): Promise<ConsentTexts>;
|
||||
export declare function getConsentTexts({ config, locale, payload, privacyPolicy, settingsSlug, }: GetConsentTextsArgs): Promise<ConsentTexts>;
|
||||
export {};
|
||||
|
||||
+30
-9
@@ -1,3 +1,4 @@
|
||||
import { resolveLocalized } from '../i18n/resolveLocalized.js';
|
||||
import { getSystemPagePath } from '../pages/index.js';
|
||||
import { getGlobal } from '../payload/index.js';
|
||||
import { CONSENT_CATEGORIES } from './categories.js';
|
||||
@@ -31,11 +32,28 @@ import { CONSENT_CATEGORIES } from './categories.js';
|
||||
privacyLink: null,
|
||||
settingsTitle: 'Cookie settings'
|
||||
};
|
||||
/** Last-resort link text — only when neither the panel nor the page has one. */ const FALLBACK_PRIVACY_LABEL = 'Privacy policy';
|
||||
/** Reads SiteSettings.privacyPolicy with all locales (slug + title as maps). */ async function readPrivacyPage(payload, settingsSlug) {
|
||||
try {
|
||||
const settings = await payload.findGlobal({
|
||||
slug: settingsSlug,
|
||||
depth: 1,
|
||||
locale: 'all'
|
||||
});
|
||||
const page = settings.privacyPolicy;
|
||||
return page && typeof page === 'object' ? page : null;
|
||||
} catch (error) {
|
||||
// No pages option / no privacyPolicy field / DB unreachable at build → no link.
|
||||
console.warn('[ipal] getConsentTexts: privacy page lookup failed, banner without link:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Resolves consent banner texts from the CookieSettings global, falling back to
|
||||
* English defaults per field. The privacy-policy link is built from the pages
|
||||
* module (system page role), not stored in CookieSettings — one source of truth.
|
||||
*/ export async function getConsentTexts({ config, locale, payload, privacyPolicy }) {
|
||||
* English defaults per field. The privacy-policy link target comes from the
|
||||
* pages module (system page role, read automatically); its text from
|
||||
* CookieSettings.privacyLinkLabel — both editable in the panel, per locale.
|
||||
*/ export async function getConsentTexts({ config, locale, payload, privacyPolicy, settingsSlug = 'site-settings' }) {
|
||||
const g = await getGlobal(payload, 'cookie-settings', {
|
||||
locale
|
||||
});
|
||||
@@ -48,16 +66,19 @@ import { CONSENT_CATEGORIES } from './categories.js';
|
||||
};
|
||||
}
|
||||
let privacyLink = null;
|
||||
if (privacyPolicy?.page && locale) {
|
||||
const href = getSystemPagePath({
|
||||
if (privacyPolicy !== false && locale) {
|
||||
const page = privacyPolicy?.page !== undefined ? privacyPolicy.page : await readPrivacyPage(payload, settingsSlug);
|
||||
const href = page ? getSystemPagePath({
|
||||
config,
|
||||
locale,
|
||||
page: privacyPolicy.page
|
||||
});
|
||||
if (href) {
|
||||
page
|
||||
}) : undefined;
|
||||
if (page && href) {
|
||||
// Panel first, then the deprecated code label, then the page's own title.
|
||||
const label = g.privacyLinkLabel?.trim() || privacyPolicy?.label?.trim() || resolveLocalized(page.title, locale).trim() || FALLBACK_PRIVACY_LABEL;
|
||||
privacyLink = {
|
||||
href,
|
||||
label: privacyPolicy.label
|
||||
label
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -4,3 +4,4 @@ export { getConsentTexts } from './getConsentTexts.js';
|
||||
export { setDefaultConsent, updateConsent } from './googleConsent.js';
|
||||
export { CONSENT_COOKIE, CONSENT_MAX_AGE, CONSENT_VERSION, parseConsent, serializeConsent, } from './storage.js';
|
||||
export type { ConsentTexts } from './texts.js';
|
||||
export { useIsMounted } from './useIsMounted.js';
|
||||
|
||||
Vendored
+1
@@ -5,5 +5,6 @@ export { ACCEPT_ALL_CONSENT, CONSENT_CATEGORIES, DEFAULT_CONSENT, REJECT_ALL_CON
|
||||
export { getConsentTexts } from './getConsentTexts.js';
|
||||
export { setDefaultConsent, updateConsent } from './googleConsent.js';
|
||||
export { CONSENT_COOKIE, CONSENT_MAX_AGE, CONSENT_VERSION, parseConsent, serializeConsent } from './storage.js';
|
||||
export { useIsMounted } from './useIsMounted.js';
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/consent/index.ts"],"sourcesContent":["// Server-safe exports (logic, types, helper). Client components (banner,\n// provider, hook) are exported separately via ./client to keep the RSC/client\n// boundary clean.\nexport {\n ACCEPT_ALL_CONSENT,\n CONSENT_CATEGORIES,\n DEFAULT_CONSENT,\n REJECT_ALL_CONSENT,\n} from './categories.js'\nexport type { ConsentCategory, ConsentState } from './categories.js'\nexport { getConsentTexts } from './getConsentTexts.js'\nexport { setDefaultConsent, updateConsent } from './googleConsent.js'\nexport {\n CONSENT_COOKIE,\n CONSENT_MAX_AGE,\n CONSENT_VERSION,\n parseConsent,\n serializeConsent,\n} from './storage.js'\nexport type { ConsentTexts } from './texts.js'\n"],"names":["ACCEPT_ALL_CONSENT","CONSENT_CATEGORIES","DEFAULT_CONSENT","REJECT_ALL_CONSENT","getConsentTexts","setDefaultConsent","updateConsent","CONSENT_COOKIE","CONSENT_MAX_AGE","CONSENT_VERSION","parseConsent","serializeConsent"],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,kBAAkB;AAClB,SACEA,kBAAkB,EAClBC,kBAAkB,EAClBC,eAAe,EACfC,kBAAkB,QACb,kBAAiB;AAExB,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,qBAAoB;AACrE,SACEC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,QACX,eAAc"}
|
||||
{"version":3,"sources":["../../../src/modules/consent/index.ts"],"sourcesContent":["// Server-safe exports (logic, types, helper). Client components (banner,\n// provider, hook) are exported separately via ./client to keep the RSC/client\n// boundary clean.\nexport {\n ACCEPT_ALL_CONSENT,\n CONSENT_CATEGORIES,\n DEFAULT_CONSENT,\n REJECT_ALL_CONSENT,\n} from './categories.js'\nexport type { ConsentCategory, ConsentState } from './categories.js'\nexport { getConsentTexts } from './getConsentTexts.js'\nexport { setDefaultConsent, updateConsent } from './googleConsent.js'\nexport {\n CONSENT_COOKIE,\n CONSENT_MAX_AGE,\n CONSENT_VERSION,\n parseConsent,\n serializeConsent,\n} from './storage.js'\nexport type { ConsentTexts } from './texts.js'\nexport { useIsMounted } from './useIsMounted.js'\n"],"names":["ACCEPT_ALL_CONSENT","CONSENT_CATEGORIES","DEFAULT_CONSENT","REJECT_ALL_CONSENT","getConsentTexts","setDefaultConsent","updateConsent","CONSENT_COOKIE","CONSENT_MAX_AGE","CONSENT_VERSION","parseConsent","serializeConsent","useIsMounted"],"mappings":"AAAA,yEAAyE;AACzE,8EAA8E;AAC9E,kBAAkB;AAClB,SACEA,kBAAkB,EAClBC,kBAAkB,EAClBC,eAAe,EACfC,kBAAkB,QACb,kBAAiB;AAExB,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,iBAAiB,EAAEC,aAAa,QAAQ,qBAAoB;AACrE,SACEC,cAAc,EACdC,eAAe,EACfC,eAAe,EACfC,YAAY,EACZC,gBAAgB,QACX,eAAc;AAErB,SAASC,YAAY,QAAQ,oBAAmB"}
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
* Returns true only after the component has mounted on the client. Used to gate
|
||||
* consent UI (CookieBanner, CookieButton) so it renders nothing during SSR /
|
||||
* first paint — preventing the React 19 / Next hydration mismatch that projects
|
||||
* were working around with their own setTimeout-based ConsentWrapper. Built into
|
||||
* the components now, so no project wrapper is needed.
|
||||
*/
|
||||
export declare function useIsMounted(): boolean;
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
'use client';
|
||||
import { useEffect, useState } from 'react';
|
||||
/**
|
||||
* Returns true only after the component has mounted on the client. Used to gate
|
||||
* consent UI (CookieBanner, CookieButton) so it renders nothing during SSR /
|
||||
* first paint — preventing the React 19 / Next hydration mismatch that projects
|
||||
* were working around with their own setTimeout-based ConsentWrapper. Built into
|
||||
* the components now, so no project wrapper is needed.
|
||||
*/ export function useIsMounted() {
|
||||
const [mounted, setMounted] = useState(false);
|
||||
useEffect(()=>{
|
||||
setMounted(true);
|
||||
}, []);
|
||||
return mounted;
|
||||
}
|
||||
|
||||
//# sourceMappingURL=useIsMounted.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/consent/useIsMounted.ts"],"sourcesContent":["'use client'\nimport { useEffect, useState } from 'react'\n\n/**\n * Returns true only after the component has mounted on the client. Used to gate\n * consent UI (CookieBanner, CookieButton) so it renders nothing during SSR /\n * first paint — preventing the React 19 / Next hydration mismatch that projects\n * were working around with their own setTimeout-based ConsentWrapper. Built into\n * the components now, so no project wrapper is needed.\n */\nexport function useIsMounted(): boolean {\n const [mounted, setMounted] = useState(false)\n useEffect(() => {\n setMounted(true)\n }, [])\n return mounted\n}\n"],"names":["useEffect","useState","useIsMounted","mounted","setMounted"],"mappings":"AAAA;AACA,SAASA,SAAS,EAAEC,QAAQ,QAAQ,QAAO;AAE3C;;;;;;CAMC,GACD,OAAO,SAASC;IACd,MAAM,CAACC,SAASC,WAAW,GAAGH,SAAS;IACvCD,UAAU;QACRI,WAAW;IACb,GAAG,EAAE;IACL,OAAOD;AACT"}
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
/**
|
||||
* Converts a page's `blocks` layout to Markdown by CONVENTION — the same field
|
||||
* names the project already standardises on (heading, subheading, body,
|
||||
* content, image, items/faq/…; see the naming rules in agents.md). The plugin
|
||||
* can't know each project's block shapes, but it CAN rely on those conventions,
|
||||
* so most blocks convert with zero per-project wiring. Special blocks get an
|
||||
* `overrides` entry keyed by blockType.
|
||||
*
|
||||
* Output is for AI/agent consumption (per-page Markdown, llms-full.txt), not
|
||||
* on-page rendering — it extracts readable text, not pixel-perfect layout.
|
||||
*
|
||||
* blocksToMarkdown(page.layout)
|
||||
* blocksToMarkdown(page.layout, {
|
||||
* overrides: { gallery: (b) => `(${(b.images as unknown[])?.length ?? 0} photos)` },
|
||||
* })
|
||||
*/
|
||||
type Block = Record<string, unknown> & {
|
||||
blockType?: string;
|
||||
};
|
||||
type BlockToMarkdown = (block: Block) => string;
|
||||
type BlocksToMarkdownArgs = {
|
||||
/** Per-blockType custom renderers. Return '' to omit a block. */
|
||||
overrides?: Record<string, BlockToMarkdown>;
|
||||
};
|
||||
export declare function blocksToMarkdown(layout: unknown, args?: BlocksToMarkdownArgs): string;
|
||||
export {};
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user