@capillarytech/creatives-library 8.0.87-alpha.4 → 8.0.87-alpha.6
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/initialState.js +1 -0
- package/package.json +1 -1
- package/services/api.js +10 -0
- package/v2Components/FormBuilder/index.js +118 -7
- package/v2Components/TemplatePreview/tests/__snapshots__/index.test.js.snap +1 -1
- package/v2Containers/Cap/actions.js +9 -0
- package/v2Containers/Cap/constants.js +4 -0
- package/v2Containers/Cap/reducer.js +6 -0
- package/v2Containers/Cap/sagas.js +29 -0
- package/v2Containers/Cap/selectors.js +6 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +11 -0
- package/v2Containers/CreativesContainer/index.js +4 -0
- package/v2Containers/Email/index.js +2 -0
- package/v2Containers/EmailWrapper/index.js +4 -0
- package/v2Containers/MobilePush/Edit/index.js +2 -0
- package/v2Containers/MobilepushWrapper/index.js +3 -1
- package/v2Containers/Sms/Create/index.js +2 -0
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/SmsWrapper/index.js +4 -0
- package/v2Containers/Zalo/index.js +28 -52
- package/v2Containers/Zalo/messages.js +1 -5
package/initialState.js
CHANGED
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -569,4 +569,14 @@ export const getLiquidTags = (content) => {
|
|
|
569
569
|
return request(url, getAPICallObject("POST", { content }, false, true));
|
|
570
570
|
};
|
|
571
571
|
|
|
572
|
+
export const postMetaId = (payload) => {
|
|
573
|
+
const url = `${API_ENDPOINT}/templates/metaId`;
|
|
574
|
+
// TODO: remove this after testing
|
|
575
|
+
return {
|
|
576
|
+
status: true,
|
|
577
|
+
metaId: "2334",
|
|
578
|
+
};
|
|
579
|
+
return request(url, getAPICallObject('POST', payload));
|
|
580
|
+
};
|
|
581
|
+
|
|
572
582
|
export {request, getAPICallObject};
|
|
@@ -44,7 +44,7 @@ import EDMEditor from "../Edmeditor";
|
|
|
44
44
|
import BeeEditor from '../../v2Containers/BeeEditor';
|
|
45
45
|
import CustomPopOver from '../CustomPopOver';
|
|
46
46
|
import messages from './messages';
|
|
47
|
-
import { makeSelectMetaEntities, selectCurrentOrgDetails, selectLiquidStateDetails } from "../../v2Containers/Cap/selectors";
|
|
47
|
+
import { makeSelectMetaEntities, selectCurrentOrgDetails, selectLiquidStateDetails, selectMetaTagsStatus } from "../../v2Containers/Cap/selectors";
|
|
48
48
|
import * as actions from "../../v2Containers/Cap/actions";
|
|
49
49
|
import './_formBuilder.scss';
|
|
50
50
|
import {updateCharCount, checkUnicode} from "../../utils/smsCharCountV2";
|
|
@@ -82,6 +82,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
82
82
|
super(props);
|
|
83
83
|
this.state = {
|
|
84
84
|
formData: {},
|
|
85
|
+
prevFormData: {},
|
|
85
86
|
errorData: {},
|
|
86
87
|
currentTab: 1,
|
|
87
88
|
currentLangTab: 'en',
|
|
@@ -140,7 +141,14 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
140
141
|
componentWillMount() {
|
|
141
142
|
this.setState({usingTabContainer: this.props.usingTabContainer ? this.props.usingTabContainer : false});
|
|
142
143
|
if (this.props.formData && (this.props.isEdit || (!this.props.isEdit && !_.isEmpty(this.props.formData)))) {
|
|
143
|
-
|
|
144
|
+
console.log('**** componentWillMount: ', {
|
|
145
|
+
formData: this.props.formData,
|
|
146
|
+
prevFormData: this.props.formData
|
|
147
|
+
});
|
|
148
|
+
this.setState({
|
|
149
|
+
formData: this.props.formData,
|
|
150
|
+
prevFormData: this.props.formData
|
|
151
|
+
}, () => {
|
|
144
152
|
// if (!this.props.isNewVersionFlow) {
|
|
145
153
|
this.initialiseForm(this.props.schema, false, true);
|
|
146
154
|
// }
|
|
@@ -172,6 +180,32 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
172
180
|
// }
|
|
173
181
|
if (nextProps.isEdit) {
|
|
174
182
|
if (!_.isEqual(nextProps.formData, this.state.formData) && !_.isEmpty(nextProps.formData)) {
|
|
183
|
+
|
|
184
|
+
const oldContent = convert(this.state.prevFormData?.base?.en?.["template-content"]);
|
|
185
|
+
const newContent = convert(this.state.formData?.base?.en?.["template-content"]);
|
|
186
|
+
console.log("**** componentWillReceiveProps: ", {
|
|
187
|
+
formData: this.state.formData,
|
|
188
|
+
prevFormData: this.state.prevFormData,
|
|
189
|
+
nextPropsFormData: nextProps.formData
|
|
190
|
+
});
|
|
191
|
+
if (!_.isEmpty(oldContent)){
|
|
192
|
+
console.log("**** oldContent is empty: ", {
|
|
193
|
+
oldContent,
|
|
194
|
+
newContent
|
|
195
|
+
});
|
|
196
|
+
this.setState({
|
|
197
|
+
prevFormData: nextProps.formData
|
|
198
|
+
});
|
|
199
|
+
} else if (oldContent !== newContent) {
|
|
200
|
+
console.log("**** oldContent !== newContent: ", {
|
|
201
|
+
oldContent,
|
|
202
|
+
newContent
|
|
203
|
+
});
|
|
204
|
+
this.setState({
|
|
205
|
+
prevFormData: this.state.formData
|
|
206
|
+
});
|
|
207
|
+
}
|
|
208
|
+
|
|
175
209
|
if (type === 'embedded' && !isLibraryModule) { //TODO: has to be checked and changed.
|
|
176
210
|
this.setState({checkValidation: true, formData: nextProps.formData}, () => {
|
|
177
211
|
this.validateForm();
|
|
@@ -1064,7 +1098,9 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1064
1098
|
};
|
|
1065
1099
|
handleLiquidTemplateSubmit =(templateContent) => {
|
|
1066
1100
|
if(templateContent){this.setState((prevState) => {
|
|
1101
|
+
console.log('**** handleLiquidTemplateSubmit: ', { prevState, templateContent });
|
|
1067
1102
|
return {
|
|
1103
|
+
// prevFormData: { ...prevState.formData },
|
|
1068
1104
|
formData: {
|
|
1069
1105
|
...prevState?.formData,
|
|
1070
1106
|
base: {
|
|
@@ -1077,11 +1113,81 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1077
1113
|
}
|
|
1078
1114
|
};
|
|
1079
1115
|
}, () => {
|
|
1080
|
-
|
|
1081
|
-
this.props.onSubmit(this.state.formData);
|
|
1082
|
-
}
|
|
1116
|
+
this.metaIDSaveWrapper();
|
|
1083
1117
|
});}
|
|
1084
1118
|
}
|
|
1119
|
+
|
|
1120
|
+
checkDiffInContent = () => {
|
|
1121
|
+
//oldCOntent will be prop based
|
|
1122
|
+
//newContent will be state based
|
|
1123
|
+
//newcontent is this.state.formData?.base?.en?.["template-content"]
|
|
1124
|
+
//oldContent is this.props.formData?.base?.en?.["template-content"]
|
|
1125
|
+
//will check if the new content has any new tags or not
|
|
1126
|
+
const oldContent = convert(this.state.prevFormData?.base?.en?.["template-content"]);
|
|
1127
|
+
const newContent = convert(this.state.formData?.base?.en?.["template-content"]);
|
|
1128
|
+
console.log("**** checkDiffInContent", { oldContent, newContent });
|
|
1129
|
+
if (_.isEmpty(oldContent)) {
|
|
1130
|
+
return false;
|
|
1131
|
+
} else if (!_.isEqual(oldContent, newContent)) {
|
|
1132
|
+
return true;
|
|
1133
|
+
}
|
|
1134
|
+
return false;
|
|
1135
|
+
};
|
|
1136
|
+
|
|
1137
|
+
metaIDSaveWrapper = () => {
|
|
1138
|
+
const {
|
|
1139
|
+
actionName,
|
|
1140
|
+
actionId,
|
|
1141
|
+
ouId,
|
|
1142
|
+
clientName,
|
|
1143
|
+
module,
|
|
1144
|
+
metaId,
|
|
1145
|
+
setMetaId,
|
|
1146
|
+
} = this.props.loyaltyMetaData;
|
|
1147
|
+
const handleMetaIDResult = (result) => {
|
|
1148
|
+
console.log("**** handleMetaIDResult: 1", { result });
|
|
1149
|
+
if (result.status && this.props.onSubmit) {
|
|
1150
|
+
console.log("**** handleMetaIDResult: 2", { result });
|
|
1151
|
+
setMetaId(result?.metaId);
|
|
1152
|
+
this.props.onSubmit(this.state.formData);
|
|
1153
|
+
} else {
|
|
1154
|
+
// this.setState({ metaID: null });
|
|
1155
|
+
this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage); //add a custom message
|
|
1156
|
+
this.props.stopValidation();
|
|
1157
|
+
return;
|
|
1158
|
+
}
|
|
1159
|
+
};
|
|
1160
|
+
console.log("**** metaIDSaveWrapper: BODY", { actionName, actionId, ouId, clientName, module, metaId, setMetaId, messageDetails: this.props.messageDetails });
|
|
1161
|
+
const content = this.state.formData?.base?.en?.["template-content"] || "";
|
|
1162
|
+
console.log("**** metaIDSaveWrapper: checkDiffInContent: ", this.checkDiffInContent());
|
|
1163
|
+
// Only generate metaId for loyalty module and specific action
|
|
1164
|
+
if (this.props.isLoyaltyModule && actionName === 'SEND_COMMUNICATION_ACTION') {
|
|
1165
|
+
if (this.checkDiffInContent()) {
|
|
1166
|
+
//need to pass payload , this will be same as the payload for template creation/edit api
|
|
1167
|
+
const payload = {
|
|
1168
|
+
ouId: ouId || -1,
|
|
1169
|
+
clientName: clientName || "EMF",
|
|
1170
|
+
sourceEntityId: actionId,
|
|
1171
|
+
module: module,
|
|
1172
|
+
executionParams: {},
|
|
1173
|
+
content,
|
|
1174
|
+
...this.props.messageDetails,
|
|
1175
|
+
channel: this.props.messageDetails?.type
|
|
1176
|
+
};
|
|
1177
|
+
console.log("**** metaIDSaveWrapper: payload: ", {
|
|
1178
|
+
payload,
|
|
1179
|
+
props: this.props,
|
|
1180
|
+
state: this.state
|
|
1181
|
+
});
|
|
1182
|
+
this.props.actions.postMetaId(payload, handleMetaIDResult);
|
|
1183
|
+
} else {
|
|
1184
|
+
this.props.onSubmit(this.state.formData);
|
|
1185
|
+
}
|
|
1186
|
+
} else {
|
|
1187
|
+
this.props.onSubmit(this.state.formData);
|
|
1188
|
+
}
|
|
1189
|
+
};
|
|
1190
|
+
|
|
1085
1191
|
saveForm(saveForm) {
|
|
1086
1192
|
if (this.props.isNewVersionFlow && !saveForm) {
|
|
1087
1193
|
this.props.getValidationData();
|
|
@@ -1156,7 +1262,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1156
1262
|
};
|
|
1157
1263
|
this.props.actions.getLiquidTags(preprocessHtml(content), handleResult);
|
|
1158
1264
|
} else {
|
|
1159
|
-
this.
|
|
1265
|
+
this.metaIDSaveWrapper();
|
|
1160
1266
|
}
|
|
1161
1267
|
} else {
|
|
1162
1268
|
this.setState({checkValidation: true});
|
|
@@ -3793,7 +3899,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3793
3899
|
|
|
3794
3900
|
|
|
3795
3901
|
return (
|
|
3796
|
-
<CapSpin spinning={Boolean(this.liquidFlow && this.props.liquidExtractionInProgress)} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
|
|
3902
|
+
<CapSpin spinning={Boolean((this.liquidFlow && this.props.liquidExtractionInProgress) || this.props.metaIdStatus === 'REQUEST')} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
|
|
3797
3903
|
<CapRow>
|
|
3798
3904
|
{this.props.schema && this.renderForm()}
|
|
3799
3905
|
<SlideBox
|
|
@@ -3827,6 +3933,9 @@ FormBuilder.defaultProps = {
|
|
|
3827
3933
|
isNewVersionFlow: false,
|
|
3828
3934
|
userLocale: localStorage.getItem('jlocale') || 'en',
|
|
3829
3935
|
showLiquidErrorInFooter: () => {},
|
|
3936
|
+
metaIdStatus: false,
|
|
3937
|
+
isLoyaltyModule: false,
|
|
3938
|
+
loyaltyMetaData: {},
|
|
3830
3939
|
};
|
|
3831
3940
|
|
|
3832
3941
|
FormBuilder.propTypes = {
|
|
@@ -3875,11 +3984,13 @@ FormBuilder.propTypes = {
|
|
|
3875
3984
|
currentOrgDetails: PropTypes.object,
|
|
3876
3985
|
liquidExtractionInProgress: PropTypes.bool,
|
|
3877
3986
|
showLiquidErrorInFooter: PropTypes.func,
|
|
3987
|
+
loyaltyMetaData: PropTypes.object
|
|
3878
3988
|
};
|
|
3879
3989
|
|
|
3880
3990
|
const mapStateToProps = createStructuredSelector({
|
|
3881
3991
|
currentOrgDetails: selectCurrentOrgDetails(),
|
|
3882
3992
|
liquidExtractionInProgress: selectLiquidStateDetails(),
|
|
3993
|
+
metaIdStatus: selectMetaTagsStatus(),
|
|
3883
3994
|
metaEntities: makeSelectMetaEntities(),
|
|
3884
3995
|
});
|
|
3885
3996
|
|
|
@@ -303,7 +303,7 @@ exports[`Test Templates container Should render correct preview component for za
|
|
|
303
303
|
className="preview-text"
|
|
304
304
|
type="label1"
|
|
305
305
|
>
|
|
306
|
-
Preview of the template is generated on the Zalo platform. Click on
|
|
306
|
+
Preview of the template is generated on the Zalo platform. Click on ‘Open preview’ to view it in a new tab
|
|
307
307
|
</CapLabel>
|
|
308
308
|
</CapRow>
|
|
309
309
|
<CapRow>
|
|
@@ -85,3 +85,12 @@ export const getLiquidTags = (data,callback) => {
|
|
|
85
85
|
callback,
|
|
86
86
|
};
|
|
87
87
|
};
|
|
88
|
+
|
|
89
|
+
export const postMetaId = (data, callback) => {
|
|
90
|
+
console.log("postMetaId action", data, callback);
|
|
91
|
+
return {
|
|
92
|
+
type: types.GET_META_ID_REQUEST,
|
|
93
|
+
data,
|
|
94
|
+
callback,
|
|
95
|
+
};
|
|
96
|
+
};
|
|
@@ -63,3 +63,7 @@ export const DEFAULT_MODULE = 'creatives';
|
|
|
63
63
|
export const GET_LIQUID_TAGS_FAILURE = 'cap/GET_LIQUID_TAGS_FAILURE_V2';
|
|
64
64
|
export const GET_LIQUID_TAGS_REQUEST = 'cap/GET_LIQUID_TAGS_REQUEST_V2';
|
|
65
65
|
export const GET_LIQUID_TAGS_SUCCESS = 'cap/GET_LIQUID_TAGS_SUCCESS_V2';
|
|
66
|
+
|
|
67
|
+
export const GET_META_ID_FAILURE = 'cap/GET_META_ID_FAILURE_V2';
|
|
68
|
+
export const GET_META_ID_REQUEST = 'cap/GET_META_ID_REQUEST_V2';
|
|
69
|
+
export const GET_META_ID_SUCCESS = 'cap/GET_META_ID_SUCCESS_V2';
|
|
@@ -199,6 +199,12 @@ function capReducer(state = fromJS(initialState.cap), action) {
|
|
|
199
199
|
return state
|
|
200
200
|
.set('demoVideoAndLinkJSONStatus', types.FAILURE)
|
|
201
201
|
.set('demoVideoAndLinkJSONError', action?.error);
|
|
202
|
+
case types.GET_META_ID_REQUEST:
|
|
203
|
+
return state.set('metaTagsStatus', types.REQUEST);
|
|
204
|
+
case types.GET_META_ID_SUCCESS:
|
|
205
|
+
return state.set('metaTagsStatus', types.SUCCESS);
|
|
206
|
+
case types.GET_META_ID_FAILURE:
|
|
207
|
+
return state.set('metaTagsStatus', types.FAILURE);
|
|
202
208
|
default:
|
|
203
209
|
return state;
|
|
204
210
|
}
|
|
@@ -186,6 +186,28 @@ const getTopbarData = (parentModule) => {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
+
export function* postMetaId(action) {
|
|
190
|
+
try {
|
|
191
|
+
console.log("postMetaId saga", action);
|
|
192
|
+
// const result = yield call(Api.postMetaId, action?.data);
|
|
193
|
+
const result = {
|
|
194
|
+
status: true,
|
|
195
|
+
metaId: "2334",
|
|
196
|
+
};
|
|
197
|
+
console.log("postMetaId saga result", result);
|
|
198
|
+
if (result) {
|
|
199
|
+
if (action?.callback) {
|
|
200
|
+
yield call(action?.callback, result);
|
|
201
|
+
}
|
|
202
|
+
yield put({ type: types.GET_META_ID_SUCCESS, result });
|
|
203
|
+
} else {
|
|
204
|
+
yield put({ type: types.GET_META_ID_FAILURE });
|
|
205
|
+
}
|
|
206
|
+
} catch (error) {
|
|
207
|
+
yield put({ type: types.GET_META_ID_FAILURE, error });
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
189
211
|
function* getTopbarMenuData(params) {
|
|
190
212
|
const {parentModule} = params;
|
|
191
213
|
try {
|
|
@@ -225,6 +247,10 @@ export function* watchLiquidEntity() {
|
|
|
225
247
|
yield takeLatest(types.GET_LIQUID_TAGS_REQUEST, getLiquidTags);
|
|
226
248
|
}
|
|
227
249
|
|
|
250
|
+
export function* watchMetaId() {
|
|
251
|
+
yield takeLatest(types.GET_META_ID_REQUEST, postMetaId);
|
|
252
|
+
}
|
|
253
|
+
|
|
228
254
|
function* watchForOrgChange() {
|
|
229
255
|
yield takeLatest(types.SWITCH_ORG_REQUEST, switchOrg);
|
|
230
256
|
}
|
|
@@ -257,6 +283,7 @@ export default [
|
|
|
257
283
|
watchGetTopbarMenuData,
|
|
258
284
|
watchForGetVideosConfig,
|
|
259
285
|
watchLiquidEntity,
|
|
286
|
+
watchMetaId,
|
|
260
287
|
];
|
|
261
288
|
|
|
262
289
|
|
|
@@ -268,6 +295,7 @@ export function* capSagaForFetchSchemaForEntity() {
|
|
|
268
295
|
export function* capSagaLiquidEntity() {
|
|
269
296
|
yield all([
|
|
270
297
|
watchLiquidEntity(),
|
|
298
|
+
watchMetaId(),
|
|
271
299
|
]);
|
|
272
300
|
};
|
|
273
301
|
|
|
@@ -279,5 +307,6 @@ export function* v2CapSagas() {
|
|
|
279
307
|
watchForFetchUserInfo(),
|
|
280
308
|
watchGetTopbarMenuData(),
|
|
281
309
|
watchForGetVideosConfig(),
|
|
310
|
+
watchMetaId(),
|
|
282
311
|
]);
|
|
283
312
|
}
|
|
@@ -72,6 +72,11 @@ const selectLiquidStateDetails = () => createSelector(
|
|
|
72
72
|
(globalState) => globalState.get('fetchingLiquidTags')
|
|
73
73
|
);
|
|
74
74
|
|
|
75
|
+
const selectMetaTagsStatus = () => createSelector(
|
|
76
|
+
selectCapDomain,
|
|
77
|
+
(globalState) => globalState.get('metaTagsStatus')
|
|
78
|
+
);
|
|
79
|
+
|
|
75
80
|
const makeSelectFetchingSchema = () => createSelector(
|
|
76
81
|
selectCapDomain,
|
|
77
82
|
(globalState) => globalState.get('fetchingSchema')
|
|
@@ -113,4 +118,5 @@ export {
|
|
|
113
118
|
makeSelectFetchingSchemaError,
|
|
114
119
|
makeSelectDemoVideoAndLink,
|
|
115
120
|
selectLiquidStateDetails,
|
|
121
|
+
selectMetaTagsStatus,
|
|
116
122
|
};
|
|
@@ -158,6 +158,7 @@ export function SlideBoxContent(props) {
|
|
|
158
158
|
hostName = '',
|
|
159
159
|
eventContextTags,
|
|
160
160
|
isLoyaltyModule,
|
|
161
|
+
loyaltyMetaData = {},
|
|
161
162
|
} = props;
|
|
162
163
|
const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
|
|
163
164
|
const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
|
|
@@ -514,6 +515,8 @@ export function SlideBoxContent(props) {
|
|
|
514
515
|
onCreateComplete={onCreateComplete}
|
|
515
516
|
smsRegister={smsRegister}
|
|
516
517
|
eventContextTags={eventContextTags}
|
|
518
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
519
|
+
messageDetails={messageDetails}
|
|
517
520
|
/>
|
|
518
521
|
)}
|
|
519
522
|
{isEditFTP && (
|
|
@@ -615,6 +618,8 @@ export function SlideBoxContent(props) {
|
|
|
615
618
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
616
619
|
eventContextTags={eventContextTags}
|
|
617
620
|
isLoyaltyModule={isLoyaltyModule}
|
|
621
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
622
|
+
messageDetails={messageDetails}
|
|
618
623
|
/>
|
|
619
624
|
)}
|
|
620
625
|
{(isEditEmailWithId || isEmailEditWithContent) && (
|
|
@@ -645,6 +650,8 @@ export function SlideBoxContent(props) {
|
|
|
645
650
|
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
646
651
|
eventContextTags={eventContextTags}
|
|
647
652
|
isLoyaltyModule={isLoyaltyModule}
|
|
653
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
654
|
+
messageDetails={messageDetails}
|
|
648
655
|
/>
|
|
649
656
|
)}
|
|
650
657
|
{isEditMPush &&
|
|
@@ -671,6 +678,8 @@ export function SlideBoxContent(props) {
|
|
|
671
678
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
672
679
|
creativesMode={creativesMode}
|
|
673
680
|
eventContextTags={eventContextTags}
|
|
681
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
682
|
+
messageDetails={messageDetails}
|
|
674
683
|
/>
|
|
675
684
|
}
|
|
676
685
|
{isCreateMPush &&
|
|
@@ -700,6 +709,8 @@ export function SlideBoxContent(props) {
|
|
|
700
709
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
701
710
|
onTestContentClicked={onTestContentClicked}
|
|
702
711
|
eventContextTags={eventContextTags}
|
|
712
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
713
|
+
messageDetails={messageDetails}
|
|
703
714
|
/>
|
|
704
715
|
}
|
|
705
716
|
{
|
|
@@ -75,6 +75,7 @@ const SlideBoxWrapper = styled.div`
|
|
|
75
75
|
`;
|
|
76
76
|
export class Creatives extends React.Component {
|
|
77
77
|
constructor(props) {
|
|
78
|
+
//send metaId and setMetaId from loyalty module in props
|
|
78
79
|
super(props);
|
|
79
80
|
this.state = {
|
|
80
81
|
isLoadingContent: true,
|
|
@@ -88,6 +89,7 @@ export class Creatives extends React.Component {
|
|
|
88
89
|
weChatMaptemplateStep: 0,
|
|
89
90
|
isLiquidValidationError: false,
|
|
90
91
|
errorMessages: [],
|
|
92
|
+
metaId: null,
|
|
91
93
|
};
|
|
92
94
|
this.creativesTemplateSteps = {
|
|
93
95
|
1: 'modeSelection',
|
|
@@ -1272,6 +1274,7 @@ export class Creatives extends React.Component {
|
|
|
1272
1274
|
enableNewChannels,
|
|
1273
1275
|
eventContextTags,
|
|
1274
1276
|
isLoyaltyModule,
|
|
1277
|
+
loyaltyMetaData = {},
|
|
1275
1278
|
} = this.props;
|
|
1276
1279
|
const mapTemplateCreate =
|
|
1277
1280
|
slidBoxContent === "createTemplate" &&
|
|
@@ -1377,6 +1380,7 @@ export class Creatives extends React.Component {
|
|
|
1377
1380
|
hostName={this.props?.hostName || ''}
|
|
1378
1381
|
eventContextTags={eventContextTags}
|
|
1379
1382
|
isLoyaltyModule={isLoyaltyModule}
|
|
1383
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
1380
1384
|
/>
|
|
1381
1385
|
)}
|
|
1382
1386
|
footer={this.shouldShowFooter() && (
|
|
@@ -2747,6 +2747,8 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2747
2747
|
eventContextTags={this.props?.eventContextTags}
|
|
2748
2748
|
forwardedTags={this.props?.forwardedTags}
|
|
2749
2749
|
isLoyaltyModule={this.props?.isLoyaltyModule}
|
|
2750
|
+
messageDetails={this.props?.messageDetails}
|
|
2751
|
+
loyaltyMetaData={this.props?.loyaltyMetaData}
|
|
2750
2752
|
/> : ''}
|
|
2751
2753
|
</Col>
|
|
2752
2754
|
</Row>
|
|
@@ -229,6 +229,8 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
229
229
|
eventContextTags,
|
|
230
230
|
// Flag to enable loyalty module specific features in the email editor
|
|
231
231
|
isLoyaltyModule,
|
|
232
|
+
loyaltyMetaData = {},
|
|
233
|
+
messageDetails = {},
|
|
232
234
|
} = this.props;
|
|
233
235
|
const {
|
|
234
236
|
templateName,
|
|
@@ -303,6 +305,8 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
|
|
|
303
305
|
moduleType={moduleType}
|
|
304
306
|
eventContextTags={eventContextTags}
|
|
305
307
|
isLoyaltyModule={isLoyaltyModule}
|
|
308
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
309
|
+
messageDetails={messageDetails}
|
|
306
310
|
/>}
|
|
307
311
|
{!isShowEmailCreate && (
|
|
308
312
|
<CmsTemplatesComponent
|
|
@@ -1991,6 +1991,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1991
1991
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
1992
1992
|
isFullMode={this.props.isFullMode}
|
|
1993
1993
|
eventContextTags={this.props?.eventContextTags}
|
|
1994
|
+
loyaltyMetaData={this.props?.loyaltyMetaData}
|
|
1995
|
+
messageDetails={this.props?.messageDetails}
|
|
1994
1996
|
/>}
|
|
1995
1997
|
</CapColumn>
|
|
1996
1998
|
{this.props.iosCtasData && this.state.showIosCtaTable &&
|
|
@@ -72,7 +72,7 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
72
72
|
}
|
|
73
73
|
|
|
74
74
|
render() {
|
|
75
|
-
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = []} = this.props;
|
|
75
|
+
const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = [], loyaltyMetaData = {}, messageDetails = {}} = this.props;
|
|
76
76
|
const {templateName} = this.state;
|
|
77
77
|
const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
|
|
78
78
|
return (
|
|
@@ -120,6 +120,8 @@ export class MobilepushWrapper extends React.Component { // eslint-disable-line
|
|
|
120
120
|
templateData={templateData}
|
|
121
121
|
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
122
122
|
eventContextTags={eventContextTags}
|
|
123
|
+
loyaltyMetaData={loyaltyMetaData}
|
|
124
|
+
messageDetails={messageDetails}
|
|
123
125
|
/>
|
|
124
126
|
|
|
125
127
|
|
|
@@ -994,6 +994,8 @@ export class Create extends React.Component { // eslint-disable-line react/prefe
|
|
|
994
994
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
995
995
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
996
996
|
eventContextTags={this.props?.eventContextTags}
|
|
997
|
+
loyaltyMetaData={this.props?.loyaltyMetaData}
|
|
998
|
+
messageDetails={this.props?.messageDetails}
|
|
997
999
|
/>
|
|
998
1000
|
</CapColumn>
|
|
999
1001
|
</CapRow>
|
|
@@ -992,6 +992,8 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
|
|
|
992
992
|
onPreviewContentClicked={this.props.onPreviewContentClicked}
|
|
993
993
|
onTestContentClicked={this.props.onTestContentClicked}
|
|
994
994
|
eventContextTags={this.props?.eventContextTags}
|
|
995
|
+
loyaltyMetaData={this.props?.loyaltyMetaData}
|
|
996
|
+
messageDetails={this.props?.messageDetails}
|
|
995
997
|
/>
|
|
996
998
|
</CapColumn>
|
|
997
999
|
</CapRow>
|
|
@@ -30,6 +30,8 @@ const SmsWrapper = (props) => {
|
|
|
30
30
|
smsRegister,
|
|
31
31
|
onShowTemplates,
|
|
32
32
|
eventContextTags,
|
|
33
|
+
loyaltyMetaData = {},
|
|
34
|
+
messageDetails = {},
|
|
33
35
|
} = props;
|
|
34
36
|
|
|
35
37
|
const smsProps = {
|
|
@@ -46,6 +48,8 @@ const SmsWrapper = (props) => {
|
|
|
46
48
|
onPreviewContentClicked,
|
|
47
49
|
onTestContentClicked,
|
|
48
50
|
eventContextTags,
|
|
51
|
+
loyaltyMetaData,
|
|
52
|
+
messageDetails,
|
|
49
53
|
};
|
|
50
54
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
51
55
|
return <>
|
|
@@ -278,50 +278,31 @@ export const Zalo = (props) => {
|
|
|
278
278
|
return tagError;
|
|
279
279
|
};
|
|
280
280
|
|
|
281
|
-
|
|
281
|
+
//this function is used for checking errror validation in this it validate tags error and length error
|
|
282
|
+
const handleErrorValidation = (e, field) => {
|
|
282
283
|
const { minLength, maxLength } = field;
|
|
283
|
-
let error = '';
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
const tagError = tagValidationErrorMessage(value);
|
|
290
|
-
if (tagError) {
|
|
291
|
-
return { error: tagError };
|
|
292
|
-
}
|
|
293
|
-
}
|
|
294
|
-
|
|
295
|
-
// Length validation
|
|
296
|
-
if (!value || value.length <= minLength || value.length > maxLength) {
|
|
297
|
-
if (hasTags) {
|
|
298
|
-
// Show warning instead of error for tag-based content
|
|
299
|
-
warning = formatMessage(messages.tagLengthWarning, {
|
|
300
|
-
maxLength,
|
|
301
|
-
});
|
|
302
|
-
} else {
|
|
303
|
-
// Show error for static content
|
|
304
|
-
error = formatMessage(messages.maxMinLengthMessage, {
|
|
305
|
-
minLength,
|
|
306
|
-
maxLength,
|
|
307
|
-
});
|
|
308
|
-
}
|
|
284
|
+
let error = e ? tagValidationErrorMessage(e) : '';
|
|
285
|
+
if (!e || e.length <= minLength || e.length > maxLength) {
|
|
286
|
+
error = formatMessage(messages.maxMinLengthMessage, {
|
|
287
|
+
minLength,
|
|
288
|
+
maxLength,
|
|
289
|
+
});
|
|
309
290
|
}
|
|
310
|
-
return
|
|
291
|
+
return error;
|
|
311
292
|
};
|
|
312
293
|
|
|
294
|
+
// this function is used for handle form data change in this also handle error validtion on change of value
|
|
313
295
|
const handleFormDataChange = (e, field) => {
|
|
314
296
|
const {
|
|
315
297
|
target: { value },
|
|
316
298
|
} = e;
|
|
317
299
|
const updatedZaloTemplateInfo = templateListParams?.map((listParams) => {
|
|
318
300
|
if (listParams?.name === field?.name) {
|
|
319
|
-
const
|
|
301
|
+
const error = handleErrorValidation(value, field);
|
|
320
302
|
return {
|
|
321
303
|
...listParams,
|
|
322
304
|
value,
|
|
323
305
|
error,
|
|
324
|
-
warning,
|
|
325
306
|
};
|
|
326
307
|
}
|
|
327
308
|
return listParams;
|
|
@@ -330,26 +311,19 @@ export const Zalo = (props) => {
|
|
|
330
311
|
};
|
|
331
312
|
|
|
332
313
|
const renderTextBoxesForListParams = (listParam) => {
|
|
333
|
-
const { name
|
|
314
|
+
const { name, error, value } = listParam;
|
|
334
315
|
return (
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
/>
|
|
347
|
-
{warning && (
|
|
348
|
-
<CapLabel type="warning" className="variable-field-warning">
|
|
349
|
-
{warning}
|
|
350
|
-
</CapLabel>
|
|
351
|
-
)}
|
|
352
|
-
</>
|
|
316
|
+
<CapInput
|
|
317
|
+
id={`zalo-${name}`}
|
|
318
|
+
onChange={(e) => handleFormDataChange(e, listParam)}
|
|
319
|
+
errorMessage={error}
|
|
320
|
+
placeholder={formatMessage(messages.addVariableWithMessage)}
|
|
321
|
+
defaultValue={value || ''}
|
|
322
|
+
value={value || ''}
|
|
323
|
+
size="default"
|
|
324
|
+
onFocus={() => setTextAreaId(name)}
|
|
325
|
+
disabled={isFullMode}
|
|
326
|
+
/>
|
|
353
327
|
);
|
|
354
328
|
};
|
|
355
329
|
|
|
@@ -377,9 +351,11 @@ export const Zalo = (props) => {
|
|
|
377
351
|
const isEditDoneDisabled = () => {
|
|
378
352
|
let disableCheck = false;
|
|
379
353
|
templateListParams?.forEach((listParams) => {
|
|
380
|
-
const { error
|
|
381
|
-
|
|
382
|
-
|
|
354
|
+
const { error, value } = listParams;
|
|
355
|
+
const errorMessage = !error
|
|
356
|
+
? handleErrorValidation(value, listParams)
|
|
357
|
+
: error;
|
|
358
|
+
if (errorMessage) {
|
|
383
359
|
disableCheck = true;
|
|
384
360
|
}
|
|
385
361
|
});
|
|
@@ -33,7 +33,7 @@ export default defineMessages({
|
|
|
33
33
|
},
|
|
34
34
|
previewText: {
|
|
35
35
|
id: `${prefix}.previewText`,
|
|
36
|
-
defaultMessage: `Preview of the template is generated on the Zalo platform. Click on
|
|
36
|
+
defaultMessage: `Preview of the template is generated on the Zalo platform. Click on ‘Open preview’ to view it in a new tab`,
|
|
37
37
|
},
|
|
38
38
|
openPreview: {
|
|
39
39
|
id: `${prefix}.openPreview`,
|
|
@@ -83,8 +83,4 @@ export default defineMessages({
|
|
|
83
83
|
id: `${prefix}.btnDisabledTooltip`,
|
|
84
84
|
defaultMessage: 'Please add all mandatory fields to proceed further',
|
|
85
85
|
},
|
|
86
|
-
tagLengthWarning: {
|
|
87
|
-
id: 'app.containers.Zalo.tagLengthWarning',
|
|
88
|
-
defaultMessage: 'If the character count of the tag value exceeds {maxLength}, the campaign will fail.',
|
|
89
|
-
},
|
|
90
86
|
});
|