@capillarytech/creatives-library 8.0.145 → 8.0.147-beta.5
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/initialReducer.js +0 -2
- package/package.json +1 -1
- package/services/api.js +0 -5
- package/services/tests/api.test.js +0 -17
- package/utils/tests/transformerUtils.test.js +861 -1
- package/utils/transformerUtils.js +168 -0
- package/v2Components/MobilePushPreviewV2/index.js +0 -8
- package/v2Components/NavigationBar/saga.js +1 -1
- package/v2Components/NavigationBar/tests/saga.test.js +2 -2
- package/v2Components/TemplatePreview/index.js +2 -28
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/PreviewSection.js +1 -1
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -1
- package/v2Components/TestAndPreviewSlidebox/tests/PreviewSection.test.js +55 -56
- package/v2Containers/CreativesContainer/SlideBoxContent.js +8 -26
- package/v2Containers/CreativesContainer/index.js +10 -64
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +5 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +25 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -5
- package/v2Containers/Email/index.js +1 -1
- package/v2Containers/InApp/actions.js +0 -7
- package/v2Containers/InApp/constants.js +1 -8
- package/v2Containers/InApp/index.js +53 -76
- package/v2Containers/InApp/reducer.js +0 -17
- package/v2Containers/InApp/sagas.js +0 -27
- package/v2Containers/InApp/selectors.js +1 -23
- package/v2Containers/InApp/tests/index.test.js +9 -0
- package/v2Containers/InApp/tests/reducer.test.js +0 -33
- package/v2Containers/InApp/tests/sagas.test.js +1 -57
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +0 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +0 -2
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +0 -9
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +0 -18
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -35
- package/v2Components/TemplatePreview/assets/images/empty_android.svg +0 -8
- package/v2Components/TemplatePreview/assets/images/empty_ios.svg +0 -5
- package/v2Containers/BeePopupEditor/constants.js +0 -10
- package/v2Containers/BeePopupEditor/index.js +0 -169
- package/v2Containers/BeePopupEditor/tests/index.test.js +0 -628
- package/v2Containers/InApp/tests/selector.test.js +0 -612
- package/v2Containers/InappAdvanced/index.js +0 -459
- package/v2Containers/InappAdvanced/index.scss +0 -11
- package/v2Containers/InappAdvanced/tests/index.test.js +0 -442
- package/v2Containers/InappWrapper/_inappWrapper.scss +0 -19
- package/v2Containers/InappWrapper/index.js +0 -195
- package/v2Containers/InappWrapper/messages.js +0 -38
- package/v2Containers/InappWrapper/tests/index.test.js +0 -247
|
@@ -881,6 +881,31 @@ exports[`Test SlideBoxContent container Should render correct component for what
|
|
|
881
881
|
</SlideBoxContent__CreativesWrapper>
|
|
882
882
|
`;
|
|
883
883
|
|
|
884
|
+
exports[`Test SlideBoxContent container Should render correct component for whatsapp channel create mode 2`] = `
|
|
885
|
+
<SlideBoxContent__CreativesWrapper>
|
|
886
|
+
<ForwardRef
|
|
887
|
+
getDefaultTags=""
|
|
888
|
+
location={
|
|
889
|
+
Object {
|
|
890
|
+
"pathname": "/inapp/create",
|
|
891
|
+
"query": Object {
|
|
892
|
+
"isEditFromCampaigns": undefined,
|
|
893
|
+
"module": "library",
|
|
894
|
+
"type": "embedded",
|
|
895
|
+
},
|
|
896
|
+
"search": "",
|
|
897
|
+
}
|
|
898
|
+
}
|
|
899
|
+
onCreateComplete={[MockFunction]}
|
|
900
|
+
templateData={
|
|
901
|
+
Object {
|
|
902
|
+
"mode": "create",
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
/>
|
|
906
|
+
</SlideBoxContent__CreativesWrapper>
|
|
907
|
+
`;
|
|
908
|
+
|
|
884
909
|
exports[`Test SlideBoxContent container Should render correct component for whatsapp channel edit mode 1`] = `
|
|
885
910
|
<SlideBoxContent__CreativesWrapper>
|
|
886
911
|
<ForwardRef
|
|
@@ -31,7 +31,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click rcs
|
|
|
31
31
|
onEnterTemplateName={[Function]}
|
|
32
32
|
onFTPSubmit={[MockFunction]}
|
|
33
33
|
onFacebookSubmit={[MockFunction]}
|
|
34
|
-
onInAppModeChange={[Function]}
|
|
35
34
|
onMobilepushModeChange={[Function]}
|
|
36
35
|
onPreviewTemplate={[Function]}
|
|
37
36
|
onRemoveTemplateName={[Function]}
|
|
@@ -117,7 +116,6 @@ exports[`Test SlideBoxContent container campaign message, add creative click wha
|
|
|
117
116
|
onEnterTemplateName={[Function]}
|
|
118
117
|
onFTPSubmit={[MockFunction]}
|
|
119
118
|
onFacebookSubmit={[MockFunction]}
|
|
120
|
-
onInAppModeChange={[Function]}
|
|
121
119
|
onMobilepushModeChange={[Function]}
|
|
122
120
|
onPreviewTemplate={[Function]}
|
|
123
121
|
onRemoveTemplateName={[Function]}
|
|
@@ -203,7 +201,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit all data
|
|
|
203
201
|
onEnterTemplateName={[Function]}
|
|
204
202
|
onFTPSubmit={[MockFunction]}
|
|
205
203
|
onFacebookSubmit={[MockFunction]}
|
|
206
|
-
onInAppModeChange={[Function]}
|
|
207
204
|
onMobilepushModeChange={[Function]}
|
|
208
205
|
onPreviewTemplate={[Function]}
|
|
209
206
|
onRemoveTemplateName={[Function]}
|
|
@@ -301,7 +298,6 @@ exports[`Test SlideBoxContent container campaign message, whatsapp edit min data
|
|
|
301
298
|
onEnterTemplateName={[Function]}
|
|
302
299
|
onFTPSubmit={[MockFunction]}
|
|
303
300
|
onFacebookSubmit={[MockFunction]}
|
|
304
|
-
onInAppModeChange={[Function]}
|
|
305
301
|
onMobilepushModeChange={[Function]}
|
|
306
302
|
onPreviewTemplate={[Function]}
|
|
307
303
|
onRemoveTemplateName={[Function]}
|
|
@@ -399,7 +395,6 @@ exports[`Test SlideBoxContent container it should clear the url, on channel chan
|
|
|
399
395
|
onEnterTemplateName={[Function]}
|
|
400
396
|
onFTPSubmit={[MockFunction]}
|
|
401
397
|
onFacebookSubmit={[MockFunction]}
|
|
402
|
-
onInAppModeChange={[Function]}
|
|
403
398
|
onMobilepushModeChange={[Function]}
|
|
404
399
|
onPreviewTemplate={[Function]}
|
|
405
400
|
onRemoveTemplateName={[Function]}
|
|
@@ -2709,7 +2709,7 @@ export class Email extends React.Component { // eslint-disable-line react/prefer
|
|
|
2709
2709
|
return (
|
|
2710
2710
|
<div className="email-container">
|
|
2711
2711
|
<CapSpin spinning={isLoading}>
|
|
2712
|
-
{
|
|
2712
|
+
{ showTestAndPreview &&
|
|
2713
2713
|
<div className="test-and-preview-container">
|
|
2714
2714
|
{this.showTestAndPreviewIcons('PREVIEW')}
|
|
2715
2715
|
{this.showTestAndPreviewIcons('TEST')}
|
|
@@ -7,7 +7,6 @@ import {
|
|
|
7
7
|
UPLOAD_INAPP_ASSET_REQUEST,
|
|
8
8
|
CLEAR_INAPP_ASSET,
|
|
9
9
|
INAPP_EDIT_TEMPLATE_REQUEST,
|
|
10
|
-
GET_BEE_POPUP_BUILDER_TOKEN_REQUEST,
|
|
11
10
|
} from "./constants";
|
|
12
11
|
|
|
13
12
|
export function createInAppTemplate(payload, callback) {
|
|
@@ -63,9 +62,3 @@ export const clearInAppAsset = (templateType) => ({
|
|
|
63
62
|
type: CLEAR_INAPP_ASSET,
|
|
64
63
|
templateType,
|
|
65
64
|
});
|
|
66
|
-
|
|
67
|
-
export function getBeePopupBuilderToken() {
|
|
68
|
-
return {
|
|
69
|
-
type: GET_BEE_POPUP_BUILDER_TOKEN_REQUEST,
|
|
70
|
-
};
|
|
71
|
-
}
|
|
@@ -34,10 +34,6 @@ export const UPLOAD_INAPP_ASSET_SUCCESS = `${prefix}/UPLOAD_INAPP_ASSET_SUCCESS`
|
|
|
34
34
|
export const UPLOAD_INAPP_ASSET_FAILURE = `${prefix}/UPLOAD_INAPP_ASSET_FAILURE`;
|
|
35
35
|
export const CLEAR_INAPP_ASSET = `${prefix}/CLEAR_INAPP_ASSET`;
|
|
36
36
|
|
|
37
|
-
export const GET_BEE_POPUP_BUILDER_TOKEN_REQUEST = `${prefix}/GET_BEE_POPUP_BUILDER_TOKEN_REQUEST`;
|
|
38
|
-
export const GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS = `${prefix}/GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS`;
|
|
39
|
-
export const GET_BEE_POPUP_BUILDER_TOKEN_FAILURE = `${prefix}/GET_BEE_POPUP_BUILDER_TOKEN_FAILURE`;
|
|
40
|
-
|
|
41
37
|
export const INAPP_MEDIA_TYPES = {
|
|
42
38
|
TEXT: "TEXT",
|
|
43
39
|
IMAGE: "IMAGE",
|
|
@@ -163,7 +159,4 @@ export const INAPP_LAYOUT_DETAILS = {
|
|
|
163
159
|
};
|
|
164
160
|
|
|
165
161
|
export const DEVICE_SUPPORTED = '1';
|
|
166
|
-
export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";
|
|
167
|
-
export const MODE_SELECTION = "modeSelection";
|
|
168
|
-
export const BASIC_EDITOR = "basicEditor";
|
|
169
|
-
export const BEE_EDITOR = "beeEditor";
|
|
162
|
+
export const AI_CONTENT_BOT_DISABLED = "AI_CONTENT_BOT_DISABLED";
|
|
@@ -7,20 +7,21 @@ import { injectIntl, FormattedMessage } from "react-intl";
|
|
|
7
7
|
import { DAEMON } from '@capillarytech/vulcan-react-sdk/utils/sagaInjectorTypes';
|
|
8
8
|
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
|
|
9
9
|
import CapSpin from "@capillarytech/cap-ui-library/CapSpin";
|
|
10
|
+
import CapInput from "@capillarytech/cap-ui-library/CapInput";
|
|
10
11
|
import CapRadioGroup from "@capillarytech/cap-ui-library/CapRadioGroup";
|
|
11
12
|
import CapRow from "@capillarytech/cap-ui-library/CapRow";
|
|
12
13
|
import CapColumn from "@capillarytech/cap-ui-library/CapColumn";
|
|
13
14
|
import CapButton from "@capillarytech/cap-ui-library/CapButton";
|
|
14
15
|
import CapTab from "@capillarytech/cap-ui-library/CapTab";
|
|
15
16
|
import CapNotification from "@capillarytech/cap-ui-library/CapNotification";
|
|
16
|
-
import { makeSelectInApp, makeSelectAccount
|
|
17
|
+
import { makeSelectInApp, makeSelectAccount } from "./selectors";
|
|
17
18
|
import * as globalActions from '../Cap/actions';
|
|
18
19
|
import {
|
|
19
20
|
isLoadingMetaEntities,
|
|
20
21
|
makeSelectMetaEntities,
|
|
21
22
|
setInjectedTags,
|
|
22
23
|
selectCurrentOrgDetails,
|
|
23
|
-
selectLiquidStateDetails
|
|
24
|
+
selectLiquidStateDetails
|
|
24
25
|
} from "../Cap/selectors";
|
|
25
26
|
import * as inAppActions from "./actions";
|
|
26
27
|
import './index.scss';
|
|
@@ -58,7 +59,6 @@ import { validateInAppContent } from "../../utils/commonUtils";
|
|
|
58
59
|
import ErrorInfoNote from "../../v2Components/ErrorInfoNote";
|
|
59
60
|
import { hasLiquidSupportFeature } from "../../utils/common";
|
|
60
61
|
import formBuilderMessages from "../../v2Components/FormBuilder/messages";
|
|
61
|
-
import InappAdvanced from "../InappAdvanced/index";
|
|
62
62
|
|
|
63
63
|
let editContent = {};
|
|
64
64
|
|
|
@@ -82,18 +82,6 @@ export const InApp = (props) => {
|
|
|
82
82
|
selectedOfferDetails,
|
|
83
83
|
currentOrgDetails,
|
|
84
84
|
fetchingLiquidValidation,
|
|
85
|
-
templateName,
|
|
86
|
-
setTemplateName,
|
|
87
|
-
getTemplateDetailsInProgress,
|
|
88
|
-
isEditInApp,
|
|
89
|
-
setIsLoadingContent,
|
|
90
|
-
query,
|
|
91
|
-
inAppCreateMode,
|
|
92
|
-
isGetFormData,
|
|
93
|
-
showTemplateName,
|
|
94
|
-
onValidationFail,
|
|
95
|
-
type,
|
|
96
|
-
forwardedTags,
|
|
97
85
|
} = props || {};
|
|
98
86
|
|
|
99
87
|
const { formatMessage } = intl;
|
|
@@ -102,7 +90,7 @@ export const InApp = (props) => {
|
|
|
102
90
|
const [templateMediaType, setTemplateMediaType] = useState(
|
|
103
91
|
INAPP_MEDIA_TYPES.TEXT
|
|
104
92
|
);
|
|
105
|
-
|
|
93
|
+
const [templateName, setTemplateName] = useState("");
|
|
106
94
|
const [templateLayoutType, setTemplateLayoutType] = useState(
|
|
107
95
|
INAPP_MESSAGE_LAYOUT_TYPES.MODAL
|
|
108
96
|
);
|
|
@@ -128,7 +116,6 @@ export const InApp = (props) => {
|
|
|
128
116
|
const [tags, updateTags] = useState([]);
|
|
129
117
|
//for edit only
|
|
130
118
|
const [isEditFlow, setEditFlow] = useState(false);
|
|
131
|
-
const [tempName, setTempName] = useState("");
|
|
132
119
|
const [templateDate, setTemplateDate] = useState("");
|
|
133
120
|
|
|
134
121
|
//buttons
|
|
@@ -204,8 +191,8 @@ export const InApp = (props) => {
|
|
|
204
191
|
} = isFullMode ? editData?.templateDetails || {} : templateData || {};
|
|
205
192
|
editContent = get(versions, `base.content`, {});
|
|
206
193
|
if (editContent && !isEmpty(editContent)) {
|
|
207
|
-
setTempName(name);
|
|
208
194
|
setEditFlow(true);
|
|
195
|
+
setTemplateName(name);
|
|
209
196
|
setTemplateDate(createdAt);
|
|
210
197
|
setTemplateLayoutType(editContent?.ANDROID?.bodyType);
|
|
211
198
|
const androidContent = editContent?.ANDROID;
|
|
@@ -357,6 +344,10 @@ export const InApp = (props) => {
|
|
|
357
344
|
};
|
|
358
345
|
// tag Code end
|
|
359
346
|
|
|
347
|
+
const onTemplateNameChange = ({ target: { value } }) => {
|
|
348
|
+
setTemplateName(value);
|
|
349
|
+
};
|
|
350
|
+
|
|
360
351
|
const onTemplateLayoutTypeChange = ({ target: { value } }) => {
|
|
361
352
|
setTemplateLayoutType(value);
|
|
362
353
|
};
|
|
@@ -469,6 +460,22 @@ export const InApp = (props) => {
|
|
|
469
460
|
},
|
|
470
461
|
];
|
|
471
462
|
|
|
463
|
+
const createModeContent = (
|
|
464
|
+
<CapRow>
|
|
465
|
+
{/* template name */}
|
|
466
|
+
<CapHeading type="h4">
|
|
467
|
+
<FormattedMessage {...messages.creativeName} />
|
|
468
|
+
</CapHeading>
|
|
469
|
+
<CapInput
|
|
470
|
+
id="inapp-template-name-input"
|
|
471
|
+
className="inapp-template-name-input"
|
|
472
|
+
onChange={onTemplateNameChange}
|
|
473
|
+
placeholder={formatMessage(globalMessages.templateNamePlaceholder)}
|
|
474
|
+
value={templateName}
|
|
475
|
+
size="default"
|
|
476
|
+
/>
|
|
477
|
+
</CapRow>
|
|
478
|
+
);
|
|
472
479
|
//create methods end
|
|
473
480
|
|
|
474
481
|
//used by create and edit
|
|
@@ -519,6 +526,10 @@ export const InApp = (props) => {
|
|
|
519
526
|
const isDisableDone = (device) => {
|
|
520
527
|
const isIosDevice = device === IOS;
|
|
521
528
|
const isAndroidDevice = device === ANDROID;
|
|
529
|
+
//if template name is not entered
|
|
530
|
+
if (isFullMode && templateName.trim() === '') {
|
|
531
|
+
return true;
|
|
532
|
+
}
|
|
522
533
|
//if template message is not entered
|
|
523
534
|
//for android
|
|
524
535
|
if (isAndroidDevice && (templateMessageAndroid.trim() === '' || templateMessageErrorAndroid)) {
|
|
@@ -608,7 +619,7 @@ export const InApp = (props) => {
|
|
|
608
619
|
sourceAccountIdentifier = "",
|
|
609
620
|
id,
|
|
610
621
|
} = accountObj;
|
|
611
|
-
|
|
622
|
+
|
|
612
623
|
// Construct Android content if not disabled
|
|
613
624
|
const androidContent = !isDisableDone(ANDROID) ? {
|
|
614
625
|
...commonDevicePayload,
|
|
@@ -628,7 +639,7 @@ export const InApp = (props) => {
|
|
|
628
639
|
ctas: [{type: DEEP_LINK, actionLink: deepLinkValueAndroid}],
|
|
629
640
|
}),
|
|
630
641
|
} : {};
|
|
631
|
-
|
|
642
|
+
|
|
632
643
|
// Construct iOS content if not disabled
|
|
633
644
|
const iosContent = !isDisableDone(IOS) ? {
|
|
634
645
|
...commonDevicePayload,
|
|
@@ -648,9 +659,9 @@ export const InApp = (props) => {
|
|
|
648
659
|
ctas: [{type: DEEP_LINK, actionLink: deepLinkValueIos}],
|
|
649
660
|
}),
|
|
650
661
|
} : {};
|
|
651
|
-
|
|
662
|
+
|
|
652
663
|
const data = {
|
|
653
|
-
name:
|
|
664
|
+
name: templateName,
|
|
654
665
|
versions: {
|
|
655
666
|
base: {
|
|
656
667
|
content: {
|
|
@@ -673,7 +684,7 @@ export const InApp = (props) => {
|
|
|
673
684
|
if (!errorMessage) {
|
|
674
685
|
CapNotification.success({
|
|
675
686
|
message: isEditFlow ? formatMessage(messages.inAppEditNotification, {
|
|
676
|
-
name:
|
|
687
|
+
name: templateName,
|
|
677
688
|
}) : formatMessage(messages.inAppCreateNotification, {
|
|
678
689
|
name: templateName,
|
|
679
690
|
}),
|
|
@@ -774,63 +785,30 @@ export const InApp = (props) => {
|
|
|
774
785
|
};
|
|
775
786
|
|
|
776
787
|
const isLiquidFlow = hasLiquidSupportFeature();
|
|
777
|
-
const isBEEeditor = get(editData, 'templateDetails.versions.base.content.ANDROID.isBEEeditor') || get(templateData, 'versions.base.content.ANDROID.isBEEeditor');
|
|
778
|
-
// Early returns to avoid nested ternary
|
|
779
|
-
if (isEditInApp && getTemplateDetailsInProgress) {
|
|
780
|
-
return <CapSpin spinning={getTemplateDetailsInProgress} />;
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
if (isEditInApp && isBEEeditor) {
|
|
784
|
-
return (
|
|
785
|
-
<InappAdvanced
|
|
786
|
-
getFormData={getFormData}
|
|
787
|
-
setIsLoadingContent={setIsLoadingContent}
|
|
788
|
-
defaultData={{ "template-name": tempName }}
|
|
789
|
-
location={{
|
|
790
|
-
pathname: `/inapp/edit`,
|
|
791
|
-
query,
|
|
792
|
-
search: '',
|
|
793
|
-
}}
|
|
794
|
-
params={{ mode: inAppCreateMode, id: params.id }}
|
|
795
|
-
isFullMode={isFullMode}
|
|
796
|
-
isGetFormData={isGetFormData}
|
|
797
|
-
showTemplateName={showTemplateName}
|
|
798
|
-
route={{ name: "inapp" }}
|
|
799
|
-
getDefaultTags={type}
|
|
800
|
-
onValidationFail={onValidationFail}
|
|
801
|
-
templateData={templateData}
|
|
802
|
-
templateName={tempName}
|
|
803
|
-
setTemplateName={setTempName}
|
|
804
|
-
forwardedTags={forwardedTags}
|
|
805
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
806
|
-
onCreateComplete={onCreateComplete}
|
|
807
|
-
/>
|
|
808
|
-
);
|
|
809
|
-
}
|
|
810
|
-
|
|
811
788
|
return (
|
|
812
789
|
<CapSpin spinning={spin || fetchingLiquidValidation} tip={fetchingLiquidValidation ? <FormattedMessage {...formBuilderMessages.liquidSpinText} /> : ""}>
|
|
813
790
|
<CapRow className="cap-inapp-creatives">
|
|
814
791
|
<CapColumn span={14}>
|
|
792
|
+
{isFullMode && createModeContent}
|
|
815
793
|
{/* Creative layout type*/}
|
|
816
794
|
{(isFullMode || !isEditFlow) && (
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
795
|
+
<>
|
|
796
|
+
<CapRow className="inapp-creative-layout">
|
|
797
|
+
<CapHeading type="h4">
|
|
798
|
+
<FormattedMessage {...messages.creativeLayout} />
|
|
799
|
+
</CapHeading>
|
|
800
|
+
<CapHeading type="h6" className="inapp-creative-layout-desc">
|
|
801
|
+
<FormattedMessage {...messages.creativeLayoutDesc} />
|
|
802
|
+
</CapHeading>
|
|
803
|
+
</CapRow>
|
|
804
|
+
<CapRadioGroup
|
|
805
|
+
id="inapp-layout-radio"
|
|
806
|
+
options={LAYOUT_RADIO_OPTIONS}
|
|
807
|
+
value={templateLayoutType}
|
|
808
|
+
onChange={onTemplateLayoutTypeChange}
|
|
809
|
+
className="inapp-layout-radio"
|
|
810
|
+
/>
|
|
811
|
+
</>
|
|
834
812
|
)}
|
|
835
813
|
{/* device tab */}
|
|
836
814
|
<CapTab
|
|
@@ -890,8 +868,7 @@ const mapStateToProps = createStructuredSelector({
|
|
|
890
868
|
loadingTags: isLoadingMetaEntities(),
|
|
891
869
|
injectedTags: setInjectedTags(),
|
|
892
870
|
currentOrgDetails: selectCurrentOrgDetails(),
|
|
893
|
-
fetchingLiquidValidation: selectLiquidStateDetails()
|
|
894
|
-
getTemplateDetailsInProgress: makeSelectGetTemplateDetailsInProgress(),
|
|
871
|
+
fetchingLiquidValidation: selectLiquidStateDetails()
|
|
895
872
|
});
|
|
896
873
|
|
|
897
874
|
const mapDispatchToProps = (dispatch) => ({
|
|
@@ -15,19 +15,12 @@ import {
|
|
|
15
15
|
INAPP_EDIT_TEMPLATE_REQUEST,
|
|
16
16
|
INAPP_EDIT_TEMPLATE_SUCCESS,
|
|
17
17
|
INAPP_EDIT_TEMPLATE_FAILURE,
|
|
18
|
-
GET_BEE_POPUP_BUILDER_TOKEN_REQUEST,
|
|
19
|
-
GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS,
|
|
20
|
-
GET_BEE_POPUP_BUILDER_TOKEN_FAILURE,
|
|
21
18
|
} from './constants';
|
|
22
19
|
|
|
23
20
|
const initialState = fromJS({
|
|
24
21
|
uploadedAssetData: {},
|
|
25
22
|
createTemplateInProgress: false,
|
|
26
23
|
editTemplateInProgress: false,
|
|
27
|
-
beePopupBuilderTokenFetching: false,
|
|
28
|
-
beePopupBuilderToken: {},
|
|
29
|
-
beePopupBuilderTokenError: false,
|
|
30
|
-
beePopupBuilderTokenErrorMessage: '',
|
|
31
24
|
});
|
|
32
25
|
|
|
33
26
|
function inAppReducer(state = initialState, action) {
|
|
@@ -108,16 +101,6 @@ function inAppReducer(state = initialState, action) {
|
|
|
108
101
|
? `uploadedAssetData${action.templateType}`
|
|
109
102
|
: 'uploadedAssetData',
|
|
110
103
|
);
|
|
111
|
-
case GET_BEE_POPUP_BUILDER_TOKEN_REQUEST:
|
|
112
|
-
return state.set('beePopupBuilderTokenFetching', true);
|
|
113
|
-
case GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS:
|
|
114
|
-
return state
|
|
115
|
-
.set('beePopupBuilderTokenFetching', false)
|
|
116
|
-
.set('beePopupBuilderToken', action.data);
|
|
117
|
-
case GET_BEE_POPUP_BUILDER_TOKEN_FAILURE:
|
|
118
|
-
return state
|
|
119
|
-
.set('beePopupBuilderTokenFetching', false)
|
|
120
|
-
.set('beePopupBuilderTokenError', fromJS(action.error));
|
|
121
104
|
default:
|
|
122
105
|
return state;
|
|
123
106
|
}
|
|
@@ -15,9 +15,6 @@ import {
|
|
|
15
15
|
GET_INAPP_TEMPLATE_DETAILS_SUCCESS,
|
|
16
16
|
GET_INAPP_TEMPLATE_DETAILS_FAILURE,
|
|
17
17
|
GET_INAPP_TEMPLATE_DETAILS_REQUEST,
|
|
18
|
-
GET_BEE_POPUP_BUILDER_TOKEN_REQUEST,
|
|
19
|
-
GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS,
|
|
20
|
-
GET_BEE_POPUP_BUILDER_TOKEN_FAILURE,
|
|
21
18
|
} from './constants';
|
|
22
19
|
import { INAPP } from '../CreativesContainer/constants';
|
|
23
20
|
|
|
@@ -139,34 +136,11 @@ export function* watchGetTemplateDetails() {
|
|
|
139
136
|
|
|
140
137
|
}
|
|
141
138
|
|
|
142
|
-
export function* getBeePopupBuilderToken() {
|
|
143
|
-
try {
|
|
144
|
-
const result = yield call(Api.getBeePopupBuilderToken);
|
|
145
|
-
if (result.success) {
|
|
146
|
-
yield put({
|
|
147
|
-
type: GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS,
|
|
148
|
-
data: result.response,
|
|
149
|
-
});
|
|
150
|
-
} else {
|
|
151
|
-
yield put({ type: GET_BEE_POPUP_BUILDER_TOKEN_FAILURE, error: result.message });
|
|
152
|
-
}
|
|
153
|
-
} catch (error) {
|
|
154
|
-
yield put({ type: GET_BEE_POPUP_BUILDER_TOKEN_FAILURE, error });
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
export function* watchGetBeePopupBuilderToken() {
|
|
158
|
-
yield takeLatest(
|
|
159
|
-
GET_BEE_POPUP_BUILDER_TOKEN_REQUEST,
|
|
160
|
-
getBeePopupBuilderToken,
|
|
161
|
-
);
|
|
162
|
-
}
|
|
163
|
-
|
|
164
139
|
export default [
|
|
165
140
|
watchCreateTemplate,
|
|
166
141
|
watchGetTemplateDetails,
|
|
167
142
|
watchUploadInAppAsset,
|
|
168
143
|
watchEditTemplate,
|
|
169
|
-
watchGetBeePopupBuilderToken,
|
|
170
144
|
];
|
|
171
145
|
|
|
172
146
|
export function* v2InAppSagas() {
|
|
@@ -175,6 +149,5 @@ export function* v2InAppSagas() {
|
|
|
175
149
|
watchGetTemplateDetails(),
|
|
176
150
|
watchUploadInAppAsset(),
|
|
177
151
|
watchEditTemplate(),
|
|
178
|
-
watchGetBeePopupBuilderToken(),
|
|
179
152
|
]);
|
|
180
153
|
}
|
|
@@ -9,26 +9,4 @@ const makeSelectInApp = () =>
|
|
|
9
9
|
const makeSelectAccount = () =>
|
|
10
10
|
createSelector(selectAccountDomain(), (substate) => substate.toJS());
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
selectInAppDomain(),
|
|
14
|
-
(substate) => substate.get('beePopupBuilderTokenFetching'),
|
|
15
|
-
);
|
|
16
|
-
|
|
17
|
-
const makeSelectBeePopupBuilderToken = () => createSelector(
|
|
18
|
-
selectInAppDomain(),
|
|
19
|
-
(substate) => substate.get('beePopupBuilderToken'),
|
|
20
|
-
);
|
|
21
|
-
|
|
22
|
-
const makeSelectGetTemplateDetailsInProgress = () => createSelector(
|
|
23
|
-
selectInAppDomain(),
|
|
24
|
-
(substate) => substate.get('getTemplateDetailsInProgress'),
|
|
25
|
-
);
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
export {
|
|
29
|
-
makeSelectInApp,
|
|
30
|
-
makeSelectAccount,
|
|
31
|
-
makeSelectBeePopupBuilderTokenFetching,
|
|
32
|
-
makeSelectBeePopupBuilderToken,
|
|
33
|
-
makeSelectGetTemplateDetailsInProgress,
|
|
34
|
-
};
|
|
12
|
+
export { makeSelectInApp, makeSelectAccount };
|
|
@@ -60,6 +60,11 @@ describe('Test activity inApp container', () => {
|
|
|
60
60
|
isFullMode: true,
|
|
61
61
|
params: { id: 'test'},
|
|
62
62
|
});
|
|
63
|
+
const inputBox = await screen.findAllByPlaceholderText(
|
|
64
|
+
'Enter template name',
|
|
65
|
+
);
|
|
66
|
+
fireEvent.change(inputBox[0], { target: { value: 'Hello, welcome' } });
|
|
67
|
+
inputBox[0].focus();
|
|
63
68
|
const iosTab = screen.getByRole('tab', {
|
|
64
69
|
name: /ios/i,
|
|
65
70
|
});
|
|
@@ -68,6 +73,10 @@ describe('Test activity inApp container', () => {
|
|
|
68
73
|
name: /android/i,
|
|
69
74
|
});
|
|
70
75
|
fireEvent.click(within(androidTab).getByText(/android/i));
|
|
76
|
+
const inputNameBox = await screen.findAllByPlaceholderText(
|
|
77
|
+
'Enter template name',
|
|
78
|
+
);
|
|
79
|
+
fireEvent.change(inputNameBox[0], { target: { value: 'Hello, welcome' } });
|
|
71
80
|
const msgBox = screen.getAllByPlaceholderText(/Please input in-app notification message content/i);
|
|
72
81
|
msgBox[0].focus();
|
|
73
82
|
fireEvent.change(msgBox[0], { target: { value: 'val' }});
|
|
@@ -260,37 +260,4 @@ describe("zalo reducer", () => {
|
|
|
260
260
|
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
261
261
|
});
|
|
262
262
|
});
|
|
263
|
-
describe("Reducer : GET_BEE_POPUP_BUILDER_TOKEN_REQUEST", () => {
|
|
264
|
-
it.concurrent("should handle GET_BEE_POPUP_BUILDER_TOKEN_REQUEST action", () => {
|
|
265
|
-
const state = fromJS({
|
|
266
|
-
beePopupBuilderTokenFetching: false,
|
|
267
|
-
});
|
|
268
|
-
const expectedResult = state.set("beePopupBuilderTokenFetching", true);
|
|
269
|
-
expect(inAppReducer(state, actions.getBeePopupBuilderToken({}))).toEqual(expectedResult);
|
|
270
|
-
});
|
|
271
|
-
it.concurrent("should handle GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS action", () => {
|
|
272
|
-
const state = fromJS({
|
|
273
|
-
beePopupBuilderTokenFetching: false,
|
|
274
|
-
beePopupBuilderToken: 'data',
|
|
275
|
-
});
|
|
276
|
-
const action = {
|
|
277
|
-
type: types.GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS,
|
|
278
|
-
data: 'data',
|
|
279
|
-
};
|
|
280
|
-
const expectedResult = state.set("beePopupBuilderTokenFetching", false).set("beePopupBuilderToken", 'data');
|
|
281
|
-
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
282
|
-
});
|
|
283
|
-
it.concurrent("should handle GET_BEE_POPUP_BUILDER_TOKEN_FAILURE action", () => {
|
|
284
|
-
const state = fromJS({
|
|
285
|
-
beePopupBuilderTokenFetching: false,
|
|
286
|
-
beePopupBuilderTokenError: 'error',
|
|
287
|
-
});
|
|
288
|
-
const action = {
|
|
289
|
-
type: types.GET_BEE_POPUP_BUILDER_TOKEN_FAILURE,
|
|
290
|
-
error: 'error',
|
|
291
|
-
};
|
|
292
|
-
const expectedResult = state.set("beePopupBuilderTokenFetching", false).set("beePopupBuilderTokenError", 'error');
|
|
293
|
-
expect(inAppReducer(state, action)).toEqual(expectedResult);
|
|
294
|
-
});
|
|
295
|
-
});
|
|
296
263
|
});
|
|
@@ -397,63 +397,7 @@ describe('test for getTemplateDetails', () => {
|
|
|
397
397
|
});
|
|
398
398
|
});
|
|
399
399
|
|
|
400
|
-
|
|
401
|
-
it('should call getBeePopupBuilderToken when GET_BEE_POPUP_BUILDER_TOKEN_REQUEST action is dispatched', () => {
|
|
402
|
-
const watcher = sagas.watchGetBeePopupBuilderToken();
|
|
403
|
-
const gen = watcher.next().value;
|
|
404
|
-
expect(gen).toEqual(takeLatest(types.GET_BEE_POPUP_BUILDER_TOKEN_REQUEST, sagas.getBeePopupBuilderToken));
|
|
405
|
-
});
|
|
406
|
-
it('should cancel the watcher watchGetBeePopupBuilderToken', () => {
|
|
407
|
-
const gen = sagas.watchGetBeePopupBuilderToken();
|
|
408
|
-
const mockTask = createMockTask();
|
|
409
|
-
expect(gen.next().value).toEqual(takeLatest(types.GET_BEE_POPUP_BUILDER_TOKEN_REQUEST, sagas.getBeePopupBuilderToken));
|
|
410
|
-
expect(gen.next(mockTask).done).toBe(true);
|
|
411
|
-
expect(mockTask.isRunning()).toBe(true);
|
|
412
|
-
expect(gen.next().value).toEqual(undefined);
|
|
413
|
-
});
|
|
414
|
-
it('should handle GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS', () => {
|
|
415
|
-
const payload = {}; // Add your payload for testing
|
|
416
|
-
const mockResult = {
|
|
417
|
-
success: true,
|
|
418
|
-
status: {
|
|
419
|
-
code: 200,
|
|
420
|
-
},
|
|
421
|
-
response: { /* mock response */ },
|
|
422
|
-
};
|
|
423
|
-
const iterator = sagas.getBeePopupBuilderToken({ payload, callback: jest.fn() });
|
|
424
|
-
expect(iterator.next().value).toEqual(call(Api.getBeePopupBuilderToken));
|
|
425
|
-
expect(iterator.next(mockResult).value).toEqual(
|
|
426
|
-
put({ type: types.GET_BEE_POPUP_BUILDER_TOKEN_SUCCESS, data: mockResult.response })
|
|
427
|
-
);
|
|
428
|
-
expect(iterator.next().done).toBe(true);
|
|
429
|
-
});
|
|
430
|
-
it('should handle GET_BEE_POPUP_BUILDER_TOKEN_FAILURE', () => {
|
|
431
|
-
const payload = {};
|
|
432
|
-
const error = new Error('Test error');
|
|
433
|
-
const iterator = sagas.getBeePopupBuilderToken({ payload });
|
|
434
|
-
expect(iterator.next().value).toEqual(call(Api.getBeePopupBuilderToken));
|
|
435
|
-
expect(iterator.throw(error).value).toEqual(
|
|
436
|
-
put({ type: types.GET_BEE_POPUP_BUILDER_TOKEN_FAILURE, error })
|
|
437
|
-
);
|
|
438
|
-
expect(iterator.next().done).toBe(true);
|
|
439
|
-
});
|
|
440
|
-
it('should handle error case', () => {
|
|
441
|
-
const payload = {};
|
|
442
|
-
const mockResult = {
|
|
443
|
-
success: false,
|
|
444
|
-
status: {
|
|
445
|
-
code: 400,
|
|
446
|
-
},
|
|
447
|
-
message: 'Test error',
|
|
448
|
-
};
|
|
449
|
-
const iterator = sagas.getBeePopupBuilderToken({ payload });
|
|
450
|
-
expect(iterator.next().value).toEqual(call(Api.getBeePopupBuilderToken));
|
|
451
|
-
expect(iterator.next(mockResult).value).toEqual(
|
|
452
|
-
put({ type: types.GET_BEE_POPUP_BUILDER_TOKEN_FAILURE, error: mockResult.message })
|
|
453
|
-
);
|
|
454
|
-
expect(iterator.next().done).toBe(true);
|
|
455
|
-
});
|
|
456
|
-
});
|
|
400
|
+
|
|
457
401
|
|
|
458
402
|
|
|
459
403
|
describe("v2InAppSagas Combined", () => {
|
|
@@ -2281,7 +2281,6 @@ new message content.",
|
|
|
2281
2281
|
"email": [Function],
|
|
2282
2282
|
"facebookPreview": [Function],
|
|
2283
2283
|
"gallery": [Function],
|
|
2284
|
-
"inapp": [Function],
|
|
2285
2284
|
"language": [Function],
|
|
2286
2285
|
"navigationConfig": [Function],
|
|
2287
2286
|
"previewAndTest": [Function],
|
|
@@ -5965,7 +5964,6 @@ new message content.",
|
|
|
5965
5964
|
"email": [Function],
|
|
5966
5965
|
"facebookPreview": [Function],
|
|
5967
5966
|
"gallery": [Function],
|
|
5968
|
-
"inapp": [Function],
|
|
5969
5967
|
"language": [Function],
|
|
5970
5968
|
"navigationConfig": [Function],
|
|
5971
5969
|
"previewAndTest": [Function],
|
|
@@ -9788,7 +9786,6 @@ new message content.",
|
|
|
9788
9786
|
"email": [Function],
|
|
9789
9787
|
"facebookPreview": [Function],
|
|
9790
9788
|
"gallery": [Function],
|
|
9791
|
-
"inapp": [Function],
|
|
9792
9789
|
"language": [Function],
|
|
9793
9790
|
"navigationConfig": [Function],
|
|
9794
9791
|
"previewAndTest": [Function],
|
|
@@ -2281,7 +2281,6 @@ new message content.",
|
|
|
2281
2281
|
"email": [Function],
|
|
2282
2282
|
"facebookPreview": [Function],
|
|
2283
2283
|
"gallery": [Function],
|
|
2284
|
-
"inapp": [Function],
|
|
2285
2284
|
"language": [Function],
|
|
2286
2285
|
"navigationConfig": [Function],
|
|
2287
2286
|
"previewAndTest": [Function],
|
|
@@ -21555,7 +21554,6 @@ new message content.",
|
|
|
21555
21554
|
"email": [Function],
|
|
21556
21555
|
"facebookPreview": [Function],
|
|
21557
21556
|
"gallery": [Function],
|
|
21558
|
-
"inapp": [Function],
|
|
21559
21557
|
"language": [Function],
|
|
21560
21558
|
"navigationConfig": [Function],
|
|
21561
21559
|
"previewAndTest": [Function],
|
|
@@ -2281,7 +2281,6 @@ new message content.",
|
|
|
2281
2281
|
"email": [Function],
|
|
2282
2282
|
"facebookPreview": [Function],
|
|
2283
2283
|
"gallery": [Function],
|
|
2284
|
-
"inapp": [Function],
|
|
2285
2284
|
"language": [Function],
|
|
2286
2285
|
"navigationConfig": [Function],
|
|
2287
2286
|
"previewAndTest": [Function],
|
|
@@ -34886,7 +34885,6 @@ new message content.",
|
|
|
34886
34885
|
"email": [Function],
|
|
34887
34886
|
"facebookPreview": [Function],
|
|
34888
34887
|
"gallery": [Function],
|
|
34889
|
-
"inapp": [Function],
|
|
34890
34888
|
"language": [Function],
|
|
34891
34889
|
"navigationConfig": [Function],
|
|
34892
34890
|
"previewAndTest": [Function],
|