@capillarytech/creatives-library 7.17.39 → 7.17.40
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/components/CapTagList/index.js +1 -1
- package/components/CapTagList/messages.js +0 -4
- package/components/FormBuilder/index.js +2 -2
- package/components/FormBuilder/messages.js +0 -8
- package/containers/Assets/Gallery/index.js +1 -1
- package/containers/Assets/Gallery/messages.js +0 -4
- package/containers/Email/index.js +1 -1
- package/containers/Templates/index.js +1 -1
- package/containers/Templates/messages.js +0 -4
- package/index.js +2 -2
- package/package.json +1 -1
- package/services/api.js +6 -6
- package/utils/common.js +6 -3
- package/utils/tests/common.test.js +5 -5
- package/v2Components/CapTagList/index.js +2 -1
- package/v2Components/FormBuilder/index.js +1 -1
- package/v2Components/FormBuilder/messages.js +0 -4
- package/v2Components/TemplatePreview/_templatePreview.scss +40 -0
- package/v2Components/TemplatePreview/index.js +34 -0
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +47 -0
- package/v2Components/TemplatePreview/tests/index.test.js +9 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +12 -6
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -3
- package/v2Containers/CreativesContainer/index.js +55 -7
- package/v2Containers/CreativesContainer/messages.js +1 -9
- package/v2Containers/TagList/index.js +2 -0
- package/v2Containers/Templates/index.js +19 -4
- package/v2Containers/Templates/messages.js +4 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +28 -129
- package/v2Containers/TemplatesV2/tests/index.test.js +1 -0
- package/v2Containers/Zalo/constants.js +0 -1
- package/v2Containers/Zalo/index.js +283 -189
- package/v2Containers/Zalo/index.scss +3 -4
- package/v2Containers/Zalo/messages.js +17 -5
- package/v2Containers/Zalo/saga.js +10 -4
- package/v2Containers/Zalo/selectors.js +8 -10
- package/v2Containers/Zalo/tests/index.test.js +67 -48
- package/v2Containers/Zalo/tests/mockData.js +5056 -5045
- package/v2Containers/Zalo/tests/reducer.test.js +3 -3
- package/v2Containers/Zalo/tests/saga.test.js +5 -2
- package/v2Containers/Zalo/tests/selector.test.js +28 -0
- package/v2Containers/Zalo/tests/selectors.test.js +0 -52
|
@@ -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=
|
|
186
|
+
<Search style={{ marginBottom: 8, width: '250px'}} placeholder="Search" 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
|
|
@@ -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 =
|
|
1520
|
-
formData[tabCount].name =
|
|
1519
|
+
const version = `Version ${this.state.currentTab}`;
|
|
1520
|
+
formData[tabCount].name = `Copy of ${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,12 +54,4 @@ 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
|
-
},
|
|
65
57
|
});
|
|
@@ -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=
|
|
339
|
+
placeholder="Search"
|
|
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)}
|
|
@@ -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=
|
|
3107
|
+
placeholder="Search"
|
|
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 =
|
|
869
|
+
duplicateObj.name = `Copy of ${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);
|
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 };
|
|
128
127
|
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,
|
|
177
176
|
RcsContainer,
|
|
177
|
+
ZaloContainer,
|
|
178
178
|
};
|
package/package.json
CHANGED
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(
|
|
93
|
+
const error = new Error(statusText);
|
|
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
|
-
|
|
505
|
-
|
|
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
|
@@ -294,8 +294,8 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
|
|
|
294
294
|
return isTraiDltFeature;
|
|
295
295
|
};
|
|
296
296
|
|
|
297
|
-
|
|
298
|
-
export const intlKeyGenerator = (value = "") => String(value).replace(/[^a-zA-Z0-9_
|
|
297
|
+
|
|
298
|
+
export const intlKeyGenerator = (value = "") => String(value).replace(/[^a-zA-Z0-9_]/g, "").toLowerCase();
|
|
299
299
|
|
|
300
300
|
export const handleInjectedData = (data, scope) => {
|
|
301
301
|
let tagType;
|
|
@@ -307,7 +307,6 @@ export const handleInjectedData = (data, scope) => {
|
|
|
307
307
|
} else if (tag?.name === CUSTOMER_EXTENDED_FIELD) {
|
|
308
308
|
tagType = EXTENDED_TAG;
|
|
309
309
|
}
|
|
310
|
-
|
|
311
310
|
if (tag?.name) {
|
|
312
311
|
const name = tag.name;
|
|
313
312
|
const key = intlKeyGenerator(name);
|
|
@@ -348,3 +347,7 @@ export const handleInjectedData = (data, scope) => {
|
|
|
348
347
|
}
|
|
349
348
|
return data;
|
|
350
349
|
};
|
|
350
|
+
|
|
351
|
+
export const handlePreviewInNewTab = (previewUrl) => {
|
|
352
|
+
window.open(previewUrl, '_blank');
|
|
353
|
+
}
|
|
@@ -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.
|
|
54
|
+
expect(result.tag1.name).toEqual(<FormattedMessage defaultMessage="Registration Fields" id="scope.registrationfields" 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.
|
|
68
|
+
<FormattedMessage defaultMessage="Registration custom fields" id="scope.registrationcustomfields_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.
|
|
82
|
+
<FormattedMessage defaultMessage="Customer extended fields" id="scope.customerextendedfields_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.
|
|
160
|
+
<FormattedMessage defaultMessage="Enter your first name" id="scope.enteryourfirstname" 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.
|
|
178
|
+
<FormattedMessage defaultMessage="Enter your first name" id="scope.enteryourfirstname" 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 isAddBtn type="flat">{label || ''}</CapButton>
|
|
324
|
+
<CapButton disabled={this?.props?.disabled} isAddBtn type="flat">{label || ''}</CapButton>
|
|
325
325
|
</CapPopover>
|
|
326
326
|
}
|
|
327
327
|
<CapModal
|
|
@@ -358,6 +358,7 @@ CapTagList.propTypes = {
|
|
|
358
358
|
disableTagsDetails: PropTypes.object,
|
|
359
359
|
currentOrgDetails: PropTypes.object,
|
|
360
360
|
channel: PropTypes.string,
|
|
361
|
+
disabled: PropTypes.bool
|
|
361
362
|
};
|
|
362
363
|
|
|
363
364
|
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 =
|
|
1672
|
+
formData[tabCount].name = `Copy of ${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}, () => {
|
|
@@ -477,4 +477,44 @@
|
|
|
477
477
|
position: absolute;
|
|
478
478
|
right: -17px;
|
|
479
479
|
bottom: -17px;
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
.zalo-preview-container {
|
|
483
|
+
text-align: center;
|
|
484
|
+
|
|
485
|
+
.preview-head {
|
|
486
|
+
font-weight: 500;
|
|
487
|
+
font-size: $FONT_SIZE_M;
|
|
488
|
+
color: $FONT_COLOR_01;
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
.preview-text {
|
|
492
|
+
font-weight: 400;
|
|
493
|
+
font-size: $FONT_SIZE_S;
|
|
494
|
+
padding-top: $CAP_SPACE_08;
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
.preview-link {
|
|
498
|
+
font-weight: 500;
|
|
499
|
+
font-size: $FONT_SIZE_M;
|
|
500
|
+
color: $FONT_COLOR_05;
|
|
501
|
+
margin-top: $CAP_SPACE_19;
|
|
502
|
+
cursor: pointer;
|
|
503
|
+
|
|
504
|
+
svg {
|
|
505
|
+
height: $CAP_SPACE_16;
|
|
506
|
+
width: $CAP_SPACE_16;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
.zalo-preview-container-creative {
|
|
512
|
+
position: fixed;
|
|
513
|
+
padding-left: 72px;
|
|
514
|
+
padding-right: 110px;
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
.zalo-preview-container-campaign {
|
|
518
|
+
padding-left: 0px;
|
|
519
|
+
padding-right: 73px;
|
|
480
520
|
}
|
|
@@ -18,11 +18,14 @@ import {
|
|
|
18
18
|
WECHAT,
|
|
19
19
|
WHATSAPP,
|
|
20
20
|
RCS,
|
|
21
|
+
ZALO
|
|
21
22
|
} from '../../v2Containers/CreativesContainer/constants';
|
|
22
23
|
import Carousel from '../Carousel';
|
|
23
24
|
import { VIBER, FACEBOOK } from '../../v2Containers/App/constants';
|
|
24
25
|
import whatsappMobileAndroid from './assets/images/whatsapp_mobile_android.svg';
|
|
25
26
|
import videoPlay from '../../assets/videoPlay.svg';
|
|
27
|
+
import zaloMessage from '../../v2Containers/Zalo/messages';
|
|
28
|
+
import { handlePreviewInNewTab } from '../../utils/common';
|
|
26
29
|
const wechatBodyNew = require('./assets/images/wechat_mobile_android.svg');
|
|
27
30
|
const smsMobileAndroid = require('./assets/images/sms_mobile_android.svg');
|
|
28
31
|
const smsMobileIos = require('./assets/images/sms_mobile_ios.svg');
|
|
@@ -327,6 +330,11 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
327
330
|
return renderArray;
|
|
328
331
|
};
|
|
329
332
|
|
|
333
|
+
const handlePreview = () => {
|
|
334
|
+
const {templatePreviewUrl = ''} = templateData;
|
|
335
|
+
handlePreviewInNewTab(templatePreviewUrl);
|
|
336
|
+
};
|
|
337
|
+
|
|
330
338
|
const whatsappUpdatedAccountName = whatsappAccountName || templateData?.versions?.base?.content?.whatsapp?.accountName || '';
|
|
331
339
|
const whatsappUpdatedLen = whatsappContentLen !== undefined ? whatsappContentLen : content?.charCount;
|
|
332
340
|
|
|
@@ -785,6 +793,32 @@ export class TemplatePreview extends React.Component { // eslint-disable-line re
|
|
|
785
793
|
''
|
|
786
794
|
)
|
|
787
795
|
}
|
|
796
|
+
{
|
|
797
|
+
channel?.toUpperCase() === ZALO && (
|
|
798
|
+
<CapRow className={`zalo-preview-container ${templateData?.fullMode ? 'zalo-preview-container-creative' : 'zalo-preview-container-campaign'}`}>
|
|
799
|
+
<CapRow>
|
|
800
|
+
<CapLabel className="preview-head">
|
|
801
|
+
{formatMessage(zaloMessage.previewHead)}
|
|
802
|
+
</CapLabel>
|
|
803
|
+
</CapRow>
|
|
804
|
+
<CapRow>
|
|
805
|
+
<CapLabel className="preview-text">
|
|
806
|
+
{formatMessage(zaloMessage.previewText)}
|
|
807
|
+
</CapLabel>
|
|
808
|
+
</CapRow>
|
|
809
|
+
<CapRow>
|
|
810
|
+
<CapLabel
|
|
811
|
+
data-testid="preview-link-button"
|
|
812
|
+
onClick={handlePreview}
|
|
813
|
+
className="preview-link"
|
|
814
|
+
>
|
|
815
|
+
{formatMessage(zaloMessage.openPreview)}{' '}
|
|
816
|
+
<CapIcon type="open-in-new-light"></CapIcon>
|
|
817
|
+
</CapLabel>
|
|
818
|
+
</CapRow>
|
|
819
|
+
</CapRow>
|
|
820
|
+
)
|
|
821
|
+
}
|
|
788
822
|
{
|
|
789
823
|
channel?.toUpperCase() === RCS && (
|
|
790
824
|
<div className="shell-v2 align-center">
|
|
@@ -292,3 +292,50 @@ exports[`Test Templates container Should render correct preview component for wh
|
|
|
292
292
|
</CapColumn>
|
|
293
293
|
</CapRow>
|
|
294
294
|
`;
|
|
295
|
+
|
|
296
|
+
exports[`Test Templates container Should render correct preview component for zalo channel 1`] = `
|
|
297
|
+
<CapRow>
|
|
298
|
+
<CapColumn
|
|
299
|
+
span={24}
|
|
300
|
+
>
|
|
301
|
+
<div
|
|
302
|
+
className="preview-container "
|
|
303
|
+
>
|
|
304
|
+
<CapRow
|
|
305
|
+
className="zalo-preview-container zalo-preview-container-campaign"
|
|
306
|
+
>
|
|
307
|
+
<CapRow>
|
|
308
|
+
<CapLabel
|
|
309
|
+
className="preview-head"
|
|
310
|
+
type="label1"
|
|
311
|
+
>
|
|
312
|
+
Preview
|
|
313
|
+
</CapLabel>
|
|
314
|
+
</CapRow>
|
|
315
|
+
<CapRow>
|
|
316
|
+
<CapLabel
|
|
317
|
+
className="preview-text"
|
|
318
|
+
type="label1"
|
|
319
|
+
>
|
|
320
|
+
Preview of the template is generated on the Zalo platform. Click on ‘Open preview’ to view it in a new tab
|
|
321
|
+
</CapLabel>
|
|
322
|
+
</CapRow>
|
|
323
|
+
<CapRow>
|
|
324
|
+
<CapLabel
|
|
325
|
+
className="preview-link"
|
|
326
|
+
data-testid="preview-link-button"
|
|
327
|
+
onClick={[Function]}
|
|
328
|
+
type="label1"
|
|
329
|
+
>
|
|
330
|
+
Open Preview
|
|
331
|
+
|
|
332
|
+
<CapIcon
|
|
333
|
+
type="open-in-new-light"
|
|
334
|
+
/>
|
|
335
|
+
</CapLabel>
|
|
336
|
+
</CapRow>
|
|
337
|
+
</CapRow>
|
|
338
|
+
</div>
|
|
339
|
+
</CapColumn>
|
|
340
|
+
</CapRow>
|
|
341
|
+
`;
|
|
@@ -11,6 +11,7 @@ describe('Test Templates container', () => {
|
|
|
11
11
|
content,
|
|
12
12
|
whatsappAccountName,
|
|
13
13
|
whatsappContentLen,
|
|
14
|
+
templateData
|
|
14
15
|
) => {
|
|
15
16
|
renderedComponent = shallowWithIntl(
|
|
16
17
|
<TemplatePreview
|
|
@@ -18,6 +19,7 @@ describe('Test Templates container', () => {
|
|
|
18
19
|
content={content}
|
|
19
20
|
whatsappAccountName={whatsappAccountName}
|
|
20
21
|
whatsappContentLen={whatsappContentLen}
|
|
22
|
+
templateData={templateData}
|
|
21
23
|
/>,
|
|
22
24
|
);
|
|
23
25
|
};
|
|
@@ -61,6 +63,13 @@ describe('Test Templates container', () => {
|
|
|
61
63
|
renderFunction('whatsapp', {}, 'test', 0);
|
|
62
64
|
expect(renderedComponent).toMatchSnapshot();
|
|
63
65
|
});
|
|
66
|
+
it('Should render correct preview component for zalo channel', () => {
|
|
67
|
+
renderFunction('zalo', {}, '', '', {
|
|
68
|
+
templatePreviewUrl: 'https://account.zalo.cloud/znspreview/-CL4HT4Hwza4v5ocK3pdVQ=='
|
|
69
|
+
});
|
|
70
|
+
expect(renderedComponent).toMatchSnapshot();
|
|
71
|
+
});
|
|
72
|
+
|
|
64
73
|
it('Should render correct preview component for rcs channel', () => {
|
|
65
74
|
renderFunction('rcs', {
|
|
66
75
|
rcsPreviewContent: {
|
|
@@ -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?.toUpperCase() === constants.ZALO;
|
|
217
217
|
}
|
|
218
218
|
const isDltEnabled = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
219
219
|
const hasJPLocaleHideFeatureEnabled = commonUtil?.hasJPLocaleHideFeatureEnabled();
|
|
@@ -510,11 +510,17 @@ export function SlideBoxContent(props) {
|
|
|
510
510
|
{
|
|
511
511
|
isEditZalo &&
|
|
512
512
|
<Zalo
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
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
|
+
}}
|
|
518
524
|
/>
|
|
519
525
|
}
|
|
520
526
|
{
|
|
@@ -61,9 +61,8 @@ export function SlideBoxHeader(props) {
|
|
|
61
61
|
email: <FormattedMessage {...messages.emailHeader} />,
|
|
62
62
|
mobilepush: <FormattedMessage {...messages.pushNotificationHeader} />,
|
|
63
63
|
wechat: <FormattedMessage {...messages.wechat} />,
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
ftp: <FormattedMessage {...messages.ftp} />,
|
|
64
|
+
no_communication: 'NO_COMMUNICATION',
|
|
65
|
+
ftp: 'FTP',
|
|
67
66
|
whatsapp: <FormattedMessage {...messages.whatsappTemplate} />,
|
|
68
67
|
rcs: <FormattedMessage {...messages.rcsCreative} />,
|
|
69
68
|
zalo: <FormattedMessage {...messages.zaloTemplate} />,
|
|
@@ -1,8 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import {
|
|
4
|
-
CapSlideBox,
|
|
5
|
-
|
|
4
|
+
CapSlideBox,
|
|
5
|
+
CapHeader,
|
|
6
|
+
CapLink,
|
|
7
|
+
CapInput,
|
|
8
|
+
CapNotification,
|
|
9
|
+
} from "@capillarytech/cap-ui-library";
|
|
6
10
|
import { injectIntl, FormattedMessage } from 'react-intl';
|
|
7
11
|
import classnames from 'classnames';
|
|
8
12
|
import {isEmpty, get, forEach, cloneDeep} from 'lodash';
|
|
@@ -23,8 +27,10 @@ import { gtmPush } from '../../utils/gtmTrackers';
|
|
|
23
27
|
import './index.scss';
|
|
24
28
|
import * as templateActions from '../Templates/actions';
|
|
25
29
|
import * as globalActions from '../Cap/actions';
|
|
30
|
+
import * as zaloActions from '../Zalo/actions';
|
|
26
31
|
import {isLoading as isLoadingSelector} from './selectors';
|
|
27
32
|
import messages from './messages';
|
|
33
|
+
import zaloMessages from '../Zalo/messages';
|
|
28
34
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
29
35
|
import { makeSelectFetchingCmsData } from '../Email/selectors';
|
|
30
36
|
import { IMAGE as LINE_IMAGE, IMAGE_MAP, IMAGE_CAROUSEL, VIDEO as LINE_VIDEO, TEMPLATE, STICKER } from '../Line/Container/constants';
|
|
@@ -97,12 +103,35 @@ export class Creatives extends React.Component {
|
|
|
97
103
|
}
|
|
98
104
|
this.setState(data);
|
|
99
105
|
};
|
|
106
|
+
|
|
107
|
+
actionCallback = () => {
|
|
108
|
+
CapNotification.error({
|
|
109
|
+
message: <FormattedMessage {...zaloMessages.zaloFailureNotificationPreview}/>,
|
|
110
|
+
});
|
|
111
|
+
};
|
|
112
|
+
|
|
100
113
|
onPreviewTemplate = (template) => {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
114
|
+
if (template.type !== constants.ZALO) {
|
|
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
|
+
}
|
|
106
135
|
};
|
|
107
136
|
onEditTemplate = () => {
|
|
108
137
|
this.setState({ slidBoxContent: 'editTemplate', showSlideBox: true, templateNameExists: true });
|
|
@@ -471,6 +500,14 @@ export class Creatives extends React.Component {
|
|
|
471
500
|
},
|
|
472
501
|
},
|
|
473
502
|
};
|
|
503
|
+
break;
|
|
504
|
+
}
|
|
505
|
+
case constants.ZALO: {
|
|
506
|
+
creativesTemplateData = {
|
|
507
|
+
type: constants.ZALO,
|
|
508
|
+
...templateData,
|
|
509
|
+
};
|
|
510
|
+
break;
|
|
474
511
|
}
|
|
475
512
|
default:
|
|
476
513
|
break;
|
|
@@ -771,6 +808,15 @@ export class Creatives extends React.Component {
|
|
|
771
808
|
}
|
|
772
809
|
}
|
|
773
810
|
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;
|
|
774
820
|
default:
|
|
775
821
|
break;
|
|
776
822
|
}
|
|
@@ -1205,6 +1251,7 @@ Creatives.propTypes = {
|
|
|
1205
1251
|
channel: PropTypes.string,
|
|
1206
1252
|
templateActions: PropTypes.object,
|
|
1207
1253
|
globalActions: PropTypes.object,
|
|
1254
|
+
zaloActions: PropTypes.object,
|
|
1208
1255
|
cap: PropTypes.object,
|
|
1209
1256
|
// isLoading: PropTypes.bool,
|
|
1210
1257
|
templateUserList: PropTypes.array,
|
|
@@ -1233,6 +1280,7 @@ function mapDispatchToProps(dispatch) {
|
|
|
1233
1280
|
templateActions: bindActionCreators(templateActions, dispatch),
|
|
1234
1281
|
globalActions: bindActionCreators(globalActions, dispatch),
|
|
1235
1282
|
actions: bindActionCreators(actions, dispatch),
|
|
1283
|
+
zaloActions: bindActionCreators(zaloActions, dispatch),
|
|
1236
1284
|
};
|
|
1237
1285
|
}
|
|
1238
1286
|
export default connect(mapStatesToProps, mapDispatchToProps)(injectIntl(Creatives));
|
|
@@ -341,13 +341,5 @@ export default defineMessages({
|
|
|
341
341
|
"wechat": {
|
|
342
342
|
id: `${scope}.wechat`,
|
|
343
343
|
defaultMessage: `Wechat`,
|
|
344
|
-
}
|
|
345
|
-
"ftp": {
|
|
346
|
-
id: `${scope}.ftp`,
|
|
347
|
-
defaultMessage: `FTP`,
|
|
348
|
-
},
|
|
349
|
-
"noCommunication": {
|
|
350
|
-
id: `${scope}.noCommunication`,
|
|
351
|
-
defaultMessage: `NO_COMMUNICATION`,
|
|
352
|
-
},
|
|
344
|
+
}
|
|
353
345
|
});
|
|
@@ -260,6 +260,7 @@ 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}
|
|
263
264
|
/>
|
|
264
265
|
</div>
|
|
265
266
|
);
|
|
@@ -286,6 +287,7 @@ TagList.propTypes = {
|
|
|
286
287
|
modalProps: PropTypes.any,
|
|
287
288
|
currentOrgDetails: PropTypes.object,
|
|
288
289
|
channel: PropTypes.string,
|
|
290
|
+
disabled: PropTypes.bool
|
|
289
291
|
};
|
|
290
292
|
|
|
291
293
|
const mapStateToProps = createStructuredSelector({
|