summaryrefslogtreecommitdiff
path: root/src-migrate/common/types/cart.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src-migrate/common/types/cart.ts')
-rw-r--r--src-migrate/common/types/cart.ts70
1 files changed, 70 insertions, 0 deletions
diff --git a/src-migrate/common/types/cart.ts b/src-migrate/common/types/cart.ts
new file mode 100644
index 00000000..15e08093
--- /dev/null
+++ b/src-migrate/common/types/cart.ts
@@ -0,0 +1,70 @@
+type Price = {
+ price: number;
+ discount_percentage: number;
+ price_discount: number;
+};
+
+export type CartProduct = {
+ id: number;
+ image: 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?: string;
+ 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[];
+};