@capillarytech/creatives-library 7.17.37-alpha.4 → 7.17.37

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/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.37-alpha.4",
4
+ "version": "7.17.37",
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
+ }
@@ -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 = {
@@ -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 === 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,12 +510,11 @@ export function SlideBoxContent(props) {
510
510
  {
511
511
  isEditZalo &&
512
512
  <Zalo
513
- templateData={templateData}
514
- location={creativesLocationProps}
515
- selectedOfferDetails={selectedOfferDetails}
516
- getDefaultTags={type}
517
- channel={channel}
518
- isFullMode={isFullMode}
513
+ templateData={templateData}
514
+ location={creativesLocationProps}
515
+ selectedOfferDetails={selectedOfferDetails}
516
+ getDefaultTags={type}
517
+ channel={channel}
519
518
  />
520
519
  }
521
520
  {
@@ -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 });
@@ -925,6 +896,9 @@ export class Creatives extends React.Component {
925
896
  handleCloseSlideBox = () => {
926
897
  const { currentChannel = '', slidBoxContent = '' } = this.state;
927
898
  const reloadTemplates = currentChannel === constants.WHATSAPP && slidBoxContent === 'editTemplate';
899
+ if (window.location.search.includes('?channel=whatsapp&mode=create')) {
900
+ window.history.pushState({}, null, '/creatives/ui/v2');
901
+ }
928
902
  this.setState((prevState) => ({
929
903
  ...prevState,
930
904
  templateData: undefined,
@@ -1231,7 +1205,6 @@ Creatives.propTypes = {
1231
1205
  channel: PropTypes.string,
1232
1206
  templateActions: PropTypes.object,
1233
1207
  globalActions: PropTypes.object,
1234
- zaloActions: PropTypes.object,
1235
1208
  cap: PropTypes.object,
1236
1209
  // isLoading: PropTypes.bool,
1237
1210
  templateUserList: PropTypes.array,
@@ -1260,7 +1233,6 @@ function mapDispatchToProps(dispatch) {
1260
1233
  templateActions: bindActionCreators(templateActions, dispatch),
1261
1234
  globalActions: bindActionCreators(globalActions, dispatch),
1262
1235
  actions: bindActionCreators(actions, dispatch),
1263
- zaloActions: bindActionCreators(zaloActions, dispatch),
1264
1236
  };
1265
1237
  }
1266
1238
  export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
@@ -295,3 +295,78 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
295
295
  />
296
296
  </CreativesContainer__SlideBoxWrapper>
297
297
  `;
298
+
299
+ exports[`Test SlideBoxContent container it should clear the url, on channel change from new whatsapp to another 1`] = `
300
+ <CreativesContainer__SlideBoxWrapper
301
+ className="add-creatives-section creatives-library-mode "
302
+ >
303
+ <CapSlideBox
304
+ closeIconPosition="right"
305
+ closeIconSize="m"
306
+ closeIconType="close"
307
+ content={
308
+ <SlideBoxContent
309
+ currentChannel="WHATSAPP"
310
+ getFormData={[Function]}
311
+ handleClose={[Function]}
312
+ onCallTaskSubmit={[Function]}
313
+ onChannelChange={[Function]}
314
+ onCreateComplete={[MockFunction]}
315
+ onCreateNew={[Function]}
316
+ onCreateNextStep={[Function]}
317
+ onEmailModeChange={[Function]}
318
+ onEnterTemplateName={[Function]}
319
+ onFTPSubmit={[MockFunction]}
320
+ onFacebookSubmit={[MockFunction]}
321
+ onMobilepushModeChange={[Function]}
322
+ onPreviewTemplate={[Function]}
323
+ onRemoveTemplateName={[Function]}
324
+ onResetStep={[Function]}
325
+ onSelectTemplate={[Function]}
326
+ onShowTemplates={[Function]}
327
+ onValidationFail={[Function]}
328
+ onWeChatMaptemplateStepChange={[Function]}
329
+ onWechatTemplateChange={[Function]}
330
+ saveMessage={[Function]}
331
+ setIsLoadingContent={[Function]}
332
+ showTemplateName={[Function]}
333
+ slidBoxContent="editTemplate"
334
+ templateStep="modeSelection"
335
+ weChatMaptemplateStep={0}
336
+ weChatTemplateType=""
337
+ />
338
+ }
339
+ footer={
340
+ <SlideBoxFooter
341
+ currentChannel="WHATSAPP"
342
+ onCreateNextStep={[Function]}
343
+ onDiscard={[Function]}
344
+ onEditTemplate={[Function]}
345
+ onSave={[Function]}
346
+ shouldShowContinueFooter={[Function]}
347
+ shouldShowDoneFooter={[Function]}
348
+ slidBoxContent="editTemplate"
349
+ templateStep="modeSelection"
350
+ />
351
+ }
352
+ handleClose={[Function]}
353
+ header={
354
+ <SlideBoxHeader
355
+ channel="WHATSAPP"
356
+ isLoadingContent={true}
357
+ onShowTemplates={[Function]}
358
+ onWeChatMaptemplateStepChange={[Function]}
359
+ showPrefix={true}
360
+ slidBoxContent="editTemplate"
361
+ templateNameRenderProp={[Function]}
362
+ templateStep="modeSelection"
363
+ weChatMaptemplateStep={0}
364
+ weChatTemplateType=""
365
+ />
366
+ }
367
+ position="right"
368
+ show={false}
369
+ size="size-xl"
370
+ />
371
+ </CreativesContainer__SlideBoxWrapper>
372
+ `;
@@ -74,6 +74,22 @@ describe('Test SlideBoxContent container', () => {
74
74
  expect(handleCloseCreatives).toHaveBeenCalledWith(true);
75
75
  });
76
76
 
77
+ it('it should clear the url, on channel change from new whatsapp to another', () => {
78
+ renderFunction(
79
+ 'WHATSAPP',
80
+ 'editTemplate',
81
+ whatsappTemplates,
82
+ whatsappGetTemplateData1,
83
+ );
84
+ delete window.location;
85
+ window.location = new URL('http://127.0.0.1:3030/creatives/ui/v2?channel=whatsapp&mode=create');
86
+ renderedComponent.instance().onEditTemplate();
87
+ renderedComponent.find('CapSlideBox').props().content.props.handleClose();
88
+ expect(renderedComponent).toMatchSnapshot();
89
+ expect(handleCloseCreatives).toHaveBeenCalledTimes(1);
90
+ expect(handleCloseCreatives).toHaveBeenCalledWith(true);
91
+ });
92
+
77
93
  it('campaign message, whatsapp edit all data', () => {
78
94
  renderFunction(
79
95
  'WHATSAPP',
@@ -260,7 +260,6 @@ export class TagList extends React.Component { // eslint-disable-line react/pref
260
260
  modalProps={this.props.modalProps}
261
261
  currentOrgDetails={this.props.currentOrgDetails}
262
262
  channel={this.props.channel}
263
- disabled={this.props.disabled}
264
263
  />
265
264
  </div>
266
265
  );
@@ -287,7 +286,6 @@ TagList.propTypes = {
287
286
  modalProps: PropTypes.any,
288
287
  currentOrgDetails: PropTypes.object,
289
288
  channel: PropTypes.string,
290
- disabled: PropTypes.bool
291
289
  };
292
290
 
293
291
  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 templates are shown here',
508
- },
509
505
  });
@@ -1038,6 +1038,134 @@ exports[`Test Templates container Should render temlates when zalo templates are
1038
1038
  tip="Getting all templates..."
1039
1039
  >
1040
1040
  <div>
1041
+ <div
1042
+ className="pagination-container"
1043
+ >
1044
+ <CapCustomCardList
1045
+ cardList={
1046
+ Array [
1047
+ Object {
1048
+ "content": <CapLabel
1049
+ className="zalo-listing-content desc"
1050
+ type="label19"
1051
+ >
1052
+ Test1
1053
+ </CapLabel>,
1054
+ "extra": Array [
1055
+ <CapTooltip
1056
+ title="Open preview in new tab"
1057
+ >
1058
+ <CapIcon
1059
+ className="view-zalo"
1060
+ onClick={[Function]}
1061
+ style={
1062
+ Object {
1063
+ "marginRight": "16px",
1064
+ }
1065
+ }
1066
+ type="eye"
1067
+ />
1068
+ </CapTooltip>,
1069
+ ],
1070
+ "hoverOption": <CapButton
1071
+ className="select-zalo"
1072
+ isAddBtn={false}
1073
+ onClick={[Function]}
1074
+ type="primary"
1075
+ >
1076
+ Select
1077
+ </CapButton>,
1078
+ "key": "ZALO-card-Test1",
1079
+ "title": <CapRow>
1080
+ <CapLabel
1081
+ className="zalo-template-name"
1082
+ type="label1"
1083
+ >
1084
+
1085
+ </CapLabel>
1086
+ <CapRow
1087
+ align="middle"
1088
+ className="zalo-status-container"
1089
+ type="flex"
1090
+ >
1091
+ <CapStatus
1092
+ color=""
1093
+ height="0.571rem"
1094
+ labelType="label3"
1095
+ text=""
1096
+ type="pending"
1097
+ width="0.571rem"
1098
+ />
1099
+ </CapRow>
1100
+ </CapRow>,
1101
+ },
1102
+ Object {
1103
+ "content": <CapLabel
1104
+ className="zalo-listing-content desc"
1105
+ type="label19"
1106
+ >
1107
+ Test2
1108
+ </CapLabel>,
1109
+ "extra": Array [
1110
+ <CapTooltip
1111
+ title="Open preview in new tab"
1112
+ >
1113
+ <CapIcon
1114
+ className="view-zalo"
1115
+ onClick={[Function]}
1116
+ style={
1117
+ Object {
1118
+ "marginRight": "16px",
1119
+ }
1120
+ }
1121
+ type="eye"
1122
+ />
1123
+ </CapTooltip>,
1124
+ ],
1125
+ "hoverOption": <CapButton
1126
+ className="select-zalo"
1127
+ isAddBtn={false}
1128
+ onClick={[Function]}
1129
+ type="primary"
1130
+ >
1131
+ Select
1132
+ </CapButton>,
1133
+ "key": "ZALO-card-Test2",
1134
+ "title": <CapRow>
1135
+ <CapLabel
1136
+ className="zalo-template-name"
1137
+ type="label1"
1138
+ >
1139
+
1140
+ </CapLabel>
1141
+ <CapRow
1142
+ align="middle"
1143
+ className="zalo-status-container"
1144
+ type="flex"
1145
+ >
1146
+ <CapStatus
1147
+ color=""
1148
+ height="0.571rem"
1149
+ labelType="label3"
1150
+ text=""
1151
+ type="pending"
1152
+ width="0.571rem"
1153
+ />
1154
+ </CapRow>
1155
+ </CapRow>,
1156
+ },
1157
+ ]
1158
+ }
1159
+ fbType="list"
1160
+ key="ZALO-card-list"
1161
+ style={
1162
+ Object {
1163
+ "marginLeft": "16px",
1164
+ }
1165
+ }
1166
+ type="ZALO"
1167
+ />
1168
+ </div>
1041
1169
  <div
1042
1170
  style={
1043
1171
  Object {
@@ -1045,34 +1173,7 @@ exports[`Test Templates container Should render temlates when zalo templates are
1045
1173
  "overflow": "auto",
1046
1174
  }
1047
1175
  }
1048
- >
1049
- <CapHeader
1050
- description={
1051
- <CapLabel
1052
- style={
1053
- Object {
1054
- "textAlign": "center",
1055
- }
1056
- }
1057
- type="label1"
1058
- >
1059
- Please try searching with another term or apply different filter
1060
- </CapLabel>
1061
- }
1062
- descriptionClass=""
1063
- inline={false}
1064
- size="large"
1065
- title={
1066
- <CapHeading
1067
- className="channel-specific-illustration-text"
1068
- type="h3"
1069
- >
1070
- Sorry, we couldn’t find any matches
1071
- </CapHeading>
1072
- }
1073
- titleClass=""
1074
- />
1075
- </div>
1176
+ />
1076
1177
  </div>
1077
1178
  </CapSpin>
1078
1179
  </div>
@@ -10,6 +10,7 @@ export const ERROR = 'ERROR';
10
10
  export const STRING = 'STRING';
11
11
  export const NUMBER = 'NUMBER';
12
12
  export const DATE = 'DATE';
13
+ export const ENABLE = 'ENABLE';
13
14
 
14
15
  export const TAG = 'TAG';
15
16
  export const EMBEDDED = 'embedded';
@@ -4,7 +4,7 @@ import { injectIntl } from "react-intl";
4
4
  import { createStructuredSelector } from "reselect";
5
5
  import { bindActionCreators } from "redux";
6
6
  import { get } from "lodash";
7
- import styled from "styled-components";
7
+ import styled from 'styled-components';
8
8
  import {
9
9
  CapSpin,
10
10
  CapRow,
@@ -15,14 +15,13 @@ import {
15
15
  CapHeading,
16
16
  CapHeader,
17
17
  CapIcon,
18
- CapNotification,
19
18
  } from "@capillarytech/cap-ui-library";
20
19
  import {
21
20
  CAP_SPACE_16,
22
21
  CAP_SPACE_24,
23
22
  CAP_SPACE_32,
24
23
  CAP_WHITE,
25
- } from "@capillarytech/cap-ui-library/styled/variables";
24
+ } from '@capillarytech/cap-ui-library/styled/variables';
26
25
  import messages from "./messages";
27
26
  import withCreatives from "../../hoc/withCreatives";
28
27
  import {
@@ -37,6 +36,7 @@ import {
37
36
  ERROR_ALERT,
38
37
  WARNING_ALERT,
39
38
  ZALO_STATUSES,
39
+ ENABLE,
40
40
  } from "./constants";
41
41
  import "./index.scss";
42
42
  import { makeSelectZalo } from "./selectors";
@@ -49,6 +49,7 @@ import { makeSelectMetaEntities, setInjectedTags } from "../Cap/selectors";
49
49
  import * as globalActions from "../Cap/actions";
50
50
  import { validateTags } from "../../utils/tagValidations";
51
51
 
52
+
52
53
  export const Zalo = ({
53
54
  intl,
54
55
  actions,
@@ -61,16 +62,13 @@ export const Zalo = ({
61
62
  injectedTags,
62
63
  selectedOfferDetails,
63
64
  template,
64
- isFullMode,
65
65
  }) => {
66
66
  const { formatMessage } = intl;
67
67
  const [zaloTemplateListParams, setZaloTemplateListParams] = useState([]);
68
68
  const [templatePreviewUrl, setTemplatePreviewUrl] = useState("");
69
69
  const [tags, updateTags] = useState([]);
70
70
  const [textAreaId, updateTextAreaId] = useState("");
71
- const [templateStatus, setZaloTemplateStatus] = useState(
72
- ZALO_STATUSES.ENABLE
73
- );
71
+ const [templateStatus, setZaloTemplateStatus] = useState(ENABLE);
74
72
 
75
73
  const ZaloFooter = styled.div`
76
74
  background-color: ${CAP_WHITE};
@@ -125,7 +123,6 @@ export const Zalo = ({
125
123
  oa_id: sourceAccountIdentifier,
126
124
  token,
127
125
  id,
128
- actionCallback,
129
126
  });
130
127
  }, []);
131
128
 
@@ -260,7 +257,6 @@ export const Zalo = ({
260
257
  value={value || ""}
261
258
  size="default"
262
259
  onFocus={() => setTextAreaId(name)}
263
- disabled={isFullMode}
264
260
  />
265
261
  );
266
262
  };
@@ -284,12 +280,6 @@ export const Zalo = ({
284
280
  }
285
281
  };
286
282
 
287
- const actionCallback = () => {
288
- CapNotification.error({
289
- message: formatMessage(messages.zaloFailureNotificationTemplate),
290
- });
291
- };
292
-
293
283
  return (
294
284
  <CapSpin spinning={zaloTemplateInfoStatus === REQUEST}>
295
285
  <CapRow type="flex" className="cap-zalo-creatives">
@@ -322,7 +312,6 @@ export const Zalo = ({
322
312
  onContextChange={handleOnTagsContextChange}
323
313
  injectedTags={injectedTags || {}}
324
314
  selectedOfferDetails={selectedOfferDetails}
325
- disabled={isFullMode}
326
315
  />
327
316
  }
328
317
  />
@@ -352,28 +341,26 @@ export const Zalo = ({
352
341
  </CapRow>
353
342
  </CapRow>
354
343
  </CapColumn>
355
- <CapColumn span={10}>
356
- <CapRow className="zalo-preview-container">
357
- <CapRow>
358
- <CapLabel className="preview-head">
359
- {formatMessage(messages.previewHead)}
360
- </CapLabel>
361
- </CapRow>
362
- <CapRow>
363
- <CapLabel className="preview-text">
364
- {formatMessage(messages.previewText)}
365
- </CapLabel>
366
- </CapRow>
367
- <CapRow>
368
- <CapLabel
369
- data-testid="preview-link-button"
370
- onClick={handlePreview}
371
- className="preview-link"
372
- >
373
- {formatMessage(messages.openPreview)}{" "}
374
- <CapIcon type="open-in-new-light"></CapIcon>
375
- </CapLabel>
376
- </CapRow>
344
+ <CapColumn type="flex" span={10} className="zalo-preview-container">
345
+ <CapRow>
346
+ <CapLabel className="preview-head">
347
+ {formatMessage(messages.previewHead)}
348
+ </CapLabel>
349
+ </CapRow>
350
+ <CapRow>
351
+ <CapLabel className="preview-text">
352
+ {formatMessage(messages.previewText)}
353
+ </CapLabel>
354
+ </CapRow>
355
+ <CapRow>
356
+ <CapLabel
357
+ data-testid="preview-link-button"
358
+ onClick={handlePreview}
359
+ className="preview-link"
360
+ >
361
+ {formatMessage(messages.openPreview)}{" "}
362
+ <CapIcon type="open-in-new-light"></CapIcon>
363
+ </CapLabel>
377
364
  </CapRow>
378
365
  </CapColumn>
379
366
  </CapRow>
@@ -42,10 +42,11 @@
42
42
  }
43
43
 
44
44
  .zalo-preview-container {
45
- position: fixed;
46
45
  text-align: center;
47
- padding-left: 72px;
48
- padding-right: 110px;
46
+ position: fixed;
47
+ right: 0;
48
+ padding-left: 194px;
49
+ padding-right: 116px;
49
50
 
50
51
  .preview-head {
51
52
  font-weight: 500;
@@ -70,13 +70,5 @@ export default defineMessages({
70
70
  PENDING_REVIEW: {
71
71
  id: `${prefix}.PENDING_REVIEW`,
72
72
  defaultMessage: 'pending review',
73
- },
74
- zaloFailureNotificationTemplate: {
75
- id: `${prefix}.zaloFailureNotificationTemplate`,
76
- defaultMessage: 'Unable to load zalo template',
77
- },
78
- zaloFailureNotificationPreview: {
79
- id: `${prefix}.zaloFailureNotificationPreview`,
80
- defaultMessage: 'Unable to load zalo preview',
81
- },
73
+ }
82
74
  });
@@ -8,29 +8,23 @@ import {
8
8
  } from "./constants";
9
9
 
10
10
  export function* getTemplateInfoById({ payload }) {
11
- const { preview = "", actionCallback } = payload;
12
11
  try {
13
12
  const res = yield call(Api.getTemplateInfoById, payload);
14
13
  if (res?.success) {
15
14
  yield put({
16
- type: preview ? ZALO_TEMPLATE_PREVIEW_INFO : ZALO_TEMPLATE_INFO_SUCCESS,
15
+ type: payload?.preview
16
+ ? ZALO_TEMPLATE_PREVIEW_INFO
17
+ : ZALO_TEMPLATE_INFO_SUCCESS,
17
18
  result: res?.response || {},
18
19
  });
19
20
  } else {
20
- const errorMsg = res?.message || res?.status?.message;
21
21
  yield put({
22
22
  type: ZALO_TEMPLATE_INFO_ERROR,
23
- error: errorMsg,
23
+ error: res?.error || res?.message,
24
24
  });
25
- if (actionCallback) {
26
- actionCallback(errorMsg);
27
- }
28
25
  }
29
26
  } catch (error) {
30
27
  yield put({ type: ZALO_TEMPLATE_INFO_ERROR, error });
31
- if (actionCallback) {
32
- actionCallback(error);
33
- }
34
28
  }
35
29
  }
36
30