@capillarytech/creatives-library 8.0.87-alpha.8 → 8.0.87

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 CHANGED
@@ -50,5 +50,4 @@ export default {
50
50
  facebook: {
51
51
 
52
52
  },
53
- metaTagsStatus: '',
54
53
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.87-alpha.8",
4
+ "version": "8.0.87",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
package/services/api.js CHANGED
@@ -9,7 +9,7 @@ import config from '../config/app';
9
9
  import pathConfig from '../config/path';
10
10
  import getSchema from './getSchema';
11
11
  import * as API from '../utils/ApiCaller';
12
- import { addBaseToTemplate } from '../utils/commonUtils';
12
+ import { addBaseToTemplate, transformCustomFieldsData } from '../utils/commonUtils';
13
13
  import { EMAIL, SMS } from '../v2Containers/CreativesContainer/constants';
14
14
  let API_ENDPOINT = config.development.api_endpoint;
15
15
  let EXPORT_API_ENDPOINT = config.development.exports_api_endpoint;
@@ -359,7 +359,13 @@ export const fetchSchemaForEntity = async ({queryParams}) => {
359
359
  });
360
360
  }
361
361
  const url = `${API_ENDPOINT}/meta/${queryParams.type}?query=${JSON.stringify(queryParams)}`;
362
- return request(url, getAPICallObject('GET'));// request(url, getAPICallObject('GET'));
362
+ const result = await request(url, getAPICallObject('GET'));// request(url, getAPICallObject('GET'));
363
+ const customFields = get(result, 'response.metaEntities.custom', {});
364
+ if (customFields && Object.keys(customFields)?.length > 0) {
365
+ const transformedData = transformCustomFieldsData(customFields);
366
+ result.response.metaEntities.custom = transformedData;
367
+ }
368
+ return result;
363
369
  };
364
370
 
365
371
  export const fetchWeCrmAccounts = (sourceName) => {
@@ -471,14 +477,12 @@ export const getUnsubscribeUrl = () => {
471
477
  return request(url, getAPICallObject('POST', body));
472
478
  };
473
479
 
474
- export const getMarketingObjectives = (channel) =>
475
- request(
476
- `${CAMPAIGNS_API_ENDPOINT}/socialObjectives?channel=${channel}`,
477
- getAPICallObject('GET', null, false, true),
478
- );
480
+ export const getMarketingObjectives = (channel) => request(
481
+ `${CAMPAIGNS_API_ENDPOINT}/socialObjectives?channel=${channel}`,
482
+ getAPICallObject('GET', null, false, true),
483
+ );
479
484
 
480
- export const getAllLineStickers = () =>
481
- request(`${API_ENDPOINT}/meta/sticker`, getAPICallObject('GET'));
485
+ export const getAllLineStickers = () => request(`${API_ENDPOINT}/meta/sticker`, getAPICallObject('GET'));
482
486
 
483
487
 
484
488
  export const createCustomRow = (data) => {
@@ -569,10 +573,4 @@ export const getLiquidTags = (content) => {
569
573
  return request(url, getAPICallObject("POST", { content }, false, true));
570
574
  };
571
575
 
572
- export const createCentralCommsMetaId = (payload) => {
573
- console.log("createCentralCommsMetaId: API call: ", { payload });
574
- const url = `${API_ENDPOINT}/common/createCentralCommsMetaId/TRANSACTION`;
575
- return request(url, getAPICallObject('POST', payload));
576
- };
577
-
578
576
  export {request, getAPICallObject};
@@ -9,23 +9,75 @@ export const apiMessageFormatHandler = (id, fallback) => (
9
9
  );
10
10
 
11
11
  export const addBaseToTemplate = (template) => {
12
- const { versions: {
13
- history = [],
14
- } = {}} = template || {};
12
+ const {
13
+ versions: {
14
+ history = [],
15
+ } = {},
16
+ } = template || {};
15
17
  if (history?.length) {
16
18
  return ({
17
19
  ...template,
18
20
  versions: {
19
21
  ...template.versions,
20
- base:{
22
+ base: {
21
23
  ...history[0],
22
- ...( !history?.[0]?.subject && { subject: get(template, 'versions.base.subject') })
23
- }
24
- }
24
+ ...( !history?.[0]?.subject && { subject: get(template, 'versions.base.subject') }),
25
+ },
26
+ },
25
27
  });
26
28
  }
27
- return template;
29
+ return template;
28
30
  };
29
31
 
30
- export const isEmbeddedEditOrPreview = (queryType, creativesMode) => queryType === EMBEDDED &&
31
- [EDIT, PREVIEW].includes(creativesMode);
32
+ export const isEmbeddedEditOrPreview = (queryType, creativesMode) => queryType === EMBEDDED && [EDIT, PREVIEW].includes(creativesMode);
33
+
34
+ export const transformCustomFieldsData = (customFields) => {
35
+ // Define mapping of scopes to their display names
36
+ const scopeMapping = {
37
+ loyalty_registration: 'Registration custom fields',
38
+ loyalty_transaction: 'Registration custom fields',
39
+ store_custom_fields: 'Organization custom fields',
40
+ org_custom_field: 'Organization custom fields',
41
+ };
42
+
43
+ // Initialize result structure with all possible sections
44
+ const result = Object.values(scopeMapping).reduce((acc, sectionName) => {
45
+ acc[sectionName] = {
46
+ name: sectionName,
47
+ subtags: {},
48
+ };
49
+ return acc;
50
+ }, {});
51
+
52
+ // Process each custom field
53
+ Object.values(customFields).forEach((field) => {
54
+ const {scope = ''} = field;
55
+ const sectionName = scopeMapping[scope];
56
+
57
+ if (sectionName) {
58
+ // Determine the prefix based on scope
59
+ let prefix = 'custom_field';
60
+ if (scope === 'org_custom_field') {
61
+ prefix = 'org_custom_field';
62
+ } else if (scope === 'store_custom_fields') {
63
+ prefix = 'store_custom_field';
64
+ }
65
+
66
+ const fieldKey = `${prefix}.${field?.name}`;
67
+ // Add field to appropriate section
68
+ result[sectionName].subtags[fieldKey] = {
69
+ name: field?.name,
70
+ desc: field?.name || field?.label,
71
+ };
72
+ }
73
+ });
74
+
75
+ // Remove empty sections (those with no subtags)
76
+ Object.keys(result).forEach((sectionName) => {
77
+ if (Object.keys(result[sectionName]?.subtags)?.length === 0) {
78
+ delete result[sectionName];
79
+ }
80
+ });
81
+
82
+ return result;
83
+ };
@@ -2,10 +2,9 @@ import "@testing-library/jest-dom";
2
2
  import get from 'lodash/get';
3
3
  import { getTreeStructuredTags } from "../common";
4
4
  import * as mockdata from "./common.mockdata";
5
- import { addBaseToTemplate, isEmbeddedEditOrPreview } from "../commonUtils";
5
+ import { addBaseToTemplate, isEmbeddedEditOrPreview, transformCustomFieldsData } from "../commonUtils";
6
6
  import { EMBEDDED, FULL } from "../../v2Containers/Whatsapp/constants";
7
7
  import { CREATE, EDIT, PREVIEW } from "../../v2Containers/App/constants";
8
- import { query } from "express";
9
8
 
10
9
  jest.mock('@capillarytech/cap-ui-utils', () => ({
11
10
  Auth: {
@@ -38,7 +37,7 @@ describe('addBaseToTemplate', () => {
38
37
  versions: {
39
38
  history: ['v1', 'v2', 'v3'],
40
39
  base: {
41
- "0":"v","1":"1","subject":undefined,
40
+ 0: "v", 1: "1", subject: undefined,
42
41
  },
43
42
  },
44
43
  };
@@ -115,3 +114,109 @@ describe('isEmbeddedEditOrPreview', () => {
115
114
  expect(isEmbeddedEditOrPreview(queryType, creativesMode)).toBe(false);
116
115
  });
117
116
  });
117
+
118
+ describe('transformCustomFieldsData', () => {
119
+ it('should transform registration custom fields correctly', () => {
120
+ const input = {
121
+ 1: {
122
+ name: 'age_group',
123
+ label: 'Age Group',
124
+ scope: 'loyalty_registration',
125
+ },
126
+ 2: {
127
+ name: 'gender',
128
+ label: 'Gender',
129
+ scope: 'loyalty_registration',
130
+ },
131
+ };
132
+
133
+ const expected = {
134
+ 'Registration custom fields': {
135
+ name: 'Registration custom fields',
136
+ subtags: {
137
+ 'custom_field.age_group': {
138
+ name: 'age_group',
139
+ desc: 'age_group',
140
+ },
141
+ 'custom_field.gender': {
142
+ name: 'gender',
143
+ desc: 'gender',
144
+ },
145
+ },
146
+ },
147
+ };
148
+
149
+ expect(transformCustomFieldsData(input)).toEqual(expected);
150
+ });
151
+
152
+ it('should transform organization custom fields correctly', () => {
153
+ const input = {
154
+ 1: {
155
+ name: 'org_phone',
156
+ label: 'Phone',
157
+ scope: 'org_custom_field',
158
+ },
159
+ 2: {
160
+ name: 'store_location',
161
+ label: 'Location',
162
+ scope: 'store_custom_fields',
163
+ },
164
+ };
165
+
166
+ const expected = {
167
+ 'Organization custom fields': {
168
+ name: 'Organization custom fields',
169
+ subtags: {
170
+ 'org_custom_field.org_phone': {
171
+ name: 'org_phone',
172
+ desc: 'org_phone',
173
+ },
174
+ 'store_custom_field.store_location': {
175
+ name: 'store_location',
176
+ desc: 'store_location',
177
+ },
178
+ },
179
+ },
180
+ };
181
+
182
+ expect(transformCustomFieldsData(input)).toEqual(expected);
183
+ });
184
+
185
+ it('should handle empty input correctly', () => {
186
+ expect(transformCustomFieldsData({})).toEqual({});
187
+ });
188
+
189
+ it('should handle fields with missing properties', () => {
190
+ const input = {
191
+ 1: {
192
+ scope: 'loyalty_registration',
193
+ },
194
+ };
195
+
196
+ const expected = {
197
+ 'Registration custom fields': {
198
+ name: 'Registration custom fields',
199
+ subtags: {
200
+ 'custom_field.undefined': {
201
+ name: undefined,
202
+ desc: undefined,
203
+ },
204
+ },
205
+ },
206
+ };
207
+
208
+ expect(transformCustomFieldsData(input)).toEqual(expected);
209
+ });
210
+
211
+ it('should ignore fields with invalid scope', () => {
212
+ const input = {
213
+ 1: {
214
+ name: 'test',
215
+ label: 'Test',
216
+ scope: 'invalid_scope',
217
+ },
218
+ };
219
+
220
+ expect(transformCustomFieldsData(input)).toEqual({});
221
+ });
222
+ });
@@ -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, selectMetaTagsStatus } from "../../v2Containers/Cap/selectors";
47
+ import { makeSelectMetaEntities, selectCurrentOrgDetails, selectLiquidStateDetails } 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";
@@ -59,7 +59,6 @@ import { CUSTOMER_BARCODE_TAG , COPY_OF, ENTRY_TRIGGER_TAG_REGEX} from '../../co
59
59
  import { hasLiquidSupportFeature, isEmailUnsubscribeTagMandatory } from '../../utils/common';
60
60
  import { isUrl } from '../../v2Containers/Line/Container/Wrapper/utils';
61
61
  import { bindActionCreators } from 'redux';
62
- import { transformFormDataToAPIPayload } from './utils';
63
62
 
64
63
  const TabPane = Tabs.TabPane;
65
64
  const {Column} = Table;
@@ -1065,7 +1064,6 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1065
1064
  };
1066
1065
  handleLiquidTemplateSubmit =(templateContent) => {
1067
1066
  if(templateContent){this.setState((prevState) => {
1068
- console.log('**** handleLiquidTemplateSubmit: ', { prevState, templateContent });
1069
1067
  return {
1070
1068
  formData: {
1071
1069
  ...prevState?.formData,
@@ -1079,74 +1077,11 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1079
1077
  }
1080
1078
  };
1081
1079
  }, () => {
1082
- this.metaIDSaveWrapper();
1083
- });}
1084
- }
1085
-
1086
- metaIDSaveWrapper = () => {
1087
- const {
1088
- actionName,
1089
- actionId,
1090
- ouId,
1091
- clientName,
1092
- module,
1093
- metaId,
1094
- setMetaId = () => {},
1095
- channel,
1096
- } = this.props.loyaltyMetaData;
1097
- const { formatMessage } = this.props.intl;
1098
- const handleMetaIDResult = (result) => {
1099
- console.log("**** handleMetaIDResult: 1", { result });
1100
- if (result.status.code === 200 && this.props.onSubmit) {
1101
- console.log("**** handleMetaIDResult: 2.1", { result });
1102
- setMetaId(result?.metaId);
1080
+ if (this.props.onSubmit) {
1103
1081
  this.props.onSubmit(this.state.formData);
1104
- } else {
1105
- // this.setState({ metaID: null });
1106
- console.log("**** handleMetaIDResult: 2.2 ", { result });
1107
- this.setState(
1108
- prevState => ({
1109
- liquidErrorMessage: {
1110
- ...prevState.liquidErrorMessage,
1111
- STANDARD_ERROR_MSG: result?.errors?.length > 0
1112
- ? [
1113
- ...(prevState.liquidErrorMessage?.STANDARD_ERROR_MSG || []),
1114
- formatMessage(messages.emailBodyEmptyError)
1115
- ]
1116
- : prevState.liquidErrorMessage?.STANDARD_ERROR_MSG,
1117
- LIQUID_ERROR_MSG: result?.errors?.map(
1118
- error => error?.message
1119
- ) ?? [formatMessage(messages.somethingWentWrong)]
1120
- }
1121
- }),
1122
- () => {
1123
- this.props.showLiquidErrorInFooter(this.state.liquidErrorMessage);
1124
- }
1125
- );
1126
- this.props.stopValidation();
1127
- return;
1128
1082
  }
1129
- };
1130
- const content = this.state.formData?.base?.en?.["template-content"] || "";
1131
- console.log("**** metaIDSaveWrapper: BODY", { content, actionName, actionId, ouId, clientName, module, metaId, setMetaId, messageDetails: this.props.messageDetails, state: this.state });
1132
- // Only generate metaId for loyalty module and specific action
1133
- if (this.props.isLoyaltyModule && actionName === 'SEND_COMMUNICATION_ACTION') {
1134
- //need to pass payload , this will be same as the payload for template creation/edit api
1135
- const payload = transformFormDataToAPIPayload(
1136
- this.state.formData,
1137
- this.props.loyaltyMetaData
1138
- );
1139
- console.log("**** metaIDSaveWrapper: payload: ", {
1140
- payload,
1141
- props: this.props,
1142
- state: this.state
1143
- });
1144
- this.props.actions.createCentralCommsMetaId(payload, handleMetaIDResult);
1145
- } else {
1146
- this.props.onSubmit(this.state.formData);
1147
- }
1148
- };
1149
-
1083
+ });}
1084
+ }
1150
1085
  saveForm(saveForm) {
1151
1086
  if (this.props.isNewVersionFlow && !saveForm) {
1152
1087
  this.props.getValidationData();
@@ -1221,7 +1156,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
1221
1156
  };
1222
1157
  this.props.actions.getLiquidTags(preprocessHtml(content), handleResult);
1223
1158
  } else {
1224
- this.metaIDSaveWrapper();
1159
+ this.props.onSubmit(this.state.formData);
1225
1160
  }
1226
1161
  } else {
1227
1162
  this.setState({checkValidation: true});
@@ -3858,7 +3793,7 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
3858
3793
 
3859
3794
 
3860
3795
  return (
3861
- <CapSpin spinning={Boolean((this.liquidFlow && this.props.liquidExtractionInProgress) || this.props.metaIdStatus === 'REQUEST')} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
3796
+ <CapSpin spinning={Boolean(this.liquidFlow && this.props.liquidExtractionInProgress)} tip={this.props.intl.formatMessage(messages.liquidSpinText)} >
3862
3797
  <CapRow>
3863
3798
  {this.props.schema && this.renderForm()}
3864
3799
  <SlideBox
@@ -3892,9 +3827,6 @@ FormBuilder.defaultProps = {
3892
3827
  isNewVersionFlow: false,
3893
3828
  userLocale: localStorage.getItem('jlocale') || 'en',
3894
3829
  showLiquidErrorInFooter: () => {},
3895
- metaIdStatus: false,
3896
- isLoyaltyModule: false,
3897
- loyaltyMetaData: {},
3898
3830
  };
3899
3831
 
3900
3832
  FormBuilder.propTypes = {
@@ -3943,13 +3875,11 @@ FormBuilder.propTypes = {
3943
3875
  currentOrgDetails: PropTypes.object,
3944
3876
  liquidExtractionInProgress: PropTypes.bool,
3945
3877
  showLiquidErrorInFooter: PropTypes.func,
3946
- loyaltyMetaData: PropTypes.object
3947
3878
  };
3948
3879
 
3949
3880
  const mapStateToProps = createStructuredSelector({
3950
3881
  currentOrgDetails: selectCurrentOrgDetails(),
3951
3882
  liquidExtractionInProgress: selectLiquidStateDetails(),
3952
- metaIdStatus: selectMetaTagsStatus(),
3953
3883
  metaEntities: makeSelectMetaEntities(),
3954
3884
  });
3955
3885
 
@@ -85,12 +85,3 @@ 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,7 +63,3 @@ 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,12 +199,6 @@ 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);
208
202
  default:
209
203
  return state;
210
204
  }
@@ -186,24 +186,6 @@ 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
-
207
189
  function* getTopbarMenuData(params) {
208
190
  const {parentModule} = params;
209
191
  try {
@@ -243,10 +225,6 @@ export function* watchLiquidEntity() {
243
225
  yield takeLatest(types.GET_LIQUID_TAGS_REQUEST, getLiquidTags);
244
226
  }
245
227
 
246
- export function* watchMetaId() {
247
- yield takeLatest(types.CREATE_CENTRAL_COMMS_META_ID_REQUEST, createCentralCommsMetaId);
248
- }
249
-
250
228
  function* watchForOrgChange() {
251
229
  yield takeLatest(types.SWITCH_ORG_REQUEST, switchOrg);
252
230
  }
@@ -279,7 +257,6 @@ export default [
279
257
  watchGetTopbarMenuData,
280
258
  watchForGetVideosConfig,
281
259
  watchLiquidEntity,
282
- watchMetaId,
283
260
  ];
284
261
 
285
262
 
@@ -291,7 +268,6 @@ export function* capSagaForFetchSchemaForEntity() {
291
268
  export function* capSagaLiquidEntity() {
292
269
  yield all([
293
270
  watchLiquidEntity(),
294
- watchMetaId(),
295
271
  ]);
296
272
  };
297
273
 
@@ -303,6 +279,5 @@ export function* v2CapSagas() {
303
279
  watchForFetchUserInfo(),
304
280
  watchGetTopbarMenuData(),
305
281
  watchForGetVideosConfig(),
306
- watchMetaId(),
307
282
  ]);
308
283
  }
@@ -72,11 +72,6 @@ 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
-
80
75
  const makeSelectFetchingSchema = () => createSelector(
81
76
  selectCapDomain,
82
77
  (globalState) => globalState.get('fetchingSchema')
@@ -118,5 +113,4 @@ export {
118
113
  makeSelectFetchingSchemaError,
119
114
  makeSelectDemoVideoAndLink,
120
115
  selectLiquidStateDetails,
121
- selectMetaTagsStatus,
122
116
  };
@@ -158,7 +158,6 @@ export function SlideBoxContent(props) {
158
158
  hostName = '',
159
159
  eventContextTags,
160
160
  isLoyaltyModule,
161
- loyaltyMetaData = {},
162
161
  } = props;
163
162
  const type = (messageDetails.type || '').toLowerCase(); // type is context in get tags values : outbound | dvs | referral | loyalty | coupons
164
163
  const query = { type: !isFullMode && 'embedded', module: isFullMode ? 'default' : 'library', isEditFromCampaigns: (templateData || {}).isEditFromCampaigns};
@@ -515,8 +514,6 @@ export function SlideBoxContent(props) {
515
514
  onCreateComplete={onCreateComplete}
516
515
  smsRegister={smsRegister}
517
516
  eventContextTags={eventContextTags}
518
- loyaltyMetaData={loyaltyMetaData}
519
- messageDetails={messageDetails}
520
517
  />
521
518
  )}
522
519
  {isEditFTP && (
@@ -618,8 +615,6 @@ export function SlideBoxContent(props) {
618
615
  showLiquidErrorInFooter={showLiquidErrorInFooter}
619
616
  eventContextTags={eventContextTags}
620
617
  isLoyaltyModule={isLoyaltyModule}
621
- loyaltyMetaData={loyaltyMetaData}
622
- messageDetails={messageDetails}
623
618
  />
624
619
  )}
625
620
  {(isEditEmailWithId || isEmailEditWithContent) && (
@@ -650,8 +645,6 @@ export function SlideBoxContent(props) {
650
645
  showLiquidErrorInFooter={showLiquidErrorInFooter}
651
646
  eventContextTags={eventContextTags}
652
647
  isLoyaltyModule={isLoyaltyModule}
653
- loyaltyMetaData={loyaltyMetaData}
654
- messageDetails={messageDetails}
655
648
  />
656
649
  )}
657
650
  {isEditMPush &&
@@ -678,8 +671,6 @@ export function SlideBoxContent(props) {
678
671
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
679
672
  creativesMode={creativesMode}
680
673
  eventContextTags={eventContextTags}
681
- loyaltyMetaData={loyaltyMetaData}
682
- messageDetails={messageDetails}
683
674
  />
684
675
  }
685
676
  {isCreateMPush &&
@@ -709,8 +700,6 @@ export function SlideBoxContent(props) {
709
700
  hideTestAndPreviewBtn={hideTestAndPreviewBtn}
710
701
  onTestContentClicked={onTestContentClicked}
711
702
  eventContextTags={eventContextTags}
712
- loyaltyMetaData={loyaltyMetaData}
713
- messageDetails={messageDetails}
714
703
  />
715
704
  }
716
705
  {
@@ -75,7 +75,6 @@ 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
79
78
  super(props);
80
79
  this.state = {
81
80
  isLoadingContent: true,
@@ -89,7 +88,6 @@ export class Creatives extends React.Component {
89
88
  weChatMaptemplateStep: 0,
90
89
  isLiquidValidationError: false,
91
90
  errorMessages: [],
92
- metaId: null,
93
91
  };
94
92
  this.creativesTemplateSteps = {
95
93
  1: 'modeSelection',
@@ -1274,7 +1272,6 @@ export class Creatives extends React.Component {
1274
1272
  enableNewChannels,
1275
1273
  eventContextTags,
1276
1274
  isLoyaltyModule,
1277
- loyaltyMetaData = {},
1278
1275
  } = this.props;
1279
1276
  const mapTemplateCreate =
1280
1277
  slidBoxContent === "createTemplate" &&
@@ -1380,7 +1377,6 @@ export class Creatives extends React.Component {
1380
1377
  hostName={this.props?.hostName || ''}
1381
1378
  eventContextTags={eventContextTags}
1382
1379
  isLoyaltyModule={isLoyaltyModule}
1383
- loyaltyMetaData={loyaltyMetaData}
1384
1380
  />
1385
1381
  )}
1386
1382
  footer={this.shouldShowFooter() && (
@@ -2747,8 +2747,6 @@ 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}
2752
2750
  /> : ''}
2753
2751
  </Col>
2754
2752
  </Row>
@@ -229,8 +229,6 @@ 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 = {},
234
232
  } = this.props;
235
233
  const {
236
234
  templateName,
@@ -305,8 +303,6 @@ export class EmailWrapper extends React.Component { // eslint-disable-line react
305
303
  moduleType={moduleType}
306
304
  eventContextTags={eventContextTags}
307
305
  isLoyaltyModule={isLoyaltyModule}
308
- loyaltyMetaData={loyaltyMetaData}
309
- messageDetails={messageDetails}
310
306
  />}
311
307
  {!isShowEmailCreate && (
312
308
  <CmsTemplatesComponent
@@ -1991,8 +1991,6 @@ 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}
1996
1994
  />}
1997
1995
  </CapColumn>
1998
1996
  {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 = [], loyaltyMetaData = {}, messageDetails = {}} = this.props;
75
+ const {mobilePushCreateMode, step, getFormData, setIsLoadingContent, isGetFormData, query, isFullMode, showTemplateName, type, onValidationFail, onPreviewContentClicked, onTestContentClicked, templateData, eventContextTags = []} = this.props;
76
76
  const {templateName} = this.state;
77
77
  const isShowMobilepushCreate = !isEmpty(mobilePushCreateMode);
78
78
  return (
@@ -120,8 +120,6 @@ 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}
125
123
  />
126
124
 
127
125
 
@@ -994,8 +994,6 @@ 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}
999
997
  />
1000
998
  </CapColumn>
1001
999
  </CapRow>
@@ -992,8 +992,6 @@ 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}
997
995
  />
998
996
  </CapColumn>
999
997
  </CapRow>
@@ -30,8 +30,6 @@ const SmsWrapper = (props) => {
30
30
  smsRegister,
31
31
  onShowTemplates,
32
32
  eventContextTags,
33
- loyaltyMetaData = {},
34
- messageDetails = {},
35
33
  } = props;
36
34
 
37
35
  const smsProps = {
@@ -48,8 +46,6 @@ const SmsWrapper = (props) => {
48
46
  onPreviewContentClicked,
49
47
  onTestContentClicked,
50
48
  eventContextTags,
51
- loyaltyMetaData,
52
- messageDetails,
53
49
  };
54
50
  const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
55
51
  return <>
@@ -1,152 +0,0 @@
1
- import {
2
- SMS,
3
- MOBILE_PUSH,
4
- EMAIL
5
- } from "../../v2Containers/CreativesContainer/constants";
6
-
7
- /**
8
- * Transform form data to API payload format
9
- * @param {object} formData - The form data from the UI
10
- * @param {string} channel - The communication channel (EMAIL, SMS, WECHAT, MOBILE_PUSH)
11
- * @param {object} params - Additional parameters like sourceEntityId, ouId, etc.
12
- * @returns {object} - The formatted API payload
13
- */
14
- export const transformFormDataToAPIPayload = (
15
- formData,
16
- loyaltyMetaData = {}
17
- ) => {
18
- console.log("**** # transformDataToAPIPyaload: ", {
19
- formData,
20
- loyaltyMetaData
21
- });
22
- const {
23
- actionId,
24
- actionName,
25
- ouId,
26
- clientName,
27
- module,
28
- metaId,
29
- setMetaId = () => {},
30
- channel,
31
- transformedMessageDetails
32
- } = loyaltyMetaData;
33
-
34
- const { emailDeliverySettings } = transformedMessageDetails;
35
- const upperCaseChannel = channel.toUpperCase();
36
-
37
- // Base response structure
38
- const response = {
39
- ouId: ouId || -1,
40
- sourceEntityId: actionId,
41
- channel: upperCaseChannel || this.props.schema.channel.toUpperCase(),
42
- module,
43
- executionParams: {},
44
- clientName: clientName || "EMF"
45
- };
46
-
47
- switch (upperCaseChannel) {
48
- case EMAIL: {
49
- const subject = formData["template-subject"] || "";
50
- const htmlContent = formData?.base?.en?.["template-content"] || "";
51
-
52
- return {
53
- ...response,
54
- emailDeliverySettings: emailDeliverySettings || {},
55
- emailMessageContent: {
56
- channel: EMAIL,
57
- messageBody: htmlContent,
58
- messageSubject: subject
59
- }
60
- };
61
- }
62
-
63
- case SMS: {
64
- // Extract SMS content from formData
65
- const smsContent = formData["sms-editor"] || "";
66
- const templateId = formData.template_id || "";
67
- const templateName = formData.template_name || "";
68
- const header = formData.header || "";
69
- const varMapped = formData["var-mapped"] || {};
70
-
71
- return {
72
- ...response,
73
- smsDeliverySettings: {
74
- additionalSettings: {
75
- skipRateLimit: false
76
- },
77
- channelSettings: {
78
- channel: SMS,
79
- senderId: header || ""
80
- }
81
- },
82
- smsMessageContent: {
83
- channel: SMS,
84
- messageBody: smsContent,
85
- templateId,
86
- templateName,
87
- varMapped
88
- }
89
- };
90
- }
91
-
92
- case MOBILE_PUSH: {
93
- // Extract Mobile Push content
94
- const androidContent = formData.ANDROID || {};
95
- const iosContent = formData.IOS || {};
96
-
97
- return {
98
- ...response,
99
- mobilePushDeliverySettings: {
100
- additionalSettings: {
101
- skipRateLimit: false
102
- },
103
- channelSettings: {
104
- channel: MOBILE_PUSH
105
- }
106
- },
107
- mobilePushMessageContent: {
108
- channel: MOBILE_PUSH,
109
- androidContent: {
110
- title: androidContent.title || "",
111
- body: androidContent.message || "",
112
- type: androidContent.type || "TEXT",
113
- custom: androidContent.custom || {}
114
- },
115
- iosContent: {
116
- title: iosContent.title || "",
117
- body: iosContent.message || "",
118
- type: iosContent.type || "TEXT",
119
- custom: iosContent.custom || {}
120
- }
121
- }
122
- };
123
- }
124
-
125
- // case WECHAT: {
126
- // // Extract WeChat content
127
- // const wechatContent = formData.content || {};
128
-
129
- // return {
130
- // ...response,
131
- // wechatDeliverySettings: {
132
- // additionalSettings: {
133
- // skipRateLimit: false
134
- // },
135
- // channelSettings: {
136
- // channel: WECHAT
137
- // }
138
- // },
139
- // wechatMessageContent: {
140
- // channel: WECHAT,
141
- // messageBody: wechatContent.body || "",
142
- // templateId: wechatContent.templateId || "",
143
- // templateName: wechatContent.templateName || "",
144
- // varMapped: wechatContent.varMapped || {}
145
- // }
146
- // };
147
- // }
148
-
149
- default:
150
- return response;
151
- }
152
- };