awing-library 2.1.233-dev → 2.1.235-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.
@@ -170,13 +170,10 @@ var CampaignContainer = function () {
170
170
  label: t('Campaign.AdvanceSearchStatus'),
171
171
  type: 'autocomplete',
172
172
  icon: (0, jsx_runtime_1.jsx)(icons_material_1.Place, { fontSize: "small" }),
173
- options: Object.entries(Enum_1.CampaignStatus).filter(function (item) { return !isNaN(Number(item[1])); }).map(function (_a) {
174
- var key = _a[0], value = _a[1];
175
- return ({
176
- value: value,
177
- text: t(['Campaign.Status', key].join('.')),
178
- });
179
- }),
173
+ options: (0, Utils_1.getCampaignStatus)(!Boolean(service.attributesGetByObjectTypeCode)).map(function (item) { return ({
174
+ value: item.value,
175
+ text: t(['Campaign.Status', item.key].join('.')),
176
+ }); }),
180
177
  },
181
178
  {
182
179
  fieldName: 'priority',
@@ -222,8 +222,8 @@ var RunInBackground = function () {
222
222
  subCampaign = {
223
223
  subCampaigns: [
224
224
  {
225
- id: sub.campaignGroup.id,
226
- name: sub.campaignGroup.name,
225
+ id: sub === null || sub === void 0 ? void 0 : sub.campaignGroup.id,
226
+ name: sub === null || sub === void 0 ? void 0 : sub.campaignGroup.name,
227
227
  },
228
228
  ],
229
229
  ads: [],
@@ -33,6 +33,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
33
33
  __setModuleDefault(result, mod);
34
34
  return result;
35
35
  };
36
+ var __importDefault = (this && this.__importDefault) || function (mod) {
37
+ return (mod && mod.__esModule) ? mod : { "default": mod };
38
+ };
36
39
  Object.defineProperty(exports, "__esModule", { value: true });
37
40
  var jsx_runtime_1 = require("react/jsx-runtime");
38
41
  var react_1 = __importStar(require("react"));
@@ -44,9 +47,11 @@ var lodash_1 = require("lodash");
44
47
  var Utils_1 = require("../../Utils");
45
48
  var Recoils_1 = require("../Recoils");
46
49
  var material_1 = require("@mui/material");
50
+ var Hooks_1 = __importDefault(require("../../../../ACM-AXN/Campaign/Hooks"));
47
51
  function SubCampaignDetail(props) {
48
52
  var t = (0, react_i18next_1.useTranslation)().t;
49
53
  var subCampaign = props.subCampaign, onSubCampaignChange = props.onSubCampaignChange, onChangeSubCampaignStatus = props.onChangeSubCampaignStatus;
54
+ var service = (0, Hooks_1.default)().service;
50
55
  var getFormValid = function () { return ({
51
56
  name: (0, Utils_1.nameValid)(subCampaign.name),
52
57
  bookingAmount: !(0, Utils_1.checkPriority)(subCampaign.priority, Enum_1.CampaignPriority.ClassB) || (0, Utils_1.bookingValid)(subCampaign.bookingAmount),
@@ -86,7 +91,7 @@ function SubCampaignDetail(props) {
86
91
  ? translationText.helperText
87
92
  : '' }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: true, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "status", name: "status", variant: "standard", select: true, required: true, fullWidth: true, label: translationText.status, value: subCampaign.status, onChange: function (e) {
88
93
  onSubCampaignChange(function (pre) { return (__assign(__assign({}, pre), { status: Number(e.target.value) })); });
89
- }, disabled: isCreate, children: Object.values(Enum_1.CampaignStatus).filter(function (item) { return !isNaN(Number(item)); }).map(function (status) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: status, children: t("Campaign.Status.".concat(Enum_1.CampaignStatus[status])) }, status)); }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: true, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "priority", select: true, required: true, variant: "standard", fullWidth: true, label: translationText.priority, value: isNaN(Number(subCampaign.priority))
94
+ }, disabled: isCreate, children: (0, Utils_1.getCampaignStatus)(!Boolean(service.attributesGetByObjectTypeCode)).map(function (item) { return ((0, jsx_runtime_1.jsx)(material_1.MenuItem, { value: item.value, children: t("Campaign.Status.".concat(item.key)) }, item.key)); }) }) }), (0, jsx_runtime_1.jsx)(material_1.Grid, { item: true, xs: true, style: { padding: 8 }, children: (0, jsx_runtime_1.jsx)(material_1.TextField, { id: "priority", select: true, required: true, variant: "standard", fullWidth: true, label: translationText.priority, value: isNaN(Number(subCampaign.priority))
90
95
  ? subCampaign.priority
91
96
  : Object.values(Enum_1.CampaignPriority)[subCampaign.priority], onChange: function (e) {
92
97
  var newPriority = Object.values(Enum_1.CampaignPriority).indexOf(e.target.value);
@@ -136,3 +136,7 @@ export declare enum adAnalyticType {
136
136
  Spot = 0,
137
137
  Engagements = 1
138
138
  }
139
+ export declare const getCampaignStatus: (isAcm?: boolean) => {
140
+ key: string;
141
+ value: number;
142
+ }[];
@@ -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.adAnalyticType = 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;
15
+ exports.getCampaignStatus = exports.adAnalyticType = 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 Enum_1 = require("./Enum");
17
17
  var Helpers_1 = require("../../Utils/Helpers");
18
18
  var i18n_1 = __importDefault(require("../../i18n"));
@@ -636,3 +636,19 @@ var adAnalyticType;
636
636
  adAnalyticType[adAnalyticType["Spot"] = 0] = "Spot";
637
637
  adAnalyticType[adAnalyticType["Engagements"] = 1] = "Engagements";
638
638
  })(adAnalyticType || (exports.adAnalyticType = adAnalyticType = {}));
639
+ var getCampaignStatus = function (isAcm) {
640
+ var allStatuses = Object.keys(Enum_1.CampaignStatus)
641
+ .filter(function (key) { return isNaN(Number(key)); })
642
+ .map(function (key) { return ({ key: key, value: Enum_1.CampaignStatus[key] }); });
643
+ if (isAcm) {
644
+ return allStatuses.filter(function (status) {
645
+ return status.value === Enum_1.CampaignStatus.Draft ||
646
+ status.value === Enum_1.CampaignStatus.Active ||
647
+ status.value === Enum_1.CampaignStatus.Done;
648
+ });
649
+ }
650
+ else {
651
+ return allStatuses;
652
+ }
653
+ };
654
+ exports.getCampaignStatus = getCampaignStatus;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "awing-library",
3
- "version": "2.1.233-dev",
3
+ "version": "2.1.235-dev",
4
4
  "description": "",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",