@capillarytech/creatives-library 7.17.39-alpha.5 → 7.17.40-alpha.0

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.
Files changed (39) hide show
  1. package/components/CapTagList/index.js +1 -1
  2. package/components/CapTagList/messages.js +4 -0
  3. package/components/FormBuilder/index.js +2 -2
  4. package/components/FormBuilder/messages.js +8 -0
  5. package/containers/App/constants.js +26 -0
  6. package/containers/Assets/Gallery/index.js +1 -1
  7. package/containers/Assets/Gallery/messages.js +4 -0
  8. package/containers/Email/index.js +1 -1
  9. package/containers/Templates/index.js +1 -1
  10. package/containers/Templates/messages.js +4 -0
  11. package/index.js +2 -2
  12. package/package.json +1 -1
  13. package/services/api.js +6 -6
  14. package/utils/common.js +13 -2
  15. package/utils/tests/common.test.js +5 -5
  16. package/v2Components/CapTagList/index.js +1 -2
  17. package/v2Components/FormBuilder/index.js +1 -1
  18. package/v2Components/FormBuilder/messages.js +4 -0
  19. package/v2Containers/CreativesContainer/SlideBoxContent.js +6 -12
  20. package/v2Containers/CreativesContainer/SlideBoxHeader.js +3 -2
  21. package/v2Containers/CreativesContainer/index.js +7 -55
  22. package/v2Containers/CreativesContainer/messages.js +9 -1
  23. package/v2Containers/TagList/index.js +18 -5
  24. package/v2Containers/Templates/index.js +3 -17
  25. package/v2Containers/Templates/messages.js +0 -4
  26. package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +129 -28
  27. package/v2Containers/TemplatesV2/tests/index.test.js +0 -1
  28. package/v2Containers/Zalo/constants.js +1 -0
  29. package/v2Containers/Zalo/index.js +185 -301
  30. package/v2Containers/Zalo/index.scss +4 -3
  31. package/v2Containers/Zalo/messages.js +5 -17
  32. package/v2Containers/Zalo/saga.js +4 -10
  33. package/v2Containers/Zalo/selectors.js +10 -8
  34. package/v2Containers/Zalo/tests/index.test.js +48 -67
  35. package/v2Containers/Zalo/tests/mockData.js +5045 -5056
  36. package/v2Containers/Zalo/tests/reducer.test.js +3 -3
  37. package/v2Containers/Zalo/tests/saga.test.js +2 -5
  38. package/v2Containers/Zalo/tests/selectors.test.js +52 -0
  39. package/v2Containers/Zalo/tests/selector.test.js +0 -28
@@ -183,7 +183,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
183
183
  onVisibleChange={this.togglePopoverVisibility}
184
184
  content={<div>
185
185
  <Spin tip="Getting tags..." spinning={this.props.loading}>
186
- <Search style={{ marginBottom: 8, width: '250px'}} placeholder="Search" onChange={this.onChange} />
186
+ <Search style={{ marginBottom: 8, width: '250px'}} placeholder={this.props.intl.formatMessage(messages.searchText)} onChange={this.onChange} />
187
187
  {this.props.moduleFilterEnabled ? <CapSelect getPopupContainer={(triggerNode) => triggerNode.parentNode} style={{width: '250px', marginBottom: '16px', minWidth: 'initial', display: 'inherit'}} onChange={this.props.onContextChange} defaultValue="All" options={options}>
188
188
  </CapSelect> : ''}
189
189
  <Tree
@@ -34,4 +34,8 @@ export default defineMessages({
34
34
  id: 'creatives.components.CapTagList.loyalty',
35
35
  defaultMessage: 'Loyalty',
36
36
  },
37
+ "searchText": {
38
+ id: 'creatives.components.CapTagList.searchText',
39
+ defaultMessage: 'Search',
40
+ },
37
41
  });
@@ -1516,8 +1516,8 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1516
1516
  this.setState({errorData: formData});
1517
1517
  } else {
1518
1518
  const tempTab = ifError ? currentTab : this.state.currentTab;
1519
- const version = `Version ${this.state.currentTab}`;
1520
- formData[tabCount].name = `Copy of ${formData[tempTab - 1].name ? formData[tempTab - 1].name : version}`;
1519
+ const version = `${this.props.intl.formatMessage(messages.version)} ${this.state.currentTab}`;
1520
+ formData[tabCount].name = `${this.props.intl.formatMessage(messages.copyOf)} ${formData[tempTab - 1].name ? formData[tempTab - 1].name : version}`;
1521
1521
  formData[tabCount].base = false;
1522
1522
  const initialTab = this.state.currentTab;
1523
1523
  this.setState({formData, tabCount: tabCount + 1, currentTab: tabCount + 1, tabKey: formData[tabCount].tabKey}, () => {
@@ -54,4 +54,12 @@ export default defineMessages({
54
54
  id: 'creatives.components.FormBuilder.ok',
55
55
  defaultMessage: 'Ok',
56
56
  },
57
+ copyOf: {
58
+ id: 'creatives.components.FormBuilder.copyOf',
59
+ defaultMessage: 'Copy of',
60
+ },
61
+ Version: {
62
+ id: 'creatives.components.FormBuilder.version',
63
+ defaultMessage: 'Version',
64
+ },
57
65
  });
@@ -7,6 +7,8 @@ export const TRAI_DLT = 'TRAI_DLT';
7
7
  export const CARD_BASED_SCOPE = 'CARD_BASED_SCOPE';
8
8
  export const HOSPITALITY_BASED_SCOPE = 'HOSPITALITY_BASED_SCOPE';
9
9
  export const REGISTRATION_CUSTOM_FIELD = 'Registration custom fields';
10
+ export const GIFT_CARDS = 'GIFT_CARDS';
11
+ export const PROMO_ENGINE = 'PROMO_ENGINE';
10
12
  export const CUSTOM_TAG = 'CustomTagMessage';
11
13
  export const CUSTOMER_EXTENDED_FIELD = 'Customer extended fields';
12
14
  export const EXTENDED_TAG = 'ExtendedTagMessage';
@@ -43,5 +45,29 @@ export const HOSPITALITY_RELATED_TAGS = [
43
45
  "email",
44
46
  "resID_Source",
45
47
  ];
48
+ export const GIFT_VOUCHER_RELATED_TAGS = [
49
+ "gift_voucher",
50
+ "gift_voucher_expiry_date.FORMAT_1",
51
+ "gift_voucher_expiry_date.FORMAT_2",
52
+ "gift_voucher_expiry_date.FORMAT_3",
53
+ "gift_voucher_expiry_date.FORMAT_4",
54
+ "gift_voucher_expiry_date.FORMAT_5",
55
+ "gift_voucher_expiry_date.FORMAT_6",
56
+ "gift_voucher_expiry_date.FORMAT_7",
57
+ "gift_voucher_expiry_date.FORMAT_8",
58
+ "gift_voucher_expiry_date",
59
+ ];
60
+ export const PROMO_ENGINE_RELATED_TAGS = [
61
+ "promotion",
62
+ "promotion_expiry_date.FORMAT_1",
63
+ "promotion_expiry_date.FORMAT_2",
64
+ "promotion_expiry_date.FORMAT_3",
65
+ "promotion_expiry_date.FORMAT_4",
66
+ "promotion_expiry_date.FORMAT_5",
67
+ "promotion_expiry_date.FORMAT_6",
68
+ "promotion_expiry_date.FORMAT_7",
69
+ "promotion_expiry_date.FORMAT_8",
70
+ "promotion_expiry_date",
71
+ ];
46
72
 
47
73
  export const CUSTOMER_BARCODE_TAG = "customer_barcode";
@@ -336,7 +336,7 @@ export class Gallery extends React.Component { // eslint-disable-line react/pref
336
336
  <CapInput
337
337
  className="search-text"
338
338
  style={{width: '210px'}}
339
- placeholder="Search"
339
+ placeholder={this.props.intl.formatMessage(messages.searchText)}
340
340
  prefix={<i className="material-icons" style={{color: '#707070', fontSize: '16px'}}>search</i>}
341
341
  value={this.state.searchText}
342
342
  onChange={(e) => this.searchAsset(e.target.value)}
@@ -86,4 +86,8 @@ export default defineMessages({
86
86
  id: 'creatives.containers.Assets.Gallery.assetDeleteFailed',
87
87
  defaultMessage: 'Image deletion failed.',
88
88
  },
89
+ searchText: {
90
+ id: 'creatives.components.CapTagList.searchText',
91
+ defaultMessage: 'Search',
92
+ },
89
93
  });
@@ -3104,7 +3104,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
3104
3104
  <CapInput
3105
3105
  className="search-text"
3106
3106
  style={{width: '210px'}}
3107
- placeholder="Search"
3107
+ placeholder={this.props.intl.formatMessage(messages.searchText)}
3108
3108
  prefix={<i className="material-icons" style={{color: '#707070', fontSize: '16px'}}>search</i>}
3109
3109
  value={this.state.searchText}
3110
3110
  onChange={(e) => this.searchAsset(e.target.value)}
@@ -866,7 +866,7 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
866
866
  duplicateTemplate(template) {
867
867
 
868
868
  const duplicateObj = _.cloneDeep(template);
869
- duplicateObj.name = `Copy of ${template.name} ${moment().format('MM-DD-YYYY HH:mm:ss')}`;
869
+ duplicateObj.name = `${this.props.intl.formatMessage(messages.copyOf)} ${template.name} ${moment().format('MM-DD-YYYY HH:mm:ss')}`;
870
870
  delete duplicateObj._id;
871
871
  if (this.state.channel.toLowerCase() === "sms") {
872
872
  this.props.smsActions.createTemplate(duplicateObj);
@@ -330,4 +330,8 @@ export default defineMessages({
330
330
  id: 'creatives.containers.Templates.Line',
331
331
  defaultMessage: 'Line',
332
332
  },
333
+ "copyOf": {
334
+ id: 'creatives.containers.Templates.copyOf',
335
+ defaultMessage: 'Copy of',
336
+ },
333
337
  });
package/index.js CHANGED
@@ -124,8 +124,8 @@ const ViberContainer = {Viber, viberReducer, viberSaga};
124
124
  const FacebookPreviewContainer = { FacebookPreview, facebookPreviewReducer, facebookPreviewSaga };
125
125
  const SmsTraiContainer = {SmsTraiCreate, SmsTraiCreateReducer, SmsTraiCreateSaga};
126
126
  const WhatsappContainer = { Whatsapp, whatsappReducer, whatsappSaga };
127
+ const zaloContainer = { Zalo, zaloReducer, zaloSaga };
127
128
  const RcsContainer = { Rcs, rcsReducer, rcsSaga };
128
- const ZaloContainer = { Zalo, zaloReducer, zaloSaga };
129
129
 
130
130
  const GalleryContainer = {Gallery, galleryReducer, gallerySagas};
131
131
  const FTPContainer = {FTP, FTPReducer, FTPSagas};
@@ -173,6 +173,6 @@ export { CapContainer,
173
173
  FacebookPreviewContainer,
174
174
  SmsTraiContainer,
175
175
  WhatsappContainer,
176
+ zaloContainer,
176
177
  RcsContainer,
177
- ZaloContainer,
178
178
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.39-alpha.5",
4
+ "version": "7.17.40-alpha.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -90,7 +90,7 @@ function checkStatus(response) {
90
90
  const isLoginPage = window.location.pathname.indexOf('/login') !== -1;
91
91
  if (!isLoginPage) redirectIfUnauthenticated(response);
92
92
 
93
- const error = new Error(statusText);
93
+ const error = new Error({ statusText, status });
94
94
  error.response = response;
95
95
  error.isError = true;
96
96
  error.status = status;
@@ -493,14 +493,14 @@ export const getSenderDetails = (channel, orgUnitId) => {
493
493
  export const getCdnTransformationConfig = () => {
494
494
  const url = `${API_ENDPOINT}/common/getCdnTransformationConfig`;
495
495
  return request(url, getAPICallObject('GET'));
496
- };
496
+ }
497
497
 
498
498
  export const getS3UrlFileSizes = (data) => {
499
499
  const url = `${API_ENDPOINT}/assets/files/metadata`;
500
500
  return request(url, getAPICallObject('POST', data));
501
- };
501
+ }
502
502
 
503
503
  export const getTemplateInfoById = ({id, username, oa_id, token}) => {
504
- const url = `${API_ENDPOINT}/templates/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}`;
505
- return request(url, getAPICallObject('GET'));
506
- };
504
+ const url = `${API_ENDPOINT}/templates/${id}/Zalo?username=${username}&oa_id=${oa_id}&token=${token}`;
505
+ return request(url, getAPICallObject('GET'));
506
+ }
package/utils/common.js CHANGED
@@ -7,6 +7,8 @@ import {
7
7
  CARD_BASED_SCOPE,
8
8
  HOSPITALITY_RELATED_TAGS,
9
9
  HOSPITALITY_BASED_SCOPE,
10
+ GIFT_CARDS,
11
+ PROMO_ENGINE,
10
12
  EXTENDED_TAG,
11
13
  CUSTOMER_EXTENDED_FIELD,
12
14
  CUSTOM_TAG,
@@ -66,7 +68,15 @@ export const hasHospitalityBasedScope = Auth.hasFeatureAccess.bind(
66
68
  null,
67
69
  HOSPITALITY_BASED_SCOPE,
68
70
  );
71
+ export const hasPromoFeature = Auth.hasFeatureAccess.bind(
72
+ null,
73
+ PROMO_ENGINE,
74
+ );
69
75
 
76
+ export const hasGiftVoucherFeature = Auth.hasFeatureAccess.bind(
77
+ null,
78
+ GIFT_CARDS,
79
+ );
70
80
  export const hasJPLocaleHideFeatureEnabled = Auth.hasFeatureAccess.bind(
71
81
  null,
72
82
  JP_LOCALE_HIDE_FEATURE,
@@ -294,8 +304,8 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
294
304
  return isTraiDltFeature;
295
305
  };
296
306
 
297
-
298
- export const intlKeyGenerator = (value = "") => String(value).replace(/[^a-zA-Z0-9_]/g, "").toLowerCase();
307
+ //Input: " Spaces In Input "---> Output: "spaces_in_input"
308
+ export const intlKeyGenerator = (value = "") => String(value).replace(/[^a-zA-Z0-9_ ]/g, "").replace(/ /g, "_").toLowerCase();
299
309
 
300
310
  export const handleInjectedData = (data, scope) => {
301
311
  let tagType;
@@ -307,6 +317,7 @@ export const handleInjectedData = (data, scope) => {
307
317
  } else if (tag?.name === CUSTOMER_EXTENDED_FIELD) {
308
318
  tagType = EXTENDED_TAG;
309
319
  }
320
+
310
321
  if (tag?.name) {
311
322
  const name = tag.name;
312
323
  const key = intlKeyGenerator(name);
@@ -51,7 +51,7 @@ describe("handleInjectedData", () => {
51
51
  const result = handleInjectedData(data, "scope");
52
52
  const intlKey = intlKeyGenerator("scope");
53
53
  expect(intlKey).toEqual('scope');
54
- expect(result.tag1.name).toEqual(<FormattedMessage defaultMessage="Registration Fields" id="scope.registrationfields" values={{}} />);
54
+ expect(result.tag1.name).toEqual(<FormattedMessage defaultMessage="Registration Fields" id="scope.registration_fields" values={{}} />);
55
55
  });
56
56
 
57
57
  it("adds tagType for Registration custom fields", () => {
@@ -65,7 +65,7 @@ describe("handleInjectedData", () => {
65
65
  const intlKey = intlKeyGenerator();
66
66
  expect(intlKey).toEqual('');
67
67
  expect(result.tag1.name).toEqual(
68
- <FormattedMessage defaultMessage="Registration custom fields" id="scope.registrationcustomfields_name.CustomTagMessage" values={{}} />
68
+ <FormattedMessage defaultMessage="Registration custom fields" id="scope.registration_custom_fields_name.CustomTagMessage" values={{}} />
69
69
  );
70
70
  });
71
71
 
@@ -79,7 +79,7 @@ describe("handleInjectedData", () => {
79
79
  const result = handleInjectedData(data, "scope");
80
80
 
81
81
  expect(result.tag1.name).toEqual(
82
- <FormattedMessage defaultMessage="Customer extended fields" id="scope.customerextendedfields_name.ExtendedTagMessage" values={{}} />
82
+ <FormattedMessage defaultMessage="Customer extended fields" id="scope.customer_extended_fields_name.ExtendedTagMessage" values={{}} />
83
83
  );
84
84
  });
85
85
  it("adds tagType for Customer extended fields fields", () => {
@@ -157,7 +157,7 @@ describe("handleInjectedData", () => {
157
157
  const result = handleInjectedData(data, "scope");
158
158
 
159
159
  expect(result.tag1.subtags.subtag1.desc).toEqual(
160
- <FormattedMessage defaultMessage="Enter your first name" id="scope.enteryourfirstname" values={{}} />
160
+ <FormattedMessage defaultMessage="Enter your first name" id="scope.enter_your_first_name" values={{}} />
161
161
  );
162
162
  });
163
163
  it("replaces subtag name desc with intl key", () => {
@@ -175,7 +175,7 @@ describe("handleInjectedData", () => {
175
175
  const result = handleInjectedData(data, "scope");
176
176
 
177
177
  expect(result.tag1.subtags.subtag1.desc).toEqual(
178
- <FormattedMessage defaultMessage="Enter your first name" id="scope.enteryourfirstname" values={{}} />
178
+ <FormattedMessage defaultMessage="Enter your first name" id="scope.enter_your_first_name" values={{}} />
179
179
  );
180
180
  });
181
181
  });
@@ -321,7 +321,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
321
321
  trigger="click"
322
322
  placement={translationLang === "ja-JP" && channel === 'EMAIL' ? "bottom" : "rightTop"}
323
323
  >
324
- <CapButton disabled={this?.props?.disabled} isAddBtn type="flat">{label || ''}</CapButton>
324
+ <CapButton isAddBtn type="flat">{label || ''}</CapButton>
325
325
  </CapPopover>
326
326
  }
327
327
  <CapModal
@@ -358,7 +358,6 @@ CapTagList.propTypes = {
358
358
  disableTagsDetails: PropTypes.object,
359
359
  currentOrgDetails: PropTypes.object,
360
360
  channel: PropTypes.string,
361
- disabled: PropTypes.bool
362
361
  };
363
362
 
364
363
  CapTagList.defaultValue = {
@@ -1669,7 +1669,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1669
1669
  } else {
1670
1670
  const tempTab = ifError ? currentTab : this.state.currentTab;
1671
1671
  const version = `Version ${this.state.currentTab}`;
1672
- formData[tabCount].name = `Copy of ${formData[tempTab - 1].name ? formData[tempTab - 1].name : version}`;
1672
+ formData[tabCount].name = `${this.props.intl.formatMessage(messages.copyOf)} ${formData[tempTab - 1].name ? formData[tempTab - 1].name : version}`;
1673
1673
  formData[tabCount].base = false;
1674
1674
  const initialTab = this.state.currentTab;
1675
1675
  this.setState({formData, tabCount: tabCount + 1, currentTab: tabCount + 1, tabKey: formData[tabCount].tabKey}, () => {
@@ -86,4 +86,8 @@ export default defineMessages({
86
86
  id: 'creatives.componentsV2.FormBuilder.imageReUpload',
87
87
  defaultMessage: 'Re upload',
88
88
  },
89
+ copyOf: {
90
+ id: 'creatives.componentsV2.FormBuilder.copyOf',
91
+ defaultMessage: 'Copy of',
92
+ },
89
93
  });
@@ -213,7 +213,7 @@ export function SlideBoxContent(props) {
213
213
  isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
214
214
  isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
215
215
  isEditFTP = isEdit && [constants.NO_COMMUNICATION, constants.FTP].includes(channel);
216
- isEditZalo = isEdit && channel?.toUpperCase() === constants.ZALO;
216
+ isEditZalo = isEdit && channel === constants.ZALO
217
217
  }
218
218
  const isDltEnabled = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
219
219
  const hasJPLocaleHideFeatureEnabled = commonUtil?.hasJPLocaleHideFeatureEnabled();
@@ -510,17 +510,11 @@ export function SlideBoxContent(props) {
510
510
  {
511
511
  isEditZalo &&
512
512
  <Zalo
513
- isFullMode={isFullMode}
514
- templateData={templateData}
515
- getFormData={getFormData}
516
- getDefaultTags={type}
517
- forwardedTags={forwardedTags}
518
- selectedOfferDetails={selectedOfferDetails}
519
- location={{
520
- pathname: `/zalo/edit`,
521
- query,
522
- search: '',
523
- }}
513
+ templateData={templateData}
514
+ location={creativesLocationProps}
515
+ selectedOfferDetails={selectedOfferDetails}
516
+ getDefaultTags={type}
517
+ channel={channel}
524
518
  />
525
519
  }
526
520
  {
@@ -61,8 +61,9 @@ export function SlideBoxHeader(props) {
61
61
  email: <FormattedMessage {...messages.emailHeader} />,
62
62
  mobilepush: <FormattedMessage {...messages.pushNotificationHeader} />,
63
63
  wechat: <FormattedMessage {...messages.wechat} />,
64
- no_communication: 'NO_COMMUNICATION',
65
- ftp: 'FTP',
64
+ line: <FormattedMessage {...messages.lineHeader} />,
65
+ no_communication: <FormattedMessage {...messages.noCommunication} />,
66
+ ftp: <FormattedMessage {...messages.ftp} />,
66
67
  whatsapp: <FormattedMessage {...messages.whatsappTemplate} />,
67
68
  rcs: <FormattedMessage {...messages.rcsCreative} />,
68
69
  zalo: <FormattedMessage {...messages.zaloTemplate} />,
@@ -1,12 +1,8 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import {
4
- CapSlideBox,
5
- CapHeader,
6
- CapLink,
7
- CapInput,
8
- CapNotification,
9
- } from "@capillarytech/cap-ui-library";
4
+ CapSlideBox, CapHeader, CapLink, CapInput,
5
+ } from '@capillarytech/cap-ui-library';
10
6
  import { injectIntl, FormattedMessage } from 'react-intl';
11
7
  import classnames from 'classnames';
12
8
  import {isEmpty, get, forEach, cloneDeep} from 'lodash';
@@ -27,10 +23,8 @@ import { gtmPush } from '../../utils/gtmTrackers';
27
23
  import './index.scss';
28
24
  import * as templateActions from '../Templates/actions';
29
25
  import * as globalActions from '../Cap/actions';
30
- import * as zaloActions from '../Zalo/actions';
31
26
  import {isLoading as isLoadingSelector} from './selectors';
32
27
  import messages from './messages';
33
- import zaloMessages from '../Zalo/messages';
34
28
  import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
35
29
  import { makeSelectFetchingCmsData } from '../Email/selectors';
36
30
  import { IMAGE as LINE_IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, VIDEO as LINE_VIDEO, TEMPLATE, STICKER } from '../Line/Container/constants';
@@ -103,35 +97,12 @@ export class Creatives extends React.Component {
103
97
  }
104
98
  this.setState(data);
105
99
  };
106
-
107
- actionCallback = () => {
108
- CapNotification.error({
109
- message: <FormattedMessage {...zaloMessages.zaloFailureNotificationPreview}/>,
110
- });
111
- };
112
-
113
100
  onPreviewTemplate = (template) => {
114
- if (template.type !== constants.ZALO.toLowerCase()) {
115
- const templateData = template;
116
- const usersList = commonUtil.getMergedUserList(this.props.templateUserList);
117
- const userId = parseInt(template.updatedBy, 10);
118
- templateData.updatedByName = commonUtil.getUserNameById(userId, usersList );
119
- this.setState({ slidBoxContent: 'preview', templateData });
120
- } else {
121
- const {
122
- name = "",
123
- sourceAccountIdentifier = "",
124
- configs: { token = "" } = {},
125
- } = get(this.props, "Templates.weCrmAccounts[0]", {});
126
- this.props.zaloActions.getTemplateInfoById({
127
- username: name,
128
- oa_id: sourceAccountIdentifier,
129
- token,
130
- id: template?._id,
131
- preview: true,
132
- actionCallback: this.actionCallback,
133
- });
134
- }
101
+ const templateData = template;
102
+ const usersList = commonUtil.getMergedUserList(this.props.templateUserList);
103
+ const userId = parseInt(template.updatedBy, 10);
104
+ templateData.updatedByName = commonUtil.getUserNameById(userId, usersList );
105
+ this.setState({ slidBoxContent: 'preview', templateData });
135
106
  };
136
107
  onEditTemplate = () => {
137
108
  this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true, templateNameExists: true });
@@ -500,14 +471,6 @@ export class Creatives extends React.Component {
500
471
  },
501
472
  },
502
473
  };
503
- break;
504
- }
505
- case constants.ZALO: {
506
- creativesTemplateData = {
507
- type: constants.ZALO,
508
- ...templateData,
509
- };
510
- break;
511
474
  }
512
475
  default:
513
476
  break;
@@ -808,15 +771,6 @@ export class Creatives extends React.Component {
808
771
  }
809
772
  }
810
773
  break;
811
- case constants.ZALO: {
812
- if (template.value) {
813
- templateData = {
814
- ...template.value,
815
- };
816
- templateData?.type && delete templateData.type;
817
- }
818
- }
819
- break;
820
774
  default:
821
775
  break;
822
776
  }
@@ -1251,7 +1205,6 @@ Creatives.propTypes = {
1251
1205
  channel: PropTypes.string,
1252
1206
  templateActions: PropTypes.object,
1253
1207
  globalActions: PropTypes.object,
1254
- zaloActions: PropTypes.object,
1255
1208
  cap: PropTypes.object,
1256
1209
  // isLoading: PropTypes.bool,
1257
1210
  templateUserList: PropTypes.array,
@@ -1280,7 +1233,6 @@ function mapDispatchToProps(dispatch) {
1280
1233
  templateActions: bindActionCreators(templateActions, dispatch),
1281
1234
  globalActions: bindActionCreators(globalActions, dispatch),
1282
1235
  actions: bindActionCreators(actions, dispatch),
1283
- zaloActions: bindActionCreators(zaloActions, dispatch),
1284
1236
  };
1285
1237
  }
1286
1238
  export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
@@ -341,5 +341,13 @@ export default defineMessages({
341
341
  "wechat": {
342
342
  id: `${scope}.wechat`,
343
343
  defaultMessage: `Wechat`,
344
- }
344
+ },
345
+ "ftp": {
346
+ id: `${scope}.ftp`,
347
+ defaultMessage: `FTP`,
348
+ },
349
+ "noCommunication": {
350
+ id: `${scope}.noCommunication`,
351
+ defaultMessage: `NO_COMMUNICATION`,
352
+ },
345
353
  });
@@ -22,7 +22,8 @@ import './_tagList.scss';
22
22
  import { selectCurrentOrgDetails } from '../Cap/selectors';
23
23
  import { injectIntl } from 'react-intl';
24
24
  import { scope } from './messages';
25
- import { handleInjectedData } from '../../utils/common';
25
+ import { handleInjectedData, hasGiftVoucherFeature, hasPromoFeature } from '../../utils/common';
26
+ import { GIFT_VOUCHER_RELATED_TAGS, PROMO_ENGINE_RELATED_TAGS } from '../../containers/App/constants';
26
27
 
27
28
  const TreeNode = Tree.TreeNode;
28
29
 
@@ -95,10 +96,24 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
95
96
  }
96
97
  populateTags(tagsList) {
97
98
  const mainTags = {};
99
+ const excludedTags = [];
100
+ if (!hasPromoFeature()) {
101
+ excludedTags.push(...PROMO_ENGINE_RELATED_TAGS);
102
+ //filtering PROMO_ENGINE_RELATED_TAGS if org does not have PROMO_ENGINE feature enabled
103
+ }
104
+ if (!hasGiftVoucherFeature()) {
105
+ //filtering GIFT_VOUCHER_RELATED_TAGS if org does not have GIFT_CARDS feature enabled
106
+ excludedTags.push(...GIFT_VOUCHER_RELATED_TAGS);
107
+ }
98
108
  //Form tags object with tag headers
99
109
  _.forEach(tagsList, (temp) => {
100
110
  const tag = temp.definition;
101
- const { locale : userLocale } = this.props?.intl || {};
111
+ const { locale: userLocale } = this.props?.intl || {};
112
+
113
+ // Check if the tag.value should be skipped based on feature control
114
+ if (_.includes(excludedTags, tag.value)) {
115
+ return; // Skip processing this tag
116
+ }
102
117
  if (!tag['tag-header']) {
103
118
  mainTags[tag.value] = {
104
119
  "name": tag?.label[userLocale] ? tag?.label[userLocale] : tag?.label?.en,
@@ -117,7 +132,7 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
117
132
  });
118
133
 
119
134
  const mainTagsCloned = _.cloneDeep(mainTags);
120
- //Insert subtags in tag headers and reomve them from top level
135
+ //Insert subtags in tag headers and remove them from top level
121
136
  const result = {};
122
137
  _.forEach(mainTagsCloned, (tag, key) => {
123
138
  if (tag['tag-header']) {
@@ -260,7 +275,6 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
260
275
  modalProps={this.props.modalProps}
261
276
  currentOrgDetails={this.props.currentOrgDetails}
262
277
  channel={this.props.channel}
263
- disabled={this.props.disabled}
264
278
  />
265
279
  </div>
266
280
  );
@@ -287,7 +301,6 @@ TagList.propTypes = {
287
301
  modalProps: PropTypes.any,
288
302
  currentOrgDetails: PropTypes.object,
289
303
  channel: PropTypes.string,
290
- disabled: PropTypes.bool
291
304
  };
292
305
 
293
306
  const mapStateToProps = createStructuredSelector({
@@ -869,11 +869,10 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
869
869
  }
870
870
 
871
871
  filterZaloTemplates = (templates) => {
872
- let { selectedZaloStatus } = this.state;
873
- selectedZaloStatus = !this.props.isFullMode ? ZALO_STATUSES.ENABLE : selectedZaloStatus;
872
+ const { selectedZaloStatus } = this.state;
874
873
  if (selectedZaloStatus) {
875
- return templates?.filter((template) => template?.versions?.base?.content?.zalo?.status === selectedZaloStatus);
876
- }
874
+ return templates?.filter((template) => template?.versions?.base?.content?.zalo.status === selectedZaloStatus);
875
+ }
877
876
  return templates;
878
877
  }
879
878
 
@@ -1910,12 +1909,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1910
1909
 
1911
1910
  selectTemplate = (id) => find(this.props.TemplatesList, {_id: id})
1912
1911
 
1913
- actionCallback = () => {
1914
- CapNotification.error({
1915
- message: this.props.intl.formatMessage(zaloMessages.zaloFailureNotificationPreview),
1916
- });
1917
- };
1918
-
1919
1912
  handlePreviewClick(template, modeType) {
1920
1913
  if (this.state.channel.toLowerCase() !== ZALO_LOWERCASE) {
1921
1914
  this.togglePreview();
@@ -1958,7 +1951,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
1958
1951
  token: token,
1959
1952
  id: template?._id,
1960
1953
  preview: true,
1961
- actionCallback: this.actionCallback,
1962
1954
  });
1963
1955
  }
1964
1956
  }
@@ -2908,12 +2900,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2908
2900
  ) : null
2909
2901
  }
2910
2902
 
2911
- {
2912
- channel.toLowerCase() === ZALO_LOWERCASE && !isFullMode ? (
2913
- <CapInfoNote message={formatMessage(messages.zaloOnlyApprovedTemplates)} />
2914
- ) : null
2915
- }
2916
-
2917
2903
  <CapRow>
2918
2904
  <Pagination onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
2919
2905
  {this.getTemplateDataForGrid({ isLoading, loadingTip, channel: this.state.channel, templates: this.state.searchingZaloTemplate ? this.state.searchedZaloTemplates : this.props.TemplatesList, filterContent, handlers: { handlePreviewClick: this.handlePreviewClick, handleEditClick: this.handleEditClick}})}
@@ -502,8 +502,4 @@ export default defineMessages({
502
502
  id: `${scope}.zaloPreview`,
503
503
  defaultMessage: 'Open preview in new tab',
504
504
  },
505
- "zaloOnlyApprovedTemplates": {
506
- id: `${scope}.zaloOnlyApprovedTemplates`,
507
- defaultMessage: 'Only enabled/approved templates are shown here',
508
- },
509
505
  });