@misebako/ui 0.3.2 → 0.4.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.
Files changed (41) hide show
  1. package/README.md +13 -4
  2. package/dist/checkout/cart.d.ts +85 -0
  3. package/dist/checkout/cart.js +42 -0
  4. package/dist/checkout/cart.js.map +1 -0
  5. package/dist/checkout/payment-unlock.d.ts +52 -0
  6. package/dist/checkout/payment-unlock.js +25 -0
  7. package/dist/checkout/payment-unlock.js.map +1 -0
  8. package/dist/checkout/unlock-intent.d.ts +15 -0
  9. package/dist/checkout/unlock-intent.js +68 -0
  10. package/dist/checkout/unlock-intent.js.map +1 -0
  11. package/dist/index.d.ts +11 -1
  12. package/dist/index.js +11 -1
  13. package/dist/index.js.map +1 -1
  14. package/dist/layout/store-chrome.d.ts +54 -0
  15. package/dist/layout/store-chrome.js +32 -0
  16. package/dist/layout/store-chrome.js.map +1 -0
  17. package/dist/orders/order-table.d.ts +31 -0
  18. package/dist/orders/order-table.js +7 -0
  19. package/dist/orders/order-table.js.map +1 -0
  20. package/dist/orders/pending-checkout-table.d.ts +24 -0
  21. package/dist/orders/pending-checkout-table.js +11 -0
  22. package/dist/orders/pending-checkout-table.js.map +1 -0
  23. package/dist/primitives/email-code-sign-in.d.ts +87 -0
  24. package/dist/primitives/email-code-sign-in.js +166 -0
  25. package/dist/primitives/email-code-sign-in.js.map +1 -0
  26. package/dist/primitives/status-page.d.ts +12 -0
  27. package/dist/primitives/status-page.js +9 -0
  28. package/dist/primitives/status-page.js.map +1 -0
  29. package/dist/storefront/catalog.d.ts +125 -0
  30. package/dist/storefront/catalog.js +55 -0
  31. package/dist/storefront/catalog.js.map +1 -0
  32. package/dist/storefront/delivery-note.d.ts +9 -0
  33. package/dist/storefront/delivery-note.js +10 -0
  34. package/dist/storefront/delivery-note.js.map +1 -0
  35. package/dist/storefront/home-hero.js +1 -1
  36. package/dist/storefront/home-hero.js.map +1 -1
  37. package/dist/styles.css +210 -0
  38. package/dist/theme/index.d.ts +12 -4
  39. package/dist/theme/index.js +38 -6
  40. package/dist/theme/index.js.map +1 -1
  41. package/package.json +41 -1
package/README.md CHANGED
@@ -22,10 +22,10 @@ import '@mantine/core/styles.css'
22
22
  import '@misebako/ui/styles.css'
23
23
 
24
24
  import { AppearanceProvider } from '@misebako/ui/appearance-provider'
25
- import { norenTheme } from '@misebako/ui/theme'
25
+ import { misebakoTheme } from '@misebako/ui/theme'
26
26
 
27
27
  export function App({ children }: { children: React.ReactNode }) {
28
- return <AppearanceProvider theme={norenTheme}>{children}</AppearanceProvider>
28
+ return <AppearanceProvider theme={misebakoTheme}>{children}</AppearanceProvider>
29
29
  }
30
30
  ```
31
31
 
@@ -38,22 +38,31 @@ Import individual subpaths to avoid pulling unused client modules, or import fro
38
38
  | Entry Point | Exports & Purpose |
39
39
  | --- | --- |
40
40
  | `@misebako/ui` | Root barrel re-exporting all components, hooks, and theme presets. |
41
- | `@misebako/ui/styles.css` | Accessible light/dark contrast tokens, mobile `16px` input zoom guard, `tabular-nums`, font smoothing, hero layout styles, and `.misebako-media` image outlines. |
42
- | `@misebako/ui/theme` | High-contrast palettes and Mantine theme presets (`misebakoColors`, `createMisebakoTheme`, `misebakoTheme`, `norenTheme`). |
41
+ | `@misebako/ui/styles.css` | Accessible light/dark contrast tokens, mobile `16px` input zoom guard, `tabular-nums`, font smoothing, hero layout styles, shared dialog chrome (`.misebako-modal-*`), loading-button spinners, and `.misebako-media` image outlines. |
42
+ | `@misebako/ui/theme` | High-contrast palettes, shared dialog/tooltip defaults (`misebakoComponents`), and the Mantine theme preset used by both Misebako and Noren (`createMisebakoTheme`, `misebakoTheme`; `norenTheme` is an alias kept for existing imports). |
43
43
  | `@misebako/ui/rich-text` | Safe ProseMirror/TipTap JSON renderer (`RichContent`, `isSafeHref`) usable in both Server and Client Components. |
44
44
  | `@misebako/ui/otp-input` | Accessible 6-digit `OtpCodeInput` with clipboard paste, `one-time-code` autofill, and keyboard navigation (`'use client'`). |
45
+ | `@misebako/ui/email-code-sign-in` | Compact email-code sign-in (`EmailCodeSignIn`) for dialogs and cards: email, 6-digit code, optional passkey or account creation. Stronger credentials (password, authenticator) are handed to the full sign-in page through `onRedirect` (`'use client'`). |
46
+ | `@misebako/ui/payment-unlock` | `LockedPaymentMethodCard` (a payment method that needs sign-in or a verified phone, shown as a button that starts the fix) and `UnlockMethodDialog` (explains the lock, hosts the unlock step and offers available methods) (`'use client'`). |
47
+ | `@misebako/ui/unlock-intent` | Remembers the payment method a buyer was unlocking across a sign-in round trip (`rememberUnlockMethod`, `readUnlockMethod`, `consumeUnlockMethod`, `clearUnlockMethod`), in session storage, expiring after 30 minutes. |
45
48
  | `@misebako/ui/phone-verify-modal` | In-site phone binding and two-step rebinding modal (`PhoneVerifyModal`) with international calling codes and Bot Check integration (`'use client'`). |
46
49
  | `@misebako/ui/bot-check` | Multi-provider human verification hook and widgets (`useBotCheck`, `TurnstileWidget`, `HCaptchaWidget`, `RecaptchaWidget`, `BotCheckError`) (`'use client'`). |
47
50
  | `@misebako/ui/appearance-menu` | Color-scheme switcher (`AppearanceMenu`: `auto` / `light` / `dark`). Changes the provider preference without writing a cookie (`'use client'`). |
48
51
  | `@misebako/ui/appearance-provider` | `AppearanceProvider` persists the preference in browser local storage and synchronizes it across tabs. System appearance changes never overwrite the selected preference (`'use client'`). |
49
52
  | `@misebako/ui/navigation-progress` | Theme-aware top bar for slow navigations. Mount `NavigationProgress` once with a localized accessible `label` and committed `routeKey` (pathname plus serialized query, without hash). Re-export `startNavigationProgress` as `onRouterTransitionStart` from the host's `instrumentation-client.ts`. Same-origin document navigations are also observed where the browser supports the Navigation API; there, the router's history write on commit also clears the bar, so a navigation that ends on the current URL (such as a redirect back) does not leave it running. |
50
53
  | `@misebako/ui/region-menu` | Searchable language and display-currency picker (`RegionMenu`, `RegionMark`) (`'use client'`). |
54
+ | `@misebako/ui/store-chrome` | Storefront chrome: `StoreHeader` (store name, nav and tools, nav wraps on phones), `StoreFooter`, `StoreNotice`, `SkipLink`, and `navCurrent` for `aria-current`. Server-renderable; pass the framework link as `LinkComponent`. |
51
55
  | `@misebako/ui/product-gallery` | Product cover and multi-image gallery with broken-image placeholder fallback (`ProductCover`, `ProductGallery`) (`'use client'`). |
56
+ | `@misebako/ui/delivery-note` | `DeliveryNote`: one line with an icon telling the buyer how an item is delivered (`instant`, `manual`, `supplier`, `backorder`). |
57
+ | `@misebako/ui/catalog` | Catalog building blocks: `ProductCard`, `ProductCardGrid`, `ProductCardPrice` (reserves the reference line so prices align), `StockBadge`, `CatalogLayout`, `CategorySidebar`, `CatalogHeader`, `CatalogSearchInput`, `FeaturedSection`, `HelpArticleCards`, and `EmptyStatePanel`. Server-renderable. |
52
58
  | `@misebako/ui/home-hero` | Responsive storefront hero with highlights, category shortcuts, and search form (`HomeHero`) (`'use client'`). |
53
59
  | `@misebako/ui/quote-fields` | Dynamic fulfillment parameter inputs (`QuoteFormFields`) driven by `@misebako/sdk/schemas` (`'use client'`). |
54
60
  | `@misebako/ui/checkout-amounts` | Order/cart pricing breakdown with promo savings and display FX conversion (`CheckoutAmounts`, `QuoteSummaryCard`) (`'use client'`). |
61
+ | `@misebako/ui/cart` | Cart page layout and controls: `CartLayout`, `CartItemList`, `CartLine`, `CartRemoveButton` (asks before removing configured items), `CartUndoNotice`, `CartSummary`, and `PromoCodeInput`. The app keeps cart state and pricing. Server-renderable. |
55
62
  | `@misebako/ui/delivery-codes` | Delivered redeem-code / voucher viewer with one-click copy feedback (`DeliveryCodeList`) (`'use client'`). |
63
+ | `@misebako/ui/order-table` | Order list table (`OrderTable`) with an accessible name; amount and status fold under the title on phones. Server-renderable. |
56
64
  | `@misebako/ui/order-status` | Order status badge color mapping, paused-order credential submission, and action confirmation modals (`orderStateColor`, `isAwaitingInput`, `NeedsInputForm`, `OrderActionConfirm`) (`'use client'`). |
65
+ | `@misebako/ui/status-page` | Not-found and error page message (`StatusPage`) with the title as the page `h1`. Server-renderable. |
57
66
 
58
67
  ## Design Principles
59
68
 
@@ -0,0 +1,85 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StoreLinkComponent } from '../primitives/link.js';
3
+ import { type ProductGalleryImage } from '../storefront/product-gallery.js';
4
+ export interface CartLayoutProps {
5
+ LinkComponent?: StoreLinkComponent;
6
+ /** Accessible name for the list of items. */
7
+ itemsLabel: string;
8
+ /** Usually a `CartItemList`. */
9
+ items: ReactNode;
10
+ browseHref?: string;
11
+ browseLabel: string;
12
+ /** Usually a `CartSummary`. */
13
+ summary: ReactNode;
14
+ }
15
+ /** Items on the left, a sticky summary on the right; stacked on phones. */
16
+ export declare function CartLayout({ LinkComponent, itemsLabel, items, browseHref, browseLabel, summary }: CartLayoutProps): import("react").JSX.Element;
17
+ export interface CartItemListProps {
18
+ /** Usually a "Select All" checkbox; a divider follows it. */
19
+ header?: ReactNode;
20
+ /** `CartLine` items. */
21
+ children: ReactNode;
22
+ }
23
+ export declare function CartItemList({ header, children }: CartItemListProps): import("react").JSX.Element;
24
+ export interface CartLineProps {
25
+ /** Position in the list; lines after the first get a divider. */
26
+ index: number;
27
+ /** Usually a selection checkbox. */
28
+ select?: ReactNode;
29
+ image?: ProductGalleryImage;
30
+ placeholderSrc?: string;
31
+ /** Product name, usually a link to the product. */
32
+ title: ReactNode;
33
+ /** Line total, shown beside the title (under it on phones). */
34
+ price?: ReactNode;
35
+ /** Status lines, quote details and the quantity and remove controls. */
36
+ children?: ReactNode;
37
+ }
38
+ export declare function CartLine({ index, select, image, placeholderSrc, title, price, children }: CartLineProps): import("react").JSX.Element;
39
+ export interface CartRemoveButtonProps {
40
+ /** Accessible name, such as "Remove: Product Name". */
41
+ label: string;
42
+ onRemove: () => void;
43
+ disabled?: boolean;
44
+ /** Ask before removing (for configured items that cannot be restored). Render with `confirming` to show the choice. */
45
+ confirm?: {
46
+ confirming: boolean;
47
+ onCancel: () => void;
48
+ cancelLabel: string;
49
+ removeLabel: string;
50
+ onConfirm: () => void;
51
+ loading?: boolean;
52
+ };
53
+ }
54
+ /** Trash button; configured items swap it for a Cancel / Remove pair before removing. */
55
+ export declare function CartRemoveButton({ label, onRemove, disabled, confirm }: CartRemoveButtonProps): import("react").JSX.Element;
56
+ export interface CartUndoNoticeProps {
57
+ message: string;
58
+ undoLabel: string;
59
+ onUndo: () => void;
60
+ }
61
+ /** Shown after a line is removed, until the buyer changes something else. */
62
+ export declare function CartUndoNotice({ message, undoLabel, onUndo }: CartUndoNoticeProps): import("react").JSX.Element;
63
+ export interface CartSummaryProps {
64
+ title: string;
65
+ /** Item count beside the title, such as "3 items". */
66
+ count?: string;
67
+ children: ReactNode;
68
+ }
69
+ /** Sticky order summary card. Wrap the children in a form if the checkout button submits. */
70
+ export declare function CartSummary({ title, count, children }: CartSummaryProps): import("react").JSX.Element;
71
+ export interface PromoCodeInputProps {
72
+ label: string;
73
+ value: string;
74
+ onChange: (value: string) => void;
75
+ /** Message for a code that cannot be used. */
76
+ error?: string;
77
+ checking?: boolean;
78
+ checkingLabel: string;
79
+ verified?: boolean;
80
+ verifiedLabel: string;
81
+ placeholder?: string;
82
+ disabled?: boolean;
83
+ }
84
+ /** Promo code field with checking, verified and invalid states, shared by the cart and checkout dialogs. */
85
+ export declare function PromoCodeInput({ label, value, onChange, error, checking, checkingLabel, verified, verifiedLabel, placeholder, disabled }: PromoCodeInputProps): import("react").JSX.Element;
@@ -0,0 +1,42 @@
1
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ActionIcon, Alert, Anchor, Box, Button, Divider, Flex, Grid, GridCol, Group, Paper, Stack, Text, TextInput, Title } from '@mantine/core';
3
+ import { ArrowLeft, Check, CircleAlert, Trash2 } from 'lucide-react';
4
+ import { ProductCover } from '../storefront/product-gallery.js';
5
+ /*
6
+ * Cart page building blocks shared by Misebako and Noren. The apps keep their own cart state, pricing
7
+ * and checkout; these only fix the layout and controls so both carts look and behave alike.
8
+ */
9
+ const linkOrAnchor = (LinkComponent) => (LinkComponent ?? 'a');
10
+ /** Items on the left, a sticky summary on the right; stacked on phones. */
11
+ export function CartLayout({ LinkComponent, itemsLabel, items, browseHref = '/products', browseLabel, summary }) {
12
+ return (_jsxs(Grid, { gap: { base: 'md', sm: 'xl' }, children: [_jsx(GridCol, { span: { base: 12, sm: 7, md: 8 }, children: _jsxs(Stack, { component: "section", "aria-label": itemsLabel, gap: "md", children: [items, _jsx(Anchor, { component: linkOrAnchor(LinkComponent), href: browseHref, size: "sm", w: "fit-content", children: _jsxs(Group, { gap: 6, children: [_jsx(ArrowLeft, { size: 15, "aria-hidden": "true" }), browseLabel] }) })] }) }), _jsx(GridCol, { span: { base: 12, sm: 5, md: 4 }, children: summary })] }));
13
+ }
14
+ export function CartItemList({ header, children }) {
15
+ return (_jsxs(Paper, { withBorder: true, radius: "md", px: { base: 'md', md: 'lg' }, children: [header && _jsxs(_Fragment, { children: [_jsx(Box, { my: "md", children: header }), _jsx(Divider, {})] }), _jsx(Box, { component: "ul", m: 0, p: 0, style: { listStyle: 'none' }, children: children })] }));
16
+ }
17
+ export function CartLine({ index, select, image, placeholderSrc, title, price, children }) {
18
+ return (_jsxs("li", { children: [index > 0 && _jsx(Divider, {}), _jsxs(Group, { py: "md", align: "start", wrap: "nowrap", gap: "sm", children: [select, _jsx(Box, { w: { base: 60, md: 82 }, bdrs: "sm", style: { overflow: 'hidden', flexShrink: 0 }, children: _jsx(ProductCover, { image: image, ratio: 1, placeholderSrc: placeholderSrc }) }), _jsxs(Stack, { flex: 1, miw: 0, gap: "xs", children: [_jsxs(Flex, { gap: { base: 2, xs: 'md' }, justify: "space-between", align: "start", direction: { base: 'column', xs: 'row' }, children: [title, price] }), children] })] })] }));
19
+ }
20
+ /** Trash button; configured items swap it for a Cancel / Remove pair before removing. */
21
+ export function CartRemoveButton({ label, onRemove, disabled, confirm }) {
22
+ if (confirm?.confirming) {
23
+ return (_jsxs(Group, { gap: "xs", children: [_jsx(Button, { type: "button", size: "compact-xs", variant: "default", disabled: disabled || confirm.loading, onClick: confirm.onCancel, children: confirm.cancelLabel }), _jsx(Button, { type: "button", size: "compact-xs", color: "red", loading: confirm.loading, disabled: disabled, onClick: confirm.onConfirm, children: confirm.removeLabel })] }));
24
+ }
25
+ return (_jsx(ActionIcon, { size: "input-sm", variant: "subtle", color: "gray", disabled: disabled, "aria-label": label, onClick: onRemove, children: _jsx(Trash2, { size: 17, "aria-hidden": "true" }) }));
26
+ }
27
+ /** Shown after a line is removed, until the buyer changes something else. */
28
+ export function CartUndoNotice({ message, undoLabel, onUndo }) {
29
+ return (_jsx(Alert, { color: "blue", variant: "light", role: "status", children: _jsxs(Group, { justify: "space-between", align: "center", gap: "sm", wrap: "wrap", children: [_jsx(Text, { size: "sm", children: message }), _jsx(Button, { type: "button", size: "compact-xs", variant: "default", onClick: onUndo, children: undoLabel })] }) }));
30
+ }
31
+ /** Sticky order summary card. Wrap the children in a form if the checkout button submits. */
32
+ export function CartSummary({ title, count, children }) {
33
+ return (_jsx(Paper, { component: "aside", "aria-labelledby": "cart-summary", withBorder: true, radius: "md", p: { base: 'md', md: 'lg' }, pos: { sm: 'sticky' }, top: "var(--mantine-spacing-lg)", children: _jsxs(Stack, { gap: "md", children: [_jsxs(Group, { justify: "space-between", align: "baseline", gap: "xs", children: [_jsx(Title, { order: 2, size: "h3", id: "cart-summary", children: title }), count && _jsx(Text, { size: "sm", c: "dimmed", children: count })] }), children] }) }));
34
+ }
35
+ /** Promo code field with checking, verified and invalid states, shared by the cart and checkout dialogs. */
36
+ export function PromoCodeInput({ label, value, onChange, error, checking, checkingLabel, verified, verifiedLabel, placeholder, disabled }) {
37
+ const filled = value.trim().length > 0;
38
+ const ok = filled && verified && !error;
39
+ return (_jsx(TextInput, { label: label, placeholder: placeholder, maxLength: 48, autoComplete: "off", spellCheck: false, value: value, disabled: disabled, error: error, description: filled && checking ? checkingLabel : undefined, classNames: { input: ok ? 'promo-verified' : undefined }, rightSection: error ? _jsx(CircleAlert, { size: 16, "aria-hidden": "true" })
40
+ : ok ? _jsx(Check, { size: 18, color: "var(--mantine-color-green-text)", "aria-label": verifiedLabel, role: "img" }) : undefined, onChange: event => onChange(event.currentTarget.value) }));
41
+ }
42
+ //# sourceMappingURL=cart.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart.js","sourceRoot":"","sources":["../../src/checkout/cart.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,eAAe,CAAA;AACjJ,OAAO,EAAE,SAAS,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAEpE,OAAO,EAAE,YAAY,EAA4B,MAAM,kCAAkC,CAAA;AAEzF;;;GAGG;AAEH,MAAM,YAAY,GAAG,CAAC,aAAkC,EAAE,EAAE,CAAC,CAAC,aAAa,IAAI,GAAG,CAAQ,CAAA;AAc1F,2EAA2E;AAC3E,MAAM,UAAU,UAAU,CAAC,EAAE,aAAa,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,GAAG,WAAW,EAAE,WAAW,EAAE,OAAO,EAAmB;IAC9H,OAAO,CACL,MAAC,IAAI,IAAC,GAAG,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,IAAI,EAAE,aACjC,KAAC,OAAO,IAAC,IAAI,EAAE,EAAE,IAAI,EAAE,EAAE,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,YACvC,MAAC,KAAK,IAAC,SAAS,EAAC,SAAS,gBAAa,UAAU,EAAE,GAAG,EAAC,IAAI,aACxD,KAAK,EACN,KAAC,MAAM,IAAC,SAAS,EAAE,YAAY,CAAC,aAAa,CAAC,EAAE,IAAI,EAAE,UAAU,EAAE,IAAI,E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aAAa,EAAE,IAAI,EAAC,KAAK,GAAG,CAAC,CAAC,CAAC,SAAS,EACtH,QAAQ,EAAE,KAAK,CAAC,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,GACtD,CACH,CAAA;AACH,CAAC"}
@@ -0,0 +1,52 @@
1
+ import type { ReactNode } from 'react';
2
+ import { type CheckoutStepsProps } from './checkout-steps.js';
3
+ export type PaymentUnlockReason = 'login_required' | 'phone_required';
4
+ export interface LockedPaymentMethodCardProps {
5
+ /** Display name of the payment method. */
6
+ name: string;
7
+ /** Secondary line, e.g. "QR code" or "Redirect". */
8
+ detail?: ReactNode;
9
+ reason: PaymentUnlockReason;
10
+ /** Short tag that names the fix, e.g. "Sign in to use" or "Verify phone to use". */
11
+ reasonLabel: string;
12
+ /** Extra badges such as a buyer fee, shown after the reason tag. */
13
+ extra?: ReactNode;
14
+ /** Opens the unlock flow. Without it the card is shown but cannot be activated. */
15
+ onUnlock?: () => void;
16
+ disabled?: boolean;
17
+ className?: string;
18
+ }
19
+ /**
20
+ * A payment method the buyer cannot use yet. The whole card is the trigger: tapping it
21
+ * starts the sign-in or phone step instead of leaving a greyed-out dead end.
22
+ */
23
+ export declare function LockedPaymentMethodCard({ name, detail, reason, reasonLabel, extra, onUnlock, disabled, className, }: LockedPaymentMethodCardProps): import("react").JSX.Element;
24
+ export interface UnlockMethodAlternative {
25
+ id: string;
26
+ name: string;
27
+ }
28
+ export interface UnlockMethodDialogProps {
29
+ opened: boolean;
30
+ onClose: () => void;
31
+ /** e.g. "Sign in to pay with Alipay". */
32
+ title: string;
33
+ description?: ReactNode;
34
+ /** Optional note set by the merchant for this payment method. */
35
+ note?: string | null;
36
+ /** Step names when unlocking takes more than one step, e.g. ["Sign in", "Verify phone"]. */
37
+ steps?: readonly string[];
38
+ activeStep?: number;
39
+ stepLabels?: CheckoutStepsProps['labels'];
40
+ /** Methods the buyer can pay with right now, offered as a way out of the dialog. */
41
+ alternatives?: readonly UnlockMethodAlternative[];
42
+ onChooseAlternative?: (id: string) => void;
43
+ labels: {
44
+ /** Heading above the alternatives, e.g. "Or pay another way". */
45
+ payAnotherWay: string;
46
+ close: string;
47
+ };
48
+ /** The sign-in or verification form. */
49
+ children?: ReactNode;
50
+ }
51
+ /** Dialog that explains why a payment method is locked and hosts the step that unlocks it. */
52
+ export declare function UnlockMethodDialog({ opened, onClose, title, description, note, steps, activeStep, stepLabels, alternatives, onChooseAlternative, labels, children, }: UnlockMethodDialogProps): import("react").JSX.Element;
@@ -0,0 +1,25 @@
1
+ 'use client';
2
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { Badge, Button, Group, Modal, Stack, Text } from '@mantine/core';
4
+ import { ChevronRight, Lock, Smartphone } from 'lucide-react';
5
+ import { CheckoutSteps } from './checkout-steps.js';
6
+ /**
7
+ * A payment method the buyer cannot use yet. The whole card is the trigger: tapping it
8
+ * starts the sign-in or phone step instead of leaving a greyed-out dead end.
9
+ */
10
+ export function LockedPaymentMethodCard({ name, detail, reason, reasonLabel, extra, onUnlock, disabled, className, }) {
11
+ const Icon = reason === 'login_required' ? Lock : Smartphone;
12
+ const body = (_jsxs(_Fragment, { children: [_jsxs(Stack, { gap: 2, miw: 0, flex: 1, children: [_jsx(Text, { size: "sm", fw: 600, lh: 1.3, children: name }), _jsxs(Group, { gap: 6, wrap: "wrap", children: [detail && _jsx(Text, { size: "xs", c: "dimmed", lh: 1.3, children: detail }), _jsx(Badge, { size: "xs", variant: "light", color: reason === 'login_required' ? 'blue' : 'orange', radius: "sm", leftSection: _jsx(Icon, { size: 10, "aria-hidden": "true" }), children: reasonLabel }), extra] })] }), onUnlock && _jsx("span", { className: "misebako-locked-method-chevron", children: _jsx(ChevronRight, { size: 18, "aria-hidden": "true" }) })] }));
13
+ const classes = ['misebako-locked-method', className].filter(Boolean).join(' ');
14
+ if (!onUnlock) {
15
+ return _jsx("div", { className: classes, "data-reason": reason, "data-static": "", children: body });
16
+ }
17
+ return (_jsx("button", { type: "button", className: classes, "data-reason": reason, disabled: disabled, onClick: onUnlock, children: body }));
18
+ }
19
+ /** Dialog that explains why a payment method is locked and hosts the step that unlocks it. */
20
+ export function UnlockMethodDialog({ opened, onClose, title, description, note, steps, activeStep = 0, stepLabels, alternatives, onChooseAlternative, labels, children, }) {
21
+ const showSteps = Boolean(steps && steps.length > 1 && stepLabels);
22
+ const others = onChooseAlternative ? alternatives ?? [] : [];
23
+ return (_jsx(Modal, { opened: opened, onClose: onClose, title: title, centered: true, size: "sm", closeButtonProps: { 'aria-label': labels.close }, children: _jsxs(Stack, { gap: "md", children: [showSteps && _jsx(CheckoutSteps, { steps: steps, active: activeStep, labels: stepLabels }), description && _jsx(Text, { size: "sm", c: "dimmed", children: description }), note && _jsx(Text, { size: "xs", c: "dimmed", className: "misebako-unlock-note", children: note }), children, others.length > 0 && (_jsxs(Stack, { gap: 6, className: "misebako-unlock-alternatives", children: [_jsx(Text, { size: "xs", c: "dimmed", children: labels.payAnotherWay }), _jsx(Group, { gap: "xs", wrap: "wrap", children: others.map(method => (_jsx(Button, { type: "button", variant: "default", size: "compact-sm", onClick: () => onChooseAlternative(method.id), children: method.name }, method.id))) })] }))] }) }));
24
+ }
25
+ //# sourceMappingURL=payment-unlock.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"payment-unlock.js","sourceRoot":"","sources":["../../src/checkout/payment-unlock.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;AAGZ,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AACxE,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,cAAc,CAAA;AAC7D,OAAO,EAAE,aAAa,EAA2B,MAAM,qBAAqB,CAAA;AAoB5E;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CAAC,EACtC,IAAI,EACJ,MAAM,E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,CAAC,IAAI,CACpB,MAAC,KAAK,IAAC,GAAG,EAAE,CAAC,EAAE,SAAS,EAAC,8BAA8B,aACrD,KAAC,IAAI,IAAC,IAAI,EAAC,IAAI,EAAC,CAAC,EAAC,QAAQ,YAAE,MAAM,CAAC,aAAa,GAAQ,EACxD,KAAC,KAAK,IAAC,GAAG,EAAC,IAAI,EAAC,IAAI,EAAC,MAAM,YACxB,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CACpB,KAAC,MAAM,IAAiB,IAAI,EAAC,QAAQ,EAAC,OAAO,EAAC,SAAS,EAAC,IAAI,EAAC,YAAY,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,mBAAoB,CAAC,MAAM,CAAC,EAAE,CAAC,YACrH,MAAM,CAAC,IAAI,IADD,MAAM,CAAC,EAAE,CAEb,CACV,CAAC,GACI,IACF,CACT,IACK,GACF,CACT,CAAA;AACH,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Remembers which locked payment method a buyer chose before they left the page to
3
+ * sign in, so checkout can select it again when they come back.
4
+ *
5
+ * Kept in sessionStorage: it stays with the tab, survives the round trip through the
6
+ * sign-in page, and never outlives the browsing session.
7
+ */
8
+ /** Saves the method the buyer wants to unlock for this checkout (`scope`, e.g. "cart" or a checkout token). */
9
+ export declare function rememberUnlockMethod(scope: string, methodId: string, now?: number): void;
10
+ /** Returns the saved method for this checkout without removing it, or null when none is saved or it is stale. */
11
+ export declare function readUnlockMethod(scope: string, maxAgeMs?: number, now?: number): string | null;
12
+ /** Forgets the saved method for this checkout. */
13
+ export declare function clearUnlockMethod(scope: string): void;
14
+ /** Returns the saved method for this checkout and forgets it, so it is restored only once. */
15
+ export declare function consumeUnlockMethod(scope: string, maxAgeMs?: number, now?: number): string | null;
@@ -0,0 +1,68 @@
1
+ /**
2
+ * Remembers which locked payment method a buyer chose before they left the page to
3
+ * sign in, so checkout can select it again when they come back.
4
+ *
5
+ * Kept in sessionStorage: it stays with the tab, survives the round trip through the
6
+ * sign-in page, and never outlives the browsing session.
7
+ */
8
+ const prefix = 'misebako.unlock-method.';
9
+ const defaultMaxAgeMs = 30 * 60_000;
10
+ const methodIdPattern = /^[A-Za-z0-9:._-]{1,64}$/;
11
+ function storage() {
12
+ try {
13
+ return typeof sessionStorage === 'undefined' ? null : sessionStorage;
14
+ }
15
+ catch {
16
+ return null;
17
+ }
18
+ }
19
+ /** Saves the method the buyer wants to unlock for this checkout (`scope`, e.g. "cart" or a checkout token). */
20
+ export function rememberUnlockMethod(scope, methodId, now = Date.now()) {
21
+ if (!methodIdPattern.test(methodId))
22
+ return;
23
+ try {
24
+ storage()?.setItem(prefix + scope, JSON.stringify({ id: methodId, at: now }));
25
+ }
26
+ catch {
27
+ // Private mode or a full quota only loses the convenience of reselecting the method.
28
+ }
29
+ }
30
+ /** Returns the saved method for this checkout without removing it, or null when none is saved or it is stale. */
31
+ export function readUnlockMethod(scope, maxAgeMs = defaultMaxAgeMs, now = Date.now()) {
32
+ const store = storage();
33
+ if (!store)
34
+ return null;
35
+ try {
36
+ const raw = store.getItem(prefix + scope);
37
+ if (!raw)
38
+ return null;
39
+ const value = JSON.parse(raw);
40
+ if (value && typeof value === 'object' &&
41
+ typeof value.id === 'string' && methodIdPattern.test(value.id) &&
42
+ typeof value.at === 'number' &&
43
+ now - value.at >= 0 && now - value.at <= maxAgeMs) {
44
+ return value.id;
45
+ }
46
+ store.removeItem(prefix + scope);
47
+ }
48
+ catch {
49
+ return null;
50
+ }
51
+ return null;
52
+ }
53
+ /** Forgets the saved method for this checkout. */
54
+ export function clearUnlockMethod(scope) {
55
+ try {
56
+ storage()?.removeItem(prefix + scope);
57
+ }
58
+ catch {
59
+ // Nothing to clean up when storage is unavailable.
60
+ }
61
+ }
62
+ /** Returns the saved method for this checkout and forgets it, so it is restored only once. */
63
+ export function consumeUnlockMethod(scope, maxAgeMs = defaultMaxAgeMs, now = Date.now()) {
64
+ const id = readUnlockMethod(scope, maxAgeMs, now);
65
+ clearUnlockMethod(scope);
66
+ return id;
67
+ }
68
+ //# sourceMappingURL=unlock-intent.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"unlock-intent.js","sourceRoot":"","sources":["../../src/checkout/unlock-intent.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,MAAM,MAAM,GAAG,yBAAyB,CAAA;AACxC,MAAM,eAAe,GAAG,EAAE,GAAG,MAAM,CAAA;AACnC,MAAM,eAAe,GAAG,yBAAyB,CAAA;AAOjD,SAAS,OAAO;IACd,IAAI,CAAC;QACH,OAAO,OAAO,cAAc,KAAK,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,cAAc,CAAA;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;AACH,CAAC;AAED,+GAA+G;AAC/G,MAAM,UAAU,oBAAoB,CAAC,KAAa,EAAE,QAAgB,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IACpF,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,QAAQ,CAAC;QAAE,OAAM;IAC3C,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,OAAO,CAAC,MAAM,GAAG,KAAK,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,EAAE,EAAE,GAAG,EAAyB,CAAC,CAAC,CAAA;IACtG,CAAC;IAAC,MAAM,CAAC;QACP,qFAAqF;IACvF,CAAC;AACH,CAAC;AAED,iHAAiH;AACjH,MAAM,UAAU,gBAAgB,CAAC,KAAa,EAAE,QAAQ,GAAG,eAAe,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAC1F,MAAM,KAAK,GAAG,OAAO,EAAE,CAAA;IACvB,IAAI,CAAC,KAAK;QAAE,OAAO,IAAI,CAAA;IACvB,IAAI,CAAC;QACH,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;QACzC,IAAI,CAAC,GAAG;YAAE,OAAO,IAAI,CAAA;QACrB,MAAM,KAAK,GAAY,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAA;QACtC,IACE,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ;YAClC,OAAQ,KAAsB,CAAC,EAAE,KAAK,QAAQ,IAAI,eAAe,CAAC,IAAI,CAAE,KAAsB,CAAC,EAAE,CAAC;YAClG,OAAQ,KAAsB,CAAC,EAAE,KAAK,QAAQ;YAC9C,GAAG,GAAI,KAAsB,CAAC,EAAE,IAAI,CAAC,IAAI,GAAG,GAAI,KAAsB,CAAC,EAAE,IAAI,QAAQ,EACrF,CAAC;YACD,OAAQ,KAAsB,CAAC,EAAE,CAAA;QACnC,CAAC;QACD,KAAK,CAAC,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;IAClC,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,IAAI,CAAA;IACb,CAAC;IACD,OAAO,IAAI,CAAA;AACb,CAAC;AAED,kDAAkD;AAClD,MAAM,UAAU,iBAAiB,CAAC,KAAa;IAC7C,IAAI,CAAC;QACH,OAAO,EAAE,EAAE,UAAU,CAAC,MAAM,GAAG,KAAK,CAAC,CAAA;IACvC,CAAC;IAAC,MAAM,CAAC;QACP,mDAAmD;IACrD,CAAC;AACH,CAAC;AAED,8FAA8F;AAC9F,MAAM,UAAU,mBAAmB,CAAC,KAAa,EAAE,QAAQ,GAAG,eAAe,EAAE,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE;IAC7F,MAAM,EAAE,GAAG,gBAAgB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAA;IACjD,iBAAiB,CAAC,KAAK,CAAC,CAAA;IACxB,OAAO,EAAE,CAAA;AACX,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- export { misebakoColors, createMisebakoTheme, misebakoTheme, norenTheme } from './theme/index.js';
1
+ export { misebakoColors, misebakoComponents, createMisebakoTheme, misebakoTheme, norenTheme } from './theme/index.js';
2
2
  export { DefaultStoreLink, type StoreLinkComponent, type StoreLinkProps } from './primitives/link.js';
3
3
  export { isSafeHref, RichContent, type RichContentProps } from './primitives/rich-text.js';
4
4
  export { OtpCodeInput, type OtpCodeInputProps } from './primitives/otp-input.js';
@@ -6,13 +6,23 @@ export { PhoneVerifyModal, type PhoneVerifyModalLabels, type SharedPhoneVerifyMo
6
6
  export { BotCheckError, HCaptchaWidget, RecaptchaWidget, TurnstileWidget, useBotCheck, type HCaptchaWidgetProps, type RecaptchaWidgetProps, type TurnstileWidgetProps, type UseBotCheckOptions, } from './primitives/bot-check.js';
7
7
  export { AppearanceMenu, type AppearanceMenuProps } from './primitives/appearance-menu.js';
8
8
  export { AppearanceProvider, type AppearanceProviderProps } from './primitives/appearance-provider.js';
9
+ export { navCurrent, SkipLink, StoreFooter, StoreHeader, StoreNotice, type StoreFooterGroup, type StoreFooterLink, type StoreFooterProps, type StoreHeaderLink, type StoreHeaderProps, type StoreNoticeProps, } from './layout/store-chrome.js';
9
10
  export { NavigationProgress, startNavigationProgress, type NavigationProgressProps } from './primitives/navigation-progress.js';
10
11
  export { RegionMark, RegionMenu, type RegionMenuLabels, type RegionMenuLocaleOption, type RegionMenuProps, } from './primitives/region-menu.js';
11
12
  export { ProductCover, ProductGallery, type ProductCoverProps, type ProductGalleryImage, type ProductGalleryProps } from './storefront/product-gallery.js';
13
+ export { DeliveryNote, type DeliveryKind, type DeliveryNoteProps } from './storefront/delivery-note.js';
14
+ export { CatalogHeader, CatalogLayout, CatalogSearchInput, CategorySidebar, EmptyStatePanel, FeaturedSection, HelpArticleCards, ProductCard, ProductCardGrid, ProductCardPrice, StockBadge, type CatalogHeaderProps, type CatalogLayoutProps, type CatalogSearchInputProps, type CategoryLinkItem, type CategorySidebarProps, type EmptyStatePanelProps, type FeaturedSectionProps, type HelpArticleCardItem, type HelpArticleCardsProps, type ProductCardGridProps, type ProductCardPriceProps, type ProductCardProps, type StockBadgeProps, type StockBadgeTone, } from './storefront/catalog.js';
12
15
  export { HomeHero, type HomeHeroBullet, type HomeHeroCategory, type SharedHomeHeroProps } from './storefront/home-hero.js';
13
16
  export { QuoteFormFields, type QuoteFormFieldsProps } from './checkout/quote-fields.js';
17
+ export { CartItemList, CartLayout, CartLine, CartRemoveButton, CartSummary, CartUndoNotice, PromoCodeInput, type CartItemListProps, type CartLayoutProps, type CartLineProps, type CartRemoveButtonProps, type CartSummaryProps, type CartUndoNoticeProps, type PromoCodeInputProps, } from './checkout/cart.js';
14
18
  export { CheckoutAmounts, QuoteSummaryCard, type CheckoutAmountsProps, type CheckoutAmountsRate, type QuoteSummaryCardProps, } from './checkout/checkout-amounts.js';
15
19
  export { CheckoutSteps, type CheckoutStepsProps, } from './checkout/checkout-steps.js';
16
20
  export { orderStateTone, StatusBadge, statusToneColor, type StatusBadgeProps, type StatusTone, } from './primitives/status-badge.js';
21
+ export { OrderTable, type OrderTableProps, type OrderTableRow } from './orders/order-table.js';
22
+ export { StatusPage, type StatusPageProps } from './primitives/status-page.js';
17
23
  export { DeliveryCodeList, type DeliveryCodeListProps } from './orders/delivery-codes.js';
24
+ export { CheckoutLink, PendingCheckoutTable, type PendingCheckoutRow } from './orders/pending-checkout-table.js';
18
25
  export { isAwaitingInput, NeedsInputForm, OrderActionConfirm, orderStateColor, type NeedsInputFormProps, type OrderActionConfirmProps, } from './orders/order-status.js';
26
+ export { LockedPaymentMethodCard, UnlockMethodDialog, type LockedPaymentMethodCardProps, type PaymentUnlockReason, type UnlockMethodAlternative, type UnlockMethodDialogProps, } from './checkout/payment-unlock.js';
27
+ export { clearUnlockMethod, consumeUnlockMethod, readUnlockMethod, rememberUnlockMethod } from './checkout/unlock-intent.js';
28
+ export { EmailCodeSignIn, type EmailCodeSignInLabels, type EmailCodeSignInProps, type EmailSignInStartResult, type EmailSignInStep, type EmailSignInVerifyResult, } from './primitives/email-code-sign-in.js';
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- export { misebakoColors, createMisebakoTheme, misebakoTheme, norenTheme } from './theme/index.js';
1
+ export { misebakoColors, misebakoComponents, createMisebakoTheme, misebakoTheme, norenTheme } from './theme/index.js';
2
2
  export { DefaultStoreLink } from './primitives/link.js';
3
3
  export { isSafeHref, RichContent } from './primitives/rich-text.js';
4
4
  export { OtpCodeInput } from './primitives/otp-input.js';
@@ -6,14 +6,24 @@ export { PhoneVerifyModal, } from './primitives/phone-verify-modal.js';
6
6
  export { BotCheckError, HCaptchaWidget, RecaptchaWidget, TurnstileWidget, useBotCheck, } from './primitives/bot-check.js';
7
7
  export { AppearanceMenu } from './primitives/appearance-menu.js';
8
8
  export { AppearanceProvider } from './primitives/appearance-provider.js';
9
+ export { navCurrent, SkipLink, StoreFooter, StoreHeader, StoreNotice, } from './layout/store-chrome.js';
9
10
  export { NavigationProgress, startNavigationProgress } from './primitives/navigation-progress.js';
10
11
  export { RegionMark, RegionMenu, } from './primitives/region-menu.js';
11
12
  export { ProductCover, ProductGallery } from './storefront/product-gallery.js';
13
+ export { DeliveryNote } from './storefront/delivery-note.js';
14
+ export { CatalogHeader, CatalogLayout, CatalogSearchInput, CategorySidebar, EmptyStatePanel, FeaturedSection, HelpArticleCards, ProductCard, ProductCardGrid, ProductCardPrice, StockBadge, } from './storefront/catalog.js';
12
15
  export { HomeHero } from './storefront/home-hero.js';
13
16
  export { QuoteFormFields } from './checkout/quote-fields.js';
17
+ export { CartItemList, CartLayout, CartLine, CartRemoveButton, CartSummary, CartUndoNotice, PromoCodeInput, } from './checkout/cart.js';
14
18
  export { CheckoutAmounts, QuoteSummaryCard, } from './checkout/checkout-amounts.js';
15
19
  export { CheckoutSteps, } from './checkout/checkout-steps.js';
16
20
  export { orderStateTone, StatusBadge, statusToneColor, } from './primitives/status-badge.js';
21
+ export { OrderTable } from './orders/order-table.js';
22
+ export { StatusPage } from './primitives/status-page.js';
17
23
  export { DeliveryCodeList } from './orders/delivery-codes.js';
24
+ export { CheckoutLink, PendingCheckoutTable } from './orders/pending-checkout-table.js';
18
25
  export { isAwaitingInput, NeedsInputForm, OrderActionConfirm, orderStateColor, } from './orders/order-status.js';
26
+ export { LockedPaymentMethodCard, UnlockMethodDialog, } from './checkout/payment-unlock.js';
27
+ export { clearUnlockMethod, consumeUnlockMethod, readUnlockMethod, rememberUnlockMethod } from './checkout/unlock-intent.js';
28
+ export { EmailCodeSignIn, } from './primitives/email-code-sign-in.js';
19
29
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,mBAAmB,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AACjG,OAAO,EAAE,gBAAgB,EAAgD,MAAM,sBAAsB,CAAA;AACrG,OAAO,EAAE,UAAU,EAAE,WAAW,EAAyB,MAAM,2BAA2B,CAAA;AAC1F,OAAO,EAAE,YAAY,EAA0B,MAAM,2BAA2B,CAAA;AAChF,OAAO,EACL,gBAAgB,GAGjB,MAAM,oCAAoC,CAAA;AAC3C,OAAO,EACL,aAAa,EACb,cAAc,EACd,eAAe,EACf,eAAe,EACf,WAAW,GAKZ,MAAM,2BAA2B,CAAA;AAClC,OAAO,EAAE,cAAc,EAA4B,MAAM,iCAAiC,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAgC,MAAM,qCAAqC,CAAA;AACtG,OAAO,EAAE,kBAAkB,EAAE,uBAAuB,EAAgC,MAAM,qCAAqC,CAAA;AAC/H,OAAO,EACL,UAAU,EACV,UAAU,GAIX,MAAM,6BAA6B,CAAA;AACpC,OAAO,EAAE,YAAY,EAAE,cAAc,EAA8E,MAAM,iCAAiC,CAAA;AAC1J,OAAO,EAAE,QAAQ,EAAwE,MAAM,2BAA2B,CAAA;AAC1H,OAAO,EAAE,eAAe,EAA6B,MAAM,4BAA4B,CAAA;AACvF,OAAO,EACL,eAAe,EACf,gB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ACvG,OAAO,EACL,aAAa,EACb,aAAa,EACb,kBAAkB,EAClB,eAAe,EACf,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,UAAU,GAeX,MAAM,yBAAyB,CAAA;AAChC,OAAO,EAAE,QAAQ,EAAwE,MAAM,2BAA2B,CAAA;AAC1H,OAAO,EAAE,eAAe,EAA6B,MAAM,4BAA4B,CAAA;AACvF,OAAO,EACL,YAAY,EACZ,UAAU,EACV,QAAQ,EACR,gBAAgB,EAChB,WAAW,EACX,cAAc,EACd,cAAc,GAQf,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,eAAe,EACf,gBAAgB,GAIjB,MAAM,gCAAgC,CAAA;AACvC,OAAO,EACL,aAAa,GAEd,MAAM,8BAA8B,CAAA;AACrC,OAAO,EACL,cAAc,EACd,WAAW,EACX,eAAe,GAGhB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,UAAU,EAA4C,MAAM,yBAAyB,CAAA;AAC9F,OAAO,EAAE,UAAU,EAAwB,MAAM,6BAA6B,CAAA;AAC9E,OAAO,EAAE,gBAAgB,EAA8B,MAAM,4BAA4B,CAAA;AACzF,OAAO,EAAE,YAAY,EAAE,oBAAoB,EAA2B,MAAM,oCAAoC,CAAA;AAChH,OAAO,EACL,eAAe,EACf,cAAc,EACd,kBAAkB,EAClB,eAAe,GAGhB,MAAM,0BAA0B,CAAA;AACjC,OAAO,EACL,uBAAuB,EACvB,kBAAkB,GAKnB,MAAM,8BAA8B,CAAA;AACrC,OAAO,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,gBAAgB,EAAE,oBAAoB,EAAE,MAAM,6BAA6B,CAAA;AAC5H,OAAO,EACL,eAAe,GAMhB,MAAM,oCAAoC,CAAA"}
@@ -0,0 +1,54 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StoreLinkComponent } from '../primitives/link.js';
3
+ /** `aria-current` for a top-level nav link: `page` on the page itself, `location` on its sub-pages. */
4
+ export declare function navCurrent(pathname: string, href: string, sectionPrefixes?: readonly string[]): 'page' | 'location' | undefined;
5
+ export declare function SkipLink({ href, children }: {
6
+ href?: string;
7
+ children: ReactNode;
8
+ }): import("react").JSX.Element;
9
+ export interface StoreNoticeProps {
10
+ /** Accessible name, such as "Notice". */
11
+ label: string;
12
+ lang?: string;
13
+ children: ReactNode;
14
+ }
15
+ /** Store-wide announcement above the header. */
16
+ export declare function StoreNotice({ label, lang, children }: StoreNoticeProps): import("react").JSX.Element;
17
+ export interface StoreHeaderLink {
18
+ href: string;
19
+ label: string;
20
+ current?: 'page' | 'location';
21
+ }
22
+ export interface StoreHeaderProps {
23
+ LinkComponent?: StoreLinkComponent;
24
+ /** Store name, linking home. */
25
+ title: string;
26
+ navLabel: string;
27
+ links: readonly StoreHeaderLink[];
28
+ /** Right-hand controls: appearance, region, cart and account. Group them in `Group gap="xs" wrap="nowrap"`. */
29
+ tools: ReactNode;
30
+ }
31
+ /** Store name, main navigation and tools; the navigation wraps onto its own row on phones. */
32
+ export declare function StoreHeader({ LinkComponent, title, navLabel, links, tools }: StoreHeaderProps): import("react").JSX.Element;
33
+ export interface StoreFooterLink {
34
+ href: string;
35
+ label: string;
36
+ /** Off-site links (social profiles) render as plain anchors with `rel="external noreferrer"`. */
37
+ external?: boolean;
38
+ }
39
+ export interface StoreFooterGroup {
40
+ title: string;
41
+ links: readonly StoreFooterLink[];
42
+ }
43
+ export interface StoreFooterProps {
44
+ LinkComponent?: StoreLinkComponent;
45
+ title: string;
46
+ description?: string | null;
47
+ /** Support address, shown as a mailto link. */
48
+ supportEmail?: {
49
+ href: string;
50
+ label: string;
51
+ } | null;
52
+ groups: readonly StoreFooterGroup[];
53
+ }
54
+ export declare function StoreFooter({ LinkComponent, title, description, supportEmail, groups }: StoreFooterProps): import("react").JSX.Element;
@@ -0,0 +1,32 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Anchor, Button, Container, Divider, Grid, GridCol, Group, Paper, Stack, Text } from '@mantine/core';
3
+ /*
4
+ * Storefront page chrome shared by Misebako and Noren: skip link, notice banner, header bar and footer.
5
+ * No hooks, so server components can render them; pass the framework link as `LinkComponent`.
6
+ */
7
+ const linkOrAnchor = (LinkComponent) => (LinkComponent ?? 'a');
8
+ /** `aria-current` for a top-level nav link: `page` on the page itself, `location` on its sub-pages. */
9
+ export function navCurrent(pathname, href, sectionPrefixes = ['/products', '/help']) {
10
+ if (pathname === href)
11
+ return 'page';
12
+ return sectionPrefixes.includes(href) && pathname.startsWith(`${href}/`) ? 'location' : undefined;
13
+ }
14
+ export function SkipLink({ href = '#main-content', children }) {
15
+ return _jsx(Button, { component: "a", href: href, className: "skip-link", children: children });
16
+ }
17
+ /** Store-wide announcement above the header. */
18
+ export function StoreNotice({ label, lang, children }) {
19
+ return (_jsx(Paper, { component: "aside", role: "note", "aria-label": label, radius: 0, bg: "var(--mantine-primary-color-light)", children: _jsx(Container, { size: "lg", py: "xs", children: _jsx(Text, { size: "sm", lang: lang, style: { whiteSpace: 'pre-line' }, children: children }) }) }));
20
+ }
21
+ /** Store name, main navigation and tools; the navigation wraps onto its own row on phones. */
22
+ export function StoreHeader({ LinkComponent, title, navLabel, links, tools }) {
23
+ const Link = linkOrAnchor(LinkComponent);
24
+ return (_jsxs("header", { children: [_jsx(Container, { size: "lg", py: "xs", children: _jsxs(Grid, { align: "center", gap: "xs", children: [_jsx(GridCol, { span: "auto", miw: 0, children: _jsx(Anchor, { component: Link, href: "/", c: "inherit", underline: "never", fw: 700, size: "lg", w: "fit-content", maw: "100%", display: "block", truncate: true, title: title, children: title }) }), _jsx(GridCol, { span: { base: 12, sm: 'content' }, order: { base: 3, sm: 2 }, children: _jsx(Group, { component: "nav", "aria-label": navLabel, className: "store-nav-links", gap: "xs", children: links.map(({ href, label, current }) => (_jsx(Button, { component: Link, href: href, variant: current ? 'light' : 'subtle', color: "gray", px: { base: 8, sm: 'sm' }, "aria-current": current, children: label }, href))) }) }), _jsx(GridCol, { span: "content", order: { base: 2, sm: 3 }, children: _jsx(Group, { justify: "end", gap: "xs", wrap: "nowrap", children: tools }) })] }) }), _jsx(Divider, {})] }));
25
+ }
26
+ export function StoreFooter({ LinkComponent, title, description, supportEmail, groups }) {
27
+ const Link = linkOrAnchor(LinkComponent);
28
+ return (_jsxs("footer", { children: [_jsx(Divider, {}), _jsx(Container, { size: "lg", py: "xl", children: _jsxs(Grid, { gap: "lg", children: [_jsx(GridCol, { span: { base: 12, sm: 4, md: 5 }, children: _jsxs(Stack, { align: "start", gap: 2, children: [_jsx(Text, { fw: 700, size: "lg", children: title }), description && _jsx(Text, { size: "sm", c: "dimmed", children: description }), supportEmail && _jsx(Anchor, { href: supportEmail.href, c: "dimmed", size: "sm", mt: 4, children: supportEmail.label })] }) }), groups.map(group => (_jsx(GridCol, { span: { base: 6, xs: 4, sm: 'auto' }, children: _jsxs(Stack, { component: "nav", "aria-label": group.title, align: "start", gap: 6, children: [_jsx(Text, { fw: 600, size: "sm", mb: 2, children: group.title }), group.links.map(link => link.external
29
+ ? _jsx(Anchor, { href: link.href, rel: "external noreferrer", c: "dimmed", size: "sm", children: link.label }, link.href)
30
+ : _jsx(Anchor, { component: Link, href: link.href, c: "dimmed", size: "sm", children: link.label }, link.href))] }) }, group.title)))] }) })] }));
31
+ }
32
+ //# sourceMappingURL=store-chrome.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"store-chrome.js","sourceRoot":"","sources":["../../src/layout/store-chrome.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,eAAe,CAAA;AAG5G;;;GAGG;AAEH,MAAM,YAAY,GAAG,CAAC,aAAkC,EAAE,EAAE,CAAC,CAAC,aAAa,IAAI,GAAG,CAAQ,CAAA;AAE1F,uGAAuG;AACvG,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a,KAAK,CAAC,KAAK,EAAE,KAAK,EAAC,OAAO,EAAC,GAAG,EAAE,CAAC,aAClE,KAAC,IAAI,IAAC,EAAE,EAAE,GAAG,EAAE,IAAI,EAAC,IAAI,EAAC,EAAE,EAAE,CAAC,YAAG,KAAK,CAAC,KAAK,GAAQ,EACnD,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,QAAQ;wCACpC,CAAC,CAAC,KAAC,MAAM,IAAiB,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,GAAG,EAAC,qBAAqB,EAAC,CAAC,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,YAAE,IAAI,CAAC,KAAK,IAAtF,IAAI,CAAC,IAAI,CAAuF;wCAC/G,CAAC,CAAC,KAAC,MAAM,IAAiB,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,CAAC,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,YAAE,IAAI,CAAC,KAAK,IAA7E,IAAI,CAAC,IAAI,CAA8E,CAAC,IACnG,IANI,KAAK,CAAC,KAAK,CAOf,CACX,CAAC,IACG,GACG,IACL,CACV,CAAA;AACH,CAAC"}
@@ -0,0 +1,31 @@
1
+ import type { ReactNode } from 'react';
2
+ export interface OrderTableRow {
3
+ key: string;
4
+ /** Product name; a string renders as bold text, or pass a link. */
5
+ title: ReactNode;
6
+ /** Badges beside the title, such as "Needs Input". */
7
+ badges?: ReactNode;
8
+ /** Dimmed line under the title: date, quantity and similar. */
9
+ meta?: ReactNode;
10
+ /** Amount and status on one line for phones, where those columns are hidden. */
11
+ compactSummary?: ReactNode;
12
+ /** Extra lines under the title, such as refund progress. */
13
+ note?: ReactNode;
14
+ amount: ReactNode;
15
+ /** Status badges for the status column. */
16
+ status: ReactNode;
17
+ action: ReactNode;
18
+ }
19
+ export interface OrderTableProps {
20
+ /** Accessible name for the table. */
21
+ label: string;
22
+ headers: {
23
+ product: string;
24
+ amount: string;
25
+ status: string;
26
+ actions: string;
27
+ };
28
+ rows: readonly OrderTableRow[];
29
+ }
30
+ /** Order list table shared by the main store and reseller stores; amount and status fold under the title on phones. */
31
+ export declare function OrderTable({ label, headers, rows }: OrderTableProps): import("react").JSX.Element;
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Group, Paper, Stack, Table, TableTbody, TableTd, TableTh, TableThead, TableTr, Text } from '@mantine/core';
3
+ /** Order list table shared by the main store and reseller stores; amount and status fold under the title on phones. */
4
+ export function OrderTable({ label, headers, rows }) {
5
+ return (_jsx(Paper, { withBorder: true, radius: "md", style: { overflow: 'hidden' }, children: _jsxs(Table, { "aria-label": label, horizontalSpacing: "md", verticalSpacing: "sm", children: [_jsx(TableThead, { children: _jsxs(TableTr, { children: [_jsx(TableTh, { children: headers.product }), _jsx(TableTh, { visibleFrom: "sm", children: headers.amount }), _jsx(TableTh, { visibleFrom: "sm", children: headers.status }), _jsx(TableTh, { ta: "end", children: headers.actions })] }) }), _jsx(TableTbody, { children: rows.map(row => (_jsxs(TableTr, { children: [_jsx(TableTd, { style: { overflowWrap: 'anywhere' }, children: _jsxs(Stack, { gap: 2, children: [_jsxs(Group, { gap: 6, wrap: "wrap", children: [typeof row.title === 'string' ? _jsx(Text, { fw: 600, size: "sm", children: row.title }) : row.title, row.badges] }), row.meta && _jsx(Text, { size: "xs", c: "dimmed", children: row.meta }), row.compactSummary && _jsx(Group, { gap: 6, wrap: "wrap", hiddenFrom: "sm", children: row.compactSummary }), row.note] }) }), _jsx(TableTd, { visibleFrom: "sm", children: row.amount }), _jsx(TableTd, { visibleFrom: "sm", children: _jsx(Group, { gap: 6, wrap: "wrap", children: row.status }) }), _jsx(TableTd, { ta: "end", children: row.action })] }, row.key))) })] }) }));
6
+ }
7
+ //# sourceMappingURL=order-table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"order-table.js","sourceRoot":"","sources":["../../src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