@teincfood/core 0.7.8 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -21
- package/dist/adapters/auth.d.ts +10 -0
- package/dist/adapters/auth.js +43 -0
- package/dist/adapters/devices.d.ts +3 -1
- package/dist/adapters/devices.js +187 -3
- package/dist/adapters/filesystem.d.ts +4 -0
- package/dist/adapters/kv.d.ts +10 -0
- package/dist/adapters/kv.js +23 -7
- package/dist/adapters/local-node.d.ts +4 -6
- package/dist/adapters/local-node.js +9 -32
- package/dist/adapters/notify.d.ts +12 -0
- package/dist/adapters/notify.js +33 -0
- package/dist/adapters/query-keys.d.ts +4 -0
- package/dist/adapters/query-keys.js +4 -0
- package/dist/adapters/services.d.ts +99 -15
- package/dist/adapters/services.js +244 -4
- package/dist/auth/session.d.ts +66 -0
- package/dist/auth/session.js +172 -0
- package/dist/catalog/hooks.d.ts +10 -0
- package/dist/catalog/hooks.js +82 -11
- package/dist/db/migrations.js +274 -0
- package/dist/db/operations.d.ts +53 -2
- package/dist/db/operations.js +177 -8
- package/dist/domain/business/index.d.ts +5 -0
- package/dist/domain/business/index.js +5 -0
- package/dist/domain/orders/lifecycle.d.ts +6 -0
- package/dist/domain/orders/lifecycle.js +6 -0
- package/dist/domain/orders/service.d.ts +24 -0
- package/dist/domain/orders/service.js +242 -0
- package/dist/domain/payments/index.d.ts +6 -0
- package/dist/domain/payments/index.js +5 -0
- package/dist/domain/reference/index.d.ts +8 -0
- package/dist/domain/reference/index.js +8 -0
- package/dist/e2e/harness.d.ts +1 -0
- package/dist/e2e/harness.js +61 -0
- package/dist/hooks/analytics.hooks.d.ts +25 -0
- package/dist/hooks/analytics.hooks.js +214 -0
- package/dist/hooks/business-hours.hooks.d.ts +8 -0
- package/dist/hooks/business-hours.hooks.js +45 -0
- package/dist/hooks/dashboard.hooks.d.ts +30 -0
- package/dist/hooks/dashboard.hooks.js +132 -0
- package/dist/hooks/delivery.hooks.d.ts +225 -0
- package/dist/hooks/delivery.hooks.js +80 -0
- package/dist/hooks/fleet.hooks.d.ts +37 -0
- package/dist/hooks/fleet.hooks.js +229 -0
- package/dist/hooks/image.hooks.d.ts +20 -0
- package/dist/hooks/image.hooks.js +62 -0
- package/dist/hooks/kiosk.hooks.d.ts +22 -5
- package/dist/hooks/kiosk.hooks.js +74 -5
- package/dist/hooks/members.hooks.d.ts +48 -0
- package/dist/hooks/members.hooks.js +302 -0
- package/dist/hooks/offline-orders.hooks.d.ts +9 -0
- package/dist/hooks/offline-orders.hooks.js +51 -0
- package/dist/hooks/orders.hooks.d.ts +19 -39
- package/dist/hooks/orders.hooks.js +126 -321
- package/dist/hooks/places.hooks.d.ts +21 -0
- package/dist/hooks/places.hooks.js +112 -0
- package/dist/hooks/realtime-stubs.d.ts +28 -0
- package/dist/hooks/realtime-stubs.js +85 -0
- package/dist/hooks/rider.hooks.d.ts +470 -0
- package/dist/hooks/rider.hooks.js +373 -0
- package/dist/hooks/use-infinite-list.d.ts +243 -0
- package/dist/hooks/use-infinite-list.js +58 -0
- package/dist/hooks/wallet.hooks.d.ts +219 -0
- package/dist/hooks/wallet.hooks.js +56 -0
- package/dist/image-cache/service.d.ts +8 -0
- package/dist/image-cache/service.js +15 -3
- package/dist/index.d.ts +60 -5
- package/dist/index.js +78 -5
- package/dist/local-node/adapters.d.ts +87 -0
- package/dist/local-node/adapters.js +4 -0
- package/dist/local-node/index.d.ts +5 -0
- package/dist/local-node/index.js +5 -0
- package/dist/local-node/security.d.ts +25 -0
- package/dist/local-node/security.js +149 -0
- package/dist/local-node/service.d.ts +83 -0
- package/dist/local-node/service.js +706 -0
- package/dist/local-node/store.d.ts +50 -0
- package/dist/local-node/store.js +284 -0
- package/dist/local-node/types.d.ts +92 -0
- package/dist/local-node/types.js +4 -0
- package/dist/printer/receipt.d.ts +4 -0
- package/dist/printer/receipt.js +75 -0
- package/dist/printer/service.js +1 -1
- package/dist/providers/query-client.d.ts +13 -0
- package/dist/providers/query-client.js +58 -0
- package/dist/realtime/events.service.d.ts +18 -0
- package/dist/realtime/events.service.js +76 -0
- package/dist/realtime/order-events.service.d.ts +6 -0
- package/dist/realtime/order-events.service.js +17 -0
- package/dist/realtime/phoenix-socket.d.ts +55 -0
- package/dist/realtime/phoenix-socket.js +269 -0
- package/dist/realtime/useEventsConnection.d.ts +1 -0
- package/dist/realtime/useEventsConnection.js +50 -0
- package/dist/reference/api.d.ts +2 -0
- package/dist/reference/api.js +2 -0
- package/dist/reference/capabilities.d.ts +12 -7
- package/dist/reference/capabilities.js +28 -13
- package/dist/reference/hooks.d.ts +34 -0
- package/dist/reference/hooks.js +124 -0
- package/dist/reference/menu-apply.d.ts +29 -0
- package/dist/reference/menu-apply.js +289 -0
- package/dist/reference/menu-record.d.ts +69 -0
- package/dist/reference/menu-record.js +163 -0
- package/dist/reference/operations.d.ts +3 -0
- package/dist/reference/operations.js +35 -1
- package/dist/reference/service.js +36 -9
- package/dist/reference/types.d.ts +1 -1
- package/dist/repositories/order.repository.d.ts +8 -0
- package/dist/repositories/order.repository.js +24 -2
- package/dist/repositories/pos.repository.d.ts +4 -0
- package/dist/repositories/pos.repository.js +4 -0
- package/dist/sync/backoff.d.ts +21 -0
- package/dist/sync/backoff.js +42 -0
- package/dist/sync/command-builder.js +10 -2
- package/dist/sync/command-queue.service.d.ts +12 -0
- package/dist/sync/command-queue.service.js +115 -18
- package/dist/sync/device-lease.service.d.ts +3 -3
- package/dist/sync/device-lease.service.js +80 -20
- package/dist/sync/engine.d.ts +3 -1
- package/dist/sync/engine.js +44 -4
- package/dist/sync/full-sync.d.ts +6 -0
- package/dist/sync/full-sync.js +72 -0
- package/dist/sync/health-probe.d.ts +24 -0
- package/dist/sync/health-probe.js +138 -0
- package/dist/sync/offline-capable.js +25 -0
- package/dist/sync/online-gates.d.ts +17 -0
- package/dist/sync/online-gates.js +55 -0
- package/dist/sync/order-number.d.ts +4 -4
- package/dist/sync/order-number.js +33 -13
- package/dist/sync/order-snapshots.service.d.ts +1 -0
- package/dist/sync/order-snapshots.service.js +47 -2
- package/dist/sync/pending-orders.service.d.ts +18 -0
- package/dist/sync/pending-orders.service.js +148 -3
- package/dist/sync/reconciliation/index.d.ts +5 -0
- package/dist/sync/reconciliation/index.js +5 -0
- package/dist/sync/snapshots/entity.d.ts +6 -0
- package/dist/sync/snapshots/entity.js +6 -0
- package/dist/sync/sync-jobs.service.d.ts +18 -0
- package/dist/sync/sync-jobs.service.js +539 -0
- package/dist/sync/transition-endpoints.d.ts +11 -0
- package/dist/sync/transition-endpoints.js +30 -0
- package/dist/sync/transport-local-node.js +3 -2
- package/dist/sync/transport-rest.d.ts +7 -0
- package/dist/sync/transport-rest.js +90 -25
- package/dist/sync/use-sync-reconciliation.js +58 -16
- package/dist/test-helpers/memory-driver.js +182 -4
- package/dist/test-helpers/seed-hours.d.ts +1 -0
- package/dist/test-helpers/seed-hours.js +23 -0
- package/dist/types/api/business.api.d.ts +42 -0
- package/dist/types/api/menu.api.d.ts +15 -0
- package/dist/types/api/seller.api.d.ts +20 -0
- package/dist/types/places.d.ts +19 -0
- package/dist/types/places.js +2 -0
- package/dist/types/rider.d.ts +67 -0
- package/dist/types/rider.js +2 -0
- package/dist/utils/attempt-stats.d.ts +23 -0
- package/dist/utils/attempt-stats.js +61 -0
- package/dist/utils/business-hours.d.ts +37 -0
- package/dist/utils/business-hours.js +96 -0
- package/dist/utils/debug-log.d.ts +23 -0
- package/dist/utils/debug-log.js +153 -0
- package/dist/utils/order-filter.d.ts +1 -1
- package/dist/utils/order-filter.js +1 -1
- package/dist/utils/order-transitions.d.ts +30 -0
- package/dist/utils/order-transitions.js +185 -0
- package/dist/utils/sync-logger.js +5 -4
- package/dist/validation/offline.d.ts +46 -0
- package/dist/validation/offline.js +79 -0
- package/package.json +6 -1
- package/dist/pricing/engine.test.d.ts +0 -1
- package/dist/pricing/engine.test.js +0 -142
- package/dist/reference/lww.test.d.ts +0 -1
- package/dist/reference/lww.test.js +0 -23
- package/dist/reference/operations.test.d.ts +0 -1
- package/dist/reference/operations.test.js +0 -66
- package/dist/standalone.integration.test.d.ts +0 -1
- package/dist/standalone.integration.test.js +0 -235
- package/dist/sync/device-lease.test.d.ts +0 -1
- package/dist/sync/device-lease.test.js +0 -38
- package/dist/sync/offline-integration.test.d.ts +0 -1
- package/dist/sync/offline-integration.test.js +0 -52
- package/dist/sync/order-number.test.d.ts +0 -1
- package/dist/sync/order-number.test.js +0 -51
- package/dist/sync/perms.test.d.ts +0 -1
- package/dist/sync/perms.test.js +0 -15
- package/dist/utils/currency.test.d.ts +0 -1
- package/dist/utils/currency.test.js +0 -17
- package/dist/utils/hlc.test.d.ts +0 -1
- package/dist/utils/hlc.test.js +0 -29
- package/dist/utils/phone.test.d.ts +0 -1
- package/dist/utils/phone.test.js +0 -19
- package/dist/utils/responsive.d.ts +0 -13
- package/dist/utils/responsive.js +0 -18
- package/dist/utils/uuid.test.d.ts +0 -1
- package/dist/utils/uuid.test.js +0 -13
- package/dist/utils/validation.test.d.ts +0 -1
- package/dist/utils/validation.test.js +0 -23
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Business deliveries hooks — single source for both apps.
|
|
3
|
+
* Offline-first: local orders with delivery_id serve instantly; the network
|
|
4
|
+
* refreshes silently when online.
|
|
5
|
+
*/
|
|
6
|
+
import { useSyncExternalStore } from "react";
|
|
7
|
+
import { useQuery } from "@tanstack/react-query";
|
|
8
|
+
import { getActiveBusiness, subscribeBusiness } from "../adapters/business";
|
|
9
|
+
import { deliveryService } from "../adapters/services";
|
|
10
|
+
import { listLocalOrders } from "../domain/orders/service";
|
|
11
|
+
import { useInfiniteList, useIsEffectivelyOnline } from "./use-infinite-list";
|
|
12
|
+
export const DELIVERY_KEYS = {
|
|
13
|
+
all: ["business-deliveries"],
|
|
14
|
+
list: (businessId, filters) => ["business-deliveries", businessId, filters],
|
|
15
|
+
};
|
|
16
|
+
export const DELIVERY_DETAIL_KEYS = {
|
|
17
|
+
all: ["delivery"],
|
|
18
|
+
detail: (id) => [...DELIVERY_DETAIL_KEYS.all, "detail", id],
|
|
19
|
+
};
|
|
20
|
+
export function useDeliveryDetailQuery(deliveryId, enabled = true) {
|
|
21
|
+
// No single-delivery SQLite mirror (list derives from local orders) —
|
|
22
|
+
// never fire while unreachable; persisted cache serves instead.
|
|
23
|
+
const online = useIsEffectivelyOnline();
|
|
24
|
+
return useQuery({
|
|
25
|
+
queryKey: DELIVERY_DETAIL_KEYS.detail(deliveryId),
|
|
26
|
+
queryFn: () => deliveryService.fetchDeliveryDetail(deliveryId),
|
|
27
|
+
enabled: enabled && Boolean(deliveryId) && online,
|
|
28
|
+
retry: false,
|
|
29
|
+
networkMode: "offlineFirst",
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function useBusinessId() {
|
|
33
|
+
const id = useSyncExternalStore(subscribeBusiness, () => getActiveBusiness()?.id ?? null, () => null);
|
|
34
|
+
return id ?? undefined;
|
|
35
|
+
}
|
|
36
|
+
async function fetchOfflineDeliveries(businessId, filters, page, pageSize) {
|
|
37
|
+
const { data } = await listLocalOrders(businessId, { status: undefined, q: filters?.search }, page, pageSize);
|
|
38
|
+
const deliveryOrders = data.filter((o) => o.delivery_id);
|
|
39
|
+
const statusSet = new Set((filters?.status ?? "").split(",").map((s) => s.trim()).filter(Boolean));
|
|
40
|
+
const filtered = statusSet.size > 0
|
|
41
|
+
? deliveryOrders.filter((o) => statusSet.has((o.status ?? "")))
|
|
42
|
+
: deliveryOrders;
|
|
43
|
+
const total = filtered.length;
|
|
44
|
+
const items = filtered.slice((page - 1) * pageSize, page * pageSize);
|
|
45
|
+
const mapped = items.map((o) => {
|
|
46
|
+
const order = o;
|
|
47
|
+
return {
|
|
48
|
+
id: order.delivery_id ?? order.id,
|
|
49
|
+
status: order.delivery_status ?? "assigned",
|
|
50
|
+
inserted_at: order.inserted_at,
|
|
51
|
+
rider: order.rider ?? null,
|
|
52
|
+
order,
|
|
53
|
+
merchant_handover_confirmed_at: null,
|
|
54
|
+
rider_pickup_confirmed_at: null,
|
|
55
|
+
};
|
|
56
|
+
});
|
|
57
|
+
return {
|
|
58
|
+
data: mapped,
|
|
59
|
+
pagination: { page, page_size: pageSize, total_pages: Math.max(1, Math.ceil(total / pageSize)), total_entries: total },
|
|
60
|
+
};
|
|
61
|
+
}
|
|
62
|
+
export function useBusinessDeliveriesQuery(enabled = true, filters) {
|
|
63
|
+
const businessId = useBusinessId();
|
|
64
|
+
return useInfiniteList({
|
|
65
|
+
key: DELIVERY_KEYS.list(businessId, filters),
|
|
66
|
+
enabled: enabled && Boolean(businessId),
|
|
67
|
+
pageSize: 20,
|
|
68
|
+
staleTime: 5000,
|
|
69
|
+
offlineFetch: (page, pageSize) => fetchOfflineDeliveries(businessId, filters, page, pageSize),
|
|
70
|
+
onlineFetch: async (page, pageSize) => {
|
|
71
|
+
const params = { page, page_size: pageSize };
|
|
72
|
+
if (filters?.status)
|
|
73
|
+
params.status = filters.status;
|
|
74
|
+
if (filters?.search)
|
|
75
|
+
params.search = filters.search;
|
|
76
|
+
const res = (await deliveryService.fetchBusinessDeliveries(businessId, params));
|
|
77
|
+
return res;
|
|
78
|
+
},
|
|
79
|
+
});
|
|
80
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet hooks — single source for both apps (previously verbatim copies).
|
|
3
|
+
* Reads serve cache instantly; network refreshes silently when online.
|
|
4
|
+
* Member/fleet management mutations require online (single source gates).
|
|
5
|
+
*/
|
|
6
|
+
import type { FleetVehicle } from "../types/api/fleet.api";
|
|
7
|
+
export declare const FLEET_KEYS: {
|
|
8
|
+
all: readonly ["fleet"];
|
|
9
|
+
riders: (businessId?: string) => readonly ["fleet", "riders", string | undefined];
|
|
10
|
+
riderDetail: (id: string) => readonly ["fleet", "rider", string];
|
|
11
|
+
riderKyc: (id: string) => readonly ["fleet", "rider-kyc", string];
|
|
12
|
+
vehicles: (businessId?: string) => readonly ["fleet", "vehicles", string | undefined];
|
|
13
|
+
vehicleDetail: (id: string) => readonly ["fleet", "vehicle", string];
|
|
14
|
+
dashboard: (businessId?: string) => readonly ["fleet", "dashboard", string | undefined];
|
|
15
|
+
earnings: () => readonly ["fleet", "earnings"];
|
|
16
|
+
joinRequests: (businessId?: string) => readonly ["fleet", "join-requests", string | undefined];
|
|
17
|
+
invitations: (businessId?: string) => readonly ["fleet", "invitations", string | undefined];
|
|
18
|
+
};
|
|
19
|
+
export declare function useFleetRidersQuery(enabled?: boolean, filters?: {
|
|
20
|
+
q?: string;
|
|
21
|
+
status?: string;
|
|
22
|
+
}): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
23
|
+
export declare function useInviteRiderMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, Record<string, unknown>, unknown>;
|
|
24
|
+
export declare function useFleetRiderQuery(riderId: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
25
|
+
export declare function useRiderKycQuery(riderId: string, enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
26
|
+
export declare function useApproveRiderMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
27
|
+
export declare function useSuspendRiderMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
28
|
+
export declare function useActivateRiderMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
29
|
+
export declare function useJoinRequestsQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
30
|
+
export declare function useApproveJoinRequestMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
31
|
+
export declare function useRejectJoinRequestMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
32
|
+
export declare function useFleetInvitationsQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
33
|
+
export declare function useRevokeInvitationMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
34
|
+
export declare function useFleetVehiclesQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
35
|
+
export declare function useAddVehicleMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, Partial<FleetVehicle>, unknown>;
|
|
36
|
+
export declare function useRemoveVehicleMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
37
|
+
export declare function useFleetDashboardQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Fleet hooks — single source for both apps (previously verbatim copies).
|
|
3
|
+
* Reads serve cache instantly; network refreshes silently when online.
|
|
4
|
+
* Member/fleet management mutations require online (single source gates).
|
|
5
|
+
*/
|
|
6
|
+
import { useMutation, useQuery, useQueryClient } from "@tanstack/react-query";
|
|
7
|
+
import { useSyncExternalStore } from "react";
|
|
8
|
+
import { getActiveBusiness, subscribeBusiness } from "../adapters/business";
|
|
9
|
+
import { fleetService } from "../adapters/services";
|
|
10
|
+
import { assertOnlineFor } from "../sync/online-gates";
|
|
11
|
+
import { validateInviteInput } from "../validation/offline";
|
|
12
|
+
import { useIsEffectivelyOnline } from "./use-infinite-list";
|
|
13
|
+
export const FLEET_KEYS = {
|
|
14
|
+
all: ["fleet"],
|
|
15
|
+
riders: (businessId) => [...FLEET_KEYS.all, "riders", businessId],
|
|
16
|
+
riderDetail: (id) => [...FLEET_KEYS.all, "rider", id],
|
|
17
|
+
riderKyc: (id) => [...FLEET_KEYS.all, "rider-kyc", id],
|
|
18
|
+
vehicles: (businessId) => [...FLEET_KEYS.all, "vehicles", businessId],
|
|
19
|
+
vehicleDetail: (id) => [...FLEET_KEYS.all, "vehicle", id],
|
|
20
|
+
dashboard: (businessId) => [...FLEET_KEYS.all, "dashboard", businessId],
|
|
21
|
+
earnings: () => [...FLEET_KEYS.all, "earnings"],
|
|
22
|
+
joinRequests: (businessId) => [...FLEET_KEYS.all, "join-requests", businessId],
|
|
23
|
+
invitations: (businessId) => [...FLEET_KEYS.all, "invitations", businessId],
|
|
24
|
+
};
|
|
25
|
+
function useBusinessId() {
|
|
26
|
+
const id = useSyncExternalStore(subscribeBusiness, () => getActiveBusiness()?.id ?? null, () => null);
|
|
27
|
+
return id ?? undefined;
|
|
28
|
+
}
|
|
29
|
+
const OFFLINE_FIRST = { retry: false, networkMode: "offlineFirst" };
|
|
30
|
+
// Fleet has no SQLite mirror — offline source is the persisted query cache.
|
|
31
|
+
// Reads are cache-first (no online gate): the query is enabled offline so
|
|
32
|
+
// TanStack can serve stale cache + OfflineBanner marks not-live. Fetches still
|
|
33
|
+
// fail gracefully via retry:false + offlineFirst when the network is down.
|
|
34
|
+
function useOnline() {
|
|
35
|
+
return useIsEffectivelyOnline();
|
|
36
|
+
}
|
|
37
|
+
// ─── Riders ───
|
|
38
|
+
export function useFleetRidersQuery(enabled = true, filters) {
|
|
39
|
+
const businessId = useBusinessId();
|
|
40
|
+
return useQuery({
|
|
41
|
+
queryKey: [...FLEET_KEYS.riders(businessId), filters],
|
|
42
|
+
queryFn: () => fleetService.fetchFleetRiders(businessId, 1, 50, filters),
|
|
43
|
+
enabled: enabled && Boolean(businessId),
|
|
44
|
+
placeholderData: (prev) => prev,
|
|
45
|
+
...OFFLINE_FIRST,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function useInviteRiderMutation() {
|
|
49
|
+
const businessId = useBusinessId();
|
|
50
|
+
const queryClient = useQueryClient();
|
|
51
|
+
return useMutation({
|
|
52
|
+
mutationFn: (data) => {
|
|
53
|
+
assertOnlineFor("member:invite");
|
|
54
|
+
validateInviteInput({ email: data.email ?? data.invited_email });
|
|
55
|
+
return fleetService.inviteRider(data, businessId);
|
|
56
|
+
},
|
|
57
|
+
onSuccess: () => {
|
|
58
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.riders(businessId) });
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
export function useFleetRiderQuery(riderId, enabled = true) {
|
|
63
|
+
const businessId = useBusinessId();
|
|
64
|
+
return useQuery({
|
|
65
|
+
queryKey: FLEET_KEYS.riderDetail(riderId),
|
|
66
|
+
queryFn: () => fleetService.fetchFleetRider(riderId, businessId),
|
|
67
|
+
enabled: enabled && Boolean(riderId),
|
|
68
|
+
placeholderData: (prev) => prev,
|
|
69
|
+
...OFFLINE_FIRST,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
export function useRiderKycQuery(riderId, enabled = true) {
|
|
73
|
+
const businessId = useBusinessId();
|
|
74
|
+
return useQuery({
|
|
75
|
+
queryKey: FLEET_KEYS.riderKyc(riderId),
|
|
76
|
+
queryFn: () => fleetService.fetchRiderKyc(riderId, businessId),
|
|
77
|
+
enabled: enabled && Boolean(riderId),
|
|
78
|
+
staleTime: 0,
|
|
79
|
+
placeholderData: (prev) => prev,
|
|
80
|
+
...OFFLINE_FIRST,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
export function useApproveRiderMutation() {
|
|
84
|
+
const businessId = useBusinessId();
|
|
85
|
+
const queryClient = useQueryClient();
|
|
86
|
+
return useMutation({
|
|
87
|
+
mutationFn: (riderId) => {
|
|
88
|
+
assertOnlineFor("member:manage");
|
|
89
|
+
return fleetService.approveRider(riderId, businessId);
|
|
90
|
+
},
|
|
91
|
+
onSuccess: () => {
|
|
92
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.riders(businessId) });
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
export function useSuspendRiderMutation() {
|
|
97
|
+
const businessId = useBusinessId();
|
|
98
|
+
const queryClient = useQueryClient();
|
|
99
|
+
return useMutation({
|
|
100
|
+
mutationFn: (riderId) => {
|
|
101
|
+
assertOnlineFor("member:manage");
|
|
102
|
+
return fleetService.suspendRider(riderId, businessId);
|
|
103
|
+
},
|
|
104
|
+
onSuccess: () => {
|
|
105
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.riders(businessId) });
|
|
106
|
+
},
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
export function useActivateRiderMutation() {
|
|
110
|
+
const businessId = useBusinessId();
|
|
111
|
+
const queryClient = useQueryClient();
|
|
112
|
+
return useMutation({
|
|
113
|
+
mutationFn: (riderId) => {
|
|
114
|
+
assertOnlineFor("member:manage");
|
|
115
|
+
return fleetService.activateRider(riderId, businessId);
|
|
116
|
+
},
|
|
117
|
+
onSuccess: () => {
|
|
118
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.riders(businessId) });
|
|
119
|
+
},
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
export function useJoinRequestsQuery(enabled = true) {
|
|
123
|
+
const businessId = useBusinessId();
|
|
124
|
+
return useQuery({
|
|
125
|
+
queryKey: FLEET_KEYS.joinRequests(businessId),
|
|
126
|
+
queryFn: () => fleetService.fetchJoinRequests(businessId),
|
|
127
|
+
enabled: enabled && Boolean(businessId),
|
|
128
|
+
placeholderData: (prev) => prev,
|
|
129
|
+
...OFFLINE_FIRST,
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
export function useApproveJoinRequestMutation() {
|
|
133
|
+
const businessId = useBusinessId();
|
|
134
|
+
const queryClient = useQueryClient();
|
|
135
|
+
return useMutation({
|
|
136
|
+
mutationFn: (requestId) => {
|
|
137
|
+
assertOnlineFor("member:manage");
|
|
138
|
+
return fleetService.approveJoinRequest(requestId, businessId);
|
|
139
|
+
},
|
|
140
|
+
onSuccess: () => {
|
|
141
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.joinRequests(businessId) });
|
|
142
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.riders(businessId) });
|
|
143
|
+
},
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
export function useRejectJoinRequestMutation() {
|
|
147
|
+
const businessId = useBusinessId();
|
|
148
|
+
const queryClient = useQueryClient();
|
|
149
|
+
return useMutation({
|
|
150
|
+
mutationFn: (requestId) => {
|
|
151
|
+
assertOnlineFor("member:manage");
|
|
152
|
+
return fleetService.rejectJoinRequest(requestId, businessId);
|
|
153
|
+
},
|
|
154
|
+
onSuccess: () => {
|
|
155
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.joinRequests(businessId) });
|
|
156
|
+
},
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
export function useFleetInvitationsQuery(enabled = true) {
|
|
160
|
+
const businessId = useBusinessId();
|
|
161
|
+
return useQuery({
|
|
162
|
+
queryKey: FLEET_KEYS.invitations(businessId),
|
|
163
|
+
queryFn: () => fleetService.fetchInvitations(businessId),
|
|
164
|
+
enabled: enabled && Boolean(businessId),
|
|
165
|
+
placeholderData: (prev) => prev,
|
|
166
|
+
...OFFLINE_FIRST,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
export function useRevokeInvitationMutation() {
|
|
170
|
+
const businessId = useBusinessId();
|
|
171
|
+
const queryClient = useQueryClient();
|
|
172
|
+
return useMutation({
|
|
173
|
+
mutationFn: (invitationId) => {
|
|
174
|
+
assertOnlineFor("member:manage");
|
|
175
|
+
return fleetService.revokeInvitation(invitationId, businessId);
|
|
176
|
+
},
|
|
177
|
+
onSuccess: () => {
|
|
178
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.invitations(businessId) });
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
// ─── Vehicles ───
|
|
183
|
+
export function useFleetVehiclesQuery(enabled = true) {
|
|
184
|
+
const businessId = useBusinessId();
|
|
185
|
+
return useQuery({
|
|
186
|
+
queryKey: FLEET_KEYS.vehicles(businessId),
|
|
187
|
+
queryFn: () => fleetService.fetchFleetVehicles(businessId),
|
|
188
|
+
enabled: enabled && Boolean(businessId),
|
|
189
|
+
placeholderData: (prev) => prev,
|
|
190
|
+
...OFFLINE_FIRST,
|
|
191
|
+
});
|
|
192
|
+
}
|
|
193
|
+
export function useAddVehicleMutation() {
|
|
194
|
+
const businessId = useBusinessId();
|
|
195
|
+
const queryClient = useQueryClient();
|
|
196
|
+
return useMutation({
|
|
197
|
+
mutationFn: (data) => {
|
|
198
|
+
assertOnlineFor("fleet:manage");
|
|
199
|
+
return fleetService.addVehicle(data, businessId);
|
|
200
|
+
},
|
|
201
|
+
onSuccess: () => {
|
|
202
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.vehicles(businessId) });
|
|
203
|
+
},
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
export function useRemoveVehicleMutation() {
|
|
207
|
+
const businessId = useBusinessId();
|
|
208
|
+
const queryClient = useQueryClient();
|
|
209
|
+
return useMutation({
|
|
210
|
+
mutationFn: (vehicleId) => {
|
|
211
|
+
assertOnlineFor("fleet:manage");
|
|
212
|
+
return fleetService.removeVehicle(vehicleId, businessId);
|
|
213
|
+
},
|
|
214
|
+
onSuccess: () => {
|
|
215
|
+
queryClient.invalidateQueries({ queryKey: FLEET_KEYS.vehicles(businessId) });
|
|
216
|
+
},
|
|
217
|
+
});
|
|
218
|
+
}
|
|
219
|
+
// ─── Dashboard ───
|
|
220
|
+
export function useFleetDashboardQuery(enabled = true) {
|
|
221
|
+
const businessId = useBusinessId();
|
|
222
|
+
return useQuery({
|
|
223
|
+
queryKey: FLEET_KEYS.dashboard(businessId),
|
|
224
|
+
queryFn: () => fleetService.fetchFleetDashboard(businessId),
|
|
225
|
+
enabled: enabled && Boolean(businessId),
|
|
226
|
+
placeholderData: (prev) => prev,
|
|
227
|
+
...OFFLINE_FIRST,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline-first image source resolution — single source for both apps.
|
|
3
|
+
*
|
|
4
|
+
* Returns the durable local file path when cached, otherwise the remote URL.
|
|
5
|
+
* While online, uncached images warm in the background. Falls back to remote
|
|
6
|
+
* so online behavior is unchanged.
|
|
7
|
+
*/
|
|
8
|
+
import { useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
export declare const IMAGE_CACHE_KEYS: {
|
|
10
|
+
all: readonly ["cachedImage"];
|
|
11
|
+
url: (url: string) => readonly ["cachedImage", string];
|
|
12
|
+
};
|
|
13
|
+
export declare const CACHED_IMAGE_KEYS: {
|
|
14
|
+
all: readonly ["cachedImage"];
|
|
15
|
+
url: (url: string) => readonly ["cachedImage", string];
|
|
16
|
+
};
|
|
17
|
+
/** Invalidate every cached-image query (e.g. after a bulk reference sync). */
|
|
18
|
+
export declare function invalidateCachedImages(queryClient: ReturnType<typeof useQueryClient>): void;
|
|
19
|
+
/** Resolve an image URL to a URI. Prefers local cache; null for null URL. */
|
|
20
|
+
export declare function useCachedImageUrl(url: string | null | undefined): string | null;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Offline-first image source resolution — single source for both apps.
|
|
3
|
+
*
|
|
4
|
+
* Returns the durable local file path when cached, otherwise the remote URL.
|
|
5
|
+
* While online, uncached images warm in the background. Falls back to remote
|
|
6
|
+
* so online behavior is unchanged.
|
|
7
|
+
*/
|
|
8
|
+
import { useQuery, useQueryClient } from "@tanstack/react-query";
|
|
9
|
+
import { useSyncExternalStore } from "react";
|
|
10
|
+
import { getConnectivityState, subscribeConnectivity } from "../adapters/connectivity";
|
|
11
|
+
import { cacheRemoteImage, getCachedImageInfo, resolveImageSource, stableCacheUrl } from "../image-cache/service";
|
|
12
|
+
export const IMAGE_CACHE_KEYS = {
|
|
13
|
+
all: ["cachedImage"],
|
|
14
|
+
url: (url) => ["cachedImage", url],
|
|
15
|
+
};
|
|
16
|
+
export const CACHED_IMAGE_KEYS = IMAGE_CACHE_KEYS;
|
|
17
|
+
/** Invalidate every cached-image query (e.g. after a bulk reference sync). */
|
|
18
|
+
export function invalidateCachedImages(queryClient) {
|
|
19
|
+
queryClient.invalidateQueries({ queryKey: IMAGE_CACHE_KEYS.all });
|
|
20
|
+
}
|
|
21
|
+
/** Resolve an image URL to a URI. Prefers local cache; null for null URL. */
|
|
22
|
+
export function useCachedImageUrl(url) {
|
|
23
|
+
const queryClient = useQueryClient();
|
|
24
|
+
const connectivity = useSyncExternalStore(subscribeConnectivity, getConnectivityState, getConnectivityState);
|
|
25
|
+
const isOnline = connectivity.isOnline;
|
|
26
|
+
const enabled = Boolean(url);
|
|
27
|
+
const { data } = useQuery({
|
|
28
|
+
queryKey: IMAGE_CACHE_KEYS.url(stableCacheUrl(url ?? "__none__")),
|
|
29
|
+
queryFn: async () => {
|
|
30
|
+
if (!url)
|
|
31
|
+
return null;
|
|
32
|
+
const resolved = await resolveImageSource(url);
|
|
33
|
+
if (!resolved)
|
|
34
|
+
return { uri: url };
|
|
35
|
+
if (resolved.uri === url && isOnline) {
|
|
36
|
+
// Warm in the background, but refresh this query ONLY if warming
|
|
37
|
+
// actually landed the file. Unconditional invalidate-after-warm
|
|
38
|
+
// turns every permanent failure (offline race, unfetchable URL)
|
|
39
|
+
// into an unbounded refetch → warm → fail loop.
|
|
40
|
+
cacheRemoteImage(url, { skipIfCached: true })
|
|
41
|
+
.then(async () => {
|
|
42
|
+
try {
|
|
43
|
+
const fresh = await getCachedImageInfo(url);
|
|
44
|
+
if (fresh.localUri) {
|
|
45
|
+
queryClient.invalidateQueries({ queryKey: IMAGE_CACHE_KEYS.url(stableCacheUrl(url)) });
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
catch { }
|
|
49
|
+
})
|
|
50
|
+
.catch(() => { });
|
|
51
|
+
}
|
|
52
|
+
return resolved;
|
|
53
|
+
},
|
|
54
|
+
enabled,
|
|
55
|
+
staleTime: 5 * 60 * 1000,
|
|
56
|
+
retry: false,
|
|
57
|
+
networkMode: "offlineFirst",
|
|
58
|
+
});
|
|
59
|
+
if (!enabled || !data)
|
|
60
|
+
return null;
|
|
61
|
+
return data.uri;
|
|
62
|
+
}
|
|
@@ -1,5 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
export interface AvailableRider {
|
|
2
|
+
id: string;
|
|
3
|
+
name: string;
|
|
4
|
+
phone: string | null;
|
|
5
|
+
vehicle_type: string | null;
|
|
6
|
+
rating: null;
|
|
7
|
+
distance: null;
|
|
8
|
+
}
|
|
9
|
+
export declare const KIOSK_KEYS: {
|
|
10
|
+
all: readonly ["kiosk"];
|
|
11
|
+
orders: (bid?: string) => readonly ["kiosk", "orders", string | undefined];
|
|
12
|
+
riders: (bid?: string) => readonly ["kiosk", "riders", string | undefined];
|
|
13
|
+
};
|
|
14
|
+
export declare function useKioskOrdersQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<{
|
|
15
|
+
data: import("..").SellerOrder[];
|
|
16
|
+
}, Error>;
|
|
17
|
+
export declare function useAvailableRidersQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<AvailableRider[], Error>;
|
|
18
|
+
export declare const useAcceptKioskOrderMutation: () => import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
19
|
+
export declare const useRejectKioskOrderMutation: () => import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
20
|
+
export declare const useStartPreparingKioskOrderMutation: () => import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
21
|
+
export declare const useMarkKioskOrderReadyMutation: () => import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
22
|
+
export { useAssignRiderMutation } from "./orders.hooks";
|
|
@@ -1,5 +1,74 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
import { useQuery, useMutation, useQueryClient } from "@tanstack/react-query";
|
|
2
|
+
import { useSyncExternalStore } from "react";
|
|
3
|
+
import { getActiveBusiness, subscribeBusiness } from "../adapters/business";
|
|
4
|
+
import { fleetService } from "../adapters/services";
|
|
5
|
+
import { listLocalOrders } from "../domain/orders/service";
|
|
6
|
+
import { orderRepository } from "../repositories/order.repository";
|
|
7
|
+
import { mergePendingIntoList } from "../sync/pending-orders.service";
|
|
8
|
+
export const KIOSK_KEYS = { all: ["kiosk"], orders: (bid) => [...KIOSK_KEYS.all, "orders", bid], riders: (bid) => [...KIOSK_KEYS.all, "riders", bid] };
|
|
9
|
+
function useBusinessId() { const id = useSyncExternalStore(subscribeBusiness, () => getActiveBusiness()?.id ?? null, () => null); return id ?? undefined; }
|
|
10
|
+
export function useKioskOrdersQuery(enabled = true) {
|
|
11
|
+
const bid = useBusinessId();
|
|
12
|
+
return useQuery({
|
|
13
|
+
queryKey: KIOSK_KEYS.orders(bid),
|
|
14
|
+
queryFn: async () => {
|
|
15
|
+
if (!bid)
|
|
16
|
+
return { data: [] };
|
|
17
|
+
const { data } = await listLocalOrders(bid, {}, 1, 100);
|
|
18
|
+
return { data: await mergePendingIntoList(data, bid, 1) };
|
|
19
|
+
},
|
|
20
|
+
enabled: enabled && !!bid,
|
|
21
|
+
staleTime: 5 * 1000,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
export function useAvailableRidersQuery(enabled = true) {
|
|
25
|
+
const bid = useBusinessId();
|
|
26
|
+
return useQuery({
|
|
27
|
+
queryKey: KIOSK_KEYS.riders(bid),
|
|
28
|
+
queryFn: async () => {
|
|
29
|
+
const res = (await fleetService.fetchFleetRiders(bid, 1, 50));
|
|
30
|
+
return (res?.data ?? []).map((rider) => ({
|
|
31
|
+
id: rider.id,
|
|
32
|
+
name: rider.user?.full_name || rider.rider_number || "Rider",
|
|
33
|
+
phone: rider.phone || null,
|
|
34
|
+
vehicle_type: rider.vehicle?.type || null,
|
|
35
|
+
rating: null,
|
|
36
|
+
distance: null,
|
|
37
|
+
}));
|
|
38
|
+
},
|
|
39
|
+
enabled: enabled && !!bid,
|
|
40
|
+
placeholderData: (prev) => prev,
|
|
41
|
+
staleTime: 0,
|
|
42
|
+
retry: false,
|
|
43
|
+
networkMode: "offlineFirst",
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
const KIOSK_ACTIONS = {
|
|
47
|
+
accept: (p) => orderRepository.acceptOrder(p),
|
|
48
|
+
reject: (p) => orderRepository.rejectOrder(p),
|
|
49
|
+
start_preparing: (p) => orderRepository.startPreparingOrder(p),
|
|
50
|
+
mark_ready: (p) => orderRepository.markOrderReady(p),
|
|
51
|
+
};
|
|
52
|
+
function makeKioskMutation(action) {
|
|
53
|
+
return function useKioskMutation() {
|
|
54
|
+
const bid = useBusinessId();
|
|
55
|
+
const qc = useQueryClient();
|
|
56
|
+
return useMutation({
|
|
57
|
+
mutationFn: (orderId) => {
|
|
58
|
+
if (!bid)
|
|
59
|
+
throw new Error("No active business");
|
|
60
|
+
const run = KIOSK_ACTIONS[action];
|
|
61
|
+
if (!run)
|
|
62
|
+
throw new Error(`Unknown kiosk action ${action}`);
|
|
63
|
+
// Engine route (cloud → LAN → queue) so peers converge.
|
|
64
|
+
return run({ orderId, businessId: bid });
|
|
65
|
+
},
|
|
66
|
+
onSuccess: () => { qc.invalidateQueries({ queryKey: KIOSK_KEYS.orders(bid) }); qc.invalidateQueries({ queryKey: ["seller"] }); },
|
|
67
|
+
});
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export const useAcceptKioskOrderMutation = makeKioskMutation("accept");
|
|
71
|
+
export const useRejectKioskOrderMutation = makeKioskMutation("reject");
|
|
72
|
+
export const useStartPreparingKioskOrderMutation = makeKioskMutation("start_preparing");
|
|
73
|
+
export const useMarkKioskOrderReadyMutation = makeKioskMutation("mark_ready");
|
|
74
|
+
export { useAssignRiderMutation } from "./orders.hooks";
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Members / invitations / roles / tax hooks — single source for both apps.
|
|
3
|
+
* Reads serve the SQLite reference cache instantly; network refreshes
|
|
4
|
+
* silently when online. Invites and management mutations require online.
|
|
5
|
+
*/
|
|
6
|
+
export declare const MEMBER_KEYS: {
|
|
7
|
+
all: readonly ["business-members"];
|
|
8
|
+
list: (businessId?: string) => readonly ["business-members", string | undefined];
|
|
9
|
+
invitations: (businessId?: string) => readonly ["business-members", string | undefined, "invitations"];
|
|
10
|
+
};
|
|
11
|
+
export declare const INVITATION_KEYS: {
|
|
12
|
+
all: readonly ["invitations"];
|
|
13
|
+
list: () => readonly ["invitations", "list"];
|
|
14
|
+
};
|
|
15
|
+
export declare const ROLES_KEYS: {
|
|
16
|
+
all: readonly ["business-roles"];
|
|
17
|
+
forBusiness: (businessId?: string) => readonly ["business-roles", string | undefined];
|
|
18
|
+
};
|
|
19
|
+
export declare const TAX_KEYS: {
|
|
20
|
+
all: readonly ["tax-rules"];
|
|
21
|
+
list: (businessId?: string) => readonly ["tax-rules", "list", string | undefined];
|
|
22
|
+
};
|
|
23
|
+
export declare function useBusinessMembersQuery(): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
24
|
+
export declare function useInviteMemberMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
25
|
+
email?: string;
|
|
26
|
+
phone?: string;
|
|
27
|
+
role?: string;
|
|
28
|
+
}, unknown>;
|
|
29
|
+
export declare function useRemoveMemberMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
30
|
+
export declare function useBusinessMemberInvitationsQuery(): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
31
|
+
export declare function useRevokeMemberInvitationMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
32
|
+
export declare function useDeleteMemberInvitationMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
33
|
+
export declare function useUserInvitationsQuery(): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
34
|
+
export declare function useLeaveBusinessMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|
|
35
|
+
export declare function useAcceptFleetInvitationMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
36
|
+
code: string;
|
|
37
|
+
}, unknown>;
|
|
38
|
+
export declare function useAcceptBusinessInvitationMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
39
|
+
code: string;
|
|
40
|
+
}, unknown>;
|
|
41
|
+
export declare function useBusinessRolesQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
42
|
+
export declare function useBusinessTaxRulesQuery(enabled?: boolean): import("@tanstack/react-query").UseQueryResult<unknown, Error>;
|
|
43
|
+
export declare function useCreateTaxRuleMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, Record<string, unknown>, unknown>;
|
|
44
|
+
export declare function useUpdateTaxRuleMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, {
|
|
45
|
+
id: string;
|
|
46
|
+
data: Record<string, unknown>;
|
|
47
|
+
}, unknown>;
|
|
48
|
+
export declare function useDeleteTaxRuleMutation(): import("@tanstack/react-query").UseMutationResult<unknown, Error, string, unknown>;
|