awing-library 2.1.163-dev → 2.1.165-dev
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/ACM-AXN/Campaign/CreateOrEdit/TabStatistic/Analytic/ChartWithType.js +1 -3
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabStatistic/Analytic/Utils.d.ts +11 -34
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabStatistic/Analytic/Utils.js +139 -62
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabStatistic/Analytic/container.js +2 -0
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabStatistic/Customer/component.js +1 -0
- package/lib/ACM-AXN/ScheduleCompletionRate/Filter.js +6 -1
- package/lib/AWING/DataGrid/index.js +7 -1
- package/lib/AWING/DateRangePicker/component.js +32 -14
- package/lib/Utils/Helpers.d.ts +1 -1
- package/lib/translate/vi/translation.json +1 -1
- package/package.json +1 -1
|
@@ -102,9 +102,7 @@ var ChartWithType = function (props) {
|
|
|
102
102
|
title: {
|
|
103
103
|
text: t('Statistics.View'),
|
|
104
104
|
},
|
|
105
|
-
|
|
106
|
-
yAxis: {
|
|
107
|
-
display: false,
|
|
105
|
+
beginAtZero: true
|
|
108
106
|
},
|
|
109
107
|
},
|
|
110
108
|
} }) })) : ((0, jsx_runtime_1.jsx)(Detail_1.default, { statisticalData: statisticalData })) })] }));
|
|
@@ -1,53 +1,30 @@
|
|
|
1
1
|
import { CampaignGroupModel } from '../../../../../ACM-AXN/Campaign/Types';
|
|
2
2
|
import { IAnalyticCampaignSummary } from '../Types';
|
|
3
3
|
import { AnalyticType } from '../../../../../ACM-AXN/Common/Enum';
|
|
4
|
+
import { DataObject } from '../../../../../AWING';
|
|
4
5
|
export declare function convertToExportDataGroupBy(data: any, objects: any, timelineType: any, groupBy: any): {
|
|
5
6
|
columns: any[];
|
|
6
7
|
data: any;
|
|
7
8
|
}[];
|
|
8
|
-
export declare function convertToExportData(data:
|
|
9
|
+
export declare function convertToExportData(data: DataObject[], places: any, timelineType: any): {
|
|
9
10
|
columns: string[];
|
|
10
11
|
data: any[][];
|
|
11
12
|
}[];
|
|
12
|
-
export declare function convertToExport(subCampaigns: CampaignGroupModel[], data:
|
|
13
|
+
export declare function convertToExport(subCampaigns: CampaignGroupModel[], data: DataObject[], timelineType: any, places: any[]): any[];
|
|
13
14
|
export declare function placesToDomains(places: any[], domains?: any[]): any[];
|
|
14
|
-
export declare const markBillingType: (subCampaigns: CampaignGroupModel[], data: IAnalyticCampaignSummary[]) =>
|
|
15
|
-
billingUnit: AnalyticType;
|
|
16
|
-
isPot: boolean;
|
|
17
|
-
campaignId?: string | undefined;
|
|
18
|
-
placeId?: string | undefined;
|
|
19
|
-
domainId?: string | undefined;
|
|
20
|
-
timeline?: number | undefined;
|
|
21
|
-
analyticEventSummaries: import("../Types").IAnalyticEventSummary[];
|
|
22
|
-
campaignGroupId?: number | undefined;
|
|
23
|
-
campaignAdId?: number | undefined;
|
|
24
|
-
}[];
|
|
15
|
+
export declare const markBillingType: (subCampaigns: CampaignGroupModel[], data: IAnalyticCampaignSummary[]) => any[];
|
|
25
16
|
export declare function convertToShowDetail(subCampaigns: CampaignGroupModel[], data: IAnalyticCampaignSummary[], selectedDomains: any[], selectedPlaces: any[]): any[];
|
|
26
|
-
export declare function dataGroupByTimeline(place: any, data:
|
|
17
|
+
export declare function dataGroupByTimeline(place: any, data: DataObject[], timelineType: any): any[][];
|
|
27
18
|
export declare function dataGroupByPlace(subCampaigns: CampaignGroupModel[], ids: any): any[];
|
|
19
|
+
export declare function campaignAnalyticInfo(subCampaigns: CampaignGroupModel[]): {
|
|
20
|
+
analyticTypes: AnalyticType[];
|
|
21
|
+
hasSpot: boolean;
|
|
22
|
+
hasEg: boolean;
|
|
23
|
+
};
|
|
28
24
|
export declare const convertToChartData: (data: IAnalyticCampaignSummary[], campaignGroups: CampaignGroupModel[], time: {
|
|
29
25
|
startDate: Date;
|
|
30
26
|
endDate: Date;
|
|
31
|
-
}) =>
|
|
32
|
-
label: string;
|
|
33
|
-
type: string;
|
|
34
|
-
data: {
|
|
35
|
-
x: string;
|
|
36
|
-
y: number;
|
|
37
|
-
}[];
|
|
38
|
-
fill: boolean;
|
|
39
|
-
pointStyle: string;
|
|
40
|
-
yAxisID: string;
|
|
41
|
-
variant: string;
|
|
42
|
-
} | {
|
|
43
|
-
label?: undefined;
|
|
44
|
-
type?: undefined;
|
|
45
|
-
data?: undefined;
|
|
46
|
-
fill?: undefined;
|
|
47
|
-
pointStyle?: undefined;
|
|
48
|
-
yAxisID?: undefined;
|
|
49
|
-
variant?: undefined;
|
|
50
|
-
})[];
|
|
27
|
+
}) => any[];
|
|
51
28
|
export declare function groupBy<T extends {
|
|
52
29
|
[key: string]: any;
|
|
53
30
|
}, K extends keyof T>(array: T[], key: K): Record<string, T[]>;
|
|
@@ -46,7 +46,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
46
46
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
47
47
|
};
|
|
48
48
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
49
|
-
exports.groupBy = exports.convertToChartData = exports.dataGroupByPlace = exports.dataGroupByTimeline = exports.convertToShowDetail = exports.markBillingType = exports.placesToDomains = exports.convertToExport = exports.convertToExportData = exports.convertToExportDataGroupBy = void 0;
|
|
49
|
+
exports.groupBy = exports.convertToChartData = exports.campaignAnalyticInfo = exports.dataGroupByPlace = exports.dataGroupByTimeline = exports.convertToShowDetail = exports.markBillingType = exports.placesToDomains = exports.convertToExport = exports.convertToExportData = exports.convertToExportDataGroupBy = void 0;
|
|
50
50
|
var Enum_1 = require("../../../../../ACM-AXN/Campaign/Enum");
|
|
51
51
|
var Helpers_1 = require("../../../../../Utils/Helpers");
|
|
52
52
|
var lodash_1 = __importStar(require("lodash"));
|
|
@@ -54,6 +54,8 @@ var i18n_1 = __importDefault(require("../../../../../i18n"));
|
|
|
54
54
|
var Enum_2 = require("../../../../../ACM-AXN/Common/Enum");
|
|
55
55
|
function convertToExportDataGroupBy(data, objects, timelineType, groupBy) {
|
|
56
56
|
var result = [];
|
|
57
|
+
var hasSpot = data.some(function (x) { return x.isSPot; });
|
|
58
|
+
var spotTitle = i18n_1.default.t('Common.Spot');
|
|
57
59
|
var exportData = objects
|
|
58
60
|
.map(function (object, key) {
|
|
59
61
|
var placeIds = object.places.map(function (plc) { return plc.placeId; });
|
|
@@ -73,27 +75,43 @@ function convertToExportDataGroupBy(data, objects, timelineType, groupBy) {
|
|
|
73
75
|
'Time',
|
|
74
76
|
i18n_1.default.t('Common.Impression'),
|
|
75
77
|
i18n_1.default.t('Common.Engagement'),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
spotTitle
|
|
79
|
+
].map(function (item) {
|
|
80
|
+
// eslint-disable-next-line eqeqeq
|
|
81
|
+
if (item == spotTitle && !hasSpot) {
|
|
82
|
+
return '';
|
|
83
|
+
}
|
|
84
|
+
return item;
|
|
85
|
+
}),
|
|
86
|
+
data: exportData.map(function (d) {
|
|
87
|
+
if (!hasSpot) {
|
|
88
|
+
d.pop();
|
|
89
|
+
d.push('');
|
|
90
|
+
}
|
|
91
|
+
return d;
|
|
92
|
+
}),
|
|
81
93
|
});
|
|
82
94
|
return result;
|
|
83
95
|
}
|
|
84
96
|
exports.convertToExportDataGroupBy = convertToExportDataGroupBy;
|
|
85
97
|
function convertToExportData(data, places, timelineType) {
|
|
86
98
|
var result = [];
|
|
99
|
+
var spotTitle = i18n_1.default.t('Common.Spot');
|
|
100
|
+
var hasSpot = data.some(function (x) { return x.isSPot; });
|
|
87
101
|
result.push({
|
|
88
102
|
columns: [
|
|
89
103
|
'Place',
|
|
90
104
|
'Time',
|
|
91
105
|
i18n_1.default.t('Common.Impression'),
|
|
92
|
-
i18n_1.default.t('
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
106
|
+
i18n_1.default.t('Campaign.Engagement'),
|
|
107
|
+
spotTitle,
|
|
108
|
+
].map(function (item) {
|
|
109
|
+
// eslint-disable-next-line eqeqeq
|
|
110
|
+
if (item == spotTitle && !hasSpot) {
|
|
111
|
+
return '';
|
|
112
|
+
}
|
|
113
|
+
return item;
|
|
114
|
+
}),
|
|
97
115
|
data: dataGroupByTimeline('All', data, timelineType),
|
|
98
116
|
});
|
|
99
117
|
Array.prototype.push.apply(result, (0, lodash_1.chain)(data)
|
|
@@ -102,7 +120,7 @@ function convertToExportData(data, places, timelineType) {
|
|
|
102
120
|
var place = places.find(function (x) { return x.placeId === key; });
|
|
103
121
|
var placeData = {
|
|
104
122
|
columns: Array(7).fill(''),
|
|
105
|
-
data: dataGroupByTimeline(place ? place.name : key, value, timelineType)
|
|
123
|
+
data: dataGroupByTimeline(place ? place.name : key, value, timelineType)
|
|
106
124
|
};
|
|
107
125
|
return placeData;
|
|
108
126
|
})
|
|
@@ -113,16 +131,19 @@ exports.convertToExportData = convertToExportData;
|
|
|
113
131
|
function convertToExport(subCampaigns, data, timelineType, places) {
|
|
114
132
|
var result = [];
|
|
115
133
|
var isShouldHeader = true;
|
|
134
|
+
var spotTitle = i18n_1.default.t('Common.Spot');
|
|
116
135
|
subCampaigns.forEach(function (sub) {
|
|
117
136
|
var _a;
|
|
118
137
|
(_a = sub === null || sub === void 0 ? void 0 : sub.ads) === null || _a === void 0 ? void 0 : _a.forEach(function (ad) {
|
|
138
|
+
var hasSpot = false;
|
|
119
139
|
var adData = data
|
|
120
140
|
.filter(function (d) {
|
|
121
141
|
var _a;
|
|
122
142
|
return (d.campaignGroupId === ((_a = sub === null || sub === void 0 ? void 0 : sub.campaignGroup) === null || _a === void 0 ? void 0 : _a.id) &&
|
|
123
143
|
d.campaignAdId === ad.id);
|
|
124
144
|
})
|
|
125
|
-
|
|
145
|
+
// eslint-disable-next-line no-sequences
|
|
146
|
+
.map(function (x) { return (hasSpot = hasSpot || x.isSPot, (__assign(__assign({}, x), Object.assign.apply(Object, __spreadArray(__spreadArray([{}], Object.values(Enum_1.BaseEvent).map(function (v) {
|
|
126
147
|
var _a;
|
|
127
148
|
return (_a = {},
|
|
128
149
|
_a[v] = 0,
|
|
@@ -132,22 +153,31 @@ function convertToExport(subCampaigns, data, timelineType, places) {
|
|
|
132
153
|
return (_a = {},
|
|
133
154
|
_a[y.eventLabel] = y.total,
|
|
134
155
|
_a);
|
|
135
|
-
}), false)))); });
|
|
156
|
+
}), false))))); });
|
|
136
157
|
result.push({
|
|
137
|
-
columns: isShouldHeader
|
|
158
|
+
columns: (isShouldHeader
|
|
138
159
|
? [
|
|
139
160
|
'Sub-campaign',
|
|
140
161
|
'Ad',
|
|
141
162
|
'Place',
|
|
142
163
|
'Time',
|
|
143
164
|
i18n_1.default.t('Common.Impression'),
|
|
144
|
-
i18n_1.default.t("Campaign.
|
|
145
|
-
|
|
146
|
-
"ER (%)",
|
|
147
|
-
"CTR (%)",
|
|
165
|
+
i18n_1.default.t("Campaign.Engagement"),
|
|
166
|
+
spotTitle,
|
|
148
167
|
]
|
|
149
|
-
: Array(
|
|
150
|
-
|
|
168
|
+
: Array(7).fill('')).map(function (item) {
|
|
169
|
+
if (item === spotTitle && !hasSpot) {
|
|
170
|
+
return '';
|
|
171
|
+
}
|
|
172
|
+
return item;
|
|
173
|
+
}),
|
|
174
|
+
data: dataGroupByTimeline('All', adData, timelineType).map(function (d) { var _a; return __spreadArray([(_a = sub === null || sub === void 0 ? void 0 : sub.campaignGroup) === null || _a === void 0 ? void 0 : _a.name, ad === null || ad === void 0 ? void 0 : ad.name], d, true); }).map(function (d) {
|
|
175
|
+
if (!hasSpot) {
|
|
176
|
+
d.pop();
|
|
177
|
+
d.push('');
|
|
178
|
+
}
|
|
179
|
+
return d;
|
|
180
|
+
}),
|
|
151
181
|
});
|
|
152
182
|
isShouldHeader = false;
|
|
153
183
|
Array.prototype.push.apply(result, (0, lodash_1.chain)(adData)
|
|
@@ -155,13 +185,19 @@ function convertToExport(subCampaigns, data, timelineType, places) {
|
|
|
155
185
|
.map(function (value, key) {
|
|
156
186
|
var place = places.find(function (x) { return x.placeId === key; });
|
|
157
187
|
var placeData = {
|
|
158
|
-
columns: Array(
|
|
188
|
+
columns: Array(7).fill(''),
|
|
159
189
|
data: dataGroupByTimeline(place ? (place === null || place === void 0 ? void 0 : place.name) || place.placeId : key, value, timelineType).map(function (d) {
|
|
160
190
|
var _a;
|
|
161
191
|
return __spreadArray([
|
|
162
192
|
(_a = sub === null || sub === void 0 ? void 0 : sub.campaignGroup) === null || _a === void 0 ? void 0 : _a.name,
|
|
163
193
|
ad === null || ad === void 0 ? void 0 : ad.name
|
|
164
194
|
], d, true);
|
|
195
|
+
}).map(function (d) {
|
|
196
|
+
if (!hasSpot) {
|
|
197
|
+
d.pop();
|
|
198
|
+
d.push('');
|
|
199
|
+
}
|
|
200
|
+
return d;
|
|
165
201
|
}),
|
|
166
202
|
};
|
|
167
203
|
return placeData;
|
|
@@ -203,8 +239,20 @@ function placesToDomains(places, domains) {
|
|
|
203
239
|
}
|
|
204
240
|
exports.placesToDomains = placesToDomains;
|
|
205
241
|
var markBillingType = function (subCampaigns, data) { return data.map(function (x, index) {
|
|
206
|
-
var _a
|
|
207
|
-
|
|
242
|
+
var _a;
|
|
243
|
+
// eslint-disable-next-line eqeqeq
|
|
244
|
+
var _b = subCampaigns.find(function (c) { return c.campaignGroup.id == x.campaignGroupId; }), campaignGroup = _b.campaignGroup, ads = _b.ads;
|
|
245
|
+
return __assign(__assign(__assign({}, x), Object.assign.apply(Object, __spreadArray(__spreadArray([{}], Object.values(Enum_1.BaseEvent).map(function (v) {
|
|
246
|
+
var _a;
|
|
247
|
+
return (_a = {},
|
|
248
|
+
_a[v] = 0,
|
|
249
|
+
_a);
|
|
250
|
+
}), false), x.analyticEventSummaries.map(function (y) {
|
|
251
|
+
var _a;
|
|
252
|
+
return (_a = {},
|
|
253
|
+
_a[y.eventLabel] = y.total,
|
|
254
|
+
_a);
|
|
255
|
+
}), false))), { billingUnit: campaignGroup.billingUnit, isSPot: campaignGroup.billingUnit === Enum_2.AnalyticType.AUTHENTICATION && ((_a = ads.find(function (ad) { return ad.id === x.campaignAdId; })) === null || _a === void 0 ? void 0 : _a.type) === Enum_1.AdType.VIDEO });
|
|
208
256
|
}); };
|
|
209
257
|
exports.markBillingType = markBillingType;
|
|
210
258
|
function convertToShowDetail(subCampaigns, data, selectedDomains, selectedPlaces) {
|
|
@@ -254,6 +302,7 @@ function convertToShowDetail(subCampaigns, data, selectedDomains, selectedPlaces
|
|
|
254
302
|
}
|
|
255
303
|
exports.convertToShowDetail = convertToShowDetail;
|
|
256
304
|
function dataGroupByTimeline(place, data, timelineType) {
|
|
305
|
+
var hasSpot = data.some(function (x) { return x.isSPot; });
|
|
257
306
|
var result = (0, lodash_1.chain)(data)
|
|
258
307
|
.groupBy('timeline')
|
|
259
308
|
.map(function (value, key) {
|
|
@@ -262,27 +311,44 @@ function dataGroupByTimeline(place, data, timelineType) {
|
|
|
262
311
|
: 'DD/MM/YYYY, H:mm');
|
|
263
312
|
// let impression = sumBy(value, BaseEvent[AnalyticType.VIEW])
|
|
264
313
|
var impression = (0, lodash_1.sumBy)(value, Enum_1.BaseEvent[Enum_2.AnalyticType.VIEW]);
|
|
265
|
-
var
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
314
|
+
var authen = value.reduce(function (sum, d) {
|
|
315
|
+
if (d.isSPot) {
|
|
316
|
+
return sum + Number((d[Enum_1.BaseEvent[Enum_2.AnalyticType.AUTHENTICATION]] + d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]]) || 0);
|
|
317
|
+
}
|
|
318
|
+
return sum + Number(d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]] || 0);
|
|
319
|
+
}, 0);
|
|
320
|
+
var arr = [place, dateString, impression];
|
|
321
|
+
if (hasSpot) {
|
|
322
|
+
arr.push(0, authen);
|
|
323
|
+
}
|
|
324
|
+
else {
|
|
325
|
+
arr.push(authen, 0);
|
|
326
|
+
}
|
|
270
327
|
return arr;
|
|
271
328
|
})
|
|
272
329
|
.value();
|
|
273
330
|
var impr = (0, lodash_1.sumBy)(data, Enum_1.BaseEvent[Enum_2.AnalyticType.VIEW]);
|
|
274
|
-
var
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
331
|
+
var authen = data.reduce(function (sum, d) {
|
|
332
|
+
if (d.isSPot) {
|
|
333
|
+
return sum + d[Enum_1.BaseEvent[Enum_2.AnalyticType.AUTHENTICATION]] + d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]];
|
|
334
|
+
}
|
|
335
|
+
return sum + d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]];
|
|
336
|
+
}, 0);
|
|
337
|
+
var totalArr = [place, i18n_1.default.t('Schedule.Total'), impr];
|
|
338
|
+
if (hasSpot) {
|
|
339
|
+
totalArr.push(0, authen);
|
|
340
|
+
}
|
|
341
|
+
else {
|
|
342
|
+
totalArr.push(authen, 0);
|
|
343
|
+
}
|
|
344
|
+
result.push(totalArr);
|
|
345
|
+
return result.map(function (d) {
|
|
346
|
+
if (!hasSpot) {
|
|
347
|
+
d.pop();
|
|
348
|
+
d.push('');
|
|
349
|
+
}
|
|
350
|
+
return d;
|
|
351
|
+
});
|
|
286
352
|
}
|
|
287
353
|
exports.dataGroupByTimeline = dataGroupByTimeline;
|
|
288
354
|
function dataGroupByPlace(subCampaigns, ids) {
|
|
@@ -312,14 +378,31 @@ function dataGroupByPlace(subCampaigns, ids) {
|
|
|
312
378
|
.value();
|
|
313
379
|
}
|
|
314
380
|
exports.dataGroupByPlace = dataGroupByPlace;
|
|
381
|
+
function campaignAnalyticInfo(subCampaigns) {
|
|
382
|
+
return {
|
|
383
|
+
analyticTypes: Array.from(new Set(subCampaigns.map(function (x) { return x.campaignGroup.billingUnit; }))),
|
|
384
|
+
hasSpot: subCampaigns.some(function (sub) {
|
|
385
|
+
return sub.ads.some(function (ad) { return ad.type === Enum_1.AdType.VIDEO; }) && sub.campaignGroup.billingUnit === Enum_2.AnalyticType.AUTHENTICATION;
|
|
386
|
+
}),
|
|
387
|
+
hasEg: subCampaigns.some(function (sub) { return sub.ads.some(function (ad) {
|
|
388
|
+
return (ad.type === Enum_1.AdType.VIDEO && sub.campaignGroup.billingUnit !== Enum_2.AnalyticType.AUTHENTICATION) ||
|
|
389
|
+
ad.type !== Enum_1.AdType.VIDEO;
|
|
390
|
+
}) && [Enum_2.AnalyticType.CLICK, Enum_2.AnalyticType.AUTHENTICATION].includes(sub.campaignGroup.billingUnit); }),
|
|
391
|
+
};
|
|
392
|
+
}
|
|
393
|
+
exports.campaignAnalyticInfo = campaignAnalyticInfo;
|
|
315
394
|
var convertToChartData = function (data, campaignGroups, time) {
|
|
316
395
|
var _a;
|
|
396
|
+
var timelineType = 'YYYYMMDD';
|
|
317
397
|
var convertData = Object.assign.apply(Object, __spreadArray([{}], [Enum_1.BaseEvent[Enum_2.AnalyticType.VIEW], 'Spot', 'Engagement'].map(function (x) {
|
|
318
398
|
var _a;
|
|
319
399
|
return (_a = {}, _a[x] = { total: 0, chartData: [] }, _a);
|
|
320
400
|
}), false));
|
|
321
401
|
data.forEach(function (x) {
|
|
322
402
|
var _a;
|
|
403
|
+
if (String(x.timeline).length === 10) {
|
|
404
|
+
timelineType = 'YYYYMMDDHH';
|
|
405
|
+
}
|
|
323
406
|
var subCampaign = campaignGroups.find(function (c) { return c.campaignGroup.id === x.campaignGroupId; });
|
|
324
407
|
if (!subCampaign)
|
|
325
408
|
return;
|
|
@@ -333,11 +416,7 @@ var convertToChartData = function (data, campaignGroups, time) {
|
|
|
333
416
|
var objKey = [
|
|
334
417
|
Enum_1.BaseEvent[Enum_2.AnalyticType.AUTHENTICATION],
|
|
335
418
|
Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK],
|
|
336
|
-
].includes(event.eventLabel)
|
|
337
|
-
? isSpot
|
|
338
|
-
? 'Spot'
|
|
339
|
-
: 'Engagement'
|
|
340
|
-
: event.eventLabel;
|
|
419
|
+
].includes(event.eventLabel) ? isSpot ? 'Spot' : 'Engagement' : event.eventLabel;
|
|
341
420
|
(_a = convertData[objKey]) === null || _a === void 0 ? void 0 : _a.chartData.push({
|
|
342
421
|
y: event.total,
|
|
343
422
|
x: timeline,
|
|
@@ -353,25 +432,23 @@ var convertToChartData = function (data, campaignGroups, time) {
|
|
|
353
432
|
_a['Spot'] = 'Campaign.Spot',
|
|
354
433
|
_a['Engagement'] = 'Campaign.Engagement',
|
|
355
434
|
_a);
|
|
435
|
+
var analyticInfo = campaignAnalyticInfo(campaignGroups);
|
|
356
436
|
return Object.entries(convertData).map(function (_a, index) {
|
|
357
437
|
var key = _a[0], value = _a[1];
|
|
438
|
+
if ((key === 'Spot' && !analyticInfo.hasSpot) ||
|
|
439
|
+
(key === 'Engagement' && !analyticInfo.hasEg))
|
|
440
|
+
return false;
|
|
358
441
|
var data = (0, lodash_1.default)(value.chartData).groupBy('x').map(function (value, key) { return ({ x: key, y: (0, lodash_1.sumBy)(value, 'y') }); }).value();
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
yAxisID: 'y',
|
|
370
|
-
variant: String(index),
|
|
371
|
-
};
|
|
372
|
-
}
|
|
373
|
-
return {};
|
|
374
|
-
}).filter(function (o) { return Object.values(o).length; });
|
|
442
|
+
return {
|
|
443
|
+
label: "".concat(i18n_1.default.t(translate[key]), " ").concat((0, Helpers_1.roundDecimalNumber)(value.total)),
|
|
444
|
+
type: 'line',
|
|
445
|
+
data: (0, Helpers_1.fillMissingDates)(data, time.startDate, time.endDate, timelineType),
|
|
446
|
+
fill: false,
|
|
447
|
+
pointStyle: 'circle',
|
|
448
|
+
yAxisID: 'y',
|
|
449
|
+
variant: String(index),
|
|
450
|
+
};
|
|
451
|
+
}).filter(Boolean);
|
|
375
452
|
};
|
|
376
453
|
exports.convertToChartData = convertToChartData;
|
|
377
454
|
function groupBy(array, key) {
|
|
@@ -24,6 +24,7 @@ var Enum_1 = require("../../../../../ACM-AXN/Campaign/Enum");
|
|
|
24
24
|
var lodash_1 = require("lodash");
|
|
25
25
|
var Context_1 = __importDefault(require("../Context"));
|
|
26
26
|
var exportFile_1 = require("../../../../../ACM-AXN/CampaignSchedule/exportFile");
|
|
27
|
+
var Enum_2 = require("../../../../../ACM-AXN/Common/Enum");
|
|
27
28
|
var AnalyticContainer = function (props) {
|
|
28
29
|
var campaignId = props.campaignId, startDate = props.startDate, endDate = props.endDate, subCampaigns = props.subCampaigns, domains = props.domains;
|
|
29
30
|
var client = (0, Context_1.default)().services;
|
|
@@ -75,6 +76,7 @@ var AnalyticContainer = function (props) {
|
|
|
75
76
|
endDate: (0, moment_1.default)(time.endDate).format(Enum_1.DATE_FORMAT),
|
|
76
77
|
timelineType: timelineType,
|
|
77
78
|
campaignAdGroups: ids.length ? ids.map(function (id) { return (__assign(__assign({}, id), { campaignId: campaignId })); }) : [{ campaignId: campaignId }],
|
|
79
|
+
analyticGroupBies: Object.values(Enum_2.AnalyticGroupBy).filter(function (g) { return !isNaN(Number(g)); }).map(function (g) { return Number(g); }),
|
|
78
80
|
placeIds: placeIds,
|
|
79
81
|
includedEventLabels: Object.values(Enum_1.BaseEvent)
|
|
80
82
|
}).then(function (res) {
|
|
@@ -158,7 +158,12 @@ function Filter(props) {
|
|
|
158
158
|
className: classes.outlinedInput,
|
|
159
159
|
}, callback: handleChangeDateRange, isDayBlocked: function (day) {
|
|
160
160
|
var now = (0, moment_1.default)().endOf('day').valueOf();
|
|
161
|
-
|
|
161
|
+
if (now < day.valueOf()) {
|
|
162
|
+
return true;
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
return false;
|
|
166
|
+
}
|
|
162
167
|
} }) }), (0, jsx_runtime_1.jsx)(SearchCampaign_1.default, { filter: filter, campaigns: campaigns, onUpdateFilter: onUpdateFilter }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", onClick: function () {
|
|
163
168
|
handleChangeQueryInput(dateRangeInput);
|
|
164
169
|
}, style: { height: '40px' }, children: t('Common.View') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", title: t('Common.Download'), onClick: handleChangeExportInput, color: "inherit", disabled: isLoadings, style: {
|
|
@@ -39,6 +39,8 @@ var constants_1 = require("../constants");
|
|
|
39
39
|
var Helpers_1 = require("../../Utils/Helpers");
|
|
40
40
|
var get_1 = __importDefault(require("../Form/Utils/get"));
|
|
41
41
|
var i18n_1 = __importDefault(require("../../i18n"));
|
|
42
|
+
var lodash_1 = require("lodash");
|
|
43
|
+
var Constant_1 = require("../../ACM-AXN/Common/Constant");
|
|
42
44
|
var StyledTableRow = (0, styles_1.styled)(material_1.TableRow)({
|
|
43
45
|
'& .MuiTableCell-root:last-child .MuiButtonBase-root': {
|
|
44
46
|
visibility: 'hidden',
|
|
@@ -177,6 +179,10 @@ var DataGrid = function (props) {
|
|
|
177
179
|
}
|
|
178
180
|
};
|
|
179
181
|
var calcOrder = function (index) { return pageIndex * pageSize + 1 + index; };
|
|
182
|
+
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
183
|
+
var handleAction = react_1.default.useCallback((0, lodash_1.debounce)(function (rowAction, id) {
|
|
184
|
+
rowAction.action(id);
|
|
185
|
+
}, Constant_1.Constants.DEBOUNCE_TIME_300), []);
|
|
180
186
|
return ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)(material_1.TableContainer, { component: material_1.Paper, children: [(0, jsx_runtime_1.jsxs)(material_1.Table, { "aria-label": "simple table", style: { tableLayout: 'fixed' }, children: [!hideHeader && ((0, jsx_runtime_1.jsx)(material_1.TableHead, { children: (0, jsx_runtime_1.jsxs)(material_1.TableRow, { children: [selected && onSelectedChange && ((0, jsx_runtime_1.jsx)(material_1.TableCell, { padding: "checkbox", children: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", indeterminate: selected.length > 0 &&
|
|
181
187
|
selected.length < rows.length, checked: selected.length > 0 &&
|
|
182
188
|
selected.length === rows.length, onChange: function () { return handleSelectAll(); }, inputProps: {
|
|
@@ -255,7 +261,7 @@ var DataGrid = function (props) {
|
|
|
255
261
|
: undefined, title: actionDef.tooltipTitle, children: (0, jsx_runtime_1.jsx)(material_1.IconButton, { onClick: function (e) {
|
|
256
262
|
if (!isShouldHide) {
|
|
257
263
|
e.stopPropagation();
|
|
258
|
-
actionDef
|
|
264
|
+
handleAction(actionDef, id);
|
|
259
265
|
}
|
|
260
266
|
}, style: {
|
|
261
267
|
marginLeft: '4px',
|
|
@@ -235,36 +235,54 @@ var DateRangePickerWrapper = function (props) {
|
|
|
235
235
|
onDatesChange(daterange);
|
|
236
236
|
// setFocusedInput(null);
|
|
237
237
|
};
|
|
238
|
+
var getDataSet = function (moment) {
|
|
239
|
+
return moment.set({
|
|
240
|
+
hour: 0,
|
|
241
|
+
minute: 0,
|
|
242
|
+
second: 0,
|
|
243
|
+
millisecond: 0,
|
|
244
|
+
});
|
|
245
|
+
};
|
|
246
|
+
var resetDate = function () {
|
|
247
|
+
setStartDate(initialStartDate);
|
|
248
|
+
setEndDate(initialEndDate);
|
|
249
|
+
setInputValue("".concat(moment(initialStartDate).format('DD/MM/YYYY'), " - ").concat(moment(initialEndDate).format('DD/MM/YYYY')));
|
|
250
|
+
callback({
|
|
251
|
+
startDate: getDataSet(moment(initialStartDate, 'DD/MM/YYYY')),
|
|
252
|
+
endDate: getDataSet(moment(initialEndDate, 'DD/MM/YYYY')),
|
|
253
|
+
});
|
|
254
|
+
};
|
|
238
255
|
var handleChangeInput = function (e) {
|
|
239
256
|
var fieldValue = e.target.value;
|
|
240
257
|
setInputValue(fieldValue);
|
|
241
258
|
var fieldValueArr = (fieldValue === null || fieldValue === void 0 ? void 0 : fieldValue.split(' - ')) || [];
|
|
242
259
|
var year1900 = moment('1900-01-01');
|
|
243
260
|
var momentStartDate = moment(fieldValueArr[0], 'DD/MM/YYYY');
|
|
261
|
+
var momentEndDate = moment(fieldValueArr[1], 'DD/MM/YYYY');
|
|
262
|
+
if (isDayBlocked && isDayBlocked(momentStartDate)) {
|
|
263
|
+
setIsValid(true);
|
|
264
|
+
resetDate();
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
if (isDayBlocked && isDayBlocked(momentEndDate)) {
|
|
268
|
+
setIsValid(true);
|
|
269
|
+
resetDate();
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
244
272
|
if (momentStartDate.isValid() && momentStartDate.diff(year1900) >= 0) {
|
|
245
273
|
setStartDate(momentStartDate);
|
|
246
274
|
}
|
|
247
|
-
var momentEndDate = moment(fieldValueArr[1], 'DD/MM/YYYY');
|
|
248
275
|
if (momentEndDate.isValid() && momentEndDate.diff(year1900) >= 0) {
|
|
249
276
|
setEndDate(momentEndDate);
|
|
250
277
|
}
|
|
251
278
|
if (moment(fieldValueArr[0], 'DD/MM/YYYY', true).isValid() &&
|
|
252
279
|
moment(fieldValueArr[1], 'DD/MM/YYYY', true).isValid() &&
|
|
253
280
|
momentEndDate.diff(momentStartDate) >= 0) {
|
|
254
|
-
momentStartDate.set({
|
|
255
|
-
hour: 0,
|
|
256
|
-
minute: 0,
|
|
257
|
-
second: 0,
|
|
258
|
-
millisecond: 0,
|
|
259
|
-
});
|
|
260
|
-
momentEndDate.set({
|
|
261
|
-
hour: 0,
|
|
262
|
-
minute: 0,
|
|
263
|
-
second: 0,
|
|
264
|
-
millisecond: 0,
|
|
265
|
-
});
|
|
266
|
-
callback({ startDate: momentStartDate, endDate: momentEndDate });
|
|
267
281
|
setIsValid(true);
|
|
282
|
+
callback({
|
|
283
|
+
startDate: getDataSet(momentStartDate),
|
|
284
|
+
endDate: getDataSet(momentEndDate),
|
|
285
|
+
});
|
|
268
286
|
}
|
|
269
287
|
else
|
|
270
288
|
setIsValid(false);
|
package/lib/Utils/Helpers.d.ts
CHANGED
|
@@ -108,7 +108,7 @@ export declare const setObject: <O extends {}>(obj: O, arrKey: Array<keyof O>, v
|
|
|
108
108
|
export declare function fillMissingDates(data: Array<{
|
|
109
109
|
x: string;
|
|
110
110
|
y: number;
|
|
111
|
-
}>, startDate?: string | Date | number, endDate?: string | Date | number, format?: 'YYYYMMDD' | 'YYYYMMDDHH'): {
|
|
111
|
+
}>, startDate?: string | Date | number, endDate?: string | Date | number, format?: string | 'YYYYMMDD' | 'YYYYMMDDHH'): {
|
|
112
112
|
x: string;
|
|
113
113
|
y: number;
|
|
114
114
|
}[];
|