# landing-pages Specification
## Purpose
Public landing pages per company, built by staff from blocks in the back office without a developer. A page's sign-up form registers visitors into an event as web sign-ups, with the page address and campaign tags, so they enter the lead pipeline. Each page shows its company's logo and accent colour.
## Requirements
### Requirement: A Page Is An Ordered List Of Typed Blocks
A page SHALL belong to one company and have a slug, a title, an optional meta description, a status (Draft or Published), a "hide header" flag that defaults to off, and an ordered list of zero to 30 blocks. The block types SHALL be HERO, RICH_TEXT, IMAGE_TEXT, FAQ, FORM, HTML, FEATURES, STEPS, TRUST and CTA. Blocks SHALL be returned in the order they were saved, and a valid save SHALL replace all of a page's blocks.
#### Scenario: Blocks read back in order
- **WHEN** staff save page `hotel-technology` with blocks HERO, RICH_TEXT, FORM
- **THEN** reading the page returns those three blocks in that order with their fields
#### Scenario: A save replaces the blocks
- **GIVEN** a page whose blocks are HERO and FAQ
- **WHEN** it is saved with only a RICH_TEXT block
- **THEN** the page has only that RICH_TEXT block
#### Scenario: An HTML block and the header flag read back
- **WHEN** staff save a page with "hide header" on and blocks HTML, FORM
- **THEN** reading the page returns "hide header" on and the HTML block with its HTML unchanged
#### Scenario: New section types read back
- **WHEN** staff save a page with blocks FEATURES, STEPS, TRUST and CTA
- **THEN** reading the page returns those four blocks in that order with their cards and fields
### Requirement: Page Fields Are Validated Server-Side
A page save SHALL be refused with the offending field path, writing nothing, when the slug does not match `^[a-z0-9]+(-[a-z0-9]+)*$`, is longer than 80 characters or is used by another page of the same company, ignoring case; or when the title is blank or longer than 120 characters; or when the meta description is longer than 160 characters.
#### Scenario: Duplicate slug in one company
- **GIVEN** INS has a page `hotel-technology`
- **WHEN** INS staff save another page with slug `hotel-technology`
- **THEN** the save is refused on field `slug`
#### Scenario: Same slug in two companies
- **GIVEN** INS has a page `about`
- **WHEN** CV staff save a page with slug `about`
- **THEN** the save succeeds
### Requirement: Block Fields Are Validated Server-Side
A page save SHALL be refused with the offending field path, writing nothing, when a block has an unknown type, a required field is blank, or a text exceeds its limit: heading 120, text and FAQ question 300, button label 40, FAQ answer 2000, rich-text HTML 100000 characters, and an HTML block's HTML 200000 characters. An HTML block's HTML SHALL NOT be blank. A FAQ SHALL have 1 to 30 items. `imagePosition` SHALL be LEFT or RIGHT.
#### Scenario: Too many blocks
- **WHEN** a page is saved with 31 blocks
- **THEN** the save is refused and nothing is written
#### Scenario: HTML block too long
- **WHEN** a page is saved with an HTML block of 200001 characters
- **THEN** the save is refused on field `blocks[0].html` and nothing is written
### Requirement: Block References Stay Inside The Company
A block's image SHALL be an image of the page's company, and the event of a FORM block or of a HERO block that names one SHALL be an event of the page's company. Otherwise the save SHALL be refused on that field.
#### Scenario: Another company's event
- **GIVEN** event `CV Roadshow` belongs to CV
- **WHEN** INS staff save a FORM block pointing at `CV Roadshow`
- **THEN** the save is refused on that block's event field
#### Scenario: Another company's event in a hero
- **GIVEN** event `CV Roadshow` belongs to CV
- **WHEN** INS staff save a HERO block whose event is `CV Roadshow`
- **THEN** the save is refused on that block's event field
### Requirement: Page Content Cannot Run Scripts
A button SHALL have both a label and a link or neither. The link SHALL start with a single `/`, `https://`, `mailto:`, `tel:`, or `#` plus a valid block link name. A save SHALL be refused when RICH_TEXT or IMAGE_TEXT HTML holds a `script` element, an `on*` attribute or a `javascript:` URL. The public page SHALL also sanitise that HTML against an allow-list. HTML blocks are exempt: they only run sealed.
#### Scenario: Script link on a button
- **WHEN** a page is saved with a HERO button link `javascript:alert(1)`
- **THEN** the save is refused on field `blocks[0].buttonUrl`
#### Scenario: Script in rich text
- **WHEN** a page is saved with rich text holding `
`
- **THEN** the save is refused on that block's HTML field
#### Scenario: Script in an HTML block
- **WHEN** a page is saved with an HTML block holding ``
- **THEN** the save succeeds
#### Scenario: Same-page button link
- **WHEN** a page is saved with a HERO button link `#signup`
- **THEN** the save succeeds
#### Scenario: Malformed same-page link
- **WHEN** a page is saved with a HERO button link `#Sign Up`
- **THEN** the save is refused on field `blocks[0].buttonUrl`
### Requirement: Page Images
Staff with `BO_PAGES` SHALL upload images for their company in PNG, JPEG or WebP, each at most 2 MB, checked by the file's content and not by its name. Anyone SHALL be able to read an image by its id, so that public pages can show it.
#### Scenario: Wrong file type
- **WHEN** staff upload a PDF renamed to `banner.png`
- **THEN** the upload is refused and nothing is stored
#### Scenario: Too large
- **WHEN** staff upload a 3 MB JPEG
- **THEN** the upload is refused and nothing is stored
### Requirement: Company Branding
Each company SHALL have an optional logo, an image of that company, and an optional accent colour in `#RRGGBB` form. These SHALL be edited on the Companies screen. Its public pages SHALL show the logo in the header and use the accent colour on buttons, with black or white button text, whichever contrasts more. Without these, the pages SHALL use the neutral Co-Lite look.
#### Scenario: Accent colour
- **GIVEN** INS has accent colour `#0B5FFF`
- **WHEN** a visitor opens an INS page
- **THEN** its buttons are `#0B5FFF` with white text
#### Scenario: Invalid colour
- **WHEN** a super admin saves the accent colour `blue`
- **THEN** the save is refused on that field
### Requirement: Public Page Address
A published page SHALL be public at `/p//`, matching the company code and the slug ignoring case. It SHALL be rendered on the server with the page title, the meta description and Open Graph tags. An unknown company, an unknown slug or a draft SHALL show the same not-found page to a visitor.
#### Scenario: Draft hidden from visitors
- **GIVEN** INS page `launch` is a draft
- **WHEN** a signed-out visitor opens `/p/INS/launch`
- **THEN** they see the not-found page
#### Scenario: Staff preview a draft
- **GIVEN** INS page `launch` is a draft
- **WHEN** INS staff with `BO_PAGES` open its preview from the editor
- **THEN** they see the page as it would be published, marked as a preview
### Requirement: The Form Block Registers For An Event
A FORM block SHALL show Co-Lite's sign-up form for its event, with that event's interests and the company's privacy notice. A submit SHALL follow the QR registration rules for matching, the existing-lead notes, consent and abuse limits. It SHALL create the event lead with source Web page and no salesperson, and SHALL record the page address and the `utm_source`, `utm_medium` and `utm_campaign` values from the page URL, each cut to 100 characters.
#### Scenario: New enquiry
- **GIVEN** page `/p/INS/hotel-technology` has a FORM block for `INS website enquiries`
- **WHEN** a new visitor submits it from a URL with `utm_source=facebook`
- **THEN** a new lead and an event lead with source Web page, no salesperson and UTM source `facebook` are created
#### Scenario: Known visitor
- **GIVEN** a lead with the same mobile exists in INS
- **WHEN** they submit the form with a different email
- **THEN** the lead is not edited, and the new email is written into the event lead's notes
### Requirement: The Form Block Closes With Its Event
A FORM block SHALL accept a submit only while its event is enabled, the event's end date in Malaysia time has not passed and the company has a privacy notice. Otherwise the page SHALL still show its other blocks, and the form area SHALL say that sign-up is closed.
#### Scenario: Ended event
- **GIVEN** the FORM block's event ended yesterday
- **WHEN** a visitor opens the page
- **THEN** the other blocks show and the form area says sign-up is closed
### Requirement: Web Sign-Up Details For Staff
The event lead detail SHALL show the page address and the UTM values of a Web page sign-up.
#### Scenario: Campaign shown
- **GIVEN** an event lead from a page opened with `utm_campaign=jan-launch`
- **WHEN** staff open the event lead
- **THEN** its detail shows the page address and campaign `jan-launch`
### Requirement: Pages Are Company-Scoped
Pages and page images SHALL follow the company scoping rules: staff see, edit and delete only their own company's pages, and a super admin sees every company's pages with their company. The Pages screens SHALL need `BO_PAGES`, which no role has at first. Page saves and deletes SHALL be audited.
#### Scenario: Another company's page
- **GIVEN** page 12 belongs to CV
- **WHEN** INS staff ask for page 12
- **THEN** they get not found
### Requirement: The Pages List
`/pages` SHALL list the pages in scope with their title, public address, status, an "Unpublished changes" mark when a published page has a draft, and last update, with a search by title or slug and an Add page action. Each row SHALL open its editor and offer Duplicate. Pages SHALL appear in the sidebar for users with `BO_PAGES`.
#### Scenario: Draft in the list
- **GIVEN** INS page `launch` is a draft
- **WHEN** INS staff open `/pages`
- **THEN** its row shows status Draft and address `/p/INS/launch`
#### Scenario: Unpublished changes in the list
- **GIVEN** INS page `hotel` is published and has a saved draft
- **WHEN** INS staff open `/pages`
- **THEN** its row shows status Published and "Unpublished changes"
### Requirement: The Page Editor
At 1024 px and wider the editor SHALL be the on-page editor. Below 1024 px it SHALL be the form editor. Both SHALL offer the title, a slug filled from the title until edited, a meta description with a 160-character counter, the status, adding, moving and removing blocks, and images uploaded only on save. A FORM block SHALL pick from the company's enabled events that have not ended.
#### Scenario: Slug follows the title until edited
- **GIVEN** a new page
- **WHEN** staff type the title "Hotel Technology"
- **THEN** the slug becomes `hotel-technology`
#### Scenario: Narrow window keeps the form
- **WHEN** staff open a page in a window 900 px wide
- **THEN** the form editor shows, with Preview
### Requirement: Saving And Deleting In The Editor
Server field errors SHALL show at their fields, keeping all entered values. After a save the editor SHALL offer a link to view the page. Deleting a page SHALL ask first. With unsaved edits, reloading, closing and following an in-app link SHALL ask first.
#### Scenario: Server error at its field
- **WHEN** staff save a HERO button link `javascript:alert(1)`
- **THEN** the error shows at that button link and every entered value stays
#### Scenario: Leaving by an in-app link
- **GIVEN** staff changed a heading and did not save
- **WHEN** they click Pages in the menu
- **THEN** the editor asks before leaving, and Cancel keeps them on the page with the change
### Requirement: Custom HTML Runs Sealed
The public page and the staff preview SHALL show each HTML block in a sandboxed frame loaded from its own address. Each frame response SHALL carry a Content-Security-Policy whose `sandbox` directive allows scripts and pop-ups only, so the HTML runs with an opaque origin even when the address is opened directly, and whose `frame-ancestors` directive allows only the Co-Lite site. The frame element SHALL NOT grant same-origin, form submission, top-level navigation or modal dialogs.
#### Scenario: Public frame is sealed
- **GIVEN** INS page `hotel-technology` is published with an HTML block at index 0
- **WHEN** a visitor's browser loads `/p/INS/hotel-technology/frame/0`
- **THEN** the response is the block's HTML with a `sandbox` policy that allows scripts and pop-ups and not same-origin
- **AND** its `frame-ancestors` allows only the Co-Lite site
#### Scenario: Pasted HTML cannot reach the visitor's session
- **GIVEN** a published HTML block whose script reads `document.cookie` and calls `/api/auth/session`
- **WHEN** the page is shown
- **THEN** the script sees no Co-Lite cookies and its call carries no Co-Lite session
### Requirement: Custom HTML Frame Addresses
The public frame address SHALL be `/p///frame/` and SHALL answer only for an HTML block of a published page; every other request SHALL get the same not-found response. The preview frame address SHALL be `/pages//preview/frame/` and SHALL require a signed-in user with `BO_PAGES` who may see that page.
#### Scenario: No frame for a draft, a missing block or a non-HTML block
- **WHEN** a visitor loads the frame address of a draft page, of block 7 of a page with 3 blocks, or of a FORM block
- **THEN** each answers with the same not-found response
#### Scenario: Staff preview of a draft frame
- **GIVEN** a draft page with an HTML block
- **WHEN** a signed-in user with `BO_PAGES` of that page's company opens the preview
- **THEN** the frame shows the draft HTML, sealed as on the public page
- **AND** the same address without a session sends the browser to sign in
### Requirement: Custom HTML Frame Height
The frame SHALL grow or shrink to fit its content, between 20 and 20000 pixels, using height reports sent by that frame only. Before the first report it SHALL be 600 pixels tall. The frame SHALL report the height of its content, not of its own window, and SHALL report again whenever the page asks, which the page SHALL do once it listens and when the frame loads.
#### Scenario: A tall paste grows the frame
- **GIVEN** a published HTML block whose content is 3000 pixels tall
- **WHEN** a visitor opens the page
- **THEN** the frame is 3000 pixels tall and shows no inner scroll bar
#### Scenario: A short top bar shrinks the frame
- **GIVEN** a published HTML block holding only a 68 pixel top bar
- **WHEN** a visitor opens the page, even if the frame loaded before the page was ready
- **THEN** the frame is 68 pixels tall, with no blank space below the bar
#### Scenario: Another frame cannot resize it
- **WHEN** a different window posts a height report to the page
- **THEN** the frame's height does not change
### Requirement: The Custom HTML Block In The Editor
The editor SHALL offer adding a Custom HTML block, edited in a monospace text box with a 200000-character counter and a note that forms inside it do not send. On the canvas the block SHALL show its last saved version as a sealed frame, marked "Save to update" while its HTML has unsaved edits. The editor SHALL offer a "hide page header" switch.
#### Scenario: Adding a Custom HTML block
- **WHEN** staff add a Custom HTML block and paste HTML into it
- **THEN** the block shows the pasted HTML, the character count and the note about forms
#### Scenario: Unsaved HTML on the canvas
- **GIVEN** a saved page with a Custom HTML block
- **WHEN** staff change its HTML in the panel
- **THEN** the canvas marks the block "Save to update"
- **AND** after Save the canvas shows the new HTML
#### Scenario: Hiding the header
- **WHEN** staff turn on "hide page header" and save
- **THEN** reading the page returns "hide header" on
### Requirement: Hide Page Header
When a page's "hide header" flag is on, its public page and its preview SHALL NOT show the company header or the page title, and SHALL still use the page title in the browser title and the page metadata.
#### Scenario: Header hidden
- **GIVEN** INS page `hotel-technology` has "hide header" on
- **WHEN** a visitor opens it
- **THEN** no company logo bar or page title heading shows above the first block
- **AND** the browser title is still the page title
### Requirement: Block Link Names
Any block MAY carry a link name. A link name SHALL be 1 to 40 characters of lowercase letters, digits and `-`, starting with a letter or digit, SHALL NOT start with `reg-` (the sign-up form's own field ids), and SHALL be unique within the page. A save breaking either rule SHALL be refused on that block's link-name field, writing nothing. The public page and the staff preview SHALL give the block that name as its element id, so a `#name` link scrolls to it.
#### Scenario: Hero button jumps to the form
- **GIVEN** a published page whose FORM block has the link name `signup` and whose HERO button links to `#signup`
- **WHEN** a visitor clicks the button
- **THEN** the page scrolls to the form
#### Scenario: Duplicate link name
- **WHEN** a page is saved with two blocks named `signup`
- **THEN** the save is refused on field `blocks[1].anchor` and nothing is written
#### Scenario: Reserved link name
- **WHEN** a page is saved with a block named `reg-email`
- **THEN** the save is refused on field `blocks[0].anchor` and nothing is written
#### Scenario: Bad link name
- **WHEN** a page is saved with a block named `Sign Up`
- **THEN** the save is refused on field `blocks[0].anchor` and nothing is written
### Requirement: Same-Page Links From A Custom HTML Frame
A click on a `#name` link inside a Custom HTML block SHALL scroll the page, without navigating the frame. The target SHALL be the element with that id inside the same frame when there is one, otherwise the block on the page with that link name, otherwise nothing happens. The page SHALL act only on such requests from its own frames and only for names of the link-name pattern. The frame SHALL gain no new sandbox permissions.
#### Scenario: Link to the form below the frame
- **GIVEN** a published page with an HTML block holding `` and a FORM block named `signup`
- **WHEN** a visitor clicks that link
- **THEN** the page scrolls to the form
#### Scenario: Link inside the frame
- **GIVEN** a published HTML block whose content holds `` near its bottom and an element with id `top` at its start
- **WHEN** a visitor scrolls down and clicks that link
- **THEN** the page scrolls back to the start of the frame
#### Scenario: Another window asks to scroll
- **WHEN** a different window posts a same-page link request to the page
- **THEN** the page does not scroll
### Requirement: Card Sections
A FEATURES, STEPS or TRUST block SHALL have 2 to 6 cards, with titles of at most 80 characters and texts of at most 300. FEATURES SHALL have a heading, an optional intro and cards with an icon from the fixed list, a title and a text. STEPS SHALL have a heading and numbered cards with a title and a text. TRUST SHALL have only card titles. A save breaking these rules, or using a card field its type lacks, SHALL be refused on that field.
#### Scenario: Feature cards show their icons
- **GIVEN** a published page with a FEATURES block of three cards with icons `wifi`, `tv` and `lock`
- **WHEN** a visitor opens it
- **THEN** the page shows the heading and three cards, each with its icon, title and text
#### Scenario: Unknown icon
- **WHEN** a page is saved with a FEATURES card whose icon is `rocket-launcher`
- **THEN** the save is refused on field `blocks[0].cards[0].icon`
#### Scenario: Too few cards
- **WHEN** a page is saved with a STEPS block of one card
- **THEN** the save is refused on field `blocks[0].cards`
#### Scenario: Steps are numbered
- **GIVEN** a published page with a STEPS block of three steps
- **WHEN** a visitor opens it
- **THEN** the steps show the numbers 1, 2 and 3 in order
### Requirement: Call-To-Action Band
A CTA block SHALL have a heading of at most 120 characters, an optional text of at most 300, and a button with both a label and a link following the button link rule. A save without the button SHALL be refused on the button field.
#### Scenario: A CTA needs its button
- **WHEN** a page is saved with a CTA block that has a heading and no button
- **THEN** the save is refused on field `blocks[0].buttonLabel`
### Requirement: Section Looks
Any block MAY carry a look: Default, Muted, Dark or Accent. Default, or no look, SHALL render as before. Muted, Dark and Accent SHALL render the block as a full-width band in that colour with text readable on it; Accent SHALL use the company's accent colour, or the default primary colour when the company has none. Any other look SHALL be refused on that block's look field.
#### Scenario: A dark band
- **GIVEN** a published page whose CTA block has the Dark look
- **WHEN** a visitor opens it
- **THEN** the CTA shows as a dark full-width band with light text
#### Scenario: Existing pages unchanged
- **GIVEN** a page saved before this change, whose blocks have no look
- **WHEN** a visitor opens it
- **THEN** it renders as it did before
#### Scenario: Unknown look
- **WHEN** a page is saved with a block whose look is `NEON`
- **THEN** the save is refused on field `blocks[0].look`
### Requirement: Hero Image Is Optional
A HERO block MAY have no image; it then shows its heading, text and button on its look's background. When it has an image, the image SHALL still belong to the page's company.
#### Scenario: Hero without an image
- **WHEN** a page is saved with a HERO block that has a heading and no image
- **THEN** the save succeeds
### Requirement: New Sections In The Editor
Both editors SHALL offer adding FEATURES, STEPS, TRUST and CTA blocks, editing their fields, adding, removing and reordering cards, and choosing any block's look. Refusals SHALL show at the field they name, including card fields.
#### Scenario: A refused card title shows at its field
- **GIVEN** staff editing a page with a FEATURES block
- **WHEN** the save is refused on field `blocks[0].cards[1].title`
- **THEN** the message shows at the second card's title field
### Requirement: Published Pages Keep A Separate Draft
Saving a published page with status Published SHALL store the content as the page's draft, checked by the same rules as any save, and SHALL NOT change what visitors see. Saving a published page with status Draft SHALL unpublish it, write the content to the page and drop any draft. A page that is not published SHALL save directly, as before. The staff preview and the editor SHALL show the draft when there is one.
#### Scenario: Editing a live page does not change it for visitors
- **GIVEN** INS page `hotel` is published with heading "Hotel day"
- **WHEN** staff change the heading to "Hotel week" and save
- **THEN** visitors still see "Hotel day"
- **AND** the editor and the staff preview show "Hotel week"
#### Scenario: Unpublishing drops the draft
- **GIVEN** a published page with a draft
- **WHEN** staff choose status Draft and save
- **THEN** the page is a draft with the saved content and no separate draft
### Requirement: Publish And Discard Changes
Publishing a page's changes SHALL check its draft again by the same rules, including a unique slug, then make it the page's content and drop the draft. A refusal SHALL show at its field and change nothing. Discarding changes SHALL ask first, then drop the draft so the editor shows the published content again. Both SHALL be limited to pages in the caller's company scope.
#### Scenario: Publish changes
- **GIVEN** published page `hotel` has a draft with heading "Hotel week"
- **WHEN** staff press Publish changes
- **THEN** visitors see "Hotel week" and the page has no draft
#### Scenario: Publish refused for a taken slug
- **GIVEN** a draft with slug `launch` and another page published with slug `launch` since
- **WHEN** staff press Publish changes
- **THEN** the publish is refused on field `slug` and visitors still see the old content
#### Scenario: Discard changes
- **GIVEN** published page `hotel` has a draft
- **WHEN** staff press Discard changes and confirm
- **THEN** the draft is gone and the editor shows the published content
#### Scenario: Another company's page
- **WHEN** CV staff ask to publish INS page `hotel`
- **THEN** the request is answered "not found" and nothing changes
### Requirement: Starter Templates
New page SHALL first offer Blank, Event sign-up and Service showcase. A template SHALL fill the editor with its sections, placeholder text, a sign-up form with link name `signup` and no event, and buttons linking to `#signup`; nothing is stored until staff save. Every template's sections SHALL pass the server's block rules once an event is chosen.
#### Scenario: Start from the event template
- **WHEN** staff choose New page, then Event sign-up
- **THEN** the editor shows a hero, trust strip, feature cards, steps, FAQ and a sign-up form, filled with placeholder text
- **AND** saving it without choosing the form's event is refused on that event field
### Requirement: Duplicate A Page
Duplicate SHALL open the editor with a copy of the page's current content (its draft when there is one), as a new unsaved draft page of the same company titled " (copy)" with slug "-copy". Nothing SHALL be stored until staff save.
#### Scenario: Duplicate last event's page
- **GIVEN** INS page `hotel` titled "Hotel day"
- **WHEN** staff press Duplicate on it and save
- **THEN** a new draft INS page `hotel-copy` titled "Hotel day (copy)" exists with the same sections
### Requirement: The Page Canvas
The on-page editor SHALL show the page on a canvas, rendered as visitors see it, with a Desktop view (1280 px wide, scaled to fit) and a Phone view (390 px wide). Changes SHALL show on the canvas as they are made, before saving. Links and buttons on the canvas SHALL NOT navigate, and the sign-up form SHALL show its preview note.
#### Scenario: Phone view uses the phone layout
- **GIVEN** a page with a FEATURES block of three cards
- **WHEN** staff switch to Phone
- **THEN** the cards stack in one column on the canvas
#### Scenario: A change shows before saving
- **WHEN** staff change a FEATURES card title in the side panel
- **THEN** the canvas shows the new title at once
### Requirement: Edit Text On The Page
Clicking a heading, short text, button label, card title or text, or FAQ question or answer on the canvas SHALL edit it in place as plain text, with the server's length limit shown when close. Rich text SHALL be edited in place with bold, italic, link, lists and alignment, and links SHALL follow the page link rule. An empty field SHALL show a faded cue naming it, and empty rich text SHALL keep room to click into. Clicking an image spot SHALL open the file picker.
#### Scenario: Edit a heading in place
- **WHEN** staff click the hero heading on the canvas and type "Hotel week"
- **THEN** the canvas and the side panel show "Hotel week"
#### Scenario: An unsafe link is refused in rich text
- **WHEN** staff add the link `javascript:alert(1)` in a Text block on the canvas
- **THEN** the link is not added and the toolbar says why
### Requirement: Section Selection And Actions
Clicking a section on the canvas SHALL select it, outline it and show its settings in the side panel. With none selected, the panel SHALL show the page settings. A selected section SHALL offer drag, up, down, duplicate and delete. "Add section" between sections and at the end SHALL offer every block type. Up and down SHALL work from the keyboard. A section that is added, duplicated or moved SHALL be brought into view on the canvas.
#### Scenario: Duplicate a section
- **WHEN** staff select the second section and press Duplicate
- **THEN** a copy appears as the third section and is selected
#### Scenario: Add a section between two
- **WHEN** staff press Add section between the first and second sections and choose Steps
- **THEN** a Steps section appears second and is selected
#### Scenario: Add a section from the side panel
- **GIVEN** the canvas shows the top of a long page
- **WHEN** staff press Add Text in the side panel
- **THEN** the canvas scrolls to the new Text section at the end, which shows a faded "Content" cue to type into
### Requirement: Undo And Redo
The on-page editor SHALL undo and redo page changes, up to 50 steps, by buttons and by Ctrl+Z and Ctrl+Shift+Z. The keys SHALL work wherever focus is in the editor, including after the focused control is removed or disabled, except inside a field outside the editor. Typing in one field SHALL be one step. Saving SHALL NOT clear the history.
#### Scenario: Undo a delete
- **GIVEN** staff deleted the FAQ section
- **WHEN** they press Ctrl+Z
- **THEN** the FAQ section is back in its place with its content
### Requirement: Refusals On The Canvas
When a save or publish is refused on a block field, the editor SHALL select that block, outline it, scroll it into view and show the message at the field in the side panel. A refusal on a page field SHALL show in the page settings.
#### Scenario: A form without an event
- **GIVEN** a page from the Event sign-up template
- **WHEN** staff save without choosing the form's event
- **THEN** the form section is selected and outlined and the panel shows the message at the Event field
### Requirement: Hero With A Sign-Up Form
A HERO block MAY name an event. When it does, the hero SHALL show Co-Lite's sign-up form for that event in a card beside its heading, text and button on wide screens, and below them on narrow screens. The hero's form SHALL follow every rule of the FORM block (see "The Form Block Registers For An Event" and "The Form Block Closes With Its Event"). A HERO block without an event SHALL show no form.
#### Scenario: Sign up from the hero
- **GIVEN** page `/p/INS/hotel-technology` has a HERO block whose event is `INS website enquiries`
- **WHEN** a new visitor submits the form in the hero from a URL with `utm_source=facebook`
- **THEN** a new lead and an event lead with source Web page, no salesperson and UTM source `facebook` are created
#### Scenario: Hero form closes with its event
- **GIVEN** the HERO block's event ended yesterday
- **WHEN** a visitor opens the page
- **THEN** the hero still shows its heading and text, and its form area says sign-up is closed
#### Scenario: Hero without an event
- **WHEN** a visitor opens a page whose HERO block names no event
- **THEN** the hero shows no form
- **AND** a submit addressed to that block is refused as not found
#### Scenario: Pick the hero's event in the editor
- **GIVEN** staff editing a page with a HERO block
- **WHEN** they pick `INS website enquiries` under the hero's sign-up form setting
- **THEN** the canvas shows the form card beside the hero text
- **AND** choosing "No form" removes it
### Requirement: Full-Width Hero
A HERO block MAY be marked full width. A full-width hero SHALL span the whole window with square corners, show its heading larger and centred top to bottom in the hero's opening height (not beside a long form), and use a shade that is darker on the text side than on the far side. A hero that is not marked full width SHALL look as it did before. The server SHALL refuse a `fullWidth` value that is not true or false.
#### Scenario: Hero runs edge to edge under a Custom HTML top bar
- **GIVEN** page `/p/INS/hotel-technology` with a Custom HTML top bar followed by a full-width HERO with an image and an event
- **WHEN** a visitor opens the page in a 1280 px window
- **THEN** the hero spans the full window width
- **AND** the form card sits beside the heading
#### Scenario: Existing hero unchanged
- **WHEN** a visitor opens a page whose HERO block is not marked full width
- **THEN** the hero sits inside the page width with rounded corners, as before
#### Scenario: Turn on full width in the editor
- **GIVEN** staff editing a page with a HERO block
- **WHEN** they switch on "Full width" in the hero's settings
- **THEN** the canvas shows the hero across the full width
### Requirement: Full-Width Blocks Join Without Gaps
A full-width HERO, a Custom HTML block, and a block with a non-default look SHALL join with no gap when two of them are next to each other. Other blocks SHALL keep their usual spacing.
#### Scenario: Top bar runs straight into the hero
- **GIVEN** a Custom HTML top bar followed by a full-width HERO
- **WHEN** a visitor opens the page
- **THEN** the hero starts directly under the top bar, with no gap
#### Scenario: Dark call to action runs into a dark footer
- **GIVEN** a CTA block with the Dark look followed by a text block with the Dark look
- **WHEN** a visitor opens the page
- **THEN** the two bands join with no gap between them
### Requirement: Hero Points
A HERO block MAY carry up to 6 points, each a non-empty title of at most 80 characters, with no icon and no text. The hero SHALL show its points as a bulleted list under its text. The server SHALL refuse more than 6 points, an empty or over-long point, and a point with an icon or text, naming the field.
#### Scenario: Points under the hero text
- **GIVEN** a HERO block with points "One accountable partner instead of five vendors" and "Local support team in Malaysia"
- **WHEN** a visitor opens the page
- **THEN** both points show as a bulleted list under the hero text
#### Scenario: Too many points refused
- **WHEN** staff save a HERO block with 7 points
- **THEN** the save is refused at `blocks[n].cards`
### Requirement: Hero Form Heading
A HERO block with an event MAY carry a form heading of at most 80 characters and a form text of at most 200 characters. The hero SHALL show them at the top of its form card, above the form. The server SHALL refuse either on a hero without an event. On the canvas, staff SHALL be able to type both in place.
#### Scenario: Card shows its heading
- **GIVEN** a HERO block with an event, form heading "Get a free consultation" and form text "Tell us about your property. It takes under a minute."
- **WHEN** a visitor opens the page
- **THEN** the form card starts with that heading and text, followed by the form
#### Scenario: Form heading without a form refused
- **WHEN** staff save a HERO block with a form heading and no event
- **THEN** the save is refused at `blocks[n].formHeading`
### Requirement: Image Upload For Custom HTML
A Custom HTML block's panel in the editor SHALL offer an image upload for the page's company, under the same checks as other page images. On success it SHALL show the image's preview and its public link with a copy button; on refusal it SHALL show the reason. The upload SHALL NOT change the block's HTML.
#### Scenario: Upload an image for the HTML
- **GIVEN** staff editing an INS page with a Custom HTML block
- **WHEN** they choose `lobby.webp` under "Upload image" in that block's panel
- **THEN** the image is stored for INS and the panel shows its preview and the link `/api/public/page-images/`
- **AND** "Copy link" copies that link, and the block's HTML is unchanged
#### Scenario: Refused upload
- **WHEN** staff choose a 3 MB JPEG under "Upload image"
- **THEN** the panel shows that the image is too large, and no link appears
#### Scenario: New page without a company
- **GIVEN** a super admin's new page with no company chosen
- **WHEN** they choose a file under "Upload image"
- **THEN** nothing is uploaded and the panel asks them to choose a company
### Requirement: Compact Landing-Page Form
A landing page's sign-up form, in a FORM block or a hero, SHALL show name, mobile, email and company, the event's interests as one optional dropdown, the privacy notice folded behind a single line that opens it in full, and the consent box. It SHALL NOT show a job-title field. QR, invitation and customer sign-up forms SHALL keep their full layout.
#### Scenario: Short form on the page
- **GIVEN** a page whose hero has an event with five interests
- **WHEN** a visitor opens the page
- **THEN** the form shows name, mobile, email, company, a "Service interested in" dropdown and the consent box, with no job title and no interest checkboxes
- **AND** the privacy notice is folded behind "How we use your details"
#### Scenario: Pick one service
- **WHEN** the visitor chooses "Cloud IP PABX" in the dropdown and submits
- **THEN** the submission carries that one interest
#### Scenario: Read the notice
- **WHEN** the visitor opens "How we use your details"
- **THEN** the full English and Malay notice shows above the consent box
#### Scenario: QR form unchanged
- **WHEN** a visitor opens an event's QR sign-up form
- **THEN** it shows job title, the interest checkboxes and the full notice as before
### Requirement: Thank-You Text On Landing Forms
A FORM block, and a HERO block with an event, MAY carry a thank-you text of at most 200 characters. After a visitor signs up through that block's form, the page SHALL show the text, with contact links, under the thank-you heading. Without it, the thank-you SHALL look as before. The server SHALL refuse an over-long thank-you text, or one on a HERO without an event.
#### Scenario: Visitor sees the page's thank-you text with a call link
- **GIVEN** page `/p/INS/hotel-technology-native` whose hero form has the thank-you text "Prefer to talk now? Call +60 12-833 2775."
- **WHEN** a visitor signs up through the hero form
- **THEN** the page shows the thank-you heading and "Prefer to talk now? Call +60 12-833 2775."
- **AND** "+60 12-833 2775" is a link to `tel:+60128332775`
#### Scenario: No thank-you text keeps today's message
- **WHEN** a visitor signs up through a FORM block without a thank-you text
- **THEN** the page shows only the thank-you heading and the "register another" button, as before
#### Scenario: Thank-you text on a hero without a form is refused
- **WHEN** staff save a HERO block without an event but with a thank-you text
- **THEN** the save is refused with the reason naming the hero's thank-you field
#### Scenario: Set the thank-you text in the editor
- **GIVEN** staff editing a hero that has an event
- **WHEN** they type a thank-you text in the hero's settings and save
- **THEN** the page keeps the text
- **AND** choosing "No form" on the hero clears it
### Requirement: Footer Block
A page MAY hold FOOTER blocks: 1 to 4 columns, each a required title (80 characters) and text (300 characters), and an optional legal line (300 characters). The page SHALL show the columns side by side on wide screens and stacked on phones, keep line breaks, show contact links in the column text, and put the legal line under a thin divider. A new footer SHALL start with the dark look. The server SHALL refuse a footer that breaks these limits, or that has a heading or a column icon.
#### Scenario: Visitor sees a three-column footer with links
- **GIVEN** a published page whose footer has the columns "Infinity Networks Security Sdn Bhd", "Talk to us" with "+603-7623 9807" and "info@infinitynetworks.com.my", and "Website" with "www.infinitynetworks.com.my", and a legal line
- **WHEN** a visitor opens the page in a 1280 px window
- **THEN** the three columns sit side by side on a dark band
- **AND** the phone links to `tel:+60376239807`, the email to `mailto:info@infinitynetworks.com.my`, and the website to `https://www.infinitynetworks.com.my`
- **AND** the legal line sits under a divider
#### Scenario: Add a footer in the editor
- **GIVEN** staff editing a page
- **WHEN** they add a Footer section
- **THEN** the canvas shows a dark footer with two empty columns to type into
- **AND** they can add columns up to 4 and type the legal line
#### Scenario: Footer with five columns is refused
- **WHEN** a page is saved with a footer of 5 columns
- **THEN** the save is refused with the reason naming the footer's columns
### Requirement: Contact Links In Plain Text
Where this spec says text shows contact links, the page SHALL show phone numbers that start with `+` as `tel:` links holding only `+` and digits, email addresses as `mailto:` links, and `https://` or `www.` addresses as `https://` links that open in a new tab. Everything else SHALL stay plain text, never HTML.
#### Scenario: Text with markup stays text
- **GIVEN** a footer column text "Call +60 12-833 2775"
- **WHEN** a visitor opens the page
- **THEN** "Call" shows as written
- **AND** "+60 12-833 2775" links to `tel:+60128332775`
### Requirement: Top Bar Block
A page's first block MAY be a top bar. The top bar SHALL show the company logo, or the company name when there is no logo, and an optional button, and SHALL stay at the top of the window while the page scrolls. The server SHALL refuse a top bar that is not the first block, or one that carries fields other than its button and link name.
#### Scenario: Logo and button without the page title
- **GIVEN** page `/p/INS/hotel-technology-native` with "hide page header" on, a top bar with the button "Get My Free Consultation" linking to `#consult`, and a full-width hero
- **WHEN** a visitor opens the page and scrolls down
- **THEN** the INS logo and the button stay at the top of the window
- **AND** no page title heading shows, and the hero starts directly under the bar
#### Scenario: Top bar further down is refused
- **WHEN** staff save a page whose top bar is the second block
- **THEN** the save is refused with the reason naming that block
### Requirement: Section Labels
Feature cards, Steps, Image with text, FAQ and Call to action blocks MAY carry a label of at most 40 characters. The page SHALL show the label above the block's heading, in small uppercase letters in the accent colour. The server SHALL refuse a longer label, or a label on any other block type.
#### Scenario: Label above a heading
- **GIVEN** a Feature cards block with the label "Services" and the heading "Everything your guests touch, handled by one team"
- **WHEN** a visitor opens the page
- **THEN** "Services" shows in small uppercase letters directly above the heading
#### Scenario: Type a label in the editor
- **GIVEN** staff editing a Steps block
- **WHEN** they type "How we work" in its label field and save
- **THEN** the page keeps the label
### Requirement: Serif Section Headings
Section headings on landing pages SHALL use the serif typeface that the full-width hero uses.
#### Scenario: Feature heading in serif
- **WHEN** a visitor opens a page with a Feature cards block
- **THEN** its heading uses the serif typeface
### Requirement: First Screen Fits The Hero And Trust Strip
A page with a top bar, a full-width hero with its sign-up form, and a trust strip SHALL show all three in full within the first 950 px of a desktop browser window. To fit, the trust strip band SHALL use less padding than other bands, and the landing-page form SHALL keep its fields, dropdown and button at least 44 px tall.
#### Scenario: INS page on a 1080p desktop
- **GIVEN** page `/p/INS/hotel-technology` with a top bar, a full-width hero with a form, and a trust strip
- **WHEN** a visitor opens it in a 1920×1080 browser window
- **THEN** the bottom of the trust strip is within 950 px of the top of the page
#### Scenario: Form controls stay easy to tap
- **WHEN** a visitor opens a landing page with a sign-up form
- **THEN** each text field, the service dropdown and the Register button are at least 44 px tall