# How to read a UJN drawing You can read a UJN drawing without ever writing one: each shape, line and tab has one meaning, and this page shows them on small drawings. ## The checkout, explained PINNED_CHECKOUT Read it the way the journey goes, from left to right. A solid arrow moves the user on. A dashed one goes back, or comes back from outside the app, as Approve does from the bank app (13.7). A red one with a cross is a failure. The pill on an arrow names what the user does, such as Pay or Approve; out of an action, where nobody clicks, it says when that way is taken (approval needed, card refused). Braces list what an arrow carries: `{card, amount}` goes to the payment provider and `{result}` comes back. ## Arrows There are four kinds of line (13.2). The pill reads "Trigger · guard": what the user does, then when this way is the one taken (13.4). ### Navigation A solid line with a filled head: the user moves on. The pill names the button or link. ```ujn view cart { title: "Cart"; route: /cart } view checkout { title: "Checkout"; route: /checkout } cart --> checkout : [Check out] ``` ### Failure path Solid and red, with a cross: an error or a rejection. Both arrows start with Pay; the text after the dot says which one is taken. ```ujn view checkout { title: "Checkout"; route: /checkout } view confirmed { title: "Order confirmed"; route: /orders/:id } view refused { type: toast; title: "Card refused" } checkout --> confirmed : [Pay] card accepted checkout -x-> refused : [Pay] card refused ``` ### Return Dashed, with an open head: the user goes back, as when a modal closes. It runs right under the arrow it answers (13.7). ```ujn view checkout { title: "Checkout"; route: /checkout } view terms { type: modal; title: "Terms of sale" } checkout --> terms : [Read terms] terms ..> checkout : [Close] ``` ### Failed return Dashed and red, with a cross: the user goes back because something failed. Here a refused card sends the user straight back to Checkout, with no error screen. ```ujn view checkout { title: "Checkout"; route: /checkout } action authorize { title: "Authorize payment" } view confirmed { title: "Order confirmed"; route: /orders/:id } checkout --> authorize : [Pay] authorize --> confirmed : approved authorize .x.> checkout : refused ``` ### A call to a system and its reply An action calls a system with a solid arrow, and the system replies with a dashed one. Neither has a pill: the braces say what is sent and what comes back. The user stays in the app (14.5). ```ujn action authorize { title: "Authorize payment" } system psp { type: external; title: "Payment provider"; host: api.pay.example } authorize --> psp { payload: [card, amount] } psp ..> authorize { payload: [result] } ``` ### An arrow after a flag A flagged arrow is dotted, with the flag's tab right of its pill. Everything reachable only through it inherits the flag: Pay later and Payment plan get outlined tabs, and the arrow between them is dotted with no tab of its own (13.8). ```ujn view checkout { title: "Checkout"; route: /checkout } view pay_later { title: "Pay later"; route: /checkout/later } view plan { title: "Payment plan"; route: /checkout/plan } checkout --> pay_later : [Pay later] { flags: [future] } pay_later --> plan : [Continue] ``` ## Flags A flag never changes a shape. The border goes dotted, and a tab inside the right edge shows the flag: filled where it is set, outlined where it is inherited. UJN has eleven flags (section 8); these four say whether a part is built and whether it stays. | Flag | Tab | Means | Carries down the journey | |---|---|---|---| | `future` | » | Planned for a later release | Yes | | `deprecated` | ↓ | Exists, and is being retired | Yes | | `legacy` | L | Old, and staying | No, for now (23.3) | | `needs-updates` | U | Exists, but its design or code is out of date | No | `future` and `deprecated` carry down: everything reachable only through the flagged node inherits them. `legacy` and `needs-updates` stay where they are set. Their tabs show the letters L and U until their glyphs are designed (23.4, 23.28). ```ujn start from_cart { description: "From the cart" } view checkout { title: "Checkout"; route: /checkout; flags: [needs-updates] } view pay_later { title: "Pay later"; route: /checkout/later; flags: [future] } view plan { title: "Payment plan"; route: /checkout/plan } view transfer { title: "Bank transfer"; route: /checkout/transfer; flags: [legacy] } from_cart --> checkout checkout --> pay_later : [Pay later] pay_later --> plan : [Continue] checkout -up-> transfer : [Bank transfer] ``` Payment plan is planned too, because the only way to it is through Pay later: its tab is outlined and the arrow into it is dotted. Checkout needs updates, but the screens after it do not, so their arrows stay solid. ## Every kind of node UJN has nine kinds of node. The shape tells you the kind, and the icon and the type name inside tell you the type (19.4). ### Where a journey starts and ends - **Start** (17): a ring where the user enters the journey, one for each way in. Its types are plain, deep link, notification and handoff return. - **End** (17): a bullseye for each way the journey can end: success, failure, or abandoned (an octagon). - **Actor** (12): a person, in a box with cut corners and a dark band. The actor who starts the journey points at its start. ```ujn actor customer { title: "Customer"; role: Shopper } start from_cart { description: "From the cart" } start from_email { type: deep-link; description: "Link in a reminder email"; route: /checkout } view checkout { title: "Checkout"; route: /checkout } end paid { type: success; description: "Order paid" } end refused { type: failure; description: "Card refused" } end left { type: abandoned; description: "Closed the page" } customer --> from_cart from_cart --> checkout from_email --> checkout checkout --> paid : [Pay] card accepted checkout -x-> refused : [Pay] card refused checkout --> left : [Close] ``` ### Views - **View** (11): anything the user sees as a window. The title bar names its type. Each view is its own box, so a modal is never drawn inside its page: an arrow goes in and a return comes out. A page with what opens over it: a drawer (a panel at an edge), a popover (a small panel by a control), a modal (blocks the page until it closes) and a toast (a message that goes away by itself, so its return has no pill). ```ujn view orders { title: "Orders"; route: /orders } view filters { type: drawer; title: "Filters" } view tip { type: popover; title: "What is pending?" } view cancel { type: modal; title: "Cancel order?" } view canceled { type: toast; title: "Order canceled" } orders --> filters : [Filter] filters ..> orders : [Apply] orders --> tip : [?] orders --> cancel : [Cancel order] cancel ..> orders : [Keep it] cancel --> canceled : [Yes, cancel] canceled ..> orders ``` The other types: tabs (one tab shown at a time), new window (opens in another browser tab or window), wizard (steps in order, each its own view), embedded (third-party content inside the app) and waiting (the user waits while the system works). ```ujn view checkout { type: wizard; title: "Checkout"; description: "2 steps"; route: /checkout } view address { title: "Address"; description: "Step 1"; parent: checkout } view card { type: embedded; title: "Card form"; description: "Step 2, from the payment provider"; parent: checkout } view paying { type: waiting; title: "Paying"; description: "Waiting for the bank" } view account { type: tabs; title: "Your account"; description: "Orders · Addresses"; route: /account } view help { type: new-window; title: "Help center"; route: https://help.example.com } checkout --> address : [Start] address --> card : [Next] card --> paying : [Pay] paying ..> card : [Cancel] account --> help : [Help] ``` ### Actions - **Action** (14): something the system does between views. The user never sees it, only its outcome. Its box has no title bar. Auth asks the user to log in or confirm who they are, action does the work, and message sends an email, an SMS or a push. Authorize payment has two exits without a guard, so both happen: the receipt goes out and the confirmation shows. ```ujn view checkout { title: "Checkout"; route: /checkout } action step_up { type: auth; title: "Confirm it is you"; description: "Bank login" } action authorize { title: "Authorize payment" } action receipt { type: message; title: "Send receipt"; channel: email } view confirmed { title: "Order confirmed"; route: /orders/:id } checkout --> step_up : [Pay] step_up --> authorize authorize --> receipt authorize --> confirmed ``` Wait is a delay; its exit guarded `timeout` is taken when the time runs out. Fork and join are bars: the paths between them run at the same time, and the join waits for all of them. Event is something that arrives on its own, and permission asks the user for consent. ```ujn action window { type: wait; title: "Cancel window"; description: "Free to cancel"; timeout: 30 min } action split { type: fork } action reserve { title: "Reserve stock" } action invoice { title: "Create invoice" } action ready { type: join } action shipped { type: event; title: "Parcel shipped"; description: "From the warehouse" } action allow { type: permission; title: "Allow notifications" } view tracking { title: "Tracking"; route: /orders/:id/track } window --> split : timeout split --> reserve split --> invoice reserve --> ready invoice --> ready ready --> shipped shipped --> allow allow --> tracking ``` ### Systems, data and people in the flow - **System** (12): a service an action calls while the user stays in the app. A server icon marks an internal one, a cloud an external one. - **Data** (16): a store an action writes to or reads from, drawn as a cylinder. The arrow points the way the data moves. - **Actor** inline (12.3): a person doing a manual task. Each arrow out is an outcome they pick. ```ujn view checkout { title: "Checkout"; route: /checkout } action place { title: "Place order" } system fraud { title: "Fraud service"; host: fraud.internal } data orders_db { title: "Orders"; location: table orders } actor reviewer { title: "Fraud reviewer"; role: Back office } view confirmed { title: "Order confirmed"; route: /orders/:id } view held { title: "Order on hold"; route: /orders/:id/held } checkout --> place : [Place order] place --> fraud { payload: [order] } fraud ..> place { payload: [score] } place --> orders_db { payload: [order] } place --> confirmed : low risk place --> reviewer : high risk reviewer --> confirmed : [Approve] reviewer -x-> held : [Hold] ``` ### Leaving the app - **Handoff** (15): a dashed box where the user leaves the app, for a bank app, an email link or a phone call. The type name says whether they come back. The bank app returns: Approve comes back through a start of type handoff return, and Decline goes back to Checkout. Call support does not return: the journey ends out there. ```ujn start from_cart { description: "From the cart" } view checkout { title: "Checkout"; route: /checkout } handoff bank_app { title: "Bank app"; description: "Approve the payment"; channel: bank app; timeout: 5 min } start back { type: handoff-return; description: "Back from the bank"; route: /checkout/return } view confirmed { title: "Order confirmed"; route: /orders/:id } handoff call_us { type: no-return; title: "Call support"; channel: phone } from_cart --> checkout checkout --> bank_app : [Pay with bank app] bank_app ..> back : [Approve] bank_app .x.> checkout : [Decline] back --> confirmed checkout -down-> call_us : [Call us] ``` ### Other journeys - **Journey reference** (18): another journey, drawn in its own diagram. Its pointed side faces away from the arrow that leads in, and the other journey's id is on its bottom line. Sign in is a call: the user comes back to Checkout by the dashed line beside the arrow. Return an item is a go-to: the user carries on in that journey. ```ujn view checkout { title: "Checkout"; route: /checkout } ref sign_in { journey: LOGIN; title: "Sign in" } view confirmed { title: "Order confirmed"; route: /orders/:id } ref returns { journey: RETURNS; title: "Return an item" } checkout -up-> sign_in : [Sign in] { returns } checkout --> confirmed : [Pay] confirmed --> returns : [Return an item] ```