@use-stall/types 0.0.1

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.
@@ -0,0 +1,73 @@
1
+ import { Timestamp } from "firebase/firestore";
2
+
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ export interface UnifiedRegisterSessionType {
5
+ id: string;
6
+ device_id: string;
7
+ staff_id: string;
8
+ location_id: string;
9
+ opening_date: Timestamp;
10
+ opening_date_string: string;
11
+ closing_date: Timestamp;
12
+ closing_date_string: string;
13
+ last_activity_date: Timestamp;
14
+ duration: number; // Duration in miliseconds
15
+ opening_cash_balance: number;
16
+ closing_cash_balance_declared: number;
17
+ closing_cash_balance_system_calculated: number;
18
+ cash_difference: number;
19
+ cash_excess: number;
20
+ running_cash_balance: number;
21
+ paid_in: number; // Total value of cash paid into the register during the session
22
+ paid_out: number; // Total value of cash paid out of the register during the session
23
+ non_cash_tender_total: number; // Total value of non-cash transactions during the session
24
+ total_amount: number; // Total value of all transactions
25
+ number_of_transactions: number;
26
+ status: "open" | "closed" | "pending";
27
+ notes: string;
28
+ closing_remarks: string;
29
+ metadata: Record<string, any>;
30
+ }
31
+
32
+ export interface UnifiedSessionTransactionType {
33
+ id: string;
34
+ date: Timestamp;
35
+ date_string: string;
36
+ order_id: string;
37
+ session_id: string;
38
+ location_id: string;
39
+ staff_id: string;
40
+ transaction_type:
41
+ | "sale"
42
+ | "return"
43
+ | "refund"
44
+ | "void"
45
+ | "pay-out"
46
+ | "pay-in";
47
+ tender_type: string; // e.g., "Cash", "Credit Card", "Gift Card"
48
+ total_amount: number;
49
+ note: string;
50
+ metadata: Record<string, any>;
51
+ payment_method: {
52
+ name: string;
53
+ id: string;
54
+ };
55
+ }
56
+
57
+ export interface UpdateSessionBalanceProps {
58
+ amount: number;
59
+ note: string;
60
+ transaction_type:
61
+ | "sale"
62
+ | "return"
63
+ | "refund"
64
+ | "void"
65
+ | "pay-out"
66
+ | "pay-in";
67
+ tender_type: string;
68
+ order_id?: string;
69
+ payment_method: {
70
+ name: string;
71
+ id: string;
72
+ };
73
+ }
@@ -0,0 +1 @@
1
+ declare module "stall-icons";
@@ -0,0 +1,44 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import { UnifiedCustomerType } from "./customers";
3
+ import { UnifiedOrderRefundType, UnifiedOrderType } from "./orders";
4
+
5
+ export interface PosQueueDataType {
6
+ action: "create" | "update" | "delete";
7
+ group: "orders" | "order_refunds" | "customers" | "purchase_orders";
8
+ data: UnifiedOrderType | UnifiedCustomerType | UnifiedOrderRefundType;
9
+ timestamp: number;
10
+ id: string;
11
+ document_id: string;
12
+ status: "syncing" | "pending";
13
+ device_token: string;
14
+ }
15
+
16
+ export interface LoaderDataType {
17
+ percentage: number;
18
+ title?: string;
19
+ icon?: unknown;
20
+ }
21
+
22
+ export interface SystemInfo {
23
+ browser: {
24
+ name: string;
25
+ version: string;
26
+ };
27
+ os: {
28
+ name: string;
29
+ version: string;
30
+ versionName: string;
31
+ };
32
+ platform: {
33
+ type: string;
34
+ vendor: string;
35
+ };
36
+ engine: {
37
+ name: string;
38
+ };
39
+ }
40
+
41
+ export interface NativeEventType {
42
+ type: "haptic" | "theme";
43
+ payload: any;
44
+ }
package/src/taxes.d.ts ADDED
@@ -0,0 +1,32 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ export interface UnifiedTaxRegionType {
3
+ id: string; // Unique identifier
4
+ name: string; // Display name (e.g., "California", "EU VAT Zone")
5
+ country: string; // Country
6
+ alpha3: string; // ISO 3166-1 alpha-3 code (e.g., "USA", "GBR")
7
+ alpha2: string; // ISO 3166-1 alpha-2 code (e.g., "US", "GB")
8
+ states: string[]; // Optional state/province (e.g., "CA")
9
+ postal_codes: string[]; // Specific ZIP codes if applicable
10
+ tax_inclusive: boolean; // Whether prices include tax
11
+ is_default?: boolean; // Whether this is the default region
12
+ metadata: { [key: string]: string }; // Additional metadata
13
+ }
14
+
15
+ export interface UnifiedTaxClassType {
16
+ id: string; // Unique ID for the tax class
17
+ region_id: string; // Links to TaxZone
18
+ name: string; // Name (e.g., "Standard", "Reduced", "Exempt")
19
+ metadata: { [key: string]: any }; // Additional metadata
20
+ }
21
+
22
+ export interface UnifiedTaxRateType {
23
+ id: string; // Unique identifier
24
+ class_id: string; // Links to TaxClass
25
+ region_id: string; // Links to TaxRegion
26
+ rate: number; // Tax rate (e.g., 0.2 for 20%)
27
+ type: "percentage" | "fixed"; // Type of tax
28
+ code: string; // Optional description
29
+ compound: boolean; // Whether this is a compound tax rate
30
+ priority: number; // Priority order
31
+ metadata: { [key: string]: any }; // Additional metadata
32
+ }
package/src/users.d.ts ADDED
@@ -0,0 +1,40 @@
1
+ import { AuthObject } from "pin-auth";
2
+
3
+ /* eslint-disable @typescript-eslint/no-explicit-any */
4
+ export interface UserType {
5
+ fullname: string;
6
+ email: string;
7
+ organizations: string[];
8
+ createdAt: string;
9
+ updatedAt: string;
10
+ id: string;
11
+ role_id: string;
12
+ phone_number: string;
13
+ profile_picture?: string;
14
+ }
15
+
16
+ export interface PosProfileType {
17
+ id: string;
18
+ name: string;
19
+ email?: string;
20
+ createdAt: string;
21
+ updatedAt: string;
22
+ role_id: string;
23
+ linked_devices: string[];
24
+ profile?: string;
25
+ locations: string[];
26
+ locations_enabled?: boolean;
27
+ auth: AuthObject;
28
+ }
29
+
30
+ export interface RoleType {
31
+ id: string;
32
+ role: string;
33
+ permissions: { [key: string]: any };
34
+ }
35
+
36
+ export interface PosRoleType {
37
+ id: string;
38
+ role: string;
39
+ permissions: { [key: string]: any };
40
+ }
package/tsconfig.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "compilerOptions": {
3
+ // Environment setup & latest features
4
+ "lib": ["ESNext"],
5
+ "target": "ESNext",
6
+ "module": "Preserve",
7
+ "moduleDetection": "force",
8
+ "jsx": "react-jsx",
9
+ "allowJs": true,
10
+
11
+ // Bundler mode
12
+ "moduleResolution": "bundler",
13
+ "allowImportingTsExtensions": true,
14
+ "verbatimModuleSyntax": true,
15
+ "noEmit": true,
16
+
17
+ // Best practices
18
+ "strict": true,
19
+ "skipLibCheck": true,
20
+ "noFallthroughCasesInSwitch": true,
21
+ "noUncheckedIndexedAccess": true,
22
+ "noImplicitOverride": true,
23
+
24
+ // Some stricter flags (disabled by default)
25
+ "noUnusedLocals": false,
26
+ "noUnusedParameters": false,
27
+ "noPropertyAccessFromIndexSignature": false
28
+ }
29
+ }
30
+