@capillarytech/creatives-library 8.0.266-alpha.0 → 8.0.266
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 -2
- package/initialReducer.js +0 -2
- package/package.json +1 -1
- package/services/api.js +5 -10
- package/services/tests/api.test.js +0 -34
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +35 -17
- package/tests/integration/TemplateCreation/api-response.js +1 -31
- package/tests/integration/TemplateCreation/msw-handler.js +0 -2
- package/utils/common.js +6 -5
- package/utils/commonUtils.js +5 -28
- package/utils/imageUrlUpload.js +141 -0
- package/utils/tests/commonUtil.test.js +0 -224
- package/utils/tests/transformerUtils.test.js +297 -0
- package/utils/transformTemplateConfig.js +10 -0
- package/utils/transformerUtils.js +40 -0
- package/v2Components/CapDeviceContent/index.js +56 -61
- package/v2Components/CapImageUpload/constants.js +2 -0
- package/v2Components/CapImageUpload/index.js +65 -16
- package/v2Components/CapImageUpload/index.scss +4 -1
- package/v2Components/CapImageUpload/messages.js +5 -1
- package/v2Components/CapImageUrlUpload/constants.js +26 -0
- package/v2Components/CapImageUrlUpload/index.js +365 -0
- package/v2Components/CapImageUrlUpload/index.scss +35 -0
- package/v2Components/CapImageUrlUpload/messages.js +47 -0
- package/v2Components/CapTagList/index.js +1 -6
- package/v2Components/CapTagListWithInput/index.js +1 -5
- package/v2Components/CapTagListWithInput/messages.js +1 -1
- package/v2Components/CapWhatsappCTA/tests/index.test.js +0 -5
- package/v2Components/ErrorInfoNote/index.js +72 -402
- package/v2Components/ErrorInfoNote/messages.js +6 -32
- package/v2Components/ErrorInfoNote/style.scss +6 -278
- package/v2Components/FormBuilder/tests/index.test.js +4 -13
- package/v2Components/HtmlEditor/HTMLEditor.js +99 -418
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +133 -1882
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +16 -27
- package/v2Components/HtmlEditor/_htmlEditor.scss +45 -108
- package/v2Components/HtmlEditor/_index.lazy.scss +1 -0
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +102 -23
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +140 -148
- package/v2Components/HtmlEditor/components/DeviceToggle/_deviceToggle.scss +1 -2
- package/v2Components/HtmlEditor/components/DeviceToggle/index.js +3 -3
- package/v2Components/HtmlEditor/components/EditorToolbar/_editorToolbar.scss +1 -9
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +6 -31
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +0 -22
- package/v2Components/HtmlEditor/components/InAppPreviewPane/DeviceFrame.js +7 -4
- package/v2Components/HtmlEditor/components/InAppPreviewPane/__tests__/DeviceFrame.test.js +45 -35
- package/v2Components/HtmlEditor/components/InAppPreviewPane/_inAppPreviewPane.scss +3 -1
- package/v2Components/HtmlEditor/components/InAppPreviewPane/constants.js +33 -33
- package/v2Components/HtmlEditor/components/InAppPreviewPane/index.js +6 -7
- package/v2Components/HtmlEditor/components/PreviewPane/_previewPane.scss +10 -7
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +43 -22
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +152 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +0 -18
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +31 -36
- package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +34 -46
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +46 -52
- package/v2Components/HtmlEditor/constants.js +20 -45
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +16 -373
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +16 -351
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +2 -5
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +146 -88
- package/v2Components/HtmlEditor/hooks/useValidation.js +56 -213
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +94 -102
- package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +45 -214
- package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +0 -134
- package/v2Components/HtmlEditor/utils/contentSanitizer.js +41 -40
- package/v2Components/HtmlEditor/utils/htmlValidator.js +72 -71
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +124 -158
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +25 -23
- package/v2Components/HtmlEditor/utils/validationAdapter.js +41 -66
- package/v2Components/MobilePushPreviewV2/index.js +7 -33
- package/v2Components/TemplatePreview/_templatePreview.scss +24 -55
- package/v2Components/TemplatePreview/index.js +32 -47
- package/v2Components/TemplatePreview/messages.js +0 -4
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +0 -1
- package/v2Containers/App/constants.js +5 -0
- package/v2Containers/BeeEditor/index.js +90 -172
- package/v2Containers/CreativesContainer/SlideBoxContent.js +108 -129
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +13 -163
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
- package/v2Containers/CreativesContainer/constants.js +3 -1
- package/v2Containers/CreativesContainer/index.js +214 -240
- package/v2Containers/CreativesContainer/messages.js +4 -8
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +210 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +2 -11
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +354 -38
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +0 -103
- package/v2Containers/Email/actions.js +0 -7
- package/v2Containers/Email/constants.js +1 -5
- package/v2Containers/Email/index.js +29 -234
- package/v2Containers/Email/messages.js +0 -32
- package/v2Containers/Email/reducer.js +1 -12
- package/v2Containers/Email/sagas.js +7 -61
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +0 -2
- package/v2Containers/Email/tests/reducer.test.js +0 -46
- package/v2Containers/Email/tests/sagas.test.js +29 -320
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +21 -211
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +74 -40
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +67 -2
- package/v2Containers/EmailWrapper/constants.js +0 -2
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +77 -629
- package/v2Containers/EmailWrapper/index.js +23 -103
- package/v2Containers/EmailWrapper/messages.js +1 -65
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +214 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +77 -594
- package/v2Containers/InApp/actions.js +0 -7
- package/v2Containers/InApp/constants.js +4 -20
- package/v2Containers/InApp/index.js +359 -802
- package/v2Containers/InApp/index.scss +3 -4
- package/v2Containers/InApp/messages.js +3 -7
- package/v2Containers/InApp/reducer.js +3 -21
- package/v2Containers/InApp/sagas.js +9 -29
- package/v2Containers/InApp/selectors.js +5 -25
- package/v2Containers/InApp/tests/index.test.js +50 -154
- package/v2Containers/InApp/tests/reducer.test.js +0 -34
- package/v2Containers/InApp/tests/sagas.test.js +9 -61
- 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 -12
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +0 -4
- package/v2Containers/TagList/index.js +19 -62
- package/v2Containers/Templates/ChannelTypeIllustration.js +13 -1
- package/v2Containers/Templates/_templates.scss +202 -56
- package/v2Containers/Templates/actions.js +2 -1
- package/v2Containers/Templates/constants.js +1 -0
- package/v2Containers/Templates/index.js +278 -123
- package/v2Containers/Templates/messages.js +24 -4
- package/v2Containers/Templates/reducer.js +2 -0
- package/v2Containers/Templates/tests/index.test.js +10 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +2 -4
- package/v2Containers/TemplatesV2/index.js +15 -7
- package/v2Containers/TemplatesV2/messages.js +4 -0
- package/v2Containers/WebPush/Create/components/BrandIconSection.js +108 -0
- package/v2Containers/WebPush/Create/components/ButtonForm.js +172 -0
- package/v2Containers/WebPush/Create/components/ButtonItem.js +101 -0
- package/v2Containers/WebPush/Create/components/ButtonList.js +145 -0
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +164 -0
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.test.js +463 -0
- package/v2Containers/WebPush/Create/components/FormActions.js +54 -0
- package/v2Containers/WebPush/Create/components/FormActions.test.js +163 -0
- package/v2Containers/WebPush/Create/components/MediaSection.js +142 -0
- package/v2Containers/WebPush/Create/components/MediaSection.test.js +341 -0
- package/v2Containers/WebPush/Create/components/MessageSection.js +103 -0
- package/v2Containers/WebPush/Create/components/MessageSection.test.js +268 -0
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +87 -0
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.test.js +210 -0
- package/v2Containers/WebPush/Create/components/TemplateNameSection.js +54 -0
- package/v2Containers/WebPush/Create/components/TemplateNameSection.test.js +143 -0
- package/v2Containers/WebPush/Create/components/__snapshots__/ButtonsLinksSection.test.js.snap +86 -0
- package/v2Containers/WebPush/Create/components/__snapshots__/FormActions.test.js.snap +16 -0
- package/v2Containers/WebPush/Create/components/__snapshots__/MediaSection.test.js.snap +41 -0
- package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +54 -0
- package/v2Containers/WebPush/Create/components/__snapshots__/NotificationTitleSection.test.js.snap +37 -0
- package/v2Containers/WebPush/Create/components/__snapshots__/TemplateNameSection.test.js.snap +21 -0
- package/v2Containers/WebPush/Create/components/_buttons.scss +246 -0
- package/v2Containers/WebPush/Create/components/tests/ButtonForm.test.js +554 -0
- package/v2Containers/WebPush/Create/components/tests/ButtonItem.test.js +607 -0
- package/v2Containers/WebPush/Create/components/tests/ButtonList.test.js +633 -0
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonForm.test.js.snap +666 -0
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonItem.test.js.snap +74 -0
- package/v2Containers/WebPush/Create/components/tests/__snapshots__/ButtonList.test.js.snap +78 -0
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.js +138 -0
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.test.js +406 -0
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.js +30 -0
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.test.js +151 -0
- package/v2Containers/WebPush/Create/hooks/useImageUpload.js +104 -0
- package/v2Containers/WebPush/Create/hooks/useImageUpload.test.js +538 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +122 -0
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +633 -0
- package/v2Containers/WebPush/Create/index.js +1148 -0
- package/v2Containers/WebPush/Create/index.scss +134 -0
- package/v2Containers/WebPush/Create/messages.js +211 -0
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +228 -0
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +294 -0
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +90 -0
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +305 -0
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +25 -0
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +156 -0
- package/v2Containers/WebPush/Create/preview/assets/Light.svg +53 -0
- package/v2Containers/WebPush/Create/preview/assets/Top.svg +5 -0
- package/v2Containers/WebPush/Create/preview/assets/android-arrow-down.svg +9 -0
- package/v2Containers/WebPush/Create/preview/assets/android-arrow-up.svg +9 -0
- 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 +106 -0
- package/v2Containers/WebPush/Create/preview/assets/iOS.svg +26 -0
- package/v2Containers/WebPush/Create/preview/assets/macos-arrow-down-icon.svg +9 -0
- package/v2Containers/WebPush/Create/preview/assets/macos-triple-dot-icon.svg +9 -0
- package/v2Containers/WebPush/Create/preview/assets/opera-icon.svg +18 -0
- package/v2Containers/WebPush/Create/preview/assets/safari-icon.svg +29 -0
- package/v2Containers/WebPush/Create/preview/assets/windows-close-icon.svg +9 -0
- package/v2Containers/WebPush/Create/preview/assets/windows-triple-dot-icon.svg +9 -0
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +51 -0
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +145 -0
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +45 -0
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +68 -0
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +61 -0
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +99 -0
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +733 -0
- package/v2Containers/WebPush/Create/preview/components/tests/WindowsChromeExpanded.test.js +571 -0
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +85 -0
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/WindowsChromeExpanded.test.js.snap +81 -0
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +50 -0
- package/v2Containers/WebPush/Create/preview/constants.js +637 -0
- package/v2Containers/WebPush/Create/preview/notification-container.scss +79 -0
- package/v2Containers/WebPush/Create/preview/preview.scss +358 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +370 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-edge.scss +12 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-firefox.scss +12 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-opera.scss +12 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-chrome.scss +47 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-edge.scss +11 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-firefox.scss +11 -0
- package/v2Containers/WebPush/Create/preview/styles/_android-tablet-opera.scss +11 -0
- package/v2Containers/WebPush/Create/preview/styles/_base.scss +207 -0
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +153 -0
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +107 -0
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +101 -0
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +229 -0
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +906 -0
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +1081 -0
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +723 -0
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +1327 -0
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +131 -0
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +112 -0
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/PreviewControls.test.js.snap +144 -0
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/WebPushPreview.test.js.snap +129 -0
- package/v2Containers/WebPush/Create/utils/payloadBuilder.js +96 -0
- package/v2Containers/WebPush/Create/utils/payloadBuilder.test.js +396 -0
- package/v2Containers/WebPush/Create/utils/previewUtils.js +89 -0
- package/v2Containers/WebPush/Create/utils/urlValidation.js +115 -0
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +449 -0
- package/v2Containers/WebPush/Create/utils/validation.js +75 -0
- package/v2Containers/WebPush/Create/utils/validation.test.js +283 -0
- package/v2Containers/WebPush/actions.js +60 -0
- package/v2Containers/WebPush/constants.js +132 -0
- package/v2Containers/WebPush/index.js +2 -0
- package/v2Containers/WebPush/reducer.js +104 -0
- package/v2Containers/WebPush/sagas.js +119 -0
- package/v2Containers/WebPush/selectors.js +65 -0
- package/v2Containers/WebPush/tests/reducer.test.js +863 -0
- package/v2Containers/WebPush/tests/sagas.test.js +566 -0
- package/v2Containers/WebPush/tests/selectors.test.js +960 -0
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +0 -34
- package/v2Components/ErrorInfoNote/constants.js +0 -1
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +0 -870
- package/v2Components/HtmlEditor/components/ValidationPanel/constants.js +0 -6
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +0 -277
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +0 -295
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +0 -51
- package/v2Components/HtmlEditor/utils/validationConstants.js +0 -38
- package/v2Components/MobilePushPreviewV2/constants.js +0 -6
- package/v2Containers/BeePopupEditor/_beePopupEditor.scss +0 -14
- package/v2Containers/BeePopupEditor/constants.js +0 -10
- package/v2Containers/BeePopupEditor/index.js +0 -194
- package/v2Containers/BeePopupEditor/tests/index.test.js +0 -627
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +0 -1246
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +0 -2472
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +0 -520
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +0 -956
- package/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +0 -376
- package/v2Containers/InApp/__tests__/sagas.test.js +0 -363
- package/v2Containers/InApp/tests/selectors.test.js +0 -612
- package/v2Containers/InAppWrapper/components/InAppWrapperView.js +0 -151
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +0 -267
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +0 -23
- package/v2Containers/InAppWrapper/constants.js +0 -16
- package/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +0 -473
- package/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +0 -198
- package/v2Containers/InAppWrapper/index.js +0 -148
- package/v2Containers/InAppWrapper/messages.js +0 -49
- package/v2Containers/InappAdvance/index.js +0 -1099
- package/v2Containers/InappAdvance/index.scss +0 -10
- package/v2Containers/InappAdvance/tests/index.test.js +0 -448
|
@@ -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,22 +167,21 @@ 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)}
|
|
185
|
-
{/* here 0 signifies the tags for template title */}
|
|
184
|
+
{getTagList(0)} {/* here 0 signifies the tags for template title */}
|
|
186
185
|
</CapColumn>
|
|
187
186
|
<CapInput
|
|
188
187
|
id="inapp-title-name-input"
|
|
@@ -214,7 +213,7 @@ const CapDeviceContent = (props) => {
|
|
|
214
213
|
</CapRow>
|
|
215
214
|
<CapRow className={`creatives-inapp-message ${!isMediaTypeImage && "message-bottom-margin"}`}>
|
|
216
215
|
<CapColumn
|
|
217
|
-
|
|
216
|
+
className="inapp-message-header"
|
|
218
217
|
>
|
|
219
218
|
<CapHeading type="h5" className="inapp-message-header-style">
|
|
220
219
|
{formatMessage(messages.message)}
|
|
@@ -223,37 +222,37 @@ const CapDeviceContent = (props) => {
|
|
|
223
222
|
{/* here 1 signifies the tags for template message */}
|
|
224
223
|
</CapColumn>
|
|
225
224
|
<div className="inapp-create-template-message-input-wrapper">
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
225
|
+
<TextArea
|
|
226
|
+
id="inapp-create-template-message-input"
|
|
227
|
+
className="inapp-create-template-message-input"
|
|
228
|
+
placeholder={formatMessage(messages.textAreaInputPlaceholder)}
|
|
229
|
+
onChange={onTemplateMessageChange}
|
|
230
|
+
value={templateMessage || ""}
|
|
231
|
+
autosize={{ minRows: 5, maxRows: 5 }}
|
|
232
|
+
errorMessage={
|
|
233
|
+
templateMessageError && (
|
|
234
|
+
<CapError className="inapp-template-message-error">
|
|
235
|
+
{templateMessageError}
|
|
236
|
+
</CapError>
|
|
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
|
+
}}
|
|
240
254
|
/>
|
|
241
|
-
|
|
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
|
-
)}
|
|
255
|
+
)}
|
|
257
256
|
</div>
|
|
258
257
|
{isMediaTypeImage && (
|
|
259
258
|
<>
|
|
@@ -280,16 +279,14 @@ const CapDeviceContent = (props) => {
|
|
|
280
279
|
</CapRow>
|
|
281
280
|
</CapRow>
|
|
282
281
|
<CapRow className="inapp-action-link">
|
|
283
|
-
<CapCheckbox onChange={onActionLinkCheckBoxChange} checked={addActionLink}
|
|
282
|
+
<CapCheckbox onChange={onActionLinkCheckBoxChange} checked={addActionLink}/>
|
|
284
283
|
<CapRow className="inapp-render-heading">
|
|
285
284
|
<CapHeader
|
|
286
|
-
title={
|
|
287
|
-
<
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
</CapRow>
|
|
292
|
-
)}
|
|
285
|
+
title={<CapRow type="flex">
|
|
286
|
+
<CapHeading type="h4">
|
|
287
|
+
{formatMessage(messages.addActionLink)}
|
|
288
|
+
</CapHeading>
|
|
289
|
+
</CapRow>}
|
|
293
290
|
description={<CapLabel type="label3">{formatMessage(messages.addActionLinkDesc)}</CapLabel>}
|
|
294
291
|
/>
|
|
295
292
|
{addActionLink && (
|
|
@@ -313,21 +310,19 @@ const CapDeviceContent = (props) => {
|
|
|
313
310
|
<CapRow className="inapp-cta-button">
|
|
314
311
|
<CapHeader
|
|
315
312
|
className="inapp-render-heading-cta-button"
|
|
316
|
-
title={
|
|
317
|
-
<
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
</CapRow>
|
|
328
|
-
)}
|
|
313
|
+
title={<CapRow type="flex">
|
|
314
|
+
<CapHeading type="h4">
|
|
315
|
+
{formatMessage(messages.btnLabel)}
|
|
316
|
+
</CapHeading>
|
|
317
|
+
<CapHeading
|
|
318
|
+
type="h6"
|
|
319
|
+
className="inapp-optional-label"
|
|
320
|
+
>
|
|
321
|
+
{formatMessage(messages.optional)}
|
|
322
|
+
</CapHeading>
|
|
323
|
+
</CapRow>}
|
|
329
324
|
description={<CapLabel type="label3">{formatMessage(messages.btnDesc)}</CapLabel>}
|
|
330
|
-
|
|
325
|
+
/>
|
|
331
326
|
<CapRadioGroup
|
|
332
327
|
options={BUTTON_RADIO_OPTIONS}
|
|
333
328
|
value={buttonType}
|
|
@@ -17,17 +17,18 @@ import {
|
|
|
17
17
|
CapImage,
|
|
18
18
|
CapError,
|
|
19
19
|
} from '@capillarytech/cap-ui-library';
|
|
20
|
-
import { injectIntl, FormattedMessage, intlShape} from 'react-intl';
|
|
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, WEBPUSH, WEBPUSH_BRAND_ICON
|
|
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';
|
|
31
32
|
function CapImageUpload(props) {
|
|
32
33
|
const {
|
|
33
34
|
intl,
|
|
@@ -50,6 +51,8 @@ function CapImageUpload(props) {
|
|
|
50
51
|
channelSpecificStyle,
|
|
51
52
|
showReUploadButton = true,
|
|
52
53
|
disableAutoRestore = false, // New prop to disable automatic restoration
|
|
54
|
+
recommendedDimensions, // Array of {width, height} objects for recommended dimensions
|
|
55
|
+
disabled = false,
|
|
53
56
|
} = props;
|
|
54
57
|
const {
|
|
55
58
|
formatMessage,
|
|
@@ -72,7 +75,7 @@ function CapImageUpload(props) {
|
|
|
72
75
|
const [isImageError, updateImageErrorMessage] = useState(false);
|
|
73
76
|
const [isDrawerRequired, updateDrawerRequirement] = useState(false);
|
|
74
77
|
|
|
75
|
-
const {CapHeadingSpan} = CapHeading;
|
|
78
|
+
const { CapHeadingSpan } = CapHeading;
|
|
76
79
|
const ImageComponent = useCallback(
|
|
77
80
|
() => (
|
|
78
81
|
<>
|
|
@@ -91,7 +94,7 @@ function CapImageUpload(props) {
|
|
|
91
94
|
|
|
92
95
|
const WithLabel = LabelHOC(ImageComponent);
|
|
93
96
|
|
|
94
|
-
const uploadImages = useCallback((e, {files}) => {
|
|
97
|
+
const uploadImages = useCallback((e, { files }) => {
|
|
95
98
|
if (e) {
|
|
96
99
|
e.preventDefault();
|
|
97
100
|
}
|
|
@@ -109,13 +112,13 @@ function CapImageUpload(props) {
|
|
|
109
112
|
height: img.height,
|
|
110
113
|
error: file && (file.size / (1e+6) > 5), // Checking if file exists and its size is greater than 5MB (5 * 10^6 bytes)
|
|
111
114
|
};
|
|
112
|
-
submitAction({file, type: 'image', fileParams}, incorrectFile);
|
|
115
|
+
submitAction({ file, type: 'image', fileParams }, incorrectFile);
|
|
113
116
|
};
|
|
114
117
|
img.onerror = () => {
|
|
115
118
|
const fileParams = {
|
|
116
119
|
error: true,
|
|
117
120
|
};
|
|
118
|
-
submitAction({fileParams}, incorrectFile);
|
|
121
|
+
submitAction({ fileParams }, incorrectFile);
|
|
119
122
|
};
|
|
120
123
|
if (e) {
|
|
121
124
|
const event = e;
|
|
@@ -123,7 +126,7 @@ function CapImageUpload(props) {
|
|
|
123
126
|
}
|
|
124
127
|
}, []);
|
|
125
128
|
|
|
126
|
-
const rcsValidation = useCallback((incorrectFile, data, size, height, width, error) => {
|
|
129
|
+
const rcsValidation = useCallback((incorrectFile, data, size, height, width, error) => {
|
|
127
130
|
if (incorrectFile || size < minImgSize || size > imgSize || height !== imgHeight || width !== imgWidth || error) {
|
|
128
131
|
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
129
132
|
} else {
|
|
@@ -146,6 +149,19 @@ function CapImageUpload(props) {
|
|
|
146
149
|
const { height, width, error } = fileParams || {};
|
|
147
150
|
if (channel === RCS) {
|
|
148
151
|
rcsValidation(incorrectFile, data, size, height, width, error);
|
|
152
|
+
} else if ([WEBPUSH, WEBPUSH_BRAND_ICON].includes(channel)) {
|
|
153
|
+
// For WEBPUSH, only validate file extension, size, and format - no dimension validation
|
|
154
|
+
if (incorrectFile || size > imgSize || error) {
|
|
155
|
+
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
156
|
+
} else {
|
|
157
|
+
updateImageErrorMessage('');
|
|
158
|
+
uploadAsset(
|
|
159
|
+
data.file,
|
|
160
|
+
data.type,
|
|
161
|
+
data.fileParams,
|
|
162
|
+
index,
|
|
163
|
+
);
|
|
164
|
+
}
|
|
149
165
|
} else if (incorrectFile || size > imgSize || height > imgHeight || width > imgWidth || error) {
|
|
150
166
|
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
151
167
|
} else {
|
|
@@ -160,7 +176,7 @@ function CapImageUpload(props) {
|
|
|
160
176
|
}, [isImageError]);
|
|
161
177
|
|
|
162
178
|
const capUploaderCustomRequest = useCallback((uploadData) => {
|
|
163
|
-
uploadImages(undefined, {files: [uploadData.file]});
|
|
179
|
+
uploadImages(undefined, { files: [uploadData.file] });
|
|
164
180
|
}, [uploadImages]);
|
|
165
181
|
|
|
166
182
|
const setDrawerVisibility = useCallback((drawervisibleFlag) => updateDrawerRequirement(drawervisibleFlag), [isDrawerRequired]);
|
|
@@ -181,19 +197,27 @@ function CapImageUpload(props) {
|
|
|
181
197
|
secure_file_path: image, width, height, file_size: size,
|
|
182
198
|
} = get(imageTemplate, 'metaInfo', {});
|
|
183
199
|
updateDrawerRequirement(false);
|
|
184
|
-
|
|
200
|
+
// For WEBPUSH, skip dimension validation - only check extension, size
|
|
201
|
+
if ([WEBPUSH, WEBPUSH_BRAND_ICON].includes(channel)) {
|
|
202
|
+
if (!allowedExtensionsRegex.test(image) || size > imgSize) {
|
|
203
|
+
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
204
|
+
} else {
|
|
205
|
+
updateImageErrorMessage('');
|
|
206
|
+
updateImageSrc(image);
|
|
207
|
+
}
|
|
208
|
+
} else if (!allowedExtensionsRegex.test(image) || height > imgHeight || width > imgWidth || size > imgSize) {
|
|
185
209
|
updateImageErrorMessage(formatMessage(messages.imageErrorDesc));
|
|
186
210
|
} else {
|
|
187
211
|
updateImageErrorMessage('');
|
|
188
212
|
updateImageSrc(image);
|
|
189
213
|
}
|
|
190
|
-
}, [isImageError, isDrawerRequired]);
|
|
214
|
+
}, [isImageError, isDrawerRequired, channel, allowedExtensionsRegex, imgSize, formatMessage]);
|
|
191
215
|
|
|
192
216
|
const getGalleryDrawerContent = useCallback(() => {
|
|
193
217
|
const locationGallery = {
|
|
194
218
|
pathname: `/assets`,
|
|
195
219
|
search: '',
|
|
196
|
-
query: !isFullMode ? {type: 'embedded', module: 'library'} : {},
|
|
220
|
+
query: !isFullMode ? { type: 'embedded', module: 'library' } : {},
|
|
197
221
|
};
|
|
198
222
|
return (
|
|
199
223
|
<>
|
|
@@ -230,6 +254,7 @@ function CapImageUpload(props) {
|
|
|
230
254
|
customRequest={capUploaderCustomRequest}
|
|
231
255
|
className="form-builder-dragger grey-background"
|
|
232
256
|
showUploadList={!isImageError}
|
|
257
|
+
disabled={disabled}
|
|
233
258
|
>
|
|
234
259
|
<CapHeading className="dragger-title" type="h7">
|
|
235
260
|
<FormattedMessage {...messages.dragAndDrop} />
|
|
@@ -237,7 +262,7 @@ function CapImageUpload(props) {
|
|
|
237
262
|
<CapHeading className="dragger-or" type="label6">
|
|
238
263
|
<FormattedMessage {...messages.or} />
|
|
239
264
|
</CapHeading>
|
|
240
|
-
<CapButton className="dragger-button upload-image" type="secondary">
|
|
265
|
+
<CapButton className="dragger-button upload-image" type="secondary" disabled={disabled} tabIndex={disabled ? -1 : undefined}>
|
|
241
266
|
<FormattedMessage {...messages.uploadComputer} />
|
|
242
267
|
</CapButton>
|
|
243
268
|
{channel !== WHATSAPP && (
|
|
@@ -245,6 +270,8 @@ function CapImageUpload(props) {
|
|
|
245
270
|
className="dragger-button gallery-select"
|
|
246
271
|
type="secondary"
|
|
247
272
|
onClick={onGalleryClick}
|
|
273
|
+
disabled={disabled}
|
|
274
|
+
tabIndex={disabled ? -1 : undefined}
|
|
248
275
|
>
|
|
249
276
|
<FormattedMessage {...messages.uploadGallery} />
|
|
250
277
|
</CapButton>
|
|
@@ -262,13 +289,15 @@ function CapImageUpload(props) {
|
|
|
262
289
|
className="dragger-button re-upload"
|
|
263
290
|
type="flat"
|
|
264
291
|
onClick={onReUpload}
|
|
265
|
-
style={channelSpecificStyle ? { marginTop:
|
|
292
|
+
style={channelSpecificStyle ? { marginTop: `-${CAP_SPACE_16}` } : {}}
|
|
293
|
+
disabled={disabled}
|
|
294
|
+
tabIndex={disabled ? -1 : undefined}
|
|
266
295
|
>
|
|
267
296
|
<FormattedMessage {...messages.imageReUpload} />
|
|
268
297
|
</CapButton>
|
|
269
298
|
);
|
|
270
299
|
}
|
|
271
|
-
}, [isImageError, imageSrc]);
|
|
300
|
+
}, [isImageError, imageSrc, disabled, showReUploadButton, channel, channelSpecificStyle, capUploaderCustomRequest, onGalleryClick, onReUpload]);
|
|
272
301
|
|
|
273
302
|
return (
|
|
274
303
|
<div style={style} className="cap-custom-image-upload">
|
|
@@ -285,6 +314,8 @@ function CapImageUpload(props) {
|
|
|
285
314
|
type="file"
|
|
286
315
|
onChange={(e) => uploadImages(e, { files: e.target.files })}
|
|
287
316
|
accept={supportedExtensions || "image/*"}
|
|
317
|
+
disabled={disabled}
|
|
318
|
+
tabIndex={disabled ? -1 : undefined}
|
|
288
319
|
/>
|
|
289
320
|
{getImageSection()}
|
|
290
321
|
<CapDrawer
|
|
@@ -305,7 +336,18 @@ function CapImageUpload(props) {
|
|
|
305
336
|
)}
|
|
306
337
|
{![WHATSAPP, INAPP].includes(channel) && (
|
|
307
338
|
<CapHeadingSpan type="label2" className="image-dimension">
|
|
308
|
-
|
|
339
|
+
{[WEBPUSH, WEBPUSH_BRAND_ICON].includes(channel) && recommendedDimensions?.length ? (
|
|
340
|
+
<FormattedMessage
|
|
341
|
+
{...messages.recommendedDimensions}
|
|
342
|
+
values={{
|
|
343
|
+
dimensions: recommendedDimensions
|
|
344
|
+
.map((dim) => `${dim.width} x ${dim.height}px`)
|
|
345
|
+
.join(', '),
|
|
346
|
+
}}
|
|
347
|
+
/>
|
|
348
|
+
) : (
|
|
349
|
+
<FormattedMessage {...messages.imageDimenstionDescription} values={{ width: imgWidth, height: imgHeight }} />
|
|
350
|
+
)}
|
|
309
351
|
</CapHeadingSpan>
|
|
310
352
|
)}
|
|
311
353
|
{channel === FACEBOOK && (
|
|
@@ -328,7 +370,7 @@ function CapImageUpload(props) {
|
|
|
328
370
|
getImageSizeLabel()
|
|
329
371
|
)
|
|
330
372
|
)}
|
|
331
|
-
{[VIBER, INAPP, MOBILEPUSH].includes(channel) && getImageSizeLabel()}
|
|
373
|
+
{[VIBER, INAPP, MOBILEPUSH, WEBPUSH, WEBPUSH_BRAND_ICON].includes(channel) && getImageSizeLabel()}
|
|
332
374
|
<CapHeadingSpan type="label2" className="image-format">
|
|
333
375
|
{channel === INAPP ? <FormattedMessage {...messages.format2} /> : <FormattedMessage {...messages.format} />}
|
|
334
376
|
</CapHeadingSpan>
|
|
@@ -357,6 +399,13 @@ CapImageUpload.propTypes = {
|
|
|
357
399
|
channel: PropTypes.string,
|
|
358
400
|
channelSpecificStyle: PropTypes.bool,
|
|
359
401
|
disableAutoRestore: PropTypes.bool,
|
|
402
|
+
recommendedDimensions: PropTypes.arrayOf(
|
|
403
|
+
PropTypes.shape({
|
|
404
|
+
width: PropTypes.number.isRequired,
|
|
405
|
+
height: PropTypes.number.isRequired,
|
|
406
|
+
})
|
|
407
|
+
),
|
|
408
|
+
disabled: PropTypes.bool,
|
|
360
409
|
};
|
|
361
410
|
|
|
362
411
|
export default injectIntl(CapImageUpload);
|
|
@@ -34,6 +34,10 @@ 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
|
+
},
|
|
37
41
|
format: {
|
|
38
42
|
id: `${scope}.format`,
|
|
39
43
|
defaultMessage: 'Format: JPEG, JPG, PNG',
|
|
@@ -57,7 +61,7 @@ export default defineMessages({
|
|
|
57
61
|
},
|
|
58
62
|
channelImageSize: {
|
|
59
63
|
id: `${scope}.channelImageSize`,
|
|
60
|
-
defaultMessage: 'Size
|
|
64
|
+
defaultMessage: 'Size up to: {size}MB',
|
|
61
65
|
},
|
|
62
66
|
RcschannelImageSize: {
|
|
63
67
|
id: `${scope}.RcschannelImageSize`,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
// Default allowed content types for image URL validation
|
|
2
|
+
export const DEFAULT_ALLOWED_CONTENT_TYPES = ['image/jpeg', 'image/jpg', 'image/png'];
|
|
3
|
+
|
|
4
|
+
// Default maximum file size (5MB)
|
|
5
|
+
export const DEFAULT_MAX_SIZE = 5000000;
|
|
6
|
+
|
|
7
|
+
// Default allowed extensions regex
|
|
8
|
+
export const DEFAULT_ALLOWED_EXTENSIONS_REGEX = /\.(jpe?g|png)$/i;
|
|
9
|
+
|
|
10
|
+
// MIME type to file extension mapping
|
|
11
|
+
export const MIME_TYPE_TO_EXTENSION = {
|
|
12
|
+
'image/jpeg': 'jpg',
|
|
13
|
+
'image/jpg': 'jpg',
|
|
14
|
+
'image/png': 'png',
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Default image extension fallback
|
|
18
|
+
export const DEFAULT_IMAGE_EXTENSION = 'png';
|
|
19
|
+
|
|
20
|
+
// Upload status state machine states
|
|
21
|
+
export const UPLOAD_STATUS = {
|
|
22
|
+
IDLE: 'idle',
|
|
23
|
+
UPLOADING: 'uploading',
|
|
24
|
+
WAITING: 'waiting',
|
|
25
|
+
};
|
|
26
|
+
|