@capillarytech/creatives-library 8.0.87-alpha.5 → 8.0.87-alpha.7
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 +6 -0
- package/v2Components/FormBuilder/index.js +80 -6
- 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 +25 -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 +34 -66
- package/v2Containers/Zalo/messages.js +1 -5
package/initialState.js
CHANGED
package/package.json
CHANGED
package/services/api.js
CHANGED
|
@@ -569,4 +569,10 @@ export const getLiquidTags = (content) => {
|
|
|
569
569
|
return request(url, getAPICallObject("POST", { content }, false, true));
|
|
570
570
|
};
|
|
571
571
|
|
|
572
|
+
export const createCentralCommsMetaId = (payload) => {
|
|
573
|
+
console.log("createCentralCommsMetaId: API call: ", { payload });
|
|
574
|
+
const url = `${API_ENDPOINT}/createCentralCommsMetaId/TRANSACTION`;
|
|
575
|
+
return request(url, getAPICallObject('POST', payload));
|
|
576
|
+
};
|
|
577
|
+
|
|
572
578
|
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";
|
|
@@ -1064,6 +1064,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1064
1064
|
};
|
|
1065
1065
|
handleLiquidTemplateSubmit =(templateContent) => {
|
|
1066
1066
|
if(templateContent){this.setState((prevState) => {
|
|
1067
|
+
console.log('**** handleLiquidTemplateSubmit: ', { prevState, templateContent });
|
|
1067
1068
|
return {
|
|
1068
1069
|
formData: {
|
|
1069
1070
|
...prevState?.formData,
|
|
@@ -1077,11 +1078,79 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1077
1078
|
}
|
|
1078
1079
|
};
|
|
1079
1080
|
}, () => {
|
|
1080
|
-
|
|
1081
|
-
this.props.onSubmit(this.state.formData);
|
|
1082
|
-
}
|
|
1081
|
+
this.metaIDSaveWrapper();
|
|
1083
1082
|
});}
|
|
1084
1083
|
}
|
|
1084
|
+
|
|
1085
|
+
metaIDSaveWrapper = () => {
|
|
1086
|
+
const {
|
|
1087
|
+
actionName,
|
|
1088
|
+
actionId,
|
|
1089
|
+
ouId,
|
|
1090
|
+
clientName,
|
|
1091
|
+
module,
|
|
1092
|
+
metaId,
|
|
1093
|
+
setMetaId = () => {},
|
|
1094
|
+
} = this.props.loyaltyMetaData;
|
|
1095
|
+
const { formatMessage } = this.props.intl;
|
|
1096
|
+
const handleMetaIDResult = (result) => {
|
|
1097
|
+
console.log("**** handleMetaIDResult: 1", { result });
|
|
1098
|
+
if (result.status === 200 && this.props.onSubmit) {
|
|
1099
|
+
console.log("**** handleMetaIDResult: 2.1", { result });
|
|
1100
|
+
setMetaId(result?.metaId);
|
|
1101
|
+
this.props.onSubmit(this.state.formData);
|
|
1102
|
+
} else {
|
|
1103
|
+
// this.setState({ metaID: null });
|
|
1104
|
+
console.log("**** handleMetaIDResult: 2.2 ", { result });
|
|
1105
|
+
this.setState(
|
|
1106
|
+
prevState => ({
|
|
1107
|
+
liquidErrorMessage: {
|
|
1108
|
+
...prevState.liquidErrorMessage,
|
|
1109
|
+
STANDARD_ERROR_MSG: result?.errors?.length > 0
|
|
1110
|
+
? [
|
|
1111
|
+
...(prevState.liquidErrorMessage?.STANDARD_ERROR_MSG || []),
|
|
1112
|
+
formatMessage(messages.emailBodyEmptyError)
|
|
1113
|
+
]
|
|
1114
|
+
: prevState.liquidErrorMessage?.STANDARD_ERROR_MSG,
|
|
1115
|
+
LIQUID_ERROR_MSG: result?.errors?.map(
|
|
1116
|
+
error => error?.message
|
|
1117
|
+
) ?? [formatMessage(messages.somethingWentWrong)]
|
|
1118
|
+
}
|
|
1119
|
+
}),
|
|
1120
|
+
() => {
|
|
1121
|
+
this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage);
|
|
1122
|
+
}
|
|
1123
|
+
);
|
|
1124
|
+
this.props.stopValidation();
|
|
1125
|
+
return;
|
|
1126
|
+
}
|
|
1127
|
+
};
|
|
1128
|
+
console.log("**** metaIDSaveWrapper: BODY", { actionName, actionId, ouId, clientName, module, metaId, setMetaId, messageDetails: this.props.messageDetails });
|
|
1129
|
+
const content = this.state.formData?.base?.en?.["template-content"] || "";
|
|
1130
|
+
// Only generate metaId for loyalty module and specific action
|
|
1131
|
+
if (this.props.isLoyaltyModule && actionName === 'SEND_COMMUNICATION_ACTION') {
|
|
1132
|
+
//need to pass payload , this will be same as the payload for template creation/edit api
|
|
1133
|
+
const payload = {
|
|
1134
|
+
ouId: ouId || -1,
|
|
1135
|
+
clientName: clientName || "EMF",
|
|
1136
|
+
sourceEntityId: actionId,
|
|
1137
|
+
module: module,
|
|
1138
|
+
executionParams: {},
|
|
1139
|
+
content,
|
|
1140
|
+
...this.props.messageDetails,
|
|
1141
|
+
channel: this.props.messageDetails?.type
|
|
1142
|
+
};
|
|
1143
|
+
console.log("**** metaIDSaveWrapper: payload: ", {
|
|
1144
|
+
payload,
|
|
1145
|
+
props: this.props,
|
|
1146
|
+
state: this.state
|
|
1147
|
+
});
|
|
1148
|
+
this.props.actions.createCentralCommsMetaId(payload, handleMetaIDResult);
|
|
1149
|
+
} else {
|
|
1150
|
+
this.props.onSubmit(this.state.formData);
|
|
1151
|
+
}
|
|
1152
|
+
};
|
|
1153
|
+
|
|
1085
1154
|
saveForm(saveForm) {
|
|
1086
1155
|
if (this.props.isNewVersionFlow && !saveForm) {
|
|
1087
1156
|
this.props.getValidationData();
|
|
@@ -1156,7 +1225,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
1156
1225
|
};
|
|
1157
1226
|
this.props.actions.getLiquidTags(preprocessHtml(content), handleResult);
|
|
1158
1227
|
} else {
|
|
1159
|
-
this.
|
|
1228
|
+
this.metaIDSaveWrapper();
|
|
1160
1229
|
}
|
|
1161
1230
|
} else {
|
|
1162
1231
|
this.setState({checkValidation: true});
|
|
@@ -3793,7 +3862,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
|
|
|
3793
3862
|
|
|
3794
3863
|
|
|
3795
3864
|
return (
|
|
3796
|
-
<CapSpin spinning={Boolean(this.liquidFlow && this.props.liquidExtractionInProgress)} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
|
|
3865
|
+
<CapSpin spinning={Boolean((this.liquidFlow && this.props.liquidExtractionInProgress) || this.props.metaIdStatus === 'REQUEST')} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
|
|
3797
3866
|
<CapRow>
|
|
3798
3867
|
{this.props.schema && this.renderForm()}
|
|
3799
3868
|
<SlideBox
|
|
@@ -3827,6 +3896,9 @@ FormBuilder.defaultProps = {
|
|
|
3827
3896
|
isNewVersionFlow: false,
|
|
3828
3897
|
userLocale: localStorage.getItem('jlocale') || 'en',
|
|
3829
3898
|
showLiquidErrorInFooter: () => {},
|
|
3899
|
+
metaIdStatus: false,
|
|
3900
|
+
isLoyaltyModule: false,
|
|
3901
|
+
loyaltyMetaData: {},
|
|
3830
3902
|
};
|
|
3831
3903
|
|
|
3832
3904
|
FormBuilder.propTypes = {
|
|
@@ -3875,11 +3947,13 @@ FormBuilder.propTypes = {
|
|
|
3875
3947
|
currentOrgDetails: PropTypes.object,
|
|
3876
3948
|
liquidExtractionInProgress: PropTypes.bool,
|
|
3877
3949
|
showLiquidErrorInFooter: PropTypes.func,
|
|
3950
|
+
loyaltyMetaData: PropTypes.object
|
|
3878
3951
|
};
|
|
3879
3952
|
|
|
3880
3953
|
const mapStateToProps = createStructuredSelector({
|
|
3881
3954
|
currentOrgDetails: selectCurrentOrgDetails(),
|
|
3882
3955
|
liquidExtractionInProgress: selectLiquidStateDetails(),
|
|
3956
|
+
metaIdStatus: selectMetaTagsStatus(),
|
|
3883
3957
|
metaEntities: makeSelectMetaEntities(),
|
|
3884
3958
|
});
|
|
3885
3959
|
|
|
@@ -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 createCentralCommsMetaId = (data, callback) => {
|
|
90
|
+
console.log("createCentralCommsMetaId action", data, callback);
|
|
91
|
+
return {
|
|
92
|
+
type: types.CREATE_CENTRAL_COMMS_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 CREATE_CENTRAL_COMMS_META_ID_FAILURE = 'cap/CREATE_CENTRAL_COMMS_META_ID_FAILURE_V2';
|
|
68
|
+
export const CREATE_CENTRAL_COMMS_META_ID_REQUEST = 'cap/CREATE_CENTRAL_COMMS_META_ID_REQUEST_V2';
|
|
69
|
+
export const CREATE_CENTRAL_COMMS_META_ID_SUCCESS = 'cap/CREATE_CENTRAL_COMMS_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.CREATE_CENTRAL_COMMS_META_ID_REQUEST:
|
|
203
|
+
return state.set('metaTagsStatus', types.REQUEST);
|
|
204
|
+
case types.CREATE_CENTRAL_COMMS_META_ID_SUCCESS:
|
|
205
|
+
return state.set('metaTagsStatus', types.SUCCESS);
|
|
206
|
+
case types.CREATE_CENTRAL_COMMS_META_ID_FAILURE:
|
|
207
|
+
return state.set('metaTagsStatus', types.FAILURE);
|
|
202
208
|
default:
|
|
203
209
|
return state;
|
|
204
210
|
}
|
|
@@ -186,6 +186,24 @@ const getTopbarData = (parentModule) => {
|
|
|
186
186
|
}
|
|
187
187
|
};
|
|
188
188
|
|
|
189
|
+
export function* createCentralCommsMetaId(action) {
|
|
190
|
+
try {
|
|
191
|
+
console.log("createCentralCommsMetaId saga", action);
|
|
192
|
+
const result = yield call(Api.createCentralCommsMetaId, action?.data);
|
|
193
|
+
console.log("createCentralCommsMetaId saga result", result);
|
|
194
|
+
if (result) {
|
|
195
|
+
if (action?.callback) {
|
|
196
|
+
yield call(action?.callback, result);
|
|
197
|
+
}
|
|
198
|
+
yield put({ type: types.CREATE_CENTRAL_COMMS_META_ID_SUCCESS, result });
|
|
199
|
+
} else {
|
|
200
|
+
yield put({ type: types.CREATE_CENTRAL_COMMS_META_ID_FAILURE });
|
|
201
|
+
}
|
|
202
|
+
} catch (error) {
|
|
203
|
+
yield put({ type: types.CREATE_CENTRAL_COMMS_META_ID_FAILURE, error });
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
189
207
|
function* getTopbarMenuData(params) {
|
|
190
208
|
const {parentModule} = params;
|
|
191
209
|
try {
|
|
@@ -225,6 +243,10 @@ export function* watchLiquidEntity() {
|
|
|
225
243
|
yield takeLatest(types.GET_LIQUID_TAGS_REQUEST, getLiquidTags);
|
|
226
244
|
}
|
|
227
245
|
|
|
246
|
+
export function* watchMetaId() {
|
|
247
|
+
yield takeLatest(types.CREATE_CENTRAL_COMMS_META_ID_REQUEST, createCentralCommsMetaId);
|
|
248
|
+
}
|
|
249
|
+
|
|
228
250
|
function* watchForOrgChange() {
|
|
229
251
|
yield takeLatest(types.SWITCH_ORG_REQUEST, switchOrg);
|
|
230
252
|
}
|
|
@@ -257,6 +279,7 @@ export default [
|
|
|
257
279
|
watchGetTopbarMenuData,
|
|
258
280
|
watchForGetVideosConfig,
|
|
259
281
|
watchLiquidEntity,
|
|
282
|
+
watchMetaId,
|
|
260
283
|
];
|
|
261
284
|
|
|
262
285
|
|
|
@@ -268,6 +291,7 @@ export function* capSagaForFetchSchemaForEntity() {
|
|
|
268
291
|
export function* capSagaLiquidEntity() {
|
|
269
292
|
yield all([
|
|
270
293
|
watchLiquidEntity(),
|
|
294
|
+
watchMetaId(),
|
|
271
295
|
]);
|
|
272
296
|
};
|
|
273
297
|
|
|
@@ -279,5 +303,6 @@ export function* v2CapSagas() {
|
|
|
279
303
|
watchForFetchUserInfo(),
|
|
280
304
|
watchGetTopbarMenuData(),
|
|
281
305
|
watchForGetVideosConfig(),
|
|
306
|
+
watchMetaId(),
|
|
282
307
|
]);
|
|
283
308
|
}
|
|
@@ -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,27 +311,19 @@ export const Zalo = (props) => {
|
|
|
330
311
|
};
|
|
331
312
|
|
|
332
313
|
const renderTextBoxesForListParams = (listParam) => {
|
|
333
|
-
const { name
|
|
334
|
-
console.log('**listParam**', listParam);
|
|
314
|
+
const { name, error, value } = listParam;
|
|
335
315
|
return (
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
/>
|
|
348
|
-
{warning && (
|
|
349
|
-
<CapLabel type="warning" className="variable-field-warning">
|
|
350
|
-
{warning}
|
|
351
|
-
</CapLabel>
|
|
352
|
-
)}
|
|
353
|
-
</>
|
|
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
|
+
/>
|
|
354
327
|
);
|
|
355
328
|
};
|
|
356
329
|
|
|
@@ -378,9 +351,11 @@ export const Zalo = (props) => {
|
|
|
378
351
|
const isEditDoneDisabled = () => {
|
|
379
352
|
let disableCheck = false;
|
|
380
353
|
templateListParams?.forEach((listParams) => {
|
|
381
|
-
const { error
|
|
382
|
-
|
|
383
|
-
|
|
354
|
+
const { error, value } = listParams;
|
|
355
|
+
const errorMessage = !error
|
|
356
|
+
? handleErrorValidation(value, listParams)
|
|
357
|
+
: error;
|
|
358
|
+
if (errorMessage) {
|
|
384
359
|
disableCheck = true;
|
|
385
360
|
}
|
|
386
361
|
});
|
|
@@ -422,7 +397,7 @@ export const Zalo = (props) => {
|
|
|
422
397
|
|
|
423
398
|
const renderContent = () =>
|
|
424
399
|
templateListParams?.map((listParam) => {
|
|
425
|
-
const { name = '', value = '', maxLength
|
|
400
|
+
const { name = '', value = '', maxLength } = listParam;
|
|
426
401
|
return (
|
|
427
402
|
<>
|
|
428
403
|
{renderTextBoxesForListParams(listParam)}
|
|
@@ -432,19 +407,12 @@ export const Zalo = (props) => {
|
|
|
432
407
|
name,
|
|
433
408
|
})}
|
|
434
409
|
</CapLabel>
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
) : (
|
|
441
|
-
<CapLabel className="variable-field-length">
|
|
442
|
-
{formatMessage(messages.charactersCount, {
|
|
443
|
-
variableLength: value.length,
|
|
444
|
-
maxLength,
|
|
445
|
-
})}
|
|
410
|
+
<CapLabel className="variable-field-length">
|
|
411
|
+
{formatMessage(messages.charactersCount, {
|
|
412
|
+
variableLength: value.length,
|
|
413
|
+
maxLength,
|
|
414
|
+
})}
|
|
446
415
|
</CapLabel>
|
|
447
|
-
)}
|
|
448
416
|
</CapRow>
|
|
449
417
|
</>
|
|
450
418
|
);
|
|
@@ -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
|
});
|