awing-library 2.1.166-dev → 2.1.168-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.
@@ -104,6 +104,9 @@ var ChartWithType = function (props) {
104
104
  },
105
105
  beginAtZero: true
106
106
  },
107
+ yAxis: {
108
+ display: false,
109
+ },
107
110
  },
108
111
  } }) })) : ((0, jsx_runtime_1.jsx)(Detail_1.default, { statisticalData: statisticalData })) })] }));
109
112
  };
@@ -446,7 +446,7 @@ var convertToChartData = function (data, campaignGroups, time) {
446
446
  fill: false,
447
447
  pointStyle: 'circle',
448
448
  yAxisID: 'y',
449
- variant: String(index),
449
+ variant: key,
450
450
  };
451
451
  }).filter(Boolean);
452
452
  };
@@ -10,29 +10,6 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- var desc = Object.getOwnPropertyDescriptor(m, k);
16
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
- desc = { enumerable: true, get: function() { return m[k]; } };
18
- }
19
- Object.defineProperty(o, k2, desc);
20
- }) : (function(o, m, k, k2) {
21
- if (k2 === undefined) k2 = k;
22
- o[k2] = m[k];
23
- }));
24
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
- Object.defineProperty(o, "default", { enumerable: true, value: v });
26
- }) : function(o, v) {
27
- o["default"] = v;
28
- });
29
- var __importStar = (this && this.__importStar) || function (mod) {
30
- if (mod && mod.__esModule) return mod;
31
- var result = {};
32
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
- __setModuleDefault(result, mod);
34
- return result;
35
- };
36
13
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
37
14
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
38
15
  if (ar || !(i in from)) {
@@ -42,12 +19,15 @@ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
42
19
  }
43
20
  return to.concat(ar || Array.prototype.slice.call(from));
44
21
  };
22
+ var __importDefault = (this && this.__importDefault) || function (mod) {
23
+ return (mod && mod.__esModule) ? mod : { "default": mod };
24
+ };
45
25
  Object.defineProperty(exports, "__esModule", { value: true });
46
26
  exports.convertToExportData = exports.convertEventData = void 0;
47
27
  var Helpers_1 = require("../../../../../Utils/Helpers");
48
- var lodash_1 = __importStar(require("lodash"));
28
+ var lodash_1 = __importDefault(require("lodash"));
49
29
  var Utils_1 = require("../Utils");
50
- var convertEventData = function (data) { return (0, lodash_1.uniqBy)(data.map(function (el) {
30
+ var convertEventData = function (data) { return data.map(function (el) {
51
31
  return el.analyticEventSummaries.map(function (x, index, events) { return ({
52
32
  timeline: el.timeline,
53
33
  eventLabel: (0, Utils_1.extractEvent)(x.eventLabel).eventName,
@@ -58,7 +38,7 @@ var convertEventData = function (data) { return (0, lodash_1.uniqBy)(data.map(fu
58
38
  })
59
39
  .reduce(function (total, e) { return total + e.total; }, 0),
60
40
  }); });
61
- }).flat(), "eventLabel"); };
41
+ }).flat(); };
62
42
  exports.convertEventData = convertEventData;
63
43
  function convertToExportData(data, places) {
64
44
  var headCell = new Set(['Place', 'Mac Address', 'Created date', 'View Number', 'Event label']);
@@ -27,7 +27,10 @@ var getTime = function (subCampaigns) {
27
27
  exports.getTime = getTime;
28
28
  var extractEvent = function (eventLabel) {
29
29
  if (eventLabel === void 0) { eventLabel = ''; }
30
- var _a = eventLabel.match(/^(\d+)_([\s\S]*)$/) || [], view = _a[1], eventName = _a[2];
30
+ if (!eventLabel) {
31
+ throw new Error('Event label is required');
32
+ }
33
+ var _a = eventLabel.match(/^(\d+)_([\s\S]*)$/) || ['', '1', eventLabel], view = _a[1], eventName = _a[2];
31
34
  return { view: view, eventName: eventName };
32
35
  };
33
36
  exports.extractEvent = extractEvent;
@@ -133,6 +133,7 @@ function SubCampaignDetail(props) {
133
133
  ? translationText.helperText
134
134
  : '', children: Object.values(Enum_2.AnalyticType)
135
135
  .filter(function (item) { return !isNaN(Number(item)); })
136
+ .filter(Boolean)
136
137
  .map(function (type) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: type, children: t("Campaign.BillingUnit.".concat((0, lodash_1.capitalize)((0, lodash_1.camelCase)(Enum_2.AnalyticType[type])))) }, type)); }) }) })] })), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: 4, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { checked: subCampaign.isReserved, onChange: function (e) {
137
138
  e.persist();
138
139
  onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { isReserved: e.target.checked })); });
@@ -130,13 +130,13 @@ export declare enum AdType {
130
130
  export declare enum CampaignRuleType {
131
131
  LimitView = 0,
132
132
  LimitClick = 1,
133
+ Authentication = 8,
133
134
  LimitEvent = 2,
134
135
  TargetGender = 3,
135
136
  TargetAge = 4,
136
137
  TargetOS = 5,
137
138
  TargetDevice = 6,
138
- RetargetMacAddress = 7,
139
- Authentication = 8
139
+ RetargetMacAddress = 7
140
140
  }
141
141
  /**
142
142
  * Enum bao gồm các phép toán
@@ -117,13 +117,13 @@ var CampaignRuleType;
117
117
  (function (CampaignRuleType) {
118
118
  CampaignRuleType[CampaignRuleType["LimitView"] = 0] = "LimitView";
119
119
  CampaignRuleType[CampaignRuleType["LimitClick"] = 1] = "LimitClick";
120
+ CampaignRuleType[CampaignRuleType["Authentication"] = 8] = "Authentication";
120
121
  CampaignRuleType[CampaignRuleType["LimitEvent"] = 2] = "LimitEvent";
121
122
  CampaignRuleType[CampaignRuleType["TargetGender"] = 3] = "TargetGender";
122
123
  CampaignRuleType[CampaignRuleType["TargetAge"] = 4] = "TargetAge";
123
124
  CampaignRuleType[CampaignRuleType["TargetOS"] = 5] = "TargetOS";
124
125
  CampaignRuleType[CampaignRuleType["TargetDevice"] = 6] = "TargetDevice";
125
126
  CampaignRuleType[CampaignRuleType["RetargetMacAddress"] = 7] = "RetargetMacAddress";
126
- CampaignRuleType[CampaignRuleType["Authentication"] = 8] = "Authentication";
127
127
  })(CampaignRuleType || (exports.CampaignRuleType = CampaignRuleType = {}));
128
128
  /**
129
129
  * Enum bao gồm các phép toán
@@ -109,7 +109,7 @@ function Container() {
109
109
  },
110
110
  {
111
111
  field: 'totalRun',
112
- headerName: "".concat(t('CampaignPlan.HasRun'), " (").concat(t('Common.BillingUnit'), ")"),
112
+ headerName: "".concat(t('CampaignPlan.HasRun'), " (").concat(t('Campaign.BillingUnit.Title'), ")"),
113
113
  type: 'number',
114
114
  width: 200,
115
115
  TableCellProps: {
@@ -118,7 +118,7 @@ function Container() {
118
118
  },
119
119
  {
120
120
  field: 'totalExpected',
121
- headerName: "".concat(t('CampaignPlan.WillRun'), " (").concat(t('Common.BillingUnit'), ")"),
121
+ headerName: "".concat(t('CampaignPlan.WillRun'), " (").concat(t('Campaign.BillingUnit.Title'), ")"),
122
122
  valueGetter: function (row) {
123
123
  return row.isContainClassB
124
124
  ? (0, Helpers_1.formatNumber)(row.totalExpected)
@@ -78,7 +78,7 @@ function CampaignPlanDetail() {
78
78
  },
79
79
  {
80
80
  field: 'totalRun',
81
- headerName: "".concat(t('CampaignPlan.HasRun'), " (").concat(t('Common.BillingUnit'), ")"),
81
+ headerName: "".concat(t('CampaignPlan.HasRun'), " (").concat(t('Campaign.BillingUnit.Title'), ")"),
82
82
  type: 'number',
83
83
  TableCellProps: {
84
84
  align: 'right',
@@ -86,7 +86,7 @@ function CampaignPlanDetail() {
86
86
  },
87
87
  {
88
88
  field: 'totalExpected',
89
- headerName: "".concat(t('CampaignPlan.WillRun'), " (").concat(t('Common.BillingUnit'), ")"),
89
+ headerName: "".concat(t('CampaignPlan.WillRun'), " (").concat(t('Campaign.BillingUnit.Title'), ")"),
90
90
  valueGetter: function (row) {
91
91
  return row.priority ===
92
92
  Utils_1.CAMPAIGN_PRIORITY.CLASS_B
@@ -96,7 +96,7 @@ var Filters = function (_a) {
96
96
  setTypeView({
97
97
  type: e.target.value,
98
98
  });
99
- }, children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.billingUnit, children: t('Common.BillingUnit') }), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.impression, children: t('Common.Impression') })] })] }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: disabledCampaignFilter ? 6 : 3, className: classes.dateRangePicker, children: (0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, { isShowCalendarInfo: true, isFutureDate: isFutureDate !== null && isFutureDate !== void 0 ? isFutureDate : true, label: "".concat(t('Common.StartDate'), " - ").concat(t('Common.EndDate')), callback: handleChangeDateRange, initialStartDate: (0, moment_1.default)(), initialEndDate: (0, moment_1.default)(), variant: "outlined", textFieldProps: {
99
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.billingUnit, children: t('Campaign.BillingUnit.Title') }), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.impression, children: t('Common.Impression') })] })] }) })), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: disabledCampaignFilter ? 6 : 3, className: classes.dateRangePicker, children: (0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, { isShowCalendarInfo: true, isFutureDate: isFutureDate !== null && isFutureDate !== void 0 ? isFutureDate : true, label: "".concat(t('Common.StartDate'), " - ").concat(t('Common.EndDate')), callback: handleChangeDateRange, initialStartDate: (0, moment_1.default)(), initialEndDate: (0, moment_1.default)(), variant: "outlined", textFieldProps: {
100
100
  fullWidth: true,
101
101
  className: classes.outlinedInput,
102
102
  }, isDayBlocked: function (day) {
@@ -44,13 +44,13 @@ var DataSetConfigs = function (exportData, campaigns, places, t, isBilling) {
44
44
  style: { font: { sz: '13' } },
45
45
  },
46
46
  {
47
- value: (0, Helpers_1.formatNumber)(isBilling ? data.rateBilling : data.rate || 0),
47
+ value: isBilling ? data.rateBilling : data.rate || 0,
48
48
  style: { font: { sz: '13' } },
49
49
  },
50
50
  {
51
- value: (0, Helpers_1.formatNumber)(isBilling
51
+ value: isBilling
52
52
  ? data.totalQuantityBilling
53
- : data.totalQuantity || 0),
53
+ : data.totalQuantity || 0,
54
54
  style: { font: { sz: '12' } },
55
55
  },
56
56
  ];
@@ -22,7 +22,7 @@ var DataSetConfigsAXN = function (t, exportData, domains, campaigns, places, isB
22
22
  '#',
23
23
  t('Schedule.Campaign'),
24
24
  t('Schedule.Place'),
25
- t('Schedule.Date'),
25
+ t('Schedule. Date'),
26
26
  "".concat(t('Schedule.Rate'), " (%)"),
27
27
  t('Schedule.Total'),
28
28
  ],
@@ -46,13 +46,13 @@ var DataSetConfigsAXN = function (t, exportData, domains, campaigns, places, isB
46
46
  style: { font: { sz: '13' } },
47
47
  },
48
48
  {
49
- value: (0, Helpers_1.formatNumber)(isBilling ? data.rateBilling : data.rate || 0),
49
+ value: isBilling ? data.rateBilling : data.rate || 0,
50
50
  style: { font: { sz: '13' } },
51
51
  },
52
52
  {
53
- value: (0, Helpers_1.formatNumber)(isBilling
53
+ value: isBilling
54
54
  ? data.totalQuantityBilling
55
- : data.totalQuantity || 0),
55
+ : data.totalQuantity || 0,
56
56
  style: { font: { sz: '12' } },
57
57
  },
58
58
  ];
@@ -146,7 +146,7 @@ function Filter(props) {
146
146
  setFilterType({
147
147
  type: e.target.value,
148
148
  });
149
- }, children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.billingUnit, children: t('Common.BillingUnit') }), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.impression, children: t('Common.Impression') })] })] }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
149
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.billingUnit, children: t('Campaign.BillingUnit.Title') }), (0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: Constant_1.TypeView.impression, children: t('Common.Impression') })] })] }) }), (0, jsx_runtime_1.jsx)(material_1.Box, { sx: {
150
150
  width: '260px',
151
151
  minWidth: '260px',
152
152
  marginRight: '16px',
@@ -62,6 +62,7 @@ var AgeRangeTabs = function (_a) {
62
62
  fill: true,
63
63
  borderWidth: 2,
64
64
  yAxisID: 'y',
65
+ variant: '3',
65
66
  },
66
67
  ];
67
68
  };
@@ -58,7 +58,7 @@ var TemplateContainer = function () {
58
58
  field: 'PageCode',
59
59
  headerName: 'PageCode',
60
60
  valueGetter: function (row) {
61
- return t("TemplateManagement.Page_".concat(row.pageCode));
61
+ return t("TemplateManagement.Page_".concat(['wlc', 'lgn'].includes(row.pageCode) ? row.pageCode : row.pageCode === '0' ? 'wlc' : 'lgn'));
62
62
  },
63
63
  },
64
64
  ], loading: loading, rows: (templates === null || templates === void 0 ? void 0 : templates.templates) || [], onCreateButtonClick: handleNavigate, customActions: (0, jsx_runtime_1.jsx)(material_1.Button, { component: Router_1.Link, to: Constant_1.Constants.IMPORT_PATH, variant: "outlined", size: "medium", sx: { marginLeft: '16px', fontWeight: 'bold' }, children: t('Common.Import') }), rowActions: [
@@ -153,7 +153,7 @@ var CreateOrEdit = function () {
153
153
  var fetchTemplateData = function () {
154
154
  if (templateId) {
155
155
  return service.templatesGet(templateId).then(function (res) {
156
- setTemplateData(__assign(__assign({}, res), { templateParameters: (0, Utils_1.removeFiledName)(res.templateParameters) }));
156
+ setTemplateData(__assign(__assign({}, res), { template: __assign(__assign({}, res.template), { pageCode: isNaN(Number(res.template.pageCode)) ? res.template.pageCode : Number(res.template.pageCode) ? 'lgn' : 'wlc' }), templateParameters: (0, Utils_1.removeFiledName)(res.templateParameters) }));
157
157
  });
158
158
  }
159
159
  };
@@ -51,7 +51,7 @@ var ImportTemplate = function () {
51
51
  };
52
52
  var handleSubmit = function () {
53
53
  var directoryId = bussinessData.directoryId, id = bussinessData.id, name = bussinessData.name;
54
- return service.templatesImport(directoryId, id, name, {
54
+ return service.templatesImport(directoryId, id || '0', name, {
55
55
  data: tempFile,
56
56
  fileName: tempFile === null || tempFile === void 0 ? void 0 : tempFile.name,
57
57
  });
@@ -59,7 +59,7 @@ var ImportTemplate = function () {
59
59
  var handleChangeFormData = (0, react_1.useCallback)(function (obj, valid, key) {
60
60
  setBussinessData(function (prev) {
61
61
  var _a;
62
- return (__assign(__assign({}, prev), (_a = {}, _a[key] = obj[key], _a.id = prev.id || (obj === null || obj === void 0 ? void 0 : obj.id) || '0', _a.directoryId = (obj === null || obj === void 0 ? void 0 : obj.directoryId) || rootDirectoryId, _a)));
62
+ return (__assign(__assign({}, prev), (_a = {}, _a[key] = obj[key], _a.directoryId = (obj === null || obj === void 0 ? void 0 : obj.directoryId) || rootDirectoryId, _a)));
63
63
  });
64
64
  }, [rootDirectoryId]);
65
65
  return ((0, jsx_runtime_1.jsxs)(ClassicDrawer_1.default, { title: t('TemplateManagement.ImportTemplate'), onSubmit: handleSubmit, disableButtonSubmit: !(tempFile === null || tempFile === void 0 ? void 0 : tempFile.name), confirmExit: true, childrenWrapperStyle: { padding: 0 }, children: [(0, jsx_runtime_1.jsx)(AWING_1.DataForm, { fields: [
@@ -46,32 +46,65 @@ var styledLineFill = function (defaultStyle, variant) {
46
46
  }
47
47
  };
48
48
  exports.styledLineFill = styledLineFill;
49
+ // Click: 004b95
50
+ // Impression: d10717
51
+ // Engagement: 0082ed
52
+ // ER: 8bc1f7
53
+ // CTR: 518be9
54
+ // Các đường phụ
55
+ // ef9234, 5752d1, 38812f
49
56
  function getColorByVariant(variant) {
50
- switch (variant) {
57
+ switch (String(variant).toLowerCase()) {
51
58
  case '0':
52
- return '#0055b8';
59
+ case 'impression':
60
+ case 'view':
61
+ return '#d10717';
53
62
  case '1':
54
- return '#dd040c';
63
+ case 'click':
64
+ return '#004b95';
55
65
  case '2':
56
- return 'green';
66
+ case 'engagement':
67
+ case 'authentication':
68
+ return '#0082ed';
57
69
  case '3':
58
- return 'violet';
70
+ case 'spot':
71
+ case 'er':
72
+ return '#8bc1f7';
59
73
  case '4':
60
- return 'black';
74
+ case 'ctr':
75
+ return '#518be9';
61
76
  case '5':
62
- return 'yellow';
77
+ case 'other':
78
+ return '#ef9234';
63
79
  case '6':
64
- return 'indigo';
80
+ case 'other1':
81
+ return '#5752d1';
65
82
  case '7':
66
- return 'orange';
67
- case '8':
68
- return 'cyan';
69
- case '9':
70
- return 'lime';
71
- case undefined:
72
- return '#80b0ff';
83
+ case 'other2':
84
+ return '#38812f';
85
+ // case '0':
86
+ // return '#0055b8'
87
+ // case '1':
88
+ // return '#dd040c'
89
+ // case '2':
90
+ // return 'green'
91
+ // case '3':
92
+ // return 'violet'
93
+ // case '4':
94
+ // return 'black'
95
+ // case '5':
96
+ // return 'yellow'
97
+ // case '6':
98
+ // return 'indigo'
99
+ // case '7':
100
+ // return 'orange'
101
+ // case '8':
102
+ // return 'cyan'
103
+ // case '9':
104
+ // return 'lime'
73
105
  default:
74
- return '#' + Math.floor(Math.random() * 16777216).toString(16);
106
+ return '#38812f';
107
+ // return '#' + Math.floor(Math.random() * 16777216).toString(16)
75
108
  }
76
109
  }
77
110
  var getStyle = function (defaultStyle, type, color) {
@@ -43,14 +43,17 @@ var GeoFencing_1 = __importDefault(require("../../ACM-AXN/GeoFencing"));
43
43
  var i18n_1 = __importDefault(require("../../i18n"));
44
44
  var omit = require('lodash/omit');
45
45
  function DataInput(props) {
46
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l;
46
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
47
47
  var t = (0, react_i18next_1.useTranslation)(undefined, { i18n: i18n_1.default }).t;
48
48
  var fieldDefinition = props.fieldDefinition, onChange = props.onChange, value = props.value, error = props.error, disableHelperText = props.disableHelperText;
49
49
  var fieldName = fieldDefinition.fieldName, type = fieldDefinition.type, onValidate = fieldDefinition.onValidate, min = fieldDefinition.min, max = fieldDefinition.max, pattern = fieldDefinition.pattern, other = __rest(fieldDefinition, ["fieldName", "type", "onValidate", "min", "max", "pattern"]);
50
- var _m = react_2.default.useState(t('Common.InvalidData')), errorText = _m[0], setErrorText = _m[1];
50
+ var _o = react_2.default.useState(t('Common.InvalidData')), errorText = _o[0], setErrorText = _o[1];
51
51
  var checkValidationValue = function (fieldDefinition, val) {
52
52
  if (!fieldDefinition.required &&
53
- (val === undefined || val === null || val === '' || (Array.isArray(val) && val.length === 0)))
53
+ (val === undefined ||
54
+ val === null ||
55
+ val === '' ||
56
+ (Array.isArray(val) && val.length === 0)))
54
57
  return true;
55
58
  if (fieldDefinition.onValidate)
56
59
  return fieldDefinition.onValidate(val, fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.length, fieldDefinition === null || fieldDefinition === void 0 ? void 0 : fieldDefinition.pattern);
@@ -135,7 +138,7 @@ function DataInput(props) {
135
138
  : undefined }));
136
139
  }
137
140
  case 'checkbox': {
138
- return ((0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { id: fieldName.toString(), name: fieldName.toString(), checked: value, onChange: function (event) {
141
+ return ((0, jsx_runtime_1.jsx)(material_1.FormControl, { fullWidth: true, children: (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { disabled: (_d = fieldDefinition.disabled) !== null && _d !== void 0 ? _d : false, id: fieldName.toString(), name: fieldName.toString(), checked: value, onChange: function (event) {
139
142
  return onChange(event.target.checked, checkValidationValue(fieldDefinition, event.target.checked));
140
143
  }, color: "primary", readOnly: fieldDefinition.readOnly }), label: fieldDefinition.label }) }));
141
144
  }
@@ -144,7 +147,7 @@ function DataInput(props) {
144
147
  return onChange(date === null || date === void 0 ? void 0 : date.toDate(), checkValidationValue(fieldDefinition, date === null || date === void 0 ? void 0 : date.toDate()));
145
148
  }, readOnly: fieldDefinition.readOnly, slotProps: {
146
149
  textField: __assign(__assign({ required: fieldDefinition.required, fullWidth: true, variant: 'standard' }, other), { error: error, helperText: !disableHelperText && error
147
- ? (_d = fieldDefinition.helperText) !== null && _d !== void 0 ? _d : t('Common.InvalidData')
150
+ ? (_e = fieldDefinition.helperText) !== null && _e !== void 0 ? _e : t('Common.InvalidData')
148
151
  : '' }),
149
152
  } }));
150
153
  }
@@ -153,12 +156,12 @@ function DataInput(props) {
153
156
  return onChange(date === null || date === void 0 ? void 0 : date.toDate(), checkValidationValue(fieldDefinition, date === null || date === void 0 ? void 0 : date.toDate()));
154
157
  }, slotProps: {
155
158
  textField: __assign(__assign({ required: fieldDefinition.required, fullWidth: true, variant: 'standard' }, other), { error: error, helperText: !disableHelperText && error
156
- ? (_e = fieldDefinition.helperText) !== null && _e !== void 0 ? _e : t('Common.InvalidData')
159
+ ? (_f = fieldDefinition.helperText) !== null && _f !== void 0 ? _f : t('Common.InvalidData')
157
160
  : '' }),
158
161
  }, readOnly: fieldDefinition.readOnly }));
159
162
  }
160
163
  case 'date-range': {
161
- var _o = other, isDayBlocked = _o.isDayBlocked, isOutsideRange = _o.isOutsideRange;
164
+ var _p = other, isDayBlocked = _p.isDayBlocked, isOutsideRange = _p.isOutsideRange;
162
165
  return ((0, jsx_runtime_1.jsx)(AWING_1.DateRangePicker, { noBorder: true, variant: "standard", textFieldProps: __assign({ fullWidth: true, style: { margin: '8px 0px' } }, omit(other, ['isDayBlocked', 'isOutsideRange'])), value: {
163
166
  startDate: (value === null || value === void 0 ? void 0 : value[0]) || null,
164
167
  endDate: (value === null || value === void 0 ? void 0 : value[1]) || null,
@@ -166,7 +169,7 @@ function DataInput(props) {
166
169
  var newValue = [dateRange.startDate, dateRange.endDate];
167
170
  onChange(newValue, checkValidationValue(fieldDefinition, newValue));
168
171
  }, label: fieldDefinition.label, error: error, helperText: !disableHelperText && error
169
- ? (_f = fieldDefinition.helperText) !== null && _f !== void 0 ? _f : t('Common.InvalidData')
172
+ ? (_g = fieldDefinition.helperText) !== null && _g !== void 0 ? _g : t('Common.InvalidData')
170
173
  : '', disableHelperText: disableHelperText, isDayBlocked: isDayBlocked, isOutsideRange: isOutsideRange }));
171
174
  }
172
175
  case 'number': {
@@ -174,7 +177,7 @@ function DataInput(props) {
174
177
  var newValue = Number(event.target.value);
175
178
  onChange(newValue, checkValidationValue(fieldDefinition, newValue));
176
179
  }, error: error, helperText: !disableHelperText && error
177
- ? (_g = fieldDefinition.helperText) !== null && _g !== void 0 ? _g : t('Common.InvalidData')
180
+ ? (_h = fieldDefinition.helperText) !== null && _h !== void 0 ? _h : t('Common.InvalidData')
178
181
  : '' })));
179
182
  }
180
183
  case 'radio': {
@@ -189,7 +192,7 @@ function DataInput(props) {
189
192
  case 'text':
190
193
  case 'text-area': {
191
194
  return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ id: fieldName.toString(), name: fieldName.toString(), type: 'text', fullWidth: true, variant: "standard", multiline: fieldDefinition.type === 'text-area', error: error, helperText: !disableHelperText && error
192
- ? (_h = fieldDefinition.helperText) !== null && _h !== void 0 ? _h : errorText
195
+ ? (_j = fieldDefinition.helperText) !== null && _j !== void 0 ? _j : errorText
193
196
  : '' }, other, { value: value !== null && value !== void 0 ? value : '', onChange: function (event) {
194
197
  return onChange(event.target.value, checkValidationValue(fieldDefinition, event.target.value));
195
198
  } })));
@@ -201,7 +204,7 @@ function DataInput(props) {
201
204
  : event.target.value;
202
205
  onChange(event.target.value, checkValidationValue(fieldDefinition, newValue));
203
206
  }, error: error, helperText: !disableHelperText && error
204
- ? (_j = fieldDefinition.helperText) !== null && _j !== void 0 ? _j : t('Common.InvalidData')
207
+ ? (_k = fieldDefinition.helperText) !== null && _k !== void 0 ? _k : t('Common.InvalidData')
205
208
  : '' }, other, { children: [!fieldDefinition.required && ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: "", children: (0, jsx_runtime_1.jsx)("em", { children: t('Common.None') }) })), fieldDefinition.options.map(function (item, index) {
206
209
  var _a;
207
210
  return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, __assign({ value: item.value, disabled: item.disabled ||
@@ -215,7 +218,7 @@ function DataInput(props) {
215
218
  return ((0, jsx_runtime_1.jsx)(AWING_1.MultipleHierarchicalChoice, __assign({}, fieldDefinition, { variant: "standard", value: value, onChange: function (value) {
216
219
  onChange(value, checkValidationValue(fieldDefinition, value));
217
220
  }, error: error, helperText: !disableHelperText && error
218
- ? (_k = fieldDefinition.helperText) !== null && _k !== void 0 ? _k : t('Common.InvalidData')
221
+ ? (_l = fieldDefinition.helperText) !== null && _l !== void 0 ? _l : t('Common.InvalidData')
219
222
  : '' })));
220
223
  }
221
224
  case 'geo-fencing': {
@@ -228,7 +231,7 @@ function DataInput(props) {
228
231
  return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({ id: fieldName.toString(), name: fieldName.toString(), type: fieldDefinition.type, fullWidth: true, variant: "standard" }, other, { value: value !== null && value !== void 0 ? value : '', onChange: function (event) {
229
232
  return onChange(event.target.value, checkValidationValue(fieldDefinition, event.target.value));
230
233
  }, error: error, helperText: !disableHelperText && error
231
- ? (_l = fieldDefinition.helperText) !== null && _l !== void 0 ? _l : t('Common.InvalidData')
234
+ ? (_m = fieldDefinition.helperText) !== null && _m !== void 0 ? _m : t('Common.InvalidData')
232
235
  : '' })));
233
236
  }
234
237
  }
@@ -37,12 +37,20 @@ function notNullValid(value) {
37
37
  }
38
38
  exports.notNullValid = notNullValid;
39
39
  function dateValid(value) {
40
- return Boolean(value && (0, moment_1.default)(value).isValid());
40
+ return Boolean(value && (value === null || value === void 0 ? void 0 : value.getFullYear()) > 1000 && (0, moment_1.default)(value).isValid());
41
41
  }
42
42
  exports.dateValid = dateValid;
43
43
  function dateRangeValid(value) {
44
- return value !== undefined && value !== null && value.length === 2 && dateValid(value[0]) && dateValid(value[1]) &&
45
- value[0] !== undefined && value[0] !== null && value[1] !== undefined && value[1] !== null && value[0] <= value[1];
44
+ return (value !== undefined &&
45
+ value !== null &&
46
+ value.length === 2 &&
47
+ dateValid(value[0]) &&
48
+ dateValid(value[1]) &&
49
+ value[0] !== undefined &&
50
+ value[0] !== null &&
51
+ value[1] !== undefined &&
52
+ value[1] !== null &&
53
+ value[0] <= value[1]);
46
54
  }
47
55
  exports.dateRangeValid = dateRangeValid;
48
56
  function emailValid(value) {
@@ -114,7 +122,8 @@ var textValidation = function (str, length, required, pattern, invertRegex) {
114
122
  if (str && pattern && !pattern.test(str)) {
115
123
  validRes.valid = false;
116
124
  if (invertRegex !== false) {
117
- var invertedRegex = invertRegex || new RegExp("[^".concat(pattern.source.replace(/[*+?^${}|]/g, ''), "]").replace(/\[\[|\]\]/g, ']'), 'g');
125
+ var invertedRegex = invertRegex ||
126
+ new RegExp("[^".concat(pattern.source.replace(/[*+?^${}|]/g, ''), "]").replace(/\[\[|\]\]/g, ']'), 'g');
118
127
  validRes.message.push("".concat(i18n_1.default.t('Common.InvalidChars'), ": ").concat(Array.from(new Set(str.match(invertedRegex))).join(' ')));
119
128
  }
120
129
  }
@@ -10,6 +10,29 @@ var __assign = (this && this.__assign) || function () {
10
10
  };
11
11
  return __assign.apply(this, arguments);
12
12
  };
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || function (mod) {
30
+ if (mod && mod.__esModule) return mod;
31
+ var result = {};
32
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
33
+ __setModuleDefault(result, mod);
34
+ return result;
35
+ };
13
36
  var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
37
  if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
38
  if (ar || !(i in from)) {
@@ -27,7 +50,7 @@ exports.parseJSON = exports.fillMissingDates = exports.setObject = exports.forma
27
50
  var moment_1 = __importDefault(require("moment"));
28
51
  var i18n_1 = __importDefault(require("../i18n"));
29
52
  var helper_1 = require("../AWING/helper");
30
- var lodash_1 = require("lodash");
53
+ var lodash_1 = __importStar(require("lodash"));
31
54
  var TIMELINE_TYPE;
32
55
  (function (TIMELINE_TYPE) {
33
56
  TIMELINE_TYPE[TIMELINE_TYPE["HOUR"] = 0] = "HOUR";
@@ -548,8 +571,8 @@ function fillMissingDates(data, startDate, endDate, format) {
548
571
  if (format === void 0) { format = 'YYYYMMDD'; }
549
572
  var result = data.concat();
550
573
  // Parse the start and end dates
551
- var start = (0, moment_1.default)(isNaN(Number(startDate)) ? startDate : String(startDate));
552
- var end = (0, moment_1.default)(isNaN(Number(endDate)) ? endDate : String(endDate));
574
+ var start = (0, moment_1.default)(isNaN(Number(startDate)) ? startDate : String(startDate)).startOf('day');
575
+ var end = (0, moment_1.default)(isNaN(Number(endDate)) ? endDate : String(endDate)).endOf('day');
553
576
  if (start.isAfter(end))
554
577
  throw new Error('Start date must be before end date');
555
578
  // Array to hold the complete range of dates
@@ -561,7 +584,12 @@ function fillMissingDates(data, startDate, endDate, format) {
561
584
  (0, lodash_1.xor)(data.map(function (d) { return d.x; }), dates).forEach(function (x) {
562
585
  result.push({ x: x, y: 0 });
563
586
  });
564
- return (0, lodash_1.orderBy)(result, ['x'], ['asc']);
587
+ return (0, lodash_1.default)(result).groupBy('x').map(function (value, key) {
588
+ return ({
589
+ x: key,
590
+ y: lodash_1.default.sumBy(value, 'y')
591
+ });
592
+ }).orderBy(['x'], ['asc']).value();
565
593
  }
566
594
  exports.fillMissingDates = fillMissingDates;
567
595
  function parseJSON(str) {
@@ -69,7 +69,6 @@
69
69
  "Download": "Download",
70
70
  "View": "View",
71
71
  "Impression": "Impression",
72
- "BillingUnit": "Billing unit",
73
72
  "TitleTypeView": "Show by",
74
73
  "Settings": "Settings",
75
74
  "Logout": "Logout",
@@ -40,7 +40,6 @@
40
40
  "View": "Xem",
41
41
  "ViewBy": "Xem theo",
42
42
  "Impression": "Impression",
43
- "BillingUnit": "Đơn vị tính",
44
43
  "TitleTypeView": "Hiển thị theo",
45
44
  "Select": "Chọn",
46
45
  "Loading": "Đang tải...",
@@ -481,7 +480,7 @@
481
480
  "CantBeDelete": "Không thể xoá chiến dịch này",
482
481
  "Attributes": "Thuộc tính",
483
482
  "BillingUnit": {
484
- "Title": "Đơn vị",
483
+ "Title": "Đơn vị tính tiền",
485
484
  "View": "Impression",
486
485
  "Authentication": "Engagement / Spot",
487
486
  "Click": "Click"
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.166-dev",
3
+ "version": "2.1.168-dev",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",