awing-library 2.1.14-beta → 2.1.16-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.
@@ -62,6 +62,7 @@ var AddOrEditRule = function (props) {
62
62
  _a[Utils_1.RuleType.TargetAge] = t('Campaign.RuleType.TargetAge'),
63
63
  _a[Utils_1.RuleType.TargetOS] = t('Campaign.RuleType.TargetOS'),
64
64
  _a[Utils_1.RuleType.TargetDevice] = t('Campaign.RuleType.TargetDevice'),
65
+ _a[Utils_1.RuleType.RetargetMacAddress] = t('Campaign.RuleType.RetargetMacAddress'),
65
66
  _a),
66
67
  save: t('Common.Save'),
67
68
  invalidData: t('Common.InvalidData'),
@@ -109,10 +110,10 @@ var AddOrEditRule = function (props) {
109
110
  return {
110
111
  value: Array.isArray(rule.value) && rule.value.length > 0,
111
112
  };
112
- // case RuleType.RetargetMacAddress:
113
- // return {
114
- // value: Array.isArray(rule.value) && rule.value.length > 0
115
- // };
113
+ case Utils_1.RuleType.RetargetMacAddress:
114
+ return {
115
+ value: Array.isArray(rule.value) && rule.value.length > 0,
116
+ };
116
117
  default:
117
118
  return {};
118
119
  }
@@ -157,14 +158,8 @@ var AddOrEditRule = function (props) {
157
158
  return ((0, jsx_runtime_1.jsx)(RuleForm_1.TargetOS, { valids: valids, rule: currentRule, onChange: handleOnChange, deviceInfoGetAllRuleOsVersions: service === null || service === void 0 ? void 0 : service.deviceInfoGetAllRuleOsVersions }));
158
159
  case Utils_1.RuleType.TargetDevice:
159
160
  return ((0, jsx_runtime_1.jsx)(RuleForm_1.TargetDevice, { valids: valids, rule: currentRule, onChange: handleOnChange, deviceInfoGetAllRuleDevices: service === null || service === void 0 ? void 0 : service.deviceInfoGetAllRuleDevices }));
160
- // case RuleType.RetargetMacAddress:
161
- // return (
162
- // <RetargetMacAddress
163
- // valids={valids}
164
- // rule={currentRule}
165
- // onChange={handleOnChange}
166
- // />
167
- // );
161
+ case Utils_1.RuleType.RetargetMacAddress:
162
+ return ((0, jsx_runtime_1.jsx)(RuleForm_1.RetargetMacAddress, { valids: valids, rule: currentRule, onChange: handleOnChange, remarketingListGetAll: service === null || service === void 0 ? void 0 : service.remarketingListGetAll }));
168
163
  default:
169
164
  return (0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, {});
170
165
  }
@@ -3,6 +3,7 @@ interface Props {
3
3
  rule: AdvancedRule;
4
4
  valids: any;
5
5
  onChange: (rule: AdvancedRule) => void;
6
+ remarketingListGetAll: () => Promise<any[]>;
6
7
  }
7
8
  declare const RetargetMacAddressContainer: (props: Props) => import("react/jsx-runtime").JSX.Element;
8
9
  export default RetargetMacAddressContainer;
@@ -19,19 +19,11 @@ var react_1 = __importDefault(require("react"));
19
19
  var component_1 = __importDefault(require("./component"));
20
20
  var RetargetMacAddressContainer = function (props) {
21
21
  var _a = react_1.default.useState([]), remarketingLists = _a[0], setRemarketingLists = _a[1];
22
+ var remarketingListGetAll = props.remarketingListGetAll;
22
23
  react_1.default.useEffect(function () {
23
- // client.
24
- // RemarketingListService.getAllRemarketingList()
25
- // .then((res) => {
26
- // if (res.data.status === STATUS_CODE.OK)
27
- // {
28
- // setRemarketingLists(res.data.data);
29
- // }
30
- // else {
31
- // Snackbar(SNACKBAR_TYPES.ERROR);
32
- // }
33
- // })
34
- // .catch(() => Snackbar(SNACKBAR_TYPES.ERROR));
24
+ remarketingListGetAll()
25
+ .then(setRemarketingLists)
26
+ .catch(function (err) { return console.log(err); });
35
27
  }, []);
36
28
  return (0, jsx_runtime_1.jsx)(component_1.default, __assign({ remarketingLists: remarketingLists }, props));
37
29
  };
@@ -80,6 +80,7 @@ export declare const RuleType: {
80
80
  TargetAge: number;
81
81
  TargetOS: number;
82
82
  TargetDevice: number;
83
+ RetargetMacAddress: number;
83
84
  };
84
85
  export declare const RuleTypeOfCalculator: {
85
86
  TargetGender: number;
@@ -87,6 +88,13 @@ export declare const RuleTypeOfCalculator: {
87
88
  TargetOS: number;
88
89
  TargetDevice: number;
89
90
  };
91
+ export declare const RuleTypeOfCalculatorAXN: {
92
+ TargetGender: number;
93
+ TargetAge: number;
94
+ TargetOS: number;
95
+ TargetDevice: number;
96
+ RetargetMacAddress: number;
97
+ };
90
98
  export declare const RuleGender: {
91
99
  Female: string;
92
100
  Male: string;
@@ -12,7 +12,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.CampaignType = exports.ageRangeValueToText = exports.RuleAgeRange = exports.DEMO_GRAPHIC_AGE_RANGE = exports.getDescription = exports.isAdActive = exports.RuleGender = exports.RuleTypeOfCalculator = exports.RuleType = exports.nextChar = exports.getName = exports.getDefaultRule = exports.bonusValid = exports.bookingValid = exports.adsClassCValid = exports.groupClassCValid = exports.groupClassBValid = exports.campaignAdsValid = exports.ruleValid = exports.verifyExpr = exports.advancedValid = exports.weightsValid = exports.placeFilterValid = exports.dateRangeValid = exports.pageValid = exports.campaignAdValid = exports.validateAnalyticTypes = exports.checkValidUrl = exports.tabPartnerValid = exports.tabInfomationValid = exports.attributesValid = exports.nameValid = exports.directoryValid = exports.advancedSearchFormatDate = exports.getCampaignPriority = exports.checkCampaignIsRunning = exports.formatListCampaign = exports.getTotalBooking = exports.checkPriority = exports.getIndexPriority = void 0;
15
+ exports.CampaignType = exports.ageRangeValueToText = exports.RuleAgeRange = exports.DEMO_GRAPHIC_AGE_RANGE = exports.getDescription = exports.isAdActive = exports.RuleGender = exports.RuleTypeOfCalculatorAXN = exports.RuleTypeOfCalculator = exports.RuleType = exports.nextChar = exports.getName = exports.getDefaultRule = exports.bonusValid = exports.bookingValid = exports.adsClassCValid = exports.groupClassCValid = exports.groupClassBValid = exports.campaignAdsValid = exports.ruleValid = exports.verifyExpr = exports.advancedValid = exports.weightsValid = exports.placeFilterValid = exports.dateRangeValid = exports.pageValid = exports.campaignAdValid = exports.validateAnalyticTypes = exports.checkValidUrl = exports.tabPartnerValid = exports.tabInfomationValid = exports.attributesValid = exports.nameValid = exports.directoryValid = exports.advancedSearchFormatDate = exports.getCampaignPriority = exports.checkCampaignIsRunning = exports.formatListCampaign = exports.getTotalBooking = exports.checkPriority = exports.getIndexPriority = void 0;
16
16
  var Types_1 = require("./Types");
17
17
  var Enum_1 = require("./Enum");
18
18
  var Helpers_1 = require("../../Utils/Helpers");
@@ -343,12 +343,12 @@ var getDefaultRule = function (type) {
343
343
  operator: Enum_1.EnumOperator.In.id,
344
344
  value: [],
345
345
  };
346
- // case RuleType.RetargetMacAddress:
347
- // return {
348
- // type: type,
349
- // operator: EnumOperator.IntersectExist.id,
350
- // value: '',
351
- // }
346
+ case exports.RuleType.RetargetMacAddress:
347
+ return {
348
+ type: type,
349
+ operator: Enum_1.EnumOperator.IntersectExist.id,
350
+ value: '',
351
+ };
352
352
  default:
353
353
  return {};
354
354
  }
@@ -373,14 +373,20 @@ exports.RuleType = {
373
373
  TargetAge: 4,
374
374
  TargetOS: 5,
375
375
  TargetDevice: 6,
376
- // RetargetMacAddress: 7,
376
+ RetargetMacAddress: 7,
377
377
  };
378
378
  exports.RuleTypeOfCalculator = {
379
379
  TargetGender: 3,
380
380
  TargetAge: 4,
381
381
  TargetOS: 5,
382
382
  TargetDevice: 6,
383
- // RetargetMacAddress: 7,
383
+ };
384
+ exports.RuleTypeOfCalculatorAXN = {
385
+ TargetGender: 3,
386
+ TargetAge: 4,
387
+ TargetOS: 5,
388
+ TargetDevice: 6,
389
+ RetargetMacAddress: 7,
384
390
  };
385
391
  exports.RuleGender = {
386
392
  Female: '0',
@@ -496,14 +502,12 @@ var getDescription = function (rule) {
496
502
  result = result.replace('{1}', value.length);
497
503
  }
498
504
  break;
499
- // case RuleType.RetargetMacAddress:
500
- // {
501
- // let textFormat = i18next.t(
502
- // 'Campaign.Rule.DescriptionFormat.RetargetMacAddress'
503
- // )
504
- // result += textFormat.replace('{0}', rule.description)
505
- // }
506
- // break
505
+ case exports.RuleType.RetargetMacAddress:
506
+ {
507
+ var textFormat = i18n_1.default.t('Campaign.Rule.DescriptionFormat.RetargetMacAddress');
508
+ result += textFormat.replace('{0}', rule.description);
509
+ }
510
+ break;
507
511
  default:
508
512
  break;
509
513
  }
@@ -75,7 +75,7 @@ var ViewContent = function (_a) {
75
75
  onChange(['viewDatas'], []);
76
76
  }
77
77
  // eslint-disable-next-line react-hooks/exhaustive-deps
78
- }, [service, viewInfoData.templateId, viewInfoData.viewDatas.length]);
78
+ }, [viewInfoData.templateId, viewInfoData.viewDatas.length]);
79
79
  var handleResData = function (res) {
80
80
  onChange(['viewDatas'], (0, Utils_1.getTemplateDatas)(res.templateParameters, viewInfoData, pageId, viewNumber));
81
81
  onChange(['templateValidation'], res.template.validation);
@@ -24,15 +24,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  var jsx_runtime_1 = require("react/jsx-runtime");
27
+ var icons_material_1 = require("@mui/icons-material");
27
28
  var GetApp_1 = __importDefault(require("@mui/icons-material/GetApp"));
28
29
  var material_1 = require("@mui/material");
30
+ var styles_1 = require("@mui/styles");
29
31
  var moment_1 = __importDefault(require("moment"));
30
32
  var react_1 = require("react");
31
33
  var react_i18next_1 = require("react-i18next");
32
- var Enums_1 = require("./Enums");
33
- var styles_1 = require("@mui/styles");
34
34
  var AWING_1 = require("../../AWING");
35
- var icons_material_1 = require("@mui/icons-material");
35
+ var Enums_1 = require("./Enums");
36
36
  var useStyles = (0, styles_1.makeStyles)(function () { return ({
37
37
  outlinedInput: {
38
38
  '& .MuiOutlinedInput-input': {
@@ -56,21 +56,21 @@ var useStyles = (0, styles_1.makeStyles)(function () { return ({
56
56
  },
57
57
  }); });
58
58
  function ControlPanel(_a) {
59
- var _b;
59
+ var _b, _c;
60
60
  var onChangeQueryInput = _a.onChangeQueryInput, onChangeExportInput = _a.onChangeExportInput, initialFilters = _a.initialFilters, isLoadings = _a.isLoadings, infoSX = _a.infoSX;
61
61
  var classes = useStyles();
62
62
  var t = (0, react_i18next_1.useTranslation)().t;
63
- var _c = (0, react_1.useState)(), queryInput = _c[0], setQueryInput = _c[1];
64
- var _d = (0, react_1.useState)([]), elementInputs = _d[0], setElementInputs = _d[1];
65
- var _e = (0, react_1.useState)(false), isShowFilterEnhanced = _e[0], setIsHideFieldAdvanced = _e[1];
66
- var _f = (0, react_1.useState)(0), flagView = _f[0], setFlagView = _f[1];
63
+ var _d = (0, react_1.useState)(), queryInput = _d[0], setQueryInput = _d[1];
64
+ var _e = (0, react_1.useState)([]), elementInputs = _e[0], setElementInputs = _e[1];
65
+ var _f = (0, react_1.useState)(false), isShowFilterEnhanced = _f[0], setIsHideFieldAdvanced = _f[1];
66
+ var flagRef = (0, react_1.useRef)('-1');
67
67
  var getView = function () {
68
+ var _a;
68
69
  onChangeQueryInput(queryInput);
69
- setFlagView(flagView + 1);
70
+ flagRef.current = ((_a = queryInput === null || queryInput === void 0 ? void 0 : queryInput.campaignIds) === null || _a === void 0 ? void 0 : _a.at(-1)) || '-1';
70
71
  };
71
- var disabledViewBy = (queryInput === null || queryInput === void 0 ? void 0 : queryInput.campaignIds) &&
72
- (queryInput === null || queryInput === void 0 ? void 0 : queryInput.campaignIds.length) > 0 &&
73
- flagView > 0;
72
+ var disabledViewBy = ((_b = queryInput === null || queryInput === void 0 ? void 0 : queryInput.campaignIds) === null || _b === void 0 ? void 0 : _b.length) > 0 &&
73
+ (queryInput === null || queryInput === void 0 ? void 0 : queryInput.campaignIds.includes(flagRef.current));
74
74
  var handleInitialFilter = function (initialFilters) {
75
75
  var initValue = initialFilters === null || initialFilters === void 0 ? void 0 : initialFilters.reduce(function (acc, curr) {
76
76
  if ((curr === null || curr === void 0 ? void 0 : curr.type) === Enums_1.TYPE_FILTERS.DATE_RANGE_PICKER) {
@@ -94,7 +94,7 @@ function ControlPanel(_a) {
94
94
  var handleElementInput = function (initialFilters) {
95
95
  var updatedElementInputs = [];
96
96
  initialFilters.map(function (item, idx) {
97
- var _a, _b, _c;
97
+ var _a, _b;
98
98
  switch (item === null || item === void 0 ? void 0 : item.type) {
99
99
  case Enums_1.TYPE_FILTERS.VIEW_BY: {
100
100
  var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.TextField, { select: true, fullWidth: true, label: t('Common.ViewBy'), size: "small", onChange: function (e) {
@@ -140,7 +140,7 @@ function ControlPanel(_a) {
140
140
  }
141
141
  case Enums_1.TYPE_FILTERS.CAMPAIGN: {
142
142
  var CampaignFilter = item === null || item === void 0 ? void 0 : item.nodeElement;
143
- var element = __assign({ component: ((0, jsx_runtime_1.jsx)(CampaignFilter, { defaultValue: [], disabled: queryInput === null || queryInput === void 0 ? void 0 : queryInput.isCampaignDefault, onSubmit: function (campaignIds) {
143
+ var element = __assign({ component: ((0, jsx_runtime_1.jsx)(CampaignFilter, { defaultValue: [], disabled: (queryInput === null || queryInput === void 0 ? void 0 : queryInput.isCampaignDefault) === '-1', onSubmit: function (campaignIds) {
144
144
  return handleChangeQueryInput(item === null || item === void 0 ? void 0 : item.name, campaignIds);
145
145
  }, disableMulti: item === null || item === void 0 ? void 0 : item.disableMulti }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'campaign' }, item);
146
146
  updatedElementInputs.push(element);
@@ -170,14 +170,14 @@ function ControlPanel(_a) {
170
170
  break;
171
171
  }
172
172
  case Enums_1.TYPE_FILTERS.CAMPAIGN_DEFAULT: {
173
- var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", defaultChecked: (_b = queryInput === null || queryInput === void 0 ? void 0 : queryInput.isCampaignDefault) !== null && _b !== void 0 ? _b : false }), label: t('Statistic.CampaignDefault'), labelPlacement: "start", onChange: function (e) {
174
- handleChangeQueryInput(item === null || item === void 0 ? void 0 : item.name, e.target.checked);
175
- } }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'isCampaignDefault' }, item);
173
+ var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControl, { children: (0, jsx_runtime_1.jsxs)(material_1.RadioGroup, { row: true, "aria-labelledby": "demo-radio-buttons-group-label", defaultValue: queryInput === null || queryInput === void 0 ? void 0 : queryInput.isCampaignDefault, name: "radio-buttons-group", onChange: function (e) {
174
+ handleChangeQueryInput(item === null || item === void 0 ? void 0 : item.name, e.target.value);
175
+ }, children: [(0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: '0', control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: t('Filter.AllCampaign') }), (0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { value: '-1', control: (0, jsx_runtime_1.jsx)(material_1.Radio, {}), label: t('Filter.CampaignDefault') })] }) }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'isCampaignDefault' }, item);
176
176
  updatedElementInputs.push(element);
177
177
  break;
178
178
  }
179
179
  case Enums_1.TYPE_FILTERS.INCLUDE_RESERVED: {
180
- var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", defaultChecked: (_c = queryInput === null || queryInput === void 0 ? void 0 : queryInput.includeReserved) !== null && _c !== void 0 ? _c : true }), label: t('StatisticSchedulePlan.IncludeCampaignReserved'), labelPlacement: "start", onChange: function (e) {
180
+ var element = __assign({ component: ((0, jsx_runtime_1.jsx)(material_1.FormControlLabel, { control: (0, jsx_runtime_1.jsx)(material_1.Checkbox, { color: "primary", defaultChecked: (_b = queryInput === null || queryInput === void 0 ? void 0 : queryInput.includeReserved) !== null && _b !== void 0 ? _b : true }), label: t('StatisticSchedulePlan.IncludeCampaignReserved'), labelPlacement: "start", onChange: function (e) {
181
181
  handleChangeQueryInput(item === null || item === void 0 ? void 0 : item.name, e.target.checked);
182
182
  } }, idx)), isEnhanced: (item === null || item === void 0 ? void 0 : item.isEnhanced) ? item === null || item === void 0 ? void 0 : item.isEnhanced : false, name: 'includeReserved' }, item);
183
183
  updatedElementInputs.push(element);
@@ -225,7 +225,7 @@ function ControlPanel(_a) {
225
225
  paddingTop: '24px',
226
226
  display: 'flex',
227
227
  flex: 'none',
228
- }, justifyContent: "flex-end", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", onClick: getView, style: { height: '40px' }, disabled: (_b = isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.chartLoading) !== null && _b !== void 0 ? _b : false, children: t('Common.View') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", title: t('Common.Download'), onClick: function () { return onChangeExportInput(queryInput); }, color: "inherit", disabled: isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.exportLoading, style: {
228
+ }, justifyContent: "flex-end", children: [(0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", color: "primary", onClick: getView, style: { height: '40px' }, disabled: (_c = isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.chartLoading) !== null && _c !== void 0 ? _c : false, children: t('Common.View') }), (0, jsx_runtime_1.jsx)(material_1.Button, { variant: "contained", title: t('Common.Download'), onClick: function () { return onChangeExportInput(queryInput); }, color: "inherit", disabled: isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.exportLoading, style: {
229
229
  marginLeft: '16px',
230
230
  height: '40px',
231
231
  }, children: (isLoadings === null || isLoadings === void 0 ? void 0 : isLoadings.exportLoading) ? ((0, jsx_runtime_1.jsx)(AWING_1.CircularProgress, { styleWrap: {
@@ -638,5 +638,9 @@
638
638
  "Old": "Old",
639
639
  "New": "New",
640
640
  "TitleDetail": "Transaction Log Detail"
641
+ },
642
+ "Filter": {
643
+ "AllCampaign": "All Campaign",
644
+ "CampaignDefault": "Campaign Default"
641
645
  }
642
646
  }
@@ -640,5 +640,9 @@
640
640
  "Old": "Cũ",
641
641
  "New": "Mới",
642
642
  "TitleDetail": "Chi tiết Log"
643
+ },
644
+ "Filter": {
645
+ "AllCampaign": "Tất cả chiến dịch",
646
+ "CampaignDefault": "Chiến dịch mặc định"
643
647
  }
644
648
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.14-beta",
3
+ "version": "2.1.16-beta",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",