@glissandoo/lib 1.20.1 → 1.21.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.
@@ -56,7 +56,6 @@ export declare namespace GroupRepertoryFbFunctionsTypes {
56
56
  groupId: string;
57
57
  path: string;
58
58
  fileName: string;
59
- fileId: string;
60
59
  }
61
60
  export interface IdentifyInstrumentItem {
62
61
  page: number;
@@ -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(): FileSectionItem[];
19
- get sectionListByTags(): FileSectionByTagItem[];
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) => this.isFileByPages
43
- ? {
44
- sectionId: section.id,
45
- tagsByFile: [],
46
- tagsByPages: Object.entries(section.pages || {}).reduce((acc, [page, { tags }]) => ({
47
- ...acc,
48
- ...(this.isNoTag(tags)
49
- ? {
50
- [types_1.GroupRepertoireTagReserved.NoTag]: [
51
- ...(acc[types_1.GroupRepertoireTagReserved.NoTag] || []),
52
- Number(page),
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: section.id,
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.reduce((acc, { tagsByFile, tagsByPages, sectionId }) => [
72
- ...acc,
73
- ...(this.isFileByPages
74
- ? Object.entries(tagsByPages).reduce((accTags, [tag, pages]) => [...accTags, { sectionId, tag, pages }], [])
75
- : tagsByFile.map((tag) => ({
76
- sectionId,
77
- tag,
78
- pages: null,
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;
@@ -29,6 +29,9 @@ class PartnershipGroup extends basic_1.default {
29
29
  get planPeriod() {
30
30
  return this.data.planPeriod || null;
31
31
  }
32
+ get discount() {
33
+ return this.data.discount || null;
34
+ }
32
35
  get planStripeId() {
33
36
  return this.data.planStripeId || null;
34
37
  }
@@ -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;
@@ -20,4 +20,5 @@ export default class Partnership extends PartnershipBasic<PartnershipData> {
20
20
  type: string;
21
21
  value: string;
22
22
  }[];
23
+ get howDidYouHearAboutUs(): string | null;
23
24
  }
@@ -47,5 +47,8 @@ class Partnership extends basic_1.default {
47
47
  get stripeTaxIds() {
48
48
  return this.data.stripeTaxIds || [];
49
49
  }
50
+ get howDidYouHearAboutUs() {
51
+ return this.data.howDidYouHearAboutUs || null;
52
+ }
50
53
  }
51
54
  exports.default = Partnership;
@@ -41,5 +41,6 @@ export interface PartnershipData extends PartnershipBasicData {
41
41
  type: string;
42
42
  value: string;
43
43
  }[];
44
+ howDidYouHearAboutUs: string | null;
44
45
  readonly createdAt: Timestamp;
45
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.20.1",
3
+ "version": "1.21.0",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",