Add OTP-first customer signup and product catalog PDF field.
Registration collects name and phone, verifies SMS, then asks for a password only for new Meshkee accounts. Product add/edit supports an optional catalog PDF. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
co-authored by
Cursor
parent
e2950fa20e
commit
6d85a217e1
@@ -108,6 +108,23 @@ export async function uploadMediaFiles(
|
||||
}))
|
||||
}
|
||||
|
||||
const CATALOG_PDF_MAX_BYTES = 2 * 1024 * 1024
|
||||
|
||||
export async function uploadCatalogPdf(file: File, signal?: AbortSignal) {
|
||||
if (file.type !== 'application/pdf' && !file.name.toLowerCase().endsWith('.pdf')) {
|
||||
throw new Error('Catalog file must be a PDF')
|
||||
}
|
||||
if (file.size > CATALOG_PDF_MAX_BYTES) {
|
||||
throw new Error('Catalog PDF must be 2MB or smaller')
|
||||
}
|
||||
const uploaded = await uploadMediaFiles([file], signal)
|
||||
const item = uploaded[0]
|
||||
if (!item) {
|
||||
throw new Error('Catalog upload failed')
|
||||
}
|
||||
return item
|
||||
}
|
||||
|
||||
export async function resolveDataUrlToMediaId(
|
||||
value: string | null,
|
||||
filename: string,
|
||||
|
||||
@@ -31,6 +31,9 @@ export interface ProductApi {
|
||||
seoMetaDescription?: string | null
|
||||
thumbnailUrl: string | null
|
||||
thumbnailMediaId: string | null
|
||||
catalogMediaId: string | null
|
||||
catalogUrl: string | null
|
||||
catalogFileName: string | null
|
||||
image: string
|
||||
thumbnail: string
|
||||
images: { mediaId: string; url: string }[]
|
||||
@@ -58,6 +61,7 @@ export interface CreateProductPayload {
|
||||
brandId?: string
|
||||
status?: 'draft' | 'published' | 'archived'
|
||||
featuredMediaId?: string
|
||||
catalogMediaId?: string
|
||||
galleryMediaIds?: string[]
|
||||
tags?: string[]
|
||||
seoMetaTitle?: string | null
|
||||
@@ -73,6 +77,7 @@ export interface UpdateProductPayload {
|
||||
brandId?: string | null
|
||||
status?: 'draft' | 'published' | 'archived'
|
||||
featuredMediaId?: string | null
|
||||
catalogMediaId?: string | null
|
||||
galleryMediaIds?: string[]
|
||||
tags?: string[]
|
||||
seoMetaTitle?: string | null
|
||||
@@ -155,6 +160,9 @@ export function mapProductApiToFormState(product: ProductApi) {
|
||||
seoMetaDescription: product.seoMetaDescription ?? '',
|
||||
thumbnailMediaId: product.thumbnailMediaId,
|
||||
galleryMediaIds: product.galleryMediaIds,
|
||||
catalogMediaId: product.catalogMediaId,
|
||||
catalogUrl: product.catalogUrl,
|
||||
catalogFileName: product.catalogFileName,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user