chore: build prod app
This commit is contained in:
@@ -9,8 +9,8 @@ import type {
|
||||
Alert,
|
||||
} from "./types";
|
||||
|
||||
const V2 = "https://5.181.0.112.nip.io/api/v2";
|
||||
const CABINE_URL = "https://5.181.0.112.nip.io/api/v1/cabine";
|
||||
const V2 = "https://mln-uber.club/api/v2";
|
||||
const CABINE_URL = "https://mln-uber.club/api/v1/cabine";
|
||||
|
||||
// ============================================
|
||||
// AUTH
|
||||
@@ -849,7 +849,7 @@ export interface PostalZone {
|
||||
|
||||
export interface DaySchedule {
|
||||
enabled: boolean;
|
||||
open_time: string; // "09:00"
|
||||
open_time: string; // "09:00"
|
||||
close_time: string; // "20:00"
|
||||
}
|
||||
|
||||
@@ -864,17 +864,51 @@ export interface DeliverySchedule {
|
||||
}
|
||||
|
||||
export const DEFAULT_POSTAL_ZONES: PostalZone[] = [
|
||||
{ name: "Zone 30€", min_amount: 30, codes: ["44000", "44100", "44200", "44300"] },
|
||||
{ name: "Zone 50€", min_amount: 50, codes: ["44400", "44880", "44120", "44230", "44115", "44980", "44470", "44240", "44700", "44800", "44340", "44620", "44830"] },
|
||||
{ name: "Zone 100€", min_amount: 100, codes: ["44860", "44220", "44118", "44710", "44690", "44119"] },
|
||||
{
|
||||
name: "Zone 30€",
|
||||
min_amount: 30,
|
||||
codes: ["44000", "44100", "44200", "44300"],
|
||||
},
|
||||
{
|
||||
name: "Zone 50€",
|
||||
min_amount: 50,
|
||||
codes: [
|
||||
"44400",
|
||||
"44880",
|
||||
"44120",
|
||||
"44230",
|
||||
"44115",
|
||||
"44980",
|
||||
"44470",
|
||||
"44240",
|
||||
"44700",
|
||||
"44800",
|
||||
"44340",
|
||||
"44620",
|
||||
"44830",
|
||||
],
|
||||
},
|
||||
{
|
||||
name: "Zone 100€",
|
||||
min_amount: 100,
|
||||
codes: ["44860", "44220", "44118", "44710", "44690", "44119"],
|
||||
},
|
||||
];
|
||||
|
||||
export const DEFAULT_DAY: DaySchedule = { enabled: true, open_time: "09:00", close_time: "20:00" };
|
||||
export const DEFAULT_DAY: DaySchedule = {
|
||||
enabled: true,
|
||||
open_time: "09:00",
|
||||
close_time: "20:00",
|
||||
};
|
||||
|
||||
export const DEFAULT_DELIVERY_SCHEDULE: DeliverySchedule = {
|
||||
monday: { ...DEFAULT_DAY }, tuesday: { ...DEFAULT_DAY }, wednesday: { ...DEFAULT_DAY },
|
||||
thursday: { ...DEFAULT_DAY }, friday: { ...DEFAULT_DAY },
|
||||
saturday: { ...DEFAULT_DAY }, sunday: { ...DEFAULT_DAY },
|
||||
monday: { ...DEFAULT_DAY },
|
||||
tuesday: { ...DEFAULT_DAY },
|
||||
wednesday: { ...DEFAULT_DAY },
|
||||
thursday: { ...DEFAULT_DAY },
|
||||
friday: { ...DEFAULT_DAY },
|
||||
saturday: { ...DEFAULT_DAY },
|
||||
sunday: { ...DEFAULT_DAY },
|
||||
};
|
||||
|
||||
export interface CategoryRoute {
|
||||
@@ -927,7 +961,6 @@ export const getSettings = async (): Promise<{
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
export interface AppNotification {
|
||||
command_id: number;
|
||||
type: string;
|
||||
@@ -952,9 +985,14 @@ export const markAdminNotificationsRead = async (): Promise<void> => {
|
||||
// TELEGRAM — ADMIN
|
||||
// ============================================
|
||||
|
||||
export const getAdminTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
|
||||
export const getAdminTelegramStatus = async (): Promise<{
|
||||
linked: boolean;
|
||||
enabled: boolean;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V2}/admin/protected/telegram/status`);
|
||||
const { data } = await apiClient.get(
|
||||
`${V2}/admin/protected/telegram/status`,
|
||||
);
|
||||
return data;
|
||||
} catch {
|
||||
return { linked: false, enabled: false };
|
||||
@@ -966,7 +1004,9 @@ export const generateAdminLinkToken = async (): Promise<{
|
||||
error?: string;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.post(`${V2}/admin/protected/telegram/link-token`);
|
||||
const { data } = await apiClient.post(
|
||||
`${V2}/admin/protected/telegram/link-token`,
|
||||
);
|
||||
return data;
|
||||
} catch (e: any) {
|
||||
return { error: e?.response?.data?.error || "Erreur" };
|
||||
@@ -976,7 +1016,9 @@ export const generateAdminLinkToken = async (): Promise<{
|
||||
export const unlinkAdminTelegram = async (): Promise<void> => {
|
||||
try {
|
||||
await apiClient.delete(`${V2}/admin/protected/telegram/unlink`);
|
||||
} catch { /* ignore */ }
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
};
|
||||
|
||||
export const updateSettings = async (
|
||||
|
||||
@@ -6,8 +6,8 @@ import type {
|
||||
Alert,
|
||||
} from "./types";
|
||||
|
||||
const API = "https://5.181.0.112.nip.io/api/v1/cabine";
|
||||
const V2 = "https://5.181.0.112.nip.io/api/v2";
|
||||
const API = "https://mln-uber.club/api/v1/cabine";
|
||||
const V2 = "https://mln-uber.club/api/v2";
|
||||
|
||||
// ============================================
|
||||
// ITEMS
|
||||
@@ -443,7 +443,10 @@ export const getAllAddresses = async (): Promise<
|
||||
|
||||
const CABINE_API = "https://5.181.0.112.nip.io/api/v1/cabine";
|
||||
|
||||
export const getCabineTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
|
||||
export const getCabineTelegramStatus = async (): Promise<{
|
||||
linked: boolean;
|
||||
enabled: boolean;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${CABINE_API}/telegram/status`);
|
||||
return data;
|
||||
@@ -457,7 +460,9 @@ export const generateCabineLinkToken = async (): Promise<{
|
||||
error?: string;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.post(`${CABINE_API}/telegram/link-token`);
|
||||
const { data } = await apiClient.post(
|
||||
`${CABINE_API}/telegram/link-token`,
|
||||
);
|
||||
return data;
|
||||
} catch (e: any) {
|
||||
return { error: e?.response?.data?.error || "Erreur" };
|
||||
@@ -467,5 +472,7 @@ export const generateCabineLinkToken = async (): Promise<{
|
||||
export const unlinkCabineTelegram = async (): Promise<void> => {
|
||||
try {
|
||||
await apiClient.delete(`${CABINE_API}/telegram/unlink`);
|
||||
} catch { /* ignore */ }
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
};
|
||||
|
||||
@@ -7,7 +7,7 @@ import type {
|
||||
Alert,
|
||||
} from "./types";
|
||||
|
||||
const API = "https://5.181.0.112.nip.io/api/v1/livreur";
|
||||
const API = "https://mln-uber.club/api/v1/livreur";
|
||||
|
||||
// ============================================
|
||||
// STATUT
|
||||
@@ -184,7 +184,9 @@ export const getDeliveryNavLink = async (
|
||||
deliveryId: number,
|
||||
): Promise<{ success: boolean; waze_app?: string; error?: string }> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${API}/deliveries/${deliveryId}/nav-link`);
|
||||
const { data } = await apiClient.get(
|
||||
`${API}/deliveries/${deliveryId}/nav-link`,
|
||||
);
|
||||
return { success: true, waze_app: data.waze_app };
|
||||
} catch (error: any) {
|
||||
return {
|
||||
@@ -219,14 +221,18 @@ export const getMyLocation = async (): Promise<{
|
||||
// ALERTES
|
||||
// ============================================
|
||||
|
||||
export const triggerPoliceAlert = async (alertMessage: string): Promise<{
|
||||
export const triggerPoliceAlert = async (
|
||||
alertMessage: string,
|
||||
): Promise<{
|
||||
success: boolean;
|
||||
alert_id?: number;
|
||||
message?: string;
|
||||
error?: string;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.post(`${API}/alert`, { message: alertMessage });
|
||||
const { data } = await apiClient.post(`${API}/alert`, {
|
||||
message: alertMessage,
|
||||
});
|
||||
return {
|
||||
success: true,
|
||||
alert_id: data.alert_id,
|
||||
@@ -329,7 +335,10 @@ export const markLivreurNotificationsRead = async (): Promise<{
|
||||
// TELEGRAM — LIVREUR
|
||||
// ============================================
|
||||
|
||||
export const getLivreurTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
|
||||
export const getLivreurTelegramStatus = async (): Promise<{
|
||||
linked: boolean;
|
||||
enabled: boolean;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${API}/telegram/status`);
|
||||
return data;
|
||||
@@ -354,6 +363,7 @@ export const generateLivreurLinkToken = async (): Promise<{
|
||||
export const unlinkLivreurTelegram = async (): Promise<void> => {
|
||||
try {
|
||||
await apiClient.delete(`${API}/telegram/unlink`);
|
||||
} catch { /* ignore */ }
|
||||
} catch {
|
||||
/* ignore */
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
||||
import { getToken, getAdminToken } from "../auth/tokenStorage";
|
||||
|
||||
// Change this to your server IP/domain
|
||||
export const API_BASE_URL = "https://5.181.0.112.nip.io";
|
||||
export const API_BASE_URL = "https://mln-uber.club";
|
||||
|
||||
const apiClient = axios.create({
|
||||
baseURL: API_BASE_URL,
|
||||
|
||||
+56
-20
@@ -12,7 +12,7 @@ import type {
|
||||
import { getToken } from "../auth/tokenStorage";
|
||||
import { extractUsernameFromToken } from "../auth/jwtUtils";
|
||||
|
||||
const V1 = "https://5.181.0.112.nip.io/api/v1";
|
||||
const V1 = "https://mln-uber.club/api/v1";
|
||||
|
||||
export const getJwtUsername = async (): Promise<string | null> => {
|
||||
const token = await getToken();
|
||||
@@ -350,14 +350,19 @@ export const checkoutCart = async (
|
||||
}
|
||||
};
|
||||
|
||||
export const getReferralBalance = async (): Promise<ReferralBalanceResponse> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/referral/balance`);
|
||||
return { success: true, balance: data.balance ?? 0 };
|
||||
} catch {
|
||||
return { success: false, balance: 0, message: "Erreur récupération solde" };
|
||||
}
|
||||
};
|
||||
export const getReferralBalance =
|
||||
async (): Promise<ReferralBalanceResponse> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/referral/balance`);
|
||||
return { success: true, balance: data.balance ?? 0 };
|
||||
} catch {
|
||||
return {
|
||||
success: false,
|
||||
balance: 0,
|
||||
message: "Erreur récupération solde",
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
export const approveDelivery = async (
|
||||
commandId: number,
|
||||
@@ -606,7 +611,11 @@ export const getMyPenalties = async (): Promise<PenaltiesResponse> => {
|
||||
// 👤 PROFIL CLIENT
|
||||
// ============================================
|
||||
|
||||
export const getMyProfile = async (): Promise<{ success: boolean; client?: any; message?: string }> => {
|
||||
export const getMyProfile = async (): Promise<{
|
||||
success: boolean;
|
||||
client?: any;
|
||||
message?: string;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/profile`);
|
||||
return { success: true, client: data.client };
|
||||
@@ -615,14 +624,21 @@ export const getMyProfile = async (): Promise<{ success: boolean; client?: any;
|
||||
}
|
||||
};
|
||||
|
||||
export const updateMyProfile = async (fields: { nom?: string; prenom?: string; telephone?: string }): Promise<{ success: boolean; message?: string; client?: any }> => {
|
||||
export const updateMyProfile = async (fields: {
|
||||
nom?: string;
|
||||
prenom?: string;
|
||||
telephone?: string;
|
||||
}): Promise<{ success: boolean; message?: string; client?: any }> => {
|
||||
try {
|
||||
const { data } = await apiClient.put(`${V1}/profile/update`, fields);
|
||||
return { success: true, client: data.client, message: data.message };
|
||||
} catch (error: any) {
|
||||
return {
|
||||
success: false,
|
||||
message: error.response?.data?.error || error.response?.data?.message || "Erreur mise à jour profil",
|
||||
message:
|
||||
error.response?.data?.error ||
|
||||
error.response?.data?.message ||
|
||||
"Erreur mise à jour profil",
|
||||
};
|
||||
}
|
||||
};
|
||||
@@ -773,7 +789,17 @@ export interface PublicSettings {
|
||||
}
|
||||
|
||||
export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
const defaults: PublicSettings = { penalties_enabled: true, show_amende_score: true, points_enabled: true, points_separated: true, referral_enabled: true, pool_names: ['Pool 1', 'Pool 2'], crypto_payment_enabled: false, crypto_only: false, nowpayments_currencies: [] };
|
||||
const defaults: PublicSettings = {
|
||||
penalties_enabled: true,
|
||||
show_amende_score: true,
|
||||
points_enabled: true,
|
||||
points_separated: true,
|
||||
referral_enabled: true,
|
||||
pool_names: ["Pool 1", "Pool 2"],
|
||||
crypto_payment_enabled: false,
|
||||
crypto_only: false,
|
||||
nowpayments_currencies: [],
|
||||
};
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/app-settings`);
|
||||
return {
|
||||
@@ -782,12 +808,15 @@ export const getPublicSettings = async (): Promise<PublicSettings> => {
|
||||
points_enabled: data.points_enabled ?? true,
|
||||
points_separated: data.points_separated ?? true,
|
||||
referral_enabled: data.referral_enabled ?? true,
|
||||
pool_names: Array.isArray(data.pool_names) && data.pool_names.length > 0
|
||||
? data.pool_names
|
||||
: defaults.pool_names,
|
||||
pool_names:
|
||||
Array.isArray(data.pool_names) && data.pool_names.length > 0
|
||||
? data.pool_names
|
||||
: defaults.pool_names,
|
||||
crypto_payment_enabled: data.crypto_payment_enabled ?? false,
|
||||
crypto_only: data.crypto_only ?? false,
|
||||
nowpayments_currencies: Array.isArray(data.nowpayments_currencies) ? data.nowpayments_currencies : [],
|
||||
nowpayments_currencies: Array.isArray(data.nowpayments_currencies)
|
||||
? data.nowpayments_currencies
|
||||
: [],
|
||||
};
|
||||
} catch {
|
||||
return defaults;
|
||||
@@ -805,9 +834,13 @@ export interface CryptoPaymentStatus {
|
||||
price_currency: string;
|
||||
}
|
||||
|
||||
export const getCryptoPaymentStatus = async (commandId: number): Promise<CryptoPaymentStatus | null> => {
|
||||
export const getCryptoPaymentStatus = async (
|
||||
commandId: number,
|
||||
): Promise<CryptoPaymentStatus | null> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/commands/${commandId}/payment-status`);
|
||||
const { data } = await apiClient.get(
|
||||
`${V1}/commands/${commandId}/payment-status`,
|
||||
);
|
||||
return data;
|
||||
} catch {
|
||||
return null;
|
||||
@@ -818,7 +851,10 @@ export const getCryptoPaymentStatus = async (commandId: number): Promise<CryptoP
|
||||
// TELEGRAM
|
||||
// ============================================
|
||||
|
||||
export const getTelegramStatus = async (): Promise<{ linked: boolean; enabled: boolean }> => {
|
||||
export const getTelegramStatus = async (): Promise<{
|
||||
linked: boolean;
|
||||
enabled: boolean;
|
||||
}> => {
|
||||
try {
|
||||
const { data } = await apiClient.get(`${V1}/telegram/status`);
|
||||
return data;
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from "axios";
|
||||
import { getToken, getAdminToken } from "../auth/tokenStorage";
|
||||
|
||||
// Change this to your server IP/domain
|
||||
export const API_BASE_URL = "https://5.181.0.112.nip.io";
|
||||
export const API_BASE_URL = "https://mln-uber.club";
|
||||
|
||||
const apiClient = axios.create({
|
||||
baseURL: API_BASE_URL,
|
||||
|
||||
Reference in New Issue
Block a user