waygraph / PageBlockOptions
Type Alias: PageBlockOptions<Out, M, E, R, Nav, U, Q, F, C, Lk>
PageBlockOptions<
Out,M,E,R,Nav,U,Q,F,C,Lk> =object
Defined in: src/engine/block/kinds/page.ts:96
Type Parameters
Out
Out extends Checkpoint<string>
M
M extends Record<string, PageMethodEntry> = Record<string, PageMethodEntry>
E
E extends Record<string, PageExpectEntry> = Record<string, PageExpectEntry>
R
R extends PageRead = PageRead
Nav
Nav = undefined
U
U extends string = string
Q
Q extends string = never
F
F extends "folder" | undefined = undefined
C
C extends Checkpoint<string> | string = Out
Lk
Lk extends Record<string, unknown> = Record<never, never>
Properties
checkpoint?
optionalcheckpoint?:C
Defined in: src/engine/block/kinds/page.ts:115
The Checkpoint this page confirms. A name makes it (checkpoint: "Home"): the page is its own Checkpoint, with nothing to declare beforehand; Home.checkpoint is the value, for what must name it (lands, a flow's from). Left out, the Block is a bare shell: it covers pages (covers) but is no page itself.
click?
optionalclick?:string| ((mem) =>string)
Defined in: src/engine/block/kinds/page.ts:215
Optional click-nav onto this page. XOR with url.
covers?
optionalcovers?:"children"| readonlyPageName[]
Defined in: src/engine/block/kinds/page.ts:198
The page covers other pages, as a shell does (a sidebar, a top bar): "children" is every page under its folder (nested shells stack), a list of names is those pages wherever they live. What the shell declares (links, interrupts, and its read) applies on every covered page, and the map draws it as one box around them.
Example
covers: "children" · covers: ["Documents", "Templates"]description?
optionaldescription?:string
Defined in: src/engine/block/kinds/page.ts:109
do?
optionaldo?: (page) =>M
Defined in: src/engine/block/kinds/page.ts:149
What you can do here: the page's moves by name, from a function of the page, called the first time the page's do is used (after every file is loaded, so the page and its Methods can import each other).
Parameters
page
PageSelf<Out, R, Nav>
Returns
M
Example
do: () => ({ addToCart: AddToCart, openModal: OpenModal })expect?
optionalexpect?:ExpectList<Out>
Defined in: src/engine/block/kinds/page.ts:123
What this Block promises wherever it's used, checked after its verify: Expect Blocks, Traits, Key.is(...). A Block that can land in several places lists them per outcome. Read-only and run together; a step can drop them ({ expect: false }) or add its own.
Example
expect: [ExpectArchivedToastBlock] · expect: { EquipmentDetail: [ExpectSavedBlock], EquipmentAdd: [ExpectNameRequiredBlock] }expects?
optionalexpects?:E| ((page) =>E)
Defined in: src/engine/block/kinds/page.ts:156
What a scenario can expect on this page, by name: Expect Blocks, Traits (page.read.modalOpen.is(true)), or () => Block factories; as a record, or a function of the page (called the first time it's used). The page's expects, typed, for a step's expect: [...].
Example
expects: (page) => ({ modalShown: page.read.modalOpen.is(true), saved: SavedExpectBlock })for?
optionalfor?: readonlyAccount[]
Defined in: src/engine/block/kinds/page.ts:222
The accounts that can open this page; without it, every account. The access tests try it as each other account and expect it not to open; waygraph check flags a flow as one of them that goes there.
Example
for: [PlantManager, Admin]frame?
optionalframe?:string
Defined in: src/engine/block/kinds/page.ts:191
The page lives in an iframe on another page (an embedded widget): its Blocks, checks and read see the page with every locator inside this frame, so no selector carries a prefix.
Example
frame: "#zsign-embed"from?
optionalfrom?: readonly (PageName|Checkpoint<string>)[]
Defined in: src/engine/block/kinds/page.ts:169
The pages it can be opened from, with a url or click. Omit = from anywhere. Set it for a page that only exists after something else (every in-app page after sign-in), so route finding goes through the sign-in steps.
Example
from: SIGNED_INinstanceOptions?
optionalinstanceOptions?:Block<Checkpoint<string>,Out>["instanceOptions"]
Defined in: src/engine/block/kinds/page.ts:216
interrupts?
optionalinterrupts?:Record<string, {do: (page) =>Promise<void>;when:string; }>
Defined in: src/engine/block/kinds/page.ts:213
What can appear on any covered page and get in the way (a cookie banner, a sound prompt), each handled where it shows up: when is the selector that shows it, do what to do. Logged, and shown in the demo; never a step.
links?
optionallinks?: (self) =>Lk
Defined in: src/engine/block/kinds/page.ts:206
The links every covered page has (a sidebar's): Shell.links.documents, each a Nav valid from any covered page, so a flow writes .gotoPage(Shell.links.documents) once instead of a Nav per page.
Parameters
self
PageSelf<CheckpointOf<C>, R, Nav>
Returns
Lk
Example
links: (self) => ({ documents: self.link({ to: "Documents", click: Sel.documents }) })methods?
optionalmethods?: readonlyPageMethodEntry[] |M
Defined in: src/engine/block/kinds/page.ts:135
Methods available on this page: a record of Blocks (or () => Block factories, lazy so the page object can colocate method definitions), or an array. A record's Blocks are also the page's do, by name, typed.
Deprecated
Name them in do: () => ({ addItem: AddItemBlock }). waygraph upgrade --codemod page-object converts a project.
name
name:
string
Defined in: src/engine/block/kinds/page.ts:108
nav?
optionalnav?:NavBlock<Out>
Defined in: src/engine/block/kinds/page.ts:163
The Nav Block that opens this page (its _nav.block.ts): the page's nav, so a flow imports the page alone.
Deprecated
Give the page its own url (or click) and from: the page opens itself, map().gotoPage(LoginPage). waygraph upgrade --codemod nav converts a project.
Example
definePageBlock({ ..., nav: NavLoginBlock }) · map().gotoPage(LoginPage.nav).method(LoginPage.do.fillUsername)needs?
optionalneeds?: readonlyMemKey<boolean>[]
Defined in: src/engine/block/kinds/page.ts:200
States (boolean mem keys from state()) the app must be in to reach this page; on a shell, every page it covers: needs: [Auth.signedIn].
opens?
optionalopens?:string
Defined in: src/engine/block/kinds/page.ts:208
A menu that hides its links until opened (a burger, a user dropdown): the selector of what opens it; a link clicks it first.
query?
optionalquery?: readonlyQ[]
Defined in: src/engine/block/kinds/page.ts:180
The query params the page keeps in its address (?tab=files): state of the page, not a page of its own. Page.go({ id, tab }) opens with them, Page.setQuery({ tab }) changes them, and arrival checks them.
Example
query: ["tab", "filter"]read?
optionalread?: (ctx) =>R
Defined in: src/engine/block/kinds/page.ts:141
What the page shows: its fields, read after a step lands here (the run log, the demo, Waygraph Studio and checks read them). Field types are inferred. Write it before do and expects, which build on it.
Parameters
ctx
Returns
R
Example
read: (ctx) => ({ sort: ctx.page.value(Sel.sort), modalOpen: ctx.page.visible(Sel.modal) })readAs?
optionalreadAs?:string
Defined in: src/engine/block/kinds/page.ts:143
The namespace of its fields in the run log (sort is inventory.sort). Default: the Checkpoint's name, lower-cased first.
requires?
optionalrequires?: readonlyMemKey<unknown>[]
Defined in: src/engine/block/kinds/page.ts:129
route?
optionalroute?:F
Defined in: src/engine/block/kinds/page.ts:185
"folder": the page's address is its folder under src/map/ (requests/[id]/ is /requests/[id]), as in Next.js and Nuxt; no url to write, and it can't disagree with where the page lives. Page.go({ id }) fills the [id].
screenshot?
optionalscreenshot?:StepScreenshot
Defined in: src/engine/block/kinds/page.ts:128
A screenshot of this page whenever a step lands on it (true, or { fullPage: true }): kept with the run, and the newest one shows on Waygraph Studio's map.
url?
optionalurl?:U| ((mem) =>string)
Defined in: src/engine/block/kinds/page.ts:174
Optional deep-link onto this page (goto). XOR with click. Omit when the hub is arrival-only (previous Block already resolved here).
verify?
Defined in: src/engine/block/kinds/page.ts:116