@bytexbyte/berify-analytics-api 1.6.4 → 1.6.6

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,5 +1,6 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
- import { ReskinChartRequest, User } from './type';
2
+ import { DataWithDate } from '../../../interfaces';
3
+ import { AgeResult, DeviceTypeResult, GenderResult, HeatmapResult, ReskinChartRequest, User } from './type';
3
4
  declare class BerifyReskinApi extends BxBApi {
4
5
  constructor({ host, secretKey, secret }: {
5
6
  host: string;
@@ -8,6 +9,73 @@ declare class BerifyReskinApi extends BxBApi {
8
9
  });
9
10
  getScanCount(user: User, form: ReskinChartRequest): Promise<{
10
11
  data: number;
12
+ } | {
13
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
14
+ }>;
15
+ getNewUserCount(user: User, form: ReskinChartRequest): Promise<{
16
+ data: number;
17
+ } | {
18
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
19
+ }>;
20
+ getUniqueScanCount(user: User, form: ReskinChartRequest): Promise<{
21
+ data: number;
22
+ } | {
23
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
24
+ }>;
25
+ getSessionDurationAvg(user: User, form: ReskinChartRequest): Promise<{
26
+ data: number;
27
+ } | {
28
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
29
+ }>;
30
+ getPromoModalOpenCount(user: User, form: ReskinChartRequest): Promise<{
31
+ data: number;
32
+ } | {
33
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
34
+ }>;
35
+ getCommunityModalOpenCount(user: User, form: ReskinChartRequest): Promise<{
36
+ data: number;
37
+ } | {
38
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
39
+ }>;
40
+ getBounceRate(user: User, form: ReskinChartRequest): Promise<{
41
+ data: number;
42
+ } | {
43
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
44
+ }>;
45
+ getExperienceEngagement(user: User, form: ReskinChartRequest): Promise<{
46
+ data: number;
47
+ } | {
48
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
49
+ }>;
50
+ getGenderBreakdown(user: User, form: ReskinChartRequest): Promise<{
51
+ data: GenderResult;
52
+ } | {
53
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
54
+ }>;
55
+ getAgeDistribution(user: User, form: ReskinChartRequest): Promise<{
56
+ data: AgeResult;
57
+ } | {
58
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
59
+ }>;
60
+ getDeviceType(user: User, form: ReskinChartRequest): Promise<{
61
+ data: DeviceTypeResult;
62
+ } | {
63
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
64
+ }>;
65
+ getHeatmap(user: User, form: ReskinChartRequest): Promise<{
66
+ data: HeatmapResult;
67
+ } | {
68
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
69
+ }>;
70
+ getDailyScanCount(user: User, form: ReskinChartRequest): Promise<{
71
+ data: DataWithDate[];
72
+ } | {
73
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
74
+ }>;
75
+ getActiveTime(user: User, form: ReskinChartRequest): Promise<{
76
+ data: DataWithDate[];
77
+ } | {
78
+ error: 'session not found' | 'user not found' | 'startDate and endDate are required' | 'Permission denied' | 'Internal Server Error';
11
79
  }>;
12
80
  }
13
81
  export default BerifyReskinApi;
@@ -82,6 +82,253 @@ var BerifyReskinApi = /** @class */ (function (_super) {
82
82
  });
83
83
  });
84
84
  };
85
+ BerifyReskinApi.prototype.getNewUserCount = function (user, form) {
86
+ return __awaiter(this, void 0, void 0, function () {
87
+ var response;
88
+ return __generator(this, function (_a) {
89
+ switch (_a.label) {
90
+ case 0: return [4 /*yield*/, this.bxbFetch({
91
+ method: 'POST',
92
+ headers: {
93
+ 'Content-Type': 'application/json'
94
+ },
95
+ body: JSON.stringify({ user: user, form: form })
96
+ }, 'new-user-count')];
97
+ case 1:
98
+ response = _a.sent();
99
+ return [2 /*return*/, response.json()];
100
+ }
101
+ });
102
+ });
103
+ };
104
+ BerifyReskinApi.prototype.getUniqueScanCount = function (user, form) {
105
+ return __awaiter(this, void 0, void 0, function () {
106
+ var response;
107
+ return __generator(this, function (_a) {
108
+ switch (_a.label) {
109
+ case 0: return [4 /*yield*/, this.bxbFetch({
110
+ method: 'POST',
111
+ headers: {
112
+ 'Content-Type': 'application/json'
113
+ },
114
+ body: JSON.stringify({ user: user, form: form })
115
+ }, 'unique-scan-count')];
116
+ case 1:
117
+ response = _a.sent();
118
+ return [2 /*return*/, response.json()];
119
+ }
120
+ });
121
+ });
122
+ };
123
+ BerifyReskinApi.prototype.getSessionDurationAvg = function (user, form) {
124
+ return __awaiter(this, void 0, void 0, function () {
125
+ var response;
126
+ return __generator(this, function (_a) {
127
+ switch (_a.label) {
128
+ case 0: return [4 /*yield*/, this.bxbFetch({
129
+ method: 'POST',
130
+ headers: {
131
+ 'Content-Type': 'application/json'
132
+ },
133
+ body: JSON.stringify({ user: user, form: form })
134
+ }, 'session-duration-avg')];
135
+ case 1:
136
+ response = _a.sent();
137
+ return [2 /*return*/, response.json()];
138
+ }
139
+ });
140
+ });
141
+ };
142
+ BerifyReskinApi.prototype.getPromoModalOpenCount = function (user, form) {
143
+ return __awaiter(this, void 0, void 0, function () {
144
+ var response;
145
+ return __generator(this, function (_a) {
146
+ switch (_a.label) {
147
+ case 0: return [4 /*yield*/, this.bxbFetch({
148
+ method: 'POST',
149
+ headers: {
150
+ 'Content-Type': 'application/json'
151
+ },
152
+ body: JSON.stringify({ user: user, form: form })
153
+ }, 'promo-modal-open-count')];
154
+ case 1:
155
+ response = _a.sent();
156
+ return [2 /*return*/, response.json()];
157
+ }
158
+ });
159
+ });
160
+ };
161
+ BerifyReskinApi.prototype.getCommunityModalOpenCount = function (user, form) {
162
+ return __awaiter(this, void 0, void 0, function () {
163
+ var response;
164
+ return __generator(this, function (_a) {
165
+ switch (_a.label) {
166
+ case 0: return [4 /*yield*/, this.bxbFetch({
167
+ method: 'POST',
168
+ headers: {
169
+ 'Content-Type': 'application/json'
170
+ },
171
+ body: JSON.stringify({ user: user, form: form })
172
+ }, 'community-modal-open-count')];
173
+ case 1:
174
+ response = _a.sent();
175
+ return [2 /*return*/, response.json()];
176
+ }
177
+ });
178
+ });
179
+ };
180
+ BerifyReskinApi.prototype.getBounceRate = function (user, form) {
181
+ return __awaiter(this, void 0, void 0, function () {
182
+ var response;
183
+ return __generator(this, function (_a) {
184
+ switch (_a.label) {
185
+ case 0: return [4 /*yield*/, this.bxbFetch({
186
+ method: 'POST',
187
+ headers: {
188
+ 'Content-Type': 'application/json'
189
+ },
190
+ body: JSON.stringify({ user: user, form: form })
191
+ }, 'bounce-rate')];
192
+ case 1:
193
+ response = _a.sent();
194
+ return [2 /*return*/, response.json()];
195
+ }
196
+ });
197
+ });
198
+ };
199
+ BerifyReskinApi.prototype.getExperienceEngagement = function (user, form) {
200
+ return __awaiter(this, void 0, void 0, function () {
201
+ var response;
202
+ return __generator(this, function (_a) {
203
+ switch (_a.label) {
204
+ case 0: return [4 /*yield*/, this.bxbFetch({
205
+ method: 'POST',
206
+ headers: {
207
+ 'Content-Type': 'application/json'
208
+ },
209
+ body: JSON.stringify({ user: user, form: form })
210
+ }, 'experience-engagement')];
211
+ case 1:
212
+ response = _a.sent();
213
+ return [2 /*return*/, response.json()];
214
+ }
215
+ });
216
+ });
217
+ };
218
+ BerifyReskinApi.prototype.getGenderBreakdown = function (user, form) {
219
+ return __awaiter(this, void 0, void 0, function () {
220
+ var response;
221
+ return __generator(this, function (_a) {
222
+ switch (_a.label) {
223
+ case 0: return [4 /*yield*/, this.bxbFetch({
224
+ method: 'POST',
225
+ headers: {
226
+ 'Content-Type': 'application/json'
227
+ },
228
+ body: JSON.stringify({ user: user, form: form })
229
+ }, 'gender-breakdown')];
230
+ case 1:
231
+ response = _a.sent();
232
+ return [2 /*return*/, response.json()];
233
+ }
234
+ });
235
+ });
236
+ };
237
+ BerifyReskinApi.prototype.getAgeDistribution = function (user, form) {
238
+ return __awaiter(this, void 0, void 0, function () {
239
+ var response;
240
+ return __generator(this, function (_a) {
241
+ switch (_a.label) {
242
+ case 0: return [4 /*yield*/, this.bxbFetch({
243
+ method: 'POST',
244
+ headers: {
245
+ 'Content-Type': 'application/json'
246
+ },
247
+ body: JSON.stringify({ user: user, form: form })
248
+ }, 'age-distribution')];
249
+ case 1:
250
+ response = _a.sent();
251
+ return [2 /*return*/, response.json()];
252
+ }
253
+ });
254
+ });
255
+ };
256
+ BerifyReskinApi.prototype.getDeviceType = function (user, form) {
257
+ return __awaiter(this, void 0, void 0, function () {
258
+ var response;
259
+ return __generator(this, function (_a) {
260
+ switch (_a.label) {
261
+ case 0: return [4 /*yield*/, this.bxbFetch({
262
+ method: 'POST',
263
+ headers: {
264
+ 'Content-Type': 'application/json'
265
+ },
266
+ body: JSON.stringify({ user: user, form: form })
267
+ }, 'device-type')];
268
+ case 1:
269
+ response = _a.sent();
270
+ return [2 /*return*/, response.json()];
271
+ }
272
+ });
273
+ });
274
+ };
275
+ BerifyReskinApi.prototype.getHeatmap = function (user, form) {
276
+ return __awaiter(this, void 0, void 0, function () {
277
+ var response;
278
+ return __generator(this, function (_a) {
279
+ switch (_a.label) {
280
+ case 0: return [4 /*yield*/, this.bxbFetch({
281
+ method: 'POST',
282
+ headers: {
283
+ 'Content-Type': 'application/json'
284
+ },
285
+ body: JSON.stringify({ user: user, form: form })
286
+ }, 'heatmap')];
287
+ case 1:
288
+ response = _a.sent();
289
+ return [2 /*return*/, response.json()];
290
+ }
291
+ });
292
+ });
293
+ };
294
+ BerifyReskinApi.prototype.getDailyScanCount = function (user, form) {
295
+ return __awaiter(this, void 0, void 0, function () {
296
+ var response;
297
+ return __generator(this, function (_a) {
298
+ switch (_a.label) {
299
+ case 0: return [4 /*yield*/, this.bxbFetch({
300
+ method: 'POST',
301
+ headers: {
302
+ 'Content-Type': 'application/json'
303
+ },
304
+ body: JSON.stringify({ user: user, form: form })
305
+ }, 'daily-scan-count')];
306
+ case 1:
307
+ response = _a.sent();
308
+ return [2 /*return*/, response.json()];
309
+ }
310
+ });
311
+ });
312
+ };
313
+ BerifyReskinApi.prototype.getActiveTime = function (user, form) {
314
+ return __awaiter(this, void 0, void 0, function () {
315
+ var response;
316
+ return __generator(this, function (_a) {
317
+ switch (_a.label) {
318
+ case 0: return [4 /*yield*/, this.bxbFetch({
319
+ method: 'POST',
320
+ headers: {
321
+ 'Content-Type': 'application/json'
322
+ },
323
+ body: JSON.stringify({ user: user, form: form })
324
+ }, 'active-time')];
325
+ case 1:
326
+ response = _a.sent();
327
+ return [2 /*return*/, response.json()];
328
+ }
329
+ });
330
+ });
331
+ };
85
332
  return BerifyReskinApi;
86
333
  }(bxb_api_1.default));
87
334
  exports.default = BerifyReskinApi;
@@ -1,3 +1,4 @@
1
+ import { Decimal } from "@prisma/client/runtime/library";
1
2
  export type CompanyRoleType = 'super' | 'admin' | 'marketing' | 'supplier' | 'seo' | 'associate';
2
3
  export type User = {
3
4
  id: string;
@@ -8,8 +9,32 @@ export interface ReskinChartRequest {
8
9
  startDate: string;
9
10
  endDate: string;
10
11
  batchId?: string;
11
- companyId?: number;
12
+ companyId?: string;
12
13
  country?: string;
13
14
  state?: string;
14
15
  city?: string;
15
16
  }
17
+ export type GenderResult = {
18
+ male: number;
19
+ female: number;
20
+ unknown: number;
21
+ };
22
+ export type AgeResult = {
23
+ '18-24': number;
24
+ '25-34': number;
25
+ '35-44': number;
26
+ '45-54': number;
27
+ '55-64': number;
28
+ '65+': number;
29
+ unknown: number;
30
+ };
31
+ export type DeviceTypeResult = {
32
+ iOS: number;
33
+ Android: number;
34
+ Web: number;
35
+ };
36
+ export type HeatmapResult = {
37
+ id: number;
38
+ latitude: Decimal | null;
39
+ longitude: Decimal | null;
40
+ }[];
@@ -38,7 +38,7 @@ export interface Scan {
38
38
  };
39
39
  };
40
40
  }
41
- export interface DataWithDate {
42
- date: Date;
41
+ export type DataWithDate = {
42
+ date: string;
43
43
  value: number;
44
- }
44
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/berify-analytics-api",
3
- "version": "1.6.4",
3
+ "version": "1.6.6",
4
4
  "description": "api",
5
5
  "main": "lib/berifyAnalyticsApi/src/index.js",
6
6
  "types": "lib/berifyAnalyticsApi/src/index.d.ts",