@zappie/sdk 0.20.0 → 0.22.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/CHANGELOG.md CHANGED
@@ -1,5 +1,27 @@
1
1
  # @zappie/sdk
2
2
 
3
+ ## 0.22.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 48bff20: `platformErrorDocument`, `platformErrorMarkup`, `platformErrorResponse`, `withPlatformErrorPage` and `PlatformErrorPage` take an optional `store` (`{ name, href?, logo? }`, the `PlatformErrorStore` type). Given one, the page leads with the store's logo or name over the heading, linking to the store's home, names the store in the title, and credits Zappie with "Powered by Zappie" in one line. Zee and the Zappie logo show only on Zappie's own page, which is unchanged when no store is given.
8
+
9
+ `siteWorker` takes the same `store`, or a function of the Worker's variables that returns it, for the page it answers with when the handler throws.
10
+
11
+ New `platformErrorTree` (with the `PlatformErrorNode` type) gives the page's `<main>` as a tree of elements. `platformErrorMarkup` writes it as HTML and `PlatformErrorPage` draws it in React, so the two always match.
12
+
13
+ ## 0.21.0
14
+
15
+ ### Minor Changes
16
+
17
+ - 50fb80a: `@zappie/sdk/menu` reads a menu the way a menu page lists it: `sectionsOf`, `categoriesOf` (categories with items, counted, each once), `itemsOf`, `categoryOfItem`, `sectionOfCategory`, `itemHref`, `menuHref`, `orderTypesOf` and `directionsHref`, with the `Section`, `CategoryView` and `OrderType` types.
18
+
19
+ The starter's menu lists its menus and categories with them, so a menu or category with nothing to sell no longer shows.
20
+
21
+ - e93e157: `@zappie/sdk/rich-text` reads merchant rich text without a DOM, so it runs in a loader, a Worker or SSR: `parseRichText` gives its nodes with the entities decoded, and `plainText` its text on one line. `@zappie/foundations/rich-text` re-exports both and adds `sanitizeRichText`, the shared sanitizer on that parser. `zappie/no-unsafe-html` accepts HTML passed through the imported `sanitizeRichText`.
22
+
23
+ The starter's item sheet shows a description's formatting, and the About page shows descriptions as text, never as tags.
24
+
3
25
  ## 0.20.0
4
26
 
5
27
  ### Minor Changes
package/README.md CHANGED
@@ -64,6 +64,8 @@ Prices always come from Zappie. The cart shows a local estimate while it waits,
64
64
  | `@zappie/sdk/places` | Address search and delivery-zone checks |
65
65
  | `@zappie/sdk/pricing` | An item's starting price, its price with given choices, and whether to show it as "From" |
66
66
  | `@zappie/sdk/display` | Phone numbers spaced for reading, and what a branch calls an in-person order |
67
+ | `@zappie/sdk/rich-text` | Merchant rich text read without a DOM: its nodes and its plain text |
68
+ | `@zappie/sdk/menu` | A menu's sections and categories, its items once each, item and menu links, order types and directions |
67
69
  | `@zappie/sdk/branches` | The nearest branch to a shopper, and each branch's distance from them |
68
70
  | `@zappie/sdk/options` | Option group rules: radio or checkbox, the group's limit, its labels and the note limit |
69
71
  | `@zappie/sdk/server` | Server-side reads, storefront URLs, `verifyWebhook()`, menu snapshots, sign-in crypto and a site's Worker, cache rules, robots, sitemap and old-address redirects |
@@ -135,7 +137,12 @@ export function ErrorBoundary() {
135
137
 
136
138
  Zappie's own pages in `@zappie/sdk/error-pages` are for the site host, which
137
139
  answers with them when a site can't answer at all. A Worker you host yourself
138
- can return `platformErrorResponse("went-wrong")` when its handler throws.
140
+ can return `platformErrorResponse("went-wrong")` when its handler throws. Pass
141
+ `{ store: { name, href, logo } }` and the page leads with your store: its logo,
142
+ or its name, over the heading and linking home, with "Powered by Zappie" in one
143
+ line at the foot. Without a store it is Zappie's own page, with the Zappie logo
144
+ and Zee. `siteWorker({ store })` from `@zappie/sdk/server` uses the store on the
145
+ page it answers with when your handler throws.
139
146
 
140
147
  When the merchant switches the storefront off, the site host asks your Worker
141
148
  for each page with the closed state. Draw your own closed page in your header
@@ -321,6 +328,23 @@ written without a country code.
321
328
  `inVenueLabel(branch)` says what an order placed at the branch is called:
322
329
  "Walk-in" when `branch.category` is `"RETAIL"`, and "Dine-in" otherwise.
323
330
 
331
+ ### Menu model
332
+
333
+ `@zappie/sdk/menu` reads a `Menu` the way a menu page lists it, with no React:
334
+ `sectionsOf(menu)` (its menus, or the whole menu as one), `categoriesOf(menu,
335
+ section?)` (categories with items, counted, each once), `itemsOf(menu,
336
+ categories)` (each item once), `categoryOfItem`, `sectionOfCategory`,
337
+ `itemHref(itemId, menuId?)`, `menuHref(menuId?, categoryId?)`,
338
+ `orderTypesOf(branch, menu)` (the order types the branch and its menus both
339
+ take) and `directionsHref(store, branch)`.
340
+
341
+ ### Rich text without a DOM
342
+
343
+ `parseRichText(html)` from `@zappie/sdk/rich-text` reads a description into
344
+ nodes in a loader, a Worker or SSR, and decodes its entities. `plainText(html)`
345
+ is the same text on one line, for a card or a meta description. To render
346
+ HTML, sanitize it with `sanitizeRichText` from `@zappie/foundations/rich-text`.
347
+
324
348
  ### Tables and bills
325
349
 
326
350
  A guest who scans a table code lands on one of three pages the platform owns:
package/dist/debug.js CHANGED
@@ -1,2 +1,2 @@
1
- var VERSION=true?"0.20.0":"0.0.0-development";function installDebug(client){if(typeof window==="undefined"||client.mode!=="test"){return}const events=[];let quote;const emit=(name,detail)=>{const event={name,detail,at:new Date().toISOString()};events.push(event);window.dispatchEvent(new CustomEvent("zappie:event",{detail:event}))};globalThis.__zappieEmit=emit;window.__zappie={version:VERSION,store:client.config.store,async catalogue(){await client.cart.hydrate();const branch=(await client.store.get()).branches.find(value=>value.id===client.cart.getSnapshot().branchId);return{branch,menu:await client.menu.get({branch:branch.id})}},cart:Object.assign(()=>client.cart.getSnapshot(),{async inject(input){await client.cart.hydrate();if(input.lines.length>100||input.lines.some(line=>!Number.isInteger(line.quantity??1)||(line.quantity??1)<1||(line.quantity??1)>99)){throw new Error("Use up to 100 cart lines with whole quantities from 1 to 99.")}const snapshot=client.cart.getSnapshot();const value={v:1,menuVersion:client._internal.cartCatalogue().version,updatedAt:Date.now(),fulfilment:snapshot.fulfilment,promoCode:snapshot.promoCode,lines:input.lines.map((line,index)=>({...line,id:`debug_${index}`,name:line.itemId,quantity:line.quantity??1,choices:(line.choices??[]).map(choice=>({...choice,quantity:choice.quantity??1})),inputs:line.inputs??{},addedAt:new Date().toISOString()}))};const scope=client.config.cart?.storageScope;(client.config.storage??window.localStorage).setItem(`zappie:cart:v1:${client.config.store}:${snapshot.branchId}${scope?`:${scope}`:""}`,JSON.stringify(value))}}),quote:()=>quote,events};client.on("add_to_cart",detail=>emit("add_to_cart",detail));client.cart.subscribe(()=>{const state=client.cart.state;const next="quote"in state?state.quote:void 0;if(next&&next!==quote){quote=next;emit("quote",next)}})}export{installDebug};
1
+ var VERSION=true?"0.22.0":"0.0.0-development";function installDebug(client){if(typeof window==="undefined"||client.mode!=="test"){return}const events=[];let quote;const emit=(name,detail)=>{const event={name,detail,at:new Date().toISOString()};events.push(event);window.dispatchEvent(new CustomEvent("zappie:event",{detail:event}))};globalThis.__zappieEmit=emit;window.__zappie={version:VERSION,store:client.config.store,async catalogue(){await client.cart.hydrate();const branch=(await client.store.get()).branches.find(value=>value.id===client.cart.getSnapshot().branchId);return{branch,menu:await client.menu.get({branch:branch.id})}},cart:Object.assign(()=>client.cart.getSnapshot(),{async inject(input){await client.cart.hydrate();if(input.lines.length>100||input.lines.some(line=>!Number.isInteger(line.quantity??1)||(line.quantity??1)<1||(line.quantity??1)>99)){throw new Error("Use up to 100 cart lines with whole quantities from 1 to 99.")}const snapshot=client.cart.getSnapshot();const value={v:1,menuVersion:client._internal.cartCatalogue().version,updatedAt:Date.now(),fulfilment:snapshot.fulfilment,promoCode:snapshot.promoCode,lines:input.lines.map((line,index)=>({...line,id:`debug_${index}`,name:line.itemId,quantity:line.quantity??1,choices:(line.choices??[]).map(choice=>({...choice,quantity:choice.quantity??1})),inputs:line.inputs??{},addedAt:new Date().toISOString()}))};const scope=client.config.cart?.storageScope;(client.config.storage??window.localStorage).setItem(`zappie:cart:v1:${client.config.store}:${snapshot.branchId}${scope?`:${scope}`:""}`,JSON.stringify(value))}}),quote:()=>quote,events};client.on("add_to_cart",detail=>emit("add_to_cart",detail));client.cart.subscribe(()=>{const state=client.cart.state;const next="quote"in state?state.quote:void 0;if(next&&next!==quote){quote=next;emit("quote",next)}})}export{installDebug};
2
2
  //# sourceMappingURL=debug.js.map
@@ -1,2 +1,2 @@
1
- var LOGO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 153 31" width="118" height="24"><path d="M0 10.1349L10.1349 0H30.4047V10.1349L18.0064 15.2024L20.2698 10.1349H0Z" fill="#9FE870"/><path d="M30.4047 20.2701L20.2698 30.405H0V20.2701L12.3646 15.2026L10.1349 20.2701H30.4047Z" fill="#9FE870"/><path d="M46.60 5.95H60.20V9.25L51.25 20.11H60.50V23.41H46.20V20.11L55.15 9.25H46.60Z" fill="{word}"/><path d="M63.21 18.3792C63.21 15.7441 65.0681 13.6496 69.764 13.6496H76.2165V12.3996C76.2165 9.79829 74.6963 8.61588 71.622 8.61588C68.9194 8.61588 67.3991 9.62937 67.3991 11.5888C67.3991 11.6901 67.3991 11.9942 67.3991 12.2644H63.7506C63.7506 12.028 63.683 11.555 63.683 11.251C63.683 7.73752 66.7235 5.67676 71.7234 5.67676C77.0273 5.67676 80.1353 8.1767 80.1353 12.7712V23.4128H76.1827C76.2503 22.5683 76.3517 20.9805 76.3517 19.5616C75.7773 22.1291 73.7166 23.6831 69.8315 23.6831C65.9465 23.6831 63.1763 21.7575 63.1763 18.3792H63.21ZM76.2165 16.3522V16.0481H70.1018C67.8383 16.0481 66.8586 16.8252 66.8586 18.2103C66.8586 19.7981 68.2775 20.7102 70.6761 20.7102C74.0882 20.7102 76.2165 19.0548 76.2165 16.3522Z" fill="{word}"/><path d="M84.0884 5.9476H88.041L87.9734 10.0016C88.6829 7.36649 91.0139 5.64355 94.4936 5.64355C99.4934 5.64355 102.635 9.05564 102.635 14.3258C102.635 19.9676 99.4597 23.6499 94.426 23.6499C90.9463 23.6499 88.6829 22.0959 87.9734 19.8324C87.9734 21.0148 88.0748 22.8053 88.0748 23.5148V30.3727H84.1222V5.91382L84.0884 5.9476ZM98.6826 14.4947C98.6826 11.1502 96.7232 8.95429 93.5814 8.95429C90.4396 8.95429 88.1086 11.184 88.041 14.6974V15.6095C88.041 18.5825 90.2707 20.4743 93.649 20.4743C96.6895 20.4743 98.6826 18.1433 98.6826 14.4947Z" fill="{word}"/><path d="M106.18 5.9476H110.132L110.065 10.0016C110.774 7.36649 113.105 5.64355 116.585 5.64355C121.585 5.64355 124.727 9.05564 124.727 14.3258C124.727 19.9676 121.551 23.6499 116.517 23.6499C113.038 23.6499 110.774 22.0959 110.065 19.8324C110.065 21.0148 110.166 22.8053 110.166 23.5148V30.3727H106.213V5.91382L106.18 5.9476ZM120.774 14.4947C120.774 11.1502 118.815 8.95429 115.673 8.95429C112.531 8.95429 110.2 11.184 110.132 14.6974V15.6095C110.132 18.5825 112.362 20.4743 115.74 20.4743C118.781 20.4743 120.774 18.1433 120.774 14.4947Z" fill="{word}"/><path d="M128.304 0H132.358V3.88505H128.304V0ZM128.338 5.94581H132.291V23.4116H128.338V5.94581Z" fill="{word}"/><path d="M152.966 15.4738H139.892C140.095 18.8184 141.987 20.6426 144.96 20.6426C147.494 20.6426 149.25 19.5278 149.419 17.467H153C152.865 21.3521 149.689 23.7169 144.892 23.7169C139.386 23.7169 135.906 20.3386 135.906 14.832C135.906 9.32533 139.386 5.67676 144.892 5.67676C149.825 5.67676 153 8.61588 153 14.055V15.4738H152.966ZM149.385 12.8388C149.385 10.2375 147.764 8.7848 144.892 8.7848C142.021 8.7848 140.433 10.2037 139.994 13.109H149.385V12.8725V12.8388Z" fill="{word}"/></svg>';var ZEE={"not-found":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -8 120 128" width="112" height="120"><defs><linearGradient id="zpe-head" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#C2F3A3"/><stop offset=".55" stop-color="#9FE870"/><stop offset="1" stop-color="#86DB52"/></linearGradient><linearGradient id="zpe-hand" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FAFAF8"/><stop offset="1" stop-color="#E4E6DC"/></linearGradient></defs><g><rect x="18" y="20" width="84" height="80" rx="28" fill="url(#zpe-head)"/><rect x="18" y="20" width="84" height="80" rx="28" fill="none" stroke="#FFFFFF" stroke-opacity=".35" stroke-width="2"/><path d="M60 24V12h10L50 2h20" fill="none" stroke="#86DB52" stroke-width="4.5" stroke-linecap="round" stroke-linejoin="round"/><ellipse cx="36" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><ellipse cx="84" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><g transform="translate(43.5 57) scale(1.08) translate(-43.5 -57)"><rect x="37" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="41" cy="51" r="2.6" fill="#FFFFFF"/></g><g transform="translate(76.5 57) scale(1.08) translate(-76.5 -57)"><rect x="70" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="74" cy="51" r="2.6" fill="#FFFFFF"/></g><ellipse cx="60" cy="81" rx="4.2" ry="5.5" fill="#121A0E"/><circle cx="15" cy="103" r="9.5" fill="url(#zpe-hand)"/><circle cx="105" cy="103" r="9.5" fill="url(#zpe-hand)"/></g></svg>',"went-wrong":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -8 120 128" width="112" height="120"><defs><linearGradient id="zpe-head" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#C2F3A3"/><stop offset=".55" stop-color="#9FE870"/><stop offset="1" stop-color="#86DB52"/></linearGradient><linearGradient id="zpe-hand" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FAFAF8"/><stop offset="1" stop-color="#E4E6DC"/></linearGradient></defs><g><rect x="18" y="20" width="84" height="80" rx="28" fill="url(#zpe-head)"/><rect x="18" y="20" width="84" height="80" rx="28" fill="none" stroke="#FFFFFF" stroke-opacity=".35" stroke-width="2"/><path d="M60 24V12h10L50 2h20" fill="none" stroke="#86DB52" stroke-width="4.5" stroke-linecap="round" stroke-linejoin="round" transform="rotate(-20 60 24) translate(0 1)"/><ellipse cx="36" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><ellipse cx="84" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><g transform="translate(0 2)"><g><rect x="37" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="41" cy="51" r="2.6" fill="#FFFFFF" transform="translate(0 2)"/></g><g><rect x="70" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="74" cy="51" r="2.6" fill="#FFFFFF" transform="translate(0 2)"/></g></g><path d="M36 40l14 5" fill="none" stroke="#121A0E" stroke-width="3.4" stroke-linecap="round" transform="translate(0 -3) rotate(-38 43 42.5)"/><path d="M84 40l-14 5" fill="none" stroke="#121A0E" stroke-width="3.4" stroke-linecap="round" transform="translate(0 -3) rotate(38 77 42.5)"/><path d="M53 83q7-5.5 14 0" fill="none" stroke="#121A0E" stroke-width="3.6" stroke-linecap="round"/><circle cx="15" cy="103" r="9.5" fill="url(#zpe-hand)"/><circle cx="105" cy="103" r="9.5" fill="url(#zpe-hand)"/></g></svg>'};export{LOGO,ZEE};
1
+ var LOGO='<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 153 31" width="118" height="24"><path d="M0 10.1L10.1 0H30.4V10.1L18 15.2L20.3 10.1H0Z" fill="#9FE870"/><path d="M30.4 20.3L20.3 30.4H0V20.3L12.4 15.2L10.1 20.3H30.4Z" fill="#9FE870"/><path d="M46.60 5.95H60.20V9.25L51.25 20.11H60.50V23.41H46.20V20.11L55.15 9.25H46.60Z" fill="{word}"/><path d="M63.21 18.4C63.21 15.7 65.1 13.6 69.8 13.6H76.2V12.4C76.2 9.8 74.7 8.6 71.6 8.6C68.9 8.6 67.4 9.6 67.4 11.6C67.4 11.7 67.4 12 67.4 12.3H63.8C63.8 12 63.7 11.6 63.7 11.3C63.7 7.7 66.7 5.7 71.7 5.7C77 5.7 80.1 8.2 80.1 12.8V23.4H76.2C76.3 22.6 76.4 21 76.4 19.6C75.8 22.1 73.7 23.7 69.8 23.7C65.9 23.7 63.2 21.8 63.2 18.4H63.21ZM76.2 16.4V16H70.1C67.8 16 66.9 16.8 66.9 18.2C66.9 19.8 68.3 20.7 70.7 20.7C74.1 20.7 76.2 19.1 76.2 16.4Z" fill="{word}"/><path d="M84.1 5.9H88L88 10C88.7 7.4 91 5.6 94.5 5.6C99.5 5.6 102.6 9.1 102.6 14.3C102.6 20 99.5 23.6 94.4 23.6C90.9 23.6 88.7 22.1 88 19.8C88 21 88.1 22.8 88.1 23.5V30.4H84.1V5.9L84.1 5.9ZM98.7 14.5C98.7 11.2 96.7 9 93.6 9C90.4 9 88.1 11.2 88 14.7V15.6C88 18.6 90.3 20.5 93.6 20.5C96.7 20.5 98.7 18.1 98.7 14.5Z" fill="{word}"/><path d="M106.18 5.9H110.1L110.1 10C110.8 7.4 113.1 5.6 116.6 5.6C121.6 5.6 124.7 9.1 124.7 14.3C124.7 20 121.6 23.6 116.5 23.6C113 23.6 110.8 22.1 110.1 19.8C110.1 21 110.2 22.8 110.2 23.5V30.4H106.2V5.9L106.18 5.9ZM120.8 14.5C120.8 11.2 118.8 9 115.7 9C112.5 9 110.2 11.2 110.1 14.7V15.6C110.1 18.6 112.4 20.5 115.74 20.5C118.8 20.5 120.8 18.1 120.8 14.5Z" fill="{word}"/><path d="M128.3 0H132.4V3.9H128.3V0ZM128.3 5.9H132.3V23.4H128.3V5.9Z" fill="{word}"/><path d="M153 15.5H139.9C140.1 18.8 142 20.6 144.96 20.6C147.5 20.6 149.25 19.5 149.4 17.5H153C152.9 21.4 149.7 23.7 144.9 23.7C139.4 23.7 135.9 20.3 135.9 14.8C135.9 9.3 139.4 5.7 144.9 5.7C149.8 5.7 153 8.6 153 14.1V15.5H153ZM149.4 12.8C149.4 10.2 147.8 8.8 144.9 8.8C142 8.8 140.4 10.2 140 13.1H149.4V12.9V12.8Z" fill="{word}"/></svg>';var ZEE={"not-found":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -8 120 128" width="112" height="120"><defs><linearGradient id="zpe-head" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#C2F3A3"/><stop offset=".55" stop-color="#9FE870"/><stop offset="1" stop-color="#86DB52"/></linearGradient><linearGradient id="zpe-hand" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FAFAF8"/><stop offset="1" stop-color="#E4E6DC"/></linearGradient></defs><g><rect x="18" y="20" width="84" height="80" rx="28" fill="url(#zpe-head)"/><rect x="18" y="20" width="84" height="80" rx="28" fill="none" stroke="#FFFFFF" stroke-opacity=".35" stroke-width="2"/><path d="M60 24V12h10L50 2h20" fill="none" stroke="#86DB52" stroke-width="4.5" stroke-linecap="round" stroke-linejoin="round"/><ellipse cx="36" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><ellipse cx="84" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><g transform="translate(43.5 57) scale(1.08) translate(-43.5 -57)"><rect x="37" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="41" cy="51" r="2.6" fill="#FFFFFF"/></g><g transform="translate(76.5 57) scale(1.08) translate(-76.5 -57)"><rect x="70" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="74" cy="51" r="2.6" fill="#FFFFFF"/></g><ellipse cx="60" cy="81" rx="4.2" ry="5.5" fill="#121A0E"/><circle cx="15" cy="103" r="9.5" fill="url(#zpe-hand)"/><circle cx="105" cy="103" r="9.5" fill="url(#zpe-hand)"/></g></svg>',"went-wrong":'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 -8 120 128" width="112" height="120"><defs><linearGradient id="zpe-head" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#C2F3A3"/><stop offset=".55" stop-color="#9FE870"/><stop offset="1" stop-color="#86DB52"/></linearGradient><linearGradient id="zpe-hand" x1="0" y1="0" x2="0" y2="1"><stop offset="0" stop-color="#FAFAF8"/><stop offset="1" stop-color="#E4E6DC"/></linearGradient></defs><g><rect x="18" y="20" width="84" height="80" rx="28" fill="url(#zpe-head)"/><rect x="18" y="20" width="84" height="80" rx="28" fill="none" stroke="#FFFFFF" stroke-opacity=".35" stroke-width="2"/><path d="M60 24V12h10L50 2h20" fill="none" stroke="#86DB52" stroke-width="4.5" stroke-linecap="round" stroke-linejoin="round" transform="rotate(-20 60 24) translate(0 1)"/><ellipse cx="36" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><ellipse cx="84" cy="79" rx="8" ry="4.5" fill="#FFFFFF"/><g transform="translate(0 2)"><g><rect x="37" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="41" cy="51" r="2.6" fill="#FFFFFF" transform="translate(0 2)"/></g><g><rect x="70" y="46" width="13" height="22" rx="6.5" fill="#121A0E"/><circle cx="74" cy="51" r="2.6" fill="#FFFFFF" transform="translate(0 2)"/></g></g><path d="M36 40l14 5" fill="none" stroke="#121A0E" stroke-width="3.4" stroke-linecap="round" transform="translate(0 -3) rotate(-38 43 42.5)"/><path d="M84 40l-14 5" fill="none" stroke="#121A0E" stroke-width="3.4" stroke-linecap="round" transform="translate(0 -3) rotate(38 77 42.5)"/><path d="M53 83q7-5.5 14 0" fill="none" stroke="#121A0E" stroke-width="3.6" stroke-linecap="round"/><circle cx="15" cy="103" r="9.5" fill="url(#zpe-hand)"/><circle cx="105" cy="103" r="9.5" fill="url(#zpe-hand)"/></g></svg>'};export{LOGO,ZEE};
2
2
  //# sourceMappingURL=art.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/error-pages/art.ts"],
4
- "mappings": "AAIO,IAAM,KACX,uxFAGK,IAAM,IAAM,CACjB,YACE,o6CACF,aACE,6uDACJ",
4
+ "mappings": "AAKO,IAAM,KACX,s4DAGK,IAAM,IAAM,CACjB,YACE,o6CACF,aACE,6uDACJ",
5
5
  "names": []
6
6
  }
@@ -1,13 +1,25 @@
1
1
  /**
2
2
  * The two pages Zappie's site host answers with when a site can't. `not-found` is a page or a table code that
3
- * doesn't exist (404). `went-wrong` is a page the site could not render (500). Storefronts draw their own pages with
4
- * `siteError` from `@zappie/sdk/site-error`.
3
+ * doesn't exist (404). `went-wrong` is a page the site could not render (500). Given a `store`, a page leads with the
4
+ * store and credits Zappie in one line. Storefronts draw their own pages with `siteError` from
5
+ * `@zappie/sdk/site-error`.
5
6
  */
6
7
  type PlatformErrorKind = "not-found" | "went-wrong";
7
- /** Where the page's links lead. */
8
+ /** The store a page belongs to. */
9
+ type PlatformErrorStore = {
10
+ /** The store's name, shown over the heading and as the page's title. */
11
+ name: string;
12
+ /** Where the store's name leads. Default the page's `home`. */
13
+ href?: string;
14
+ /** The store's logo as an image URL, shown in place of its name. */
15
+ logo?: string;
16
+ };
17
+ /** Where the page's links lead, and whose page it is. */
8
18
  type PlatformErrorOptions = {
9
19
  /** The storefront's home page. Default `/`. */
10
20
  home?: string;
21
+ /** The store the page belongs to. Leave it out for Zappie's own page, with the Zappie logo and Zee. */
22
+ store?: PlatformErrorStore;
11
23
  };
12
24
  /** One of the page's links. An empty `href` reloads the address the guest is on. */
13
25
  type PlatformErrorAction = {
@@ -28,6 +40,10 @@ type PlatformErrorParts = {
28
40
  /** Zee as an image source: surprised for a missing page, sad for a failed one. */
29
41
  zee: string;
30
42
  actions: PlatformErrorAction[];
43
+ /** The store the page belongs to, with its link resolved. Zappie's own page has none. */
44
+ store?: PlatformErrorStore & {
45
+ href: string;
46
+ };
31
47
  };
32
48
  /** The HTTP status each page answers with. */
33
49
  declare function platformErrorStatus(kind: PlatformErrorKind): number;
@@ -36,11 +52,26 @@ declare function platformErrorStatus(kind: PlatformErrorKind): number;
36
52
  */
37
53
  declare function platformErrorKind(error: unknown): PlatformErrorKind;
38
54
  /** The words, artwork and links of the page for `kind`. */
39
- declare function platformErrorParts(kind: PlatformErrorKind, { home }?: PlatformErrorOptions): PlatformErrorParts;
55
+ declare function platformErrorParts(kind: PlatformErrorKind, { home, store }?: PlatformErrorOptions): PlatformErrorParts;
40
56
  /** The page's stylesheet. */
41
57
  declare const PLATFORM_ERROR_STYLES: string;
42
58
  /** The Geist stylesheet the page's type comes from. */
43
59
  declare const PLATFORM_ERROR_FONTS = "https://fonts.googleapis.com/css2?family=Geist:wght@400;600&display=swap";
60
+ /** Where the store page's "Powered by Zappie" credit leads. */
61
+ declare const PLATFORM_ERROR_CREDIT = "https://zappie.ai";
62
+ /**
63
+ * One element of the page: its tag, its attributes as React names them, and its children. Text is plain, never HTML.
64
+ */
65
+ type PlatformErrorNode = [
66
+ tag: string,
67
+ attributes: Record<string, string>,
68
+ ...children: (PlatformErrorNode | string)[]
69
+ ];
70
+ /**
71
+ * The page's `<main>` element as a tree, which `platformErrorMarkup` writes as HTML and `PlatformErrorPage` draws in
72
+ * React, so the two always match.
73
+ */
74
+ declare function platformErrorTree(kind: PlatformErrorKind, options?: PlatformErrorOptions): PlatformErrorNode;
44
75
  /** The page's `<main>` element as HTML. `PlatformErrorPage` from `@zappie/sdk/error-pages/react` draws the same. */
45
76
  declare function platformErrorMarkup(kind: PlatformErrorKind, options?: PlatformErrorOptions): string;
46
77
  /** A complete HTML document for the page, for a server or Worker answering without the site's own code. */
@@ -54,5 +85,5 @@ declare function withPlatformErrorPage(response: Response, options?: PlatformErr
54
85
  /** The page as a Response with its status, for a site's Worker to return when its own rendering fails. */
55
86
  declare function platformErrorResponse(kind: PlatformErrorKind, options?: PlatformErrorOptions): Response;
56
87
 
57
- export { PLATFORM_ERROR_FONTS, PLATFORM_ERROR_STYLES, platformErrorDocument, platformErrorKind, platformErrorMarkup, platformErrorParts, platformErrorResponse, platformErrorStatus, withPlatformErrorPage };
58
- export type { PlatformErrorAction, PlatformErrorKind, PlatformErrorOptions, PlatformErrorParts };
88
+ export { PLATFORM_ERROR_CREDIT, PLATFORM_ERROR_FONTS, PLATFORM_ERROR_STYLES, platformErrorDocument, platformErrorKind, platformErrorMarkup, platformErrorParts, platformErrorResponse, platformErrorStatus, platformErrorTree, withPlatformErrorPage };
89
+ export type { PlatformErrorAction, PlatformErrorKind, PlatformErrorNode, PlatformErrorOptions, PlatformErrorParts, PlatformErrorStore };
@@ -1,11 +1,16 @@
1
- import{LOGO,ZEE}from"./art.js";var STATUS={"not-found":404,"went-wrong":500};var COPY={"not-found":{title:"We couldn't find that page",text:"The link or code you followed may be out of date, or the page may have moved."},"went-wrong":{title:"Something went wrong",text:"This page didn't load. Try again, or go to the home page."}};function platformErrorStatus(kind){return STATUS[kind]}function platformErrorKind(error){const status=typeof error==="object"&&error!==null&&"status"in error?error.status:void 0;return status===404||status===410?"not-found":"went-wrong"}var image=svg=>`data:image/svg+xml,${svg.replace(/["#%<> ]/g,character=>character==='"'?"'":encodeURIComponent(character))}`;function platformErrorParts(kind,{home="/"}={}){const homeAction=primary=>({label:"Go to the home page",href:home,primary});return{kind,...COPY[kind],logo:{light:image(LOGO.replaceAll("{word}","#121A0E")),dark:image(LOGO.replaceAll("{word}","#F1F1F1"))},zee:image(ZEE[kind]),actions:kind==="went-wrong"?[{label:"Try again",href:"",primary:true},homeAction(false)]:[homeAction(true)]}}var PLATFORM_ERROR_STYLES=`main.zpe{--zpe-bg:#fff;--zpe-fg:#121A0E;--zpe-fg2:#4A4A4A;--zpe-surface:#fff;--zpe-edge:#8A8A8A;--zpe-hover:#F5F5F5;position:fixed;inset:0;z-index:2147483000;overflow-y:auto;box-sizing:border-box;display:grid;grid-template-rows:auto 1fr;gap:24px;width:auto;max-width:none;margin:0;padding:24px 40px;background:var(--zpe-bg);color:var(--zpe-fg);font-family:Geist,system-ui,-apple-system,Roboto,sans-serif;font-size:15px;font-weight:400;line-height:22px;letter-spacing:-.003em;text-align:center}
1
+ import{LOGO,ZEE}from"./art.js";var STATUS={"not-found":404,"went-wrong":500};var COPY={"not-found":{title:"We couldn't find that page",text:"The link or code you followed may be out of date, or the page may have moved."},"went-wrong":{title:"Something went wrong",text:"This page didn't load. Try again, or go to the home page."}};function platformErrorStatus(kind){return STATUS[kind]}function platformErrorKind(error){const status=typeof error==="object"&&error!==null&&"status"in error?error.status:void 0;return status===404||status===410?"not-found":"went-wrong"}var image=svg=>`data:image/svg+xml,${svg.replace(/["#%<> ]/g,character=>character==='"'?"'":encodeURIComponent(character))}`;function platformErrorParts(kind,{home="/",store}={}){const homeAction=primary=>({label:"Go to the home page",href:home,primary});return{kind,...COPY[kind],logo:{light:image(LOGO.replaceAll("{word}","#121A0E")),dark:image(LOGO.replaceAll("{word}","#F1F1F1"))},zee:image(ZEE[kind]),actions:kind==="went-wrong"?[{label:"Try again",href:"",primary:true},homeAction(false)]:[homeAction(true)],...store?.name.trim()?{store:{...store,name:store.name.trim(),href:store.href??home}}:{}}}var PLATFORM_ERROR_STYLES=`main.zpe{--zpe-bg:#fff;--zpe-fg:#121A0E;--zpe-fg2:#4A4A4A;--zpe-surface:#fff;--zpe-edge:#8A8A8A;--zpe-hover:#F5F5F5;position:fixed;inset:0;z-index:2147483000;overflow-y:auto;box-sizing:border-box;display:grid;grid-template-rows:auto 1fr;gap:24px;width:auto;max-width:none;margin:0;padding:24px 40px;background:var(--zpe-bg);color:var(--zpe-fg);font-family:Geist,system-ui,-apple-system,Roboto,sans-serif;font-size:15px;font-weight:400;line-height:22px;letter-spacing:-.003em;text-align:center}
2
2
  @media (prefers-color-scheme:dark){main.zpe{--zpe-bg:#1A1A1A;--zpe-fg:#F1F1F1;--zpe-fg2:#C4C4C4;--zpe-surface:#212121;--zpe-edge:#6B6B6B;--zpe-hover:#2A2A2A;color-scheme:dark}}
3
+ main.zpe[data-store]{grid-template-rows:1fr auto}
3
4
  .zpe .zpe-brand{display:flex;justify-content:center}
4
5
  .zpe .zpe-brand img{display:block;width:118px;height:24px}
5
6
  .zpe .zpe-center{display:grid;place-items:center;min-width:0}
6
7
  .zpe .zpe-body{display:grid;gap:12px;justify-items:center;width:100%;max-width:400px;animation:zpe-enter .2s cubic-bezier(.2,0,0,1) both}
7
8
  .zpe .zpe-zee{display:block;width:112px;height:120px;max-width:none;margin:0 0 4px;animation:zpe-float 4.2s cubic-bezier(.4,0,.2,1) infinite}
8
9
  .zpe[data-kind=went-wrong] .zpe-zee{animation-duration:6s}
10
+ .zpe .zpe-store{display:block;max-width:100%;margin:0 0 4px;color:var(--zpe-fg);font-size:17px;line-height:24px;font-weight:600;text-decoration:none;overflow-wrap:anywhere}
11
+ .zpe .zpe-store img{display:block;max-width:200px;max-height:56px}
12
+ .zpe .zpe-credit{margin:0;color:var(--zpe-fg2);font-size:13px;line-height:20px}
13
+ .zpe .zpe-credit a{color:inherit}
9
14
  .zpe .zpe-title{margin:0;padding:0;color:var(--zpe-fg);font:inherit;font-size:26px;line-height:32px;font-weight:600;letter-spacing:-.022em;text-wrap:balance}
10
15
  .zpe .zpe-text{margin:0;padding:0;max-width:52ch;color:var(--zpe-fg2);font:inherit;text-wrap:pretty}
11
16
  .zpe .zpe-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:4px}
@@ -17,5 +22,5 @@ import{LOGO,ZEE}from"./art.js";var STATUS={"not-found":404,"went-wrong":500};var
17
22
  @media (max-width:767px){main.zpe{padding:24px 16px}.zpe .zpe-body{align-self:start;margin-top:12vh}.zpe .zpe-actions{flex-direction:column-reverse;align-self:stretch;width:100%}.zpe .zpe-button{width:100%}}
18
23
  @media (prefers-reduced-motion:reduce){.zpe .zpe-body,.zpe .zpe-zee{animation:none}}
19
24
  @keyframes zpe-enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
20
- @keyframes zpe-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}`;var PLATFORM_ERROR_FONTS="https://fonts.googleapis.com/css2?family=Geist:wght@400;600&display=swap";var escape=text=>text.replace(/[&<>"']/g,character=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"})[character]??character);function platformErrorMarkup(kind,options={}){const parts=platformErrorParts(kind,options);const actions=parts.actions.map(action=>`<a class="zpe-button${action.primary?" zpe-primary":""}" href="${escape(action.href)}">${escape(action.label)}</a>`).join("");return`<main class="zpe" data-kind="${kind}"><div class="zpe-brand"><picture><source srcset="${parts.logo.dark}" media="(prefers-color-scheme: dark)"><img alt="Zappie" width="118" height="24" src="${parts.logo.light}"></picture></div><div class="zpe-center"><div class="zpe-body"><img class="zpe-zee" alt="" width="112" height="120" src="${parts.zee}"><h1 class="zpe-title">${escape(parts.title)}</h1><p class="zpe-text">${escape(parts.text)}</p><div class="zpe-actions">${actions}</div></div></div></main>`}function platformErrorDocument(kind,options={}){return`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="robots" content="noindex"><title>${escape(COPY[kind].title)}</title><link rel="stylesheet" href="${escape(PLATFORM_ERROR_FONTS)}"><style>${PLATFORM_ERROR_STYLES}</style></head><body style="margin:0">${platformErrorMarkup(kind,options)}</body></html>`}function withPlatformErrorPage(response,options={}){const status=response.status;const kind=status===404||status===410?"not-found":status>=500?"went-wrong":void 0;if(!kind||!/^text\/html/i.test(response.headers.get("content-type")??"")){return response}response.body?.cancel().catch(()=>void 0);const headers=new Headers(response.headers);for(const name of["content-length","content-encoding","etag"]){headers.delete(name)}headers.set("content-type","text/html; charset=utf-8");headers.set("cache-control","no-store");return new Response(platformErrorDocument(kind,options),{status,statusText:response.statusText,headers})}function platformErrorResponse(kind,options={}){return new Response(platformErrorDocument(kind,options),{status:STATUS[kind],headers:{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}})}export{PLATFORM_ERROR_FONTS,PLATFORM_ERROR_STYLES,platformErrorDocument,platformErrorKind,platformErrorMarkup,platformErrorParts,platformErrorResponse,platformErrorStatus,withPlatformErrorPage};
25
+ @keyframes zpe-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}`;var PLATFORM_ERROR_FONTS="https://fonts.googleapis.com/css2?family=Geist:wght@400;600&display=swap";var escape=text=>text.replace(/[&<>"]/g,character=>({"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;"})[character]??character);var PLATFORM_ERROR_CREDIT="https://zappie.ai";function platformErrorTree(kind,options={}){const parts=platformErrorParts(kind,options);const{store}=parts;const center=["div",{className:"zpe-center"},["div",{className:"zpe-body"},store?["a",{className:"zpe-store",href:store.href},store.logo?["img",{alt:store.name,src:store.logo}]:store.name]:["img",{className:"zpe-zee",alt:"",width:"112",height:"120",src:parts.zee}],["h1",{className:"zpe-title"},parts.title],["p",{className:"zpe-text"},parts.text],["div",{className:"zpe-actions"},...parts.actions.map(action=>["a",{className:action.primary?"zpe-button zpe-primary":"zpe-button",href:action.href},action.label])]]];return store?["main",{className:"zpe","data-kind":kind,"data-store":""},center,["p",{className:"zpe-credit"},"Powered by ",["a",{href:PLATFORM_ERROR_CREDIT,"data-zappie-attribution":""},"Zappie"]]]:["main",{className:"zpe","data-kind":kind},["div",{className:"zpe-brand"},["picture",{},["source",{srcSet:parts.logo.dark,media:"(prefers-color-scheme: dark)"}],["img",{alt:"Zappie",width:"118",height:"24",src:parts.logo.light}]]],center]}var html=node=>{if(typeof node==="string"){return escape(node)}const[tag,attributes,...children]=node;const open=`<${tag}${Object.entries(attributes).map(([name,value])=>` ${name==="className"?"class":name.toLowerCase()}="${escape(value)}"`).join("")}>`;return tag==="img"||tag==="source"?open:`${open}${children.map(html).join("")}</${tag}>`};function platformErrorMarkup(kind,options={}){return html(platformErrorTree(kind,options))}function platformErrorDocument(kind,options={}){const store=platformErrorParts(kind,options).store;return`<!doctype html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1"><meta name="robots" content="noindex"><title>${escape(COPY[kind].title)}${store?` | ${escape(store.name)}`:""}</title><link rel="stylesheet" href="${escape(PLATFORM_ERROR_FONTS)}"><style>${PLATFORM_ERROR_STYLES}</style></head><body style="margin:0">${platformErrorMarkup(kind,options)}</body></html>`}function withPlatformErrorPage(response,options={}){const status=response.status;const kind=status===404||status===410?"not-found":status>=500?"went-wrong":void 0;if(!kind||!/^text\/html/i.test(response.headers.get("content-type")??"")){return response}response.body?.cancel().catch(()=>void 0);const headers=new Headers(response.headers);for(const name of["content-length","content-encoding","etag"]){headers.delete(name)}headers.set("content-type","text/html; charset=utf-8");headers.set("cache-control","no-store");return new Response(platformErrorDocument(kind,options),{status,statusText:response.statusText,headers})}function platformErrorResponse(kind,options={}){return new Response(platformErrorDocument(kind,options),{status:STATUS[kind],headers:{"content-type":"text/html; charset=utf-8","cache-control":"no-store"}})}export{PLATFORM_ERROR_CREDIT,PLATFORM_ERROR_FONTS,PLATFORM_ERROR_STYLES,platformErrorDocument,platformErrorKind,platformErrorMarkup,platformErrorParts,platformErrorResponse,platformErrorStatus,platformErrorTree,withPlatformErrorPage};
21
26
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/error-pages/index.ts"],
4
- "mappings": "AAAA,OAAS,KAAM,QAAW,WAkC1B,IAAM,OAA4C,CAChD,YAAa,IACb,aAAc,GAChB,EAEA,IAAM,KAAmE,CACvE,YAAa,CACX,MAAO,6BACP,KAAM,+EACR,EACA,aAAc,CACZ,MAAO,uBACP,KAAM,2DACR,CACF,EAGO,SAAS,oBAAoB,KAAiC,CACnE,OAAO,OAAO,IAAI,CACpB,CAKO,SAAS,kBAAkB,MAAmC,CACnE,MAAM,OACJ,OAAO,QAAU,UAAY,QAAU,MAAQ,WAAY,MACvD,MAAM,OACN,OACN,OAAO,SAAW,KAAO,SAAW,IAAM,YAAc,YAC1D,CAGA,IAAM,MAAS,KACb,sBAAsB,IAAI,QAAQ,YAAc,WAAe,YAAc,IAAM,IAAM,mBAAmB,SAAS,CAAE,CAAC,GAGnH,SAAS,mBACd,KACA,CAAE,KAAO,GAAI,EAA0B,CAAC,EACpB,CACpB,MAAM,WAAc,UAAsB,CACxC,MAAO,sBACP,KAAM,KACN,OACF,GACA,MAAO,CACL,KACA,GAAG,KAAK,IAAI,EACZ,KAAM,CACJ,MAAO,MAAM,KAAK,WAAW,SAAU,SAAS,CAAC,EACjD,KAAM,MAAM,KAAK,WAAW,SAAU,SAAS,CAAC,CAClD,EACA,IAAK,MAAM,IAAI,IAAI,CAAC,EACpB,QACE,OAAS,aACL,CAAC,C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B,KAAM,OAAO,EAAE,MAChD,MAAO,+KAA+K,OAAO,KAAK,IAAI,EAAE,KAAK,CAAC,GAAG,MAAQ,MAAM,OAAO,MAAM,IAAI,CAAC,GAAK,EAAE,wCAAwC,OAAO,oBAAoB,CAAC,YAAY,qBAAqB,yCAAyC,oBAAoB,KAAM,OAAO,CAAC,gBAC1a,CAOO,SAAS,sBACd,SACA,QAAgC,CAAC,EACvB,CACV,MAAM,OAAS,SAAS,OACxB,MAAM,KACJ,SAAW,KAAO,SAAW,IACzB,YACA,QAAU,IACR,aACA,OACR,GACE,CAAC,MACD,CAAC,eAAe,KAAK,SAAS,QAAQ,IAAI,cAAc,GAAK,EAAE,EAC/D,CACA,OAAO,QACT,CACA,SAAS,MAAM,OAAO,EAAE,MAAM,IAAM,MAAS,EAC7C,MAAM,QAAU,IAAI,QAAQ,SAAS,OAAO,EAC5C,UAAW,OAAQ,CAAC,iBAAkB,mBAAoB,MAAM,EAAG,CACjE,QAAQ,OAAO,IAAI,CACrB,CACA,QAAQ,IAAI,eAAgB,0BAA0B,EACtD,QAAQ,IAAI,gBAAiB,UAAU,EACvC,OAAO,IAAI,SAAS,sBAAsB,KAAM,OAAO,EAAG,CACxD,OACA,WAAY,SAAS,WACrB,OACF,CAAC,CACH,CAGO,SAAS,sBACd,KACA,QAAgC,CAAC,EACvB,CACV,OAAO,IAAI,SAAS,sBAAsB,KAAM,OAAO,EAAG,CACxD,OAAQ,OAAO,IAAI,EACnB,QAAS,CACP,eAAgB,2BAChB,gBAAiB,UACnB,CACF,CAAC,CACH",
5
5
  "names": []
6
6
  }
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { PlatformErrorOptions, PlatformErrorKind } from '@zappie/sdk/error-pages';
3
- export { PlatformErrorKind, PlatformErrorOptions, platformErrorKind } from '@zappie/sdk/error-pages';
3
+ export { PlatformErrorKind, PlatformErrorOptions, PlatformErrorStore, platformErrorKind } from '@zappie/sdk/error-pages';
4
4
 
5
5
  /** Props for `PlatformErrorPage`. */
6
6
  type PlatformErrorPageProps = PlatformErrorOptions & {
@@ -11,10 +11,11 @@ type PlatformErrorPageProps = PlatformErrorOptions & {
11
11
  };
12
12
  /**
13
13
  * Zappie's page for a missing page (`not-found`) or a failed one (`went-wrong`). It is the site host's fallback for a
14
- * site that can't answer. A storefront draws its own pages with `siteError` from `@zappie/sdk/site-error`. It
15
- * covers the whole window, over anything the site draws around it.
14
+ * site that can't answer. Given a `store`, it leads with the store and credits Zappie in one line. A storefront draws
15
+ * its own pages with `siteError` from `@zappie/sdk/site-error`. It covers the whole window, over anything the site
16
+ * draws around it.
16
17
  */
17
- declare function PlatformErrorPage({ kind, error, home, }: PlatformErrorPageProps): react.JSX.Element;
18
+ declare function PlatformErrorPage({ kind, error, home, store, }: PlatformErrorPageProps): react.JSX.Element;
18
19
 
19
20
  export { PlatformErrorPage };
20
21
  export type { PlatformErrorPageProps };
@@ -1,2 +1,2 @@
1
- import{PLATFORM_ERROR_FONTS,PLATFORM_ERROR_STYLES,platformErrorKind,platformErrorParts}from"@zappie/sdk/error-pages";import{Fragment}from"react";import{platformErrorKind as platformErrorKind2}from"@zappie/sdk/error-pages";import{jsx,jsxs}from"react/jsx-runtime";function PlatformErrorPage({kind,error,home}){const parts=platformErrorParts(kind??platformErrorKind(error),home===void 0?{}:{home});return jsxs(Fragment,{children:[jsx("link",{rel:"stylesheet",href:PLATFORM_ERROR_FONTS}),jsx("style",{children:PLATFORM_ERROR_STYLES}),jsxs("main",{className:"zpe","data-kind":parts.kind,children:[jsx("div",{className:"zpe-brand",children:jsxs("picture",{children:[jsx("source",{srcSet:parts.logo.dark,media:"(prefers-color-scheme: dark)"}),jsx("img",{src:parts.logo.light,alt:"Zappie",width:"118",height:"24"})]})}),jsx("div",{className:"zpe-center",children:jsxs("div",{className:"zpe-body",children:[jsx("img",{className:"zpe-zee",src:parts.zee,alt:"",width:"112",height:"120"}),jsx("h1",{className:"zpe-title",children:parts.title}),jsx("p",{className:"zpe-text",children:parts.text}),jsx("div",{className:"zpe-actions",children:parts.actions.map(action=>jsx("a",{className:action.primary?"zpe-button zpe-primary":"zpe-button",href:action.href,children:action.label},action.label))})]})})]})]})}export{PlatformErrorPage,platformErrorKind2 as platformErrorKind};
1
+ import{PLATFORM_ERROR_FONTS,PLATFORM_ERROR_STYLES,platformErrorKind,platformErrorTree}from"@zappie/sdk/error-pages";import{createElement,Fragment}from"react";import{platformErrorKind as platformErrorKind2}from"@zappie/sdk/error-pages";import{jsx,jsxs}from"react/jsx-runtime";var draw=node=>{if(typeof node==="string"){return node}const[tag,attributes,...children]=node;return createElement(tag,attributes,...children.map(draw))};function PlatformErrorPage({kind,error,home,store}){return jsxs(Fragment,{children:[jsx("link",{rel:"stylesheet",href:PLATFORM_ERROR_FONTS}),jsx("style",{children:PLATFORM_ERROR_STYLES}),draw(platformErrorTree(kind??platformErrorKind(error),{...home===void 0?{}:{home},...store===void 0?{}:{store}}))]})}export{PlatformErrorPage,platformErrorKind2 as platformErrorKind};
2
2
  //# sourceMappingURL=react.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/error-pages/react.tsx"],
4
- "mappings": "AAAA,OACE,qBACA,sBACA,kBACA,uBAGK,0BACP,OAAS,aAAgB,QAEzB,OACE,qBAAAA,uBAGK,0BA0BD,WAII,SAJJ,oBAXC,SAAS,kBAAkB,CAChC,KACA,MACA,IACF,EAA2B,CACzB,MAAM,MAAQ,mBACZ,MAAQ,kBAAkB,KAAK,EAC/B,OAAS,OAAY,CAAC,EAAI,CAAE,IAAK,CACnC,EACA,OACE,KAAC,UACC,cAAC,QAAK,IAAI,aAAa,KAAM,qBAAsB,EACnD,IAAC,SAAO,+BAAsB,EAC9B,KAAC,QAAK,UAAU,MAAM,YAAW,MAAM,KACrC,cAAC,OAAI,UAAU,YACb,cAAC,WACC,cAAC,UACC,OAAQ,MAAM,KAAK,KACnB,MAAM,+BACR,EACA,IAAC,OAAI,IAAK,MAAM,KAAK,MAAO,IAAI,SAAS,MAAM,MAAM,OAAO,KAAK,GACnE,EACF,EACA,IAAC,OAAI,UAAU,aACb,cAAC,OAAI,UAAU,WACb,cAAC,OACC,UAAU,UACV,IAAK,MAAM,IACX,IAAI,GACJ,MAAM,MACN,OAAO,MACT,EACA,IAAC,MAAG,UAAU,YAAa,eAAM,MAAM,EACvC,IAAC,KAAE,UAAU,WAAY,eAAM,KAAK,EACpC,IAAC,OAAI,UAAU,cACZ,eAAM,QAAQ,IAAK,QAClB,IAAC,KAEC,UACE,OAAO,QAAU,yBAA2B,aAE9C,KAAM,OAAO,KAEZ,gBAAO,OANH,OAAO,KAOd,CACD,EACH,GACF,EACF,GACF,GACF,CAEJ",
4
+ "mappings": "AAAA,OACE,qBACA,sBACA,kBACA,sBAIK,0BACP,OAAS,cAAe,aAAgC,QAExD,OACE,qBAAAA,uBAIK,0BA+BH,OACE,IADF,6BArBJ,IAAM,KAAQ,MAAgD,CAC5D,GAAI,OAAO,OAAS,SAAU,CAC5B,OAAO,IACT,CACA,KAAM,CAAC,IAAK,WAAY,GAAG,QAAQ,EAAI,KACvC,OAAO,cAAc,IAAK,WAAY,GAAG,SAAS,IAAI,IAAI,CAAC,CAC7D,EAQO,SAAS,kBAAkB,CAChC,KACA,MACA,KACA,KACF,EAA2B,CACzB,OACE,KAAC,UACC,cAAC,QAAK,IAAI,aAAa,KAAM,qBAAsB,EACnD,IAAC,SAAO,+BAAsB,EAC7B,KACC,kBAAkB,MAAQ,kBAAkB,KAAK,EAAG,CAClD,GAAI,OAAS,OAAY,CAAC,EAAI,CAAE,IAAK,EACrC,GAAI,QAAU,OAAY,CAAC,EAAI,CAAE,KAAM,CACzC,CAAC,CACH,GACF,CAEJ",
5
5
  "names": ["platformErrorKind"]
6
6
  }
package/dist/index.js CHANGED
@@ -1,2 +1,2 @@
1
- import{ZappieCartError}from"./cart/errors.js";import{holdsForLater,isHeldQuote}from"./cart/held.js";import{previewItem}from"./cart/preview.js";import{estimateUnitPrice}from"./cart/price.js";import{resolveSourceMenu}from"./cart/source-menu.js";import{validateLine}from"./cart/validate.js";import{createZappie}from"./client.js";import{API_VERSION}from"./config.js";import{ZappieError,isZappieError}from"./errors.js";export*from"./models.js";import{format,money}from"./money.js";import{RestTransport}from"./transport/rest.js";var VERSION=true?"0.20.0":"0.0.0-development";export{API_VERSION,RestTransport,VERSION,ZappieCartError,ZappieError,createZappie,estimateUnitPrice,format,holdsForLater,isHeldQuote,isZappieError,money,previewItem,resolveSourceMenu,validateLine};
1
+ import{ZappieCartError}from"./cart/errors.js";import{holdsForLater,isHeldQuote}from"./cart/held.js";import{previewItem}from"./cart/preview.js";import{estimateUnitPrice}from"./cart/price.js";import{resolveSourceMenu}from"./cart/source-menu.js";import{validateLine}from"./cart/validate.js";import{createZappie}from"./client.js";import{API_VERSION}from"./config.js";import{ZappieError,isZappieError}from"./errors.js";export*from"./models.js";import{format,money}from"./money.js";import{RestTransport}from"./transport/rest.js";var VERSION=true?"0.22.0":"0.0.0-development";export{API_VERSION,RestTransport,VERSION,ZappieCartError,ZappieError,createZappie,estimateUnitPrice,format,holdsForLater,isHeldQuote,isZappieError,money,previewItem,resolveSourceMenu,validateLine};
2
2
  //# sourceMappingURL=index.js.map
@@ -0,0 +1,39 @@
1
+ import { Category, MenuSection, Menu, Branch, Item } from '@zappie/sdk';
2
+
3
+ /** One of the branch's menus (Food, Drinks) with its categories, or the whole menu when it has none. */
4
+ type Section = Pick<MenuSection, "id" | "name" | "categoryIds"> & Partial<MenuSection>;
5
+ /** A category with the number of its items the menu has. */
6
+ type CategoryView = Category & {
7
+ itemCount: number;
8
+ };
9
+ /** An order type a site's switch offers. */
10
+ type OrderType = "delivery" | "pickup";
11
+ /** The branch's menus that list a category, or the whole menu as one section when it lists no menus. */
12
+ declare function sectionsOf(menu: Menu): Section[];
13
+ /**
14
+ * The categories with something to sell, in a section's order, or across every section in the order the menus list
15
+ * them, each once.
16
+ */
17
+ declare function categoriesOf(menu: Menu, section?: Pick<Section, "categoryIds">): CategoryView[];
18
+ /** Each item of the categories once, in the order they list them. */
19
+ declare function itemsOf(menu: Menu, categories: readonly Pick<Category, "itemIds">[]): Item[];
20
+ /** The first category that lists the item. */
21
+ declare function categoryOfItem(menu: Menu, itemId: string): Category | undefined;
22
+ /** The first section that lists the category. */
23
+ declare function sectionOfCategory<S extends Pick<Section, "categoryIds">>(sections: readonly S[], categoryId: string | undefined): S | undefined;
24
+ /** An item's page, opened from the menu it is on (`?menu=`), so it is ordered by the rules of the one shown. */
25
+ declare const itemHref: (itemId: string, menuId?: string) => string;
26
+ /** The menu page, at a menu (`?menu=`) and a category (`?category=`). */
27
+ declare function menuHref(sectionId?: string, categoryId?: string): string;
28
+ /**
29
+ * The order types the branch offers that its menus take. A menu may list its own; when none lists any, the branch's
30
+ * stand.
31
+ */
32
+ declare function orderTypesOf(branch: Pick<Branch, "fulfilment">, menu: Menu | undefined): OrderType[];
33
+ /** Directions to the branch in Google Maps: to its pin, or a search for its address, then the store's name. */
34
+ declare function directionsHref(store: {
35
+ name: string;
36
+ }, branch: Pick<Branch, "coordinates" | "address">): string;
37
+
38
+ export { categoriesOf, categoryOfItem, directionsHref, itemHref, itemsOf, menuHref, orderTypesOf, sectionOfCategory, sectionsOf };
39
+ export type { CategoryView, OrderType, Section };
@@ -0,0 +1,2 @@
1
+ function sectionsOf(menu){return menu.menus?.length?menu.menus.filter(section=>section.categoryIds.length>0):[{id:menu.id,name:menu.name,categoryIds:menu.categories.map(category=>category.id)}]}function categoriesOf(menu,section){const ids=section?.categoryIds??sectionsOf(menu).flatMap(entry=>entry.categoryIds);return[...new Set(ids)].map(id=>menu.categories.find(category=>category.id===id)).filter(category=>Boolean(category)).map(category=>({...category,itemCount:category.itemIds.filter(itemId=>menu.items[itemId]).length})).filter(category=>category.itemCount>0)}function itemsOf(menu,categories){const ids=new Set(categories.flatMap(category=>category.itemIds));return[...ids].flatMap(id=>menu.items[id]??[])}function categoryOfItem(menu,itemId){return menu.categories.find(category=>category.itemIds.includes(itemId))}function sectionOfCategory(sections,categoryId){return categoryId?sections.find(section=>section.categoryIds.includes(categoryId)):void 0}var itemHref=(itemId,menuId)=>`/item/${encodeURIComponent(itemId)}${menuId?`?menu=${encodeURIComponent(menuId)}`:""}`;function menuHref(sectionId,categoryId){const query=new URLSearchParams;if(sectionId){query.set("menu",sectionId)}if(categoryId){query.set("category",categoryId)}const search=query.toString();return search?`/menu?${search}`:"/menu"}function orderTypesOf(branch,menu){const listed=menu?.menus?.flatMap(section=>section.fulfilment??[]);const offers=["delivery","pickup"].filter(type=>branch.fulfilment[type]);return listed?.length?offers.filter(type=>listed.includes(type)):offers}function directionsHref(store,branch){return branch.coordinates?`https://www.google.com/maps/dir/?api=1&destination=${branch.coordinates.lat},${branch.coordinates.lng}`:`https://www.google.com/maps/search/?api=1&query=${encodeURIComponent(branch.address??store.name)}`}export{categoriesOf,categoryOfItem,directionsHref,itemHref,itemsOf,menuHref,orderTypesOf,sectionOfCategory,sectionsOf};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/menu/index.ts"],
4
+ "mappings": "AAeO,SAAS,WAAW,KAAuB,CAChD,OAAO,KAAK,OAAO,OACf,KAAK,MAAM,OAAQ,SAAY,QAAQ,YAAY,OAAS,CAAC,EAC7D,CACE,CACE,GAAI,KAAK,GACT,KAAM,KAAK,KACX,YAAa,KAAK,WAAW,IAAK,UAAa,SAAS,EAAE,CAC5D,CACF,CACN,CAMO,SAAS,aACd,KACA,QACgB,CAChB,MAAM,IACJ,SAAS,aACT,WAAW,IAAI,EAAE,QAAS,OAAU,MAAM,WAAW,EACvD,MAAO,CAAC,GAAG,IAAI,IAAI,GAAG,CAAC,EACpB,IAAK,IAAO,KAAK,WAAW,KAAM,UAAa,SAAS,KAAO,EAAE,CAAC,EAClE,OAAQ,UAAmC,QAAQ,QAAQ,CAAC,EAC5D,IAAK,WAAc,CAClB,GAAG,SACH,UAAW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,SAAW,MAAM,IAAI,CAAC,EACzG",
5
+ "names": []
6
+ }
@@ -0,0 +1,18 @@
1
+ /** A node of merchant rich text: a tag with its children, or text. Attributes are not kept. */
2
+ type RichTextNode = {
3
+ type: string;
4
+ name?: string;
5
+ data?: string;
6
+ children?: RichTextNode[];
7
+ };
8
+ /**
9
+ * Parse merchant rich text into nodes without a DOM, so it runs in a loader, a Worker or SSR. Pair it with
10
+ * `createSanitizeRichText` from `@zappie/foundations/rich-text` before you render HTML.
11
+ * Decodes numeric entities, Latin-1 names and the typographic marks menus use; leaves unknown names as text.
12
+ */
13
+ declare function parseRichText(html: string): RichTextNode[];
14
+ /** Merchant rich text as plain text, for a card's lines, a search or a meta description: tags dropped, entities decoded, spaces collapsed. */
15
+ declare function plainText(html: string): string;
16
+
17
+ export { parseRichText, plainText };
18
+ export type { RichTextNode };
@@ -0,0 +1,2 @@
1
+ var tag=/<(\/?)\s*([a-zA-Z][a-zA-Z0-9]*)\b[^>]*>/g;var voidTags=new Set(["br","hr","img","input","meta","link"]);var latin1="iexcl cent pound curren yen brvbar sect uml copy ordf laquo not shy reg macr deg plusmn sup2 sup3 acute micro para middot cedil sup1 ordm raquo frac14 frac12 frac34 iquest Agrave Aacute Acirc Atilde Auml Aring AElig Ccedil Egrave Eacute Ecirc Euml Igrave Iacute Icirc Iuml ETH Ntilde Ograve Oacute Ocirc Otilde Ouml times Oslash Ugrave Uacute Ucirc Uuml Yacute THORN szlig agrave aacute acirc atilde auml aring aelig ccedil egrave eacute ecirc euml igrave iacute icirc iuml eth ntilde ograve oacute ocirc otilde ouml divide oslash ugrave uacute ucirc uuml yacute thorn yuml";var marks="OElig 152 oelig 153 Scaron 160 scaron 161 Yuml 178 fnof 192 circ 2c6 tilde 2dc ensp 2002 emsp 2003 thinsp 2009 ndash 2013 mdash 2014 lsquo 2018 rsquo 2019 sbquo 201a ldquo 201c rdquo 201d bdquo 201e dagger 2020 Dagger 2021 bull 2022 hellip 2026 permil 2030 prime 2032 Prime 2033 lsaquo 2039 rsaquo 203a euro 20ac trade 2122 larr 2190 rarr 2192 minus 2212 check 2713";var named;var entities=()=>{if(!named){named={amp:"&",AMP:"&",apos:"'",gt:">",GT:">",lt:"<",LT:"<",nbsp:"\xA0",quot:'"',QUOT:'"'};latin1.split(" ").forEach((name,index)=>{named[name]=String.fromCodePoint(161+index)});const pairs=marks.split(" ");for(let index=0;index<pairs.length;index+=2){named[pairs[index]]=String.fromCodePoint(Number.parseInt(pairs[index+1],16))}}return named};var decodeEntities=value=>value.replace(/&(?:#([0-9]+)|#x([0-9a-f]+)|([a-z][a-z0-9]*));/gi,(entity,decimal,hexadecimal,name)=>{if(name){return entities()[name]??entity}const code=Number.parseInt(decimal||hexadecimal,hexadecimal?16:10);return code>0&&code<=1114111&&!(code>=55296&&code<=57343)?String.fromCodePoint(code):"\uFFFD"});function parseRichText(html){const root={type:"root",children:[]};const stack=[root];let last=0;const appendText=value=>{if(value){stack.at(-1)?.children?.push({type:"text",data:decodeEntities(value)})}};for(const match of html.matchAll(tag)){appendText(html.slice(last,match.index));last=match.index+match[0].length;const name=match[2].toLowerCase();if(match[1]){let position=stack.length-1;while(position>0&&stack[position].name!==name){position--}if(position>0){stack.length=position}continue}const node={type:"tag",name,children:[]};stack.at(-1)?.children?.push(node);if(!voidTags.has(name)&&!match[0].endsWith("/>")){stack.push(node)}}appendText(html.slice(last));return root.children}function plainText(html){const text=[];const walk=nodes=>{for(const node of nodes){if(node.type==="text"){text.push(node.data)}else{walk(node.children);text.push(" ")}}};walk(parseRichText(html));return text.join("").replace(/\s+/g," ").trim()}export{parseRichText,plainText};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/rich-text/index.ts"],
4
+ "mappings": "AAQA,IAAM,IAAM,2CACZ,IAAM,SAAW,IAAI,IAAI,CAAC,KAAM,KAAM,MAAO,QAAS,OAAQ,MAAM,CAAC,EAGrE,IAAM,OACJ,gkBACF,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CAAC,EAAE,OAC9B,MAAM,KAAO,MAAM,CAAC,EAAG,YAAY,EACnC,GAAI,MAAM,CAAC,EAAG,CACZ,IAAI,SAAW,MAAM,OAAS,EAC9B,MAAO,SAAW,GAAK,MAAM,QAAQ,EAAG,OAAS,KAAM,CACrD,UACF,CACA,GAAI,SAAW,EAAG,CAChB,MAAM,OAAS,QACjB,CACA,QACF,CACA,MAAM,KAAqB,CAAE,KAAM,MAAO,KAAM,SAAU,CAAC,CAAE,EAC7D,MAAM,GAAG,EAAE,GAAG,UAAU,KAAK,IAAI,EACjC,GAAI,CAAC,SAAS,IAAI,IAAI,GAAK,CAAC,MAAM,CAAC,EAAE,SAAS,IAAI,EAAG,CACnD,MAAM,KAAK,IAAI,CACjB,CACF,CACA,WAAW,KAAK,MAAM,IAAI,CAAC,EAC3B,OAAO,KAAK,QACd,CAGO,SAAS,UAAU,KAAc,CACtC,MAAM,KAAiB,CAAC,EACxB,MAAM,KAAQ,OAA0B,CACtC,UAAW,QAAQ,MAAO,CACxB,GAAI,KAAK,OAAS,OAAQ,CACxB,KAAK,KAAK,KAAK,IAAK,CACtB,KAAO,CACL,KAAK,KAAK,QAAS,EACnB,KAAK,KAAK,GAAG,CACf,CACF,CACF,EACA,KAAK,cAAc,IAAI,CAAC,EACxB,OAAO,KAAK,KAAK,EAAE,EAAE,QAAQ,OAAQ,GAAG,EAAE,KAAK,CACjD",
5
+ "names": []
6
+ }
@@ -1099,6 +1099,16 @@ declare function sitemapResponse({ preview, ...options }: SitemapOptions & {
1099
1099
  preview: boolean;
1100
1100
  }): Response;
1101
1101
 
1102
+ /** The store a page belongs to. */
1103
+ type PlatformErrorStore = {
1104
+ /** The store's name, shown over the heading and as the page's title. */
1105
+ name: string;
1106
+ /** Where the store's name leads. Default the page's `home`. */
1107
+ href?: string;
1108
+ /** The store's logo as an image URL, shown in place of its name. */
1109
+ logo?: string;
1110
+ };
1111
+
1102
1112
  /** The Worker's own variables that {@link siteWorker} reads. */
1103
1113
  type SiteWorkerEnv = {
1104
1114
  /** `off` renders every page afresh, as an end-to-end test's own Worker does. */
@@ -1119,6 +1129,8 @@ type SiteWorkerOptions<Env extends SiteWorkerEnv> = {
1119
1129
  branchCookie?: string;
1120
1130
  /** Answers a request before anything renders, such as `legacyRedirects(…).classicHome`. */
1121
1131
  redirect?: (request: Request) => Response | undefined;
1132
+ /** The store whose name leads the "Something went wrong" page, such as `{ name: "Kingfisher Africa" }`. */
1133
+ store?: PlatformErrorStore | ((env: Env) => PlatformErrorStore | undefined);
1122
1134
  };
1123
1135
  /**
1124
1136
  * A site's Worker. It answers, in order:
@@ -1131,7 +1143,7 @@ type SiteWorkerOptions<Env extends SiteWorkerEnv> = {
1131
1143
  * afresh with `ZAPPIE_EDGE_CACHE=off`, and for a request with `x-forwarded-host`: a page drawn behind a proxy names
1132
1144
  * the proxy's host in its links, so it is never shared. A new build starts with an empty cache.
1133
1145
  *
1134
- * A handler that throws answers with Zappie's own "Something went wrong" page.
1146
+ * A handler that throws answers with Zappie's "Something went wrong" page, led by `store` when you name it.
1135
1147
  *
1136
1148
  * @example
1137
1149
  * ```ts
@@ -1146,7 +1158,7 @@ type SiteWorkerOptions<Env extends SiteWorkerEnv> = {
1146
1158
  * });
1147
1159
  * ```
1148
1160
  */
1149
- declare function siteWorker<Env extends SiteWorkerEnv>({ render, deployId, cacheControl, branchCookie, redirect, }: SiteWorkerOptions<Env>): {
1161
+ declare function siteWorker<Env extends SiteWorkerEnv>({ render, deployId, cacheControl, branchCookie, redirect, store, }: SiteWorkerOptions<Env>): {
1150
1162
  fetch(request: Request, env: Env, ctx: EdgeContext): Promise<Response>;
1151
1163
  };
1152
1164
  /**
@@ -1,2 +1,2 @@
1
- import{platformErrorResponse}from"../error-pages/index.js";import{markClosedPage,siteClosed}from"../site-closed/index.js";import{cachePage}from"./edge-cache.js";function siteWorker({render,deployId,cacheControl,branchCookie,redirect}){return{async fetch(request,env,ctx){try{if(siteClosed(request)){const response=await render(new Request(new URL("/",request.url),request),env,ctx);return response.ok?markClosedPage(response):response}const early=redirect?.(request);if(early){return early}const fresh=next=>render(next,env,ctx);if(env.ZAPPIE_EDGE_CACHE==="off"||request.headers.has("x-forwarded-host")){return await fresh(request)}return await cachePage(request,fresh,{ctx,deployId:await deployId(),...cacheControl?{cacheControl}:{},...branchCookie?{branchCookie}:{}})}catch(error){console.error(error);return platformErrorResponse("went-wrong")}}}}function originFetch(origin,fetcher=(input,init)=>globalThis.fetch(input,init)){return(input,init)=>{const headers=new Headers(init?.headers??(input instanceof Request?input.headers:void 0));if(!headers.has("origin")){headers.set("origin",origin)}return fetcher(input,{...init,headers})}}export{originFetch,siteWorker};
1
+ import{platformErrorResponse}from"../error-pages/index.js";import{markClosedPage,siteClosed}from"../site-closed/index.js";import{cachePage}from"./edge-cache.js";function siteWorker({render,deployId,cacheControl,branchCookie,redirect,store}){return{async fetch(request,env,ctx){try{if(siteClosed(request)){const response=await render(new Request(new URL("/",request.url),request),env,ctx);return response.ok?markClosedPage(response):response}const early=redirect?.(request);if(early){return early}const fresh=next=>render(next,env,ctx);if(env.ZAPPIE_EDGE_CACHE==="off"||request.headers.has("x-forwarded-host")){return await fresh(request)}return await cachePage(request,fresh,{ctx,deployId:await deployId(),...cacheControl?{cacheControl}:{},...branchCookie?{branchCookie}:{}})}catch(error){console.error(error);let owner;try{owner=typeof store==="function"?store(env):store}catch{owner=void 0}return platformErrorResponse("went-wrong",owner?{store:owner}:{})}}}}function originFetch(origin,fetcher=(input,init)=>globalThis.fetch(input,init)){return(input,init)=>{const headers=new Headers(init?.headers??(input instanceof Request?input.headers:void 0));if(!headers.has("origin")){headers.set("origin",origin)}return fetcher(input,{...init,headers})}}export{originFetch,siteWorker};
2
2
  //# sourceMappingURL=site-worker.js.map
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/server/site-worker.ts"],
4
- "mappings": "AAAA,OAAS,0BAA6B,0BACtC,OAAS,eAAgB,eAAkB,0BAC3C,OAA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-1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zappie/sdk",
3
- "version": "0.20.0",
3
+ "version": "0.22.0",
4
4
  "description": "Typed, framework-agnostic client for Zappie menus, carts, checkout, auth and events.",
5
5
  "type": "module",
6
6
  "sideEffects": [
@@ -123,6 +123,14 @@
123
123
  "types": "./dist/display/index.d.ts",
124
124
  "import": "./dist/display/index.js"
125
125
  },
126
+ "./rich-text": {
127
+ "types": "./dist/rich-text/index.d.ts",
128
+ "import": "./dist/rich-text/index.js"
129
+ },
130
+ "./menu": {
131
+ "types": "./dist/menu/index.d.ts",
132
+ "import": "./dist/menu/index.js"
133
+ },
126
134
  "./branches": {
127
135
  "types": "./dist/branches/index.d.ts",
128
136
  "import": "./dist/branches/index.js"
@@ -227,7 +235,7 @@
227
235
  "vite": "8.3.5"
228
236
  },
229
237
  "scripts": {
230
- "build": "node ../../scripts/release-packages/build-declarations.mjs tsup.config.ts tsup.checkout.config.ts tsup.checkout-defaults.config.ts tsup.customer.config.ts tsup.loyalty.config.ts tsup.in-venue.config.ts tsup.account.config.ts tsup.places.config.ts tsup.url.config.ts tsup.redirect.config.ts tsup.navigation.config.ts tsup.services.config.ts tsup.visits.config.ts tsup.pricing.config.ts tsup.display.config.ts tsup.branches.config.ts tsup.options.config.ts tsup.site-config.config.ts tsup.template.config.ts tsup.error-pages.config.ts tsup.site-error.config.ts tsup.site-closed.config.ts tsup.navigation-progress.config.ts tsup.receipts.config.ts && node ../../scripts/release-packages/build-modules.mjs --no-sources-content --unmapped=studio/index.js --unmapped=testing/index.js --unmapped=vite/index.js",
238
+ "build": "node ../../scripts/release-packages/build-declarations.mjs tsup.config.ts tsup.checkout.config.ts tsup.checkout-defaults.config.ts tsup.customer.config.ts tsup.loyalty.config.ts tsup.in-venue.config.ts tsup.account.config.ts tsup.places.config.ts tsup.url.config.ts tsup.redirect.config.ts tsup.navigation.config.ts tsup.services.config.ts tsup.visits.config.ts tsup.pricing.config.ts tsup.display.config.ts tsup.rich-text.config.ts tsup.menu.config.ts tsup.branches.config.ts tsup.options.config.ts tsup.site-config.config.ts tsup.template.config.ts tsup.error-pages.config.ts tsup.site-error.config.ts tsup.site-closed.config.ts tsup.navigation-progress.config.ts tsup.receipts.config.ts && node ../../scripts/release-packages/build-modules.mjs --no-sources-content --unmapped=studio/index.js --unmapped=testing/index.js --unmapped=vite/index.js",
231
239
  "test": "vitest run --root ../.. packages/sdk/test",
232
240
  "size": "node ../../scripts/release-packages/size-sdk.mjs && size-limit"
233
241
  }