@mwam/sdk 0.4.0 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +58 -0
- package/dist/index.d.ts +3601 -138
- package/dist/index.js +267 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,6 +101,64 @@ the event's Details tab in the CRM.
|
|
|
101
101
|
CRM, newest first, each with its `pictures` (`{ url, alt, caption, width, height }`), so a
|
|
102
102
|
page needs no second call. Empty when there are none.
|
|
103
103
|
|
|
104
|
+
## An event's page (0.5.0)
|
|
105
|
+
|
|
106
|
+
An event can be laid out in the CRM's page builder: sections of one to three columns, or a
|
|
107
|
+
main column beside a sidebar, a column that stays in view while the page scrolls, and
|
|
108
|
+
snippets of the monastery's own data among the words. `getEvent` then carries `page`; it is
|
|
109
|
+
`null` for a plain description, which is `bodyHtml` as before.
|
|
110
|
+
|
|
111
|
+
**When `page` is not null, draw it in place of your description AND of any sidebar of your
|
|
112
|
+
own** — the page has its own, if it wants one.
|
|
113
|
+
|
|
114
|
+
```ts
|
|
115
|
+
const event = await mwam.getEvent("day-of-mindfulness");
|
|
116
|
+
if (event.page !== null) {
|
|
117
|
+
for (const section of event.page.sections) {
|
|
118
|
+
// section.layout: one | halves | wideLeft | wideRight | thirds | mainSidebar | sidebarMain
|
|
119
|
+
for (const column of section.columns) {
|
|
120
|
+
// column.sticky: keep it in view while the section scrolls past (wide screens only)
|
|
121
|
+
for (const block of column.blocks) {
|
|
122
|
+
// "html" — words and pictures, already rendered: place as they are
|
|
123
|
+
// "button" — { label, href, variant: primary | secondary }
|
|
124
|
+
// "row" — { layout, columns: [{ align, blocks }] }, one level only
|
|
125
|
+
// "snippet" — { kind, ... } below. Skip a type or kind you do not know.
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
| Snippet `kind` | What to draw |
|
|
133
|
+
|---|---|
|
|
134
|
+
| `teacher` | `block.teacher`: `{ name, title, bio, photo }`, or `null` when gone — skip it |
|
|
135
|
+
| `gallery` | `block.gallery`: a published gallery with its `pictures`, or `null` — skip it |
|
|
136
|
+
| `dates` | this event's `sessions` |
|
|
137
|
+
| `schedule` | this event's `segments` (the running order) |
|
|
138
|
+
| `booking` | your booking card. `block.phone` is `"inline"`, or `"bar"`: pinned to the bottom of the screen on a phone |
|
|
139
|
+
| `place` | the place of the next date (`sessions[].place`) |
|
|
140
|
+
|
|
141
|
+
`event.teachers` lists the teachers the page shows; `eventJsonLd` names them as `performer`.
|
|
142
|
+
|
|
143
|
+
Or let the SDK write it: `pageHtml(event.page, { snippet })` gives the page as HTML with
|
|
144
|
+
layout classes, calling `snippet(block)` for each snippet so you draw it (answer `null` for an
|
|
145
|
+
empty placeholder), and `layoutCss({ breakpoint, stickyTop, palette })` gives the stylesheet
|
|
146
|
+
for those classes — grid, stacking under `breakpoint` (900 by default), the sticky column
|
|
147
|
+
stopping `stickyTop` pixels below the top (under your header), and the section backgrounds
|
|
148
|
+
from `event.page.style.palette`. It sets no fonts and no colours of its own; your stylesheet
|
|
149
|
+
decides how everything looks.
|
|
150
|
+
|
|
151
|
+
| Class | Meaning |
|
|
152
|
+
|---|---|
|
|
153
|
+
| `mwam-page`, `mwam-section`, `mwam-section__inner` | The page, a section, its measure |
|
|
154
|
+
| `mwam-section--contained`, `--full`, `--space-s` / `-m` / `-l` | Width and spacing |
|
|
155
|
+
| `mwam-bg-1` … `mwam-bg-6` | A background from the monastery's palette |
|
|
156
|
+
| `mwam-cols`, `mwam-cols--halves` / `--thirds` / `--wide-left` / `--wide-right` / `--main-sidebar` / `--sidebar-main` | How columns share the width |
|
|
157
|
+
| `mwam-col`, `mwam-col--sticky`, `mwam-col--middle` | A column |
|
|
158
|
+
| `mwam-row` | A row of smaller columns inside a column |
|
|
159
|
+
| `mwam-snippet`, `mwam-snippet--{kind}`, `mwam-snippet--phone-bar` | A snippet's place |
|
|
160
|
+
| `mwam-button`, `mwam-button--primary`, `--secondary` | A button |
|
|
161
|
+
|
|
104
162
|
## The website key
|
|
105
163
|
|
|
106
164
|
An Admin makes one in **Monastery settings → Website keys**. It is shown once. Keep it in
|