@capillarytech/creatives-library 8.0.242-alpha.0 → 8.0.242-alpha.2
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/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +2 -1
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/sagas/__tests__/assetPolling.test.js +74 -3
- package/sagas/assetPolling.js +8 -1
- package/services/api.js +10 -5
- package/services/tests/api.test.js +18 -0
- package/translations/en.json +0 -1
- package/utils/common.js +5 -0
- package/utils/commonUtils.js +14 -1
- package/utils/tests/commonUtil.test.js +224 -0
- package/utils/transformTemplateConfig.js +0 -10
- package/utils/transformerUtils.js +0 -42
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapImageUpload/constants.js +0 -2
- package/v2Components/CapImageUpload/index.js +14 -54
- package/v2Components/CapImageUpload/index.scss +1 -4
- package/v2Components/CapImageUpload/messages.js +0 -4
- package/v2Components/CapTagList/index.js +6 -1
- package/v2Components/CapTagListWithInput/index.js +5 -1
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +5 -0
- package/v2Components/ErrorInfoNote/index.js +412 -72
- package/v2Components/ErrorInfoNote/messages.js +22 -0
- package/v2Components/ErrorInfoNote/style.scss +279 -2
- package/v2Components/HtmlEditor/HTMLEditor.js +217 -90
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1132 -133
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +17 -12
- package/v2Components/HtmlEditor/_htmlEditor.scss +15 -23
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +13 -101
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -139
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +2 -1
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +1 -0
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +1 -1
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +1 -0
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +4 -7
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +35 -45
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +1 -3
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +7 -6
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +3 -6
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +10 -11
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +87 -62
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +49 -31
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +254 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +362 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
- package/v2Components/HtmlEditor/constants.js +29 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +95 -85
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +99 -101
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
- package/v2Components/HtmlEditor/utils/validationAdapter.js +34 -41
- package/v2Components/MobilePushPreviewV2/index.js +32 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +44 -24
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +31 -25
- package/v2Containers/App/constants.js +0 -5
- package/v2Containers/BeeEditor/index.js +82 -80
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +193 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/Cap/tests/__snapshots__/index.test.js.snap +0 -1
- package/v2Containers/CreativesContainer/SlideBoxContent.js +148 -120
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +9 -3
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
- package/v2Containers/CreativesContainer/constants.js +1 -2
- package/v2Containers/CreativesContainer/index.js +173 -193
- package/v2Containers/CreativesContainer/messages.js +4 -4
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -50
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +36 -0
- package/v2Containers/Email/actions.js +7 -0
- package/v2Containers/Email/constants.js +5 -1
- package/v2Containers/Email/index.js +13 -0
- package/v2Containers/Email/messages.js +32 -0
- package/v2Containers/Email/reducer.js +12 -1
- package/v2Containers/Email/sagas.js +41 -6
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1046 -0
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +193 -7
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
- package/v2Containers/EmailWrapper/constants.js +2 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +436 -67
- package/v2Containers/EmailWrapper/index.js +99 -23
- package/v2Containers/EmailWrapper/messages.js +61 -1
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +26 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +111 -77
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +376 -0
- package/v2Containers/InApp/__tests__/sagas.test.js +363 -0
- package/v2Containers/InApp/actions.js +7 -0
- package/v2Containers/InApp/constants.js +20 -4
- package/v2Containers/InApp/index.js +800 -357
- package/v2Containers/InApp/index.scss +4 -3
- package/v2Containers/InApp/messages.js +7 -3
- package/v2Containers/InApp/reducer.js +21 -3
- package/v2Containers/InApp/sagas.js +29 -9
- package/v2Containers/InApp/selectors.js +25 -5
- package/v2Containers/InApp/tests/index.test.js +154 -50
- package/v2Containers/InApp/tests/reducer.test.js +34 -0
- package/v2Containers/InApp/tests/sagas.test.js +61 -9
- package/v2Containers/InApp/tests/selectors.test.js +612 -0
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +162 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +9 -0
- package/v2Containers/InAppWrapper/constants.js +16 -0
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +473 -0
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +198 -0
- package/v2Containers/InAppWrapper/index.js +148 -0
- package/v2Containers/InAppWrapper/messages.js +49 -0
- package/v2Containers/InappAdvance/index.js +1099 -0
- package/v2Containers/InappAdvance/index.scss +10 -0
- package/v2Containers/InappAdvance/tests/index.test.js +448 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +3 -3
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -2
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -25
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -18
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -46
- package/v2Containers/SmsTrai/Create/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -8
- package/v2Containers/TagList/index.js +67 -1
- package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
- package/v2Containers/Templates/_templates.scss +56 -200
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +124 -277
- package/v2Containers/Templates/messages.js +4 -24
- package/v2Containers/Templates/reducer.js +0 -2
- package/v2Containers/Templates/tests/index.test.js +0 -10
- package/v2Containers/TemplatesV2/index.js +2 -3
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +35 -132
- package/v2Components/CapImageUrlUpload/constants.js +0 -19
- package/v2Components/CapImageUrlUpload/index.js +0 -455
- package/v2Components/CapImageUrlUpload/index.scss +0 -35
- package/v2Components/CapImageUrlUpload/messages.js +0 -47
- package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -175
- package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
- package/v2Containers/WebPush/Create/components/ButtonList.js +0 -144
- package/v2Containers/WebPush/Create/components/_buttons.scss +0 -246
- package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +0 -554
- package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +0 -607
- package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +0 -633
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +0 -666
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +0 -74
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +0 -80
- package/v2Containers/WebPush/Create/index.js +0 -1755
- package/v2Containers/WebPush/Create/index.scss +0 -123
- package/v2Containers/WebPush/Create/messages.js +0 -199
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -241
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -290
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -81
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -240
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -23
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -144
- package/v2Containers/WebPush/Create/preview/assets/Light.svg +0 -53
- package/v2Containers/WebPush/Create/preview/assets/Top.svg +0 -5
- package/v2Containers/WebPush/Create/preview/assets/chrome-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/edge-icon.png +0 -0
- package/v2Containers/WebPush/Create/preview/assets/firefox-icon.svg +0 -106
- package/v2Containers/WebPush/Create/preview/assets/iOS.svg +0 -26
- package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +0 -18
- package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +0 -29
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -44
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -110
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -72
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -55
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -70
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -512
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -77
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -527
- package/v2Containers/WebPush/Create/preview/constants.js +0 -162
- package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -104
- package/v2Containers/WebPush/Create/preview/preview.scss +0 -409
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -300
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +0 -12
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +0 -303
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +0 -11
- package/v2Containers/WebPush/Create/preview/styles/_base.scss +0 -188
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -106
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -75
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -174
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1077
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -943
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -128
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -121
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +0 -144
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +0 -127
- package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -116
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
- package/v2Containers/WebPush/actions.js +0 -60
- package/v2Containers/WebPush/constants.js +0 -108
- package/v2Containers/WebPush/index.js +0 -2
- package/v2Containers/WebPush/reducer.js +0 -104
- package/v2Containers/WebPush/sagas.js +0 -119
- package/v2Containers/WebPush/selectors.js +0 -65
- package/v2Containers/WebPush/tests/reducer.test.js +0 -863
- package/v2Containers/WebPush/tests/sagas.test.js +0 -566
- package/v2Containers/WebPush/tests/selectors.test.js +0 -960
|
@@ -69,7 +69,7 @@ const CapDeviceContent = (props) => {
|
|
|
69
69
|
templateDescErrorHandler,
|
|
70
70
|
templateTitleError,
|
|
71
71
|
setTemplateTitleError,
|
|
72
|
-
isAiContentBotDisabled
|
|
72
|
+
isAiContentBotDisabled,
|
|
73
73
|
} = props || {};
|
|
74
74
|
const { TextArea } = CapInput;
|
|
75
75
|
const { formatMessage } = intl;
|
|
@@ -167,21 +167,22 @@ const CapDeviceContent = (props) => {
|
|
|
167
167
|
return (
|
|
168
168
|
<>
|
|
169
169
|
<CapRow className="creatives-device-content">
|
|
170
|
-
|
|
170
|
+
<CapLink
|
|
171
171
|
title={isAndroid
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
? formatMessage(messages.copyContentFromIOS)
|
|
173
|
+
: formatMessage(messages.copyCotentFromAndroid)}
|
|
174
174
|
className="inapp-copy-content"
|
|
175
175
|
onClick={onCopyTitleAndContent}
|
|
176
|
-
|
|
176
|
+
/>
|
|
177
177
|
<CapRow className="creatives-inapp-title">
|
|
178
178
|
<CapColumn
|
|
179
|
-
|
|
179
|
+
className="inapp-content-main"
|
|
180
180
|
>
|
|
181
181
|
<CapHeading type="h5" className="inapp-title">
|
|
182
182
|
{formatMessage(messages.title)}
|
|
183
183
|
</CapHeading>
|
|
184
|
-
{getTagList(0)}
|
|
184
|
+
{getTagList(0)}
|
|
185
|
+
{/* here 0 signifies the tags for template title */}
|
|
185
186
|
</CapColumn>
|
|
186
187
|
<CapInput
|
|
187
188
|
id="inapp-title-name-input"
|
|
@@ -213,7 +214,7 @@ const CapDeviceContent = (props) => {
|
|
|
213
214
|
</CapRow>
|
|
214
215
|
<CapRow className={`creatives-inapp-message ${!isMediaTypeImage && "message-bottom-margin"}`}>
|
|
215
216
|
<CapColumn
|
|
216
|
-
|
|
217
|
+
className="inapp-message-header"
|
|
217
218
|
>
|
|
218
219
|
<CapHeading type="h5" className="inapp-message-header-style">
|
|
219
220
|
{formatMessage(messages.message)}
|
|
@@ -222,37 +223,37 @@ const CapDeviceContent = (props) => {
|
|
|
222
223
|
{/* here 1 signifies the tags for template message */}
|
|
223
224
|
</CapColumn>
|
|
224
225
|
<div className="inapp-create-template-message-input-wrapper">
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
/>
|
|
240
|
-
{!isAiContentBotDisabled && (
|
|
241
|
-
<CapAskAira.ContentGenerationBot
|
|
242
|
-
text={templateMessage || ""}
|
|
243
|
-
setText={(text) => {
|
|
244
|
-
onTemplateMessageChange({ target: { value: text } });
|
|
245
|
-
}}
|
|
246
|
-
iconPlacement="float-br"
|
|
247
|
-
iconSize="1.6rem"
|
|
248
|
-
rootStyle={{
|
|
249
|
-
bottom: "0.2rem",
|
|
250
|
-
right: "0.2rem",
|
|
251
|
-
left: "auto",
|
|
252
|
-
position: "absolute",
|
|
253
|
-
}}
|
|
226
|
+
<TextArea
|
|
227
|
+
id="inapp-create-template-message-input"
|
|
228
|
+
className="inapp-create-template-message-input"
|
|
229
|
+
placeholder={formatMessage(messages.textAreaInputPlaceholder)}
|
|
230
|
+
onChange={onTemplateMessageChange}
|
|
231
|
+
value={templateMessage || ""}
|
|
232
|
+
autosize={{ minRows: 5, maxRows: 5 }}
|
|
233
|
+
errorMessage={
|
|
234
|
+
templateMessageError && (
|
|
235
|
+
<CapError className="inapp-template-message-error">
|
|
236
|
+
{templateMessageError}
|
|
237
|
+
</CapError>
|
|
238
|
+
)
|
|
239
|
+
}
|
|
254
240
|
/>
|
|
255
|
-
|
|
241
|
+
{!isAiContentBotDisabled && (
|
|
242
|
+
<CapAskAira.ContentGenerationBot
|
|
243
|
+
text={templateMessage || ""}
|
|
244
|
+
setText={(text) => {
|
|
245
|
+
onTemplateMessageChange({ target: { value: text } });
|
|
246
|
+
}}
|
|
247
|
+
iconPlacement="float-br"
|
|
248
|
+
iconSize="1.6rem"
|
|
249
|
+
rootStyle={{
|
|
250
|
+
bottom: "0.2rem",
|
|
251
|
+
right: "0.2rem",
|
|
252
|
+
left: "auto",
|
|
253
|
+
position: "absolute",
|
|
254
|
+
}}
|
|
255
|
+
/>
|
|
256
|
+
)}
|
|
256
257
|
</div>
|
|
257
258
|
{isMediaTypeImage && (
|
|
258
259
|
<>
|
|
@@ -279,14 +280,16 @@ const CapDeviceContent = (props) => {
|
|
|
279
280
|
</CapRow>
|
|
280
281
|
</CapRow>
|
|
281
282
|
<CapRow className="inapp-action-link">
|
|
282
|
-
<CapCheckbox onChange={onActionLinkCheckBoxChange} checked={addActionLink}/>
|
|
283
|
+
<CapCheckbox onChange={onActionLinkCheckBoxChange} checked={addActionLink} />
|
|
283
284
|
<CapRow className="inapp-render-heading">
|
|
284
285
|
<CapHeader
|
|
285
|
-
title={
|
|
286
|
-
<
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
286
|
+
title={(
|
|
287
|
+
<CapRow type="flex">
|
|
288
|
+
<CapHeading type="h4">
|
|
289
|
+
{formatMessage(messages.addActionLink)}
|
|
290
|
+
</CapHeading>
|
|
291
|
+
</CapRow>
|
|
292
|
+
)}
|
|
290
293
|
description={<CapLabel type="label3">{formatMessage(messages.addActionLinkDesc)}</CapLabel>}
|
|
291
294
|
/>
|
|
292
295
|
{addActionLink && (
|
|
@@ -310,19 +313,21 @@ const CapDeviceContent = (props) => {
|
|
|
310
313
|
<CapRow className="inapp-cta-button">
|
|
311
314
|
<CapHeader
|
|
312
315
|
className="inapp-render-heading-cta-button"
|
|
313
|
-
title={
|
|
314
|
-
<
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
316
|
+
title={(
|
|
317
|
+
<CapRow type="flex">
|
|
318
|
+
<CapHeading type="h4">
|
|
319
|
+
{formatMessage(messages.btnLabel)}
|
|
320
|
+
</CapHeading>
|
|
321
|
+
<CapHeading
|
|
322
|
+
type="h6"
|
|
323
|
+
className="inapp-optional-label"
|
|
324
|
+
>
|
|
325
|
+
{formatMessage(messages.optional)}
|
|
326
|
+
</CapHeading>
|
|
327
|
+
</CapRow>
|
|
328
|
+
)}
|
|
324
329
|
description={<CapLabel type="label3">{formatMessage(messages.btnDesc)}</CapLabel>}
|
|
325
|
-
|
|
330
|
+
/>
|
|
326
331
|
<CapRadioGroup
|
|
327
332
|
options={BUTTON_RADIO_OPTIONS}
|
|
328
333
|
value={buttonType}
|
|
@@ -17,18 +17,17 @@ import {
|
|
|
17
17
|
CapImage,
|
|
18
18
|
CapError,
|
|
19
19
|
} from '@capillarytech/cap-ui-library';
|
|
20
|
-
import { injectIntl, FormattedMessage, intlShape
|
|
20
|
+
import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
|
|
21
21
|
import { isEmpty, get } from 'lodash';
|
|
22
22
|
import './index.scss';
|
|
23
23
|
import Gallery from '../../v2Containers/Assets/Gallery';
|
|
24
24
|
import { MAX_SUPPORTED_IMAGE_SIZE } from './constants';
|
|
25
25
|
import {
|
|
26
|
-
FACEBOOK, INAPP, RCS, WHATSAPP, VIBER,
|
|
26
|
+
FACEBOOK, INAPP, RCS, WHATSAPP, VIBER,
|
|
27
27
|
} from "../../v2Containers/CreativesContainer/constants";
|
|
28
28
|
|
|
29
29
|
import messages from './messages';
|
|
30
30
|
import { MOBILEPUSH } from '../CapVideoUpload/constants';
|
|
31
|
-
import { CAP_SPACE_16 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
32
31
|
function CapImageUpload(props) {
|
|
33
32
|
const {
|
|
34
33
|
intl,
|
|
@@ -51,7 +50,6 @@ function CapImageUpload(props) {
|
|
|
51
50
|
channelSpecificStyle,
|
|
52
51
|
showReUploadButton = true,
|
|
53
52
|
disableAutoRestore = false, // New prop to disable automatic restoration
|
|
54
|
-
recommendedDimensions, // Array of {width, height} objects for recommended dimensions
|
|
55
53
|
} = props;
|
|
56
54
|
const {
|
|
57
55
|
formatMessage,
|
|
@@ -74,7 +72,7 @@ function CapImageUpload(props) {
|
|
|
74
72
|
const [isImageError, updateImageErrorMessage] = useState(false);
|
|
75
73
|
const [isDrawerRequired, updateDrawerRequirement] = useState(false);
|
|
76
74
|
|
|
77
|
-
const {
|
|
75
|
+
const {CapHeadingSpan} = CapHeading;
|
|
78
76
|
const ImageComponent = useCallback(
|
|
79
77
|
() => (
|
|
80
78
|
<>
|
|
@@ -93,7 +91,7 @@ function CapImageUpload(props) {
|
|
|
93
91
|
|
|
94
92
|
const WithLabel = LabelHOC(ImageComponent);
|
|
95
93
|
|
|
96
|
-
const uploadImages = useCallback((e, {
|
|
94
|
+
const uploadImages = useCallback((e, {files}) => {
|
|
97
95
|
if (e) {
|
|
98
96
|
e.preventDefault();
|
|
99
97
|
}
|
|
@@ -111,13 +109,13 @@ function CapImageUpload(props) {
|
|
|
111
109
|
height: img.height,
|
|
112
110
|
error: file && (file.size / (1e+6) > 5), // Checking if file exists and its size is greater than 5MB (5 * 10^6 bytes)
|
|
113
111
|
};
|
|
114
|
-
submitAction({
|
|
112
|
+
submitAction({file, type: 'image', fileParams}, incorrectFile);
|
|
115
113
|
};
|
|
116
114
|
img.onerror = () => {
|
|
117
115
|
const fileParams = {
|
|
118
116
|
error: true,
|
|
119
117
|
};
|
|
120
|
-
submitAction({
|
|
118
|
+
submitAction({fileParams}, incorrectFile);
|
|
121
119
|
};
|
|
122
120
|
if (e) {
|
|
123
121
|
const event = e;
|
|
@@ -125,7 +123,7 @@ function CapImageUpload(props) {
|
|
|
125
123
|
}
|
|
126
124
|
}, []);
|
|
127
125
|
|
|
128
|
-
const rcsValidation = useCallback((incorrectFile, data, size, height, width, error) => {
|
|
126
|
+
const rcsValidation = useCallback((incorrectFile, data, size, height, width, error) => {
|
|
129
127
|
if (incorrectFile || size < minImgSize || size > imgSize || height !== imgHeight || width !== imgWidth || error) {
|
|
130
128
|
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
131
129
|
} else {
|
|
@@ -148,19 +146,6 @@ function CapImageUpload(props) {
|
|
|
148
146
|
const { height, width, error } = fileParams || {};
|
|
149
147
|
if (channel === RCS) {
|
|
150
148
|
rcsValidation(incorrectFile, data, size, height, width, error);
|
|
151
|
-
} else if ([WEBPUSH, WEBPUSH_BRAND_ICON].includes(channel)) {
|
|
152
|
-
// For WEBPUSH, only validate file extension, size, and format - no dimension validation
|
|
153
|
-
if (incorrectFile || size > imgSize || error) {
|
|
154
|
-
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
155
|
-
} else {
|
|
156
|
-
updateImageErrorMessage('');
|
|
157
|
-
uploadAsset(
|
|
158
|
-
data.file,
|
|
159
|
-
data.type,
|
|
160
|
-
data.fileParams,
|
|
161
|
-
index,
|
|
162
|
-
);
|
|
163
|
-
}
|
|
164
149
|
} else if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth || error) {
|
|
165
150
|
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
166
151
|
} else {
|
|
@@ -175,7 +160,7 @@ function CapImageUpload(props) {
|
|
|
175
160
|
}, [isImageError]);
|
|
176
161
|
|
|
177
162
|
const capUploaderCustomRequest = useCallback((uploadData) => {
|
|
178
|
-
uploadImages(undefined, {
|
|
163
|
+
uploadImages(undefined, {files: [uploadData.file]});
|
|
179
164
|
}, [uploadImages]);
|
|
180
165
|
|
|
181
166
|
const setDrawerVisibility = useCallback((drawervisibleFlag) => updateDrawerRequirement(drawervisibleFlag), [isDrawerRequired]);
|
|
@@ -196,27 +181,19 @@ function CapImageUpload(props) {
|
|
|
196
181
|
secure_file_path: image, width, height, file_size: size,
|
|
197
182
|
} = get(imageTemplate, 'metaInfo', {});
|
|
198
183
|
updateDrawerRequirement(false);
|
|
199
|
-
|
|
200
|
-
if ([WEBPUSH, WEBPUSH_BRAND_ICON].includes(channel)) {
|
|
201
|
-
if (!allowedExtensionsRegex.test(image) || size > imgSize) {
|
|
202
|
-
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
203
|
-
} else {
|
|
204
|
-
updateImageErrorMessage('');
|
|
205
|
-
updateImageSrc(image);
|
|
206
|
-
}
|
|
207
|
-
} else if (!allowedExtensionsRegex.test(image) || height > imgHeight || width > imgWidth || size > imgSize) {
|
|
184
|
+
if (!allowedExtensionsRegex.test(image) || height > imgHeight || width > imgWidth || size > imgSize ) {
|
|
208
185
|
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
209
186
|
} else {
|
|
210
187
|
updateImageErrorMessage('');
|
|
211
188
|
updateImageSrc(image);
|
|
212
189
|
}
|
|
213
|
-
}, [isImageError, isDrawerRequired
|
|
190
|
+
}, [isImageError, isDrawerRequired]);
|
|
214
191
|
|
|
215
192
|
const getGalleryDrawerContent = useCallback(() => {
|
|
216
193
|
const locationGallery = {
|
|
217
194
|
pathname: `/assets`,
|
|
218
195
|
search: '',
|
|
219
|
-
query: !isFullMode ? {
|
|
196
|
+
query: !isFullMode ? {type: 'embedded', module: 'library'} : {},
|
|
220
197
|
};
|
|
221
198
|
return (
|
|
222
199
|
<>
|
|
@@ -285,7 +262,7 @@ function CapImageUpload(props) {
|
|
|
285
262
|
className="dragger-button re-upload"
|
|
286
263
|
type="flat"
|
|
287
264
|
onClick={onReUpload}
|
|
288
|
-
style={channelSpecificStyle ? { marginTop:
|
|
265
|
+
style={channelSpecificStyle ? { marginTop: '-16px'} : {}}
|
|
289
266
|
>
|
|
290
267
|
<FormattedMessage {...messages.imageReUpload} />
|
|
291
268
|
</CapButton>
|
|
@@ -328,18 +305,7 @@ function CapImageUpload(props) {
|
|
|
328
305
|
)}
|
|
329
306
|
{![WHATSAPP, INAPP].includes(channel) && (
|
|
330
307
|
<CapHeadingSpan type="label2" className="image-dimension">
|
|
331
|
-
{
|
|
332
|
-
<FormattedMessage
|
|
333
|
-
{...messages.recommendedDimensions}
|
|
334
|
-
values={{
|
|
335
|
-
dimensions: recommendedDimensions
|
|
336
|
-
.map((dim) => `${dim.width} x ${dim.height}px`)
|
|
337
|
-
.join(', '),
|
|
338
|
-
}}
|
|
339
|
-
/>
|
|
340
|
-
) : (
|
|
341
|
-
<FormattedMessage {...messages.imageDimenstionDescription} values={{ width: imgWidth, height: imgHeight }} />
|
|
342
|
-
)}
|
|
308
|
+
<FormattedMessage {...messages.imageDimenstionDescription} values={{ width: imgWidth, height: imgHeight }} />
|
|
343
309
|
</CapHeadingSpan>
|
|
344
310
|
)}
|
|
345
311
|
{channel === FACEBOOK && (
|
|
@@ -362,7 +328,7 @@ function CapImageUpload(props) {
|
|
|
362
328
|
getImageSizeLabel()
|
|
363
329
|
)
|
|
364
330
|
)}
|
|
365
|
-
{[VIBER, INAPP, MOBILEPUSH
|
|
331
|
+
{[VIBER, INAPP, MOBILEPUSH].includes(channel) && getImageSizeLabel()}
|
|
366
332
|
<CapHeadingSpan type="label2" className="image-format">
|
|
367
333
|
{channel === INAPP ? <FormattedMessage {...messages.format2} /> : <FormattedMessage {...messages.format} />}
|
|
368
334
|
</CapHeadingSpan>
|
|
@@ -391,12 +357,6 @@ CapImageUpload.propTypes = {
|
|
|
391
357
|
channel: PropTypes.string,
|
|
392
358
|
channelSpecificStyle: PropTypes.bool,
|
|
393
359
|
disableAutoRestore: PropTypes.bool,
|
|
394
|
-
recommendedDimensions: PropTypes.arrayOf(
|
|
395
|
-
PropTypes.shape({
|
|
396
|
-
width: PropTypes.number.isRequired,
|
|
397
|
-
height: PropTypes.number.isRequired,
|
|
398
|
-
})
|
|
399
|
-
),
|
|
400
360
|
};
|
|
401
361
|
|
|
402
362
|
export default injectIntl(CapImageUpload);
|
|
@@ -34,10 +34,6 @@ export default defineMessages({
|
|
|
34
34
|
id: `${scope}.imageDimenstionDescription`,
|
|
35
35
|
defaultMessage: 'Dimensions upto: {width}px x {height}px',
|
|
36
36
|
},
|
|
37
|
-
recommendedDimensions: {
|
|
38
|
-
id: `${scope}.recommendedDimensions`,
|
|
39
|
-
defaultMessage: 'Recommended dimensions: {dimensions}',
|
|
40
|
-
},
|
|
41
37
|
format: {
|
|
42
38
|
id: `${scope}.format`,
|
|
43
39
|
defaultMessage: 'Format: JPEG, JPG, PNG',
|
|
@@ -227,6 +227,10 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
227
227
|
|
|
228
228
|
togglePopoverVisibility = (visible) => {
|
|
229
229
|
this.setState({visible});
|
|
230
|
+
// Call onVisibleChange callback if provided (for triggering API calls when popover opens)
|
|
231
|
+
if (this.props.onVisibleChange) {
|
|
232
|
+
this.props.onVisibleChange(visible);
|
|
233
|
+
}
|
|
230
234
|
};
|
|
231
235
|
|
|
232
236
|
renderDynamicTagFlow = () => {
|
|
@@ -468,7 +472,7 @@ class CapTagList extends React.Component { // eslint-disable-line react/prefer-s
|
|
|
468
472
|
onVisibleChange={this.togglePopoverVisibility}
|
|
469
473
|
content={contentSection}
|
|
470
474
|
trigger="click"
|
|
471
|
-
placement={channel === EMAIL.toUpperCase() ? "leftTop" : "rightTop"}
|
|
475
|
+
placement={this.props.popoverPlacement || (channel === EMAIL.toUpperCase() ? "leftTop" : "rightTop")}
|
|
472
476
|
>
|
|
473
477
|
<CapTooltip
|
|
474
478
|
title={
|
|
@@ -535,6 +539,7 @@ CapTagList.propTypes = {
|
|
|
535
539
|
channel: PropTypes.string,
|
|
536
540
|
disabled: PropTypes.bool,
|
|
537
541
|
fetchingSchemaError: PropTypes.bool,
|
|
542
|
+
popoverPlacement: PropTypes.string,
|
|
538
543
|
};
|
|
539
544
|
|
|
540
545
|
CapTagList.defaultValue = {
|
|
@@ -48,13 +48,14 @@ export const CapTagListWithInput = (props) => {
|
|
|
48
48
|
showTagList = true,
|
|
49
49
|
showInput = true,
|
|
50
50
|
inputProps = {},
|
|
51
|
+
popoverPlacement,
|
|
51
52
|
} = props;
|
|
52
53
|
|
|
53
54
|
const { formatMessage } = intl;
|
|
54
55
|
|
|
55
56
|
return (
|
|
56
57
|
<CapColumn style={containerStyle}>
|
|
57
|
-
<CapRow
|
|
58
|
+
<CapRow align="middle" type="flex">
|
|
58
59
|
{showHeading && headingText && (
|
|
59
60
|
<CapHeading type={headingType} style={headingStyle}>
|
|
60
61
|
{headingText}
|
|
@@ -76,6 +77,7 @@ export const CapTagListWithInput = (props) => {
|
|
|
76
77
|
selectedOfferDetails={selectedOfferDetails}
|
|
77
78
|
eventContextTags={eventContextTags}
|
|
78
79
|
style={tagListStyle}
|
|
80
|
+
popoverPlacement={popoverPlacement}
|
|
79
81
|
/>
|
|
80
82
|
)}
|
|
81
83
|
</CapRow>
|
|
@@ -136,6 +138,7 @@ CapTagListWithInput.propTypes = {
|
|
|
136
138
|
showHeading: PropTypes.bool,
|
|
137
139
|
showTagList: PropTypes.bool,
|
|
138
140
|
showInput: PropTypes.bool,
|
|
141
|
+
popoverPlacement: PropTypes.string,
|
|
139
142
|
};
|
|
140
143
|
|
|
141
144
|
CapTagListWithInput.defaultProps = {
|
|
@@ -164,6 +167,7 @@ CapTagListWithInput.defaultProps = {
|
|
|
164
167
|
showTagList: true,
|
|
165
168
|
showInput: true,
|
|
166
169
|
inputProps: {},
|
|
170
|
+
popoverPlacement: undefined,
|
|
167
171
|
};
|
|
168
172
|
|
|
169
173
|
export default injectIntl(CapTagListWithInput);
|
|
@@ -4,6 +4,11 @@ import '@testing-library/jest-dom';
|
|
|
4
4
|
import { render, screen, fireEvent } from '../../../utils/test-utils';
|
|
5
5
|
import { CapWhatsappCTA } from '../index';
|
|
6
6
|
|
|
7
|
+
// Mock the missing reducer
|
|
8
|
+
jest.mock('@capillarytech/cap-ui-library/CapCollapsibleLeftNavigation/reducer', () => {
|
|
9
|
+
return (state = {}) => state;
|
|
10
|
+
}, { virtual: true });
|
|
11
|
+
|
|
7
12
|
const updateHandler = jest.fn();
|
|
8
13
|
const deleteHandler = jest.fn();
|
|
9
14
|
const initializeComponent = (
|