@glissandoo/lib 1.9.1 → 1.10.0
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/functions/event.d.ts +8 -3
- package/functions/event.js +6 -0
- package/functions/eventPlayer.d.ts +2 -1
- package/functions/eventRepertory.d.ts +2 -1
- package/helpers/notifications.d.ts +2 -4
- package/helpers/notifications.js +5 -4
- package/models/User/index.d.ts +3 -12
- package/models/User/index.js +5 -19
- package/models/User/types.d.ts +6 -0
- package/models/User/types.js +6 -1
- package/package.json +1 -1
package/functions/event.d.ts
CHANGED
|
@@ -2,6 +2,11 @@ import { Descendant } from '../helpers/slate';
|
|
|
2
2
|
import { EventPlayerStatus } from '../models/Evento/Player/types';
|
|
3
3
|
import { EventRepeatPeriod, EventStage, EventType } from '../models/Evento/types';
|
|
4
4
|
export declare namespace EventoFbFunctionsTypes {
|
|
5
|
+
export enum RelationAction {
|
|
6
|
+
Single = "single",
|
|
7
|
+
Future = "future",
|
|
8
|
+
All = "all"
|
|
9
|
+
}
|
|
5
10
|
export interface PublishParams {
|
|
6
11
|
type: EventType;
|
|
7
12
|
displayName: string | null;
|
|
@@ -31,7 +36,7 @@ export declare namespace EventoFbFunctionsTypes {
|
|
|
31
36
|
export type PublishResult = string[];
|
|
32
37
|
interface EditParamsBase {
|
|
33
38
|
eventId: string;
|
|
34
|
-
|
|
39
|
+
relations: RelationAction;
|
|
35
40
|
notify: boolean;
|
|
36
41
|
}
|
|
37
42
|
export enum EditScope {
|
|
@@ -89,7 +94,7 @@ export declare namespace EventoFbFunctionsTypes {
|
|
|
89
94
|
export type EditResult = void;
|
|
90
95
|
export interface EditDatetimeParams {
|
|
91
96
|
eventId: string;
|
|
92
|
-
|
|
97
|
+
relations: RelationAction;
|
|
93
98
|
notify: boolean;
|
|
94
99
|
datetime: number;
|
|
95
100
|
datetimeEnd: number;
|
|
@@ -98,7 +103,7 @@ export declare namespace EventoFbFunctionsTypes {
|
|
|
98
103
|
export type EditDatetimeResult = void;
|
|
99
104
|
export interface RemoveParams {
|
|
100
105
|
eventId: string;
|
|
101
|
-
|
|
106
|
+
relations: RelationAction;
|
|
102
107
|
notify: boolean;
|
|
103
108
|
}
|
|
104
109
|
export type RemoveResult = void;
|
package/functions/event.js
CHANGED
|
@@ -3,6 +3,12 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.EventoFbFunctionsTypes = void 0;
|
|
4
4
|
var EventoFbFunctionsTypes;
|
|
5
5
|
(function (EventoFbFunctionsTypes) {
|
|
6
|
+
let RelationAction;
|
|
7
|
+
(function (RelationAction) {
|
|
8
|
+
RelationAction["Single"] = "single";
|
|
9
|
+
RelationAction["Future"] = "future";
|
|
10
|
+
RelationAction["All"] = "all";
|
|
11
|
+
})(RelationAction = EventoFbFunctionsTypes.RelationAction || (EventoFbFunctionsTypes.RelationAction = {}));
|
|
6
12
|
let EditScope;
|
|
7
13
|
(function (EditScope) {
|
|
8
14
|
EditScope["Title"] = "title";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { EventPlayerReason } from '../models/Evento/Player/types';
|
|
2
|
+
import { EventoFbFunctionsTypes } from './event';
|
|
2
3
|
export declare namespace EventoPlayerFbFunctionsTypes {
|
|
3
4
|
enum SwitchAssistanceActions {
|
|
4
5
|
Confirm = "confirm",
|
|
@@ -20,7 +21,7 @@ export declare namespace EventoPlayerFbFunctionsTypes {
|
|
|
20
21
|
eventId: string;
|
|
21
22
|
userIds: string[];
|
|
22
23
|
templateId: string | null;
|
|
23
|
-
|
|
24
|
+
relations: EventoFbFunctionsTypes.RelationAction;
|
|
24
25
|
notify: boolean;
|
|
25
26
|
}
|
|
26
27
|
type EditResult = void;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { InstrumentId } from '../helpers/instruments';
|
|
2
|
+
import { EventoFbFunctionsTypes } from './event';
|
|
2
3
|
export declare namespace EventoRepertoryFbFunctionsTypes {
|
|
3
4
|
interface EditParams {
|
|
4
5
|
eventId: string;
|
|
5
6
|
themeIds: string[];
|
|
6
|
-
|
|
7
|
+
relations: EventoFbFunctionsTypes.RelationAction;
|
|
7
8
|
notify: boolean;
|
|
8
9
|
}
|
|
9
10
|
type EditResult = void;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { EventoFbFunctionsTypes } from '../functions/event';
|
|
2
2
|
import { NotificationActions } from '../models/Notification/types';
|
|
3
|
+
import { UserNotificationSettings } from '../models/User/types';
|
|
3
4
|
import { BadgesTypes } from './badges';
|
|
4
5
|
export declare const notificationActionsBadges: Record<BadgesTypes, {
|
|
5
6
|
firstLevel: NotificationActions;
|
|
@@ -32,8 +33,5 @@ declare type RelationActionNotification = Record<NotificationEventActions, Notif
|
|
|
32
33
|
export declare const notificationPerformance: RelationActionNotification;
|
|
33
34
|
export declare const notificationSinglePractice: RelationActionNotification;
|
|
34
35
|
export declare const notificationMultiplePractice: RelationActionNotification;
|
|
35
|
-
export declare const
|
|
36
|
-
eventAssistanceConfirm: NotificationActions[];
|
|
37
|
-
eventAssistanceDecline: NotificationActions[];
|
|
38
|
-
};
|
|
36
|
+
export declare const userNotificationSettings: Record<UserNotificationSettings, NotificationActions[]>;
|
|
39
37
|
export {};
|
package/helpers/notifications.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.userNotificationSettings = exports.notificationMultiplePractice = exports.notificationSinglePractice = exports.notificationPerformance = exports.editScopeToAction = exports.NotificationEventActions = exports.notificationActionsBadges = void 0;
|
|
4
4
|
const types_1 = require("../models/Notification/types");
|
|
5
|
+
const types_2 = require("../models/User/types");
|
|
5
6
|
const badges_1 = require("./badges");
|
|
6
7
|
exports.notificationActionsBadges = {
|
|
7
8
|
[badges_1.BadgesTypes.AccPerformances]: {
|
|
@@ -113,12 +114,12 @@ exports.notificationMultiplePractice = {
|
|
|
113
114
|
reminderMorningPending: types_1.NotificationActions.PracticeMorningReminderPending,
|
|
114
115
|
reminderRollcall: types_1.NotificationActions.PracticeRollCallReminder,
|
|
115
116
|
};
|
|
116
|
-
exports.
|
|
117
|
-
|
|
117
|
+
exports.userNotificationSettings = {
|
|
118
|
+
[types_2.UserNotificationSettings.AttendanceConfirmed]: [
|
|
118
119
|
types_1.NotificationActions.PerformanceAssistanceConfirm,
|
|
119
120
|
types_1.NotificationActions.PracticeAssistanceConfirm,
|
|
120
121
|
],
|
|
121
|
-
|
|
122
|
+
[types_2.UserNotificationSettings.AttendanceDeclined]: [
|
|
122
123
|
types_1.NotificationActions.PerformanceAssistanceDecline,
|
|
123
124
|
types_1.NotificationActions.PracticeAssistanceDecline,
|
|
124
125
|
],
|
package/models/User/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { DocumentSnapshot } from '@google-cloud/firestore';
|
|
2
2
|
import UserBasic from './basic';
|
|
3
|
-
import { UserAppConfig, UserData, UserRole } from './types';
|
|
3
|
+
import { UserAppConfig, UserData, UserNotificationSettings, UserRole } from './types';
|
|
4
4
|
export default class User extends UserBasic<UserData> {
|
|
5
5
|
constructor(doc: DocumentSnapshot);
|
|
6
6
|
get name(): string;
|
|
@@ -25,18 +25,8 @@ export default class User extends UserBasic<UserData> {
|
|
|
25
25
|
get groupsAdmin(): string[];
|
|
26
26
|
get isAdmin(): boolean;
|
|
27
27
|
get birthDate(): FirebaseFirestore.Timestamp | null;
|
|
28
|
+
get notificationSettings(): Record<UserNotificationSettings, boolean>;
|
|
28
29
|
/** @deprecated */
|
|
29
|
-
private get devices();
|
|
30
|
-
/** @deprecated */
|
|
31
|
-
get devicesList(): (import("./types").DeviceInfo & {
|
|
32
|
-
id: string;
|
|
33
|
-
})[];
|
|
34
|
-
/** @deprecated */
|
|
35
|
-
get hasDevices(): boolean;
|
|
36
|
-
/** @deprecated */
|
|
37
|
-
get device(): (import("./types").DeviceInfo & {
|
|
38
|
-
id: string;
|
|
39
|
-
}) | null;
|
|
40
30
|
get disabledNotifications(): Record<string, boolean>;
|
|
41
31
|
get activeDisabledNotifications(): string[];
|
|
42
32
|
get isActive(): boolean;
|
|
@@ -47,6 +37,7 @@ export default class User extends UserBasic<UserData> {
|
|
|
47
37
|
default_events_filter: import("./types").UserEventsFilter;
|
|
48
38
|
};
|
|
49
39
|
getAppConfig(value: UserAppConfig): string | import("./types").UserEventsFilter | null;
|
|
40
|
+
getNotificationSetting(key: UserNotificationSettings): boolean;
|
|
50
41
|
get registerVia(): import("./types").UserRegisterVia;
|
|
51
42
|
get lastAppLoginAt(): FirebaseFirestore.Timestamp | null;
|
|
52
43
|
}
|
package/models/User/index.js
CHANGED
|
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const lodash_1 = require("lodash");
|
|
7
|
-
const orderBy_1 = __importDefault(require("lodash/orderBy"));
|
|
8
7
|
const lang_1 = require("../../lang");
|
|
9
8
|
const basic_1 = __importDefault(require("./basic"));
|
|
10
9
|
const types_1 = require("./types");
|
|
@@ -78,26 +77,10 @@ class User extends basic_1.default {
|
|
|
78
77
|
get birthDate() {
|
|
79
78
|
return this.data.birthDate;
|
|
80
79
|
}
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return this.data.devices || {};
|
|
84
|
-
}
|
|
85
|
-
/** @deprecated */
|
|
86
|
-
get devicesList() {
|
|
87
|
-
const list = Object.keys(this.devices).map((id) => Object.assign(this.devices[id], { id }));
|
|
88
|
-
return orderBy_1.default(list, (device) => device.last_seen_at.toDate(), ['desc']);
|
|
80
|
+
get notificationSettings() {
|
|
81
|
+
return this.data.notificationSettings || {};
|
|
89
82
|
}
|
|
90
83
|
/** @deprecated */
|
|
91
|
-
get hasDevices() {
|
|
92
|
-
return this.devicesList.length > 0;
|
|
93
|
-
}
|
|
94
|
-
/** @deprecated */
|
|
95
|
-
get device() {
|
|
96
|
-
if (this.hasDevices) {
|
|
97
|
-
return this.devicesList[0];
|
|
98
|
-
}
|
|
99
|
-
return null;
|
|
100
|
-
}
|
|
101
84
|
get disabledNotifications() {
|
|
102
85
|
return this.data.disabledNotifications || {};
|
|
103
86
|
}
|
|
@@ -119,6 +102,9 @@ class User extends basic_1.default {
|
|
|
119
102
|
getAppConfig(value) {
|
|
120
103
|
return this.data.appConfig[value];
|
|
121
104
|
}
|
|
105
|
+
getNotificationSetting(key) {
|
|
106
|
+
return this.data.notificationSettings[key] || false;
|
|
107
|
+
}
|
|
122
108
|
get registerVia() {
|
|
123
109
|
return this.data.registerVia || null;
|
|
124
110
|
}
|
package/models/User/types.d.ts
CHANGED
|
@@ -12,6 +12,10 @@ export declare enum UserAppConfig {
|
|
|
12
12
|
DefaultGroupId = "default_group_id",
|
|
13
13
|
DefaultEventsFilter = "default_events_filter"
|
|
14
14
|
}
|
|
15
|
+
export declare enum UserNotificationSettings {
|
|
16
|
+
AttendanceConfirmed = "enabled_attendance_confirmed",
|
|
17
|
+
AttendanceDeclined = "enabled_attendance_declined"
|
|
18
|
+
}
|
|
15
19
|
export declare enum UserEventsFilter {
|
|
16
20
|
Month = 1,
|
|
17
21
|
Trimonth = 3,
|
|
@@ -58,6 +62,8 @@ export interface UserData extends UserBasicData {
|
|
|
58
62
|
birthDate: Timestamp | null;
|
|
59
63
|
/** @deprecated */
|
|
60
64
|
devices: Record<string, DeviceInfo> | null;
|
|
65
|
+
notificationSettings: Record<UserNotificationSettings, boolean>;
|
|
66
|
+
/** @deprecated */
|
|
61
67
|
disabledNotifications: Record<string, boolean> | null;
|
|
62
68
|
appConfig: {
|
|
63
69
|
[UserAppConfig.DefaultGroupId]: string | null;
|
package/models/User/types.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.UserEventsFilter = exports.UserAppConfig = exports.UserRegisterVia = exports.UserRole = void 0;
|
|
3
|
+
exports.UserEventsFilter = exports.UserNotificationSettings = exports.UserAppConfig = exports.UserRegisterVia = exports.UserRole = void 0;
|
|
4
4
|
var UserRole;
|
|
5
5
|
(function (UserRole) {
|
|
6
6
|
UserRole["SuperAdmin"] = "admin";
|
|
@@ -16,6 +16,11 @@ var UserAppConfig;
|
|
|
16
16
|
UserAppConfig["DefaultGroupId"] = "default_group_id";
|
|
17
17
|
UserAppConfig["DefaultEventsFilter"] = "default_events_filter";
|
|
18
18
|
})(UserAppConfig = exports.UserAppConfig || (exports.UserAppConfig = {}));
|
|
19
|
+
var UserNotificationSettings;
|
|
20
|
+
(function (UserNotificationSettings) {
|
|
21
|
+
UserNotificationSettings["AttendanceConfirmed"] = "enabled_attendance_confirmed";
|
|
22
|
+
UserNotificationSettings["AttendanceDeclined"] = "enabled_attendance_declined";
|
|
23
|
+
})(UserNotificationSettings = exports.UserNotificationSettings || (exports.UserNotificationSettings = {}));
|
|
19
24
|
var UserEventsFilter;
|
|
20
25
|
(function (UserEventsFilter) {
|
|
21
26
|
UserEventsFilter[UserEventsFilter["Month"] = 1] = "Month";
|