@simonarcher/fika-types 1.0.18 → 1.0.20

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/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
1
  export * from './shop';
2
2
  export * from './coffee';
3
3
  export * from './farm';
4
+ export * from './user';
5
+ export * from './userList';
package/dist/index.js CHANGED
@@ -20,3 +20,7 @@ __exportStar(require("./shop"), exports);
20
20
  __exportStar(require("./coffee"), exports);
21
21
  // Export all farm-related types
22
22
  __exportStar(require("./farm"), exports);
23
+ // Export all user-related types
24
+ __exportStar(require("./user"), exports);
25
+ // Export all user list-related types
26
+ __exportStar(require("./userList"), exports);
package/dist/shop.d.ts CHANGED
@@ -143,6 +143,20 @@ export interface ShopCommunityStats {
143
143
  visitCount: number;
144
144
  lastVisit: AdminTimestamp;
145
145
  };
146
+ topVisitor30Day?: {
147
+ userId: string;
148
+ userName: string;
149
+ checkIns30Day: number;
150
+ lastCalculated: AdminTimestamp;
151
+ };
152
+ }
153
+ export interface DailyVisitorStats {
154
+ date: string;
155
+ userCheckIns: Record<string, number>;
156
+ totalCheckIns: number;
157
+ uniqueVisitors: number;
158
+ createdAt: AdminTimestamp;
159
+ updatedAt: AdminTimestamp;
146
160
  }
147
161
  export interface ShopInfo {
148
162
  features: Partial<Record<ShopFeatureKey, boolean | null>> & Record<string, boolean | null>;
package/dist/user.d.ts ADDED
@@ -0,0 +1,21 @@
1
+ export interface User {
2
+ id: string;
3
+ email: string;
4
+ displayName: string;
5
+ photoURL?: string;
6
+ username?: string;
7
+ phoneNumber?: string;
8
+ createdAt: Date;
9
+ lastLoginAt: Date;
10
+ points?: number;
11
+ shopLists?: string[];
12
+ visitedShopsListId?: string;
13
+ role?: 'user' | 'admin';
14
+ unreadNotificationCount?: number;
15
+ preferences?: {
16
+ darkMode?: boolean;
17
+ notifications?: boolean;
18
+ [key: string]: any;
19
+ };
20
+ [key: string]: any;
21
+ }
package/dist/user.js ADDED
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,145 @@
1
+ import type { Timestamp as AdminTimestamp } from "firebase-admin/firestore";
2
+ export interface ShopInList {
3
+ shopId: string;
4
+ note?: string;
5
+ addedAt: AdminTimestamp;
6
+ }
7
+ export interface UserList {
8
+ id: string;
9
+ userId: string;
10
+ name: string;
11
+ description?: string;
12
+ isPublic: boolean;
13
+ shops: ShopInList[];
14
+ createdAt: AdminTimestamp;
15
+ updatedAt: AdminTimestamp;
16
+ totalShops: number;
17
+ listType: 'user_created' | 'system_managed';
18
+ systemListType?: 'visited_shops' | 'other_future_types';
19
+ isEditable: boolean;
20
+ tags?: string[];
21
+ coverImage?: string;
22
+ collaborators?: string[];
23
+ }
24
+ export interface UserListWithShopDetails extends Omit<UserList, 'shops'> {
25
+ shops: ShopWithDetails[];
26
+ creatorDisplayName?: string;
27
+ creatorUsername?: string;
28
+ creatorProfileImage?: string;
29
+ }
30
+ export interface ShopWithDetails {
31
+ shopId: string;
32
+ name: string;
33
+ city: string;
34
+ countryCode: string;
35
+ coverImage?: string;
36
+ logoImage?: string;
37
+ fikaRating?: number;
38
+ note?: string;
39
+ addedAt: AdminTimestamp;
40
+ }
41
+ export declare const SYSTEM_LIST_TYPES: {
42
+ readonly VISITED_SHOPS: "visited_shops";
43
+ };
44
+ export declare const VISITED_SHOPS_LIST_CONFIG: {
45
+ readonly name: "Visited Shops";
46
+ readonly description: "Shops you've checked into. This list is automatically managed based on your check-ins.";
47
+ readonly listType: "system_managed";
48
+ readonly systemListType: "visited_shops";
49
+ readonly isEditable: false;
50
+ readonly isPublic: false;
51
+ readonly tags: readonly ["auto-generated", "check-ins"];
52
+ };
53
+ export interface VisitedShopsStats {
54
+ totalShops: number;
55
+ firstVisitDate: AdminTimestamp;
56
+ mostRecentVisit: AdminTimestamp;
57
+ totalCheckIns: number;
58
+ averageCheckInsPerShop: number;
59
+ }
60
+ export interface VisitedShopsListWithStats {
61
+ list: UserListWithShopDetails;
62
+ stats: VisitedShopsStats;
63
+ }
64
+ export interface CreateListData {
65
+ name: string;
66
+ description?: string;
67
+ isPublic: boolean;
68
+ tags?: string[];
69
+ }
70
+ export interface UpdateListData {
71
+ name?: string;
72
+ description?: string;
73
+ isPublic?: boolean;
74
+ tags?: string[];
75
+ }
76
+ export interface ListFormData {
77
+ name: string;
78
+ description: string;
79
+ isPublic: boolean;
80
+ tags: string[];
81
+ }
82
+ export interface ListCacheItem {
83
+ id: string;
84
+ name: string;
85
+ totalShops: number;
86
+ isPublic: boolean;
87
+ timestamp: number;
88
+ coverImage?: string;
89
+ }
90
+ export interface ListApiResponse<T = any> {
91
+ success: boolean;
92
+ data?: T;
93
+ message?: string;
94
+ }
95
+ export interface GetListsQuery {
96
+ isPublic?: boolean;
97
+ limit?: number;
98
+ offset?: number;
99
+ search?: string;
100
+ }
101
+ export interface ListPermissions {
102
+ canView: boolean;
103
+ canEdit: boolean;
104
+ canDelete: boolean;
105
+ canAddShops: boolean;
106
+ canRemoveShops: boolean;
107
+ canToggleVisibility: boolean;
108
+ }
109
+ export interface ShopSummary {
110
+ id: string;
111
+ name: string;
112
+ city: string;
113
+ countryCode: string;
114
+ coverImage?: string;
115
+ logoImage?: string;
116
+ fikaRating?: number;
117
+ }
118
+ export interface ListValidationError {
119
+ field: string;
120
+ message: string;
121
+ }
122
+ export interface ListStats {
123
+ totalLists: number;
124
+ publicLists: number;
125
+ privateLists: number;
126
+ totalShopsInLists: number;
127
+ averageShopsPerList: number;
128
+ }
129
+ export type ListErrorType = 'LIST_NOT_FOUND' | 'ACCESS_DENIED' | 'VALIDATION_ERROR' | 'SHOP_ALREADY_IN_LIST' | 'SHOP_NOT_IN_LIST' | 'LIST_LIMIT_EXCEEDED' | 'NETWORK_ERROR' | 'AUTHENTICATION_ERROR' | 'UNKNOWN_ERROR';
130
+ export interface ListError {
131
+ type: ListErrorType;
132
+ message: string;
133
+ details?: any;
134
+ }
135
+ export declare const LIST_VALIDATION_RULES: {
136
+ readonly NAME_MIN_LENGTH: 1;
137
+ readonly NAME_MAX_LENGTH: 100;
138
+ readonly DESCRIPTION_MAX_LENGTH: 500;
139
+ readonly MAX_TAGS_PER_LIST: 10;
140
+ readonly TAG_MAX_LENGTH: 30;
141
+ readonly MAX_LISTS_PER_USER: 50;
142
+ readonly MAX_SHOPS_PER_LIST: 100;
143
+ readonly SHOP_NOTE_MAX_LENGTH: 300;
144
+ };
145
+ export declare const DEFAULT_LIST_FORM_DATA: ListFormData;
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DEFAULT_LIST_FORM_DATA = exports.LIST_VALIDATION_RULES = exports.VISITED_SHOPS_LIST_CONFIG = exports.SYSTEM_LIST_TYPES = void 0;
4
+ exports.SYSTEM_LIST_TYPES = {
5
+ VISITED_SHOPS: 'visited_shops'
6
+ };
7
+ exports.VISITED_SHOPS_LIST_CONFIG = {
8
+ name: 'Visited Shops',
9
+ description: 'Shops you\'ve checked into. This list is automatically managed based on your check-ins.',
10
+ listType: 'system_managed',
11
+ systemListType: 'visited_shops',
12
+ isEditable: false,
13
+ isPublic: false, // Default private, but user can change
14
+ tags: ['auto-generated', 'check-ins']
15
+ };
16
+ // Constants for validation and limits
17
+ exports.LIST_VALIDATION_RULES = {
18
+ NAME_MIN_LENGTH: 1,
19
+ NAME_MAX_LENGTH: 100,
20
+ DESCRIPTION_MAX_LENGTH: 500,
21
+ MAX_TAGS_PER_LIST: 10,
22
+ TAG_MAX_LENGTH: 30,
23
+ MAX_LISTS_PER_USER: 50,
24
+ MAX_SHOPS_PER_LIST: 100,
25
+ SHOP_NOTE_MAX_LENGTH: 300,
26
+ };
27
+ // Default values for forms
28
+ exports.DEFAULT_LIST_FORM_DATA = {
29
+ name: '',
30
+ description: '',
31
+ isPublic: false,
32
+ tags: [],
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@simonarcher/fika-types",
3
- "version": "1.0.18",
3
+ "version": "1.0.20",
4
4
  "description": "Shared TypeScript types for Fika projects",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",