@capillarytech/creatives-library 8.0.114-alpha.1 → 8.0.114
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/package.json +1 -1
- package/utils/commonUtils.js +3 -359
- package/utils/tagValidations.js +5 -20
- package/utils/tests/commonUtil.test.js +171 -474
- package/utils/tests/tagValidations.test.js +2 -89
- package/v2Components/ErrorInfoNote/index.js +46 -114
- package/v2Components/ErrorInfoNote/messages.js +0 -25
- package/v2Components/ErrorInfoNote/style.scss +1 -14
- package/v2Components/FormBuilder/index.js +127 -204
- package/v2Components/FormBuilder/messages.js +1 -1
- package/v2Containers/Cap/reducer.js +4 -4
- package/v2Containers/CreativesContainer/SlideBoxContent.js +3 -23
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +1 -3
- package/v2Containers/CreativesContainer/constants.js +1 -4
- package/v2Containers/CreativesContainer/index.js +19 -44
- package/v2Containers/CreativesContainer/messages.js +0 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +3 -21
- package/v2Containers/Ebill/index.js +3 -3
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +1 -1
- package/v2Containers/InApp/index.js +50 -123
- package/v2Containers/InApp/tests/index.test.js +1 -1
- package/v2Containers/InApp/tests/sagas.test.js +1 -1
- package/v2Containers/InApp/utils.js +0 -37
- package/v2Containers/MobilePush/Create/index.js +20 -24
- package/v2Containers/MobilePush/Edit/index.js +2 -6
- package/v2Containers/MobilepushWrapper/index.js +0 -2
- package/v2Containers/Sms/Create/index.js +0 -1
- package/v2Containers/Sms/Edit/index.js +0 -2
- package/v2Containers/SmsWrapper/index.js +0 -2
- package/v2Containers/Whatsapp/constants.js +1 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +57476 -0
- package/v2Containers/Whatsapp/tests/index.test.js +88 -0
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.js +0 -127
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.test.js +0 -147
- package/v2Components/ErrorInfoNote/utils.js +0 -38
- package/v2Components/ErrorInfoNote/utils.test.js +0 -156
- package/v2Containers/InApp/tests/utils.test.js +0 -41
|
@@ -499,7 +499,6 @@ export function SlideBoxContent(props) {
|
|
|
499
499
|
}
|
|
500
500
|
{isEditSms && (
|
|
501
501
|
<SmsWrapper
|
|
502
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
503
502
|
setIsLoadingContent={setIsLoadingContent}
|
|
504
503
|
isEditSms={isEditSms}
|
|
505
504
|
location={creativesLocationProps}
|
|
@@ -555,7 +554,6 @@ export function SlideBoxContent(props) {
|
|
|
555
554
|
}}
|
|
556
555
|
hostName={hostName}
|
|
557
556
|
eventContextTags={eventContextTags}
|
|
558
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
559
557
|
/>
|
|
560
558
|
}
|
|
561
559
|
{
|
|
@@ -570,7 +568,6 @@ export function SlideBoxContent(props) {
|
|
|
570
568
|
}
|
|
571
569
|
{isCreateSms && (
|
|
572
570
|
<SmsWrapper
|
|
573
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
574
571
|
setIsLoadingContent={setIsLoadingContent}
|
|
575
572
|
location={creativesLocationProps}
|
|
576
573
|
route={{ name: 'sms' }}
|
|
@@ -677,7 +674,6 @@ export function SlideBoxContent(props) {
|
|
|
677
674
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
678
675
|
creativesMode={creativesMode}
|
|
679
676
|
eventContextTags={eventContextTags}
|
|
680
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
681
677
|
/>
|
|
682
678
|
}
|
|
683
679
|
{isCreateMPush &&
|
|
@@ -707,7 +703,6 @@ export function SlideBoxContent(props) {
|
|
|
707
703
|
hideTestAndPreviewBtn={hideTestAndPreviewBtn}
|
|
708
704
|
onTestContentClicked={onTestContentClicked}
|
|
709
705
|
eventContextTags={eventContextTags}
|
|
710
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
711
706
|
/>
|
|
712
707
|
}
|
|
713
708
|
{
|
|
@@ -727,7 +722,6 @@ export function SlideBoxContent(props) {
|
|
|
727
722
|
onSelectTemplate={onSelectTemplate}
|
|
728
723
|
orgUnitId={orgUnitId}
|
|
729
724
|
eventContextTags={eventContextTags}
|
|
730
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
731
725
|
/>
|
|
732
726
|
)
|
|
733
727
|
}
|
|
@@ -748,7 +742,6 @@ export function SlideBoxContent(props) {
|
|
|
748
742
|
fbAdManager={fbAdManager}
|
|
749
743
|
onSelectTemplate={onSelectTemplate}
|
|
750
744
|
eventContextTags={eventContextTags}
|
|
751
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
752
745
|
/>
|
|
753
746
|
)
|
|
754
747
|
}
|
|
@@ -771,7 +764,6 @@ export function SlideBoxContent(props) {
|
|
|
771
764
|
handleClose={handleClose}
|
|
772
765
|
selectedOfferDetails={selectedOfferDetails}
|
|
773
766
|
eventContextTags={eventContextTags}
|
|
774
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
775
767
|
/>
|
|
776
768
|
)
|
|
777
769
|
}
|
|
@@ -791,7 +783,6 @@ export function SlideBoxContent(props) {
|
|
|
791
783
|
handleClose={handleClose}
|
|
792
784
|
selectedOfferDetails={selectedOfferDetails}
|
|
793
785
|
eventContextTags={eventContextTags}
|
|
794
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
795
786
|
/>
|
|
796
787
|
)
|
|
797
788
|
}
|
|
@@ -807,7 +798,6 @@ export function SlideBoxContent(props) {
|
|
|
807
798
|
templateData={templateData}
|
|
808
799
|
selectedOfferDetails={selectedOfferDetails}
|
|
809
800
|
eventContextTags={eventContextTags}
|
|
810
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
811
801
|
createNew/>
|
|
812
802
|
)}
|
|
813
803
|
|
|
@@ -825,16 +815,13 @@ export function SlideBoxContent(props) {
|
|
|
825
815
|
templateData={templateData}
|
|
826
816
|
selectedOfferDetails={selectedOfferDetails}
|
|
827
817
|
eventContextTags={eventContextTags}
|
|
828
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
829
818
|
createNew/> }
|
|
830
819
|
|
|
831
820
|
{isCreateWhatsapp && (<Whatsapp
|
|
832
821
|
isFullMode={isFullMode}
|
|
833
822
|
onCreateComplete={onCreateComplete}
|
|
834
823
|
eventContextTags={eventContextTags}
|
|
835
|
-
handleClose={handleClose}
|
|
836
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
837
|
-
/>
|
|
824
|
+
handleClose={handleClose}/>
|
|
838
825
|
)}
|
|
839
826
|
|
|
840
827
|
{isEditWhatsapp && (<Whatsapp
|
|
@@ -852,9 +839,7 @@ export function SlideBoxContent(props) {
|
|
|
852
839
|
pathname: `/whatsapp/edit`,
|
|
853
840
|
query,
|
|
854
841
|
search: '',
|
|
855
|
-
}}
|
|
856
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
857
|
-
/>
|
|
842
|
+
}}/>
|
|
858
843
|
)}
|
|
859
844
|
|
|
860
845
|
{isCreateInApp && (<InApp
|
|
@@ -871,7 +856,6 @@ export function SlideBoxContent(props) {
|
|
|
871
856
|
templateData={templateData}
|
|
872
857
|
getDefaultTags={type}
|
|
873
858
|
eventContextTags={eventContextTags}
|
|
874
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
875
859
|
/>
|
|
876
860
|
)}
|
|
877
861
|
|
|
@@ -891,14 +875,11 @@ export function SlideBoxContent(props) {
|
|
|
891
875
|
pathname: `/inapp/edit`,
|
|
892
876
|
query,
|
|
893
877
|
search: '',
|
|
894
|
-
}}
|
|
895
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
896
|
-
/>
|
|
878
|
+
}} />
|
|
897
879
|
)}
|
|
898
880
|
|
|
899
881
|
{isCreateRcs && (<Rcs
|
|
900
882
|
{...rcsCommonProps}
|
|
901
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
902
883
|
location={{
|
|
903
884
|
pathname: `/rcs/create`,
|
|
904
885
|
query,
|
|
@@ -907,7 +888,6 @@ export function SlideBoxContent(props) {
|
|
|
907
888
|
)}
|
|
908
889
|
{isEditRcs && (<Rcs
|
|
909
890
|
{...rcsCommonProps}
|
|
910
|
-
showLiquidErrorInFooter={showLiquidErrorInFooter}
|
|
911
891
|
templateData={templateData}
|
|
912
892
|
params={{
|
|
913
893
|
id: templateData._id,
|
|
@@ -25,12 +25,10 @@ function SlideBoxFooter(props) {
|
|
|
25
25
|
isTemplateNameEmpty,
|
|
26
26
|
errorMessages,
|
|
27
27
|
isLiquidValidationError,
|
|
28
|
-
currentTab,
|
|
29
28
|
} = props;
|
|
30
|
-
|
|
31
29
|
return (
|
|
32
30
|
<div className='template-footer-width'>
|
|
33
|
-
{isLiquidValidationError && (<ErrorInfoNote
|
|
31
|
+
{isLiquidValidationError && (<ErrorInfoNote errorMessages={errorMessages} />)}
|
|
34
32
|
<div>
|
|
35
33
|
{props.shouldShowDoneFooter() && (
|
|
36
34
|
<div>
|
|
@@ -33,7 +33,7 @@ export const HIDE_CONTAINER_LOADER = "app/CreativesContainer/HIDE_CONTAINER_LOAD
|
|
|
33
33
|
export const WHATSAPP_HELP_DOC_LINK = "https://docs.capillarytech.com/docs/create-whatsapp-template";
|
|
34
34
|
|
|
35
35
|
export const ENABLE_AI_SUGGESTIONS = "ENABLE_AI_SUGGESTIONS";
|
|
36
|
-
export const LIQUID_SUPPORTED_CHANNELS = [EMAIL
|
|
36
|
+
export const LIQUID_SUPPORTED_CHANNELS = [EMAIL];
|
|
37
37
|
|
|
38
38
|
export const EMF = "EMF";
|
|
39
39
|
export const VENENO = "VENENO";
|
|
@@ -44,6 +44,3 @@ export const EXTERNAL_URL = "EXTERNAL_URL";
|
|
|
44
44
|
|
|
45
45
|
export const TRANSACTION = "TRANSACTION";
|
|
46
46
|
export const BIG_TEXT = "BIG_TEXT";
|
|
47
|
-
export const GENERIC = "GENERIC";
|
|
48
|
-
export const LIQUID_ERROR_MSG = "LIQUID_ERROR_MSG";
|
|
49
|
-
export const STANDARD_ERROR_MSG = "STANDARD_ERROR_MSG";
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import Bugsnag from "@bugsnag/js";
|
|
4
|
-
import
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
import {
|
|
5
|
+
CapSlideBox,
|
|
6
|
+
CapHeader,
|
|
7
|
+
CapLink,
|
|
8
|
+
CapInput,
|
|
9
|
+
CapNotification,
|
|
10
|
+
} from "@capillarytech/cap-ui-library";
|
|
9
11
|
import { injectIntl, FormattedMessage } from 'react-intl';
|
|
10
12
|
import classnames from 'classnames';
|
|
11
13
|
import {
|
|
@@ -57,7 +59,6 @@ import {
|
|
|
57
59
|
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
58
60
|
import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
|
|
59
61
|
import { DYNAMIC_URL } from '../../v2Components/CapWhatsappCTA/constants';
|
|
60
|
-
import ErrorInfoNote from '../../v2Components/ErrorInfoNote';
|
|
61
62
|
|
|
62
63
|
import {
|
|
63
64
|
transformChannelPayload,
|
|
@@ -93,13 +94,7 @@ export class Creatives extends React.Component {
|
|
|
93
94
|
weChatMaptemplateStep: 0,
|
|
94
95
|
isLiquidValidationError: false,
|
|
95
96
|
errorMessages: [],
|
|
96
|
-
liquidErrorMessage: {
|
|
97
|
-
STANDARD_ERROR_MSG: [],
|
|
98
|
-
LIQUID_ERROR_MSG: [],
|
|
99
|
-
},
|
|
100
|
-
activeFormBuilderTab: constants.ANDROID,
|
|
101
97
|
};
|
|
102
|
-
this.liquidFlow = Boolean(commonUtil.hasLiquidSupportFeature());
|
|
103
98
|
this.creativesTemplateSteps = {
|
|
104
99
|
1: 'modeSelection',
|
|
105
100
|
2: 'templateSelection', // only for email in current flows wil be used for mpush, line and wechat as well.
|
|
@@ -757,7 +752,7 @@ export class Creatives extends React.Component {
|
|
|
757
752
|
}
|
|
758
753
|
templateData.androidContent = androidContent;
|
|
759
754
|
templateData.androidContent.type = get(channelTemplate, 'definition.mode', '').toUpperCase();
|
|
760
|
-
templateData.androidContent.deviceType =
|
|
755
|
+
templateData.androidContent.deviceType = 'ANDROID';
|
|
761
756
|
}
|
|
762
757
|
const iosContent = channel === constants.INAPP ? get(channelTemplate, 'versions.base.content.IOS') : get(channelTemplate, 'versions.base.IOS');
|
|
763
758
|
if (!isEmpty(iosContent)) {
|
|
@@ -776,7 +771,7 @@ export class Creatives extends React.Component {
|
|
|
776
771
|
}
|
|
777
772
|
templateData.iosContent = iosContent;
|
|
778
773
|
templateData.iosContent.type = get(channelTemplate, 'definition.mode').toUpperCase();
|
|
779
|
-
templateData.iosContent.deviceType =
|
|
774
|
+
templateData.iosContent.deviceType = IOS.toUpperCase();
|
|
780
775
|
}
|
|
781
776
|
templateData.messageSubject = channelTemplate?.name ? channelTemplate?.name : "messageSubject";
|
|
782
777
|
}
|
|
@@ -1109,7 +1104,6 @@ export class Creatives extends React.Component {
|
|
|
1109
1104
|
}
|
|
1110
1105
|
|
|
1111
1106
|
getFormData = (template) => {
|
|
1112
|
-
|
|
1113
1107
|
if (template.validity) {
|
|
1114
1108
|
this.setState(
|
|
1115
1109
|
{
|
|
@@ -1332,14 +1326,10 @@ export class Creatives extends React.Component {
|
|
|
1332
1326
|
}
|
|
1333
1327
|
}
|
|
1334
1328
|
|
|
1335
|
-
showLiquidErrorInFooter = (
|
|
1336
|
-
|
|
1337
|
-
this.setState({
|
|
1338
|
-
|
|
1339
|
-
liquidErrorMessage: errorMessagesFromFormBuilder,
|
|
1340
|
-
activeFormBuilderTab: currentFormBuilderTab === 1 ? constants.ANDROID : (currentFormBuilderTab === 2 ? constants.IOS : null), // Update activeFormBuilderTab, default to 1 if undefined
|
|
1341
|
-
});
|
|
1342
|
-
}
|
|
1329
|
+
showLiquidErrorInFooter = (errorMessages) => {
|
|
1330
|
+
const isError = (errorMessages?.STANDARD_ERROR_MSG?.length > 0 || errorMessages?.LIQUID_ERROR_MSG?.length > 0);
|
|
1331
|
+
this.setState({ isLiquidValidationError: isError, errorMessages });
|
|
1332
|
+
};
|
|
1343
1333
|
|
|
1344
1334
|
shouldShowContinueFooter = () => { // only for email for now, has to be modified according to channel
|
|
1345
1335
|
const { slidBoxContent, templateStep, currentChannel, emailCreateMode, mobilePushCreateMode, inAppCreateMode, weChatTemplateType } = this.state;
|
|
@@ -1399,8 +1389,7 @@ export class Creatives extends React.Component {
|
|
|
1399
1389
|
weChatMaptemplateStep,
|
|
1400
1390
|
isTemplateNameEmpty,
|
|
1401
1391
|
isLiquidValidationError,
|
|
1402
|
-
|
|
1403
|
-
activeFormBuilderTab,
|
|
1392
|
+
errorMessages,
|
|
1404
1393
|
} = this.state;
|
|
1405
1394
|
const {
|
|
1406
1395
|
isFullMode,
|
|
@@ -1428,11 +1417,11 @@ export class Creatives extends React.Component {
|
|
|
1428
1417
|
weChatTemplateType === MAP_TEMPLATE &&
|
|
1429
1418
|
templateStep !== "modeSelection";
|
|
1430
1419
|
const slideBoxWrapperMargin =
|
|
1431
|
-
|
|
1420
|
+
errorMessages?.STANDARD_ERROR_MSG?.length > 0 && errorMessages?.LIQUID_ERROR_MSG?.length > 0
|
|
1432
1421
|
? CAP_SPACE_64
|
|
1433
|
-
:
|
|
1422
|
+
: errorMessages?.LIQUID_ERROR_MSG?.length > 0
|
|
1434
1423
|
? CAP_SPACE_56
|
|
1435
|
-
:
|
|
1424
|
+
: errorMessages?.STANDARD_ERROR_MSG?.length > 0
|
|
1436
1425
|
? CAP_SPACE_32
|
|
1437
1426
|
: 0;
|
|
1438
1427
|
/* TODO: Instead of passing down same props separately to each component down, write common function to these props and pass it accordingly */
|
|
@@ -1530,7 +1519,7 @@ export class Creatives extends React.Component {
|
|
|
1530
1519
|
loyaltyMetaData={loyaltyMetaData}
|
|
1531
1520
|
/>
|
|
1532
1521
|
)}
|
|
1533
|
-
footer={this.shouldShowFooter()
|
|
1522
|
+
footer={this.shouldShowFooter() && (
|
|
1534
1523
|
<SlideBoxFooter
|
|
1535
1524
|
isFullMode={isFullMode}
|
|
1536
1525
|
messages={this.props.messages}
|
|
@@ -1547,24 +1536,13 @@ export class Creatives extends React.Component {
|
|
|
1547
1536
|
fetchingCmsData={fetchingCmsData}
|
|
1548
1537
|
isTemplateNameEmpty={isTemplateNameEmpty}
|
|
1549
1538
|
isLiquidValidationError={isLiquidValidationError}
|
|
1550
|
-
errorMessages={
|
|
1551
|
-
currentTab={activeFormBuilderTab}
|
|
1539
|
+
errorMessages={errorMessages}
|
|
1552
1540
|
/>
|
|
1553
|
-
) : isLiquidValidationError && (
|
|
1554
|
-
<CapRow className="template-footer-width">
|
|
1555
|
-
{(() => {
|
|
1556
|
-
|
|
1557
|
-
const errorsToShow = get(liquidErrorMessage, constants.LIQUID_ERROR_MSG, []);
|
|
1558
|
-
const standardErrorsToShow = get(liquidErrorMessage, constants.STANDARD_ERROR_MSG, []);
|
|
1559
|
-
return <ErrorInfoNote currentTab={activeFormBuilderTab?.toUpperCase()} errorMessages={{LIQUID_ERROR_MSG: errorsToShow, STANDARD_ERROR_MSG: standardErrorsToShow}} />;
|
|
1560
|
-
})()}
|
|
1561
|
-
</CapRow>
|
|
1562
1541
|
)}
|
|
1563
1542
|
handleClose={this.handleCloseSlideBox}
|
|
1564
1543
|
show={showSlideBox}
|
|
1565
1544
|
size="size-xl"
|
|
1566
1545
|
/>
|
|
1567
|
-
|
|
1568
1546
|
</SlideBoxWrapper>
|
|
1569
1547
|
);
|
|
1570
1548
|
}
|
|
@@ -1599,9 +1577,6 @@ Creatives.propTypes = {
|
|
|
1599
1577
|
orgUnitId: PropTypes.number,
|
|
1600
1578
|
hostName: PropTypes.string,
|
|
1601
1579
|
eventContextTags: PropTypes.array,
|
|
1602
|
-
intl: PropTypes.shape({
|
|
1603
|
-
formatMessage: PropTypes.func,
|
|
1604
|
-
}),
|
|
1605
1580
|
stopValidation: PropTypes.func,
|
|
1606
1581
|
};
|
|
1607
1582
|
const mapStatesToProps = () => createStructuredSelector({
|
|
@@ -14,10 +14,6 @@ export default defineMessages({
|
|
|
14
14
|
id: 'creatives.containersV2.Creatives.continue',
|
|
15
15
|
defaultMessage: 'Continue',
|
|
16
16
|
},
|
|
17
|
-
"emailBodyEmptyError": {
|
|
18
|
-
id: 'creatives.componentsV2.FormBuilder.emailBodyEmptyError',
|
|
19
|
-
defaultMessage: 'Mobile push body cannot be empty',
|
|
20
|
-
},
|
|
21
17
|
"lastUpdated": {
|
|
22
18
|
id: 'creatives.containersV2.Creatives.lastUpdated',
|
|
23
19
|
defaultMessage: 'Last updated: {date} by {user}',
|
|
@@ -215,13 +215,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
215
215
|
footer={
|
|
216
216
|
<SlideBoxFooter
|
|
217
217
|
currentChannel="WHATSAPP"
|
|
218
|
-
|
|
219
|
-
errorMessages={
|
|
220
|
-
Object {
|
|
221
|
-
"LIQUID_ERROR_MSG": Array [],
|
|
222
|
-
"STANDARD_ERROR_MSG": Array [],
|
|
223
|
-
}
|
|
224
|
-
}
|
|
218
|
+
errorMessages={Array []}
|
|
225
219
|
isLiquidValidationError={false}
|
|
226
220
|
onCreateNextStep={[Function]}
|
|
227
221
|
onDiscard={[Function]}
|
|
@@ -307,13 +301,7 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
307
301
|
footer={
|
|
308
302
|
<SlideBoxFooter
|
|
309
303
|
currentChannel="WHATSAPP"
|
|
310
|
-
|
|
311
|
-
errorMessages={
|
|
312
|
-
Object {
|
|
313
|
-
"LIQUID_ERROR_MSG": Array [],
|
|
314
|
-
"STANDARD_ERROR_MSG": Array [],
|
|
315
|
-
}
|
|
316
|
-
}
|
|
304
|
+
errorMessages={Array []}
|
|
317
305
|
isLiquidValidationError={false}
|
|
318
306
|
onCreateNextStep={[Function]}
|
|
319
307
|
onDiscard={[Function]}
|
|
@@ -399,13 +387,7 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
399
387
|
footer={
|
|
400
388
|
<SlideBoxFooter
|
|
401
389
|
currentChannel="WHATSAPP"
|
|
402
|
-
|
|
403
|
-
errorMessages={
|
|
404
|
-
Object {
|
|
405
|
-
"LIQUID_ERROR_MSG": Array [],
|
|
406
|
-
"STANDARD_ERROR_MSG": Array [],
|
|
407
|
-
}
|
|
408
|
-
}
|
|
390
|
+
errorMessages={Array []}
|
|
409
391
|
isLiquidValidationError={false}
|
|
410
392
|
onCreateNextStep={[Function]}
|
|
411
393
|
onDiscard={[Function]}
|
|
@@ -955,7 +955,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
955
955
|
}
|
|
956
956
|
temp.injectedEvents = {};
|
|
957
957
|
_.forEach(col.supportedEvents, (event) => {
|
|
958
|
-
|
|
958
|
+
console.log('injected event for ', col, event, this.getMappedEvent(col.id, event));
|
|
959
959
|
temp.injectedEvents[event] = this.getMappedEvent(col.id, event);
|
|
960
960
|
});
|
|
961
961
|
|
|
@@ -1135,7 +1135,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
1135
1135
|
}
|
|
1136
1136
|
|
|
1137
1137
|
cloneParent(section, tabIndex) {
|
|
1138
|
-
|
|
1138
|
+
console.log('trying to clone', JSON.stringify(section), tabIndex);
|
|
1139
1139
|
const parentsect = section;
|
|
1140
1140
|
const childSectionsBeforeCloning = parentsect.childSections.slice();
|
|
1141
1141
|
const childSections = [];
|
|
@@ -1152,7 +1152,7 @@ export class Ebill extends React.Component { // eslint-disable-line react/prefer
|
|
|
1152
1152
|
childSections.push(sect);
|
|
1153
1153
|
return true;
|
|
1154
1154
|
});
|
|
1155
|
-
|
|
1155
|
+
console.log('returning cloned parent section final 1', JSON.stringify(childSections));
|
|
1156
1156
|
parentsect.childSections = childSections;
|
|
1157
1157
|
|
|
1158
1158
|
return _.cloneDeep(parentsect);
|
|
@@ -138,7 +138,7 @@ const EmailWrapperView = ({
|
|
|
138
138
|
emailProps,
|
|
139
139
|
cmsTemplatesProps,
|
|
140
140
|
}) => {
|
|
141
|
-
|
|
141
|
+
console.log("EmailLayout", step, emailCreateMode);
|
|
142
142
|
const isShowTemplateSelection = step === STEPS.MODE_SELECTION || (step === STEPS.TEMPLATE_SELECTION && emailCreateMode === EMAIL_CREATE_MODES.UPLOAD);
|
|
143
143
|
|
|
144
144
|
return (
|
|
@@ -20,8 +20,7 @@ import {
|
|
|
20
20
|
isLoadingMetaEntities,
|
|
21
21
|
makeSelectMetaEntities,
|
|
22
22
|
setInjectedTags,
|
|
23
|
-
selectCurrentOrgDetails
|
|
24
|
-
selectLiquidStateDetails
|
|
23
|
+
selectCurrentOrgDetails
|
|
25
24
|
} from "../Cap/selectors";
|
|
26
25
|
import * as inAppActions from "./actions";
|
|
27
26
|
import './index.scss';
|
|
@@ -52,11 +51,7 @@ import { INAPP, SMS } from "../CreativesContainer/constants";
|
|
|
52
51
|
import { ALL, TAG, EMBEDDED, DEFAULT, FULL, LIBRARY } from "../Whatsapp/constants";
|
|
53
52
|
import CapDeviceContent from "../../v2Components/CapDeviceContent";
|
|
54
53
|
import { getCdnUrl } from "../../utils/cdnTransformation";
|
|
55
|
-
import { getCtaObject
|
|
56
|
-
import { validateInAppContent } from "../../utils/commonUtils";
|
|
57
|
-
import ErrorInfoNote from "../../v2Components/ErrorInfoNote";
|
|
58
|
-
import { hasLiquidSupportFeature } from "../../utils/common";
|
|
59
|
-
import formBuilderMessages from "../../v2Components/FormBuilder/messages";
|
|
54
|
+
import { getCtaObject } from "./utils";
|
|
60
55
|
let editContent = {};
|
|
61
56
|
|
|
62
57
|
export const InApp = (props) => {
|
|
@@ -77,10 +72,8 @@ export const InApp = (props) => {
|
|
|
77
72
|
injectedTags,
|
|
78
73
|
getFormData,
|
|
79
74
|
selectedOfferDetails,
|
|
80
|
-
currentOrgDetails
|
|
81
|
-
fetchingLiquidValidation,
|
|
75
|
+
currentOrgDetails
|
|
82
76
|
} = props || {};
|
|
83
|
-
const isLiquidFlow = hasLiquidSupportFeature();
|
|
84
77
|
const { formatMessage } = intl;
|
|
85
78
|
const [titleAndroid, setTitleAndroid] = useState("");
|
|
86
79
|
const [titleIos, setTitleIos] = useState("");
|
|
@@ -128,18 +121,6 @@ export const InApp = (props) => {
|
|
|
128
121
|
const isAiContentBotDisabled = accessibleFeatures?.includes(
|
|
129
122
|
AI_CONTENT_BOT_DISABLED
|
|
130
123
|
);
|
|
131
|
-
const [errorMessage, setErrorMessage] = useState({
|
|
132
|
-
STANDARD_ERROR_MSG: {
|
|
133
|
-
ANDROID: [],
|
|
134
|
-
IOS: [],
|
|
135
|
-
GENERIC: [],
|
|
136
|
-
},
|
|
137
|
-
LIQUID_ERROR_MSG: {
|
|
138
|
-
ANDROID: [],
|
|
139
|
-
IOS: [],
|
|
140
|
-
GENERIC: [],
|
|
141
|
-
},
|
|
142
|
-
});
|
|
143
124
|
|
|
144
125
|
//gets account details
|
|
145
126
|
useEffect(() => {
|
|
@@ -618,54 +599,47 @@ export const InApp = (props) => {
|
|
|
618
599
|
sourceAccountIdentifier = "",
|
|
619
600
|
id,
|
|
620
601
|
} = accountObj;
|
|
621
|
-
|
|
622
|
-
// Construct Android content if not disabled
|
|
623
|
-
const androidContent = !isDisableDone(ANDROID) ? {
|
|
624
|
-
...commonDevicePayload,
|
|
625
|
-
title: titleAndroid,
|
|
626
|
-
message: templateMessageAndroid,
|
|
627
|
-
bodyType: templateLayoutType,
|
|
628
|
-
expandableDetails: {
|
|
629
|
-
style: BIG_TEXT,
|
|
630
|
-
message: templateMessageAndroid,
|
|
631
|
-
...androidMediaParams,
|
|
632
|
-
...(isBtnTypeCtaAndroid && {
|
|
633
|
-
ctas: getCtaPayload(ANDROID),
|
|
634
|
-
}),
|
|
635
|
-
},
|
|
636
|
-
custom: [],
|
|
637
|
-
...(deepLinkValueAndroid && {
|
|
638
|
-
ctas: [{type: DEEP_LINK, actionLink: deepLinkValueAndroid}],
|
|
639
|
-
}),
|
|
640
|
-
} : {};
|
|
641
|
-
|
|
642
|
-
// Construct iOS content if not disabled
|
|
643
|
-
const iosContent = !isDisableDone(IOS) ? {
|
|
644
|
-
...commonDevicePayload,
|
|
645
|
-
title: titleIos,
|
|
646
|
-
message: templateMessageIos,
|
|
647
|
-
bodyType: templateLayoutType,
|
|
648
|
-
expandableDetails: {
|
|
649
|
-
style: BIG_TEXT,
|
|
650
|
-
message: templateMessageIos,
|
|
651
|
-
...iosMediaParams,
|
|
652
|
-
...(isBtnTypeCTaIos && {
|
|
653
|
-
ctas: getCtaPayload(IOS),
|
|
654
|
-
}),
|
|
655
|
-
},
|
|
656
|
-
custom: [],
|
|
657
|
-
...(deepLinkValueIos && {
|
|
658
|
-
ctas: [{type: DEEP_LINK, actionLink: deepLinkValueIos}],
|
|
659
|
-
}),
|
|
660
|
-
} : {};
|
|
661
|
-
|
|
662
602
|
const data = {
|
|
663
603
|
name: templateName,
|
|
664
604
|
versions: {
|
|
665
605
|
base: {
|
|
666
606
|
content: {
|
|
667
|
-
ANDROID:
|
|
668
|
-
|
|
607
|
+
ANDROID: !isDisableDone(ANDROID) ? {
|
|
608
|
+
...commonDevicePayload,
|
|
609
|
+
title: titleAndroid,
|
|
610
|
+
message: templateMessageAndroid,
|
|
611
|
+
bodyType: templateLayoutType,
|
|
612
|
+
expandableDetails: {
|
|
613
|
+
style: BIG_TEXT,
|
|
614
|
+
message: templateMessageAndroid,
|
|
615
|
+
...androidMediaParams,
|
|
616
|
+
...(isBtnTypeCtaAndroid && {
|
|
617
|
+
ctas: getCtaPayload(ANDROID),
|
|
618
|
+
}),
|
|
619
|
+
},
|
|
620
|
+
custom: [],
|
|
621
|
+
...(deepLinkValueAndroid && {
|
|
622
|
+
ctas: [{type: DEEP_LINK, actionLink: deepLinkValueAndroid}],
|
|
623
|
+
}),
|
|
624
|
+
} : {},
|
|
625
|
+
IOS: !isDisableDone(IOS) ? {
|
|
626
|
+
...commonDevicePayload,
|
|
627
|
+
title: titleIos,
|
|
628
|
+
message: templateMessageIos,
|
|
629
|
+
bodyType: templateLayoutType,
|
|
630
|
+
expandableDetails: {
|
|
631
|
+
style: BIG_TEXT,
|
|
632
|
+
message: templateMessageIos,
|
|
633
|
+
...iosMediaParams,
|
|
634
|
+
...(isBtnTypeCTaIos && {
|
|
635
|
+
ctas: getCtaPayload(IOS),
|
|
636
|
+
}),
|
|
637
|
+
},
|
|
638
|
+
custom: [],
|
|
639
|
+
...(deepLinkValueIos && {
|
|
640
|
+
ctas: [{type: DEEP_LINK, actionLink: deepLinkValueIos}],
|
|
641
|
+
}),
|
|
642
|
+
} : {},
|
|
669
643
|
},
|
|
670
644
|
},
|
|
671
645
|
},
|
|
@@ -729,61 +703,21 @@ export const InApp = (props) => {
|
|
|
729
703
|
const onDoneCallback = () => {
|
|
730
704
|
if (isFullMode) {
|
|
731
705
|
if (isEditFlow) {
|
|
732
|
-
return onEditInApp
|
|
706
|
+
return onEditInApp;
|
|
733
707
|
}
|
|
734
|
-
return onCreateInApp
|
|
708
|
+
return onCreateInApp;
|
|
735
709
|
}
|
|
736
|
-
return
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
const liquidMiddleWare = () => {
|
|
745
|
-
// Set up callbacks for validation results
|
|
746
|
-
const onError = ({ standardErrors, liquidErrors }) => {
|
|
747
|
-
setErrorMessage((prev) => ({
|
|
748
|
-
STANDARD_ERROR_MSG: { ...prev.STANDARD_ERROR_MSG, ...standardErrors },
|
|
749
|
-
LIQUID_ERROR_MSG: { ...prev.LIQUID_ERROR_MSG, ...liquidErrors },
|
|
750
|
-
}));
|
|
751
|
-
};
|
|
752
|
-
const onSuccess = () => {
|
|
753
|
-
// Proceed with submission when validation is successful
|
|
754
|
-
onDoneCallback();
|
|
755
|
-
};
|
|
756
|
-
|
|
757
|
-
// Validate the INAPP content
|
|
758
|
-
const payload = createPayload();
|
|
759
|
-
validateInAppContent(payload, {
|
|
760
|
-
currentTab: panes === ANDROID ? 1 : 2, // Convert ANDROID/IOS to tab numbers
|
|
761
|
-
onError,
|
|
762
|
-
onSuccess,
|
|
763
|
-
getLiquidTags: (content, callback) => globalActions.getLiquidTags(content, callback),
|
|
764
|
-
formatMessage,
|
|
765
|
-
messages: globalMessages,
|
|
766
|
-
tagLookupMap: metaEntities?.tagLookupMap || {},
|
|
767
|
-
eventContextTags: metaEntities?.eventContextTags || [],
|
|
768
|
-
isLiquidFlow,
|
|
769
|
-
forwardedTags: {},
|
|
770
|
-
skipTags: (tag) => {
|
|
771
|
-
// Skip certain tags if needed
|
|
772
|
-
const skipRegexes = [
|
|
773
|
-
/dynamic_expiry_date_after_\d+_days\.FORMAT_\d/,
|
|
774
|
-
/unsubscribe\(#[a-zA-Z\d]{6}\)/,
|
|
775
|
-
/Link_to_[a-zA-z]/,
|
|
776
|
-
/SURVEY.*\.TOKEN/,
|
|
777
|
-
/^[A-Za-z].*\([a-zA-Z\d]*\)/,
|
|
778
|
-
];
|
|
779
|
-
|
|
780
|
-
return skipRegexes.some((regex) => regex.test(tag));
|
|
781
|
-
},
|
|
782
|
-
});
|
|
710
|
+
return () =>
|
|
711
|
+
getFormData({
|
|
712
|
+
value: createPayload(),
|
|
713
|
+
_id: params && params.id,
|
|
714
|
+
validity: true,
|
|
715
|
+
type: INAPP,
|
|
716
|
+
});
|
|
783
717
|
};
|
|
784
718
|
|
|
785
719
|
return (
|
|
786
|
-
<CapSpin spinning={spin
|
|
720
|
+
<CapSpin spinning={spin}>
|
|
787
721
|
<CapRow className="cap-inapp-creatives">
|
|
788
722
|
<CapColumn span={14}>
|
|
789
723
|
{isFullMode && createModeContent}
|
|
@@ -828,14 +762,8 @@ export const InApp = (props) => {
|
|
|
828
762
|
<div className={`inapp-footer ${!isFullMode && `inapp-footer-lib`}`}>
|
|
829
763
|
{
|
|
830
764
|
<>
|
|
831
|
-
{hasAnyErrors(errorMessage) && (
|
|
832
|
-
<ErrorInfoNote
|
|
833
|
-
errorMessages={errorMessage}
|
|
834
|
-
currentTab={panes}
|
|
835
|
-
/>
|
|
836
|
-
)}
|
|
837
765
|
<CapButton
|
|
838
|
-
onClick={
|
|
766
|
+
onClick={onDoneCallback()}
|
|
839
767
|
disabled={isDisableDone(panes)}
|
|
840
768
|
className="inapp-create-btn"
|
|
841
769
|
>
|
|
@@ -865,7 +793,6 @@ const mapStateToProps = createStructuredSelector({
|
|
|
865
793
|
loadingTags: isLoadingMetaEntities(),
|
|
866
794
|
injectedTags: setInjectedTags(),
|
|
867
795
|
currentOrgDetails: selectCurrentOrgDetails(),
|
|
868
|
-
fetchingLiquidValidation: selectLiquidStateDetails()
|
|
869
796
|
});
|
|
870
797
|
|
|
871
798
|
const mapDispatchToProps = (dispatch) => ({
|
|
@@ -85,7 +85,7 @@ describe('Test activity inApp container', () => {
|
|
|
85
85
|
});
|
|
86
86
|
expect(updateBtn).toBeEnabled();
|
|
87
87
|
fireEvent.click(updateBtn);
|
|
88
|
-
expect(mockActions.editTemplate).
|
|
88
|
+
expect(mockActions.editTemplate).toBeCalled();
|
|
89
89
|
});
|
|
90
90
|
it('test case for inApp template configuration', async () => {
|
|
91
91
|
renderComponent({
|
|
@@ -387,7 +387,7 @@ describe('test for getTemplateDetails', () => {
|
|
|
387
387
|
expect(gen.next().value).toEqual(
|
|
388
388
|
takeLatest(types.GET_INAPP_TEMPLATE_DETAILS_REQUEST, sagas.getTemplateDetails),
|
|
389
389
|
);
|
|
390
|
-
|
|
390
|
+
console.log('gen.next().value', gen.next());
|
|
391
391
|
// Pass the mock task to the takeLatest effect
|
|
392
392
|
expect(gen.next(mockTask).done).toBe(true);
|
|
393
393
|
|