@capillarytech/creatives-library 7.17.93 → 7.17.95
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 +1 -0
- package/containers/MobilePush/Edit/index.js +1 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/routes.js +5 -0
- package/v2Components/CapDeviceContent/index.js +311 -0
- package/v2Components/CapDeviceContent/index.scss +115 -0
- package/v2Components/CapDeviceContent/messages.js +94 -0
- package/v2Components/CapDeviceContent/tests/index.test.js +85 -0
- package/v2Components/CapImageUpload/index.js +11 -4
- package/v2Components/CapImageUpload/messages.js +6 -2
- package/v2Components/CapInAppCTA/constants.js +25 -0
- package/v2Components/CapInAppCTA/index.js +280 -0
- package/v2Components/CapInAppCTA/index.scss +93 -0
- package/v2Components/CapInAppCTA/messages.js +85 -0
- package/v2Components/FormBuilder/index.js +3 -4
- package/v2Components/MobilePushPreviewV2/index.js +78 -23
- package/v2Components/TemplatePreview/_templatePreview.scss +449 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_bottom.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_full.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_modal.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_top.svg +11 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_bottom.svg +6 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_full.svg +18 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_modal.svg +7 -0
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_top.svg +13 -0
- package/v2Components/TemplatePreview/index.js +660 -375
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Containers/App/constants.js +1 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +4 -1
- package/v2Containers/CreativesContainer/constants.js +1 -0
- package/v2Containers/CreativesContainer/index.js +42 -19
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/InApp/actions.js +64 -0
- package/v2Containers/InApp/constants.js +125 -0
- package/v2Containers/InApp/index.js +762 -0
- package/v2Containers/InApp/index.scss +48 -0
- package/v2Containers/InApp/messages.js +99 -0
- package/v2Containers/InApp/reducer.js +109 -0
- package/v2Containers/InApp/sagas.js +143 -0
- package/v2Containers/InApp/selectors.js +12 -0
- package/v2Containers/InApp/tests/action.test.js +53 -0
- package/v2Containers/InApp/tests/index.test.js +142 -0
- package/v2Containers/InApp/tests/mockData.js +898 -0
- package/v2Containers/InApp/tests/reducer.test.js +177 -0
- package/v2Containers/InApp/tests/sagas.test.js +391 -0
- package/v2Containers/MobilePush/Edit/index.js +3 -1
- package/v2Containers/Templates/_templates.scss +14 -0
- package/v2Containers/Templates/index.js +86 -32
- package/v2Containers/Templates/messages.js +20 -0
- package/v2Containers/TemplatesV2/index.js +2 -1
- package/v2Containers/TemplatesV2/messages.js +4 -0
|
@@ -86,4 +86,8 @@ export default defineMessages({
|
|
|
86
86
|
id: 'creatives.componentsV2.TemplatePreview.previewUrlMetaImage',
|
|
87
87
|
defaultMessage: 'Preview url meta image',
|
|
88
88
|
},
|
|
89
|
+
addToCart: {
|
|
90
|
+
id: `creatives.componentsV2.TemplatePreview.addToCart`,
|
|
91
|
+
defaultMessage: 'Add to cart',
|
|
92
|
+
},
|
|
89
93
|
});
|
|
@@ -22,6 +22,7 @@ import LineContainer from '../Line/Container';
|
|
|
22
22
|
import FTP from '../FTP';
|
|
23
23
|
import Viber from '../Viber';
|
|
24
24
|
import Whatsapp from '../Whatsapp';
|
|
25
|
+
import InApp from '../InApp';
|
|
25
26
|
import Rcs from '../Rcs';
|
|
26
27
|
import { getWhatsappContent } from '../Whatsapp/utils';
|
|
27
28
|
import * as commonUtil from '../../utils/common';
|
|
@@ -182,6 +183,7 @@ export function SlideBoxContent(props) {
|
|
|
182
183
|
const isCreateSms = isCreate && channel === constants.SMS;
|
|
183
184
|
const isCreateFacebook = isCreate && channel === constants.FACEBOOK;
|
|
184
185
|
const isCreateWhatsapp = isCreate && channel === constants.WHATSAPP;
|
|
186
|
+
const isCreateInApp = isCreate && channel === constants.INAPP;
|
|
185
187
|
const isCreateRcs = isCreate && channel === constants.RCS;
|
|
186
188
|
const isCreateMPush = isCreate && channel === constants.MOBILE_PUSH;
|
|
187
189
|
const isCreateCallTask = isCreate && channel === constants.CALL_TASK;
|
|
@@ -191,11 +193,13 @@ export function SlideBoxContent(props) {
|
|
|
191
193
|
let isPreview = false;
|
|
192
194
|
let isEmailPreview = false;
|
|
193
195
|
let isMpushPreview = false;
|
|
196
|
+
let isInappPreview = false;
|
|
194
197
|
let isEditCallTask = false;
|
|
195
198
|
let isEditMPush = false;
|
|
196
199
|
let isEditFacebook = false;
|
|
197
200
|
let isEditFTP = false;
|
|
198
201
|
let isEditWhatsapp = false;
|
|
202
|
+
let isEditInApp = false;
|
|
199
203
|
let isEditRcs = false;
|
|
200
204
|
let isEditZalo = false;
|
|
201
205
|
const isEmailCreate = isCreate && channel === constants.EMAIL;
|
|
@@ -212,8 +216,10 @@ export function SlideBoxContent(props) {
|
|
|
212
216
|
isPreview = slidBoxContent === 'preview' && [constants.SMS, constants.LINE, constants.WHATSAPP, constants.FACEBOOK, constants.VIBER, constants.RCS].includes(channel);
|
|
213
217
|
isEmailPreview = slidBoxContent === 'preview' && channel === constants.EMAIL;
|
|
214
218
|
isMpushPreview = slidBoxContent === 'preview' && channel === constants.MOBILE_PUSH;
|
|
219
|
+
isInappPreview = slidBoxContent === 'preview' && channel === constants.INAPP;
|
|
215
220
|
isEditFTP = isEdit && [constants.NO_COMMUNICATION, constants.FTP].includes(channel);
|
|
216
221
|
isEditZalo = isEdit && channel?.toUpperCase() === constants.ZALO;
|
|
222
|
+
isEditInApp = isEdit && channel === constants.INAPP;
|
|
217
223
|
}
|
|
218
224
|
const isDltEnabled = commonUtil.isTraiDLTEnable(isFullMode, smsRegister);
|
|
219
225
|
const hasJPLocaleHideFeatureEnabled = commonUtil?.hasJPLocaleHideFeatureEnabled();
|
|
@@ -438,6 +444,13 @@ export function SlideBoxContent(props) {
|
|
|
438
444
|
/>
|
|
439
445
|
)
|
|
440
446
|
}
|
|
447
|
+
{isInappPreview && (
|
|
448
|
+
<MobilePushPreview
|
|
449
|
+
templateData={templateData}
|
|
450
|
+
channel={channel}
|
|
451
|
+
forwardedTags={forwardedTags}
|
|
452
|
+
/>
|
|
453
|
+
)}
|
|
441
454
|
{isMpushPreview && (
|
|
442
455
|
<MobilePushPreview
|
|
443
456
|
templateData={templateData}
|
|
@@ -786,6 +799,36 @@ export function SlideBoxContent(props) {
|
|
|
786
799
|
}}/>
|
|
787
800
|
)}
|
|
788
801
|
|
|
802
|
+
{isCreateInApp && (<InApp
|
|
803
|
+
isFullMode={isFullMode}
|
|
804
|
+
onCreateComplete={onCreateComplete}
|
|
805
|
+
handleClose={handleClose}
|
|
806
|
+
location={{
|
|
807
|
+
pathname: `/inapp/create`,
|
|
808
|
+
query,
|
|
809
|
+
search: '',
|
|
810
|
+
}}
|
|
811
|
+
/>
|
|
812
|
+
)}
|
|
813
|
+
|
|
814
|
+
{isEditInApp && (<InApp
|
|
815
|
+
isFullMode={isFullMode}
|
|
816
|
+
templateData={templateData}
|
|
817
|
+
getFormData={getFormData}
|
|
818
|
+
getDefaultTags={type}
|
|
819
|
+
forwardedTags={forwardedTags}
|
|
820
|
+
onCreateComplete={onCreateComplete}
|
|
821
|
+
selectedOfferDetails={selectedOfferDetails}
|
|
822
|
+
params={{
|
|
823
|
+
id: templateData._id,
|
|
824
|
+
}}
|
|
825
|
+
location={{
|
|
826
|
+
pathname: `/inapp/edit`,
|
|
827
|
+
query,
|
|
828
|
+
search: '',
|
|
829
|
+
}} />
|
|
830
|
+
)}
|
|
831
|
+
|
|
789
832
|
{isCreateRcs && (<Rcs
|
|
790
833
|
{...rcsCommonProps}
|
|
791
834
|
location={{
|
|
@@ -11,7 +11,7 @@ import whatsppMsg from '../Whatsapp/messages';
|
|
|
11
11
|
import { LANGUAGE_OPTIONS } from '../Whatsapp/constants';
|
|
12
12
|
import globalMessages from '../Cap/messages';
|
|
13
13
|
import { MAP_TEMPLATE } from '../WeChat/Wrapper/constants';
|
|
14
|
-
import { NO_COMMUNICATION, FTP, WHATSAPP, RCS, ZALO } from '../App/constants';
|
|
14
|
+
import { NO_COMMUNICATION, FTP, WHATSAPP, RCS, ZALO, INAPP } from '../App/constants';
|
|
15
15
|
import { isTraiDLTEnable } from '../../utils/common';
|
|
16
16
|
import { formatString } from '../../utils/Formatter';
|
|
17
17
|
import {
|
|
@@ -39,7 +39,9 @@ export function SlideBoxHeader(props) {
|
|
|
39
39
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
40
40
|
const showCreateTraiSMSHeader = isTraiDlt && channel.toLowerCase() === "sms";
|
|
41
41
|
const isWhatsappEdit = channel.toLowerCase() === WHATSAPP && slidBoxContent === 'editTemplate';
|
|
42
|
+
const isInAppEdit = channel.toLowerCase() === INAPP && slidBoxContent === 'editTemplate';
|
|
42
43
|
const isWhatsappCreate = channel.toLowerCase() === WHATSAPP && slidBoxContent === 'createTemplate';
|
|
44
|
+
const isInAppCreate = channel.toLowerCase() === INAPP && slidBoxContent === 'createTemplate';
|
|
43
45
|
const isZaloEdit = channel.toLowerCase() === ZALO && slidBoxContent === 'editTemplate';
|
|
44
46
|
const zaloOverview = isZaloEdit && isFullMode;
|
|
45
47
|
const whatsappOverview = isWhatsappEdit && isFullMode;
|
|
@@ -60,6 +62,7 @@ export function SlideBoxHeader(props) {
|
|
|
60
62
|
sms: <FormattedMessage {...messages.smsHeader} />,
|
|
61
63
|
email: <FormattedMessage {...messages.emailHeader} />,
|
|
62
64
|
mobilepush: <FormattedMessage {...messages.pushNotificationHeader} />,
|
|
65
|
+
inapp: <FormattedMessage {...messages.inAppHeader} />,
|
|
63
66
|
wechat: <FormattedMessage {...messages.wechat} />,
|
|
64
67
|
line: <FormattedMessage {...messages.lineHeader} />,
|
|
65
68
|
no_communication: <FormattedMessage {...messages.noCommunication} />,
|
|
@@ -40,6 +40,7 @@ import { LOYALTY } from '../App/constants';
|
|
|
40
40
|
import { WHATSAPP_STATUSES, WHATSAPP_MEDIA_TYPES } from '../Whatsapp/constants';
|
|
41
41
|
|
|
42
42
|
import { updateImagesInHtml } from '../../utils/cdnTransformation';
|
|
43
|
+
import { IOS } from '../InApp/constants';
|
|
43
44
|
|
|
44
45
|
const classPrefix = 'add-creatives-section';
|
|
45
46
|
const CREATIVES_CONTAINER = 'creativesContainer';
|
|
@@ -155,7 +156,7 @@ export class Creatives extends React.Component {
|
|
|
155
156
|
this.setState((prevState) => {
|
|
156
157
|
let templateStep = prevState.templateStep + 1;
|
|
157
158
|
const {emailCreateMode, currentChannel} = prevState;
|
|
158
|
-
if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") ||
|
|
159
|
+
if ((currentChannel.toUpperCase() === constants.EMAIL && emailCreateMode === "upload") || [constants.MOBILE_PUSH, constants.WECHAT, constants.INAPP].includes(currentChannel.toUpperCase())) {
|
|
159
160
|
templateStep = prevState.templateStep + 2;
|
|
160
161
|
}
|
|
161
162
|
return {
|
|
@@ -168,6 +169,9 @@ export class Creatives extends React.Component {
|
|
|
168
169
|
this.setState({ emailCreateMode: mode});
|
|
169
170
|
}
|
|
170
171
|
|
|
172
|
+
onInAppModeChange = (mode) => {
|
|
173
|
+
this.setState({ inAppCreateMode: mode});
|
|
174
|
+
}
|
|
171
175
|
|
|
172
176
|
onMobilepushModeChange = (mode) => {
|
|
173
177
|
this.setState({ mobilePushCreateMode: mode});
|
|
@@ -281,6 +285,21 @@ export class Creatives extends React.Component {
|
|
|
281
285
|
};
|
|
282
286
|
break;
|
|
283
287
|
}
|
|
288
|
+
case constants.INAPP: {
|
|
289
|
+
const mode = get(templateData, 'androidContent.type') || get(templateData, 'iosContent.type') || '';
|
|
290
|
+
creativesTemplateData = {
|
|
291
|
+
type: channel,
|
|
292
|
+
name: templateData.messageSubject,
|
|
293
|
+
versions: {
|
|
294
|
+
content: {
|
|
295
|
+
ANDROID: templateData.androidContent,
|
|
296
|
+
IOS: templateData.iosContent,
|
|
297
|
+
},
|
|
298
|
+
},
|
|
299
|
+
definition: {accountId: templateData.accountId, mode: mode.toLowerCase()},
|
|
300
|
+
};
|
|
301
|
+
break;
|
|
302
|
+
}
|
|
284
303
|
case constants.WECHAT: {
|
|
285
304
|
const messageBody = JSON.parse(templateData.messageBody);
|
|
286
305
|
creativesTemplateData = {
|
|
@@ -570,15 +589,16 @@ export class Creatives extends React.Component {
|
|
|
570
589
|
}
|
|
571
590
|
break;
|
|
572
591
|
case constants.MOBILE_PUSH:
|
|
592
|
+
case constants.INAPP:
|
|
573
593
|
if (get(template, "value.versions.base")) {
|
|
574
|
-
const
|
|
575
|
-
templateData.accountId = get(
|
|
594
|
+
const channelTemplate = template.value;
|
|
595
|
+
templateData.accountId = get(channelTemplate, 'definition.accountId');
|
|
576
596
|
const type = (get(this.props, "messageDetails.type") || '').toLowerCase();
|
|
577
597
|
if (type === LOYALTY) {
|
|
578
|
-
templateData.licenseCode = get(
|
|
579
|
-
templateData.templateId = get(
|
|
598
|
+
templateData.licenseCode = get(channelTemplate, 'definition.licenseCode');
|
|
599
|
+
templateData.templateId = get(channelTemplate, '_id');
|
|
580
600
|
}
|
|
581
|
-
const androidContent = get(
|
|
601
|
+
const androidContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.ANDROID') : get(channelTemplate, 'versions.base.ANDROID');
|
|
582
602
|
if (!isEmpty(androidContent)) {
|
|
583
603
|
if (type !== LOYALTY) {
|
|
584
604
|
delete androidContent.cuid;
|
|
@@ -588,13 +608,13 @@ export class Creatives extends React.Component {
|
|
|
588
608
|
const custom = {};
|
|
589
609
|
forEach(androidContent.custom, (customKeyValue) => {
|
|
590
610
|
custom[customKeyValue.key] = customKeyValue.value;
|
|
591
|
-
}
|
|
611
|
+
});
|
|
592
612
|
androidContent.custom = custom;
|
|
593
613
|
templateData.androidContent = androidContent;
|
|
594
|
-
templateData.androidContent.type = get(
|
|
614
|
+
templateData.androidContent.type = get(channelTemplate, 'definition.mode', '').toUpperCase();
|
|
595
615
|
templateData.androidContent.deviceType = 'ANDROID';
|
|
596
616
|
}
|
|
597
|
-
const iosContent = get(
|
|
617
|
+
const iosContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.IOS') : get(channelTemplate, 'versions.base.IOS');
|
|
598
618
|
if (!isEmpty(iosContent)) {
|
|
599
619
|
if (type !== LOYALTY) {
|
|
600
620
|
delete iosContent.cuid;
|
|
@@ -604,13 +624,13 @@ export class Creatives extends React.Component {
|
|
|
604
624
|
const custom = {};
|
|
605
625
|
forEach(iosContent.custom, (customKeyValue) => {
|
|
606
626
|
custom[customKeyValue.key] = customKeyValue.value;
|
|
607
|
-
}
|
|
627
|
+
});
|
|
608
628
|
iosContent.custom = custom;
|
|
609
629
|
templateData.iosContent = iosContent;
|
|
610
|
-
templateData.iosContent.type = get(
|
|
611
|
-
templateData.iosContent.deviceType =
|
|
630
|
+
templateData.iosContent.type = get(channelTemplate, 'definition.mode').toUpperCase();
|
|
631
|
+
templateData.iosContent.deviceType = IOS.toUpperCase();
|
|
612
632
|
}
|
|
613
|
-
templateData.messageSubject =
|
|
633
|
+
templateData.messageSubject = channelTemplate?.name ? channelTemplate?.name : "messageSubject";
|
|
614
634
|
}
|
|
615
635
|
break;
|
|
616
636
|
case constants.WECHAT:
|
|
@@ -897,6 +917,7 @@ export class Creatives extends React.Component {
|
|
|
897
917
|
};
|
|
898
918
|
break;
|
|
899
919
|
case constants.MOBILE_PUSH:
|
|
920
|
+
case constants.INAPP:
|
|
900
921
|
gtmDetails = {
|
|
901
922
|
...gtmDetails,
|
|
902
923
|
|
|
@@ -981,12 +1002,13 @@ export class Creatives extends React.Component {
|
|
|
981
1002
|
}
|
|
982
1003
|
shouldShowFooter = () => {
|
|
983
1004
|
const {isFullMode } = this.props;
|
|
984
|
-
const {slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, weChatTemplateType, templateData} = this.state;
|
|
1005
|
+
const {slidBoxContent, currentChannel, emailCreateMode, templateNameExists, templateStep, mobilePushCreateMode, inAppCreateMode, weChatTemplateType, templateData} = this.state;
|
|
985
1006
|
const channel = currentChannel.toUpperCase();
|
|
986
1007
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
987
1008
|
let showFooter = false;
|
|
988
1009
|
showFooter = isFullMode && slidBoxContent === "preview";
|
|
989
1010
|
const isMobilepush = channel === constants.MOBILE_PUSH;
|
|
1011
|
+
const isInApp = channel === constants.INAPP;
|
|
990
1012
|
if (!isFullMode ) {
|
|
991
1013
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
992
1014
|
const isCreate = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
@@ -1036,7 +1058,6 @@ export class Creatives extends React.Component {
|
|
|
1036
1058
|
if ([constants.LINE, constants.VIBER, constants.FACEBOOK].includes(channel) || isLineViberChannel) {
|
|
1037
1059
|
showFooter = false;
|
|
1038
1060
|
}
|
|
1039
|
-
|
|
1040
1061
|
return showFooter;
|
|
1041
1062
|
}
|
|
1042
1063
|
shouldShowDoneFooter = () => {
|
|
@@ -1049,7 +1070,7 @@ export class Creatives extends React.Component {
|
|
|
1049
1070
|
if (channel === constants.EMAIL || channel === constants.SMS) {
|
|
1050
1071
|
const isEmailCreate = slidBoxContent === 'createTemplate' && channel === constants.EMAIL && currentStep !== 'createTemplateContent';
|
|
1051
1072
|
showDone = (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate') && !isEmailCreate;
|
|
1052
|
-
} else if (
|
|
1073
|
+
} else if ([constants.WECHAT, constants.MOBILE_PUSH].includes(channel)) {
|
|
1053
1074
|
showDone = currentStep === "createTemplateContent" || slidBoxContent === "editTemplate";
|
|
1054
1075
|
}
|
|
1055
1076
|
|
|
@@ -1080,7 +1101,7 @@ export class Creatives extends React.Component {
|
|
|
1080
1101
|
showTemplateName = ({formData, onFormDataChange}) => { //gets called from email/index after template data is fetched
|
|
1081
1102
|
const {slidBoxContent, currentChannel, isEditName} = this.state;
|
|
1082
1103
|
const channel = currentChannel.toUpperCase();
|
|
1083
|
-
if (
|
|
1104
|
+
if ([constants.EMAIL, constants.MOBILE_PUSH, constants.INAPP].includes(channel) && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate')) {
|
|
1084
1105
|
const name = get(formData, 'template-name');
|
|
1085
1106
|
if (channel === constants.EMAIL && !name && slidBoxContent === 'createTemplate') {
|
|
1086
1107
|
this.setState({isTemplateNameEmpty:true});
|
|
@@ -1094,7 +1115,7 @@ export class Creatives extends React.Component {
|
|
|
1094
1115
|
}
|
|
1095
1116
|
}
|
|
1096
1117
|
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
1097
|
-
const {slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode, weChatTemplateType} = this.state;
|
|
1118
|
+
const {slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode, inAppCreateMode, weChatTemplateType} = this.state;
|
|
1098
1119
|
let isShowContinueFooter = false;
|
|
1099
1120
|
const currentStep = this.creativesTemplateSteps[templateStep];
|
|
1100
1121
|
const channel = currentChannel.toUpperCase();
|
|
@@ -1108,6 +1129,8 @@ export class Creatives extends React.Component {
|
|
|
1108
1129
|
isShowContinueFooter = !isEmpty(mobilePushCreateMode) && currentStep === "modeSelection";
|
|
1109
1130
|
} else if (currentChannel.toUpperCase() === constants.WECHAT) {
|
|
1110
1131
|
isShowContinueFooter = !isEmpty(weChatTemplateType) && currentStep === "modeSelection";
|
|
1132
|
+
} else if (currentChannel.toUpperCase() === constants.INAPP) {
|
|
1133
|
+
isShowContinueFooter = !isEmpty(inAppCreateMode) && currentChannel === "modeSelection";
|
|
1111
1134
|
}
|
|
1112
1135
|
|
|
1113
1136
|
return isShowContinueFooter;
|
|
@@ -1117,7 +1140,7 @@ export class Creatives extends React.Component {
|
|
|
1117
1140
|
const {templateContainerDetails} = this;
|
|
1118
1141
|
const {formData, onFormDataChange} = templateContainerDetails;
|
|
1119
1142
|
const channel = currentChannel.toUpperCase();
|
|
1120
|
-
if (
|
|
1143
|
+
if ([constants.EMAIL, constants.MOBILE_PUSH, constants.INAPP].includes(channel) && (slidBoxContent === 'editTemplate' || slidBoxContent === 'createTemplate')) {
|
|
1121
1144
|
const name = get(formData, 'template-name');
|
|
1122
1145
|
return showTemplateNameComponentEdit ? this.templateNameComponentInput({formData, onFormDataChange, name}) : this.templateNameComponentHeader({formData, onFormDataChange, name});
|
|
1123
1146
|
}
|
|
@@ -338,6 +338,10 @@ export default defineMessages({
|
|
|
338
338
|
id: `${scope}.pushNotificationHeader`,
|
|
339
339
|
defaultMessage: `Push notification`,
|
|
340
340
|
},
|
|
341
|
+
"inAppHeader": {
|
|
342
|
+
id: `${scope}.inAppHeader`,
|
|
343
|
+
defaultMessage: `In App Message`,
|
|
344
|
+
},
|
|
341
345
|
"wechat": {
|
|
342
346
|
id: `${scope}.wechat`,
|
|
343
347
|
defaultMessage: `Wechat`,
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { INAPP } from "../CreativesContainer/constants";
|
|
2
|
+
import {
|
|
3
|
+
INAPP_TEMPLATE_CREATE_REQUEST,
|
|
4
|
+
CLEAR_CREATE_RESPONSE_REQUEST,
|
|
5
|
+
GET_INAPP_TEMPLATE_DETAILS_REQUEST,
|
|
6
|
+
RESET_EDIT_TEMPLATE,
|
|
7
|
+
UPLOAD_INAPP_ASSET_REQUEST,
|
|
8
|
+
CLEAR_INAPP_ASSET,
|
|
9
|
+
INAPP_EDIT_TEMPLATE_REQUEST,
|
|
10
|
+
} from "./constants";
|
|
11
|
+
|
|
12
|
+
export function createInAppTemplate(payload, callback) {
|
|
13
|
+
return {
|
|
14
|
+
type: INAPP_TEMPLATE_CREATE_REQUEST,
|
|
15
|
+
payload,
|
|
16
|
+
callback,
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
export function clearCreateResponse() {
|
|
20
|
+
return {
|
|
21
|
+
type: CLEAR_CREATE_RESPONSE_REQUEST,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
// FOR EDIT
|
|
25
|
+
export function getTemplateDetails(id, callback) {
|
|
26
|
+
return {
|
|
27
|
+
type: GET_INAPP_TEMPLATE_DETAILS_REQUEST,
|
|
28
|
+
id,
|
|
29
|
+
channel: INAPP,
|
|
30
|
+
callback,
|
|
31
|
+
};
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export function editTemplate(template, callback) {
|
|
35
|
+
return {
|
|
36
|
+
type: INAPP_EDIT_TEMPLATE_REQUEST,
|
|
37
|
+
payload: template,
|
|
38
|
+
callback,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export function resetEditTemplate() {
|
|
43
|
+
return {
|
|
44
|
+
type: RESET_EDIT_TEMPLATE,
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
export const uploadInAppAsset = (
|
|
49
|
+
file,
|
|
50
|
+
assetType,
|
|
51
|
+
fileParams,
|
|
52
|
+
templateType,
|
|
53
|
+
) => ({
|
|
54
|
+
type: UPLOAD_INAPP_ASSET_REQUEST,
|
|
55
|
+
file,
|
|
56
|
+
assetType,
|
|
57
|
+
fileParams,
|
|
58
|
+
templateType,
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
export const clearInAppAsset = (templateType) => ({
|
|
62
|
+
type: CLEAR_INAPP_ASSET,
|
|
63
|
+
templateType,
|
|
64
|
+
});
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { FormattedMessage } from "react-intl";
|
|
3
|
+
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
|
|
4
|
+
import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
|
|
5
|
+
import { WEBSITE } from "../../v2Components/CapInAppCTA/constants";
|
|
6
|
+
import messages from "./messages";
|
|
7
|
+
|
|
8
|
+
const prefix = "app/v2Containers/InApp";
|
|
9
|
+
export const INAPP_TEMPLATE_CREATE_REQUEST = `${prefix}/INAPP_TEMPLATE_CREATE_REQUEST`;
|
|
10
|
+
export const INAPP_TEMPLATE_CREATE_SUCCESS = `${prefix}/INAPP_TEMPLATE_CREATE_SUCCESS`;
|
|
11
|
+
export const INAPP_TEMPLATE_CREATE_FAILURE = `${prefix}/INAPP_TEMPLATE_CREATE_FAILURE`;
|
|
12
|
+
export const INAPP_EDIT_TEMPLATE_REQUEST = `${prefix}/INAPP_EDIT_TEMPLATE_REQUEST`;
|
|
13
|
+
export const INAPP_EDIT_TEMPLATE_SUCCESS = `${prefix}/INAPP_EDIT_TEMPLATE_SUCCESS`;
|
|
14
|
+
export const INAPP_EDIT_TEMPLATE_FAILURE = `${prefix}/INAPP_EDIT_TEMPLATE_FAILURE`;
|
|
15
|
+
export const CLEAR_CREATE_RESPONSE_REQUEST = `${prefix}/CLEAR_CREATE_RESPONSE_REQUEST`;
|
|
16
|
+
// FOR EDIT
|
|
17
|
+
export const GET_INAPP_TEMPLATE_DETAILS_REQUEST = `${prefix}/Edit/GET_INAPP_TEMPLATE_DETAILS_REQUEST`;
|
|
18
|
+
export const GET_INAPP_TEMPLATE_DETAILS_SUCCESS = `${prefix}/Edit/GET_INAPP_TEMPLATE_DETAILS_SUCCESS`;
|
|
19
|
+
export const GET_INAPP_TEMPLATE_DETAILS_FAILURE = `${prefix}/Edit/GET_INAPP_TEMPLATE_DETAILS_FAILURE`;
|
|
20
|
+
export const RESET_EDIT_TEMPLATE = `${prefix}/Edit/RESET_EDIT_TEMPLATE`;
|
|
21
|
+
|
|
22
|
+
export const UPLOAD_INAPP_ASSET_REQUEST = `${prefix}/UPLOAD_INAPP_ASSET_REQUEST`;
|
|
23
|
+
export const UPLOAD_INAPP_ASSET_SUCCESS = `${prefix}/UPLOAD_INAPP_ASSET_SUCCESS`;
|
|
24
|
+
export const UPLOAD_INAPP_ASSET_FAILURE = `${prefix}/UPLOAD_INAPP_ASSET_FAILURE`;
|
|
25
|
+
export const CLEAR_INAPP_ASSET = `${prefix}/CLEAR_INAPP_ASSET`;
|
|
26
|
+
|
|
27
|
+
export const INAPP_MEDIA_TYPES = {
|
|
28
|
+
TEXT: "TEXT",
|
|
29
|
+
IMAGE: "IMAGE",
|
|
30
|
+
};
|
|
31
|
+
export const BIG_TEXT = 'BIG_TEXT';
|
|
32
|
+
export const BIG_PICTURE = 'BIG_PICTURE';
|
|
33
|
+
export const NONE = "NONE";
|
|
34
|
+
export const CTA = "CTA";
|
|
35
|
+
export const MAPP_SDK = "MAPP_SDK";
|
|
36
|
+
export const INAPP_BUTTON_TYPES = {
|
|
37
|
+
NONE,
|
|
38
|
+
CTA,
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export const DEEP_LINK = 'DEEP_LINK';
|
|
42
|
+
|
|
43
|
+
export const INITIAL_CTA_DATA = [
|
|
44
|
+
{
|
|
45
|
+
index: 0,
|
|
46
|
+
ctaType: WEBSITE,
|
|
47
|
+
text: "",
|
|
48
|
+
urlType: DEEP_LINK,
|
|
49
|
+
url: "",
|
|
50
|
+
isSaved: false,
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export const URL_MAX_LENGTH = 2000;
|
|
55
|
+
|
|
56
|
+
export const ALLOWED_IMAGE_EXTENSIONS_REGEX = /\.(jpe?g|png)$/i;
|
|
57
|
+
export const INAPP_IMG_SIZE = 5000000; // 5MB
|
|
58
|
+
|
|
59
|
+
export const TEMPLATE_MESSAGE_MAX_LENGTH = 1024;
|
|
60
|
+
|
|
61
|
+
export const INAPP_MESSAGE_LAYOUT_TYPES = {
|
|
62
|
+
MODAL: "POPUP",
|
|
63
|
+
TOPBANNER: "HEADER",
|
|
64
|
+
BOTTOMBANNER: "FOOTER",
|
|
65
|
+
FULLSCREEN: "FULLSCREEN",
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const ANDROID = "ANDROID";
|
|
69
|
+
export const IOS = "iOS";
|
|
70
|
+
export const LAYOUT_RADIO_OPTIONS = [
|
|
71
|
+
{
|
|
72
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.MODAL,
|
|
73
|
+
label: <FormattedMessage {...messages.layoutModal} />,
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.TOPBANNER,
|
|
77
|
+
label: <FormattedMessage {...messages.layoutTopBanner} />,
|
|
78
|
+
},
|
|
79
|
+
{
|
|
80
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.BOTTOMBANNER,
|
|
81
|
+
label: <FormattedMessage {...messages.layoutBottomBanner} />,
|
|
82
|
+
},
|
|
83
|
+
{
|
|
84
|
+
value: INAPP_MESSAGE_LAYOUT_TYPES.FULLSCREEN,
|
|
85
|
+
label: <FormattedMessage {...messages.layoutFullScreen} />,
|
|
86
|
+
},
|
|
87
|
+
];
|
|
88
|
+
export const MEDIA_RADIO_OPTIONS = [
|
|
89
|
+
{
|
|
90
|
+
value: INAPP_MEDIA_TYPES.TEXT,
|
|
91
|
+
label: <FormattedMessage {...messages.mediaText} />,
|
|
92
|
+
},
|
|
93
|
+
{
|
|
94
|
+
value: INAPP_MEDIA_TYPES.IMAGE,
|
|
95
|
+
label: <FormattedMessage {...messages.mediaImage} />,
|
|
96
|
+
},
|
|
97
|
+
];
|
|
98
|
+
export const BUTTON_RADIO_OPTIONS = [
|
|
99
|
+
{
|
|
100
|
+
value: INAPP_BUTTON_TYPES.NONE,
|
|
101
|
+
label: (
|
|
102
|
+
<CapHeading
|
|
103
|
+
type="h4"
|
|
104
|
+
className="inapp-button-none"
|
|
105
|
+
>
|
|
106
|
+
<FormattedMessage {...messages.btnTypeNone} />
|
|
107
|
+
</CapHeading>
|
|
108
|
+
),
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
value: INAPP_BUTTON_TYPES.CTA,
|
|
112
|
+
label: (
|
|
113
|
+
<>
|
|
114
|
+
<div
|
|
115
|
+
className="inapp-button-cta"
|
|
116
|
+
>
|
|
117
|
+
<CapHeading type="h4">
|
|
118
|
+
<FormattedMessage {...messages.btnTypeCTA} />
|
|
119
|
+
</CapHeading>
|
|
120
|
+
<CapLabel><FormattedMessage {...messages.ctaDescription} /></CapLabel>
|
|
121
|
+
</div>
|
|
122
|
+
</>
|
|
123
|
+
),
|
|
124
|
+
},
|
|
125
|
+
];
|