@glissandoo/lib 1.3.16 → 1.3.17

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.
@@ -1,7 +1,7 @@
1
1
  import { DocumentReference, DocumentSnapshot } from '@google-cloud/firestore';
2
2
  import { LanguagesTypes } from '../../lang';
3
3
  import GroupBasic from './basic';
4
- import { GroupData, SocialNetwork } from './types';
4
+ import { GroupData, GroupStatus, SocialNetwork } from './types';
5
5
  export default class Group extends GroupBasic<GroupData> {
6
6
  constructor(doc: DocumentSnapshot, lang?: LanguagesTypes);
7
7
  get owner(): DocumentReference;
@@ -36,7 +36,7 @@ export default class Group extends GroupBasic<GroupData> {
36
36
  getSocialNetworkUrl(id: SocialNetwork): string | null;
37
37
  get config(): Record<import("./types").GroupConfig, boolean>;
38
38
  get templates(): Record<string, import("./types").GroupTemplateData>;
39
- get status(): import("./types").GroupStatus;
39
+ get status(): GroupStatus;
40
40
  get templatesList(): (import("./types").GroupTemplateData & {
41
41
  id: string;
42
42
  })[];
@@ -47,4 +47,5 @@ export default class Group extends GroupBasic<GroupData> {
47
47
  getPlayer: (userId: string) => import("../Player/types").PlayerBasicData | null;
48
48
  isAdmin: (userId: string) => boolean;
49
49
  isPlayer: (userId: string) => boolean;
50
+ get isExpiredTrial(): boolean;
50
51
  }
@@ -3,6 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
+ const date_fns_1 = require("date-fns");
6
7
  const lodash_1 = require("lodash");
7
8
  const orders_1 = require("../../helpers/musicStyles/orders");
8
9
  const lang_1 = require("../../lang");
@@ -132,5 +133,9 @@ class Group extends basic_1.default {
132
133
  get satisfactionIndex() {
133
134
  return this.data.satisfactionIndex || { current: 0, last: 0 };
134
135
  }
136
+ get isExpiredTrial() {
137
+ const isOutDateTrial = date_fns_1.isBefore(this.createdAt.toDate(), date_fns_1.subMonths(new Date(), 1));
138
+ return this.status !== types_1.GroupStatus.Premium && isOutDateTrial;
139
+ }
135
140
  }
136
141
  exports.default = Group;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.3.16",
3
+ "version": "1.3.17",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",