@teincfood/core 0.1.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.
Files changed (120) hide show
  1. package/README.md +44 -0
  2. package/dist/adapters/auth.d.ts +13 -0
  3. package/dist/adapters/auth.js +14 -0
  4. package/dist/adapters/business.d.ts +13 -0
  5. package/dist/adapters/business.js +14 -0
  6. package/dist/adapters/connectivity.d.ts +17 -0
  7. package/dist/adapters/connectivity.js +38 -0
  8. package/dist/adapters/devices.d.ts +5 -0
  9. package/dist/adapters/devices.js +14 -0
  10. package/dist/adapters/http.d.ts +30 -0
  11. package/dist/adapters/http.js +37 -0
  12. package/dist/adapters/image-cache.d.ts +8 -0
  13. package/dist/adapters/image-cache.js +12 -0
  14. package/dist/adapters/kv-types.d.ts +5 -0
  15. package/dist/adapters/kv-types.js +2 -0
  16. package/dist/adapters/kv.d.ts +20 -0
  17. package/dist/adapters/kv.js +81 -0
  18. package/dist/adapters/local-node.d.ts +34 -0
  19. package/dist/adapters/local-node.js +40 -0
  20. package/dist/adapters/pending-orders.d.ts +17 -0
  21. package/dist/adapters/pending-orders.js +31 -0
  22. package/dist/adapters/query-keys.d.ts +17 -0
  23. package/dist/adapters/query-keys.js +20 -0
  24. package/dist/adapters/services.d.ts +62 -0
  25. package/dist/adapters/services.js +95 -0
  26. package/dist/adapters/sqlite.d.ts +20 -0
  27. package/dist/adapters/sqlite.js +23 -0
  28. package/dist/db/connection.d.ts +8 -0
  29. package/dist/db/connection.js +87 -0
  30. package/dist/db/migrations.d.ts +9 -0
  31. package/dist/db/migrations.js +106 -0
  32. package/dist/db/operations.d.ts +45 -0
  33. package/dist/db/operations.js +192 -0
  34. package/dist/index.d.ts +50 -0
  35. package/dist/index.js +118 -0
  36. package/dist/reference/api.d.ts +10 -0
  37. package/dist/reference/api.js +24 -0
  38. package/dist/reference/events.d.ts +54 -0
  39. package/dist/reference/events.js +144 -0
  40. package/dist/reference/operations.d.ts +11 -0
  41. package/dist/reference/operations.js +46 -0
  42. package/dist/reference/service.d.ts +27 -0
  43. package/dist/reference/service.js +270 -0
  44. package/dist/reference/types.d.ts +47 -0
  45. package/dist/reference/types.js +12 -0
  46. package/dist/repositories/order.repository.d.ts +44 -0
  47. package/dist/repositories/order.repository.js +132 -0
  48. package/dist/repositories/pos.repository.d.ts +20 -0
  49. package/dist/repositories/pos.repository.js +28 -0
  50. package/dist/sync/command-builder.d.ts +17 -0
  51. package/dist/sync/command-builder.js +30 -0
  52. package/dist/sync/command-queue.service.d.ts +41 -0
  53. package/dist/sync/command-queue.service.js +253 -0
  54. package/dist/sync/engine.d.ts +53 -0
  55. package/dist/sync/engine.js +216 -0
  56. package/dist/sync/order-number.d.ts +20 -0
  57. package/dist/sync/order-number.js +58 -0
  58. package/dist/sync/order-snapshots.service.d.ts +46 -0
  59. package/dist/sync/order-snapshots.service.js +151 -0
  60. package/dist/sync/pending-orders.service.d.ts +45 -0
  61. package/dist/sync/pending-orders.service.js +163 -0
  62. package/dist/sync/transport-local-node.d.ts +14 -0
  63. package/dist/sync/transport-local-node.js +67 -0
  64. package/dist/sync/transport-rest.d.ts +17 -0
  65. package/dist/sync/transport-rest.js +112 -0
  66. package/dist/sync/types.d.ts +102 -0
  67. package/dist/sync/types.js +13 -0
  68. package/dist/sync/use-sync-reconciliation.d.ts +10 -0
  69. package/dist/sync/use-sync-reconciliation.js +106 -0
  70. package/dist/types/api/auth.api.d.ts +61 -0
  71. package/dist/types/api/auth.api.js +3 -0
  72. package/dist/types/api/business.api.d.ts +137 -0
  73. package/dist/types/api/business.api.js +3 -0
  74. package/dist/types/api/conversation.api.d.ts +46 -0
  75. package/dist/types/api/conversation.api.js +2 -0
  76. package/dist/types/api/error.api.d.ts +8 -0
  77. package/dist/types/api/error.api.js +2 -0
  78. package/dist/types/api/fleet.api.d.ts +98 -0
  79. package/dist/types/api/fleet.api.js +3 -0
  80. package/dist/types/api/index.d.ts +11 -0
  81. package/dist/types/api/index.js +27 -0
  82. package/dist/types/api/kiosk.api.d.ts +4 -0
  83. package/dist/types/api/kiosk.api.js +2 -0
  84. package/dist/types/api/menu.api.d.ts +90 -0
  85. package/dist/types/api/menu.api.js +2 -0
  86. package/dist/types/api/pagination.d.ts +10 -0
  87. package/dist/types/api/pagination.js +2 -0
  88. package/dist/types/api/rider.api.d.ts +179 -0
  89. package/dist/types/api/rider.api.js +2 -0
  90. package/dist/types/api/seller.api.d.ts +164 -0
  91. package/dist/types/api/seller.api.js +2 -0
  92. package/dist/types/api/wallet.api.d.ts +27 -0
  93. package/dist/types/api/wallet.api.js +2 -0
  94. package/dist/types/pos.types.d.ts +33 -0
  95. package/dist/types/pos.types.js +5 -0
  96. package/dist/utils/constants.d.ts +85 -0
  97. package/dist/utils/constants.js +72 -0
  98. package/dist/utils/copyToClipBoard.d.ts +5 -0
  99. package/dist/utils/copyToClipBoard.js +23 -0
  100. package/dist/utils/currency.d.ts +9 -0
  101. package/dist/utils/currency.js +37 -0
  102. package/dist/utils/error.d.ts +4 -0
  103. package/dist/utils/error.js +73 -0
  104. package/dist/utils/formatCurrency.d.ts +4 -0
  105. package/dist/utils/formatCurrency.js +16 -0
  106. package/dist/utils/formatDate.d.ts +8 -0
  107. package/dist/utils/formatDate.js +42 -0
  108. package/dist/utils/phone.d.ts +10 -0
  109. package/dist/utils/phone.js +71 -0
  110. package/dist/utils/responsive.d.ts +13 -0
  111. package/dist/utils/responsive.js +21 -0
  112. package/dist/utils/storage.d.ts +15 -0
  113. package/dist/utils/storage.js +60 -0
  114. package/dist/utils/sync-logger.d.ts +22 -0
  115. package/dist/utils/sync-logger.js +79 -0
  116. package/dist/utils/uuid.d.ts +7 -0
  117. package/dist/utils/uuid.js +47 -0
  118. package/dist/utils/validation.d.ts +31 -0
  119. package/dist/utils/validation.js +170 -0
  120. package/package.json +49 -0
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ /**
3
+ * Core types for the offline-first, event-driven Sync Engine.
4
+ *
5
+ * These types define the contract between:
6
+ * - UI / Hooks
7
+ * - Repositories
8
+ * - Sync Engine
9
+ * - Transports (REST, Local Node, queued)
10
+ *
11
+ * All timestamps are ISO strings. Monetary amounts remain in minor units.
12
+ */
13
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Sync reconciliation bridge.
3
+ *
4
+ * Subscribes to domain events produced by the Sync Engine and:
5
+ * - Applies order events to the pending-orders store (queued orders stay
6
+ * visible until the cloud confirms them).
7
+ * - Marks reconciled optimistic events as synced to cloud.
8
+ * - Invalidates TanStack Query caches for affected entities.
9
+ */
10
+ export declare function useSyncReconciliation(): void;
@@ -0,0 +1,106 @@
1
+ "use strict";
2
+ /**
3
+ * Sync reconciliation bridge.
4
+ *
5
+ * Subscribes to domain events produced by the Sync Engine and:
6
+ * - Applies order events to the pending-orders store (queued orders stay
7
+ * visible until the cloud confirms them).
8
+ * - Marks reconciled optimistic events as synced to cloud.
9
+ * - Invalidates TanStack Query caches for affected entities.
10
+ */
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.useSyncReconciliation = useSyncReconciliation;
13
+ const react_1 = require("react");
14
+ const react_query_1 = require("@tanstack/react-query");
15
+ const engine_1 = require("./engine");
16
+ const pending_orders_service_1 = require("./pending-orders.service");
17
+ const local_node_1 = require("../adapters/local-node");
18
+ const connection_1 = require("../db/connection");
19
+ const operations_1 = require("../db/operations");
20
+ const sync_logger_1 = require("../utils/sync-logger");
21
+ const query_keys_1 = require("../adapters/query-keys");
22
+ const events_1 = require("../reference/events");
23
+ function isLocalOrderEvent(event) {
24
+ const payload = event.payload;
25
+ if (!payload)
26
+ return false;
27
+ const localOrderNumber = payload.local_order_number;
28
+ return typeof localOrderNumber === "string" && localOrderNumber.startsWith("TFL-");
29
+ }
30
+ function useSyncReconciliation() {
31
+ const queryClient = (0, react_query_1.useQueryClient)();
32
+ (0, react_1.useEffect)(() => {
33
+ // Reference changes re-sync offline data and refresh caches on this device
34
+ // and (via the LAN relay) on every connected terminal.
35
+ const unregisterReferenceInvalidator = (0, events_1.registerReferenceInvalidator)(() => {
36
+ queryClient.invalidateQueries({ queryKey: query_keys_1.MENU_KEYS.all });
37
+ queryClient.invalidateQueries({ queryKey: query_keys_1.REFERENCE_KEYS.all });
38
+ queryClient.invalidateQueries({ queryKey: query_keys_1.POS_KEYS.all });
39
+ queryClient.invalidateQueries({ queryKey: query_keys_1.SELLER_KEYS.all });
40
+ });
41
+ // Pending-order reconciliation invalidates POS + seller order lists so the
42
+ // server-confirmed order replaces the optimistic one. Invalidate from the
43
+ // broadest key: POS_KEYS.orders() without a businessId would produce
44
+ // ['pos','orders',undefined] which does not prefix-match business-scoped
45
+ // keys.
46
+ const unregisterInvalidator = (0, pending_orders_service_1.registerPendingOrdersInvalidator)(() => {
47
+ queryClient.invalidateQueries({ queryKey: query_keys_1.POS_KEYS.all });
48
+ queryClient.invalidateQueries({ queryKey: query_keys_1.SELLER_KEYS.all });
49
+ });
50
+ // Reference-change events are published through the Sync Engine but are
51
+ // not backed by a command, so the engine has no transport dependency on
52
+ // the reference module. Register the singleton once.
53
+ (0, events_1.registerReferenceEventEngine)(engine_1.syncEngine);
54
+ const unsubscribe = engine_1.syncEngine.subscribe(async (event) => {
55
+ sync_logger_1.syncLogger.event(event, "received");
56
+ // The node relays engine events (e.g. order.created when a queued
57
+ // command is replayed) to LAN clients so they reconcile their pending
58
+ // orders and refresh caches.
59
+ if (local_node_1.localNodeService.isLocalNode()) {
60
+ local_node_1.localNodeService.broadcastToClients(event);
61
+ }
62
+ // Reference data changed on this device but we are a LAN client (not the
63
+ // node): forward the event to the node so it rebroadcasts it to every
64
+ // other terminal (the node also applies it locally via its onRelayEvent
65
+ // hook). The node does not echo it back to this device.
66
+ if (event.event_type === events_1.REFERENCE_CHANGED_EVENT_TYPE &&
67
+ !local_node_1.localNodeService.isLocalNode()) {
68
+ local_node_1.localNodeService.getClient()?.publishEvent?.(event);
69
+ }
70
+ // Reference data changed (locally or echoed from the cloud): re-sync the
71
+ // affected keys and refresh caches on this device.
72
+ await (0, events_1.applyReferenceChangeEvent)(event, "local");
73
+ // Order/delivery state changed: refresh order caches so this terminal
74
+ // shows the same order states as the device that made the change.
75
+ await (0, pending_orders_service_1.applyOrderStateChangeEvent)(event, "local");
76
+ // Route both queued (optimistic) and reconciled (created) order events
77
+ // into the pending-orders store.
78
+ if (event.event_type === "order.create_queued" ||
79
+ event.event_type === "order.created") {
80
+ await (0, pending_orders_service_1.applyPendingOrderEvent)(event, "local");
81
+ }
82
+ if (event.event_type === "order.created" && isLocalOrderEvent(event)) {
83
+ try {
84
+ const db = (0, connection_1.getSyncDatabase)();
85
+ await (0, operations_1.markEventsSynced)(db, [event.event_id]);
86
+ }
87
+ catch (error) {
88
+ sync_logger_1.syncLogger.error("Reconciliation", "Failed to mark event synced", {
89
+ error: String(error),
90
+ });
91
+ }
92
+ const payload = event.payload;
93
+ const businessId = payload.business_id;
94
+ if (businessId) {
95
+ queryClient.invalidateQueries({ queryKey: query_keys_1.POS_KEYS.orders(businessId) });
96
+ queryClient.invalidateQueries({ queryKey: query_keys_1.SELLER_KEYS.all });
97
+ }
98
+ }
99
+ });
100
+ return () => {
101
+ unsubscribe();
102
+ unregisterInvalidator();
103
+ unregisterReferenceInvalidator();
104
+ };
105
+ }, [queryClient]);
106
+ }
@@ -0,0 +1,61 @@
1
+ export interface RegisterRequest {
2
+ email: string;
3
+ password: string;
4
+ full_name: string;
5
+ phone?: string;
6
+ }
7
+ export interface LoginRequest {
8
+ email: string;
9
+ password: string;
10
+ }
11
+ export interface OTPRequest {
12
+ phone: string;
13
+ purpose?: 'login' | 'register';
14
+ }
15
+ export interface OTPVerifyRequest {
16
+ phone: string;
17
+ code: string;
18
+ type?: 'login' | 'register';
19
+ }
20
+ export interface OIDCRequest {
21
+ provider: 'google' | 'apple' | 'facebook';
22
+ id_token: string;
23
+ }
24
+ export interface AuthResponse {
25
+ access_token: string;
26
+ refresh_token: string;
27
+ user: AuthUser;
28
+ }
29
+ export interface AuthUser {
30
+ id: string;
31
+ email: string | null;
32
+ full_name: string | null;
33
+ phone: string | null;
34
+ avatar_url: string | null;
35
+ has_password: boolean;
36
+ roles: string[];
37
+ }
38
+ export interface RegisterResponse {
39
+ status: string;
40
+ message: string;
41
+ user: {
42
+ email: string;
43
+ full_name: string;
44
+ has_password: boolean;
45
+ roles: string[];
46
+ };
47
+ }
48
+ export interface RefreshResponse {
49
+ access_token: string;
50
+ refresh_token: string;
51
+ }
52
+ export interface ForgotPasswordRequest {
53
+ email: string;
54
+ }
55
+ export interface ResetPasswordRequest {
56
+ token: string;
57
+ password: string;
58
+ }
59
+ export interface VerifyEmailRequest {
60
+ token: string;
61
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // ─── Auth Requests ───
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,137 @@
1
+ export interface Business {
2
+ id: string;
3
+ name: string;
4
+ description: string;
5
+ type: string;
6
+ phone: string;
7
+ email: string;
8
+ status: string;
9
+ currency: string;
10
+ is_open: boolean;
11
+ owner_id: string;
12
+ business_number: string;
13
+ latitude: number;
14
+ longitude: number;
15
+ logo_url: string | null;
16
+ cover_image_url: string | null;
17
+ kyc_status: string;
18
+ rating: number | null;
19
+ address?: {
20
+ street: string;
21
+ city: string;
22
+ region?: string;
23
+ country?: string;
24
+ latitude?: number;
25
+ longitude?: number;
26
+ } | null;
27
+ inserted_at: string;
28
+ updated_at: string;
29
+ }
30
+ export interface BusinessResponse {
31
+ data: Business;
32
+ }
33
+ export interface BusinessListResponse {
34
+ data: Business[];
35
+ }
36
+ export interface BusinessMembershipBusiness {
37
+ id: string;
38
+ business_number: string;
39
+ name: string;
40
+ type: string;
41
+ status: string;
42
+ logo_url: string | null;
43
+ cover_image_url: string | null;
44
+ }
45
+ export interface BusinessMembership {
46
+ business: BusinessMembershipBusiness;
47
+ role: string;
48
+ status: string;
49
+ source: string | null;
50
+ invited_by_user_id: string | null;
51
+ }
52
+ export interface BusinessMembershipListResponse {
53
+ data: BusinessMembership[];
54
+ }
55
+ export interface BusinessMembershipDetail {
56
+ business_id: string;
57
+ role: string;
58
+ source: string;
59
+ status: string;
60
+ capabilities: string[];
61
+ }
62
+ export interface BusinessMembershipResponse {
63
+ data: BusinessMembershipDetail;
64
+ }
65
+ export interface BusinessMember {
66
+ id: string;
67
+ user_id: string;
68
+ role: string;
69
+ status: string;
70
+ inserted_at: string;
71
+ }
72
+ export interface BusinessMemberListResponse {
73
+ data: BusinessMember[];
74
+ }
75
+ export interface OperatingHoursEntry {
76
+ id?: string;
77
+ day_of_week: number;
78
+ open_time: string | null;
79
+ close_time: string | null;
80
+ is_closed: boolean;
81
+ }
82
+ export interface OperatingHoursResponse {
83
+ data: OperatingHoursEntry[];
84
+ }
85
+ export interface DayHours {
86
+ open: string;
87
+ close: string;
88
+ }
89
+ export interface Promo {
90
+ id: string;
91
+ code: string;
92
+ discount_percent: number | null;
93
+ discount_minor: number | null;
94
+ max_uses: number | null;
95
+ used_count: number;
96
+ expires_at: string | null;
97
+ is_active: boolean;
98
+ business_id: string;
99
+ }
100
+ export interface PromoListResponse {
101
+ data: Promo[];
102
+ }
103
+ export interface PromoResponse {
104
+ data: Promo;
105
+ }
106
+ export interface TaxRule {
107
+ id: string;
108
+ business_id: string;
109
+ name: string;
110
+ code: string;
111
+ country_code: string;
112
+ rate_basis_points: number;
113
+ applies_to: 'subtotal' | 'subtotal_plus_delivery';
114
+ is_inclusive: boolean;
115
+ is_active: boolean;
116
+ display_order: number;
117
+ inserted_at: string;
118
+ updated_at: string;
119
+ }
120
+ export interface TaxRuleListResponse {
121
+ data: TaxRule[];
122
+ }
123
+ export interface TaxRuleResponse {
124
+ data: TaxRule;
125
+ }
126
+ export interface TaxRuleRequest {
127
+ tax_rule: {
128
+ name: string;
129
+ code: string;
130
+ country_code: string;
131
+ rate_basis_points: number;
132
+ applies_to: 'subtotal' | 'subtotal_plus_delivery';
133
+ is_inclusive: boolean;
134
+ is_active: boolean;
135
+ display_order?: number;
136
+ };
137
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // ─── Business ───
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,46 @@
1
+ import type { PaginationMeta } from './pagination';
2
+ export interface ConversationParticipant {
3
+ id: string;
4
+ user_id: string;
5
+ archived_at: string | null;
6
+ }
7
+ export interface Conversation {
8
+ id: string;
9
+ type: string;
10
+ status: string;
11
+ assigned_agent_id: string | null;
12
+ order_id: string | null;
13
+ participants: ConversationParticipant[];
14
+ inserted_at: string;
15
+ updated_at: string;
16
+ }
17
+ export interface ConversationMessage {
18
+ id: string;
19
+ content: string;
20
+ sender_id: string;
21
+ conversation_id: string;
22
+ direction: string;
23
+ channel: string;
24
+ message_type: string;
25
+ status: string;
26
+ external_id: string | null;
27
+ metadata: Record<string, unknown> | null;
28
+ replied_by_id: string | null;
29
+ read: boolean;
30
+ inserted_at: string;
31
+ }
32
+ export interface ConversationListResponse {
33
+ data: Conversation[];
34
+ pagination: PaginationMeta;
35
+ }
36
+ export interface ConversationResponse {
37
+ data: Conversation;
38
+ }
39
+ export interface ConversationMessagesResponse {
40
+ data: ConversationMessage[];
41
+ meta: {
42
+ limit: number;
43
+ offset: number;
44
+ count: number;
45
+ };
46
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ export interface ApiErrorContent {
2
+ code: string;
3
+ message: string;
4
+ details?: Record<string, unknown>;
5
+ }
6
+ export interface ApiErrorResponse {
7
+ error: ApiErrorContent | string;
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,98 @@
1
+ export interface FleetRiderUser {
2
+ id: string;
3
+ full_name: string;
4
+ phone?: string;
5
+ avatar_url?: string;
6
+ }
7
+ export interface FleetRiderVehicle {
8
+ id: string;
9
+ type: string;
10
+ plate_number: string;
11
+ brand: string | null;
12
+ model: string | null;
13
+ color: string | null;
14
+ year: number | null;
15
+ }
16
+ export interface FleetRider {
17
+ id: string;
18
+ rider_number: string;
19
+ status: string;
20
+ is_online: boolean;
21
+ is_fleet_managed: boolean;
22
+ is_active: boolean;
23
+ phone: string;
24
+ license_number: string;
25
+ kyc_status: string;
26
+ user: FleetRiderUser | null;
27
+ vehicle: FleetRiderVehicle | null;
28
+ inserted_at: string;
29
+ }
30
+ export interface FleetRiderResponse {
31
+ data: FleetRider;
32
+ }
33
+ export interface FleetKycDocument {
34
+ type: string;
35
+ name: string;
36
+ url: string | null;
37
+ signed_url: string | null;
38
+ document_id: string | null;
39
+ issued_date: string | null;
40
+ expiration_date: string | null;
41
+ expired: boolean;
42
+ }
43
+ export interface FleetRiderKyc {
44
+ rider_id: string;
45
+ kyc_status: string;
46
+ submitted_at: string | null;
47
+ verified_at: string | null;
48
+ documents: FleetKycDocument[];
49
+ }
50
+ export interface FleetRiderKycResponse {
51
+ data: FleetRiderKyc;
52
+ }
53
+ export interface FleetVehicle {
54
+ id: string;
55
+ rider_id: string | null;
56
+ plate_number: string;
57
+ type: string;
58
+ ownership: string;
59
+ brand?: string;
60
+ model?: string;
61
+ color?: string;
62
+ year?: number;
63
+ rider_number?: string;
64
+ rider_name?: string;
65
+ inserted_at: string;
66
+ }
67
+ export interface FleetRidersResponse {
68
+ data: FleetRider[];
69
+ }
70
+ export interface FleetVehiclesResponse {
71
+ data: FleetVehicle[];
72
+ }
73
+ export interface JoinRequest {
74
+ id: string;
75
+ user_id: string;
76
+ rider_number: string;
77
+ status: string;
78
+ inserted_at: string;
79
+ }
80
+ export interface FleetInvitation {
81
+ id: string;
82
+ business_id: string;
83
+ status: string;
84
+ inserted_at: string;
85
+ }
86
+ export interface FleetDashboard {
87
+ total_riders: number;
88
+ active_riders: number;
89
+ online_riders: number;
90
+ offline_riders: number;
91
+ total_vehicles: number;
92
+ today_deliveries: number;
93
+ today_earnings_minor: number;
94
+ pending_join_requests: number;
95
+ }
96
+ export interface FleetDashboardResponse {
97
+ data: FleetDashboard;
98
+ }
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ // ─── Fleet Rider ───
3
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ export * from './pagination';
2
+ export * from './auth.api';
3
+ export * from './rider.api';
4
+ export * from './seller.api';
5
+ export * from './fleet.api';
6
+ export * from './kiosk.api';
7
+ export * from './menu.api';
8
+ export * from './business.api';
9
+ export * from './wallet.api';
10
+ export * from './conversation.api';
11
+ export * from './error.api';
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./pagination"), exports);
18
+ __exportStar(require("./auth.api"), exports);
19
+ __exportStar(require("./rider.api"), exports);
20
+ __exportStar(require("./seller.api"), exports);
21
+ __exportStar(require("./fleet.api"), exports);
22
+ __exportStar(require("./kiosk.api"), exports);
23
+ __exportStar(require("./menu.api"), exports);
24
+ __exportStar(require("./business.api"), exports);
25
+ __exportStar(require("./wallet.api"), exports);
26
+ __exportStar(require("./conversation.api"), exports);
27
+ __exportStar(require("./error.api"), exports);
@@ -0,0 +1,4 @@
1
+ import type { PaginatedResponse } from './pagination';
2
+ import type { SellerOrder } from './seller.api';
3
+ export type KioskOrder = SellerOrder;
4
+ export type KioskOrdersResponse = PaginatedResponse<KioskOrder>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,90 @@
1
+ import type { PaginationMeta } from './pagination';
2
+ export interface Money {
3
+ amountMinor: number;
4
+ currencyCode: string;
5
+ }
6
+ export interface MenuItemVariantResponse {
7
+ id: string;
8
+ name: string;
9
+ price: Money;
10
+ }
11
+ export interface MenuItemAddonResponse {
12
+ id: string;
13
+ name: string;
14
+ pricingType: string;
15
+ amountMinor: number;
16
+ currencyCode: string;
17
+ }
18
+ export interface MenuItemCategory {
19
+ id: string;
20
+ name: string;
21
+ }
22
+ export interface MenuItemBusiness {
23
+ id: string;
24
+ name: string;
25
+ distance?: number;
26
+ is_open?: boolean;
27
+ }
28
+ export interface MenuItem {
29
+ id: string;
30
+ name: string;
31
+ description: string | null;
32
+ basePrice: Money;
33
+ image_url: string | null;
34
+ is_available: boolean;
35
+ dietary_tags: string[];
36
+ category_id: string;
37
+ business_id: string;
38
+ category: MenuItemCategory | null;
39
+ variants: MenuItemVariantResponse[];
40
+ extras: MenuItemAddonResponse[];
41
+ business?: MenuItemBusiness;
42
+ inserted_at: string;
43
+ updated_at: string;
44
+ }
45
+ export interface MenuItemResponse {
46
+ data: MenuItem;
47
+ }
48
+ export interface MenuItemListResponse {
49
+ data: MenuItem[];
50
+ pagination: PaginationMeta;
51
+ }
52
+ export interface MenuItemVariant {
53
+ id: string;
54
+ name: string;
55
+ price_adjustment: number;
56
+ }
57
+ export interface MenuItemAddon {
58
+ id: string;
59
+ name: string;
60
+ price_minor: number;
61
+ }
62
+ export interface MenuCategory {
63
+ id: string;
64
+ name: string;
65
+ sort_order: number;
66
+ is_global: boolean;
67
+ is_system: boolean;
68
+ pending_global_request: boolean;
69
+ }
70
+ export interface MenuCategoryListResponse {
71
+ data: MenuCategory[];
72
+ }
73
+ export interface CatalogItemRequest {
74
+ name: string;
75
+ description: string;
76
+ price_minor: number;
77
+ category_id: string;
78
+ currency_code: string;
79
+ dietary_tags?: string[];
80
+ variants: {
81
+ name: string;
82
+ price_adjustment: number;
83
+ }[];
84
+ extras: {
85
+ name: string;
86
+ price_minor: number;
87
+ }[];
88
+ available: boolean;
89
+ image_url?: string | null;
90
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,10 @@
1
+ export interface PaginationMeta {
2
+ page: number;
3
+ page_size: number;
4
+ total_entries: number;
5
+ total_pages: number;
6
+ }
7
+ export interface PaginatedResponse<T> {
8
+ data: T[];
9
+ pagination: PaginationMeta;
10
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });