awing-library 2.1.167-dev → 2.1.169-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/Utils.js +3 -3
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabStatistic/Event/Util.js +6 -26
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabStatistic/Utils.js +4 -1
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/Advanced.js +1 -1
- package/lib/ACM-AXN/Campaign/CreateOrEdit/TabSubCampaign/SubCampaignDetail.js +1 -0
- package/lib/ACM-AXN/Campaign/Enum.d.ts +2 -2
- package/lib/ACM-AXN/Campaign/Enum.js +1 -1
- package/lib/ACM-AXN/Campaign/Utils.d.ts +1 -1
- package/lib/ACM-AXN/Campaign/Utils.js +1 -1
- package/lib/ACM-AXN/CampaignPlan/Container.js +2 -2
- package/lib/ACM-AXN/CampaignPlan/Detail.js +2 -2
- package/lib/ACM-AXN/CampaignSchedule/Components/ControlPanel/Filter.js +1 -1
- package/lib/ACM-AXN/CampaignSchedule/DataConfig.js +3 -3
- package/lib/ACM-AXN/CampaignSchedule/DataConfigAXN.js +4 -4
- package/lib/ACM-AXN/ScheduleCompletionRate/Filter.js +1 -1
- package/lib/ACM-AXN/StatisticsAudienceDemographic/Tabs/AgeRange.js +1 -0
- package/lib/ACM-AXN/Template/Container.js +1 -1
- package/lib/ACM-AXN/Template/CreateOrEdit/index.js +1 -1
- package/lib/ACM-AXN/Template/Import.js +2 -2
- package/lib/ACM-AXN/ViewTemplate/TemplateField/Fields/BasicField/index.js +30 -35
- package/lib/ACM-AXN/ViewTemplate/container.js +2 -2
- package/lib/AWING/Chart/Styles.js +49 -16
- package/lib/AWING/DataForm/DataInput.js +16 -13
- package/lib/AWING/ultis/validation.js +13 -4
- package/lib/Utils/Helpers.js +2 -2
- package/lib/translate/en/translation.json +0 -1
- package/lib/translate/vi/translation.json +1 -2
- package/package.json +1 -1
|
@@ -315,7 +315,7 @@ function dataGroupByTimeline(place, data, timelineType) {
|
|
|
315
315
|
if (d.isSPot) {
|
|
316
316
|
return sum + Number((d[Enum_1.BaseEvent[Enum_2.AnalyticType.AUTHENTICATION]] + d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]]) || 0);
|
|
317
317
|
}
|
|
318
|
-
return sum + Number(d[Enum_1.BaseEvent[Enum_2.AnalyticType.
|
|
318
|
+
return sum + Number(d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]] || 0);
|
|
319
319
|
}, 0);
|
|
320
320
|
var arr = [place, dateString, impression];
|
|
321
321
|
if (hasSpot) {
|
|
@@ -332,7 +332,7 @@ function dataGroupByTimeline(place, data, timelineType) {
|
|
|
332
332
|
if (d.isSPot) {
|
|
333
333
|
return sum + d[Enum_1.BaseEvent[Enum_2.AnalyticType.AUTHENTICATION]] + d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]];
|
|
334
334
|
}
|
|
335
|
-
return sum + d[Enum_1.BaseEvent[Enum_2.AnalyticType.
|
|
335
|
+
return sum + d[Enum_1.BaseEvent[Enum_2.AnalyticType.CLICK]];
|
|
336
336
|
}, 0);
|
|
337
337
|
var totalArr = [place, i18n_1.default.t('Schedule.Total'), impr];
|
|
338
338
|
if (hasSpot) {
|
|
@@ -446,7 +446,7 @@ var convertToChartData = function (data, campaignGroups, time) {
|
|
|
446
446
|
fill: false,
|
|
447
447
|
pointStyle: 'circle',
|
|
448
448
|
yAxisID: 'y',
|
|
449
|
-
variant:
|
|
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 =
|
|
28
|
+
var lodash_1 = __importDefault(require("lodash"));
|
|
49
29
|
var Utils_1 = require("../Utils");
|
|
50
|
-
var convertEventData = function (data) { return
|
|
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()
|
|
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
|
-
|
|
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;
|
|
@@ -180,6 +180,7 @@ var Advanced = function (props) {
|
|
|
180
180
|
type: {
|
|
181
181
|
LimitView: t('Campaign.RuleType.LimitView'),
|
|
182
182
|
LimitClick: t('Campaign.RuleType.LimitClick'),
|
|
183
|
+
Authentication: t('Campaign.RuleType.Engagement'),
|
|
183
184
|
LimitEvent: t('Campaign.RuleType.LimitEvent'),
|
|
184
185
|
TargetGender: t('Campaign.RuleType.TargetGender'),
|
|
185
186
|
TargetAge: t('Campaign.RuleType.TargetAge'),
|
|
@@ -189,7 +190,6 @@ var Advanced = function (props) {
|
|
|
189
190
|
RetargetPlace: t('Campaign.RuleType.RetargetPlace'),
|
|
190
191
|
RetargetDomain: t('Campaign.RuleType.RetargetDomain'),
|
|
191
192
|
RetargetMacAddress: t('Campaign.RuleType.RetargetMacAddress'),
|
|
192
|
-
Authentication: t('Campaign.RuleType.Engagement'),
|
|
193
193
|
},
|
|
194
194
|
};
|
|
195
195
|
var handleSubmit = function () {
|
|
@@ -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
|
|
@@ -77,13 +77,13 @@ export declare const nextChar: (c: string) => string;
|
|
|
77
77
|
export declare const RuleType: {
|
|
78
78
|
LimitView: number;
|
|
79
79
|
LimitClick: number;
|
|
80
|
+
Authentication: number;
|
|
80
81
|
LimitEvent: number;
|
|
81
82
|
TargetGender: number;
|
|
82
83
|
TargetAge: number;
|
|
83
84
|
TargetOS: number;
|
|
84
85
|
TargetDevice: number;
|
|
85
86
|
RetargetMacAddress: number;
|
|
86
|
-
Authentication: number;
|
|
87
87
|
};
|
|
88
88
|
export declare const RuleTypeOfCalculator: {
|
|
89
89
|
TargetGender: number;
|
|
@@ -368,13 +368,13 @@ exports.nextChar = nextChar;
|
|
|
368
368
|
exports.RuleType = {
|
|
369
369
|
LimitView: 0,
|
|
370
370
|
LimitClick: 1,
|
|
371
|
+
Authentication: 8,
|
|
371
372
|
LimitEvent: 2,
|
|
372
373
|
TargetGender: 3,
|
|
373
374
|
TargetAge: 4,
|
|
374
375
|
TargetOS: 5,
|
|
375
376
|
TargetDevice: 6,
|
|
376
377
|
RetargetMacAddress: 7,
|
|
377
|
-
Authentication: 8,
|
|
378
378
|
};
|
|
379
379
|
exports.RuleTypeOfCalculator = {
|
|
380
380
|
TargetGender: 3,
|
|
@@ -109,7 +109,7 @@ function Container() {
|
|
|
109
109
|
},
|
|
110
110
|
{
|
|
111
111
|
field: 'totalRun',
|
|
112
|
-
headerName: "".concat(t('CampaignPlan.HasRun'), " (").concat(t('
|
|
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('
|
|
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('
|
|
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('
|
|
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('
|
|
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:
|
|
47
|
+
value: isBilling ? data.rateBilling : data.rate || 0,
|
|
48
48
|
style: { font: { sz: '13' } },
|
|
49
49
|
},
|
|
50
50
|
{
|
|
51
|
-
value:
|
|
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:
|
|
49
|
+
value: isBilling ? data.rateBilling : data.rate || 0,
|
|
50
50
|
style: { font: { sz: '13' } },
|
|
51
51
|
},
|
|
52
52
|
{
|
|
53
|
-
value:
|
|
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('
|
|
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',
|
|
@@ -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.
|
|
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: [
|
|
@@ -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 __importDefault = (this && this.__importDefault) || function (mod) {
|
|
37
14
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
38
15
|
};
|
|
@@ -40,9 +17,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
40
17
|
var jsx_runtime_1 = require("react/jsx-runtime");
|
|
41
18
|
var material_1 = require("@mui/material");
|
|
42
19
|
var styles_1 = require("@mui/styles");
|
|
43
|
-
var AWING_1 = require("../../../../../AWING");
|
|
44
20
|
var validation_1 = require("../../../../../AWING/ultis/validation");
|
|
45
|
-
var react_1 =
|
|
21
|
+
var react_1 = require("react");
|
|
46
22
|
var react_i18next_1 = require("react-i18next");
|
|
47
23
|
var Enum_1 = require("../../../Enum");
|
|
48
24
|
var ImageField_1 = __importDefault(require("./ImageField"));
|
|
@@ -136,8 +112,8 @@ function BasicField(props) {
|
|
|
136
112
|
}));
|
|
137
113
|
// onChangeViewValid(isError)
|
|
138
114
|
switch (fieldType) {
|
|
115
|
+
// return renderNumberField(field, isError)
|
|
139
116
|
case Enum_1.TYPE_FIELD_TEMPLATE.TEXT_FIELD_NUMBER:
|
|
140
|
-
return renderNumberField(field, isError);
|
|
141
117
|
case Enum_1.TYPE_FIELD_TEMPLATE.TEXT_FIELD:
|
|
142
118
|
case Enum_1.TYPE_FIELD_TEMPLATE.URL:
|
|
143
119
|
return renderTextField(field, isError);
|
|
@@ -159,16 +135,35 @@ function BasicField(props) {
|
|
|
159
135
|
return null;
|
|
160
136
|
}
|
|
161
137
|
};
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
}
|
|
138
|
+
// const renderNumberField = React.useCallback((field: any, isError: boolean) => {
|
|
139
|
+
// return (
|
|
140
|
+
// <NumberFormat
|
|
141
|
+
// {...field}
|
|
142
|
+
// inputProps={{ min: 0 }}
|
|
143
|
+
// className={classes.text}
|
|
144
|
+
// required={isRequired}
|
|
145
|
+
// min={0}
|
|
146
|
+
// fullWidth
|
|
147
|
+
// variant="standard"
|
|
148
|
+
// label={labelName || fieldName}
|
|
149
|
+
// onChange={(e) => {
|
|
150
|
+
// let newValue = Number(e.target.value)
|
|
151
|
+
// console.log('newValue', newValue)
|
|
152
|
+
// handleChange(newValue)
|
|
153
|
+
// }}
|
|
154
|
+
// error={isError}
|
|
155
|
+
// helperText={isError ? t('Common.Required') : ''}
|
|
156
|
+
// />
|
|
157
|
+
// )
|
|
158
|
+
// // eslint-disable-next-line react-hooks/exhaustive-deps
|
|
159
|
+
// }, [classes, fieldName, isRequired, labelName, t])
|
|
170
160
|
var renderTextField = function (field, isError) {
|
|
171
|
-
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, field, { className: classes.text, required: isRequired, fullWidth: true }, (fieldType === Enum_1.TYPE_FIELD_TEMPLATE.
|
|
161
|
+
return ((0, jsx_runtime_1.jsx)(material_1.TextField, __assign({}, field, { className: classes.text, required: isRequired, fullWidth: true }, (fieldType === Enum_1.TYPE_FIELD_TEMPLATE.TEXT_FIELD_NUMBER
|
|
162
|
+
? { inputProps: {
|
|
163
|
+
min: 0,
|
|
164
|
+
type: 'number',
|
|
165
|
+
} }
|
|
166
|
+
: {}), (fieldType === Enum_1.TYPE_FIELD_TEMPLATE.TEXTAREA
|
|
172
167
|
? { multiline: true, rows: 4 }
|
|
173
168
|
: {}), { variant: "standard", label: labelName || fieldName, onChange: function (e) {
|
|
174
169
|
handleChange(e.target.value);
|
|
@@ -85,7 +85,7 @@ function ViewTemplate(_a) {
|
|
|
85
85
|
return ((0, jsx_runtime_1.jsxs)(material_1.Grid, { container: true, spacing: 4, children: [(0, jsx_runtime_1.jsxs)(material_1.Grid, { item: true, xs: enablePreview ? 8 : 12, children: [templateLabelName && ((0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "body1", style: {
|
|
86
86
|
fontWeight: "bold",
|
|
87
87
|
textTransform: "uppercase",
|
|
88
|
-
}, children: templateLabelName })), fields && renderFields(fields, false), (0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { id: "advance-option", style: {
|
|
88
|
+
}, children: templateLabelName })), fields && renderFields(fields, false), enablePreview && ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsxs)("div", { id: "advance-option", style: {
|
|
89
89
|
display: "flex",
|
|
90
90
|
flexDirection: "row",
|
|
91
91
|
justifyContent: "space-between",
|
|
@@ -99,7 +99,7 @@ function ViewTemplate(_a) {
|
|
|
99
99
|
display: "block",
|
|
100
100
|
} : {
|
|
101
101
|
display: "none",
|
|
102
|
-
}, children: [fields && advanceFields.length > 0 && renderFields(fields, true), (0, jsx_runtime_1.jsx)(Event_1.default, __assign({}, props))] })] })] }), enablePreview && ((0, jsx_runtime_1.jsxs)(material_1.Grid, { item: true, xs: 4, children: [(0, jsx_runtime_1.jsx)(Preview_1.default, { domainId: domainId || "", validStatus: validStatus, configs: CONFIGS, pagePath: pagePath, templateDatas: templateDatas }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", children: t("ViewTemplate.PreviewLoadingNote") })] }))] }));
|
|
102
|
+
}, children: [fields && advanceFields.length > 0 && renderFields(fields, true), (0, jsx_runtime_1.jsx)(Event_1.default, __assign({}, props))] })] }))] }), enablePreview && ((0, jsx_runtime_1.jsxs)(material_1.Grid, { item: true, xs: 4, children: [(0, jsx_runtime_1.jsx)(Preview_1.default, { domainId: domainId || "", validStatus: validStatus, configs: CONFIGS, pagePath: pagePath, templateDatas: templateDatas }), (0, jsx_runtime_1.jsx)(material_1.Typography, { variant: "caption", children: t("ViewTemplate.PreviewLoadingNote") })] }))] }));
|
|
103
103
|
}
|
|
104
104
|
exports.default = ViewTemplate;
|
|
105
105
|
var getChilds = function (fields, fieldInfo) {
|
|
@@ -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
|
-
|
|
59
|
+
case 'impression':
|
|
60
|
+
case 'view':
|
|
61
|
+
return '#d10717';
|
|
53
62
|
case '1':
|
|
54
|
-
|
|
63
|
+
case 'click':
|
|
64
|
+
return '#004b95';
|
|
55
65
|
case '2':
|
|
56
|
-
|
|
66
|
+
case 'engagement':
|
|
67
|
+
case 'authentication':
|
|
68
|
+
return '#0082ed';
|
|
57
69
|
case '3':
|
|
58
|
-
|
|
70
|
+
case 'spot':
|
|
71
|
+
case 'er':
|
|
72
|
+
return '#8bc1f7';
|
|
59
73
|
case '4':
|
|
60
|
-
|
|
74
|
+
case 'ctr':
|
|
75
|
+
return '#518be9';
|
|
61
76
|
case '5':
|
|
62
|
-
|
|
77
|
+
case 'other':
|
|
78
|
+
return '#ef9234';
|
|
63
79
|
case '6':
|
|
64
|
-
|
|
80
|
+
case 'other1':
|
|
81
|
+
return '#5752d1';
|
|
65
82
|
case '7':
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
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 '#'
|
|
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
|
|
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 ||
|
|
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
|
-
? (
|
|
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
|
-
? (
|
|
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
|
|
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
|
-
? (
|
|
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
|
-
? (
|
|
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
|
-
? (
|
|
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
|
-
? (
|
|
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
|
-
? (
|
|
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
|
-
? (
|
|
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 &&
|
|
45
|
-
value
|
|
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 ||
|
|
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
|
}
|
package/lib/Utils/Helpers.js
CHANGED
|
@@ -571,8 +571,8 @@ function fillMissingDates(data, startDate, endDate, format) {
|
|
|
571
571
|
if (format === void 0) { format = 'YYYYMMDD'; }
|
|
572
572
|
var result = data.concat();
|
|
573
573
|
// Parse the start and end dates
|
|
574
|
-
var start = (0, moment_1.default)(isNaN(Number(startDate)) ? startDate : String(startDate));
|
|
575
|
-
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');
|
|
576
576
|
if (start.isAfter(end))
|
|
577
577
|
throw new Error('Start date must be before end date');
|
|
578
578
|
// Array to hold the complete range of dates
|
|
@@ -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"
|