@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.
- package/containers/Ebill/index.js +0 -1
- package/containers/MobilePush/Edit/index.js +0 -1
- package/package.json +1 -1
- package/v2Components/CapDeviceContent/index.js +23 -22
- package/v2Components/CapDeviceContent/index.scss +1 -1
- package/v2Components/CapDeviceContent/tests/index.test.js +39 -29
- package/v2Components/CapInAppCTA/index.js +6 -7
- package/v2Components/FormBuilder/index.js +4 -3
- package/v2Containers/CreativesContainer/index.js +11 -60
- package/v2Containers/InApp/constants.js +1 -2
- package/v2Containers/InApp/index.js +44 -58
- package/v2Containers/InApp/index.scss +1 -1
- package/v2Containers/InApp/messages.js +2 -2
- package/v2Containers/MobilePush/Edit/index.js +1 -3
- package/v2Containers/Templates/_templates.scss +6 -0
|
@@ -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
|
@@ -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
|
-
<
|
|
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
|
-
<
|
|
162
|
-
<
|
|
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
|
-
</
|
|
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
|
-
</
|
|
179
|
-
<
|
|
180
|
-
<
|
|
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
|
-
</
|
|
192
|
-
</
|
|
193
|
-
<
|
|
194
|
-
<
|
|
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
|
-
</
|
|
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
|
-
</
|
|
238
|
-
</
|
|
239
|
-
<
|
|
238
|
+
</CapRow>
|
|
239
|
+
</CapRow>
|
|
240
|
+
<CapRow className="inapp-action-link">
|
|
240
241
|
<CapCheckbox onChange={() => setAddActionLink(!addActionLink)} checked={addActionLink} />
|
|
241
|
-
<
|
|
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
|
-
<
|
|
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
|
-
</
|
|
263
|
+
</CapRow>
|
|
263
264
|
)}
|
|
264
|
-
</
|
|
265
|
-
</
|
|
266
|
-
<
|
|
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
|
-
</
|
|
298
|
+
</CapRow>
|
|
298
299
|
</>
|
|
299
300
|
);
|
|
300
301
|
};
|
|
@@ -33,37 +33,47 @@ describe('Test CapDeviceContent', () => {
|
|
|
33
33
|
fireEvent.click(copyLink);
|
|
34
34
|
expect(copyLink).toBeInTheDocument();
|
|
35
35
|
});
|
|
36
|
-
it(
|
|
37
|
-
renderComponent(
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
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:
|
|
63
|
-
fireEvent.change(msgBox[0], { target: {value:
|
|
64
|
-
const titleBox = screen.getAllByPlaceholderText(
|
|
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:
|
|
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
|
|
98
|
+
if (!isUrl(value)) {
|
|
98
99
|
errorMessage = formatMessage(messages.ctaWebsiteUrlErrorMessage);
|
|
99
100
|
}
|
|
100
101
|
setUrlError(errorMessage);
|
|
101
|
-
updateHelper('url', value
|
|
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
|
|
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
|
-
//
|
|
218
|
-
|
|
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
|
|
637
|
-
const
|
|
638
|
-
templateData.accountId = get(
|
|
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(
|
|
642
|
-
templateData.templateId = get(
|
|
598
|
+
templateData.licenseCode = get(channelTemplate, 'definition.licenseCode');
|
|
599
|
+
templateData.templateId = get(channelTemplate, '_id');
|
|
643
600
|
}
|
|
644
|
-
const androidContent = get(
|
|
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(
|
|
614
|
+
templateData.androidContent.type = get(channelTemplate, 'definition.mode', '').toUpperCase();
|
|
658
615
|
templateData.androidContent.deviceType = 'ANDROID';
|
|
659
616
|
}
|
|
660
|
-
const iosContent = get(
|
|
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(
|
|
630
|
+
templateData.iosContent.type = get(channelTemplate, 'definition.mode').toUpperCase();
|
|
674
631
|
templateData.iosContent.deviceType = IOS.toUpperCase();
|
|
675
632
|
}
|
|
676
|
-
templateData.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.
|
|
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 [
|
|
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
|
|
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
|
-
|
|
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
|
|
172
|
+
setDeepLinkValueAndroid(androidCta?.actionLink);
|
|
175
173
|
setAddActionLinkAndroid(!isEmpty(androidCta) && true);
|
|
176
174
|
setButtonTypeAndroid(
|
|
177
|
-
androidExpandableDetails?.
|
|
175
|
+
androidExpandableDetails?.ctas?.length ? INAPP_BUTTON_TYPES.CTA : INAPP_BUTTON_TYPES.NONE
|
|
178
176
|
);
|
|
179
|
-
if (androidExpandableDetails?.
|
|
177
|
+
if (androidExpandableDetails?.ctas?.length > 0) {
|
|
180
178
|
setCtaDataAndroid(
|
|
181
|
-
androidExpandableDetails?.
|
|
182
|
-
const {
|
|
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
|
-
|
|
201
|
+
setTemplateMediaType(iosExpandableDetails?.style === BIG_TEXT ? INAPP_MEDIA_TYPES.TEXT : INAPP_MEDIA_TYPES.IMAGE);
|
|
205
202
|
setInAppImageSrcIos(iosExpandableDetails?.image);
|
|
206
|
-
setButtonTypeIos(iosExpandableDetails?.
|
|
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?.
|
|
206
|
+
if (iosExpandableDetails?.ctas?.length > 0) {
|
|
210
207
|
setCtaDataIos(
|
|
211
|
-
iosExpandableDetails?.
|
|
212
|
-
const {
|
|
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={
|
|
361
|
-
setTemplateMediaType={
|
|
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={
|
|
404
|
-
setTemplateMediaType={
|
|
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 (
|
|
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 (
|
|
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
|
-
...(
|
|
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 && !(
|
|
516
|
+
if (panes === ANDROID && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcAndroid === '') {
|
|
523
517
|
return true;
|
|
524
518
|
}
|
|
525
|
-
if (panes === IOS && !(
|
|
519
|
+
if (panes === IOS && !(templateMediaType === INAPP_MEDIA_TYPES.TEXT) && inAppImageSrcIos === '') {
|
|
526
520
|
return true;
|
|
527
521
|
}
|
|
528
522
|
//cta
|
|
529
|
-
if (
|
|
530
|
-
if (
|
|
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
|
|
535
|
-
|
|
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 {
|
|
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 (
|
|
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
|
-
...(
|
|
605
|
-
|
|
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
|
-
...(
|
|
622
|
-
|
|
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:
|
|
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) {
|
|
@@ -91,8 +91,8 @@ export default defineMessages({
|
|
|
91
91
|
id: `${prefix}.btnTypeCTA`,
|
|
92
92
|
defaultMessage: "Call to action",
|
|
93
93
|
},
|
|
94
|
-
|
|
95
|
-
id: `${prefix}.
|
|
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
|
|
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
|
}
|