diff --git a/.changeset/37087-forms-in-studio-menu-developer-page-retired.md b/.changeset/37087-forms-in-studio-menu-developer-page-retired.md new file mode 100644 index 00000000000..d0664c41af8 --- /dev/null +++ b/.changeset/37087-forms-in-studio-menu-developer-page-retired.md @@ -0,0 +1,29 @@ +--- +'@object-ui/app-shell': patch +'@object-ui/console': patch +'@object-ui/i18n': patch +'@objectstack/platform-objects': patch +--- + +feat(studio)!: forms are listed in Studio's menu, and the console's Developer → Public Forms page is retired (objectstack#37087, ADR-0159) + +Clause-②: yes (narrowing) — released translation keys, a Studio navigation entry and a console page are removed (listed below); two `publicFormsSetup` keys are added in every locale +Metadata-protocol: none + + + +**Forms in Studio's menu.** `form` is a metadata type of its own (ADR-0159), and Studio now lists it: under UI, in the common tier, after Reports. A package's menu always shows the row, whether the package holds a form or not, and the type directory lists it too. The row opens the package's list of forms, and a form opens in Studio's form editor. ADR-0084's type-to-group table gains the `form` row. + +**Developer → Public Forms is retired.** The console page that listed public forms and edited each one in a dialog read and wrote forms as views. A public form is a `form` item now: it is designed in Studio's form editor, and its public link is switched on or off in Setup → Public forms. Studio's Developer group no longer shows the entry. Both addresses of the page, `/apps//developer/public-forms` and `/apps//component/developer/public-forms`, redirect to Studio's list of forms, so a bookmark still lands somewhere useful. Setup's Public Forms entry is unchanged. + +**Setup names both forms when an address is taken.** Switching a public form on while another form holds its address is refused. The message now names the form that holds the address beside the form being switched on, so the administrator knows which two forms to tell apart. When the other form cannot be read, the message says another form holds the address. + +**BREAKING**: released keys and one navigation entry are removed. No code in the platform reads them any more. + +- `@object-ui/i18n`, `./namespaces/developer`, every locale: the 47 keys under `console.developer.publicForms` (shipped since 18.2.0). The retired page was their only reader. +- `@objectstack/platform-objects`: the Studio app's navigation entry `nav_public_forms` (component `developer:public-forms`) and its label key `apps.studio.navigation.nav_public_forms.label` in every locale. Setup's entry of the same id, `apps.setup.navigation.nav_public_forms`, stays. +- `@object-ui/console`: the `PublicFormsPage` module. The component key `developer:public-forms` stays registered, as the redirect above. + +If a deployment overrides one of the removed keys (in its own i18next resources), that override no longer applies: nothing asks for the key. Remove the override. A project's translation bundle could never name `apps.studio.navigation.nav_public_forms`: the Studio app is the platform's, and `translation-target-unknown` already refused a key under an app the project does not define. A `translation` item saved in an environment, in Studio or through the metadata API, is not checked against navigation: one that names the removed key still saves and publishes, and translates nothing. Delete the key from such an item. + +New keys, in every locale of `@object-ui/i18n`: `publicFormsSetup.refusalAddressTaken` and `publicFormsSetup.refusalAddressTakenUnknown`. diff --git a/docs/adr/0084-application-builder-information-architecture.md b/docs/adr/0084-application-builder-information-architecture.md index 211569489d0..6a0b8913c50 100644 --- a/docs/adr/0084-application-builder-information-architecture.md +++ b/docs/adr/0084-application-builder-information-architecture.md @@ -184,8 +184,9 @@ Every type the spec registers, enumerated at `origin/main` `151e8123` from `pack | **界面 UI** | `ui` | 2 | `page` 页面 | 常用 | | **界面 UI** | `ui` | 3 | `dashboard` 仪表盘 | 常用 | | **界面 UI** | `ui` | 4 | `report` 报表 | 常用 | -| **界面 UI** | `ui` | 5 | `view` 视图 | 高级 | -| **界面 UI** | `ui` | 6 | `action` 操作 | 高级 | +| **界面 UI** | `ui` | 5 | `form` 表单 | 常用 | +| **界面 UI** | `ui` | 6 | `view` 视图 | 高级 | +| **界面 UI** | `ui` | 7 | `action` 操作 | 高级 | | **自动化 Automation** | `automation` | 1 | `flow` 流程 | 常用 | | **自动化 Automation** | `automation` | 2 | `job` | 高级 | | **平台 Platform** | `system` | 1 | `doc` 文档 | 高级 | @@ -215,6 +216,8 @@ Every type the spec registers, enumerated at `origin/main` `151e8123` from `pack *(Amended 2026-11-27, card [#37740](https://github.com/objectstack-ai/objectstack/issues/37740), which catches the notes up with a row the table already holds and decides nothing: `knowledge_source`, the table's last row. The row was written by the change that registered the type (card [#37304](https://github.com/objectstack-ai/objectstack/issues/37304); [ADR-0161](./0161-knowledge-platform-boundary-platform-owns-assembly-sync-split-record-return-knowledge-source-is-a-governed-type.md) K4), under [item 6](#amendment-2026-11-25-silent), and that change left the notes of 2026-11-25 and 2026-11-26 above at their own readings. Read again at `origin/main` `62dd9e1ef5`: 35 entries — the 33 of those readings, each in the domain the 2026-11-26 note leaves it in, and two registered on 2026-11-27: `form`, registered `ui` ([ADR-0159](./0159-forms-are-their-own-metadata-type-public-forms-are-form-items-view-is-lists-only.md) D2; card [#37086](https://github.com/objectstack-ai/objectstack/issues/37086)), and `knowledge_source`, registered `ai`. `form` still has no row: Studio's directory does not list the type yet, and its row is written by the change that lists it ([Amendment (2026-11-26)](#amendment-2026-11-26-moves)). So the table has 34 rows for the 35 entries, and they count 数据 Data 8 · 界面 UI 6 · 自动化 Automation 2 · 平台 Platform 7 · 访问 Access 6 · AI 5. No type changed group since the 2026-11-26 note, and one row has been rewritten since: `datasource`'s, by the note above this one.)* +*(Rewritten 2026-11-29, card [#37087](https://github.com/objectstack-ai/objectstack/issues/37087), which carries out [Amendment (2026-11-26)](#amendment-2026-11-26-moves) for one row and decides nothing: `form`. The same change takes the type off the directory's hidden types and brings its designer, so Studio lists it and its row is written: 界面 UI, fifth, directly after `report` ([item 11](#amendment-2026-11-26-silent)), and its tier is 常用; `view` and `action`, the two types behind it, are each one place later. Read again at `origin/main` `3014176695`: the registry holds the same 35 entries, and the table now has a row for each — 35 rows, counting 数据 Data 8 · 界面 UI 7 · 自动化 Automation 2 · 平台 Platform 7 · 访问 Access 6 · AI 5. The four rows that amendment left to their changes are now each rewritten or written: `dataset`'s, `position`'s, `datasource`'s and `form`'s.)* + The rows are in the menu's order: by group, then by **Order**, which counts inside a group. **Tier** is 常用 Common or 高级 Advanced. The Chinese word beside a registered name is the one the ruling or its proposal uses for that type; a type neither names in Chinese has none. `field` carries no order and no tier because it draws no row (the second reading below). The table is the registry read at one commit. **The rule above is what binds**: a type added to the registry, or given another domain there, moves in the menu without this table being edited, and where the two disagree the registry is right. *(Amended 2026-11-25: that sentence is about the Group and `domain` columns. The Order and Tier columns are read from no registry — they are decided in this record, and a type the table has no row for is drawn in 高级 Advanced, at the end of its group: [Amendment (2026-11-25)](#amendment-2026-11-25).)* diff --git a/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts b/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts index 623b302e3bc..e9edaa62d3d 100644 --- a/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts +++ b/packages/cli/test/connect-agent-both-halves-wire.pin.test.ts @@ -295,6 +295,20 @@ describe('#17647 — Connect-an-Agent visibility: BOTH halves, over the wire', ( expect(allowedIds).toContain('nav_packages'); expect(groupChildren(setupAllowed.body?.item, 'group_apps')).toEqual(['nav_packages']); expect(allowedIds).toContain('nav_public_forms'); + // #37087 — the id is Setup's alone now: Studio's entry of the same id + // is retired with the console page it opened (`developer:public-forms`). + // What Setup serves under it is its own page, once. + const publicForms: AnyRec[] = []; + const collect = (items: AnyRec[] | undefined) => { + for (const item of items ?? []) { + if (item?.id === 'nav_public_forms') publicForms.push(item); + if (Array.isArray(item?.children)) collect(item.children); + } + }; + collect(setupAllowed.body?.item?.navigation); + expect(publicForms).toHaveLength(1); + expect(publicForms[0]).toMatchObject({ type: 'component', componentRef: 'forms:public-forms' }); + expect(JSON.stringify(setupAllowed.body)).not.toContain('developer:public-forms'); expect(allowedIds).toContain('nav_work_calendars'); expect(allowedIds).toContain('nav_work_calendar_exceptions'); expect(allowedIds).not.toContain('nav_packaged_actions'); diff --git a/packages/cli/test/console-page-nav-entries.pin.test.ts b/packages/cli/test/console-page-nav-entries.pin.test.ts index cf434e37708..b2aad95d15c 100644 --- a/packages/cli/test/console-page-nav-entries.pin.test.ts +++ b/packages/cli/test/console-page-nav-entries.pin.test.ts @@ -40,7 +40,7 @@ import { describe, expect, it, vi } from 'vitest'; import { SchemaRegistry } from '@objectstack/objectql'; -import { STUDIO_APP } from '@objectstack/platform-objects/apps'; +import { SETUP_APP, SETUP_NAV_CONTRIBUTIONS, STUDIO_APP } from '@objectstack/platform-objects/apps'; import { RestServer } from '@objectstack/rest'; type AnyRec = Record; @@ -49,14 +49,19 @@ type AnyRec = Record; const MEASURED_CONSOLE_KEYS = ['audit:log', 'developer:integrations']; /** - * The real registration of the Studio shell. `structuredClone` because - * `registerItem` writes the `_lock` envelope onto what it is handed - * (ADR-0010 §3.7). + * The real registration of the Studio shell, and of the Setup shell with the + * entries this package contributes to it (#37087, for the entry the two apps + * once both declared). `structuredClone` because `registerItem` writes the + * `_lock` envelope onto what it is handed (ADR-0010 §3.7). */ function composedRegistry(): SchemaRegistry { const registry = new SchemaRegistry({ multiTenant: false, collisionPolicy: 'error' }); (registry as AnyRec).logLevel = 'silent'; registry.registerApp(structuredClone(STUDIO_APP), '@objectstack/platform-objects'); + registry.registerApp(structuredClone(SETUP_APP), '@objectstack/platform-objects'); + for (const contribution of SETUP_NAV_CONTRIBUTIONS) { + registry.registerAppNavContribution(contribution as any, '@objectstack/platform-objects'); + } return registry; } @@ -75,8 +80,8 @@ function makeRes() { return res; } -/** A `RestServer` serving the composed Studio app to a caller holding `studio.access`. */ -function serve() { +/** A `RestServer` serving the composed apps to a caller holding `perms` (`studio.access` by default). */ +function serve(perms: string[] = ['studio.access']) { const registry = composedRegistry(); const protocol: AnyRec = { getDiscovery: vi.fn().mockResolvedValue({ @@ -96,7 +101,7 @@ function serve() { const rest: AnyRec = new RestServer( createMockServer() as any, protocol as any, { api: { requireAuth: false } } as any, ); - rest.resolveExecCtx = async () => ({ userId: 'u1', systemPermissions: ['studio.access'] }); + rest.resolveExecCtx = async () => ({ userId: 'u1', systemPermissions: perms }); rest.registerRoutes(); return rest; } @@ -127,8 +132,11 @@ describe('#20142 — the Integrations & APIs nav entry, served from the composed const studio = await getApp(serve(), 'studio'); expect(studio.statusCode).toBe(200); const developer = group(studio.body?.item, 'group_developer'); + // #37087 — three entries: Studio's `nav_public_forms` is retired with + // the console page it opened. Setup's entry of the same id is pinned + // in the last block of this file. expect(ids(developer)).toEqual([ - 'nav_api_console', 'nav_flow_runs', 'nav_public_forms', 'nav_integrations', + 'nav_api_console', 'nav_flow_runs', 'nav_integrations', ]); expect(developer?.at(-1)).toMatchObject({ type: 'component', componentRef: 'developer:integrations' }); }); @@ -142,3 +150,35 @@ describe('#20142 — the Integrations & APIs nav entry, served from the composed expect(MEASURED_CONSOLE_KEYS).toContain(served[0].componentRef); }); }); + +describe('#37087 — Public Forms is served by Setup alone', () => { + /** Every served nav entry of an app with the given id, groups walked. */ + const entriesById = (app: AnyRec | undefined, id: string): AnyRec[] => { + const out: AnyRec[] = []; + const walk = (items: AnyRec[] | undefined) => { + for (const item of items ?? []) { + if (item?.id === id) out.push(item); + if (Array.isArray(item?.children)) walk(item.children); + } + }; + walk(app?.navigation); + return out; + }; + + it('the served Studio app holds no `nav_public_forms` entry and names no `developer:public-forms` key', async () => { + const studio = await getApp(serve(), 'studio'); + expect(studio.statusCode).toBe(200); + expect(entriesById(studio.body?.item, 'nav_public_forms')).toEqual([]); + expect(JSON.stringify(studio.body)).not.toContain('developer:public-forms'); + // CONTROL: the walk finds an entry that is served. + expect(entriesById(studio.body?.item, 'nav_integrations')).toHaveLength(1); + }); + + it('the served Setup app holds it once, opening Setup\'s own page', async () => { + const setup = await getApp(serve(['setup.access', 'manage_platform_settings']), 'setup'); + expect(setup.statusCode).toBe(200); + const served = entriesById(setup.body?.item, 'nav_public_forms'); + expect(served).toHaveLength(1); + expect(served[0]).toMatchObject({ type: 'component', componentRef: 'forms:public-forms' }); + }); +}); diff --git a/packages/platform-objects/src/apps/console-page-nav-entries.test.ts b/packages/platform-objects/src/apps/console-page-nav-entries.test.ts index b4014ed4116..23d33d03dee 100644 --- a/packages/platform-objects/src/apps/console-page-nav-entries.test.ts +++ b/packages/platform-objects/src/apps/console-page-nav-entries.test.ts @@ -31,10 +31,17 @@ // `registerDeveloperComponents.tsx` registers `developer:integrations`, both // imported for their side effect by `apps/console/src/main.tsx`. A pin bump // that renames one of them must change this list in the same PR. +// +// #37087 — Studio's Developer group held a fourth entry, `nav_public_forms`, +// which opened the console's Public Forms page under `developer:public-forms`. +// That page is retired: a form is a `form` item designed in Studio's form +// editor, and its public link is switched in Setup → Public forms (ADR-0159). +// The id is Setup's alone now, and the last block pins both sides of that. import { describe, it, expect } from 'vitest'; import { AppSchema } from '@objectstack/spec/ui'; +import { SETUP_NAV_CONTRIBUTIONS } from './setup-nav.contributions.js'; import { STUDIO_APP } from './studio.app.js'; /** The registry keys the pinned console registers for the pages this repo links. */ @@ -73,7 +80,6 @@ describe('the Integrations & APIs entry targets the console page (#20142)', () = expect(studioGroup('group_developer').map((i) => i.id)).toEqual([ 'nav_api_console', 'nav_flow_runs', - 'nav_public_forms', 'nav_integrations', ]); }); @@ -104,3 +110,34 @@ describe('each ref names a key the pinned console registers (#20142)', () => { } }); }); + +describe('Public Forms is Setup\'s entry alone (#37087)', () => { + /** Every entry of Studio's navigation, groups flattened. */ + const studioEntries = (): NavItem[] => + ((STUDIO_APP.navigation ?? []) as NavItem[]).flatMap((g) => [g, ...(g.children ?? [])]); + + it('Studio declares no `nav_public_forms` entry and names no `developer:public-forms` key', () => { + expect(studioEntries().map((i) => i.id)).not.toContain('nav_public_forms'); + expect(studioEntries().map((i) => i.componentRef)).not.toContain('developer:public-forms'); + }); + + it('Setup still contributes `nav_public_forms`, once, to its own page and behind its own gate', () => { + const found = SETUP_NAV_CONTRIBUTIONS.flatMap((c) => + (c.items as NavItem[]).filter((i) => i.id === 'nav_public_forms').map((i) => ({ app: c.app, group: c.group, item: i })), + ); + expect(found).toHaveLength(1); + expect(found[0].app).toBe('setup'); + expect(found[0].item).toMatchObject({ + type: 'component', + label: 'Public Forms', + componentRef: 'forms:public-forms', + requiredPermissions: ['manage_platform_settings'], + }); + }); + + it('CONTROL: the two developer entries beside the retired one are still declared', () => { + const ids = studioGroup('group_developer').map((i) => i.id); + expect(ids).toContain('nav_api_console'); + expect(ids).toContain('nav_flow_runs'); + }); +}); diff --git a/packages/platform-objects/src/apps/studio.app.ts b/packages/platform-objects/src/apps/studio.app.ts index 0d94065d9f6..cf2e7e14844 100644 --- a/packages/platform-objects/src/apps/studio.app.ts +++ b/packages/platform-objects/src/apps/studio.app.ts @@ -296,9 +296,15 @@ export const STUDIO_APP: App = { }, { // Developer — first-party developer tooling surfaces hosted by the - // console (API console, flow run inspector, public forms registry, - // integrations & APIs). Registered as built-in components in the - // console's ComponentRegistry under the `developer:*` namespace. + // console (API console, flow run inspector, integrations & APIs). + // Registered as built-in components in the console's ComponentRegistry + // under the `developer:*` namespace. + // + // #37087 — no Public Forms entry: that console page is retired. A form + // is a `form` item, listed under 界面 UI in Studio's menu and designed + // in its form editor (ADR-0159); its public link is switched on or off + // in Setup → Public forms (`setup-nav.contributions.ts`, the entry of + // the same id `nav_public_forms`, which stays). id: 'group_developer', type: 'group', label: 'Developer', @@ -318,13 +324,6 @@ export const STUDIO_APP: App = { componentRef: 'developer:flow-runs', icon: 'activity', }, - { - id: 'nav_public_forms', - type: 'component', - label: 'Public Forms', - componentRef: 'developer:public-forms', - icon: 'file-text', - }, { // #20142 — the console's Integrations & APIs page: the environment's // REST base URL, per-object endpoints and an `x-api-key` cURL diff --git a/packages/platform-objects/src/apps/translations/ar.source-hashes.ts b/packages/platform-objects/src/apps/translations/ar.source-hashes.ts index c8d055df1e5..1f6b04eff03 100644 --- a/packages/platform-objects/src/apps/translations/ar.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ar.source-hashes.ts @@ -159,7 +159,6 @@ export const arSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/ar.ts b/packages/platform-objects/src/apps/translations/ar.ts index 86f1088b6af..fb0b41fdef1 100644 --- a/packages/platform-objects/src/apps/translations/ar.ts +++ b/packages/platform-objects/src/apps/translations/ar.ts @@ -166,7 +166,6 @@ export const ar: TranslationData = { group_developer: { label: 'المطوّر' }, nav_api_console: { label: 'وحدة تحكم API' }, nav_flow_runs: { label: 'عمليات تشغيل التدفقات' }, - nav_public_forms: { label: 'النماذج العامة' }, nav_integrations: { label: 'عمليات التكامل وواجهات API' }, group_integration: { label: 'التكامل' }, nav_email_templates: { label: 'قوالب البريد الإلكتروني' }, diff --git a/packages/platform-objects/src/apps/translations/de.source-hashes.ts b/packages/platform-objects/src/apps/translations/de.source-hashes.ts index 40208542a18..7beb9517e63 100644 --- a/packages/platform-objects/src/apps/translations/de.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/de.source-hashes.ts @@ -160,7 +160,6 @@ export const deSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/de.ts b/packages/platform-objects/src/apps/translations/de.ts index 5280df6bc28..792dd8a8df8 100644 --- a/packages/platform-objects/src/apps/translations/de.ts +++ b/packages/platform-objects/src/apps/translations/de.ts @@ -168,7 +168,6 @@ export const de: TranslationData = { group_developer: { label: 'Entwickler' }, nav_api_console: { label: 'API-Konsole' }, nav_flow_runs: { label: 'Flow-Ausführungen' }, - nav_public_forms: { label: 'Öffentliche Formulare' }, nav_integrations: { label: 'Integrationen und APIs' }, group_integration: { label: 'Integration' }, nav_email_templates: { label: 'E-Mail-Vorlagen' }, diff --git a/packages/platform-objects/src/apps/translations/en.ts b/packages/platform-objects/src/apps/translations/en.ts index 2237d18f5de..e3ba6bb88a1 100644 --- a/packages/platform-objects/src/apps/translations/en.ts +++ b/packages/platform-objects/src/apps/translations/en.ts @@ -220,7 +220,6 @@ export const en: TranslationData = { group_developer: { label: 'Developer' }, nav_api_console: { label: 'API Console' }, nav_flow_runs: { label: 'Flow Runs' }, - nav_public_forms: { label: 'Public Forms' }, nav_integrations: { label: 'Integrations & APIs' }, group_integration: { label: 'Integration' }, nav_email_templates: { label: 'Email Templates' }, diff --git a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts index 8e8acdf7b1b..82490f1639d 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.source-hashes.ts @@ -151,7 +151,6 @@ export const esESSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/es-ES.ts b/packages/platform-objects/src/apps/translations/es-ES.ts index dd22c5925f9..ab961c19588 100644 --- a/packages/platform-objects/src/apps/translations/es-ES.ts +++ b/packages/platform-objects/src/apps/translations/es-ES.ts @@ -154,7 +154,6 @@ export const esES: TranslationData = { group_developer: { label: 'Desarrollador' }, nav_api_console: { label: 'Consola de API' }, nav_flow_runs: { label: 'Ejecuciones de flujo' }, - nav_public_forms: { label: 'Formularios públicos' }, nav_integrations: { label: 'Integraciones y API' }, group_integration: { label: 'Integración' }, nav_email_templates: { label: 'Plantillas de correo' }, diff --git a/packages/platform-objects/src/apps/translations/fr.source-hashes.ts b/packages/platform-objects/src/apps/translations/fr.source-hashes.ts index ff4f73d7060..c26eaae19ee 100644 --- a/packages/platform-objects/src/apps/translations/fr.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/fr.source-hashes.ts @@ -160,7 +160,6 @@ export const frSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/fr.ts b/packages/platform-objects/src/apps/translations/fr.ts index f974d92e4bb..71b9b02fa85 100644 --- a/packages/platform-objects/src/apps/translations/fr.ts +++ b/packages/platform-objects/src/apps/translations/fr.ts @@ -168,7 +168,6 @@ export const fr: TranslationData = { group_developer: { label: 'Développeur' }, nav_api_console: { label: 'Console API' }, nav_flow_runs: { label: 'Exécutions de flux' }, - nav_public_forms: { label: 'Formulaires publics' }, nav_integrations: { label: 'Intégrations et API' }, group_integration: { label: 'Intégration' }, nav_email_templates: { label: 'Modèles d’e-mail' }, diff --git a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts index c3eab8dcd3d..22759fc409b 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.source-hashes.ts @@ -151,7 +151,6 @@ export const jaJPSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/ja-JP.ts b/packages/platform-objects/src/apps/translations/ja-JP.ts index 646a14e39ac..1117b5d0ada 100644 --- a/packages/platform-objects/src/apps/translations/ja-JP.ts +++ b/packages/platform-objects/src/apps/translations/ja-JP.ts @@ -154,7 +154,6 @@ export const jaJP: TranslationData = { group_developer: { label: '開発者' }, nav_api_console: { label: 'API コンソール' }, nav_flow_runs: { label: 'フロー実行履歴' }, - nav_public_forms: { label: '公開フォーム' }, nav_integrations: { label: '連携と API' }, group_integration: { label: '連携' }, nav_email_templates: { label: 'メールテンプレート' }, diff --git a/packages/platform-objects/src/apps/translations/ko.source-hashes.ts b/packages/platform-objects/src/apps/translations/ko.source-hashes.ts index a735db2ee23..d70aa56d4e2 100644 --- a/packages/platform-objects/src/apps/translations/ko.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ko.source-hashes.ts @@ -160,7 +160,6 @@ export const koSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/ko.ts b/packages/platform-objects/src/apps/translations/ko.ts index 60cdc6b47d6..61f2474c19c 100644 --- a/packages/platform-objects/src/apps/translations/ko.ts +++ b/packages/platform-objects/src/apps/translations/ko.ts @@ -167,7 +167,6 @@ export const ko: TranslationData = { group_developer: { label: '개발자' }, nav_api_console: { label: 'API 콘솔' }, nav_flow_runs: { label: '플로우 실행' }, - nav_public_forms: { label: '공개 양식' }, nav_integrations: { label: '통합 및 API' }, group_integration: { label: '통합' }, nav_email_templates: { label: '이메일 템플릿' }, diff --git a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts index 7e50817018c..ac7f0d5b849 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.source-hashes.ts @@ -160,7 +160,6 @@ export const ptBRSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/pt-BR.ts b/packages/platform-objects/src/apps/translations/pt-BR.ts index a048fcb11d1..61197f64e47 100644 --- a/packages/platform-objects/src/apps/translations/pt-BR.ts +++ b/packages/platform-objects/src/apps/translations/pt-BR.ts @@ -168,7 +168,6 @@ export const ptBR: TranslationData = { group_developer: { label: 'Desenvolvedor' }, nav_api_console: { label: 'Console da API' }, nav_flow_runs: { label: 'Execuções de fluxos' }, - nav_public_forms: { label: 'Formulários públicos' }, nav_integrations: { label: 'Integrações e API' }, group_integration: { label: 'Integração' }, nav_email_templates: { label: 'Modelos de e-mail' }, diff --git a/packages/platform-objects/src/apps/translations/ru.source-hashes.ts b/packages/platform-objects/src/apps/translations/ru.source-hashes.ts index a065482f2d5..d1d84e7fb6f 100644 --- a/packages/platform-objects/src/apps/translations/ru.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/ru.source-hashes.ts @@ -160,7 +160,6 @@ export const ruSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/ru.ts b/packages/platform-objects/src/apps/translations/ru.ts index ce6dd8cc5e2..5126553a8dd 100644 --- a/packages/platform-objects/src/apps/translations/ru.ts +++ b/packages/platform-objects/src/apps/translations/ru.ts @@ -168,7 +168,6 @@ export const ru: TranslationData = { group_developer: { label: 'Разработчик' }, nav_api_console: { label: 'Консоль API' }, nav_flow_runs: { label: 'Запуски потоков' }, - nav_public_forms: { label: 'Публичные формы' }, nav_integrations: { label: 'Интеграции и API' }, group_integration: { label: 'Интеграция' }, nav_email_templates: { label: 'Шаблоны писем' }, diff --git a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts index 1d06995fcc8..37bd167fa6e 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.source-hashes.ts @@ -151,7 +151,6 @@ export const zhCNSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/zh-CN.ts b/packages/platform-objects/src/apps/translations/zh-CN.ts index 2e677c42f8f..7d61dd024bd 100644 --- a/packages/platform-objects/src/apps/translations/zh-CN.ts +++ b/packages/platform-objects/src/apps/translations/zh-CN.ts @@ -161,7 +161,6 @@ export const zhCN: TranslationData = { group_developer: { label: '开发者' }, nav_api_console: { label: 'API 控制台' }, nav_flow_runs: { label: '流程运行记录' }, - nav_public_forms: { label: '公开表单' }, nav_integrations: { label: '集成与 API' }, group_integration: { label: '集成' }, nav_email_templates: { label: '邮件模板' }, diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts index a544b4735a8..83bd403d975 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.source-hashes.ts @@ -159,7 +159,6 @@ export const zhHantSourceHashes: Readonly> = { 'apps.studio.navigation.group_developer.label': '59668ec5af5afb55', 'apps.studio.navigation.nav_api_console.label': 'd90e508f1921e8d3', 'apps.studio.navigation.nav_flow_runs.label': '0bdee1504c505862', - 'apps.studio.navigation.nav_public_forms.label': '4592e97959994e86', 'apps.studio.navigation.nav_integrations.label': 'edbd97d7f401a5b8', 'apps.studio.navigation.group_integration.label': 'a1f2ddfb5c00c83a', 'apps.studio.navigation.nav_email_templates.label': '3463bce831c833d5', diff --git a/packages/platform-objects/src/apps/translations/zh-Hant.ts b/packages/platform-objects/src/apps/translations/zh-Hant.ts index 0d6d24b9705..13ce4bc4960 100644 --- a/packages/platform-objects/src/apps/translations/zh-Hant.ts +++ b/packages/platform-objects/src/apps/translations/zh-Hant.ts @@ -166,7 +166,6 @@ export const zhHant: TranslationData = { group_developer: { label: '開發者' }, nav_api_console: { label: 'API 控制台' }, nav_flow_runs: { label: '流程執行記錄' }, - nav_public_forms: { label: '公開表單' }, nav_integrations: { label: '整合與 API' }, group_integration: { label: '整合' }, nav_email_templates: { label: '郵件範本' }, diff --git a/ui/.claude/skills/objectui-contributor/guides/console-development.md b/ui/.claude/skills/objectui-contributor/guides/console-development.md index fa6a9bebe35..d9a6a005253 100644 --- a/ui/.claude/skills/objectui-contributor/guides/console-development.md +++ b/ui/.claude/skills/objectui-contributor/guides/console-development.md @@ -85,7 +85,7 @@ apps/console/src/pages/ ├── auth/ # Login, register, reset/set password, verify email, │ # OAuth consent, device auth, accept invitation ├── developer/ # DeveloperHubPage, ApiConsolePage, FlowRunsPage, -│ # PublicFormsPage, IntegrationsPage +│ # IntegrationsPage ├── settings/ # SettingsHub + SettingsView (`system/settings/:namespace`) ├── system/ # Admin panel — exactly six pages │ ├── SystemHubPage.tsx # Card-based admin hub (@deprecated — see below) @@ -350,12 +350,13 @@ for the full list and its rationale comments): ``` system -> SystemHubPage system/apps | profile | approvals | ai-approvals | audit-log | settings[/:namespace] -developer[/api-console | flow-runs | public-forms | integrations] +developer[/api-console | flow-runs | integrations] docs[/:slug[/:name]] # Legacy URLs -> the metadata-admin engine (translate the URL, don't revive the page) system/objects[/:objectName] -> ObjectRedirect -> …/metadata/object[/:name] system/metadata[/:type[/:itemName]] -> MetadataRedirect -> …/metadata[/:type[/:name]] +developer/public-forms -> RetiredPublicFormsRedirect -> /studio/~all/metadata/form # Legacy URLs -> framework-owned system objects (objectui#3655) system/users -> SystemObjectRedirect -> …/sys_user diff --git a/ui/apps/console/src/AppContent.tsx b/ui/apps/console/src/AppContent.tsx index c6fac00c367..b79dedbabe0 100644 --- a/ui/apps/console/src/AppContent.tsx +++ b/ui/apps/console/src/AppContent.tsx @@ -33,7 +33,6 @@ const SettingsHub = lazy(() => import('./pages/settings/SettingsHub').then(m => const SettingsView = lazy(() => import('./pages/settings/SettingsView').then(m => ({ default: m.SettingsView }))); const ApiConsolePage = lazy(() => import('./pages/developer/ApiConsolePage').then(m => ({ default: m.ApiConsolePage }))); const FlowRunsPage = lazy(() => import('./pages/developer/FlowRunsPage').then(m => ({ default: m.FlowRunsPage }))); -const PublicFormsPage = lazy(() => import('./pages/developer/PublicFormsPage').then(m => ({ default: m.PublicFormsPage }))); const IntegrationsPage = lazy(() => import('./pages/developer/IntegrationsPage').then(m => ({ default: m.IntegrationsPage }))); // ADR-0048 — package docs are viewed inside their package container: // /apps/:packageId/docs/:name (DocPage is a default export), with an @@ -186,6 +185,22 @@ function SystemCatalogRedirect({ type }: { type: 'position' | 'permission' }) { return ; } +/** + * Forwards the retired `developer/public-forms` page (objectstack#37087) onto + * Studio's list of forms across every package, in the "All metadata" area. + * + * The page listed an environment's public forms and edited each one in a + * dialog. Forms are a metadata type of their own now (ADR-0159): a form is + * designed in Studio's form editor, which that list opens, and its public link + * is switched on or off in Setup → Public forms (D4, D6). The page read no + * query, so `location.search` / `location.hash` are not forwarded. The + * `developer:public-forms` component key lands on the same list + * (`registerDeveloperComponents.tsx`). + */ +function RetiredPublicFormsRedirect() { + return ; +} + /** * The bare `…/system` landing: forwards onto `…/system/settings`, the settings * hub (objectui#3743). @@ -252,7 +267,8 @@ export const systemRoutes = ( below stay for bookmarks and deep links. */} }>} /> }>} /> - }>} /> + {/* objectstack#37087 — the Public Forms page is retired: a bookmark lands on Studio's list of forms. */} + } /> }>} /> {/* ADR-0048 — package docs under the package container: app-scoped index (/apps/:packageId/docs) + single-doc viewer (/apps/:packageId/docs/:name) */} diff --git a/ui/apps/console/src/__tests__/publicFormsRetired-37087.test.tsx b/ui/apps/console/src/__tests__/publicFormsRetired-37087.test.tsx new file mode 100644 index 00000000000..d50b0cd0ea5 --- /dev/null +++ b/ui/apps/console/src/__tests__/publicFormsRetired-37087.test.tsx @@ -0,0 +1,124 @@ +// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. + +/** + * objectstack#37087 — the console's Developer → Public Forms page is retired, + * and both of its addresses land on Studio's list of forms. + * + * The page listed an environment's public forms and edited each one in a + * dialog, reading and writing `view` items. Forms are a metadata type of their + * own now (ADR-0159): a form is designed in Studio's form editor, and its + * public link is switched on or off in Setup → Public forms. So the page, its + * tests and its `console.developer.publicForms.*` keys are gone, and Studio's + * Developer group no longer names it. + * + * What stays is the two addresses a bookmark may carry: + * - the standalone route `/apps//developer/public-forms` (`AppContent`); + * - the component address `/apps//component/developer/public-forms`, + * which the retired navigation entry opened (`registerDeveloperComponents`). + * Each lands, in one hop, on `/studio/~all/metadata/form`: the list of forms + * across every package, where each row opens the form in its own package. + * + * `ChainRecorder` records every location the router settles on, so "one hop" + * is measured, not assumed. The two redirects are the modules' own: the route + * table and the registered component are imported, never transcribed. + * + * CONTROL: the neighbouring developer route still renders a page, so a harness + * that redirected everything would not pass. + */ + +import '@testing-library/jest-dom/vitest'; +import { describe, it, expect, vi } from 'vitest'; +import { render, screen } from '@testing-library/react'; +import { MemoryRouter, Routes, Route, useLocation, useParams } from 'react-router-dom'; + +vi.mock('../pages/developer/IntegrationsPage', () => ({ + IntegrationsPage: () =>
, +})); + +import { getAppComponent, componentRefToUrlSegments } from '@object-ui/app-shell'; +import { systemRoutes } from '../AppContent'; +// Side-effect import: the module under test, imported the way `main.tsx` imports it. +import '../registerDeveloperComponents'; + +/** Where both addresses land: Studio's cross-package list of the `form` type. */ +const FORM_LIST = '/studio/~all/metadata/form'; + +function ChainRecorder({ sink }: { sink: string[] }) { + const location = useLocation(); + const here = `${location.pathname}${location.search}${location.hash}`; + if (sink[sink.length - 1] !== here) sink.push(here); + return null; +} + +function Probe({ id }: { id: string }) { + const params = useParams(); + return
{JSON.stringify(params)}
; +} + +/** The component the registry holds for the retired key, mounted where `ComponentNavView` mounts it. */ +function RegisteredPublicForms() { + const Registered = getAppComponent('developer:public-forms')!.component; + return ; +} + +function renderAt(url: string): string[] { + const chain: string[] = []; + render( + + + + + {systemRoutes} + } /> + + {/* The Studio app the host mounts beside `/apps/*`. */} + } /> + } /> + + , + ); + return chain; +} + +describe('the retired Public Forms page lands on Studio\'s list of forms (objectstack#37087)', () => { + it.each(['studio', 'setup', 'crm'])('the standalone route of app %s redirects there in one hop', async (app) => { + const chain = renderAt(`/apps/${app}/developer/public-forms`); + expect(await screen.findByTestId('studio')).toHaveTextContent(JSON.stringify({ '*': '~all/metadata/form' })); + expect(chain).toEqual([`/apps/${app}/developer/public-forms`, FORM_LIST]); + }); + + it('the component address the retired navigation entry opened redirects there in one hop', async () => { + expect(componentRefToUrlSegments('developer:public-forms')).toEqual(['developer', 'public-forms']); + const chain = renderAt('/apps/studio/component/developer/public-forms'); + expect(await screen.findByTestId('studio')).toHaveTextContent(JSON.stringify({ '*': '~all/metadata/form' })); + expect(chain).toEqual(['/apps/studio/component/developer/public-forms', FORM_LIST]); + expect(screen.queryByText('Component not registered')).not.toBeInTheDocument(); + }); + + it('carries no query and no fragment: the retired page read neither', async () => { + for (const url of ['/apps/studio/developer/public-forms?package=crm&x=1#top', '/apps/studio/component/developer/public-forms?package=crm#top']) { + const chain = renderAt(url); + expect((await screen.findAllByTestId('studio')).length).toBeGreaterThan(0); + expect(chain[chain.length - 1], url).toBe(FORM_LIST); + } + }); + + it('the key stays registered by the console, as a redirect and not a page', () => { + const entry = getAppComponent('developer:public-forms'); + expect(entry).toBeDefined(); + expect(entry?.source).toBe('@object-ui/console'); + }); + + it('the page module and its tests are gone', () => { + expect(Object.keys(import.meta.glob('../pages/developer/PublicFormsPage*'))).toEqual([]); + // CONTROL: the glob reads this directory. + expect(Object.keys(import.meta.glob('../pages/developer/FlowRunsPage.tsx'))).toEqual(['../pages/developer/FlowRunsPage.tsx']); + }); + + it('CONTROL: the neighbouring developer route still renders its page, and nothing redirects it', async () => { + const chain = renderAt('/apps/studio/developer/integrations'); + expect(await screen.findByTestId('integrations-probe')).toBeInTheDocument(); + expect(chain).toEqual(['/apps/studio/developer/integrations']); + expect(screen.queryByTestId('studio')).not.toBeInTheDocument(); + }); +}); diff --git a/ui/apps/console/src/pages/developer/PublicFormsPage.emptyPlaceholderAffordance-8504.test.tsx b/ui/apps/console/src/pages/developer/PublicFormsPage.emptyPlaceholderAffordance-8504.test.tsx deleted file mode 100644 index abc45b308bc..00000000000 --- a/ui/apps/console/src/pages/developer/PublicFormsPage.emptyPlaceholderAffordance-8504.test.tsx +++ /dev/null @@ -1,187 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * The Public Forms table's Object column draws the shared `EmptyValue` - * (objectui#8504). - * - * ## The defect - * - * A form declaring no `object` fell to `—` — no `data-slot`, no - * `aria-label`, none of the shared component's `select-none` / `no-underline` / - * `pointer-events-none`. In a column headed "Object", a screen-reader user - * heard a naked punctuation mark while the row above announced "showcase_task". - * - * ## Reachability was CHECKED before the swap, not assumed - * - * This is the one carrier on the card that lives in `apps/`, not `packages/` — - * an app's dependency tier, not a library's, and outside the packages-only - * `git grep` pathspec every census in the thread used (a glob rooted at - * `packages`, which never sees `apps`). Measured: `@object-ui/components` - * is on `apps/console`'s `devDependencies` (`workspace:*`) and 29 files under - * `apps/console/src` already import from it — this page among them. `EmptyValue` - * joins an import list that was already there; no manifest edge was added, and - * none was needed. - * - * ## Which case DISCRIMINATES — MEASURED, not predicted - * - * The caricature was RUN: the Object cell rewritten to `` - * unconditionally, objects included. Every case goes red, on a different - * assertion: - * - * - `exactly ONE of the two rows draws a placeholder` fails on "and the - * filled row does NOT" — the assertion that fails BECAUSE a filled cell - * gained a placeholder. - * - `NON-REGRESSION` fails one assertion earlier, on "the object reaches the - * cell": the caricature also stops the column printing objects, so its own - * `no placeholder` half is never reached. - * - `THE DEFECT` fails ONLY on its control. Its headline claim — "the - * objectless row has an accessible name" — is equally true of a table that - * has stopped printing objects. - * - * Reverting the fix turns `THE DEFECT` and the one-of-two case red on their - * headline assertions and leaves `NON-REGRESSION` green. - * - * ## The visual delta - * - * `text-muted-foreground` (full opacity) becomes the shared - * `text-muted-foreground/50` — one deliberate step more muted, plus the three - * affordances and the accessible name. The glyph is unchanged. - * - * Assertions are scoped to ONE cell of ONE row (objectui#8495). - */ -import { describe, expect, it, vi, afterEach } from 'vitest'; -import { render, screen, cleanup, waitFor, within } from '@testing-library/react'; -import '@testing-library/jest-dom'; -// The page asks the router where the anonymous route is served (objectui#11769), -// so it renders inside one, as it does in the app. -import { MemoryRouter } from 'react-router-dom'; - -/** - * Two published public forms — one declaring an `object`, one not — on the - * `ViewItem` shape `GET /meta/view` serves: the form under `config`, opened to - * anonymous intake by the server's rule (`sharing.enabled`, `allowAnonymous` - * and a `publicLink`; objectui#11545). - * - * `ViewItemSchema` requires `object`, so the objectless row is not a valid - * ViewItem: it pins how the page draws a served item that names no object, - * which is what the shared placeholder is for. - */ -const { ADAPTER } = vi.hoisted(() => { - const form = (name: string, slug: string, object?: string) => ({ - name, - label: name, - ...(object ? { object } : {}), - viewKind: 'form', - config: { - type: 'simple', - sections: [{ label: 'Task', fields: ['title'] }], - sharing: { enabled: true, allowAnonymous: true, publicLink: `/forms/${slug}` }, - }, - }); - // A STABLE singleton: a fresh object per render loops the page's load effect. - const ADAPTER = { - getClient: () => ({ - meta: { - getItems: async (type: string) => - type === 'view' - ? [ - form('objectless_form', 'objectless'), - form('showcase_task.task_form', 'log-time', 'showcase_task'), - ] - : [], - saveItem: async () => ({ ok: true }), - }, - }), - }; - return { ADAPTER }; -}); - -vi.mock('@object-ui/app-shell', async (importOriginal) => ({ - ...(await importOriginal>()), - useAdapter: () => ADAPTER, -})); -vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); - -// Imported AFTER the mocks so the page picks them up. -import { PublicFormsPage } from './PublicFormsPage'; - -afterEach(cleanup); - -/** The shared placeholder inside ONE element, or null. */ -const emptyIn = (el: HTMLElement): HTMLElement | null => - el.querySelector('[data-slot="empty-value"]'); - -async function mount() { - const { container } = render(, { wrapper: MemoryRouter }); - // `queryByText` THROWS on multiple matches, and the Name cell prints the - // label and the name — so a single-match query never resolves here. - await waitFor(() => - expect(screen.queryAllByText('objectless_form').length).toBeGreaterThan(0), - ); - - const headers = () => - Array.from(container.querySelectorAll('thead th')).map((th) => - (th.textContent ?? '').trim(), - ); - - /** The cell under `header` in the row whose Name cell reads `name`. */ - const cell = (name: string, header: string): HTMLElement => { - const idx = headers().indexOf(header); - expect(idx, `the ${header} column is present — headers were ${JSON.stringify(headers())}`) - .toBeGreaterThanOrEqual(0); - const tr = Array.from(container.querySelectorAll('tbody tr')).find((r) => - (r.textContent ?? '').includes(name), - ); - expect(tr, `the row for ${name} rendered`).toBeTruthy(); - const td = (tr as HTMLElement).querySelectorAll('td')[idx]; - expect(td, `the ${name} row has a cell under ${header}`).toBeTruthy(); - return td as HTMLElement; - }; - return { cell }; -} - -describe('PublicFormsPage object cell uses the shared EmptyValue (objectui#8504)', () => { - it('THE DEFECT — a form declaring no object carries an accessible name', async () => { - const { cell } = await mount(); - const placeholder = emptyIn(cell('objectless_form', 'Object')); - - expect(placeholder, 'the objectless cell draws the shared placeholder').not.toBeNull(); - expect(placeholder, 'and therefore has an accessible name').toHaveAttribute('aria-label'); - expect( - (placeholder as HTMLElement).getAttribute('aria-label'), - 'the name is a word, never a naked punctuation mark', - ).toBe('No value'); - expect((placeholder as HTMLElement).textContent, 'the glyph is unchanged').toBe('—'); - // CONTROL — without this, a table printing NO objects passes above. - expect( - within(cell('task_form', 'Object')).queryByText('showcase_task'), - 'CONTROL: the sibling row still prints its object', - ).not.toBeNull(); - }); - - it('NON-REGRESSION — a form WITH an object renders its badge and NO placeholder', async () => { - const { cell } = await mount(); - const filled = cell('task_form', 'Object'); - - expect(within(filled).queryByText('showcase_task'), 'the object reaches the cell') - .not.toBeNull(); - // THE DISCRIMINATING HALF: red for an EmptyValue-everywhere implementation. - expect(emptyIn(filled), 'a cell with an object carries NO placeholder').toBeNull(); - }); - - it('exactly ONE of the two rows draws a placeholder', () => { - // The assertion order matters, and it was measured. `NON-REGRESSION` above - // fails on its FIRST assertion under the caricature — the object stops - // reaching the cell — so its `no placeholder` half never runs. This case - // reaches that half: the empty row still has one, the filled row must not, - // and the second assertion is the one that fails BECAUSE a filled cell - // gained a placeholder. - return mount().then(({ cell }) => { - expect(emptyIn(cell('objectless_form', 'Object')), 'the empty row has one') - .not.toBeNull(); - expect(emptyIn(cell('task_form', 'Object')), 'and the filled row does NOT') - .toBeNull(); - }); - }); -}); diff --git a/ui/apps/console/src/pages/developer/PublicFormsPage.publicUrlBasename-11769.test.tsx b/ui/apps/console/src/pages/developer/PublicFormsPage.publicUrlBasename-11769.test.tsx deleted file mode 100644 index 242e9a6ea98..00000000000 --- a/ui/apps/console/src/pages/developer/PublicFormsPage.publicUrlBasename-11769.test.tsx +++ /dev/null @@ -1,227 +0,0 @@ -// Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. - -/** - * The Public Forms page offers the anonymous URL the console is served at - * (objectui#11769). - * - * ## The defect - * - * The page built every anonymous URL as `${origin}/console/f/SLUG`: the copied - * URL, the iframe snippet, the React snippet, and the `/console/f/` prefix - * printed beside both slug fields. No host serves the console at `/console/`. - * The framework CLI and cloud mount it at `/_console/` and inject - * ``, which `App.tsx` turns into the router's basename. - * The anonymous route is `/f/:slug` under that basename. A framework-served - * console (`@objectstack/cli` 17.7.0 `serve`) answers `GET /console/f/SLUG` - * with a 404 `ENDPOINT_NOT_FOUND`, and `GET /_console/f/SLUG` with the - * console's HTML. That was measured once, for this card. Nothing here - * re-derives it. - * - * ## What these pins hold - * - * The page asks the router where `/f` lives. So the URL follows the basename it - * renders under, and every surface that shows it shows the same value: - * - * - under `/_console`, the page offers `ORIGIN/_console/f/SLUG`; - * - on a root-mounted console it offers `ORIGIN/f/SLUG`; - * - nested under the metadata-driven entry - * (`/apps/APP/component/developer/public-forms`), the URL does not take on - * that route's depth; - * - the link, the copied URL, the URL inside both snippets and the two - * slug-field prefixes agree. - * - * The router is `BrowserRouter`, as in `App.tsx`, so `useHref` resolves through - * the same navigator the shipped app uses. - */ -import { describe, expect, it, vi, beforeEach, afterEach } from 'vitest'; -import { render, screen, cleanup, waitFor, within, fireEvent } from '@testing-library/react'; -import '@testing-library/jest-dom'; -import { BrowserRouter, Routes, Route } from 'react-router-dom'; - -/** One published public form, and one FormView not yet published (so the - * Publish dialog, which needs a candidate, can be opened), on the `ViewItem` - * shape `GET /meta/view` serves: the form under `config` (objectui#11545). */ -const { ADAPTER, METADATA_CLIENT } = vi.hoisted(() => { - const form = (name: string, sharing?: Record) => ({ - name, - label: name, - object: 'lead', - viewKind: 'form', - config: { - type: 'simple', - sections: [{ label: 'Lead', fields: ['email'] }], - ...(sharing ? { sharing } : {}), - }, - }); - // A STABLE singleton: a fresh object per render loops the page's load effect. - const ADAPTER = { - getClient: () => ({ - meta: { - getItems: async (type: string) => - type === 'view' - ? [ - form('lead.contact_us', { - enabled: true, - allowAnonymous: true, - publicLink: '/forms/contact-us', - }), - form('lead.internal'), - ] - : [], - saveItem: async () => ({ ok: true }), - }, - }), - }; - // objectstack#35054 — the writers (and the Edit dialog's prefill) start - // from the layered read: here the stored item is the served one, read from - // the same list (no translation in play). - const METADATA_CLIENT = { - layered: async (_type: string, name: string) => { - const listed: any = await ADAPTER.getClient().meta.getItems('view'); - const items: any[] = Array.isArray(listed) ? listed : listed?.items ?? []; - const found = items.find((i) => i?.name === name) ?? null; - return { code: null, overlay: found, overlayScope: found ? 'env' : null, effective: found }; - }, - }; - return { ADAPTER, METADATA_CLIENT }; -}); - -vi.mock('@object-ui/app-shell', async (importOriginal) => ({ - ...(await importOriginal>()), - useAdapter: () => ADAPTER, - useMetadataClient: () => METADATA_CLIENT, -})); -vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); - -// Imported AFTER the mocks so the page picks them up. -import { PublicFormsPage } from './PublicFormsPage'; - -const SLUG = 'contact-us'; - -/** - * Where the console is mounted. `basename` is what `App.tsx` resolves from the - * injected ``; `at` is the route the page is reached through. - */ -const MOUNTS = [ - { - name: 'a /_console mount (framework CLI and cloud)', - basename: '/_console', - at: '/developer/public-forms', - nested: false, - path: '/_console/f/contact-us', - prefix: '/_console/f/', - }, - { - name: 'a root-mounted console', - basename: '/', - at: '/developer/public-forms', - nested: false, - path: '/f/contact-us', - prefix: '/f/', - }, - { - name: 'a /_console mount, reached through the metadata-driven component route', - basename: '/_console', - at: '/apps/crm/component/developer/public-forms', - nested: true, - path: '/_console/f/contact-us', - prefix: '/_console/f/', - }, -] as const; - -type Mount = (typeof MOUNTS)[number]; - -let writeText: ReturnType; - -beforeEach(() => { - writeText = vi.fn(async () => undefined); - Object.defineProperty(window.navigator, 'clipboard', { - configurable: true, - value: { writeText }, - }); -}); - -afterEach(() => { - cleanup(); - window.history.replaceState({}, '', '/'); -}); - -async function renderUnder(mount: Mount) { - const entry = `${mount.basename === '/' ? '' : mount.basename}${mount.at}`; - window.history.replaceState({}, '', entry); - render( - - {mount.nested ? ( - - } /> - - ) : ( - - )} - , - ); - // The row exists once the listing has loaded. - await screen.findByRole('button', { name: /Edit sharing & post-submit behavior/i }); -} - -/** Click one copy action and return exactly what it put on the clipboard. */ -async function copiedBy(title: string): Promise { - const before = writeText.mock.calls.length; - fireEvent.click(screen.getByTitle(title)); - await waitFor(() => expect(writeText.mock.calls.length).toBe(before + 1)); - return writeText.mock.calls[before][0] as string; -} - -/** The prefix printed beside the open dialog's slug field. */ -function slugFieldPrefix(): string { - const field = screen.getByLabelText('URL slug'); - return (field.parentElement?.textContent ?? '').trim(); -} - -describe.each(MOUNTS)('Public Forms URL under $name (objectui#11769)', (mount) => { - it('offers ORIGIN + basename + /f/SLUG as the link and the copied URL', async () => { - await renderUnder(mount); - const expected = `${window.location.origin}${mount.path}`; - - const link = screen.getByText(expected).closest('a'); - expect(link).not.toBeNull(); - expect(link).toHaveAttribute('href', expected); - - const url = await copiedBy('Copy URL'); - expect(url).toBe(expected); - expect(new URL(url).pathname).toBe(mount.path); - }); - - it('puts exactly the copied URL inside both snippets', async () => { - await renderUnder(mount); - const url = await copiedBy('Copy URL'); - - const iframe = await copiedBy('Copy `; - const formatReact = (slug: string) => - ``; - - /** `label` is the whole translated toast ("Copied URL"). */ - const copy = async (label: string, value: string) => { - try { - await navigator.clipboard.writeText(value); - toast.success(label); - } catch { - toast.error(t('console.developer.publicForms.clipboardUnavailable', { defaultValue: 'Clipboard unavailable' })); - } - }; - - const publish = async () => { - if (!publishView || !publishSlug) return; - const cand = publishable.find((p) => p.name === publishView); - if (!cand) return; - const slug = sanitizeSlug(publishSlug); - if (!slug) { - toast.error(t('console.developer.publicForms.invalidSlug', { defaultValue: 'Invalid slug' })); - return; - } - setPublishing(true); - try { - // The form body is the STORED item's `config` (module header). - const stored = await readStoredFormView(cand.name); - const config = stored.form; - const next = { - ...stored.item, - config: { - ...config, - sharing: { - ...(config.sharing ?? {}), - enabled: true, - allowAnonymous: true, - publicLink: `/forms/${slug}`, - }, - }, - }; - await client.meta.saveItem('view', cand.name, next); - toast.success(t('console.developer.publicForms.published', { defaultValue: 'Published {{name}}', name: cand.name })); - setPublishOpen(false); - setPublishView(''); - setPublishSlug(''); - await load(); - } catch (e: any) { - toast.error(t('console.developer.publicForms.publishFailed', { defaultValue: 'Publish failed: {{message}}', message: formatMetadataError(e) })); - } finally { - setPublishing(false); - } - }; - - const openEditor = async (row: PublicFormRow) => { - // The dialog edits the stored form (module header): its thank-you text is - // prefilled from the stored `submitBehavior`, never the served one. The - // slug is the served rule's, which reads no translated key. - let stored: StoredFormView; - try { - stored = await readStoredFormView(row.name); - } catch (e: any) { - toast.error(t('console.developer.publicForms.saveFailed', { defaultValue: 'Save failed: {{message}}', message: formatMetadataError(e) })); - return; - } - setEditRow({ ...stored, label: row.label }); - setEditSlug(row.slug); - const sb = stored.form.submitBehavior; - const kind = (sb?.kind as any) ?? 'thank-you'; - setEditBehavior(kind); - setEditBehaviorTitle(sb?.title ?? ''); - setEditBehaviorMessage(sb?.message ?? ''); - setEditBehaviorUrl(sb?.url ?? ''); - setEditUrlRefusal(null); - setEditOpen(true); - }; - - const saveEdit = async () => { - if (!editRow) return; - const slug = sanitizeSlug(editSlug); - if (!slug) { - toast.error(t('console.developer.publicForms.invalidSlug', { defaultValue: 'Invalid slug' })); - return; - } - setEditUrlRefusal(null); - let submitBehavior: any; - switch (editBehavior) { - case 'thank-you': - submitBehavior = { kind: 'thank-you' }; - if (editBehaviorTitle) submitBehavior.title = editBehaviorTitle; - if (editBehaviorMessage) submitBehavior.message = editBehaviorMessage; - break; - case 'redirect': { - // The contract's verdict, not this dialog's: empty is one of the seven - // families the spec refuses, so it comes back through here too rather - // than keeping a local `required` message that says less. - const verdict = checkSubmitRedirectUrl(editBehaviorUrl); - if (!verdict.ok) { - setEditUrlRefusal(verdict.refusal); - return; - } - // The value the schema accepted, so a future normalisation in the spec - // is what gets saved — the same read-back the renderer does. - submitBehavior = { kind: 'redirect', url: verdict.url }; - break; - } - case 'continue': - case 'next-record': - submitBehavior = { kind: editBehavior }; - break; - } - // `sharing` and `submitBehavior` both belong to the form, which on a - // ViewItem is its `config`: the stored one the dialog was opened on - // (module header). - const form = editRow.form; - const next = { - ...editRow.item, - config: { - ...form, - sharing: { - ...(form.sharing ?? {}), - enabled: true, - allowAnonymous: true, - publicLink: `/forms/${slug}`, - }, - submitBehavior, - }, - }; - setSaving(true); - try { - await client.meta.saveItem('view', editRow.name, next); - toast.success(t('console.developer.publicForms.saved', { defaultValue: 'Saved {{name}}', name: editRow.name })); - setEditOpen(false); - setEditRow(null); - await load(); - } catch (e: any) { - toast.error(t('console.developer.publicForms.saveFailed', { defaultValue: 'Save failed: {{message}}', message: formatMetadataError(e) })); - } finally { - setSaving(false); - } - }; - - const hasRows = rows.length > 0; - - const behaviorLabels: Record = { - 'thank-you': t('console.developer.publicForms.behaviorThankYou', { defaultValue: 'Show a thank-you panel' }), - redirect: t('console.developer.publicForms.behaviorRedirect', { defaultValue: 'Redirect to a URL' }), - continue: t('console.developer.publicForms.behaviorContinue', { defaultValue: 'Reset for another response' }), - 'next-record': t('console.developer.publicForms.behaviorNextRecord', { defaultValue: 'Advance to next record (internal queues)' }), - }; - const submitBehaviorOptions = SUBMIT_BEHAVIOR_KINDS.map((value) => ({ value, label: behaviorLabels[value] })); - const publishLabel = t('console.developer.publicForms.publishButton', { defaultValue: 'Publish form…' }); - - return ( -
- - -
- - - {t('console.developer.publicForms.title', { defaultValue: 'Public Forms' })} - - - {t('console.developer.publicForms.description', { - defaultValue: - 'Forms anyone can fill out — no login required. Publish a form to get a shareable link; submissions land directly in the bound object.', - })} - -
-
- - -
-
- - {error && ( -
- {error} -
- )} - {!loading && !hasRows && ( -
-

{t('console.developer.publicForms.emptyTitle', { defaultValue: 'No public forms yet' })}

-

- {withSlots( - t('console.developer.publicForms.emptyBody', { - defaultValue: - 'Click {{action}} above to share an existing form, or build a new one in Views & Apps and mark it public.', - action: SLOT[0], - }), - [{publishLabel}], - )} -

-
- )} - {hasRows && ( - - - - {t('console.developer.publicForms.columnName', { defaultValue: 'Name' })} - {t('console.developer.publicForms.columnObject', { defaultValue: 'Object' })} - {t('console.developer.publicForms.columnSlug', { defaultValue: 'Slug' })} - {t('console.developer.publicForms.columnPublicUrl', { defaultValue: 'Public URL' })} - {t('common.actions', { defaultValue: 'Actions' })} - - - - {rows.map((row) => { - const url = formatPublicUrl(row.slug); - return ( - - -
- {row.label ?? row.name} - {row.name} -
-
- - {row.object ? ( - {row.object} - ) : ( - - )} - - - {row.slug} - - - - {url} - - - - -
- - - - -
-
-
- ); - })} -
-
- )} -
-
- - - - - {t('console.developer.publicForms.publishDialogTitle', { defaultValue: 'Publish a FormView' })} - - {withSlots( - t('console.developer.publicForms.publishDialogDescription', { - defaultValue: - 'Pick an existing FormView to open it to anonymous visitors. Publishing sets {{enabled}}, {{allowAnonymous}} and {{publicLink}} in its config: the public form route serves a form only when all three are set.', - enabled: SLOT[0], - allowAnonymous: SLOT[1], - publicLink: SLOT[2], - }), - [ - sharing.enabled, - sharing.allowAnonymous, - sharing.publicLink, - ], - )} - - -
-
- - ({ - value: p.name, - label: `${p.label ?? p.name} (${p.name}) ${p.object ? `· ${p.object}` : ''}`, - })), - ]} - onPick={setPublishView} - /> -
-
- -
- {`${publicFormPath}/`} - setPublishSlug(e.target.value)} - /> -
-

- {t('console.developer.publicForms.slugHint', { defaultValue: 'Lowercase letters, digits, dashes and underscores only.' })} -

-
-
- - - - -
-
- - - - - - {editRow - ? t('console.developer.publicForms.editTitle', { defaultValue: 'Edit {{name}}', name: editRow.label ?? editRow.name }) - : t('console.developer.publicForms.editTitleFallback', { defaultValue: 'Edit form' })} - - - {t('console.developer.publicForms.editDescription', { defaultValue: 'Configure the public URL and what happens after submit.' })} - - -
-
- -
- {`${publicFormPath}/`} - setEditSlug(e.target.value)} - /> -
-
-
- - { - setEditBehavior(kind); - setEditUrlRefusal(null); - }} - /> -
- {editBehavior === 'thank-you' && ( - <> -
- - setEditBehaviorTitle(e.target.value)} - /> -
-
- - setEditBehaviorMessage(e.target.value)} - /> -
- - )} - {editBehavior === 'redirect' && ( -
- - {/* - Not `type="url"`: that type's own notion of valid is an - ABSOLUTE URL, which is the one thing this key refuses, so it - pulled the author the wrong way — as did the former - `https://example.com/thanks` placeholder. - */} - { - setEditBehaviorUrl(e.target.value); - setEditUrlRefusal(null); - }} - aria-invalid={editUrlRefusal ? true : undefined} - aria-describedby={editUrlRefusal ? 'edit-url-refusal' : 'edit-url-hint'} - /> - {editUrlRefusal ? ( - - ) : ( -

- {withSlots( - t('console.developer.publicForms.redirectHint', { - defaultValue: - 'An in-app path, starting with {{slash}} — interpolate a field of the submitted record as {{token}}. To send the browser out of the app, use an app navigation item instead.', - slash: SLOT[0], - token: SLOT[1], - }), - [/, {'{{record.field_name}}'}], - )} -

- )} -
- )} -
- - - - -
-
-
- ); -} diff --git a/ui/apps/console/src/pages/developer/consolePagesLocale-13460.test.tsx b/ui/apps/console/src/pages/developer/consolePagesLocale-13460.test.tsx index cb289741074..19751f2d188 100644 --- a/ui/apps/console/src/pages/developer/consolePagesLocale-13460.test.tsx +++ b/ui/apps/console/src/pages/developer/consolePagesLocale-13460.test.tsx @@ -1,12 +1,17 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * objectui#13460 — four routed console pages speak the session's language. + * objectui#13460 — three routed console pages speak the session's language. * - * Developer → API Console, Developer → Public Forms, Developer → Integrations & - * APIs and System → AI Approvals imported nothing from `@object-ui/i18n`, so a - * zh / ja / ar operator got an English page. They now read - * `console.developer.*` / `console.system.*` keys. + * Developer → API Console, Developer → Integrations & APIs and System → AI + * Approvals imported nothing from `@object-ui/i18n`, so a zh / ja / ar + * operator got an English page. They now read `console.developer.*` / + * `console.system.*` keys. + * + * The card's fourth page, Developer → Public Forms, is retired with its + * `console.developer.publicForms.*` keys (objectstack#37087): a form is + * designed in Studio's form editor and its public link is switched in Setup → + * Public forms, and both read their own keys. * * What this file pins, through the real pages and a real `I18nProvider`: * - under zh each page draws its heading and a sample of its copy from the @@ -51,7 +56,6 @@ vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); // Imported after the mocks so the pages pick them up. import { ApiConsolePage } from './ApiConsolePage'; -import { PublicFormsPage } from './PublicFormsPage'; import { IntegrationsPage } from './IntegrationsPage'; import { AiPendingActionsPage } from '../system/AiPendingActionsPage'; @@ -97,7 +101,6 @@ describe('console pages under zh (objectui#13460)', () => { it('guard: the zh values read below are real zh rows, not English copies', () => { for (const [zhValue, enValue] of [ [zhDev.apiConsole.endpointsTitle, enDev.apiConsole.endpointsTitle], - [zhDev.publicForms.title, enDev.publicForms.title], [zhDev.integrations.title, enDev.integrations.title], [zhSys.aiApprovals.title, en.console.system.aiApprovals.title], ]) { @@ -118,18 +121,6 @@ describe('console pages under zh (objectui#13460)', () => { expect(container.textContent).not.toMatch(LEAK); }); - it('Public Forms: the card, the empty state with its action in place, and the toolbar', async () => { - const { container } = page(, 'zh'); - expect(await screen.findByText(zhDev.publicForms.emptyTitle)).toBeTruthy(); - expect(screen.getByText(zhDev.publicForms.title)).toBeTruthy(); - expect(screen.getByRole('button', { name: zhDev.publicForms.publishButton })).toBeTruthy(); - const strong = screen.getByText(zhDev.publicForms.publishButton, { selector: 'strong' }); - expect(strong.parentElement!.textContent).toBe( - zhDev.publicForms.emptyBody.replace('{{action}}', zhDev.publicForms.publishButton), - ); - expect(container.textContent).not.toMatch(LEAK); - }); - it('Integrations & APIs: the header, the cards, and the auth sentence with its three elements', async () => { const { container } = page(, 'zh'); expect(await screen.findByText(zhDev.integrations.noObjects)).toBeTruthy(); @@ -163,14 +154,6 @@ describe('control: with no provider each page reads its English (objectui#13460) expect(strong.parentElement!.textContent).toBe('Select an endpoint or type a URL and click Send'); }); - it('Public Forms', async () => { - page(, null); - const strong = await screen.findByText('Publish form…', { selector: 'strong' }); - expect(strong.parentElement!.textContent).toBe( - 'Click Publish form… above to share an existing form, or build a new one in Views & Apps and mark it public.', - ); - }); - it('Integrations & APIs', async () => { page(, null); const action = await screen.findByText('Open API Console', { selector: 'strong' }); diff --git a/ui/apps/console/src/pages/developer/developerMetadataEnvelope.contractEnvelope-6917.test.tsx b/ui/apps/console/src/pages/developer/developerMetadataEnvelope.contractEnvelope-6917.test.tsx index 4c2c0778044..708a3696b7e 100644 --- a/ui/apps/console/src/pages/developer/developerMetadataEnvelope.contractEnvelope-6917.test.tsx +++ b/ui/apps/console/src/pages/developer/developerMetadataEnvelope.contractEnvelope-6917.test.tsx @@ -1,8 +1,13 @@ // Copyright (c) 2026 ObjectStack. Licensed under the Apache-2.0 license. /** - * The two developer pages read a `client.meta.getItems()` answer as the - * metadata API DECLARES it — and do NOT read `value` (objectui#6917 arm B). + * A developer page reads a `client.meta.getItems()` answer as the metadata API + * DECLARES it — and does NOT read `value` (objectui#6917 arm B). + * + * The card fixed two pages, Flow Runs and Public Forms. Public Forms is + * retired (objectstack#37087: a form is a `form` item, designed in Studio and + * switched in Setup, whose readers have their own tests), so Flow Runs is the + * page pinned here. The census below is the card's, taken over both. * * ── The seam is NOT `DataSource.find()`, and that changed the measurement ── * objectui#6917 filed these two sites as "the same arm objectui#6840 removed", @@ -41,12 +46,9 @@ import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest'; import { render, screen, cleanup, waitFor } from '@testing-library/react'; -// The page asks the router where the anonymous route is served (objectui#11769), -// so it renders inside one, as it does in the app. -import { MemoryRouter } from 'react-router-dom'; /** - * One mutable answer, read by BOTH pages' `meta.getItems`. A stable singleton + * One mutable answer, read by the page's `meta.getItems`. A stable singleton * adapter: a fresh object per render loops the pages' load effects. Its client * is a singleton too, as the real adapter's `getClient()` is: Flow Runs keys its * flow and run loads on the client, so a fresh one per call re-ran them on @@ -73,9 +75,8 @@ vi.mock('@object-ui/app-shell', async (importOriginal) => ({ })); vi.mock('sonner', () => ({ toast: { success: vi.fn(), error: vi.fn() } })); -// Imported AFTER the mocks so the pages pick them up. +// Imported AFTER the mocks so the page picks them up. import { FlowRunsPage } from './FlowRunsPage'; -import { PublicFormsPage } from './PublicFormsPage'; /** A flow definition, as `meta.getItems('flow')` rows carry it: the item IS * the definition, flattened, with no `spec` member (objectui#12829). */ @@ -85,21 +86,6 @@ const FLOW = { variables: [{ name: 'recordId', type: 'text', isInput: true }], }; -/** A published public form, on the `ViewItem` shape `GET /meta/view` serves: - * the form under `config`, opened to anonymous intake by the server's rule - * (`sharing.enabled`, `allowAnonymous` and a `publicLink`; objectui#11545). */ -const FORM = { - name: 'showcase_task.public', - label: 'Log Time', - object: 'showcase_task', - viewKind: 'form', - config: { - type: 'simple', - sections: [{ label: 'Task', fields: ['title'] }], - sharing: { enabled: true, allowAnonymous: true, publicLink: '/forms/log-time' }, - }, -}; - beforeEach(() => { state.answer = []; }); @@ -143,30 +129,3 @@ describe('FlowRunsPage — meta.getItems envelope (objectui#6917)', () => { }); }); }); - -describe('PublicFormsPage — meta.getItems envelope (objectui#6917)', () => { - it("still reads the envelope's `items` member", async () => { - state.answer = { items: [FORM] }; - render(, { wrapper: MemoryRouter }); - await waitFor(() => { - expect(screen.getByText('Log Time')).toBeInTheDocument(); - }); - }); - - it('still reads a bare array', async () => { - state.answer = [FORM]; - render(, { wrapper: MemoryRouter }); - await waitFor(() => { - expect(screen.getByText('Log Time')).toBeInTheDocument(); - }); - }); - - it('does NOT read `value` — not a member of this envelope', async () => { - state.answer = { value: [FORM] }; - render(, { wrapper: MemoryRouter }); - await waitFor(() => { - expect(screen.getByText('No public forms yet')).toBeInTheDocument(); - }); - expect(screen.queryByText('Log Time')).not.toBeInTheDocument(); - }); -}); diff --git a/ui/apps/console/src/registerDeveloperComponents.tsx b/ui/apps/console/src/registerDeveloperComponents.tsx index 5d11bc4c630..f514ae19b7e 100644 --- a/ui/apps/console/src/registerDeveloperComponents.tsx +++ b/ui/apps/console/src/registerDeveloperComponents.tsx @@ -5,7 +5,7 @@ * * Binds the `developer:*` registry keys to the lazy-loaded console pages * that already host these tools. The framework's Studio app names the first - * three from its Developer navigation group. + * two from its Developer navigation group. * * URL shape resolved by `ComponentNavView`: * developer:api-console → /apps//component/developer/api-console @@ -13,6 +13,13 @@ * developer:public-forms → /apps//component/developer/public-forms * developer:integrations → /apps//component/developer/integrations * + * `developer:public-forms` (objectstack#37087) is no page any more. The + * Public Forms page it opened is retired: a public form is a `form` item + * designed in Studio's form editor and switched on or off in Setup → Public + * forms (ADR-0159 D4, D6). No navigation names the key; it stays registered + * so that a bookmark of its address lands on Studio's list of forms, as the + * standalone `developer/public-forms` route in `AppContent.tsx` does. + * * `developer:integrations` (objectui#10520): the Integrations & APIs page * was linked from exactly one place, a card on the console's Developer Hub * page, and that hub had no in-app link of its own once the System Hub card @@ -30,7 +37,8 @@ */ import { lazy, Suspense } from 'react'; -import { registerAppComponent } from '@object-ui/app-shell'; +import { Navigate } from 'react-router-dom'; +import { SETUP_PACKAGES_PATH, registerAppComponent, setupMetadataStudioPath } from '@object-ui/app-shell'; const ApiConsolePage = lazy(() => import('./pages/developer/ApiConsolePage').then((m) => ({ default: m.ApiConsolePage })), @@ -38,9 +46,6 @@ const ApiConsolePage = lazy(() => const FlowRunsPage = lazy(() => import('./pages/developer/FlowRunsPage').then((m) => ({ default: m.FlowRunsPage })), ); -const PublicFormsPage = lazy(() => - import('./pages/developer/PublicFormsPage').then((m) => ({ default: m.PublicFormsPage })), -); const IntegrationsPage = lazy(() => import('./pages/developer/IntegrationsPage').then((m) => ({ default: m.IntegrationsPage })), ); @@ -71,15 +76,15 @@ registerAppComponent({ ), }); +// objectstack#37087 — the retired Public Forms page. A bookmark of its address +// lands on Studio's list of forms across every package, where each row opens +// the form in its own package. The retired page read no query, so none is +// carried. The standalone route in `AppContent.tsx` lands on the same list. registerAppComponent({ ref: 'developer:public-forms', label: 'Public Forms', source: '@object-ui/console', - component: (props: any) => ( - }> - - - ), + component: () => , }); registerAppComponent({ diff --git a/ui/packages/app-shell/src/views/metadata-admin/directoryScope.ts b/ui/packages/app-shell/src/views/metadata-admin/directoryScope.ts index e62307771ea..179bab90fcd 100644 --- a/ui/packages/app-shell/src/views/metadata-admin/directoryScope.ts +++ b/ui/packages/app-shell/src/views/metadata-admin/directoryScope.ts @@ -10,13 +10,14 @@ import { ENVIRONMENT_AREA_TYPES } from './metadataAreaHost.js'; /** * Types never listed. `field` is edited inside its object; `package` is the - * scope container itself, with its own management surface. `form` (ADR-0159 - * card ②, objectstack#37086) has no designer, menu placement or ADR-0084 row - * yet: card ③ (objectstack#37087) brings all three and takes it off this set. - * Its forms are still served and judged; only Studio's directory and menu - * leave the type out. + * scope container itself, with its own management surface. + * + * `form` was on this set while the type had no designer, menu placement or + * ADR-0084 row (ADR-0159 card ②, objectstack#37086). Card ③ + * (objectstack#37087) brought all three, so the directory and the menu list + * the type like any other. */ -export const HIDDEN_DIRECTORY_TYPES: ReadonlySet = new Set(['field', 'package', 'form']); +export const HIDDEN_DIRECTORY_TYPES: ReadonlySet = new Set(['field', 'package']); /** * The served type entries a directory lists, in served order: diff --git a/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.test.tsx b/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.test.tsx index 3197c24781c..f31f21cbbab 100644 --- a/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.test.tsx +++ b/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.test.tsx @@ -225,4 +225,108 @@ describe('PublicFormsSetupPage', () => { } warn.mockRestore(); }); + + describe('[#37087] a switch-on refused because another form holds the address (409 FORM_ADDRESS_TAKEN)', () => { + /** The server's refusal, as the metadata client throws it. */ + const addressTaken = () => + Object.assign( + new Error( + "The form 'web_to_lead' cannot open the public address '/forms/contact-us': the form 'crm_lead.newsletter' of the package 'crm' holds it.", + ), + { status: 409, code: 'FORM_ADDRESS_TAKEN' }, + ); + /** The form that holds the address: on, at the same slug. */ + const holder = (extra: Record = {}) => + form(true, { name: 'crm_lead.newsletter', label: 'Newsletter signup', title: 'Newsletter signup', ...extra }); + + const said = () => ((fake.toast.error as ReturnType).mock.calls[0] as [string])[0]; + + it('names both forms: the one being switched on and the one that holds its address', async () => { + fake.items = [form(false), holder()]; + fake.layered = () => ({ code: form(false), effective: form(false) }); + fake.packages.set('crm', { writable: true, manifest: { id: 'crm' } }); + fake.save = async () => { + throw addressTaken(); + }; + const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined); + render(, { wrapper: host(ADMIN) }); + const row = await screen.findByTestId('public-form-row-web_to_lead'); + expect(row).toHaveAttribute('data-on', 'false'); + fake.listed = []; + fireEvent.click(screen.getByTestId('public-form-switch-web_to_lead')); + await waitFor(() => expect(fake.toast.error).toHaveBeenCalledTimes(1)); + // One sentence, both names: the switched form in the frame, the holder in the reason. + expect(said()).toBe( + '«publicFormsSetup.switchFailed» ' + + JSON.stringify({ name: 'Contact us', message: '«publicFormsSetup.refusalAddressTaken» {"holder":"Newsletter signup"}' }), + ); + // Never the server's own message; that goes to the console log. + expect(said()).not.toContain('cannot open the public address'); + expect(said()).not.toContain('refusalServer'); + expect(warn).toHaveBeenCalled(); + // The holder is read from the environment's forms, again, after the refusal. + expect(fake.listed).toEqual(['form']); + // Nothing was switched: the row stays off and no success is said. + expect(fake.toast.success).not.toHaveBeenCalled(); + expect(screen.getByTestId('public-form-row-web_to_lead')).toHaveAttribute('data-on', 'false'); + await waitFor(() => expect(screen.getByTestId('public-form-switch-web_to_lead')).not.toBeDisabled()); + warn.mockRestore(); + }); + + it('two forms shown under one name are told apart by the holder\'s item name', async () => { + fake.items = [form(false), holder({ label: 'Contact us', title: 'Contact us' })]; + fake.layered = () => ({ code: form(false), effective: form(false) }); + fake.packages.set('crm', { writable: true, manifest: { id: 'crm' } }); + fake.save = async () => { + throw addressTaken(); + }; + const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined); + render(, { wrapper: host(ADMIN) }); + fireEvent.click(await screen.findByTestId('public-form-switch-web_to_lead')); + await waitFor(() => expect(fake.toast.error).toHaveBeenCalledTimes(1)); + expect(said()).toContain('«publicFormsSetup.refusalAddressTaken» {\\"holder\\":\\"Contact us (crm_lead.newsletter)\\"}'); + warn.mockRestore(); + }); + + it('with no holder read, says another form holds the address and names none, never the generic server sentence', async () => { + const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined); + for (const how of ['the forms read again hold no other form at the address', 'the second read fails'] as const) { + (fake.toast.error as ReturnType).mockClear(); + fake.listFails = null; + fake.items = [form(false)]; + fake.layered = () => ({ code: form(false), effective: form(false) }); + fake.packages.set('crm', { writable: true, manifest: { id: 'crm' } }); + fake.save = async () => { + if (how === 'the second read fails') fake.listFails = 'ECONNRESET'; + throw addressTaken(); + }; + const { unmount } = render(, { wrapper: host(ADMIN) }); + fireEvent.click(await screen.findByTestId('public-form-switch-web_to_lead')); + await waitFor(() => expect(fake.toast.error).toHaveBeenCalledTimes(1)); + expect(said(), how).toBe( + '«publicFormsSetup.switchFailed» ' + + JSON.stringify({ name: 'Contact us', message: '«publicFormsSetup.refusalAddressTakenUnknown»' }), + ); + expect(said(), how).not.toContain('ECONNRESET'); + unmount(); + } + warn.mockRestore(); + }); + + it('CONTROL: another 409 is not read as an address clash', async () => { + fake.items = [form(false), holder()]; + fake.layered = () => ({ code: form(false), effective: form(false) }); + fake.packages.set('crm', { writable: true, manifest: { id: 'crm' } }); + fake.save = async () => { + throw Object.assign(new Error('conflict'), { status: 409, code: 'SOMETHING_ELSE' }); + }; + const warn = vi.spyOn(console, 'warn').mockImplementation(() => undefined); + render(, { wrapper: host(ADMIN) }); + fireEvent.click(await screen.findByTestId('public-form-switch-web_to_lead')); + await waitFor(() => expect(fake.toast.error).toHaveBeenCalledTimes(1)); + expect(said()).toContain('«publicFormsSetup.refusalServer»'); + expect(said()).not.toContain('refusalAddressTaken'); + warn.mockRestore(); + }); + }); }); diff --git a/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.tsx b/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.tsx index 2f942e20b6e..4db340776e1 100644 --- a/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.tsx +++ b/ui/packages/app-shell/src/views/setup/PublicFormsSetupPage.tsx @@ -15,6 +15,11 @@ * changed) in Studio. Which forms are listed and where a switch is saved are * `publicForms.ts`'s. * + * A switch-on the server refuses because another form holds the address + * (`409 FORM_ADDRESS_TAKEN`) is said with both names: the form being switched + * on and the form that holds its address (objectstack#37087). The holder is + * read from the environment's forms, by `publicForms.ts`'s rule. + * * The address is the router's answer for the anonymous form route `/f/:slug` * (`useHref`, which prefixes the console's basename), as Studio's page builds * it (objectui#11769), so it follows the mount the console runs under. @@ -49,9 +54,12 @@ import { AUTHORING_CAPABILITY } from '../../hooks/useCanAuthorMetadata.js'; import { PUBLIC_FORMS_CAPABILITY } from './publicFormsRef.js'; import { PublicFormSwitchRefusal, + isAddressTakenRefusal, markShippedOff, + publicAddressHolderOf, publicFormRowsOf, switchPublicForm, + type PublicAddressHolder, type PublicFormRow, } from './publicForms.js'; @@ -85,6 +93,18 @@ function serverRefusalText(t: Translate, err: unknown): string { return t('publicFormsSetup.refusalServer'); } +/** + * The sentence for a switch-on refused because another form holds the address: + * it names that form, by the name the list shows it under. Two forms shown + * under one name are told apart by the holder's item name. With no holder + * read, it says another form holds the address, and names none. + */ +function addressTakenText(t: Translate, row: PublicFormRow, holder: PublicAddressHolder | null): string { + if (!holder) return t('publicFormsSetup.refusalAddressTakenUnknown'); + const shown = holder.title === row.title ? `${holder.title} (${holder.name})` : holder.title; + return t('publicFormsSetup.refusalAddressTaken', { holder: shown }); +} + type Read = { kind: 'loading' } | { kind: 'failed' } | { kind: 'ready'; rows: PublicFormRow[] }; export function PublicFormsSetupPage() { @@ -167,6 +187,18 @@ function PublicFormsSetupBody() { } }; + /** The other form that holds `row`'s address, read from the environment's forms; `null` when none is read. */ + const readAddressHolder = async (row: PublicFormRow): Promise => { + try { + const client: any = (adapter as any)?.getClient?.(); + if (!client?.meta?.getItems) return null; + return publicAddressHolderOf(await client.meta.getItems('form'), row); + } catch (err) { + console.warn('[public forms] address holder read failed:', formatMetadataError(err)); + return null; + } + }; + const flip = async (row: PublicFormRow, on: boolean) => { setBusy(row.name); try { @@ -188,6 +220,13 @@ function PublicFormsSetupBody() { ); setNonce((n) => n + 1); } catch (err) { + if (isAddressTakenRefusal(err)) { + // The server's own words (they name both forms and their packages) go to the console log. + console.warn('[public forms] switch refused:', formatMetadataError(err)); + const message = addressTakenText(t, row, await readAddressHolder(row)); + toast.error(t('publicFormsSetup.switchFailed', { name: row.title, message })); + return; + } const message = err instanceof PublicFormSwitchRefusal ? refusalText(t, err) : serverRefusalText(t, err); toast.error(t('publicFormsSetup.switchFailed', { name: row.title, message })); if (err instanceof PublicFormSwitchRefusal && err.reason === 'shipped-off') setNonce((n) => n + 1); diff --git a/ui/packages/app-shell/src/views/setup/publicForms.test.ts b/ui/packages/app-shell/src/views/setup/publicForms.test.ts index 70e1b14597d..c6c8c5150fa 100644 --- a/ui/packages/app-shell/src/views/setup/publicForms.test.ts +++ b/ui/packages/app-shell/src/views/setup/publicForms.test.ts @@ -4,8 +4,10 @@ import { describe, it, expect, vi } from 'vitest'; import { PublicFormSwitchRefusal, baseShipsFormOff, + isAddressTakenRefusal, markShippedOff, overrideHoldsOnlySwitch, + publicAddressHolderOf, publicFormRowOf, publicFormRowsOf, switchPublicForm, @@ -96,6 +98,87 @@ describe('publicFormRowsOf', () => { }); }); +describe('[#37087] publicAddressHolderOf: the other form that holds an address', () => { + /** The form being switched on: `web_to_lead` of `crm`, at `contact-us`, switched off. */ + const row = publicFormRowOf(formItem({}, false))!; + /** Another form whose public link names the same address. */ + const other = (overrides: Record = {}, enabled = true) => + formItem({ name: 'crm_lead.newsletter', label: 'Newsletter signup', title: 'Newsletter signup', ...overrides }, enabled); + + it('names the other form whose public link names the address, by the name the list shows it under', () => { + expect(publicAddressHolderOf({ items: [formItem({}, false), other()] }, row)).toEqual({ + name: 'crm_lead.newsletter', + title: 'Newsletter signup', + packageId: 'crm', + }); + // A bare array answer reads the same. + expect(publicAddressHolderOf([other(), formItem({}, false)], row)?.name).toBe('crm_lead.newsletter'); + }); + + it('a form holds its address switched off, and when it was never anonymous: the server counts both', () => { + expect(publicAddressHolderOf([formItem({}, false), other({}, false)], row)?.name).toBe('crm_lead.newsletter'); + const internal = other({ sharing: { enabled: true, allowAnonymous: false, publicLink: '/forms/contact-us' } }); + // Not a public form, so Setup does not list it; it holds the address all the same. + expect(publicFormRowOf(internal)).toBeNull(); + expect(publicAddressHolderOf([formItem({}, false), internal], row)?.name).toBe('crm_lead.newsletter'); + }); + + it('reads a public link as the routes do: `/forms/x`, `forms/x` and `x` are one address', () => { + for (const publicLink of ['/forms/contact-us', 'forms/contact-us', 'contact-us']) { + const holder = other({ sharing: { enabled: true, allowAnonymous: true, publicLink } }); + expect(publicAddressHolderOf([holder], row)?.name, publicLink).toBe('crm_lead.newsletter'); + } + }); + + it('the form itself is not another form: its own item, the app\'s document it overrides, and an override of it', () => { + // Its own item alone: nobody else holds the address. + expect(publicAddressHolderOf([formItem({}, false)], row)).toBeNull(); + // The row is the override an environment saved over the app's form: the app's own document is the same form. + const override = formItem({ _packageId: 'crm.custom', overrides: { package: 'crm', basedOn: '3.0.0' } }, false); + const overrideRow = publicFormRowOf(override)!; + expect(overrideRow.packageId).toBe('crm.custom'); + expect(publicAddressHolderOf([override, formItem()], overrideRow)).toBeNull(); + // The row is the app's form: an override of it is the same form. + expect(publicAddressHolderOf([formItem({}, false), override], row)).toBeNull(); + // CONTROL: beside those, a third form at the address is still named. + expect(publicAddressHolderOf([override, formItem(), other()], overrideRow)?.name).toBe('crm_lead.newsletter'); + }); + + it('a form of the same name in an unrelated package is another form', () => { + const twin = formItem({ _packageId: 'hr', label: 'HR contact' }); + expect(publicAddressHolderOf([formItem({}, false), twin], row)).toEqual({ name: 'web_to_lead', title: 'HR contact', packageId: 'hr' }); + }); + + it('a row bound to no package stands for every item of its name, as the server judges a package-less write', () => { + const loose = publicFormRowOf(formItem({ _packageId: undefined }, false))!; + expect(loose.packageId).toBeNull(); + expect(publicAddressHolderOf([formItem({ _packageId: undefined }, false), formItem()], loose)).toBeNull(); + expect(publicAddressHolderOf([formItem({ _packageId: undefined }, false), other()], loose)?.name).toBe('crm_lead.newsletter'); + }); + + it('answers null when no other form holds the address, and for an answer that is not a list', () => { + const elsewhere = other({ sharing: { enabled: true, allowAnonymous: true, publicLink: 'newsletter' } }); + expect(publicAddressHolderOf([formItem({}, false), elsewhere], row)).toBeNull(); + expect(publicAddressHolderOf(undefined, row)).toBeNull(); + expect(publicAddressHolderOf({ items: 'nope' }, row)).toBeNull(); + expect(publicAddressHolderOf([null, 'x', { name: '' }, { sharing: { publicLink: 'contact-us' } }], row)).toBeNull(); + }); +}); + +describe('[#37087] isAddressTakenRefusal', () => { + it('is the server\'s 409 FORM_ADDRESS_TAKEN, by either status key', () => { + expect(isAddressTakenRefusal(Object.assign(new Error('taken'), { status: 409, code: 'FORM_ADDRESS_TAKEN' }))).toBe(true); + expect(isAddressTakenRefusal({ statusCode: 409, code: 'FORM_ADDRESS_TAKEN' })).toBe(true); + }); + + it('is not a pending-draft conflict, another status with the code, or no error at all', () => { + expect(isAddressTakenRefusal({ status: 409, code: 'METADATA_CONFLICT' })).toBe(false); + expect(isAddressTakenRefusal({ status: 400, code: 'FORM_ADDRESS_TAKEN' })).toBe(false); + expect(isAddressTakenRefusal({ status: 409 })).toBe(false); + expect(isAddressTakenRefusal(undefined)).toBe(false); + }); +}); + describe('overrideHoldsOnlySwitch', () => { const base = formItem(); it('is true when the override differs from the base only by the switch, its declaration and the decorations', () => { diff --git a/ui/packages/app-shell/src/views/setup/publicForms.ts b/ui/packages/app-shell/src/views/setup/publicForms.ts index 0c70321c873..a754aae869e 100644 --- a/ui/packages/app-shell/src/views/setup/publicForms.ts +++ b/ui/packages/app-shell/src/views/setup/publicForms.ts @@ -65,12 +65,22 @@ * where it would save: that draft is its saver's and is never published on * their behalf. * + * ## An address another form holds + * + * The server refuses a switch-on that would leave two forms open on one + * address (`409 FORM_ADDRESS_TAKEN`, ADR-0159 ruled question 3). Its envelope + * names the other form in its message prose alone, so the page reads the + * environment's forms again and finds the holder by the server's own rule + * ({@link publicAddressHolderOf}): it then names both forms, the one being + * switched on and the one that holds the address (objectstack#37087). + * * Not listed here: when a form last took a submission. A submission is an * ordinary record of the form's object and records no form, so there is * nothing to read. */ -import { anonymousFormIntakeSlug, formExplicitlyWithdraws } from '@objectstack/spec/ui'; +import { anonymousFormIntakeSlug, formExplicitlyWithdraws, publicFormSlug } from '@objectstack/spec/ui'; +import { errorCodeIs } from '@object-ui/types'; import { emitMetadataRefresh } from '../../assistant/assistantBus.js'; import { resolveDashboardEditTarget, @@ -173,6 +183,82 @@ export function publicFormRowsOf(answer: unknown): PublicFormRow[] { return rows.sort((a, b) => a.title.localeCompare(b.title) || a.name.localeCompare(b.name)); } +/** The server's code for a form left open on an address another form holds (`409`). */ +export const FORM_ADDRESS_TAKEN = 'FORM_ADDRESS_TAKEN'; + +/** Whether `err` is the server's refusal of an address another form holds. */ +export function isAddressTakenRefusal(err: unknown): boolean { + const e = err as { status?: unknown; statusCode?: unknown } | null | undefined; + return (e?.status === 409 || e?.statusCode === 409) && errorCodeIs(err, FORM_ADDRESS_TAKEN); +} + +/** The form that holds an address another form asked for. */ +export interface PublicAddressHolder { + /** The `form` item's name. */ + name: string; + /** What the page shows as its name ({@link shownName}). */ + title: string; + /** The package that serves it, or `null` when it names none. */ + packageId: string | null; +} + +/** + * The slug a form's public link names, switched on or off: the address the + * server's write rule reads the form to hold (`formHeldSlug`, + * `@objectstack/metadata-protocol`). + */ +function heldSlug(form: FormDoc): string | undefined { + const link = isDoc(form.sharing) ? form.sharing.publicLink : undefined; + return typeof link === 'string' && link !== '' ? publicFormSlug(link) : undefined; +} + +const packageOf = (item: FormDoc): string | null => + typeof item._packageId === 'string' && item._packageId ? item._packageId : null; + +const overriddenPackageOf = (item: FormDoc): string | null => + isDoc(item.overrides) && typeof item.overrides.package === 'string' && item.overrides.package + ? item.overrides.package + : null; + +/** + * The OTHER form that holds `row`'s address in a `GET /meta/form` answer + * (`{ items }`, or a bare array), or `null` when the answer holds none. + * + * Judged as the server judges the write it refuses (module header): a form + * holds an address while its public link names it, switched on or off, so a + * switched-off holder and a form that was never anonymous both count. `row` + * itself is not "another form": the item of its name in its own package, the + * app's document that item overrides and an override of it, and, for a row + * bound to no package, every item of its name. + */ +export function publicAddressHolderOf( + answer: unknown, + row: Pick, +): PublicAddressHolder | null { + const items: FormDoc[] = ( + Array.isArray(answer) ? answer : isDoc(answer) && Array.isArray(answer.items) ? answer.items : [] + ).filter((item: unknown): item is FormDoc => isDoc(item) && typeof item.name === 'string' && !!item.name); + // The packages `row` stands in: its own, and the app's it overrides. + const own = new Set(); + if (row.packageId) { + own.add(row.packageId); + for (const item of items) { + if (item.name !== row.name || packageOf(item) !== row.packageId) continue; + const base = overriddenPackageOf(item); + if (base) own.add(base); + } + } + const isRow = (item: FormDoc): boolean => { + if (item.name !== row.name) return false; + if (!row.packageId) return true; + const pkg = packageOf(item); + const base = overriddenPackageOf(item); + return (pkg !== null && own.has(pkg)) || (base !== null && own.has(base)); + }; + const holder = items.find((item) => heldSlug(item) === row.slug && !isRow(item)); + return holder ? { name: holder.name, title: shownName(holder), packageId: packageOf(holder) } : null; +} + /** The metadata client calls {@link switchPublicForm} makes. */ export interface PublicFormSwitchClient { layered( diff --git a/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx b/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx index 2d511701f6e..7a3769c2bde 100644 --- a/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx +++ b/ui/packages/app-shell/src/views/studio-design/StudioMenu.test.tsx @@ -332,6 +332,7 @@ describe('a package that holds nothing yet (objectstack#37201)', () => { { type: 'dataset', domain: 'data' }, { type: 'dashboard', domain: 'ui' }, { type: 'report', domain: 'ui' }, + { type: 'form', domain: 'ui' }, { type: 'assignment_rule', domain: 'security' }, { type: 'agent', domain: 'ai' }, { type: 'tool', domain: 'ai' }, @@ -345,6 +346,7 @@ describe('a package that holds nothing yet (objectstack#37201)', () => { expect(all[0]).toBe('overview'); const common = all.slice(1).filter((k) => !links(foldRegion()).includes(k)); // objectstack#37564 — dataset and position are 常用 by name (ADR-0084, amended 2026-11-26). + // objectstack#37087 — so is form, after report. expect(common).toEqual([ 'type:object', 'type:dataset', @@ -352,6 +354,7 @@ describe('a package that holds nothing yet (objectstack#37201)', () => { 'type:page', 'type:dashboard', 'type:report', + 'type:form', 'type:flow', 'type:permission', 'type:position', @@ -394,6 +397,50 @@ describe('dataset and position are 常用, placed by name (objectstack#37564, AD }); }); +describe('form is listed and 常用, placed by name (objectstack#37087, ADR-0084 amended 2026-11-26)', () => { + const keysIn = (testId: string) => + within(screen.getByTestId(testId)) + .queryAllByRole('link', { hidden: true }) + .map((a) => a.getAttribute('data-testid')!.replace('studio-menu-entry-', '')); + /** The 界面 UI types as the registry serves them: alphabetically. */ + const UI_SERVED = [ + { type: 'action', domain: 'ui' }, + { type: 'dashboard', domain: 'ui' }, + { type: 'form', domain: 'ui' }, + { type: 'report', domain: 'ui' }, + { type: 'view', domain: 'ui' }, + ]; + + it('form is drawn under UI directly after report, above the fold, and opens the form list of the package', () => { + reads.entries = [...SERVED, ...UI_SERVED]; + // The package holds views and no form. + reads.sweep = { countsByType: { view: 4 }, packagesByType: { view: [PKG] } }; + renderAt(`/studio/${PKG}/data`); + expect(keysIn('studio-menu-group-ui')).toEqual(['type:app', 'type:page', 'type:dashboard', 'type:report', 'type:form']); + expect(foldRegion().contains(entry('type:form'))).toBe(false); + // Holding none, it is drawn all the same, as any empty 常用 type is. + expect(entry('type:form')).toHaveAttribute('data-empty', 'true'); + expect(entry('type:form')).toHaveAttribute('href', `/studio/${PKG}/metadata/form?package=${PKG}`); + // `view`, the type forms were carved from, stays 高级: inside the fold. + expect(foldRegion().contains(screen.getByTestId('studio-menu-entry-type:view'))).toBe(true); + }); + + it('a package that holds forms draws the row with its count, not dimmed', () => { + reads.entries = [...SERVED, ...UI_SERVED]; + reads.sweep = { countsByType: { form: 2 }, packagesByType: { form: [PKG] } }; + renderAt(`/studio/${PKG}/data`); + expect(entry('type:form')).not.toHaveAttribute('data-empty'); + expect(screen.getByTestId('studio-menu-count-type:form')).toHaveTextContent('2'); + }); + + it('CONTROL: a registry that serves no form type draws no form row', () => { + reads.entries = [...SERVED, ...UI_SERVED.filter((e) => e.type !== 'form')]; + renderAt(`/studio/${PKG}/data`); + expect(screen.queryByTestId('studio-menu-entry-type:form')).toBeNull(); + expect(keysIn('studio-menu-group-ui')).toEqual(['type:app', 'type:page', 'type:dashboard', 'type:report']); + }); +}); + describe('the 「高级」 fold (objectstack#37201)', () => { it('closed by default: a button that names the region it controls, which is hidden', () => { renderAt(`/studio/${PKG}/data`); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts index 35e09479a59..3a17265b20d 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuModel.test.ts @@ -188,6 +188,7 @@ const SERVED = [ { type: 'action', domain: 'ui' }, { type: 'app', domain: 'ui' }, { type: 'dashboard', domain: 'ui' }, + { type: 'form', domain: 'ui' }, { type: 'page', domain: 'ui' }, { type: 'report', domain: 'ui' }, { type: 'view', domain: 'ui' }, @@ -211,7 +212,8 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende it("orders each group by the table, an unplaced type after the placed ones, then the entries that are not a type", () => { expect(keysOf(menu)).toEqual({ data: ['type:object', 'type:dataset', 'type:picklist', 'type:hook', 'type:mapping', 'type:zz_unplaced'], - ui: ['type:app', 'type:page', 'type:dashboard', 'type:report', 'type:view', 'type:action'], + // objectstack#37087 — form after report, and so directly before view, the type it was carved from. + ui: ['type:app', 'type:page', 'type:dashboard', 'type:report', 'type:form', 'type:view', 'type:action'], automation: ['type:flow', 'type:job', 'orgFlows'], system: ['type:doc', 'type:book', 'type:email_template', 'diagnostics'], security: ['type:permission', 'type:position', 'type:assignment_rule', 'owd'], @@ -229,6 +231,8 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende // objectstack#37564 — placed by name (ADR-0084, amended 2026-11-26). expect(entries.find((e) => e.key === 'type:dataset')!.tier).toBe('common'); expect(entries.find((e) => e.key === 'type:position')!.tier).toBe('common'); + // objectstack#37087 — so is form: 「表单放常用」. + expect(entries.find((e) => e.key === 'type:form')!.tier).toBe('common'); }); it('the three entries that are not a type are 高级 on a package', () => { @@ -242,7 +246,8 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende expect(Object.fromEntries(tiers.common.map((g) => [g.group, g.entries.map((e) => e.key)]))).toEqual({ // objectstack#37564 — dataset directly after object, position directly after permission set, both above the fold. data: ['type:object', 'type:dataset'], - ui: ['type:app', 'type:page', 'type:dashboard', 'type:report'], + // objectstack#37087 — form is the last of 界面 UI's 常用 types, above the fold. + ui: ['type:app', 'type:page', 'type:dashboard', 'type:report', 'type:form'], automation: ['type:flow'], security: ['type:permission', 'type:position'], ai: ['type:agent', 'type:tool', 'type:skill'], @@ -254,6 +259,8 @@ describe('the menu reads the placement table (objectstack#37201, ADR-0084 amende 'type:assignment_rule', 'owd', ]); + // objectstack#37087 — the fold's 界面 UI group is the two 高级 types, and form is not one of them. + expect(tiers.advanced.find((g) => g.group === 'ui')!.entries.map((e) => e.key)).toEqual(['type:view', 'type:action']); }); it('keeps every address and entry key: only the order and the tier are new', () => { @@ -269,7 +276,7 @@ describe('the 常用 types are always listed on a package (objectstack#37201)', expect(STUDIO_MENU_ALWAYS_TYPES).toEqual(STUDIO_MENU_PLACEMENT.filter((r) => r.tier === 'common').map((r) => r.type)); expect(STUDIO_MENU_ALWAYS_TYPES).toEqual([ 'object', 'dataset', - 'app', 'page', 'dashboard', 'report', + 'app', 'page', 'dashboard', 'report', 'form', 'flow', 'permission', 'position', 'agent', 'tool', 'skill', @@ -285,9 +292,27 @@ describe('the 常用 types are always listed on a package (objectstack#37201)', always: STUDIO_MENU_ALWAYS_TYPES, }).map((e) => e.type); expect(listed.sort()).toEqual([ - 'agent', 'app', 'dashboard', 'dataset', 'flow', 'object', 'page', 'permission', 'position', 'report', 'skill', 'tool', + 'agent', 'app', 'dashboard', 'dataset', 'flow', 'form', 'object', 'page', 'permission', 'position', 'report', 'skill', 'tool', ]); }); + + // objectstack#37087 — `form` was on the directory's hidden types until its designer shipped. + it('the directory rule lists form on a package, and still drops field and package', async () => { + const { scopeDirectoryEntries, HIDDEN_DIRECTORY_TYPES } = await import('../metadata-admin/directoryScope'); + expect([...HIDDEN_DIRECTORY_TYPES].sort()).toEqual(['field', 'package']); + const served = [ + { type: 'form', domain: 'ui' }, + { type: 'field', domain: 'data' }, + { type: 'package', domain: 'system' }, + ]; + const scope = { environment: false, packageId: PKG, always: STUDIO_MENU_ALWAYS_TYPES }; + // A package that holds one of each: form is listed, the two hidden types are not. + expect( + scopeDirectoryEntries(served, { ...scope, packagesByType: { form: [PKG], field: [PKG], package: [PKG] } }).map((e) => e.type), + ).toEqual(['form']); + // A package that holds no form: listed all the same, as every 常用 type is. + expect(scopeDirectoryEntries(served, { ...scope, packagesByType: {} }).map((e) => e.type)).toEqual(['form']); + }); }); describe('an empty 常用 type means the sweep answered none, not "not answered yet" (objectstack#37201)', () => { diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts index 8b87445265a..3443876f0fe 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.test.ts @@ -3,7 +3,8 @@ /** * objectstack#37200 — Studio's menu placement table agrees with the registry * and with the ruled order (ruling on #37192; ADR-0084 amended 2026-11-26, - * objectstack#37564: `dataset` and `position` placed in 常用 by name). + * objectstack#37564: `dataset` and `position` placed in 常用 by name; + * objectstack#37087: `form` listed, and placed in 常用 by name). * * Three holds: * - against `DEFAULT_METADATA_TYPE_REGISTRY`: every type the directory can @@ -65,10 +66,10 @@ describe('the menu placement table agrees with the registry (objectstack#37200)' }); describe('the menu placement table holds the ruled order and tiers (objectstack#37200)', () => { - it('常用: object, dataset · app, page, dashboard, report · flow · permission, position · agent, tool, skill, in that order', () => { + it('常用: object, dataset · app, page, dashboard, report, form · flow · permission, position · agent, tool, skill, in that order', () => { expect(STUDIO_MENU_PLACEMENT.filter((row) => row.tier === 'common').map((row) => row.type)).toEqual([ 'object', 'dataset', - 'app', 'page', 'dashboard', 'report', + 'app', 'page', 'dashboard', 'report', 'form', 'flow', 'permission', 'position', 'agent', 'tool', 'skill', @@ -107,6 +108,27 @@ describe('the menu placement table holds the ruled order and tiers (objectstack# expect(types.indexOf('position')).toBe(types.indexOf('permission') + 1); }); + // ADR-0084, amended 2026-11-26: 「表单放常用」, and item 11 of that amendment's + // list for the place — last of 界面 UI's 常用 types. objectstack#37087 takes the + // type off the directory's hidden types, so it owes a row here. + it('form is listed and common, placed by name: directly after report, and so directly before view (objectstack#37087)', () => { + const types = STUDIO_MENU_PLACEMENT.map((row) => row.type); + expect(HIDDEN_DIRECTORY_TYPES.has('form')).toBe(false); + expect(LISTABLE_TYPES).toContain('form'); + expect(STUDIO_MENU_PLACEMENT.find((row) => row.type === 'form')?.tier).toBe('common'); + expect(types.indexOf('form')).toBe(types.indexOf('report') + 1); + const ui = types.filter((type) => DOMAIN_OF.get(type) === 'ui'); + expect(ui[ui.indexOf('form') + 1]).toBe('view'); + }); + + // The two types the directory still hides, and why each draws no row. + it('CONTROL: field and package stay hidden, and neither has a row', () => { + expect([...HIDDEN_DIRECTORY_TYPES].sort()).toEqual(['field', 'package']); + const types = STUDIO_MENU_PLACEMENT.map((row) => row.type); + expect(types).not.toContain('field'); + expect(types).not.toContain('package'); + }); + it('each row holds a type and a tier, and nothing else (the group stays the served domain)', () => { for (const row of STUDIO_MENU_PLACEMENT) { expect(Object.keys(row).sort(), row.type).toEqual(['tier', 'type']); @@ -190,10 +212,11 @@ describe('the groups the 2026-11-26 placements touch read as ADR-0084 lists them }); }); - // `form` joins the 常用 types here, after `report`, when its type is registered and listed (ADR-0159). - it('界面 UI closes up behind dataset: app · page · dashboard · report | view · action', () => { + // objectstack#37087 — `form` is registered `ui` (ADR-0159 D2) and listed, so it joins the 常用 types, after `report`. + it('界面 UI closes up behind dataset and gains form: app · page · dashboard · report · form | view · action', () => { + expect(DOMAIN_OF.get('form')).toBe('ui'); expect(groupTiers('ui')).toEqual({ - common: ['app', 'page', 'dashboard', 'report'], + common: ['app', 'page', 'dashboard', 'report', 'form'], advanced: ['view', 'action'], }); }); diff --git a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts index d89da0ff965..d0f16d3d6a7 100644 --- a/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts +++ b/ui/packages/app-shell/src/views/studio-design/studioMenuPlacement.ts @@ -3,7 +3,7 @@ /** * Where each metadata type sits in Studio's left menu: its order and its tier * (objectstack ADR-0084; epic #36890, ruling on #37192; amended 2026-11-26, - * "Placements, and what moves to Setup", objectstack#37564). + * "Placements, and what moves to Setup", objectstack#37564, #37920, #37087). * * One ordered list of `{ type, tier }`. It holds order and tier ONLY: a type's * group stays its served registry `domain`, so this table can never disagree @@ -12,9 +12,9 @@ * ## Tiers * * - `common` (常用): always listed on a package, in this order — object, - * dataset · app, page, dashboard, report · flow · permission, position · - * agent, tool, skill. The AI group is drawn last of the visible groups, - * above the fold. + * dataset · app, page, dashboard, report, form · flow · permission, + * position · agent, tool, skill. The AI group is drawn last of the visible + * groups, above the fold. * - `advanced` (高级): every other type the directory lists, in one collapsed * fold under the common groups, still under its own group label. That * includes picklist (选项列表) and email template. @@ -37,8 +37,8 @@ * * The rule that sorts a type into a tier has three tests (ADR-0084, amended * 2026-11-25). Where the maintainer places a type by name, the name decides, - * and the row says so beside it. `dataset` and `position` are two such rows: - * the rule alone would sort each of them `advanced`. + * and the row says so beside it. `dataset`, `position` and `form` are three + * such rows: the rule alone would sort each of them `advanced`. * * ## Order * @@ -85,6 +85,10 @@ export const STUDIO_MENU_PLACEMENT: readonly StudioMenuPlacementRow[] = Object.f { type: 'page', tier: 'common' }, { type: 'dashboard', tier: 'common' }, { type: 'report', tier: 'common' }, + // Placed by name (「表单放常用」), last of the group's 常用 types and so + // directly before `view`, the type it was carved from (ADR-0159). A form is + // bound to one object, so the rule's first test alone would sort it 高级. + { type: 'form', tier: 'common' }, { type: 'flow', tier: 'common' }, { type: 'permission', tier: 'common' }, // Placed by name, directly after `permission`: a position is one slot per diff --git a/ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.ts b/ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.ts index df3e3d00fbe..d7ac0380ff0 100644 --- a/ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.ts +++ b/ui/packages/i18n/src/__tests__/de-quote-pairing-3876.test.ts @@ -508,7 +508,8 @@ describe('objectui#3876 — de pack closes „ with “ and not with a straight // 133 once the list page's half of the same card added // `console.objectView.sharedMappingNameTaken` and `.sharedMappingDraftPending`, // one „{{name}}“ each — two spans. - expect(okSpans, 'correctly paired spans').toBe(133); + // 134 once objectstack-ai/objectstack#37087 added `publicFormsSetup.refusalAddressTaken` and its „{{holder}}“ — one span. + expect(okSpans, 'correctly paired spans').toBe(134); }); it('keeps the count identity that replaces the card’s count(„) === count(“)', () => { @@ -660,7 +661,8 @@ describe('objectui#3876 — de pack closes „ with “ and not with a straight // pairs to `grid.import.sharedSaveHint` and `grid.import.sharedSaved`. // 133 / 133 / 0 after the same card added `console.objectView.sharedMappingNameTaken` // and `.sharedMappingDraftPending`, one matched pair each. - expect({ open, close, rdq }).toEqual({ open: 133, close: 133, rdq: 0 }); + // 134 / 134 / 0 after objectstack-ai/objectstack#37087 added `publicFormsSetup.refusalAddressTaken`, one matched pair. + expect({ open, close, rdq }).toEqual({ open: 134, close: 134, rdq: 0 }); // The durable shape: every „ closed by a “, every surplus “ an English // opener answered by a ”. Survived translating the two English values. expect(close).toBe(open + rdq); diff --git a/ui/packages/i18n/src/__tests__/developer-namespace.test.ts b/ui/packages/i18n/src/__tests__/developer-namespace.test.ts index 3dcc58f6cd3..82c274faf7f 100644 --- a/ui/packages/i18n/src/__tests__/developer-namespace.test.ts +++ b/ui/packages/i18n/src/__tests__/developer-namespace.test.ts @@ -137,7 +137,8 @@ describe('developer namespace — cut out of the packs, not copied', () => { }); it('the en catalogue is populated (key parity across languages is all-locales-key-parity\'s)', () => { - expect(leaves(enNs).length).toBeGreaterThan(200); + // 184 leaves once objectstack-ai/objectstack#37087 removed the 47 `console.developer.publicForms` keys with their page. + expect(leaves(enNs).length).toBeGreaterThan(150); }); }); diff --git a/ui/packages/i18n/src/locales/ar.ts b/ui/packages/i18n/src/locales/ar.ts index c099531274c..ffae33ccdaa 100644 --- a/ui/packages/i18n/src/locales/ar.ts +++ b/ui/packages/i18n/src/locales/ar.ts @@ -6523,6 +6523,8 @@ const ar = { refusalShippedOff: "يوفّره تطبيقه مُعطّلًا، لذا لا يمكن تفعيله من هنا.", refusalForbidden: "ليست لديك صلاحية تغيير إعدادات التطبيق.", refusalServer: "رفض الخادم التغيير. حاول مرة أخرى أو تواصل مع مسؤول.", + refusalAddressTaken: "النموذج «{{holder}}» يستخدم العنوان نفسه بالفعل. امنح أحد النموذجين عنوانًا آخر في App Studio.", + refusalAddressTakenUnknown: "يستخدم نموذج آخر العنوان نفسه بالفعل. امنح أحد النموذجين عنوانًا آخر في App Studio.", switchedOnEarlierVersion: "تم تفعيل {{name}}. يبقى على الإصدار السابق {{version}} من التطبيق الذي خصّصته هذه البيئة؛ لاستخدام نموذج التطبيق الحالي، استعد الأصل في App Studio.", noSwitchPermission: "يتطلب تفعيل النماذج أو تعطيلها صلاحية تغيير إعدادات التطبيق، وهي ليست لديك.", shippedOff: "معطّل (عطّله تطبيقه)", diff --git a/ui/packages/i18n/src/locales/de.ts b/ui/packages/i18n/src/locales/de.ts index c2bbf22577f..73381b81947 100644 --- a/ui/packages/i18n/src/locales/de.ts +++ b/ui/packages/i18n/src/locales/de.ts @@ -5908,6 +5908,8 @@ const de = { refusalShippedOff: "die App liefert es ausgeschaltet aus, daher kann es hier nicht eingeschaltet werden.", refusalForbidden: "Sie haben keine Berechtigung, die App-Konfiguration zu ändern.", refusalServer: "der Server hat die Änderung abgelehnt. Versuchen Sie es erneut oder wenden Sie sich an einen Administrator.", + refusalAddressTaken: "das Formular „{{holder}}“ verwendet bereits dieselbe Adresse. Geben Sie einem der beiden Formulare in App Studio eine andere Adresse.", + refusalAddressTakenUnknown: "ein anderes Formular verwendet bereits dieselbe Adresse. Geben Sie einem der beiden Formulare in App Studio eine andere Adresse.", switchedOnEarlierVersion: "{{name}} ist eingeschaltet. Es bleibt bei der früheren App-Version {{version}}, die diese Umgebung angepasst hat; um das aktuelle Formular der App zu verwenden, stellen Sie das Original in App Studio wieder her.", noSwitchPermission: "Zum Ein- oder Ausschalten von Formularen ist die Berechtigung zum Ändern der App-Konfiguration nötig, die Sie nicht haben.", shippedOff: "Aus (von der App ausgeschaltet)", diff --git a/ui/packages/i18n/src/locales/en.ts b/ui/packages/i18n/src/locales/en.ts index 8cbf274aefc..0c704cf9852 100644 --- a/ui/packages/i18n/src/locales/en.ts +++ b/ui/packages/i18n/src/locales/en.ts @@ -6819,6 +6819,8 @@ const en = { refusalShippedOff: "its app ships it switched off, so it cannot be switched on here.", refusalForbidden: "you don't have permission to change app configuration.", refusalServer: "the server refused the change. Try again, or ask an administrator.", + refusalAddressTaken: "the form “{{holder}}” already uses the same address. Give one of the two forms another address in App Studio.", + refusalAddressTakenUnknown: "another form already uses the same address. Give one of the two forms another address in App Studio.", switchedOnEarlierVersion: "{{name}} is on. It stays on the app's earlier version {{version}}, which this environment customized; to take the app's current form, restore the original in App Studio.", noSwitchPermission: "Switching forms on or off needs permission to change app configuration, which you don't have.", shippedOff: "Off (switched off by its app)", diff --git a/ui/packages/i18n/src/locales/es.ts b/ui/packages/i18n/src/locales/es.ts index ec1ec504397..34ed1427495 100644 --- a/ui/packages/i18n/src/locales/es.ts +++ b/ui/packages/i18n/src/locales/es.ts @@ -6061,6 +6061,8 @@ const es = { refusalShippedOff: "su aplicación lo incluye desactivado, así que no se puede activar aquí.", refusalForbidden: "no tiene permiso para cambiar la configuración de la aplicación.", refusalServer: "el servidor rechazó el cambio. Inténtelo de nuevo o consulte a un administrador.", + refusalAddressTaken: "el formulario «{{holder}}» ya usa la misma dirección. Asigne otra dirección a uno de los dos formularios en App Studio.", + refusalAddressTakenUnknown: "otro formulario ya usa la misma dirección. Asigne otra dirección a uno de los dos formularios en App Studio.", switchedOnEarlierVersion: "{{name}} está activado. Sigue en la versión anterior {{version}} de la aplicación, que este entorno personalizó; para usar el formulario actual de la aplicación, restaure el original en App Studio.", noSwitchPermission: "Para activar o desactivar formularios se necesita permiso para cambiar la configuración de la aplicación, y usted no lo tiene.", shippedOff: "Desactivado (por su aplicación)", diff --git a/ui/packages/i18n/src/locales/fr.ts b/ui/packages/i18n/src/locales/fr.ts index b7bf4289c89..66f1c9d33fe 100644 --- a/ui/packages/i18n/src/locales/fr.ts +++ b/ui/packages/i18n/src/locales/fr.ts @@ -6057,6 +6057,8 @@ const fr = { refusalShippedOff: "son application le livre désactivé, il ne peut donc pas être activé ici.", refusalForbidden: "vous n'avez pas l'autorisation de modifier la configuration de l'application.", refusalServer: "le serveur a refusé la modification. Réessayez ou contactez un administrateur.", + refusalAddressTaken: "le formulaire « {{holder}} » utilise déjà la même adresse. Donnez une autre adresse à l'un des deux formulaires dans App Studio.", + refusalAddressTakenUnknown: "un autre formulaire utilise déjà la même adresse. Donnez une autre adresse à l'un des deux formulaires dans App Studio.", switchedOnEarlierVersion: "{{name}} est activé. Il reste sur la version antérieure {{version}} de l'application, que cet environnement a personnalisée ; pour utiliser le formulaire actuel de l'application, restaurez l'original dans App Studio.", noSwitchPermission: "Activer ou désactiver des formulaires nécessite l'autorisation de modifier la configuration de l'application, que vous n'avez pas.", shippedOff: "Désactivé (par son application)", diff --git a/ui/packages/i18n/src/locales/ja.ts b/ui/packages/i18n/src/locales/ja.ts index f3d337f7f75..22003cd37c2 100644 --- a/ui/packages/i18n/src/locales/ja.ts +++ b/ui/packages/i18n/src/locales/ja.ts @@ -5909,6 +5909,8 @@ const ja = { refusalShippedOff: "所属アプリがオフの状態で提供しているため、ここではオンにできません。", refusalForbidden: "アプリ構成を変更する権限がありません。", refusalServer: "サーバーが変更を拒否しました。再試行するか、管理者に問い合わせてください。", + refusalAddressTaken: "フォーム「{{holder}}」がすでに同じアドレスを使っています。App Studio でどちらかのフォームのアドレスを変更してください。", + refusalAddressTakenUnknown: "別のフォームがすでに同じアドレスを使っています。App Studio でどちらかのフォームのアドレスを変更してください。", switchedOnEarlierVersion: "{{name}} をオンにしました。この環境でカスタマイズしたアプリの以前のバージョン {{version}} のままです。アプリの現在のフォームを使うには、App Studio で元に戻してください。", noSwitchPermission: "フォームのオン/オフにはアプリ構成を変更する権限が必要ですが、お持ちではありません。", shippedOff: "オフ(アプリによりオフ)", diff --git a/ui/packages/i18n/src/locales/ko.ts b/ui/packages/i18n/src/locales/ko.ts index 83a2bbda6f8..3f77f0d1759 100644 --- a/ui/packages/i18n/src/locales/ko.ts +++ b/ui/packages/i18n/src/locales/ko.ts @@ -5906,6 +5906,8 @@ const ko = { refusalShippedOff: "소속 앱이 꺼진 상태로 제공하므로 여기서 켤 수 없습니다.", refusalForbidden: "앱 구성을 변경할 권한이 없습니다.", refusalServer: "서버가 변경을 거부했습니다. 다시 시도하거나 관리자에게 문의하세요.", + refusalAddressTaken: "양식 “{{holder}}”이(가) 이미 같은 주소를 사용하고 있습니다. App Studio에서 두 양식 중 하나의 주소를 바꾸세요.", + refusalAddressTakenUnknown: "다른 양식이 이미 같은 주소를 사용하고 있습니다. App Studio에서 두 양식 중 하나의 주소를 바꾸세요.", switchedOnEarlierVersion: "{{name}}을(를) 켰습니다. 이 환경에서 사용자 지정한 앱의 이전 버전 {{version}}이(가) 계속 사용됩니다. 앱의 현재 양식을 사용하려면 App Studio에서 원본으로 복원하세요.", noSwitchPermission: "양식을 켜거나 끄려면 앱 구성을 변경할 권한이 필요하지만 권한이 없습니다.", shippedOff: "꺼짐(앱에서 꺼짐)", diff --git a/ui/packages/i18n/src/locales/pt-BR.ts b/ui/packages/i18n/src/locales/pt-BR.ts index 9af469fe6c7..a4f8d635871 100644 --- a/ui/packages/i18n/src/locales/pt-BR.ts +++ b/ui/packages/i18n/src/locales/pt-BR.ts @@ -6056,6 +6056,8 @@ const pt = { refusalShippedOff: "o aplicativo o entrega desativado, então ele não pode ser ativado aqui.", refusalForbidden: "você não tem permissão para alterar a configuração do aplicativo.", refusalServer: "o servidor recusou a alteração. Tente novamente ou fale com um administrador.", + refusalAddressTaken: "o formulário “{{holder}}” já usa o mesmo endereço. Dê outro endereço a um dos dois formulários no App Studio.", + refusalAddressTakenUnknown: "outro formulário já usa o mesmo endereço. Dê outro endereço a um dos dois formulários no App Studio.", switchedOnEarlierVersion: "{{name}} está ativado. Ele continua na versão anterior {{version}} do aplicativo, que este ambiente personalizou; para usar o formulário atual do aplicativo, restaure o original no App Studio.", noSwitchPermission: "Ativar ou desativar formulários exige permissão para alterar a configuração do aplicativo, que você não tem.", shippedOff: "Desativado (pelo aplicativo)", diff --git a/ui/packages/i18n/src/locales/ru.ts b/ui/packages/i18n/src/locales/ru.ts index d0ed52e63cd..2d5e59307a3 100644 --- a/ui/packages/i18n/src/locales/ru.ts +++ b/ui/packages/i18n/src/locales/ru.ts @@ -6223,6 +6223,8 @@ const ru = { refusalShippedOff: "приложение поставляет её выключенной, поэтому здесь её нельзя включить.", refusalForbidden: "у вас нет прав на изменение конфигурации приложения.", refusalServer: "сервер отклонил изменение. Повторите попытку или обратитесь к администратору.", + refusalAddressTaken: "форма «{{holder}}» уже использует тот же адрес. Задайте одной из двух форм другой адрес в App Studio.", + refusalAddressTakenUnknown: "другая форма уже использует тот же адрес. Задайте одной из двух форм другой адрес в App Studio.", switchedOnEarlierVersion: "Форма «{{name}}» включена. Она остаётся на прежней версии приложения {{version}}, которую настроила эта среда; чтобы использовать текущую форму приложения, восстановите оригинал в App Studio.", noSwitchPermission: "Чтобы включать и выключать формы, нужны права на изменение конфигурации приложения, а у вас их нет.", shippedOff: "Выкл. (выключена приложением)", diff --git a/ui/packages/i18n/src/locales/zh-Hans.ts b/ui/packages/i18n/src/locales/zh-Hans.ts index b361242f552..b6f1e55d364 100644 --- a/ui/packages/i18n/src/locales/zh-Hans.ts +++ b/ui/packages/i18n/src/locales/zh-Hans.ts @@ -5954,6 +5954,8 @@ const zh = { refusalShippedOff: "所属应用发布时就关闭了这个表单,无法在这里开启。", refusalForbidden: "你没有修改应用配置的权限。", refusalServer: "服务器拒绝了这次修改。请重试,或联系管理员。", + refusalAddressTaken: "表单「{{holder}}」已经用了同一个地址。请在应用搭建里给其中一个表单换个地址。", + refusalAddressTakenUnknown: "另一个表单已经用了同一个地址。请在应用搭建里给其中一个表单换个地址。", switchedOnEarlierVersion: "{{name}} 已开启。它仍沿用本环境定制时的应用旧版本 {{version}};如需使用应用当前版本的表单,请在应用搭建中恢复原样。", noSwitchPermission: "开启或关闭表单需要修改应用配置的权限,你目前没有。", shippedOff: "关闭(应用自带关闭)", diff --git a/ui/packages/i18n/src/locales/zh-Hant.ts b/ui/packages/i18n/src/locales/zh-Hant.ts index 7fd660b3756..449e0456f67 100644 --- a/ui/packages/i18n/src/locales/zh-Hant.ts +++ b/ui/packages/i18n/src/locales/zh-Hant.ts @@ -5954,6 +5954,8 @@ const zhHant = { refusalShippedOff: "所屬應用釋出時就關閉了這個表單,無法在這裡開啟。", refusalForbidden: "你沒有修改應用配置的權限。", refusalServer: "伺服器拒絕了這次修改。請重試,或聯絡管理員。", + refusalAddressTaken: "表單「{{holder}}」已經用了同一個地址。請在應用搭建裡給其中一個表單換個地址。", + refusalAddressTakenUnknown: "另一個表單已經用了同一個地址。請在應用搭建裡給其中一個表單換個地址。", switchedOnEarlierVersion: "{{name}} 已開啟。它仍沿用本環境定製時的應用舊版本 {{version}};如需使用應用當前版本的表單,請在應用搭建中恢復原樣。", noSwitchPermission: "開啟或關閉表單需要修改應用配置的權限,你目前沒有。", shippedOff: "關閉(應用自帶關閉)", diff --git a/ui/packages/i18n/src/namespaces/developer/ar.ts b/ui/packages/i18n/src/namespaces/developer/ar.ts index d2528f7b282..67ed780af43 100644 --- a/ui/packages/i18n/src/namespaces/developer/ar.ts +++ b/ui/packages/i18n/src/namespaces/developer/ar.ts @@ -69,55 +69,6 @@ const ar = { sampleTitle: "مثال (cURL)", copySample: "نسخ مثال cURL", }, - publicForms: { - title: "النماذج العامة", - description: "نماذج يستطيع أي شخص تعبئتها — دون تسجيل دخول. انشر نموذجًا لتحصل على رابط قابل للمشاركة؛ وتصل الإرسالات مباشرةً إلى الكائن المرتبط.", - publishNone: "لا توجد طرق عرض نماذج غير عامة متاحة", - publishTooltip: "نشر طريقة عرض نموذج", - publishButton: "نشر نموذج…", - emptyTitle: "لا توجد نماذج عامة بعد", - emptyBody: "انقر على {{action}} أعلاه لمشاركة نموذج موجود، أو أنشئ نموذجًا جديدًا في «طرق العرض والتطبيقات» واجعله عامًا.", - columnName: "الاسم", - columnObject: "الكائن", - columnSlug: "المعرّف المختصر", - columnPublicUrl: "عنوان URL العام", - copyUrl: "نسخ عنوان URL", - copyIframe: "نسخ شيفرة تضمين