@capillarytech/creatives-library 7.17.94 → 7.17.96

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.
@@ -956,7 +956,6 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
956
956
  }
957
957
  temp.injectedEvents = {};
958
958
  _.forEach(col.supportedEvents, (event) => {
959
- console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
960
959
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
961
960
  });
962
961
 
@@ -1779,7 +1779,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1779
1779
  temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
1780
1780
  }
1781
1781
  _.forEach(col.supportedEvents, (event) => {
1782
- console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
1783
1782
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
1784
1783
  });
1785
1784
  return true;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "7.17.94",
4
+ "version": "7.17.96",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -8,6 +8,7 @@ import CapHeader from "@capillarytech/cap-ui-library/CapHeader";
8
8
  import CapInput from "@capillarytech/cap-ui-library/CapInput";
9
9
  import CapRadioGroup from "@capillarytech/cap-ui-library/CapRadioGroup";
10
10
  import CapRow from "@capillarytech/cap-ui-library/CapRow";
11
+ import CapColumn from "@capillarytech/cap-ui-library/CapColumn";
11
12
  import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
12
13
  import CapLink from "@capillarytech/cap-ui-library/CapLink";
13
14
  import CapError from "@capillarytech/cap-ui-library/CapError";
@@ -150,7 +151,7 @@ const CapDeviceContent = (props) => {
150
151
 
151
152
  return (
152
153
  <>
153
- <div className="creatives-device-content">
154
+ <CapRow className="creatives-device-content">
154
155
  <CapLink
155
156
  title={isAndroid
156
157
  ? formatMessage(messages.copyContentFromIOS)
@@ -158,15 +159,15 @@ const CapDeviceContent = (props) => {
158
159
  className="inapp-copy-content"
159
160
  onClick={onCopyTitleAndContent}
160
161
  />
161
- <div className="creatives-inapp-title">
162
- <div
162
+ <CapRow className="creatives-inapp-title">
163
+ <CapColumn
163
164
  className="inapp-content-main"
164
165
  >
165
166
  <CapHeading type="h5" className="inapp-title">
166
167
  {formatMessage(messages.title)}
167
168
  </CapHeading>
168
169
  {getTagList(0)} {/* here 0 signifies the tags for template title */}
169
- </div>
170
+ </CapColumn>
170
171
  <CapInput
171
172
  id="inapp-title-name-input"
172
173
  onChange={onTitleChange}
@@ -175,9 +176,9 @@ const CapDeviceContent = (props) => {
175
176
  size="default"
176
177
  isRequired
177
178
  />
178
- </div>
179
- <div className="creatives-inapp-media">
180
- <div className="inapp-content-media">
179
+ </CapRow>
180
+ <CapRow className="creatives-inapp-media">
181
+ <CapRow className="inapp-content-media">
181
182
  <CapHeading type="h5" className="inapp-media-header">
182
183
  {formatMessage(messages.mediaLabel)}
183
184
  </CapHeading>
@@ -188,17 +189,17 @@ const CapDeviceContent = (props) => {
188
189
  onChange={onTemplateMediaTypeChange}
189
190
  className="inapp-media-radio"
190
191
  />
191
- </div>
192
- </div>
193
- <div className={`creatives-inapp-message ${!isMediaTypeImage && "message-bottom-margin"}`}>
194
- <div
192
+ </CapRow>
193
+ </CapRow>
194
+ <CapRow className={`creatives-inapp-message ${!isMediaTypeImage && "message-bottom-margin"}`}>
195
+ <CapColumn
195
196
  className="inapp-message-header"
196
197
  >
197
198
  <CapHeading type="h5" className="inapp-message-header-style">
198
199
  {formatMessage(messages.message)}
199
200
  </CapHeading>
200
201
  {getTagList(1)} {/* here 1 signifies the tags for template message */}
201
- </div>
202
+ </CapColumn>
202
203
  <TextArea
203
204
  id="inapp-create-template-message-input"
204
205
  className="inapp-create-template-message-input"
@@ -234,11 +235,11 @@ const CapDeviceContent = (props) => {
234
235
  />
235
236
  </>
236
237
  )}
237
- </div>
238
- </div>
239
- <div className="inapp-action-link">
238
+ </CapRow>
239
+ </CapRow>
240
+ <CapRow className="inapp-action-link">
240
241
  <CapCheckbox onChange={() => setAddActionLink(!addActionLink)} checked={addActionLink} />
241
- <div className="inapp-render-heading">
242
+ <CapRow className="inapp-render-heading">
242
243
  <CapHeader
243
244
  title={<CapRow type="flex">
244
245
  <CapHeading type="h4">
@@ -248,7 +249,7 @@ const CapDeviceContent = (props) => {
248
249
  description={<CapLabel type="label3">{formatMessage(messages.addActionLinkDesc)}</CapLabel>}
249
250
  />
250
251
  {addActionLink && (
251
- <div className="inapp-action-deep-link">
252
+ <CapRow className="inapp-action-deep-link">
252
253
  <CapHeading type="h4">
253
254
  {formatMessage(messages.actionDeepLink)}
254
255
  </CapHeading>
@@ -259,11 +260,11 @@ const CapDeviceContent = (props) => {
259
260
  value={deepLinkValue}
260
261
  onChange={(value) => { setDeepLinkValue(value); }}
261
262
  />
262
- </div>
263
+ </CapRow>
263
264
  )}
264
- </div>
265
- </div>
266
- <div className="inapp-cta-button">
265
+ </CapRow>
266
+ </CapRow>
267
+ <CapRow className="inapp-cta-button">
267
268
  <CapHeader
268
269
  className="inapp-render-heading-cta-button"
269
270
  title={<CapRow type="flex">
@@ -294,7 +295,7 @@ const CapDeviceContent = (props) => {
294
295
  deepLink={deepLink || []}
295
296
  />
296
297
  )}
297
- </div>
298
+ </CapRow>
298
299
  </>
299
300
  );
300
301
  };
@@ -48,7 +48,7 @@
48
48
  }
49
49
  .cap-custom-image-upload {
50
50
  .dragger-button.re-upload {
51
- top: 28rem;
51
+ top: 12rem;
52
52
  position: absolute;
53
53
  right: $CAP_SPACE_20;
54
54
  color: $FONT_COLOR_05;
@@ -33,37 +33,47 @@ describe('Test CapDeviceContent', () => {
33
33
  fireEvent.click(copyLink);
34
34
  expect(copyLink).toBeInTheDocument();
35
35
  });
36
- it('test case for CapDeviceContent component Ios pane', () => {
37
- renderComponent(
38
- {...deviceContentProps,
39
- panes: "iOS",
40
- buttonType: 'CTA',
41
- setTemplateMediaType: jest.fn(),
42
- setButtonType: jest.fn(),
43
- setCtaData: jest.fn(),
44
- setTemplateMessage: jest.fn(),
45
- setTemplateMessageError: jest.fn(),
46
- setTitle: jest.fn(),
47
- templateMediType: 'IMAGE',
48
- addActionLink: true,
49
- ctaData: [
50
- {
51
- index: 0,
52
- ctaType: "WEBSITE",
53
- text: "test",
54
- urlType: "DEEP_LINK",
55
- url: "",
56
- isSaved: true,
57
- label: "Test_1",
58
- },
59
- ] });
60
- const msgBox = screen.getAllByPlaceholderText(/Please input in-app notification message content/i);
36
+ it("test case for CapDeviceContent component Ios pane", () => {
37
+ renderComponent({
38
+ ...deviceContentProps,
39
+ panes: "iOS",
40
+ buttonType: "CTA",
41
+ setTemplateMediaType: jest.fn(),
42
+ setButtonType: jest.fn(),
43
+ setCtaData: jest.fn(),
44
+ setTemplateMessage: jest.fn(),
45
+ setTemplateMessageError: jest.fn(),
46
+ setTitle: jest.fn(),
47
+ templateMediType: "IMAGE",
48
+ addActionLink: true,
49
+ ctaData: [
50
+ {
51
+ index: 0,
52
+ ctaType: "WEBSITE",
53
+ text: "test",
54
+ urlType: "DEEP_LINK",
55
+ url: "link",
56
+ isSaved: true,
57
+ },
58
+ ],
59
+ deepLink: [
60
+ {
61
+ label: "Test_1",
62
+ value: "link",
63
+ },
64
+ ],
65
+ });
66
+ const msgBox = screen.getAllByPlaceholderText(
67
+ /Please input in-app notification message content/i
68
+ );
61
69
  msgBox[0].focus();
62
- fireEvent.change(msgBox[0], { target: {value: 'val'}});
63
- fireEvent.change(msgBox[0], { target: {value: ''}});
64
- const titleBox = screen.getAllByPlaceholderText(/Please input message title name/i);
70
+ fireEvent.change(msgBox[0], { target: { value: "val" } });
71
+ fireEvent.change(msgBox[0], { target: { value: "" } });
72
+ const titleBox = screen.getAllByPlaceholderText(
73
+ /Please input message title name/i
74
+ );
65
75
  titleBox[0].focus();
66
- fireEvent.change(titleBox[0], { target: {value: 'val'}});
76
+ fireEvent.change(titleBox[0], { target: { value: "val" } });
67
77
  const img = screen.getByText(/image/i);
68
78
  fireEvent.click(img);
69
79
  const none = screen.getByText(/None/i);
@@ -43,7 +43,8 @@ export const CapInAppCTA = (props) => {
43
43
 
44
44
  const [urlError, setUrlError] = useState(false);
45
45
  const [buttonError, setButtonError] = useState(false);
46
- const [ctaDeepLinkValue, setCtaDeepLinkValue] = useState("");
46
+ const [ctaDeepLinkValue, setCtaDeepLinkValue] = useState(ctaData[0]?.url || "");
47
+ const selectedDeepLink = deepLink?.find(link => link?.value === ctaData[0]?.url);
47
48
 
48
49
  const updateHelper = (type, value, index) => {
49
50
  let clonedCta = cloneDeep(ctaData[index]);
@@ -94,12 +95,11 @@ export const CapInAppCTA = (props) => {
94
95
  const onDeepLinkSelect = (value) => {
95
96
  setCtaDeepLinkValue(value);
96
97
  let errorMessage = false;
97
- if (!isUrl(value.key)) {
98
+ if (!isUrl(value)) {
98
99
  errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
99
100
  }
100
101
  setUrlError(errorMessage);
101
- updateHelper('url', value.key, 0); // 0 is an index
102
- updateHelper('label', value.label, 0); // 0 is an index
102
+ updateHelper('url', value, 0); // 0 is an index
103
103
  };
104
104
 
105
105
  const ctaSaveDisabled = (index) => {
@@ -120,7 +120,7 @@ export const CapInAppCTA = (props) => {
120
120
  const renderedContent = () => {
121
121
  const renderArray = [];
122
122
  ctaData?.forEach((cta) => {
123
- const { index, text, url, urlType, isSaved, label } = cta || {};
123
+ const { index, text, url, urlType, isSaved } = cta || {};
124
124
  //this is to display buttons after they are saved, in both create and edit mode.
125
125
  if (isSaved) {
126
126
  renderArray.push(
@@ -145,7 +145,7 @@ export const CapInAppCTA = (props) => {
145
145
  : <CapTag className="cta-type-label">{formatMessage(messages.urlExternalLink)}</CapTag>}
146
146
  </CapColumn>
147
147
  <CapColumn>
148
- {urlType === DEEP_LINK ? label : ''}
148
+ {urlType === DEEP_LINK ? selectedDeepLink?.label : ''}
149
149
  </CapColumn>
150
150
  {(
151
151
  <CapRow className="cta-action-grp">
@@ -219,7 +219,6 @@ export const CapInAppCTA = (props) => {
219
219
  options={deepLink || []}
220
220
  onChange={onDeepLinkSelect}
221
221
  value={ctaDeepLinkValue}
222
- labelInValue
223
222
  />
224
223
  </>
225
224
 
@@ -214,9 +214,10 @@ class FormBuilder extends React.Component { // eslint-disable-line react/prefer-
214
214
  this.setState({usingTabContainer: true});
215
215
  }
216
216
  }
217
- // if (nextProps.currentTab) {
218
- // this.setState({currentTab: nextProps.currentTab});
219
- // }
217
+ //In Context of MPUSH currentTab represents whether its Android or IOS tab , 1 for Android and 2 for IOS
218
+ if (nextProps.currentTab && _.get(this.props, 'schema.channel') === MOBILE_PUSH) {
219
+ this.setState({currentTab: nextProps.currentTab});
220
+ }
220
221
  } else if (!_.isEmpty(nextProps.formData) &&
221
222
  ( !this.state.usingTabContainer || (this.state.usingTabContainer && nextProps.tabKey !== ''))
222
223
  && !_.isEqual(nextProps.formData, this.state.formData) &&
@@ -589,59 +589,16 @@ export class Creatives extends React.Component {
589
589
  }
590
590
  break;
591
591
  case constants.MOBILE_PUSH:
592
- if (get(template, "value.versions.base")) {
593
- const mobilpushTemplate = template.value;
594
- templateData.accountId = get(mobilpushTemplate, 'definition.accountId');
595
- const type = (get(this.props, "messageDetails.type") || '').toLowerCase();
596
- if (type === LOYALTY) {
597
- templateData.licenseCode = get(mobilpushTemplate, 'definition.licenseCode');
598
- templateData.templateId = get(mobilpushTemplate, '_id');
599
- }
600
- const androidContent = get(mobilpushTemplate, 'versions.base.ANDROID');
601
- if (!isEmpty(androidContent)) {
602
- if (type !== LOYALTY) {
603
- delete androidContent.cuid;
604
- delete androidContent.luid;
605
- delete androidContent.communicationId;
606
- }
607
- const custom = {};
608
- forEach(androidContent.custom, (customKeyValue) => {
609
- custom[customKeyValue.key] = customKeyValue.value;
610
- } );
611
- androidContent.custom = custom;
612
- templateData.androidContent = androidContent;
613
- templateData.androidContent.type = get(mobilpushTemplate, 'definition.mode', '').toUpperCase();
614
- templateData.androidContent.deviceType = 'ANDROID';
615
- }
616
- const iosContent = get(mobilpushTemplate, 'versions.base.IOS');
617
- if (!isEmpty(iosContent)) {
618
- if (type !== LOYALTY) {
619
- delete iosContent.cuid;
620
- delete iosContent.luid;
621
- delete iosContent.communicationId;
622
- }
623
- const custom = {};
624
- forEach(iosContent.custom, (customKeyValue) => {
625
- custom[customKeyValue.key] = customKeyValue.value;
626
- } );
627
- iosContent.custom = custom;
628
- templateData.iosContent = iosContent;
629
- templateData.iosContent.type = get(mobilpushTemplate, 'definition.mode').toUpperCase();
630
- templateData.iosContent.deviceType = 'IOS';
631
- }
632
- templateData.messageSubject = mobilpushTemplate.name ? mobilpushTemplate.name : "messageSubject";
633
- }
634
- break;
635
592
  case constants.INAPP:
636
- if (get(template, "value.versions.base.content")) {
637
- const inAppTemplate = template.value;
638
- templateData.accountId = get(inAppTemplate, 'definition.accountId');
593
+ if (get(template, "value.versions.base")) {
594
+ const channelTemplate = template.value;
595
+ templateData.accountId = get(channelTemplate, 'definition.accountId');
639
596
  const type = (get(this.props, "messageDetails.type") || '').toLowerCase();
640
597
  if (type === LOYALTY) {
641
- templateData.licenseCode = get(inAppTemplate, 'definition.licenseCode');
642
- templateData.templateId = get(inAppTemplate, '_id');
598
+ templateData.licenseCode = get(channelTemplate, 'definition.licenseCode');
599
+ templateData.templateId = get(channelTemplate, '_id');
643
600
  }
644
- const androidContent = get(inAppTemplate, 'versions.base.content.ANDROID');
601
+ const androidContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.ANDROID') : get(channelTemplate, 'versions.base.ANDROID');
645
602
  if (!isEmpty(androidContent)) {
646
603
  if (type !== LOYALTY) {
647
604
  delete androidContent.cuid;
@@ -654,10 +611,10 @@ export class Creatives extends React.Component {
654
611
  });
655
612
  androidContent.custom = custom;
656
613
  templateData.androidContent = androidContent;
657
- templateData.androidContent.type = get(inAppTemplate, 'definition.mode', '').toUpperCase();
614
+ templateData.androidContent.type = get(channelTemplate, 'definition.mode', '').toUpperCase();
658
615
  templateData.androidContent.deviceType = 'ANDROID';
659
616
  }
660
- const iosContent = get(inAppTemplate, 'versions.base.content.IOS');
617
+ const iosContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.IOS') : get(channelTemplate, 'versions.base.IOS');
661
618
  if (!isEmpty(iosContent)) {
662
619
  if (type !== LOYALTY) {
663
620
  delete iosContent.cuid;
@@ -670,10 +627,10 @@ export class Creatives extends React.Component {
670
627
  });
671
628
  iosContent.custom = custom;
672
629
  templateData.iosContent = iosContent;
673
- templateData.iosContent.type = get(inAppTemplate, 'definition.mode').toUpperCase();
630
+ templateData.iosContent.type = get(channelTemplate, 'definition.mode').toUpperCase();
674
631
  templateData.iosContent.deviceType = IOS.toUpperCase();
675
632
  }
676
- templateData.messageSubject = inAppTemplate?.name ? inAppTemplate?.name : "messageSubject";
633
+ templateData.messageSubject = channelTemplate?.name ? channelTemplate?.name : "messageSubject";
677
634
  }
678
635
  break;
679
636
  case constants.WECHAT:
@@ -960,6 +917,7 @@ export class Creatives extends React.Component {
960
917
  };
961
918
  break;
962
919
  case constants.MOBILE_PUSH:
920
+ case constants.INAPP:
963
921
  gtmDetails = {
964
922
  ...gtmDetails,
965
923
 
@@ -967,13 +925,6 @@ export class Creatives extends React.Component {
967
925
  imageAdded: androidType === 'IMAGE' || iosType === 'IMAGE',
968
926
  };
969
927
  break;
970
- case constants.INAPP:
971
- gtmDetails = {
972
- ...gtmDetails,
973
- content: `${androidTitle} ${androidMessage} ${iosTitle} ${iosMessage}`,
974
- imageAdded: androidType === IMAGE || iosType === IMAGE,
975
- };
976
- break;
977
928
  case constants.LINE:
978
929
  gtmDetails = Object.assign({
979
930
  ...gtmDetails,
@@ -48,7 +48,6 @@ export const INITIAL_CTA_DATA = [
48
48
  urlType: DEEP_LINK,
49
49
  url: "",
50
50
  isSaved: false,
51
- label: "",
52
51
  },
53
52
  ];
54
53
 
@@ -118,7 +117,7 @@ export const BUTTON_RADIO_OPTIONS = [
118
117
  <CapHeading type="h4">
119
118
  <FormattedMessage {...messages.btnTypeCTA} />
120
119
  </CapHeading>
121
- <CapLabel><FormattedMessage {...messages.ctaDesc} /></CapLabel>
120
+ <CapLabel><FormattedMessage {...messages.ctaDescription} /></CapLabel>
122
121
  </div>
123
122
  </>
124
123
  ),
@@ -67,10 +67,7 @@ export const InApp = (props) => {
67
67
  const { formatMessage } = intl;
68
68
  const [titleAndroid, setTitleAndroid] = useState("");
69
69
  const [titleIos, setTitleIos] = useState("");
70
- const [templateMediaTypeAndroid, setTemplateMediaTypeAndroid] = useState(
71
- INAPP_MEDIA_TYPES.TEXT
72
- );
73
- const [templateMediaTypeIos, setTemplateMediaTypeIos] = useState(
70
+ const [templateMediaType, setTemplateMediaType] = useState(
74
71
  INAPP_MEDIA_TYPES.TEXT
75
72
  );
76
73
  const [templateName, setTemplateName] = useState("");
@@ -106,7 +103,8 @@ export const InApp = (props) => {
106
103
  INAPP_BUTTON_TYPES.NONE
107
104
  );
108
105
  const [buttonTypeIos, setButtonTypeIos] = useState(INAPP_BUTTON_TYPES.NONE);
109
- const isBtnTypeCta = buttonTypeAndroid === INAPP_BUTTON_TYPES.CTA;
106
+ const isBtnTypeCtaAndroid = buttonTypeAndroid === INAPP_BUTTON_TYPES.CTA;
107
+ const isBtnTypeCTaIos = buttonTypeIos === INAPP_BUTTON_TYPES.CTA;
110
108
 
111
109
  //gets account details
112
110
  useEffect(() => {
@@ -165,28 +163,27 @@ export const InApp = (props) => {
165
163
  } = androidContent;
166
164
  setTitleAndroid(androidTitle);
167
165
  setTemplateMessageAndroid(androidMessage);
168
- setTemplateMediaTypeAndroid(
166
+ setTemplateMediaType(
169
167
  androidExpandableDetails?.style === BIG_TEXT
170
168
  ? INAPP_MEDIA_TYPES.TEXT
171
169
  : INAPP_MEDIA_TYPES.IMAGE
172
170
  );
173
171
  setInAppImageSrcAndroid(androidExpandableDetails?.image);
174
- setDeepLinkValueAndroid(androidCta.actionLink);
172
+ setDeepLinkValueAndroid(androidCta?.actionLink);
175
173
  setAddActionLinkAndroid(!isEmpty(androidCta) && true);
176
174
  setButtonTypeAndroid(
177
- androidExpandableDetails?.buttonType || INAPP_BUTTON_TYPES.NONE
175
+ androidExpandableDetails?.ctas?.length ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE
178
176
  );
179
- if (androidExpandableDetails?.buttonType === INAPP_BUTTON_TYPES.CTA && androidExpandableDetails?.buttons.length > 0) {
177
+ if (androidExpandableDetails?.ctas?.length > 0) {
180
178
  setCtaDataAndroid(
181
- androidExpandableDetails?.buttons?.map((cta) => {
182
- const { index, type, text, url = "", label } = cta;
179
+ androidExpandableDetails?.ctas?.map((cta, index) => {
180
+ const { type, actionText, actionLink = "" } = cta;
183
181
  const obj = {
184
182
  index,
185
- text,
186
- url,
183
+ text: actionText,
184
+ url: actionLink,
187
185
  urlType: type,
188
186
  isSaved: true,
189
- label,
190
187
  };
191
188
  return obj;
192
189
  })
@@ -201,22 +198,21 @@ export const InApp = (props) => {
201
198
  } = iosContent;
202
199
  setTitleIos(iosTitle);
203
200
  setTemplateMessageIos(iosMessage);
204
- setTemplateMediaTypeIos(iosExpandableDetails?.style === BIG_TEXT ? INAPP_MEDIA_TYPES.TEXT : INAPP_MEDIA_TYPES.IMAGE);
201
+ setTemplateMediaType(iosExpandableDetails?.style === BIG_TEXT ? INAPP_MEDIA_TYPES.TEXT : INAPP_MEDIA_TYPES.IMAGE);
205
202
  setInAppImageSrcIos(iosExpandableDetails?.image);
206
- setButtonTypeIos(iosExpandableDetails?.buttonType || INAPP_BUTTON_TYPES.NONE);
203
+ setButtonTypeIos(iosExpandableDetails?.ctas?.length ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE);
207
204
  setAddActionLinkIos(!isEmpty(iosCta) && true);
208
205
  setDeepLinkValueIos(iosCta?.actionLink);
209
- if (iosExpandableDetails?.buttonType === INAPP_BUTTON_TYPES.CTA && iosExpandableDetails?.buttons.length > 0) {
206
+ if (iosExpandableDetails?.ctas?.length > 0) {
210
207
  setCtaDataIos(
211
- iosExpandableDetails?.buttons?.map((cta) => {
212
- const { index, type, text, url = "", label } = cta;
208
+ iosExpandableDetails?.ctas?.map((cta, index) => {
209
+ const { type, actionText, actionLink = "" } = cta;
213
210
  const obj = {
214
211
  index,
215
- text,
216
- url,
212
+ text: actionText,
213
+ url: actionLink,
217
214
  urlType: type,
218
215
  isSaved: true,
219
- label,
220
216
  };
221
217
  return obj;
222
218
  })
@@ -314,7 +310,6 @@ export const InApp = (props) => {
314
310
  }
315
311
  }
316
312
  };
317
-
318
313
  // tag Code end
319
314
 
320
315
  const onTemplateNameChange = ({ target: { value } }) => {
@@ -335,7 +330,6 @@ export const InApp = (props) => {
335
330
  }
336
331
  };
337
332
 
338
-
339
333
  const PANES = [
340
334
  {
341
335
  content: (
@@ -357,8 +351,8 @@ export const InApp = (props) => {
357
351
  setButtonType={setButtonTypeAndroid}
358
352
  accountId={accountId}
359
353
  accessToken={accessToken}
360
- templateMediaType={templateMediaTypeAndroid}
361
- setTemplateMediaType={setTemplateMediaTypeAndroid}
354
+ templateMediaType={templateMediaType}
355
+ setTemplateMediaType={setTemplateMediaType}
362
356
  title={titleAndroid}
363
357
  setTitle={setTitleAndroid}
364
358
  templateMessageError={templateMessageErrorAndroid}
@@ -400,8 +394,8 @@ export const InApp = (props) => {
400
394
  setButtonType={setButtonTypeIos}
401
395
  accountId={accountId}
402
396
  accessToken={accessToken}
403
- templateMediaType={templateMediaTypeIos}
404
- setTemplateMediaType={setTemplateMediaTypeIos}
397
+ templateMediaType={templateMediaType}
398
+ setTemplateMediaType={setTemplateMediaType}
405
399
  title={titleIos}
406
400
  setTitle={setTitleIos}
407
401
  templateMessageError={templateMessageErrorIos}
@@ -468,7 +462,7 @@ export const InApp = (props) => {
468
462
  let ctaData = {};
469
463
  if (panes === ANDROID) {
470
464
  ctaData = ctaDataAndroid;
471
- switch (templateMediaTypeAndroid) {
465
+ switch (templateMediaType) {
472
466
  case INAPP_MEDIA_TYPES.IMAGE:
473
467
  mediaPreview.inAppImageSrcAndroid = inAppImageSrcAndroid;
474
468
  break;
@@ -477,7 +471,7 @@ export const InApp = (props) => {
477
471
  }
478
472
  } else {
479
473
  ctaData = ctaDataIos;
480
- switch (templateMediaTypeIos) {
474
+ switch (templateMediaType) {
481
475
  case INAPP_MEDIA_TYPES.IMAGE:
482
476
  mediaPreview.inAppImageSrcIos = inAppImageSrcIos;
483
477
  break;
@@ -493,7 +487,7 @@ export const InApp = (props) => {
493
487
  mediaPreview,
494
488
  templateTitle,
495
489
  templateMsg,
496
- ...(isBtnTypeCta && {
490
+ ...((isBtnTypeCtaAndroid || isBtnTypeCTaIos) && {
497
491
  ctaData,
498
492
  }),
499
493
  },
@@ -519,20 +513,24 @@ export const InApp = (props) => {
519
513
  return true;
520
514
  }//for ios
521
515
  //if media type is image and the mediaType file is not uploaded
522
- if (panes === ANDROID && !(templateMediaTypeAndroid === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcAndroid === '') {
516
+ if (panes === ANDROID && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcAndroid === '') {
523
517
  return true;
524
518
  }
525
- if (panes === IOS && !(templateMediaTypeIos === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcIos === '') {
519
+ if (panes === IOS && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcIos === '') {
526
520
  return true;
527
521
  }
528
522
  //cta
529
- if (isBtnTypeCta) {
530
- if (panes === ANDROID && ctaDataAndroid[0]?.isSaved) {
523
+ if (isBtnTypeCtaAndroid) {
524
+ if (ctaDataAndroid[0]?.isSaved) {
531
525
  //if button type is cta and 1st button is saved
532
526
  return false;
533
527
  }
534
- if (panes === IOS && ctaDataIos[0]?.isSaved) {
535
- //if button type is cta and 1st button is saved
528
+ //if button type is cta and there are no buttons saved
529
+ return true;
530
+ }
531
+ if (isBtnTypeCTaIos) {
532
+ if (ctaDataIos[0]?.isSaved) {
533
+ //if button type is cta and 1st button is saved
536
534
  return false;
537
535
  }
538
536
  //if button type is cta and there are no buttons saved
@@ -543,37 +541,28 @@ export const InApp = (props) => {
543
541
 
544
542
  const getCtaPayload = (type) =>
545
543
  (type === ANDROID ? ctaDataAndroid : ctaDataIos).map((cta) => {
546
- const { index, text, urlType, url, label } = cta;
544
+ const { text, urlType, url } = cta;
547
545
  return {
548
- index,
549
546
  type: urlType,
550
- text,
551
- url,
552
- label,
547
+ actionText: text,
548
+ actionLink: url,
553
549
  };
554
550
  });
555
551
 
556
552
  const createPayload = () => {
557
553
  let androidMediaParams = {};
558
554
  let iosMediaParams = {};
559
- const buttonType = panes === ANDROID ? buttonTypeAndroid : buttonTypeIos;
560
555
  const commonDevicePayload = {
561
556
  luid: "{{luid}}",
562
557
  cuid: "{{cuid}}",
563
558
  communicationId: "{{communicationId}}",
564
559
  };
565
- switch (templateMediaTypeAndroid) {
560
+ switch (templateMediaType) {
566
561
  case INAPP_MEDIA_TYPES.IMAGE:
567
562
  androidMediaParams = {
568
563
  image: getCdnUrl({url: inAppImageSrcAndroid, channelName: INAPP }),
569
564
  style: BIG_PICTURE,
570
565
  };
571
- break;
572
- default:
573
- break;
574
- }
575
- switch (templateMediaTypeIos) {
576
- case INAPP_MEDIA_TYPES.IMAGE:
577
566
  iosMediaParams = {
578
567
  image: getCdnUrl({url: inAppImageSrcIos, channelName: INAPP }),
579
568
  style: BIG_PICTURE,
@@ -601,9 +590,8 @@ export const InApp = (props) => {
601
590
  style: BIG_TEXT,
602
591
  message: templateMessageAndroid,
603
592
  ...androidMediaParams,
604
- ...(isBtnTypeCta && {
605
- buttonType,
606
- buttons: getCtaPayload(ANDROID),
593
+ ...(isBtnTypeCtaAndroid && {
594
+ ctas: getCtaPayload(ANDROID),
607
595
  }),
608
596
  },
609
597
  custom: [],
@@ -618,9 +606,8 @@ export const InApp = (props) => {
618
606
  style: BIG_TEXT,
619
607
  message: templateMessageIos,
620
608
  ...iosMediaParams,
621
- ...(isBtnTypeCta && {
622
- buttonType,
623
- buttons: getCtaPayload(IOS),
609
+ ...(isBtnTypeCTaIos && {
610
+ ctas: getCtaPayload(IOS),
624
611
  }),
625
612
  },
626
613
  custom: [],
@@ -633,7 +620,7 @@ export const InApp = (props) => {
633
620
  definition: {
634
621
  accountId: id,
635
622
  licenseCode: sourceAccountIdentifier,
636
- mode: "CREATE",
623
+ mode: templateMediaType,
637
624
  },
638
625
  };
639
626
  return data;
@@ -686,7 +673,6 @@ export const InApp = (props) => {
686
673
  );
687
674
  };
688
675
 
689
-
690
676
  const onDoneCallback = () => {
691
677
  if (isFullMode) {
692
678
  if (isEditFlow) {
@@ -37,7 +37,7 @@
37
37
  .inapp-footer {
38
38
  background-color: $CAP_WHITE;
39
39
  bottom: 0;
40
- position: fixed;
40
+ // position: fixed;
41
41
  width: 100%;
42
42
  padding: $CAP_SPACE_20 0;
43
43
  z-index: 1;
@@ -91,8 +91,8 @@ export default defineMessages({
91
91
  id: `${prefix}.btnTypeCTA`,
92
92
  defaultMessage: "Call to action",
93
93
  },
94
- ctaDesc: {
95
- id: `${prefix}.ctaDesc`,
94
+ ctaDescription: {
95
+ id: `${prefix}.ctaDescription`,
96
96
  defaultMessage:
97
97
  "Create a button that lets customers take an action",
98
98
  },
@@ -768,10 +768,9 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
768
768
  formData[0].base = true;
769
769
  // formData[0].tabKey = '1';
770
770
  // formData[1].tabKey = '2';
771
-
772
771
  this.setState({templateCta}, () => {
773
772
  this.getSchemaForFormData(formData, schema);
774
- this.setState({tabCount, formData, editData: data, currentTab: 1}, () => {
773
+ this.setState({tabCount, formData, editData: data}, () => {
775
774
  this.props.showTemplateName({formData, onFormDataChange: this.onFormDataChange});
776
775
  });
777
776
  });
@@ -1469,7 +1468,6 @@ export class Edit extends React.Component { // eslint-disable-line react/prefer-
1469
1468
  temp.content.appName = this.props.Templates.selectedWeChatAccount.name;
1470
1469
  }
1471
1470
  _.forEach(col.supportedEvents, (event) => {
1472
- console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
1473
1471
  temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
1474
1472
  });
1475
1473
  return true;
@@ -11,6 +11,7 @@
11
11
  .creatives-templates-list.full-mode{
12
12
  .pagination-container {
13
13
  .cap-custom-card-list-row {
14
+ padding-bottom: 10rem;
14
15
  .cap-custom-card-list-col{
15
16
  &:nth-child(3n+3) { //every 4th child
16
17
  margin-right: unset;
@@ -25,6 +26,7 @@
25
26
  .creatives-templates-list.full-mode{
26
27
  .pagination-container {
27
28
  .cap-custom-card-list-row {
29
+ padding-bottom: 10rem;
28
30
  .cap-custom-card-list-col{
29
31
  &:nth-child(4n+4) { //every 4th child
30
32
  margin-right: unset;
@@ -56,6 +58,9 @@
56
58
  }
57
59
 
58
60
  .pagination-container {
61
+ .cap-custom-card-list-row {
62
+ padding-bottom: 10rem;
63
+ }
59
64
  .FACEBOOK {
60
65
  .ant-card-body {
61
66
  background-color: $CAP_G09;
@@ -523,6 +528,7 @@
523
528
  .message-container{
524
529
  border-bottom: solid 0.5px #D6D6D6;
525
530
  }
531
+
526
532
  .main-content{
527
533
  overflow: hidden;
528
534
  }