cap-creatives-ui 8.0.280 → 8.0.321
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/.github/workflows/pr-title-check.yml +88 -0
- package/app/constants/unified.js +21 -1
- package/app/containers/App/constants.js +0 -1
- package/app/containers/Login/test/index.test.js +123 -0
- package/app/containers/Login/test/selectors.test.js +165 -0
- package/app/initialState.js +0 -2
- package/app/services/api.js +6 -0
- package/app/services/tests/api.test.js +7 -0
- package/app/services/tests/getSchema.test.js +95 -0
- package/app/utils/common.js +23 -9
- package/app/utils/commonUtils.js +64 -93
- package/app/utils/tagValidations.js +83 -219
- package/app/utils/templateVarUtils.js +172 -0
- package/app/utils/tests/common.test.js +265 -323
- package/app/utils/tests/commonUtil.test.js +461 -118
- package/app/utils/tests/commonUtils.test.js +581 -0
- package/app/utils/tests/messageUtils.test.js +95 -0
- package/app/utils/tests/smsCharCount.test.js +304 -0
- package/app/utils/tests/smsCharCountV2.test.js +213 -10
- package/app/utils/tests/tagValidations.test.js +474 -357
- package/app/utils/tests/templateVarUtils.test.js +160 -0
- package/app/v2Components/CapDeviceContent/index.js +10 -7
- package/app/v2Components/CapTagList/index.js +32 -24
- package/app/v2Components/CapTagList/style.scss +48 -0
- package/app/v2Components/CapTagListWithInput/__tests__/CapTagListWithInput.test.js +63 -0
- package/app/v2Components/CapTagListWithInput/index.js +8 -0
- package/app/v2Components/CapWhatsappCTA/index.js +2 -0
- package/app/v2Components/CapWhatsappCarouselButton/index.js +32 -14
- package/app/v2Components/CapWhatsappCarouselButton/tests/index.test.js +120 -2
- package/app/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +39 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +606 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +36 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +79 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/index.js +314 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +141 -0
- package/app/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +156 -0
- package/app/v2Components/CommonTestAndPreview/SendTestMessage.js +57 -1
- package/app/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
- package/app/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/app/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +210 -4
- package/app/v2Components/CommonTestAndPreview/actions.js +20 -0
- package/app/v2Components/CommonTestAndPreview/constants.js +57 -1
- package/app/v2Components/CommonTestAndPreview/index.js +878 -156
- package/app/v2Components/CommonTestAndPreview/messages.js +41 -3
- package/app/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/app/v2Components/CommonTestAndPreview/reducer.js +47 -0
- package/app/v2Components/CommonTestAndPreview/sagas.js +75 -5
- package/app/v2Components/CommonTestAndPreview/selectors.js +51 -0
- package/app/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +1156 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +334 -0
- package/app/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +576 -0
- package/app/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +156 -0
- package/app/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/app/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
- package/app/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -7
- package/app/v2Components/CommonTestAndPreview/tests/index.test.js +914 -5
- package/app/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/app/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
- package/app/v2Components/CommonTestAndPreview/tests/sagas.test.js +146 -378
- package/app/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
- package/app/v2Components/ErrorInfoNote/index.js +24 -26
- package/app/v2Components/FormBuilder/index.js +182 -204
- package/app/v2Components/FormBuilder/messages.js +4 -8
- package/app/v2Components/HtmlEditor/HTMLEditor.js +7 -6
- package/app/v2Components/HtmlEditor/__tests__/HTMLEditor.apiErrors.test.js +1 -1
- package/app/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +928 -17
- package/app/v2Components/HtmlEditor/components/CodeEditorPane/index.js +4 -2
- package/app/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +452 -3
- package/app/v2Components/HtmlEditor/hooks/useValidation.js +12 -9
- package/app/v2Components/HtmlEditor/utils/__tests__/htmlValidator.enhanced.test.js +132 -0
- package/app/v2Components/HtmlEditor/utils/htmlValidator.js +4 -2
- package/app/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/app/v2Components/SmsFallback/constants.js +73 -0
- package/app/v2Components/SmsFallback/index.js +956 -0
- package/app/v2Components/SmsFallback/index.scss +265 -0
- package/app/v2Components/SmsFallback/messages.js +78 -0
- package/app/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
- package/app/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/app/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/app/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
- package/app/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/app/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/app/v2Components/TestAndPreviewSlidebox/index.js +22 -1
- package/app/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/app/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/app/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/app/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/app/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/app/v2Containers/BeeEditor/index.js +3 -0
- package/app/v2Containers/BeePopupEditor/index.js +9 -2
- package/app/v2Containers/Cap/mockData.js +0 -14
- package/app/v2Containers/Cap/reducer.js +3 -55
- package/app/v2Containers/Cap/tests/reducer.test.js +0 -102
- package/app/v2Containers/CommunicationFlow/CommunicationFlow.js +291 -0
- package/app/v2Containers/CommunicationFlow/CommunicationFlow.scss +25 -0
- package/app/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +255 -0
- package/app/v2Containers/CommunicationFlow/constants.js +200 -0
- package/app/v2Containers/CommunicationFlow/index.js +102 -0
- package/app/v2Containers/CommunicationFlow/messages.js +346 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +522 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +170 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +796 -0
- package/app/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +95 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/Tests/CommunicationStrategyStep.test.js +133 -0
- package/app/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +289 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.scss +70 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +319 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +69 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +616 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +577 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +1111 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +696 -0
- package/app/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/index.js +7 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +102 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.scss +36 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/Tests/DynamicControlsStep.test.js +91 -0
- package/app/v2Containers/CommunicationFlow/steps/DynamicControlsStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +86 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/Tests/MessageTypeStep.test.js +100 -0
- package/app/v2Containers/CommunicationFlow/steps/MessageTypeStep/index.js +5 -0
- package/app/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +30 -0
- package/app/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/app/v2Containers/CreativesContainer/SlideBoxContent.js +127 -11
- package/app/v2Containers/CreativesContainer/SlideBoxFooter.js +62 -9
- package/app/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/app/v2Containers/CreativesContainer/constants.js +24 -0
- package/app/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/app/v2Containers/CreativesContainer/index.js +346 -71
- package/app/v2Containers/CreativesContainer/index.scss +51 -1
- package/app/v2Containers/CreativesContainer/messages.js +12 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxContent.test.js +69 -1
- package/app/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +443 -0
- package/app/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +147 -4
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
- package/app/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +57 -10
- package/app/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/app/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/app/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/app/v2Containers/Email/index.js +2 -5
- package/app/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +58 -77
- package/app/v2Containers/EmailWrapper/components/EmailWrapperView.js +3 -0
- package/app/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +158 -89
- package/app/v2Containers/EmailWrapper/components/__tests__/EmailWrapperView.test.js +16 -1
- package/app/v2Containers/EmailWrapper/hooks/useEmailWrapper.js +17 -12
- package/app/v2Containers/EmailWrapper/index.js +4 -0
- package/app/v2Containers/EmailWrapper/tests/useEmailWrapper.edgeCases.test.js +1 -0
- package/app/v2Containers/EmailWrapper/tests/useEmailWrapper.test.js +133 -0
- package/app/v2Containers/FTP/index.js +2 -51
- package/app/v2Containers/FTP/messages.js +0 -4
- package/app/v2Containers/InApp/__tests__/InAppHTMLEditor.test.js +110 -155
- package/app/v2Containers/InApp/index.js +297 -118
- package/app/v2Containers/InApp/tests/index.test.js +17 -6
- package/app/v2Containers/InApp/tests/mockData.js +1 -1
- package/app/v2Containers/InAppWrapper/hooks/__tests__/useInAppWrapper.test.js +19 -0
- package/app/v2Containers/InAppWrapper/hooks/useInAppWrapper.js +3 -0
- package/app/v2Containers/InAppWrapper/index.js +3 -0
- package/app/v2Containers/InappAdvance/index.js +5 -104
- package/app/v2Containers/InappAdvance/tests/index.test.js +2 -0
- package/app/v2Containers/Line/Container/ImageCarousel/tests/__snapshots__/content.test.js.snap +24 -3
- package/app/v2Containers/Line/Container/Text/index.js +0 -1
- package/app/v2Containers/MobilePush/Create/index.js +105 -28
- package/app/v2Containers/MobilePush/Create/messages.js +4 -0
- package/app/v2Containers/MobilePush/Edit/index.js +250 -68
- package/app/v2Containers/MobilePush/Edit/messages.js +4 -0
- package/app/v2Containers/MobilePushNew/components/PlatformContentFields.js +36 -12
- package/app/v2Containers/MobilePushNew/components/tests/PlatformContentFields.test.js +68 -27
- package/app/v2Containers/MobilePushNew/index.js +78 -35
- package/app/v2Containers/MobilePushNew/messages.js +8 -0
- package/app/v2Containers/MobilepushWrapper/index.js +11 -1
- package/app/v2Containers/Rcs/constants.js +32 -1
- package/app/v2Containers/Rcs/index.js +963 -916
- package/app/v2Containers/Rcs/index.scss +85 -6
- package/app/v2Containers/Rcs/messages.js +10 -1
- package/app/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
- package/app/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +41136 -1566
- package/app/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/app/v2Containers/Rcs/tests/index.test.js +41 -38
- package/app/v2Containers/Rcs/tests/mockData.js +38 -0
- package/app/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
- package/app/v2Containers/Rcs/tests/utils.test.js +379 -1
- package/app/v2Containers/Rcs/utils.js +358 -10
- package/app/v2Containers/Sms/Create/index.js +122 -39
- package/app/v2Containers/Sms/Create/messages.js +4 -0
- package/app/v2Containers/Sms/Edit/index.js +37 -3
- package/app/v2Containers/Sms/commonMethods.js +3 -6
- package/app/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/app/v2Containers/Sms/tests/commonMethods.test.js +122 -0
- package/app/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/app/v2Containers/SmsTrai/Create/index.js +9 -4
- package/app/v2Containers/SmsTrai/Create/index.scss +1 -1
- package/app/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/app/v2Containers/SmsTrai/Edit/index.js +667 -160
- package/app/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/app/v2Containers/SmsTrai/Edit/messages.js +9 -4
- package/app/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4590 -2436
- package/app/v2Containers/SmsWrapper/index.js +41 -8
- package/app/v2Containers/TagList/index.js +63 -2
- package/app/v2Containers/TagList/messages.js +8 -0
- package/app/v2Containers/TagList/tests/TagList.test.js +122 -20
- package/app/v2Containers/TagList/tests/mockdata.js +17 -0
- package/app/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/app/v2Containers/Templates/_templates.scss +61 -2
- package/app/v2Containers/Templates/actions.js +11 -0
- package/app/v2Containers/Templates/constants.js +2 -0
- package/app/v2Containers/Templates/index.js +90 -40
- package/app/v2Containers/Templates/reducer.js +3 -1
- package/app/v2Containers/Templates/sagas.js +57 -12
- package/app/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/app/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
- package/app/v2Containers/Templates/tests/reducer.test.js +12 -0
- package/app/v2Containers/Templates/tests/sagas.test.js +193 -12
- package/app/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/app/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/app/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/app/v2Containers/TemplatesV2/index.js +147 -49
- package/app/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/app/v2Containers/Viber/index.js +9 -10
- package/app/v2Containers/Viber/index.scss +1 -1
- package/app/v2Containers/WebPush/Create/components/BrandIconSection.test.js +264 -0
- package/app/v2Containers/WebPush/Create/components/MessageSection.js +78 -19
- package/app/v2Containers/WebPush/Create/components/MessageSection.test.js +82 -0
- package/app/v2Containers/WebPush/Create/components/__snapshots__/BrandIconSection.test.js.snap +187 -0
- package/app/v2Containers/WebPush/Create/components/__snapshots__/MessageSection.test.js.snap +25 -17
- package/app/v2Containers/WebPush/Create/hooks/useAiraTriggerPosition.js +80 -0
- package/app/v2Containers/WebPush/Create/hooks/useAiraTriggerPosition.test.js +210 -0
- package/app/v2Containers/WebPush/Create/hooks/useTagManagement.js +1 -5
- package/app/v2Containers/WebPush/Create/hooks/useTagManagement.test.js +0 -7
- package/app/v2Containers/WebPush/Create/index.js +36 -6
- package/app/v2Containers/WebPush/Create/index.scss +5 -0
- package/app/v2Containers/WebPush/Create/messages.js +8 -1
- package/app/v2Containers/WebPush/Create/preview/tests/NotificationContainer.test.js +269 -0
- package/app/v2Containers/WebPush/Create/utils/validation.js +31 -15
- package/app/v2Containers/WebPush/Create/utils/validation.test.js +72 -24
- package/app/v2Containers/Whatsapp/index.js +28 -53
- package/app/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +26939 -3982
- package/app/v2Containers/Whatsapp/tests/index.test.js +172 -0
- package/app/v2Containers/Zalo/index.js +5 -11
- package/package.json +2 -2
- package/version +9 -0
|
@@ -24,6 +24,20 @@ export default defineMessages({
|
|
|
24
24
|
id: `${scope}.personalizationTags`,
|
|
25
25
|
defaultMessage: 'Personalization Tags',
|
|
26
26
|
},
|
|
27
|
+
rcsTagsSectionTitle: {
|
|
28
|
+
id: `${scope}.rcsTagsSectionTitle`,
|
|
29
|
+
defaultMessage: 'RCS Tags',
|
|
30
|
+
},
|
|
31
|
+
/** Primary SMS section when channel is SMS — `messages[`${channel}TagsSectionTitle`]` resolves to this. */
|
|
32
|
+
SMSTagsSectionTitle: {
|
|
33
|
+
id: `${scope}.SMSTagsSectionTitle`,
|
|
34
|
+
defaultMessage: 'SMS tags',
|
|
35
|
+
},
|
|
36
|
+
/** Fallback SMS under RCS — same label as SMS Test & Preview for consistent personalization UX. */
|
|
37
|
+
smsFallbackTagsSectionTitle: {
|
|
38
|
+
id: `${scope}.smsFallbackTagsSectionTitle`,
|
|
39
|
+
defaultMessage: 'SMS tags',
|
|
40
|
+
},
|
|
27
41
|
customValues: {
|
|
28
42
|
id: `${scope}.customValues`,
|
|
29
43
|
defaultMessage: 'Custom Values',
|
|
@@ -36,6 +50,14 @@ export default defineMessages({
|
|
|
36
50
|
id: `${scope}.discardCustomValues`,
|
|
37
51
|
defaultMessage: 'Discard custom values',
|
|
38
52
|
},
|
|
53
|
+
rcsSenderIdLabel: {
|
|
54
|
+
id: `${scope}.rcsSenderIdLabel`,
|
|
55
|
+
defaultMessage: 'RCS Sender ID',
|
|
56
|
+
},
|
|
57
|
+
fallbackSmsSenderIdLabel: {
|
|
58
|
+
id: `${scope}.fallbackSmsSenderIdLabel`,
|
|
59
|
+
defaultMessage: 'Fallback SMS Sender ID',
|
|
60
|
+
},
|
|
39
61
|
updatePreview: {
|
|
40
62
|
id: `${scope}.updatePreview`,
|
|
41
63
|
defaultMessage: 'Update Preview',
|
|
@@ -92,6 +114,14 @@ export default defineMessages({
|
|
|
92
114
|
id: `${scope}.previewTitle`,
|
|
93
115
|
defaultMessage: 'Preview',
|
|
94
116
|
},
|
|
117
|
+
rcsTab: {
|
|
118
|
+
id: `${scope}.rcsTab`,
|
|
119
|
+
defaultMessage: 'RCS',
|
|
120
|
+
},
|
|
121
|
+
smsFallbackTab: {
|
|
122
|
+
id: `${scope}.smsFallbackTab`,
|
|
123
|
+
defaultMessage: 'Fallback SMS',
|
|
124
|
+
},
|
|
95
125
|
previewPlaceholder: {
|
|
96
126
|
id: `${scope}.previewPlaceholder`,
|
|
97
127
|
defaultMessage: 'Click "Update Preview" to see the rendered email.',
|
|
@@ -180,14 +210,22 @@ export default defineMessages({
|
|
|
180
210
|
id: `${scope}.lastModified`,
|
|
181
211
|
defaultMessage: 'Last modified',
|
|
182
212
|
},
|
|
183
|
-
|
|
184
|
-
id: `${scope}.
|
|
185
|
-
defaultMessage: 'by',
|
|
213
|
+
byAuthor: {
|
|
214
|
+
id: `${scope}.byAuthor`,
|
|
215
|
+
defaultMessage: 'by {name}',
|
|
186
216
|
},
|
|
187
217
|
senderId: {
|
|
188
218
|
id: `${scope}.senderId`,
|
|
189
219
|
defaultMessage: 'Sender ID',
|
|
190
220
|
},
|
|
221
|
+
rcsSenderIdLabel: {
|
|
222
|
+
id: `${scope}.rcsSenderIdLabel`,
|
|
223
|
+
defaultMessage: 'RCS sender ID',
|
|
224
|
+
},
|
|
225
|
+
domainLabel: {
|
|
226
|
+
id: `${scope}.domainLabel`,
|
|
227
|
+
defaultMessage: 'Domain',
|
|
228
|
+
},
|
|
191
229
|
urlPreviewImage: {
|
|
192
230
|
id: `${scope}.urlPreviewImage`,
|
|
193
231
|
defaultMessage: 'URL Preview Image',
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helpers for Liquid `/preview` (updateEmailPreview) responses.
|
|
3
|
+
* The API may nest the payload under `data` or return fields at the top level.
|
|
4
|
+
* SMS responses often use `messageBody` instead of `resolvedBody`.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { getFallbackResolvedContent } from '../../utils/templateVarUtils';
|
|
8
|
+
import { RCS_SMS_FALLBACK_VAR_MAPPED_PROP } from './constants';
|
|
9
|
+
|
|
10
|
+
export function normalizePreviewApiPayload(raw) {
|
|
11
|
+
if (!raw || typeof raw !== 'object') return raw;
|
|
12
|
+
const next = { ...raw };
|
|
13
|
+
if (next.resolvedBody == null) {
|
|
14
|
+
const alt = next.messageBody ?? next.previewMessage ?? next.previewText;
|
|
15
|
+
if (alt != null) next.resolvedBody = alt;
|
|
16
|
+
}
|
|
17
|
+
return next;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Returns a normalized preview object suitable for Redux `previewData`, or null on error / empty.
|
|
22
|
+
*/
|
|
23
|
+
export function extractPreviewFromLiquidResponse(response) {
|
|
24
|
+
if (!response || response.error) return null;
|
|
25
|
+
if (response.errors && Array.isArray(response.errors) && response.errors.length > 0) return null;
|
|
26
|
+
|
|
27
|
+
let body;
|
|
28
|
+
if (response.data !== undefined && response.data !== null && typeof response.data === 'object') {
|
|
29
|
+
body = normalizePreviewApiPayload(response.data);
|
|
30
|
+
} else if (typeof response === 'object' && !Array.isArray(response)) {
|
|
31
|
+
body = normalizePreviewApiPayload(response);
|
|
32
|
+
} else {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
if (!body) return null;
|
|
37
|
+
if (body.resolvedBody === undefined && body.messageBody === undefined) {
|
|
38
|
+
return null;
|
|
39
|
+
}
|
|
40
|
+
return body;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* RCS SMS fallback: merge template (`templateContent` / `content`) with VarSegment
|
|
45
|
+
* `rcsSmsFallbackVarMapped` before Liquid /preview, tag extraction, or createMessageMeta.
|
|
46
|
+
* Raw template alone is stale when the user edits slot values.
|
|
47
|
+
*/
|
|
48
|
+
export function getSmsFallbackTextForTagExtraction(smsFallbackContext) {
|
|
49
|
+
const rawTemplateBody =
|
|
50
|
+
smsFallbackContext?.templateContent ?? smsFallbackContext?.content ?? '';
|
|
51
|
+
if (!rawTemplateBody) return '';
|
|
52
|
+
const rcsSmsFallbackVarMapped = smsFallbackContext?.[RCS_SMS_FALLBACK_VAR_MAPPED_PROP];
|
|
53
|
+
const hasRcsSmsFallbackVarMappedEntries =
|
|
54
|
+
Object.keys(rcsSmsFallbackVarMapped ?? {}).length > 0;
|
|
55
|
+
if (hasRcsSmsFallbackVarMappedEntries) {
|
|
56
|
+
return getFallbackResolvedContent(rawTemplateBody, rcsSmsFallbackVarMapped ?? {});
|
|
57
|
+
}
|
|
58
|
+
return rawTemplateBody;
|
|
59
|
+
}
|
|
@@ -31,6 +31,13 @@ import {
|
|
|
31
31
|
GET_PREFILLED_VALUES_FAILURE,
|
|
32
32
|
CLEAR_PREFILLED_VALUES,
|
|
33
33
|
CLEAR_PREVIEW_ERRORS,
|
|
34
|
+
GET_SENDER_DETAILS_REQUESTED,
|
|
35
|
+
GET_SENDER_DETAILS_SUCCESS,
|
|
36
|
+
GET_SENDER_DETAILS_FAILURE,
|
|
37
|
+
GET_WECRM_ACCOUNTS_REQUESTED,
|
|
38
|
+
GET_WECRM_ACCOUNTS_SUCCESS,
|
|
39
|
+
GET_WECRM_ACCOUNTS_FAILURE,
|
|
40
|
+
CHANNELS,
|
|
34
41
|
} from './constants';
|
|
35
42
|
|
|
36
43
|
const initialState = fromJS({
|
|
@@ -85,6 +92,16 @@ const initialState = fromJS({
|
|
|
85
92
|
isFetchingPrefilledValues: false,
|
|
86
93
|
fetchPrefilledValuesError: null,
|
|
87
94
|
fetchPrefilledValuesErrors: [],
|
|
95
|
+
|
|
96
|
+
senderDetailsByChannel: fromJS({
|
|
97
|
+
[CHANNELS.SMS]: [],
|
|
98
|
+
[CHANNELS.EMAIL]: [],
|
|
99
|
+
[CHANNELS.WHATSAPP]: [],
|
|
100
|
+
}),
|
|
101
|
+
wecrmAccounts: fromJS([]),
|
|
102
|
+
isLoadingSenderDetails: false,
|
|
103
|
+
fetchSenderDetailsError: null,
|
|
104
|
+
fetchWeCrmAccountsError: null,
|
|
88
105
|
});
|
|
89
106
|
|
|
90
107
|
const previewAndTestReducer = (state = initialState, action) => {
|
|
@@ -250,6 +267,36 @@ const previewAndTestReducer = (state = initialState, action) => {
|
|
|
250
267
|
.set('fetchPrefilledValuesError', null)
|
|
251
268
|
.set('fetchPrefilledValuesErrors', fromJS([]));
|
|
252
269
|
|
|
270
|
+
case GET_SENDER_DETAILS_REQUESTED:
|
|
271
|
+
return state
|
|
272
|
+
.set('isLoadingSenderDetails', true)
|
|
273
|
+
.set('fetchSenderDetailsError', null);
|
|
274
|
+
|
|
275
|
+
case GET_SENDER_DETAILS_SUCCESS: {
|
|
276
|
+
const { channel, domains } = action.payload || {};
|
|
277
|
+
if (!channel) return state;
|
|
278
|
+
return state
|
|
279
|
+
.setIn(['senderDetailsByChannel', channel], fromJS(domains || []))
|
|
280
|
+
.set('isLoadingSenderDetails', false)
|
|
281
|
+
.set('fetchSenderDetailsError', null);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
case GET_SENDER_DETAILS_FAILURE:
|
|
285
|
+
return state
|
|
286
|
+
.set('isLoadingSenderDetails', false)
|
|
287
|
+
.set('fetchSenderDetailsError', action.payload?.error ?? action.payload);
|
|
288
|
+
|
|
289
|
+
case GET_WECRM_ACCOUNTS_REQUESTED:
|
|
290
|
+
return state.set('fetchWeCrmAccountsError', null);
|
|
291
|
+
|
|
292
|
+
case GET_WECRM_ACCOUNTS_SUCCESS:
|
|
293
|
+
return state
|
|
294
|
+
.set('wecrmAccounts', fromJS(action.payload?.accounts || []))
|
|
295
|
+
.set('fetchWeCrmAccountsError', null);
|
|
296
|
+
|
|
297
|
+
case GET_WECRM_ACCOUNTS_FAILURE:
|
|
298
|
+
return state.set('fetchWeCrmAccountsError', action.payload?.error ?? action.payload);
|
|
299
|
+
|
|
253
300
|
default:
|
|
254
301
|
return state;
|
|
255
302
|
}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
|
-
call, put, takeLatest, all,
|
|
6
|
+
call, put, takeLatest, takeEvery, all,
|
|
7
7
|
} from 'redux-saga/effects';
|
|
8
8
|
import get from 'lodash/get';
|
|
9
9
|
import isEmpty from 'lodash/isEmpty';
|
|
@@ -35,8 +35,17 @@ import {
|
|
|
35
35
|
GET_PREFILLED_VALUES_REQUESTED,
|
|
36
36
|
GET_PREFILLED_VALUES_SUCCESS,
|
|
37
37
|
GET_PREFILLED_VALUES_FAILURE,
|
|
38
|
+
GET_SENDER_DETAILS_REQUESTED,
|
|
39
|
+
GET_SENDER_DETAILS_SUCCESS,
|
|
40
|
+
GET_SENDER_DETAILS_FAILURE,
|
|
41
|
+
GET_WECRM_ACCOUNTS_REQUESTED,
|
|
42
|
+
GET_WECRM_ACCOUNTS_SUCCESS,
|
|
43
|
+
GET_WECRM_ACCOUNTS_FAILURE,
|
|
38
44
|
ERROR_MESSAGES,
|
|
45
|
+
CHANNELS,
|
|
39
46
|
} from './constants';
|
|
47
|
+
import { parseSenderDetailsResponse } from './DeliverySettings/utils/parseSenderDetailsResponse';
|
|
48
|
+
import { extractPreviewFromLiquidResponse } from './previewApiUtils';
|
|
40
49
|
|
|
41
50
|
// Search Customers Saga
|
|
42
51
|
export function* searchCustomersSaga(action) {
|
|
@@ -83,11 +92,12 @@ export function* updatePreviewSaga(action) {
|
|
|
83
92
|
const customValues = action.payload.resolvedTags;
|
|
84
93
|
|
|
85
94
|
const response = yield call(Api.updateEmailPreview, action.payload);
|
|
86
|
-
|
|
95
|
+
const previewPayload = extractPreviewFromLiquidResponse(response);
|
|
96
|
+
if (previewPayload) {
|
|
87
97
|
yield put({
|
|
88
98
|
type: UPDATE_PREVIEW_SUCCESS,
|
|
89
99
|
payload: {
|
|
90
|
-
previewData:
|
|
100
|
+
previewData: previewPayload,
|
|
91
101
|
customValues, // Pass custom values to be preserved
|
|
92
102
|
},
|
|
93
103
|
});
|
|
@@ -228,8 +238,13 @@ export function* createMessageMetaSaga(action) {
|
|
|
228
238
|
export function* getPrefilledValuesSaga(action) {
|
|
229
239
|
try {
|
|
230
240
|
const response = yield call(Api.updateEmailPreview, action.payload);
|
|
231
|
-
|
|
232
|
-
|
|
241
|
+
const body =
|
|
242
|
+
response?.data !== undefined && response?.data !== null
|
|
243
|
+
? response.data
|
|
244
|
+
: response;
|
|
245
|
+
const resolvedTagValues = body?.resolvedTagValues;
|
|
246
|
+
if (resolvedTagValues != null) {
|
|
247
|
+
yield put({ type: GET_PREFILLED_VALUES_SUCCESS, payload: { values: resolvedTagValues } });
|
|
233
248
|
} else {
|
|
234
249
|
// Pass all errors from API response to state
|
|
235
250
|
yield put({
|
|
@@ -285,6 +300,59 @@ export function* watchGetPrefilledValues() {
|
|
|
285
300
|
yield takeLatest(GET_PREFILLED_VALUES_REQUESTED, getPrefilledValuesSaga);
|
|
286
301
|
}
|
|
287
302
|
|
|
303
|
+
export function* getSenderDetailsSaga(action) {
|
|
304
|
+
const { channel, orgUnitId } = action.payload || {};
|
|
305
|
+
if (!channel) return;
|
|
306
|
+
try {
|
|
307
|
+
const response = yield call(Api.getSenderDetails, channel, orgUnitId ?? -1);
|
|
308
|
+
if (response?.errors?.length) {
|
|
309
|
+
yield put({
|
|
310
|
+
type: GET_SENDER_DETAILS_FAILURE,
|
|
311
|
+
payload: { channel, error: response.errors },
|
|
312
|
+
});
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
const parsed = parseSenderDetailsResponse(channel, response);
|
|
316
|
+
yield put({
|
|
317
|
+
type: GET_SENDER_DETAILS_SUCCESS,
|
|
318
|
+
payload: { channel, domains: parsed.domains || [] },
|
|
319
|
+
});
|
|
320
|
+
} catch (error) {
|
|
321
|
+
yield put({
|
|
322
|
+
type: GET_SENDER_DETAILS_FAILURE,
|
|
323
|
+
payload: { channel, error: error.message || error },
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
export function* getWeCrmAccountsSaga(action) {
|
|
329
|
+
const { sourceName } = action.payload || {};
|
|
330
|
+
try {
|
|
331
|
+
const result = yield call(Api.fetchWeCrmAccounts, sourceName || CHANNELS.WHATSAPP);
|
|
332
|
+
const accounts = get(result, 'response') || get(result, 'entity') || (result?.success ? result.response : null) || [];
|
|
333
|
+
const list = Array.isArray(accounts) ? accounts : (accounts && accounts.data) || [];
|
|
334
|
+
yield put({
|
|
335
|
+
type: GET_WECRM_ACCOUNTS_SUCCESS,
|
|
336
|
+
payload: { accounts: list },
|
|
337
|
+
});
|
|
338
|
+
} catch (error) {
|
|
339
|
+
yield put({
|
|
340
|
+
type: GET_WECRM_ACCOUNTS_FAILURE,
|
|
341
|
+
payload: { error: error.message || error },
|
|
342
|
+
});
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
export function* watchGetSenderDetails() {
|
|
347
|
+
// takeEvery: RCS test & preview dispatches RCS then SMS back-to-back; takeLatest would
|
|
348
|
+
// cancel the RCS fetch so senderDetailsByChannel.RCS stayed empty while SMS loaded.
|
|
349
|
+
yield takeEvery(GET_SENDER_DETAILS_REQUESTED, getSenderDetailsSaga);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
export function* watchGetWeCrmAccounts() {
|
|
353
|
+
yield takeLatest(GET_WECRM_ACCOUNTS_REQUESTED, getWeCrmAccountsSaga);
|
|
354
|
+
}
|
|
355
|
+
|
|
288
356
|
// Root saga
|
|
289
357
|
export function* commonTestAndPreviewSaga() {
|
|
290
358
|
yield all([
|
|
@@ -296,5 +364,7 @@ export function* commonTestAndPreviewSaga() {
|
|
|
296
364
|
watchFetchTestGroups(),
|
|
297
365
|
watchCreateMessageMeta(),
|
|
298
366
|
watchGetPrefilledValues(),
|
|
367
|
+
watchGetSenderDetails(),
|
|
368
|
+
watchGetWeCrmAccounts(),
|
|
299
369
|
]);
|
|
300
370
|
}
|
|
@@ -144,6 +144,51 @@ const makeSelectFetchPrefilledValuesErrors = () => createSelector(
|
|
|
144
144
|
(substate) => substate.get('fetchPrefilledValuesErrors')?.toJS() || [],
|
|
145
145
|
);
|
|
146
146
|
|
|
147
|
+
const makeSelectSenderDetailsForChannel = (channel) => createSelector(
|
|
148
|
+
selectCommonTestAndPreviewDomain,
|
|
149
|
+
(substate) => {
|
|
150
|
+
if (!substate) return [];
|
|
151
|
+
const byChannel = substate.get('senderDetailsByChannel');
|
|
152
|
+
if (!byChannel) return [];
|
|
153
|
+
const list = byChannel.get(channel);
|
|
154
|
+
return list ? list.toJS() : [];
|
|
155
|
+
},
|
|
156
|
+
);
|
|
157
|
+
|
|
158
|
+
const makeSelectSenderDetailsByChannel = () => createSelector(
|
|
159
|
+
selectCommonTestAndPreviewDomain,
|
|
160
|
+
(substate) => {
|
|
161
|
+
if (!substate) return {};
|
|
162
|
+
const byChannel = substate.get('senderDetailsByChannel');
|
|
163
|
+
if (!byChannel) return {};
|
|
164
|
+
return byChannel.toJS ? byChannel.toJS() : {};
|
|
165
|
+
},
|
|
166
|
+
);
|
|
167
|
+
|
|
168
|
+
const makeSelectWeCrmAccounts = () => createSelector(
|
|
169
|
+
selectCommonTestAndPreviewDomain,
|
|
170
|
+
(substate) => {
|
|
171
|
+
if (!substate) return [];
|
|
172
|
+
const list = substate.get('wecrmAccounts');
|
|
173
|
+
return list ? list.toJS() : [];
|
|
174
|
+
},
|
|
175
|
+
);
|
|
176
|
+
|
|
177
|
+
const makeSelectIsLoadingSenderDetails = () => createSelector(
|
|
178
|
+
selectCommonTestAndPreviewDomain,
|
|
179
|
+
(substate) => substate.get('isLoadingSenderDetails') || false,
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
const makeSelectFetchSenderDetailsError = () => createSelector(
|
|
183
|
+
selectCommonTestAndPreviewDomain,
|
|
184
|
+
(substate) => substate.get('fetchSenderDetailsError'),
|
|
185
|
+
);
|
|
186
|
+
|
|
187
|
+
const makeSelectFetchWeCrmAccountsError = () => createSelector(
|
|
188
|
+
selectCommonTestAndPreviewDomain,
|
|
189
|
+
(substate) => substate.get('fetchWeCrmAccountsError'),
|
|
190
|
+
);
|
|
191
|
+
|
|
147
192
|
export {
|
|
148
193
|
makeSelectCommonTestAndPreview,
|
|
149
194
|
makeSelectCustomers,
|
|
@@ -171,4 +216,10 @@ export {
|
|
|
171
216
|
makeSelectUpdatePreviewErrors,
|
|
172
217
|
makeSelectFetchPrefilledValuesError,
|
|
173
218
|
makeSelectFetchPrefilledValuesErrors,
|
|
219
|
+
makeSelectSenderDetailsForChannel,
|
|
220
|
+
makeSelectSenderDetailsByChannel,
|
|
221
|
+
makeSelectWeCrmAccounts,
|
|
222
|
+
makeSelectIsLoadingSenderDetails,
|
|
223
|
+
makeSelectFetchSenderDetailsError,
|
|
224
|
+
makeSelectFetchWeCrmAccountsError,
|
|
174
225
|
};
|