@bytexbyte/berify-analytics-api 1.3.5 → 1.3.7
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/lib/ScanChart/index.d.ts +3 -1
- package/lib/ScanChart/index.js +40 -2
- package/lib/ScanChart/type.d.ts +53 -1
- package/lib/ScanChart/type.js +18 -0
- package/package.json +1 -1
package/lib/ScanChart/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import BxBApi from '@bytexbyte/bxb-api';
|
|
2
|
-
import { ScanReportRequest, ScanReportResponse, UserReportRequest, UserReportResponse } from './type';
|
|
2
|
+
import { ScanReportRequest, ScanReportResponse, UserReportRequest, UserReportResponse, ScanRateResponse, ScanRateByTimeRequest, ScanRateByTimeResponse, User } from './type';
|
|
3
3
|
declare class BerifyScanChartApi extends BxBApi {
|
|
4
4
|
constructor({ host, secretKey, secret }: {
|
|
5
5
|
host: string;
|
|
@@ -8,5 +8,7 @@ declare class BerifyScanChartApi extends BxBApi {
|
|
|
8
8
|
});
|
|
9
9
|
getScanReport(form: ScanReportRequest): Promise<ScanReportResponse>;
|
|
10
10
|
getUserReport(form: UserReportRequest): Promise<UserReportResponse>;
|
|
11
|
+
getScanRateAll(user: User, form: UserReportRequest): Promise<ScanRateResponse>;
|
|
12
|
+
getScanRateByTime(form: ScanRateByTimeRequest): Promise<ScanRateByTimeResponse[]>;
|
|
11
13
|
}
|
|
12
14
|
export default BerifyScanChartApi;
|
package/lib/ScanChart/index.js
CHANGED
|
@@ -74,7 +74,7 @@ var BerifyScanChartApi = /** @class */ (function (_super) {
|
|
|
74
74
|
'Content-Type': 'application/json'
|
|
75
75
|
},
|
|
76
76
|
body: JSON.stringify(form)
|
|
77
|
-
}, "scan-report")];
|
|
77
|
+
}, "".concat(this.moduleName, "/scan-report"))];
|
|
78
78
|
case 1:
|
|
79
79
|
response = _a.sent();
|
|
80
80
|
return [2 /*return*/, response.json()];
|
|
@@ -93,7 +93,45 @@ var BerifyScanChartApi = /** @class */ (function (_super) {
|
|
|
93
93
|
'Content-Type': 'application/json'
|
|
94
94
|
},
|
|
95
95
|
body: JSON.stringify(form)
|
|
96
|
-
}, "user-report")];
|
|
96
|
+
}, "".concat(this.moduleName, "/user-report"))];
|
|
97
|
+
case 1:
|
|
98
|
+
response = _a.sent();
|
|
99
|
+
return [2 /*return*/, response.json()];
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
});
|
|
103
|
+
};
|
|
104
|
+
BerifyScanChartApi.prototype.getScanRateAll = 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
|
+
}, "".concat(this.moduleName, "/scan-rate-all"))];
|
|
116
|
+
case 1:
|
|
117
|
+
response = _a.sent();
|
|
118
|
+
return [2 /*return*/, response.json()];
|
|
119
|
+
}
|
|
120
|
+
});
|
|
121
|
+
});
|
|
122
|
+
};
|
|
123
|
+
BerifyScanChartApi.prototype.getScanRateByTime = function (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(form)
|
|
134
|
+
}, "".concat(this.moduleName, "/scan-rate-by-time"))];
|
|
97
135
|
case 1:
|
|
98
136
|
response = _a.sent();
|
|
99
137
|
return [2 /*return*/, response.json()];
|
package/lib/ScanChart/type.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export type ScanReportRequest = {
|
|
2
2
|
tagTokenId?: string;
|
|
3
3
|
batchId?: string;
|
|
4
|
-
companyId?:
|
|
4
|
+
companyId?: number;
|
|
5
5
|
};
|
|
6
6
|
export type ScanReportResult = {
|
|
7
7
|
anonymous: number;
|
|
@@ -30,3 +30,55 @@ export type UserReportResponse = {
|
|
|
30
30
|
data?: UserReportResult;
|
|
31
31
|
error?: string;
|
|
32
32
|
};
|
|
33
|
+
export type ScanRateResponse = {
|
|
34
|
+
status: 'ok' | 'error';
|
|
35
|
+
data?: {
|
|
36
|
+
month: string;
|
|
37
|
+
scanCounts: number;
|
|
38
|
+
}[];
|
|
39
|
+
error?: string;
|
|
40
|
+
};
|
|
41
|
+
export declare enum TimeInterval {
|
|
42
|
+
All = "All Time",
|
|
43
|
+
LastHour = "Last hour",
|
|
44
|
+
LastDay = "Last day",
|
|
45
|
+
LastWeek = "Last week",
|
|
46
|
+
LastMonth = "Last month"
|
|
47
|
+
}
|
|
48
|
+
export type ScanRateByTimeRequest = {
|
|
49
|
+
batchId?: string;
|
|
50
|
+
companyId?: number;
|
|
51
|
+
tagTokenId?: string;
|
|
52
|
+
time: TimeInterval;
|
|
53
|
+
};
|
|
54
|
+
export type ScanRateByTimeResponse = {
|
|
55
|
+
scanCounts: number;
|
|
56
|
+
date?: Date;
|
|
57
|
+
year?: string;
|
|
58
|
+
month?: string;
|
|
59
|
+
day?: string;
|
|
60
|
+
hour?: string;
|
|
61
|
+
minute?: string;
|
|
62
|
+
};
|
|
63
|
+
export declare enum CompanyRoleType {
|
|
64
|
+
super = 0,
|
|
65
|
+
admin = 1,
|
|
66
|
+
marketing = 2,
|
|
67
|
+
supplier = 3,
|
|
68
|
+
seo = 4,
|
|
69
|
+
associate = 5
|
|
70
|
+
}
|
|
71
|
+
export type User = {
|
|
72
|
+
id: string;
|
|
73
|
+
companyId: number;
|
|
74
|
+
companyRole: CompanyRoleType;
|
|
75
|
+
};
|
|
76
|
+
export type ScanRateType = {
|
|
77
|
+
date?: Date;
|
|
78
|
+
year?: string;
|
|
79
|
+
month?: string;
|
|
80
|
+
day?: string;
|
|
81
|
+
hour?: string;
|
|
82
|
+
minute?: string;
|
|
83
|
+
scanCounts: number;
|
|
84
|
+
};
|
package/lib/ScanChart/type.js
CHANGED
|
@@ -1,2 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CompanyRoleType = exports.TimeInterval = void 0;
|
|
4
|
+
var TimeInterval;
|
|
5
|
+
(function (TimeInterval) {
|
|
6
|
+
TimeInterval["All"] = "All Time";
|
|
7
|
+
TimeInterval["LastHour"] = "Last hour";
|
|
8
|
+
TimeInterval["LastDay"] = "Last day";
|
|
9
|
+
TimeInterval["LastWeek"] = "Last week";
|
|
10
|
+
TimeInterval["LastMonth"] = "Last month";
|
|
11
|
+
})(TimeInterval = exports.TimeInterval || (exports.TimeInterval = {}));
|
|
12
|
+
var CompanyRoleType;
|
|
13
|
+
(function (CompanyRoleType) {
|
|
14
|
+
CompanyRoleType[CompanyRoleType["super"] = 0] = "super";
|
|
15
|
+
CompanyRoleType[CompanyRoleType["admin"] = 1] = "admin";
|
|
16
|
+
CompanyRoleType[CompanyRoleType["marketing"] = 2] = "marketing";
|
|
17
|
+
CompanyRoleType[CompanyRoleType["supplier"] = 3] = "supplier";
|
|
18
|
+
CompanyRoleType[CompanyRoleType["seo"] = 4] = "seo";
|
|
19
|
+
CompanyRoleType[CompanyRoleType["associate"] = 5] = "associate";
|
|
20
|
+
})(CompanyRoleType = exports.CompanyRoleType || (exports.CompanyRoleType = {}));
|