@glissandoo/lib 1.20.2 → 1.22.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/models/Group/Repertory/File/index.d.ts +10 -3
- package/models/Group/Repertory/File/index.js +26 -34
- package/models/Partnership/Group/index.d.ts +1 -0
- package/models/Partnership/Group/index.js +3 -0
- package/models/Partnership/Group/types.d.ts +1 -0
- package/models/Partnership/index.d.ts +1 -0
- package/models/Partnership/index.js +3 -0
- package/models/Partnership/types.d.ts +1 -0
- package/package.json +1 -1
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { FileSectionId } from '../File/Section/types';
|
|
2
2
|
import { GroupRepertoireFile } from '../types';
|
|
3
|
-
import { FileSectionByTagItem, FileSectionItem } from './types';
|
|
4
3
|
export default class ThemeFile {
|
|
5
4
|
id: string;
|
|
6
5
|
private data;
|
|
@@ -15,8 +14,16 @@ export default class ThemeFile {
|
|
|
15
14
|
get isFileByPages(): boolean;
|
|
16
15
|
get sections(): Partial<Record<FileSectionId, import("../types").GroupRepertoireFileSections>>;
|
|
17
16
|
get sectionIds(): FileSectionId[];
|
|
18
|
-
get sectionsList():
|
|
19
|
-
|
|
17
|
+
get sectionsList(): {
|
|
18
|
+
sectionId: FileSectionId;
|
|
19
|
+
tagsByFile: string[];
|
|
20
|
+
tagsByPages: Record<string, number[]>;
|
|
21
|
+
}[];
|
|
22
|
+
get sectionListByTags(): {
|
|
23
|
+
sectionId: FileSectionId;
|
|
24
|
+
tag: string;
|
|
25
|
+
pages: number[] | null;
|
|
26
|
+
}[];
|
|
20
27
|
get identifyAt(): number | null;
|
|
21
28
|
protected isNoTag(tags?: string[]): boolean;
|
|
22
29
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
3
4
|
const objects_1 = require("../../../../helpers/objects");
|
|
4
5
|
const types_1 = require("../../types");
|
|
5
6
|
class ThemeFile {
|
|
@@ -39,45 +40,36 @@ class ThemeFile {
|
|
|
39
40
|
}
|
|
40
41
|
get sectionsList() {
|
|
41
42
|
const list = (0, objects_1.mapToArray)(this.sections);
|
|
42
|
-
return list.map((section) =>
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
}
|
|
55
|
-
: tags.reduce((accTags, tag) => ({
|
|
56
|
-
...accTags,
|
|
57
|
-
[tag]: [...(acc[tag] || []), Number(page)],
|
|
58
|
-
}), {})),
|
|
59
|
-
}), {}),
|
|
43
|
+
return list.map((section) => {
|
|
44
|
+
const sectionId = section.id;
|
|
45
|
+
if (this.isFileByPages) {
|
|
46
|
+
const items = Object.entries(section.pages || {}).flatMap(([page, { tags }]) => this.isNoTag(tags)
|
|
47
|
+
? { page: Number(page), tag: types_1.GroupRepertoireTagReserved.NoTag }
|
|
48
|
+
: tags.map((tag) => ({ page: Number(page), tag })));
|
|
49
|
+
const tagsByPages = (0, lodash_1.mapValues)((0, lodash_1.groupBy)(items, 'tag'), (v) => v.map((t) => t.page));
|
|
50
|
+
return {
|
|
51
|
+
sectionId,
|
|
52
|
+
tagsByFile: [],
|
|
53
|
+
tagsByPages,
|
|
54
|
+
};
|
|
60
55
|
}
|
|
61
|
-
|
|
62
|
-
sectionId
|
|
63
|
-
tagsByFile: this.isNoTag(section.tags)
|
|
64
|
-
? [types_1.GroupRepertoireTagReserved.NoTag]
|
|
65
|
-
: section.tags || [],
|
|
56
|
+
return {
|
|
57
|
+
sectionId,
|
|
58
|
+
tagsByFile: this.isNoTag(section.tags) ? [types_1.GroupRepertoireTagReserved.NoTag] : section.tags || [],
|
|
66
59
|
tagsByPages: {},
|
|
67
|
-
}
|
|
60
|
+
};
|
|
61
|
+
});
|
|
68
62
|
}
|
|
69
63
|
get sectionListByTags() {
|
|
70
64
|
const list = this.sectionsList;
|
|
71
|
-
return list.
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}))),
|
|
80
|
-
], []);
|
|
65
|
+
return list.flatMap(({ tagsByFile, tagsByPages, sectionId }) => {
|
|
66
|
+
const tags = this.isFileByPages ? Object.keys(tagsByPages) : tagsByFile;
|
|
67
|
+
return tags.map((tag) => ({
|
|
68
|
+
sectionId,
|
|
69
|
+
tag,
|
|
70
|
+
pages: this.isFileByPages ? tagsByPages[tag] : null,
|
|
71
|
+
}));
|
|
72
|
+
});
|
|
81
73
|
}
|
|
82
74
|
get identifyAt() {
|
|
83
75
|
return this.data.identifyAt || null;
|
|
@@ -11,6 +11,7 @@ export default class PartnershipGroup extends GroupBasic<PartnershipGroupData> {
|
|
|
11
11
|
get upgradedBy(): FirebaseFirestore.DocumentReference<FirebaseFirestore.DocumentData> | null;
|
|
12
12
|
get planId(): PlansGroup;
|
|
13
13
|
get planPeriod(): import("../../../helpers/plans").PlanPeriod | null;
|
|
14
|
+
get discount(): number | null;
|
|
14
15
|
get planStripeId(): string | null;
|
|
15
16
|
get subscriptionStripeId(): string | null;
|
|
16
17
|
get partnershipId(): string;
|
|
@@ -7,6 +7,7 @@ export interface PartnershipGroupData extends GroupBasicData {
|
|
|
7
7
|
planId: PlansGroup;
|
|
8
8
|
planPeriod: PlanPeriod | null;
|
|
9
9
|
planStripeId: string | null;
|
|
10
|
+
discount: number | null;
|
|
10
11
|
subscriptionStripeId: string | null;
|
|
11
12
|
deletedAt: Timestamp | null;
|
|
12
13
|
readonly linkedBy: DocumentReference;
|