chore: build
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
import apiClient from "./client";
|
||||
import { API_BASE_URL } from "./client";
|
||||
import type {
|
||||
ConfirmReceptionResponse,
|
||||
CheckoutCartResponse,
|
||||
@@ -12,7 +13,7 @@ import type {
|
||||
import { getToken } from "../auth/tokenStorage";
|
||||
import { extractUsernameFromToken } from "../auth/jwtUtils";
|
||||
|
||||
const V1 = "/api/v1";
|
||||
const V1 = `${API_BASE_URL}/api/v1`;
|
||||
|
||||
export const getJwtUsername = async (): Promise<string | null> => {
|
||||
const token = await getToken();
|
||||
@@ -359,19 +360,18 @@ export const checkoutCart = async (
|
||||
price_currency: data.price_currency,
|
||||
};
|
||||
} catch (error: any) {
|
||||
const errMsg: string = error.response?.data?.error || "Erreur serveur";
|
||||
if (errMsg.startsWith("Adresse invalide ")) {
|
||||
const suggested = errMsg.replace("Adresse invalide ", "").trim();
|
||||
const data = error.response?.data;
|
||||
if (data?.corrected_address) {
|
||||
return {
|
||||
success: false,
|
||||
invalid_address: true,
|
||||
suggested_address: suggested,
|
||||
message: errMsg,
|
||||
suggested_address: data.corrected_address,
|
||||
message: data.error || "Adresse non reconnue",
|
||||
};
|
||||
}
|
||||
return {
|
||||
success: false,
|
||||
message: errMsg,
|
||||
message: data?.error || "Erreur serveur",
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -529,7 +529,6 @@ export const getOrdersWithTracking = async () => {
|
||||
|
||||
// ============================================
|
||||
// HISTORY
|
||||
// ============================================
|
||||
|
||||
export const getMyCompletedOrders = async (): Promise<HistoryResponse> => {
|
||||
try {
|
||||
@@ -661,6 +660,7 @@ export const updateMyProfile = async (fields: {
|
||||
}
|
||||
};
|
||||
|
||||
// ============================================
|
||||
// ORDER DETAILS
|
||||
// ============================================
|
||||
|
||||
@@ -963,6 +963,7 @@ export const toggle2FA = async (
|
||||
|
||||
export type RewardCategoryConfig = {
|
||||
category: string;
|
||||
type: "free_product" | "half_price_product";
|
||||
all_products: boolean;
|
||||
product_ids: number[];
|
||||
product_names: string[];
|
||||
@@ -974,6 +975,7 @@ export type RewardItemConfig = {
|
||||
product_name: string;
|
||||
quantity: number;
|
||||
price: number;
|
||||
type: "free_product" | "half_price_product";
|
||||
};
|
||||
|
||||
export type PointsPoolInfo = {
|
||||
@@ -989,7 +991,6 @@ export type PointsPoolInfo = {
|
||||
|
||||
export type PointsRewardConfig = {
|
||||
threshold: number;
|
||||
type: string;
|
||||
description: string;
|
||||
reward_items: RewardItemConfig[];
|
||||
};
|
||||
|
||||
@@ -10,7 +10,7 @@ export interface ApiResponse {
|
||||
token_type?: string;
|
||||
expires_in?: number;
|
||||
user?: UserResponse;
|
||||
[key: string]: any;
|
||||
[key: string]: any; // Pour les champs additionnels
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -146,7 +146,7 @@ export default function OrderHistoryScreen() {
|
||||
if (res.success) {
|
||||
const text =
|
||||
res.product_added && res.product_name
|
||||
? `🎁 ${res.product_name} ajouté à votre panier ! Commandez au moins un produit pour en profiter.`
|
||||
? `${res.product_name} ajouté à votre panier ! Commandez au moins un produit pour en profiter.`
|
||||
: res.description || "Récompense réclamée !";
|
||||
setClaimFeedback({ pool: poolKey, type: "success", text });
|
||||
getMyPointsRewards().then((r) => {
|
||||
@@ -882,16 +882,34 @@ export default function OrderHistoryScreen() {
|
||||
: `Encore ${remaining} pts pour une récompense`}
|
||||
</Text>
|
||||
{feedback && (
|
||||
<Text
|
||||
style={
|
||||
feedback.type ===
|
||||
"success"
|
||||
? styles.feedbackSuccess
|
||||
: styles.feedbackError
|
||||
}
|
||||
<View
|
||||
style={{
|
||||
flexDirection:
|
||||
"row",
|
||||
alignItems:
|
||||
"center",
|
||||
gap: 4,
|
||||
}}
|
||||
>
|
||||
{feedback.text}
|
||||
</Text>
|
||||
{feedback.type ===
|
||||
"success" && (
|
||||
<Ionicons
|
||||
name="gift-outline"
|
||||
size={12}
|
||||
color="#10b981"
|
||||
/>
|
||||
)}
|
||||
<Text
|
||||
style={
|
||||
feedback.type ===
|
||||
"success"
|
||||
? styles.feedbackSuccess
|
||||
: styles.feedbackError
|
||||
}
|
||||
>
|
||||
{feedback.text}
|
||||
</Text>
|
||||
</View>
|
||||
)}
|
||||
{pool.rewards_available > 0 && (
|
||||
<TouchableOpacity
|
||||
@@ -1132,11 +1150,18 @@ export default function OrderHistoryScreen() {
|
||||
</Text>
|
||||
)}
|
||||
</View>
|
||||
{item.price > 0 && (
|
||||
{item.type ===
|
||||
"half_price_product" ? (
|
||||
<Text
|
||||
style={styles.pickerItemPrice}
|
||||
>
|
||||
{item.price}€
|
||||
-50% · {item.price}€
|
||||
</Text>
|
||||
) : (
|
||||
<Text
|
||||
style={styles.pickerItemPrice}
|
||||
>
|
||||
Offert
|
||||
</Text>
|
||||
)}
|
||||
<Ionicons
|
||||
|
||||
@@ -28,6 +28,8 @@ import { spacing, fontSize } from "../../theme";
|
||||
import { useTheme } from "../../context/ThemeContext";
|
||||
import type { ClientStackParamList } from "../../navigation/types";
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
||||
const logoGrosSemi = require("../../../assets/logo-gros-semi.png");
|
||||
|
||||
const { width: SCREEN_WIDTH } = Dimensions.get("window");
|
||||
const CARD_WIDTH = SCREEN_WIDTH - 48;
|
||||
|
||||
Reference in New Issue
Block a user