@mwam/sdk 0.3.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 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
@@ -157,7 +215,7 @@ verificationToken })` from your server. Square keeps the card in the monastery's
157
215
  and charges it each month; each month is receipted. The donor is emailed a private link to
158
216
  `/give/monthly/{token}` on your site — a page that shows `monthlyGift(token)` and offers
159
217
  `stopMonthlyGift(token)`. Apple Pay shows only on
160
- an address an Admin has turned it on for, in **Giving**; the address must serve Square's file
218
+ an address an Admin has turned it on for, in **Monastery settings → Payments**; the address must serve Square's file
161
219
  at `/.well-known/apple-developer-merchantid-domain-association`.
162
220
 
163
221
  A missing, wrong or withdrawn key is refused on every call, so a broken key shows up at once. To replace one: make the new key, deploy it, then withdraw the old.
@@ -174,7 +232,9 @@ A missing, wrong or withdrawn key is refused on every call, so a broken key show
174
232
  | `getEvent(slug)` | One event and every date it has, with its `cover` and the `galleries` linked to it |
175
233
  | `listSeries()` · `getSeries(slug)` | Programmes, and the events in each |
176
234
  | `listGalleries({ limit? })` · `getGallery(slug)` | Published galleries; every picture has alt text |
177
- | `register(sessionId, who, { visitor? })` | Takes a place, or a place on the waitlist |
235
+ | `register(sessionId, who, { visitor? })` | Takes a place, or a place on the waitlist. Answers `{ status, seats }` and no token (since 0.4.0): the person's link goes to them by email, and an address that had already booked is answered as a newcomer would be |
236
+ | `signUp(eventSlug, who, { visitor? })` | For an event whose `signUp` is `ALL_DATES` (a weekly class): one sign-up for every date it has and any added later. Answers `{ status }`, CONFIRMED or WAITLISTED, with the same rules as `register`; booking one of its dates with `register` is refused. The person leaves from their own page, which the email links to |
237
+ | `register(sessionId, { name, email, seats?, card, amountCents }, { visitor? })` | For a date whose event's `pricing` is `DONATION` (each place gives at least `priceCents`): `card` is the card box's `{ sourceId, verificationToken? }`, the box started with `giving().card`. The card is held, the place taken, then the money taken; a full date throws `conflict` with nothing taken, a refused card throws `declined` with a message for the person. The confirmation email is the receipt |
178
238
  | `booking(token)` · `cancelBooking(token)` | One booking, by the token from its email |
179
239
  | `giving()` | Whether a gift can be taken now, in what currency, and what to start Square's card box with |
180
240
  | `give(gift, { visitor? })` | Starts a gift; answers with the payment page |