@capillarytech/creatives-library 8.0.113 → 8.0.114-alpha.0
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/App/test/saga.test.js +1 -1
- package/containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +1 -1
- package/containers/Assets/Gallery/tests/actions.test.js +2 -3
- package/containers/Assets/Gallery/tests/reducer.test.js +7 -7
- package/containers/Assets/Gallery/tests/saga.test.js +9 -9
- package/containers/Dashboard/test/saga.test.js +1 -1
- package/containers/Ebill/test/saga.test.js +1 -1
- package/containers/Email/test/saga.test.js +33 -33
- package/containers/LanguageProvider/tests/actions.test.js +1 -1
- package/containers/LanguageProvider/tests/reducer.test.js +2 -2
- package/containers/LanguageProvider/tests/selectors.test.js +1 -1
- package/containers/Line/Create/tests/saga.test.js +2 -9
- package/containers/Line/Edit/test/saga.test.js +10 -14
- package/containers/MobilePush/Create/test/saga.test.js +2 -2
- package/containers/MobilePush/Edit/tests/saga.test.js +14 -14
- package/containers/Sms/Create/test/saga.test.js +4 -5
- package/containers/Sms/Edit/test/saga.test.js +1 -1
- package/containers/Templates/test/saga.test.js +14 -17
- package/containers/WeChat/MapTemplates/test/saga.test.js +9 -13
- package/containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +1 -1
- package/containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +1 -1
- package/package.json +1 -1
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +8 -9
- package/utils/commonUtils.js +389 -3
- package/utils/tagValidations.js +20 -5
- package/utils/tests/authWrapper.test.js +2 -2
- package/utils/tests/cdnTransformation.test.js +16 -15
- package/utils/tests/commonUtil.test.js +324 -178
- package/v2Components/CapVideoUpload/tests/index.test.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +1 -2
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.js +130 -0
- package/v2Components/ErrorInfoNote/ErrorTypeRenderer.test.js +146 -0
- package/v2Components/ErrorInfoNote/index.js +114 -46
- package/v2Components/ErrorInfoNote/messages.js +25 -0
- package/v2Components/ErrorInfoNote/style.scss +14 -1
- package/v2Components/ErrorInfoNote/utils.js +28 -0
- package/v2Components/ErrorInfoNote/utils.test.js +93 -0
- package/v2Components/FormBuilder/index.js +200 -127
- package/v2Components/FormBuilder/messages.js +1 -1
- package/v2Components/MarketingObjective/test/index.test.js +1 -1
- package/v2Components/NavigationBar/tests/saga.test.js +2 -3
- package/v2Containers/Assets/Gallery/tests/__snapshots__/reducer.test.js.snap +1 -1
- package/v2Containers/Assets/Gallery/tests/actions.test.js +2 -3
- package/v2Containers/Assets/Gallery/tests/reducer.test.js +7 -7
- package/v2Containers/Assets/Gallery/tests/saga.test.js +2 -2
- package/v2Containers/BeeEditor/test/saga.test.js +1 -1
- package/v2Containers/CallTask/test/saga.test.js +1 -1
- package/v2Containers/Cap/reducer.js +4 -4
- package/v2Containers/Cap/tests/actions.test.js +1 -1
- package/v2Containers/Cap/tests/reducer.test.js +11 -11
- package/v2Containers/Cap/tests/saga.test.js +1 -1
- package/v2Containers/Cap/tests/selectors.test.js +3 -3
- package/v2Containers/CapFacebookPreview/tests/saga.test.js +1 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +23 -3
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +3 -1
- package/v2Containers/CreativesContainer/constants.js +2 -1
- package/v2Containers/CreativesContainer/index.js +37 -10
- package/v2Containers/CreativesContainer/messages.js +4 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +21 -3
- package/v2Containers/Ebill/index.js +3 -3
- package/v2Containers/Ebill/test/saga.test.js +1 -1
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +4 -4
- package/v2Containers/Email/tests/actions.test.js +1 -1
- package/v2Containers/Email/tests/reducer.test.js +2 -2
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +1 -1
- package/v2Containers/FTP/test/saga.test.js +1 -1
- package/v2Containers/Facebook/test/saga.test.js +7 -7
- package/v2Containers/InApp/index.js +127 -49
- package/v2Containers/InApp/tests/action.test.js +7 -7
- package/v2Containers/InApp/tests/index.test.js +2 -4
- package/v2Containers/InApp/tests/reducer.test.js +175 -89
- package/v2Containers/InApp/tests/sagas.test.js +1 -1
- package/v2Containers/InApp/utils.js +37 -0
- package/v2Containers/LanguageProvider/tests/actions.test.js +1 -1
- package/v2Containers/LanguageProvider/tests/reducer.test.js +3 -3
- package/v2Containers/LanguageProvider/tests/saga.test.js +2 -2
- package/v2Containers/LanguageProvider/tests/selectors.test.js +1 -1
- package/v2Containers/Line/Container/ImageCarousel/tests/utils.test.js +3 -3
- package/v2Containers/Line/Container/Sticker/tests/utils.test.js +6 -6
- package/v2Containers/MobilePush/Create/index.js +24 -20
- package/v2Containers/MobilePush/Create/test/saga.test.js +2 -2
- package/v2Containers/MobilePush/Edit/index.js +4 -1
- package/v2Containers/MobilePush/Edit/test/saga.test.js +14 -14
- package/v2Containers/MobilepushWrapper/index.js +2 -0
- package/v2Containers/Rcs/tests/saga.test.js +1 -1
- package/v2Containers/Sms/Create/index.js +14 -2
- package/v2Containers/Sms/Create/test/saga.test.js +1 -1
- package/v2Containers/Sms/Edit/index.js +2 -0
- package/v2Containers/Sms/Edit/test/saga.test.js +5 -5
- package/v2Containers/SmsTrai/Create/tests/saga.test.js +1 -1
- package/v2Containers/SmsTrai/Create/tests/selectors.test.js +1 -1
- package/v2Containers/SmsWrapper/index.js +2 -0
- package/v2Containers/TagList/tests/TagList.test.js +1 -3
- package/v2Containers/TagList/tests/utils.test.js +3 -3
- package/v2Containers/Templates/tests/actions.test.js +1 -1
- package/v2Containers/Templates/tests/reducer.test.js +8 -8
- package/v2Containers/Templates/tests/sagas.test.js +2 -4
- package/v2Containers/WeChat/MapTemplates/test/saga.test.js +9 -13
- package/v2Containers/WeChat/RichmediaTemplates/Create/test/saga.test.js +1 -1
- package/v2Containers/WeChat/RichmediaTemplates/Edit/test/saga.test.js +1 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/utils.test.js.snap +9 -9
- package/v2Containers/Whatsapp/tests/actions.test.js +3 -3
- package/v2Containers/Whatsapp/tests/reducer.test.js +32 -36
- package/v2Containers/Whatsapp/tests/utils.test.js +19 -19
- package/v2Containers/Zalo/tests/actions.test.js +3 -3
- package/v2Containers/Zalo/tests/reducer.test.js +72 -42
|
@@ -9,7 +9,7 @@ import * as matchers from 'redux-saga-test-plan/matchers';
|
|
|
9
9
|
|
|
10
10
|
describe('Facebook Ad Management Sagas', () => {
|
|
11
11
|
describe('fetchMarketingObjectives Saga', () => {
|
|
12
|
-
it('handles successful fetching of marketing objectives', () => {
|
|
12
|
+
it.concurrent('handles successful fetching of marketing objectives', () => {
|
|
13
13
|
const fakeResponse = {
|
|
14
14
|
data: [{ id: 1, name: 'Increase Reach' }],
|
|
15
15
|
errors: []
|
|
@@ -26,7 +26,7 @@ describe('Facebook Ad Management Sagas', () => {
|
|
|
26
26
|
.run();
|
|
27
27
|
});
|
|
28
28
|
|
|
29
|
-
it('handles errors in fetching marketing objectives', () => {
|
|
29
|
+
it.concurrent('handles errors in fetching marketing objectives', () => {
|
|
30
30
|
const fakeResponse = {
|
|
31
31
|
errors: ['Error fetching data'],
|
|
32
32
|
data: null
|
|
@@ -47,7 +47,7 @@ describe('Facebook Ad Management Sagas', () => {
|
|
|
47
47
|
describe('getOrgOUs Saga', () => {
|
|
48
48
|
const orgID = '123';
|
|
49
49
|
|
|
50
|
-
it('handles successful fetching of org OUs', () => {
|
|
50
|
+
it.concurrent('handles successful fetching of org OUs', () => {
|
|
51
51
|
const fakeResponse = {
|
|
52
52
|
status: 200,
|
|
53
53
|
result: [{ id: 1, name: 'Org Unit One' }],
|
|
@@ -64,7 +64,7 @@ describe('Facebook Ad Management Sagas', () => {
|
|
|
64
64
|
.run();
|
|
65
65
|
});
|
|
66
66
|
|
|
67
|
-
it('handles failure in fetching org OUs', () => {
|
|
67
|
+
it.concurrent('handles failure in fetching org OUs', () => {
|
|
68
68
|
const error = new Error('Fetch failed');
|
|
69
69
|
|
|
70
70
|
return expectSaga(sagas.getOrgOUs, { orgID })
|
|
@@ -84,7 +84,7 @@ describe('Facebook Ad Management Sagas', () => {
|
|
|
84
84
|
const assetType = 'video';
|
|
85
85
|
const fileParams = {};
|
|
86
86
|
|
|
87
|
-
it('handles successful asset upload', () => {
|
|
87
|
+
it.concurrent('handles successful asset upload', () => {
|
|
88
88
|
const uploadResponse = {
|
|
89
89
|
status: { code: 200 },
|
|
90
90
|
response: { asset: { id: 1, metaInfo: { secure_file_path: 'http://example.com/ad.mp4' } } }
|
|
@@ -114,7 +114,7 @@ describe('Facebook Ad Management Sagas', () => {
|
|
|
114
114
|
.run();
|
|
115
115
|
});
|
|
116
116
|
|
|
117
|
-
it('handles failure in asset upload', () => {
|
|
117
|
+
it.concurrent('handles failure in asset upload', () => {
|
|
118
118
|
const error = new Error('Upload failed');
|
|
119
119
|
|
|
120
120
|
return expectSaga(sagas.uploadFbAdAsset, file, assetType, fileParams)
|
|
@@ -132,7 +132,7 @@ describe('Facebook Ad Management Sagas', () => {
|
|
|
132
132
|
|
|
133
133
|
// Test combined saga
|
|
134
134
|
describe('Combined v2FacebookSagas', () => {
|
|
135
|
-
it('should initialize all Facebook-related watcher sagas without error', () => {
|
|
135
|
+
it.concurrent('should initialize all Facebook-related watcher sagas without error', () => {
|
|
136
136
|
return expectSaga(v2FacebookSagas)
|
|
137
137
|
.run();
|
|
138
138
|
});
|
|
@@ -20,7 +20,8 @@ import {
|
|
|
20
20
|
isLoadingMetaEntities,
|
|
21
21
|
makeSelectMetaEntities,
|
|
22
22
|
setInjectedTags,
|
|
23
|
-
selectCurrentOrgDetails
|
|
23
|
+
selectCurrentOrgDetails,
|
|
24
|
+
selectLiquidStateDetails
|
|
24
25
|
} from "../Cap/selectors";
|
|
25
26
|
import * as inAppActions from "./actions";
|
|
26
27
|
import './index.scss';
|
|
@@ -51,7 +52,11 @@ import { INAPP, SMS } from "../CreativesContainer/constants";
|
|
|
51
52
|
import { ALL, TAG, EMBEDDED, DEFAULT, FULL, LIBRARY } from "../Whatsapp/constants";
|
|
52
53
|
import CapDeviceContent from "../../v2Components/CapDeviceContent";
|
|
53
54
|
import { getCdnUrl } from "../../utils/cdnTransformation";
|
|
54
|
-
import { getCtaObject } from "./utils";
|
|
55
|
+
import { getCtaObject, hasAnyErrors } from "./utils";
|
|
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";
|
|
55
60
|
let editContent = {};
|
|
56
61
|
|
|
57
62
|
export const InApp = (props) => {
|
|
@@ -72,8 +77,10 @@ export const InApp = (props) => {
|
|
|
72
77
|
injectedTags,
|
|
73
78
|
getFormData,
|
|
74
79
|
selectedOfferDetails,
|
|
75
|
-
currentOrgDetails
|
|
80
|
+
currentOrgDetails,
|
|
81
|
+
fetchingLiquidValidation,
|
|
76
82
|
} = props || {};
|
|
83
|
+
const isLiquidFlow = !hasLiquidSupportFeature();
|
|
77
84
|
const { formatMessage } = intl;
|
|
78
85
|
const [titleAndroid, setTitleAndroid] = useState("");
|
|
79
86
|
const [titleIos, setTitleIos] = useState("");
|
|
@@ -121,6 +128,18 @@ export const InApp = (props) => {
|
|
|
121
128
|
const isAiContentBotDisabled = accessibleFeatures?.includes(
|
|
122
129
|
AI_CONTENT_BOT_DISABLED
|
|
123
130
|
);
|
|
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
|
+
});
|
|
124
143
|
|
|
125
144
|
//gets account details
|
|
126
145
|
useEffect(() => {
|
|
@@ -599,47 +618,54 @@ export const InApp = (props) => {
|
|
|
599
618
|
sourceAccountIdentifier = "",
|
|
600
619
|
id,
|
|
601
620
|
} = 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
|
+
|
|
602
662
|
const data = {
|
|
603
663
|
name: templateName,
|
|
604
664
|
versions: {
|
|
605
665
|
base: {
|
|
606
666
|
content: {
|
|
607
|
-
ANDROID:
|
|
608
|
-
|
|
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
|
-
} : {},
|
|
667
|
+
ANDROID: androidContent,
|
|
668
|
+
IOS: iosContent,
|
|
643
669
|
},
|
|
644
670
|
},
|
|
645
671
|
},
|
|
@@ -703,21 +729,66 @@ export const InApp = (props) => {
|
|
|
703
729
|
const onDoneCallback = () => {
|
|
704
730
|
if (isFullMode) {
|
|
705
731
|
if (isEditFlow) {
|
|
706
|
-
return onEditInApp;
|
|
732
|
+
return onEditInApp();
|
|
707
733
|
}
|
|
708
|
-
return onCreateInApp;
|
|
734
|
+
return onCreateInApp();
|
|
709
735
|
}
|
|
710
|
-
return (
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
736
|
+
return getFormData({
|
|
737
|
+
value: createPayload(),
|
|
738
|
+
_id: params && params.id,
|
|
739
|
+
validity: true,
|
|
740
|
+
type: INAPP,
|
|
741
|
+
});
|
|
742
|
+
};
|
|
743
|
+
|
|
744
|
+
const liquidMiddleWare = () => {
|
|
745
|
+
// Set up callbacks for validation results
|
|
746
|
+
const onError = ({ standardErrors, liquidErrors }) => {
|
|
747
|
+
|
|
748
|
+
setErrorMessage({
|
|
749
|
+
STANDARD_ERROR_MSG: standardErrors,
|
|
750
|
+
LIQUID_ERROR_MSG: liquidErrors,
|
|
716
751
|
});
|
|
752
|
+
};
|
|
753
|
+
|
|
754
|
+
const onSuccess = () => {
|
|
755
|
+
|
|
756
|
+
// setSpin(false);
|
|
757
|
+
// Proceed with submission when validation is successful
|
|
758
|
+
onDoneCallback();
|
|
759
|
+
};
|
|
760
|
+
|
|
761
|
+
// Validate the INAPP content
|
|
762
|
+
const payload = createPayload();
|
|
763
|
+
|
|
764
|
+
validateInAppContent(payload, {
|
|
765
|
+
currentTab: panes === ANDROID ? 1 : 2, // Convert ANDROID/IOS to tab numbers
|
|
766
|
+
onError,
|
|
767
|
+
onSuccess,
|
|
768
|
+
getLiquidTags: (content, callback) => globalActions.getLiquidTags(content, callback),
|
|
769
|
+
formatMessage,
|
|
770
|
+
messages: globalMessages,
|
|
771
|
+
tagLookupMap: metaEntities?.tagLookupMap || {},
|
|
772
|
+
eventContextTags: metaEntities?.eventContextTags || [],
|
|
773
|
+
isLiquidFlow,
|
|
774
|
+
forwardedTags: {},
|
|
775
|
+
skipTags: (tag) => {
|
|
776
|
+
// Skip certain tags if needed
|
|
777
|
+
const skipRegexes = [
|
|
778
|
+
/dynamic_expiry_date_after_\d+_days\.FORMAT_\d/,
|
|
779
|
+
/unsubscribe\(#[a-zA-Z\d]{6}\)/,
|
|
780
|
+
/Link_to_[a-zA-z]/,
|
|
781
|
+
/SURVEY.*\.TOKEN/,
|
|
782
|
+
/^[A-Za-z].*\([a-zA-Z\d]*\)/,
|
|
783
|
+
];
|
|
784
|
+
|
|
785
|
+
return skipRegexes.some((regex) => regex.test(tag));
|
|
786
|
+
},
|
|
787
|
+
});
|
|
717
788
|
};
|
|
718
789
|
|
|
719
790
|
return (
|
|
720
|
-
<CapSpin spinning={spin}>
|
|
791
|
+
<CapSpin spinning={spin || fetchingLiquidValidation} tip={fetchingLiquidValidation ? <FormattedMessage {...formBuilderMessages.liquidSpinText} /> : ""}>
|
|
721
792
|
<CapRow className="cap-inapp-creatives">
|
|
722
793
|
<CapColumn span={14}>
|
|
723
794
|
{isFullMode && createModeContent}
|
|
@@ -762,8 +833,14 @@ export const InApp = (props) => {
|
|
|
762
833
|
<div className={`inapp-footer ${!isFullMode && `inapp-footer-lib`}`}>
|
|
763
834
|
{
|
|
764
835
|
<>
|
|
836
|
+
{hasAnyErrors(errorMessage) && (
|
|
837
|
+
<ErrorInfoNote
|
|
838
|
+
errorMessages={errorMessage}
|
|
839
|
+
currentTab={panes}
|
|
840
|
+
/>
|
|
841
|
+
)}
|
|
765
842
|
<CapButton
|
|
766
|
-
onClick={onDoneCallback
|
|
843
|
+
onClick={isLiquidFlow ? liquidMiddleWare : onDoneCallback}
|
|
767
844
|
disabled={isDisableDone(panes)}
|
|
768
845
|
className="inapp-create-btn"
|
|
769
846
|
>
|
|
@@ -793,6 +870,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
793
870
|
loadingTags: isLoadingMetaEntities(),
|
|
794
871
|
injectedTags: setInjectedTags(),
|
|
795
872
|
currentOrgDetails: selectCurrentOrgDetails(),
|
|
873
|
+
fetchingLiquidValidation: selectLiquidStateDetails()
|
|
796
874
|
});
|
|
797
875
|
|
|
798
876
|
const mapDispatchToProps = (dispatch) => ({
|
|
@@ -2,7 +2,7 @@ import * as types from "../constants";
|
|
|
2
2
|
import * as actions from "../actions";
|
|
3
3
|
|
|
4
4
|
describe("Test inapp actions", () => {
|
|
5
|
-
|
|
5
|
+
test.concurrent("has a type of INAPP_TEMPLATE_CREATE_REQUEST action", () => {
|
|
6
6
|
const payload = {};
|
|
7
7
|
const expected = {
|
|
8
8
|
type: types.INAPP_TEMPLATE_CREATE_REQUEST,
|
|
@@ -11,25 +11,25 @@ describe("Test inapp actions", () => {
|
|
|
11
11
|
expect(actions.createInAppTemplate(payload)).toEqual(expected);
|
|
12
12
|
});
|
|
13
13
|
|
|
14
|
-
|
|
14
|
+
test.concurrent("has a type of CLEAR_CREATE_RESPONSE_REQUEST action", () => {
|
|
15
15
|
const expected = {
|
|
16
16
|
type: types.CLEAR_CREATE_RESPONSE_REQUEST,
|
|
17
17
|
};
|
|
18
18
|
expect(actions.clearCreateResponse()).toEqual(expected);
|
|
19
19
|
});
|
|
20
|
-
|
|
20
|
+
test.concurrent("has a type of INAPP_EDIT_TEMPLATE_REQUEST action", () => {
|
|
21
21
|
const expected = {
|
|
22
22
|
type: types.INAPP_EDIT_TEMPLATE_REQUEST,
|
|
23
23
|
};
|
|
24
24
|
expect(actions.editTemplate()).toEqual(expected);
|
|
25
25
|
});
|
|
26
|
-
|
|
26
|
+
test.concurrent("has a type of RESET_EDIT_TEMPLATE action", () => {
|
|
27
27
|
const expected = {
|
|
28
28
|
type: types.RESET_EDIT_TEMPLATE,
|
|
29
29
|
};
|
|
30
30
|
expect(actions.resetEditTemplate()).toEqual(expected);
|
|
31
31
|
});
|
|
32
|
-
|
|
32
|
+
test.concurrent("has a type of GET_INAPP_TEMPLATE_DETAILS_REQUEST action", () => {
|
|
33
33
|
const expected = {
|
|
34
34
|
type: types.GET_INAPP_TEMPLATE_DETAILS_REQUEST,
|
|
35
35
|
callback: undefined,
|
|
@@ -38,13 +38,13 @@ describe("Test inapp actions", () => {
|
|
|
38
38
|
};
|
|
39
39
|
expect(actions.getTemplateDetails()).toEqual(expected);
|
|
40
40
|
});
|
|
41
|
-
|
|
41
|
+
test.concurrent("has a type of UPLOAD_INAPP_ASSET_REQUEST action", () => {
|
|
42
42
|
const expected = {
|
|
43
43
|
type: types.UPLOAD_INAPP_ASSET_REQUEST,
|
|
44
44
|
};
|
|
45
45
|
expect(actions.uploadInAppAsset()).toEqual(expected);
|
|
46
46
|
});
|
|
47
|
-
|
|
47
|
+
test.concurrent("has a type of CLEAR_INAPP_ASSET action", () => {
|
|
48
48
|
const expected = {
|
|
49
49
|
type: types.CLEAR_INAPP_ASSET,
|
|
50
50
|
};
|
|
@@ -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).toHaveBeenCalled();
|
|
89
89
|
});
|
|
90
90
|
it('test case for inApp template configuration', async () => {
|
|
91
91
|
renderComponent({
|
|
@@ -109,9 +109,7 @@ describe('Test activity inApp container', () => {
|
|
|
109
109
|
const msgBox = screen.getAllByPlaceholderText(/Please input in-app notification message content/i);
|
|
110
110
|
msgBox[0].focus();
|
|
111
111
|
fireEvent.change(msgBox[0], { target: { value: 'val' }});
|
|
112
|
-
const doneBtn = screen.
|
|
113
|
-
name: /done/i,
|
|
114
|
-
});
|
|
112
|
+
const doneBtn = screen.getByText(/done/i);
|
|
115
113
|
expect(doneBtn).toBeEnabled();
|
|
116
114
|
});
|
|
117
115
|
it('test case for inApp template copy content flow', async () => {
|