1.3.0 first commit
This commit is contained in:
parent
d528d164b4
commit
514b64dcd1
50 changed files with 3129 additions and 1215 deletions
|
|
@ -7,7 +7,6 @@
|
||||||
"icon": "./assets/images/symbuyoteadmin.png",
|
"icon": "./assets/images/symbuyoteadmin.png",
|
||||||
"scheme": "freshyoadmin",
|
"scheme": "freshyoadmin",
|
||||||
"userInterfaceStyle": "automatic",
|
"userInterfaceStyle": "automatic",
|
||||||
"newArchEnabled": true,
|
|
||||||
"ios": {
|
"ios": {
|
||||||
"supportsTablet": true,
|
"supportsTablet": true,
|
||||||
"bundleIdentifier": "in.freshyo.adminui",
|
"bundleIdentifier": "in.freshyo.adminui",
|
||||||
|
|
@ -62,10 +61,9 @@
|
||||||
"foregroundImage": "./assets/images/symbuyoteadmin.png",
|
"foregroundImage": "./assets/images/symbuyoteadmin.png",
|
||||||
"backgroundColor": "#fff0f6"
|
"backgroundColor": "#fff0f6"
|
||||||
},
|
},
|
||||||
"edgeToEdgeEnabled": true,
|
"package": "in.freshyo.adminui",
|
||||||
"package": "in.freshyo.adminui",
|
"googleServicesFile": "./google-services.json",
|
||||||
"googleServicesFile": "./google-services.json",
|
"intentFilters": [
|
||||||
"intentFilters": [
|
|
||||||
{
|
{
|
||||||
"action": "VIEW",
|
"action": "VIEW",
|
||||||
"autoVerify": true,
|
"autoVerify": true,
|
||||||
|
|
@ -76,7 +74,10 @@
|
||||||
"pathPrefix": "/manage-orders/order-details"
|
"pathPrefix": "/manage-orders/order-details"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"category": ["BROWSABLE", "DEFAULT"]
|
"category": [
|
||||||
|
"BROWSABLE",
|
||||||
|
"DEFAULT"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
|
@ -96,9 +97,9 @@
|
||||||
"backgroundColor": "#ffffff"
|
"backgroundColor": "#ffffff"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"expo-secure-store",
|
"expo-secure-store",
|
||||||
"expo-notifications"
|
"expo-notifications"
|
||||||
],
|
],
|
||||||
"experiments": {
|
"experiments": {
|
||||||
"typedRoutes": true
|
"typedRoutes": true
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -234,7 +234,7 @@ export default function Complaints() {
|
||||||
<ActivityIndicator size="small" color="#3B82F6" />
|
<ActivityIndicator size="small" color="#3B82F6" />
|
||||||
<MyText style={tw`text-gray-500 ml-2`}>Loading more...</MyText>
|
<MyText style={tw`text-gray-500 ml-2`}>Loading more...</MyText>
|
||||||
</View>
|
</View>
|
||||||
) : null
|
) : undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
<ConfirmationDialog
|
<ConfirmationDialog
|
||||||
|
|
|
||||||
|
|
@ -140,7 +140,7 @@ export default function CouponDetails() {
|
||||||
<ScrollView
|
<ScrollView
|
||||||
style={tw`flex-1`}
|
style={tw`flex-1`}
|
||||||
contentContainerStyle={tw`p-4 pb-10`}
|
contentContainerStyle={tw`p-4 pb-10`}
|
||||||
refreshControl={<RefreshControl refreshing={isFetching} onRefresh={refetch} />}
|
refreshControl={<RefreshControl refreshing={isFetching} onRefresh={() => { void refetch() }} />}
|
||||||
>
|
>
|
||||||
<View style={tw`bg-white rounded-2xl p-5 mb-4 shadow-sm`}>
|
<View style={tw`bg-white rounded-2xl p-5 mb-4 shadow-sm`}>
|
||||||
<View style={tw`flex-row items-center flex-wrap`}>
|
<View style={tw`flex-row items-center flex-wrap`}>
|
||||||
|
|
|
||||||
|
|
@ -556,7 +556,7 @@ export default function Orders() {
|
||||||
<ActivityIndicator size="small" color="#3B82F6" />
|
<ActivityIndicator size="small" color="#3B82F6" />
|
||||||
<MyText style={tw`text-gray-600 ml-2`}>Loading more...</MyText>
|
<MyText style={tw`text-gray-600 ml-2`}>Loading more...</MyText>
|
||||||
</View>
|
</View>
|
||||||
) : null
|
) : undefined
|
||||||
),
|
),
|
||||||
[isFetchingNextPage]
|
[isFetchingNextPage]
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ export default function Stores() {
|
||||||
numColumns={2}
|
numColumns={2}
|
||||||
columnWrapperStyle={tw`justify-start`}
|
columnWrapperStyle={tw`justify-start`}
|
||||||
contentContainerStyle={tw`p-2 pb-24`}
|
contentContainerStyle={tw`p-2 pb-24`}
|
||||||
refreshControl={<RefreshControl refreshing={isLoading} onRefresh={refetch} />}
|
refreshControl={<RefreshControl refreshing={isLoading} onRefresh={() => { void refetch() }} />}
|
||||||
ListHeaderComponent={
|
ListHeaderComponent={
|
||||||
<Animated.View entering={FadeInDown.duration(600)} style={tw`mb-8 mt-4 px-1`}>
|
<Animated.View entering={FadeInDown.duration(600)} style={tw`mb-8 mt-4 px-1`}>
|
||||||
<View style={tw`flex-row justify-between items-end mb-2`}>
|
<View style={tw`flex-row justify-between items-end mb-2`}>
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ config.resolver.nodeModulesPaths = [
|
||||||
path.resolve(workspaceRoot, 'node_modules'),
|
path.resolve(workspaceRoot, 'node_modules'),
|
||||||
];
|
];
|
||||||
|
|
||||||
// 3. Force Metro to resolve (sub)dependencies only from the top-level `node_modules`
|
// 3. Keep Metro's default hierarchical lookup: forcing it off breaks packages
|
||||||
config.resolver.disableHierarchicalLookup = true;
|
// that ship their own nested dependency (react-native-reanimated 4 ships a
|
||||||
|
// semver@7 used by its worklets version check, while the root has semver@6).
|
||||||
|
|
||||||
// 4. Ensure Metro correctly resolves the entry point for expo-router
|
// 4. Ensure Metro correctly resolves the entry point for expo-router
|
||||||
// This is crucial for web builds in a monorepo with expo-router
|
// This is crucial for web builds in a monorepo with expo-router
|
||||||
|
|
|
||||||
|
|
@ -14,76 +14,64 @@
|
||||||
"test:typecheck": "tsc --noEmit --project tsconfig.json"
|
"test:typecheck": "tsc --noEmit --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^14.1.0",
|
"@expo/vector-icons": "^15.0.2",
|
||||||
"@react-native-community/datetimepicker": "8.4.1",
|
"@react-native-community/datetimepicker": "9.2.1",
|
||||||
"@react-native-picker/picker": "2.11.1",
|
|
||||||
"@react-navigation/bottom-tabs": "^7.3.10",
|
|
||||||
"@react-navigation/drawer": "^7.3.9",
|
"@react-navigation/drawer": "^7.3.9",
|
||||||
"@react-navigation/elements": "^2.3.8",
|
|
||||||
"@react-navigation/material-top-tabs": "^7.4.11",
|
|
||||||
"@react-navigation/native": "^7.1.6",
|
"@react-navigation/native": "^7.1.6",
|
||||||
"@tanstack/react-query": "^5.100.0",
|
"@tanstack/react-query": "^5.100.0",
|
||||||
"@trpc/client": "^11.6.0",
|
"@trpc/client": "^11.6.0",
|
||||||
"@trpc/react-query": "^11.6.0",
|
"@trpc/react-query": "^11.6.0",
|
||||||
"axios": "^1.11.0",
|
|
||||||
"buffer": "^6.0.3",
|
|
||||||
"date-fns": "^4.1.0",
|
"date-fns": "^4.1.0",
|
||||||
"dayjs": "^1.11.18",
|
"dayjs": "^1.11.18",
|
||||||
"expo": "~53.0.22",
|
"expo": "~58.0.26",
|
||||||
"expo-blur": "~14.1.5",
|
"expo-blur": "~58.0.6",
|
||||||
"expo-constants": "~17.1.7",
|
"expo-constants": "~58.0.16",
|
||||||
"expo-device": "~7.1.4",
|
"expo-device": "~58.0.5",
|
||||||
"expo-document-picker": "~13.1.6",
|
"expo-document-picker": "~58.0.5",
|
||||||
"expo-font": "~13.3.2",
|
"expo-font": "~58.0.12",
|
||||||
"expo-haptics": "~14.1.4",
|
"expo-image": "~58.0.18",
|
||||||
"expo-image": "~2.4.0",
|
"expo-image-picker": "~58.0.10",
|
||||||
"expo-image-picker": "~16.1.4",
|
"expo-linear-gradient": "~58.0.4",
|
||||||
"expo-linear-gradient": "~14.1.5",
|
"expo-linking": "~58.0.17",
|
||||||
"expo-linking": "~7.1.7",
|
"expo-location": "~58.0.22",
|
||||||
"expo-location": "^19.0.8",
|
"expo-notifications": "~58.1.9",
|
||||||
"expo-notifications": "~0.31.4",
|
"expo-router": "~58.0.32",
|
||||||
"expo-router": "~5.1.5",
|
"expo-secure-store": "~58.0.3",
|
||||||
"expo-secure-store": "~14.2.4",
|
"expo-splash-screen": "~58.0.14",
|
||||||
"expo-splash-screen": "~0.30.10",
|
"expo-status-bar": "~58.0.5",
|
||||||
"expo-status-bar": "~2.2.3",
|
"expo-system-ui": "~58.0.7",
|
||||||
"expo-symbols": "~0.4.5",
|
"expo-updates": "~58.0.22",
|
||||||
"expo-system-ui": "~5.0.11",
|
|
||||||
"expo-updates": "~0.28.17",
|
|
||||||
"expo-web-browser": "~14.2.0",
|
|
||||||
"formik": "^2.4.6",
|
"formik": "^2.4.6",
|
||||||
"jwt-decode": "^4.0.0",
|
"react": "19.3.0",
|
||||||
"react": "19.0.0",
|
"react-dom": "19.3.0",
|
||||||
"react-dom": "19.0.0",
|
"react-native": "0.88.1",
|
||||||
"react-hook-form": "^7.62.0",
|
|
||||||
"react-native": "0.79.6",
|
|
||||||
"react-native-draggable-flatlist": "^4.0.3",
|
"react-native-draggable-flatlist": "^4.0.3",
|
||||||
"react-native-element-dropdown": "^2.12.4",
|
"react-native-gesture-handler": "~3.3.0",
|
||||||
"react-native-gesture-handler": "~2.24.0",
|
"react-native-pager-view": "9.0.7",
|
||||||
"react-native-pager-view": "6.7.1",
|
|
||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-reanimated": "~3.17.4",
|
"react-native-reanimated": "4.7.1",
|
||||||
"react-native-safe-area-context": "5.4.0",
|
"react-native-safe-area-context": "~5.11.1",
|
||||||
"react-native-screens": "~4.11.1",
|
"react-native-screens": "~4.30.1",
|
||||||
"react-native-tab-view": "^4.1.3",
|
"react-native-tab-view": "^4.1.3",
|
||||||
"react-native-toast-message": "^2.3.3",
|
"react-native-toast-message": "^2.3.3",
|
||||||
"react-native-web": "~0.20.0",
|
"react-native-web": "~0.21.4",
|
||||||
"react-native-webview": "13.13.5",
|
"react-native-worklets": "0.13.0",
|
||||||
"twrnc": "^4.9.1",
|
"twrnc": "^4.9.1",
|
||||||
"yup": "^1.7.0"
|
"yup": "^1.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.25.2",
|
||||||
"@types/react": "~19.0.10",
|
|
||||||
"@types/react-native-razorpay": "^2.2.6",
|
|
||||||
"eslint": "^9.25.0",
|
|
||||||
"eslint-config-expo": "~9.2.0",
|
|
||||||
"typescript": "~5.8.3",
|
|
||||||
"@testing-library/react-native": "^13",
|
"@testing-library/react-native": "^13",
|
||||||
"@types/jest": "^29",
|
"@types/jest": "30.0.0",
|
||||||
"babel-preset-expo": "~13.0.0",
|
"@types/react": "~19.3.0",
|
||||||
"jest": "~29.7.0",
|
"@types/react-native-razorpay": "^2.2.6",
|
||||||
"jest-expo": "~53.0.0",
|
"babel-preset-expo": "~58.0.26",
|
||||||
"react-test-renderer": "19.0.0"
|
"eslint": "^9.25.0",
|
||||||
|
"eslint-config-expo": "~58.0.4",
|
||||||
|
"jest": "~30.5.2",
|
||||||
|
"jest-expo": "~58.0.15",
|
||||||
|
"react-test-renderer": "19.0.0",
|
||||||
|
"typescript": "~6.0.3"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,14 +153,8 @@ export const NotificationProvider: React.FC<ReactParentComponent> = ({
|
||||||
);
|
);
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (notificationListener.current) {
|
notificationListener.current?.remove();
|
||||||
Notifications.removeNotificationSubscription(
|
responseListener.current?.remove();
|
||||||
notificationListener.current
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (responseListener.current) {
|
|
||||||
Notifications.removeNotificationSubscription(responseListener.current);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}, [openFromNotification]);
|
}, [openFromNotification]);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,8 @@ import React, { useState, useEffect } from 'react';
|
||||||
import { View, Text, TouchableOpacity, FlatList } from 'react-native';
|
import { View, Text, TouchableOpacity, FlatList } from 'react-native';
|
||||||
import { Formik } from 'formik';
|
import { Formik } from 'formik';
|
||||||
import * as Yup from 'yup';
|
import * as Yup from 'yup';
|
||||||
import { MyTextInput, MyButton, tw, AppContainer , DateTimePickerMod, Checkbox, BottomDialog, MyText } from 'common-ui';
|
import { MyTextInput, MyButton, tw, AppContainer , Checkbox, BottomDialog, MyText } from 'common-ui';
|
||||||
|
import DateTimePickerMod from 'common-ui/src/components/date-time-picker';
|
||||||
import { trpc } from '../trpc-client';
|
import { trpc } from '../trpc-client';
|
||||||
import ProductsSelector from '@/components/ProductsSelector';
|
import ProductsSelector from '@/components/ProductsSelector';
|
||||||
|
|
||||||
|
|
@ -490,7 +491,7 @@ export default function CouponForm({ onSubmit, isLoading, initialValues }: Coupo
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
onEndReachedThreshold={0.5}
|
onEndReachedThreshold={0.5}
|
||||||
ListFooterComponent={isFetchingUsers ? <Text style={tw`text-center p-3`}>Loading...</Text> : null}
|
ListFooterComponent={isFetchingUsers ? <Text style={tw`text-center p-3`}>Loading...</Text> : undefined}
|
||||||
style={tw`max-h-60`}
|
style={tw`max-h-60`}
|
||||||
/>
|
/>
|
||||||
<TouchableOpacity
|
<TouchableOpacity
|
||||||
|
|
|
||||||
|
|
@ -100,10 +100,10 @@ describe('Root layout (AROOT-01..09)', () => {
|
||||||
const view = renderLayout()
|
const view = renderLayout()
|
||||||
await flush()
|
await flush()
|
||||||
|
|
||||||
expect(Notifications.removeNotificationSubscription).not.toHaveBeenCalled()
|
expect(notificationsMock.__getListenerCounts()).toEqual({ received: 1, response: 1 })
|
||||||
view.unmount()
|
view.unmount()
|
||||||
|
|
||||||
expect(Notifications.removeNotificationSubscription).toHaveBeenCalledTimes(2)
|
expect(notificationsMock.__getListenerCounts()).toEqual({ received: 0, response: 0 })
|
||||||
})
|
})
|
||||||
|
|
||||||
it('AROOT-06: a tap that launched the app opens that order', async () => {
|
it('AROOT-06: a tap that launched the app opens that order', async () => {
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,8 @@
|
||||||
import React from 'react'
|
import React from 'react'
|
||||||
import { act } from '@testing-library/react-native'
|
import { act } from '@testing-library/react-native'
|
||||||
import { fireEvent } from '@testing-library/react-native'
|
import { fireEvent } from '@testing-library/react-native'
|
||||||
import { Checkbox, DateTimePickerMod } from 'common-ui'
|
import { Checkbox } from 'common-ui'
|
||||||
|
import DateTimePickerMod from 'common-ui/src/components/date-time-picker'
|
||||||
|
|
||||||
import CouponForm from '@/src/components/CouponForm'
|
import CouponForm from '@/src/components/CouponForm'
|
||||||
import { renderWithProviders, flush } from '../helpers/test-utils'
|
import { renderWithProviders, flush } from '../helpers/test-utils'
|
||||||
|
|
|
||||||
|
|
@ -49,6 +49,11 @@ export function __emitNotification(notification: any) {
|
||||||
receivedListeners.forEach((listener) => listener(notification))
|
receivedListeners.forEach((listener) => listener(notification))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const __getListenerCounts = () => ({
|
||||||
|
received: receivedListeners.length,
|
||||||
|
response: responseListeners.length,
|
||||||
|
})
|
||||||
|
|
||||||
export function __emitResponse(response: any) {
|
export function __emitResponse(response: any) {
|
||||||
responseListeners.forEach((listener) => listener(response))
|
responseListeners.forEach((listener) => listener(response))
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ async function renderBanners(banners = [banner()], options: { stateful?: boolean
|
||||||
}
|
}
|
||||||
|
|
||||||
function icon(view: View, name: string) {
|
function icon(view: View, name: string) {
|
||||||
return view.UNSAFE_getAllByType(MaterialIcons).find((node: any) => node.props.name === name)
|
return view.UNSAFE_getAllByType(MaterialIcons).find((node: any) => node.props.name === name)!
|
||||||
}
|
}
|
||||||
|
|
||||||
async function confirmDelete(alertSpy: jest.SpyInstance) {
|
async function confirmDelete(alertSpy: jest.SpyInstance) {
|
||||||
|
|
|
||||||
|
|
@ -343,7 +343,7 @@ describe('Coupons list (ACOUPUI-01..30)', () => {
|
||||||
const icon = view
|
const icon = view
|
||||||
.UNSAFE_getAllByType(MaterialCommunityIcons)
|
.UNSAFE_getAllByType(MaterialCommunityIcons)
|
||||||
.find((node: any) => node.props.name === 'plus')
|
.find((node: any) => node.props.name === 'plus')
|
||||||
fireEvent.press(icon)
|
fireEvent.press(icon!)
|
||||||
|
|
||||||
expect(router.push).toHaveBeenCalledWith('/(drawer)/dashboard/coupons/create')
|
expect(router.push).toHaveBeenCalledWith('/(drawer)/dashboard/coupons/create')
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ async function renderGroups(groups: any[] = [GROUP_1]) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function icon(view: View, name: string) {
|
function icon(view: View, name: string) {
|
||||||
return view.UNSAFE_getAllByType(MaterialIcons).find((node: any) => node.props.name === name)
|
return view.UNSAFE_getAllByType(MaterialIcons).find((node: any) => node.props.name === name)!
|
||||||
}
|
}
|
||||||
|
|
||||||
async function confirmDelete(alertSpy: jest.SpyInstance) {
|
async function confirmDelete(alertSpy: jest.SpyInstance) {
|
||||||
|
|
|
||||||
10
apps/admin-ui/tests/types/jest-globals.d.ts
vendored
Normal file
10
apps/admin-ui/tests/types/jest-globals.d.ts
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
/**
|
||||||
|
* jest 30's @types/jest no longer declares the global `jest` object — it moved
|
||||||
|
* to `@jest/globals`. The suites still use `jest.fn()`, `jest.mock()`, etc. as
|
||||||
|
* globals, so re-declare it here instead of importing it in every test file.
|
||||||
|
*/
|
||||||
|
declare global {
|
||||||
|
const jest: typeof import('@jest/globals').jest
|
||||||
|
}
|
||||||
|
|
||||||
|
export {}
|
||||||
|
|
@ -10,11 +10,27 @@
|
||||||
"@backend/*": [
|
"@backend/*": [
|
||||||
"../backend/src/*"
|
"../backend/src/*"
|
||||||
],
|
],
|
||||||
"shared-types": ["../shared-types"],
|
"shared-types": [
|
||||||
"common-ui": ["../../packages/ui"],
|
"../shared-types"
|
||||||
"common-ui/*": ["../../packages/ui/*"]
|
],
|
||||||
|
"common-ui": [
|
||||||
|
"../../packages/ui"
|
||||||
|
],
|
||||||
|
"common-ui/*": [
|
||||||
|
"../../packages/ui/*"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"moduleSuffixes": [".ios", ".android", ".native", ".web", ""]
|
"moduleSuffixes": [
|
||||||
|
".ios",
|
||||||
|
".android",
|
||||||
|
".native",
|
||||||
|
".web",
|
||||||
|
""
|
||||||
|
],
|
||||||
|
"types": [
|
||||||
|
"jest",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
|
|
|
||||||
|
|
@ -2,16 +2,19 @@
|
||||||
"expo": {
|
"expo": {
|
||||||
"name": "Freshyo",
|
"name": "Freshyo",
|
||||||
"slug": "freshyo",
|
"slug": "freshyo",
|
||||||
"version": "1.2.0",
|
"version": "1.3.0",
|
||||||
"orientation": "portrait",
|
"orientation": "portrait",
|
||||||
"icon": "./assets/images/freshyo-logo.png",
|
"icon": "./assets/images/freshyo-logo.png",
|
||||||
"scheme": "freshyo",
|
"scheme": "freshyo",
|
||||||
"userInterfaceStyle": "automatic",
|
"userInterfaceStyle": "automatic",
|
||||||
"newArchEnabled": true,
|
|
||||||
"ios": {
|
"ios": {
|
||||||
"buildNumber": "1.1.0",
|
"buildNumber": "1.1.0",
|
||||||
"supportsTablet": true,
|
"supportsTablet": true,
|
||||||
"bundleIdentifier": "com.freshyotrial.app",
|
"bundleIdentifier": "com.freshyotrial.app",
|
||||||
|
"associatedDomains": [
|
||||||
|
"applinks:www.freshyo.in",
|
||||||
|
"applinks:app.freshyo.in"
|
||||||
|
],
|
||||||
"infoPlist": {
|
"infoPlist": {
|
||||||
"LSApplicationQueriesSchemes": [
|
"LSApplicationQueriesSchemes": [
|
||||||
"ppemerchantsdkv1",
|
"ppemerchantsdkv1",
|
||||||
|
|
@ -66,9 +69,40 @@
|
||||||
"foregroundImage": "./assets/images/freshyo-logo.png",
|
"foregroundImage": "./assets/images/freshyo-logo.png",
|
||||||
"backgroundColor": "#fff0f6"
|
"backgroundColor": "#fff0f6"
|
||||||
},
|
},
|
||||||
"edgeToEdgeEnabled": true,
|
|
||||||
"package": "in.freshyo.app",
|
"package": "in.freshyo.app",
|
||||||
"googleServicesFile": "./google-services.json"
|
"googleServicesFile": "./google-services.json",
|
||||||
|
"intentFilters": [
|
||||||
|
{
|
||||||
|
"action": "VIEW",
|
||||||
|
"autoVerify": true,
|
||||||
|
"category": [
|
||||||
|
"BROWSABLE",
|
||||||
|
"DEFAULT"
|
||||||
|
],
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"scheme": "https",
|
||||||
|
"host": "www.freshyo.in",
|
||||||
|
"pathPrefix": "/mobileoffers/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"action": "VIEW",
|
||||||
|
"autoVerify": true,
|
||||||
|
"category": [
|
||||||
|
"BROWSABLE",
|
||||||
|
"DEFAULT"
|
||||||
|
],
|
||||||
|
"data": [
|
||||||
|
{
|
||||||
|
"scheme": "https",
|
||||||
|
"host": "app.freshyo.in",
|
||||||
|
"pathPrefix": "/"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"web": {
|
"web": {
|
||||||
"bundler": "metro",
|
"bundler": "metro",
|
||||||
|
|
@ -100,7 +134,6 @@
|
||||||
},
|
},
|
||||||
"runtimeVersion": {
|
"runtimeVersion": {
|
||||||
"policy": "appVersion"
|
"policy": "appVersion"
|
||||||
|
|
||||||
},
|
},
|
||||||
"updates": {
|
"updates": {
|
||||||
"url": "https://u.expo.dev/7f3e7611-f7a8-45f9-8a99-c2b1f6454d48"
|
"url": "https://u.expo.dev/7f3e7611-f7a8-45f9-8a99-c2b1f6454d48"
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,7 @@ function Login() {
|
||||||
const [resendCountdown, setResendCountdown] = useState(0);
|
const [resendCountdown, setResendCountdown] = useState(0);
|
||||||
const [otpCells, setOtpCells] = useState(['', '', '', '']);
|
const [otpCells, setOtpCells] = useState(['', '', '', '']);
|
||||||
const intervalRef = useRef<any | null>(null);
|
const intervalRef = useRef<any | null>(null);
|
||||||
const inputRefs = useRef<(TextInput | null)[]>([null, null, null, null]);
|
const inputRefs = useRef<(React.ComponentRef<typeof TextInput> | null)[]>([null, null, null, null]);
|
||||||
|
|
||||||
// Terms and Conditions state
|
// Terms and Conditions state
|
||||||
const [termsAccepted, setTermsAccepted] = useState(true);
|
const [termsAccepted, setTermsAccepted] = useState(true);
|
||||||
|
|
@ -534,7 +534,9 @@ function Login() {
|
||||||
<View style={tw`mt-4`}>
|
<View style={tw`mt-4`}>
|
||||||
<MyButton
|
<MyButton
|
||||||
testID="user-login-submit"
|
testID="user-login-submit"
|
||||||
onPress={handleSubmit(onSubmit)}
|
onPress={() => {
|
||||||
|
void handleSubmit(onSubmit)();
|
||||||
|
}}
|
||||||
fillColor="brand600"
|
fillColor="brand600"
|
||||||
textColor="white1"
|
textColor="white1"
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|
|
||||||
|
|
@ -136,7 +136,7 @@ const StoreCard = ({
|
||||||
</MyTouchableOpacity>
|
</MyTouchableOpacity>
|
||||||
<View style={tw`h-8`} />
|
<View style={tw`h-8`} />
|
||||||
</View>
|
</View>
|
||||||
) : null}
|
) : undefined}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ export default function Layout() {
|
||||||
tabBarLabel: 'Home',
|
tabBarLabel: 'Home',
|
||||||
tabBarButtonTestID: 'tab-home',
|
tabBarButtonTestID: 'tab-home',
|
||||||
tabBarIcon: ({ color, size, focused }) => (
|
tabBarIcon: ({ color, size, focused }) => (
|
||||||
<HomeIcon focused={focused} size={size} color={color} />
|
<HomeIcon focused={focused} size={size} color={color as string} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -68,7 +68,7 @@ export default function Layout() {
|
||||||
tabBarLabel: 'Offers',
|
tabBarLabel: 'Offers',
|
||||||
tabBarButtonTestID: 'tab-offers',
|
tabBarButtonTestID: 'tab-offers',
|
||||||
tabBarIcon: ({ color, size, focused }) => (
|
tabBarIcon: ({ color, size, focused }) => (
|
||||||
<OffersIcon focused={focused} size={size} color={color} />
|
<OffersIcon focused={focused} size={size} color={color as string} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -105,7 +105,7 @@ export default function Layout() {
|
||||||
tabBarLabel: 'Stores',
|
tabBarLabel: 'Stores',
|
||||||
tabBarButtonTestID: 'tab-stores',
|
tabBarButtonTestID: 'tab-stores',
|
||||||
tabBarIcon: ({ color, size, focused }) => (
|
tabBarIcon: ({ color, size, focused }) => (
|
||||||
<StoresIcon focused={focused} size={size} color={color} />
|
<StoresIcon focused={focused} size={size} color={color as string} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
@ -115,7 +115,7 @@ export default function Layout() {
|
||||||
tabBarLabel: 'Me',
|
tabBarLabel: 'Me',
|
||||||
tabBarButtonTestID: 'tab-me',
|
tabBarButtonTestID: 'tab-me',
|
||||||
tabBarIcon: ({ color, size, focused }) => (
|
tabBarIcon: ({ color, size, focused }) => (
|
||||||
<MeIcon focused={focused} size={size} color={color} />
|
<MeIcon focused={focused} size={size} color={color as string} />
|
||||||
),
|
),
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ const CheckoutAddressSelector: React.FC<AddressSelectorProps> = ({
|
||||||
const queryClient = useQueryClient();
|
const queryClient = useQueryClient();
|
||||||
const utils = trpc.useUtils();
|
const utils = trpc.useUtils();
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const scrollViewRef = useRef<ScrollView>(null);
|
const scrollViewRef = useRef<React.ComponentRef<typeof ScrollView>>(null);
|
||||||
const { isAuthenticated } = useAuth();
|
const { isAuthenticated } = useAuth();
|
||||||
const { regionId: selectedRegionId } = useRegion();
|
const { regionId: selectedRegionId } = useRegion();
|
||||||
const { data: addresses } = trpc.user.address.getUserAddresses.useQuery(
|
const { data: addresses } = trpc.user.address.getUserAddresses.useQuery(
|
||||||
|
|
|
||||||
|
|
@ -124,7 +124,7 @@ export default function NextOrderGlimpse() {
|
||||||
const { setNavigationTarget } = useNavigationTarget();
|
const { setNavigationTarget } = useNavigationTarget();
|
||||||
const userDetails = useUserDetails();
|
const userDetails = useUserDetails();
|
||||||
const [currentIndex, setCurrentIndex] = useState(0);
|
const [currentIndex, setCurrentIndex] = useState(0);
|
||||||
const scrollViewRef = useRef<ScrollView>(null);
|
const scrollViewRef = useRef<React.ComponentRef<typeof ScrollView>>(null);
|
||||||
|
|
||||||
const { data: ordersData, isLoading: ordersLoading } = trpc.user.order.getOrders.useQuery({
|
const { data: ordersData, isLoading: ordersLoading } = trpc.user.order.getOrders.useQuery({
|
||||||
page: 1,
|
page: 1,
|
||||||
|
|
|
||||||
|
|
@ -668,7 +668,7 @@ const ProductDetail: React.FC<ProductDetailProps> = ({ productId, isFlashDeliver
|
||||||
<MyText style={tw`text-gray-300 text-xs mt-1`}>Be the first to share your thoughts!</MyText>
|
<MyText style={tw`text-gray-300 text-xs mt-1`}>Be the first to share your thoughts!</MyText>
|
||||||
</View>
|
</View>
|
||||||
}
|
}
|
||||||
ListFooterComponent={reviewsLoading ? <View style={tw`py-4`}><MyText style={tw`text-center text-gray-400 text-xs`}>Loading more reviews...</MyText></View> : null}
|
ListFooterComponent={reviewsLoading ? <View style={tw`py-4`}><MyText style={tw`text-center text-gray-400 text-xs`}>Loading more reviews...</MyText></View> : undefined}
|
||||||
scrollEnabled={false}
|
scrollEnabled={false}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
import React, { useState } from 'react';
|
import React, { useState } from 'react';
|
||||||
import { Drawer } from 'expo-router/drawer';
|
import { Drawer } from 'expo-router/drawer';
|
||||||
import { DrawerContentComponentProps } from '@react-navigation/drawer';
|
|
||||||
import { View, ScrollView, Alert, Dimensions, RefreshControl } from 'react-native';
|
import { View, ScrollView, Alert, Dimensions, RefreshControl } from 'react-native';
|
||||||
import { Image } from 'expo-image';
|
import { Image } from 'expo-image';
|
||||||
import { useRouter, usePathname, Slot } from 'expo-router';
|
import { useRouter, usePathname, Slot } from 'expo-router';
|
||||||
|
|
@ -31,7 +30,9 @@ interface SlotLayoutProps extends SlotProductsProps {
|
||||||
isForFlashDelivery?: boolean;
|
isForFlashDelivery?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
function CustomDrawerContent(baseUrl: string, drawerProps: DrawerContentComponentProps, slotIdParent?: number, storeIdParent?: number) {
|
type DrawerContentProps = Parameters<NonNullable<React.ComponentProps<typeof Drawer>['drawerContent']>>[0];
|
||||||
|
|
||||||
|
function CustomDrawerContent(baseUrl: string, drawerProps: DrawerContentProps, slotIdParent?: number, storeIdParent?: number) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
const pathname = usePathname();
|
const pathname = usePathname();
|
||||||
const { data: storesData } = useStores();
|
const { data: storesData } = useStores();
|
||||||
|
|
@ -536,7 +537,7 @@ export function SlotProducts({ slotId:slotIdParent, storeId:storeIdParent, baseU
|
||||||
<View style={tw`items-center justify-center py-10`}>
|
<View style={tw`items-center justify-center py-10`}>
|
||||||
<MyText style={tw`text-gray-400 font-medium`}>No products from this store in this slot.</MyText>
|
<MyText style={tw`text-gray-400 font-medium`}>No products from this store in this slot.</MyText>
|
||||||
</View>
|
</View>
|
||||||
) : null
|
) : undefined
|
||||||
}
|
}
|
||||||
/>
|
/>
|
||||||
</View>
|
</View>
|
||||||
|
|
|
||||||
|
|
@ -426,7 +426,9 @@ function RegistrationForm({ onSubmit, isLoading = false, initialValues, isEdit =
|
||||||
|
|
||||||
<MyButton
|
<MyButton
|
||||||
testID="registration-submit-button"
|
testID="registration-submit-button"
|
||||||
onPress={handleSubmit(handleFormSubmit)}
|
onPress={() => {
|
||||||
|
void handleSubmit(handleFormSubmit)();
|
||||||
|
}}
|
||||||
fillColor="brand500"
|
fillColor="brand500"
|
||||||
textColor="white1"
|
textColor="white1"
|
||||||
fullWidth
|
fullWidth
|
||||||
|
|
|
||||||
|
|
@ -14,77 +14,68 @@
|
||||||
"test:typecheck": "tsc --noEmit --project tsconfig.json"
|
"test:typecheck": "tsc --noEmit --project tsconfig.json"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^14.1.0",
|
"@expo/vector-icons": "^15.0.2",
|
||||||
"@react-native-community/datetimepicker": "8.4.1",
|
"@react-native-async-storage/async-storage": "2.2.0",
|
||||||
"@react-native-google-signin/google-signin": "^16.0.0",
|
|
||||||
"@react-native-picker/picker": "2.11.1",
|
|
||||||
"@react-navigation/bottom-tabs": "^7.3.10",
|
|
||||||
"@react-navigation/drawer": "^7.3.9",
|
"@react-navigation/drawer": "^7.3.9",
|
||||||
"@react-navigation/elements": "^2.3.8",
|
|
||||||
"@react-navigation/native": "^7.1.6",
|
"@react-navigation/native": "^7.1.6",
|
||||||
"@tanstack/react-query": "^5.100.0",
|
"@tanstack/react-query": "^5.100.0",
|
||||||
"@trpc/client": "^11.6.0",
|
"@trpc/client": "^11.6.0",
|
||||||
"@trpc/react-query": "^11.6.0",
|
"@trpc/react-query": "^11.6.0",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"dayjs": "^1.11.18",
|
"dayjs": "^1.11.18",
|
||||||
"expo": "~53.0.22",
|
"expo": "~58.0.26",
|
||||||
"expo-blur": "~14.1.5",
|
"expo-blur": "~58.0.6",
|
||||||
"expo-constants": "~17.1.7",
|
"expo-constants": "~58.0.16",
|
||||||
"expo-crypto": "~14.1.5",
|
"expo-crypto": "~58.0.8",
|
||||||
"expo-device": "~7.1.4",
|
"expo-device": "~58.0.5",
|
||||||
"expo-document-picker": "~13.1.6",
|
"expo-document-picker": "~58.0.5",
|
||||||
"expo-font": "~13.3.2",
|
"expo-font": "~58.0.12",
|
||||||
"expo-haptics": "~14.1.4",
|
"expo-image": "~58.0.18",
|
||||||
"expo-image": "2.4.1",
|
"expo-image-picker": "~58.0.10",
|
||||||
"expo-image-picker": "~16.1.4",
|
"expo-linear-gradient": "~58.0.4",
|
||||||
"expo-linear-gradient": "~14.1.5",
|
"expo-linking": "~58.0.17",
|
||||||
"expo-linking": "~7.1.7",
|
"expo-location": "~58.0.22",
|
||||||
"expo-location": "~18.1.6",
|
"expo-notifications": "~58.1.9",
|
||||||
"expo-notifications": "~0.31.4",
|
"expo-router": "~58.0.32",
|
||||||
"expo-router": "~5.1.5",
|
"expo-secure-store": "~58.0.3",
|
||||||
"expo-secure-store": "~14.2.4",
|
"expo-splash-screen": "~58.0.14",
|
||||||
"expo-splash-screen": "~0.30.10",
|
"expo-status-bar": "~58.0.5",
|
||||||
"expo-status-bar": "~2.2.3",
|
"expo-system-ui": "~58.0.7",
|
||||||
"expo-symbols": "~0.4.5",
|
"expo-updates": "~58.0.22",
|
||||||
"expo-system-ui": "~5.0.11",
|
"expo-web-browser": "~58.1.0",
|
||||||
"expo-updates": "~0.28.17",
|
|
||||||
"expo-web-browser": "~14.2.0",
|
|
||||||
"formik": "^2.4.6",
|
"formik": "^2.4.6",
|
||||||
"fuse.js": "^7.1.0",
|
"fuse.js": "^7.1.0",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"react": "19.0.0",
|
"react": "19.3.0",
|
||||||
"react-dom": "19.0.0",
|
"react-dom": "19.3.0",
|
||||||
"react-hook-form": "^7.62.0",
|
"react-hook-form": "^7.62.0",
|
||||||
"react-native": "0.79.6",
|
"react-native": "0.88.1",
|
||||||
"react-native-element-dropdown": "^2.12.4",
|
"react-native-gesture-handler": "~3.3.0",
|
||||||
"react-native-gesture-handler": "~2.24.0",
|
"react-native-maps": "1.29.11",
|
||||||
"react-native-pager-view": "6.7.1",
|
|
||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-razorpay": "^2.3.1",
|
"react-native-reanimated": "4.7.1",
|
||||||
"react-native-reanimated": "~3.17.4",
|
"react-native-safe-area-context": "~5.11.1",
|
||||||
"react-native-safe-area-context": "5.4.0",
|
"react-native-screens": "~4.30.1",
|
||||||
"react-native-screens": "~4.11.1",
|
"react-native-svg": "15.16.0",
|
||||||
"react-native-svg": "15.11.2",
|
|
||||||
"react-native-tab-view": "^4.1.3",
|
|
||||||
"react-native-toast-message": "^2.3.3",
|
"react-native-toast-message": "^2.3.3",
|
||||||
"react-native-web": "~0.20.0",
|
"react-native-web": "~0.21.4",
|
||||||
"react-native-webview": "13.13.5",
|
"react-native-webview": "14.0.1",
|
||||||
|
"react-native-worklets": "0.13.0",
|
||||||
"twrnc": "^4.9.1",
|
"twrnc": "^4.9.1",
|
||||||
"yup": "^1.7.0"
|
"yup": "^1.7.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.29.7",
|
||||||
"@testing-library/react-native": "^13",
|
"@testing-library/react-native": "^13",
|
||||||
"@types/jest": "^29",
|
"@types/jest": "30.0.0",
|
||||||
"@types/react": "~19.0.10",
|
"@types/react": "~19.3.0",
|
||||||
"@types/react-native-razorpay": "^2.2.6",
|
"babel-preset-expo": "~58.0.26",
|
||||||
"babel-preset-expo": "~13.0.0",
|
|
||||||
"eslint": "^9.25.0",
|
"eslint": "^9.25.0",
|
||||||
"eslint-config-expo": "~9.2.0",
|
"eslint-config-expo": "~58.0.4",
|
||||||
"jest": "~29.7.0",
|
"jest": "~30.5.2",
|
||||||
"jest-expo": "~53.0.0",
|
"jest-expo": "~58.0.15",
|
||||||
"react-test-renderer": "19.0.0",
|
"react-test-renderer": "19.0.0",
|
||||||
"typescript": "~5.8.3"
|
"typescript": "~6.0.3"
|
||||||
},
|
},
|
||||||
"private": true
|
"private": true
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -89,14 +89,8 @@ export const NotificationProvider: React.FC<ReactParentComponent> = ({
|
||||||
});
|
});
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
if (notificationListener.current) {
|
notificationListener.current?.remove();
|
||||||
Notifications.removeNotificationSubscription(
|
responseListener.current?.remove();
|
||||||
notificationListener.current
|
|
||||||
);
|
|
||||||
}
|
|
||||||
if (responseListener.current) {
|
|
||||||
Notifications.removeNotificationSubscription(responseListener.current);
|
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}, []);
|
}, []);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
import * as FileSystem from 'expo-file-system'
|
import * as FileSystem from 'expo-file-system/legacy'
|
||||||
import { IMAGE_CACHE_CLEARED_AT_KEY } from '@/src/lib/image-cache-ttl'
|
import { IMAGE_CACHE_CLEARED_AT_KEY } from '@/src/lib/image-cache-ttl'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -146,7 +146,7 @@ describe('app entry + route layouts (APP-01..APP-24)', () => {
|
||||||
.UNSAFE_getAllByType(Tabs.Screen)
|
.UNSAFE_getAllByType(Tabs.Screen)
|
||||||
.find((screen: any) => screen.props.name === '(tabs)/flash-delivery')
|
.find((screen: any) => screen.props.name === '(tabs)/flash-delivery')
|
||||||
const button = render(
|
const button = render(
|
||||||
center.props.options.tabBarButton({ style: {}, accessibilityState: { selected: true } })
|
center!.props.options.tabBarButton({ style: {}, accessibilityState: { selected: true } })
|
||||||
)
|
)
|
||||||
|
|
||||||
expect(button.getByText('1 Hr Delivery')).toBeTruthy()
|
expect(button.getByText('1 Hr Delivery')).toBeTruthy()
|
||||||
|
|
|
||||||
|
|
@ -113,7 +113,7 @@ describe('Complaints (CMP-01..CMP-18)', () => {
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
resetAllMocks()
|
resetAllMocks()
|
||||||
mockFocusCallbacks.clear()
|
mockFocusCallbacks.clear()
|
||||||
jest.spyOn(Linking, 'openURL').mockResolvedValue(true)
|
jest.spyOn(Linking, 'openURL').mockResolvedValue(undefined as any)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('CMP-01: shows loading copy while the complaints query is pending', () => {
|
it('CMP-01: shows loading copy while the complaints query is pending', () => {
|
||||||
|
|
|
||||||
|
|
@ -1568,7 +1568,7 @@ describe('Home (HOME)', () => {
|
||||||
it('HOME-110: the support mobile renders and tapping it opens a tel: link', async () => {
|
it('HOME-110: the support mobile renders and tapping it opens a tel: link', async () => {
|
||||||
signedIn()
|
signedIn()
|
||||||
setOrders([{ ...O1, deliveryStatus: 'processing' }])
|
setOrders([{ ...O1, deliveryStatus: 'processing' }])
|
||||||
const openURL = jest.spyOn(Linking, 'openURL').mockResolvedValue(true)
|
const openURL = jest.spyOn(Linking, 'openURL').mockResolvedValue(undefined as any)
|
||||||
const { getByText, getByTestId } = await renderHome()
|
const { getByText, getByTestId } = await renderHome()
|
||||||
|
|
||||||
expect(getByText('Need help? Call 8688182552')).toBeTruthy()
|
expect(getByText('Need help? Call 8688182552')).toBeTruthy()
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ describe('Me layout (APP-20..APP-23 / ME-20)', () => {
|
||||||
(screen: any) => screen.props.name === '[id]'
|
(screen: any) => screen.props.name === '[id]'
|
||||||
)
|
)
|
||||||
expect(stack.props.screenOptions.title).toBe('My Orders')
|
expect(stack.props.screenOptions.title).toBe('My Orders')
|
||||||
expect(detail.props.options.title).toBe('Order Details')
|
expect(detail!.props.options.title).toBe('Order Details')
|
||||||
})
|
})
|
||||||
|
|
||||||
it('ME-20: signed out the me layout gates the hub behind the login wall', () => {
|
it('ME-20: signed out the me layout gates the hub behind the login wall', () => {
|
||||||
|
|
|
||||||
10
apps/user-ui/tests/types/jest-globals.d.ts
vendored
Normal file
10
apps/user-ui/tests/types/jest-globals.d.ts
vendored
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
/**
|
||||||
|
* jest 30's @types/jest no longer declares the global `jest` object — it moved
|
||||||
|
* to `@jest/globals`. The suites still use `jest.fn()`, `jest.mock()`, etc. as
|
||||||
|
* globals, so re-declare it here instead of importing it in ~70 files.
|
||||||
|
*/
|
||||||
|
declare global {
|
||||||
|
const jest: typeof import('@jest/globals').jest
|
||||||
|
}
|
||||||
|
|
||||||
|
export {}
|
||||||
|
|
@ -39,7 +39,11 @@
|
||||||
".web",
|
".web",
|
||||||
""
|
""
|
||||||
],
|
],
|
||||||
"jsx": "react-native"
|
"jsx": "react-native",
|
||||||
|
"types": [
|
||||||
|
"jest",
|
||||||
|
"node"
|
||||||
|
]
|
||||||
},
|
},
|
||||||
"include": [
|
"include": [
|
||||||
"**/*.ts",
|
"**/*.ts",
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -6,10 +6,12 @@
|
||||||
"dev": "vite dev",
|
"dev": "vite dev",
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
"build:dev": "CLOUDFLARE_ENV=dev vite build",
|
"build:dev": "CLOUDFLARE_ENV=dev vite build",
|
||||||
|
"build:app": "CLOUDFLARE_ENV=app vite build",
|
||||||
"preview": "npm run build && wrangler dev",
|
"preview": "npm run build && wrangler dev",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"deploy": "npm run build && wrangler deploy",
|
"deploy": "npm run build && wrangler deploy",
|
||||||
"deploy:dev": "npm run build:dev && wrangler deploy",
|
"deploy:dev": "npm run build:dev && wrangler deploy",
|
||||||
|
"deploy:app": "npm run build:app && wrangler deploy",
|
||||||
"cf-typegen": "wrangler types"
|
"cf-typegen": "wrangler types"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
|
|
||||||
10
apps/web-ui/public/.well-known/assetlinks.json
Normal file
10
apps/web-ui/public/.well-known/assetlinks.json
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
[
|
||||||
|
{
|
||||||
|
"relation": ["delegate_permission/common.handle_all_urls"],
|
||||||
|
"target": {
|
||||||
|
"namespace": "android_app",
|
||||||
|
"package_name": "in.freshyo.app",
|
||||||
|
"sha256_cert_fingerprints": ["05:9E:E6:A4:37:42:E4:B2:2C:DD:EC:4A:98:54:E3:F7:CF:0A:5F:EF:4D:A7:C7:FD:B5:59:AB:E9:EF:96:34:4B"]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
41
apps/web-ui/src/lib/well-known.ts
Normal file
41
apps/web-ui/src/lib/well-known.ts
Normal file
|
|
@ -0,0 +1,41 @@
|
||||||
|
/**
|
||||||
|
* Domain-association documents served at /.well-known/*.
|
||||||
|
*
|
||||||
|
* The file is per-host: iOS reads the AASA from the host being opened, and the
|
||||||
|
* `components` list decides which paths on *that* host may open the app. It
|
||||||
|
* cannot be a static asset because every deploy target of this app (www,
|
||||||
|
* app.freshyo.in, devwebui) shares the same `public/` folder.
|
||||||
|
*/
|
||||||
|
|
||||||
|
/** Apple Team ID + bundle id of the mobile app (apps/user-ui/app.json). */
|
||||||
|
const APP_ID = 'YG52TAX22H.com.freshyotrial.app'
|
||||||
|
|
||||||
|
/** Hosts that claim the whole domain, everything else is treated the same. */
|
||||||
|
const WWW_HOST = 'www.freshyo.in'
|
||||||
|
|
||||||
|
export type AppleAppSiteAssociation = {
|
||||||
|
applinks: {
|
||||||
|
apps: string[]
|
||||||
|
details: Array<{
|
||||||
|
appID: string
|
||||||
|
components: Array<{ '/'?: string; exclude?: boolean }>
|
||||||
|
}>
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
export function aasaFor(hostname: string): AppleAppSiteAssociation {
|
||||||
|
// www only claims /mobileoffers/*; app.freshyo.in (and any other host that
|
||||||
|
// serves this file) claims the whole domain. Keep in sync with the
|
||||||
|
// intentFilters in apps/user-ui/app.json.
|
||||||
|
const components =
|
||||||
|
hostname === WWW_HOST
|
||||||
|
? [{ '/': '/mobileoffers/*' }]
|
||||||
|
: [{ '/': '/*' }]
|
||||||
|
|
||||||
|
return {
|
||||||
|
applinks: {
|
||||||
|
apps: [],
|
||||||
|
details: [{ appID: APP_ID, components }],
|
||||||
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
36
apps/web-ui/src/server-entry.ts
Normal file
36
apps/web-ui/src/server-entry.ts
Normal file
|
|
@ -0,0 +1,36 @@
|
||||||
|
import entry from '@tanstack/react-start/server-entry'
|
||||||
|
|
||||||
|
import { aasaFor } from './lib/well-known'
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Apple App Site Association path. Android's Digital Asset Links file stays a
|
||||||
|
* static asset (`public/.well-known/assetlinks.json`) because it is identical
|
||||||
|
* on every host; only the AASA depends on the domain being opened.
|
||||||
|
*/
|
||||||
|
const AASA_PATH = '/.well-known/apple-app-site-association'
|
||||||
|
|
||||||
|
type WorkerFetch = (request: Request, ...rest: unknown[]) => Promise<Response>
|
||||||
|
|
||||||
|
function json(body: unknown): Response {
|
||||||
|
return new Response(JSON.stringify(body, null, 2), {
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json',
|
||||||
|
// Short cache: Apple's CDN re-reads the file, and we want the ability to
|
||||||
|
// correct a bad component list without waiting a day.
|
||||||
|
'cache-control': 'public, max-age=300',
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
fetch(request: Request, ...rest: unknown[]): Response | Promise<Response> {
|
||||||
|
const { pathname, hostname } = new URL(request.url)
|
||||||
|
|
||||||
|
if (pathname === AASA_PATH) {
|
||||||
|
return json(aasaFor(hostname))
|
||||||
|
}
|
||||||
|
|
||||||
|
// Everything else is the normal TanStack Start app.
|
||||||
|
return (entry.fetch as unknown as WorkerFetch)(request, ...rest)
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -5,7 +5,7 @@
|
||||||
"observability": {
|
"observability": {
|
||||||
"enabled": true
|
"enabled": true
|
||||||
},
|
},
|
||||||
"main": "@tanstack/react-start/server-entry",
|
"main": "./src/server-entry.ts",
|
||||||
"compatibility_flags": [
|
"compatibility_flags": [
|
||||||
"nodejs_compat"
|
"nodejs_compat"
|
||||||
],
|
],
|
||||||
|
|
@ -22,6 +22,18 @@
|
||||||
"custom_domain": true
|
"custom_domain": true
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
// Mobile-app host: serves app.freshyo.in, including its own
|
||||||
|
// /.well-known/* association files (Android App Links + iOS AASA).
|
||||||
|
// Build with CLOUDFLARE_ENV=app (`npm run deploy:app`).
|
||||||
|
"app": {
|
||||||
|
"name": "web-ui-app",
|
||||||
|
"routes": [
|
||||||
|
{
|
||||||
|
"pattern": "app.freshyo.in",
|
||||||
|
"custom_domain": true
|
||||||
|
}
|
||||||
|
]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
257
change-log.txt
257
change-log.txt
|
|
@ -1508,3 +1508,260 @@ case and smaller so it fits beside the 2xl figure).
|
||||||
(testID cart-item-coupon-price-{id})
|
(testID cart-item-coupon-price-{id})
|
||||||
- footer: standalone hint block under the subtotal row
|
- footer: standalone hint block under the subtotal row
|
||||||
+ hint inline with ₹subtotal (testID apply-coupons-hint, numberOfLines 1)
|
+ hint inline with ₹subtotal (testID apply-coupons-hint, numberOfLines 1)
|
||||||
|
|
||||||
|
[2026-11-17 08:33:07 IST] user-ui: drop dependencies nothing imports.
|
||||||
|
|
||||||
|
Every removed entry was checked against real import/require statements in
|
||||||
|
apps/user-ui and packages/ui (no docs/mentions counted). Everything kept is
|
||||||
|
still installed through another workspace package or required by app.json /
|
||||||
|
Expo tooling, so this only shrinks the manifest - not the hoisted install.
|
||||||
|
|
||||||
|
--- apps/user-ui/package.json (dependencies)
|
||||||
|
- @react-native-google-signin/google-signin: 0 imports repo-wide
|
||||||
|
- @react-native-picker/picker: 0 imports
|
||||||
|
- @react-navigation/bottom-tabs: 0 imports (expo-router depends on it)
|
||||||
|
- @react-navigation/elements: 0 imports (@react-navigation/drawer depends on it)
|
||||||
|
- expo-haptics: 0 imports
|
||||||
|
- expo-symbols: 0 imports
|
||||||
|
- react-native-element-dropdown: only packages/ui (dropdown/multi-select)
|
||||||
|
- react-native-pager-view: 0 direct imports
|
||||||
|
- react-native-tab-view: only apps/admin-ui
|
||||||
|
- react-native-razorpay: 0 imports (checkout uses PhonePe)
|
||||||
|
- @react-native-community/datetimepicker: only packages/ui (date pickers)
|
||||||
|
--- apps/user-ui/package.json (devDependencies)
|
||||||
|
- @types/react-native-razorpay: only typed the removed razorpay package
|
||||||
|
|
||||||
|
Kept despite being imported only by packages/ui: expo-blur, expo-document-picker,
|
||||||
|
expo-status-bar, expo-crypto, expo-web-browser, twrnc.
|
||||||
|
Kept despite 0 direct imports: expo-secure-store / expo-splash-screen (app.json
|
||||||
|
plugins), expo-system-ui (userInterfaceStyle), react-native-screens (expo-router
|
||||||
|
peer), react-native-web + react-dom (web bundler).
|
||||||
|
|
||||||
|
[2026-11-17 08:34:11 IST] user-ui: add @react-native-async-storage/async-storage 2.1.2.
|
||||||
|
|
||||||
|
Expo's bundledNativeModules for SDK 53 pins 2.1.2, so it is installed exact
|
||||||
|
(no caret) to keep `npx expo install --check` quiet and the native module in
|
||||||
|
step with the SDK. Installed with bun so the workspace lockfile stays the
|
||||||
|
source of truth.
|
||||||
|
|
||||||
|
--- apps/user-ui/package.json (dependencies)
|
||||||
|
+ "@react-native-async-storage/async-storage": "2.1.2"
|
||||||
|
|
||||||
|
[2026-11-17 23:09:20 IST] user-ui app.json: claim two link surfaces for the app.
|
||||||
|
|
||||||
|
--- apps/user-ui/app.json (ios)
|
||||||
|
+ "associatedDomains": ["applinks:www.freshyo.in", "applinks:app.freshyo.in"]
|
||||||
|
--- apps/user-ui/app.json (android)
|
||||||
|
+ "intentFilters": one autoVerify VIEW filter with two https data entries:
|
||||||
|
+ www.freshyo.in pathPrefix "/mobileoffers/"
|
||||||
|
+ app.freshyo.in pathPrefix "/"
|
||||||
|
|
||||||
|
[2026-11-17 23:11:26 IST] web-ui: add the domain-association files with placeholders.
|
||||||
|
|
||||||
|
Static files under public/ are copied verbatim by Vite into dist/client, so both
|
||||||
|
are served at the site root. Values that only the Apple/Play accounts can
|
||||||
|
provide are left as REPLACE_WITH_* tokens.
|
||||||
|
|
||||||
|
--- apps/web-ui/public/.well-known/apple-app-site-association (new)
|
||||||
|
iOS AASA for www.freshyo.in; components restricted to /mobileoffers/*
|
||||||
|
(app.freshyo.in needs its own copy claiming /* and must be served by that host)
|
||||||
|
--- apps/web-ui/public/.well-known/assetlinks.json (new)
|
||||||
|
Android Digital Asset Links for in.freshyo.app; SHA-256 fingerprint placeholder
|
||||||
|
|
||||||
|
[2026-11-17 23:16:23 IST] web-ui: fill the Android signing fingerprint in assetlinks.json.
|
||||||
|
|
||||||
|
--- apps/web-ui/public/.well-known/assetlinks.json
|
||||||
|
- "sha256_cert_fingerprints": ["REPLACE_WITH_SHA256_CERT_FINGERPRINT"]
|
||||||
|
+ "sha256_cert_fingerprints": ["05:9E:E6:A4:37:42:E4:B2:2C:DD:EC:4A:98:54:E3:F7:CF:0A:5F:EF:4D:A7:C7:FD:B5:59:AB:E9:EF:96:34:4B"]
|
||||||
|
|
||||||
|
[2026-11-17 23:17:24 IST] web-ui: fill the Apple Team ID in the AASA.
|
||||||
|
|
||||||
|
--- apps/web-ui/public/.well-known/apple-app-site-association
|
||||||
|
- "appID": "REPLACE_WITH_APPLE_TEAM_ID.com.freshyotrial.app"
|
||||||
|
+ "appID": "YG52TAX22H.com.freshyotrial.app"
|
||||||
|
|
||||||
|
[2026-11-18 00:14:23 IST] common-ui: stop the barrel from eagerly pulling native modules.
|
||||||
|
|
||||||
|
The app crashed on launch with "TurboModuleRegistry.getEnforcing(...):
|
||||||
|
'RNCDatePicker' could not be found" because `import { ... } from 'common-ui'`
|
||||||
|
evaluated packages/ui/index.ts, which statically imported the date pickers, and
|
||||||
|
@react-native-community/datetimepicker resolves its native module at import time.
|
||||||
|
Nothing in user-ui renders a picker; the import alone was enough.
|
||||||
|
|
||||||
|
--- packages/ui/index.ts
|
||||||
|
- import DatePicker from "./src/components/date-picker" (dead: 0 consumers)
|
||||||
|
- import DateTimePickerMod from "./src/components/date-time-picker" (kept, but no
|
||||||
|
longer re-exported - only admin-ui uses it, via a deep import like SlotForm.tsx)
|
||||||
|
- dropped both from the export block
|
||||||
|
|
||||||
|
--- packages/ui/src/components/date-picker.tsx (deleted, 99 lines, 0 importers)
|
||||||
|
--- packages/ui/src/components/dropdown.tsx (deleted, 85 lines, 0 importers)
|
||||||
|
--- packages/ui/src/components/multi-select.tsx (deleted, 118 lines, 0 importers)
|
||||||
|
|
||||||
|
--- packages/ui/src/components/bottom-dropdown.tsx
|
||||||
|
+ inlined DropdownBaseProps (was imported as a type from the deleted dropdown.tsx)
|
||||||
|
|
||||||
|
--- packages/ui/package.json
|
||||||
|
- react-native-element-dropdown (only the two deleted components used it)
|
||||||
|
- expo-haptics, expo-symbols, @react-native-picker/picker, react-native-pager-view,
|
||||||
|
react-native-tab-view, react-native-razorpay, @react-native-google-signin/google-signin,
|
||||||
|
@react-navigation/bottom-tabs, @react-navigation/elements (0 references in packages/ui)
|
||||||
|
kept: @react-native-community/datetimepicker (date-time-picker.tsx needs it)
|
||||||
|
--- apps/admin-ui/src/components/CouponForm.tsx
|
||||||
|
- DateTimePickerMod from 'common-ui'
|
||||||
|
+ DateTimePickerMod from 'common-ui/src/components/date-time-picker'
|
||||||
|
--- apps/admin-ui/tests/components/coupon-form.test.tsx (same import switch)
|
||||||
|
|
||||||
|
[2026-11-18 00:25:23 IST] user-ui app.json: split the App Links filter per host.
|
||||||
|
|
||||||
|
Android merges the attributes of every <data> element inside one intent filter,
|
||||||
|
so the single filter (hosts www+app, paths /mobileoffers/ + /) matched the
|
||||||
|
cartesian product: www.freshyo.in/cart opened the app. Two filters now, one per
|
||||||
|
host, so www is restricted to /mobileoffers/ and app.freshyo.in keeps /.
|
||||||
|
|
||||||
|
--- apps/user-ui/app.json (android.intentFilters)
|
||||||
|
- one filter with data: [www + /mobileoffers/, app + /]
|
||||||
|
+ filter 1: www.freshyo.in pathPrefix /mobileoffers/
|
||||||
|
+ filter 2: app.freshyo.in pathPrefix /
|
||||||
|
|
||||||
|
[2026-11-18 00:27:54 IST] admin-ui: drop dependencies nothing imports.
|
||||||
|
|
||||||
|
Same audit as user-ui: every entry below has zero import/require statements in
|
||||||
|
apps/admin-ui, and is not needed by a config plugin, a native autolinking
|
||||||
|
target, or a peer of expo-router / react-native-tab-view.
|
||||||
|
|
||||||
|
--- apps/admin-ui/package.json (dependencies)
|
||||||
|
- @react-native-picker/picker (0 refs; no component uses it)
|
||||||
|
- @react-navigation/bottom-tabs (0 refs; expo-router depends on it)
|
||||||
|
- @react-navigation/elements (0 refs; @react-navigation/drawer depends on it)
|
||||||
|
- @react-navigation/material-top-tabs (0 refs; TabView comes from react-native-tab-view)
|
||||||
|
- axios (0 refs; only packages/ui/src/services/axios.ts
|
||||||
|
uses it and nothing imports that file)
|
||||||
|
- buffer (0 refs; Buffer only used as a Node global in tests)
|
||||||
|
- expo-haptics (0 refs)
|
||||||
|
- expo-symbols (0 refs)
|
||||||
|
- expo-web-browser (0 refs; only packages/ui/google-sign-in.tsx,
|
||||||
|
which admin-ui never imports)
|
||||||
|
- jwt-decode (0 refs)
|
||||||
|
- react-hook-form (0 refs; forms use formik + yup)
|
||||||
|
- react-native-element-dropdown (0 refs; its common-ui consumers were deleted)
|
||||||
|
- react-native-webview (0 refs)
|
||||||
|
|
||||||
|
Kept on purpose: @react-native-community/datetimepicker (CouponForm/SlotForm
|
||||||
|
deep-import the common-ui date-time-picker), react-native-pager-view (native
|
||||||
|
partner of the used react-native-tab-view), react-native-screens / expo-linking /
|
||||||
|
expo-constants / expo-font (expo-router + vector-icons), expo-updates (app.json
|
||||||
|
updates.url), expo-system-ui (userInterfaceStyle), expo-splash-screen /
|
||||||
|
expo-secure-store (app.json plugins), react-dom + react-native-web ("web" script
|
||||||
|
and app.json web output), expo-document-picker + expo-status-bar (common-ui
|
||||||
|
components admin-ui renders).
|
||||||
|
|
||||||
|
[2026-11-18 00:33:51 IST] web-ui: add an "app" deploy target for app.freshyo.in.
|
||||||
|
|
||||||
|
--- apps/web-ui/package.json (scripts)
|
||||||
|
+ "build:app": "CLOUDFLARE_ENV=app vite build"
|
||||||
|
+ "deploy:app": "npm run build:app && wrangler deploy"
|
||||||
|
--- apps/web-ui/wrangler.jsonc (env)
|
||||||
|
+ "app": { "name": "web-ui-app", "routes": [{ "pattern": "app.freshyo.in",
|
||||||
|
"custom_domain": true }] }
|
||||||
|
same shape as env.dev: separate Worker, own custom domain, routes kept out of
|
||||||
|
the top-level so prod/dev/app never claim each other's host.
|
||||||
|
|
||||||
|
[2026-11-18 00:36:12 IST] web-ui: serve the AASA per host from the worker entry.
|
||||||
|
|
||||||
|
The association file is per-host, but public/ is shared by every deploy target,
|
||||||
|
so app.freshyo.in would have served the www variant (/mobileoffers/* only).
|
||||||
|
The file is now generated by a thin worker entry that switches on the request
|
||||||
|
host; assetlinks.json stays static (it is host-agnostic).
|
||||||
|
|
||||||
|
--- apps/web-ui/src/lib/well-known.ts (new)
|
||||||
|
aasaFor(hostname): www.freshyo.in -> /mobileoffers/*, everything else -> /*
|
||||||
|
--- apps/web-ui/src/server-entry.ts (new)
|
||||||
|
intercepts /.well-known/apple-app-site-association, delegates everything else
|
||||||
|
to @tanstack/react-start/server-entry
|
||||||
|
--- apps/web-ui/wrangler.jsonc
|
||||||
|
- "main": "@tanstack/react-start/server-entry"
|
||||||
|
+ "main": "./src/server-entry.ts"
|
||||||
|
--- apps/web-ui/public/.well-known/apple-app-site-association (deleted)
|
||||||
|
the static file would shadow the worker (assets are served before the worker)
|
||||||
|
|
||||||
|
[2026-11-18 01:43:01 IST] user-ui: add react-native-maps (dependency only).
|
||||||
|
|
||||||
|
Expo SDK 53 pins 1.20.1, installed exact like the other native modules. No
|
||||||
|
imports, screens or config changes - the package is only declared so the next
|
||||||
|
native build links it.
|
||||||
|
|
||||||
|
--- apps/user-ui/package.json (dependencies)
|
||||||
|
+ "react-native-maps": "1.20.1"
|
||||||
|
|
||||||
|
[2026-11-18 01:53:59 IST] expo sdk 53 -> 58 across the monorepo.
|
||||||
|
|
||||||
|
SDK 58 is five majors ahead (53 -> 54 -> 55 -> 56 -> 57 -> 58): react-native
|
||||||
|
0.79.6 -> 0.88.1, react 19.0.0 -> 19.3.0, expo-router 5.1.5 -> 58.0.32,
|
||||||
|
reanimated 3.17 -> 4.7.1 (+ react-native-worklets 0.13), gesture-handler
|
||||||
|
2.24 -> 3.3.0, every expo-* module renumbered to 58.x. All four manifests moved
|
||||||
|
together because bun hoists a single react-native copy.
|
||||||
|
|
||||||
|
--- package.json (root)
|
||||||
|
expo ~58.0.26, react 19.3.0, react-native 0.88.1, @react-native/virtualized-lists ^0.88.1,
|
||||||
|
expo-auth-session ~58.0.19, expo-crypto ~58.0.8, expo-web-browser ~58.1.0,
|
||||||
|
@babel/core ^7.29.7, typescript ~6.0.3, @types/react ~19.3.0, eslint-config-expo ~58.0.4
|
||||||
|
--- apps/user-ui/package.json
|
||||||
|
expo 58.0.26, expo-router ~58.0.32, expo-* all 58.x, RN 0.88.1, react 19.3.0,
|
||||||
|
react-native-maps 1.20.1 -> 1.29.11, gesture-handler ~3.3.0, reanimated 4.7.1,
|
||||||
|
+ react-native-worklets 0.13.0, screens ~4.30.1, safe-area ~5.11.1, svg 15.16.0,
|
||||||
|
webview 14.0.1, react-native-web ~0.21.4, async-storage 2.2.0,
|
||||||
|
jest ~30.5.2 + @types/jest 30, jest-expo ~58.0.15, typescript ~6.0.3,
|
||||||
|
babel-preset-expo ~58.0.26, eslint-config-expo ~58.0.4
|
||||||
|
--- apps/admin-ui/package.json
|
||||||
|
same set plus datetimepicker 9.2.1, pager-view 9.0.7
|
||||||
|
--- packages/ui/package.json
|
||||||
|
same set (common-ui compiled inside both apps)
|
||||||
|
--- apps/{user-ui,admin-ui}/app.json
|
||||||
|
- "newArchEnabled": true (not a valid field any more; new arch only)
|
||||||
|
- "android.edgeToEdgeEnabled": true (mandatory/default now)
|
||||||
|
--- apps/{user-ui,admin-ui}/tsconfig.json
|
||||||
|
+ "types": ["jest", "node"] (TS 6 no longer auto-includes @types/jest here)
|
||||||
|
--- apps/{user-ui,admin-ui}/tests/types/jest-globals.d.ts (new)
|
||||||
|
re-declares the global `jest` object that @types/jest 30 moved to @jest/globals
|
||||||
|
--- apps/admin-ui/metro.config.js
|
||||||
|
- config.resolver.disableHierarchicalLookup = true
|
||||||
|
(reanimated 4 validates worklets with its nested semver@7 while root has
|
||||||
|
semver@6, so forcing top-level-only lookup broke the export)
|
||||||
|
|
||||||
|
code migrations:
|
||||||
|
--- app/(auth)/login.tsx TextInput refs -> React.ComponentRef<typeof TextInput>; submit handler wrapped
|
||||||
|
--- components/registration-form.tsx submit handler wrapped (onPress expects a gesture event)
|
||||||
|
--- app/(drawer)/_layout.tsx tabBarIcon color is ColorValue -> cast to string
|
||||||
|
--- components/{CheckoutAddressSelector,NextOrderGlimpse}.tsx
|
||||||
|
ScrollView refs -> React.ComponentRef<typeof ScrollView>
|
||||||
|
--- app/(drawer)/(tabs)/stores/index.tsx, components/ProductDetail.tsx,
|
||||||
|
components/SlotSpecificView.tsx list slots: null -> undefined (Element | null no longer accepted)
|
||||||
|
--- components/SlotSpecificView.tsx DrawerContentComponentProps derived from expo-router's Drawer
|
||||||
|
(expo-router 58 vendors its own react-navigation types)
|
||||||
|
--- services/notif-service/notif-context.tsx (both apps)
|
||||||
|
- Notifications.removeNotificationSubscription(sub) (removed from the API)
|
||||||
|
+ sub?.remove()
|
||||||
|
--- src/lib/image-cache-meta.ts expo-file-system -> expo-file-system/legacy (same API; new
|
||||||
|
File/Paths API is a follow-up)
|
||||||
|
--- packages/ui/src/components/bottom-dropdown.tsx
|
||||||
|
timer ref -> ReturnType<typeof setTimeout>
|
||||||
|
--- admin-ui: complaints / orders / CouponForm list slots null -> undefined;
|
||||||
|
RefreshControl onRefresh wraps refetch (it returns a QueryObserverResult now);
|
||||||
|
tests updated for the new subscription teardown and non-null finds
|
||||||
|
|
||||||
|
verified: tsc clean in user-ui + admin-ui; expo export (android) builds for both;
|
||||||
|
expo install --check clean; jest configs resolve under jest 30; expo-doctor only
|
||||||
|
reports the pre-existing lock-file / .expo-ignore warnings.
|
||||||
|
|
||||||
|
[2026-11-18 01:58:44 IST] user-ui: bump app version to 1.3.0 for the SDK 58 build.
|
||||||
|
|
||||||
|
runtimeVersion is `policy: appVersion`, and it is still 1.2.0 - the same value
|
||||||
|
the SDK 53 APK shipped with. Publishing an SDK 58 update under 1.2.0 would be
|
||||||
|
delivered to those old binaries, whose native side has no react-native-worklets
|
||||||
|
(reanimated 4) and would crash on launch. Bumping the version gives the new
|
||||||
|
build its own runtimeVersion so OTA traffic cannot cross SDK lines.
|
||||||
|
|
||||||
|
--- apps/user-ui/app.json
|
||||||
|
- "version": "1.2.0"
|
||||||
|
+ "version": "1.3.0"
|
||||||
|
|
|
||||||
22
package.json
22
package.json
|
|
@ -27,20 +27,20 @@
|
||||||
"packages/*"
|
"packages/*"
|
||||||
],
|
],
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"@babel/core": "^7.25.2",
|
"@babel/core": "^7.29.7",
|
||||||
"@playwright/test": "^1.63.0",
|
"@playwright/test": "^1.63.0",
|
||||||
"@types/bun": "^1.4.4",
|
"@types/bun": "^1.4.4",
|
||||||
"@types/canvas-confetti": "^1.9.0",
|
"@types/canvas-confetti": "^1.9.0",
|
||||||
"@types/node": "^22.10.2",
|
"@types/node": "^22.10.2",
|
||||||
"@types/react": "~19.0.10",
|
"@types/react": "~19.3.0",
|
||||||
"@types/react-native-razorpay": "^2.2.6",
|
"@types/react-native-razorpay": "^2.2.6",
|
||||||
"eslint": "^9.25.0",
|
"eslint": "^9.25.0",
|
||||||
"eslint-config-expo": "~9.2.0",
|
"eslint-config-expo": "~58.0.4",
|
||||||
"turbo": "^2.0.0",
|
"turbo": "^2.0.0",
|
||||||
"typescript": "~5.8.3"
|
"typescript": "~6.0.3"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@react-native/virtualized-lists": "^0.79.6",
|
"@react-native/virtualized-lists": "^0.88.1",
|
||||||
"@react-three/drei": "^10.7.7",
|
"@react-three/drei": "^10.7.7",
|
||||||
"@react-three/fiber": "^9.5.0",
|
"@react-three/fiber": "^9.5.0",
|
||||||
"@types/three": "^0.182.0",
|
"@types/three": "^0.182.0",
|
||||||
|
|
@ -48,16 +48,16 @@
|
||||||
"backend": "^1.0.0",
|
"backend": "^1.0.0",
|
||||||
"canvas-confetti": "^1.9.4",
|
"canvas-confetti": "^1.9.4",
|
||||||
"drizzle-orm": "^0.45.1",
|
"drizzle-orm": "^0.45.1",
|
||||||
"expo": "~53.0.22",
|
"expo": "~58.0.26",
|
||||||
"expo-auth-session": "~6.2.1",
|
"expo-auth-session": "~58.0.19",
|
||||||
"expo-crypto": "~14.1.5",
|
"expo-crypto": "~58.0.8",
|
||||||
"expo-server-sdk": "^5.0.0",
|
"expo-server-sdk": "^5.0.0",
|
||||||
"expo-web-browser": "~14.2.0",
|
"expo-web-browser": "~58.1.0",
|
||||||
"fuse.js": "^7.1.0",
|
"fuse.js": "^7.1.0",
|
||||||
"node-cron": "^4.2.1",
|
"node-cron": "^4.2.1",
|
||||||
"pg": "^8.20.0",
|
"pg": "^8.20.0",
|
||||||
"react": "19.0.0",
|
"react": "19.3.0",
|
||||||
"react-native": "0.79.6",
|
"react-native": "0.88.1",
|
||||||
"three": "^0.182.0",
|
"three": "^0.182.0",
|
||||||
"user-ui": "^1.0.0",
|
"user-ui": "^1.0.0",
|
||||||
"zustand": "^5.0.9"
|
"zustand": "^5.0.9"
|
||||||
|
|
|
||||||
|
|
@ -11,7 +11,6 @@ import { useTheme, Theme } from "./hooks/theme-context";
|
||||||
import MyTextInput from "./src/components/textinput";
|
import MyTextInput from "./src/components/textinput";
|
||||||
import BottomDialog, { ConfirmationDialog, RawBottomDialog } from "./src/components/dialog";
|
import BottomDialog, { ConfirmationDialog, RawBottomDialog } from "./src/components/dialog";
|
||||||
import LoadingDialog from "./src/components/loading-dialog";
|
import LoadingDialog from "./src/components/loading-dialog";
|
||||||
import DatePicker from "./src/components/date-picker";
|
|
||||||
import MyText from "./src/components/text";
|
import MyText from "./src/components/text";
|
||||||
import MyTouchableOpacity from "./src/components/touchable-opacity";
|
import MyTouchableOpacity from "./src/components/touchable-opacity";
|
||||||
import BottomDropdown from "./src/components/bottom-dropdown";
|
import BottomDropdown from "./src/components/bottom-dropdown";
|
||||||
|
|
@ -32,7 +31,6 @@ import useManualRefresh from "./hooks/useManualRefresh";
|
||||||
import { useDrawerTitle } from "./hooks/useDrawerTitle";
|
import { useDrawerTitle } from "./hooks/useDrawerTitle";
|
||||||
import { useMarkDataFetchers } from "./hooks/useMarkDataFetchers";
|
import { useMarkDataFetchers } from "./hooks/useMarkDataFetchers";
|
||||||
import { StorageServiceCasual } from "./src/services/StorageServiceCasual";
|
import { StorageServiceCasual } from "./src/services/StorageServiceCasual";
|
||||||
import DateTimePickerMod from "./src/components/date-time-picker";
|
|
||||||
import { RefreshProvider, useRefresh } from "./src/lib/refresh-context";
|
import { RefreshProvider, useRefresh } from "./src/lib/refresh-context";
|
||||||
import MyStatusBar from "./src/components/MyStatusBar";
|
import MyStatusBar from "./src/components/MyStatusBar";
|
||||||
import { InfoDialog } from "./src/components/info-dialog";
|
import { InfoDialog } from "./src/components/info-dialog";
|
||||||
|
|
@ -56,7 +54,6 @@ export {
|
||||||
MyTouchableOpacity,
|
MyTouchableOpacity,
|
||||||
ConfirmationDialog,
|
ConfirmationDialog,
|
||||||
RawBottomDialog,
|
RawBottomDialog,
|
||||||
DatePicker,
|
|
||||||
BottomDropdown,
|
BottomDropdown,
|
||||||
ImageViewerURI,
|
ImageViewerURI,
|
||||||
ImageCarousel,
|
ImageCarousel,
|
||||||
|
|
@ -77,7 +74,6 @@ export {
|
||||||
useDrawerTitle,
|
useDrawerTitle,
|
||||||
useMarkDataFetchers,
|
useMarkDataFetchers,
|
||||||
StorageServiceCasual,
|
StorageServiceCasual,
|
||||||
DateTimePickerMod,
|
|
||||||
RefreshProvider,
|
RefreshProvider,
|
||||||
useRefresh,
|
useRefresh,
|
||||||
MyStatusBar,
|
MyStatusBar,
|
||||||
|
|
|
||||||
|
|
@ -4,58 +4,49 @@
|
||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"private": true,
|
"private": true,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@expo/vector-icons": "^14.1.0",
|
"@expo/vector-icons": "^15.0.2",
|
||||||
"@react-native-community/datetimepicker": "8.4.1",
|
"@react-native-community/datetimepicker": "9.2.1",
|
||||||
"@react-native-google-signin/google-signin": "^16.0.0",
|
|
||||||
"@react-native-picker/picker": "2.11.1",
|
|
||||||
"@react-navigation/bottom-tabs": "^7.3.10",
|
|
||||||
"@react-navigation/drawer": "^7.5.8",
|
"@react-navigation/drawer": "^7.5.8",
|
||||||
"@react-navigation/elements": "^2.3.8",
|
|
||||||
"@react-navigation/native": "^7.1.6",
|
"@react-navigation/native": "^7.1.6",
|
||||||
"@tanstack/react-query": "^5.100.0",
|
"@tanstack/react-query": "^5.100.0",
|
||||||
"axios": "^1.11.0",
|
"axios": "^1.11.0",
|
||||||
"buffer": "^6.0.3",
|
"buffer": "^6.0.3",
|
||||||
"dayjs": "^1.11.18",
|
"dayjs": "^1.11.18",
|
||||||
"expo": "~53.0.22",
|
"expo": "~58.0.26",
|
||||||
"expo-blur": "~14.1.5",
|
"expo-blur": "~58.0.6",
|
||||||
"expo-constants": "~17.1.7",
|
"expo-constants": "~58.0.16",
|
||||||
"expo-dev-client": "~5.2.4",
|
"expo-dev-client": "~58.0.21",
|
||||||
"expo-device": "~7.1.4",
|
"expo-device": "~58.0.5",
|
||||||
"expo-document-picker": "~13.1.6",
|
"expo-document-picker": "~58.0.5",
|
||||||
"expo-font": "~13.3.2",
|
"expo-font": "~58.0.12",
|
||||||
"expo-haptics": "~14.1.4",
|
"expo-image": "~58.0.18",
|
||||||
"expo-image": "~2.4.0",
|
"expo-image-picker": "~58.0.10",
|
||||||
"expo-image-picker": "~16.1.4",
|
"expo-linear-gradient": "~58.0.4",
|
||||||
"expo-linear-gradient": "~14.1.5",
|
"expo-linking": "~58.0.17",
|
||||||
"expo-linking": "~7.1.7",
|
"expo-notifications": "~58.1.9",
|
||||||
"expo-notifications": "~0.31.4",
|
"expo-router": "~58.0.32",
|
||||||
"expo-router": "~5.1.5",
|
"expo-secure-store": "~58.0.3",
|
||||||
"expo-secure-store": "~14.2.4",
|
"expo-splash-screen": "~58.0.14",
|
||||||
"expo-splash-screen": "~0.30.10",
|
"expo-status-bar": "~58.0.5",
|
||||||
"expo-status-bar": "~2.2.3",
|
"expo-system-ui": "~58.0.7",
|
||||||
"expo-symbols": "~0.4.5",
|
"expo-web-browser": "~58.1.0",
|
||||||
"expo-system-ui": "~5.0.11",
|
|
||||||
"expo-web-browser": "~14.2.0",
|
|
||||||
"formik": "^2.4.6",
|
"formik": "^2.4.6",
|
||||||
"jwt-decode": "^4.0.0",
|
"jwt-decode": "^4.0.0",
|
||||||
"react": "19.0.0",
|
"react": "19.3.0",
|
||||||
"react-dom": "19.0.0",
|
"react-dom": "19.3.0",
|
||||||
"react-hook-form": "^7.62.0",
|
"react-hook-form": "^7.62.0",
|
||||||
"react-native": "0.79.6",
|
"react-native": "0.88.1",
|
||||||
"react-native-element-dropdown": "^2.12.4",
|
"react-native-gesture-handler": "~3.3.0",
|
||||||
"react-native-gesture-handler": "~2.24.0",
|
|
||||||
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
"react-native-keyboard-aware-scroll-view": "^0.9.5",
|
||||||
"react-native-pager-view": "^6.9.1",
|
|
||||||
"react-native-paper": "^5.14.5",
|
"react-native-paper": "^5.14.5",
|
||||||
"react-native-phonepe-pg": "^3.1.1",
|
"react-native-phonepe-pg": "^3.1.1",
|
||||||
"react-native-razorpay": "^2.3.0",
|
"react-native-reanimated": "4.7.1",
|
||||||
"react-native-reanimated": "~3.17.4",
|
"react-native-safe-area-context": "~5.11.1",
|
||||||
"react-native-safe-area-context": "5.4.0",
|
"react-native-screens": "~4.30.1",
|
||||||
"react-native-screens": "~4.11.1",
|
|
||||||
"react-native-tab-view": "^4.1.3",
|
|
||||||
"react-native-toast-message": "^2.3.3",
|
"react-native-toast-message": "^2.3.3",
|
||||||
"react-native-web": "~0.20.0",
|
"react-native-web": "~0.21.4",
|
||||||
"react-native-webview": "13.13.5",
|
"react-native-webview": "14.0.1",
|
||||||
|
"react-native-worklets": "0.13.0",
|
||||||
"twrnc": "^4.9.1",
|
"twrnc": "^4.9.1",
|
||||||
"yup": "^1.7.0",
|
"yup": "^1.7.0",
|
||||||
"zustand": "^5.0.10"
|
"zustand": "^5.0.10"
|
||||||
|
|
|
||||||
|
|
@ -7,7 +7,19 @@ import { useTheme } from '../../hooks/theme-context';
|
||||||
import tw from '../lib/tailwind';
|
import tw from '../lib/tailwind';
|
||||||
import { colors } from '../lib/theme-colors';
|
import { colors } from '../lib/theme-colors';
|
||||||
import type { DropdownOption as BaseDropdownOption } from '@packages/shared';
|
import type { DropdownOption as BaseDropdownOption } from '@packages/shared';
|
||||||
import type { DropdownBaseProps } from './dropdown';
|
|
||||||
|
// Shared shape for the dropdown components. Used to live in ./dropdown, which
|
||||||
|
// wrapped react-native-element-dropdown; that component had no consumers, so
|
||||||
|
// the type lives here now and the dependency is gone.
|
||||||
|
export interface DropdownBaseProps<O> {
|
||||||
|
label: string;
|
||||||
|
options: O[];
|
||||||
|
error?: boolean;
|
||||||
|
style?: any;
|
||||||
|
placeholder?: string;
|
||||||
|
disabled?: boolean;
|
||||||
|
className?: string;
|
||||||
|
}
|
||||||
|
|
||||||
// Bottom/multi dropdown option — shared base + per-option disabled flag
|
// Bottom/multi dropdown option — shared base + per-option disabled flag
|
||||||
export interface DropdownOption extends BaseDropdownOption {
|
export interface DropdownOption extends BaseDropdownOption {
|
||||||
|
|
@ -79,7 +91,7 @@ const BottomDropdown: React.FC<BottomDropdownProps> = ({
|
||||||
const [searchQuery, setSearchQuery] = useState('');
|
const [searchQuery, setSearchQuery] = useState('');
|
||||||
// Which option's `detail` is expanded (one at a time).
|
// Which option's `detail` is expanded (one at a time).
|
||||||
const [expandedValue, setExpandedValue] = useState<string | number | null>(null);
|
const [expandedValue, setExpandedValue] = useState<string | number | null>(null);
|
||||||
const debounceTimeoutRef = useRef<number | null>(null);
|
const debounceTimeoutRef = useRef<ReturnType<typeof setTimeout> | null>(null);
|
||||||
|
|
||||||
// Debounced search function
|
// Debounced search function
|
||||||
const debouncedOnSearch = useCallback((query: string) => {
|
const debouncedOnSearch = useCallback((query: string) => {
|
||||||
|
|
|
||||||
|
|
@ -1,100 +0,0 @@
|
||||||
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
|
||||||
import DateTimePicker, {
|
|
||||||
AndroidNativeProps,
|
|
||||||
DateTimePickerAndroid,
|
|
||||||
DateTimePickerEvent,
|
|
||||||
} from "@react-native-community/datetimepicker";
|
|
||||||
import React, { useState } from "react";
|
|
||||||
import {
|
|
||||||
Modal,
|
|
||||||
Platform,
|
|
||||||
Text,
|
|
||||||
TouchableOpacity,
|
|
||||||
View,
|
|
||||||
} from "react-native";
|
|
||||||
import MyText from "./text";
|
|
||||||
import { useTheme, tw } from "common-ui";
|
|
||||||
|
|
||||||
interface Props {
|
|
||||||
value: Date | null;
|
|
||||||
setValue: (date: Date | null) => void;
|
|
||||||
showLabel?: boolean; // Optional prop to control label visibility
|
|
||||||
placeholder?: string; // Optional custom placeholder
|
|
||||||
}
|
|
||||||
|
|
||||||
function DatePicker(props: Props) {
|
|
||||||
const { value, setValue, showLabel = true, placeholder = "Select Date" } = props;
|
|
||||||
const [show, setShow] = useState<boolean>(false);
|
|
||||||
const { theme } = useTheme();
|
|
||||||
|
|
||||||
const onChange = (event: DateTimePickerEvent, selectedDate?: Date) => {
|
|
||||||
const currentDate = selectedDate || value;
|
|
||||||
if (Platform.OS === "ios") setShow(false);
|
|
||||||
setValue(currentDate);
|
|
||||||
};
|
|
||||||
|
|
||||||
const showDatepicker = () => {
|
|
||||||
if (Platform.OS === "android") {
|
|
||||||
DateTimePickerAndroid.open({
|
|
||||||
value: value || new Date(),
|
|
||||||
onChange: onChange,
|
|
||||||
mode: "date",
|
|
||||||
is24Hour: true,
|
|
||||||
display: "default",
|
|
||||||
} as AndroidNativeProps);
|
|
||||||
} else {
|
|
||||||
setShow(true);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
return (
|
|
||||||
<View style={tw`justify-center items-start p-0 w-full`}>
|
|
||||||
<TouchableOpacity onPress={showDatepicker} style={tw`w-full`}>
|
|
||||||
{showLabel && <MyText style={tw`text-xs`}>{placeholder}</MyText>}
|
|
||||||
<View
|
|
||||||
style={[tw`flex-row items-center border border-gray5 rounded py-2 px-2 justify-between`]}
|
|
||||||
>
|
|
||||||
<Text style={[tw`text-sm font-medium text-gray-800 ml-1 mr-1`, { opacity: value ? 1 : 0.5 }]}>
|
|
||||||
{value?.toLocaleDateString() || placeholder}
|
|
||||||
</Text>
|
|
||||||
<MaterialCommunityIcons
|
|
||||||
name="calendar"
|
|
||||||
size={24}
|
|
||||||
color={theme.colors.gray5}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
</TouchableOpacity>
|
|
||||||
|
|
||||||
{/* Conditional rendering for iOS, as it uses the declarative API */}
|
|
||||||
{show && Platform.OS === "ios" && (
|
|
||||||
<Modal
|
|
||||||
transparent
|
|
||||||
animationType="fade"
|
|
||||||
visible={show}
|
|
||||||
onRequestClose={() => setShow(false)}
|
|
||||||
>
|
|
||||||
<View style={[tw`flex-1 justify-center items-center`, { backgroundColor: "rgba(0, 0, 0, 0.5)" }]}>
|
|
||||||
<View style={[tw`w-4/5 bg-white rounded-xl p-5`, { elevation: 5 }]}>
|
|
||||||
<DateTimePicker
|
|
||||||
testID="dateTimePicker"
|
|
||||||
value={value || new Date()}
|
|
||||||
mode="date"
|
|
||||||
is24Hour={true}
|
|
||||||
display="default"
|
|
||||||
onChange={onChange}
|
|
||||||
/>
|
|
||||||
<TouchableOpacity
|
|
||||||
onPress={() => setShow(false)}
|
|
||||||
style={tw`mt-2.5 bg-blue-500 rounded py-2.5 items-center`}
|
|
||||||
>
|
|
||||||
<Text style={tw`text-white font-bold`}>Done</Text>
|
|
||||||
</TouchableOpacity>
|
|
||||||
</View>
|
|
||||||
</View>
|
|
||||||
</Modal>
|
|
||||||
)}
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
export default DatePicker;
|
|
||||||
|
|
@ -1,85 +0,0 @@
|
||||||
import tw from "../lib/tailwind";
|
|
||||||
import React from "react";
|
|
||||||
import { Text, View } from "react-native";
|
|
||||||
import { Dropdown } from "react-native-element-dropdown";
|
|
||||||
import type { DropdownOption } from '@packages/shared';
|
|
||||||
|
|
||||||
export type { DropdownOption } from '@packages/shared';
|
|
||||||
|
|
||||||
// Common dropdown scaffold — value/onValueChange stay per-variant because the
|
|
||||||
// single dropdown carries a scalar and the bottom/multi one carries arrays.
|
|
||||||
// The option element type is generic: the bottom/multi dropdown extends the
|
|
||||||
// shared DropdownOption with a per-option disabled flag.
|
|
||||||
export interface DropdownBaseProps<O = DropdownOption> {
|
|
||||||
label: string;
|
|
||||||
options: O[];
|
|
||||||
error?: boolean;
|
|
||||||
style?: any;
|
|
||||||
placeholder?: string;
|
|
||||||
disabled?: boolean;
|
|
||||||
className?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Props extends DropdownBaseProps {
|
|
||||||
value: string | number;
|
|
||||||
onValueChange: (value: string | number) => void;
|
|
||||||
}
|
|
||||||
|
|
||||||
const CustomDropdown: React.FC<Props> = ({
|
|
||||||
label,
|
|
||||||
value,
|
|
||||||
options,
|
|
||||||
onValueChange,
|
|
||||||
error,
|
|
||||||
style,
|
|
||||||
placeholder,
|
|
||||||
disabled,
|
|
||||||
className,
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<View style={[tw``, style]}>
|
|
||||||
<Dropdown
|
|
||||||
data={options}
|
|
||||||
labelField="label"
|
|
||||||
valueField="value"
|
|
||||||
value={value}
|
|
||||||
onChange={(item) => onValueChange(item.value)}
|
|
||||||
placeholder={placeholder ?? label}
|
|
||||||
placeholderStyle={[tw`text-gray-500`, disabled && tw`text-gray-400`]}
|
|
||||||
style={[
|
|
||||||
tw`border rounded-md px-3 py-2 bg-white`,
|
|
||||||
error ? tw`border-red-500` : tw`border-gray-300`,
|
|
||||||
disabled && tw`bg-gray-100 border-gray-200`,
|
|
||||||
tw`${className || ''}`,
|
|
||||||
]}
|
|
||||||
disable={disabled}
|
|
||||||
renderItem={(item: DropdownOption) => {
|
|
||||||
const isSelected = value === item.value;
|
|
||||||
return (
|
|
||||||
<View
|
|
||||||
style={[
|
|
||||||
tw`px-3 py-2 rounded-md my-1`,
|
|
||||||
isSelected ? tw`bg-blue-50` : tw`bg-white`,
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
<Text
|
|
||||||
style={[
|
|
||||||
isSelected ? tw`text-blue-800 font-semibold` : tw`text-gray-800`,
|
|
||||||
disabled && tw`text-gray-400`,
|
|
||||||
]}
|
|
||||||
>
|
|
||||||
{item.label}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
selectedTextStyle={disabled ? tw`text-gray-400` : tw`text-gray-800 font-medium`}
|
|
||||||
// the dropdown's listProps / containerProps can be tuned if needed:
|
|
||||||
// dropdownStyle etc. Example:
|
|
||||||
// dropdownStyle={tw`bg-white`}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
export default CustomDropdown;
|
|
||||||
|
|
@ -1,118 +0,0 @@
|
||||||
import React from 'react';
|
|
||||||
import { ImageStyle, StyleSheet, TextStyle, View, ViewStyle, Text } from 'react-native';
|
|
||||||
import { Image } from 'expo-image';
|
|
||||||
import { MultiSelect } from 'react-native-element-dropdown';
|
|
||||||
|
|
||||||
export interface DropdownOption {
|
|
||||||
label: string;
|
|
||||||
value: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface MultiSelectDropdownProps {
|
|
||||||
data: DropdownOption[];
|
|
||||||
value: string[];
|
|
||||||
onChange: (value: string[]) => void;
|
|
||||||
placeholder?: string;
|
|
||||||
labelField?: string;
|
|
||||||
valueField?: string;
|
|
||||||
style?: ViewStyle;
|
|
||||||
dropdownStyle?: ViewStyle;
|
|
||||||
placeholderStyle?: TextStyle;
|
|
||||||
selectedTextStyle?: TextStyle;
|
|
||||||
inputSearchStyle?: TextStyle;
|
|
||||||
iconStyle?: ImageStyle;
|
|
||||||
search?: boolean;
|
|
||||||
maxHeight?: number;
|
|
||||||
disabled?: boolean;
|
|
||||||
}
|
|
||||||
|
|
||||||
const MultiSelectDropdown: React.FC<MultiSelectDropdownProps> = ({
|
|
||||||
data,
|
|
||||||
value,
|
|
||||||
onChange,
|
|
||||||
placeholder = 'Select',
|
|
||||||
labelField = 'label',
|
|
||||||
valueField = 'value',
|
|
||||||
style,
|
|
||||||
dropdownStyle,
|
|
||||||
placeholderStyle,
|
|
||||||
selectedTextStyle,
|
|
||||||
inputSearchStyle,
|
|
||||||
iconStyle,
|
|
||||||
search = true,
|
|
||||||
maxHeight = 300,
|
|
||||||
disabled = false,
|
|
||||||
}) => {
|
|
||||||
return (
|
|
||||||
<View style={style}>
|
|
||||||
<MultiSelect
|
|
||||||
style={[styles.dropdown, dropdownStyle]}
|
|
||||||
placeholderStyle={[styles.placeholderStyle, placeholderStyle]}
|
|
||||||
selectedTextStyle={[styles.selectedTextStyle, selectedTextStyle]}
|
|
||||||
inputSearchStyle={[styles.inputSearchStyle, inputSearchStyle]}
|
|
||||||
iconStyle={[styles.iconStyle, iconStyle]}
|
|
||||||
data={data}
|
|
||||||
search={search}
|
|
||||||
maxHeight={maxHeight}
|
|
||||||
labelField={labelField}
|
|
||||||
valueField={valueField}
|
|
||||||
placeholder={placeholder}
|
|
||||||
value={value}
|
|
||||||
onChange={onChange}
|
|
||||||
disable={disabled}
|
|
||||||
renderItem={(item: DropdownOption) => {
|
|
||||||
const isSelected = value.includes(item.value);
|
|
||||||
return (
|
|
||||||
<View style={[styles.item, isSelected && styles.selectedItem]}>
|
|
||||||
<Text style={isSelected ? styles.selectedTextStyle : styles.itemTextStyle}>
|
|
||||||
{item.label}
|
|
||||||
</Text>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
}}
|
|
||||||
/>
|
|
||||||
</View>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
const styles = StyleSheet.create({
|
|
||||||
dropdown: {
|
|
||||||
borderColor: '#ccc',
|
|
||||||
borderWidth: 1,
|
|
||||||
borderRadius: 8,
|
|
||||||
padding: 8,
|
|
||||||
backgroundColor: '#fff',
|
|
||||||
},
|
|
||||||
placeholderStyle: {
|
|
||||||
color: '#888',
|
|
||||||
fontSize: 16,
|
|
||||||
},
|
|
||||||
selectedTextStyle: {
|
|
||||||
color: '#333',
|
|
||||||
fontSize: 16,
|
|
||||||
fontWeight: 'bold',
|
|
||||||
},
|
|
||||||
itemTextStyle: {
|
|
||||||
color: '#333',
|
|
||||||
fontSize: 16,
|
|
||||||
},
|
|
||||||
inputSearchStyle: {
|
|
||||||
color: '#333',
|
|
||||||
fontSize: 16,
|
|
||||||
},
|
|
||||||
iconStyle: {
|
|
||||||
width: 24,
|
|
||||||
height: 24,
|
|
||||||
} as ImageStyle,
|
|
||||||
item: {
|
|
||||||
padding: 10,
|
|
||||||
borderRadius: 6,
|
|
||||||
backgroundColor: '#fff',
|
|
||||||
marginVertical: 2,
|
|
||||||
},
|
|
||||||
selectedItem: {
|
|
||||||
backgroundColor: '#e0f0ff', // Light blue for selected
|
|
||||||
},
|
|
||||||
});
|
|
||||||
|
|
||||||
export default MultiSelectDropdown;
|
|
||||||
Loading…
Add table
Reference in a new issue