@bytexbyte/berify-analytics-api 2.2.4 → 2.2.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.
- package/lib/berifyAnalyticsApi/src/Report/index.d.ts +20 -0
- package/lib/berifyAnalyticsApi/src/Report/index.js +32 -0
- package/lib/berifyAnalyticsApi/src/Report/type.d.ts +89 -0
- package/lib/berifyAnalyticsApi/src/Report/type.js +6 -0
- package/lib/berifyAnalyticsApi/src/index.d.ts +2 -0
- package/lib/berifyAnalyticsApi/src/index.js +2 -0
- package/lib/interfaces/index.d.ts +11 -3
- package/package.json +1 -1
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import BxBApi from '@bytexbyte/bxb-api';
|
|
2
|
+
import { ScanReportRequest, ScanReportResponse } from './type';
|
|
3
|
+
import { User } from '../ScanChart/type';
|
|
4
|
+
declare class BerifyReportApi extends BxBApi {
|
|
5
|
+
constructor({ host, secretKey, secret }: {
|
|
6
|
+
host: string;
|
|
7
|
+
secretKey?: string;
|
|
8
|
+
secret?: string;
|
|
9
|
+
});
|
|
10
|
+
/**
|
|
11
|
+
* 生成掃描報告
|
|
12
|
+
* Generate scan report with customizable date range
|
|
13
|
+
*
|
|
14
|
+
* @param user - User information for authorization
|
|
15
|
+
* @param form - Report request parameters
|
|
16
|
+
* @returns Promise<ScanReportResponse>
|
|
17
|
+
*/
|
|
18
|
+
generateScanReport(user: User, form: ScanReportRequest): Promise<ScanReportResponse>;
|
|
19
|
+
}
|
|
20
|
+
export default BerifyReportApi;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const bxb_api_1 = require("@bytexbyte/bxb-api");
|
|
4
|
+
class BerifyReportApi extends bxb_api_1.default {
|
|
5
|
+
constructor({ host, secretKey, secret }) {
|
|
6
|
+
super({
|
|
7
|
+
host,
|
|
8
|
+
moduleName: 'reports',
|
|
9
|
+
secretKey: secretKey ?? 'secretKey',
|
|
10
|
+
secret: secret ?? 'secret'
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 生成掃描報告
|
|
15
|
+
* Generate scan report with customizable date range
|
|
16
|
+
*
|
|
17
|
+
* @param user - User information for authorization
|
|
18
|
+
* @param form - Report request parameters
|
|
19
|
+
* @returns Promise<ScanReportResponse>
|
|
20
|
+
*/
|
|
21
|
+
async generateScanReport(user, form) {
|
|
22
|
+
const response = await this.bxbFetch({
|
|
23
|
+
method: 'POST',
|
|
24
|
+
headers: {
|
|
25
|
+
'Content-Type': 'application/json'
|
|
26
|
+
},
|
|
27
|
+
body: JSON.stringify({ user, ...form })
|
|
28
|
+
}, '');
|
|
29
|
+
return response.json();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
exports.default = BerifyReportApi;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Report API Type Definitions
|
|
3
|
+
* 掃描報告 API 接口定義
|
|
4
|
+
*/
|
|
5
|
+
export type ScanReportRequest = {
|
|
6
|
+
companyId: string;
|
|
7
|
+
startDate?: string;
|
|
8
|
+
endDate?: string;
|
|
9
|
+
includeCharts?: boolean;
|
|
10
|
+
includePdf?: boolean;
|
|
11
|
+
useOpenAI?: boolean;
|
|
12
|
+
digitalTopN?: number;
|
|
13
|
+
format?: 'json' | 'pdf';
|
|
14
|
+
};
|
|
15
|
+
export type DailyCount = {
|
|
16
|
+
date: string;
|
|
17
|
+
count: number;
|
|
18
|
+
};
|
|
19
|
+
export type TopItem = {
|
|
20
|
+
id: string;
|
|
21
|
+
name?: string;
|
|
22
|
+
count: number;
|
|
23
|
+
};
|
|
24
|
+
export type LocationStats = {
|
|
25
|
+
location: string;
|
|
26
|
+
country?: string;
|
|
27
|
+
region?: string;
|
|
28
|
+
locality?: string;
|
|
29
|
+
count: number;
|
|
30
|
+
};
|
|
31
|
+
export type PromoDetail = {
|
|
32
|
+
title?: string;
|
|
33
|
+
description?: string;
|
|
34
|
+
link?: string;
|
|
35
|
+
imageUrl?: string;
|
|
36
|
+
};
|
|
37
|
+
export type ProductDetail = {
|
|
38
|
+
id: string;
|
|
39
|
+
name?: string;
|
|
40
|
+
description?: string;
|
|
41
|
+
detail?: string;
|
|
42
|
+
promo?: PromoDetail;
|
|
43
|
+
};
|
|
44
|
+
export type DigitalCustomizationDetail = {
|
|
45
|
+
id: string;
|
|
46
|
+
name?: string;
|
|
47
|
+
count: number;
|
|
48
|
+
shopLink?: string;
|
|
49
|
+
exploreLink?: string;
|
|
50
|
+
successText?: string;
|
|
51
|
+
product?: ProductDetail;
|
|
52
|
+
};
|
|
53
|
+
export type ScanReportStats = {
|
|
54
|
+
companyId: string;
|
|
55
|
+
companyName?: string;
|
|
56
|
+
startDate: string;
|
|
57
|
+
endDate: string;
|
|
58
|
+
totalScans: number;
|
|
59
|
+
uniqueUsers: number;
|
|
60
|
+
dailyCounts: DailyCount[];
|
|
61
|
+
topTags: TopItem[];
|
|
62
|
+
topTokens: TopItem[];
|
|
63
|
+
topBatches: TopItem[];
|
|
64
|
+
topLocations: LocationStats[];
|
|
65
|
+
topDigitalCustomizations: DigitalCustomizationDetail[];
|
|
66
|
+
unknownLocationScans: number;
|
|
67
|
+
};
|
|
68
|
+
export type ChartData = {
|
|
69
|
+
dailyTrend?: string;
|
|
70
|
+
topLocations?: string;
|
|
71
|
+
};
|
|
72
|
+
export type ScanReportResult = ScanReportStats & {
|
|
73
|
+
charts?: ChartData;
|
|
74
|
+
pdfUrl?: string;
|
|
75
|
+
};
|
|
76
|
+
export type ScanReportResponse = {
|
|
77
|
+
status: 'ok' | 'error';
|
|
78
|
+
data?: {
|
|
79
|
+
downloadUrl?: string | null;
|
|
80
|
+
};
|
|
81
|
+
error?: string;
|
|
82
|
+
};
|
|
83
|
+
export type ReportAggregationOptions = {
|
|
84
|
+
companyId: string;
|
|
85
|
+
startDate: Date;
|
|
86
|
+
endDate: Date;
|
|
87
|
+
digitalTopN?: number;
|
|
88
|
+
includeGeoData?: boolean;
|
|
89
|
+
};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import BerifyHeatMapApi from "./Heatmap";
|
|
2
2
|
import BerifyReskinApi from "./Reskin";
|
|
3
3
|
import BerifyScanChartApi from "./ScanChart";
|
|
4
|
+
import BerifyReportApi from "./Report";
|
|
4
5
|
declare class BerifyAnalyticsApi {
|
|
5
6
|
host: string;
|
|
6
7
|
secretKey?: string;
|
|
@@ -8,6 +9,7 @@ declare class BerifyAnalyticsApi {
|
|
|
8
9
|
heatmap: BerifyHeatMapApi;
|
|
9
10
|
scanChart: BerifyScanChartApi;
|
|
10
11
|
reskin: BerifyReskinApi;
|
|
12
|
+
report: BerifyReportApi;
|
|
11
13
|
constructor({ host, secretKey, secret }: {
|
|
12
14
|
host: string;
|
|
13
15
|
secretKey?: string;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const Heatmap_1 = require("./Heatmap");
|
|
4
4
|
const Reskin_1 = require("./Reskin");
|
|
5
5
|
const ScanChart_1 = require("./ScanChart");
|
|
6
|
+
const Report_1 = require("./Report");
|
|
6
7
|
class BerifyAnalyticsApi {
|
|
7
8
|
constructor({ host, secretKey, secret }) {
|
|
8
9
|
this.host = host;
|
|
@@ -11,6 +12,7 @@ class BerifyAnalyticsApi {
|
|
|
11
12
|
this.heatmap = new Heatmap_1.default({ host, secretKey, secret });
|
|
12
13
|
this.scanChart = new ScanChart_1.default({ host, secretKey, secret });
|
|
13
14
|
this.reskin = new Reskin_1.default({ host, secretKey, secret });
|
|
15
|
+
this.report = new Report_1.default({ host, secretKey, secret });
|
|
14
16
|
}
|
|
15
17
|
}
|
|
16
18
|
exports.default = BerifyAnalyticsApi;
|
|
@@ -29,9 +29,9 @@ export interface Scan {
|
|
|
29
29
|
createdAt: Date;
|
|
30
30
|
tagId: string;
|
|
31
31
|
generalUserId: string;
|
|
32
|
-
isVisitedPromo:
|
|
33
|
-
isVisitedShop:
|
|
34
|
-
isVisitedExplore:
|
|
32
|
+
isVisitedPromo: boolean;
|
|
33
|
+
isVisitedShop: boolean;
|
|
34
|
+
isVisitedExplore: boolean;
|
|
35
35
|
exploreLink?: string;
|
|
36
36
|
digitalCustomizationId: string;
|
|
37
37
|
promoLink?: string;
|
|
@@ -50,3 +50,11 @@ export type DataWithDate = {
|
|
|
50
50
|
date: string;
|
|
51
51
|
value: number;
|
|
52
52
|
};
|
|
53
|
+
export type AtlasSyncOperation = 'insert' | 'update' | 'replace';
|
|
54
|
+
export interface VisitFlagSyncPayload {
|
|
55
|
+
id: string;
|
|
56
|
+
operation?: AtlasSyncOperation;
|
|
57
|
+
isVisitedPromo?: boolean;
|
|
58
|
+
isVisitedShop?: boolean;
|
|
59
|
+
isVisitedExplore?: boolean;
|
|
60
|
+
}
|