@zeyolabs/shopping 2026.11.39 → 2026.11.41
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/basket/pages/Basket.svelte +101 -90
- package/bundles/admin/BundleForm.svelte +53 -30
- package/bundles/admin/BundlesPage.svelte +10 -10
- package/bundles/pages/Bundle.svelte +77 -72
- package/catalogue/admin/CategoriesPage.svelte +13 -7
- package/catalogue/admin/CategoryForm.svelte +3 -2
- package/catalogue/admin/ProductForm.svelte +66 -55
- package/catalogue/admin/ProductsPage.svelte +28 -26
- package/catalogue/admin.remote.ts +5 -2
- package/catalogue/admin.service.server.ts +6 -2
- package/catalogue/components/ProductCard.svelte +4 -4
- package/catalogue/pages/Product.svelte +46 -45
- package/catalogue/pages/Search.svelte +20 -16
- package/catalogue/pages/Shop.svelte +9 -8
- package/checkout/payments-worker.ts +16 -0
- package/checkout/webhook.server.ts +3 -39
- package/checkout/webhook.ts +51 -0
- package/customers/pages/Account.svelte +17 -14
- package/fulfilment/admin/OrderPage.svelte +65 -55
- package/fulfilment/admin/OrdersPage.svelte +69 -58
- package/orders/pages/Order.svelte +23 -18
- package/package.json +3 -3
- package/reviews/admin/ReviewsPage.svelte +30 -26
- package/reviews/components/Reviews.svelte +7 -6
- package/stock/admin/StockPage.svelte +12 -9
- package/stock/admin/StockRow.svelte +9 -13
- package/ui/PageLinks.svelte +28 -22
- package/ui/Stars.svelte +12 -10
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
2
3
|
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
3
4
|
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
4
5
|
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
@@ -27,20 +28,20 @@
|
|
|
27
28
|
No reviews yet. Bought this? You can review it from your order page.
|
|
28
29
|
</Text>
|
|
29
30
|
{:else}
|
|
30
|
-
<
|
|
31
|
+
<Cluster class="mt-2" gap="xs">
|
|
31
32
|
<Stars rating={reviews.average} />
|
|
32
33
|
<Span
|
|
33
34
|
>{reviews.average} out of 5, from {reviews.count}
|
|
34
35
|
{reviews.count === 1 ? 'review' : 'reviews'}</Span
|
|
35
36
|
>
|
|
36
|
-
</
|
|
37
|
+
</Cluster>
|
|
37
38
|
<ul class="mt-4 divide-y divide-[var(--bd)] border-y border-[var(--bd)]">
|
|
38
39
|
{#each reviews.list as review (review.id)}
|
|
39
40
|
<li class="py-4">
|
|
40
|
-
<
|
|
41
|
-
<Stars rating={review.rating} size="
|
|
42
|
-
{#if review.title}<
|
|
43
|
-
</
|
|
41
|
+
<Cluster gap="xs">
|
|
42
|
+
<Stars rating={review.rating} size="sm" />
|
|
43
|
+
{#if review.title}<Span bold>{review.title}</Span>{/if}
|
|
44
|
+
</Cluster>
|
|
44
45
|
<Text class="mt-2 whitespace-pre-line">{review.body}</Text>
|
|
45
46
|
<Text class="mt-2" color="secondary">
|
|
46
47
|
{review.name}, verified buyer, {date.format(review.createdAt)}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import Badge from '@zeyolabs/ui/badge/Badge.svelte';
|
|
3
3
|
import Boundary from '@zeyolabs/ui/boundary/Boundary.svelte';
|
|
4
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
4
5
|
import Text from '@zeyolabs/ui/text/Text.svelte';
|
|
5
6
|
import Title from '@zeyolabs/ui/text/Title.svelte';
|
|
6
7
|
|
|
@@ -19,24 +20,26 @@
|
|
|
19
20
|
<Boundary message="Could not load stock.">
|
|
20
21
|
{let rows = $derived(await getStock())}
|
|
21
22
|
<div class="mt-4 overflow-x-auto rounded-xl border border-[var(--bd)] bg-white">
|
|
22
|
-
<table class="w-full text-left
|
|
23
|
+
<table class="w-full text-left">
|
|
23
24
|
<thead class="border-b border-[var(--bd)] text-[var(--txs)]">
|
|
24
25
|
<tr>
|
|
25
|
-
<th class="px-4 py-2
|
|
26
|
-
<th class="px-4 py-2
|
|
27
|
-
<th class="px-4 py-2 text-right
|
|
28
|
-
<th class="px-4 py-2 text-right
|
|
26
|
+
<th class="px-4 py-2"><Span bold size="sm">Product</Span></th>
|
|
27
|
+
<th class="px-4 py-2"><Span bold size="sm">SKU</Span></th>
|
|
28
|
+
<th class="px-4 py-2 text-right"><Span bold size="sm">Waiting</Span></th>
|
|
29
|
+
<th class="px-4 py-2 text-right"><Span bold size="sm">Stock</Span></th>
|
|
29
30
|
</tr>
|
|
30
31
|
</thead>
|
|
31
32
|
<tbody class="divide-y divide-[var(--bd)]">
|
|
32
33
|
{#each rows as row (row.id)}
|
|
33
34
|
<tr>
|
|
34
|
-
<td class="px-4 py-2
|
|
35
|
-
|
|
35
|
+
<td class="px-4 py-2">
|
|
36
|
+
<Span bold size="sm"
|
|
37
|
+
>{row.name}{row.variationLabel ? ` · ${row.variationLabel}` : ''}</Span
|
|
38
|
+
>
|
|
36
39
|
{#if !row.active}<Badge color="neutral">inactive</Badge>{/if}
|
|
37
40
|
</td>
|
|
38
|
-
<td class="px-4 py-2 whitespace-nowrap">{row.sku}</td>
|
|
39
|
-
<td class="px-4 py-2 text-right">{row.waiting}</td>
|
|
41
|
+
<td class="px-4 py-2 whitespace-nowrap"><Span size="sm">{row.sku}</Span></td>
|
|
42
|
+
<td class="px-4 py-2 text-right"><Span size="sm">{row.waiting}</Span></td>
|
|
40
43
|
<td class="px-4 py-2"
|
|
41
44
|
><StockRow
|
|
42
45
|
id={row.id}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import { Form, NumberField } from '@zeyolabs/ui/form';
|
|
3
3
|
import Button from '@zeyolabs/ui/form/Button.svelte';
|
|
4
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
4
5
|
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
5
6
|
|
|
6
7
|
import { setStockForm } from '../admin.remote';
|
|
@@ -11,17 +12,12 @@
|
|
|
11
12
|
const form = $derived(setStockForm.for(id));
|
|
12
13
|
</script>
|
|
13
14
|
|
|
14
|
-
<Form
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
>
|
|
22
|
-
<!-- The column header says "Stock"; the label names the product for screen readers. -->
|
|
23
|
-
<NumberField name="stock" {form} inputmode="numeric">
|
|
24
|
-
<Span class="sr-only">Stock for {name}</Span>
|
|
25
|
-
</NumberField>
|
|
26
|
-
<Button {form}>Save</Button>
|
|
15
|
+
<Form defaults={{ stock }} {form} hidden={{ productId: id }} reset={false} schema={StockSchema}>
|
|
16
|
+
<Cluster gap="xs" justify="end" nowrap>
|
|
17
|
+
<!-- The column header says "Stock"; the label names the product for screen readers. -->
|
|
18
|
+
<NumberField name="stock" {form} inputmode="numeric">
|
|
19
|
+
<Span class="sr-only">Stock for {name}</Span>
|
|
20
|
+
</NumberField>
|
|
21
|
+
<Button {form}>Save</Button>
|
|
22
|
+
</Cluster>
|
|
27
23
|
</Form>
|
package/ui/PageLinks.svelte
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
import { page as current } from '$app/state';
|
|
3
3
|
import ChevronLeft from '@lucide/svelte/icons/chevron-left';
|
|
4
4
|
import ChevronRight from '@lucide/svelte/icons/chevron-right';
|
|
5
|
+
import Cluster from '@zeyolabs/ui/layout/Cluster.svelte';
|
|
6
|
+
import Span from '@zeyolabs/ui/text/Span.svelte';
|
|
5
7
|
|
|
6
8
|
import { Paging } from '../catalogue/library';
|
|
7
9
|
|
|
@@ -12,34 +14,38 @@
|
|
|
12
14
|
n === 1 ? current.url.pathname : `${current.url.pathname}?page=${n}`;
|
|
13
15
|
|
|
14
16
|
const box =
|
|
15
|
-
'inline-flex h-10 min-w-10 items-center justify-center gap-1 rounded-full px-3
|
|
17
|
+
'inline-flex h-10 min-w-10 items-center justify-center gap-1 rounded-full px-3 no-underline';
|
|
16
18
|
const link = `${box} border border-[var(--bd)] text-[var(--tx)] hover:border-[var(--primary-strong)] hover:text-[var(--primary-strong)]`;
|
|
17
19
|
</script>
|
|
18
20
|
|
|
19
21
|
{#if pages > 1}
|
|
20
22
|
<!-- eslint-disable svelte/no-navigation-without-resolve -- same path as this page, only ?page changes -->
|
|
21
|
-
<nav class="mt-10
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
<
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
{#if n === null}
|
|
29
|
-
<div class="{box} text-[var(--txt)]" aria-hidden="true">…</div>
|
|
30
|
-
{:else if n === page}
|
|
31
|
-
<div class="{box} bg-[var(--primary-strong)] font-medium text-white" aria-current="page">
|
|
32
|
-
{n}
|
|
33
|
-
</div>
|
|
34
|
-
{:else}
|
|
35
|
-
<a class={link} aria-label="Page {n}" href={href(n)}>{n}</a>
|
|
23
|
+
<nav class="mt-10" aria-label="Pages">
|
|
24
|
+
<Cluster gap="xs" justify="center">
|
|
25
|
+
{#if page > 1}
|
|
26
|
+
<a class={link} href={href(page - 1)} rel="prev">
|
|
27
|
+
<ChevronLeft class="size-4" aria-hidden="true" />
|
|
28
|
+
<Span size="sm">Previous</Span>
|
|
29
|
+
</a>
|
|
36
30
|
{/if}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
31
|
+
{#each Paging.window(page, pages) as n, i (n ?? `gap-${i}`)}
|
|
32
|
+
{#if n === null}
|
|
33
|
+
<div class="{box} text-[var(--txt)]" aria-hidden="true"><Span size="sm">…</Span></div>
|
|
34
|
+
{:else if n === page}
|
|
35
|
+
<div class="{box} bg-[var(--primary-strong)] text-white" aria-current="page">
|
|
36
|
+
<Span bold size="sm">{n}</Span>
|
|
37
|
+
</div>
|
|
38
|
+
{:else}
|
|
39
|
+
<a class={link} aria-label="Page {n}" href={href(n)}><Span size="sm">{n}</Span></a>
|
|
40
|
+
{/if}
|
|
41
|
+
{/each}
|
|
42
|
+
{#if page < pages}
|
|
43
|
+
<a class={link} href={href(page + 1)} rel="next">
|
|
44
|
+
<Span size="sm">Next</Span>
|
|
45
|
+
<ChevronRight class="size-4" aria-hidden="true" />
|
|
46
|
+
</a>
|
|
47
|
+
{/if}
|
|
48
|
+
</Cluster>
|
|
43
49
|
</nav>
|
|
44
50
|
<!-- eslint-enable svelte/no-navigation-without-resolve -->
|
|
45
51
|
{/if}
|
package/ui/Stars.svelte
CHANGED
|
@@ -1,20 +1,22 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
/** A read-only star rating, e.g. 4.5 shows as four and a half of five stars. */
|
|
3
|
-
let { rating, size = '
|
|
3
|
+
let { rating, size = 'md' }: { rating: number; size?: 'md' | 'sm' } = $props();
|
|
4
4
|
const pct = $derived(`${Math.max(0, Math.min(5, rating)) * 20}%`);
|
|
5
5
|
</script>
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
<div
|
|
8
|
+
style:font-size={size === 'sm' ? '14px' : '16px'}
|
|
9
|
+
style:line-height="1"
|
|
10
|
+
class="relative inline-block whitespace-nowrap"
|
|
10
11
|
aria-label="{rating} out of 5 stars"
|
|
11
12
|
role="img"
|
|
12
13
|
>
|
|
13
|
-
<
|
|
14
|
-
<
|
|
14
|
+
<div class="text-[var(--bd)]" aria-hidden="true">★★★★★</div>
|
|
15
|
+
<div
|
|
15
16
|
style:width={pct}
|
|
16
|
-
class="absolute inset-0 overflow-hidden
|
|
17
|
-
aria-hidden="true"
|
|
17
|
+
class="absolute inset-0 overflow-hidden text-[var(--primary-strong)]"
|
|
18
|
+
aria-hidden="true"
|
|
18
19
|
>
|
|
19
|
-
|
|
20
|
-
|
|
20
|
+
★★★★★
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|