Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
aa284736c9 | ||
|
|
bd2fbaf8bf | ||
|
|
eb436528d4 | ||
|
|
70b676660d | ||
|
|
7dc93ac5ed | ||
|
|
3bab8a0697 | ||
|
|
7ef7927e38 | ||
|
|
a7846d9770 | ||
|
|
015092e773 | ||
|
|
f4d969ad29 | ||
|
|
fad5d778e8 | ||
|
|
0f073b963e | ||
|
|
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 |
@@ -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.
|
||||
@@ -1,260 +0,0 @@
|
||||
# Zasady i Standardy Projektowe — Payload CMS 3 + Next 16 + @intecion/ipal-kit
|
||||
|
||||
Niniejszy dokument stanowi bezwzględnie obowiązujące reguły pracy dla agenta (Antigravity) w niniejszym projekcie. Został sporządzony na podstawie dokumentacji w `/docs`. Każda zasada musi być ściśle przestrzegana, bez wyjątków i bez stosowania obejść/prowizorek.
|
||||
|
||||
---
|
||||
|
||||
## 1. ZASADA NADRZĘDNA: ipal-kit JEST OBOWIĄZKOWY
|
||||
|
||||
1. **Obowiązkowe użycie pluginu:**
|
||||
- Każda funkcja dostarczana przez `@intecion/ipal-kit` (i18n, SEO, formularze, consent, email, slug, bezpieczeństwo, strony systemowe, storage R2, breadcrumbs, JSON-LD) **MUSI** być realizowana przez plugin.
|
||||
- **NIGDY** nie twórz własnego kodu w projekcie dublującego możliwości pluginu.
|
||||
2. **Sprawdzaj przed pisaniem:**
|
||||
- Zanim napiszesz jakąkolwiek funkcję, helper czy komponent — sprawdź dokumentację w `node_modules/@intecion/ipal-kit/docs/` oraz definicje typów `.d.ts`. Jeśli funkcja istnieje w pluginie, **musisz** jej użyć.
|
||||
3. **Gdy w pluginie czegoś brakuje:**
|
||||
- **NIE** obchodź braku prowizorką ani własnym kodem w projekcie (to tworzy dług technologiczny i rozbieżności).
|
||||
- **Zgłoś brak funkcji do rozbudowy pluginu**, zamiast łatać to lokalnie.
|
||||
- Logika uniwersalna (przydatna w innych projektach) trafia do pluginu. W projekcie znajduje się **wyłącznie** specyfika danego klienta (jego bloki, wygląd, struktura danych).
|
||||
4. **Gdy coś w pluginie nie działa:**
|
||||
- **Zgłoś problem i błąd**, zamiast tworzyć ciche obejścia, prowizoryczne hooki czy hardkodowane patche.
|
||||
|
||||
---
|
||||
|
||||
## 2. KROK 0: INSTALACJA I DOSTĘP DO DOKUMENTACJI PLUGINU
|
||||
|
||||
1. **Utwórz `.npmrc` w katalogu projektu:**
|
||||
```ini
|
||||
legacy-peer-deps=true
|
||||
@intecion:registry=https://git.intecion.net/api/packages/IntecionSoftware/npm/
|
||||
```
|
||||
*(Scoped override: tylko `@intecion/*` z Gitea, rejestr publiczny bez tokena).*
|
||||
2. **Instalacja pluginu:**
|
||||
```bash
|
||||
pnpm add @intecion/ipal-kit
|
||||
```
|
||||
*(NIGDY nie instaluj z gita `git+https://...` — psuje React Client Manifest w Next).*
|
||||
3. **Lokalizacja dokumentacji źródłowej:**
|
||||
```bash
|
||||
ls node_modules/@intecion/ipal-kit/docs/
|
||||
```
|
||||
Zawsze korzystaj z plików w `docs/` pluginu (`getting-started.md`, `seo.md`, `forms.md`, `email.md`, `storage.md`, `i18n.md`, `blocks.md`, `turnstile.md` itd.).
|
||||
|
||||
---
|
||||
|
||||
## 3. ABSOLUTNY ZAKAZ HARDKODOWANIA
|
||||
|
||||
### A. Treść i teksty:
|
||||
- **ZAKAZ:** Tekst widoczny dla użytkownika wpisany w JSX, etykiety i komunikaty w kodzie, instrukcje `if (locale === 'pl')`, tablice z tekstami w kodzie.
|
||||
- **WYMAGANE:** Każdy tekst pochodzi z pola `localized: true`, pobierany z panelu CMS.
|
||||
- **Częsty błąd (ukryty hardkod w fallbacku):** `siteName || 'Nazwa Klienta'` lub `catch { return { name: 'Firma...' } }` to **niedopuszczalny hardkod**! Gdy brak danych z panelu/env: **pomiń pole** (np. `...(val ? { name: val } : {})`), nie wstawiaj danych klienta w fallbacku `||` ani w bloku `catch`.
|
||||
|
||||
### B. Obrazy i multimedia:
|
||||
- **ZAKAZ:** `import logo from '@/assets/...'`, ścieżki `src="/images/..."`.
|
||||
- **WYMAGANE:** Pole `type: 'upload', relationTo: 'media'`, renderowane z `media.url`. Do kolekcji `Media` obowiązkowo wepnij `normalizeFilenameHook`.
|
||||
- **Preconnect:** Użyj `<MediaPreconnect />` z pluginu (czyta `R2_PUBLIC_URL` z env), nigdy sztywnego tagu `<link>` z domeną.
|
||||
- **Favicon:** Użyj `buildIconsMetadata(settings.favicon)` z panelu (format PNG, nie ręczny SVG).
|
||||
|
||||
### C. Linki i routing:
|
||||
- **ZAKAZ:** `href="/pl/kontakt"`, menu jako statyczna tablica w kodzie, oraz **sztywna mapa zlokalizowanych ścieżek** (`const localizedRoutes = {...}` — kardynalny antywzorzec).
|
||||
- **WYMAGANE:** `getLocalizedSlugs` / `switchLocalePath` z bazy danych, `getSystemPagePath`, relacje `relationship -> pages` w panelu CMS.
|
||||
|
||||
### D. Konfiguracja i dane firmy:
|
||||
- **ZAKAZ:** `locale as 'pl' | 'en'`, zaszyty slug kolekcji, dane firmy, NIP, adres, telefon w kodzie.
|
||||
- **WYMAGANE:** Jedno źródło prawdy `i18n.config.ts`, `locale as never`, dane firmy z globala (np. `siteSettings` / `CompanyInfo`), infrastruktura wyłącznie w `.env`.
|
||||
|
||||
### E. Renderer bloków, kolekcje, formularze (częste błędy):
|
||||
- **Renderer rich text:** ZAWSZE `RenderRichText` z pluginu (`@intecion/ipal-kit/rsc`, wrapper nad oficjalnym konwerterem Lexical). NIGDY własny parser Lexical (switch po node.type, flagi node.format, dangerouslySetInnerHTML, hardkod `.pl`). Styl przez `converters`. Patrz richtext.md.
|
||||
- **Renderer bloków:** ZAWSZE `RenderBlocks` z pluginu + mapa `registry`. NIGDY własny `switch (block.blockType)` — to gadatliwe, bez enhanceProps, rośnie liniowo. Mapa deklaratywna, silnik z pluginu.
|
||||
- **MINIMUM kolekcji, nie maksimum:** Domyślnie tylko rdzeń (pages, media, settings, navigation, footer + globale). Kolekcję treści (blog/produkty) TYLKO gdy klient JAWNIE wymaga. NIGDY nie twórz: `users` (WBUDOWANE w Payload — nie duplikuj!), `daneFirmy`/`settings` jako kolekcje (to GLOBALE), FAQ/hero/features jako kolekcje (to BLOKI). Test przed stworzeniem: lista rekordów + własny URL + jawna potrzeba + Payload nie ma wbudowanego. Patrz `kolekcje-katalog.md`.
|
||||
- **Formularze z buildera:** ZAWSZE pola/etykiety/komunikaty z buildera w panelu (kolekcja Forms) + `submitForm`. NIGDY nie hardkoduj pól ani tekstów w JSX. Turnstile: `TurnstileProvider` (siteKey raz w layoutcie) + `useTurnstile()`.
|
||||
- **Logika formularza z pluginu:** stan/walidacja/Turnstile/submit przez `useForm` (dowolne pola) lub `useContactForm` (preset) z `@intecion/ipal-kit/client` — hooki NIE renderują markupu, wygląd zostaje w projekcie. NIGDY nie kopiuj ręcznej hydrauliki (useState na pola, regex e-maila, obsługa tokenu, try/catch submitu) do projektu — to antywzorzec, który hook eliminuje. Walidacja przez `buildValidator` + reguły (`required`, `email`, `minLength`, `pattern`…). Patrz `forms.md`.
|
||||
- **Wartości lokalizowane:** ZAWSZE `resolveLocalized(value, locale)` z pluginu. NIGDY własny `getSafeString`/`(v as any)[locale]` kopiowany do JSON-LD, rich text czy topiców formularza.
|
||||
- **ZAKAZ:** `locale as 'pl' | 'en'`, zaszyty slug kolekcji, dane firmy, NIP, adres, telefon w kodzie.
|
||||
- **WYMAGANE:** Jedno źródło prawdy `i18n.config.ts`, `locale as never`, dane firmy z globala (np. `siteSettings` / `CompanyInfo`), infrastruktura wyłącznie w `.env`.
|
||||
|
||||
---
|
||||
|
||||
## 4. ARCHITEKTURA I STRUKTURA PROJEKTU
|
||||
|
||||
### A. Next 16 + Payload 3:
|
||||
- **NIGDY nie twórz `middleware.ts`.** W Next 16 stosuje się **WYŁĄCZNIE `proxy.ts`** (funkcja `proxy`). Jeśli plik `middleware.ts` istnieje — usuń go natychmiast.
|
||||
- **Struktura katalogów:**
|
||||
```
|
||||
src/
|
||||
app/
|
||||
(frontend)/
|
||||
styles.css # Tailwind + @source na plugin
|
||||
[locale]/
|
||||
layout.tsx # root layout bez sztywnego <head>
|
||||
not-found.tsx # 404 (treść z panelu)
|
||||
[[...slug]]/
|
||||
page.tsx # render stron z bloków (podwójne nawiasy!)
|
||||
(payload)/ # panel admina
|
||||
manifest.ts # PWA z panelu — WYMAGANE export const dynamic = 'force-dynamic'
|
||||
sitemap.ts # z lib/content + export const dynamic = 'force-dynamic'
|
||||
robots.ts # z lib/content
|
||||
instrumentation.ts # assertEnv(ipalEnvRules(...)) — walidacja ENV na starcie
|
||||
blocks/
|
||||
<NazwaBloku>/
|
||||
config.ts # schemat pól bloku
|
||||
Component.tsx # render komponentu
|
||||
registry.ts # mapa blockType -> komponent
|
||||
collections/
|
||||
Pages.ts # layout typu blocks
|
||||
Media.ts # upload + normalizeFilenameHook
|
||||
globals/ # siteSettings, siteIntegrations, navigation, footer
|
||||
lib/
|
||||
content.ts # createContentHelpers — JEDNO źródło
|
||||
payload.ts # helpery projektu (getSettings...)
|
||||
i18n.config.ts # locale — jedno źródło
|
||||
payload.config.ts
|
||||
proxy.ts # routing locale (NIE middleware.ts)
|
||||
```
|
||||
|
||||
### B. Przepływ danych i zależności:
|
||||
- **Brak cykli importów:** Warstwa niższa (bloki) **NIE** może importować warstwy wyższej (`lib/*`). Dane zewnętrzne (np. klucze Turnstile) przekazuj przez `enhanceProps` w `page.tsx`.
|
||||
- **Dostęp do Payloada:** Jedno źródło `getCachedPayload` w `lib/content.ts`.
|
||||
- **Server Components (RSC) domyślnie:** Pobieranie danych po stronie serwera; `'use client'` stosuj wyłącznie dla komponentów z lokalnym stanem/interakcją. Chroń wrażliwe moduły przez `import 'server-only'`.
|
||||
|
||||
### C. Kluczowe wymagania SEO i Renderingu:
|
||||
1. **Brak jawnego `<head>` w layoutcie:** Sztywny `<head>` wypycha metatagi Next.js do `<body>`. Pozwól Next.js zarządzać nagłówkiem. `<MediaPreconnect />` umieszczaj w `<body>` (React 19 automatycznie hoistuje tag link do head).
|
||||
2. **Wymagane ISR:** `export const revalidate = 3600` w `page.tsx` stron (zapobiega race condition streamingu metadanych i zapewnia TTFB ~20ms).
|
||||
3. **Wymagane `generateStaticParams`:** W `[[...slug]]/page.tsx` eksportuj `generateStaticParams` z `lib/content` (`export { generateStaticParams } from '@/lib/content'`). Gwarantuje synchroniczne generowanie metadanych w `<head>` dla robotów.
|
||||
4. **`htmlLimitedBots`:** Skonfiguruj w `next.config.ts` zgodnie z `seo.md`.
|
||||
5. **`export const dynamic = 'force-dynamic'` na route'ach odpytujących bazę:** `manifest.ts`, `llms.txt/route.ts`, `sitemap.xml/route.ts`. Bez tego Next próbuje prerenderować je podczas `docker build` (baza offline → crash). Handlery pluginu mają try/catch jako drugą warstwę, ale `dynamic` to eksport modułowy — MUSI być w pliku route'a, handler nie ustawi go za Ciebie.
|
||||
6. **Walidacja ENV na starcie:** `instrumentation.ts` z `assertEnv(ipalEnvRules({ ... }))` — fail fast przy brakującej konfiguracji, zamiast kryptograficznego crashu w buildzie. Patrz `env.md`.
|
||||
|
||||
---
|
||||
|
||||
## 5. STANDARDY KODU I TYPOWANIA (POZIOM SENIOR)
|
||||
|
||||
1. **Zero `any` i zero `@ts-ignore`:**
|
||||
- Zawsze typuj precyzyjnie. Jeśli kształt danych z zewnątrz jest nieznany, użyj `unknown` + zawężenie (type guard).
|
||||
- Wyjątek: wąskie rzutowanie `as unknown as Record<string, unknown>` przy udokumentowanych rozbieżnościach generatora Payload (np. pole zlokalizowane przy `locale: 'all'`).
|
||||
2. **Typy generowane:** Importuj typy z `@/payload-types` (`pnpm generate:types`), nie twórz ręcznych duplikatów interfejsów.
|
||||
3. **Generyki przy wywołaniu:** Stosuj np. `getSiteSettings<SiteSetting>(payload)`, a nie rzutowanie `as SiteSetting` na wyniku.
|
||||
4. **`satisfies` dla konfiguracji:** Używaj `as const satisfies I18nConfig`.
|
||||
5. **Obsługa błędów:** Nigdy nie połykaj błędów (`catch {}`). Loguj konkretny komunikat i zwracaj kontrolowany błąd. Stosuj guard clauses (płaski kod).
|
||||
6. **Transakcje i hooki:** W hookach Payload zawsze przekazuj `req` do kolejnych operacji bazodanowych. Chroń hooki przed nieskończonymi pętlami za pomocą flagi w `context` (np. `context.skip`). Przy `payload.find` pamiętaj o `overrideAccess: false`, jeśli operacja ma respektować uprawnienia usera.
|
||||
|
||||
---
|
||||
|
||||
## 6. NAZEWNICTWO I KONWENCJE
|
||||
|
||||
- **Foldery bloków i pliki kolekcji:** PascalCase (`blocks/HeroSection/`, `collections/Pages.ts`).
|
||||
- **Pliki bloku:** `config.ts` + `Component.tsx` w jednym folderze.
|
||||
- **Slugi kolekcji:** camelCase, liczba mnoga (`pages`, `blogPosts`, `products`).
|
||||
- **Slugi bloków:** camelCase (`hero`, `textSection`). Klucz w `registry.ts` musi być identyczny ze slugiem bloku.
|
||||
- **Wspólne nazwy pól (obowiązkowe w każdym projekcie):**
|
||||
- Nagłówek: `heading`
|
||||
- Podtytuł: `subheading`
|
||||
- Treść: `body` (textarea) lub `content` (richText)
|
||||
- Obraz: `image` (upload -> media)
|
||||
- Przycisk CTA: `ctaLabel` (text, localized)
|
||||
- Cel CTA: `ctaTarget` (relationship -> pages)
|
||||
- Link zewn.: `url` (text)
|
||||
- Zgoda prawna: `consent` (checkbox)
|
||||
|
||||
---
|
||||
|
||||
|
||||
**Globale Company/Header/Footer → PROJEKT, nie plugin.** Model danych firmy różni się per kraj (NIP/PL, ABN/AU, EIN/US) i branżę. NIE szukaj buildCompanyGlobal w pluginie — zdefiniuj własny src/globals/Company.ts. Schema.org: klocki pluginu (buildOrganizationJsonLd...) + JsonLdGraph, zmapuj SWOJE dane na @type (LegalService/PL, HVACBusiness/AU). Patrz seo.md.
|
||||
|
||||
## 6b. WYMAGANIA PRAWNE (COMPLIANCE)
|
||||
|
||||
Każda strona (PL/EU) MUSI mieć: polityka prywatności, polityka cookies, baner
|
||||
zgody cookies, zgoda RODO w formularzach. Plugin dostarcza MECHANIZM:
|
||||
- **Strony polityk** → System Pages (role: privacyPolicy, cookiePolicy, termsOfService), linkowane przez `getSystemPagePath`.
|
||||
- **Baner cookies** → CookieBanner + CookieButton + ConsentProvider (analytics/marketing gated — NIE ładują się przed zgodą).
|
||||
- **Zgoda RODO** → checkbox `consent` w formularzu (enforcement server-side w submitForm).
|
||||
- **Strony noindex** → polityki/regulamin zaznacz `noindex` w panelu SEO (kanibalizacja fraz).
|
||||
- **Ochrona:** hook `buildPreventDeleteSystemPage` blokuje usunięcie strony systemowej.
|
||||
|
||||
Granica: MY dostarczamy mechanizm, TREŚĆ prawną (tekst polityk) tworzy klient/prawnik.
|
||||
|
||||
**Widget dostępności (a11y)** — OPCJONALNY, NIE dodawaj domyślnie. Wymagany tylko
|
||||
dla podmiotów publicznych / części e-commerce (European Accessibility Act). Dla
|
||||
zwykłych stron komercyjnych to opcja — dodawaj GDY klient wymaga (AccessibilityProvider
|
||||
+ AccessibilityWidget + CSS projektu). Patrz `accessibility.md`.
|
||||
Patrz `wymagania-prawne.md`.
|
||||
|
||||
## 6c. HOOKI PLUGINU (automatyzacja)
|
||||
|
||||
Wpinaj w kolekcje gdzie dotyczy (patrz `hooks.md`):
|
||||
- **buildRevalidateHook** (afterChange/afterDelete) — ISR odświeżany po zapisie (redaktor od razu widzi zmianę). `revalidatePath` wstrzykiwany z projektu.
|
||||
- **trackSlugHistoryHook** (beforeChange) — zmiana slug → zapis starego slug. Odczyt robi **resolveRedirect** (patrz niżej) — NIE pisz własnego lookupu.
|
||||
- **resolveRedirect** (moduł content) — w catch-all, gdy `resolveRoute` nic nie znajdzie: czyta slugHistory i zwraca cel 301/308; projekt woła `permanentRedirect` (plugin nie importuje `next/navigation`). Domyka trackSlugHistoryHook.
|
||||
- **buildCrossLocaleFieldSync** (afterChange) — kopiuje pola wspólne dla języków (obrazki) wewnątrz lokalizowanego `blocks` między locale. Lista języków z `config` (NIGDY hardkod `['pl','en',…]`). Zastępuje ręczny hook z zahardkodowaną listą.
|
||||
- **buildNoindexField** (pole, nie hook) — sidebarowy checkbox `noindex` zgrany z `meta.noindex`, bez `any`. Zamiast ręcznego checkboxa + hooka glue.
|
||||
- **setPublishedAtHook** — auto-data publikacji (blog).
|
||||
- **normalizeFilenameHook** — czyste nazwy plików (Media, obowiązkowo).
|
||||
- **buildPreventDeleteSystemPage** / **buildValidateUniqueRole** — ochrona stron systemowych.
|
||||
|
||||
## 6d. BEZPIECZEŃSTWO (nagłówki)
|
||||
|
||||
- **buildSecurityHeaders** w next.config — HSTS, COOP, nosniff, Referrer-Policy (z automatu, uniwersalne).
|
||||
- **buildCsp** — generator CSP z twardymi regułami (base-uri, object-src, frame-ancestors). Flagi: turnstile, analytics, youtube, r2Url. Wdrażaj przez `report-only` → sprawdź konsolę → `enforce`.
|
||||
- **2FA WYMUSZONE** — `ipalKit({ twoFactor: { issuer: 'Nazwa Firmy' } })` + `pnpm add @clocklimited/payload-2fa@3.0.0-beta.7`. Wymuszone dla WSZYSTKICH użytkowników (forceSetup), bez opcji wyłączenia per user. NIE ustawiaj `twoFactor: false` (chyba że klient wprost odmawia). Bez zależności = błąd buildu. Patrz security.md.
|
||||
- **Ścieżka panelu** — `ipalKit({ adminRoute: '/its' })` ukrywa panel. WYMAGA przeniesienia folderu `app/(payload)/admin/` → `app/(payload)/its/`. To obscurity, nie security (2FA to prawdziwa ochrona).
|
||||
- CSP zostaje w projekcie (domeny), ale skeleton z pluginu. NIE Trusted Types (psuje Turnstile/GA).
|
||||
|
||||
## 7. PODZIAŁ PRACY I RÓL
|
||||
|
||||
- **Antigravity (Agent):** Buduje architekturę, logikę, kolekcje, bloki, routing, edytowalność przez panel, integracje oraz dba o brak hardkodów.
|
||||
- **Impeccable (osobne narzędzie):** Dopracowuje wygląd, system wizualny na bazie `PRODUCT.md` i `DESIGN.md`. Antigravity nie „dopieszcza" styli ad-hoc kosztem logiki i edytowalności.
|
||||
- **Klient / Redaktor:** Samodzielnie zarządza każdą treścią z poziomu panelu CMS.
|
||||
|
||||
---
|
||||
|
||||
## 8. PROCEDURA RAPORTOWANIA DO PLUGINU
|
||||
|
||||
Jeśli w trakcie pracy:
|
||||
1. Funkcja okaże się brakująca w `@intecion/ipal-kit`,
|
||||
2. Wystąpi błąd wewnętrzny w bibliotece pluginu,
|
||||
3. Pojawi się powtarzalna potrzeba biznesowa przydatna w wielu projektach,
|
||||
|
||||
**Należy natychmiast przygotować raport proponowanej zmiany/rozbudowy pluginu:**
|
||||
- Dokładny opis problemu / brakującej funkcjonalności,
|
||||
- Proponowany interfejs API / sygnatura funkcji lub konfiguracji,
|
||||
- Uzasadnienie uniwersalności dla innych projektów.
|
||||
**Nie wolno tworzyć cichej łaty w kodzie projektu.**
|
||||
|
||||
---
|
||||
|
||||
## 9. MAPA DOKUMENTACJI — gdzie szukać szczegółów
|
||||
|
||||
Ten plik to skondensowane reguły. Szczegóły w `node_modules/@intecion/ipal-kit/docs/`:
|
||||
|
||||
| Chcę... | Plik |
|
||||
|---|---|
|
||||
| Zbudować projekt od zera | `getting-started.md` |
|
||||
| Strukturę, nazewnictwo, konwencje | `fundamenty-projektu.md` |
|
||||
| Jakie kolekcje budować (minimum!) | `kolekcje-katalog.md` |
|
||||
| SEO, metadane, sitemap, favicon, structured data, llms.txt | `seo.md` |
|
||||
| Hooki (revalidate, slug history, cross-locale sync, ochrona) | `hooks.md` |
|
||||
| Redirecty 301/308 (resolveRedirect) | `content.md` |
|
||||
| Walidacja ENV na starcie (assertEnv) | `env.md` |
|
||||
| Czytelność dla AI: Markdown per strona, llms-full, boty AI w robots | `content.md`, `seo.md` |
|
||||
| Serwer MCP strony (Claude podłącza się do treści) | `mcp.md` |
|
||||
| GTM + Meta Pixel — konfiguracja krok po kroku | `gtm-meta-pixel.md` |
|
||||
| White-label panelu admina (logo/nazwa z SiteSettings) | `white-label.md` |
|
||||
| Bezpieczeństwo, CSP, COOP | `security.md` |
|
||||
| Formularze, Turnstile, submitForm, useForm/useContactForm | `forms.md`, `turnstile.md` |
|
||||
| i18n, strona jednojęzyczna, ścieżki | `i18n.md` |
|
||||
| Strony systemowe, routing | `pages.md` |
|
||||
| Bloki, RenderBlocks | `blocks.md` |
|
||||
| Media, R2, MediaPreconnect | `storage.md` |
|
||||
| Email (SMTP/Graph) | `email.md` |
|
||||
| Consent, cookies | `consent.md` |
|
||||
| Deployment, ISR/SSG, Coolify | `deployment.md` |
|
||||
| Wymagania prawne, compliance | `wymagania-prawne.md` |
|
||||
| Filozofia CMS, edytowalność, Impeccable | `architektura-tresci.md` |
|
||||
| Standardy kodu, antywzorce | `standardy-kodu.md` |
|
||||
|
||||
---
|
||||
|
||||
## 10. ZAPISZ REGUŁY PROJEKTU
|
||||
|
||||
Kluczowe ustalenia projektu (stack, decyzje, tryby stron) zapisz we własnym pliku
|
||||
kontekstu (`agents.md` / `.agents/context/`), żeby nie gubić ich między sesjami.
|
||||
Nie polegaj tylko na pamięci sesji.
|
||||
Executable
+61
@@ -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
+4
-2
@@ -1,8 +1,10 @@
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/admin
|
||||
*
|
||||
* Admin-panel UI components (white-label branding). Separate export so Payload's
|
||||
* 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';
|
||||
export { AdminLogo, AdminIcon, IntecionCredit } from '../modules/branding/index.js';
|
||||
export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
|
||||
export { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js';
|
||||
|
||||
Vendored
+4
-2
@@ -1,9 +1,11 @@
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/admin
|
||||
*
|
||||
* Admin-panel UI components (white-label branding). Separate export so Payload's
|
||||
* 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';
|
||||
*/ export { AdminLogo, AdminIcon, IntecionCredit } from '../modules/branding/index.js';
|
||||
export { RowLabel } from '../modules/admin-ui/RowLabelComponent.js';
|
||||
export { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js';
|
||||
|
||||
//# sourceMappingURL=admin.js.map
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/admin.ts"],"sourcesContent":["/**\n * Entry point: @intecion/ipal-kit/admin\n *\n * Admin-panel UI components (white-label branding). 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":["AdminIcon","AdminLogo","IntecionCredit"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ,+BAA8B"}
|
||||
{"version":3,"sources":["../../src/exports/admin.ts"],"sourcesContent":["/**\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 { AdminLogo, AdminIcon, IntecionCredit } from '../modules/branding/index.js'\nexport { RowLabel } from '../modules/admin-ui/RowLabelComponent.js'\nexport { IntegrationAlerts } from '../modules/integrations/IntegrationAlerts.js'\n"],"names":["AdminLogo","AdminIcon","IntecionCredit","RowLabel","IntegrationAlerts"],"mappings":"AAAA;;;;;;CAMC,GACD,SAASA,SAAS,EAAEC,SAAS,EAAEC,cAAc,QAAQ,+BAA8B;AACnF,SAASC,QAAQ,QAAQ,2CAA0C;AACnE,SAASC,iBAAiB,QAAQ,+CAA8C"}
|
||||
Vendored
+24
-20
@@ -1,9 +1,3 @@
|
||||
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 { pushDataLayer } from '../modules/analytics/client.js';
|
||||
/**
|
||||
* Entry point: ipal-kit/client
|
||||
*
|
||||
@@ -11,21 +5,31 @@ export { pushDataLayer } from '../modules/analytics/client.js';
|
||||
* components. Kept separate from the main entry so server bundles don't pull in
|
||||
* client-only code.
|
||||
*/
|
||||
export { ConsentProvider, ConsentScript, CookieBanner, CookieButton, useConsent, useConsentContext, } from '../modules/consent/client.js';
|
||||
export { useConsent, ConsentProvider, useConsentContext, CookieBanner, CookieButton, ConsentScript, } 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 { Turnstile } from '../modules/turnstile/client.js';
|
||||
export { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js';
|
||||
export { AccessibilityProvider, useAccessibility, AccessibilityWidget } from '../modules/accessibility/client.js';
|
||||
export type { A11yState, A11yTexts, A11yClassNames } from '../modules/accessibility/client.js';
|
||||
export { switchLocalePath, buildLocalizedPath, getLocalizedSlugs, getLocaleCodes, } from '../modules/i18n/index.js';
|
||||
export type { LocalizedSlugs, I18nConfig } from '../modules/i18n/index.js';
|
||||
export type { TurnstileProps } from '../modules/turnstile/client.js';
|
||||
export { LocaleView } from '../modules/pages/LocaleView.js';
|
||||
export { Analytics } from '../modules/analytics/client.js';
|
||||
export type { AnalyticsProps } from '../modules/analytics/client.js';
|
||||
export { pushDataLayer } from '../modules/analytics/client.js';
|
||||
export { loadMetaPixel, loadClarity, loadLinkedIn, loadTikTok } from '../modules/analytics/client.js';
|
||||
export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
|
||||
export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js';
|
||||
export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
|
||||
export { AlternateLinksProvider, useAlternateLinks, useSetAlternateLinks, AlternateLinksUpdater, LanguageSwitcher, } from '../modules/i18n/index.js';
|
||||
export type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js';
|
||||
export { useForm } from '../modules/forms/useForm.js';
|
||||
export type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js';
|
||||
export { useContactForm } from '../modules/forms/useContactForm.js';
|
||||
export type { ContactFormValues, ContactFormErrors, SubmitAction } from '../modules/forms/useContactForm.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 { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js';
|
||||
export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js';
|
||||
export type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js';
|
||||
|
||||
Vendored
+18
-15
@@ -1,26 +1,29 @@
|
||||
'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';
|
||||
/**
|
||||
* 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, 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 { useConsent, ConsentProvider, useConsentContext, CookieBanner, CookieButton, ConsentScript } from '../modules/consent/client.js';
|
||||
export { Turnstile } from '../modules/turnstile/client.js';
|
||||
export { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js';
|
||||
export { AccessibilityProvider, useAccessibility, AccessibilityWidget } from '../modules/accessibility/client.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 { switchLocalePath, buildLocalizedPath, getLocalizedSlugs, getLocaleCodes } from '../modules/i18n/index.js';
|
||||
export { LocaleView } from '../modules/pages/LocaleView.js';
|
||||
export { Analytics } from '../modules/analytics/client.js';
|
||||
export { pushDataLayer } from '../modules/analytics/client.js';
|
||||
export { loadMetaPixel, loadClarity, loadLinkedIn, loadTikTok } from '../modules/analytics/client.js';
|
||||
export { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js';
|
||||
export { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js';
|
||||
export { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js';
|
||||
export { AlternateLinksProvider, useAlternateLinks, useSetAlternateLinks, AlternateLinksUpdater, LanguageSwitcher } from '../modules/i18n/index.js';
|
||||
export { useForm } from '../modules/forms/useForm.js';
|
||||
export { useContactForm } from '../modules/forms/useContactForm.js';
|
||||
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';
|
||||
export { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.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 {\n AccessibilityProvider,\n AccessibilityWidget,\n useAccessibility,\n} from '../modules/accessibility/client.js'\nexport type { A11yClassNames, A11yState, A11yTexts } from '../modules/accessibility/client.js'\nexport { Analytics } from '../modules/analytics/client.js'\nexport { pushDataLayer } from '../modules/analytics/client.js'\n\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 {\n ContactFormErrors,\n ContactFormValues,\n SubmitAction,\n} 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 { 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","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","Turnstile","TurnstileProvider","useTurnstile"],"mappings":"AAAA;AACA,SAASA,WAAW,QAAQ,wDAAuD;AACnF,SAASC,eAAe,QAAQ,4DAA2D;AAC3F,SACEC,qBAAqB,EACrBC,mBAAmB,EACnBC,gBAAgB,QACX,qCAAoC;AAE3C,SAASC,SAAS,QAAQ,iCAAgC;AAC1D,SAASC,aAAa,QAAQ,iCAAgC;AAE9D;;;;;;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;AAMnE,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,SAAS,QAAQ,iCAAgC;AAC1D,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,iCAAgC"}
|
||||
{"version":3,"sources":["../../src/exports/client.ts"],"sourcesContent":["'use client'\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 useConsent,\n ConsentProvider,\n useConsentContext,\n CookieBanner,\n CookieButton,\n ConsentScript,\n} from '../modules/consent/client.js'\nexport type { CookieBannerClassNames } from '../modules/consent/client.js'\nexport { Turnstile } from '../modules/turnstile/client.js'\nexport { TurnstileProvider, useTurnstile } from '../modules/turnstile/client.js'\nexport { AccessibilityProvider, useAccessibility, AccessibilityWidget } from '../modules/accessibility/client.js'\nexport type { A11yState, A11yTexts, A11yClassNames } from '../modules/accessibility/client.js'\n\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 switchLocalePath,\n buildLocalizedPath,\n getLocalizedSlugs,\n getLocaleCodes,\n} from '../modules/i18n/index.js'\nexport type { LocalizedSlugs, I18nConfig } from '../modules/i18n/index.js'\nexport type { TurnstileProps } from '../modules/turnstile/client.js'\nexport { LocaleView } from '../modules/pages/LocaleView.js'\nexport { Analytics } from '../modules/analytics/client.js'\nexport type { AnalyticsProps } from '../modules/analytics/client.js'\nexport { pushDataLayer } from '../modules/analytics/client.js'\nexport { loadMetaPixel, loadClarity, loadLinkedIn, loadTikTok } from '../modules/analytics/client.js'\nexport { MaskedField } from '../globals/SiteIntegrations/components/MaskedField.js'\nexport { IntegrationStatusBanner } from '../modules/integrations/IntegrationStatusBanner.js'\nexport { TestEmailButton } from '../globals/SiteIntegrations/components/TestEmailButton.js'\nexport {\n AlternateLinksProvider,\n useAlternateLinks,\n useSetAlternateLinks,\n AlternateLinksUpdater,\n LanguageSwitcher,\n} from '../modules/i18n/index.js'\nexport type { AlternateLinks, LanguageSwitcherClassNames } from '../modules/i18n/index.js'\nexport { useForm } from '../modules/forms/useForm.js'\nexport type { FormErrors, FormSubmitAction, Validator } from '../modules/forms/useForm.js'\nexport { useContactForm } from '../modules/forms/useContactForm.js'\nexport type { ContactFormValues, ContactFormErrors, SubmitAction } from '../modules/forms/useContactForm.js'\nexport {\n buildValidator,\n isEmail,\n required,\n email,\n minLength,\n maxLength,\n checked,\n pattern,\n custom,\n} from '../modules/forms/validators.js'\nexport type { Rule } from '../modules/forms/validators.js'\nexport { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from '../modules/forms/honeypot.js'\nexport { formAnalyticsOnSuccess } from '../modules/forms/formAnalytics.js'\nexport type { FormAnalyticsConfig } from '../modules/forms/formAnalytics.js'\n"],"names":["useConsent","ConsentProvider","useConsentContext","CookieBanner","CookieButton","ConsentScript","Turnstile","TurnstileProvider","useTurnstile","AccessibilityProvider","useAccessibility","AccessibilityWidget","switchLocalePath","buildLocalizedPath","getLocalizedSlugs","getLocaleCodes","LocaleView","Analytics","pushDataLayer","loadMetaPixel","loadClarity","loadLinkedIn","loadTikTok","MaskedField","IntegrationStatusBanner","TestEmailButton","AlternateLinksProvider","useAlternateLinks","useSetAlternateLinks","AlternateLinksUpdater","LanguageSwitcher","useForm","useContactForm","buildValidator","isEmail","required","email","minLength","maxLength","checked","pattern","custom","HONEYPOT_FIELD","honeypotInputProps","isHoneypotTripped","formAnalyticsOnSuccess"],"mappings":"AAAA;AACA;;;;;;CAMC,GACD,SACEA,UAAU,EACVC,eAAe,EACfC,iBAAiB,EACjBC,YAAY,EACZC,YAAY,EACZC,aAAa,QACR,+BAA8B;AAErC,SAASC,SAAS,QAAQ,iCAAgC;AAC1D,SAASC,iBAAiB,EAAEC,YAAY,QAAQ,iCAAgC;AAChF,SAASC,qBAAqB,EAAEC,gBAAgB,EAAEC,mBAAmB,QAAQ,qCAAoC;AAGjH,wEAAwE;AACxE,gFAAgF;AAChF,SACEC,gBAAgB,EAChBC,kBAAkB,EAClBC,iBAAiB,EACjBC,cAAc,QACT,2BAA0B;AAGjC,SAASC,UAAU,QAAQ,iCAAgC;AAC3D,SAASC,SAAS,QAAQ,iCAAgC;AAE1D,SAASC,aAAa,QAAQ,iCAAgC;AAC9D,SAASC,aAAa,EAAEC,WAAW,EAAEC,YAAY,EAAEC,UAAU,QAAQ,iCAAgC;AACrG,SAASC,WAAW,QAAQ,wDAAuD;AACnF,SAASC,uBAAuB,QAAQ,qDAAoD;AAC5F,SAASC,eAAe,QAAQ,4DAA2D;AAC3F,SACEC,sBAAsB,EACtBC,iBAAiB,EACjBC,oBAAoB,EACpBC,qBAAqB,EACrBC,gBAAgB,QACX,2BAA0B;AAEjC,SAASC,OAAO,QAAQ,8BAA6B;AAErD,SAASC,cAAc,QAAQ,qCAAoC;AAEnE,SACEC,cAAc,EACdC,OAAO,EACPC,QAAQ,EACRC,KAAK,EACLC,SAAS,EACTC,SAAS,EACTC,OAAO,EACPC,OAAO,EACPC,MAAM,QACD,iCAAgC;AAEvC,SAASC,cAAc,EAAEC,kBAAkB,EAAEC,iBAAiB,QAAQ,+BAA8B;AACpG,SAASC,sBAAsB,QAAQ,oCAAmC"}
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/env
|
||||
*
|
||||
* Environment validation ONLY — zero imports beyond this module, no Payload,
|
||||
* no Node built-ins, no React. Safe for Next's instrumentation.ts, which Next
|
||||
* also compiles for the Edge runtime: importing the package root there drags in
|
||||
* Payload / file-type / fs and crashes Turbopack ("Export fileTypeFromFile
|
||||
* doesn't exist in target module").
|
||||
*
|
||||
* // src/instrumentation.ts
|
||||
* import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
|
||||
* export function register() {
|
||||
* if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true }))
|
||||
* }
|
||||
*/
|
||||
export { assertEnv, ipalEnvRules } from '../modules/env/index.js';
|
||||
export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from '../modules/env/index.js';
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
/**
|
||||
* Entry point: @intecion/ipal-kit/env
|
||||
*
|
||||
* Environment validation ONLY — zero imports beyond this module, no Payload,
|
||||
* no Node built-ins, no React. Safe for Next's instrumentation.ts, which Next
|
||||
* also compiles for the Edge runtime: importing the package root there drags in
|
||||
* Payload / file-type / fs and crashes Turbopack ("Export fileTypeFromFile
|
||||
* doesn't exist in target module").
|
||||
*
|
||||
* // src/instrumentation.ts
|
||||
* import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'
|
||||
* export function register() {
|
||||
* if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true }))
|
||||
* }
|
||||
*/ export { assertEnv, ipalEnvRules } from '../modules/env/index.js';
|
||||
|
||||
//# sourceMappingURL=env.js.map
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/env.ts"],"sourcesContent":["/**\n * Entry point: @intecion/ipal-kit/env\n *\n * Environment validation ONLY — zero imports beyond this module, no Payload,\n * no Node built-ins, no React. Safe for Next's instrumentation.ts, which Next\n * also compiles for the Edge runtime: importing the package root there drags in\n * Payload / file-type / fs and crashes Turbopack (\"Export fileTypeFromFile\n * doesn't exist in target module\").\n *\n * // src/instrumentation.ts\n * import { assertEnv, ipalEnvRules } from '@intecion/ipal-kit/env'\n * export function register() {\n * if (process.env.NEXT_RUNTIME === 'nodejs') assertEnv(ipalEnvRules({ storage: true }))\n * }\n */\nexport { assertEnv, ipalEnvRules } from '../modules/env/index.js'\nexport type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from '../modules/env/index.js'\n"],"names":["assertEnv","ipalEnvRules"],"mappings":"AAAA;;;;;;;;;;;;;;CAcC,GACD,SAASA,SAAS,EAAEC,YAAY,QAAQ,0BAAyB"}
|
||||
Vendored
+2
-1
@@ -10,7 +10,8 @@
|
||||
* Import these only from Server Actions, route handlers, or server components —
|
||||
* never from the Payload config or client code.
|
||||
*/
|
||||
export { verifyTurnstile } from '../modules/turnstile/index.js';
|
||||
export { verifyTurnstile, checkTurnstile } from '../modules/turnstile/index.js';
|
||||
export type { TurnstileCheck, TurnstileOutcome } from '../modules/turnstile/index.js';
|
||||
export { sendEmail } from '../modules/email/index.js';
|
||||
export type { SendEmailArgs, SendEmailResult } from '../modules/email/index.js';
|
||||
export { submitForm } from '../modules/forms/index.js';
|
||||
|
||||
Vendored
+1
-1
@@ -9,7 +9,7 @@
|
||||
*
|
||||
* Import these only from Server Actions, route handlers, or server components —
|
||||
* never from the Payload config or client code.
|
||||
*/ export { verifyTurnstile } from '../modules/turnstile/index.js';
|
||||
*/ export { verifyTurnstile, checkTurnstile } from '../modules/turnstile/index.js';
|
||||
export { sendEmail } from '../modules/email/index.js';
|
||||
export { submitForm } from '../modules/forms/index.js';
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../src/exports/server.ts"],"sourcesContent":["/**\n * Entry point: ipal-kit/server\n *\n * Server-only runtime functions — these import 'server-only' (Turnstile secret,\n * SMTP password, nodemailer). Kept OUT of the main entry so that loading the\n * Payload config or running `payload generate:importmap` (both Node scripts,\n * no bundler) never pulls in 'server-only', which throws outside a bundled\n * server context.\n *\n * Import these only from Server Actions, route handlers, or server components —\n * never from the Payload config or client code.\n */\nexport { verifyTurnstile } from '../modules/turnstile/index.js'\nexport { sendEmail } from '../modules/email/index.js'\nexport type { SendEmailArgs, SendEmailResult } from '../modules/email/index.js'\nexport { submitForm } from '../modules/forms/index.js'\nexport type { SubmitFormArgs, SubmitFormResult } from '../modules/forms/index.js'\n"],"names":["verifyTurnstile","sendEmail","submitForm"],"mappings":"AAAA;;;;;;;;;;;CAWC,GACD,SAASA,eAAe,QAAQ,gCAA+B;AAC/D,SAASC,SAAS,QAAQ,4BAA2B;AAErD,SAASC,UAAU,QAAQ,4BAA2B"}
|
||||
{"version":3,"sources":["../../src/exports/server.ts"],"sourcesContent":["/**\n * Entry point: ipal-kit/server\n *\n * Server-only runtime functions — these import 'server-only' (Turnstile secret,\n * SMTP password, nodemailer). Kept OUT of the main entry so that loading the\n * Payload config or running `payload generate:importmap` (both Node scripts,\n * no bundler) never pulls in 'server-only', which throws outside a bundled\n * server context.\n *\n * Import these only from Server Actions, route handlers, or server components —\n * never from the Payload config or client code.\n */\nexport { verifyTurnstile, checkTurnstile } from '../modules/turnstile/index.js'\nexport type { TurnstileCheck, TurnstileOutcome } from '../modules/turnstile/index.js'\nexport { sendEmail } from '../modules/email/index.js'\nexport type { SendEmailArgs, SendEmailResult } from '../modules/email/index.js'\nexport { submitForm } from '../modules/forms/index.js'\nexport type { SubmitFormArgs, SubmitFormResult } from '../modules/forms/index.js'\n"],"names":["verifyTurnstile","checkTurnstile","sendEmail","submitForm"],"mappings":"AAAA;;;;;;;;;;;CAWC,GACD,SAASA,eAAe,EAAEC,cAAc,QAAQ,gCAA+B;AAE/E,SAASC,SAAS,QAAQ,4BAA2B;AAErD,SAASC,UAAU,QAAQ,4BAA2B"}
|
||||
+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
+5
-2
@@ -6,11 +6,14 @@ import { notificationsFields } from './fields.js';
|
||||
*/ export function buildNotifications() {
|
||||
return {
|
||||
slug: 'notifications',
|
||||
label: 'Notifications',
|
||||
admin: {
|
||||
group: 'Settings'
|
||||
},
|
||||
access: {
|
||||
read: ()=>true
|
||||
},
|
||||
fields: notificationsFields,
|
||||
label: 'Notifications'
|
||||
fields: notificationsFields
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"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"}
|
||||
{"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 admin: { group: 'Settings' },\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","admin","group","access","read","fields"],"mappings":"AACA,SAASA,mBAAmB,QAAQ,cAAa;AAEjD;;;;CAIC,GACD,OAAO,SAASC;IACd,OAAO;QACLC,MAAM;QACNC,OAAO;QACPC,OAAO;YAAEC,OAAO;QAAW;QAC3BC,QAAQ;YACNC,MAAM,IAAM;QACd;QACAC,QAAQR;IACV;AACF"}
|
||||
@@ -1,3 +1,20 @@
|
||||
import type { TextFieldClientComponent } from 'payload';
|
||||
/**
|
||||
* Masked text input for sensitive values (SMTP password, R2 secret key,
|
||||
* Turnstile secret key, etc.).
|
||||
*
|
||||
* Renders the value as a password field (••••) so secrets aren't shown in
|
||||
* plaintext on screen — protecting against shoulder-surfing and accidental
|
||||
* exposure when the panel is open. The value is still stored and returned
|
||||
* normally (UI masking, NOT hashing or encryption), because the plugin must
|
||||
* read it back to authenticate with SMTP/R2/Turnstile. A toggle reveals the
|
||||
* value when an authorised editor genuinely needs to check it.
|
||||
*
|
||||
* Uses a raw <input> driven by useField rather than @payloadcms/ui's TextInput,
|
||||
* because TextInput doesn't expose inputProps, so there's no way to switch its
|
||||
* inner input to type="password".
|
||||
*
|
||||
* Assigned via a field's admin.components.Field. Works on any `text` field.
|
||||
*/
|
||||
export declare const MaskedField: TextFieldClientComponent;
|
||||
export default MaskedField;
|
||||
|
||||
+51
-25
@@ -1,51 +1,77 @@
|
||||
'use client';
|
||||
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
||||
import { useField, FieldLabel, FieldDescription } from '@payloadcms/ui';
|
||||
import { useState } from 'react';
|
||||
export const MaskedField = (props)=>{
|
||||
const { field, path, value: propValue, setValue: propSetValue, onChange: propOnChange } = props || {};
|
||||
const [internalValue, setInternalValue] = useState(propValue ?? '');
|
||||
/**
|
||||
* Masked text input for sensitive values (SMTP password, R2 secret key,
|
||||
* Turnstile secret key, etc.).
|
||||
*
|
||||
* Renders the value as a password field (••••) so secrets aren't shown in
|
||||
* plaintext on screen — protecting against shoulder-surfing and accidental
|
||||
* exposure when the panel is open. The value is still stored and returned
|
||||
* normally (UI masking, NOT hashing or encryption), because the plugin must
|
||||
* read it back to authenticate with SMTP/R2/Turnstile. A toggle reveals the
|
||||
* value when an authorised editor genuinely needs to check it.
|
||||
*
|
||||
* Uses a raw <input> driven by useField rather than @payloadcms/ui's TextInput,
|
||||
* because TextInput doesn't expose inputProps, so there's no way to switch its
|
||||
* inner input to type="password".
|
||||
*
|
||||
* Assigned via a field's admin.components.Field. Works on any `text` field.
|
||||
*/ export const MaskedField = ({ field, path })=>{
|
||||
const { value, setValue } = useField({
|
||||
path
|
||||
});
|
||||
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;
|
||||
const description = field?.admin?.description;
|
||||
return /*#__PURE__*/ _jsxs("div", {
|
||||
className: "field-type text",
|
||||
className: "field-type text masked-field",
|
||||
children: [
|
||||
label && /*#__PURE__*/ _jsx("label", {
|
||||
className: "field-label",
|
||||
children: label
|
||||
/*#__PURE__*/ _jsx(FieldLabel, {
|
||||
label: label,
|
||||
htmlFor: `field-${path}`
|
||||
}),
|
||||
/*#__PURE__*/ _jsxs("div", {
|
||||
className: "field-type__wrap",
|
||||
style: {
|
||||
display: 'flex',
|
||||
gap: '.5rem'
|
||||
gap: '.5rem',
|
||||
alignItems: 'center'
|
||||
},
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("input", {
|
||||
id: `field-${path}`,
|
||||
type: revealed ? 'text' : 'password',
|
||||
autoComplete: "off",
|
||||
onChange: handleChange,
|
||||
className: "field-type__input",
|
||||
value: value ?? '',
|
||||
onChange: (e)=>setValue(e.target.value),
|
||||
style: {
|
||||
flex: 1
|
||||
},
|
||||
type: revealed ? 'text' : 'password',
|
||||
value: currentValue ?? ''
|
||||
}
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
onClick: ()=>setRevealed((r)=>!r),
|
||||
type: "button",
|
||||
onClick: ()=>setRevealed((r)=>!r),
|
||||
style: {
|
||||
background: 'none',
|
||||
border: 'none',
|
||||
padding: '.25rem .5rem',
|
||||
cursor: 'pointer',
|
||||
font: 'inherit',
|
||||
textDecoration: 'underline',
|
||||
opacity: 0.75,
|
||||
whiteSpace: 'nowrap'
|
||||
},
|
||||
children: revealed ? 'Hide' : 'Reveal'
|
||||
})
|
||||
]
|
||||
})
|
||||
}),
|
||||
description && typeof description === 'string' ? /*#__PURE__*/ _jsx(FieldDescription, {
|
||||
path: path,
|
||||
description: description
|
||||
}) : null
|
||||
]
|
||||
});
|
||||
};
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"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"}
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/components/MaskedField.tsx"],"sourcesContent":["'use client'\n\nimport { useField, FieldLabel, FieldDescription } from '@payloadcms/ui'\nimport { useState } from 'react'\nimport type { TextFieldClientComponent } from 'payload'\n\n/**\n * Masked text input for sensitive values (SMTP password, R2 secret key,\n * Turnstile secret key, etc.).\n *\n * Renders the value as a password field (••••) so secrets aren't shown in\n * plaintext on screen — protecting against shoulder-surfing and accidental\n * exposure when the panel is open. The value is still stored and returned\n * normally (UI masking, NOT hashing or encryption), because the plugin must\n * read it back to authenticate with SMTP/R2/Turnstile. A toggle reveals the\n * value when an authorised editor genuinely needs to check it.\n *\n * Uses a raw <input> driven by useField rather than @payloadcms/ui's TextInput,\n * because TextInput doesn't expose inputProps, so there's no way to switch its\n * inner input to type=\"password\".\n *\n * Assigned via a field's admin.components.Field. Works on any `text` field.\n */\nexport const MaskedField: TextFieldClientComponent = ({ field, path }) => {\n const { value, setValue } = useField<string>({ path })\n const [revealed, setRevealed] = useState(false)\n\n const label =\n typeof field?.label === 'string' ? field.label : (field?.name ?? path)\n const description = field?.admin?.description\n\n return (\n <div className=\"field-type text masked-field\">\n <FieldLabel label={label} htmlFor={`field-${path}`} />\n\n <div className=\"field-type__wrap\" style={{ display: 'flex', gap: '.5rem', alignItems: 'center' }}>\n <input\n id={`field-${path}`}\n type={revealed ? 'text' : 'password'}\n autoComplete=\"off\"\n className=\"field-type__input\"\n value={value ?? ''}\n onChange={(e) => setValue(e.target.value)}\n style={{ flex: 1 }}\n />\n <button\n type=\"button\"\n onClick={() => setRevealed((r) => !r)}\n style={{\n background: 'none',\n border: 'none',\n padding: '.25rem .5rem',\n cursor: 'pointer',\n font: 'inherit',\n textDecoration: 'underline',\n opacity: 0.75,\n whiteSpace: 'nowrap',\n }}\n >\n {revealed ? 'Hide' : 'Reveal'}\n </button>\n </div>\n\n {description && typeof description === 'string' ? (\n <FieldDescription path={path} description={description} />\n ) : null}\n </div>\n )\n}\n\nexport default MaskedField\n"],"names":["useField","FieldLabel","FieldDescription","useState","MaskedField","field","path","value","setValue","revealed","setRevealed","label","name","description","admin","div","className","htmlFor","style","display","gap","alignItems","input","id","type","autoComplete","onChange","e","target","flex","button","onClick","r","background","border","padding","cursor","font","textDecoration","opacity","whiteSpace"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,EAAEC,UAAU,EAAEC,gBAAgB,QAAQ,iBAAgB;AACvE,SAASC,QAAQ,QAAQ,QAAO;AAGhC;;;;;;;;;;;;;;;;CAgBC,GACD,OAAO,MAAMC,cAAwC,CAAC,EAAEC,KAAK,EAAEC,IAAI,EAAE;IACnE,MAAM,EAAEC,KAAK,EAAEC,QAAQ,EAAE,GAAGR,SAAiB;QAAEM;IAAK;IACpD,MAAM,CAACG,UAAUC,YAAY,GAAGP,SAAS;IAEzC,MAAMQ,QACJ,OAAON,OAAOM,UAAU,WAAWN,MAAMM,KAAK,GAAIN,OAAOO,QAAQN;IACnE,MAAMO,cAAcR,OAAOS,OAAOD;IAElC,qBACE,MAACE;QAAIC,WAAU;;0BACb,KAACf;gBAAWU,OAAOA;gBAAOM,SAAS,CAAC,MAAM,EAAEX,MAAM;;0BAElD,MAACS;gBAAIC,WAAU;gBAAmBE,OAAO;oBAAEC,SAAS;oBAAQC,KAAK;oBAASC,YAAY;gBAAS;;kCAC7F,KAACC;wBACCC,IAAI,CAAC,MAAM,EAAEjB,MAAM;wBACnBkB,MAAMf,WAAW,SAAS;wBAC1BgB,cAAa;wBACbT,WAAU;wBACVT,OAAOA,SAAS;wBAChBmB,UAAU,CAACC,IAAMnB,SAASmB,EAAEC,MAAM,CAACrB,KAAK;wBACxCW,OAAO;4BAAEW,MAAM;wBAAE;;kCAEnB,KAACC;wBACCN,MAAK;wBACLO,SAAS,IAAMrB,YAAY,CAACsB,IAAM,CAACA;wBACnCd,OAAO;4BACLe,YAAY;4BACZC,QAAQ;4BACRC,SAAS;4BACTC,QAAQ;4BACRC,MAAM;4BACNC,gBAAgB;4BAChBC,SAAS;4BACTC,YAAY;wBACd;kCAEC/B,WAAW,SAAS;;;;YAIxBI,eAAe,OAAOA,gBAAgB,yBACrC,KAACX;gBAAiBI,MAAMA;gBAAMO,aAAaA;iBACzC;;;AAGV,EAAC;AAED,eAAeT,YAAW"}
|
||||
+17
-17
@@ -27,14 +27,14 @@ import { useState } from 'react';
|
||||
});
|
||||
try {
|
||||
const res = await fetch('/api/ipal/test-email', {
|
||||
body: JSON.stringify({
|
||||
to: to.trim()
|
||||
}),
|
||||
credentials: 'include',
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json'
|
||||
},
|
||||
method: 'POST'
|
||||
credentials: 'include',
|
||||
body: JSON.stringify({
|
||||
to: to.trim()
|
||||
})
|
||||
});
|
||||
const data = await res.json();
|
||||
if (data.ok) {
|
||||
@@ -67,38 +67,38 @@ import { useState } from 'react';
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("p", {
|
||||
style: {
|
||||
opacity: 0.7,
|
||||
fontSize: '.85rem',
|
||||
marginTop: 0,
|
||||
opacity: 0.7
|
||||
marginTop: 0
|
||||
},
|
||||
children: "Sends through the transport selected above. Save your changes first."
|
||||
}),
|
||||
/*#__PURE__*/ _jsxs("div", {
|
||||
style: {
|
||||
alignItems: 'center',
|
||||
display: 'flex',
|
||||
flexWrap: 'wrap',
|
||||
gap: '.5rem'
|
||||
gap: '.5rem',
|
||||
alignItems: 'center',
|
||||
flexWrap: 'wrap'
|
||||
},
|
||||
children: [
|
||||
/*#__PURE__*/ _jsx("input", {
|
||||
onChange: (e)=>setTo(e.target.value),
|
||||
type: "email",
|
||||
placeholder: "[email protected]",
|
||||
value: to,
|
||||
onChange: (e)=>setTo(e.target.value),
|
||||
style: {
|
||||
flex: 1,
|
||||
minWidth: '220px'
|
||||
},
|
||||
type: "email",
|
||||
value: to
|
||||
}
|
||||
}),
|
||||
/*#__PURE__*/ _jsx("button", {
|
||||
className: "btn btn--style-secondary",
|
||||
disabled: status.kind === 'sending',
|
||||
type: "button",
|
||||
onClick: send,
|
||||
disabled: status.kind === 'sending',
|
||||
className: "btn btn--style-secondary",
|
||||
style: {
|
||||
whiteSpace: 'nowrap'
|
||||
},
|
||||
type: "button",
|
||||
children: status.kind === 'sending' ? 'Sending…' : 'Send test'
|
||||
})
|
||||
]
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/components/TestEmailButton.tsx"],"sourcesContent":["'use client'\n\nimport { useState } from 'react'\n\n/**\n * Admin UI: a small \"send test email\" tool for the SiteIntegrations email tab.\n * Enter an address, click Send, and it POSTs to /api/ipal/test-email, which\n * sends through the currently-selected transport (SMTP or Graph). Shows the\n * result inline so you can confirm delivery — or read the exact error — without\n * leaving the panel.\n *\n * Assigned via a `ui` field's admin.components.Field.\n */\nexport const TestEmailButton = () => {\n const [to, setTo] = useState('')\n const [status, setStatus] = useState<\n | { kind: 'error'; msg: string }\n | { kind: 'idle' }\n | { kind: 'ok'; msg: string }\n | { kind: 'sending' }\n >({ kind: 'idle' })\n\n const send = async () => {\n if (!to.trim()) {\n setStatus({ kind: 'error', msg: 'Enter a recipient address.' })\n return\n }\n setStatus({ kind: 'sending' })\n try {\n const res = await fetch('/api/ipal/test-email', {\n body: JSON.stringify({ to: to.trim() }),\n credentials: 'include',\n headers: { 'Content-Type': 'application/json' },\n method: 'POST',\n })\n const data = await res.json()\n if (data.ok) {\n setStatus({ kind: 'ok', msg: data.message ?? 'Test email sent.' })\n } else {\n setStatus({ kind: 'error', msg: data.error ?? 'Send failed.' })\n }\n } catch {\n setStatus({ kind: 'error', msg: 'Request failed. Is the server running?' })\n }\n }\n\n return (\n <div className=\"field-type\" style={{ marginTop: '1rem' }}>\n <label className=\"field-label\">Send a test email</label>\n <p style={{ fontSize: '.85rem', marginTop: 0, opacity: 0.7 }}>\n Sends through the transport selected above. Save your changes first.\n </p>\n <div style={{ alignItems: 'center', display: 'flex', flexWrap: 'wrap', gap: '.5rem' }}>\n <input\n onChange={(e) => setTo(e.target.value)}\n placeholder=\"[email protected]\"\n style={{ flex: 1, minWidth: '220px' }}\n type=\"email\"\n value={to}\n />\n <button\n className=\"btn btn--style-secondary\"\n disabled={status.kind === 'sending'}\n onClick={send}\n style={{ whiteSpace: 'nowrap' }}\n type=\"button\"\n >\n {status.kind === 'sending' ? 'Sending…' : 'Send test'}\n </button>\n </div>\n {status.kind === 'ok' && (\n <p style={{ color: 'var(--theme-success-500, green)', marginTop: '.5rem' }}>\n ✓ {status.msg}\n </p>\n )}\n {status.kind === 'error' && (\n <p style={{ color: 'var(--theme-error-500, crimson)', marginTop: '.5rem' }}>\n ✗ {status.msg}\n </p>\n )}\n </div>\n )\n}\n\nexport default TestEmailButton\n"],"names":["useState","TestEmailButton","to","setTo","status","setStatus","kind","send","trim","msg","res","fetch","body","JSON","stringify","credentials","headers","method","data","json","ok","message","error","div","className","style","marginTop","label","p","fontSize","opacity","alignItems","display","flexWrap","gap","input","onChange","e","target","value","placeholder","flex","minWidth","type","button","disabled","onClick","whiteSpace","color"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,QAAO;AAEhC;;;;;;;;CAQC,GACD,OAAO,MAAMC,kBAAkB;IAC7B,MAAM,CAACC,IAAIC,MAAM,GAAGH,SAAS;IAC7B,MAAM,CAACI,QAAQC,UAAU,GAAGL,SAK1B;QAAEM,MAAM;IAAO;IAEjB,MAAMC,OAAO;QACX,IAAI,CAACL,GAAGM,IAAI,IAAI;YACdH,UAAU;gBAAEC,MAAM;gBAASG,KAAK;YAA6B;YAC7D;QACF;QACAJ,UAAU;YAAEC,MAAM;QAAU;QAC5B,IAAI;YACF,MAAMI,MAAM,MAAMC,MAAM,wBAAwB;gBAC9CC,MAAMC,KAAKC,SAAS,CAAC;oBAAEZ,IAAIA,GAAGM,IAAI;gBAAG;gBACrCO,aAAa;gBACbC,SAAS;oBAAE,gBAAgB;gBAAmB;gBAC9CC,QAAQ;YACV;YACA,MAAMC,OAAO,MAAMR,IAAIS,IAAI;YAC3B,IAAID,KAAKE,EAAE,EAAE;gBACXf,UAAU;oBAAEC,MAAM;oBAAMG,KAAKS,KAAKG,OAAO,IAAI;gBAAmB;YAClE,OAAO;gBACLhB,UAAU;oBAAEC,MAAM;oBAASG,KAAKS,KAAKI,KAAK,IAAI;gBAAe;YAC/D;QACF,EAAE,OAAM;YACNjB,UAAU;gBAAEC,MAAM;gBAASG,KAAK;YAAyC;QAC3E;IACF;IAEA,qBACE,MAACc;QAAIC,WAAU;QAAaC,OAAO;YAAEC,WAAW;QAAO;;0BACrD,KAACC;gBAAMH,WAAU;0BAAc;;0BAC/B,KAACI;gBAAEH,OAAO;oBAAEI,UAAU;oBAAUH,WAAW;oBAAGI,SAAS;gBAAI;0BAAG;;0BAG9D,MAACP;gBAAIE,OAAO;oBAAEM,YAAY;oBAAUC,SAAS;oBAAQC,UAAU;oBAAQC,KAAK;gBAAQ;;kCAClF,KAACC;wBACCC,UAAU,CAACC,IAAMlC,MAAMkC,EAAEC,MAAM,CAACC,KAAK;wBACrCC,aAAY;wBACZf,OAAO;4BAAEgB,MAAM;4BAAGC,UAAU;wBAAQ;wBACpCC,MAAK;wBACLJ,OAAOrC;;kCAET,KAAC0C;wBACCpB,WAAU;wBACVqB,UAAUzC,OAAOE,IAAI,KAAK;wBAC1BwC,SAASvC;wBACTkB,OAAO;4BAAEsB,YAAY;wBAAS;wBAC9BJ,MAAK;kCAEJvC,OAAOE,IAAI,KAAK,YAAY,aAAa;;;;YAG7CF,OAAOE,IAAI,KAAK,sBACf,MAACsB;gBAAEH,OAAO;oBAAEuB,OAAO;oBAAmCtB,WAAW;gBAAQ;;oBAAG;oBACvEtB,OAAOK,GAAG;;;YAGhBL,OAAOE,IAAI,KAAK,yBACf,MAACsB;gBAAEH,OAAO;oBAAEuB,OAAO;oBAAmCtB,WAAW;gBAAQ;;oBAAG;oBACvEtB,OAAOK,GAAG;;;;;AAKvB,EAAC;AAED,eAAeR,gBAAe"}
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/components/TestEmailButton.tsx"],"sourcesContent":["'use client'\n\nimport { useState } from 'react'\n\n/**\n * Admin UI: a small \"send test email\" tool for the SiteIntegrations email tab.\n * Enter an address, click Send, and it POSTs to /api/ipal/test-email, which\n * sends through the currently-selected transport (SMTP or Graph). Shows the\n * result inline so you can confirm delivery — or read the exact error — without\n * leaving the panel.\n *\n * Assigned via a `ui` field's admin.components.Field.\n */\nexport const TestEmailButton = () => {\n const [to, setTo] = useState('')\n const [status, setStatus] = useState<\n { kind: 'idle' } | { kind: 'sending' } | { kind: 'ok'; msg: string } | { kind: 'error'; msg: string }\n >({ kind: 'idle' })\n\n const send = async () => {\n if (!to.trim()) {\n setStatus({ kind: 'error', msg: 'Enter a recipient address.' })\n return\n }\n setStatus({ kind: 'sending' })\n try {\n const res = await fetch('/api/ipal/test-email', {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n credentials: 'include',\n body: JSON.stringify({ to: to.trim() }),\n })\n const data = await res.json()\n if (data.ok) {\n setStatus({ kind: 'ok', msg: data.message ?? 'Test email sent.' })\n } else {\n setStatus({ kind: 'error', msg: data.error ?? 'Send failed.' })\n }\n } catch {\n setStatus({ kind: 'error', msg: 'Request failed. Is the server running?' })\n }\n }\n\n return (\n <div className=\"field-type\" style={{ marginTop: '1rem' }}>\n <label className=\"field-label\">Send a test email</label>\n <p style={{ opacity: 0.7, fontSize: '.85rem', marginTop: 0 }}>\n Sends through the transport selected above. Save your changes first.\n </p>\n <div style={{ display: 'flex', gap: '.5rem', alignItems: 'center', flexWrap: 'wrap' }}>\n <input\n type=\"email\"\n placeholder=\"[email protected]\"\n value={to}\n onChange={(e) => setTo(e.target.value)}\n style={{ flex: 1, minWidth: '220px' }}\n />\n <button\n type=\"button\"\n onClick={send}\n disabled={status.kind === 'sending'}\n className=\"btn btn--style-secondary\"\n style={{ whiteSpace: 'nowrap' }}\n >\n {status.kind === 'sending' ? 'Sending…' : 'Send test'}\n </button>\n </div>\n {status.kind === 'ok' && (\n <p style={{ color: 'var(--theme-success-500, green)', marginTop: '.5rem' }}>\n ✓ {status.msg}\n </p>\n )}\n {status.kind === 'error' && (\n <p style={{ color: 'var(--theme-error-500, crimson)', marginTop: '.5rem' }}>\n ✗ {status.msg}\n </p>\n )}\n </div>\n )\n}\n\nexport default TestEmailButton\n"],"names":["useState","TestEmailButton","to","setTo","status","setStatus","kind","send","trim","msg","res","fetch","method","headers","credentials","body","JSON","stringify","data","json","ok","message","error","div","className","style","marginTop","label","p","opacity","fontSize","display","gap","alignItems","flexWrap","input","type","placeholder","value","onChange","e","target","flex","minWidth","button","onClick","disabled","whiteSpace","color"],"mappings":"AAAA;;AAEA,SAASA,QAAQ,QAAQ,QAAO;AAEhC;;;;;;;;CAQC,GACD,OAAO,MAAMC,kBAAkB;IAC7B,MAAM,CAACC,IAAIC,MAAM,GAAGH,SAAS;IAC7B,MAAM,CAACI,QAAQC,UAAU,GAAGL,SAE1B;QAAEM,MAAM;IAAO;IAEjB,MAAMC,OAAO;QACX,IAAI,CAACL,GAAGM,IAAI,IAAI;YACdH,UAAU;gBAAEC,MAAM;gBAASG,KAAK;YAA6B;YAC7D;QACF;QACAJ,UAAU;YAAEC,MAAM;QAAU;QAC5B,IAAI;YACF,MAAMI,MAAM,MAAMC,MAAM,wBAAwB;gBAC9CC,QAAQ;gBACRC,SAAS;oBAAE,gBAAgB;gBAAmB;gBAC9CC,aAAa;gBACbC,MAAMC,KAAKC,SAAS,CAAC;oBAAEf,IAAIA,GAAGM,IAAI;gBAAG;YACvC;YACA,MAAMU,OAAO,MAAMR,IAAIS,IAAI;YAC3B,IAAID,KAAKE,EAAE,EAAE;gBACXf,UAAU;oBAAEC,MAAM;oBAAMG,KAAKS,KAAKG,OAAO,IAAI;gBAAmB;YAClE,OAAO;gBACLhB,UAAU;oBAAEC,MAAM;oBAASG,KAAKS,KAAKI,KAAK,IAAI;gBAAe;YAC/D;QACF,EAAE,OAAM;YACNjB,UAAU;gBAAEC,MAAM;gBAASG,KAAK;YAAyC;QAC3E;IACF;IAEA,qBACE,MAACc;QAAIC,WAAU;QAAaC,OAAO;YAAEC,WAAW;QAAO;;0BACrD,KAACC;gBAAMH,WAAU;0BAAc;;0BAC/B,KAACI;gBAAEH,OAAO;oBAAEI,SAAS;oBAAKC,UAAU;oBAAUJ,WAAW;gBAAE;0BAAG;;0BAG9D,MAACH;gBAAIE,OAAO;oBAAEM,SAAS;oBAAQC,KAAK;oBAASC,YAAY;oBAAUC,UAAU;gBAAO;;kCAClF,KAACC;wBACCC,MAAK;wBACLC,aAAY;wBACZC,OAAOpC;wBACPqC,UAAU,CAACC,IAAMrC,MAAMqC,EAAEC,MAAM,CAACH,KAAK;wBACrCb,OAAO;4BAAEiB,MAAM;4BAAGC,UAAU;wBAAQ;;kCAEtC,KAACC;wBACCR,MAAK;wBACLS,SAAStC;wBACTuC,UAAU1C,OAAOE,IAAI,KAAK;wBAC1BkB,WAAU;wBACVC,OAAO;4BAAEsB,YAAY;wBAAS;kCAE7B3C,OAAOE,IAAI,KAAK,YAAY,aAAa;;;;YAG7CF,OAAOE,IAAI,KAAK,sBACf,MAACsB;gBAAEH,OAAO;oBAAEuB,OAAO;oBAAmCtB,WAAW;gBAAQ;;oBAAG;oBACvEtB,OAAOK,GAAG;;;YAGhBL,OAAOE,IAAI,KAAK,yBACf,MAACsB;gBAAEH,OAAO;oBAAEuB,OAAO;oBAAmCtB,WAAW;gBAAQ;;oBAAG;oBACvEtB,OAAOK,GAAG;;;;;AAKvB,EAAC;AAED,eAAeR,gBAAe"}
|
||||
+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"}
|
||||
+5
-1
@@ -1,3 +1,4 @@
|
||||
import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js';
|
||||
/**
|
||||
* SMTP transport settings for outbound email.
|
||||
*
|
||||
@@ -5,6 +6,8 @@
|
||||
* user), so all fields — including the password — stay editable in the admin
|
||||
* panel while remaining inaccessible to anonymous API requests.
|
||||
*/ export const smtpFields = [
|
||||
// Status written by mailAdapter on every send (throttled) — banner on this tab.
|
||||
buildIntegrationStatusBanner('emailStatus', 'Email'),
|
||||
{
|
||||
name: 'emailTransport',
|
||||
type: 'select',
|
||||
@@ -88,7 +91,8 @@
|
||||
Field: '@intecion/ipal-kit/client#TestEmailButton'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
buildIntegrationStatusField('emailStatus')
|
||||
];
|
||||
|
||||
//# sourceMappingURL=smtp.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/smtp.ts"],"sourcesContent":["import type { Field } from 'payload'\n\n/**\n * SMTP transport settings for outbound email.\n *\n * Protected at the global level (SiteIntegrations requires an authenticated\n * user), so all fields — including the password — stay editable in the admin\n * panel while remaining inaccessible to anonymous API requests.\n */\nexport const smtpFields: Field[] = [\n {\n name: 'emailTransport',\n type: 'select',\n admin: {\n description:\n 'How outbound email is sent. \"Microsoft Graph\" is only available when configured by the administrator (Intecion).',\n // The Graph option only makes sense when agency credentials exist in env.\n // We can't read process.env in the admin UI directly, so a client project\n // that hasn't set up Graph should filter this option via integrationsFields\n // override, or simply leave it on 'smtp'. The adapter enforces the real\n // availability at send time regardless of what's selected here.\n },\n defaultValue: 'smtp',\n options: [\n { label: 'SMTP', value: 'smtp' },\n { label: 'Microsoft Graph (Exchange)', value: 'graph' },\n ],\n },\n {\n type: 'row',\n admin: {\n // Hide SMTP fields when Graph is selected — they're not used then.\n condition: (_, siblingData) => siblingData?.emailTransport !== 'graph',\n },\n fields: [\n {\n name: 'smtpHost',\n type: 'text',\n admin: { placeholder: 'smtp.example.com', width: '70%' },\n },\n {\n name: 'smtpPort',\n type: 'number',\n admin: { width: '30%' },\n defaultValue: 587,\n },\n ],\n },\n {\n name: 'smtpUser',\n type: 'text',\n admin: {\n description: 'SMTP account username.',\n },\n },\n {\n name: 'smtpPassword',\n type: 'text',\n admin: {\n description: 'SMTP account password.',\n // Masked in the UI (••••) — stored plaintext, readable for SMTP auth.\n components: {\n Field: '@intecion/ipal-kit/client#MaskedField',\n },\n },\n },\n {\n name: 'smtpFromAddress',\n type: 'email',\n admin: {\n description: 'Default \"from\" address for outgoing mail.',\n },\n },\n {\n name: 'smtpFromName',\n type: 'text',\n admin: {\n description: 'Default \"from\" display name.',\n },\n },\n {\n name: 'emailTest',\n type: 'ui',\n admin: {\n components: {\n Field: '@intecion/ipal-kit/client#TestEmailButton',\n },\n },\n },\n]\n"],"names":["smtpFields","name","type","admin","description","defaultValue","options","label","value","condition","_","siblingData","emailTransport","fields","placeholder","width","components","Field"],"mappings":"AAEA;;;;;;CAMC,GACD,OAAO,MAAMA,aAAsB;IACjC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aACE;QAMJ;QACAC,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAQC,OAAO;YAAO;YAC/B;gBAAED,OAAO;gBAA8BC,OAAO;YAAQ;SACvD;IACH;IACA;QACEN,MAAM;QACNC,OAAO;YACL,mEAAmE;YACnEM,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,mBAAmB;QACjE;QACAC,QAAQ;YACN;gBACEZ,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEW,aAAa;oBAAoBC,OAAO;gBAAM;YACzD;YACA;gBACEd,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEY,OAAO;gBAAM;gBACtBV,cAAc;YAChB;SACD;IACH;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACb,sEAAsE;YACtEY,YAAY;gBACVC,OAAO;YACT;QACF;IACF;IACA;QACEhB,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLa,YAAY;gBACVC,OAAO;YACT;QACF;IACF;CACD,CAAA"}
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/smtp.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'\n\n/**\n * SMTP transport settings for outbound email.\n *\n * Protected at the global level (SiteIntegrations requires an authenticated\n * user), so all fields — including the password — stay editable in the admin\n * panel while remaining inaccessible to anonymous API requests.\n */\nexport const smtpFields: Field[] = [\n // Status written by mailAdapter on every send (throttled) — banner on this tab.\n buildIntegrationStatusBanner('emailStatus', 'Email'),\n {\n name: 'emailTransport',\n type: 'select',\n admin: {\n description:\n 'How outbound email is sent. \"Microsoft Graph\" is only available when configured by the administrator (Intecion).',\n // The Graph option only makes sense when agency credentials exist in env.\n // We can't read process.env in the admin UI directly, so a client project\n // that hasn't set up Graph should filter this option via integrationsFields\n // override, or simply leave it on 'smtp'. The adapter enforces the real\n // availability at send time regardless of what's selected here.\n },\n defaultValue: 'smtp',\n options: [\n { label: 'SMTP', value: 'smtp' },\n { label: 'Microsoft Graph (Exchange)', value: 'graph' },\n ],\n },\n {\n type: 'row',\n admin: {\n // Hide SMTP fields when Graph is selected — they're not used then.\n condition: (_, siblingData) => siblingData?.emailTransport !== 'graph',\n },\n fields: [\n {\n name: 'smtpHost',\n type: 'text',\n admin: { placeholder: 'smtp.example.com', width: '70%' },\n },\n {\n name: 'smtpPort',\n type: 'number',\n admin: { width: '30%' },\n defaultValue: 587,\n },\n ],\n },\n {\n name: 'smtpUser',\n type: 'text',\n admin: {\n description: 'SMTP account username.',\n },\n },\n {\n name: 'smtpPassword',\n type: 'text',\n admin: {\n description: 'SMTP account password.',\n // Masked in the UI (••••) — stored plaintext, readable for SMTP auth.\n components: {\n Field: '@intecion/ipal-kit/client#MaskedField',\n },\n },\n },\n {\n name: 'smtpFromAddress',\n type: 'email',\n admin: {\n description: 'Default \"from\" address for outgoing mail.',\n },\n },\n {\n name: 'smtpFromName',\n type: 'text',\n admin: {\n description: 'Default \"from\" display name.',\n },\n },\n {\n name: 'emailTest',\n type: 'ui',\n admin: {\n components: {\n Field: '@intecion/ipal-kit/client#TestEmailButton',\n },\n },\n },\n buildIntegrationStatusField('emailStatus'),\n]\n"],"names":["buildIntegrationStatusBanner","buildIntegrationStatusField","smtpFields","name","type","admin","description","defaultValue","options","label","value","condition","_","siblingData","emailTransport","fields","placeholder","width","components","Field"],"mappings":"AAEA,SAASA,4BAA4B,EAAEC,2BAA2B,QAAQ,0CAAyC;AAEnH;;;;;;CAMC,GACD,OAAO,MAAMC,aAAsB;IACjC,gFAAgF;IAChFF,6BAA6B,eAAe;IAC5C;QACEG,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aACE;QAMJ;QACAC,cAAc;QACdC,SAAS;YACP;gBAAEC,OAAO;gBAAQC,OAAO;YAAO;YAC/B;gBAAED,OAAO;gBAA8BC,OAAO;YAAQ;SACvD;IACH;IACA;QACEN,MAAM;QACNC,OAAO;YACL,mEAAmE;YACnEM,WAAW,CAACC,GAAGC,cAAgBA,aAAaC,mBAAmB;QACjE;QACAC,QAAQ;YACN;gBACEZ,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEW,aAAa;oBAAoBC,OAAO;gBAAM;YACzD;YACA;gBACEd,MAAM;gBACNC,MAAM;gBACNC,OAAO;oBAAEY,OAAO;gBAAM;gBACtBV,cAAc;YAChB;SACD;IACH;IACA;QACEJ,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACb,sEAAsE;YACtEY,YAAY;gBACVC,OAAO;YACT;QACF;IACF;IACA;QACEhB,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLa,YAAY;gBACVC,OAAO;YACT;QACF;IACF;IACAlB,4BAA4B;CAC7B,CAAA"}
|
||||
@@ -1,10 +0,0 @@
|
||||
import type { Field } from 'payload';
|
||||
/**
|
||||
* Cloudflare R2 storage credentials.
|
||||
* Reserved for future use — media offloading to R2.
|
||||
*
|
||||
* Protected at the global level (SiteIntegrations requires an authenticated
|
||||
* user), so the access keys stay editable in the admin panel while remaining
|
||||
* inaccessible to anonymous API requests.
|
||||
*/
|
||||
export declare const storageFields: Field[];
|
||||
-43
@@ -1,43 +0,0 @@
|
||||
/**
|
||||
* Cloudflare R2 storage credentials.
|
||||
* Reserved for future use — media offloading to R2.
|
||||
*
|
||||
* Protected at the global level (SiteIntegrations requires an authenticated
|
||||
* user), so the access keys stay editable in the admin panel while remaining
|
||||
* inaccessible to anonymous API requests.
|
||||
*/ export const storageFields = [
|
||||
{
|
||||
name: 'r2Bucket',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'R2 bucket name.'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'r2Endpoint',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'R2 S3-compatible endpoint URL.'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'r2AccessKeyId',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'R2 access key ID.'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: 'r2SecretAccessKey',
|
||||
type: 'text',
|
||||
admin: {
|
||||
description: 'R2 secret access key.',
|
||||
// Masked in the UI (••••) — stored plaintext, readable for R2 auth.
|
||||
components: {
|
||||
Field: '@intecion/ipal-kit/client#MaskedField'
|
||||
}
|
||||
}
|
||||
}
|
||||
];
|
||||
|
||||
//# sourceMappingURL=storage.js.map
|
||||
@@ -1 +0,0 @@
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/storage.ts"],"sourcesContent":["import type { Field } from 'payload'\n\n/**\n * Cloudflare R2 storage credentials.\n * Reserved for future use — media offloading to R2.\n *\n * Protected at the global level (SiteIntegrations requires an authenticated\n * user), so the access keys stay editable in the admin panel while remaining\n * inaccessible to anonymous API requests.\n */\nexport const storageFields: Field[] = [\n {\n name: 'r2Bucket',\n type: 'text',\n admin: {\n description: 'R2 bucket name.',\n },\n },\n {\n name: 'r2Endpoint',\n type: 'text',\n admin: {\n description: 'R2 S3-compatible endpoint URL.',\n },\n },\n {\n name: 'r2AccessKeyId',\n type: 'text',\n admin: {\n description: 'R2 access key ID.',\n },\n },\n {\n name: 'r2SecretAccessKey',\n type: 'text',\n admin: {\n description: 'R2 secret access key.',\n // Masked in the UI (••••) — stored plaintext, readable for R2 auth.\n components: {\n Field: '@intecion/ipal-kit/client#MaskedField',\n },\n },\n },\n]\n"],"names":["storageFields","name","type","admin","description","components","Field"],"mappings":"AAEA;;;;;;;CAOC,GACD,OAAO,MAAMA,gBAAyB;IACpC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACb,oEAAoE;YACpEC,YAAY;gBACVC,OAAO;YACT;QACF;IACF;CACD,CAAA"}
|
||||
+5
-1
@@ -1,3 +1,4 @@
|
||||
import { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js';
|
||||
/**
|
||||
* Cloudflare Turnstile credentials.
|
||||
*
|
||||
@@ -6,6 +7,8 @@
|
||||
* (SiteIntegrations requires an authenticated user) rather than per-field,
|
||||
* so they remain editable in the admin panel.
|
||||
*/ export const turnstileFields = [
|
||||
// Status written by the server when it verifies a form (checkTurnstile) — banner on this tab.
|
||||
buildIntegrationStatusBanner('turnstileStatus', 'Turnstile'),
|
||||
{
|
||||
name: 'turnstileSiteKey',
|
||||
type: 'text',
|
||||
@@ -23,7 +26,8 @@
|
||||
Field: '@intecion/ipal-kit/client#MaskedField'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
buildIntegrationStatusField('turnstileStatus')
|
||||
];
|
||||
|
||||
//# sourceMappingURL=turnstile.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/turnstile.ts"],"sourcesContent":["import type { Field } from 'payload'\n\n/**\n * Cloudflare Turnstile credentials.\n *\n * siteKey is public (rendered in the widget); secretKey is used for\n * server-side verification. Both are protected at the global level\n * (SiteIntegrations requires an authenticated user) rather than per-field,\n * so they remain editable in the admin panel.\n */\nexport const turnstileFields: Field[] = [\n {\n name: 'turnstileSiteKey',\n type: 'text',\n admin: {\n description: 'Public site key rendered in the Turnstile widget.',\n },\n },\n {\n name: 'turnstileSecretKey',\n type: 'text',\n admin: {\n description: 'Secret key used for server-side verification.',\n // Masked in the UI (••••) — stored plaintext, readable for verification.\n components: {\n Field: '@intecion/ipal-kit/client#MaskedField',\n },\n },\n },\n]\n"],"names":["turnstileFields","name","type","admin","description","components","Field"],"mappings":"AAEA;;;;;;;CAOC,GACD,OAAO,MAAMA,kBAA2B;IACtC;QACEC,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACb,yEAAyE;YACzEC,YAAY;gBACVC,OAAO;YACT;QACF;IACF;CACD,CAAA"}
|
||||
{"version":3,"sources":["../../../../src/globals/SiteIntegrations/fields/turnstile.ts"],"sourcesContent":["import type { Field } from 'payload'\n\nimport { buildIntegrationStatusBanner, buildIntegrationStatusField } from '../../../modules/integrations/status.js'\n\n/**\n * Cloudflare Turnstile credentials.\n *\n * siteKey is public (rendered in the widget); secretKey is used for\n * server-side verification. Both are protected at the global level\n * (SiteIntegrations requires an authenticated user) rather than per-field,\n * so they remain editable in the admin panel.\n */\nexport const turnstileFields: Field[] = [\n // Status written by the server when it verifies a form (checkTurnstile) — banner on this tab.\n buildIntegrationStatusBanner('turnstileStatus', 'Turnstile'),\n {\n name: 'turnstileSiteKey',\n type: 'text',\n admin: {\n description: 'Public site key rendered in the Turnstile widget.',\n },\n },\n {\n name: 'turnstileSecretKey',\n type: 'text',\n admin: {\n description: 'Secret key used for server-side verification.',\n // Masked in the UI (••••) — stored plaintext, readable for verification.\n components: {\n Field: '@intecion/ipal-kit/client#MaskedField',\n },\n },\n },\n buildIntegrationStatusField('turnstileStatus'),\n]\n"],"names":["buildIntegrationStatusBanner","buildIntegrationStatusField","turnstileFields","name","type","admin","description","components","Field"],"mappings":"AAEA,SAASA,4BAA4B,EAAEC,2BAA2B,QAAQ,0CAAyC;AAEnH;;;;;;;CAOC,GACD,OAAO,MAAMC,kBAA2B;IACtC,8FAA8F;IAC9FF,6BAA6B,mBAAmB;IAChD;QACEG,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;QACf;IACF;IACA;QACEH,MAAM;QACNC,MAAM;QACNC,OAAO;YACLC,aAAa;YACb,yEAAyE;YACzEC,YAAY;gBACVC,OAAO;YACT;QACF;IACF;IACAP,4BAA4B;CAC7B,CAAA"}
|
||||
-4
@@ -14,10 +14,6 @@ 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 {};
|
||||
|
||||
+26
-4
@@ -13,10 +13,6 @@ 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',
|
||||
@@ -54,6 +50,32 @@ import { turnstileFields } from './fields/turnstile.js';
|
||||
]
|
||||
}
|
||||
],
|
||||
hooks: {
|
||||
beforeChange: [
|
||||
// Keys edited in the panel → clear that integration's old status, so a stale
|
||||
// "not working" banner doesn't linger until the next form submission.
|
||||
({ context, data, originalDoc })=>{
|
||||
if (context?.ipalIntegrationStatus || !data) {
|
||||
return data;
|
||||
}
|
||||
const changed = (k)=>k in data && data[k] !== originalDoc?.[k];
|
||||
const cleared = {
|
||||
checkedAt: null,
|
||||
code: null,
|
||||
message: null,
|
||||
since: null,
|
||||
state: null
|
||||
};
|
||||
if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {
|
||||
data.turnstileStatus = cleared;
|
||||
}
|
||||
if (Object.keys(data).some((k)=>(k === 'emailTransport' || k.startsWith('smtp')) && changed(k))) {
|
||||
data.emailStatus = cleared;
|
||||
}
|
||||
return data;
|
||||
}
|
||||
]
|
||||
},
|
||||
label: 'Site Integrations'
|
||||
};
|
||||
}
|
||||
|
||||
+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 { 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"}
|
||||
{"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 */\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\n ? [{ fields: additionalFields, label: 'Custom' }]\n : []),\n ],\n },\n ],\n hooks: {\n beforeChange: [\n // Keys edited in the panel → clear that integration's old status, so a stale\n // \"not working\" banner doesn't linger until the next form submission.\n ({ context, data, originalDoc }) => {\n if (context?.ipalIntegrationStatus || !data) {return data}\n const changed = (k: string) => k in data && data[k] !== originalDoc?.[k]\n const cleared = { checkedAt: null, code: null, message: null, since: null, state: null }\n if (changed('turnstileSecretKey') || changed('turnstileSiteKey')) {data.turnstileStatus = cleared}\n if (Object.keys(data).some((k) => (k === 'emailTransport' || k.startsWith('smtp')) && changed(k))) {\n data.emailStatus = cleared\n }\n return data\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","hooks","beforeChange","context","data","originalDoc","ipalIntegrationStatus","changed","k","cleared","checkedAt","code","message","since","state","turnstileStatus","Object","keys","some","startsWith","emailStatus"],"mappings":"AAEA,SAASA,OAAO,QAAQ,gCAA+B;AACvD,SAASC,eAAe,QAAQ,wBAAuB;AACvD,SAASC,UAAU,QAAQ,mBAAkB;AAC7C,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,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,SAClB;wBAAC;4BAAEJ,QAAQT;4BAAkBY,OAAO;wBAAS;qBAAE,GAC/C,EAAE;iBACP;YACH;SACD;QACDE,OAAO;YACLC,cAAc;gBACZ,6EAA6E;gBAC7E,sEAAsE;gBACtE,CAAC,EAAEC,OAAO,EAAEC,IAAI,EAAEC,WAAW,EAAE;oBAC7B,IAAIF,SAASG,yBAAyB,CAACF,MAAM;wBAAC,OAAOA;oBAAI;oBACzD,MAAMG,UAAU,CAACC,IAAcA,KAAKJ,QAAQA,IAAI,CAACI,EAAE,KAAKH,aAAa,CAACG,EAAE;oBACxE,MAAMC,UAAU;wBAAEC,WAAW;wBAAMC,MAAM;wBAAMC,SAAS;wBAAMC,OAAO;wBAAMC,OAAO;oBAAK;oBACvF,IAAIP,QAAQ,yBAAyBA,QAAQ,qBAAqB;wBAACH,KAAKW,eAAe,GAAGN;oBAAO;oBACjG,IAAIO,OAAOC,IAAI,CAACb,MAAMc,IAAI,CAAC,CAACV,IAAM,AAACA,CAAAA,MAAM,oBAAoBA,EAAEW,UAAU,CAAC,OAAM,KAAMZ,QAAQC,KAAK;wBACjGJ,KAAKgB,WAAW,GAAGX;oBACrB;oBACA,OAAOL;gBACT;aACD;QACH;QACAL,OAAO;IACT;AACF"}
|
||||
Vendored
+61
-52
@@ -1,67 +1,76 @@
|
||||
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 { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y, } from './modules/accessibility/index.js';
|
||||
export type { A11yState } from './modules/accessibility/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, blocksToMarkdown, buildArchivePath, buildEntryPath, createMarkdownRenderer, createSearchRoute, getArchiveEntries, MARKDOWN_PREFIX, markdownHref, markdownResponse, parsePageParam, prefersMarkdown, resolveRedirect, resolveRoute, searchContent, } from './modules/content/index.js';
|
||||
export type { ArchiveEntries } from './modules/content/index.js';
|
||||
export type { SearchResult } 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 { assertEnv, ipalEnvRules } from './modules/env/index.js';
|
||||
export type { AssertEnvOptions, EnvKind, EnvRule, IpalEnvFeatures } from './modules/env/index.js';
|
||||
export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
|
||||
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.js';
|
||||
export type { FormsCollectionOverrides, FormsFieldsOverride, FormsOption, } from './modules/forms/types.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 { createContentHelpers } from './modules/frontend/index.js';
|
||||
export { createHealthRoute } from './modules/health/index.js';
|
||||
export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook, } from './modules/hooks/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 { 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 { createMcpRoute } from './modules/mcp/index.js';
|
||||
export { normalizeFilename, normalizeFilenameHook } from './modules/media/index.js';
|
||||
export { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage, } from './modules/notifications/index.js';
|
||||
export type { FormNotificationTexts, NotificationTexts } from './modules/notifications/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, getSiteIntegrations, getSiteSettings, SITE_INTEGRATIONS_SLUG, SITE_SETTINGS_SLUG, } 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 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 { AI_ASSISTANT_BOTS, AI_TRAINING_BOTS, buildAutoFillMetaHook, buildRobots, buildSitemapEntries, createMetadataGenerator, createPageMetadata, injectAutoFillMeta, } from './modules/seo/index.js';
|
||||
export { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler, } from './modules/seo/index.js';
|
||||
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField, } from './modules/seo/index.js';
|
||||
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js';
|
||||
export { buildNoindexField } from './modules/seo/index.js';
|
||||
export { recordIntegrationStatus, buildIntegrationStatusField, buildIntegrationStatusBanner } from './modules/integrations/index.js';
|
||||
export type { IntegrationStatus, IntegrationState } from './modules/integrations/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 { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd, } from './modules/seo/index.js';
|
||||
export { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd, } 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 } from './modules/seo/index.js';
|
||||
export { buildSlugField, toSlug } from './modules/slug/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 { ipalKit } from './plugin.js';
|
||||
export type { IpalOptions } from './types.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
+35
-32
@@ -1,57 +1,60 @@
|
||||
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 { A11Y_COOKIE, A11Y_DEFAULT, a11yAttributes, parseA11y, serializeA11y } from './modules/accessibility/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, blocksToMarkdown, buildArchivePath, buildEntryPath, createMarkdownRenderer, createSearchRoute, getArchiveEntries, MARKDOWN_PREFIX, markdownHref, markdownResponse, parsePageParam, prefersMarkdown, resolveRedirect, resolveRoute, searchContent } 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';
|
||||
// Boot-time environment validation (fail fast on misconfigured deploys).
|
||||
export { assertEnv, ipalEnvRules } from './modules/env/index.js';
|
||||
// Panel-managed form analytics (config-time field builder).
|
||||
export { buildFormAnalyticsFields } from './modules/forms/formAnalyticsFields.js';
|
||||
export { graphAdapter } from './modules/email/graphAdapter.js';
|
||||
export { mailAdapter } from './modules/email/mailAdapter.js';
|
||||
export { buildFormsPlugin } from './modules/forms/formsPluginConfig.js';
|
||||
export { HONEYPOT_FIELD, honeypotInputProps, isHoneypotTripped } from './modules/forms/honeypot.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, checked, custom, email, isEmail, maxLength, minLength, pattern, required } from './modules/forms/validators.js';
|
||||
export { createContentHelpers } from './modules/frontend/index.js';
|
||||
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';
|
||||
export { buildCrossLocaleFieldSync, buildPreventDeleteSystemPage, buildRevalidateHook, buildValidateUniqueRole, setPublishedAtHook, trackSlugHistoryHook } from './modules/hooks/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 { createProxy, DEFAULT_PROXY_MATCHER } from './modules/i18n/index.js';
|
||||
export { resolveLocalized } from './modules/i18n/index.js';
|
||||
// Read-only MCP server (Claude/agents connect to the site and query it).
|
||||
export { createMcpRoute } from './modules/mcp/index.js';
|
||||
export { normalizeFilename, normalizeFilenameHook } from './modules/media/index.js';
|
||||
export { getNotificationTexts, NOTIFICATION_FALLBACK, resolveFormMessage } from './modules/notifications/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';
|
||||
// Lexical → Markdown (pure, no React) — for AI-readable output.
|
||||
export { lexicalToMarkdown } from './modules/richtext/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 { 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 { buildHreflangAlternates, buildMetadata, composeTitle } from './modules/seo/index.js';
|
||||
export { AI_ASSISTANT_BOTS, AI_TRAINING_BOTS, buildAutoFillMetaHook, buildRobots, buildSitemapEntries, createMetadataGenerator, createPageMetadata, injectAutoFillMeta } from './modules/seo/index.js';
|
||||
export { createLlmsTxtRoute, createManifestHandler, createSitemapRouteHandler } from './modules/seo/index.js';
|
||||
export { buildIconsMetadata, buildOrganizationJsonLd, validateFaviconField } from './modules/seo/index.js';
|
||||
export { buildNoindexField } from './modules/seo/index.js';
|
||||
export { recordIntegrationStatus, buildIntegrationStatusField, buildIntegrationStatusBanner } from './modules/integrations/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 { buildBreadcrumbJsonLd, buildSiteNavigationJsonLd, buildWebSiteJsonLd } 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 { buildFaqJsonLd, buildLocalBusinessJsonLd, buildServiceJsonLd } 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 } from './modules/seo/index.js';
|
||||
export { buildSlugField, toSlug } from './modules/slug/index.js';
|
||||
export { buildSitemapXml, buildSitemapCss, SITEMAP_STYLE_PARAM, DEFAULT_SITEMAP_CREDIT } from './modules/seo/index.js';
|
||||
export { buildR2Storage } from './modules/storage/index.js';
|
||||
export { ipalKit } from './plugin.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
+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
+2
@@ -1,2 +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
+3
@@ -1,5 +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'\nexport { pushDataLayer } from './pushDataLayer.js'\n"],"names":["Analytics","pushDataLayer"],"mappings":"AAAA;AACA,SAASA,SAAS,QAAQ,iBAAgB;AAC1C,SAASC,aAAa,QAAQ,qBAAoB"}
|
||||
{"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
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"}
|
||||
+33
-19
@@ -1,3 +1,4 @@
|
||||
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,
|
||||
@@ -5,41 +6,54 @@
|
||||
* automatically by `ipalKit({ whiteLabel: true })` (it injects
|
||||
* admin.components.graphics.Logo/Icon pointing here).
|
||||
*
|
||||
* Server Components — they read the SiteSettings global at render. Data access
|
||||
* uses the project's `@payload-config` alias (universal in Payload 3 Next apps),
|
||||
* loaded via a variable specifier so the PLUGIN's own typecheck doesn't try to
|
||||
* resolve it (same pattern as the optional 2FA import). Everything is wrapped in
|
||||
* try/catch: on the login screen before the DB is ready, or a build with no DB,
|
||||
* the component falls back to the site name text, then to null (Payload's own
|
||||
* default) — never throws, never blocks the panel.
|
||||
* 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 = {
|
||||
/** SiteSettings global slug. Default 'site-settings'. */
|
||||
settingsSlug?: string;
|
||||
/** Field holding the site name. Default 'siteName'. */
|
||||
nameField?: string;
|
||||
/** 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 (login screen + nav). SiteSettings `logo`, falls back to `siteName`. */
|
||||
/**
|
||||
* 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 shown at the bottom of the admin nav: "Technology by
|
||||
* Intecion.com". This is the PLUGIN VENDOR's credit (Intecion ships ipal-kit),
|
||||
* not client data — so a sensible default here is fine and A0-safe. The client's
|
||||
* own brand still owns the logo/name above (AdminLogo); this is a small line
|
||||
* stating who provides the technology. Text/URL overridable; turn it off with
|
||||
* `whiteLabel: { credit: false }`.
|
||||
* 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.
|
||||
* 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 {};
|
||||
|
||||
+94
-53
@@ -1,101 +1,142 @@
|
||||
import { jsx as _jsx } from "react/jsx-runtime";
|
||||
import { getPayload } from 'payload';
|
||||
async function loadBranding(settingsSlug, nameField, imageField) {
|
||||
/** 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 {
|
||||
// Consumer alias — resolved in the project's build, hidden from plugin tsc.
|
||||
const spec = '@payload-config';
|
||||
const mod = await import(spec);
|
||||
const payload = await getPayload({
|
||||
config: mod.default
|
||||
});
|
||||
const locale = typeof props.locale === 'string' ? props.locale : props.locale?.code;
|
||||
const settings = await payload.findGlobal({
|
||||
slug: settingsSlug,
|
||||
depth: 1
|
||||
depth: 1,
|
||||
...locale ? {
|
||||
locale: locale
|
||||
} : {}
|
||||
});
|
||||
const name = typeof settings[nameField] === 'string' ? settings[nameField] : null;
|
||||
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 {
|
||||
} catch (error) {
|
||||
console.warn('[ipal] admin branding: falling back to Payload default:', error);
|
||||
return {
|
||||
name: null,
|
||||
url: null
|
||||
};
|
||||
}
|
||||
}
|
||||
/** Admin panel logo (login screen + nav). SiteSettings `logo`, falls back to `siteName`. */ export async function AdminLogo(props = {}) {
|
||||
const { settingsSlug = 'site-settings', nameField = 'siteName', imageField = 'logo' } = props;
|
||||
const { name, url } = await loadBranding(settingsSlug, nameField, imageField);
|
||||
/**
|
||||
* 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", {
|
||||
src: url,
|
||||
alt: name ?? '',
|
||||
src: url,
|
||||
style: {
|
||||
maxHeight: 60,
|
||||
maxWidth: 240,
|
||||
width: 'auto',
|
||||
height: 'auto'
|
||||
height: 'auto',
|
||||
maxHeight: 120,
|
||||
maxWidth: 420,
|
||||
width: 'auto'
|
||||
}
|
||||
});
|
||||
}
|
||||
if (name) return /*#__PURE__*/ _jsx("div", {
|
||||
style: {
|
||||
fontSize: '1.5rem',
|
||||
fontWeight: 600
|
||||
},
|
||||
children: name
|
||||
});
|
||||
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 { settingsSlug = 'site-settings', nameField = 'siteName', imageField = 'favicon' } = props;
|
||||
const { name, url } = await loadBranding(settingsSlug, nameField, imageField);
|
||||
const { imageField = 'favicon', nameField = 'siteName', settingsSlug = 'site-settings' } = props;
|
||||
const { name, url } = await loadBranding(props, settingsSlug, nameField, imageField);
|
||||
if (url) {
|
||||
return /*#__PURE__*/ _jsx("img", {
|
||||
src: url,
|
||||
alt: name ?? '',
|
||||
src: url,
|
||||
style: {
|
||||
height: 'auto',
|
||||
maxHeight: 28,
|
||||
maxWidth: 28,
|
||||
width: 'auto',
|
||||
height: 'auto'
|
||||
width: 'auto'
|
||||
}
|
||||
});
|
||||
}
|
||||
if (name) return /*#__PURE__*/ _jsx("div", {
|
||||
style: {
|
||||
fontWeight: 700
|
||||
},
|
||||
children: name.slice(0, 2).toUpperCase()
|
||||
});
|
||||
if (name) {
|
||||
return /*#__PURE__*/ _jsx("div", {
|
||||
style: {
|
||||
fontWeight: 700
|
||||
},
|
||||
children: name.slice(0, 2).toUpperCase()
|
||||
});
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* Discreet vendor credit shown at the bottom of the admin nav: "Technology by
|
||||
* Intecion.com". This is the PLUGIN VENDOR's credit (Intecion ships ipal-kit),
|
||||
* not client data — so a sensible default here is fine and A0-safe. The client's
|
||||
* own brand still owns the logo/name above (AdminLogo); this is a small line
|
||||
* stating who provides the technology. Text/URL overridable; turn it off with
|
||||
* `whiteLabel: { credit: false }`.
|
||||
* 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.
|
||||
* 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 by Intecion.com', url = 'https://intecion.com' } = 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,
|
||||
target: "_blank",
|
||||
rel: "noopener noreferrer",
|
||||
style: {
|
||||
display: 'block',
|
||||
padding: '0.75rem 1rem',
|
||||
fontSize: '0.75rem',
|
||||
opacity: 0.6,
|
||||
textDecoration: 'none'
|
||||
},
|
||||
style: style,
|
||||
target: "_blank",
|
||||
children: text
|
||||
});
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+6
-1
@@ -68,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",
|
||||
@@ -107,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
|
||||
})
|
||||
@@ -168,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
+3
-2
@@ -14,7 +14,7 @@ import { useIsMounted } from './useIsMounted.js';
|
||||
* replace the styling outright.
|
||||
*/ export function CookieButton({ className } = {}) {
|
||||
const isMounted = useIsMounted();
|
||||
const { decided, reopen } = useConsentContext();
|
||||
const { decided, reopen, texts } = useConsentContext();
|
||||
// Render nothing until mounted — prevents hydration mismatch (no project
|
||||
// ConsentWrapper workaround needed).
|
||||
if (!isMounted) {
|
||||
@@ -25,7 +25,8 @@ import { useIsMounted } from './useIsMounted.js';
|
||||
}
|
||||
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'\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 } = 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 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","useIsMounted","CookieButton","className","isMounted","decided","reopen","cls","button","aria-label","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,EAAE,GAAGN;IAE5B,yEAAyE;IACzE,qCAAqC;IACrC,IAAI,CAACI,WAAW;QAAC,OAAO;IAAI;IAC5B,IAAI,CAACC,SAAS;QAAC,OAAO;IAAI;IAE1B,MAAME,MACJJ,aACA,2HACE,4GACA;IAEJ,qBACE,KAACK;QAAOC,cAAW;QAAkBN,WAAWI;QAAKG,aAAU;QAAgBC,SAASL;kBACtF,cAAA,KAACP;YACCa,eAAY;YACZT,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"}
|
||||
+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
+8
@@ -11,6 +11,14 @@ type CreateSearchRouteArgs = {
|
||||
getCachedPayload: () => Promise<BasePayload>;
|
||||
/** Home slug map/string so the home result collapses to root. */
|
||||
homeSlug?: Record<string, string> | string;
|
||||
/**
|
||||
* Per-IP limit (in memory, per instance). Default { max: 120, windowMs: 60_000 }.
|
||||
* `false` = off (a limiter in front, e.g. Cloudflare WAF rate limiting).
|
||||
*/
|
||||
rateLimit?: {
|
||||
max?: number;
|
||||
windowMs?: number;
|
||||
} | false;
|
||||
/** Field holding a richer AI summary (buildSummaryField) to prefer as description. */
|
||||
summaryField?: string;
|
||||
};
|
||||
|
||||
+22
@@ -1,3 +1,4 @@
|
||||
import { checkRateLimit, clientIp, tooManyRequests } from '../shared/rateLimit.js';
|
||||
import { searchContent } from './searchContent.js';
|
||||
/**
|
||||
* A JSON content-search endpoint. Powers both the site's own search UI and
|
||||
@@ -18,7 +19,28 @@ import { searchContent } from './searchContent.js';
|
||||
* Uses the global Request/Response — no next/server import.
|
||||
*/ export function createSearchRoute(args) {
|
||||
const { baseUrl, collection = 'pages', config, defaultLimit = 10, getCachedPayload, homeSlug, summaryField } = args;
|
||||
// 120/min: a debounced search-as-you-type box stays well under it; a scraper doesn't.
|
||||
const rl = args.rateLimit === false ? null : {
|
||||
max: 120,
|
||||
windowMs: 60_000,
|
||||
...args.rateLimit
|
||||
};
|
||||
return async (req)=>{
|
||||
if (rl) {
|
||||
const ip = clientIp(req);
|
||||
if (!checkRateLimit({
|
||||
key: ip,
|
||||
scope: 'search',
|
||||
...rl
|
||||
})) {
|
||||
return tooManyRequests(ip, 'search', {
|
||||
count: 0,
|
||||
error: 'Too many requests',
|
||||
query: '',
|
||||
results: []
|
||||
});
|
||||
}
|
||||
}
|
||||
const url = new URL(req.url);
|
||||
const query = url.searchParams.get('q')?.trim() ?? '';
|
||||
const locale = url.searchParams.get('locale') ?? undefined;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
@@ -6,6 +6,7 @@ export { getArchiveEntries } from './getArchiveEntries.js';
|
||||
export type { ArchiveEntries } from './getArchiveEntries.js';
|
||||
export { MARKDOWN_PREFIX, markdownHref, prefersMarkdown } from './markdownNegotiation.js';
|
||||
export { buildArchivePath, buildEntryPath, parsePageParam } from './paths.js';
|
||||
export { resolveNotFoundPage } from './resolveNotFoundPage.js';
|
||||
export { resolveRedirect } from './resolveRedirect.js';
|
||||
export { resolveRoute } from './resolveRoute.js';
|
||||
export type { ResolvedRoute } from './resolveRoute.js';
|
||||
|
||||
Vendored
+1
@@ -5,6 +5,7 @@ export { createSearchRoute } from './createSearchRoute.js';
|
||||
export { getArchiveEntries } from './getArchiveEntries.js';
|
||||
export { MARKDOWN_PREFIX, markdownHref, prefersMarkdown } from './markdownNegotiation.js';
|
||||
export { buildArchivePath, buildEntryPath, parsePageParam } from './paths.js';
|
||||
export { resolveNotFoundPage } from './resolveNotFoundPage.js';
|
||||
export { resolveRedirect } from './resolveRedirect.js';
|
||||
export { resolveRoute } from './resolveRoute.js';
|
||||
export { searchContent } from './searchContent.js';
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/content/index.ts"],"sourcesContent":["export { buildArchiveFields } from './archiveFields.js'\nexport { blocksToMarkdown } from './blocksToMarkdown.js'\nexport { createMarkdownRenderer, markdownResponse } from './createMarkdownRenderer.js'\nexport { createSearchRoute } from './createSearchRoute.js'\nexport { getArchiveEntries } from './getArchiveEntries.js'\nexport type { ArchiveEntries } from './getArchiveEntries.js'\nexport { MARKDOWN_PREFIX, markdownHref, prefersMarkdown } from './markdownNegotiation.js'\nexport { buildArchivePath, buildEntryPath, parsePageParam } from './paths.js'\nexport { resolveRedirect } from './resolveRedirect.js'\nexport { resolveRoute } from './resolveRoute.js'\nexport type { ResolvedRoute } from './resolveRoute.js'\nexport { searchContent } from './searchContent.js'\nexport type { SearchResult } from './searchContent.js'\nexport type { ContentCollectionOption, ContentOption } from './types.js'\nexport { archiveFieldName } from './types.js'\n"],"names":["buildArchiveFields","blocksToMarkdown","createMarkdownRenderer","markdownResponse","createSearchRoute","getArchiveEntries","MARKDOWN_PREFIX","markdownHref","prefersMarkdown","buildArchivePath","buildEntryPath","parsePageParam","resolveRedirect","resolveRoute","searchContent","archiveFieldName"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,qBAAoB;AACvD,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,sBAAsB,EAAEC,gBAAgB,QAAQ,8BAA6B;AACtF,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,iBAAiB,QAAQ,yBAAwB;AAE1D,SAASC,eAAe,EAAEC,YAAY,EAAEC,eAAe,QAAQ,2BAA0B;AACzF,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,cAAc,QAAQ,aAAY;AAC7E,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,YAAY,QAAQ,oBAAmB;AAEhD,SAASC,aAAa,QAAQ,qBAAoB;AAGlD,SAASC,gBAAgB,QAAQ,aAAY"}
|
||||
{"version":3,"sources":["../../../src/modules/content/index.ts"],"sourcesContent":["export { buildArchiveFields } from './archiveFields.js'\nexport { blocksToMarkdown } from './blocksToMarkdown.js'\nexport { createMarkdownRenderer, markdownResponse } from './createMarkdownRenderer.js'\nexport { createSearchRoute } from './createSearchRoute.js'\nexport { getArchiveEntries } from './getArchiveEntries.js'\nexport type { ArchiveEntries } from './getArchiveEntries.js'\nexport { MARKDOWN_PREFIX, markdownHref, prefersMarkdown } from './markdownNegotiation.js'\nexport { buildArchivePath, buildEntryPath, parsePageParam } from './paths.js'\nexport { resolveNotFoundPage } from './resolveNotFoundPage.js'\nexport { resolveRedirect } from './resolveRedirect.js'\nexport { resolveRoute } from './resolveRoute.js'\nexport type { ResolvedRoute } from './resolveRoute.js'\nexport { searchContent } from './searchContent.js'\nexport type { SearchResult } from './searchContent.js'\nexport type { ContentCollectionOption, ContentOption } from './types.js'\nexport { archiveFieldName } from './types.js'\n"],"names":["buildArchiveFields","blocksToMarkdown","createMarkdownRenderer","markdownResponse","createSearchRoute","getArchiveEntries","MARKDOWN_PREFIX","markdownHref","prefersMarkdown","buildArchivePath","buildEntryPath","parsePageParam","resolveNotFoundPage","resolveRedirect","resolveRoute","searchContent","archiveFieldName"],"mappings":"AAAA,SAASA,kBAAkB,QAAQ,qBAAoB;AACvD,SAASC,gBAAgB,QAAQ,wBAAuB;AACxD,SAASC,sBAAsB,EAAEC,gBAAgB,QAAQ,8BAA6B;AACtF,SAASC,iBAAiB,QAAQ,yBAAwB;AAC1D,SAASC,iBAAiB,QAAQ,yBAAwB;AAE1D,SAASC,eAAe,EAAEC,YAAY,EAAEC,eAAe,QAAQ,2BAA0B;AACzF,SAASC,gBAAgB,EAAEC,cAAc,EAAEC,cAAc,QAAQ,aAAY;AAC7E,SAASC,mBAAmB,QAAQ,2BAA0B;AAC9D,SAASC,eAAe,QAAQ,uBAAsB;AACtD,SAASC,YAAY,QAAQ,oBAAmB;AAEhD,SAASC,aAAa,QAAQ,qBAAoB;AAGlD,SAASC,gBAAgB,QAAQ,aAAY"}
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
import type { BasePayload } from 'payload';
|
||||
type ResolveNotFoundPageArgs = {
|
||||
locale: string;
|
||||
/** Client's Pages collection slug. Defaults to 'pages'. */
|
||||
pagesSlug?: string;
|
||||
payload: BasePayload;
|
||||
/** SiteSettings global slug. Defaults to 'site-settings'. */
|
||||
settingsSlug?: string;
|
||||
};
|
||||
/**
|
||||
* Returns the page the editor assigned as **404 (Not Found)** in System Pages,
|
||||
* fully populated (depth 2, same shape as resolveRoute's pages), or null when
|
||||
* the role is unassigned.
|
||||
*
|
||||
* Used by the project's `not-found.tsx`. The editor decides what a 404 looks
|
||||
* like: a dedicated "Not found" page, or simply the homepage. Null means
|
||||
* "render the project's built-in fallback view".
|
||||
*
|
||||
* Never throws — a missing DB (container build prerendering not-found) or a
|
||||
* deleted page just yields null, so the 404 view can't crash the build.
|
||||
*/
|
||||
export declare function resolveNotFoundPage({ locale, pagesSlug, payload, settingsSlug, }: ResolveNotFoundPageArgs): Promise<null | Record<string, unknown>>;
|
||||
export {};
|
||||
+37
@@ -0,0 +1,37 @@
|
||||
/**
|
||||
* Returns the page the editor assigned as **404 (Not Found)** in System Pages,
|
||||
* fully populated (depth 2, same shape as resolveRoute's pages), or null when
|
||||
* the role is unassigned.
|
||||
*
|
||||
* Used by the project's `not-found.tsx`. The editor decides what a 404 looks
|
||||
* like: a dedicated "Not found" page, or simply the homepage. Null means
|
||||
* "render the project's built-in fallback view".
|
||||
*
|
||||
* Never throws — a missing DB (container build prerendering not-found) or a
|
||||
* deleted page just yields null, so the 404 view can't crash the build.
|
||||
*/ export async function resolveNotFoundPage({ locale, pagesSlug = 'pages', payload, settingsSlug = 'site-settings' }) {
|
||||
try {
|
||||
const settings = await payload.findGlobal({
|
||||
slug: settingsSlug,
|
||||
depth: 0,
|
||||
locale: locale
|
||||
});
|
||||
const rel = settings.notFound;
|
||||
const id = typeof rel === 'string' || typeof rel === 'number' ? rel : rel && typeof rel === 'object' ? rel.id : undefined;
|
||||
if (id === undefined) {
|
||||
return null;
|
||||
}
|
||||
const doc = await payload.findByID({
|
||||
id,
|
||||
collection: pagesSlug,
|
||||
depth: 2,
|
||||
locale: locale
|
||||
});
|
||||
return doc ?? null;
|
||||
} catch (error) {
|
||||
console.warn('[ipal] resolveNotFoundPage: falling back to built-in 404 view:', error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
//# sourceMappingURL=resolveNotFoundPage.js.map
|
||||
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../../../src/modules/content/resolveNotFoundPage.ts"],"sourcesContent":["import type { BasePayload } from 'payload'\n\ntype ResolveNotFoundPageArgs = {\n locale: string\n /** Client's Pages collection slug. Defaults to 'pages'. */\n pagesSlug?: string\n payload: BasePayload\n /** SiteSettings global slug. Defaults to 'site-settings'. */\n settingsSlug?: string\n}\n\n/**\n * Returns the page the editor assigned as **404 (Not Found)** in System Pages,\n * fully populated (depth 2, same shape as resolveRoute's pages), or null when\n * the role is unassigned.\n *\n * Used by the project's `not-found.tsx`. The editor decides what a 404 looks\n * like: a dedicated \"Not found\" page, or simply the homepage. Null means\n * \"render the project's built-in fallback view\".\n *\n * Never throws — a missing DB (container build prerendering not-found) or a\n * deleted page just yields null, so the 404 view can't crash the build.\n */\nexport async function resolveNotFoundPage({\n locale,\n pagesSlug = 'pages',\n payload,\n settingsSlug = 'site-settings',\n}: ResolveNotFoundPageArgs): Promise<null | Record<string, unknown>> {\n try {\n const settings = (await payload.findGlobal({\n slug: settingsSlug as never,\n depth: 0,\n locale: locale as never,\n })) as Record<string, unknown>\n\n const rel = settings.notFound\n const id =\n typeof rel === 'string' || typeof rel === 'number'\n ? rel\n : rel && typeof rel === 'object'\n ? (rel as { id?: number | string }).id\n : undefined\n if (id === undefined) {return null}\n\n const doc = await payload.findByID({\n id,\n collection: pagesSlug as never,\n depth: 2,\n locale: locale as never,\n })\n return (doc as null | Record<string, unknown>) ?? null\n } catch (error) {\n console.warn('[ipal] resolveNotFoundPage: falling back to built-in 404 view:', error)\n return null\n }\n}\n"],"names":["resolveNotFoundPage","locale","pagesSlug","payload","settingsSlug","settings","findGlobal","slug","depth","rel","notFound","id","undefined","doc","findByID","collection","error","console","warn"],"mappings":"AAWA;;;;;;;;;;;CAWC,GACD,OAAO,eAAeA,oBAAoB,EACxCC,MAAM,EACNC,YAAY,OAAO,EACnBC,OAAO,EACPC,eAAe,eAAe,EACN;IACxB,IAAI;QACF,MAAMC,WAAY,MAAMF,QAAQG,UAAU,CAAC;YACzCC,MAAMH;YACNI,OAAO;YACPP,QAAQA;QACV;QAEA,MAAMQ,MAAMJ,SAASK,QAAQ;QAC7B,MAAMC,KACJ,OAAOF,QAAQ,YAAY,OAAOA,QAAQ,WACtCA,MACAA,OAAO,OAAOA,QAAQ,WACpB,AAACA,IAAiCE,EAAE,GACpCC;QACR,IAAID,OAAOC,WAAW;YAAC,OAAO;QAAI;QAElC,MAAMC,MAAM,MAAMV,QAAQW,QAAQ,CAAC;YACjCH;YACAI,YAAYb;YACZM,OAAO;YACPP,QAAQA;QACV;QACA,OAAO,AAACY,OAA0C;IACpD,EAAE,OAAOG,OAAO;QACdC,QAAQC,IAAI,CAAC,kEAAkEF;QAC/E,OAAO;IACT;AACF"}
|
||||
+7
-1
@@ -38,6 +38,12 @@ type ResolveRouteArgs = {
|
||||
payload: BasePayload;
|
||||
/** Route segments after the locale, e.g. ['artykuly', 'moj-post']. */
|
||||
segments?: string[];
|
||||
/**
|
||||
* SiteSettings already read for this locale (depth ≥ 1). Pass it to skip the
|
||||
* read — createContentHelpers does, so layout, metadata and page share ONE
|
||||
* settings query per request.
|
||||
*/
|
||||
settings?: null | Record<string, unknown>;
|
||||
/** SiteSettings global slug. Defaults to 'site-settings'. */
|
||||
settingsSlug?: string;
|
||||
};
|
||||
@@ -64,5 +70,5 @@ type ResolveRouteArgs = {
|
||||
* make canonical and hreflang ambiguous (the same entry reachable under several
|
||||
* URLs).
|
||||
*/
|
||||
export declare function resolveRoute({ content, locale, page, pagesSlug, payload, segments, settingsSlug, }: ResolveRouteArgs): Promise<null | ResolvedRoute>;
|
||||
export declare function resolveRoute({ content, locale, page, pagesSlug, payload, segments, settings: preloaded, settingsSlug, }: ResolveRouteArgs): Promise<null | ResolvedRoute>;
|
||||
export {};
|
||||
|
||||
Vendored
+16
-2
@@ -21,8 +21,8 @@ import { archiveFieldName } from './types.js';
|
||||
* Depth beyond {archive}/{entry} isn't supported — categories in the path would
|
||||
* make canonical and hreflang ambiguous (the same entry reachable under several
|
||||
* URLs).
|
||||
*/ export async function resolveRoute({ content, locale, page = 1, pagesSlug = 'pages', payload, segments, settingsSlug = 'site-settings' }) {
|
||||
const settings = await payload.findGlobal({
|
||||
*/ export async function resolveRoute({ content, locale, page = 1, pagesSlug = 'pages', payload, segments, settings: preloaded, settingsSlug = 'site-settings' }) {
|
||||
const settings = preloaded ?? await payload.findGlobal({
|
||||
slug: settingsSlug,
|
||||
depth: 1,
|
||||
locale: locale
|
||||
@@ -114,6 +114,20 @@ import { archiveFieldName } from './types.js';
|
||||
if (!doc) {
|
||||
return null;
|
||||
}
|
||||
// The page assigned as 404 in System Pages must not be reachable as a normal
|
||||
// 200 URL (/pl/strona-nie-znaleziona) — that's a soft-404 / duplicate. Treat
|
||||
// it as not found, so the route calls notFound() and not-found.tsx renders
|
||||
// that same page with a real 404 status. (If 404 = homepage, the homepage is
|
||||
// served from the root branch above and never reaches here by its own slug
|
||||
// in a way that matters — but guard anyway so we never hide the homepage.)
|
||||
const notFound = settings.notFound;
|
||||
const homepage = settings.homepage;
|
||||
const notFoundId = notFound && typeof notFound === 'object' ? notFound.id : notFound;
|
||||
const homepageId = homepage && typeof homepage === 'object' ? homepage.id : homepage;
|
||||
const docId = doc.id;
|
||||
if (notFoundId != null && notFoundId === docId && notFoundId !== homepageId) {
|
||||
return null;
|
||||
}
|
||||
return {
|
||||
type: 'page',
|
||||
doc: doc
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -47,7 +47,7 @@ import { buildLocalizedPath, getDefaultLocale, isValidLocale } from '../i18n/ind
|
||||
if (doc._status && doc._status !== 'published') {
|
||||
continue;
|
||||
}
|
||||
if (doc.meta?.noindex) {
|
||||
if (doc.noindex || doc.meta?.noindex) {
|
||||
continue;
|
||||
}
|
||||
const title = typeof doc.title === 'string' ? doc.title : undefined;
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+3
-3
@@ -1,11 +1,11 @@
|
||||
import type { PayloadEmailAdapter } from 'payload';
|
||||
import { type GraphAdapterArgs } from './graphAdapter.js';
|
||||
import { type PanelSmtpAdapterArgs } from './panelSmtpAdapter.js';
|
||||
import { type GraphAdapterArgs } from './graphAdapter.js';
|
||||
export type MailAdapterArgs = {
|
||||
smtp?: PanelSmtpAdapterArgs;
|
||||
graph?: GraphAdapterArgs;
|
||||
fallbackFromAddress?: string;
|
||||
fallbackFromName?: string;
|
||||
graph?: GraphAdapterArgs;
|
||||
smtp?: PanelSmtpAdapterArgs;
|
||||
};
|
||||
/**
|
||||
* Dispatcher email adapter: wired into the config ONCE, but picks the transport
|
||||
|
||||
Vendored
+42
-7
@@ -1,6 +1,9 @@
|
||||
import { getSiteIntegrations } from '../payload/index.js';
|
||||
import { graphAdapter } from './graphAdapter.js';
|
||||
import { recordIntegrationStatus } from '../integrations/status.js';
|
||||
import { panelSmtpAdapter } from './panelSmtpAdapter.js';
|
||||
import { graphAdapter } from './graphAdapter.js';
|
||||
const STATUS_FIELD = 'emailStatus';
|
||||
/** Error text for the panel: first line, no stack, capped — SMTP errors don't carry the password. */ const describe = (err)=>(err instanceof Error ? err.message : String(err)).split('\n')[0].slice(0, 200);
|
||||
/** True when the agency Graph credentials are present in the environment. */ function graphAvailable() {
|
||||
return Boolean(process.env.GRAPH_TENANT_ID && process.env.GRAPH_CLIENT_ID && process.env.GRAPH_CLIENT_SECRET && process.env.GRAPH_SENDER);
|
||||
}
|
||||
@@ -41,16 +44,48 @@ import { panelSmtpAdapter } from './panelSmtpAdapter.js';
|
||||
sendEmail: async (message)=>{
|
||||
const settings = await getSiteIntegrations(payload);
|
||||
const choice = settings.emailTransport ?? 'smtp';
|
||||
if (choice === 'graph') {
|
||||
if (graphAvailable()) {
|
||||
return graph.sendEmail(message);
|
||||
}
|
||||
const previous = settings[STATUS_FIELD];
|
||||
const useGraph = choice === 'graph' && graphAvailable();
|
||||
const graphFallback = choice === 'graph' && !useGraph;
|
||||
if (graphFallback) {
|
||||
// Panel asked for Graph but the agency creds aren't configured for
|
||||
// this project. Fall back to SMTP rather than silently dropping mail.
|
||||
payload.logger.warn('[ipal] Transport set to Graph but GRAPH_* env vars are missing; falling back to SMTP.');
|
||||
return smtp.sendEmail(message);
|
||||
}
|
||||
return smtp.sendEmail(message);
|
||||
const transport = useGraph ? 'Microsoft Graph' : 'SMTP';
|
||||
const code = useGraph ? 'graph-error' : 'smtp-error';
|
||||
let result;
|
||||
try {
|
||||
result = await (useGraph ? graph : smtp).sendEmail(message);
|
||||
} catch (err) {
|
||||
await recordIntegrationStatus(payload, STATUS_FIELD, previous, {
|
||||
state: 'degraded',
|
||||
code,
|
||||
message: `${transport}: ${describe(err)}`
|
||||
});
|
||||
throw err // callers (form-builder, Send test) still see the failure
|
||||
;
|
||||
}
|
||||
// The delegates report failure as { sent: false, error, detail? } instead
|
||||
// of throwing (a broken mailbox must not crash a form submission).
|
||||
const failed = result;
|
||||
if (failed && typeof failed === 'object' && failed.sent === false) {
|
||||
await recordIntegrationStatus(payload, STATUS_FIELD, previous, {
|
||||
state: 'degraded',
|
||||
code,
|
||||
message: `${transport}: ${describe(failed.detail ?? failed.error ?? 'not sent')}`
|
||||
});
|
||||
return result;
|
||||
}
|
||||
// Graph selected but unavailable is a configuration problem even if SMTP delivered.
|
||||
await recordIntegrationStatus(payload, STATUS_FIELD, previous, graphFallback ? {
|
||||
state: 'degraded',
|
||||
code: 'graph-unavailable',
|
||||
message: 'Microsoft Graph is selected but not configured on the server — e-mails are sent over SMTP.'
|
||||
} : {
|
||||
state: 'ok'
|
||||
});
|
||||
return result;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
+12
-10
@@ -32,8 +32,8 @@ import { getSiteIntegrations } from '../payload/index.js';
|
||||
if (!host || !user || !pass) {
|
||||
payload.logger.error('[ipal] Email not sent: SMTP is not configured in Site Integrations.');
|
||||
return {
|
||||
error: 'SMTP is not configured in Site Integrations.',
|
||||
sent: false
|
||||
sent: false,
|
||||
error: 'SMTP is not configured in Site Integrations.'
|
||||
};
|
||||
}
|
||||
// The panel is the source of truth for the sender; fall back to whatever
|
||||
@@ -48,13 +48,13 @@ import { getSiteIntegrations } from '../payload/index.js';
|
||||
const stripCRLF = (v)=>String(v ?? '').replace(/[\r\n]+/g, ' ').trim();
|
||||
const { default: nodemailer } = await import('nodemailer');
|
||||
const transporter = nodemailer.createTransport({
|
||||
auth: {
|
||||
pass,
|
||||
user
|
||||
},
|
||||
host,
|
||||
port,
|
||||
secure: port === 465
|
||||
secure: port === 465,
|
||||
auth: {
|
||||
user,
|
||||
pass
|
||||
}
|
||||
});
|
||||
try {
|
||||
const info = await transporter.sendMail({
|
||||
@@ -65,16 +65,18 @@ import { getSiteIntegrations } from '../payload/index.js';
|
||||
} : {}
|
||||
});
|
||||
return {
|
||||
messageId: info.messageId,
|
||||
sent: true
|
||||
sent: true,
|
||||
messageId: info.messageId
|
||||
};
|
||||
} catch (err) {
|
||||
// Never surface SMTP internals to the caller — a form submission
|
||||
// shouldn't fail loudly because the mailbox is misconfigured.
|
||||
payload.logger.error(`[ipal] Email send failed: ${err.message}`);
|
||||
// `detail` is for the panel status (mailAdapter), not for end users.
|
||||
return {
|
||||
sent: false,
|
||||
error: 'Failed to send email.',
|
||||
sent: false
|
||||
detail: err.message
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+1
-1
@@ -13,7 +13,7 @@
|
||||
}
|
||||
switch(kind){
|
||||
case 'boolean':
|
||||
if (!/^(true|false|1|0|yes|no)$/i.test(value)) {
|
||||
if (!/^(?:true|false|1|0|yes|no)$/i.test(value)) {
|
||||
return `${name} must be a boolean (true/false/1/0/yes/no, got "${value}")`;
|
||||
}
|
||||
break;
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
Vendored
+13
-2
@@ -59,8 +59,19 @@
|
||||
kind: 'url'
|
||||
}, {
|
||||
name: 'R2_PUBLIC_URL',
|
||||
description: 'Public base URL media is served from',
|
||||
kind: 'url'
|
||||
description: 'Public base URL media is served from (custom domain of the bucket)',
|
||||
// Production: absolute URL (https://media.example.com). Outside production a
|
||||
// site-relative path ('/media') is accepted — buildR2Storage prefixes it with
|
||||
// NEXT_PUBLIC_SERVER_URL (e.g. a dev rewrite /media → bucket).
|
||||
validate: (v)=>{
|
||||
if (/^https?:\/\/[^/\s]+/i.test(v)) {
|
||||
return true;
|
||||
}
|
||||
if (v.startsWith('/') && process.env.NODE_ENV !== 'production') {
|
||||
return true;
|
||||
}
|
||||
return v.startsWith('/') ? `R2_PUBLIC_URL must be an absolute URL in production (got "${v}") — e.g. https://media.example.com` : `R2_PUBLIC_URL must be an absolute URL (https://…) or, outside production, a path starting with "/" (got "${v}")`;
|
||||
}
|
||||
});
|
||||
}
|
||||
if (emailGraph) {
|
||||
|
||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+10
-4
@@ -3,9 +3,15 @@ import type { FormsOption } from './types.js';
|
||||
/**
|
||||
* Configures @payloadcms/plugin-form-builder from IPAL's FormsOption.
|
||||
*
|
||||
* Provides the form/form-submissions collections and field types. Email
|
||||
* delivery is intentionally NOT handled here — the plugin's own SMTP-from-panel
|
||||
* sender (submitForm) does that, so the form-builder's built-in email (which
|
||||
* needs a Payload email adapter) is left unused.
|
||||
* Provides the forms / form-submissions collections and field types. E-mails
|
||||
* after a submission are the form-builder's own (Forms → Emails), sent through
|
||||
* the project's email adapter (mailAdapter()).
|
||||
*
|
||||
* SECURITY: form-builder defaults form-submissions to `create: () => true`, i.e.
|
||||
* anyone can POST /api/form-submissions and skip everything submitForm enforces
|
||||
* (rate limit, Turnstile, GDPR consent, schema validation). Here REST/GraphQL
|
||||
* creation is limited to logged-in users; the site submits through submitForm
|
||||
* (server action → Local API, which bypasses access by design). A project that
|
||||
* really needs public REST submissions can override `formSubmissionOverrides.access.create`.
|
||||
*/
|
||||
export declare function buildFormsPlugin(forms: FormsOption): Plugin;
|
||||
|
||||
+53
-16
@@ -1,22 +1,33 @@
|
||||
import { formBuilderPlugin } from '@payloadcms/plugin-form-builder';
|
||||
/** REST/GraphQL: only logged-in users. Local API (submitForm) is unaffected. */ const submissionsCreateAccess = ({ req })=>Boolean(req.user);
|
||||
/**
|
||||
* Configures @payloadcms/plugin-form-builder from IPAL's FormsOption.
|
||||
*
|
||||
* Provides the form/form-submissions collections and field types. Email
|
||||
* delivery is intentionally NOT handled here — the plugin's own SMTP-from-panel
|
||||
* sender (submitForm) does that, so the form-builder's built-in email (which
|
||||
* needs a Payload email adapter) is left unused.
|
||||
* Provides the forms / form-submissions collections and field types. E-mails
|
||||
* after a submission are the form-builder's own (Forms → Emails), sent through
|
||||
* the project's email adapter (mailAdapter()).
|
||||
*
|
||||
* SECURITY: form-builder defaults form-submissions to `create: () => true`, i.e.
|
||||
* anyone can POST /api/form-submissions and skip everything submitForm enforces
|
||||
* (rate limit, Turnstile, GDPR consent, schema validation). Here REST/GraphQL
|
||||
* creation is limited to logged-in users; the site submits through submitForm
|
||||
* (server action → Local API, which bypasses access by design). A project that
|
||||
* really needs public REST submissions can override `formSubmissionOverrides.access.create`.
|
||||
*/ export function buildFormsPlugin(forms) {
|
||||
const adminGroup = forms.adminGroup === undefined ? 'Forms' : forms.adminGroup;
|
||||
const group = adminGroup ? {
|
||||
group: adminGroup
|
||||
} : {};
|
||||
return formBuilderPlugin({
|
||||
fields: {
|
||||
checkbox: true,
|
||||
email: true,
|
||||
message: true,
|
||||
number: true,
|
||||
payment: false,
|
||||
select: true,
|
||||
text: true,
|
||||
textarea: true,
|
||||
email: true,
|
||||
number: true,
|
||||
select: true,
|
||||
checkbox: true,
|
||||
message: true,
|
||||
payment: false,
|
||||
...forms.fields
|
||||
},
|
||||
...forms.redirectRelationships ? {
|
||||
@@ -25,12 +36,38 @@ import { formBuilderPlugin } from '@payloadcms/plugin-form-builder';
|
||||
// Client-supplied collection overrides (e.g. a per-form notification
|
||||
// address). The plugin provides the hook, not the opinion about which
|
||||
// extra fields a form should carry.
|
||||
...forms.formOverrides ? {
|
||||
formOverrides: forms.formOverrides
|
||||
} : {},
|
||||
...forms.formSubmissionOverrides ? {
|
||||
formSubmissionOverrides: forms.formSubmissionOverrides
|
||||
} : {}
|
||||
// Tidy panel by default: both collections under one sidebar group with plain
|
||||
// labels — no per-project overrides needed just to sort the sidebar.
|
||||
formOverrides: {
|
||||
labels: {
|
||||
singular: 'Form',
|
||||
plural: 'Forms'
|
||||
},
|
||||
...forms.formOverrides,
|
||||
admin: {
|
||||
...group,
|
||||
...forms.formOverrides?.admin
|
||||
}
|
||||
},
|
||||
formSubmissionOverrides: {
|
||||
labels: {
|
||||
singular: 'Submission',
|
||||
plural: 'Submissions'
|
||||
},
|
||||
...forms.formSubmissionOverrides,
|
||||
admin: {
|
||||
...group,
|
||||
defaultColumns: [
|
||||
'form',
|
||||
'createdAt'
|
||||
],
|
||||
...forms.formSubmissionOverrides?.admin
|
||||
},
|
||||
access: {
|
||||
create: submissionsCreateAccess,
|
||||
...forms.formSubmissionOverrides?.access
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user