@glissandoo/lib 1.108.7 → 1.108.9

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.
@@ -139,6 +139,8 @@ export declare enum FbFunctionName {
139
139
  PartnershipPartnerEdit = "partnershipPartner-edit",
140
140
  PartnershipPartnerOnWrite = "partnershipPartner-onWrite",
141
141
  PartnershipPartnerRemove = "partnershipPartner-remove",
142
+ PartnershipPartnerRequest = "partnershipPartner-request",
143
+ PartnershipPartnerAccept = "partnershipPartner-accept",
142
144
  PartnershipPaymentCreateOneTime = "partnershipPayment-createOneTime",
143
145
  PartnershipPaymentGenerateRecurringBySubscriptions = "partnershipPayment-generateRecurringBySubscriptions",
144
146
  PartnershipPaymentEdit = "partnershipPayment-edit",
@@ -146,6 +148,7 @@ export declare enum FbFunctionName {
146
148
  PartnershipPaymentRemove = "partnershipPayment-remove",
147
149
  PartnershipPlanCreate = "partnershipPlan-create",
148
150
  PartnershipPlanEdit = "partnershipPlan-edit",
151
+ PartnershipPlanOnUpdate = "partnershipPlan-onUpdate",
149
152
  PartnershipPlanRemove = "partnershipPlan-remove",
150
153
  PartnershipSepaPaymentGroupCreate = "partnershipSepaPaymentGroup-create",
151
154
  PartnershipSepaPaymentGroupEdit = "partnershipSepaPaymentGroup-edit",
@@ -153,6 +156,7 @@ export declare enum FbFunctionName {
153
156
  PartnershipSepaPaymentGroupRemove = "partnershipSepaPaymentGroup-remove",
154
157
  PartnershipSubscriptionCreate = "partnershipSubscription-create",
155
158
  PartnershipSubscriptionEdit = "partnershipSubscription-edit",
159
+ PartnershipSubscriptionOnUpdate = "partnershipSubscription-onUpdate",
156
160
  PartnershipSubscriptionOnWrite = "partnershipSubscription-onWrite",
157
161
  PartnershipSubscriptionRemove = "partnershipSubscription-remove",
158
162
  ReminderBiweeklyEventsEmail = "reminder-biweeklyEventsEmail",
@@ -143,6 +143,8 @@ var FbFunctionName;
143
143
  FbFunctionName["PartnershipPartnerEdit"] = "partnershipPartner-edit";
144
144
  FbFunctionName["PartnershipPartnerOnWrite"] = "partnershipPartner-onWrite";
145
145
  FbFunctionName["PartnershipPartnerRemove"] = "partnershipPartner-remove";
146
+ FbFunctionName["PartnershipPartnerRequest"] = "partnershipPartner-request";
147
+ FbFunctionName["PartnershipPartnerAccept"] = "partnershipPartner-accept";
146
148
  FbFunctionName["PartnershipPaymentCreateOneTime"] = "partnershipPayment-createOneTime";
147
149
  FbFunctionName["PartnershipPaymentGenerateRecurringBySubscriptions"] = "partnershipPayment-generateRecurringBySubscriptions";
148
150
  FbFunctionName["PartnershipPaymentEdit"] = "partnershipPayment-edit";
@@ -150,6 +152,7 @@ var FbFunctionName;
150
152
  FbFunctionName["PartnershipPaymentRemove"] = "partnershipPayment-remove";
151
153
  FbFunctionName["PartnershipPlanCreate"] = "partnershipPlan-create";
152
154
  FbFunctionName["PartnershipPlanEdit"] = "partnershipPlan-edit";
155
+ FbFunctionName["PartnershipPlanOnUpdate"] = "partnershipPlan-onUpdate";
153
156
  FbFunctionName["PartnershipPlanRemove"] = "partnershipPlan-remove";
154
157
  FbFunctionName["PartnershipSepaPaymentGroupCreate"] = "partnershipSepaPaymentGroup-create";
155
158
  FbFunctionName["PartnershipSepaPaymentGroupEdit"] = "partnershipSepaPaymentGroup-edit";
@@ -157,6 +160,7 @@ var FbFunctionName;
157
160
  FbFunctionName["PartnershipSepaPaymentGroupRemove"] = "partnershipSepaPaymentGroup-remove";
158
161
  FbFunctionName["PartnershipSubscriptionCreate"] = "partnershipSubscription-create";
159
162
  FbFunctionName["PartnershipSubscriptionEdit"] = "partnershipSubscription-edit";
163
+ FbFunctionName["PartnershipSubscriptionOnUpdate"] = "partnershipSubscription-onUpdate";
160
164
  FbFunctionName["PartnershipSubscriptionOnWrite"] = "partnershipSubscription-onWrite";
161
165
  FbFunctionName["PartnershipSubscriptionRemove"] = "partnershipSubscription-remove";
162
166
  FbFunctionName["ReminderBiweeklyEventsEmail"] = "reminder-biweeklyEventsEmail";
@@ -34,5 +34,14 @@ export declare namespace PartnershipPartnerFbFunctionsTypes {
34
34
  partnerId: string;
35
35
  }
36
36
  export type RemoveResult = void;
37
+ export interface RequestParams extends CreateData {
38
+ partnershipId: string;
39
+ }
40
+ export type RequestResult = void;
41
+ export interface AcceptParams {
42
+ partnershipId: string;
43
+ partnerId: string;
44
+ }
45
+ export type AcceptResult = void;
37
46
  export {};
38
47
  }
@@ -5,6 +5,7 @@ export declare namespace PartnershipPaymentFbFunctionsTypes {
5
5
  amount: number;
6
6
  partnerId: string;
7
7
  paymentMethod: PaymentMethod;
8
+ dueDate: string;
8
9
  }
9
10
  interface CreateOneTimeParams extends CreateOneTimeData {
10
11
  partnershipId: string;
@@ -18,6 +19,7 @@ export declare namespace PartnershipPaymentFbFunctionsTypes {
18
19
  amount?: number;
19
20
  paymentMethod?: PaymentMethod;
20
21
  status?: PaymentStatus;
22
+ dueDate?: string;
21
23
  }
22
24
  type EditResult = void;
23
25
  type RemoveParams = {
@@ -148,6 +148,8 @@ const regionByFunctions = {
148
148
  [index_1.FbFunctionName.PartnershipPartnerEdit]: GCloudRegions.EuropeWest6,
149
149
  [index_1.FbFunctionName.PartnershipPartnerOnWrite]: GCloudRegions.EuropeWest6,
150
150
  [index_1.FbFunctionName.PartnershipPartnerRemove]: GCloudRegions.EuropeWest6,
151
+ [index_1.FbFunctionName.PartnershipPartnerRequest]: GCloudRegions.EuropeWest6,
152
+ [index_1.FbFunctionName.PartnershipPartnerAccept]: GCloudRegions.EuropeWest6,
151
153
  [index_1.FbFunctionName.PartnershipPaymentCreateOneTime]: GCloudRegions.EuropeWest6,
152
154
  [index_1.FbFunctionName.PartnershipPaymentGenerateRecurringBySubscriptions]: GCloudRegions.EuropeWest6,
153
155
  [index_1.FbFunctionName.PartnershipPaymentEdit]: GCloudRegions.EuropeWest6,
@@ -155,6 +157,7 @@ const regionByFunctions = {
155
157
  [index_1.FbFunctionName.PartnershipPaymentRemove]: GCloudRegions.EuropeWest6,
156
158
  [index_1.FbFunctionName.PartnershipPlanCreate]: GCloudRegions.EuropeWest6,
157
159
  [index_1.FbFunctionName.PartnershipPlanEdit]: GCloudRegions.EuropeWest6,
160
+ [index_1.FbFunctionName.PartnershipPlanOnUpdate]: GCloudRegions.EuropeWest6,
158
161
  [index_1.FbFunctionName.PartnershipPlanRemove]: GCloudRegions.EuropeWest6,
159
162
  [index_1.FbFunctionName.PartnershipSepaPaymentGroupCreate]: GCloudRegions.EuropeWest6,
160
163
  [index_1.FbFunctionName.PartnershipSepaPaymentGroupEdit]: GCloudRegions.EuropeWest6,
@@ -162,6 +165,7 @@ const regionByFunctions = {
162
165
  [index_1.FbFunctionName.PartnershipSepaPaymentGroupRemove]: GCloudRegions.EuropeWest6,
163
166
  [index_1.FbFunctionName.PartnershipSubscriptionCreate]: GCloudRegions.EuropeWest6,
164
167
  [index_1.FbFunctionName.PartnershipSubscriptionEdit]: GCloudRegions.EuropeWest6,
168
+ [index_1.FbFunctionName.PartnershipSubscriptionOnUpdate]: GCloudRegions.EuropeWest6,
165
169
  [index_1.FbFunctionName.PartnershipSubscriptionOnWrite]: GCloudRegions.EuropeWest6,
166
170
  [index_1.FbFunctionName.PartnershipSubscriptionRemove]: GCloudRegions.EuropeWest6,
167
171
  [index_1.FbFunctionName.ReminderBiweeklyEventsEmail]: GCloudRegions.EuropeWest6,
@@ -5,7 +5,7 @@ export declare enum CommunicationTemplateType {
5
5
  }
6
6
  export interface CommunicationTemplateData {
7
7
  title: string;
8
- message: any;
8
+ message: Record<string, unknown>[];
9
9
  }
10
10
  export type CommunicationTemplateLangs = Record<LanguagesTypes, CommunicationTemplateData>;
11
11
  export interface CommunicationTemplatesVars {
@@ -28,5 +28,5 @@ export interface CommunicationTemplatesVars {
28
28
  }
29
29
  declare const templates: Record<CommunicationTemplateType, CommunicationTemplateLangs>;
30
30
  export declare const replaceKeysVarsString: <T extends string, D extends Record<string, string>>(text: T, meta: D) => string;
31
- export declare function replaceKeysVarsInNodes<T extends Record<string, any>, D extends Record<string, string>>(nodes: T[], meta: D): T[];
31
+ export declare function replaceKeysVarsInNodes<T extends Record<string, unknown>, D extends Record<string, string>>(nodes: T[], meta: D): T[];
32
32
  export default templates;
@@ -1,5 +1,5 @@
1
1
  import ModelWithLang from '../../Model/lang';
2
- import { PartnershipPartnerData } from './types';
2
+ import { PartnershipPartnerData, PartnerStatus } from './types';
3
3
  export default class PartnershipPartner extends ModelWithLang<PartnershipPartnerData> {
4
4
  get tinyInfo(): {
5
5
  displayName: string;
@@ -11,7 +11,7 @@ export default class PartnershipPartner extends ModelWithLang<PartnershipPartner
11
11
  get photoURL(): string;
12
12
  get displayName(): string;
13
13
  get NIF(): string | null;
14
- get email(): string | null;
14
+ get email(): string;
15
15
  get phone(): string | null;
16
16
  get birthdate(): FirebaseFirestore.Timestamp | null;
17
17
  get sepaMandate(): {
@@ -30,7 +30,12 @@ export default class PartnershipPartner extends ModelWithLang<PartnershipPartner
30
30
  get editedBy(): string | null;
31
31
  get isDeleted(): boolean;
32
32
  get isActive(): boolean;
33
+ get isPending(): boolean;
34
+ get acceptedAt(): FirebaseFirestore.Timestamp | null;
35
+ get acceptedBy(): string | null;
36
+ get status(): PartnerStatus;
33
37
  get userId(): string | null;
34
38
  get groupIds(): string[];
35
39
  get subscriptionIds(): string[];
40
+ get subscriptions(): Record<string, import("../Plan/types").PartnershipPlanBasicData>;
36
41
  }
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const types_1 = require("../../../helpers/types");
7
7
  const utils_1 = require("../../../helpers/utils");
8
8
  const lang_1 = __importDefault(require("../../Model/lang"));
9
+ const types_2 = require("./types");
9
10
  class PartnershipPartner extends lang_1.default {
10
11
  get tinyInfo() {
11
12
  return {
@@ -26,7 +27,7 @@ class PartnershipPartner extends lang_1.default {
26
27
  return this.data.photoURL;
27
28
  }
28
29
  get displayName() {
29
- return this.data.displayName;
30
+ return `${this.name} ${this.lastname}`;
30
31
  }
31
32
  get NIF() {
32
33
  return this.data.NIF;
@@ -72,6 +73,22 @@ class PartnershipPartner extends lang_1.default {
72
73
  get isActive() {
73
74
  return this.exists && !this.isDeleted;
74
75
  }
76
+ get isPending() {
77
+ return !this.isDeleted && this.acceptedAt === null;
78
+ }
79
+ get acceptedAt() {
80
+ return this.data.acceptedAt || null;
81
+ }
82
+ get acceptedBy() {
83
+ return this.data.acceptedBy || null;
84
+ }
85
+ get status() {
86
+ if (this.isDeleted)
87
+ return types_2.PartnerStatus.Inactive;
88
+ if (this.isPending)
89
+ return types_2.PartnerStatus.Pending;
90
+ return types_2.PartnerStatus.Active;
91
+ }
75
92
  get userId() {
76
93
  return this.data.userId || null;
77
94
  }
@@ -81,5 +98,8 @@ class PartnershipPartner extends lang_1.default {
81
98
  get subscriptionIds() {
82
99
  return this.data.subscriptionIds || [];
83
100
  }
101
+ get subscriptions() {
102
+ return this.data.subscriptions || {};
103
+ }
84
104
  }
85
105
  exports.default = PartnershipPartner;
@@ -1,7 +1,13 @@
1
1
  import { Timestamp } from '@google-cloud/firestore';
2
2
  import { BasicAddressData } from '../../../helpers/types';
3
3
  import { DocumentReference } from '../../../types/firestore';
4
- import { UserExtendedData } from '../../User/types';
4
+ import { GroupPlayerCustomFieldValue } from '../../Group/Player/types';
5
+ import { PartnershipPlanBasicData } from '../Plan/types';
6
+ export declare enum PartnerStatus {
7
+ Active = "active",
8
+ Pending = "pending",
9
+ Inactive = "inactive"
10
+ }
5
11
  export interface PartnershipPartnerSepaMandate {
6
12
  mandateId: string;
7
13
  iban: string;
@@ -9,18 +15,27 @@ export interface PartnershipPartnerSepaMandate {
9
15
  holderAddress: BasicAddressData;
10
16
  swiftbic: string | null;
11
17
  }
12
- export interface PartnershipPartnerData extends UserExtendedData {
18
+ export interface PartnershipPartnerData {
19
+ userId: string | null;
20
+ email: string;
21
+ name: string;
22
+ lastname: string;
23
+ photoURL: string;
24
+ birthDate: Timestamp | null;
13
25
  address: BasicAddressData | null;
14
26
  phone: string | null;
15
27
  NIF: string | null;
16
28
  sepaMandate: PartnershipPartnerSepaMandate | null;
17
- userId: string | null;
18
29
  groupIds: string[];
19
30
  subscriptionIds: string[];
31
+ subscriptions: Record<string, PartnershipPlanBasicData>;
32
+ customFields: Record<string, GroupPlayerCustomFieldValue>;
20
33
  createdAt: Timestamp;
21
34
  createdBy: DocumentReference;
22
35
  editedAt: Timestamp | null;
23
36
  editedBy: string | null;
37
+ acceptedAt: Timestamp | null;
38
+ acceptedBy: string | null;
24
39
  deletedAt: Timestamp | null;
25
40
  deletedBy: string | null;
26
41
  }
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PartnerStatus = void 0;
4
+ var PartnerStatus;
5
+ (function (PartnerStatus) {
6
+ PartnerStatus["Active"] = "active";
7
+ PartnerStatus["Pending"] = "pending";
8
+ PartnerStatus["Inactive"] = "inactive";
9
+ })(PartnerStatus = exports.PartnerStatus || (exports.PartnerStatus = {}));
@@ -16,6 +16,7 @@ export default class PartnershipPayment extends ModelWithLang<PartnershipPayment
16
16
  get statusHistoryOrdered(): import("./types").PaymentStatusHistoryItem[];
17
17
  get sepaPaymentGroupId(): string | null;
18
18
  get isLinkedToSepaPaymentGroup(): boolean;
19
+ get dueDate(): FirebaseFirestore.Timestamp;
19
20
  get createdAt(): FirebaseFirestore.Timestamp;
20
21
  get createdBy(): string | null;
21
22
  get editedAt(): FirebaseFirestore.Timestamp | null;
@@ -52,6 +52,9 @@ class PartnershipPayment extends lang_1.default {
52
52
  get isLinkedToSepaPaymentGroup() {
53
53
  return !!this.sepaPaymentGroupId;
54
54
  }
55
+ get dueDate() {
56
+ return this.data.dueDate || this.data.createdAt;
57
+ }
55
58
  get createdAt() {
56
59
  return this.data.createdAt;
57
60
  }
@@ -23,6 +23,7 @@ export interface PartnershipPaymentData {
23
23
  status: PaymentStatus;
24
24
  statusHistory: PaymentStatusHistoryItem[];
25
25
  sepaPaymentGroupId: string | null;
26
+ dueDate: Timestamp;
26
27
  createdAt: Timestamp;
27
28
  createdBy: string | null;
28
29
  editedAt: Timestamp | null;
@@ -24,7 +24,7 @@ class PartnershipPlan extends lang_1.default {
24
24
  : (0, date_fns_1.setDate)(date, this.schedule.paymentDay);
25
25
  }
26
26
  setPaymentMonth(date) {
27
- return (0, isNumber_1.default)(this.schedule.paymentMonth) && this.isAnnuallySchedule
27
+ return (0, isNumber_1.default)(this.schedule.paymentMonth) && this.schedule.periodInMonths > 1
28
28
  ? (0, date_fns_1.setMonth)(date, this.schedule.paymentMonth)
29
29
  : date;
30
30
  }
@@ -36,8 +36,11 @@ class PartnershipPlan extends lang_1.default {
36
36
  return this.setPaymentDate(newDate);
37
37
  }
38
38
  getFirstPaymentDate() {
39
- const newDate = this.setPaymentDate(new Date());
40
- return (0, date_fns_1.isPast)(newDate) ? (0, date_fns_1.addMonths)(newDate, this.isAnnuallySchedule ? 12 : 1) : newDate;
39
+ let newDate = this.setPaymentDate(new Date());
40
+ if ((0, date_fns_1.isPast)(newDate)) {
41
+ newDate = this.getNextPaymentDate(newDate);
42
+ }
43
+ return newDate;
41
44
  }
42
45
  get name() {
43
46
  return this.data.name;
@@ -3,6 +3,7 @@ import { PartnershipSubscriptionData } from './types';
3
3
  export default class PartnershipSubscription extends Model<PartnershipSubscriptionData> {
4
4
  get partnershipId(): string;
5
5
  get planId(): string;
6
+ get planInfo(): import("../Plan/types").PartnershipPlanBasicData;
6
7
  get partnerId(): string;
7
8
  get partnerInfo(): import("../../User/types").UserTinyData;
8
9
  get nextPaymentDate(): FirebaseFirestore.Timestamp | null;
@@ -13,6 +13,9 @@ class PartnershipSubscription extends Model_1.default {
13
13
  get planId() {
14
14
  return this.data.planId;
15
15
  }
16
+ get planInfo() {
17
+ return this.data.planInfo;
18
+ }
16
19
  get partnerId() {
17
20
  return this.data.partnerId;
18
21
  }
@@ -1,6 +1,6 @@
1
1
  import { AdminItemStatus } from '../../helpers/types';
2
2
  import PartnershipBasic from './basic';
3
- import { PartnershipData } from './types';
3
+ import { APartnershipCustomField, PartnershipData } from './types';
4
4
  export default class Partnership extends PartnershipBasic<PartnershipData> {
5
5
  get description(): string | null;
6
6
  get admins(): string[];
@@ -26,4 +26,6 @@ export default class Partnership extends PartnershipBasic<PartnershipData> {
26
26
  get deletedBy(): string | null;
27
27
  get isDeleted(): boolean;
28
28
  get isActive(): boolean;
29
+ get customFields(): Record<string, import("../Group/types").GroupCustomField>;
30
+ get customFieldsList(): APartnershipCustomField[];
29
31
  }
@@ -64,5 +64,16 @@ class Partnership extends basic_1.default {
64
64
  get isActive() {
65
65
  return this.exists && !this.deletedAt;
66
66
  }
67
+ get customFields() {
68
+ return this.data.customFields || {};
69
+ }
70
+ get customFieldsList() {
71
+ return Object.entries(this.customFields)
72
+ .map(([id, field]) => ({
73
+ id,
74
+ ...field,
75
+ }))
76
+ .sort((a, b) => a.order - b.order);
77
+ }
67
78
  }
68
79
  exports.default = Partnership;
@@ -1,5 +1,8 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { AdminItem, BasicAddressData } from '../../helpers/types';
3
+ import { AGroupCustomField, GroupCustomField } from '../Group/types';
4
+ export type PartnershipCustomField = GroupCustomField;
5
+ export type APartnershipCustomField = AGroupCustomField;
3
6
  export declare enum PartnershipRoles {
4
7
  Admin = "admin"
5
8
  }
@@ -31,6 +34,7 @@ export interface PartnershipData extends PartnershipBasicData {
31
34
  administrators: string[];
32
35
  administratorsList: AdminItem[];
33
36
  federationIds: string[];
37
+ customFields: Record<string, PartnershipCustomField>;
34
38
  createdAt: Timestamp;
35
39
  createdBy: DocumentReference;
36
40
  editedAt: Timestamp | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.108.7",
3
+ "version": "1.108.9",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",