@glissandoo/lib 1.93.1 → 1.94.1

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.
Files changed (53) hide show
  1. package/functions/federationPartnership.d.ts +1 -1
  2. package/functions/group.d.ts +7 -0
  3. package/functions/index.d.ts +2 -0
  4. package/functions/index.js +2 -0
  5. package/functions/partner.d.ts +2 -2
  6. package/functions/partnership.d.ts +10 -0
  7. package/functions/partnershipPartner.d.ts +35 -0
  8. package/functions/partnershipPartner.js +2 -0
  9. package/functions/regions.js +2 -0
  10. package/helpers/collections.d.ts +1 -3
  11. package/helpers/collections.js +1 -3
  12. package/helpers/payments.d.ts +1 -1
  13. package/helpers/payments.js +1 -1
  14. package/models/Customer/basic.d.ts +1 -1
  15. package/models/Customer/types.d.ts +1 -1
  16. package/models/Federation/index.d.ts +1 -1
  17. package/models/Federation/types.d.ts +1 -1
  18. package/models/Metrics/index.d.ts +0 -2
  19. package/models/Metrics/index.js +0 -6
  20. package/models/Metrics/types.d.ts +1 -1
  21. package/models/{Partner → Partnership/Partner}/basic.d.ts +2 -6
  22. package/models/{Partner → Partnership/Partner}/basic.js +0 -21
  23. package/models/Partnership/Partner/index.d.ts +11 -5
  24. package/models/Partnership/Partner/index.js +31 -9
  25. package/models/{Partner → Partnership/Partner}/tiny.d.ts +1 -1
  26. package/models/{Partner → Partnership/Partner}/tiny.js +1 -1
  27. package/models/Partnership/Partner/types.d.ts +28 -4
  28. package/models/{Payment → Partnership/Payment}/basic.d.ts +1 -1
  29. package/models/{Payment → Partnership/Payment}/basic.js +1 -1
  30. package/models/Partnership/Payment/index.d.ts +9 -4
  31. package/models/Partnership/Payment/index.js +20 -5
  32. package/models/Partnership/Payment/types.d.ts +31 -5
  33. package/models/Partnership/Payment/types.js +15 -0
  34. package/models/Partnership/{Partner/Subscription → Subscription}/index.d.ts +2 -2
  35. package/models/Partnership/{Partner/Subscription → Subscription}/index.js +3 -3
  36. package/models/Partnership/{Partner/Subscription → Subscription}/types.d.ts +2 -2
  37. package/models/Partnership/basic.d.ts +1 -1
  38. package/models/Partnership/types.d.ts +1 -12
  39. package/models/Partnership/types.js +1 -7
  40. package/models/User/index.d.ts +2 -0
  41. package/models/User/index.js +4 -0
  42. package/models/User/types.d.ts +2 -0
  43. package/models/User/types.js +1 -0
  44. package/package.json +1 -1
  45. package/models/Partner/index.d.ts +0 -16
  46. package/models/Partner/index.js +0 -48
  47. package/models/Partner/types.d.ts +0 -46
  48. package/models/Partner/types.js +0 -9
  49. package/models/Payment/index.d.ts +0 -13
  50. package/models/Payment/index.js +0 -33
  51. package/models/Payment/types.d.ts +0 -32
  52. package/models/Payment/types.js +0 -17
  53. /package/models/Partnership/{Partner/Subscription → Subscription}/types.js +0 -0
@@ -1,4 +1,4 @@
1
- import { BasicAddressData } from '../models/Partner/types';
1
+ import { BasicAddressData } from '../models/Partnership/Partner/types';
2
2
  export declare namespace FederationPartnershipFbFunctionsTypes {
3
3
  interface AddParams {
4
4
  partnershipId: string;
@@ -59,6 +59,13 @@ export declare namespace GroupFbFunctionsTypes {
59
59
  id: string;
60
60
  instruments: GroupData['instruments'];
61
61
  }
62
+ interface GetByInvitationLinkParams {
63
+ invitationLink: string;
64
+ }
65
+ interface GetByInvitationLinkResult extends GroupBasicData {
66
+ id: string;
67
+ instruments: GroupData['instruments'];
68
+ }
62
69
  interface SendInvitationEmailParams {
63
70
  emails: string[];
64
71
  groupId: string;
@@ -67,6 +67,7 @@ export declare enum FbFunctionName {
67
67
  GroupEditInstruments = "group-editInstruments",
68
68
  GroupEditTemplate = "group-editTemplate",
69
69
  GroupGetById = "group-getById",
70
+ GroupGetByInvitationLink = "group-getByInvitationLink",
70
71
  GroupOnboardingMessages = "group-onboardingMessages",
71
72
  GroupOnCreate = "group-onCreate",
72
73
  GroupOnUpdate = "group-onUpdate",
@@ -119,6 +120,7 @@ export declare enum FbFunctionName {
119
120
  PartnershipGroupAdd = "partnershipGroup-add",
120
121
  PartnershipGroupRemove = "partnershipGroup-remove",
121
122
  PartnershipOnUpdate = "partnership-onUpdate",
123
+ PartnershipPublish = "partnership-publish",
122
124
  PartnershipRemove = "partnership-remove",
123
125
  PartnershipRemoveAdmin = "partnership-removeAdmin",
124
126
  ReminderBiweeklyEventsEmail = "reminder-biweeklyEventsEmail",
@@ -71,6 +71,7 @@ var FbFunctionName;
71
71
  FbFunctionName["GroupEditInstruments"] = "group-editInstruments";
72
72
  FbFunctionName["GroupEditTemplate"] = "group-editTemplate";
73
73
  FbFunctionName["GroupGetById"] = "group-getById";
74
+ FbFunctionName["GroupGetByInvitationLink"] = "group-getByInvitationLink";
74
75
  FbFunctionName["GroupOnboardingMessages"] = "group-onboardingMessages";
75
76
  FbFunctionName["GroupOnCreate"] = "group-onCreate";
76
77
  FbFunctionName["GroupOnUpdate"] = "group-onUpdate";
@@ -123,6 +124,7 @@ var FbFunctionName;
123
124
  FbFunctionName["PartnershipGroupAdd"] = "partnershipGroup-add";
124
125
  FbFunctionName["PartnershipGroupRemove"] = "partnershipGroup-remove";
125
126
  FbFunctionName["PartnershipOnUpdate"] = "partnership-onUpdate";
127
+ FbFunctionName["PartnershipPublish"] = "partnership-publish";
126
128
  FbFunctionName["PartnershipRemove"] = "partnership-remove";
127
129
  FbFunctionName["PartnershipRemoveAdmin"] = "partnership-removeAdmin";
128
130
  FbFunctionName["ReminderBiweeklyEventsEmail"] = "reminder-biweeklyEventsEmail";
@@ -1,5 +1,5 @@
1
- import { BasicAddressData, PartnerData } from '../models/Partner/types';
2
- import PartnerSubscription from '../models/Partnership/Partner/Subscription';
1
+ import { BasicAddressData, PartnerData } from '../models/Partnership/Partner/types';
2
+ import PartnerSubscription from '../models/Partnership/Subscription';
3
3
  import { PartnershipData } from '../models/Partnership/types';
4
4
  export declare namespace PartnerFbFunctionsTypes {
5
5
  interface CreateParams {
@@ -1,4 +1,14 @@
1
+ import { BasicAddressData } from '../models/Partnership/Partner/types';
1
2
  export declare namespace PartnershipFbFunctionsTypes {
3
+ interface PublishParams {
4
+ groupId: string;
5
+ displayName: string;
6
+ CIF: string;
7
+ email: string;
8
+ phone: string | null;
9
+ address: BasicAddressData;
10
+ }
11
+ type PublishResult = void;
2
12
  interface CreateParams {
3
13
  partnershipId: string;
4
14
  displayName: string;
@@ -0,0 +1,35 @@
1
+ import { CreatedOn } from '../helpers/types';
2
+ import { BasicAddressData } from '../models/Partnership/Partner/types';
3
+ export declare namespace PartnershipPartnerFbFunctionsTypes {
4
+ interface CreateParams {
5
+ partnershipId: string;
6
+ partnerId: string;
7
+ name: string;
8
+ lastname: string;
9
+ email: string;
10
+ phone: string | null;
11
+ birthdate: number | null;
12
+ address: BasicAddressData | null;
13
+ identificator: string;
14
+ createdOn: CreatedOn;
15
+ }
16
+ type CreateResult = void;
17
+ interface EditParams {
18
+ partnershipId: string;
19
+ }
20
+ type EditResult = void;
21
+ interface RemoveParams {
22
+ partnershipId: string;
23
+ }
24
+ type RemoveResult = void;
25
+ interface AddConfirmedAdminParams {
26
+ partnershipId: string;
27
+ userId: string;
28
+ }
29
+ type AddConfirmedAdminResult = void;
30
+ interface RemoveAdminParams {
31
+ partnershipId: string;
32
+ email: string;
33
+ }
34
+ type RemoveAdminResult = void;
35
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -78,6 +78,7 @@ const regionByFunctions = {
78
78
  [index_1.FbFunctionName.GroupEditInstruments]: GCloudRegions.EuropeWest6,
79
79
  [index_1.FbFunctionName.GroupEditTemplate]: GCloudRegions.EuropeWest6,
80
80
  [index_1.FbFunctionName.GroupGetById]: GCloudRegions.EuropeWest6,
81
+ [index_1.FbFunctionName.GroupGetByInvitationLink]: GCloudRegions.EuropeWest6,
81
82
  [index_1.FbFunctionName.GroupOnboardingMessages]: GCloudRegions.EuropeWest6,
82
83
  [index_1.FbFunctionName.GroupOnCreate]: GCloudRegions.UsCentral1,
83
84
  [index_1.FbFunctionName.GroupOnUpdate]: GCloudRegions.UsCentral1,
@@ -130,6 +131,7 @@ const regionByFunctions = {
130
131
  [index_1.FbFunctionName.PartnershipGroupAdd]: GCloudRegions.EuropeWest6,
131
132
  [index_1.FbFunctionName.PartnershipGroupRemove]: GCloudRegions.EuropeWest6,
132
133
  [index_1.FbFunctionName.PartnershipOnUpdate]: GCloudRegions.EuropeWest6,
134
+ [index_1.FbFunctionName.PartnershipPublish]: GCloudRegions.EuropeWest6,
133
135
  [index_1.FbFunctionName.PartnershipRemove]: GCloudRegions.EuropeWest6,
134
136
  [index_1.FbFunctionName.PartnershipRemoveAdmin]: GCloudRegions.EuropeWest6,
135
137
  [index_1.FbFunctionName.ReminderBiweeklyEventsEmail]: GCloudRegions.EuropeWest6,
@@ -20,14 +20,12 @@ export declare enum CollectionNames {
20
20
  GroupRepertory = "repertory",
21
21
  GroupStageTemplates = "stageTemplates",
22
22
  Metrics = "metrics",
23
- Partner = "partner",
24
23
  Partnership = "partnership",
25
24
  PartnershipPartners = "partners",
26
25
  PartnershipGroups = "groups",
27
- PartnershipPartnerSubscriptions = "subscriptions",
26
+ PartnershipSubscriptions = "subscriptions",
28
27
  PartnershipPayments = "payments",
29
28
  PartnershipPlans = "plans",
30
- Payment = "payment",
31
29
  Federation = "federation",
32
30
  FederationPartnerships = "partnerships",
33
31
  Offer = "offer",
@@ -24,14 +24,12 @@ var CollectionNames;
24
24
  CollectionNames["GroupRepertory"] = "repertory";
25
25
  CollectionNames["GroupStageTemplates"] = "stageTemplates";
26
26
  CollectionNames["Metrics"] = "metrics";
27
- CollectionNames["Partner"] = "partner";
28
27
  CollectionNames["Partnership"] = "partnership";
29
28
  CollectionNames["PartnershipPartners"] = "partners";
30
29
  CollectionNames["PartnershipGroups"] = "groups";
31
- CollectionNames["PartnershipPartnerSubscriptions"] = "subscriptions";
30
+ CollectionNames["PartnershipSubscriptions"] = "subscriptions";
32
31
  CollectionNames["PartnershipPayments"] = "payments";
33
32
  CollectionNames["PartnershipPlans"] = "plans";
34
- CollectionNames["Payment"] = "payment";
35
33
  CollectionNames["Federation"] = "federation";
36
34
  CollectionNames["FederationPartnerships"] = "partnerships";
37
35
  CollectionNames["Offer"] = "offer";
@@ -1,2 +1,2 @@
1
- import { PaymentStatus } from '../models/Payment/types';
1
+ import { PaymentStatus } from '../models/Partnership/Payment/types';
2
2
  export declare const paymentStatusErrors: PaymentStatus[];
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.paymentStatusErrors = void 0;
4
- const types_1 = require("../models/Payment/types");
4
+ const types_1 = require("../models/Partnership/Payment/types");
5
5
  exports.paymentStatusErrors = [
6
6
  types_1.PaymentStatus.Error,
7
7
  types_1.PaymentStatus.Chargeback,
@@ -5,7 +5,7 @@ export default class CustomerBasic<D> extends Model<D & CustomerBasicData> {
5
5
  get basicInfo(): CustomerBasicData;
6
6
  get displayName(): string;
7
7
  get email(): string;
8
- get address(): import("../Partner/types").BasicAddressData;
8
+ get address(): import("../Partnership/Partner/types").BasicAddressData;
9
9
  get displayAddress(): string;
10
10
  get phone(): string | null;
11
11
  get groupIds(): string[];
@@ -1,6 +1,6 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { AdminItem } from '../../helpers/types';
3
- import { BasicAddressData } from '../Partner/types';
3
+ import { BasicAddressData } from '../Partnership/Partner/types';
4
4
  export declare enum CustomerRoles {
5
5
  Admin = "admin"
6
6
  }
@@ -13,7 +13,7 @@ export default class Federation extends Model<FederationData> {
13
13
  get photoURL(): string;
14
14
  get phone(): string | null;
15
15
  get web(): string | null;
16
- get address(): import("../Partner/types").BasicAddressData | null;
16
+ get address(): import("../Partnership/Partner/types").BasicAddressData | null;
17
17
  get displayAddress(): string;
18
18
  get partnershipConnectedIds(): string[];
19
19
  get createdAt(): FirebaseFirestore.Timestamp;
@@ -1,6 +1,6 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { AdminItem } from '../../helpers/types';
3
- import { BasicAddressData } from '../Partner/types';
3
+ import { BasicAddressData } from '../Partnership/Partner/types';
4
4
  export interface FederationData {
5
5
  displayName: string;
6
6
  photoURL: string;
@@ -9,8 +9,6 @@ export default class Metrics extends Model<MetricsData> {
9
9
  get events(): EntityTypes;
10
10
  get communications(): EntityTypes;
11
11
  get repertory(): EntityTypes;
12
- get partnerships(): EntityTypes;
13
- get partners(): EntityTypes;
14
12
  get date(): FirebaseFirestore.Timestamp;
15
13
  get createdAt(): FirebaseFirestore.Timestamp;
16
14
  }
@@ -31,12 +31,6 @@ class Metrics extends Model_1.default {
31
31
  get repertory() {
32
32
  return this.data.repertory || this.defaultEntity;
33
33
  }
34
- get partnerships() {
35
- return this.data.partnership || this.defaultEntity;
36
- }
37
- get partners() {
38
- return this.data.partner || this.defaultEntity;
39
- }
40
34
  get date() {
41
35
  return this.data.date;
42
36
  }
@@ -1,6 +1,6 @@
1
1
  import { Timestamp } from '@google-cloud/firestore';
2
2
  import { CollectionNames } from '../../helpers/collections';
3
- export type AllowCollections = CollectionNames.User | CollectionNames.Group | CollectionNames.Event | CollectionNames.Communication | CollectionNames.GroupRepertory | CollectionNames.Partner | CollectionNames.Partnership | CollectionNames.Customer;
3
+ export type AllowCollections = CollectionNames.User | CollectionNames.Group | CollectionNames.Event | CollectionNames.Communication | CollectionNames.GroupRepertory | CollectionNames.Customer;
4
4
  export interface EntityTypes {
5
5
  total: number;
6
6
  acc: number;
@@ -1,17 +1,13 @@
1
- import { DocumentModel } from '../Model';
1
+ import { DocumentModel } from '../../Model';
2
2
  import PartnerTiny from './tiny';
3
- import { PartnerBasicData, PartnerStatus } from './types';
3
+ import { PartnerBasicData } from './types';
4
4
  export default class PartnerBasic<D> extends PartnerTiny<D & PartnerBasicData> {
5
5
  constructor(doc: DocumentModel);
6
6
  get basicInfo(): PartnerBasicData;
7
- get status(): PartnerStatus;
8
7
  get createdAt(): FirebaseFirestore.Timestamp;
9
8
  get createdBy(): string;
10
9
  get deletedAt(): FirebaseFirestore.Timestamp | null;
11
10
  get deletedBy(): string | null;
12
11
  get isDeleted(): boolean;
13
- get verifiedAt(): FirebaseFirestore.Timestamp | null;
14
- get verifiedBy(): string | null;
15
- get isVerified(): boolean;
16
12
  get isActive(): boolean;
17
13
  }
@@ -4,7 +4,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const tiny_1 = __importDefault(require("./tiny"));
7
- const types_1 = require("./types");
8
7
  class PartnerBasic extends tiny_1.default {
9
8
  constructor(doc) {
10
9
  super(doc);
@@ -12,23 +11,12 @@ class PartnerBasic extends tiny_1.default {
12
11
  get basicInfo() {
13
12
  return {
14
13
  ...this.tinyInfo,
15
- verifiedAt: this.verifiedAt,
16
- verifiedBy: this.verifiedBy,
17
14
  deletedAt: this.deletedAt,
18
15
  deletedBy: this.deletedBy,
19
16
  createdAt: this.createdAt,
20
17
  createdBy: this.createdBy,
21
18
  };
22
19
  }
23
- get status() {
24
- if (this.isDeleted) {
25
- return types_1.PartnerStatus.Deleted;
26
- }
27
- if (this.isVerified) {
28
- return types_1.PartnerStatus.Verified;
29
- }
30
- return types_1.PartnerStatus.PendingVerification;
31
- }
32
20
  get createdAt() {
33
21
  return this.data.createdAt;
34
22
  }
@@ -44,15 +32,6 @@ class PartnerBasic extends tiny_1.default {
44
32
  get isDeleted() {
45
33
  return this.deletedAt !== null;
46
34
  }
47
- get verifiedAt() {
48
- return this.data.verifiedAt || null;
49
- }
50
- get verifiedBy() {
51
- return this.data.verifiedBy || null;
52
- }
53
- get isVerified() {
54
- return this.verifiedAt !== null;
55
- }
56
35
  get isActive() {
57
36
  return this.exists && !this.isDeleted;
58
37
  }
@@ -1,9 +1,15 @@
1
1
  import { DocumentModel } from '../../Model';
2
- import PartnerBasic from '../../Partner/basic';
3
- import { PartnershipPartnerData } from './types';
4
- export default class PartnershipPartner extends PartnerBasic<PartnershipPartnerData> {
2
+ import PartnerBasic from './basic';
3
+ import { PartnerData } from './types';
4
+ export default class Partner extends PartnerBasic<PartnerData> {
5
5
  constructor(doc: DocumentModel);
6
+ get identificator(): string;
7
+ get name(): string;
8
+ get lastname(): string;
9
+ get email(): string;
10
+ get phone(): string | null;
11
+ get birthdate(): FirebaseFirestore.Timestamp | null;
6
12
  get partnershipId(): string;
7
- get subscriptionIds(): string[];
8
- get subscriptionActivesIds(): string[];
13
+ get address(): import("./types").BasicAddressData | null;
14
+ get displayAddress(): string | null;
9
15
  }
@@ -3,20 +3,42 @@ 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 utils_1 = require("../../../helpers/utils");
7
- const basic_1 = __importDefault(require("../../Partner/basic"));
8
- class PartnershipPartner extends basic_1.default {
6
+ const isString_1 = __importDefault(require("lodash/isString"));
7
+ const basic_1 = __importDefault(require("./basic"));
8
+ class Partner extends basic_1.default {
9
9
  constructor(doc) {
10
10
  super(doc);
11
11
  }
12
+ get identificator() {
13
+ return this.data.identificator;
14
+ }
15
+ get name() {
16
+ return this.data.name;
17
+ }
18
+ get lastname() {
19
+ return this.data.lastname;
20
+ }
21
+ get email() {
22
+ return this.data.email;
23
+ }
24
+ get phone() {
25
+ return this.data.phone;
26
+ }
27
+ get birthdate() {
28
+ return this.data.birthdate;
29
+ }
12
30
  get partnershipId() {
13
- return (0, utils_1.at)(this.ref.path.split('/'), 1) || '';
31
+ return this.data.partnershipId;
14
32
  }
15
- get subscriptionIds() {
16
- return this.data.subscriptionIds || [];
33
+ get address() {
34
+ return this.data.address;
17
35
  }
18
- get subscriptionActivesIds() {
19
- return this.data.subscriptionActivesIds || [];
36
+ get displayAddress() {
37
+ if (!this.address)
38
+ return null;
39
+ const { street, city, postalCode, province, country } = this.address;
40
+ const fields = [street, postalCode, city, province, country];
41
+ return fields.filter((field) => (0, isString_1.default)(field)).join(', ');
20
42
  }
21
43
  }
22
- exports.default = PartnershipPartner;
44
+ exports.default = Partner;
@@ -1,4 +1,4 @@
1
- import Model, { DocumentModel } from '../Model';
1
+ import Model, { DocumentModel } from '../../Model';
2
2
  import { PartnerTinyData } from './types';
3
3
  export default class PartnerTiny<D> extends Model<D & PartnerTinyData> {
4
4
  constructor(doc: DocumentModel);
@@ -3,7 +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 Model_1 = __importDefault(require("../Model"));
6
+ const Model_1 = __importDefault(require("../../Model"));
7
7
  class PartnerTiny extends Model_1.default {
8
8
  constructor(doc) {
9
9
  super(doc);
@@ -1,5 +1,29 @@
1
- import { PartnerBasicData } from '../../Partner/types';
2
- export interface PartnershipPartnerData extends PartnerBasicData {
3
- subscriptionIds: string[];
4
- subscriptionActivesIds: string[];
1
+ import { Timestamp } from '@google-cloud/firestore';
2
+ export interface BasicAddressData {
3
+ street?: string;
4
+ city?: string;
5
+ postalCode?: string;
6
+ province?: string;
7
+ country?: string;
8
+ }
9
+ export interface PartnerTinyData {
10
+ photoURL: string | null;
11
+ displayName: string;
12
+ }
13
+ export interface PartnerBasicData extends PartnerTinyData {
14
+ readonly createdAt: Timestamp;
15
+ readonly createdBy: string;
16
+ deletedAt: Timestamp | null;
17
+ deletedBy: string | null;
18
+ }
19
+ export interface PartnerData extends PartnerBasicData {
20
+ identificator: string;
21
+ name: string;
22
+ lastname: string;
23
+ email: string;
24
+ address: BasicAddressData | null;
25
+ phone: string | null;
26
+ birthdate: Timestamp | null;
27
+ groupIds: string[];
28
+ readonly partnershipId: string;
5
29
  }
@@ -1,4 +1,4 @@
1
- import Model, { DocumentModel } from '../Model';
1
+ import Model, { DocumentModel } from '../../Model';
2
2
  import { PaymentBasicData, PaymentType } from './types';
3
3
  export default class PaymentBasic<D> extends Model<D & PaymentBasicData> {
4
4
  constructor(doc: DocumentModel);
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const date_fns_1 = require("date-fns");
7
- const Model_1 = __importDefault(require("../Model"));
7
+ const Model_1 = __importDefault(require("../../Model"));
8
8
  const types_1 = require("./types");
9
9
  class PaymentBasic extends Model_1.default {
10
10
  constructor(doc) {
@@ -1,8 +1,13 @@
1
1
  import { DocumentModel } from '../../Model';
2
- import PaymentBasic from '../../Payment/basic';
3
- import { PartnershipPaymentsData } from './types';
4
- export default class PartnershipPayments extends PaymentBasic<PartnershipPaymentsData> {
2
+ import PaymentBasic from './basic';
3
+ import { PaymentData } from './types';
4
+ export default class Payment extends PaymentBasic<PaymentData> {
5
5
  constructor(doc: DocumentModel);
6
+ get partnershipId(): string;
6
7
  get partnerId(): string;
7
- get partnerInfo(): import("../../Partner/types").PartnerTinyData;
8
+ get subscriptionId(): string | null;
9
+ get onetimeId(): string | null;
10
+ get transactionId(): string;
11
+ get history(): import("./types").PaymentHistory[];
12
+ get historyOrdered(): import("./types").PaymentHistory[];
8
13
  }
@@ -3,16 +3,31 @@ 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 basic_1 = __importDefault(require("../../Payment/basic"));
7
- class PartnershipPayments extends basic_1.default {
6
+ const basic_1 = __importDefault(require("./basic"));
7
+ class Payment extends basic_1.default {
8
8
  constructor(doc) {
9
9
  super(doc);
10
10
  }
11
+ get partnershipId() {
12
+ return this.data.partnershipId;
13
+ }
11
14
  get partnerId() {
12
15
  return this.data.partnerId;
13
16
  }
14
- get partnerInfo() {
15
- return this.data.partnerInfo;
17
+ get subscriptionId() {
18
+ return this.data.subscriptionId;
19
+ }
20
+ get onetimeId() {
21
+ return this.data.onetimeId;
22
+ }
23
+ get transactionId() {
24
+ return this.data.transactionId;
25
+ }
26
+ get history() {
27
+ return this.data.history || [];
28
+ }
29
+ get historyOrdered() {
30
+ return this.history.sort((a, b) => (a.timestamp < b.timestamp ? 1 : -1));
16
31
  }
17
32
  }
18
- exports.default = PartnershipPayments;
33
+ exports.default = Payment;
@@ -1,6 +1,32 @@
1
- import { PartnerTinyData } from '../../Partner/types';
2
- import { PaymentBasicData } from '../../Payment/types';
3
- export interface PartnershipPaymentsData extends PaymentBasicData {
4
- partnerId: string;
5
- partnerInfo: PartnerTinyData;
1
+ import { Timestamp } from '@google-cloud/firestore';
2
+ export declare enum PaymentType {
3
+ Recurring = "recurring",
4
+ OneTime = "one-time"
5
+ }
6
+ export declare enum PaymentStatus {
7
+ Pending = 0,
8
+ Waiting = 1,
9
+ Success = 2,
10
+ Error = 3,
11
+ Chargeback = 4,
12
+ Canceled = 5
13
+ }
14
+ export interface PaymentHistory {
15
+ readonly status: PaymentStatus;
16
+ readonly timestamp: number;
17
+ }
18
+ export interface PaymentBasicData {
19
+ readonly title: string;
20
+ readonly amount: number;
21
+ lastAction: PaymentHistory;
22
+ readonly createdAt: Timestamp;
23
+ readonly type: PaymentType;
24
+ }
25
+ export interface PaymentData extends PaymentBasicData {
26
+ readonly partnershipId: string;
27
+ readonly partnerId: string;
28
+ readonly subscriptionId: string | null;
29
+ readonly onetimeId: string | null;
30
+ readonly transactionId: string;
31
+ history: PaymentHistory[];
6
32
  }
@@ -1,2 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PaymentStatus = exports.PaymentType = void 0;
4
+ var PaymentType;
5
+ (function (PaymentType) {
6
+ PaymentType["Recurring"] = "recurring";
7
+ PaymentType["OneTime"] = "one-time";
8
+ })(PaymentType = exports.PaymentType || (exports.PaymentType = {}));
9
+ var PaymentStatus;
10
+ (function (PaymentStatus) {
11
+ PaymentStatus[PaymentStatus["Pending"] = 0] = "Pending";
12
+ PaymentStatus[PaymentStatus["Waiting"] = 1] = "Waiting";
13
+ PaymentStatus[PaymentStatus["Success"] = 2] = "Success";
14
+ PaymentStatus[PaymentStatus["Error"] = 3] = "Error";
15
+ PaymentStatus[PaymentStatus["Chargeback"] = 4] = "Chargeback";
16
+ PaymentStatus[PaymentStatus["Canceled"] = 5] = "Canceled";
17
+ })(PaymentStatus = exports.PaymentStatus || (exports.PaymentStatus = {}));
@@ -1,5 +1,5 @@
1
- import { DocumentModel } from '../../../Model';
2
- import PartnershipPlanBasic from '../../Plan/basic';
1
+ import { DocumentModel } from '../../Model';
2
+ import PartnershipPlanBasic from '../Plan/basic';
3
3
  import { SubscriptionData, SubscriptionStatus } from './types';
4
4
  export default class PartnerSubscription extends PartnershipPlanBasic<SubscriptionData> {
5
5
  constructor(doc: DocumentModel);
@@ -3,9 +3,9 @@ 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 payments_1 = require("../../../../helpers/payments");
7
- const utils_1 = require("../../../../helpers/utils");
8
- const basic_1 = __importDefault(require("../../Plan/basic"));
6
+ const payments_1 = require("../../../helpers/payments");
7
+ const utils_1 = require("../../../helpers/utils");
8
+ const basic_1 = __importDefault(require("../Plan/basic"));
9
9
  const types_1 = require("./types");
10
10
  class PartnerSubscription extends basic_1.default {
11
11
  constructor(doc) {
@@ -1,6 +1,6 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
- import { PaymentStatus } from '../../../Payment/types';
3
- import { PartnershipPlanBasicData } from '../../Plan/types';
2
+ import { PaymentStatus } from '../Payment/types';
3
+ import { PartnershipPlanBasicData } from '../Plan/types';
4
4
  export declare enum SubscriptionStatus {
5
5
  Active = "active",
6
6
  Pause = "pause",
@@ -6,7 +6,7 @@ export default class PartnershipBasic<D> extends Model<D & PartnershipBasicData>
6
6
  get displayName(): string;
7
7
  get photoURL(): string;
8
8
  get email(): string;
9
- get address(): import("../Partner/types").BasicAddressData;
9
+ get address(): import("./Partner/types").BasicAddressData;
10
10
  get displayAddress(): string;
11
11
  get phone(): string | null;
12
12
  get groupIds(): string[];
@@ -1,20 +1,9 @@
1
1
  import { DocumentReference, Timestamp } from '@google-cloud/firestore';
2
2
  import { AdminItem } from '../../helpers/types';
3
- import { BasicAddressData } from '../Partner/types';
3
+ import { BasicAddressData } from './Partner/types';
4
4
  export declare enum PartnershipRoles {
5
5
  Admin = "admin"
6
6
  }
7
- export declare enum PartnershipStatus {
8
- Verified = "verified",
9
- PendingVerification = "pendingVerification",
10
- Deleted = "deleted"
11
- }
12
- export interface LegalContactData {
13
- name: string;
14
- lastname: string;
15
- birthdate: number;
16
- email: string;
17
- }
18
7
  export interface PartnershipAlgoliaData extends Pick<PartnershipData, 'displayName' | 'photoURL' | 'partnerCount'> {
19
8
  createdAt: number;
20
9
  }
@@ -1,13 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PartnershipStatus = exports.PartnershipRoles = void 0;
3
+ exports.PartnershipRoles = void 0;
4
4
  var PartnershipRoles;
5
5
  (function (PartnershipRoles) {
6
6
  PartnershipRoles["Admin"] = "admin";
7
7
  })(PartnershipRoles = exports.PartnershipRoles || (exports.PartnershipRoles = {}));
8
- var PartnershipStatus;
9
- (function (PartnershipStatus) {
10
- PartnershipStatus["Verified"] = "verified";
11
- PartnershipStatus["PendingVerification"] = "pendingVerification";
12
- PartnershipStatus["Deleted"] = "deleted";
13
- })(PartnershipStatus = exports.PartnershipStatus || (exports.PartnershipStatus = {}));
@@ -39,12 +39,14 @@ export default class User extends UserBasic<UserData> {
39
39
  };
40
40
  get dashboardConfig(): {
41
41
  default_group_id: string | null;
42
+ default_partnership_id: string | null;
42
43
  repertoire_order_by: RepertoireFilterBy;
43
44
  repertoire_order_direction: RepertoireFilterDirection;
44
45
  events_type: import("../Evento/types").EventType | null;
45
46
  };
46
47
  getDashboardConfig<T extends UserDashboardConfig>(value: T): {
47
48
  default_group_id: string | null;
49
+ default_partnership_id: string | null;
48
50
  repertoire_order_by: RepertoireFilterBy;
49
51
  repertoire_order_direction: RepertoireFilterDirection;
50
52
  events_type: import("../Evento/types").EventType | null;
@@ -117,6 +117,7 @@ class User extends basic_1.default {
117
117
  get dashboardConfig() {
118
118
  const { dashboardConfig = {
119
119
  [types_2.UserDashboardConfig.DefaultGroupId]: null,
120
+ [types_2.UserDashboardConfig.DefaultPartnershipId]: null,
120
121
  [types_2.UserDashboardConfig.RepertoireOrderBy]: types_1.RepertoireFilterBy.CreatedAt,
121
122
  [types_2.UserDashboardConfig.RepertoireOrderDirection]: types_1.RepertoireFilterDirection.Desc,
122
123
  [types_2.UserDashboardConfig.EventsType]: null,
@@ -125,6 +126,9 @@ class User extends basic_1.default {
125
126
  [types_2.UserDashboardConfig.DefaultGroupId]: types_2.UserDashboardConfig.DefaultGroupId in dashboardConfig
126
127
  ? dashboardConfig[types_2.UserDashboardConfig.DefaultGroupId]
127
128
  : null,
129
+ [types_2.UserDashboardConfig.DefaultPartnershipId]: types_2.UserDashboardConfig.DefaultPartnershipId in dashboardConfig
130
+ ? dashboardConfig[types_2.UserDashboardConfig.DefaultPartnershipId]
131
+ : null,
128
132
  [types_2.UserDashboardConfig.RepertoireOrderBy]: types_2.UserDashboardConfig.RepertoireOrderBy in dashboardConfig
129
133
  ? dashboardConfig[types_2.UserDashboardConfig.RepertoireOrderBy]
130
134
  : types_1.RepertoireFilterBy.CreatedAt,
@@ -16,6 +16,7 @@ export declare enum UserAppConfig {
16
16
  }
17
17
  export declare enum UserDashboardConfig {
18
18
  DefaultGroupId = "default_group_id",
19
+ DefaultPartnershipId = "default_partnership_id",
19
20
  RepertoireOrderBy = "repertoire_order_by",
20
21
  RepertoireOrderDirection = "repertoire_order_direction",
21
22
  EventsType = "events_type"
@@ -81,6 +82,7 @@ export interface UserData extends UserBasicData {
81
82
  emailSettings: Record<UserEmailSettings, boolean>;
82
83
  dashboardConfig: {
83
84
  [UserDashboardConfig.DefaultGroupId]: string | null;
85
+ [UserDashboardConfig.DefaultPartnershipId]: string | null;
84
86
  [UserDashboardConfig.RepertoireOrderBy]: RepertoireFilterBy;
85
87
  [UserDashboardConfig.RepertoireOrderDirection]: RepertoireFilterDirection;
86
88
  [UserDashboardConfig.EventsType]: EventType | null;
@@ -19,6 +19,7 @@ var UserAppConfig;
19
19
  var UserDashboardConfig;
20
20
  (function (UserDashboardConfig) {
21
21
  UserDashboardConfig["DefaultGroupId"] = "default_group_id";
22
+ UserDashboardConfig["DefaultPartnershipId"] = "default_partnership_id";
22
23
  UserDashboardConfig["RepertoireOrderBy"] = "repertoire_order_by";
23
24
  UserDashboardConfig["RepertoireOrderDirection"] = "repertoire_order_direction";
24
25
  UserDashboardConfig["EventsType"] = "events_type";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@glissandoo/lib",
3
- "version": "1.93.1",
3
+ "version": "1.94.1",
4
4
  "description": "Glissandoo library js",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",
@@ -1,16 +0,0 @@
1
- import { DocumentModel } from '../Model';
2
- import PartnerBasic from './basic';
3
- import { PartnerData } from './types';
4
- export default class Partner extends PartnerBasic<PartnerData> {
5
- constructor(doc: DocumentModel);
6
- get name(): string;
7
- get lastname(): string;
8
- get email(): string;
9
- get phone(): string | null;
10
- get birthdate(): FirebaseFirestore.Timestamp | null;
11
- get partnershipId(): string;
12
- get mandateId(): number | null;
13
- get address(): import("./types").BasicAddressData | null;
14
- get displayIBAN(): string | null;
15
- get displayAddress(): string | null;
16
- }
@@ -1,48 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const isString_1 = __importDefault(require("lodash/isString"));
7
- const basic_1 = __importDefault(require("./basic"));
8
- class Partner extends basic_1.default {
9
- constructor(doc) {
10
- super(doc);
11
- }
12
- get name() {
13
- return this.data.name;
14
- }
15
- get lastname() {
16
- return this.data.lastname;
17
- }
18
- get email() {
19
- return this.data.email;
20
- }
21
- get phone() {
22
- return this.data.phone;
23
- }
24
- get birthdate() {
25
- return this.data.birthdate;
26
- }
27
- get partnershipId() {
28
- return this.data.partnershipId;
29
- }
30
- get mandateId() {
31
- return this.data.mandateId;
32
- }
33
- get address() {
34
- return this.data.address;
35
- }
36
- get displayIBAN() {
37
- const { iban } = this.data;
38
- return iban ? `${iban.first} **** **** **** **** ${iban.last}` : null;
39
- }
40
- get displayAddress() {
41
- if (!this.address)
42
- return null;
43
- const { street, city, postalCode, province, country } = this.address;
44
- const fields = [street, postalCode, city, province, country];
45
- return fields.filter((field) => (0, isString_1.default)(field)).join(', ');
46
- }
47
- }
48
- exports.default = Partner;
@@ -1,46 +0,0 @@
1
- import { Timestamp } from '@google-cloud/firestore';
2
- export declare enum PartnerStatus {
3
- Verified = "verified",
4
- PendingVerification = "pendingVerification",
5
- Deleted = "deleted"
6
- }
7
- export interface BasicAddressData {
8
- street?: string;
9
- city?: string;
10
- postalCode?: string;
11
- province?: string;
12
- country?: string;
13
- }
14
- export interface PartnerPartialIban {
15
- first: string;
16
- last: string;
17
- }
18
- export interface PartnerAlgoliaData extends Pick<PartnerData, 'photoURL' | 'partnershipId'> {
19
- status: PartnerStatus;
20
- displayName: string;
21
- createdAt: number;
22
- }
23
- export interface PartnerTinyData {
24
- photoURL: string | null;
25
- displayName: string;
26
- }
27
- export interface PartnerBasicData extends PartnerTinyData {
28
- verifiedAt: Timestamp | null;
29
- verifiedBy: string | null;
30
- createdAt: Timestamp;
31
- createdBy: string;
32
- deletedAt: Timestamp | null;
33
- deletedBy: string | null;
34
- }
35
- export interface PartnerData extends PartnerBasicData {
36
- name: string;
37
- lastname: string;
38
- email: string;
39
- iban: PartnerPartialIban | null;
40
- address: BasicAddressData | null;
41
- phone: string | null;
42
- birthdate: Timestamp | null;
43
- partnershipId: string;
44
- mandateId: number | null;
45
- token: string | null;
46
- }
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PartnerStatus = void 0;
4
- var PartnerStatus;
5
- (function (PartnerStatus) {
6
- PartnerStatus["Verified"] = "verified";
7
- PartnerStatus["PendingVerification"] = "pendingVerification";
8
- PartnerStatus["Deleted"] = "deleted";
9
- })(PartnerStatus = exports.PartnerStatus || (exports.PartnerStatus = {}));
@@ -1,13 +0,0 @@
1
- import { DocumentModel } from '../Model';
2
- import PaymentBasic from './basic';
3
- import { PaymentData } from './types';
4
- export default class Payment extends PaymentBasic<PaymentData> {
5
- constructor(doc: DocumentModel);
6
- get partnershipId(): string;
7
- get partnerId(): string;
8
- get subscriptionId(): string | null;
9
- get onetimeId(): string | null;
10
- get transactionId(): string;
11
- get history(): import("./types").PaymentHistory[];
12
- get historyOrdered(): import("./types").PaymentHistory[];
13
- }
@@ -1,33 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- const basic_1 = __importDefault(require("./basic"));
7
- class Payment extends basic_1.default {
8
- constructor(doc) {
9
- super(doc);
10
- }
11
- get partnershipId() {
12
- return this.data.partnershipId;
13
- }
14
- get partnerId() {
15
- return this.data.partnerId;
16
- }
17
- get subscriptionId() {
18
- return this.data.subscriptionId;
19
- }
20
- get onetimeId() {
21
- return this.data.onetimeId;
22
- }
23
- get transactionId() {
24
- return this.data.transactionId;
25
- }
26
- get history() {
27
- return this.data.history || [];
28
- }
29
- get historyOrdered() {
30
- return this.history.sort((a, b) => (a.timestamp < b.timestamp ? 1 : -1));
31
- }
32
- }
33
- exports.default = Payment;
@@ -1,32 +0,0 @@
1
- import { Timestamp } from '@google-cloud/firestore';
2
- export declare enum PaymentType {
3
- Recurring = "recurring",
4
- OneTime = "one-time"
5
- }
6
- export declare enum PaymentStatus {
7
- Pending = 0,
8
- Waiting = 1,
9
- Success = 2,
10
- Error = 3,
11
- Chargeback = 4,
12
- Canceled = 5
13
- }
14
- export interface PaymentHistory {
15
- readonly status: PaymentStatus;
16
- readonly timestamp: number;
17
- }
18
- export interface PaymentBasicData {
19
- readonly title: string;
20
- readonly amount: number;
21
- lastAction: PaymentHistory;
22
- readonly createdAt: Timestamp;
23
- readonly type: PaymentType;
24
- }
25
- export interface PaymentData extends PaymentBasicData {
26
- readonly partnershipId: string;
27
- readonly partnerId: string;
28
- readonly subscriptionId: string | null;
29
- readonly onetimeId: string | null;
30
- readonly transactionId: string;
31
- history: PaymentHistory[];
32
- }
@@ -1,17 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PaymentStatus = exports.PaymentType = void 0;
4
- var PaymentType;
5
- (function (PaymentType) {
6
- PaymentType["Recurring"] = "recurring";
7
- PaymentType["OneTime"] = "one-time";
8
- })(PaymentType = exports.PaymentType || (exports.PaymentType = {}));
9
- var PaymentStatus;
10
- (function (PaymentStatus) {
11
- PaymentStatus[PaymentStatus["Pending"] = 0] = "Pending";
12
- PaymentStatus[PaymentStatus["Waiting"] = 1] = "Waiting";
13
- PaymentStatus[PaymentStatus["Success"] = 2] = "Success";
14
- PaymentStatus[PaymentStatus["Error"] = 3] = "Error";
15
- PaymentStatus[PaymentStatus["Chargeback"] = 4] = "Chargeback";
16
- PaymentStatus[PaymentStatus["Canceled"] = 5] = "Canceled";
17
- })(PaymentStatus = exports.PaymentStatus || (exports.PaymentStatus = {}));