@authenty/authapi-types 1.0.29 → 1.0.32

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/dist/index.d.ts CHANGED
@@ -671,10 +671,102 @@ export declare namespace AuthApi {
671
671
  }>;
672
672
  }
673
673
  }
674
+ namespace support {
675
+ namespace newReport {
676
+ type POST = {
677
+ msg?: string;
678
+ };
679
+ }
680
+ }
674
681
  namespace report {
675
- type POST = {
676
- msg?: string;
677
- };
682
+ namespace users {
683
+ type GET = {
684
+ totalUsers: number;
685
+ usersByCountry: Array<{
686
+ countryId: number | null;
687
+ countryName: string;
688
+ count: number;
689
+ }>;
690
+ usersByState: Array<{
691
+ stateId: number | null;
692
+ stateName: string;
693
+ stateUf: string | null;
694
+ count: number;
695
+ }>;
696
+ usersWithActiveSubscription: number;
697
+ };
698
+ namespace timeline {
699
+ type GET = {
700
+ timeline: Array<{
701
+ month: string;
702
+ users: number;
703
+ purchases: number;
704
+ }>;
705
+ summary: {
706
+ totalUsers: number;
707
+ totalPurchases: number;
708
+ iniDate: string;
709
+ endDate: string;
710
+ };
711
+ };
712
+ }
713
+ namespace cumulativeTimeline {
714
+ type GET = {
715
+ timeline2: Array<{
716
+ month: string;
717
+ activeUsers: number;
718
+ paidSubscriptions: number;
719
+ }>;
720
+ summary: {
721
+ iniDate: string;
722
+ endDate: string;
723
+ };
724
+ };
725
+ }
726
+ namespace usage {
727
+ namespace monthly {
728
+ type GET = {
729
+ users: Array<{
730
+ userId: number;
731
+ userName: string;
732
+ userEmail: string;
733
+ monthlyUsage: Array<{
734
+ month: string;
735
+ totalMinutes: number;
736
+ totalHours: number;
737
+ byProduct: Array<{
738
+ productId: number;
739
+ productTitle: string;
740
+ minutes: number;
741
+ }>;
742
+ }>;
743
+ }>;
744
+ summary: {
745
+ totalUsers: number;
746
+ totalSessions: number;
747
+ totalMinutes: number;
748
+ iniDate: string;
749
+ endDate: string;
750
+ };
751
+ };
752
+ }
753
+ }
754
+ }
755
+ namespace live {
756
+ namespace activeUsersBySoftware {
757
+ type GET = Array<{
758
+ productId: number;
759
+ productTitle: string;
760
+ productLogo: string;
761
+ activeUserCount: number;
762
+ activeUsers: Array<{
763
+ id: number;
764
+ fullname: string;
765
+ email: string;
766
+ }>;
767
+ }>;
768
+ }
769
+ }
678
770
  }
679
771
  namespace admin {
680
772
  namespace purchases {
@@ -814,9 +906,19 @@ export declare namespace AuthApi {
814
906
  status: () => Promise<responses.ApiResponse<auxiliarTypes.CronjobsStatuses>>;
815
907
  run: (name: string) => Promise<responses.ApiResponse<responses.cronJobs.run.POST>>;
816
908
  };
909
+ reports: {
910
+ users: () => Promise<responses.ApiResponse<responses.report.users.GET>>;
911
+ usersMonthlyUsage: (iniDate?: string, endDate?: string, userId?: number) => Promise<responses.ApiResponse<responses.report.users.usage.monthly.GET>>;
912
+ usersTimeline: (iniDate?: string, endDate?: string) => Promise<responses.ApiResponse<responses.report.users.timeline.GET>>;
913
+ usersCumulativeTimeline: (iniDate?: string, endDate?: string) => Promise<responses.ApiResponse<responses.report.users.cumulativeTimeline.GET>>;
914
+ getLiveUsersCountByProduct: () => Promise<responses.ApiResponse<responses.report.live.activeUsersBySoftware.GET>>;
915
+ };
916
+ };
917
+ support: {
918
+ newReport: (id: string, data: any) => Promise<responses.ApiResponse<responses.support.newReport.POST>>;
817
919
  };
818
- report: {
819
- new: (id: string, data: any) => Promise<responses.ApiResponse<responses.report.POST>>;
920
+ track: {
921
+ route: (route: string) => Promise<responses.ApiResponse<any>>;
820
922
  };
821
923
  }
822
924
  }
package/dist/index.js CHANGED
@@ -253,17 +253,39 @@ var AuthApi;
253
253
  run: async (name) => {
254
254
  return await this.request('POST', `admin/cronjobs/run/${name}`, {});
255
255
  }
256
+ },
257
+ reports: {
258
+ users: async () => {
259
+ return await this.request('GET', 'report/users', {});
260
+ },
261
+ usersMonthlyUsage: async (iniDate, endDate, userId) => {
262
+ return await this.request('GET', 'report/users/usage/monthly', { iniDate, endDate, userId });
263
+ },
264
+ usersTimeline: async (iniDate, endDate) => {
265
+ return await this.request('GET', 'report/users/timeline', { iniDate, endDate });
266
+ },
267
+ usersCumulativeTimeline: async (iniDate, endDate) => {
268
+ return await this.request('GET', 'report/users/cumulative-timeline', { iniDate, endDate });
269
+ },
270
+ getLiveUsersCountByProduct: async () => {
271
+ return await this.request('GET', 'report/live/active-users-by-software', {});
272
+ }
256
273
  }
257
274
  };
258
- this.report = {
259
- new: async (id, data) => {
260
- return await this.request('POST', 'report', {
275
+ this.support = {
276
+ newReport: async (id, data) => {
277
+ return await this.request('POST', 'support/newReport', {
261
278
  id,
262
279
  data: (0, tools_1.safeStringify)(data),
263
280
  appVersion: 'unknown'
264
281
  });
265
282
  }
266
283
  };
284
+ this.track = {
285
+ route: async (route) => {
286
+ return await this.request('POST', 'track/route', { route });
287
+ }
288
+ };
267
289
  this.baseURL = config.baseURL;
268
290
  this.tokenStorage = config.tokenStorage;
269
291
  this.onTokenUpdate = config.onTokenUpdate;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@authenty/authapi-types",
3
- "version": "1.0.29",
3
+ "version": "1.0.32",
4
4
  "description": "Shared types for Authenty API",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -689,8 +689,107 @@ export namespace AuthApi {
689
689
  }
690
690
  }
691
691
 
692
+ export namespace support {
693
+ export namespace newReport {
694
+ export type POST = { msg?: string };
695
+ }
696
+ }
692
697
  export namespace report {
693
- export type POST = { msg?: string };
698
+
699
+ export namespace users {
700
+
701
+ export type GET = {
702
+ totalUsers: number;
703
+ usersByCountry: Array<{
704
+ countryId: number | null;
705
+ countryName: string;
706
+ count: number;
707
+ }>;
708
+ usersByState: Array<{
709
+ stateId: number | null;
710
+ stateName: string;
711
+ stateUf: string | null;
712
+ count: number;
713
+ }>;
714
+ usersWithActiveSubscription: number;
715
+ };
716
+
717
+ export namespace timeline {
718
+ export type GET = {
719
+ timeline: Array<{
720
+ month: string;
721
+ users: number;
722
+ purchases: number;
723
+ }>;
724
+ summary: {
725
+ totalUsers: number;
726
+ totalPurchases: number;
727
+ iniDate: string;
728
+ endDate: string;
729
+ };
730
+ };
731
+ }
732
+
733
+ export namespace cumulativeTimeline {
734
+ export type GET = {
735
+ timeline2: Array<{
736
+ month: string;
737
+ activeUsers: number;
738
+ paidSubscriptions: number;
739
+ }>;
740
+ summary: {
741
+ iniDate: string;
742
+ endDate: string;
743
+ };
744
+ };
745
+ }
746
+
747
+ export namespace usage {
748
+ export namespace monthly {
749
+ export type GET = {
750
+ users: Array<{
751
+ userId: number;
752
+ userName: string;
753
+ userEmail: string;
754
+ monthlyUsage: Array<{
755
+ month: string;
756
+ totalMinutes: number;
757
+ totalHours: number;
758
+ byProduct: Array<{
759
+ productId: number;
760
+ productTitle: string;
761
+ minutes: number;
762
+ }>;
763
+ }>;
764
+ }>;
765
+ summary: {
766
+ totalUsers: number;
767
+ totalSessions: number;
768
+ totalMinutes: number;
769
+ iniDate: string;
770
+ endDate: string;
771
+ };
772
+ };
773
+ }
774
+ }
775
+
776
+ }
777
+
778
+ export namespace live {
779
+ export namespace activeUsersBySoftware {
780
+ export type GET = Array<{
781
+ productId: number;
782
+ productTitle: string;
783
+ productLogo: string;
784
+ activeUserCount: number;
785
+ activeUsers: Array<{
786
+ id: number;
787
+ fullname: string;
788
+ email: string;
789
+ }>;
790
+ }>
791
+ }
792
+ }
694
793
  }
695
794
 
696
795
  export namespace admin {
@@ -1109,13 +1208,31 @@ export namespace AuthApi {
1109
1208
  run: async (name: string) => {
1110
1209
  return await this.request<responses.cronJobs.run.POST>('POST', `admin/cronjobs/run/${name}`, {});
1111
1210
  }
1211
+ },
1212
+
1213
+ reports: {
1214
+ users: async () => {
1215
+ return await this.request<responses.report.users.GET>('GET', 'report/users', {});
1216
+ },
1217
+ usersMonthlyUsage: async (iniDate?: string, endDate?: string, userId?: number) => {
1218
+ return await this.request<responses.report.users.usage.monthly.GET>('GET', 'report/users/usage/monthly', { iniDate, endDate, userId });
1219
+ },
1220
+ usersTimeline: async (iniDate?: string, endDate?: string) => {
1221
+ return await this.request<responses.report.users.timeline.GET>('GET', 'report/users/timeline', { iniDate, endDate });
1222
+ },
1223
+ usersCumulativeTimeline: async (iniDate?: string, endDate?: string) => {
1224
+ return await this.request<responses.report.users.cumulativeTimeline.GET>('GET', 'report/users/cumulative-timeline', { iniDate, endDate });
1225
+ },
1226
+ getLiveUsersCountByProduct: async () => {
1227
+ return await this.request<responses.report.live.activeUsersBySoftware.GET>('GET', 'report/live/active-users-by-software', {});
1228
+ }
1112
1229
  }
1113
1230
  }
1114
1231
 
1115
- public report = {
1116
- new: async (id: string, data: any) => {
1232
+ public support = {
1233
+ newReport: async (id: string, data: any) => {
1117
1234
 
1118
- return await this.request<responses.report.POST>('POST', 'report', {
1235
+ return await this.request<responses.support.newReport.POST>('POST', 'support/newReport', {
1119
1236
  id,
1120
1237
  data: safeStringify(data),
1121
1238
  appVersion: 'unknown'
@@ -1123,6 +1240,11 @@ export namespace AuthApi {
1123
1240
  }
1124
1241
  }
1125
1242
 
1243
+ public track = {
1244
+ route: async (route: string) => {
1245
+ return await this.request('POST', 'track/route', { route });
1246
+ }
1247
+ }
1126
1248
  }
1127
1249
 
1128
1250
  }
package/dist/admin.d.ts DELETED
@@ -1,19 +0,0 @@
1
- export declare enum Privilege {
2
- NONE = 0,
3
- READ = 1,
4
- WRITE = 2
5
- }
6
- export type PrivilegeTable = {
7
- users: Privilege;
8
- products: Privilege;
9
- courses: Privilege;
10
- consultancies: Privilege;
11
- bundles: Privilege;
12
- logs: Privilege;
13
- support: Privilege;
14
- leads: Privilege;
15
- paymentSystem: Privilege;
16
- adminMaster: Privilege;
17
- activityTrakking: Privilege;
18
- financial: Privilege;
19
- };
package/dist/admin.js DELETED
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Privilege = void 0;
4
- var Privilege;
5
- (function (Privilege) {
6
- Privilege[Privilege["NONE"] = 0] = "NONE";
7
- Privilege[Privilege["READ"] = 1] = "READ";
8
- Privilege[Privilege["WRITE"] = 2] = "WRITE";
9
- })(Privilege || (exports.Privilege = Privilege = {}));
@@ -1,8 +0,0 @@
1
- export type CronJob = {
2
- startAt: Date | null;
3
- latestRunErrorCount: number;
4
- latestCompletedAt: Date | null;
5
- };
6
- export type CronjobsStatuses = {
7
- purchasesStatusUpdate: CronJob;
8
- };
package/dist/cronjobs.js DELETED
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/general.d.ts DELETED
@@ -1,227 +0,0 @@
1
- import { PrivilegeTable } from "./admin";
2
- import { PG_PurchaseLicenseStatus, PG_PurchasePaymentStatus, PG_PurchaseType } from "./payment-system";
3
- export declare enum BundleType {
4
- BUNDLE = 0,
5
- SYMBOLIC_PRODUCT = 1,
6
- SYMBOLIC_COURSE = 2,
7
- SYMBOLIC_CONSULTANCY = 3
8
- }
9
- export type Product = {
10
- id: number;
11
- title: string;
12
- short: string;
13
- resume: string;
14
- video: string;
15
- imgUrls: string | null;
16
- logo: string;
17
- themeImage: string;
18
- themeColor: string;
19
- themeVideo: string;
20
- url: string;
21
- type: number;
22
- period_test: number;
23
- created: string;
24
- deletedAt?: string | null;
25
- Levels?: ProductLevel[];
26
- };
27
- export type ProductLevel = {
28
- id: number;
29
- productID: number;
30
- level: number;
31
- short: string;
32
- Product?: Product;
33
- store_bundles_levels?: {
34
- id: number;
35
- bundleID: number;
36
- levelID: number;
37
- quantity: number;
38
- Bundle?: Bundle;
39
- }[];
40
- };
41
- export type Course = {
42
- id: number;
43
- type: number;
44
- name: string;
45
- short: string;
46
- resume: string;
47
- img_landscape: string;
48
- img_square: string;
49
- workload: number;
50
- langID: number;
51
- num_classes?: number;
52
- seats: number;
53
- url?: string;
54
- dates: string;
55
- local: string;
56
- local_url: string;
57
- date_mat_s?: string;
58
- date_mat_e?: string;
59
- date_ends?: string;
60
- email_enrollment?: string;
61
- email_before?: string;
62
- email_after?: string;
63
- date_c: string;
64
- date_r?: string | null;
65
- };
66
- export type Consultancy = {
67
- id: number;
68
- teacherID: number;
69
- type: number;
70
- name: string;
71
- short: string;
72
- resume: string;
73
- img_landscape: string;
74
- img_square: string;
75
- workload: number;
76
- langID: number;
77
- url?: string;
78
- datetime: string;
79
- date_mat_s?: string;
80
- date_mat_e?: string;
81
- date_ends?: string;
82
- email_enrollment: string;
83
- email_before: string;
84
- email_after: string;
85
- date_c: string;
86
- date_r?: string | null;
87
- };
88
- export type Bundle = {
89
- id: number;
90
- type: BundleType;
91
- title?: string;
92
- short?: string;
93
- resume?: string;
94
- img: string;
95
- themeImage: string;
96
- themeColor: string;
97
- shareLimit: number;
98
- created: string;
99
- active: boolean;
100
- showInSite: boolean;
101
- defaultMetaArray: string;
102
- deletedAt?: string | null;
103
- Levels?: {
104
- id: number;
105
- bundleID: number;
106
- levelID: number;
107
- quantity: number;
108
- Level: ProductLevel;
109
- }[];
110
- Courses?: {
111
- id: number;
112
- bundleID: number;
113
- courseID: number;
114
- quantity: number;
115
- Course: Course;
116
- }[];
117
- Consultancies?: {
118
- id: number;
119
- bundleID: number;
120
- consultancyID: number;
121
- quantity: number;
122
- Consultancy: Consultancy;
123
- }[];
124
- store_bundles_paymethod: PaymentMethod[];
125
- };
126
- export type PaymentMethod = {
127
- id: number;
128
- bundleID: number;
129
- price: number;
130
- fromprice: number;
131
- period_renew: number;
132
- period_grace: number;
133
- gatewayHash: string;
134
- allowBoleto: boolean;
135
- gatewayID: number;
136
- Bundle?: Bundle;
137
- };
138
- export type Purchase = {
139
- paghash: string;
140
- id: number;
141
- price: number;
142
- licenseStatus: PG_PurchaseLicenseStatus;
143
- paymentStatus: PG_PurchasePaymentStatus;
144
- type_step: PG_PurchaseType;
145
- PaymentMethod: PaymentMethod;
146
- Wallet?: Wallet;
147
- walletID: number;
148
- createdAt: string;
149
- paymentDueAt: string | null;
150
- owner: string;
151
- invoiceUrl?: string;
152
- nfUrl?: string;
153
- isAdmin?: boolean;
154
- meta_data?: Record<string, any>;
155
- PurchaseShares?: PurchaseShare[];
156
- Levels?: {
157
- Level: ProductLevel;
158
- quant: number;
159
- }[];
160
- };
161
- export type Wallet = {
162
- id: number;
163
- userID: number;
164
- balance?: number;
165
- Purchases?: Purchase[];
166
- };
167
- export type PurchaseShare = {
168
- id: number;
169
- purchaseID: number;
170
- userID: number;
171
- Purchase: Purchase;
172
- };
173
- export type LocalUser = {
174
- id: number;
175
- fullname: string;
176
- email: string;
177
- lang: number;
178
- avatar: string;
179
- end_city?: number;
180
- end_comp?: string;
181
- end_country: number;
182
- end_district?: string;
183
- end_n?: string;
184
- end_state?: number;
185
- end_street?: string;
186
- end_zip?: string;
187
- email_verif: boolean;
188
- fiscal_verif: boolean;
189
- terms: boolean;
190
- cpf?: string;
191
- newslatter?: boolean;
192
- allow_purchase?: boolean;
193
- allow_license?: boolean;
194
- date_c?: Date | string;
195
- date_r?: Date | string | null;
196
- Wallets?: Wallet[];
197
- PurchasesShares?: PurchaseShare[];
198
- Sys_admUser_config?: AdminUserConfig;
199
- Sys_adminUser?: PrivilegeTable;
200
- };
201
- export type AdminUserConfig = {
202
- campaigns_blacklist: string;
203
- deletedAt: Date | null;
204
- userID: number;
205
- };
206
- export type availableSoftware_auxType = {
207
- Level: ProductLevel;
208
- quantity: number;
209
- purchaseId: number | null;
210
- type: 'free' | 'own' | 'shared';
211
- };
212
- export type LogEntry = {
213
- appId: string;
214
- logCode: number;
215
- content: string;
216
- timestamp?: string;
217
- metadata?: {
218
- requestId: string;
219
- endpoint: string;
220
- method: string;
221
- userId?: number;
222
- ip?: string;
223
- browser?: string;
224
- system?: string;
225
- referer?: string;
226
- };
227
- };
package/dist/general.js DELETED
@@ -1,10 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.BundleType = void 0;
4
- var BundleType;
5
- (function (BundleType) {
6
- BundleType[BundleType["BUNDLE"] = 0] = "BUNDLE";
7
- BundleType[BundleType["SYMBOLIC_PRODUCT"] = 1] = "SYMBOLIC_PRODUCT";
8
- BundleType[BundleType["SYMBOLIC_COURSE"] = 2] = "SYMBOLIC_COURSE";
9
- BundleType[BundleType["SYMBOLIC_CONSULTANCY"] = 3] = "SYMBOLIC_CONSULTANCY";
10
- })(BundleType || (exports.BundleType = BundleType = {}));
package/dist/package.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "name": "@authenty/authapi-types",
3
- "version": "1.0.12",
4
- "description": "Shared types for Authenty API",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "scripts": {
8
- "prebuild": "node IncrementVersion.js",
9
- "build": "tsc",
10
- "dev": "tsc -w"
11
- },
12
- "publishConfig": {
13
- "access": "public"
14
- },
15
- "devDependencies": {
16
- "typescript": "^5.0.0"
17
- }
18
- }
@@ -1,44 +0,0 @@
1
- export type PG_Customer = {
2
- id: string;
3
- email: string;
4
- name: string;
5
- };
6
- export declare enum PG_PurchaseLicenseStatus {
7
- UNKNOWN = 0,//Nunca será atualizado automaticamente!!
8
- OPEN = 3,//ABERTA - Aguardando pagamento
9
- EXPIRED = 1,//VENCEU - Era PAGAMENTO, e acabou prazo pra uso acabou
10
- PAID = 5,//PAGA - Pagamento realizado com sucesso - é pagamento único
11
- ACTIVE = 6,//ATIVO - Assinatura ativa e em dia
12
- RECYCLING = 4,//RETENTANDO - Tentativa de renovação automática falhou, mas ainda está no prazo para pagar manualmente
13
- CANCELED = 2
14
- }
15
- export declare const PG_PurchaseLicenseStatus_GroupActive: PG_PurchaseLicenseStatus[];
16
- export declare enum PG_PurchasePaymentStatus {
17
- UNKNOWN = 0,//pendent or unknown
18
- ACTIVE = 1,
19
- CANCELED = 2,
20
- REFUNDED = 3,
21
- REMOVED = 4,// REMOVIDO DO GATEWAY - Não há mais registro do pagamento no gateway
22
- PENDING = 5
23
- }
24
- export declare enum PG_PurchaseType {
25
- SESSION = 0,//o registro se trata de uma sessão de compra (ex: intenção de compra preparada para redirecionar o usuário ao gateway. Ainda não é um pagamento nem uma assinatura ativa)
26
- STANDARD = 1,//Pagamento único
27
- RECURRENT = 2
28
- }
29
- export type PG_Purchase = {
30
- id: string;
31
- amount: number;
32
- recurrent: boolean;
33
- type: PG_PurchaseType;
34
- paymentStatus: PG_PurchasePaymentStatus;
35
- url: string | null;
36
- dueTime: Date | null;
37
- };
38
- export declare enum PG_RecurrenceType {
39
- NONE = 0,
40
- DAILY = 1,
41
- WEEKLY = 2,
42
- MONTHLY = 3,
43
- YEARLY = 4
44
- }