@zappie/sdk 0.10.10 → 0.11.1

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.
Files changed (68) hide show
  1. package/CHANGELOG.md +25 -0
  2. package/README.md +99 -19
  3. package/dist/cart/item.d.ts +1 -1
  4. package/dist/{client-CtDaenmW.d.ts → client-C47e44tl.d.ts} +1 -1
  5. package/dist/customer/client.js +8 -8
  6. package/dist/customer/client.js.map +1 -1
  7. package/dist/customer/index.d.ts +4 -2
  8. package/dist/debug.js +1 -1
  9. package/dist/debug.js.map +1 -1
  10. package/dist/error-pages/art.js +11 -0
  11. package/dist/error-pages/art.js.map +6 -0
  12. package/dist/error-pages/index.d.ts +58 -0
  13. package/dist/error-pages/index.js +122 -0
  14. package/dist/error-pages/index.js.map +6 -0
  15. package/dist/error-pages/react.d.ts +20 -0
  16. package/dist/error-pages/react.js +66 -0
  17. package/dist/error-pages/react.js.map +6 -0
  18. package/dist/in-venue/bill.js +70 -0
  19. package/dist/in-venue/bill.js.map +6 -0
  20. package/dist/in-venue/client.js +120 -0
  21. package/dist/in-venue/client.js.map +6 -0
  22. package/dist/in-venue/error.js +19 -0
  23. package/dist/in-venue/error.js.map +6 -0
  24. package/dist/in-venue/index.d.ts +338 -0
  25. package/dist/in-venue/index.js +24 -0
  26. package/dist/in-venue/index.js.map +6 -0
  27. package/dist/in-venue/react/bill-page.js +351 -0
  28. package/dist/in-venue/react/bill-page.js.map +6 -0
  29. package/dist/in-venue/react/in-venue-page.js +103 -0
  30. package/dist/in-venue/react/in-venue-page.js.map +6 -0
  31. package/dist/in-venue/react/order-panel.js +284 -0
  32. package/dist/in-venue/react/order-panel.js.map +6 -0
  33. package/dist/in-venue/react/pay-point-page.js +51 -0
  34. package/dist/in-venue/react/pay-point-page.js.map +6 -0
  35. package/dist/in-venue/react/shared.js +202 -0
  36. package/dist/in-venue/react/shared.js.map +6 -0
  37. package/dist/in-venue/react/table-menus-page.js +152 -0
  38. package/dist/in-venue/react/table-menus-page.js.map +6 -0
  39. package/dist/in-venue/react.d.ts +120 -0
  40. package/dist/in-venue/react.js +15 -0
  41. package/dist/in-venue/react.js.map +6 -0
  42. package/dist/in-venue/table.js +63 -0
  43. package/dist/in-venue/table.js.map +6 -0
  44. package/dist/in-venue/types.js +1 -0
  45. package/dist/in-venue/types.js.map +6 -0
  46. package/dist/in-venue/watch.js +83 -0
  47. package/dist/in-venue/watch.js.map +6 -0
  48. package/dist/index.d.ts +4 -4
  49. package/dist/index.js +1 -1
  50. package/dist/index.js.map +1 -1
  51. package/dist/integrations/index.d.ts +1 -1
  52. package/dist/internal.d.ts +1 -1
  53. package/dist/persist/catalogue.d.ts +2 -2
  54. package/dist/receipts/index.d.ts +23 -0
  55. package/dist/receipts/index.js +49 -0
  56. package/dist/receipts/index.js.map +6 -0
  57. package/dist/server/index.d.ts +1 -1
  58. package/dist/site-error/index.d.ts +45 -0
  59. package/dist/site-error/index.js +33 -0
  60. package/dist/site-error/index.js.map +6 -0
  61. package/dist/site-error/react.d.ts +18 -0
  62. package/dist/site-error/react.js +15 -0
  63. package/dist/site-error/react.js.map +6 -0
  64. package/dist/testing/index.d.ts +1 -1
  65. package/dist/transport/search.d.ts +1 -1
  66. package/dist/transport/selected-menu.d.ts +2 -2
  67. package/dist/{types-DMMeyB5d.d.ts → types-ooHA0lwH.d.ts} +2 -0
  68. package/package.json +30 -2
package/CHANGELOG.md CHANGED
@@ -1,5 +1,30 @@
1
1
  # @zappie/sdk
2
2
 
3
+ ## 0.11.1
4
+
5
+ ### Patch Changes
6
+
7
+ - a1b1a2d: The in-venue pages look native on a site that defines no `--z-*` tokens. Spacing, sizes, borders, corners and the focus ring fall back to real values, with 16px of padding at the page's edge, and colour and type inherit the site's own. A site with tokens looks as before. The pages also import React once, which pays for the fallbacks inside the 7 kB budget.
8
+
9
+ ## 0.11.0
10
+
11
+ ### Minor Changes
12
+
13
+ - f43013f: Add Zappie's own page not found and something went wrong pages for every storefront. `@zappie/sdk/error-pages/react` draws them with Zee, surprised at a missing page and sad beside Try again when a page fails, in Zappie's colours on every site. `@zappie/sdk/error-pages` returns the same page as HTML for a Worker that can't render the site. The starter shows them from its root error boundary and its catch-all route.
14
+ - 2637055: New `@zappie/sdk/in-venue` entry for guests at a table. `createInVenue()` reads the table a guest scanned (`payPoint`), where its scan lands (`entry`), its menu group (`menuGroup`) and the table's bill (`dineInOrder`, narrowed to chosen diners). `placeDineInOrder` adds the signed-in guest's lines to the bill, `payDineInOrder` raises a payment for chosen diners or the whole bill, and `wallet` reads the signed-in guest's wallet balances, and `watchDineInOrder` follows the bill live over server-sent events, falling back to polling. Requests go through Zappie hosting's `/_zappie/api`. IDs work bare, as printed table codes carry them, or with their API prefix. `createTableClient(site, scope)` gives a storefront client for one table: its branch, its dine-in menus or the one menu it pins, and a bag kept apart from the guest's online bag.
15
+
16
+ New `@zappie/sdk/in-venue/react` entry with the in-venue pages the platform owns: `PayPointPage` for `/pay-point/:id`, `TableMenusPage` for `/dine-in/menus` and `BillPage` for `/dine-in/:order`, or `InVenuePage` for all of them from the path. They behave as the classic app's table pages do, drawn with the site's tokens, header, footer and catalogue. The table menu shows a menu group's logo and each bag line's choices, and an order a signed-out guest placed goes on once they're back from sign-in. The bill keeps the classic split by diner, with a pill per diner and "Mine" for the signed-in guest, and pays on Zappie's payment page, which comes back to the bill. Paying spends the wallet as the classic bill does: when the guest's balance in the bill's currency is below the amount. A wallet that can't be read is left out. Self-service and collect-payment tables aren't served on storefronts. Scanning one says the table can't be used on this site and to ask a member of staff. `scopeMessage` gives the bill's words for whose share is shown or paid for.
17
+
18
+ The cart's dine-in fulfilment takes an optional `payPointId`, kept with the saved cart.
19
+
20
+ - 73d283a: New `@zappie/sdk/site-error` entry for a storefront's own 404 and error pages. `siteError(error, { url, home, copy })` turns what a route threw into the page to show: `not-found` for a 404 or 410 and `went-wrong` for anything else, a safe heading and message, Try again, which reloads the address, and the home link. It never shows the thrown error's text. `SiteErrorPage` from `/site-error/react` hands the same to a render prop and draws nothing itself. Zappie's pages in `@zappie/sdk/error-pages` are now the site host's fallback only.
21
+
22
+ The in-venue pages throw to the site's own error boundary. An unknown table, bill or path throws a 404 Response, and any other failed load throws its error. The `notFound` prop is gone.
23
+
24
+ Receipts. New `@zappie/sdk/receipts` entry with `receiptFile(url)`, which reads a receipt PDF as a File named as the API names it, and `canShareReceipt()`. The customer client has `receipt(orderId)` for an online order. The in-venue client has `receipt(orderId)` and `receiptUrl(orderId)` for a table bill, and the bill page offers Download receipt once anything is paid, opening the share sheet where the device can share a file.
25
+
26
+ The starter draws its own 404 and error page with `siteError`, in its own look, and its Worker answers with Zappie's page only when its handler throws.
27
+
3
28
  ## 0.10.10
4
29
 
5
30
  ### Patch Changes
package/README.md CHANGED
@@ -50,25 +50,29 @@ Prices always come from Zappie. The cart shows a local estimate while it waits,
50
50
 
51
51
  ## Entry points
52
52
 
53
- | Import | For |
54
- | -------------------------------------------- | ---------------------------------------------------------------------------------------- |
55
- | `@zappie/sdk` | The client, the cart, money formatting and errors |
56
- | `@zappie/sdk/react` | `ZappieProvider` and hooks such as `useStore`, `useMenu` and `useCart` |
57
- | `@zappie/sdk/checkout` | Opening Zappie's hosted checkout and checking it completed |
58
- | `@zappie/sdk/checkout-defaults` | The phone, address, region and time a signed-in checkout starts from |
59
- | `@zappie/sdk/customer` and `/customer/react` | Signed-in customers, their orders and saved addresses |
60
- | `@zappie/sdk/account` | `accountsUrl`, a link to the shopper's Zappie account on the accounts portal |
61
- | `@zappie/sdk/integrations` | Public integration IDs and browser keys |
62
- | `@zappie/sdk/places` | Address search and delivery-zone checks |
63
- | `@zappie/sdk/pricing` | An item's starting price, its price with given choices, and whether to show it as "From" |
64
- | `@zappie/sdk/display` | Phone numbers spaced for reading, and what a branch calls an in-person order |
65
- | `@zappie/sdk/branches` | The nearest branch to a shopper, and each branch's distance from them |
66
- | `@zappie/sdk/options` | Option group rules: radio or checkbox, the group's limit, its labels and the note limit |
67
- | `@zappie/sdk/server` | Server-side reads, storefront URLs, `verifyWebhook()`, menu snapshots and sign-in crypto |
68
- | `@zappie/sdk/template` and `/template/react` | Template settings and responsive images for template authors |
69
- | `@zappie/sdk/testing` | A mock client for your tests |
70
- | `@zappie/sdk/url` | Storefront URL parsing and canonical redirects |
71
- | `@zappie/sdk/redirect` | Same-origin validation for untrusted redirect targets |
53
+ | Import | For |
54
+ | -------------------------------------------------- | ---------------------------------------------------------------------------------------- |
55
+ | `@zappie/sdk` | The client, the cart, money formatting and errors |
56
+ | `@zappie/sdk/react` | `ZappieProvider` and hooks such as `useStore`, `useMenu` and `useCart` |
57
+ | `@zappie/sdk/checkout` | Opening Zappie's hosted checkout and checking it completed |
58
+ | `@zappie/sdk/checkout-defaults` | The phone, address, region and time a signed-in checkout starts from |
59
+ | `@zappie/sdk/customer` and `/customer/react` | Signed-in customers, their orders and saved addresses |
60
+ | `@zappie/sdk/in-venue` and `/in-venue/react` | Tables: the scanned table, its menus, the shared bill, and the pages that serve them |
61
+ | `@zappie/sdk/account` | `accountsUrl`, a link to the shopper's Zappie account on the accounts portal |
62
+ | `@zappie/sdk/integrations` | Public integration IDs and browser keys |
63
+ | `@zappie/sdk/places` | Address search and delivery-zone checks |
64
+ | `@zappie/sdk/pricing` | An item's starting price, its price with given choices, and whether to show it as "From" |
65
+ | `@zappie/sdk/display` | Phone numbers spaced for reading, and what a branch calls an in-person order |
66
+ | `@zappie/sdk/branches` | The nearest branch to a shopper, and each branch's distance from them |
67
+ | `@zappie/sdk/options` | Option group rules: radio or checkbox, the group's limit, its labels and the note limit |
68
+ | `@zappie/sdk/server` | Server-side reads, storefront URLs, `verifyWebhook()`, menu snapshots and sign-in crypto |
69
+ | `@zappie/sdk/template` and `/template/react` | Template settings and responsive images for template authors |
70
+ | `@zappie/sdk/error-pages` and `/error-pages/react` | Zappie's page not found and something went wrong pages, for the site host's fallback |
71
+ | `@zappie/sdk/site-error` and `/site-error/react` | Your own 404 and error pages: which page, safe words, Try again and the home link |
72
+ | `@zappie/sdk/receipts` | Receipt PDFs as files, and whether the device can share them |
73
+ | `@zappie/sdk/testing` | A mock client for your tests |
74
+ | `@zappie/sdk/url` | Storefront URL parsing and canonical redirects |
75
+ | `@zappie/sdk/redirect` | Same-origin validation for untrusted redirect targets |
72
76
 
73
77
  Customer sign-in runs through Zappie's site host, so `@zappie/sdk/customer` works on sites Zappie hosts. Sign-in for a site you host yourself isn't available yet.
74
78
 
@@ -98,6 +102,44 @@ const verifier = createTokenVerifier({
98
102
  const claims = await verifier.verifyIdToken(idToken, { nonce });
99
103
  ```
100
104
 
105
+ Your storefront draws its own page when a page is missing or fails. `siteError`
106
+ from `@zappie/sdk/site-error` turns what a route threw into the page to show:
107
+ `not-found` for a 404 or 410 and `went-wrong` for anything else, a safe heading
108
+ and message, Try again, which reloads the address, and a link home. It never
109
+ shows the thrown error's text. Pass your own words with `copy`. Throw a 404 from
110
+ your catch-all route to reach the not-found page. `SiteErrorPage` from
111
+ `/site-error/react` does the same as a render prop.
112
+
113
+ ```tsx
114
+ import { siteError } from "@zappie/sdk/site-error";
115
+ import { useLocation, useRouteError } from "react-router";
116
+
117
+ export function ErrorBoundary() {
118
+ const location = useLocation();
119
+ const page = siteError(useRouteError(), {
120
+ url: location.pathname + location.search,
121
+ });
122
+ return (
123
+ <main>
124
+ <h1>{page.title}</h1>
125
+ <p>{page.message}</p>
126
+ {page.retry && <a href={page.retry.href}>{page.retry.label}</a>}
127
+ <a href={page.home.href}>{page.home.label}</a>
128
+ </main>
129
+ );
130
+ }
131
+ ```
132
+
133
+ Zappie's own pages in `@zappie/sdk/error-pages` are for the site host, which
134
+ answers with them when a site can't answer at all. A Worker you host yourself
135
+ can return `platformErrorResponse("went-wrong")` when its handler throws.
136
+
137
+ Receipts come as PDF files. `customer.receipt(orderId)` reads an online order's
138
+ receipt, and `receiptFile(url)` from `@zappie/sdk/receipts` reads any receipt
139
+ address, such as a table bill's `inVenue.receiptUrl(orderId)`. Hand the file to
140
+ `navigator.share` where `canShareReceipt()` says the device can share it, or link
141
+ to the address with `download`.
142
+
101
143
  Pass any redirect target read from a query parameter through `safeRedirect`.
102
144
  It keeps same-origin relative paths and returns your trusted fallback for an
103
145
  external, malformed or unsupported target.
@@ -160,6 +202,44 @@ written without a country code.
160
202
  `inVenueLabel(branch)` says what an order placed at the branch is called:
161
203
  "Walk-in" when `branch.category` is `"RETAIL"`, and "Dine-in" otherwise.
162
204
 
205
+ ### Tables and bills
206
+
207
+ A guest who scans a table code lands on one of three pages the platform owns:
208
+ `/pay-point/:id`, `/dine-in/menus` and `/dine-in/:order`.
209
+ Mount `InVenuePage` from `@zappie/sdk/in-venue/react` at each of those paths,
210
+ before your catch-all, and pass it the path and query, your clients, your
211
+ router's `navigate`, your header and footer, and `renderMenu`. `renderMenu`
212
+ draws your own catalogue and item sheet. It renders inside a `ZappieProvider`
213
+ whose client is the table's, so `useMenu()` reads the table's menu and adding
214
+ an item fills the table's bag. Leave your own bag and checkout out of it. The
215
+ page brings the table's bag and Place order.
216
+
217
+ ```tsx
218
+ import { createInVenue } from "@zappie/sdk/in-venue";
219
+ import { InVenuePage } from "@zappie/sdk/in-venue/react";
220
+
221
+ const inVenue = createInVenue();
222
+
223
+ <InVenuePage
224
+ pathname={location.pathname}
225
+ search={location.search}
226
+ client={zappie}
227
+ inVenue={inVenue}
228
+ customer={customer}
229
+ navigate={(href, { replace } = {}) => navigate(href, { replace })}
230
+ header={<Header />}
231
+ footer={<Footer />}
232
+ renderMenu={() => <Catalogue />}
233
+ />;
234
+ ```
235
+
236
+ Ordering and paying need a signed-in guest. A signed-out guest goes to sign in
237
+ and comes back to the same page, with the table's bag kept on the device, and
238
+ the order goes on as soon as they're back. Paying sends the guest to Zappie's
239
+ payment page with `return` set to the bill. Self-service and collect-payment
240
+ tables aren't served on storefronts. Scanning one says the table can't be used
241
+ on this site and sends the guest to staff.
242
+
163
243
  ### Place routes
164
244
 
165
245
  `places.place(placeId, { branchId })` returns `route` with optional
@@ -1,6 +1,6 @@
1
1
  import { Zappie } from '../index.js';
2
2
  import { Item } from '../index.js';
3
- import '../types-DMMeyB5d.js';
3
+ import '../types-ooHA0lwH.js';
4
4
 
5
5
  /** Register an item already read by a partial/selected catalogue, without fetching it again. */
6
6
  declare function prepareItem(client: Zappie, item: Item, options: {
@@ -1,5 +1,5 @@
1
1
  import { a as Menu, C as CategoryPage, S as Store, I as Item, M as Money, F as Formatters } from './models-asoc6fS3.js';
2
- import { Q as QuoteRequest, h as WireQuote, e as CartIssueCode, d as CartModule, b as CartLineInput } from './types-DMMeyB5d.js';
2
+ import { Q as QuoteRequest, h as WireQuote, e as CartIssueCode, d as CartModule, b as CartLineInput } from './types-ooHA0lwH.js';
3
3
 
4
4
  /** Stable public error codes. */
5
5
  type ZappieErrorCode = "network_error" | "timeout" | "rate_limited" | "unauthorized" | "forbidden" | "forbidden_origin" | "scope_required" | "not_found" | "store_not_found" | "branch_not_found" | "item_not_found" | "cart_invalid" | "invalid_request" | "version_unsupported" | "server_error";
@@ -1,6 +1,7 @@
1
1
  // src/customer/client.ts
2
2
  import { createPendingNavigation } from "@zappie/sdk/navigation";
3
3
  import { requestWithRetry } from "../internal/customer-http.js";
4
+ import { orderReceipt } from "@zappie/sdk/receipts";
4
5
  import {
5
6
  forgetBagAddresses,
6
7
  forgetRememberedAddress,
@@ -59,7 +60,7 @@ function createCustomer(options = {}) {
59
60
  const response = await requestWithRetry(
60
61
  fetcher,
61
62
  sessionPath,
62
- { method: "GET", cache: "no-store" },
63
+ { cache: "no-store" },
63
64
  "Could not check the customer session"
64
65
  );
65
66
  const body = await readCustomerResponse(response, "session");
@@ -124,12 +125,9 @@ function createCustomer(options = {}) {
124
125
  },
125
126
  // Every read is a GET, fetch's default.
126
127
  profile: () => request("/me"),
127
- async addresses() {
128
- const result = await request(
129
- "/me/addresses"
130
- );
131
- return result.addresses;
132
- },
128
+ addresses: () => request("/me/addresses").then(
129
+ (result) => result.addresses
130
+ ),
133
131
  addAddress: (body) => request("/me/addresses", {
134
132
  method: "POST",
135
133
  headers: { "Content-Type": "application/json" },
@@ -147,7 +145,9 @@ function createCustomer(options = {}) {
147
145
  }
148
146
  return request(`/me/orders${query.size ? `?${query}` : ""}`);
149
147
  },
150
- order: (id) => readOrder(id),
148
+ order: readOrder,
149
+ /** The order's receipt as a PDF File, named as the API names it. Needs the orders:read scope. */
150
+ receipt: (id) => orderReceipt(base, id, fetcher),
151
151
  watchOrder(id, watchOptions) {
152
152
  return watchOrder(base, id, readOrder, watchOptions);
153
153
  }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../src/customer/client.ts"],
4
- "mappings": ";AAEA,SAAS,+BAA+B;AACxC,SAAS,wBAAwB;AACjC;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,aAAa,SAAS,oBAAoB;AACnD,SAAS,uBAAuB,4BAA4B;AAa5D,SAAS,kBAAkB;AAE3B,IAAM,wBAAwB;AAC9B,IAAM,uBAAuB;AAE7B,SAAS,KACP,MACA,OACS;AACT,SACE,MAAM,OAAO,OAAO,MACpB,MAAM,eAAe,OAAO,cAC5B,MAAM,iBAAiB,OAAO;AAElC;AASO,SAAS,eAAe,UAAiC,CAAC,GAAG;AAClE,QAAM,QAAQ,QAAQ,gBAAgB,uBAAuB;AAAA,IAC3D;AAAA,IACA;AAAA,EACF;AACA,QAAM,cAAc,QAAQ,eAAe;AAC3C,QAAM,UAAU,QAAQ,SAAS,WAAW;AAC5C,MAAI,WAAW,QAAQ,mBAAmB;AAC1C,MAAI,QACF,QAAQ,oBAAoB,SACxB,YACA,WACE,kBACA;AAGR,QAAM,SAAS,MAAM;AACnB,QAAI,UAAU,WAAW;AACvB,oBAAc,UAAU,MAAM,IAAI;AAAA,IACpC;AAAA,EACF;AACA,SAAO;AACP,QAAM,YAAY,oBAAI,IAAsB;AAC5C,QAAM,SAAS,MAAM;AACnB,eAAW,YAAY,WAAW;AAChC,eAAS,OAAO,QAAQ;AAAA,IAC1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OAAO;AAAA;AAAA,IAEP,SAAS,CAAC,OAAe,aAAa,MAAM,IAAI,OAAO;AAAA,IACvD,WAAW,IAAY,cAAiC;AACtD,aAAO,WAAW,MAAM,IAAI,WAAW,YAAY;AAAA,IACrD;AAAA,EACF;AACF;",
5
5
  "names": ["options"]
6
6
  }
@@ -151,14 +151,16 @@ declare function createCustomer(options?: CustomerClientOptions): {
151
151
  /** Sign out through Zappie hosting, forgetting the delivery address remembered on this device and the one in each saved bag, whose items stay. A call while pending does nothing. */
152
152
  signOut(): void;
153
153
  profile: () => Promise<CustomerProfile>;
154
- addresses(): Promise<SavedAddress[]>;
154
+ addresses: () => Promise<SavedAddress[]>;
155
155
  addAddress: (body: CreateAddress) => Promise<SavedAddress>;
156
156
  removeAddress: (id: string) => Promise<void>;
157
157
  orders(options?: {
158
158
  cursor?: string;
159
159
  limit?: number;
160
160
  }): Promise<OrdersPage>;
161
- order: (id: string) => Promise<CustomerOrder>;
161
+ order: (id: string, signal?: AbortSignal) => Promise<CustomerOrder>;
162
+ /** The order's receipt as a PDF File, named as the API names it. Needs the orders:read scope. */
163
+ receipt: (id: string) => Promise<File>;
162
164
  watchOrder(id: string, watchOptions: WatchOrderOptions): () => void;
163
165
  };
164
166
  /**
package/dist/debug.js CHANGED
@@ -1,5 +1,5 @@
1
1
  // src/debug.ts
2
- var VERSION = true ? "0.10.10" : "0.0.0-development";
2
+ var VERSION = true ? "0.11.1" : "0.0.0-development";
3
3
  function installDebug(client) {
4
4
  if (typeof window === "undefined" || client.mode !== "test") {
5
5
  return;
package/dist/debug.js.map CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../src/debug.ts"],
4
- "mappings": ";AAOA,IAAM,UACJ,OACI,YACA;AAoCC,SAAS,aAAa,QAAgB;AAC3C,MAAI,OAAO,WAAW,eAAe,OAAO,SAAS,QAAQ;AAC3D;AAAA,EACF;AACA,QAAM,SAAuB,CAAC;AAC9B,MAAI;AACJ,QAA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B,UAAS,oBAAI,KAAK,GAAE,YAAY;AAAA,UAClC,EAAE;AAAA,QACJ;AACA,cAAM,QAAQ,OAAO,OAAO,MAAM;AAClC,SAAC,OAAO,OAAO,WAAW,OAAO,cAAc;AAAA,UAC7C,kBAAkB,OAAO,OAAO,KAAK,IAAI,SAAS,QAAQ,GAAG,QAAQ,IAAI,KAAK,KAAK,EAAE;AAAA,UACrF,KAAK,UAAU,KAAK;AAAA,QACtB;AAAA,MACF;AAAA,IACF,CAAC;AAAA,IACD,OAAO,MAAM;AAAA,IACb;AAAA,EACF;AACA,SAAO,GAAG,eAAe,CAAC,WAAW,KAAK,eAAe,MAAM,CAAC;AAChE,SAAO,KAAK,UAAU,MAAM;AAC1B,UAAM,QAAQ,OAAO,KAAK;AAC1B,UAAM,OAAO,WAAW,QAAQ,MAAM,QAAQ;AAC9C,QAAI,QAAQ,SAAS,OAAO;AAC1B,cAAQ;AACR,WAAK,SAAS,IAAI;AAAA,IACpB;AAAA,EACF,CAAC;AACH;",
5
5
  "names": []
6
6
  }
@@ -0,0 +1,11 @@
1
+ // src/error-pages/art.ts
2
+ 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>';
3
+ var ZEE = {
4
+ "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>',
5
+ "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>'
6
+ };
7
+ export {
8
+ LOGO,
9
+ ZEE
10
+ };
11
+ //# sourceMappingURL=art.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/error-pages/art.ts"],
4
+ "mappings": ";AAIO,IAAM,OACX;AAGK,IAAM,MAAM;AAAA,EACjB,aACE;AAAA,EACF,cACE;AACJ;",
5
+ "names": []
6
+ }
@@ -0,0 +1,58 @@
1
+ /**
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`.
5
+ */
6
+ type PlatformErrorKind = "not-found" | "went-wrong";
7
+ /** Where the page's links lead. */
8
+ type PlatformErrorOptions = {
9
+ /** The storefront's home page. Default `/`. */
10
+ home?: string;
11
+ };
12
+ /** One of the page's links. An empty `href` reloads the address the guest is on. */
13
+ type PlatformErrorAction = {
14
+ label: string;
15
+ href: string;
16
+ primary: boolean;
17
+ };
18
+ /** Everything the page shows, for drawing it as HTML or in React. */
19
+ type PlatformErrorParts = {
20
+ kind: PlatformErrorKind;
21
+ title: string;
22
+ text: string;
23
+ /** The Zappie lockup as image sources, for light and dark pages. */
24
+ logo: {
25
+ light: string;
26
+ dark: string;
27
+ };
28
+ /** Zee as an image source: surprised for a missing page, sad for a failed one. */
29
+ zee: string;
30
+ actions: PlatformErrorAction[];
31
+ };
32
+ /** The HTTP status each page answers with. */
33
+ declare function platformErrorStatus(kind: PlatformErrorKind): number;
34
+ /**
35
+ * Pick the page for something a route threw. A 404 or 410 response is `not-found`. Anything else is `went-wrong`.
36
+ */
37
+ declare function platformErrorKind(error: unknown): PlatformErrorKind;
38
+ /** The words, artwork and links of the page for `kind`. */
39
+ declare function platformErrorParts(kind: PlatformErrorKind, { home }?: PlatformErrorOptions): PlatformErrorParts;
40
+ /** The page's stylesheet. */
41
+ declare const PLATFORM_ERROR_STYLES: string;
42
+ /** The Geist stylesheet the page's type comes from. */
43
+ declare const PLATFORM_ERROR_FONTS = "https://fonts.googleapis.com/css2?family=Geist:wght@400;600&display=swap";
44
+ /** The page's `<main>` element as HTML. `PlatformErrorPage` from `@zappie/sdk/error-pages/react` draws the same. */
45
+ declare function platformErrorMarkup(kind: PlatformErrorKind, options?: PlatformErrorOptions): string;
46
+ /** A complete HTML document for the page, for a server or Worker answering without the site's own code. */
47
+ declare function platformErrorDocument(kind: PlatformErrorKind, options?: PlatformErrorOptions): string;
48
+ /**
49
+ * Swap a missing or failed HTML page for Zappie's page, keeping its status and headers. A 404 or 410 becomes
50
+ * `not-found` and a 5xx becomes `went-wrong`. Anything else, and every response that isn't HTML, such as a data
51
+ * request, a sitemap or an image, passes through unchanged. Wrap the response a site's Worker returns with it.
52
+ */
53
+ declare function withPlatformErrorPage(response: Response, options?: PlatformErrorOptions): Response;
54
+ /** The page as a Response with its status, for a site's Worker to return when its own rendering fails. */
55
+ declare function platformErrorResponse(kind: PlatformErrorKind, options?: PlatformErrorOptions): Response;
56
+
57
+ export { PLATFORM_ERROR_FONTS, PLATFORM_ERROR_STYLES, platformErrorDocument, platformErrorKind, platformErrorMarkup, platformErrorParts, platformErrorResponse, platformErrorStatus, withPlatformErrorPage };
58
+ export type { PlatformErrorAction, PlatformErrorKind, PlatformErrorOptions, PlatformErrorParts };
@@ -0,0 +1,122 @@
1
+ // src/error-pages/index.ts
2
+ import { LOGO, ZEE } from "./art.js";
3
+ var STATUS = {
4
+ "not-found": 404,
5
+ "went-wrong": 500
6
+ };
7
+ var COPY = {
8
+ "not-found": {
9
+ title: "We couldn't find that page",
10
+ text: "The link or code you followed may be out of date, or the page may have moved."
11
+ },
12
+ "went-wrong": {
13
+ title: "Something went wrong",
14
+ text: "This page didn't load. Try again, or go to the home page."
15
+ }
16
+ };
17
+ function platformErrorStatus(kind) {
18
+ return STATUS[kind];
19
+ }
20
+ function platformErrorKind(error) {
21
+ const status = typeof error === "object" && error !== null && "status" in error ? error.status : void 0;
22
+ return status === 404 || status === 410 ? "not-found" : "went-wrong";
23
+ }
24
+ var image = (svg) => `data:image/svg+xml,${svg.replace(/["#%<> ]/g, (character) => character === '"' ? "'" : encodeURIComponent(character))}`;
25
+ function platformErrorParts(kind, { home = "/" } = {}) {
26
+ const homeAction = (primary) => ({
27
+ label: "Go to the home page",
28
+ href: home,
29
+ primary
30
+ });
31
+ return {
32
+ kind,
33
+ ...COPY[kind],
34
+ logo: {
35
+ light: image(LOGO.replaceAll("{word}", "#121A0E")),
36
+ dark: image(LOGO.replaceAll("{word}", "#F1F1F1"))
37
+ },
38
+ zee: image(ZEE[kind]),
39
+ actions: kind === "went-wrong" ? [{ label: "Try again", href: "", primary: true }, homeAction(false)] : [homeAction(true)]
40
+ };
41
+ }
42
+ 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}
43
+ @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}}
44
+ .zpe .zpe-brand{display:flex;justify-content:center}
45
+ .zpe .zpe-brand img{display:block;width:118px;height:24px}
46
+ .zpe .zpe-center{display:grid;place-items:center;min-width:0}
47
+ .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}
48
+ .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}
49
+ .zpe[data-kind=went-wrong] .zpe-zee{animation-duration:6s}
50
+ .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}
51
+ .zpe .zpe-text{margin:0;padding:0;max-width:52ch;color:var(--zpe-fg2);font:inherit;text-wrap:pretty}
52
+ .zpe .zpe-actions{display:flex;flex-wrap:wrap;justify-content:center;gap:8px;margin-top:4px}
53
+ .zpe .zpe-button{box-sizing:border-box;display:inline-flex;align-items:center;justify-content:center;min-height:44px;margin:0;padding:0 18px;border:1px solid var(--zpe-edge);border-radius:8px;background:var(--zpe-surface);color:var(--zpe-fg);font:inherit;font-weight:600;text-decoration:none;cursor:pointer;transition:background-color .12s cubic-bezier(.2,0,0,1)}
54
+ .zpe .zpe-button:hover{background:var(--zpe-hover)}
55
+ .zpe .zpe-button:focus-visible{outline:none;box-shadow:0 0 0 3px rgba(159,232,112,.55)}
56
+ .zpe .zpe-primary{border-color:rgba(18,26,14,.08);background:#9FE870;color:#121A0E}
57
+ .zpe .zpe-primary:hover{background:#8EE05C}
58
+ @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%}}
59
+ @media (prefers-reduced-motion:reduce){.zpe .zpe-body,.zpe .zpe-zee{animation:none}}
60
+ @keyframes zpe-enter{from{opacity:0;transform:translateY(8px)}to{opacity:1;transform:none}}
61
+ @keyframes zpe-float{0%,100%{transform:translateY(0)}50%{transform:translateY(-3px)}}`;
62
+ var PLATFORM_ERROR_FONTS = "https://fonts.googleapis.com/css2?family=Geist:wght@400;600&display=swap";
63
+ var escape = (text) => text.replace(
64
+ /[&<>"']/g,
65
+ (character) => ({
66
+ "&": "&amp;",
67
+ "<": "&lt;",
68
+ ">": "&gt;",
69
+ '"': "&quot;",
70
+ "'": "&#39;"
71
+ })[character] ?? character
72
+ );
73
+ function platformErrorMarkup(kind, options = {}) {
74
+ const parts = platformErrorParts(kind, options);
75
+ const actions = parts.actions.map(
76
+ (action) => `<a class="zpe-button${action.primary ? " zpe-primary" : ""}" href="${escape(action.href)}">${escape(action.label)}</a>`
77
+ ).join("");
78
+ 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>`;
79
+ }
80
+ function platformErrorDocument(kind, options = {}) {
81
+ 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>`;
82
+ }
83
+ function withPlatformErrorPage(response, options = {}) {
84
+ const status = response.status;
85
+ const kind = status === 404 || status === 410 ? "not-found" : status >= 500 ? "went-wrong" : void 0;
86
+ if (!kind || !/^text\/html/i.test(response.headers.get("content-type") ?? "")) {
87
+ return response;
88
+ }
89
+ response.body?.cancel().catch(() => void 0);
90
+ const headers = new Headers(response.headers);
91
+ for (const name of ["content-length", "content-encoding", "etag"]) {
92
+ headers.delete(name);
93
+ }
94
+ headers.set("content-type", "text/html; charset=utf-8");
95
+ headers.set("cache-control", "no-store");
96
+ return new Response(platformErrorDocument(kind, options), {
97
+ status,
98
+ statusText: response.statusText,
99
+ headers
100
+ });
101
+ }
102
+ function platformErrorResponse(kind, options = {}) {
103
+ return new Response(platformErrorDocument(kind, options), {
104
+ status: STATUS[kind],
105
+ headers: {
106
+ "content-type": "text/html; charset=utf-8",
107
+ "cache-control": "no-store"
108
+ }
109
+ });
110
+ }
111
+ export {
112
+ PLATFORM_ERROR_FONTS,
113
+ PLATFORM_ERROR_STYLES,
114
+ platformErrorDocument,
115
+ platformErrorKind,
116
+ platformErrorMarkup,
117
+ platformErrorParts,
118
+ platformErrorResponse,
119
+ platformErrorStatus,
120
+ withPlatformErrorPage
121
+ };
122
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 3,
3
+ "sources": ["../../src/error-pages/index.ts"],
4
+ "mappings": ";AAAA,SAAS,MAAM,WAAW;AAkC1B,IAAM,SAA4C;AAAA,EAChD,aAAa;AAAA,EACb,cAAc;AAChB;AAEA,IAAM,OAAmE;AAAA,EACvE,aAAa;AAAA,IACX,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,cAAc;AAAA,IACZ,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AACF;AAGO,SAAS,oBAAoB,MAAiC;AACnE,SAAO,OAAO,IAAI;AACpB;AAKO,SAAS,kBAAkB,OAAmC;AACnE,QAAM,SACJ,OAAO,UAAU,YAAY,UAAU,QAAQ,YAAY,QACvD,MAAM,SACN;AACN,SAAO,WAAW,OAAO,WAAW,MAAM,cAAc;AAC1D;AAGA,IAAM,QAAQ,CAAC,QACb,sBAAsB,IAAI,QAAQ,aAAa,CAAC,cAAe,cAAc,MAAM,MAAM,mBAAmB,SAAS,CAAE,CAAC;AAGnH,SAAS,mBACd,MACA,EAAE,OAAO,IAAI,IAA0B,CAAC,GACpB;AACpB,QAAM,aAAa,CAAC,aAAsB;AAAA,IACxC,OAAO;AAAA,IACP,MAAM;AAAA,IACN;AAAA,EACF;AACA,SAAO;AAAA,IACL;AAAA,IACA,GAAG,KAAK,IAAI;AAAA,IACZ,MAAM;AAAA,MACJ,OAAO,MAAM,KAAK,WAAW,UAAU,SAAS,CA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,sBACd,UACA,UAAgC,CAAC,GACvB;AACV,QAAM,SAAS,SAAS;AACxB,QAAM,OACJ,WAAW,OAAO,WAAW,MACzB,cACA,UAAU,MACR,eACA;AACR,MACE,CAAC,QACD,CAAC,eAAe,KAAK,SAAS,QAAQ,IAAI,cAAc,KAAK,EAAE,GAC/D;AACA,WAAO;AAAA,EACT;AACA,WAAS,MAAM,OAAO,EAAE,MAAM,MAAM,MAAS;AAC7C,QAAM,UAAU,IAAI,QAAQ,SAAS,OAAO;AAC5C,aAAW,QAAQ,CAAC,kBAAkB,oBAAoB,MAAM,GAAG;AACjE,YAAQ,OAAO,IAAI;AAAA,EACrB;AACA,UAAQ,IAAI,gBAAgB,0BAA0B;AACtD,UAAQ,IAAI,iBAAiB,UAAU;AACvC,SAAO,IAAI,SAAS,sBAAsB,MAAM,OAAO,GAAG;AAAA,IACxD;AAAA,IACA,YAAY,SAAS;AAAA,IACrB;AAAA,EACF,CAAC;AACH;AAGO,SAAS,sBACd,MACA,UAAgC,CAAC,GACvB;AACV,SAAO,IAAI,SAAS,sBAAsB,MAAM,OAAO,GAAG;AAAA,IACxD,QAAQ,OAAO,IAAI;AAAA,IACnB,SAAS;AAAA,MACP,gBAAgB;AAAA,MAChB,iBAAiB;AAAA,IACnB;AAAA,EACF,CAAC;AACH;",
5
+ "names": []
6
+ }
@@ -0,0 +1,20 @@
1
+ import * as react from 'react';
2
+ import { PlatformErrorOptions, PlatformErrorKind } from '@zappie/sdk/error-pages';
3
+ export { PlatformErrorKind, PlatformErrorOptions, platformErrorKind } from '@zappie/sdk/error-pages';
4
+
5
+ /** Props for `PlatformErrorPage`. */
6
+ type PlatformErrorPageProps = PlatformErrorOptions & {
7
+ /** The page to show. Leave it out to choose from `error`. */
8
+ kind?: PlatformErrorKind;
9
+ /** What the route threw. A 404 or 410 shows `not-found`, anything else `went-wrong`. */
10
+ error?: unknown;
11
+ };
12
+ /**
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.
16
+ */
17
+ declare function PlatformErrorPage({ kind, error, home, }: PlatformErrorPageProps): react.JSX.Element;
18
+
19
+ export { PlatformErrorPage };
20
+ export type { PlatformErrorPageProps };
@@ -0,0 +1,66 @@
1
+ // src/error-pages/react.tsx
2
+ import {
3
+ PLATFORM_ERROR_FONTS,
4
+ PLATFORM_ERROR_STYLES,
5
+ platformErrorKind,
6
+ platformErrorParts
7
+ } from "@zappie/sdk/error-pages";
8
+ import { Fragment } from "react";
9
+ import {
10
+ platformErrorKind as platformErrorKind2
11
+ } from "@zappie/sdk/error-pages";
12
+ import { jsx, jsxs } from "react/jsx-runtime";
13
+ function PlatformErrorPage({
14
+ kind,
15
+ error,
16
+ home
17
+ }) {
18
+ const parts = platformErrorParts(
19
+ kind ?? platformErrorKind(error),
20
+ home === void 0 ? {} : { home }
21
+ );
22
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
23
+ /* @__PURE__ */ jsx("link", { rel: "stylesheet", href: PLATFORM_ERROR_FONTS }),
24
+ /* @__PURE__ */ jsx("style", { children: PLATFORM_ERROR_STYLES }),
25
+ /* @__PURE__ */ jsxs("main", { className: "zpe", "data-kind": parts.kind, children: [
26
+ /* @__PURE__ */ jsx("div", { className: "zpe-brand", children: /* @__PURE__ */ jsxs("picture", { children: [
27
+ /* @__PURE__ */ jsx(
28
+ "source",
29
+ {
30
+ srcSet: parts.logo.dark,
31
+ media: "(prefers-color-scheme: dark)"
32
+ }
33
+ ),
34
+ /* @__PURE__ */ jsx("img", { src: parts.logo.light, alt: "Zappie", width: "118", height: "24" })
35
+ ] }) }),
36
+ /* @__PURE__ */ jsx("div", { className: "zpe-center", children: /* @__PURE__ */ jsxs("div", { className: "zpe-body", children: [
37
+ /* @__PURE__ */ jsx(
38
+ "img",
39
+ {
40
+ className: "zpe-zee",
41
+ src: parts.zee,
42
+ alt: "",
43
+ width: "112",
44
+ height: "120"
45
+ }
46
+ ),
47
+ /* @__PURE__ */ jsx("h1", { className: "zpe-title", children: parts.title }),
48
+ /* @__PURE__ */ jsx("p", { className: "zpe-text", children: parts.text }),
49
+ /* @__PURE__ */ jsx("div", { className: "zpe-actions", children: parts.actions.map((action) => /* @__PURE__ */ jsx(
50
+ "a",
51
+ {
52
+ className: action.primary ? "zpe-button zpe-primary" : "zpe-button",
53
+ href: action.href,
54
+ children: action.label
55
+ },
56
+ action.label
57
+ )) })
58
+ ] }) })
59
+ ] })
60
+ ] });
61
+ }
62
+ export {
63
+ PlatformErrorPage,
64
+ platformErrorKind2 as platformErrorKind
65
+ };
66
+ //# sourceMappingURL=react.js.map