mgtypes 1.0.23 → 1.0.25

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/.eslintrc.js ADDED
@@ -0,0 +1,33 @@
1
+ module.exports = {
2
+ env: {
3
+ browser: true,
4
+ es2021: true,
5
+ node: true,
6
+ },
7
+ extends: ['eslint:recommended', 'plugin:@typescript-eslint/recommended'],
8
+ overrides: [
9
+ {
10
+ env: {
11
+ node: true,
12
+ },
13
+ files: ['.eslintrc.{js,cjs}'],
14
+ parserOptions: {
15
+ sourceType: 'script',
16
+ },
17
+ },
18
+ {
19
+ files: ['*.js'],
20
+ rules: {
21
+ '@typescript-eslint/no-var-requires': 'off',
22
+ },
23
+ },
24
+ ],
25
+ parser: '@typescript-eslint/parser',
26
+ parserOptions: {
27
+ ecmaVersion: 'latest',
28
+ sourceType: 'module',
29
+ },
30
+ rules: {
31
+ '@typescript-eslint/no-unused-vars': 0,
32
+ },
33
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mgtypes",
3
- "version": "1.0.23",
3
+ "version": "1.0.25",
4
4
  "description": "types for mg development",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -16,7 +16,12 @@
16
16
  "url": "https://github.com/MobGob/mgTypes/issues"
17
17
  },
18
18
  "homepage": "https://github.com/MobGob/mgTypes#readme",
19
- "dependencies": {
20
- "@types/geojson": "^7946.0.16"
19
+ "devDependencies": {
20
+ "@types/geojson": "^7946.0.16",
21
+ "@typescript-eslint/eslint-plugin": "^8.46.2",
22
+ "@typescript-eslint/parser": "^8.46.2",
23
+ "eslint": "^8.57.1",
24
+ "eslint-config-airbnb": "^19.0.4",
25
+ "eslint-plugin-import": "^2.32.0"
21
26
  }
22
27
  }
@@ -12,6 +12,8 @@ export interface mgConfiguration {
12
12
  features: mgFeaturesConfig;
13
13
  map: mgMapConfig;
14
14
  feed: mgFeedConfig;
15
+ profiles: mgProfilesConfig;
16
+ lists: mgListsConfig;
15
17
  }
16
18
 
17
19
  /**
@@ -20,8 +22,7 @@ export interface mgConfiguration {
20
22
  export interface mgMapConfig {
21
23
  MAP_LABELS: { zoomThresholds: number[]; labels: MapSign[][] };
22
24
  MAP_STYLE_URL: string;
23
- DEFAULT_MAP_BOUNDARIES: Position[];
24
- MAP_FILTERS: { [key: string]: any };
25
+ DEFAULT_MAP_BOUNDARIES: { latitude: number; longitude: number }[];
25
26
  }
26
27
 
27
28
  /**
@@ -48,6 +49,13 @@ export interface mgFeedConfig {
48
49
  };
49
50
  }
50
51
 
52
+ /**
53
+ * Configs for lists
54
+ */
55
+ export interface mgListsConfig {
56
+ HAS_CALENDAR: boolean;
57
+ }
58
+
51
59
  /**
52
60
  * Configs for event dates, locations, names, map details and feed header
53
61
  */
@@ -60,65 +68,99 @@ export interface mgSpecsConfig {
60
68
  APP_ALIAS: string;
61
69
  }
62
70
 
63
- interface PERMISSION_PROFILE {
64
- CONTENT_CREATION: {
65
- comment: boolean;
66
- photo: boolean;
67
- pin:
68
- | {
69
- [key: string]: any;
70
- }
71
- | false;
72
- plan:
73
- | {
74
- [key: string]: any;
75
- }
76
- | false;
77
- route: boolean;
78
- };
79
- VISIBLE_FEED_TABS: {
80
- main: boolean;
81
- archive: boolean;
82
- mine: boolean;
83
- friends: boolean;
84
- };
85
- CAN_HAVE_FRIENDS: boolean;
86
- CAN_SHARE_LOCATION: boolean;
87
- CAN_SHARE_CONTENT: boolean;
88
- CAN_SAVE_CONTENT: boolean;
89
- CAN_VOTE: boolean;
90
- CAN_ADD_TO_THREAD: boolean;
91
- CAN_EMBED_CONTENT_IN_THREAD: boolean;
92
- }
93
-
94
71
  /**
95
- * Configs that dictate user interactivity and determine what the configured app "is all about", so to speak
96
- * @param PERMISSION_PROFILES dictates what types of content users with various roles can add through the app. A configured object for each role (GUEST, USER, etc.) is a PERMISSION_PROFILE:
97
- *
98
- * {
99
- * CONTENT_CREATION:{
100
- * comment: true,
101
- * photo: false,
102
- * pin: { personal: ['car', 'bicycle', 'default'] },
103
- * plan: { sport: ['soccer'] },
104
- * route: false
105
- * }
106
- * },
72
+ * Configs that dictate user interactivity
107
73
  */
108
74
  export interface mgFeaturesConfig {
109
75
  EVENT_TAGS: string[];
110
- PIN_TYPES: { [key: string]: string[] };
111
- PLAN_TYPES: { [key: string]: string[] };
112
- SERVICE_TYPES: { [key: string]: any };
113
- EMERGENCY_TYPES: { [key: string]: any };
114
- USER_AUTH_SETTING: 'guest only' | 'account only' | 'guest or account';
115
- PERMISSION_PROFILES: {
116
- guest: PERMISSION_PROFILE | null;
117
- user: PERMISSION_PROFILE | null;
76
+ PIN_TYPES: {
77
+ food?: string[];
78
+ drink?: string[];
79
+ infrastructure?: string[];
80
+ activity?: string[];
81
+ toilet?: string[];
82
+ service?: string[];
83
+ transportation?: string[];
84
+ shopping?: string[];
85
+ personal?: string[];
86
+ other?: string[];
118
87
  };
119
- IS_CONTENT_THREADED: boolean
88
+ PLAN_TYPES: {
89
+ sport?: string[];
90
+ hallmark?: string[];
91
+ music?: string[];
92
+ other?: string[];
93
+ };
94
+ SERVICE_TYPES: {
95
+ fire?: {
96
+ value: 'fire';
97
+ label: string;
98
+ icon: string;
99
+ color: string;
100
+ };
101
+ medical?: {
102
+ value: 'medical';
103
+ label: string;
104
+ icon: string;
105
+ color: string;
106
+ };
107
+ 'mental health'?: {
108
+ value: 'mental health';
109
+ label: string;
110
+ icon: string;
111
+ color: string;
112
+ };
113
+ security?: {
114
+ value: 'security';
115
+ label: string;
116
+ icon: string;
117
+ color: string;
118
+ };
119
+ default: {
120
+ value: 'default';
121
+ label: string;
122
+ icon: string;
123
+ color: string;
124
+ };
125
+ };
126
+ EMERGENCY_TYPES: {
127
+ fire?: {
128
+ value: 'fire';
129
+ label: string;
130
+ icon: string;
131
+ color: string;
132
+ };
133
+ medical?: {
134
+ value: 'medical';
135
+ label: string;
136
+ icon: string;
137
+ color: string;
138
+ };
139
+ 'mental health'?: {
140
+ value: 'mental health';
141
+ label: string;
142
+ icon: string;
143
+ color: string;
144
+ };
145
+ security?: {
146
+ value: 'security';
147
+ label: string;
148
+ icon: string;
149
+ color: string;
150
+ };
151
+ default: {
152
+ value: 'default';
153
+ label: string;
154
+ icon: string;
155
+ color: string;
156
+ };
157
+ };
158
+ USER_AUTH_SETTING: 'guest only' | 'account only' | 'guest or account';
159
+ IS_CONTENT_THREADED: boolean;
120
160
  }
121
161
 
162
+ // ** COLORS **
163
+
122
164
  /**
123
165
  * Configs based on React Native Paper color assignments w/ some extras
124
166
  */
@@ -170,6 +212,8 @@ export interface mgColorsConfig {
170
212
  backdrop: string;
171
213
  }
172
214
 
215
+ // ** FONTS **
216
+
173
217
  /**
174
218
  * Configs for an individual font style
175
219
  */
@@ -196,6 +240,8 @@ export interface mgFontsConfig {
196
240
  default: mgFontTextStyle;
197
241
  }
198
242
 
243
+ // ** STYLES **
244
+
199
245
  /**
200
246
  * Configs for border and shadow styles
201
247
  */
@@ -208,3 +254,96 @@ export interface mgStylesConfig {
208
254
  buttonShadow: 'none' | 'small' | 'large';
209
255
  shadowRadius: 'small' | 'large' | 'none';
210
256
  }
257
+
258
+ // ** ACCOUNT PROFILES **
259
+
260
+ /**
261
+ * Configs for account-specific permissions and features
262
+ */
263
+ export interface mgProfilesConfig {
264
+ USER: mgProfileConfig;
265
+ GUEST: mgProfileConfig;
266
+ ADMIN: mgProfileConfig;
267
+ }
268
+
269
+ interface mgProfileConfig {
270
+ mgPermissionProfile: mgPermissionProfile;
271
+ mgMapFilterProfile: mgMapFilterProfile;
272
+ }
273
+
274
+ interface mgPermissionProfile {
275
+ CONTENT_CREATION: {
276
+ comment: boolean;
277
+ // whether a guest/user can take a photo versus
278
+ // use one from their library
279
+ photo: { camera: boolean; library: boolean };
280
+ pin:
281
+ | {
282
+ [key: string]: string[];
283
+ }
284
+ | false;
285
+ plan:
286
+ | {
287
+ [key: string]: string[];
288
+ }
289
+ | false;
290
+ route: boolean;
291
+ };
292
+ VISIBLE_FEED_TABS: {
293
+ main: boolean;
294
+ archive: boolean;
295
+ mine: boolean;
296
+ friends: boolean;
297
+ };
298
+ CAN_HAVE_FRIENDS: boolean;
299
+ CAN_SHARE_LOCATION: boolean;
300
+ CAN_SHARE_CONTENT: boolean;
301
+ CAN_SAVE_CONTENT: boolean;
302
+ CAN_VOTE: boolean;
303
+ CAN_ADD_TO_THREAD: boolean;
304
+ CAN_EMBED_CONTENT_IN_THREAD: boolean;
305
+ }
306
+
307
+ /**
308
+ * Determines what filters are displayed to
309
+ * a defined account type, such that an admin
310
+ * would see different filters than a guest or user
311
+ *
312
+ * @param pins one of this property's internal properties can be 'all', which will filter all pins
313
+ * @param plans same as above
314
+ */
315
+ interface mgMapFilterProfile {
316
+ pins?: { [key: string]: mgMapFilter };
317
+ plans?: { [key: string]: mgMapFilter };
318
+ people?: {
319
+ friends?: mgMapFilter;
320
+ fire?: mgMapFilter;
321
+ security?: mgMapFilter;
322
+ medical?: mgMapFilter;
323
+ 'mental health'?: mgMapFilter;
324
+ allResponders?: mgMapFilter;
325
+ all?: mgMapFilter;
326
+ };
327
+ emergencies?: {
328
+ fire?: mgMapFilter;
329
+ security?: mgMapFilter;
330
+ medical?: mgMapFilter;
331
+ 'mental health'?: mgMapFilter;
332
+ all?: mgMapFilter;
333
+ };
334
+ routes: {
335
+ runs?: mgMapFilter;
336
+ parades?: mgMapFilter;
337
+ all?: mgMapFilter;
338
+ };
339
+ }
340
+
341
+ /**
342
+ * Configs to display a map filter
343
+ */
344
+ interface mgMapFilter {
345
+ category: 'route' | 'pin' | 'person' | 'plan' | 'emergency';
346
+ value: string;
347
+ labelText: string;
348
+ icon: string;
349
+ }
package/types/Content.ts CHANGED
@@ -4,9 +4,14 @@ import { Vote } from './Vote';
4
4
  import { Emergency } from './Emergency';
5
5
  import { Position } from 'geojson';
6
6
 
7
- // shared posts will have sharedContentDetails, normal posts won't have sCD. Posts with threads attached have children; thread tracks who added and where a threaded post goes. A plan may have UserPlan details that indicate if user is attending the plan
8
-
9
- export interface AllAppContent {
7
+ /**
8
+ * shared posts will have sharedContentDetails, normal
9
+ * posts won't have sCD. Posts with threads attached have
10
+ * children; thread tracks who added and where a threaded
11
+ * post goes. A plan may have UserPlan details that indicate
12
+ * if user is attending the plan
13
+ * */
14
+ export interface AppContent {
10
15
  feedData: {
11
16
  mainContent: { order: number[]; content: { [contentId: string]: Post } };
12
17
  sharedContent: { order: number[]; content: { [contentId: string]: Post } };
@@ -31,6 +36,9 @@ export interface AllAppContent {
31
36
  activeRole: string;
32
37
  emergencies: Emergency[];
33
38
  };
39
+ listsData: {
40
+ [listId: string]: { content: Post[]; title: string; description: string };
41
+ };
34
42
  }
35
43
  export interface PostWithIndex {
36
44
  [contentId: string]: Post;
@@ -50,7 +58,9 @@ export interface Post {
50
58
  parent?: Post;
51
59
  }
52
60
 
53
- // indicates who embedded a piece of content: used for ThreadModal
61
+ /**
62
+ * indicates who embedded a piece of content: used for ThreadModal
63
+ * */
54
64
  export interface Thread {
55
65
  id: number;
56
66
  parentId: number;
@@ -85,7 +95,10 @@ export interface Content {
85
95
  fakeCreatedAt: string;
86
96
  }
87
97
 
88
- // Covers all different content types (pin, plan, comment, photo) coming in from server
98
+ /**
99
+ * Covers all different content types
100
+ * (pin, plan, comment, photo) coming in from server
101
+ * */
89
102
  export interface Contentable {
90
103
  id: number;
91
104
  primaryText: string;
@@ -155,7 +168,7 @@ export interface SharedContentDetails {
155
168
  * Consists of information from both user_friend and user records
156
169
  * to display the state of a friendship on client.
157
170
  * Documents when the request was originally made and who
158
- * has last updated it. TODO: create events that document
171
+ * has last updated it. TODO:type create events that document
159
172
  * how a friendship has changed over time
160
173
  */
161
174
  export interface FriendRequest {
@@ -176,12 +189,11 @@ export interface FriendRequest {
176
189
  lastUpdaterId: number;
177
190
  }
178
191
 
179
- // Specific content types - type Contentable above covers all content types coming in from server, but content types below are used for creating/editing content in Create[ContentType].tsx component
180
192
  export interface Pin {
181
193
  id: number | null; // will not have id when creating
182
194
  pinCategory?: string;
183
195
  pinType?: string;
184
- // TODO: CHANGE TO KEY AND BUCKET
196
+ // TODO:type CHANGE TO KEY AND BUCKET
185
197
  // WHICH ARE NEEDED FOR createPresignedUrlWothClient
186
198
  // KEY IS ROUTE + FILENAME
187
199
  photoURL?: string; // only available after post is created (ie, this is not added by the user)
@@ -225,7 +237,7 @@ export interface Comment {
225
237
  export interface Photo {
226
238
  id: number | null; // will not have id when creating
227
239
  primaryText: string;
228
- photoURL?: string; // may not have one (gets returned from Cloudinary after posting)
240
+ photoURL?: string;
229
241
  createdAt: string;
230
242
  updatedAt: string;
231
243
  }
@@ -242,4 +254,3 @@ export interface Route {
242
254
  link: string;
243
255
  phoneNumber: string;
244
256
  }
245
-
@@ -8,7 +8,7 @@ export interface Emergency {
8
8
  latitude: number | string | null;
9
9
  status: 'open' | 'closed';
10
10
  reporterId?: number | null;
11
- emergencyType: 'medical' | 'security' | 'fire' | null;
11
+ emergencyType: 'medical' | 'security' | 'fire' | 'mental health' | null;
12
12
  primaryText: string;
13
13
  address: string | null;
14
14
  reporter?: User;
package/types/User.ts CHANGED
@@ -6,7 +6,7 @@ export interface User {
6
6
  familyName: string | null;
7
7
  longName: string | null;
8
8
  email: string | null;
9
- phoneNumber: string | number | null; // TODO: currently this datum is a string but could/should change to numbers?
9
+ phoneNumber: string | number | null; // TODO:type currently this datum is a string but could/should change to numbers?
10
10
  latitude: number | string | null; // same as Content interface
11
11
  longitude: number | string | null; // same
12
12
  shareLoc: boolean | null;