@sportsbroker/firebase-structure 3.21.1 → 3.22.0-RC1

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.
@@ -20,7 +20,6 @@ interface RedCardEvent extends BaseEvent {
20
20
  isSecondYellow?: boolean;
21
21
  playerId: NumericID;
22
22
  playerName: string;
23
- playerShirtName: string;
24
23
  playerUniform: string;
25
24
  }
26
25
 
@@ -28,7 +27,6 @@ interface YellowCardEvent extends BaseEvent {
28
27
  type: "YELLOW_CARD";
29
28
  playerId: NumericID;
30
29
  playerName: string;
31
- playerShirtName: string;
32
30
  playerUniform: string;
33
31
  }
34
32
 
@@ -36,14 +34,12 @@ interface GoalEvent extends BaseEvent {
36
34
  type: "GOAL";
37
35
  assistingPlayerId?: NumericID;
38
36
  assistingPlayerName?: string;
39
- assistingPlayerShirtName?: string;
40
37
  assistingPlayerUniform?: string;
41
38
  goalNumber: number;
42
39
  penalty?: boolean;
43
40
  ownGoal?: boolean;
44
41
  playerId: NumericID;
45
42
  playerName: string;
46
- playerShirtName: string;
47
43
  playerUniform: string;
48
44
  }
49
45
 
@@ -51,11 +47,9 @@ interface SubstitutionEvent extends BaseEvent {
51
47
  type: "SUBSTITUTION";
52
48
  playerInId: NumericID;
53
49
  playerInName: string;
54
- playerInShirtName: string;
55
50
  playerInUniform: string;
56
51
  playerOutId: NumericID;
57
52
  playerOutName: string;
58
- playerOutShirtName: string;
59
53
  playerOutUniform: string;
60
54
  }
61
55
 
@@ -1,34 +1,80 @@
1
- import {UserID, Language, ISODate} from "../../global";
1
+ import { ISODate } from "../../global";
2
2
 
3
3
  export type NotificationID = string;
4
4
 
5
+ export type OrderType =
6
+ | 'MARKET'
7
+ | 'LIMIT';
8
+
5
9
  export type NotificationType =
6
- | "TRANSACTION_BUY"
7
- | "TRANSACTION_SELL"
8
- | "TEAM_ELIMINATED"
9
- | "KICK_OFF";
10
+ | 'CUSTOM'
11
+ | 'TEAM_BANKRUPT'
12
+ | 'SHARE_SPLIT'
13
+ | 'SHARE_BUY_SUCCESSFUL'
14
+ | 'SHARE_SELL_SUCCESSFUL'
15
+ | 'SHARE_BUY_UNSUCCESSFUL'
16
+ | 'SHARE_SELL_UNSUCCESSFUL';
17
+
18
+ export type VariablesMap = {
19
+ ['CUSTOM']: {
20
+ title: string;
21
+ content: string;
22
+ icon?: string;
23
+ };
24
+ ['TEAM_BANKRUPT']: {
25
+ teamId: string;
26
+ teamName: string;
27
+ };
28
+ ['SHARE_SPLIT']: {
29
+ // @todo
30
+ };
31
+ ['SHARE_BUY_SUCCESSFUL']: {
32
+ orderId: number;
33
+ orderType: OrderType,
34
+ shareAmount: number;
35
+ teamId: string;
36
+ teamName: string;
37
+ };
38
+ ['SHARE_SELL_SUCCESSFUL']: {
39
+ orderId: number;
40
+ orderType: OrderType,
41
+ shareAmount: number;
42
+ teamId: string;
43
+ teamName: string;
44
+ };
45
+ ['SHARE_BUY_UNSUCCESSFUL']: {
46
+ orderId: number;
47
+ orderType: OrderType,
48
+ shareAmount: number;
49
+ teamId: string;
50
+ teamName: string;
51
+ };
52
+ ['SHARE_SELL_UNSUCCESSFUL']: {
53
+ orderId: number;
54
+ orderType: OrderType,
55
+ shareAmount: number;
56
+ teamId: string;
57
+ teamName: string;
58
+ };
59
+ }
10
60
 
11
- export interface Notification {
12
- type: NotificationType;
13
- title: string;
61
+ export interface Notification<T extends NotificationType> {
62
+ type: T;
63
+ title?: string;
14
64
  description?: string;
65
+ variables?: VariablesMap[T];
15
66
  shown: boolean;
16
67
  createdAt: ISODate;
17
68
  updatedAt: ISODate;
18
69
  id: NotificationID;
19
70
  }
20
71
 
21
- /**
22
- * notificationId: NotificationID
23
- * language: Language
24
- * userId: UserID
25
- */
26
72
  export interface Notifications {
27
73
  [userId: string]: {
28
74
  unreadCount: number;
29
- [language: string]: number | { // It can't be number - this is workaround because TS can't handle dynamic keys here
75
+ en: { // This is for backward compatibility
30
76
  entries: {
31
- [notificationId: string]: Notification;
77
+ [notificationId: string]: Notification<NotificationType>;
32
78
  };
33
79
  };
34
80
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sportsbroker/firebase-structure",
3
- "version": "3.21.1",
3
+ "version": "3.22.0-RC1",
4
4
  "description": "Firebase structure typings",
5
5
  "main": "index.d.ts",
6
6
  "repository": {