summaryrefslogtreecommitdiff
path: root/src-migrate/types
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/types')
-rw-r--r--src-migrate/types/auth.ts62
-rw-r--r--src-migrate/types/banner.ts8
-rw-r--r--src-migrate/types/cart.ts76
-rw-r--r--src-migrate/types/category.ts4
-rw-r--r--src-migrate/types/checkout.ts16
-rw-r--r--src-migrate/types/nav.ts4
-rw-r--r--src-migrate/types/odoo.ts7
-rw-r--r--src-migrate/types/pageContent.ts5
-rw-r--r--src-migrate/types/product.ts38
-rw-r--r--src-migrate/types/productVariant.ts33
-rw-r--r--src-migrate/types/promotion.ts44
-rw-r--r--src-migrate/types/promotionProgram.ts8
-rw-r--r--src-migrate/types/solr.ts7
13 files changed, 312 insertions, 0 deletions
diff --git a/src-migrate/types/auth.ts b/src-migrate/types/auth.ts
new file mode 100644
index 00000000..e93a475a
--- /dev/null
+++ b/src-migrate/types/auth.ts
@@ -0,0 +1,62 @@
+import { registerSchema } from '~/validations/auth';
+import { OdooApiRes } from './odoo';
+import { z } from 'zod';
+
+export type AuthProps = {
+ id: number;
+ parentId: number;
+ parentName: string;
+ partnerId: number;
+ name: string;
+ email: string;
+ phone: string;
+ mobile: string;
+ external: boolean;
+ company: boolean;
+ pricelist: string | null;
+ token: string;
+ feature : {
+ onlyReadyStock : boolean,
+ soApproval : boolean
+ }
+};
+
+export type AuthApiProps = OdooApiRes<AuthProps>;
+
+export type RegisterProps = z.infer<typeof registerSchema>;
+
+export type RegisterResApiProps = {
+ register: boolean;
+ reason: 'EMAIL_USED' | 'NOT_ACTIVE' | null;
+};
+
+type ActivationResProps = {
+ activation: boolean;
+ user: AuthProps | null;
+};
+
+export type ActivationTokenProps = {
+ token: string;
+};
+
+export type ActivationTokenResApiProps = ActivationResProps & {
+ reason: 'INVALID_TOKEN' | null;
+};
+
+export type ActivationOtpProps = {
+ email: string;
+ otp: string;
+};
+
+export type ActivationOtpResApiProps = ActivationResProps & {
+ reason: 'INVALID_OTP' | null;
+};
+
+export type ActivationReqProps = {
+ email: string;
+};
+
+export type ActivationReqResApiProps = {
+ activation_request: boolean;
+ reason: 'NOT_FOUND' | 'ACTIVE' | null;
+};
diff --git a/src-migrate/types/banner.ts b/src-migrate/types/banner.ts
new file mode 100644
index 00000000..dbccc378
--- /dev/null
+++ b/src-migrate/types/banner.ts
@@ -0,0 +1,8 @@
+export interface IBanner {
+ background_color: string | false;
+ group_by_week: number | false;
+ image: string;
+ name: string;
+ sequence: number;
+ url: string;
+}
diff --git a/src-migrate/types/cart.ts b/src-migrate/types/cart.ts
new file mode 100644
index 00000000..5a2cf4a9
--- /dev/null
+++ b/src-migrate/types/cart.ts
@@ -0,0 +1,76 @@
+import { CategoryPromo } from "./promotion";
+
+type Price = {
+ price: number;
+ discount_percentage: number;
+ price_discount: number;
+};
+
+export type CartProduct = {
+ id: number;
+ image: string;
+ parent: {
+ id: number;
+ name: string;
+ };
+ display_name: string;
+ name: string;
+ code: string;
+ price: Price;
+ qty: number;
+ weight: number;
+ package_weight: number;
+};
+
+export type CartItem = {
+ cart_id: number;
+ quantity: number;
+ selected: boolean;
+ can_buy: boolean;
+ cart_type: 'product' | 'promotion';
+ id: number;
+ name: string;
+ stock: number;
+ weight: number;
+ attributes: string[];
+ parent: {
+ id: number;
+ name: string;
+ image: string;
+ };
+ price: Price;
+ manufacture: {
+ id: number;
+ name: string;
+ };
+ has_flashsale: boolean;
+ subtotal: number;
+
+ code?: string;
+
+ image?: string;
+ remaining_time?: number;
+ promotion_type?: {
+ value?: CategoryPromo;
+ label?: string;
+ };
+ limit_qty?: {
+ all?: number;
+ user?: number;
+ transaction?: number;
+ };
+ remaining_qty?: {
+ all?: number;
+ user?: number;
+ transaction?: number;
+ };
+ used_percentage?: number;
+ products?: CartProduct[];
+ free_products?: CartProduct[];
+ package_price?: number;
+};
+
+export type CartProps = {
+ product_total: number;
+ products: CartItem[];
+};
diff --git a/src-migrate/types/category.ts b/src-migrate/types/category.ts
new file mode 100644
index 00000000..1037b5f9
--- /dev/null
+++ b/src-migrate/types/category.ts
@@ -0,0 +1,4 @@
+export interface ICategoryBreadcrumb {
+ id: number;
+ name: string;
+}
diff --git a/src-migrate/types/checkout.ts b/src-migrate/types/checkout.ts
new file mode 100644
index 00000000..dc1365d8
--- /dev/null
+++ b/src-migrate/types/checkout.ts
@@ -0,0 +1,16 @@
+import { CartItem } from './cart';
+
+export interface ICheckout {
+ total_purchase: number;
+ total_discount: number;
+ discount_voucher: number;
+ subtotal: number;
+ tax: number;
+ grand_total: number;
+ total_weight: {
+ kg: number;
+ g: number;
+ };
+ has_product_without_weight: boolean;
+ products: CartItem[];
+}
diff --git a/src-migrate/types/nav.ts b/src-migrate/types/nav.ts
new file mode 100644
index 00000000..ba97b1bf
--- /dev/null
+++ b/src-migrate/types/nav.ts
@@ -0,0 +1,4 @@
+export type SecondaryNavItemProps = {
+ label: string
+ href: string
+}
diff --git a/src-migrate/types/odoo.ts b/src-migrate/types/odoo.ts
new file mode 100644
index 00000000..73a029e9
--- /dev/null
+++ b/src-migrate/types/odoo.ts
@@ -0,0 +1,7 @@
+export interface OdooApiRes<T> {
+ status: {
+ code: number;
+ description: string;
+ };
+ result: T;
+}
diff --git a/src-migrate/types/pageContent.ts b/src-migrate/types/pageContent.ts
new file mode 100644
index 00000000..4361deb7
--- /dev/null
+++ b/src-migrate/types/pageContent.ts
@@ -0,0 +1,5 @@
+export type PageContentProps = {
+ id: number;
+ url_path: string;
+ content: string;
+} | null;
diff --git a/src-migrate/types/product.ts b/src-migrate/types/product.ts
new file mode 100644
index 00000000..681cdc8e
--- /dev/null
+++ b/src-migrate/types/product.ts
@@ -0,0 +1,38 @@
+import { IProductVariantDetail } from './productVariant';
+
+export interface IProduct {
+ id: number;
+ image: string;
+ code: string;
+ display_name: string;
+ name: string;
+ weight: number;
+ qty_sold: number;
+ stock_total: number;
+ variant_total: number;
+ description: string;
+ isSni: boolean;
+ isTkdn: boolean;
+ categories: {
+ id: string;
+ name: string;
+ }[];
+ flash_sale: {
+ id: string;
+ remaining_time: number;
+ tag: string;
+ };
+ lowest_price: {
+ price: number;
+ price_discount: number;
+ discount_percentage: number;
+ };
+ manufacture: {
+ id: number;
+ name: string;
+ };
+}
+
+export interface IProductDetail extends IProduct {
+ variants: IProductVariantDetail[];
+}
diff --git a/src-migrate/types/productVariant.ts b/src-migrate/types/productVariant.ts
new file mode 100644
index 00000000..861b216a
--- /dev/null
+++ b/src-migrate/types/productVariant.ts
@@ -0,0 +1,33 @@
+export interface IProductVariantDetail {
+ id: number;
+ image: string;
+ code: string;
+ name: string;
+ weight: number;
+ is_flashsale: {
+ remaining_time: number;
+ is_flashsale: boolean;
+ };
+ price: {
+ price: number;
+ price_discount: number;
+ discount_percentage: number;
+ };
+ manufacture:
+ | {
+ id: string;
+ name: string;
+ }
+ | {};
+ parent: {
+ id: string;
+ name: string;
+ image: string;
+ };
+ attributes: string[];
+}
+
+export interface IProductVariantSLA {
+ qty: number;
+ sla_date: string;
+}
diff --git a/src-migrate/types/promotion.ts b/src-migrate/types/promotion.ts
new file mode 100644
index 00000000..85190aad
--- /dev/null
+++ b/src-migrate/types/promotion.ts
@@ -0,0 +1,44 @@
+export interface IPromotion {
+ id: number;
+ program_id: number;
+ name: string;
+ type: {
+ value: CategoryPromo;
+ label: string;
+ };
+ limit: number;
+ limit_user: number;
+ limit_trx: number;
+ price: number;
+ total_qty: number;
+ products: {
+ product_id: number;
+ qty: number;
+ }[];
+ free_products: {
+ product_id: number;
+ qty: number;
+ }[];
+}
+
+export interface IProductVariantPromo {
+ id: number;
+ parent_id: number;
+ display_name: string;
+ image: string;
+ name: string;
+ default_code: string;
+ price: {
+ price: number;
+ discount_percentage: number;
+ price_discount: number;
+ };
+ qty: number;
+}
+
+export type CategoryPromo = 'bundling' | 'discount_loading' | 'merchandise';
+
+export interface ICategoryPromo {
+ value: CategoryPromo;
+ label: string;
+}
diff --git a/src-migrate/types/promotionProgram.ts b/src-migrate/types/promotionProgram.ts
new file mode 100644
index 00000000..205884b6
--- /dev/null
+++ b/src-migrate/types/promotionProgram.ts
@@ -0,0 +1,8 @@
+export type IPromotionProgram = {
+ id: number;
+ name: string;
+ start_time: string;
+ end_time: string;
+ applies_to: string;
+ time_left: number;
+};
diff --git a/src-migrate/types/solr.ts b/src-migrate/types/solr.ts
new file mode 100644
index 00000000..d231c305
--- /dev/null
+++ b/src-migrate/types/solr.ts
@@ -0,0 +1,7 @@
+export type SolrResponse<T> = {
+ response: {
+ numFound: number;
+ start: number;
+ docs: T;
+ };
+};