TEST_AUTOMATION #9

Merged
shafi merged 19 commits from TEST_AUTOMATION into main 2026-10-03 05:20:55 +00:00
12 changed files with 47 additions and 12 deletions
Showing only changes of commit dec7b3a79b - Show all commits

View file

@ -75,7 +75,7 @@ export default function Dashboard() {
const menuItems: MenuItem[] = [ const menuItems: MenuItem[] = [
{ {
title: 'Manage Orderss', title: 'Manage Orders',
icon: 'shopping-bag', icon: 'shopping-bag',
description: 'View and manage customer orders', description: 'View and manage customer orders',
route: '/(drawer)/dashboard/manage-orders', route: '/(drawer)/dashboard/manage-orders',

View file

@ -1,7 +1,7 @@
import { createTRPCProxyClient, httpBatchLink, TRPCClientError } from '@trpc/client'; import { createTRPCProxyClient, httpBatchLink, TRPCClientError } from '@trpc/client';
import { createTRPCReact } from '@trpc/react-query'; import { createTRPCReact } from '@trpc/react-query';
import { AppRouter } from '@backend/trpc/router' import { AppRouter } from '@backend/trpc/router'
import { BASE_API_URL } from 'common-ui'; import { BASE_API_URL } from '@packages/shared';
import { getJWT } from '@/hooks/useJWT'; import { getJWT } from '@/hooks/useJWT';
import { FORCE_LOGOUT_EVENT } from 'common-ui/src/lib/const-strs'; import { FORCE_LOGOUT_EVENT } from 'common-ui/src/lib/const-strs';
import { DeviceEventEmitter } from 'react-native'; import { DeviceEventEmitter } from 'react-native';

View file

@ -3,11 +3,12 @@ import { createTRPCClient, httpBatchLink } from '@trpc/client'
import type { AppRouter } from '@backend/trpc/router' import type { AppRouter } from '@backend/trpc/router'
import { getJWT } from '../hooks/useJWT' import { getJWT } from '../hooks/useJWT'
import { EventBus, FORCE_LOGOUT_EVENT } from './event-bus' import { EventBus, FORCE_LOGOUT_EVENT } from './event-bus'
import { BASE_API_URL as DEFAULT_API_URL } from '@packages/shared'
// Same backend as admin-ui (BASE_API_URL from common-ui); overridable via env. // Same backend as admin-ui; overridable via VITE_API_URL (set it to
// https://devapi.freshyo.in for dev builds — the shared default is production).
export const BASE_API_URL = export const BASE_API_URL =
// (import.meta.env?.VITE_API_URL as string | undefined) || 'https://worker.freshyo.in' (import.meta.env?.VITE_API_URL as string | undefined) || DEFAULT_API_URL
(import.meta.env?.VITE_API_URL as string | undefined) || 'https://devapi.freshyo.in'
export const trpc = createTRPCReact<AppRouter>() export const trpc = createTRPCReact<AppRouter>()

View file

@ -1,6 +1,7 @@
import { BASE_API_URL } from '@packages/shared'
const webUiConstants = { const webUiConstants = {
baseUrl: 'https://worker.freshyo.in/' baseUrl: `${BASE_API_URL}/`
// baseUrl: '/'
} }

View file

@ -9,6 +9,7 @@ export default defineConfig({
resolve: { resolve: {
alias: { alias: {
'@': path.resolve(__dirname, 'src'), '@': path.resolve(__dirname, 'src'),
'@packages/shared': path.resolve(__dirname, '../../packages/shared'),
} }
}, },
server: { server: {

View file

@ -1,10 +1,11 @@
import { createTRPCReact } from '@trpc/react-query' import { createTRPCReact } from '@trpc/react-query'
import { createTRPCClient, httpBatchLink } from '@trpc/client' import { createTRPCClient, httpBatchLink } from '@trpc/client'
import type { AppRouter } from '@backend/trpc/router' import type { AppRouter } from '@backend/trpc/router'
import { BASE_API_URL as DEFAULT_API_URL } from '@packages/shared'
// const BASE_API_URL = 'http://192.168.100.126:8787' // const BASE_API_URL = 'http://192.168.100.126:8787'
export const BASE_API_URL = export const BASE_API_URL =
(import.meta.env?.VITE_API_URL as string | undefined) || 'https://worker.freshyo.in' (import.meta.env?.VITE_API_URL as string | undefined) || DEFAULT_API_URL
export const trpc = createTRPCReact<AppRouter>() export const trpc = createTRPCReact<AppRouter>()

View file

@ -1,7 +1,7 @@
import { createTRPCProxyClient, httpBatchLink } from "@trpc/client"; import { createTRPCProxyClient, httpBatchLink } from "@trpc/client";
import { createTRPCReact } from "@trpc/react-query"; import { createTRPCReact } from "@trpc/react-query";
import { AppRouter } from "@backend/trpc/router"; import { AppRouter } from "@backend/trpc/router";
import { BASE_API_URL } from "common-ui"; import { BASE_API_URL } from "@packages/shared";
import { getAuthToken } from "@/hooks/useJWT"; import { getAuthToken } from "@/hooks/useJWT";
import { DeviceEventEmitter } from "react-native"; import { DeviceEventEmitter } from "react-native";
import { FORCE_LOGOUT_EVENT } from "common-ui/src/lib/const-strs"; import { FORCE_LOGOUT_EVENT } from "common-ui/src/lib/const-strs";

View file

@ -10,7 +10,7 @@
* silent empty render. * silent empty render.
* *
* The tRPC URL is matched on the procedure path rather than the host, because * The tRPC URL is matched on the procedure path rather than the host, because
* BASE_API_URL (packages/ui/index.ts) is a local address during development. * BASE_API_URL (@packages/shared) is a local address during development.
* `jest.mock('axios')` lives in tests/setup.ts so it is registered before any * `jest.mock('axios')` lives in tests/setup.ts so it is registered before any
* app module imports axios. * app module imports axios.
* *

View file

@ -1,10 +1,11 @@
import { createTRPCReact } from '@trpc/react-query' import { createTRPCReact } from '@trpc/react-query'
import { createTRPCClient, httpBatchLink } from '@trpc/client' import { createTRPCClient, httpBatchLink } from '@trpc/client'
import type { AppRouter } from '@backend/trpc/router' import type { AppRouter } from '@backend/trpc/router'
import { BASE_API_URL as DEFAULT_API_URL } from '@packages/shared'
// const BASE_API_URL = 'http://192.168.100.111:8787' // const BASE_API_URL = 'http://192.168.100.111:8787'
export const BASE_API_URL = export const BASE_API_URL =
(import.meta.env?.VITE_API_URL as string | undefined) || 'https://worker.freshyo.in' (import.meta.env?.VITE_API_URL as string | undefined) || DEFAULT_API_URL
export const trpc = createTRPCReact<AppRouter>() export const trpc = createTRPCReact<AppRouter>()

View file

@ -3586,3 +3586,27 @@ set to false so these render only in superadmin-ui:
apps/admin-ui/app/(drawer)/dashboard/customize-app/index.tsx — CONST_VISIBILITY: apps/admin-ui/app/(drawer)/dashboard/customize-app/index.tsx — CONST_VISIBILITY:
internalAppVersion: true -> false internalAppVersion: true -> false
(superadmin-ui's src/routes/constants.tsx keeps it visible, unchanged.) (superadmin-ui's src/routes/constants.tsx keeps it visible, unchanged.)
[2026-10-02 00:16:36] refactor: move BASE_API_URL to @packages/shared so every UI uses one source.
packages/ui (common-ui) is React Native specific; the API base URL does not belong
there. It now lives in the framework-agnostic shared package, and packages/ui no
longer exports it.
- packages/shared/index.ts: export const BASE_API_URL = 'https://worker.freshyo.in'.
- packages/ui/index.ts: removed the local BASE_API_URL declaration + export.
- packages/ui/src/services/axios.ts: imports BASE_API_URL from '@packages/shared'.
- apps/user-ui/src/trpc-client.ts, apps/admin-ui/src/trpc-client.ts: import from
'@packages/shared' instead of 'common-ui'.
- apps/web-ui/src/lib/trpc-client.ts, apps/admin-web/..., apps/superadmin-ui/...:
default from '@packages/shared', still overridable via VITE_API_URL.
NOTE: admin-web's old devapi.freshyo.in default is gone; set
VITE_API_URL=https://devapi.freshyo.in for dev builds if still needed.
- apps/fallback-ui: vite alias for @packages/shared; baseUrl from the shared
constant.
- apps/user-ui/tests/mocks/api.ts: stale comment pointing at packages/ui.
[2026-10-02 00:24:19] admin-ui: fix typo in dashboard menu title ('Manage Orderss' -> 'Manage Orders').
Pre-existing regression surfaced while running the suite after the BASE_API_URL
move; the dashboard-hub tests expect 'Manage Orders'. Unrelated to the URL change.

View file

@ -7,5 +7,11 @@ export const CACHE_FILENAMES = {
banners: 'banners.json', banners: 'banners.json',
} as const } as const
/**
* Base origin of the backend API, shared by every UI (React Native and web).
* Framework-agnostic: apps may override it (e.g. VITE_API_URL) at build time.
*/
export const BASE_API_URL = 'https://worker.freshyo.in'
// Re-export all types from the types folder // Re-export all types from the types folder
export * from './types' export * from './types'

View file

@ -4,7 +4,7 @@ import axiosParent from 'axios';
import { DeviceEventEmitter } from 'react-native' import { DeviceEventEmitter } from 'react-native'
import { FORCE_LOGOUT_EVENT } from '../lib/const-strs'; import { FORCE_LOGOUT_EVENT } from '../lib/const-strs';
import { getAuthToken } from '@/hooks/useJWT'; import { getAuthToken } from '@/hooks/useJWT';
import { BASE_API_URL } from '../../index'; import { BASE_API_URL } from '@packages/shared';
// const API_BASE_URL = 'http://192.168.1.5:4000'; // Change to your API base URL // const API_BASE_URL = 'http://192.168.1.5:4000'; // Change to your API base URL
// const API_BASE_URL = 'http://192.168.100.95:4000'; // Change to your API base URL // const API_BASE_URL = 'http://192.168.100.95:4000'; // Change to your API base URL