export const HIDDEN_PRODUCT_TAG = "nextjs-frontend-hidden"; export const DEFAULT_OPTION = "Default Title"; /** * productJsonLd constant */ export const BASE_SCHEMA_URL = "https://schema.org"; export const PRODUCT_TYPE = "Product"; export const PRODUCT_OFFER_TYPE = "AggregateOffer"; /** * cookies constant */ export const TOKEN = "token"; export const BASE_URL = process.env.NEXT_PUBLIC_SITE_URL; export const baseUrl = process.env.NEXT_PUBLIC_BAGISTO_ENDPOINT; // -----Pagination--------// export const PAGE = "page"; export const LIMIT = "limit"; export const LOADING = "loading"; export const QUERY = "q"; export const SORT = "sort"; /** * Placeholder Images */ export const SIGNUP_IMG = "/image/sign-in.webp"; export const SIGNIN_IMG = "/image/login.webp"; export const FORGET_PASSWORD_IMG = "/image/forget-password.webp"; export const NOT_IMAGE = "/image/placeholder.webp"; export const LOGO_IMG = "/image/logo.png"; export const variants = { hidden: { opacity: 0, y: 50 }, visible: { opacity: 1, y: 0 }, }; export function getImageUrl(url?: string, baseUrl?: string, fallback: string = NOT_IMAGE) { if (!url) return fallback; if (url.startsWith("http://") || url.startsWith("https://")) { return url; } return `${baseUrl}${url.startsWith("/") ? url : `/${url}`}`; } export type SortOrderTypes = { key: string; title: string; value: string; sortKey: string; reverse: boolean; }; export const SortByFields: SortOrderTypes[] = [ { key: "name-asc", title: "From A-Z", value: "name-asc", sortKey: "TITLE", reverse: false, }, { key: "name-desc", title: "From Z-A", value: "name-desc", sortKey: "TITLE", reverse: true, }, { key: "newest", title: "Newest First", value: "newest", sortKey: "CREATED_AT", reverse: true, }, { key: "oldest", title: "Oldest First", value: "oldest", sortKey: "CREATED_AT", reverse: false, }, { key: "price-asc", title: "Cheapest First", value: "price-asc", sortKey: "PRICE", reverse: false, }, { key: "price-desc", title: "Expensive First", value: "price-desc", sortKey: "PRICE", reverse: true, }, ]; export const GUEST_CART_TOKEN = "guest_cart_token"; export const GUEST_CART_ID = "guest_cart_id"; export const IS_GUEST = "is_guest"; export const CURRENT_CURRENCY = "current_currency"; export const CURRENT_LOCAL = "current_local"; export const CURRENT_CHANNEL = "current_channel"; export const NEXTAUTH_TOKEN = "next-auth.session-token"; export const NEXTAUTH_SECURE_TOKEN = "__Secure-next-auth.session-token"; export const ORDER_ID = "order_id"; export const EMAIL_REGEX = /^(?![.-])(?!.*[.-]@)(?!.*\.\.)[a-zA-Z0-9._-]+@[a-zA-Z0-9-]+(\.[a-zA-Z]{2,})+$/; export const IS_VALID_INPUT = /^[a-zA-Z0-9\s]*$/; export const IS_VALID_ADDRESS = /^[a-zA-Z0-9\s,\/-]*$/; export const IS_VALID_PHONE = /^[0-9]{10}$/; export const IS_VALID_PHONECODE = /^(\+\d+\s|\+\d+\-\d+\s|\+\d+\-\d+and\d+\-\d+\s)/; // +23 / +1-234 / +1-809and1-829 export const IS_VALID_FULL_PHONE = /^(\+\d+\s|\+\d+\-\d+\s|\+\d+\-\d+and\d+\-\d+\s)\d{9,12}$/;