@capillarytech/creatives-library 8.0.264 → 8.0.266-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/Android.png +0 -0
- package/assets/iOS.png +0 -0
- package/constants/unified.js +2 -2
- package/initialReducer.js +2 -0
- package/package.json +1 -1
- package/services/api.js +10 -5
- package/services/tests/api.test.js +34 -0
- package/tests/integration/TemplateCreation/TemplateCreation.integration.test.js +17 -35
- package/tests/integration/TemplateCreation/api-response.js +31 -1
- package/tests/integration/TemplateCreation/msw-handler.js +2 -0
- package/utils/common.js +5 -6
- package/utils/commonUtils.js +28 -5
- package/utils/tagValidations.js +1 -2
- package/utils/tests/commonUtil.test.js +224 -0
- package/utils/tests/transformerUtils.test.js +0 -297
- package/utils/transformTemplateConfig.js +0 -10
- package/utils/transformerUtils.js +0 -40
- package/v2Components/CapDeviceContent/index.js +61 -56
- package/v2Components/CapImageUpload/constants.js +0 -2
- package/v2Components/CapImageUpload/index.js +16 -65
- package/v2Components/CapImageUpload/index.scss +1 -4
- package/v2Components/CapImageUpload/messages.js +1 -5
- 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/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +2 -2
- package/v2Components/ErrorInfoNote/constants.js +1 -0
- package/v2Components/ErrorInfoNote/index.js +402 -72
- package/v2Components/ErrorInfoNote/messages.js +32 -6
- package/v2Components/ErrorInfoNote/style.scss +278 -6
- package/v2Components/FormBuilder/index.js +8 -8
- package/v2Components/FormBuilder/tests/index.test.js +13 -4
- package/v2Components/HtmlEditor/HTMLEditor.js +418 -99
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +870 -0
- package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +1882 -133
- package/v2Components/HtmlEditor/__tests__/index.lazy.test.js +27 -16
- package/v2Components/HtmlEditor/_htmlEditor.scss +108 -45
- package/v2Components/HtmlEditor/_index.lazy.scss +0 -1
- package/v2Components/HtmlEditor/components/CodeEditorPane/_codeEditorPane.scss +23 -102
- package/v2Components/HtmlEditor/components/CodeEditorPane/index.js +148 -140
- 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 +9 -1
- package/v2Components/HtmlEditor/components/EditorToolbar/index.js +31 -6
- package/v2Components/HtmlEditor/components/FullscreenModal/_fullscreenModal.scss +22 -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 +7 -10
- package/v2Components/HtmlEditor/components/PreviewPane/index.js +22 -43
- package/v2Components/HtmlEditor/components/SplitContainer/_splitContainer.scss +1 -1
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/_validationErrorDisplay.scss +18 -0
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/index.js +36 -31
- package/v2Components/HtmlEditor/components/ValidationPanel/_validationPanel.scss +46 -34
- package/v2Components/HtmlEditor/components/ValidationPanel/constants.js +6 -0
- package/v2Components/HtmlEditor/components/ValidationPanel/index.js +52 -46
- package/v2Components/HtmlEditor/components/ValidationTabs/_validationTabs.scss +277 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/index.js +295 -0
- package/v2Components/HtmlEditor/components/ValidationTabs/messages.js +51 -0
- package/v2Components/HtmlEditor/constants.js +45 -20
- package/v2Components/HtmlEditor/hooks/__tests__/useInAppContent.test.js +373 -16
- package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +351 -16
- package/v2Components/HtmlEditor/hooks/useEditorContent.js +5 -2
- package/v2Components/HtmlEditor/hooks/useInAppContent.js +88 -146
- package/v2Components/HtmlEditor/hooks/useValidation.js +213 -56
- package/v2Components/HtmlEditor/index.js +1 -1
- package/v2Components/HtmlEditor/messages.js +102 -94
- package/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +214 -45
- package/v2Components/HtmlEditor/utils/__tests__/validationAdapter.test.js +134 -0
- package/v2Components/HtmlEditor/utils/contentSanitizer.js +40 -41
- package/v2Components/HtmlEditor/utils/htmlValidator.js +71 -72
- package/v2Components/HtmlEditor/utils/liquidTemplateSupport.js +158 -124
- package/v2Components/HtmlEditor/utils/properSyntaxHighlighting.js +23 -25
- package/v2Components/HtmlEditor/utils/validationAdapter.js +66 -41
- package/v2Components/HtmlEditor/utils/validationConstants.js +38 -0
- package/v2Components/MobilePushPreviewV2/constants.js +6 -0
- package/v2Components/MobilePushPreviewV2/index.js +33 -7
- package/v2Components/TemplatePreview/_templatePreview.scss +55 -24
- package/v2Components/TemplatePreview/index.js +47 -32
- package/v2Components/TemplatePreview/messages.js +4 -0
- package/v2Components/TestAndPreviewSlidebox/_testAndPreviewSlidebox.scss +1 -0
- package/v2Containers/App/constants.js +0 -5
- package/v2Containers/BeeEditor/index.js +172 -90
- package/v2Containers/BeePopupEditor/_beePopupEditor.scss +14 -0
- package/v2Containers/BeePopupEditor/constants.js +10 -0
- package/v2Containers/BeePopupEditor/index.js +194 -0
- package/v2Containers/BeePopupEditor/tests/index.test.js +627 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +129 -108
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +163 -13
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +2 -2
- package/v2Containers/CreativesContainer/constants.js +1 -3
- package/v2Containers/CreativesContainer/index.js +240 -214
- package/v2Containers/CreativesContainer/messages.js +8 -4
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +0 -210
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +11 -2
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +38 -354
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +103 -0
- package/v2Containers/Email/actions.js +7 -0
- package/v2Containers/Email/constants.js +5 -1
- package/v2Containers/Email/index.js +241 -32
- package/v2Containers/Email/messages.js +32 -0
- package/v2Containers/Email/reducer.js +12 -1
- package/v2Containers/Email/sagas.js +61 -7
- package/v2Containers/Email/tests/__snapshots__/reducer.test.js.snap +2 -0
- package/v2Containers/Email/tests/reducer.test.js +46 -0
- package/v2Containers/Email/tests/sagas.test.js +320 -29
- package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +1246 -0
- package/v2Containers/EmailWrapper/components/EmailWrapperView.js +211 -21
- package/v2Containers/EmailWrapper/components/HTMLEditorTesting.js +40 -74
- package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +2472 -0
- package/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +520 -0
- package/v2Containers/EmailWrapper/components/__tests__/HTMLEditorTesting.test.js +2 -67
- package/v2Containers/EmailWrapper/constants.js +2 -0
- package/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +629 -77
- package/v2Containers/EmailWrapper/index.js +103 -23
- package/v2Containers/EmailWrapper/messages.js +65 -1
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +956 -0
- package/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +594 -77
- package/v2Containers/FTP/index.js +1 -1
- 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 +802 -360
- 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 +151 -0
- package/v2Containers/InAppWrapper/components/__tests__/InAppWrapperView.test.js +267 -0
- package/v2Containers/InAppWrapper/components/inAppWrapperView.scss +23 -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 -0
- package/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/Text/index.js +0 -1
- package/v2Containers/Line/Container/Wrapper/tests/__snapshots__/index.test.js.snap +2 -0
- package/v2Containers/Line/Container/tests/__snapshots__/index.test.js.snap +9 -0
- package/v2Containers/MobilePushNew/index.js +0 -1
- package/v2Containers/Rcs/index.js +0 -3
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +12 -0
- package/v2Containers/SmsTrai/Edit/index.js +0 -1
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4 -0
- package/v2Containers/TagList/index.js +62 -19
- package/v2Containers/Templates/ChannelTypeIllustration.js +1 -13
- package/v2Containers/Templates/_templates.scss +56 -202
- package/v2Containers/Templates/actions.js +1 -2
- package/v2Containers/Templates/constants.js +0 -1
- package/v2Containers/Templates/index.js +123 -278
- 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/TemplatesV2.style.js +4 -2
- package/v2Containers/TemplatesV2/index.js +7 -15
- package/v2Containers/TemplatesV2/messages.js +0 -4
- package/v2Containers/Viber/index.js +0 -1
- package/v2Containers/Whatsapp/index.js +0 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +34 -0
- package/v2Containers/Zalo/index.js +0 -1
- package/v2Containers/Zalo/tests/index.test.js +5 -1
- package/utils/imageUrlUpload.js +0 -141
- package/v2Components/CapImageUrlUpload/constants.js +0 -26
- package/v2Components/CapImageUrlUpload/index.js +0 -365
- package/v2Components/CapImageUrlUpload/index.scss +0 -35
- package/v2Components/CapImageUrlUpload/messages.js +0 -47
- package/v2Components/HtmlEditor/components/ValidationErrorDisplay/__tests__/index.test.js +0 -152
- package/v2Containers/EmailWrapper/tests/EmailWrapperView.test.js +0 -214
- package/v2Containers/WebPush/Create/components/BrandIconSection.js +0 -108
- package/v2Containers/WebPush/Create/components/ButtonForm.js +0 -172
- package/v2Containers/WebPush/Create/components/ButtonItem.js +0 -101
- package/v2Containers/WebPush/Create/components/ButtonList.js +0 -145
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.js +0 -164
- package/v2Containers/WebPush/Create/components/ButtonsLinksSection.test.js +0 -463
- package/v2Containers/WebPush/Create/components/FormActions.js +0 -54
- package/v2Containers/WebPush/Create/components/FormActions.test.js +0 -163
- package/v2Containers/WebPush/Create/components/MediaSection.js +0 -142
- package/v2Containers/WebPush/Create/components/MediaSection.test.js +0 -341
- package/v2Containers/WebPush/Create/components/MessageSection.js +0 -103
- package/v2Containers/WebPush/Create/components/MessageSection.test.js +0 -268
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.js +0 -87
- package/v2Containers/WebPush/Create/components/NotificationTitleSection.test.js +0 -210
- package/v2Containers/WebPush/Create/components/TemplateNameSection.js +0 -54
- package/v2Containers/WebPush/Create/components/TemplateNameSection.test.js +0 -143
- package/v2Containers/WebPush/Create/components/__snapshots__/ButtonsLinksSection.test.js.snap +0 -86
- package/v2Containers/WebPush/Create/components/__snapshots__/FormActions.test.js.snap +0 -16
- package/v2Containers/WebPush/Create/components/__snapshots__/MediaSection.test.js.snap +0 -41
- package/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +0 -54
- package/v2Containers/WebPush/Create/components/__snapshots__/NotificationTitleSection.test.js.snap +0 -37
- package/v2Containers/WebPush/Create/components/__snapshots__/TemplateNameSection.test.js.snap +0 -21
- 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 -78
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.js +0 -138
- package/v2Containers/WebPush/Create/hooks/useButtonManagement.test.js +0 -406
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.js +0 -30
- package/v2Containers/WebPush/Create/hooks/useCharacterCount.test.js +0 -151
- package/v2Containers/WebPush/Create/hooks/useImageUpload.js +0 -104
- package/v2Containers/WebPush/Create/hooks/useImageUpload.test.js +0 -538
- package/v2Containers/WebPush/Create/hooks/useTagManagement.js +0 -122
- package/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -633
- package/v2Containers/WebPush/Create/index.js +0 -1148
- package/v2Containers/WebPush/Create/index.scss +0 -134
- package/v2Containers/WebPush/Create/messages.js +0 -211
- package/v2Containers/WebPush/Create/preview/DevicePreviewContent.js +0 -228
- package/v2Containers/WebPush/Create/preview/NotificationContainer.js +0 -294
- package/v2Containers/WebPush/Create/preview/PreviewContent.js +0 -90
- package/v2Containers/WebPush/Create/preview/PreviewControls.js +0 -305
- package/v2Containers/WebPush/Create/preview/PreviewDisclaimer.js +0 -25
- package/v2Containers/WebPush/Create/preview/WebPushPreview.js +0 -155
- 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/android-arrow-down.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/android-arrow-up.svg +0 -9
- 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/macos-arrow-down-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/macos-triple-dot-icon.svg +0 -9
- 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/assets/windows-close-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/assets/windows-triple-dot-icon.svg +0 -9
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileChromeHeader.js +0 -51
- package/v2Containers/WebPush/Create/preview/components/AndroidMobileExpanded.js +0 -145
- package/v2Containers/WebPush/Create/preview/components/IOSHeader.js +0 -45
- package/v2Containers/WebPush/Create/preview/components/NotificationExpandedContent.js +0 -68
- package/v2Containers/WebPush/Create/preview/components/NotificationHeader.js +0 -61
- package/v2Containers/WebPush/Create/preview/components/WindowsChromeExpanded.js +0 -99
- package/v2Containers/WebPush/Create/preview/components/tests/AndroidMobileExpanded.test.js +0 -733
- package/v2Containers/WebPush/Create/preview/components/tests/WindowsChromeExpanded.test.js +0 -571
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/AndroidMobileExpanded.test.js.snap +0 -85
- package/v2Containers/WebPush/Create/preview/components/tests/__snapshots__/WindowsChromeExpanded.test.js.snap +0 -81
- package/v2Containers/WebPush/Create/preview/config/notificationMappings.js +0 -50
- package/v2Containers/WebPush/Create/preview/constants.js +0 -637
- package/v2Containers/WebPush/Create/preview/notification-container.scss +0 -79
- package/v2Containers/WebPush/Create/preview/preview.scss +0 -358
- package/v2Containers/WebPush/Create/preview/styles/_android-mobile-chrome.scss +0 -370
- 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 -47
- 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 -207
- package/v2Containers/WebPush/Create/preview/styles/_ios.scss +0 -153
- package/v2Containers/WebPush/Create/preview/styles/_ipados.scss +0 -107
- package/v2Containers/WebPush/Create/preview/styles/_macos-chrome.scss +0 -101
- package/v2Containers/WebPush/Create/preview/styles/_windows-chrome.scss +0 -229
- package/v2Containers/WebPush/Create/preview/tests/DevicePreviewContent.test.js +0 -909
- package/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +0 -1081
- package/v2Containers/WebPush/Create/preview/tests/PreviewControls.test.js +0 -723
- package/v2Containers/WebPush/Create/preview/tests/WebPushPreview.test.js +0 -1327
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/DevicePreviewContent.test.js.snap +0 -131
- package/v2Containers/WebPush/Create/preview/tests/__snapshots__/NotificationContainer.test.js.snap +0 -112
- 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 -129
- package/v2Containers/WebPush/Create/utils/payloadBuilder.js +0 -96
- package/v2Containers/WebPush/Create/utils/payloadBuilder.test.js +0 -396
- package/v2Containers/WebPush/Create/utils/previewUtils.js +0 -89
- package/v2Containers/WebPush/Create/utils/urlValidation.js +0 -115
- package/v2Containers/WebPush/Create/utils/urlValidation.test.js +0 -449
- package/v2Containers/WebPush/Create/utils/validation.js +0 -76
- package/v2Containers/WebPush/Create/utils/validation.test.js +0 -283
- package/v2Containers/WebPush/actions.js +0 -60
- package/v2Containers/WebPush/constants.js +0 -132
- 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
|
@@ -46,10 +46,6 @@ export default defineMessages({
|
|
|
46
46
|
id: `${scope}.mobilepushHeader`,
|
|
47
47
|
defaultMessage: `Mobile Push`,
|
|
48
48
|
},
|
|
49
|
-
"webpushHeader": {
|
|
50
|
-
id: `${scope}.webpushHeader`,
|
|
51
|
-
defaultMessage: `Web Push`,
|
|
52
|
-
},
|
|
53
49
|
"ebillHeader": {
|
|
54
50
|
id: `${scope}.ebillHeader`,
|
|
55
51
|
defaultMessage: `Ebill`,
|
|
@@ -346,10 +342,6 @@ export default defineMessages({
|
|
|
346
342
|
id: `${scope}.newWhatsappTemplate`,
|
|
347
343
|
defaultMessage: 'Add new Whatsapp {template}',
|
|
348
344
|
},
|
|
349
|
-
"newWebPushTemplate": {
|
|
350
|
-
id: `${scope}.newWebPushTemplate`,
|
|
351
|
-
defaultMessage: 'Add new Web push {template}',
|
|
352
|
-
},
|
|
353
345
|
"newInAppMessageTemplate": {
|
|
354
346
|
id: `${scope}.newInAppMessageTemplate`,
|
|
355
347
|
defaultMessage: 'Add new In app message {template}',
|
|
@@ -386,14 +378,6 @@ export default defineMessages({
|
|
|
386
378
|
id: `${scope}.whatsappDescIllustration`,
|
|
387
379
|
defaultMessage: 'These templates can be reused when creating a\nnew message content.',
|
|
388
380
|
},
|
|
389
|
-
"webPushTitleIllustration": {
|
|
390
|
-
id: `${scope}.webPushTitleIllustration`,
|
|
391
|
-
defaultMessage: 'Add a new Web push creative {template}',
|
|
392
|
-
},
|
|
393
|
-
"webPushDescIllustration": {
|
|
394
|
-
id: `${scope}.webPushDescIllustration`,
|
|
395
|
-
defaultMessage: 'These templates can be reused when creating a new message content.',
|
|
396
|
-
},
|
|
397
381
|
"whatsappAccountNotConfiguredTitle": {
|
|
398
382
|
id: `${scope}.whatsappAccountNotConfiguredTitle`,
|
|
399
383
|
defaultMessage: 'Whatsapp account is not configured',
|
|
@@ -478,10 +462,6 @@ export default defineMessages({
|
|
|
478
462
|
id: `${scope}.zaloAccount`,
|
|
479
463
|
defaultMessage: 'Zalo account',
|
|
480
464
|
},
|
|
481
|
-
"webpushAccount": {
|
|
482
|
-
id: `${scope}.webpushAccount`,
|
|
483
|
-
defaultMessage: 'Web push account',
|
|
484
|
-
},
|
|
485
465
|
"rcsAccount": {
|
|
486
466
|
id: `${scope}.rcsAccount`,
|
|
487
467
|
defaultMessage: 'RCS account',
|
|
@@ -518,10 +498,6 @@ export default defineMessages({
|
|
|
518
498
|
id: `${scope}.noAccountsPresentZalo`,
|
|
519
499
|
defaultMessage: "Zalo accounts are not setup for your brand",
|
|
520
500
|
},
|
|
521
|
-
"noAccountsPresentWebpush": {
|
|
522
|
-
id: `${scope}.noAccountsPresentWebpush`,
|
|
523
|
-
defaultMessage: "Web push accounts are not setup for your brand",
|
|
524
|
-
},
|
|
525
501
|
"noAccountsPresentRcs": {
|
|
526
502
|
id: `${scope}.noAccountsPresentRcs`,
|
|
527
503
|
defaultMessage: "RCS accounts are not setup for your brand",
|
|
@@ -558,6 +534,10 @@ export default defineMessages({
|
|
|
558
534
|
id: `${scope}.rcsOnlyApprovedTemplates`,
|
|
559
535
|
defaultMessage: 'Only "Approved" templates are available here, as you can use those templates to create a message.',
|
|
560
536
|
},
|
|
537
|
+
"layout": {
|
|
538
|
+
id: `${scope}.layout`,
|
|
539
|
+
defaultMessage: `Layout`,
|
|
540
|
+
},
|
|
561
541
|
"status": {
|
|
562
542
|
id: `${scope}.status`,
|
|
563
543
|
defaultMessage: 'Status',
|
|
@@ -124,8 +124,6 @@ function templatesReducer(state = initialState, action) {
|
|
|
124
124
|
return state
|
|
125
125
|
.set('selectedFacebookAccount', fromJS(action.faceBookAccount))
|
|
126
126
|
.set('templates', []);
|
|
127
|
-
case types.SET_WEBPUSH_ACCOUNT:
|
|
128
|
-
return state.set('selectedWebPushAccount', fromJS(action.account));
|
|
129
127
|
case types.RESET_ACCOUNT:
|
|
130
128
|
return state
|
|
131
129
|
.remove('selectedWeChatAccount')
|
|
@@ -22,7 +22,6 @@ describe('Test Templates container', () => {
|
|
|
22
22
|
const getAllTemplates = jest.fn();
|
|
23
23
|
const getUserList = jest.fn();
|
|
24
24
|
const getSenderDetails = jest.fn();
|
|
25
|
-
const resetTemplate = jest.fn();
|
|
26
25
|
let renderedComponent;
|
|
27
26
|
|
|
28
27
|
beforeEach(() => {
|
|
@@ -55,7 +54,6 @@ describe('Test Templates container', () => {
|
|
|
55
54
|
getAllTemplates,
|
|
56
55
|
getUserList,
|
|
57
56
|
getSenderDetails,
|
|
58
|
-
resetTemplate,
|
|
59
57
|
}}
|
|
60
58
|
location={{
|
|
61
59
|
pathname: `/${channel}`,
|
|
@@ -81,8 +79,6 @@ describe('Test Templates container', () => {
|
|
|
81
79
|
channel: 'WHATSAPP',
|
|
82
80
|
orgUnitId: -1,
|
|
83
81
|
});
|
|
84
|
-
// resetTemplate should be called when entering account selection mode
|
|
85
|
-
expect(resetTemplate).toHaveBeenCalled();
|
|
86
82
|
});
|
|
87
83
|
|
|
88
84
|
it('Should render temlates when whatsapp templates are passed', () => {
|
|
@@ -107,8 +103,6 @@ describe('Test Templates container', () => {
|
|
|
107
103
|
Templates: {},
|
|
108
104
|
});
|
|
109
105
|
expect(renderedComponent).toMatchSnapshot();
|
|
110
|
-
// SMS doesn't enter account selection mode, so resetTemplate shouldn't be called on mount
|
|
111
|
-
expect(resetTemplate).not.toHaveBeenCalled();
|
|
112
106
|
});
|
|
113
107
|
|
|
114
108
|
it('Should render temlates when whatsapp templates are passed in full mode', () => {
|
|
@@ -129,8 +123,6 @@ describe('Test Templates container', () => {
|
|
|
129
123
|
it('Should render correct component for zalo channel', () => {
|
|
130
124
|
RenderFunctionFor('zalo');
|
|
131
125
|
expect(renderedComponent).toMatchSnapshot();
|
|
132
|
-
// resetTemplate should be called when entering account selection mode
|
|
133
|
-
expect(resetTemplate).toHaveBeenCalled();
|
|
134
126
|
});
|
|
135
127
|
it('Should render temlates when zalo templates are passed', () => {
|
|
136
128
|
RenderFunctionFor('zalo');
|
|
@@ -209,8 +201,6 @@ describe('Test Templates container', () => {
|
|
|
209
201
|
channel: 'RCS',
|
|
210
202
|
orgUnitId: -1,
|
|
211
203
|
});
|
|
212
|
-
// resetTemplate should be called when entering account selection mode
|
|
213
|
-
expect(resetTemplate).toHaveBeenCalled();
|
|
214
204
|
});
|
|
215
205
|
|
|
216
206
|
it('Should render templates when RCS templates are passed', () => {
|
|
@@ -14,8 +14,10 @@ export default css`
|
|
|
14
14
|
margin: 0 auto;
|
|
15
15
|
width: 100%;
|
|
16
16
|
padding: ${CAP_SPACE_24} 0;
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
/* Only main channel tabs content, not HTML Editor validation panel tabs */
|
|
18
|
+
> .cap-tab-v2 > .ant-tabs-content-holder > .ant-tabs-content,
|
|
19
|
+
> .cap-tab-v2 > .ant-tabs-content {
|
|
20
|
+
margin-top: ${CAP_SPACE_16};
|
|
19
21
|
}
|
|
20
22
|
` : `.cap-tab-v2 {
|
|
21
23
|
height: calc(100vh - 11.25rem);
|
|
@@ -30,11 +30,11 @@ import FTP from '../FTP';
|
|
|
30
30
|
import Gallery from '../Assets/Gallery';
|
|
31
31
|
import withStyles from '../../hoc/withStyles';
|
|
32
32
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
33
|
-
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP
|
|
33
|
+
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP } from '../App/constants';
|
|
34
34
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
35
35
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
36
36
|
import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
|
|
37
|
-
import { LOYALTY_SUPPORTED_ACTION
|
|
37
|
+
import { LOYALTY_SUPPORTED_ACTION } from "../CreativesContainer/constants";
|
|
38
38
|
|
|
39
39
|
const {CapCustomCardList} = CapCustomCard;
|
|
40
40
|
|
|
@@ -65,13 +65,6 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
65
65
|
email: {content: <></>, tab: intl.formatMessage(messages.email), key: 'email'},
|
|
66
66
|
//'wechat': {content: this.getTemplatesComponent('wechat'), tab: 'Wechat', key: 'wechat'},
|
|
67
67
|
mPush: {content: <></>, tab: intl.formatMessage(messages.pushNotification), key: 'mobilepush'},
|
|
68
|
-
...(commonUtil.hasWebPushFeatureEnabled() ? {
|
|
69
|
-
webpush: {
|
|
70
|
-
content: <div></div>,
|
|
71
|
-
tab: intl.formatMessage(messages.webPush),
|
|
72
|
-
key: WEBPUSH,
|
|
73
|
-
}
|
|
74
|
-
} : {}),
|
|
75
68
|
viber: {content: <></>, tab: intl.formatMessage(messages.viber), key: 'viber'},
|
|
76
69
|
whatsapp: { content: <></>, tab: intl.formatMessage(messages.whatsapp), key: WHATSAPP },
|
|
77
70
|
zalo: { content: <div></div>, tab: intl.formatMessage(messages.zalo), key: ZALO },
|
|
@@ -95,7 +88,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
95
88
|
return obj;
|
|
96
89
|
}, []);
|
|
97
90
|
|
|
98
|
-
|
|
91
|
+
if (isFullMode ) {
|
|
99
92
|
filteredPanes.push({content: <div></div>, tab: intl.formatMessage(messages.gallery), key: 'assets'});
|
|
100
93
|
} else {
|
|
101
94
|
if (!channelsToHide.includes('callTask')) {
|
|
@@ -105,19 +98,18 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
105
98
|
filteredPanes.push({content: <></>, tab: intl.formatMessage(messages.FTP), key: 'ftp'});
|
|
106
99
|
defaultChannel = 'FTP';
|
|
107
100
|
}
|
|
101
|
+
const commonChannels = ['sms', 'email', 'wechat', 'mobilepush', 'line', 'viber', 'facebook', 'call_task', 'ftp', 'assets'];
|
|
108
102
|
|
|
109
|
-
// Create a local copy of COMMON_CHANNELS to avoid mutating the imported array
|
|
110
|
-
const channels = [...COMMON_CHANNELS];
|
|
111
103
|
const { actionName = ''} = loyaltyMetaData;
|
|
112
104
|
if (isLoyaltyModule && actionName === LOYALTY_SUPPORTED_ACTION) {
|
|
113
|
-
|
|
105
|
+
commonChannels.push(WHATSAPP, ZALO);
|
|
114
106
|
}
|
|
115
107
|
|
|
116
|
-
// we only show channels which other than
|
|
108
|
+
// we only show channels which other than commonChannels
|
|
117
109
|
// if it is coming in enableNewChannels array
|
|
118
110
|
filteredPanes = filteredPanes.filter((item) => {
|
|
119
111
|
const channel = item.key;
|
|
120
|
-
if (!
|
|
112
|
+
if (!commonChannels.includes(channel)) {
|
|
121
113
|
return enableNewChannels.includes(channel.toUpperCase());
|
|
122
114
|
}
|
|
123
115
|
return true;
|
|
@@ -2281,6 +2281,7 @@ new message content.",
|
|
|
2281
2281
|
"email": [Function],
|
|
2282
2282
|
"facebookPreview": [Function],
|
|
2283
2283
|
"gallery": [Function],
|
|
2284
|
+
"inApp": [Function],
|
|
2284
2285
|
"language": [Function],
|
|
2285
2286
|
"navigationConfig": [Function],
|
|
2286
2287
|
"previewAndTest": [Function],
|
|
@@ -23689,6 +23690,7 @@ new message content.",
|
|
|
23689
23690
|
"email": [Function],
|
|
23690
23691
|
"facebookPreview": [Function],
|
|
23691
23692
|
"gallery": [Function],
|
|
23693
|
+
"inApp": [Function],
|
|
23692
23694
|
"language": [Function],
|
|
23693
23695
|
"navigationConfig": [Function],
|
|
23694
23696
|
"previewAndTest": [Function],
|
|
@@ -47213,6 +47215,7 @@ new message content.",
|
|
|
47213
47215
|
"email": [Function],
|
|
47214
47216
|
"facebookPreview": [Function],
|
|
47215
47217
|
"gallery": [Function],
|
|
47218
|
+
"inApp": [Function],
|
|
47216
47219
|
"language": [Function],
|
|
47217
47220
|
"navigationConfig": [Function],
|
|
47218
47221
|
"previewAndTest": [Function],
|
|
@@ -71725,6 +71728,7 @@ new message content.",
|
|
|
71725
71728
|
"email": [Function],
|
|
71726
71729
|
"facebookPreview": [Function],
|
|
71727
71730
|
"gallery": [Function],
|
|
71731
|
+
"inApp": [Function],
|
|
71728
71732
|
"language": [Function],
|
|
71729
71733
|
"navigationConfig": [Function],
|
|
71730
71734
|
"previewAndTest": [Function],
|
|
@@ -98534,6 +98538,7 @@ new message content.",
|
|
|
98534
98538
|
"email": [Function],
|
|
98535
98539
|
"facebookPreview": [Function],
|
|
98536
98540
|
"gallery": [Function],
|
|
98541
|
+
"inApp": [Function],
|
|
98537
98542
|
"language": [Function],
|
|
98538
98543
|
"navigationConfig": [Function],
|
|
98539
98544
|
"previewAndTest": [Function],
|
|
@@ -119972,6 +119977,7 @@ new message content.",
|
|
|
119972
119977
|
"email": [Function],
|
|
119973
119978
|
"facebookPreview": [Function],
|
|
119974
119979
|
"gallery": [Function],
|
|
119980
|
+
"inApp": [Function],
|
|
119975
119981
|
"language": [Function],
|
|
119976
119982
|
"navigationConfig": [Function],
|
|
119977
119983
|
"previewAndTest": [Function],
|
|
@@ -141380,6 +141386,7 @@ new message content.",
|
|
|
141380
141386
|
"email": [Function],
|
|
141381
141387
|
"facebookPreview": [Function],
|
|
141382
141388
|
"gallery": [Function],
|
|
141389
|
+
"inApp": [Function],
|
|
141383
141390
|
"language": [Function],
|
|
141384
141391
|
"navigationConfig": [Function],
|
|
141385
141392
|
"previewAndTest": [Function],
|
|
@@ -166800,6 +166807,7 @@ new message content.",
|
|
|
166800
166807
|
"email": [Function],
|
|
166801
166808
|
"facebookPreview": [Function],
|
|
166802
166809
|
"gallery": [Function],
|
|
166810
|
+
"inApp": [Function],
|
|
166803
166811
|
"language": [Function],
|
|
166804
166812
|
"navigationConfig": [Function],
|
|
166805
166813
|
"previewAndTest": [Function],
|
|
@@ -193208,6 +193216,7 @@ new message content.",
|
|
|
193208
193216
|
"email": [Function],
|
|
193209
193217
|
"facebookPreview": [Function],
|
|
193210
193218
|
"gallery": [Function],
|
|
193219
|
+
"inApp": [Function],
|
|
193211
193220
|
"language": [Function],
|
|
193212
193221
|
"navigationConfig": [Function],
|
|
193213
193222
|
"previewAndTest": [Function],
|
|
@@ -221913,6 +221922,7 @@ new message content.",
|
|
|
221913
221922
|
"email": [Function],
|
|
221914
221923
|
"facebookPreview": [Function],
|
|
221915
221924
|
"gallery": [Function],
|
|
221925
|
+
"inApp": [Function],
|
|
221916
221926
|
"language": [Function],
|
|
221917
221927
|
"navigationConfig": [Function],
|
|
221918
221928
|
"previewAndTest": [Function],
|
|
@@ -251600,6 +251610,7 @@ new message content.",
|
|
|
251600
251610
|
"email": [Function],
|
|
251601
251611
|
"facebookPreview": [Function],
|
|
251602
251612
|
"gallery": [Function],
|
|
251613
|
+
"inApp": [Function],
|
|
251603
251614
|
"language": [Function],
|
|
251604
251615
|
"navigationConfig": [Function],
|
|
251605
251616
|
"previewAndTest": [Function],
|
|
@@ -267353,6 +267364,7 @@ new message content.",
|
|
|
267353
267364
|
"email": [Function],
|
|
267354
267365
|
"facebookPreview": [Function],
|
|
267355
267366
|
"gallery": [Function],
|
|
267367
|
+
"inApp": [Function],
|
|
267356
267368
|
"language": [Function],
|
|
267357
267369
|
"navigationConfig": [Function],
|
|
267358
267370
|
"previewAndTest": [Function],
|
|
@@ -281957,6 +281969,7 @@ new message content.",
|
|
|
281957
281969
|
"email": [Function],
|
|
281958
281970
|
"facebookPreview": [Function],
|
|
281959
281971
|
"gallery": [Function],
|
|
281972
|
+
"inApp": [Function],
|
|
281960
281973
|
"language": [Function],
|
|
281961
281974
|
"navigationConfig": [Function],
|
|
281962
281975
|
"previewAndTest": [Function],
|
|
@@ -298668,6 +298681,7 @@ new message content.",
|
|
|
298668
298681
|
"email": [Function],
|
|
298669
298682
|
"facebookPreview": [Function],
|
|
298670
298683
|
"gallery": [Function],
|
|
298684
|
+
"inApp": [Function],
|
|
298671
298685
|
"language": [Function],
|
|
298672
298686
|
"navigationConfig": [Function],
|
|
298673
298687
|
"previewAndTest": [Function],
|
|
@@ -322716,6 +322730,7 @@ new message content.",
|
|
|
322716
322730
|
"email": [Function],
|
|
322717
322731
|
"facebookPreview": [Function],
|
|
322718
322732
|
"gallery": [Function],
|
|
322733
|
+
"inApp": [Function],
|
|
322719
322734
|
"language": [Function],
|
|
322720
322735
|
"navigationConfig": [Function],
|
|
322721
322736
|
"previewAndTest": [Function],
|
|
@@ -350354,6 +350369,7 @@ new message content.",
|
|
|
350354
350369
|
"email": [Function],
|
|
350355
350370
|
"facebookPreview": [Function],
|
|
350356
350371
|
"gallery": [Function],
|
|
350372
|
+
"inApp": [Function],
|
|
350357
350373
|
"language": [Function],
|
|
350358
350374
|
"navigationConfig": [Function],
|
|
350359
350375
|
"previewAndTest": [Function],
|
|
@@ -366678,6 +366694,7 @@ new message content.",
|
|
|
366678
366694
|
"email": [Function],
|
|
366679
366695
|
"facebookPreview": [Function],
|
|
366680
366696
|
"gallery": [Function],
|
|
366697
|
+
"inApp": [Function],
|
|
366681
366698
|
"language": [Function],
|
|
366682
366699
|
"navigationConfig": [Function],
|
|
366683
366700
|
"previewAndTest": [Function],
|
|
@@ -388086,6 +388103,7 @@ new message content.",
|
|
|
388086
388103
|
"email": [Function],
|
|
388087
388104
|
"facebookPreview": [Function],
|
|
388088
388105
|
"gallery": [Function],
|
|
388106
|
+
"inApp": [Function],
|
|
388089
388107
|
"language": [Function],
|
|
388090
388108
|
"navigationConfig": [Function],
|
|
388091
388109
|
"previewAndTest": [Function],
|
|
@@ -413506,6 +413524,7 @@ new message content.",
|
|
|
413506
413524
|
"email": [Function],
|
|
413507
413525
|
"facebookPreview": [Function],
|
|
413508
413526
|
"gallery": [Function],
|
|
413527
|
+
"inApp": [Function],
|
|
413509
413528
|
"language": [Function],
|
|
413510
413529
|
"navigationConfig": [Function],
|
|
413511
413530
|
"previewAndTest": [Function],
|
|
@@ -434914,6 +434933,7 @@ new message content.",
|
|
|
434914
434933
|
"email": [Function],
|
|
434915
434934
|
"facebookPreview": [Function],
|
|
434916
434935
|
"gallery": [Function],
|
|
434936
|
+
"inApp": [Function],
|
|
434917
434937
|
"language": [Function],
|
|
434918
434938
|
"navigationConfig": [Function],
|
|
434919
434939
|
"previewAndTest": [Function],
|
|
@@ -457142,6 +457162,7 @@ new message content.",
|
|
|
457142
457162
|
"email": [Function],
|
|
457143
457163
|
"facebookPreview": [Function],
|
|
457144
457164
|
"gallery": [Function],
|
|
457165
|
+
"inApp": [Function],
|
|
457145
457166
|
"language": [Function],
|
|
457146
457167
|
"navigationConfig": [Function],
|
|
457147
457168
|
"previewAndTest": [Function],
|
|
@@ -480193,6 +480214,7 @@ new message content.",
|
|
|
480193
480214
|
"email": [Function],
|
|
480194
480215
|
"facebookPreview": [Function],
|
|
480195
480216
|
"gallery": [Function],
|
|
480217
|
+
"inApp": [Function],
|
|
480196
480218
|
"language": [Function],
|
|
480197
480219
|
"navigationConfig": [Function],
|
|
480198
480220
|
"previewAndTest": [Function],
|
|
@@ -504064,6 +504086,7 @@ new message content.",
|
|
|
504064
504086
|
"email": [Function],
|
|
504065
504087
|
"facebookPreview": [Function],
|
|
504066
504088
|
"gallery": [Function],
|
|
504089
|
+
"inApp": [Function],
|
|
504067
504090
|
"language": [Function],
|
|
504068
504091
|
"navigationConfig": [Function],
|
|
504069
504092
|
"previewAndTest": [Function],
|
|
@@ -528778,6 +528801,7 @@ new message content.",
|
|
|
528778
528801
|
"email": [Function],
|
|
528779
528802
|
"facebookPreview": [Function],
|
|
528780
528803
|
"gallery": [Function],
|
|
528804
|
+
"inApp": [Function],
|
|
528781
528805
|
"language": [Function],
|
|
528782
528806
|
"navigationConfig": [Function],
|
|
528783
528807
|
"previewAndTest": [Function],
|
|
@@ -554332,6 +554356,7 @@ new message content.",
|
|
|
554332
554356
|
"email": [Function],
|
|
554333
554357
|
"facebookPreview": [Function],
|
|
554334
554358
|
"gallery": [Function],
|
|
554359
|
+
"inApp": [Function],
|
|
554335
554360
|
"language": [Function],
|
|
554336
554361
|
"navigationConfig": [Function],
|
|
554337
554362
|
"previewAndTest": [Function],
|
|
@@ -580717,6 +580742,7 @@ new message content.",
|
|
|
580717
580742
|
"email": [Function],
|
|
580718
580743
|
"facebookPreview": [Function],
|
|
580719
580744
|
"gallery": [Function],
|
|
580745
|
+
"inApp": [Function],
|
|
580720
580746
|
"language": [Function],
|
|
580721
580747
|
"navigationConfig": [Function],
|
|
580722
580748
|
"previewAndTest": [Function],
|
|
@@ -607933,6 +607959,7 @@ new message content.",
|
|
|
607933
607959
|
"email": [Function],
|
|
607934
607960
|
"facebookPreview": [Function],
|
|
607935
607961
|
"gallery": [Function],
|
|
607962
|
+
"inApp": [Function],
|
|
607936
607963
|
"language": [Function],
|
|
607937
607964
|
"navigationConfig": [Function],
|
|
607938
607965
|
"previewAndTest": [Function],
|
|
@@ -635961,6 +635988,7 @@ new message content.",
|
|
|
635961
635988
|
"email": [Function],
|
|
635962
635989
|
"facebookPreview": [Function],
|
|
635963
635990
|
"gallery": [Function],
|
|
635991
|
+
"inApp": [Function],
|
|
635964
635992
|
"language": [Function],
|
|
635965
635993
|
"navigationConfig": [Function],
|
|
635966
635994
|
"previewAndTest": [Function],
|
|
@@ -658230,6 +658258,7 @@ new message content.",
|
|
|
658230
658258
|
"email": [Function],
|
|
658231
658259
|
"facebookPreview": [Function],
|
|
658232
658260
|
"gallery": [Function],
|
|
658261
|
+
"inApp": [Function],
|
|
658233
658262
|
"language": [Function],
|
|
658234
658263
|
"navigationConfig": [Function],
|
|
658235
658264
|
"previewAndTest": [Function],
|
|
@@ -681326,6 +681355,7 @@ new message content.",
|
|
|
681326
681355
|
"email": [Function],
|
|
681327
681356
|
"facebookPreview": [Function],
|
|
681328
681357
|
"gallery": [Function],
|
|
681358
|
+
"inApp": [Function],
|
|
681329
681359
|
"language": [Function],
|
|
681330
681360
|
"navigationConfig": [Function],
|
|
681331
681361
|
"previewAndTest": [Function],
|
|
@@ -705313,6 +705343,7 @@ new message content.",
|
|
|
705313
705343
|
"email": [Function],
|
|
705314
705344
|
"facebookPreview": [Function],
|
|
705315
705345
|
"gallery": [Function],
|
|
705346
|
+
"inApp": [Function],
|
|
705316
705347
|
"language": [Function],
|
|
705317
705348
|
"navigationConfig": [Function],
|
|
705318
705349
|
"previewAndTest": [Function],
|
|
@@ -726721,6 +726752,7 @@ new message content.",
|
|
|
726721
726752
|
"email": [Function],
|
|
726722
726753
|
"facebookPreview": [Function],
|
|
726723
726754
|
"gallery": [Function],
|
|
726755
|
+
"inApp": [Function],
|
|
726724
726756
|
"language": [Function],
|
|
726725
726757
|
"navigationConfig": [Function],
|
|
726726
726758
|
"previewAndTest": [Function],
|
|
@@ -751456,6 +751488,7 @@ new message content.",
|
|
|
751456
751488
|
"email": [Function],
|
|
751457
751489
|
"facebookPreview": [Function],
|
|
751458
751490
|
"gallery": [Function],
|
|
751491
|
+
"inApp": [Function],
|
|
751459
751492
|
"language": [Function],
|
|
751460
751493
|
"navigationConfig": [Function],
|
|
751461
751494
|
"previewAndTest": [Function],
|
|
@@ -776299,6 +776332,7 @@ new message content.",
|
|
|
776299
776332
|
"email": [Function],
|
|
776300
776333
|
"facebookPreview": [Function],
|
|
776301
776334
|
"gallery": [Function],
|
|
776335
|
+
"inApp": [Function],
|
|
776302
776336
|
"language": [Function],
|
|
776303
776337
|
"navigationConfig": [Function],
|
|
776304
776338
|
"previewAndTest": [Function],
|
|
@@ -117,7 +117,11 @@ describe('Test activity zalo container', () => {
|
|
|
117
117
|
target: { value: 'Hello, welcome {{fsdaf}}' },
|
|
118
118
|
});
|
|
119
119
|
inputBox[0].focus();
|
|
120
|
-
expect(
|
|
120
|
+
expect(
|
|
121
|
+
screen.getByText(
|
|
122
|
+
'Unsupported tags: fsdaf. Please remove them from this message.',
|
|
123
|
+
),
|
|
124
|
+
).toBeInTheDocument();
|
|
121
125
|
});
|
|
122
126
|
|
|
123
127
|
it('test case for set template data', async () => {
|
package/utils/imageUrlUpload.js
DELETED
|
@@ -1,141 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility functions for uploading images from URLs
|
|
3
|
-
*
|
|
4
|
-
* NOTE: CORS-limited; will be replaced with backend implementation.
|
|
5
|
-
* Flow currently hidden (not removed) from frontend.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import {
|
|
9
|
-
DEFAULT_ALLOWED_CONTENT_TYPES,
|
|
10
|
-
MIME_TYPE_TO_EXTENSION,
|
|
11
|
-
DEFAULT_IMAGE_EXTENSION,
|
|
12
|
-
} from '../v2Components/CapImageUrlUpload/constants';
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Fetches an image from a URL
|
|
16
|
-
*
|
|
17
|
-
* @param {string} url - The image URL to fetch
|
|
18
|
-
* @returns {Promise<Response>} - The fetch response object
|
|
19
|
-
* @throws {Error} - If the fetch fails (network/CORS error)
|
|
20
|
-
*/
|
|
21
|
-
export const fetchImageFromUrl = async (url) => {
|
|
22
|
-
const trimmedUrl = url?.trim() || '';
|
|
23
|
-
|
|
24
|
-
if (!trimmedUrl) {
|
|
25
|
-
throw new Error('URL is required');
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// CORS-limited: fails for images without proper CORS headers
|
|
29
|
-
const response = await fetch(trimmedUrl, {
|
|
30
|
-
method: 'GET',
|
|
31
|
-
redirect: 'follow',
|
|
32
|
-
mode: 'cors',
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
if (!response.ok) {
|
|
36
|
-
throw new Error(`Failed to fetch image: ${response.status} ${response.statusText}`);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
return response;
|
|
40
|
-
};
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Helper function to upload image from URL
|
|
44
|
-
* Fetches image, validates content type and size, converts to File, and uploads via uploadAsset
|
|
45
|
-
*
|
|
46
|
-
* @param {string} url - The image URL to upload
|
|
47
|
-
* @param {Function} formatMessage - React Intl formatMessage function
|
|
48
|
-
* @param {Object} messages - React Intl messages object
|
|
49
|
-
* @param {Function} uploadAssetFn - Function to upload the asset (file, type, fileParams)
|
|
50
|
-
* @param {string} fileNamePrefix - Prefix for the generated file name
|
|
51
|
-
* @param {number} maxSize - Maximum file size in bytes
|
|
52
|
-
* @param {string[]} allowedContentTypes - Array of allowed MIME types (defaults to DEFAULT_ALLOWED_CONTENT_TYPES)
|
|
53
|
-
* @returns {Promise<{success: boolean, error: string}>} - Result object with success status and error message
|
|
54
|
-
*
|
|
55
|
-
* @example
|
|
56
|
-
* const result = await uploadImageFromUrlHelper(
|
|
57
|
-
* 'https://example.com/image.jpg',
|
|
58
|
-
* formatMessage,
|
|
59
|
-
* messages,
|
|
60
|
-
* uploadAsset,
|
|
61
|
-
* 'my-image',
|
|
62
|
-
* 5000000,
|
|
63
|
-
* ['image/jpeg', 'image/png']
|
|
64
|
-
* );
|
|
65
|
-
*/
|
|
66
|
-
export const uploadImageFromUrlHelper = async (
|
|
67
|
-
url,
|
|
68
|
-
formatMessage,
|
|
69
|
-
messages,
|
|
70
|
-
uploadAssetFn,
|
|
71
|
-
fileNamePrefix,
|
|
72
|
-
maxSize,
|
|
73
|
-
allowedContentTypes = DEFAULT_ALLOWED_CONTENT_TYPES,
|
|
74
|
-
) => {
|
|
75
|
-
const trimmedUrl = url?.trim() || '';
|
|
76
|
-
|
|
77
|
-
try {
|
|
78
|
-
const response = await fetchImageFromUrl(trimmedUrl);
|
|
79
|
-
|
|
80
|
-
// Validate Content-Type
|
|
81
|
-
const contentType = response.headers?.get('Content-Type') || '';
|
|
82
|
-
const normalizedContentType = contentType.split(';')[0].toLowerCase().trim();
|
|
83
|
-
|
|
84
|
-
if (!allowedContentTypes.includes(normalizedContentType)) {
|
|
85
|
-
return {
|
|
86
|
-
success: false,
|
|
87
|
-
error: formatMessage(messages.imageTypeInvalid),
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
const blob = await response.blob();
|
|
92
|
-
|
|
93
|
-
if (blob.size > maxSize) {
|
|
94
|
-
return {
|
|
95
|
-
success: false,
|
|
96
|
-
error: formatMessage(messages.imageSizeInvalid),
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
// Load image to get dimensions and verify validity
|
|
101
|
-
return new Promise((resolve) => {
|
|
102
|
-
const img = new Image();
|
|
103
|
-
const objectUrl = URL.createObjectURL(blob);
|
|
104
|
-
|
|
105
|
-
img.onload = () => {
|
|
106
|
-
const extension = MIME_TYPE_TO_EXTENSION[normalizedContentType] || DEFAULT_IMAGE_EXTENSION;
|
|
107
|
-
const fileName = `${fileNamePrefix}.${extension}`;
|
|
108
|
-
const file = new File([blob], fileName, { type: blob.type });
|
|
109
|
-
const fileParams = {
|
|
110
|
-
width: img.width,
|
|
111
|
-
height: img.height,
|
|
112
|
-
error: false,
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
uploadAssetFn(file, 'image', fileParams);
|
|
116
|
-
URL.revokeObjectURL(objectUrl);
|
|
117
|
-
|
|
118
|
-
resolve({
|
|
119
|
-
success: true,
|
|
120
|
-
error: '',
|
|
121
|
-
});
|
|
122
|
-
};
|
|
123
|
-
|
|
124
|
-
img.onerror = () => {
|
|
125
|
-
URL.revokeObjectURL(objectUrl);
|
|
126
|
-
resolve({
|
|
127
|
-
success: false,
|
|
128
|
-
error: formatMessage(messages.imageLoadError),
|
|
129
|
-
});
|
|
130
|
-
};
|
|
131
|
-
|
|
132
|
-
img.src = objectUrl;
|
|
133
|
-
});
|
|
134
|
-
} catch (error) {
|
|
135
|
-
return {
|
|
136
|
-
success: false,
|
|
137
|
-
error: formatMessage(messages.imageLoadError),
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
|