@chopkola/common 1.0.213

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 (63) hide show
  1. package/build/helpers/helpers.d.ts +2 -0
  2. package/build/helpers/helpers.js +34 -0
  3. package/build/index.d.ts +15 -0
  4. package/build/index.js +31 -0
  5. package/build/types/address.d.ts +12 -0
  6. package/build/types/address.js +2 -0
  7. package/build/types/apis/administrator/access.control.list.type.d.ts +8 -0
  8. package/build/types/apis/administrator/access.control.list.type.js +2 -0
  9. package/build/types/apis/administrator/administrator.category.management.type.d.ts +22 -0
  10. package/build/types/apis/administrator/administrator.category.management.type.js +2 -0
  11. package/build/types/apis/administrator/administrator.dashboard.type.d.ts +38 -0
  12. package/build/types/apis/administrator/administrator.dashboard.type.js +10 -0
  13. package/build/types/apis/administrator/administrator.system.settings.type.d.ts +29 -0
  14. package/build/types/apis/administrator/administrator.system.settings.type.js +2 -0
  15. package/build/types/apis/administrator/administrator.vendor.management.type.d.ts +37 -0
  16. package/build/types/apis/administrator/administrator.vendor.management.type.js +7 -0
  17. package/build/types/apis/administrator/create.administrator.type.d.ts +4 -0
  18. package/build/types/apis/administrator/create.administrator.type.js +2 -0
  19. package/build/types/apis/administrator/system.user.management.type.d.ts +38 -0
  20. package/build/types/apis/administrator/system.user.management.type.js +9 -0
  21. package/build/types/apis/google.d.ts +22 -0
  22. package/build/types/apis/google.js +2 -0
  23. package/build/types/apis/index.d.ts +11 -0
  24. package/build/types/apis/index.js +27 -0
  25. package/build/types/apis/vendor/active.business.d.ts +7 -0
  26. package/build/types/apis/vendor/active.business.js +2 -0
  27. package/build/types/apis/vendor/active.business.summary.statistics.and.page.resource.d.ts +39 -0
  28. package/build/types/apis/vendor/active.business.summary.statistics.and.page.resource.js +10 -0
  29. package/build/types/apis/vendor/vendor.user.summary.statistics.resource.data.d.ts +35 -0
  30. package/build/types/apis/vendor/vendor.user.summary.statistics.resource.data.js +2 -0
  31. package/build/types/cart.d.ts +113 -0
  32. package/build/types/cart.js +20 -0
  33. package/build/types/category.d.ts +38 -0
  34. package/build/types/category.js +2 -0
  35. package/build/types/enum/collection.d.ts +133 -0
  36. package/build/types/enum/collection.js +157 -0
  37. package/build/types/enum/error.d.ts +12 -0
  38. package/build/types/enum/error.js +17 -0
  39. package/build/types/errors/index.d.ts +17 -0
  40. package/build/types/errors/index.js +2 -0
  41. package/build/types/file.types.d.ts +11 -0
  42. package/build/types/file.types.js +2 -0
  43. package/build/types/global.d.ts +88 -0
  44. package/build/types/global.js +26 -0
  45. package/build/types/menu_n_meal.d.ts +104 -0
  46. package/build/types/menu_n_meal.js +2 -0
  47. package/build/types/products.d.ts +208 -0
  48. package/build/types/products.js +2 -0
  49. package/build/types/reservation.d.ts +27 -0
  50. package/build/types/reservation.js +2 -0
  51. package/build/types/role_n_permission.d.ts +56 -0
  52. package/build/types/role_n_permission.js +5 -0
  53. package/build/types/user.d.ts +74 -0
  54. package/build/types/user.js +5 -0
  55. package/build/types/vendor.d.ts +126 -0
  56. package/build/types/vendor.js +2 -0
  57. package/build/validators/index.d.ts +2 -0
  58. package/build/validators/index.js +18 -0
  59. package/build/validators/regex.d.ts +3 -0
  60. package/build/validators/regex.js +6 -0
  61. package/build/validators/validate.d.ts +3 -0
  62. package/build/validators/validate.js +24 -0
  63. package/package.json +29 -0
@@ -0,0 +1,2 @@
1
+ export declare const convertStringDurationToMs: (value: string) => number;
2
+ export declare const abbreviateNumber: (number: number | null | undefined, decimals?: number) => string;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.abbreviateNumber = exports.convertStringDurationToMs = void 0;
4
+ const validators_1 = require("../validators");
5
+ const convertStringDurationToMs = (value) => {
6
+ const match = value.match(validators_1.stringDurationToMsRegex);
7
+ if (!match) {
8
+ throw new Error(`Invalid duration format: ${value}`);
9
+ }
10
+ const amount = parseInt(match[1], 10);
11
+ const unit = match[2].toLowerCase();
12
+ const unitMap = {
13
+ ms: 1,
14
+ s: 1000,
15
+ m: 1000 * 60,
16
+ h: 1000 * 60 * 60,
17
+ d: 1000 * 60 * 60 * 24,
18
+ w: 1000 * 60 * 60 * 24 * 7,
19
+ y: 1000 * 60 * 60 * 24 * 365,
20
+ };
21
+ return amount * unitMap[unit];
22
+ };
23
+ exports.convertStringDurationToMs = convertStringDurationToMs;
24
+ const abbreviateNumber = (number, decimals = 1) => {
25
+ if (number == null || isNaN(number))
26
+ return '0'; // fallback for null/undefined/NaN
27
+ // Reusable formatter with dynamic decimals
28
+ const formatter = new Intl.NumberFormat('en', {
29
+ notation: 'compact',
30
+ maximumFractionDigits: decimals,
31
+ });
32
+ return formatter.format(number);
33
+ };
34
+ exports.abbreviateNumber = abbreviateNumber;
@@ -0,0 +1,15 @@
1
+ export * from './types/user';
2
+ export * from './types/enum/error';
3
+ export * from './types/enum/collection';
4
+ export * from './types/global';
5
+ export * from './types/errors/index';
6
+ export * from './validators/index';
7
+ export * from './helpers/helpers';
8
+ export * from './types/cart';
9
+ export * from './types/apis';
10
+ export * from './types/file.types';
11
+ export * from './types/category';
12
+ export * from './types/vendor';
13
+ export * from './types/menu_n_meal';
14
+ export * from './types/products';
15
+ export * from './types/role_n_permission';
package/build/index.js ADDED
@@ -0,0 +1,31 @@
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("./types/user"), exports);
18
+ __exportStar(require("./types/enum/error"), exports);
19
+ __exportStar(require("./types/enum/collection"), exports);
20
+ __exportStar(require("./types/global"), exports);
21
+ __exportStar(require("./types/errors/index"), exports);
22
+ __exportStar(require("./validators/index"), exports);
23
+ __exportStar(require("./helpers/helpers"), exports);
24
+ __exportStar(require("./types/cart"), exports);
25
+ __exportStar(require("./types/apis"), exports);
26
+ __exportStar(require("./types/file.types"), exports);
27
+ __exportStar(require("./types/category"), exports);
28
+ __exportStar(require("./types/vendor"), exports);
29
+ __exportStar(require("./types/menu_n_meal"), exports);
30
+ __exportStar(require("./types/products"), exports);
31
+ __exportStar(require("./types/role_n_permission"), exports);
@@ -0,0 +1,12 @@
1
+ export interface AddressI {
2
+ id?: string;
3
+ label?: string;
4
+ street_address?: string;
5
+ city?: string;
6
+ country?: string;
7
+ neighborhood?: string;
8
+ state?: string;
9
+ postal_code?: string;
10
+ latitude?: number;
11
+ longitude?: number;
12
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { PermissionCollectionType } from "../../global";
2
+ import { Permission, RoleWithPermissions } from "../../role_n_permission";
3
+ export type AccessControlListResourceData = {
4
+ resources: string[];
5
+ permissionActions: PermissionCollectionType[];
6
+ permissions: Permission[];
7
+ roles: RoleWithPermissions[];
8
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,22 @@
1
+ import { Category, CategoryTreeNode, CategoryWithRelations } from "../../category";
2
+ export type CategoryItemStat = {
3
+ title: string;
4
+ value: string | number;
5
+ color?: string;
6
+ };
7
+ export type CategoryItemStats = {
8
+ vendor_using: CategoryItemStat;
9
+ active_products: CategoryItemStat;
10
+ monthly_view: CategoryItemStat;
11
+ };
12
+ export interface CategoryDetailsData {
13
+ stats: CategoryItemStats;
14
+ category: CategoryWithRelations;
15
+ }
16
+ export interface CreateOrEditCategoryData {
17
+ category: Category | null;
18
+ parentCategory: Category | null;
19
+ }
20
+ export type CategoryManagementData = {
21
+ roots: CategoryTreeNode[];
22
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,38 @@
1
+ import type { LucideIcon } from "lucide-react";
2
+ import { SystemLoggedActivity, SystemPerformanceMetric } from "../../global";
3
+ import { Vendor } from "../../vendor";
4
+ export declare enum AdministratorDashboardIconEnum {
5
+ BADGE_DOLLAR_SIGN = "badge_dollar_sign",
6
+ WALLET = "wallet",
7
+ STORE = "store",
8
+ USERS = "users"
9
+ }
10
+ export type BackendAdministratorStat = {
11
+ title: string;
12
+ value: string | number;
13
+ subtext?: string;
14
+ icon: AdministratorDashboardIconEnum;
15
+ color: string;
16
+ };
17
+ export type AdministratorStat = {
18
+ title: string;
19
+ value: string | number;
20
+ subtext?: string;
21
+ icon: LucideIcon;
22
+ color: string;
23
+ };
24
+ export type AdminDashboardStats = {
25
+ total_revenue: BackendAdministratorStat;
26
+ platform_commission: BackendAdministratorStat;
27
+ active_vendors: BackendAdministratorStat;
28
+ active_users: BackendAdministratorStat;
29
+ };
30
+ export type AdministratorDashboardData = {
31
+ stats: AdminDashboardStats;
32
+ vendor_applications: Vendor[];
33
+ system_activities: SystemLoggedActivity[];
34
+ performance_data: SystemPerformanceMetric[];
35
+ };
36
+ export interface GetAdministratorDashboardPageResourceI {
37
+ data: AdministratorDashboardData;
38
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdministratorDashboardIconEnum = void 0;
4
+ var AdministratorDashboardIconEnum;
5
+ (function (AdministratorDashboardIconEnum) {
6
+ AdministratorDashboardIconEnum["BADGE_DOLLAR_SIGN"] = "badge_dollar_sign";
7
+ AdministratorDashboardIconEnum["WALLET"] = "wallet";
8
+ AdministratorDashboardIconEnum["STORE"] = "store";
9
+ AdministratorDashboardIconEnum["USERS"] = "users";
10
+ })(AdministratorDashboardIconEnum || (exports.AdministratorDashboardIconEnum = AdministratorDashboardIconEnum = {}));
@@ -0,0 +1,29 @@
1
+ import { Currency, UUID } from "../../global";
2
+ export type SystemSettings = {
3
+ id: UUID;
4
+ system_name: string;
5
+ support_email: string;
6
+ default_currency: UUID;
7
+ timezone: string;
8
+ maintenance_mode: boolean;
9
+ two_factor_auth: boolean;
10
+ password_rotation: boolean;
11
+ session_timeout_minutes: number;
12
+ max_login_attempts: number;
13
+ default_commission_percentage: string;
14
+ signup_approval: string;
15
+ min_payout_threshold: string;
16
+ payout_cycle: string;
17
+ instant_store_activation: boolean;
18
+ enable_customer_reviews: boolean;
19
+ guest_checkout: boolean;
20
+ referral_reward_amount: string;
21
+ support_phone: string;
22
+ created_at: Date;
23
+ updated_at: Date;
24
+ currency?: Currency;
25
+ };
26
+ export type AdministratorSystemSettingsData = {
27
+ settings: SystemSettings;
28
+ currencies: Currency[];
29
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,37 @@
1
+ import { LucideIcon } from "lucide-react";
2
+ import { BusinessTypeFilterTab } from "../../global";
3
+ import { Vendor } from "../../vendor";
4
+ export declare enum AdministratorVendorManagementIconEnum {
5
+ STORE = "store"
6
+ }
7
+ export type BackendAdministratorVendorStat = {
8
+ title: string;
9
+ value: string | number;
10
+ icon: AdministratorVendorManagementIconEnum;
11
+ bg_color: string;
12
+ text_color: string;
13
+ };
14
+ export type AdministratorVendorStat = {
15
+ title: string;
16
+ value: string | number;
17
+ icon: LucideIcon;
18
+ bg_color: string;
19
+ text_color: string;
20
+ };
21
+ export type AdministratorVendorsStats = {
22
+ total_vendors: BackendAdministratorVendorStat;
23
+ active_vendors: BackendAdministratorVendorStat;
24
+ new_today: BackendAdministratorVendorStat;
25
+ suspended_vendors: BackendAdministratorVendorStat;
26
+ };
27
+ export type AdministratorVendorManagementData = {
28
+ stats: AdministratorVendorsStats;
29
+ scopes?: BusinessTypeFilterTab;
30
+ vendors: Vendor[];
31
+ };
32
+ export type AdministratorVendorDetailsManagementData = {
33
+ audit_logs: any[];
34
+ compliance_and_finance: any[];
35
+ operations?: any[];
36
+ vendor: Vendor;
37
+ };
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AdministratorVendorManagementIconEnum = void 0;
4
+ var AdministratorVendorManagementIconEnum;
5
+ (function (AdministratorVendorManagementIconEnum) {
6
+ AdministratorVendorManagementIconEnum["STORE"] = "store";
7
+ })(AdministratorVendorManagementIconEnum || (exports.AdministratorVendorManagementIconEnum = AdministratorVendorManagementIconEnum = {}));
@@ -0,0 +1,4 @@
1
+ import { Role } from "../../role_n_permission";
2
+ export type CreateAdministratorData = {
3
+ roles: Role[];
4
+ };
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,38 @@
1
+ import { LucideIcon } from "lucide-react";
2
+ import { FilterTab } from "../../global";
3
+ import { User } from "../../user";
4
+ export declare enum SystemUserManagementIconEnum {
5
+ USER_X = "user_x",
6
+ USER_CHECK = "user_check",
7
+ USER = "user"
8
+ }
9
+ export type BackendSystemUserStat = {
10
+ title: string;
11
+ value: string | number;
12
+ icon: SystemUserManagementIconEnum;
13
+ bg_color: string;
14
+ text_color: string;
15
+ };
16
+ export type SystemUserStat = {
17
+ title: string;
18
+ value: string | number;
19
+ icon: LucideIcon;
20
+ bg_color: string;
21
+ text_color: string;
22
+ };
23
+ export type SystemUsersStats = {
24
+ total_users: BackendSystemUserStat;
25
+ active_users: BackendSystemUserStat;
26
+ new_today: BackendSystemUserStat;
27
+ suspended_users: BackendSystemUserStat;
28
+ };
29
+ export type SystemUserManagementData = {
30
+ stats: SystemUsersStats;
31
+ account_types?: FilterTab;
32
+ users: User[];
33
+ };
34
+ export type SystemUserDetailsManagementData = {
35
+ audit_logs: any[];
36
+ security_and_access?: any[];
37
+ user: User;
38
+ };
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SystemUserManagementIconEnum = void 0;
4
+ var SystemUserManagementIconEnum;
5
+ (function (SystemUserManagementIconEnum) {
6
+ SystemUserManagementIconEnum["USER_X"] = "user_x";
7
+ SystemUserManagementIconEnum["USER_CHECK"] = "user_check";
8
+ SystemUserManagementIconEnum["USER"] = "user";
9
+ })(SystemUserManagementIconEnum || (exports.SystemUserManagementIconEnum = SystemUserManagementIconEnum = {}));
@@ -0,0 +1,22 @@
1
+ export interface GoogleDistanceMatrixResponse {
2
+ status: string;
3
+ origin_addresses: string[];
4
+ destination_addresses: string[];
5
+ rows: {
6
+ elements: {
7
+ status: string;
8
+ duration: {
9
+ text: string;
10
+ value: number;
11
+ };
12
+ distance: {
13
+ text: string;
14
+ value: number;
15
+ };
16
+ }[];
17
+ }[];
18
+ }
19
+ export interface DistanceMatrixResult {
20
+ distance: string;
21
+ duration: string;
22
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,11 @@
1
+ export * from './administrator/system.user.management.type';
2
+ export * from './administrator/administrator.dashboard.type';
3
+ export * from './administrator/access.control.list.type';
4
+ export * from './administrator/create.administrator.type';
5
+ export * from './administrator/administrator.vendor.management.type';
6
+ export * from './administrator/administrator.category.management.type';
7
+ export * from './administrator/administrator.system.settings.type';
8
+ export * from './vendor/vendor.user.summary.statistics.resource.data';
9
+ export * from './vendor/active.business';
10
+ export * from './vendor/active.business.summary.statistics.and.page.resource';
11
+ export * from './google';
@@ -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("./administrator/system.user.management.type"), exports);
18
+ __exportStar(require("./administrator/administrator.dashboard.type"), exports);
19
+ __exportStar(require("./administrator/access.control.list.type"), exports);
20
+ __exportStar(require("./administrator/create.administrator.type"), exports);
21
+ __exportStar(require("./administrator/administrator.vendor.management.type"), exports);
22
+ __exportStar(require("./administrator/administrator.category.management.type"), exports);
23
+ __exportStar(require("./administrator/administrator.system.settings.type"), exports);
24
+ __exportStar(require("./vendor/vendor.user.summary.statistics.resource.data"), exports);
25
+ __exportStar(require("./vendor/active.business"), exports);
26
+ __exportStar(require("./vendor/active.business.summary.statistics.and.page.resource"), exports);
27
+ __exportStar(require("./google"), exports);
@@ -0,0 +1,7 @@
1
+ import { Vendor } from "../../vendor";
2
+ export interface ToggleBusinessOpenedState {
3
+ business: Vendor;
4
+ }
5
+ export interface GetBusinessOpenedState {
6
+ business: Vendor;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,39 @@
1
+ import { LucideIcon } from "lucide-react";
2
+ import { Currency } from "../../global";
3
+ export declare enum ActiveBusinessSummaryStatisticsIconEnum {
4
+ WALLET = "wallet",
5
+ SHOPPING_BAG = "shopping_bag",
6
+ STAR = "star",
7
+ X_CIRCLE = "x_circle"
8
+ }
9
+ export type BackendActiveBusinessSummaryStat = {
10
+ title: string;
11
+ value: string | number;
12
+ subtext?: string;
13
+ icon: ActiveBusinessSummaryStatisticsIconEnum;
14
+ bg_color?: string;
15
+ text_color?: string;
16
+ };
17
+ export type ActiveBusinessSummaryStat = {
18
+ title: string;
19
+ value: string | number;
20
+ subtext?: string;
21
+ icon: LucideIcon;
22
+ bg_color: string;
23
+ text_color: string;
24
+ };
25
+ export type ActiveBusinessStats = {
26
+ todays_revenue: BackendActiveBusinessSummaryStat;
27
+ total_orders: BackendActiveBusinessSummaryStat;
28
+ average_rating: BackendActiveBusinessSummaryStat;
29
+ cancelled: BackendActiveBusinessSummaryStat;
30
+ };
31
+ export type ActiveBusinessSummaryStatisticsResourceData = {
32
+ orders: any[];
33
+ delivery_status: any[];
34
+ stats: ActiveBusinessStats;
35
+ currency: Currency;
36
+ };
37
+ export interface GetActiveBusinessSummaryStatisticsResourceDataI {
38
+ data: ActiveBusinessSummaryStatisticsResourceData;
39
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.ActiveBusinessSummaryStatisticsIconEnum = void 0;
4
+ var ActiveBusinessSummaryStatisticsIconEnum;
5
+ (function (ActiveBusinessSummaryStatisticsIconEnum) {
6
+ ActiveBusinessSummaryStatisticsIconEnum["WALLET"] = "wallet";
7
+ ActiveBusinessSummaryStatisticsIconEnum["SHOPPING_BAG"] = "shopping_bag";
8
+ ActiveBusinessSummaryStatisticsIconEnum["STAR"] = "star";
9
+ ActiveBusinessSummaryStatisticsIconEnum["X_CIRCLE"] = "x_circle";
10
+ })(ActiveBusinessSummaryStatisticsIconEnum || (exports.ActiveBusinessSummaryStatisticsIconEnum = ActiveBusinessSummaryStatisticsIconEnum = {}));
@@ -0,0 +1,35 @@
1
+ import { LucideIcon } from "lucide-react";
2
+ import { Vendor } from "../../vendor";
3
+ import { VendorUserSummaryStatisticsIconEnum } from "../../enum/collection";
4
+ import { Currency } from "../../global";
5
+ export type BackendVendorUserSummaryStat = {
6
+ title: string;
7
+ value: string | number;
8
+ subtext?: string;
9
+ icon: VendorUserSummaryStatisticsIconEnum;
10
+ bg_color?: string;
11
+ text_color?: string;
12
+ };
13
+ export type VendorUserSummaryStat = {
14
+ title: string;
15
+ value: string | number;
16
+ subtext?: string;
17
+ icon: LucideIcon;
18
+ bg_color: string;
19
+ text_color: string;
20
+ };
21
+ export type VendorUserStats = {
22
+ registered_businesses: BackendVendorUserSummaryStat;
23
+ active: BackendVendorUserSummaryStat;
24
+ pending_approval: BackendVendorUserSummaryStat;
25
+ suspended: BackendVendorUserSummaryStat;
26
+ };
27
+ export type VendorUserSummaryStatisticsResourceData = {
28
+ businesses: Vendor[];
29
+ actions: any[];
30
+ stats: VendorUserStats;
31
+ currency: Currency;
32
+ };
33
+ export interface GetVendorUserSummaryStatisticsResourceData {
34
+ data: VendorUserSummaryStatisticsResourceData;
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,113 @@
1
+ import { CartItemTypeEnum, CartStatusEnum, ScopeEnum } from "./enum/collection";
2
+ import { MoneyString, Timestamps, UUID, Nullable, DateString, TimeString } from "./global";
3
+ export interface CartSelectedModifierOption {
4
+ modifier_group_id: UUID;
5
+ modifier_option_id: UUID;
6
+ quantity: number;
7
+ }
8
+ export interface BaseCartItem extends Timestamps {
9
+ id: UUID;
10
+ cart_id: UUID;
11
+ vendor_id: UUID;
12
+ quantity: number;
13
+ unit_price: MoneyString;
14
+ total_price: MoneyString;
15
+ }
16
+ export interface BaseAddToCartInput {
17
+ cart_id: UUID;
18
+ vendor_id: UUID;
19
+ quantity: number;
20
+ }
21
+ export interface MealCartItemMetadata {
22
+ special_instructions: Nullable<string>;
23
+ selected_options: CartSelectedModifierOption[];
24
+ }
25
+ export interface MealCartItem extends BaseCartItem {
26
+ item_type: CartItemTypeEnum.MEAL;
27
+ meal_id: UUID;
28
+ product_id: null;
29
+ product_variant_id: null;
30
+ inventory_item_id: null;
31
+ metadata: MealCartItemMetadata;
32
+ }
33
+ export interface AddMealToCartInput extends BaseAddToCartInput {
34
+ item_type: CartItemTypeEnum.MEAL;
35
+ meal_id: UUID;
36
+ metadata: MealCartItemMetadata;
37
+ }
38
+ export interface ProductCartItemMetadata {
39
+ special_instructions: Nullable<string>;
40
+ accepts_substitutions: boolean;
41
+ }
42
+ export interface ProductCartItem extends BaseCartItem {
43
+ item_type: CartItemTypeEnum.PRODUCT;
44
+ meal_id: null;
45
+ product_id: UUID;
46
+ product_variant_id: Nullable<UUID>;
47
+ inventory_item_id: UUID;
48
+ metadata: ProductCartItemMetadata;
49
+ }
50
+ export interface AddProductToCartInput extends BaseAddToCartInput {
51
+ item_type: CartItemTypeEnum.PRODUCT;
52
+ product_id: UUID;
53
+ product_variant_id?: UUID;
54
+ inventory_item_id: UUID;
55
+ metadata: ProductCartItemMetadata;
56
+ }
57
+ export interface ReservationCartItemMetadata {
58
+ reservation_date: DateString;
59
+ reservation_time: TimeString;
60
+ party_size: number;
61
+ special_requests: Nullable<string>;
62
+ }
63
+ export interface ReservationCartItem extends BaseCartItem {
64
+ item_type: CartItemTypeEnum.RESERVATION;
65
+ meal_id: null;
66
+ product_id: null;
67
+ product_variant_id: null;
68
+ inventory_item_id: null;
69
+ metadata: ReservationCartItemMetadata;
70
+ }
71
+ export interface AddReservationToCartInput extends BaseAddToCartInput {
72
+ item_type: CartItemTypeEnum.RESERVATION;
73
+ metadata: ReservationCartItemMetadata;
74
+ }
75
+ export type CartItem = MealCartItem | ProductCartItem | ReservationCartItem;
76
+ export type AddToCartInput = AddMealToCartInput | AddProductToCartInput | AddReservationToCartInput;
77
+ export interface BaseCart<T extends CartItem> extends Timestamps {
78
+ id: UUID;
79
+ user_id: Nullable<UUID>;
80
+ session_id: string;
81
+ cart_type: ScopeEnum;
82
+ vendor_id: UUID;
83
+ status: CartStatusEnum;
84
+ expires_at: Date;
85
+ total_items: number;
86
+ subtotal: MoneyString;
87
+ items: T[];
88
+ }
89
+ export interface RestaurantCart extends BaseCart<MealCartItem | ReservationCartItem> {
90
+ cart_type: ScopeEnum.RESTAURANT;
91
+ delivery_fee_estimate?: MoneyString;
92
+ tax_estimate?: MoneyString;
93
+ total_estimate?: MoneyString;
94
+ }
95
+ export interface GroceryCart extends BaseCart<ProductCartItem> {
96
+ cart_type: ScopeEnum.GROCERY;
97
+ bag_fee_estimate?: MoneyString;
98
+ delivery_fee_estimate?: MoneyString;
99
+ tax_estimate?: MoneyString;
100
+ total_estimate?: MoneyString;
101
+ }
102
+ export type CartAggregate = RestaurantCart | GroceryCart;
103
+ export interface HydratedCartItem {
104
+ id: string;
105
+ cart_item_id: UUID;
106
+ name: string;
107
+ image: string;
108
+ unit_price: MoneyString;
109
+ total_price: MoneyString;
110
+ quantity: number;
111
+ item_type: CartItemTypeEnum;
112
+ options_summary?: string;
113
+ }
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ // function renderCart(cart: CartAggregate) {
4
+ // if (cart.cart_type === CartTypeEnum.RESTAURANT) {
5
+ // // TypeScript KNOWS this is a RestaurantCart.
6
+ // // It will auto-complete `meal_id` and `party_size` but throw an error if you type `product_id`.
7
+ // cart.items.forEach(item => {
8
+ // if (item.item_type === CartItemTypeEnum.MEAL) {
9
+ // console.log(item.meal_id); // ✅ Works
10
+ // }
11
+ // });
12
+ // }
13
+ // if (cart.cart_type === CartTypeEnum.GROCERY) {
14
+ // // TypeScript KNOWS this is a GroceryCart.
15
+ // // It will auto-complete `inventory_item_id`.
16
+ // cart.items.forEach(item => {
17
+ // console.log(item.inventory_item_id); // ✅ Works
18
+ // })
19
+ // }
20
+ // }