@bytexbyte/berify-analytics-api 1.6.6 → 2.0.0

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,5 @@
1
1
  import BxBApi from '@bytexbyte/bxb-api';
2
- import { HeatmapRequest, HeatmapResponse, LastUpdatedAtResponse, ReskinHeatmapRequest } from './type';
2
+ import { HeatmapRequest, HeatmapResponse, LastUpdatedAtResponse } from './type';
3
3
  declare class BerifyHeatMapApi extends BxBApi {
4
4
  constructor({ host, secretKey, secret }: {
5
5
  host: string;
@@ -8,6 +8,5 @@ declare class BerifyHeatMapApi extends BxBApi {
8
8
  });
9
9
  getHeatmap(form: HeatmapRequest): Promise<HeatmapResponse>;
10
10
  getLastUpdatedAt(): Promise<LastUpdatedAtResponse>;
11
- getHeatmapByDateRange(form: ReskinHeatmapRequest): Promise<HeatmapResponse>;
12
11
  }
13
12
  export default BerifyHeatMapApi;
@@ -100,25 +100,6 @@ var BerifyHeatMapApi = /** @class */ (function (_super) {
100
100
  });
101
101
  });
102
102
  };
103
- BerifyHeatMapApi.prototype.getHeatmapByDateRange = function (form) {
104
- return __awaiter(this, void 0, void 0, function () {
105
- var response;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0: return [4 /*yield*/, this.bxbFetch({
109
- method: 'POST',
110
- headers: {
111
- 'Content-Type': 'application/json'
112
- },
113
- body: JSON.stringify(form)
114
- }, 'date-range')];
115
- case 1:
116
- response = _a.sent();
117
- return [2 /*return*/, response.json()];
118
- }
119
- });
120
- });
121
- };
122
103
  return BerifyHeatMapApi;
123
104
  }(bxb_api_1.default));
124
105
  exports.default = BerifyHeatMapApi;
@@ -15,15 +15,6 @@ export type HeatmapRequest = {
15
15
  collectionRuleId?: number;
16
16
  timeInterval: TimeInterval;
17
17
  };
18
- export type ReskinHeatmapRequest = {
19
- userId: string;
20
- companyId?: number;
21
- tagTokenId?: string;
22
- batchId?: string;
23
- collectionRuleId?: number;
24
- startDate: Date;
25
- endDate: Date;
26
- };
27
18
  export type HeatmapResult = {
28
19
  id: number;
29
20
  latitude: Decimal | null;
@@ -1,5 +1,4 @@
1
1
  import BerifyHeatMapApi from "./Heatmap";
2
- import BerifyReskinApi from "./Reskin";
3
2
  import BerifyScanChartApi from "./ScanChart";
4
3
  declare class BerifyAnalyticsApi {
5
4
  host: string;
@@ -7,7 +6,6 @@ declare class BerifyAnalyticsApi {
7
6
  secret?: string;
8
7
  heatmap: BerifyHeatMapApi;
9
8
  scanChart: BerifyScanChartApi;
10
- reskin: BerifyReskinApi;
11
9
  constructor({ host, secretKey, secret }: {
12
10
  host: string;
13
11
  secretKey?: string;
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  var Heatmap_1 = require("./Heatmap");
4
- var Reskin_1 = require("./Reskin");
5
4
  var ScanChart_1 = require("./ScanChart");
6
5
  var BerifyAnalyticsApi = /** @class */ (function () {
7
6
  function BerifyAnalyticsApi(_a) {
@@ -11,7 +10,6 @@ var BerifyAnalyticsApi = /** @class */ (function () {
11
10
  this.secret = secret;
12
11
  this.heatmap = new Heatmap_1.default({ host: host, secretKey: secretKey, secret: secret });
13
12
  this.scanChart = new ScanChart_1.default({ host: host, secretKey: secretKey, secret: secret });
14
- this.reskin = new Reskin_1.default({ host: host, secretKey: secretKey, secret: secret });
15
13
  }
16
14
  return BerifyAnalyticsApi;
17
15
  }());
@@ -25,7 +25,6 @@ export interface Scan {
25
25
  id: number;
26
26
  latitude: Decimal | null;
27
27
  longitude: Decimal | null;
28
- location: string | null;
29
28
  createdAt: Date;
30
29
  tagTokenId: string;
31
30
  userId: string;
@@ -38,7 +37,3 @@ export interface Scan {
38
37
  };
39
38
  };
40
39
  }
41
- export type DataWithDate = {
42
- date: string;
43
- value: number;
44
- };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bytexbyte/berify-analytics-api",
3
- "version": "1.6.6",
3
+ "version": "2.0.0",
4
4
  "description": "api",
5
5
  "main": "lib/berifyAnalyticsApi/src/index.js",
6
6
  "types": "lib/berifyAnalyticsApi/src/index.d.ts",
@@ -1,81 +0,0 @@
1
- import BxBApi from '@bytexbyte/bxb-api';
2
- import { DataWithDate } from '../../../interfaces';
3
- import { AgeResult, DeviceTypeResult, GenderResult, HeatmapResult, ReskinChartRequest, User } from './type';
4
- declare class BerifyReskinApi extends BxBApi {
5
- constructor({ host, secretKey, secret }: {
6
- host: string;
7
- secretKey?: string;
8
- secret?: string;
9
- });
10
- getScanCount(user: User, form: ReskinChartRequest): Promise<{
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';
79
- }>;
80
- }
81
- export default BerifyReskinApi;
@@ -1,334 +0,0 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
18
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
19
- return new (P || (P = Promise))(function (resolve, reject) {
20
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
21
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
22
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
23
- step((generator = generator.apply(thisArg, _arguments || [])).next());
24
- });
25
- };
26
- var __generator = (this && this.__generator) || function (thisArg, body) {
27
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
28
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
29
- function verb(n) { return function (v) { return step([n, v]); }; }
30
- function step(op) {
31
- if (f) throw new TypeError("Generator is already executing.");
32
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
33
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
34
- if (y = 0, t) op = [op[0] & 2, t.value];
35
- switch (op[0]) {
36
- case 0: case 1: t = op; break;
37
- case 4: _.label++; return { value: op[1], done: false };
38
- case 5: _.label++; y = op[1]; op = [0]; continue;
39
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
40
- default:
41
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
42
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
43
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
44
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
45
- if (t[2]) _.ops.pop();
46
- _.trys.pop(); continue;
47
- }
48
- op = body.call(thisArg, _);
49
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
50
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
51
- }
52
- };
53
- Object.defineProperty(exports, "__esModule", { value: true });
54
- var bxb_api_1 = require("@bytexbyte/bxb-api");
55
- var BerifyReskinApi = /** @class */ (function (_super) {
56
- __extends(BerifyReskinApi, _super);
57
- function BerifyReskinApi(_a) {
58
- var host = _a.host, secretKey = _a.secretKey, secret = _a.secret;
59
- return _super.call(this, {
60
- host: host,
61
- moduleName: 'reskin',
62
- secretKey: secretKey !== null && secretKey !== void 0 ? secretKey : 'secretKey',
63
- secret: secret !== null && secret !== void 0 ? secret : 'secret'
64
- }) || this;
65
- }
66
- BerifyReskinApi.prototype.getScanCount = function (user, form) {
67
- return __awaiter(this, void 0, void 0, function () {
68
- var response;
69
- return __generator(this, function (_a) {
70
- switch (_a.label) {
71
- case 0: return [4 /*yield*/, this.bxbFetch({
72
- method: 'POST',
73
- headers: {
74
- 'Content-Type': 'application/json'
75
- },
76
- body: JSON.stringify({ user: user, form: form })
77
- }, 'scan-count')];
78
- case 1:
79
- response = _a.sent();
80
- return [2 /*return*/, response.json()];
81
- }
82
- });
83
- });
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
- };
332
- return BerifyReskinApi;
333
- }(bxb_api_1.default));
334
- exports.default = BerifyReskinApi;
@@ -1,40 +0,0 @@
1
- import { Decimal } from "@prisma/client/runtime/library";
2
- export type CompanyRoleType = 'super' | 'admin' | 'marketing' | 'supplier' | 'seo' | 'associate';
3
- export type User = {
4
- id: string;
5
- companyId: number;
6
- companyRole: CompanyRoleType;
7
- };
8
- export interface ReskinChartRequest {
9
- startDate: string;
10
- endDate: string;
11
- batchId?: string;
12
- companyId?: string;
13
- country?: string;
14
- state?: string;
15
- city?: string;
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
- }[];
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });