| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- 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}$/;
|