@capillarytech/creatives-library 7.17.92 → 7.17.93
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/containers/Ebill/index.js +0 -1
- package/containers/MobilePush/Edit/index.js +0 -1
- package/index.js +0 -6
- package/package.json +1 -1
- package/routes.js +0 -5
- package/services/api.js +0 -5
- package/v2Components/CapImageUpload/index.js +3 -10
- package/v2Components/CapImageUpload/messages.js +0 -4
- package/v2Components/FormBuilder/index.js +4 -3
- package/v2Components/MobilePushPreviewV2/index.js +23 -81
- package/v2Components/TemplatePreview/_templatePreview.scss +0 -448
- package/v2Components/TemplatePreview/index.js +375 -660
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Containers/App/constants.js +0 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +0 -43
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +1 -4
- package/v2Containers/CreativesContainer/constants.js +0 -1
- package/v2Containers/CreativesContainer/index.js +27 -94
- package/v2Containers/CreativesContainer/messages.js +0 -4
- package/v2Containers/MobilePush/Edit/index.js +1 -3
- package/v2Containers/Templates/_templates.scss +0 -10
- package/v2Containers/Templates/index.js +23 -103
- package/v2Containers/Templates/messages.js +0 -20
- package/v2Containers/TemplatesV2/index.js +2 -8
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Components/CapDeviceContent/index.js +0 -338
- package/v2Components/CapDeviceContent/index.scss +0 -115
- package/v2Components/CapDeviceContent/messages.js +0 -107
- package/v2Components/CapDeviceContent/tests/index.test.js +0 -75
- package/v2Components/CapInAppCTA/constants.js +0 -25
- package/v2Components/CapInAppCTA/index.js +0 -281
- package/v2Components/CapInAppCTA/index.scss +0 -93
- package/v2Components/CapInAppCTA/messages.js +0 -85
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_bottom.svg +0 -11
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_full.svg +0 -11
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_modal.svg +0 -11
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_android_top.svg +0 -11
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_bottom.svg +0 -6
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_full.svg +0 -18
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_modal.svg +0 -7
- package/v2Components/TemplatePreview/assets/images/inapp_mobile_ios_top.svg +0 -13
- package/v2Containers/InApp/actions.js +0 -64
- package/v2Containers/InApp/constants.js +0 -95
- package/v2Containers/InApp/index.js +0 -745
- package/v2Containers/InApp/index.scss +0 -47
- package/v2Containers/InApp/messages.js +0 -86
- package/v2Containers/InApp/reducer.js +0 -109
- package/v2Containers/InApp/sagas.js +0 -143
- package/v2Containers/InApp/selectors.js +0 -12
- package/v2Containers/InApp/tests/action.test.js +0 -53
- package/v2Containers/InApp/tests/index.test.js +0 -152
- package/v2Containers/InApp/tests/mockData.js +0 -897
- package/v2Containers/InApp/tests/reducer.test.js +0 -177
- package/v2Containers/InApp/tests/sagas.test.js +0 -391
|
@@ -1,338 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import { injectIntl, intlShape } from "react-intl";
|
|
4
|
-
import cloneDeep from "lodash/cloneDeep";
|
|
5
|
-
import isEmpty from "lodash/isEmpty";
|
|
6
|
-
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
|
|
7
|
-
import CapHeader from "@capillarytech/cap-ui-library/CapHeader";
|
|
8
|
-
import CapInput from "@capillarytech/cap-ui-library/CapInput";
|
|
9
|
-
import CapRadioGroup from "@capillarytech/cap-ui-library/CapRadioGroup";
|
|
10
|
-
import CapRow from "@capillarytech/cap-ui-library/CapRow";
|
|
11
|
-
import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
|
|
12
|
-
import CapLink from "@capillarytech/cap-ui-library/CapLink";
|
|
13
|
-
import CapError from "@capillarytech/cap-ui-library/CapError";
|
|
14
|
-
import CapCheckbox from "@capillarytech/cap-ui-library/CapCheckbox";
|
|
15
|
-
import CapSelect from "@capillarytech/cap-ui-library/CapSelect";
|
|
16
|
-
import TagList from "../../v2Containers/TagList";
|
|
17
|
-
import messages from "./messages";
|
|
18
|
-
import {
|
|
19
|
-
ANDROID,
|
|
20
|
-
INAPP_MEDIA_TYPES,
|
|
21
|
-
INAPP_BUTTON_TYPES,
|
|
22
|
-
ALLOWED_IMAGE_EXTENSIONS_REGEX,
|
|
23
|
-
INAPP_IMG_SIZE,
|
|
24
|
-
INITIAL_CTA_DATA,
|
|
25
|
-
MEDIA_RADIO_OPTIONS,
|
|
26
|
-
} from "../../v2Containers/InApp/constants";
|
|
27
|
-
import { INAPP } from "../../v2Containers/CreativesContainer/constants";
|
|
28
|
-
import CapImageUpload from "../CapImageUpload";
|
|
29
|
-
import CapInAppCTA from "../CapInAppCTA";
|
|
30
|
-
import './index.scss';
|
|
31
|
-
|
|
32
|
-
const CapDeviceContent = (props) => {
|
|
33
|
-
const {
|
|
34
|
-
intl,
|
|
35
|
-
location,
|
|
36
|
-
injectedTags,
|
|
37
|
-
selectedOfferDetails,
|
|
38
|
-
panes,
|
|
39
|
-
actions,
|
|
40
|
-
editData,
|
|
41
|
-
isFullMode,
|
|
42
|
-
inAppImageSrc,
|
|
43
|
-
setInAppImageSrc,
|
|
44
|
-
isEditFlow,
|
|
45
|
-
ctaData,
|
|
46
|
-
setCtaData,
|
|
47
|
-
buttonType,
|
|
48
|
-
setButtonType,
|
|
49
|
-
templateMediaType,
|
|
50
|
-
setTemplateMediaType,
|
|
51
|
-
title,
|
|
52
|
-
setTitle,
|
|
53
|
-
templateMessageError,
|
|
54
|
-
templateMessage,
|
|
55
|
-
setTemplateMessage,
|
|
56
|
-
setTemplateMessageError,
|
|
57
|
-
addActionLink,
|
|
58
|
-
setAddActionLink,
|
|
59
|
-
deepLink,
|
|
60
|
-
deepLinkValue,
|
|
61
|
-
setDeepLinkValue,
|
|
62
|
-
onCopyTitleAndContent,
|
|
63
|
-
tags,
|
|
64
|
-
onTagSelect,
|
|
65
|
-
handleOnTagsContextChange,
|
|
66
|
-
} = props || {};
|
|
67
|
-
const { TextArea } = CapInput;
|
|
68
|
-
const { formatMessage } = intl;
|
|
69
|
-
|
|
70
|
-
const isAndroid = panes === ANDROID;
|
|
71
|
-
const isMediaTypeImage = INAPP_MEDIA_TYPES.IMAGE === templateMediaType;
|
|
72
|
-
const isBtnTypeCta = buttonType === INAPP_BUTTON_TYPES.CTA;
|
|
73
|
-
const onTemplateMessageChange = ({ target: { value } }) => {
|
|
74
|
-
let error = '';
|
|
75
|
-
if (value === '') {
|
|
76
|
-
error = formatMessage(messages.emptyTemplateMessageErrorMessage);
|
|
77
|
-
}
|
|
78
|
-
setTemplateMessage(value);
|
|
79
|
-
setTemplateMessageError(error);
|
|
80
|
-
};
|
|
81
|
-
|
|
82
|
-
const setUpdateInAppImageSrc = useCallback(
|
|
83
|
-
(filePath) => {
|
|
84
|
-
const templateType = 0;
|
|
85
|
-
setInAppImageSrc(filePath);
|
|
86
|
-
actions.clearInAppAsset(templateType);
|
|
87
|
-
},
|
|
88
|
-
[inAppImageSrc]
|
|
89
|
-
);
|
|
90
|
-
const updateOnInAppImageReUpload = useCallback(() => {
|
|
91
|
-
setInAppImageSrc("");
|
|
92
|
-
}, [inAppImageSrc]);
|
|
93
|
-
|
|
94
|
-
const updateHandler = (ctaDataParam, index) => {
|
|
95
|
-
setCtaData((prevState) => {
|
|
96
|
-
const clonedCta = cloneDeep(prevState);
|
|
97
|
-
clonedCta[index] = ctaDataParam;
|
|
98
|
-
return clonedCta;
|
|
99
|
-
});
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
// function to delete CTA button
|
|
103
|
-
const deleteHandler = (index) => {
|
|
104
|
-
setCtaData((prevState) => {
|
|
105
|
-
const clonedCta = cloneDeep(prevState);
|
|
106
|
-
const filteredCta = clonedCta.filter((cta) => cta.index !== index);
|
|
107
|
-
if (filteredCta.length === 1) {
|
|
108
|
-
// updates the index of the cta buttons present in case there's a cta button deleted
|
|
109
|
-
filteredCta[0].index = 0;
|
|
110
|
-
}
|
|
111
|
-
if (isEmpty(filteredCta)) {
|
|
112
|
-
onChangeButtonType({target: { value: INAPP_BUTTON_TYPES.NONE } });
|
|
113
|
-
}
|
|
114
|
-
return filteredCta;
|
|
115
|
-
});
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
const buttonRadioOptions = [
|
|
119
|
-
{
|
|
120
|
-
value: INAPP_BUTTON_TYPES.NONE,
|
|
121
|
-
label: (
|
|
122
|
-
<CapHeading
|
|
123
|
-
type="h4"
|
|
124
|
-
className="inapp-button-none"
|
|
125
|
-
>
|
|
126
|
-
{formatMessage(messages.btnTypeNone)}
|
|
127
|
-
</CapHeading>
|
|
128
|
-
),
|
|
129
|
-
},
|
|
130
|
-
{
|
|
131
|
-
value: INAPP_BUTTON_TYPES.CTA,
|
|
132
|
-
label: (
|
|
133
|
-
<>
|
|
134
|
-
<div
|
|
135
|
-
className="inapp-button-cta"
|
|
136
|
-
>
|
|
137
|
-
<CapHeading type="h4">
|
|
138
|
-
{formatMessage(messages.btnTypeCTA)}
|
|
139
|
-
</CapHeading>
|
|
140
|
-
<CapLabel>{formatMessage(messages.ctaDesc)}</CapLabel>
|
|
141
|
-
</div>
|
|
142
|
-
</>
|
|
143
|
-
),
|
|
144
|
-
},
|
|
145
|
-
];
|
|
146
|
-
|
|
147
|
-
const onTitleChange = ({ target: { value } }) => {
|
|
148
|
-
setTitle(value);
|
|
149
|
-
};
|
|
150
|
-
|
|
151
|
-
const onTemplateMediaTypeChange = ({ target: { value } }) => {
|
|
152
|
-
setTemplateMediaType(value);
|
|
153
|
-
};
|
|
154
|
-
|
|
155
|
-
const onChangeButtonType = ({ target: { value } }) => {
|
|
156
|
-
setButtonType(value);
|
|
157
|
-
setCtaData(INITIAL_CTA_DATA);
|
|
158
|
-
};
|
|
159
|
-
|
|
160
|
-
const uploadInAppAsset = (file, type, fileParams) => {
|
|
161
|
-
actions.uploadInAppAsset(file, type, fileParams, 0);
|
|
162
|
-
};
|
|
163
|
-
|
|
164
|
-
const getTagList = (index) => (
|
|
165
|
-
<TagList
|
|
166
|
-
moduleFilterEnabled={
|
|
167
|
-
location && location?.query && location?.query?.type !== "embedded"
|
|
168
|
-
}
|
|
169
|
-
label={formatMessage(messages.addLabel)}
|
|
170
|
-
onTagSelect={(value) => onTagSelect(value, index)}
|
|
171
|
-
onContextChange={handleOnTagsContextChange}
|
|
172
|
-
location={location}
|
|
173
|
-
tags={tags || []}
|
|
174
|
-
injectedTags={injectedTags || {}}
|
|
175
|
-
selectedOfferDetails={selectedOfferDetails}
|
|
176
|
-
/>
|
|
177
|
-
);
|
|
178
|
-
|
|
179
|
-
return (
|
|
180
|
-
<>
|
|
181
|
-
<div className="creatives-device-content">
|
|
182
|
-
<CapLink
|
|
183
|
-
title={isAndroid
|
|
184
|
-
? formatMessage(messages.copyContentFromIOS)
|
|
185
|
-
: formatMessage(messages.copyCotentFromAndroid)}
|
|
186
|
-
className="inapp-copy-content"
|
|
187
|
-
onClick={onCopyTitleAndContent}
|
|
188
|
-
/>
|
|
189
|
-
<div className="creatives-inapp-title">
|
|
190
|
-
<div
|
|
191
|
-
className="inapp-content-main"
|
|
192
|
-
>
|
|
193
|
-
<CapHeading type="h5" className="inapp-title">
|
|
194
|
-
{formatMessage(messages.title)}
|
|
195
|
-
</CapHeading>
|
|
196
|
-
{getTagList(0)} {/* here 0 signifies the tags for template title */}
|
|
197
|
-
</div>
|
|
198
|
-
<CapInput
|
|
199
|
-
id="inapp-title-name-input"
|
|
200
|
-
onChange={onTitleChange}
|
|
201
|
-
placeholder={formatMessage(messages.titlePlaceholder)}
|
|
202
|
-
value={title}
|
|
203
|
-
size="default"
|
|
204
|
-
isRequired
|
|
205
|
-
/>
|
|
206
|
-
</div>
|
|
207
|
-
<div className="creatives-inapp-media">
|
|
208
|
-
<div className="inapp-content-media">
|
|
209
|
-
<CapHeading type="h5" className="inapp-media-header">
|
|
210
|
-
{formatMessage(messages.mediaLabel)}
|
|
211
|
-
</CapHeading>
|
|
212
|
-
<CapRadioGroup
|
|
213
|
-
id="inapp-media-radio"
|
|
214
|
-
options={MEDIA_RADIO_OPTIONS}
|
|
215
|
-
value={templateMediaType}
|
|
216
|
-
onChange={onTemplateMediaTypeChange}
|
|
217
|
-
className="inapp-media-radio"
|
|
218
|
-
/>
|
|
219
|
-
</div>
|
|
220
|
-
</div>
|
|
221
|
-
<div className={`creatives-inapp-message ${!isMediaTypeImage && "message-bottom-margin"}`}>
|
|
222
|
-
<div
|
|
223
|
-
className="inapp-message-header"
|
|
224
|
-
>
|
|
225
|
-
<CapHeading type="h5" className="inapp-message-header-style">
|
|
226
|
-
{formatMessage(messages.message)}
|
|
227
|
-
</CapHeading>
|
|
228
|
-
{getTagList(1)} {/* here 1 signifies the tags for template message */}
|
|
229
|
-
</div>
|
|
230
|
-
<TextArea
|
|
231
|
-
id="inapp-create-template-message-input"
|
|
232
|
-
className="inapp-create-template-message-input"
|
|
233
|
-
placeholder={formatMessage(messages.textAreaInputPlaceholder)}
|
|
234
|
-
onChange={onTemplateMessageChange}
|
|
235
|
-
value={templateMessage || ''}
|
|
236
|
-
autosize={{ minRows: 5, maxRows: 5 }}
|
|
237
|
-
errorMessage={templateMessageError && (
|
|
238
|
-
<CapError className="inapp-template-message-error">
|
|
239
|
-
{templateMessageError}
|
|
240
|
-
</CapError>
|
|
241
|
-
)}
|
|
242
|
-
/>
|
|
243
|
-
{isMediaTypeImage && (
|
|
244
|
-
<>
|
|
245
|
-
<CapHeading type="h4" className="cover-img">
|
|
246
|
-
{formatMessage(messages.coverImage)}
|
|
247
|
-
</CapHeading>
|
|
248
|
-
<CapImageUpload
|
|
249
|
-
allowedExtensionsRegex={ALLOWED_IMAGE_EXTENSIONS_REGEX}
|
|
250
|
-
imgSize={INAPP_IMG_SIZE}
|
|
251
|
-
uploadAsset={uploadInAppAsset}
|
|
252
|
-
isFullMode={isFullMode}
|
|
253
|
-
imageSrc={inAppImageSrc}
|
|
254
|
-
updateImageSrc={setUpdateInAppImageSrc}
|
|
255
|
-
updateOnReUpload={updateOnInAppImageReUpload}
|
|
256
|
-
index={0}
|
|
257
|
-
className="cap-custom-image-upload"
|
|
258
|
-
key="inapp-uploaded-image"
|
|
259
|
-
imageData={editData}
|
|
260
|
-
channel={INAPP}
|
|
261
|
-
channelSpecificStyle={!isFullMode}
|
|
262
|
-
/>
|
|
263
|
-
</>
|
|
264
|
-
)}
|
|
265
|
-
</div>
|
|
266
|
-
</div>
|
|
267
|
-
<div className="inapp-action-link">
|
|
268
|
-
<CapCheckbox onChange={() => setAddActionLink(!addActionLink)} checked={addActionLink} />
|
|
269
|
-
<div className="inapp-render-heading">
|
|
270
|
-
<CapHeader
|
|
271
|
-
title={<CapRow type="flex">
|
|
272
|
-
<CapHeading type="h4">
|
|
273
|
-
{formatMessage(messages.addActionLink)}
|
|
274
|
-
</CapHeading>
|
|
275
|
-
</CapRow>}
|
|
276
|
-
description={<CapLabel type="label3">{formatMessage(messages.addActionLinkDesc)}</CapLabel>}
|
|
277
|
-
/>
|
|
278
|
-
{addActionLink && (
|
|
279
|
-
<div className="inapp-action-deep-link">
|
|
280
|
-
<CapHeading type="h4">
|
|
281
|
-
{formatMessage(messages.actionDeepLink)}
|
|
282
|
-
</CapHeading>
|
|
283
|
-
<CapSelect
|
|
284
|
-
id="inapp-add-action-link-type"
|
|
285
|
-
placeholder={formatMessage(messages.deepLinkOptionsPlaceholder)}
|
|
286
|
-
options={deepLink || []}
|
|
287
|
-
value={deepLinkValue}
|
|
288
|
-
onChange={(value) => { setDeepLinkValue(value); }}
|
|
289
|
-
/>
|
|
290
|
-
</div>
|
|
291
|
-
)}
|
|
292
|
-
</div>
|
|
293
|
-
</div>
|
|
294
|
-
<div className="inapp-cta-button">
|
|
295
|
-
<CapHeader
|
|
296
|
-
className="inapp-render-heading-cta-button"
|
|
297
|
-
title={<CapRow type="flex">
|
|
298
|
-
<CapHeading type="h4">
|
|
299
|
-
{formatMessage(messages.btnLabel)}
|
|
300
|
-
</CapHeading>
|
|
301
|
-
<CapHeading
|
|
302
|
-
type="h6"
|
|
303
|
-
className="inapp-optional-label"
|
|
304
|
-
>
|
|
305
|
-
{formatMessage(messages.optional)}
|
|
306
|
-
</CapHeading>
|
|
307
|
-
</CapRow>}
|
|
308
|
-
description={<CapLabel type="label3">{formatMessage(messages.btnDesc)}</CapLabel>}
|
|
309
|
-
/>
|
|
310
|
-
<CapRadioGroup
|
|
311
|
-
options={buttonRadioOptions}
|
|
312
|
-
value={buttonType}
|
|
313
|
-
onChange={onChangeButtonType}
|
|
314
|
-
className="inapp-btn-radio-group"
|
|
315
|
-
/>
|
|
316
|
-
{isBtnTypeCta && (
|
|
317
|
-
<CapInAppCTA
|
|
318
|
-
ctaData={ctaData}
|
|
319
|
-
updateHandler={updateHandler}
|
|
320
|
-
deleteHandler={deleteHandler}
|
|
321
|
-
isEditFlow={isEditFlow}
|
|
322
|
-
deepLink={deepLink || []}
|
|
323
|
-
/>
|
|
324
|
-
)}
|
|
325
|
-
</div>
|
|
326
|
-
</>
|
|
327
|
-
);
|
|
328
|
-
};
|
|
329
|
-
|
|
330
|
-
CapDeviceContent.propTypes = {
|
|
331
|
-
intl: intlShape.isRequierd,
|
|
332
|
-
location: PropTypes.string,
|
|
333
|
-
injectedTags: PropTypes.object,
|
|
334
|
-
selectedOfferDetails: PropTypes.array,
|
|
335
|
-
panes: PropTypes.string,
|
|
336
|
-
};
|
|
337
|
-
|
|
338
|
-
export default injectIntl(CapDeviceContent);
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
@import '~@capillarytech/cap-ui-library/styles/_variables.scss';
|
|
2
|
-
|
|
3
|
-
.creatives-device-content {
|
|
4
|
-
.inapp-copy-content {
|
|
5
|
-
margin-top: $CAP_SPACE_08;
|
|
6
|
-
margin-bottom: $CAP_SPACE_16;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
.creatives-inapp-title {
|
|
10
|
-
.inapp-content-main {
|
|
11
|
-
display: flex;
|
|
12
|
-
align-items: center;
|
|
13
|
-
justify-content: space-between;
|
|
14
|
-
margin-top: $CAP_SPACE_08;
|
|
15
|
-
}
|
|
16
|
-
.inapp-title {
|
|
17
|
-
font-weight: 500;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
.creatives-inapp-media {
|
|
22
|
-
.inapp-media-header {
|
|
23
|
-
font-weight: 500;
|
|
24
|
-
}
|
|
25
|
-
.inapp-content-media {
|
|
26
|
-
margin-top: $CAP_SPACE_16;
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
.inapp-media-radio {
|
|
30
|
-
font-weight: 500;
|
|
31
|
-
margin-top: $CAP_SPACE_16;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
.creatives-inapp-message {
|
|
35
|
-
margin-top : $CAP_SPACE_12;
|
|
36
|
-
.inapp-message-header {
|
|
37
|
-
display: flex;
|
|
38
|
-
align-items: center;
|
|
39
|
-
justify-content: space-between;
|
|
40
|
-
|
|
41
|
-
.inapp-message-header-style {
|
|
42
|
-
font-weight: 500;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
.inapp-create-template-message-input {
|
|
46
|
-
min-height: 5.214rem;
|
|
47
|
-
margin-bottom: $CAP_SPACE_08;
|
|
48
|
-
}
|
|
49
|
-
.cap-custom-image-upload {
|
|
50
|
-
.dragger-button.re-upload {
|
|
51
|
-
top: 28rem;
|
|
52
|
-
position: absolute;
|
|
53
|
-
right: $CAP_SPACE_20;
|
|
54
|
-
color: $FONT_COLOR_05;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
.message-bottom-margin{
|
|
59
|
-
margin-bottom: 0.857rem;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
.inapp-action-link {
|
|
64
|
-
display: flex;
|
|
65
|
-
margin-top: 2rem;
|
|
66
|
-
|
|
67
|
-
.inapp-render-heading {
|
|
68
|
-
width: 100%;
|
|
69
|
-
|
|
70
|
-
.inapp-action-deep-link {
|
|
71
|
-
margin-top: $CAP_SPACE_12;
|
|
72
|
-
|
|
73
|
-
#inapp-add-action-link-type {
|
|
74
|
-
width: 100%;
|
|
75
|
-
margin-top: $CAP_SPACE_12;
|
|
76
|
-
}
|
|
77
|
-
.cap-select-v2 {
|
|
78
|
-
.ant-select-selection__placeholder {
|
|
79
|
-
display: block;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
.inapp-cta-button {
|
|
86
|
-
margin-top: 2rem;
|
|
87
|
-
|
|
88
|
-
.inapp-render-heading-cta-button {
|
|
89
|
-
.inapp-optional-label {
|
|
90
|
-
font-size: $CAP_SPACE_12;
|
|
91
|
-
color: $CAP_G06;
|
|
92
|
-
margin-left: $CAP_SPACE_04;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
.inapp-btn-radio-group{
|
|
96
|
-
display: grid;
|
|
97
|
-
}
|
|
98
|
-
.inapp-button-none {
|
|
99
|
-
display: inline-grid;
|
|
100
|
-
margin-top: $CAP_SPACE_16;
|
|
101
|
-
}
|
|
102
|
-
.inapp-button-cta {
|
|
103
|
-
display: inline-grid;
|
|
104
|
-
margin-top: $CAP_SPACE_24;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
.inapp-template-message-error {
|
|
108
|
-
margin-bottom: 1rem;
|
|
109
|
-
}
|
|
110
|
-
.image-container {
|
|
111
|
-
margin-top: 1.5rem;
|
|
112
|
-
}
|
|
113
|
-
.cover-img {
|
|
114
|
-
margin-top: 2rem;
|
|
115
|
-
}
|
|
@@ -1,107 +0,0 @@
|
|
|
1
|
-
import { defineMessages } from "react-intl";
|
|
2
|
-
|
|
3
|
-
const prefix = "app.v2Components.CapDeviceContent";
|
|
4
|
-
|
|
5
|
-
export default defineMessages({
|
|
6
|
-
copyContentFromIOS: {
|
|
7
|
-
id: `${prefix}.copyContentFromIOS`,
|
|
8
|
-
defaultMessage: "Copy title and content from iOS",
|
|
9
|
-
},
|
|
10
|
-
copyCotentFromAndroid: {
|
|
11
|
-
id: `${prefix}.copyContentFromAndriod`,
|
|
12
|
-
defaultMessage: "Copy title and content from Android",
|
|
13
|
-
},
|
|
14
|
-
title: {
|
|
15
|
-
id: `${prefix}.title`,
|
|
16
|
-
defaultMessage: "Title",
|
|
17
|
-
},
|
|
18
|
-
addLabel: {
|
|
19
|
-
id: `${prefix}.addLabel`,
|
|
20
|
-
defaultMessage: "Add labels",
|
|
21
|
-
},
|
|
22
|
-
titlePlaceholder: {
|
|
23
|
-
id: `${prefix}.titlePlaceholder`,
|
|
24
|
-
defaultMessage: "Please input message title name",
|
|
25
|
-
},
|
|
26
|
-
message: {
|
|
27
|
-
id: `${prefix}.message`,
|
|
28
|
-
defaultMessage: "Message",
|
|
29
|
-
},
|
|
30
|
-
textAreaInputPlaceholder: {
|
|
31
|
-
id: `${prefix}.textAreaInputPlaceholder`,
|
|
32
|
-
defaultMessage: "Please input in-app notification message content",
|
|
33
|
-
},
|
|
34
|
-
addActionLink: {
|
|
35
|
-
id: `${prefix}.addActionLink`,
|
|
36
|
-
defaultMessage: 'Add action link to content',
|
|
37
|
-
},
|
|
38
|
-
addActionLinkDesc: {
|
|
39
|
-
id: `${prefix}.addActionLinkDesc`,
|
|
40
|
-
defaultMessage: 'Add a deep link of the page which customer will be directed to',
|
|
41
|
-
},
|
|
42
|
-
select: {
|
|
43
|
-
id: `${prefix}.select`,
|
|
44
|
-
defaultMessage: "Select",
|
|
45
|
-
},
|
|
46
|
-
mediaLabel: {
|
|
47
|
-
id: `${prefix}.mediaLabel`,
|
|
48
|
-
defaultMessage: "Media",
|
|
49
|
-
},
|
|
50
|
-
mediaText: {
|
|
51
|
-
id: `${prefix}.mediaText`,
|
|
52
|
-
defaultMessage: "Text",
|
|
53
|
-
},
|
|
54
|
-
mediaImage: {
|
|
55
|
-
id: `${prefix}.mediaImage`,
|
|
56
|
-
defaultMessage: "Image",
|
|
57
|
-
},
|
|
58
|
-
btnTypeNone: {
|
|
59
|
-
id: `${prefix}.btnTypeNone`,
|
|
60
|
-
defaultMessage: "None",
|
|
61
|
-
},
|
|
62
|
-
btnTypeCTA: {
|
|
63
|
-
id: `${prefix}.btnTypeCTA`,
|
|
64
|
-
defaultMessage: "Call to action",
|
|
65
|
-
},
|
|
66
|
-
ctaDesc: {
|
|
67
|
-
id: `${prefix}.ctaDesc`,
|
|
68
|
-
defaultMessage:
|
|
69
|
-
"Create a button that lets customers take an action",
|
|
70
|
-
},
|
|
71
|
-
emptyTemplateMessageErrorMessage: {
|
|
72
|
-
id: `${prefix}.emptyTemplateMessageErrorMessage`,
|
|
73
|
-
defaultMessage: "Template message cannot be empty",
|
|
74
|
-
},
|
|
75
|
-
templateMessageLabel: {
|
|
76
|
-
id: `${prefix}.templateMessageLabel`,
|
|
77
|
-
defaultMessage: 'Message',
|
|
78
|
-
},
|
|
79
|
-
btnDisabledTooltip: {
|
|
80
|
-
id: `${prefix}.btnDisabledTooltip`,
|
|
81
|
-
defaultMessage: 'Please add all mandatory fields to proceed further',
|
|
82
|
-
},
|
|
83
|
-
btnLabel: {
|
|
84
|
-
id: `${prefix}.btnLabel`,
|
|
85
|
-
defaultMessage: 'Buttons',
|
|
86
|
-
},
|
|
87
|
-
btnDesc: {
|
|
88
|
-
id: `${prefix}.btnDesc`,
|
|
89
|
-
defaultMessage: 'These will be show clickable buttons below your message.',
|
|
90
|
-
},
|
|
91
|
-
optional: {
|
|
92
|
-
id: `${prefix}.optional`,
|
|
93
|
-
defaultMessage: '(Optional)',
|
|
94
|
-
},
|
|
95
|
-
actionDeepLink: {
|
|
96
|
-
id: `${prefix}.actionDeepLink`,
|
|
97
|
-
defaultMessage: 'Deep Link',
|
|
98
|
-
},
|
|
99
|
-
deepLinkOptionsPlaceholder: {
|
|
100
|
-
id: `${prefix}.deepLinkOptionsPlaceholder`,
|
|
101
|
-
defaultMessage: 'Select deep link',
|
|
102
|
-
},
|
|
103
|
-
coverImage: {
|
|
104
|
-
id: `${prefix}.coverImage`,
|
|
105
|
-
defaultMessage: 'Cover image',
|
|
106
|
-
},
|
|
107
|
-
});
|
|
@@ -1,75 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { injectIntl } from 'react-intl';
|
|
3
|
-
import { browserHistory } from 'react-router';
|
|
4
|
-
import '@testing-library/jest-dom';
|
|
5
|
-
import { Provider } from 'react-redux';
|
|
6
|
-
import configureStore from '../../../store';
|
|
7
|
-
import CapDeviceContent from '../index';
|
|
8
|
-
import { render, screen, fireEvent } from '../../../utils/test-utils';
|
|
9
|
-
import { deviceContentProps } from '../../../v2Containers/InApp/tests/mockData';
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
let store;
|
|
13
|
-
beforeAll(() => {
|
|
14
|
-
store = configureStore({}, browserHistory);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
const ComponentToRender = injectIntl(CapDeviceContent);
|
|
18
|
-
const renderComponent = (props) =>
|
|
19
|
-
render(
|
|
20
|
-
<Provider store={store}>
|
|
21
|
-
<ComponentToRender {...props} />
|
|
22
|
-
</Provider>,
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
describe('Test CapDeviceContent', () => {
|
|
26
|
-
it('test case for CapDeviceContent component Android pane', async () => {
|
|
27
|
-
renderComponent(deviceContentProps);
|
|
28
|
-
const msgBox = screen.getAllByPlaceholderText(/Please input in-app notification message content/i);
|
|
29
|
-
fireEvent.change(msgBox[0], 'val');
|
|
30
|
-
const copyLink = screen.getByRole('link', {
|
|
31
|
-
name: /copy title and content from ios/i,
|
|
32
|
-
});
|
|
33
|
-
fireEvent.click(copyLink);
|
|
34
|
-
expect(copyLink).toBeInTheDocument();
|
|
35
|
-
});
|
|
36
|
-
it('test case for CapDeviceContent component Ios pane', () => {
|
|
37
|
-
renderComponent(
|
|
38
|
-
{...deviceContentProps,
|
|
39
|
-
panes: "iOS",
|
|
40
|
-
buttonType: 'CTA',
|
|
41
|
-
setTemplateMediaType: jest.fn(),
|
|
42
|
-
setButtonType: jest.fn(),
|
|
43
|
-
setCtaData: jest.fn(),
|
|
44
|
-
setTemplateMessage: jest.fn(),
|
|
45
|
-
setTemplateMessageError: jest.fn(),
|
|
46
|
-
setTitle: jest.fn(),
|
|
47
|
-
templateMediType: 'IMAGE',
|
|
48
|
-
addActionLink: true,
|
|
49
|
-
ctaData: [
|
|
50
|
-
{
|
|
51
|
-
index: 0,
|
|
52
|
-
ctaType: "WEBSITE",
|
|
53
|
-
text: "test",
|
|
54
|
-
urlType: "DEEP_LINK",
|
|
55
|
-
url: "",
|
|
56
|
-
isSaved: true,
|
|
57
|
-
label: "Test_1",
|
|
58
|
-
},
|
|
59
|
-
] });
|
|
60
|
-
const msgBox = screen.getAllByPlaceholderText(/Please input in-app notification message content/i);
|
|
61
|
-
msgBox[0].focus();
|
|
62
|
-
fireEvent.change(msgBox[0], { target: {value: 'val'}});
|
|
63
|
-
fireEvent.change(msgBox[0], { target: {value: ''}});
|
|
64
|
-
const titleBox = screen.getAllByPlaceholderText(/Please input message title name/i);
|
|
65
|
-
titleBox[0].focus();
|
|
66
|
-
fireEvent.change(titleBox[0], { target: {value: 'val'}});
|
|
67
|
-
const img = screen.getByText(/image/i);
|
|
68
|
-
fireEvent.click(img);
|
|
69
|
-
const none = screen.getByText(/None/i);
|
|
70
|
-
fireEvent.click(none);
|
|
71
|
-
const editIcon = screen.getByText(/Test_1/i).nextSibling.firstChild;
|
|
72
|
-
fireEvent.click(editIcon);
|
|
73
|
-
expect(screen.getByText(/Test_1/i)).toBeInTheDocument();
|
|
74
|
-
});
|
|
75
|
-
});
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FormattedMessage } from 'react-intl';
|
|
3
|
-
import messages from './messages';
|
|
4
|
-
|
|
5
|
-
export const DEEP_LINK = 'DEEP_LINK';
|
|
6
|
-
export const EXTERNAL_LINK = 'EXTERNAL_LINK';
|
|
7
|
-
export const WEBSITE = 'WEBSITE';
|
|
8
|
-
|
|
9
|
-
export const CTA_OPTIONS = [
|
|
10
|
-
{
|
|
11
|
-
key: DEEP_LINK,
|
|
12
|
-
value: DEEP_LINK,
|
|
13
|
-
label: <FormattedMessage {...messages.ctaLinkTypeDeep} />,
|
|
14
|
-
tooltipLabel: <FormattedMessage {...messages.ctaOptionDisabledTooltipDeepLink} />,
|
|
15
|
-
},
|
|
16
|
-
{
|
|
17
|
-
key: EXTERNAL_LINK,
|
|
18
|
-
value: EXTERNAL_LINK,
|
|
19
|
-
label: <FormattedMessage {...messages.ctaLinkTypeExternal} />,
|
|
20
|
-
tooltipLabel: <FormattedMessage {...messages.ctaOptionDisabledTooltipExternalLink} />,
|
|
21
|
-
},
|
|
22
|
-
];
|
|
23
|
-
|
|
24
|
-
export const BTN_MAX_LENGTH = 20;
|
|
25
|
-
export const URL_MAX_LENGTH = 2000;
|