@capillarytech/creatives-library 7.17.40-alpha.0 → 7.17.41
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/App/constants.js +0 -26
- 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 -13
- 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 +57 -7
- package/v2Containers/CreativesContainer/messages.js +1 -9
- package/v2Containers/TagList/index.js +5 -18
- 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 +280 -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
|
});
|
|
@@ -7,8 +7,6 @@ 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';
|
|
12
10
|
export const CUSTOM_TAG = 'CustomTagMessage';
|
|
13
11
|
export const CUSTOMER_EXTENDED_FIELD = 'Customer extended fields';
|
|
14
12
|
export const EXTENDED_TAG = 'ExtendedTagMessage';
|
|
@@ -45,29 +43,5 @@ export const HOSPITALITY_RELATED_TAGS = [
|
|
|
45
43
|
"email",
|
|
46
44
|
"resID_Source",
|
|
47
45
|
];
|
|
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
|
-
];
|
|
72
46
|
|
|
73
47
|
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=
|
|
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
|
@@ -7,8 +7,6 @@ import {
|
|
|
7
7
|
CARD_BASED_SCOPE,
|
|
8
8
|
HOSPITALITY_RELATED_TAGS,
|
|
9
9
|
HOSPITALITY_BASED_SCOPE,
|
|
10
|
-
GIFT_CARDS,
|
|
11
|
-
PROMO_ENGINE,
|
|
12
10
|
EXTENDED_TAG,
|
|
13
11
|
CUSTOMER_EXTENDED_FIELD,
|
|
14
12
|
CUSTOM_TAG,
|
|
@@ -68,15 +66,7 @@ export const hasHospitalityBasedScope = Auth.hasFeatureAccess.bind(
|
|
|
68
66
|
null,
|
|
69
67
|
HOSPITALITY_BASED_SCOPE,
|
|
70
68
|
);
|
|
71
|
-
export const hasPromoFeature = Auth.hasFeatureAccess.bind(
|
|
72
|
-
null,
|
|
73
|
-
PROMO_ENGINE,
|
|
74
|
-
);
|
|
75
69
|
|
|
76
|
-
export const hasGiftVoucherFeature = Auth.hasFeatureAccess.bind(
|
|
77
|
-
null,
|
|
78
|
-
GIFT_CARDS,
|
|
79
|
-
);
|
|
80
70
|
export const hasJPLocaleHideFeatureEnabled = Auth.hasFeatureAccess.bind(
|
|
81
71
|
null,
|
|
82
72
|
JP_LOCALE_HIDE_FEATURE,
|
|
@@ -304,8 +294,8 @@ export const isTraiDLTEnable = (isFullMode, smsRegister) => {
|
|
|
304
294
|
return isTraiDltFeature;
|
|
305
295
|
};
|
|
306
296
|
|
|
307
|
-
|
|
308
|
-
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();
|
|
309
299
|
|
|
310
300
|
export const handleInjectedData = (data, scope) => {
|
|
311
301
|
let tagType;
|
|
@@ -317,7 +307,6 @@ export const handleInjectedData = (data, scope) => {
|
|
|
317
307
|
} else if (tag?.name === CUSTOMER_EXTENDED_FIELD) {
|
|
318
308
|
tagType = EXTENDED_TAG;
|
|
319
309
|
}
|
|
320
|
-
|
|
321
310
|
if (tag?.name) {
|
|
322
311
|
const name = tag.name;
|
|
323
312
|
const key = intlKeyGenerator(name);
|
|
@@ -358,3 +347,7 @@ export const handleInjectedData = (data, scope) => {
|
|
|
358
347
|
}
|
|
359
348
|
return data;
|
|
360
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} />,
|