create-nymbal-app 0.4.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +2 -1
- package/dist/index.js +14 -5
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
- package/scaffold/project/astro/src/pages/index.astro +13 -15
- package/scaffold/templates/astro/_dot.node-version +1 -1
- package/scaffold/templates/astro/astro.config.mjs +23 -0
- package/scaffold/templates/astro/package.json +26 -26
- package/scaffold/templates/astro/src/components/SkipNav.astro +3 -1
- package/scaffold/templates/astro/src/elements/index.ts +11 -0
- package/scaffold/templates/astro/src/layouts/BaseLayout.astro +15 -4
- package/scaffold/templates/astro/src/lib/api.ts +162 -38
- package/scaffold/templates/astro/src/lib/chrome.ts +59 -0
- package/scaffold/templates/astro/src/lib/client.ts +4 -4
- package/scaffold/templates/astro/src/lib/fragments.ts +48 -0
- package/scaffold/templates/astro/src/lib/server-elements.ts +5 -0
- package/scaffold/templates/astro/src/middleware.ts +37 -0
- package/scaffold/templates/astro/src/pages/404.astro +3 -0
- package/scaffold/templates/astro/src/pages/account/addresses.astro +5 -97
- package/scaffold/templates/astro/src/pages/account/login.astro +7 -34
- package/scaffold/templates/astro/src/pages/account/orders/[orderNumber].astro +11 -3
- package/scaffold/templates/astro/src/pages/account/profile.astro +6 -56
- package/scaffold/templates/astro/src/pages/account/register.astro +7 -73
- package/scaffold/templates/astro/src/pages/alerts/confirm.astro +59 -0
- package/scaffold/templates/astro/src/pages/alerts/unsubscribe.astro +53 -0
- package/scaffold/templates/astro/src/pages/cart.astro +14 -7
- package/scaffold/templates/astro/src/pages/category/[slug].astro +25 -27
- package/scaffold/templates/astro/src/pages/checkout.astro +30 -94
- package/scaffold/templates/astro/src/pages/fragments/footer.astro +5 -2
- package/scaffold/templates/astro/src/pages/fragments/header.astro +12 -2
- package/scaffold/templates/astro/src/pages/fragments/nav.astro +8 -5
- package/scaffold/templates/astro/src/pages/fragments/product/[slug].astro +9 -10
- package/scaffold/templates/astro/src/pages/index.astro +25 -15
- package/scaffold/templates/astro/src/pages/order/[orderNumber].astro +34 -45
- package/scaffold/templates/astro/src/pages/product/[slug].astro +64 -34
- package/scaffold/templates/astro/src/pages/products/index.astro +16 -21
- package/scaffold/templates/astro/src/pages/search.astro +10 -11
- package/scaffold/templates/astro/src/scripts/init-client.ts +14 -0
- package/scaffold/templates/astro/src/scripts/order-status.ts +3 -1
- package/scaffold/templates/astro/src/scripts/pdp.ts +29 -21
- package/scaffold/templates/astro/src/scripts/plp.ts +15 -93
- package/scaffold/templates/astro/src/scripts/search.ts +7 -132
- package/scaffold/templates/astro/src/scripts/signed-in-redirect.ts +4 -0
- package/scaffold/templates/astro/src/styles/global.css +49 -45
- package/scaffold/templates/astro/src/styles/pages/account.css +4 -90
- package/scaffold/templates/astro/src/styles/pages/confirmation.css +6 -0
- package/scaffold/templates/astro/src/styles/pages/home.css +9 -100
- package/scaffold/templates/astro/src/styles/pages/pdp.css +5 -171
- package/scaffold/templates/astro/src/styles/pages/plp.css +3 -42
- package/scaffold/templates/astro/src/styles/pages/search.css +4 -110
- package/scaffold/templates/astro/src/styles/tokens.css +56 -0
- package/scaffold/templates/nextjs/_dot.node-version +1 -1
- package/scaffold/templates/nextjs/app/(catalog)/category/[slug]/page.tsx +74 -0
- package/scaffold/templates/nextjs/app/(catalog)/home/[key]/page.tsx +85 -0
- package/scaffold/templates/nextjs/app/(catalog)/layout.tsx +13 -0
- package/scaffold/templates/nextjs/app/(catalog)/not-found.tsx +7 -0
- package/scaffold/templates/nextjs/app/(catalog)/product/[slug]/page.tsx +201 -0
- package/scaffold/templates/nextjs/app/(catalog)/products/page.tsx +62 -0
- package/scaffold/templates/nextjs/app/(catalog)/search/SearchView.tsx +90 -0
- package/scaffold/templates/nextjs/app/(catalog)/search/page.tsx +46 -0
- package/scaffold/templates/nextjs/app/(shopper)/account/addresses/AddressesView.tsx +5 -0
- package/scaffold/templates/nextjs/app/(shopper)/account/addresses/page.tsx +17 -0
- package/scaffold/templates/nextjs/app/(shopper)/account/login/LoginView.tsx +28 -0
- package/scaffold/templates/nextjs/app/(shopper)/account/login/page.tsx +23 -0
- package/scaffold/templates/nextjs/app/{account → (shopper)/account}/orders/[orderNumber]/page.tsx +10 -3
- package/scaffold/templates/nextjs/app/(shopper)/account/profile/ProfileView.tsx +5 -0
- package/scaffold/templates/nextjs/app/(shopper)/account/profile/page.tsx +20 -0
- package/scaffold/templates/nextjs/app/(shopper)/account/register/RegisterView.tsx +26 -0
- package/scaffold/templates/nextjs/app/(shopper)/account/register/page.tsx +11 -0
- package/scaffold/templates/nextjs/app/(shopper)/alerts/AlertLinkForm.tsx +90 -0
- package/scaffold/templates/nextjs/app/(shopper)/alerts/LinkInvalid.tsx +19 -0
- package/scaffold/templates/nextjs/app/(shopper)/alerts/actions.ts +33 -0
- package/scaffold/templates/nextjs/app/(shopper)/alerts/confirm/page.tsx +19 -0
- package/scaffold/templates/nextjs/app/(shopper)/alerts/unsubscribe/page.tsx +17 -0
- package/scaffold/templates/nextjs/app/(shopper)/cart/CartView.tsx +5 -0
- package/scaffold/templates/nextjs/app/(shopper)/cart/page.tsx +22 -0
- package/scaffold/templates/nextjs/app/(shopper)/checkout/CheckoutView.tsx +34 -0
- package/scaffold/templates/nextjs/app/(shopper)/checkout/page.tsx +39 -0
- package/scaffold/templates/nextjs/app/(shopper)/layout.tsx +12 -0
- package/scaffold/templates/nextjs/app/(shopper)/not-found.tsx +6 -0
- package/scaffold/templates/nextjs/app/{order → (shopper)/order}/[orderNumber]/page.tsx +44 -9
- package/scaffold/templates/nextjs/app/error.tsx +3 -7
- package/scaffold/templates/nextjs/app/fragments/footer/route.ts +13 -0
- package/scaffold/templates/nextjs/app/fragments/header/[key]/route.ts +18 -0
- package/scaffold/templates/nextjs/app/fragments/nav/[key]/route.ts +23 -0
- package/scaffold/templates/nextjs/app/fragments/product/[slug]/route.ts +22 -0
- package/scaffold/templates/nextjs/app/globals.css +5 -23
- package/scaffold/templates/nextjs/app/layout.tsx +8 -5
- package/scaffold/templates/nextjs/app/not-found.tsx +9 -33
- package/scaffold/templates/nextjs/app/tokens.css +56 -0
- package/scaffold/templates/nextjs/components/client/ListingControls.tsx +87 -0
- package/scaffold/templates/nextjs/components/client/NymbalSetup.tsx +48 -6
- package/scaffold/templates/nextjs/components/client/OrderStatusRefresh.tsx +8 -2
- package/scaffold/templates/nextjs/components/client/ProductInteractive.tsx +47 -15
- package/scaffold/templates/nextjs/components/client/elements.tsx +17 -0
- package/scaffold/templates/nextjs/components/server/Header.tsx +33 -102
- package/scaffold/templates/nextjs/components/server/NotFoundView.tsx +39 -0
- package/scaffold/templates/nextjs/components/server/SkipNav.tsx +7 -3
- package/scaffold/templates/nextjs/elements/index.ts +12 -0
- package/scaffold/templates/nextjs/lib/api.ts +198 -62
- package/scaffold/templates/nextjs/lib/chrome.ts +40 -0
- package/scaffold/templates/nextjs/lib/fragments.ts +16 -0
- package/scaffold/templates/nextjs/lib/header.ts +39 -0
- package/scaffold/templates/nextjs/lib/render.ts +14 -0
- package/scaffold/templates/nextjs/next.config.mjs +41 -0
- package/scaffold/templates/nextjs/package.json +28 -27
- package/scaffold/templates/nextjs/styles/pages/account.module.css +0 -70
- package/scaffold/templates/nextjs/styles/pages/confirmation.module.css +6 -85
- package/scaffold/templates/nextjs/styles/pages/home.module.css +2 -103
- package/scaffold/templates/nextjs/styles/pages/pdp.module.css +3 -183
- package/scaffold/templates/nextjs/styles/pages/plp.module.css +9 -143
- package/scaffold/templates/nextjs/styles/pages/search.module.css +1 -145
- package/scaffold/templates/nextjs/tsconfig.dist.json +5 -0
- package/scaffold/templates/astro/src/components/AddressForm.astro +0 -107
- package/scaffold/templates/astro/src/components/Breadcrumb.astro +0 -20
- package/scaffold/templates/astro/src/components/CategoryNav.astro +0 -27
- package/scaffold/templates/astro/src/components/CheckoutSteps.astro +0 -29
- package/scaffold/templates/astro/src/components/Footer.astro +0 -108
- package/scaffold/templates/astro/src/components/Header.astro +0 -198
- package/scaffold/templates/astro/src/components/ImageGallery.astro +0 -42
- package/scaffold/templates/astro/src/components/OrderSummary.astro +0 -53
- package/scaffold/templates/astro/src/components/Pagination.astro +0 -13
- package/scaffold/templates/astro/src/components/PriceDisplay.astro +0 -25
- package/scaffold/templates/astro/src/components/ProductCard.astro +0 -44
- package/scaffold/templates/astro/src/components/RelatedProducts.astro +0 -28
- package/scaffold/templates/astro/src/components/ReviewForm.astro +0 -74
- package/scaffold/templates/astro/src/components/ReviewList.astro +0 -41
- package/scaffold/templates/astro/src/components/StockBadge.astro +0 -15
- package/scaffold/templates/astro/src/scripts/auth-forms.ts +0 -82
- package/scaffold/templates/astro/src/scripts/cart-page.ts +0 -118
- package/scaffold/templates/astro/src/scripts/checkout.ts +0 -271
- package/scaffold/templates/astro/src/scripts/image-gallery.ts +0 -22
- package/scaffold/templates/astro/src/scripts/profile-form.ts +0 -57
- package/scaffold/templates/astro/src/scripts/review-form.ts +0 -27
- package/scaffold/templates/astro/src/styles/pages/cart.css +0 -215
- package/scaffold/templates/astro/src/styles/pages/checkout.css +0 -270
- package/scaffold/templates/nextjs/app/account/addresses/page.tsx +0 -10
- package/scaffold/templates/nextjs/app/account/login/page.tsx +0 -23
- package/scaffold/templates/nextjs/app/account/profile/page.tsx +0 -10
- package/scaffold/templates/nextjs/app/account/register/page.tsx +0 -10
- package/scaffold/templates/nextjs/app/cart/page.tsx +0 -10
- package/scaffold/templates/nextjs/app/category/[slug]/page.tsx +0 -61
- package/scaffold/templates/nextjs/app/checkout/page.tsx +0 -17
- package/scaffold/templates/nextjs/app/page.tsx +0 -63
- package/scaffold/templates/nextjs/app/product/[slug]/page.tsx +0 -111
- package/scaffold/templates/nextjs/app/products/page.tsx +0 -40
- package/scaffold/templates/nextjs/app/search/page.tsx +0 -24
- package/scaffold/templates/nextjs/components/client/AddressManager.tsx +0 -181
- package/scaffold/templates/nextjs/components/client/CartPage.tsx +0 -121
- package/scaffold/templates/nextjs/components/client/CheckoutForm.tsx +0 -482
- package/scaffold/templates/nextjs/components/client/ImageGallery.tsx +0 -68
- package/scaffold/templates/nextjs/components/client/LoginForm.tsx +0 -89
- package/scaffold/templates/nextjs/components/client/MiniCartWrapper.tsx +0 -12
- package/scaffold/templates/nextjs/components/client/ProductGrid.tsx +0 -137
- package/scaffold/templates/nextjs/components/client/ProfileForm.tsx +0 -112
- package/scaffold/templates/nextjs/components/client/RegisterForm.tsx +0 -131
- package/scaffold/templates/nextjs/components/client/ReviewForm.tsx +0 -116
- package/scaffold/templates/nextjs/components/client/SearchBarWrapper.tsx +0 -27
- package/scaffold/templates/nextjs/components/client/SearchResults.tsx +0 -181
- package/scaffold/templates/nextjs/components/server/Breadcrumb.tsx +0 -36
- package/scaffold/templates/nextjs/components/server/CategoryNav.tsx +0 -29
- package/scaffold/templates/nextjs/components/server/CheckoutSteps.tsx +0 -60
- package/scaffold/templates/nextjs/components/server/Footer.module.css +0 -64
- package/scaffold/templates/nextjs/components/server/Footer.tsx +0 -79
- package/scaffold/templates/nextjs/components/server/Header.module.css +0 -147
- package/scaffold/templates/nextjs/components/server/OrderSummary.tsx +0 -79
- package/scaffold/templates/nextjs/components/server/PriceDisplay.tsx +0 -31
- package/scaffold/templates/nextjs/components/server/ProductCard.tsx +0 -59
- package/scaffold/templates/nextjs/components/server/RelatedProducts.tsx +0 -31
- package/scaffold/templates/nextjs/components/server/ReviewList.tsx +0 -62
- package/scaffold/templates/nextjs/styles/pages/cart.module.css +0 -240
- package/scaffold/templates/nextjs/styles/pages/checkout.module.css +0 -404
- /package/scaffold/templates/nextjs/app/{account → (shopper)/account}/layout.tsx +0 -0
- /package/scaffold/templates/nextjs/app/{account → (shopper)/account}/orders/page.tsx +0 -0
- /package/scaffold/templates/nextjs/app/{account → (shopper)/account}/page.tsx +0 -0
|
@@ -1,10 +1,63 @@
|
|
|
1
|
+
import { cache } from 'react'
|
|
1
2
|
import { unstable_rethrow } from 'next/navigation'
|
|
2
|
-
import type {
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import type {
|
|
4
|
+
DenormalisedProduct,
|
|
5
|
+
ProductListResult,
|
|
6
|
+
ProductSearchResult,
|
|
7
|
+
ReviewsListResult,
|
|
8
|
+
} from '@nymbalhq/sdk'
|
|
9
|
+
import { DEFAULT_PRODUCT_SORT, ORDER_KEY_HEADER, PRODUCT_SORT_KEYS } from '@nymbalhq/types'
|
|
10
|
+
import type {
|
|
11
|
+
AlertKind,
|
|
12
|
+
Cart,
|
|
13
|
+
Category,
|
|
14
|
+
ProductSortKey,
|
|
15
|
+
ShopperOrder,
|
|
16
|
+
StoreCapabilities,
|
|
17
|
+
} from '@nymbalhq/types'
|
|
5
18
|
|
|
6
19
|
const API_URL = process.env.NYMBAL_API_URL ?? 'http://localhost:3001'
|
|
7
20
|
|
|
21
|
+
/**
|
|
22
|
+
* Seconds a catalog read stays in Next's data cache: each is at least the TTL of the longest route that reads it, since
|
|
23
|
+
* a route's TTL is the smallest of its segment's and its fetches'. NYMBAL_CATALOG_REVALIDATE_S replaces every one.
|
|
24
|
+
*/
|
|
25
|
+
const CATALOG_REVALIDATE_S = {
|
|
26
|
+
capabilities: 3600,
|
|
27
|
+
categories: 21600,
|
|
28
|
+
product: 300,
|
|
29
|
+
products: 300,
|
|
30
|
+
reviews: 60,
|
|
31
|
+
} as const
|
|
32
|
+
|
|
33
|
+
function revalidateOf(read: keyof typeof CATALOG_REVALIDATE_S, seconds?: number): number {
|
|
34
|
+
const override = Number(process.env.NYMBAL_CATALOG_REVALIDATE_S)
|
|
35
|
+
if (Number.isInteger(override) && override > 0) return override
|
|
36
|
+
return seconds ?? CATALOG_REVALIDATE_S[read]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* A catalog read through Next's data cache. It resolves a 200 or a 404 (an answer about the data, which the caller
|
|
41
|
+
* reads); a network error, a 5xx or any other refusal (a rate limit's 429) rejects, so a failed first render is an
|
|
42
|
+
* error Next does not cache and a failed regeneration keeps the last good page, where an empty value would be cached
|
|
43
|
+
* for every shopper. `next dev` caches no page but still keeps fetches, so there the read is fresh and a catalog edit
|
|
44
|
+
* shows at once.
|
|
45
|
+
*/
|
|
46
|
+
async function catalogFetch(
|
|
47
|
+
url: string,
|
|
48
|
+
read: keyof typeof CATALOG_REVALIDATE_S,
|
|
49
|
+
seconds?: number,
|
|
50
|
+
): Promise<Response> {
|
|
51
|
+
const res = await fetch(
|
|
52
|
+
url,
|
|
53
|
+
process.env.NODE_ENV === 'development'
|
|
54
|
+
? { cache: 'no-store' }
|
|
55
|
+
: { next: { revalidate: revalidateOf(read, seconds) } },
|
|
56
|
+
)
|
|
57
|
+
if (!res.ok && res.status !== 404) throw new Error(`[api] GET ${url} answered ${res.status}`)
|
|
58
|
+
return res
|
|
59
|
+
}
|
|
60
|
+
|
|
8
61
|
export async function fetchProducts(params?: {
|
|
9
62
|
limit?: number
|
|
10
63
|
cursor?: string
|
|
@@ -17,30 +70,18 @@ export async function fetchProducts(params?: {
|
|
|
17
70
|
if (params?.category) url.searchParams.set('category', params.category)
|
|
18
71
|
if (params?.sort) url.searchParams.set('sort', params.sort)
|
|
19
72
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return envelope.data ?? { items: [], nextCursor: null }
|
|
25
|
-
} catch (err) {
|
|
26
|
-
console.error('[api] fetchProducts failed', err)
|
|
27
|
-
return { items: [], nextCursor: null }
|
|
28
|
-
}
|
|
73
|
+
const res = await catalogFetch(url.toString(), 'products')
|
|
74
|
+
if (!res.ok) return { items: [], nextCursor: null }
|
|
75
|
+
const envelope = (await res.json()) as { data: ProductListResult }
|
|
76
|
+
return envelope.data ?? { items: [], nextCursor: null }
|
|
29
77
|
}
|
|
30
78
|
|
|
31
|
-
/** What the store can do, which decides what the page renders; null when the API
|
|
79
|
+
/** What the store can do, which decides what the page renders; null when the API has no capabilities to report. */
|
|
32
80
|
export async function fetchCapabilities(): Promise<StoreCapabilities | null> {
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
return envelope.data ?? null
|
|
38
|
-
} catch (err) {
|
|
39
|
-
// Next signals a request-time render by throwing from fetch at build; that must reach Next, not become null.
|
|
40
|
-
unstable_rethrow(err)
|
|
41
|
-
console.error('[api] fetchCapabilities failed', err)
|
|
42
|
-
return null
|
|
43
|
-
}
|
|
81
|
+
const res = await catalogFetch(`${API_URL}/api/capabilities`, 'capabilities')
|
|
82
|
+
if (!res.ok) return null
|
|
83
|
+
const envelope = (await res.json()) as { data: StoreCapabilities }
|
|
84
|
+
return envelope.data ?? null
|
|
44
85
|
}
|
|
45
86
|
|
|
46
87
|
/** The sort a listing URL asks for, among the store's keys; a missing or unknown `?sort=` is the store's default. */
|
|
@@ -53,57 +94,152 @@ export function sortFromSearchParams(
|
|
|
53
94
|
return keys.find((key) => key === sort) ?? catalog?.defaultSort ?? DEFAULT_PRODUCT_SORT
|
|
54
95
|
}
|
|
55
96
|
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
}
|
|
97
|
+
/**
|
|
98
|
+
* The product, or null when the API has none by that slug (a 404, the only answer that is null). `revalidateS` is the
|
|
99
|
+
* caller's route TTL when it is shorter than the default: callers share one data-cache entry, and Next judges its
|
|
100
|
+
* staleness by each caller's own seconds, so the PDP's 60 s regeneration reads stock no older than 60 s.
|
|
101
|
+
*/
|
|
102
|
+
export async function fetchProduct(
|
|
103
|
+
slug: string,
|
|
104
|
+
revalidateS?: number,
|
|
105
|
+
): Promise<DenormalisedProduct | null> {
|
|
106
|
+
const url = `${API_URL}/api/products/${encodeURIComponent(slug)}`
|
|
107
|
+
const res = await catalogFetch(url, 'product', revalidateS)
|
|
108
|
+
if (res.status === 404) return null
|
|
109
|
+
const envelope = (await res.json()) as { data: DenormalisedProduct }
|
|
110
|
+
return envelope.data ?? null
|
|
66
111
|
}
|
|
67
112
|
|
|
68
|
-
|
|
69
|
-
{ id: 'cat_apparel', parentId: null, name: 'Apparel', slug: 'apparel', description: 'Clothing and accessories', position: 0, createdAt: '2024-01-01T00:00:00Z' },
|
|
70
|
-
{ id: 'cat_home', parentId: null, name: 'Home', slug: 'home', description: 'Home goods and decor', position: 1, createdAt: '2024-01-01T00:00:00Z' },
|
|
71
|
-
{ id: 'cat_electronics', parentId: null, name: 'Electronics', slug: 'electronics', description: 'Gadgets and devices', position: 2, createdAt: '2024-01-01T00:00:00Z' },
|
|
72
|
-
{ id: 'cat_books', parentId: null, name: 'Books', slug: 'books', description: 'Books and reading', position: 3, createdAt: '2024-01-01T00:00:00Z' },
|
|
73
|
-
]
|
|
74
|
-
|
|
113
|
+
/** The store's categories as the API lists them; never a list of its own, which a cached page would then show. */
|
|
75
114
|
export async function fetchCategories(): Promise<Category[]> {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
115
|
+
const url = `${API_URL}/api/categories`
|
|
116
|
+
const res = await catalogFetch(url, 'categories')
|
|
117
|
+
if (!res.ok) throw new Error(`[api] GET ${url} answered ${res.status}`)
|
|
118
|
+
const envelope = (await res.json()) as { data: Category[] }
|
|
119
|
+
return envelope.data
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* The order its key opens, `key` being the confirmation URL's `?key=`. Null on a 404, which the API answers alike for
|
|
124
|
+
* an unknown number and for an order read without its key; rejects when the API fails, so the order page's failed read
|
|
125
|
+
* is a 500 and never a not-found page for an order the shopper has. The key goes in a header, never in the API's URL.
|
|
126
|
+
*/
|
|
127
|
+
export async function loadOrder(orderNumber: string, key?: string): Promise<ShopperOrder | null> {
|
|
128
|
+
const url = `${API_URL}/api/orders/${encodeURIComponent(orderNumber)}`
|
|
129
|
+
const res = await fetch(url, {
|
|
130
|
+
cache: 'no-store',
|
|
131
|
+
headers: key ? { [ORDER_KEY_HEADER]: key } : {},
|
|
132
|
+
})
|
|
133
|
+
if (res.status === 404) return null
|
|
134
|
+
if (!res.ok) throw new Error(`[api] GET ${url} answered ${res.status}`)
|
|
135
|
+
const envelope = (await res.json()) as { data?: ShopperOrder | null }
|
|
136
|
+
if (!envelope.data) throw new Error(`[api] GET ${url} answered no data`)
|
|
137
|
+
return envelope.data
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
export async function fetchReviews(productId: string): Promise<ReviewsListResult> {
|
|
141
|
+
const res = await catalogFetch(
|
|
142
|
+
`${API_URL}/api/products/${encodeURIComponent(productId)}/reviews`,
|
|
143
|
+
'reviews',
|
|
144
|
+
)
|
|
145
|
+
if (!res.ok) return { items: [], nextCursor: null }
|
|
146
|
+
const envelope = (await res.json()) as { data: ReviewsListResult }
|
|
147
|
+
return envelope.data ?? { items: [], nextCursor: null }
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** The cart the cart elements take as their `cart` attribute: its lines and sums, never the cart token. */
|
|
151
|
+
export interface CartProjection {
|
|
152
|
+
items: Cart['items']
|
|
153
|
+
subtotalMinor: number
|
|
154
|
+
currency: string
|
|
155
|
+
itemCount: number
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const CART_COOKIE = 'nymbal.cart'
|
|
159
|
+
|
|
160
|
+
/** The `nymbal.cart` value in a request's Cookie header, or null. */
|
|
161
|
+
function cartToken(cookie: string | null): string | null {
|
|
162
|
+
for (const pair of (cookie ?? '').split(';')) {
|
|
163
|
+
const [name, ...value] = pair.trim().split('=')
|
|
164
|
+
if (name === CART_COOKIE && value.length > 0) return value.join('=')
|
|
84
165
|
}
|
|
166
|
+
return null
|
|
85
167
|
}
|
|
86
168
|
|
|
87
|
-
|
|
169
|
+
/**
|
|
170
|
+
* The shopper's cart, read with the request's `nymbal.cart` cookie, as the projection the elements take; once per
|
|
171
|
+
* request, however many server components ask. Null without the cookie: `GET /api/cart` with none would make a cart
|
|
172
|
+
* the page could not keep, so the element renders its shell and the browser fills it. The cookie reaches this server
|
|
173
|
+
* when the store and the API share a host or a proxy.
|
|
174
|
+
*/
|
|
175
|
+
export const fetchCart = cache(async (cookie: string | null): Promise<CartProjection | null> => {
|
|
176
|
+
const token = cartToken(cookie)
|
|
177
|
+
if (token === null) return null
|
|
88
178
|
try {
|
|
89
|
-
const res = await fetch(`${API_URL}/api/
|
|
179
|
+
const res = await fetch(`${API_URL}/api/cart`, {
|
|
180
|
+
cache: 'no-store',
|
|
181
|
+
headers: { Cookie: `${CART_COOKIE}=${token}` },
|
|
182
|
+
})
|
|
90
183
|
if (!res.ok) return null
|
|
91
|
-
const
|
|
92
|
-
return
|
|
184
|
+
const { items, subtotalMinor, currency } = ((await res.json()) as { data: Cart }).data
|
|
185
|
+
return {
|
|
186
|
+
items,
|
|
187
|
+
subtotalMinor,
|
|
188
|
+
currency,
|
|
189
|
+
itemCount: items.reduce((n, item) => n + item.qty, 0),
|
|
190
|
+
}
|
|
93
191
|
} catch (err) {
|
|
94
|
-
|
|
192
|
+
unstable_rethrow(err)
|
|
193
|
+
console.error('[api] fetchCart failed', err)
|
|
95
194
|
return null
|
|
96
195
|
}
|
|
97
|
-
}
|
|
196
|
+
})
|
|
98
197
|
|
|
99
|
-
|
|
198
|
+
/** The search the search page shows for `q` (and its category), as the search store would hold it. */
|
|
199
|
+
export async function fetchSearch(
|
|
200
|
+
q: string,
|
|
201
|
+
category: string | null,
|
|
202
|
+
): Promise<ProductSearchResult | null> {
|
|
203
|
+
const url = new URL('/api/products/search', API_URL)
|
|
204
|
+
url.searchParams.set('q', q)
|
|
205
|
+
if (category) url.searchParams.set('category', category)
|
|
100
206
|
try {
|
|
101
|
-
const res = await fetch(
|
|
102
|
-
if (!res.ok) return
|
|
103
|
-
|
|
104
|
-
return envelope.data ?? { items: [], nextCursor: null }
|
|
207
|
+
const res = await fetch(url.toString(), { cache: 'no-store' })
|
|
208
|
+
if (!res.ok) return null
|
|
209
|
+
return ((await res.json()) as { data: ProductSearchResult }).data ?? null
|
|
105
210
|
} catch (err) {
|
|
106
|
-
|
|
107
|
-
|
|
211
|
+
unstable_rethrow(err)
|
|
212
|
+
console.error('[api] fetchSearch failed', err)
|
|
213
|
+
return null
|
|
108
214
|
}
|
|
109
215
|
}
|
|
216
|
+
|
|
217
|
+
/** An alert link's token posted to the API from this server; null when the API refuses the link (404, or 400). */
|
|
218
|
+
async function postAlertToken<T>(path: string, token: string): Promise<T | null> {
|
|
219
|
+
const res = await fetch(`${API_URL}${path}`, {
|
|
220
|
+
method: 'POST',
|
|
221
|
+
headers: { 'content-type': 'application/json', accept: 'application/json' },
|
|
222
|
+
body: JSON.stringify({ token }),
|
|
223
|
+
cache: 'no-store',
|
|
224
|
+
})
|
|
225
|
+
if (res.status === 404 || res.status === 400) return null
|
|
226
|
+
if (!res.ok) throw new Error(`[api] POST ${path} answered ${res.status}`)
|
|
227
|
+
return ((await res.json()) as { data: T }).data
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
export interface AlertConfirmation {
|
|
231
|
+
kind: AlertKind
|
|
232
|
+
product: { name: string; slug: string }
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
/** Confirms the alert a confirmation email's link names; null when the link is not valid; rejects when the API fails. */
|
|
236
|
+
export function confirmAlert(token: string): Promise<AlertConfirmation | null> {
|
|
237
|
+
return postAlertToken<AlertConfirmation>('/api/alerts/confirm', token)
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
/** Stops the alert an email's unsubscribe link names; false when the link is not valid; rejects when the API fails. */
|
|
241
|
+
export async function unsubscribeAlert(token: string): Promise<boolean> {
|
|
242
|
+
return (
|
|
243
|
+
(await postAlertToken<{ status: 'unsubscribed' }>('/api/alerts/unsubscribe', token)) !== null
|
|
244
|
+
)
|
|
245
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
// The store's header and footer, rendered by nymbal-site-header and nymbal-site-footer: edit the links here.
|
|
2
|
+
|
|
3
|
+
export const HEADER = {
|
|
4
|
+
logo: 'Nymbal',
|
|
5
|
+
accountHref: '/account',
|
|
6
|
+
links: [
|
|
7
|
+
{ href: '/products', label: 'Shop' },
|
|
8
|
+
{ href: '/products?category=new', label: 'New Arrivals' },
|
|
9
|
+
{ href: '/products?category=sale', label: 'Sale' },
|
|
10
|
+
],
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export const FOOTER_COLUMNS = [
|
|
14
|
+
{
|
|
15
|
+
heading: 'Shop',
|
|
16
|
+
links: [
|
|
17
|
+
{ href: '/products', label: 'All Products' },
|
|
18
|
+
{ href: '/products?category=new', label: 'New Arrivals' },
|
|
19
|
+
{ href: '/products?category=sale', label: 'Sale' },
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
heading: 'Account',
|
|
24
|
+
links: [
|
|
25
|
+
{ href: '/account', label: 'My Account' },
|
|
26
|
+
{ href: '/account/orders', label: 'Order History' },
|
|
27
|
+
{ href: '/account/login', label: 'Sign In' },
|
|
28
|
+
{ href: '/account/register', label: 'Create Account' },
|
|
29
|
+
],
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
heading: 'About',
|
|
33
|
+
links: [
|
|
34
|
+
{ href: '/about', label: 'About Us' },
|
|
35
|
+
{ href: '/contact', label: 'Contact' },
|
|
36
|
+
{ href: '/shipping', label: 'Shipping & Returns' },
|
|
37
|
+
{ href: '/privacy', label: 'Privacy Policy' },
|
|
38
|
+
],
|
|
39
|
+
},
|
|
40
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// The fragment routes answer one element as the server renders it, the same as the pages carry, for a CDN to cache
|
|
2
|
+
// and an edge to assemble. Next sets each 200's Cache-Control from the route's TTL; a fragment reads no request, so it
|
|
3
|
+
// is the same for every shopper.
|
|
4
|
+
|
|
5
|
+
/** A fragment's HTML. It has no <meta charset>, so the charset is in the header. */
|
|
6
|
+
export function fragment(html: string): Response {
|
|
7
|
+
return new Response(html, { headers: { 'Content-Type': 'text/html; charset=utf-8' } })
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/** No fragment by that name: Next may hold it for the route's TTL, and `no-store` keeps a CDN from storing it. */
|
|
11
|
+
export function noFragment(): Response {
|
|
12
|
+
return new Response('Not found', {
|
|
13
|
+
status: 404,
|
|
14
|
+
headers: { 'Content-Type': 'text/plain; charset=utf-8', 'Cache-Control': 'no-store' },
|
|
15
|
+
})
|
|
16
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { fetchCapabilities } from '@/lib/api'
|
|
2
|
+
import { HEADER } from '@/lib/chrome'
|
|
3
|
+
import { renderElement } from '@/lib/render'
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* The store's nymbal-site-header as the server renders it: its attributes, and the search bar (when the store searches)
|
|
7
|
+
* and the mini-cart as its light-DOM children, each with the slot it fills. React cannot give children beside the
|
|
8
|
+
* header's server HTML, so they go in that HTML. The mini-cart has a count only on a shopper's own page; a shared,
|
|
9
|
+
* cached header has none.
|
|
10
|
+
*/
|
|
11
|
+
export function siteHeader(
|
|
12
|
+
search: boolean,
|
|
13
|
+
cartCount?: number,
|
|
14
|
+
): { attributes: Record<string, string>; children: string } {
|
|
15
|
+
const miniCart: Record<string, string> = { slot: 'cart' }
|
|
16
|
+
if (cartCount !== undefined) miniCart['count'] = String(cartCount)
|
|
17
|
+
const children = [
|
|
18
|
+
search
|
|
19
|
+
? renderElement('nymbal-search-bar', {
|
|
20
|
+
attributes: { slot: 'search', placeholder: 'Search products...', 'debounce-ms': '300' },
|
|
21
|
+
})
|
|
22
|
+
: '',
|
|
23
|
+
renderElement('nymbal-mini-cart', { attributes: miniCart }),
|
|
24
|
+
].join('')
|
|
25
|
+
return {
|
|
26
|
+
attributes: {
|
|
27
|
+
links: JSON.stringify(HEADER.links),
|
|
28
|
+
logo: HEADER.logo,
|
|
29
|
+
'account-href': HEADER.accountHref,
|
|
30
|
+
},
|
|
31
|
+
children,
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/** Whether the store searches, which puts the search bar in the header. */
|
|
36
|
+
export async function canSearch(): Promise<boolean> {
|
|
37
|
+
const capabilities = await fetchCapabilities()
|
|
38
|
+
return capabilities?.search.capabilities.includes('search') ?? false
|
|
39
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { renderNymbal } from '@nymbalhq/react/server'
|
|
2
|
+
import {
|
|
3
|
+
cardImageOf,
|
|
4
|
+
cardProductOf,
|
|
5
|
+
registerServerElements,
|
|
6
|
+
renderElement,
|
|
7
|
+
} from '@nymbalhq/web-components/ssr'
|
|
8
|
+
import { serverElements } from '@/elements'
|
|
9
|
+
|
|
10
|
+
// Server components only: this loads Lit SSR. The store's own elements render on the server under their tags, as the
|
|
11
|
+
// browser defines them there.
|
|
12
|
+
registerServerElements(serverElements)
|
|
13
|
+
|
|
14
|
+
export { cardImageOf, cardProductOf, renderElement, renderNymbal }
|
|
@@ -1,9 +1,50 @@
|
|
|
1
|
+
import { relative } from 'node:path'
|
|
2
|
+
import { fileURLToPath } from 'node:url'
|
|
3
|
+
|
|
4
|
+
// NYMBAL_ELEMENTS_ENTRY (an absolute path) is the store's elements entry in place of elements/index.ts, on the server
|
|
5
|
+
// and in the browser (the E2E override fixture).
|
|
6
|
+
const elementsEntry = process.env.NYMBAL_ELEMENTS_ENTRY
|
|
7
|
+
const elementsAlias =
|
|
8
|
+
elementsEntry === undefined
|
|
9
|
+
? {}
|
|
10
|
+
: { '@/elements': `./${relative(fileURLToPath(new URL('.', import.meta.url)), elementsEntry)}` }
|
|
11
|
+
|
|
12
|
+
// NYMBAL_NEXT_DIST_DIR builds beside the usual `.next`, so a second build cannot overwrite one being served.
|
|
13
|
+
const distDir = process.env.NYMBAL_NEXT_DIST_DIR || '.next'
|
|
14
|
+
|
|
1
15
|
/** @type {import('next').NextConfig} */
|
|
2
16
|
const nextConfig = {
|
|
3
17
|
reactStrictMode: true,
|
|
18
|
+
distDir,
|
|
19
|
+
...(distDir !== '.next' && { typescript: { tsconfigPath: 'tsconfig.dist.json' } }),
|
|
20
|
+
// Cached pages live in memory, bounded by cacheMaxMemorySize: on disk, every distinct product URL a crawler asks for
|
|
21
|
+
// would keep an entry.
|
|
22
|
+
experimental: { isrFlushToDisk: false },
|
|
23
|
+
// `/` and the header and nav fragments are dynamic segments with no params, so the build prerenders none of them
|
|
24
|
+
// (the API may be down then) and Next caches each on its first request.
|
|
25
|
+
async rewrites() {
|
|
26
|
+
return {
|
|
27
|
+
beforeFiles: [
|
|
28
|
+
{ source: '/', destination: '/home/index' },
|
|
29
|
+
{ source: '/fragments/header', destination: '/fragments/header/index' },
|
|
30
|
+
{ source: '/fragments/nav', destination: '/fragments/nav/index' },
|
|
31
|
+
],
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
// The order page's URL carries the order's key; no request from it, nor from its not-found render, may refer it on.
|
|
35
|
+
async headers() {
|
|
36
|
+
return [
|
|
37
|
+
{
|
|
38
|
+
source: '/order/:orderNumber',
|
|
39
|
+
headers: [{ key: 'Referrer-Policy', value: 'no-referrer' }],
|
|
40
|
+
},
|
|
41
|
+
]
|
|
42
|
+
},
|
|
4
43
|
transpilePackages: ['@nymbalhq/sdk', '@nymbalhq/react', '@nymbalhq/web-components'],
|
|
5
44
|
images: {
|
|
6
45
|
remotePatterns: [{ protocol: 'https', hostname: '**' }],
|
|
7
46
|
},
|
|
47
|
+
turbopack: { resolveAlias: elementsAlias },
|
|
8
48
|
}
|
|
49
|
+
|
|
9
50
|
export default nextConfig
|
|
@@ -17,46 +17,47 @@
|
|
|
17
17
|
"seed": "nymbal seed"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"nymbal": "1.
|
|
21
|
-
"@nymbalhq/config": "1.
|
|
22
|
-
"@nymbalhq/platform": "1.
|
|
23
|
-
"@nymbalhq/stack": "1.
|
|
20
|
+
"nymbal": "1.4.0",
|
|
21
|
+
"@nymbalhq/config": "1.4.0",
|
|
22
|
+
"@nymbalhq/platform": "1.4.0",
|
|
23
|
+
"@nymbalhq/stack": "1.4.0",
|
|
24
24
|
"next": "^16.4.2",
|
|
25
25
|
"react": "^19.3.1",
|
|
26
26
|
"react-dom": "^19.3.1",
|
|
27
|
-
"@nymbalhq/sdk": "1.
|
|
28
|
-
"@nymbalhq/react": "1.
|
|
29
|
-
"@nymbalhq/web-components": "1.
|
|
30
|
-
"@nymbalhq/types": "1.
|
|
27
|
+
"@nymbalhq/sdk": "1.4.0",
|
|
28
|
+
"@nymbalhq/react": "1.4.0",
|
|
29
|
+
"@nymbalhq/web-components": "1.4.0",
|
|
30
|
+
"@nymbalhq/types": "1.4.0"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@types/node": "^22.9.0",
|
|
34
34
|
"@types/react": "^19.3.0",
|
|
35
35
|
"@types/react-dom": "^19.3.0",
|
|
36
|
-
"typescript": "
|
|
36
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
37
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2"
|
|
37
38
|
},
|
|
38
39
|
"pnpm": {
|
|
39
40
|
"overrides": {
|
|
40
|
-
"nymbal": "1.
|
|
41
|
-
"@nymbalhq/config": "1.
|
|
42
|
-
"@nymbalhq/http": "1.
|
|
43
|
-
"@nymbalhq/platform": "1.
|
|
44
|
-
"@nymbalhq/react": "1.
|
|
45
|
-
"@nymbalhq/sdk": "1.
|
|
46
|
-
"@nymbalhq/stack": "1.
|
|
47
|
-
"@nymbalhq/types": "1.
|
|
48
|
-
"@nymbalhq/web-components": "1.
|
|
41
|
+
"nymbal": "1.4.0",
|
|
42
|
+
"@nymbalhq/config": "1.4.0",
|
|
43
|
+
"@nymbalhq/http": "1.4.0",
|
|
44
|
+
"@nymbalhq/platform": "1.4.0",
|
|
45
|
+
"@nymbalhq/react": "1.4.0",
|
|
46
|
+
"@nymbalhq/sdk": "1.4.0",
|
|
47
|
+
"@nymbalhq/stack": "1.4.0",
|
|
48
|
+
"@nymbalhq/types": "1.4.0",
|
|
49
|
+
"@nymbalhq/web-components": "1.4.0"
|
|
49
50
|
}
|
|
50
51
|
},
|
|
51
52
|
"overrides": {
|
|
52
|
-
"nymbal": "1.
|
|
53
|
-
"@nymbalhq/config": "1.
|
|
54
|
-
"@nymbalhq/http": "1.
|
|
55
|
-
"@nymbalhq/platform": "1.
|
|
56
|
-
"@nymbalhq/react": "1.
|
|
57
|
-
"@nymbalhq/sdk": "1.
|
|
58
|
-
"@nymbalhq/stack": "1.
|
|
59
|
-
"@nymbalhq/types": "1.
|
|
60
|
-
"@nymbalhq/web-components": "1.
|
|
53
|
+
"nymbal": "1.4.0",
|
|
54
|
+
"@nymbalhq/config": "1.4.0",
|
|
55
|
+
"@nymbalhq/http": "1.4.0",
|
|
56
|
+
"@nymbalhq/platform": "1.4.0",
|
|
57
|
+
"@nymbalhq/react": "1.4.0",
|
|
58
|
+
"@nymbalhq/sdk": "1.4.0",
|
|
59
|
+
"@nymbalhq/stack": "1.4.0",
|
|
60
|
+
"@nymbalhq/types": "1.4.0",
|
|
61
|
+
"@nymbalhq/web-components": "1.4.0"
|
|
61
62
|
}
|
|
62
63
|
}
|
|
@@ -132,27 +132,6 @@
|
|
|
132
132
|
margin-top: var(--nymbal-spacing-lg);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
-
.saveButton {
|
|
136
|
-
padding: 0.625rem 1.5rem;
|
|
137
|
-
font-size: var(--nymbal-font-size-sm);
|
|
138
|
-
font-weight: var(--nymbal-font-weight-medium);
|
|
139
|
-
color: var(--nymbal-color-text-inverse);
|
|
140
|
-
background-color: var(--nymbal-color-primary);
|
|
141
|
-
border: none;
|
|
142
|
-
border-radius: var(--nymbal-radius-md);
|
|
143
|
-
cursor: pointer;
|
|
144
|
-
transition: background-color var(--nymbal-transition-fast);
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
.saveButton:hover {
|
|
148
|
-
background-color: var(--nymbal-color-primary-hover);
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
.saveButton:disabled {
|
|
152
|
-
opacity: 0.5;
|
|
153
|
-
cursor: not-allowed;
|
|
154
|
-
}
|
|
155
|
-
|
|
156
135
|
.cancelButton {
|
|
157
136
|
padding: 0.625rem 1.5rem;
|
|
158
137
|
font-size: var(--nymbal-font-size-sm);
|
|
@@ -169,27 +148,6 @@
|
|
|
169
148
|
border-color: var(--nymbal-color-primary);
|
|
170
149
|
}
|
|
171
150
|
|
|
172
|
-
/* ── Alert / Success Message ──────────────────────────────────────── */
|
|
173
|
-
|
|
174
|
-
.alert {
|
|
175
|
-
padding: var(--nymbal-spacing-md);
|
|
176
|
-
border-radius: var(--nymbal-radius-md);
|
|
177
|
-
font-size: var(--nymbal-font-size-sm);
|
|
178
|
-
margin-bottom: var(--nymbal-spacing-md);
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
.alertSuccess {
|
|
182
|
-
background-color: #dcfce7;
|
|
183
|
-
color: var(--nymbal-color-success);
|
|
184
|
-
border: 1px solid #bbf7d0;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
.alertError {
|
|
188
|
-
background-color: #fef2f2;
|
|
189
|
-
color: var(--nymbal-color-error);
|
|
190
|
-
border: 1px solid #fecaca;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
151
|
/* ── Order List ───────────────────────────────────────────────────── */
|
|
194
152
|
|
|
195
153
|
.orderList {
|
|
@@ -331,34 +289,6 @@
|
|
|
331
289
|
margin-bottom: var(--nymbal-spacing-lg);
|
|
332
290
|
}
|
|
333
291
|
|
|
334
|
-
.authForm {
|
|
335
|
-
display: flex;
|
|
336
|
-
flex-direction: column;
|
|
337
|
-
gap: var(--nymbal-spacing-md);
|
|
338
|
-
}
|
|
339
|
-
|
|
340
|
-
.authSubmit {
|
|
341
|
-
width: 100%;
|
|
342
|
-
padding: 0.75rem;
|
|
343
|
-
font-size: var(--nymbal-font-size-sm);
|
|
344
|
-
font-weight: var(--nymbal-font-weight-medium);
|
|
345
|
-
color: var(--nymbal-color-text-inverse);
|
|
346
|
-
background-color: var(--nymbal-color-primary);
|
|
347
|
-
border: none;
|
|
348
|
-
border-radius: var(--nymbal-radius-md);
|
|
349
|
-
cursor: pointer;
|
|
350
|
-
transition: background-color var(--nymbal-transition-fast);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
.authSubmit:hover {
|
|
354
|
-
background-color: var(--nymbal-color-primary-hover);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
.authSubmit:disabled {
|
|
358
|
-
opacity: 0.5;
|
|
359
|
-
cursor: not-allowed;
|
|
360
|
-
}
|
|
361
|
-
|
|
362
292
|
.authFooter {
|
|
363
293
|
text-align: center;
|
|
364
294
|
margin-top: var(--nymbal-spacing-md);
|