awing-library 2.1.142-beta → 2.1.144-beta

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.
@@ -8,6 +8,10 @@ interface Props {
8
8
  subCampaigns: CampaignGroupModel[];
9
9
  ids: any;
10
10
  onCampaignAdGroupIdChange: (newValue: string[]) => void;
11
+ time: {
12
+ startDate: Date;
13
+ endDate: Date;
14
+ };
11
15
  }
12
16
  declare const ChartWithType: (props: Props) => import("react/jsx-runtime").JSX.Element;
13
17
  export default ChartWithType;
@@ -4,6 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  var jsx_runtime_1 = require("react/jsx-runtime");
7
+ /* eslint-disable eqeqeq */
7
8
  var react_i18next_1 = require("react-i18next");
8
9
  var material_1 = require("@mui/material");
9
10
  var i18n_1 = __importDefault(require("../../../../../i18n"));
@@ -77,26 +78,6 @@ var ChartWithType = function (props) {
77
78
  // console.log("valuddde", value, result)
78
79
  onCampaignAdGroupIdChange(result);
79
80
  };
80
- // const getValue = useMemo(() => {
81
- // let result: any[] = []
82
- // if (ids.campaignGroupId) {
83
- // let tmpSelected: any[] = []
84
- // const group = groupOptions.find(
85
- // (g) => g.code === ids.campaignGroupId?.toString()
86
- // )
87
- // tmpSelected = [group]
88
- // if (ids.campaignAdId) {
89
- // const ad = groupOptions.find(
90
- // (g) =>
91
- // g.code === `${ids.campaignGroupId}&${ids.campaignAdId}`
92
- // )
93
- // tmpSelected = [group, ad];
94
- // }
95
- // result.push(tmpSelected)
96
- // }
97
- // console.log("result", result)
98
- // return result
99
- // }, [groupOptions, ids.campaignAdId, ids.campaignGroupId])
100
81
  var getValue = function () {
101
82
  var final = [];
102
83
  ids.forEach(function (id) {
@@ -115,7 +96,7 @@ var ChartWithType = function (props) {
115
96
  });
116
97
  return final;
117
98
  };
118
- return ((0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 1, sx: styles.root, children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 3 }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, children: (0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, variant: "outlined", children: (0, jsx_runtime_1.jsx)(MultipleHierarchicalChoice_1.MultipleHierarchicalChoice, { onChange: handleGroupChange, options: groupOptions, placeholder: t('Campaign.SelectGroup'), label: translationText.timeline, value: getValue() }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 2, children: (0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, variant: "outlined", children: (0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: translationText.timeline, id: "timelineType", name: "timelineType", value: timelineType, onChange: function (e) { return setTimelineType(e.target.value); }, size: "small", variant: "outlined", children: ChartByType.map(function (type, idx) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: idx, children: type }, idx)); }) }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 2, children: (0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, variant: "outlined", children: (0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: t('Campaign.StatisticType'), id: "statisticType", name: "statisticType", value: statisticType, onChange: function (e) { return setStatisticType(e.target.value); }, size: "small", variant: "outlined", children: SType.map(function (type, idx) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: idx, children: type }, idx)); }) }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 1 }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, sx: styles.chart, children: statisticType === 0 ? ((0, jsx_runtime_1.jsx)(material_1.Box, { component: 'div', sx: styles.chartWrapper, children: (0, jsx_runtime_1.jsx)(AWING_1.BarLineComponent, { chart: chart, dataChart: (0, Utils_1.convertToChartData)(statisticalData, subCampaigns), type: 'line', data: [], timeline: timelineType, optionCustom: {
99
+ return ((0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 1, sx: styles.root, children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 3 }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, children: (0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, variant: "outlined", children: (0, jsx_runtime_1.jsx)(MultipleHierarchicalChoice_1.MultipleHierarchicalChoice, { onChange: handleGroupChange, options: groupOptions, placeholder: t('Campaign.SelectGroup'), label: translationText.timeline, value: getValue() }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 2, children: (0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, variant: "outlined", children: (0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: translationText.timeline, id: "timelineType", name: "timelineType", value: timelineType, onChange: function (e) { return setTimelineType(e.target.value); }, size: "small", variant: "outlined", children: ChartByType.map(function (type, idx) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: idx, children: type }, idx)); }) }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 2, children: (0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, variant: "outlined", children: (0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: t('Campaign.StatisticType'), id: "statisticType", name: "statisticType", value: statisticType, onChange: function (e) { return setStatisticType(e.target.value); }, size: "small", variant: "outlined", children: SType.map(function (type, idx) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: idx, children: type }, idx)); }) }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 1 }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, sx: styles.chart, children: statisticType === 0 ? ((0, jsx_runtime_1.jsx)(material_1.Box, { component: 'div', sx: styles.chartWrapper, children: (0, jsx_runtime_1.jsx)(AWING_1.BarLineComponent, { chart: chart, dataChart: (0, Utils_1.convertToChartData)(statisticalData, subCampaigns, props.time), type: 'line', data: [], timeline: timelineType, optionCustom: {
119
100
  scales: {
120
101
  y: {
121
102
  title: {
@@ -1,5 +1,5 @@
1
1
  import { CampaignGroupModel } from '../../../../../ACM-AXN/Campaign/Types';
2
- import { IAnalyticCampaignSummary, IAnalyticEventSummary } from '../Types';
2
+ import { IAnalyticCampaignSummary } from '../Types';
3
3
  import { AnalyticType } from '../../../../../ACM-AXN/Common/Enum';
4
4
  export declare function convertToExportDataGroupBy(data: any, objects: any, timelineType: any, groupBy: any): {
5
5
  columns: any[];
@@ -18,14 +18,17 @@ export declare const markBillingType: (subCampaigns: CampaignGroupModel[], data:
18
18
  placeId?: string | undefined;
19
19
  domainId?: string | undefined;
20
20
  timeline?: number | undefined;
21
- analyticEventSummaries: IAnalyticEventSummary[];
21
+ analyticEventSummaries: import("../Types").IAnalyticEventSummary[];
22
22
  campaignGroupId?: number | undefined;
23
23
  campaignAdId?: number | undefined;
24
24
  }[];
25
25
  export declare function convertToShowDetail(subCampaigns: CampaignGroupModel[], data: IAnalyticCampaignSummary[], selectedDomains: any[], selectedPlaces: any[]): any[];
26
26
  export declare function dataGroupByTimeline(place: any, data: any, timelineType: any): any[][];
27
27
  export declare function dataGroupByPlace(subCampaigns: CampaignGroupModel[], ids: any): any[];
28
- export declare const convertToChartData: (data: IAnalyticCampaignSummary[], campaignGroups: CampaignGroupModel[]) => ({
28
+ export declare const convertToChartData: (data: IAnalyticCampaignSummary[], campaignGroups: CampaignGroupModel[], time: {
29
+ startDate: Date;
30
+ endDate: Date;
31
+ }) => ({
29
32
  label: string;
30
33
  type: string;
31
34
  data: {
@@ -303,18 +303,14 @@ function dataGroupByPlace(subCampaigns, ids) {
303
303
  .value();
304
304
  }
305
305
  exports.dataGroupByPlace = dataGroupByPlace;
306
- var convertToChartData = function (data, campaignGroups) {
306
+ var convertToChartData = function (data, campaignGroups, time) {
307
307
  var _a;
308
- var convertData = Object.assign.apply(Object, __spreadArray([{}], [Enum_1.BaseEvent[Enum_2.AnalyticType.VIEW], Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK], 'Spot', 'Engagement'].map(function (x) {
308
+ var convertData = Object.assign.apply(Object, __spreadArray([{}], [Enum_1.BaseEvent[Enum_2.AnalyticType.VIEW], 'Spot', 'Engagement'].map(function (x) {
309
309
  var _a;
310
310
  return (_a = {}, _a[x] = { total: 0, chartData: [] }, _a);
311
311
  }), false));
312
- var startDate = Number.MAX_SAFE_INTEGER;
313
- var endDate = 0;
314
312
  data.forEach(function (x) {
315
313
  var _a;
316
- startDate = Math.min(startDate, Number(x.timeline));
317
- endDate = Math.max(endDate, Number(x.timeline));
318
314
  var subCampaign = campaignGroups.find(function (c) { return c.campaignGroup.id === x.campaignGroupId; });
319
315
  if (!subCampaign)
320
316
  return;
@@ -325,7 +321,14 @@ var convertToChartData = function (data, campaignGroups) {
325
321
  x.analyticEventSummaries.forEach(function (event) {
326
322
  var _a;
327
323
  if ([Enum_1.BaseEvent[billingUnit], Enum_1.BaseEvent[Enum_2.AnalyticType.VIEW]].includes(event.eventLabel)) {
328
- var objKey = event.eventLabel === Enum_1.BaseEvent[Enum_2.AnalyticType.AUTHENTICATION] ? isSpot ? 'Spot' : 'Engagement' : event.eventLabel;
324
+ var objKey = [
325
+ Enum_1.BaseEvent[Enum_2.AnalyticType.AUTHENTICATION],
326
+ Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK],
327
+ ].includes(event.eventLabel)
328
+ ? isSpot
329
+ ? 'Spot'
330
+ : 'Engagement'
331
+ : event.eventLabel;
329
332
  (_a = convertData[objKey]) === null || _a === void 0 ? void 0 : _a.chartData.push({
330
333
  y: event.total,
331
334
  x: timeline,
@@ -338,7 +341,6 @@ var convertToChartData = function (data, campaignGroups) {
338
341
  });
339
342
  var translate = (_a = {},
340
343
  _a[Enum_1.BaseEvent[Enum_2.AnalyticType.VIEW]] = 'Common.Impression',
341
- _a[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]] = 'Statistics.NumberOfConnections',
342
344
  _a['Spot'] = 'Campaign.Spot',
343
345
  _a['Engagement'] = 'Campaign.Engagement',
344
346
  _a);
@@ -352,7 +354,7 @@ var convertToChartData = function (data, campaignGroups) {
352
354
  return {
353
355
  label: "".concat(i18n_1.default.t(translate[key]), " ").concat((0, Helpers_1.roundDecimalNumber)(value.total)),
354
356
  type: 'line',
355
- data: (0, Helpers_1.fillMissingDates)(data, startDate, endDate),
357
+ data: (0, Helpers_1.fillMissingDates)(data, time.startDate, time.endDate),
356
358
  fill: false,
357
359
  pointStyle: 'circle',
358
360
  yAxisID: 'y',
@@ -72,6 +72,6 @@ var Analytic = function (props) {
72
72
  };
73
73
  return ((0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 2, children: [(0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, children: (0, jsx_runtime_1.jsx)(ChartFilter_1.default, { subCampaigns: subCampaigns, queryInput: queryInput, onChangeQueryInput: changeQueryInput, onQueryData: queryData, isExportType: true, onExportData: function (exportType) {
74
74
  return exportData(queryInput.time, queryInput.placeIds, queryInput.timelineType, exportType, queryInput.ids);
75
- }, domains: domains }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { marginTop: '20px' }, children: isLoading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(ChartWithType_1.default, { statisticalData: statisticalData, subCampaigns: subCampaigns, ids: queryInput.ids, onCampaignAdGroupIdChange: handleChangeAdGroupId, statisticType: queryInput.statisticType, setStatisticType: changeStatisticType, timelineType: queryInput.timelineType, setTimelineType: changeTimelineType })) })] }));
75
+ }, domains: domains }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 12, style: { marginTop: '20px' }, children: isLoading ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, {})) : ((0, jsx_runtime_1.jsx)(ChartWithType_1.default, { statisticalData: statisticalData, subCampaigns: subCampaigns, ids: queryInput.ids, onCampaignAdGroupIdChange: handleChangeAdGroupId, statisticType: queryInput.statisticType, setStatisticType: changeStatisticType, timelineType: queryInput.timelineType, setTimelineType: changeTimelineType, time: queryInput.time })) })] }));
76
76
  };
77
77
  exports.default = Analytic;
@@ -79,7 +79,7 @@ var LimitEvent = function (props) {
79
79
  return handleChangeParameter('eventLabel', e.target.value);
80
80
  }, error: valids && !valids.eventLabel, helperText: valids && !valids.eventLabel
81
81
  ? translationText.helperText
82
- : '', children: Object.keys(eventSelected).map(function (event, index) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: event, children: event }, index)); }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 6, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "viewNumber", name: "viewNumber", variant: "standard", disabled: !((_c = rule === null || rule === void 0 ? void 0 : rule.parameter) === null || _c === void 0 ? void 0 : _c.eventLabel), required: true, select: true, fullWidth: true, label: translationText.viewNumber, value: (_e = (_d = rule === null || rule === void 0 ? void 0 : rule.parameter) === null || _d === void 0 ? void 0 : _d.viewNumber) !== null && _e !== void 0 ? _e : '', onChange: function (e) {
82
+ : '', children: Object.keys(eventSelected).map(function (event, index) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: event, children: event }, index)); }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 6, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "viewNumber", name: "viewNumber", variant: "standard", disabled: !((_c = rule === null || rule === void 0 ? void 0 : rule.parameter) === null || _c === void 0 ? void 0 : _c.eventLabel), required: true, select: true, fullWidth: true, label: translationText.viewNumber, value: (_e = (_d = rule === null || rule === void 0 ? void 0 : rule.parameter) === null || _d === void 0 ? void 0 : _d.viewNumber) !== null && _e !== void 0 ? _e : "", onChange: function (e) {
83
83
  return handleChangeParameter('viewNumber', e.target.value);
84
84
  }, error: valids && !valids.viewNumber, helperText: valids && !valids.viewNumber
85
85
  ? translationText.helperText
@@ -50,6 +50,7 @@ var TabLabel_1 = __importDefault(require("../../../Commons/Components/TabLabel")
50
50
  var usePath_1 = __importDefault(require("../../../Commons/Hooks/usePath"));
51
51
  var Wrapper_1 = __importDefault(require("../../../AWING/HOC/Wrapper"));
52
52
  var TabStatistic_1 = __importDefault(require("./TabStatistic"));
53
+ var Enum_2 = require("../../../ACM-AXN/Common/Enum");
53
54
  var route = [
54
55
  Constant_1.Constants.CAMPAIGN_INFORMATION,
55
56
  Constant_1.Constants.CAMPAIGN_SUBCAMPAIGN,
@@ -69,7 +70,7 @@ var CreateOrEdit = function () {
69
70
  var setCampaignPages = (0, recoil_1.useSetRecoilState)(atoms_1.campaignPageIdState);
70
71
  var setDirectories = (0, recoil_1.useSetRecoilState)(Recoils_1.directoriesState);
71
72
  var setAttributes = (0, recoil_1.useSetRecoilState)(Recoils_1.attributesState);
72
- var confirmExit = (0, recoil_1.useRecoilValue)(Recoils_1.confirmExitState);
73
+ var _e = (0, recoil_1.useRecoilState)(Recoils_1.confirmExitState), confirmExit = _e[0], setConfirmExit = _e[1];
73
74
  var readyForSubmit = (0, recoil_1.useRecoilValue)(Recoils_1.readyForSubmitState);
74
75
  var setCreate = (0, recoil_1.useSetRecoilState)(Recoils_1.isCreateState);
75
76
  var tabValid = {
@@ -77,8 +78,8 @@ var CreateOrEdit = function () {
77
78
  tabSubCampaignValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabSubCampaignValidState),
78
79
  tabPartnerValid: (0, recoil_1.useRecoilValue)(Recoils_1.tabPartnerValidState),
79
80
  };
80
- var _e = (0, react_1.useState)('0'), value = _e[0], setValue = _e[1];
81
- var _f = (0, react_1.useState)(true), loading = _f[0], setLoading = _f[1];
81
+ var _f = (0, react_1.useState)('0'), value = _f[0], setValue = _f[1];
82
+ var _g = (0, react_1.useState)(true), loading = _g[0], setLoading = _g[1];
82
83
  var componentStatus = (0, react_1.useMemo)(function () {
83
84
  return location.pathname.includes(Constant_1.Constants.CAMPAIGN_DETAIL) &&
84
85
  !!campaignId
@@ -181,10 +182,13 @@ var CreateOrEdit = function () {
181
182
  });
182
183
  }
183
184
  else {
185
+ setConfirmExit(true);
184
186
  campaignModel.campaign.name += ' - copy';
185
187
  campaignModel.campaign.createdDate = undefined;
186
188
  campaignModel.campaignGroups.forEach(function (g) {
187
189
  g.campaignGroup.ticket = Enum_1.CampaignTicket.INACTIVE;
190
+ if (!service.attributesGetByObjectTypeCode)
191
+ g.campaignGroup.billingUnit = Enum_2.AnalyticType.AUTHENTICATION;
188
192
  });
189
193
  }
190
194
  setCampaignData(campaignModel);
@@ -219,7 +223,7 @@ var CreateOrEdit = function () {
219
223
  return service.campaignsPost(dataSubmit);
220
224
  }
221
225
  };
222
- return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: "".concat(t(['Campaign', campaignId ? 'TitleDetail' : 'Create'].join('.'))).concat(campaignId ? ": ".concat((_a = campaignData === null || campaignData === void 0 ? void 0 : campaignData.campaign) === null || _a === void 0 ? void 0 : _a.name) : '', "\n "), onSubmit: handleSubmit, disableButtonSubmit: !readyForSubmit, confirmExit: confirmExit, childrenWrapperStyle: { padding: 0 }, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, sx: {
226
+ return ((0, jsx_runtime_1.jsx)(ClassicDrawer_1.default, { title: "".concat(t(['Campaign', campaignId ? 'TitleDetail' : 'Create'].join('.'))).concat(campaignId ? ": ".concat((_a = campaignData === null || campaignData === void 0 ? void 0 : campaignData.campaign) === null || _a === void 0 ? void 0 : _a.name) : '', "\n "), onSubmit: handleSubmit, disableButtonSubmit: !readyForSubmit || !confirmExit, confirmExit: confirmExit, childrenWrapperStyle: { padding: 0 }, children: (0, jsx_runtime_1.jsx)(material_1.Grid, { container: true, sx: {
223
227
  display: 'flex',
224
228
  flexDirection: 'column',
225
229
  flexGrow: 1,
@@ -194,7 +194,7 @@ function DataInput(props) {
194
194
  } })));
195
195
  }
196
196
  case 'select': {
197
- return ((0, jsx_runtime_1.jsxs)(material_1.TextField, __assign({ id: fieldName.toString(), name: fieldName.toString(), fullWidth: true, select: true, variant: "standard", value: value !== null && value !== void 0 ? value : '', onChange: function (event) {
197
+ return ((0, jsx_runtime_1.jsxs)(material_1.TextField, __assign({ id: fieldName.toString(), name: fieldName.toString(), fullWidth: true, select: true, variant: "standard", value: value !== null && value !== void 0 ? value : "", onChange: function (event) {
198
198
  var newValue = fieldDefinition.multiple
199
199
  ? event.target.value.split(',')
200
200
  : event.target.value;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.142-beta",
3
+ "version": "2.1.144-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",