@capillarytech/creatives-library 7.17.37-alpha.3 → 7.17.37-beta.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.
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.3",
4
+ "version": "7.17.37-beta.0",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -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
  {
@@ -23,7 +23,6 @@ import { gtmPush } from '../../utils/gtmTrackers';
23
23
  import './index.scss';
24
24
  import * as templateActions from '../Templates/actions';
25
25
  import * as globalActions from '../Cap/actions';
26
- import * as zaloActions from '../Zalo/actions';
27
26
  import {isLoading as isLoadingSelector} from './selectors';
28
27
  import messages from './messages';
29
28
  import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
@@ -99,26 +98,11 @@ export class Creatives extends React.Component {
99
98
  this.setState(data);
100
99
  };
101
100
  onPreviewTemplate = (template) => {
102
- if (template.type !== constants.ZALO.toLowerCase()) {
103
- const templateData = template;
104
- const usersList = commonUtil.getMergedUserList(this.props.templateUserList);
105
- const userId = parseInt(template.updatedBy, 10);
106
- templateData.updatedByName = commonUtil.getUserNameById(userId, usersList );
107
- this.setState({ slidBoxContent: 'preview', templateData });
108
- } else {
109
- const {
110
- name = "",
111
- sourceAccountIdentifier = "",
112
- configs: { token = "" } = {},
113
- } = get(this.props, "Templates.weCrmAccounts[0]", {});
114
- this.props.zaloActions.getTemplateInfoById({
115
- username: name,
116
- oa_id: sourceAccountIdentifier,
117
- token,
118
- id: template?._id,
119
- preview: true,
120
- });
121
- }
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 });
122
106
  };
123
107
  onEditTemplate = () => {
124
108
  this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true, templateNameExists: true });
@@ -1218,7 +1202,6 @@ Creatives.propTypes = {
1218
1202
  channel: PropTypes.string,
1219
1203
  templateActions: PropTypes.object,
1220
1204
  globalActions: PropTypes.object,
1221
- zaloActions: PropTypes.object,
1222
1205
  cap: PropTypes.object,
1223
1206
  // isLoading: PropTypes.bool,
1224
1207
  templateUserList: PropTypes.array,
@@ -1247,7 +1230,6 @@ function mapDispatchToProps(dispatch) {
1247
1230
  templateActions: bindActionCreators(templateActions, dispatch),
1248
1231
  globalActions: bindActionCreators(globalActions, dispatch),
1249
1232
  actions: bindActionCreators(actions, dispatch),
1250
- zaloActions: bindActionCreators(zaloActions, dispatch),
1251
1233
  };
1252
1234
  }
1253
1235
  export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
@@ -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
 
@@ -2901,12 +2900,6 @@ export class Templates extends React.Component { // eslint-disable-line react/pr
2901
2900
  ) : null
2902
2901
  }
2903
2902
 
2904
- {
2905
- channel.toLowerCase() === ZALO_LOWERCASE && !isFullMode ? (
2906
- <CapInfoNote message={formatMessage(messages.zaloOnlyApprovedTemplates)} />
2907
- ) : null
2908
- }
2909
-
2910
2903
  <CapRow>
2911
2904
  <Pagination onPageChange={templates.length ? this.onPaginationChange : () => {}} paginationSelector="pagination-container">
2912
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,
@@ -21,7 +21,7 @@ import {
21
21
  CAP_SPACE_24,
22
22
  CAP_SPACE_32,
23
23
  CAP_WHITE,
24
- } from "@capillarytech/cap-ui-library/styled/variables";
24
+ } from '@capillarytech/cap-ui-library/styled/variables';
25
25
  import messages from "./messages";
26
26
  import withCreatives from "../../hoc/withCreatives";
27
27
  import {
@@ -36,6 +36,7 @@ import {
36
36
  ERROR_ALERT,
37
37
  WARNING_ALERT,
38
38
  ZALO_STATUSES,
39
+ ENABLE,
39
40
  } from "./constants";
40
41
  import "./index.scss";
41
42
  import { makeSelectZalo } from "./selectors";
@@ -48,6 +49,7 @@ import { makeSelectMetaEntities, setInjectedTags } from "../Cap/selectors";
48
49
  import * as globalActions from "../Cap/actions";
49
50
  import { validateTags } from "../../utils/tagValidations";
50
51
 
52
+
51
53
  export const Zalo = ({
52
54
  intl,
53
55
  actions,
@@ -60,16 +62,13 @@ export const Zalo = ({
60
62
  injectedTags,
61
63
  selectedOfferDetails,
62
64
  template,
63
- isFullMode,
64
65
  }) => {
65
66
  const { formatMessage } = intl;
66
67
  const [zaloTemplateListParams, setZaloTemplateListParams] = useState([]);
67
68
  const [templatePreviewUrl, setTemplatePreviewUrl] = useState("");
68
69
  const [tags, updateTags] = useState([]);
69
70
  const [textAreaId, updateTextAreaId] = useState("");
70
- const [templateStatus, setZaloTemplateStatus] = useState(
71
- ZALO_STATUSES.ENABLE
72
- );
71
+ const [templateStatus, setZaloTemplateStatus] = useState(ENABLE);
73
72
 
74
73
  const ZaloFooter = styled.div`
75
74
  background-color: ${CAP_WHITE};
@@ -258,7 +257,6 @@ export const Zalo = ({
258
257
  value={value || ""}
259
258
  size="default"
260
259
  onFocus={() => setTextAreaId(name)}
261
- disabled={isFullMode}
262
260
  />
263
261
  );
264
262
  };
@@ -314,7 +312,6 @@ export const Zalo = ({
314
312
  onContextChange={handleOnTagsContextChange}
315
313
  injectedTags={injectedTags || {}}
316
314
  selectedOfferDetails={selectedOfferDetails}
317
- disabled={isFullMode}
318
315
  />
319
316
  }
320
317
  />
@@ -344,28 +341,26 @@ export const Zalo = ({
344
341
  </CapRow>
345
342
  </CapRow>
346
343
  </CapColumn>
347
- <CapColumn span={10}>
348
- <CapRow className="zalo-preview-container">
349
- <CapRow>
350
- <CapLabel className="preview-head">
351
- {formatMessage(messages.previewHead)}
352
- </CapLabel>
353
- </CapRow>
354
- <CapRow>
355
- <CapLabel className="preview-text">
356
- {formatMessage(messages.previewText)}
357
- </CapLabel>
358
- </CapRow>
359
- <CapRow>
360
- <CapLabel
361
- data-testid="preview-link-button"
362
- onClick={handlePreview}
363
- className="preview-link"
364
- >
365
- {formatMessage(messages.openPreview)}{" "}
366
- <CapIcon type="open-in-new-light"></CapIcon>
367
- </CapLabel>
368
- </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>
369
364
  </CapRow>
370
365
  </CapColumn>
371
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,5 +70,5 @@ export default defineMessages({
70
70
  PENDING_REVIEW: {
71
71
  id: `${prefix}.PENDING_REVIEW`,
72
72
  defaultMessage: 'pending review',
73
- },
73
+ }
74
74
  });