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
|
@@ -10,9 +10,8 @@ import { connect } from 'react-redux';
|
|
|
10
10
|
import { injectIntl, intlShape, FormattedMessage } from 'react-intl';
|
|
11
11
|
import { createStructuredSelector } from 'reselect';
|
|
12
12
|
import { bindActionCreators, compose } from 'redux';
|
|
13
|
-
import { CapTab, CapCustomCard, CapButton, CapHeader,
|
|
14
|
-
import { find, get } from 'lodash';
|
|
15
|
-
import isEmpty from 'lodash/isEmpty';
|
|
13
|
+
import { CapTab, CapCustomCard, CapButton, CapHeader, CapIcon, CapSpin, CapTooltip } from '@capillarytech/cap-ui-library';
|
|
14
|
+
import { find, get, pick } from 'lodash';
|
|
16
15
|
import Helmet from 'react-helmet';
|
|
17
16
|
|
|
18
17
|
import { UserIsAuthenticated } from '../../utils/authWrapper';
|
|
@@ -30,13 +29,21 @@ import FTP from '../FTP';
|
|
|
30
29
|
import Gallery from '../Assets/Gallery';
|
|
31
30
|
import withStyles from '../../hoc/withStyles';
|
|
32
31
|
import styles, { CapTabStyle } from './TemplatesV2.style';
|
|
33
|
-
import { CREATIVES_UI_VIEW, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP, WEBPUSH } from '../App/constants';
|
|
32
|
+
import { CREATIVES_UI_VIEW, FTP as FTP_CHANNEL, LOYALTY, WHATSAPP, RCS, LINE, EMAIL, ASSETS, JP_LOCALE_HIDE_FEATURE, ZALO, INAPP, WEBPUSH } from '../App/constants';
|
|
34
33
|
import AccessForbidden from '../../v2Components/AccessForbidden';
|
|
35
34
|
import { getObjFromQueryParams } from '../../utils/v2common';
|
|
36
35
|
import { makeSelectAuthenticated, selectCurrentOrgDetails } from "../../v2Containers/Cap/selectors";
|
|
37
|
-
import {
|
|
36
|
+
import {
|
|
37
|
+
CALL_TASK,
|
|
38
|
+
COMMON_CHANNELS,
|
|
39
|
+
LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK,
|
|
40
|
+
LOYALTY_SUPPORTED_ACTION,
|
|
41
|
+
MOBILE_PUSH,
|
|
42
|
+
NORMALIZED_CHANNEL_ALIASES,
|
|
43
|
+
SMS,
|
|
44
|
+
} from "../CreativesContainer/constants";
|
|
38
45
|
|
|
39
|
-
const {CapCustomCardList} = CapCustomCard;
|
|
46
|
+
const { CapCustomCardList } = CapCustomCard;
|
|
40
47
|
|
|
41
48
|
const StyledCapTab = withStyles(CapTab, CapTabStyle);
|
|
42
49
|
export class TemplatesV2 extends React.Component { // eslint-disable-line react/prefer-stateless-function
|
|
@@ -58,6 +65,7 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
58
65
|
cap = {},
|
|
59
66
|
loyaltyMetaData = {},
|
|
60
67
|
isLoyaltyModule = false,
|
|
68
|
+
isAnonymousType = false,
|
|
61
69
|
} = props;
|
|
62
70
|
|
|
63
71
|
const defaultPanes = {
|
|
@@ -89,44 +97,62 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
89
97
|
key: 'wechat',
|
|
90
98
|
};
|
|
91
99
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
100
|
+
// Robust normalization function: converts camelCase, hyphens, spaces and mixed-case to snake_case lowercase
|
|
101
|
+
const normalizeChannel = (raw = '') => {
|
|
102
|
+
const str = (raw || '').toString();
|
|
103
|
+
return str.replace(/([a-z0-9])([A-Z])/g, '$1_$2').replace(/[^a-zA-Z0-9]+/g, '_').toLowerCase();
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
const buildChannelSet = (channelList) => {
|
|
107
|
+
const normalized = (channelList || []).map((c) => normalizeChannel(c));
|
|
108
|
+
const withAliases = normalized.flatMap((norm) => {
|
|
109
|
+
const canonical = NORMALIZED_CHANNEL_ALIASES[norm];
|
|
110
|
+
return canonical ? [norm, canonical] : [norm];
|
|
111
|
+
});
|
|
112
|
+
return new Set(withAliases);
|
|
113
|
+
};
|
|
114
|
+
const normalizedChannelsToHideSet = buildChannelSet(channelsToHide);
|
|
115
|
+
const normalizedChannelsToDisableSet = buildChannelSet(channelsToDisable);
|
|
116
|
+
|
|
117
|
+
// Build filtered panes by examining each pane's `key` and checking against normalized hide set
|
|
118
|
+
let filteredPanes = Object.keys(defaultPanes).map((k) => defaultPanes[k]).filter((pane) => {
|
|
119
|
+
const paneKey = normalizeChannel(pane.key);
|
|
120
|
+
return !normalizedChannelsToHideSet.has(paneKey);
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
if (isFullMode && !normalizedChannelsToHideSet.has(normalizeChannel(ASSETS))) {
|
|
124
|
+
filteredPanes.push({ content: <div></div>, tab: intl.formatMessage(messages.gallery), key: ASSETS });
|
|
125
|
+
} else if (!isFullMode) {
|
|
126
|
+
// Add special-mode panes only when not hidden (use normalized checks)
|
|
127
|
+
if (!normalizedChannelsToHideSet.has(CALL_TASK.toLowerCase())) {
|
|
128
|
+
filteredPanes.push({ content: <div></div>, tab: intl.formatMessage(messages.callTask), key: CALL_TASK.toLowerCase() });
|
|
103
129
|
}
|
|
104
|
-
if (!
|
|
105
|
-
filteredPanes.push({content: <></>, tab: intl.formatMessage(messages.FTP), key:
|
|
106
|
-
defaultChannel =
|
|
130
|
+
if (!normalizedChannelsToHideSet.has(FTP_CHANNEL.toLowerCase())) {
|
|
131
|
+
filteredPanes.push({ content: <></>, tab: intl.formatMessage(messages.FTP), key: FTP_CHANNEL.toLowerCase() });
|
|
132
|
+
defaultChannel = FTP_CHANNEL;
|
|
107
133
|
}
|
|
108
134
|
|
|
109
135
|
// Create a local copy of COMMON_CHANNELS to avoid mutating the imported array
|
|
110
136
|
const channels = [...COMMON_CHANNELS];
|
|
111
|
-
const { actionName = ''} = loyaltyMetaData;
|
|
137
|
+
const { actionName = '' } = loyaltyMetaData;
|
|
112
138
|
if (isLoyaltyModule && actionName === LOYALTY_SUPPORTED_ACTION) {
|
|
113
139
|
channels.push(WHATSAPP, ZALO);
|
|
114
140
|
}
|
|
115
141
|
|
|
116
|
-
// we only show channels
|
|
117
|
-
// if it is coming in enableNewChannels array
|
|
142
|
+
// we only show channels other than COMMON_CHANNELS if they are present in enableNewChannels
|
|
118
143
|
filteredPanes = filteredPanes.filter((item) => {
|
|
119
|
-
const
|
|
120
|
-
if (!channels.includes(
|
|
121
|
-
return enableNewChannels.includes(
|
|
144
|
+
const channelKey = normalizeChannel(item.key);
|
|
145
|
+
if (!channels.includes(channelKey)) {
|
|
146
|
+
return enableNewChannels.includes(channelKey.toUpperCase());
|
|
122
147
|
}
|
|
123
148
|
return true;
|
|
124
149
|
});
|
|
125
150
|
}
|
|
126
151
|
|
|
127
152
|
|
|
128
|
-
filteredPanes = filteredPanes.map(
|
|
129
|
-
|
|
153
|
+
filteredPanes = filteredPanes.map((pane) => {
|
|
154
|
+
const paneKeyNorm = normalizeChannel(pane.key);
|
|
155
|
+
if (normalizedChannelsToDisableSet.has(paneKeyNorm)) {
|
|
130
156
|
// eslint-disable-next-line no-param-reassign
|
|
131
157
|
pane.disabled = true;
|
|
132
158
|
if (pane.key === 'facebook' && showDisabledFBInfo) {
|
|
@@ -151,10 +177,18 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
151
177
|
filteredPanes = hideEngagementChannel ? filteredPanes?.filter((pane) => [EMAIL, LINE, ASSETS].includes(pane?.key) && pane) : filteredPanes;
|
|
152
178
|
defaultChannel = hideEngagementChannel ? EMAIL : defaultChannel;
|
|
153
179
|
|
|
154
|
-
|
|
155
|
-
if (
|
|
156
|
-
|
|
157
|
-
|
|
180
|
+
// If audience is anonymous, prefer mobilepush as default (if not hidden)
|
|
181
|
+
if (isAnonymousType) {
|
|
182
|
+
const mobilePushNorm = normalizeChannel(MOBILE_PUSH.toLowerCase());
|
|
183
|
+
if (!normalizedChannelsToHideSet.has(mobilePushNorm)) {
|
|
184
|
+
defaultChannel = MOBILE_PUSH.toLowerCase();
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
const defaultChannelOrder = [SMS.toLowerCase(), EMAIL, MOBILE_PUSH.toLowerCase(), LINE, CALL_TASK.toLowerCase()];
|
|
189
|
+
if (normalizedChannelsToDisableSet.size > 0) {
|
|
190
|
+
defaultChannelOrder.some((ch) => {
|
|
191
|
+
if (!normalizedChannelsToDisableSet.has(ch)) {
|
|
158
192
|
defaultChannel = ch;
|
|
159
193
|
return true;
|
|
160
194
|
}
|
|
@@ -189,7 +223,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
189
223
|
this.setState({selectedChannel: nextProps.channel, panes });
|
|
190
224
|
}
|
|
191
225
|
}
|
|
192
|
-
|
|
226
|
+
|
|
227
|
+
getTemplateDataForGrid = ({ templates, handlers, filterContent, channel, isLoading, loadingTip }) => {
|
|
193
228
|
const currentChannel = channel.toUpperCase();
|
|
194
229
|
const cardDataList = templates.map((template) => {
|
|
195
230
|
const templateData =
|
|
@@ -215,7 +250,8 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
215
250
|
</CapSpin>
|
|
216
251
|
|
|
217
252
|
</div>);
|
|
218
|
-
}
|
|
253
|
+
};
|
|
254
|
+
|
|
219
255
|
getGalleryComponent = (location) => <Gallery location={location} isFullMode={this.props.isFullMode}/>
|
|
220
256
|
getCallTaskComponent = () => (
|
|
221
257
|
<CallTask
|
|
@@ -279,6 +315,29 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
279
315
|
if (messageStrategy !== "X_ENGAGE" && channel === 'facebook' && !isFullMode) {
|
|
280
316
|
return this.getFacebookComponent();
|
|
281
317
|
}
|
|
318
|
+
const localConfig = this.props.localTemplatesConfig || pick(this.props, LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK);
|
|
319
|
+
const useLocalTemplates = localConfig.useLocalTemplates;
|
|
320
|
+
if (useLocalTemplates && channel === (this.props.channel || 'sms')) {
|
|
321
|
+
// Reuse full Templates component (same UI as Redux flow) with local data only
|
|
322
|
+
const location = { pathname: `/${channel}`, search: '', query: !this.props.isFullMode ? { type: 'embedded', module: 'library' } : {} };
|
|
323
|
+
return (
|
|
324
|
+
<Templates
|
|
325
|
+
key={`${channel}-local`}
|
|
326
|
+
location={location}
|
|
327
|
+
route={{ name: channel }}
|
|
328
|
+
router={this.props.router}
|
|
329
|
+
isFullMode={this.props.isFullMode}
|
|
330
|
+
createNew={this.props.createNew}
|
|
331
|
+
onSelectTemplate={this.props.onSelectTemplate}
|
|
332
|
+
handlePeviewTemplate={this.props.handlePeviewTemplate}
|
|
333
|
+
messageStrategy={this.props.messageStrategy}
|
|
334
|
+
smsRegister={this.props.smsRegister}
|
|
335
|
+
hideTestAndPreviewBtn={this.props.hideTestAndPreviewBtn}
|
|
336
|
+
localTemplatesConfig={localConfig}
|
|
337
|
+
/>
|
|
338
|
+
);
|
|
339
|
+
}
|
|
340
|
+
|
|
282
341
|
const location = {pathname: `/${channel}`, search: '', query};
|
|
283
342
|
switch (channel) {
|
|
284
343
|
case 'call_task':
|
|
@@ -328,29 +387,55 @@ export class TemplatesV2 extends React.Component { // eslint-disable-line react/
|
|
|
328
387
|
}
|
|
329
388
|
render() {
|
|
330
389
|
const { isFullMode, className, cap = {}, Global = {}} = this.props;
|
|
390
|
+
const useLocalTemplates = get(this.props, 'localTemplatesConfig.useLocalTemplates', false);
|
|
331
391
|
const { accessiblePermissions = []} = cap.user || Global.user || {};
|
|
332
392
|
let isCreativeAccessible = true;
|
|
333
393
|
if (!accessiblePermissions.includes(CREATIVES_UI_VIEW)) {
|
|
334
394
|
isCreativeAccessible = false;
|
|
335
395
|
}
|
|
396
|
+
// Recompute active pane content every render so local-list mode updates
|
|
397
|
+
// (templates/loading/search UI) are not stuck with the initial cached pane.
|
|
398
|
+
const panes = this.setChannelContent(this.state.selectedChannel, this.state.panes);
|
|
399
|
+
const hideChannelTabsForLocalSms = useLocalTemplates && panes.length === 1;
|
|
400
|
+
const activeLocalPane = hideChannelTabsForLocalSms
|
|
401
|
+
? (panes.find(
|
|
402
|
+
(p) => String(p.key).toLowerCase() === String(this.state.selectedChannel).toLowerCase(),
|
|
403
|
+
) || panes[0])
|
|
404
|
+
: null;
|
|
336
405
|
return (
|
|
337
406
|
!isCreativeAccessible ? <AccessForbidden /> : (
|
|
338
|
-
<div
|
|
339
|
-
{isFullMode
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
panes={this.state.panes}
|
|
349
|
-
onChange={this.channelChange}
|
|
350
|
-
activeKey={this.state.selectedChannel}
|
|
351
|
-
defaultActiveKey={this.state.selectedChannel}
|
|
352
|
-
isFullMode={isFullMode}
|
|
407
|
+
<div
|
|
408
|
+
className={`${className} creatives-templates-container ${isFullMode ? 'fullmode' : 'library-mode'}${useLocalTemplates ? ' creatives-templates-container--local-sms' : ''}`}
|
|
409
|
+
data-testid="cap-wrapper"
|
|
410
|
+
>
|
|
411
|
+
{isFullMode && !useLocalTemplates && (
|
|
412
|
+
<Helmet
|
|
413
|
+
title={this.props.intl.formatMessage(messages.creatives)}
|
|
414
|
+
meta={[
|
|
415
|
+
{ name: 'description', content: this.props.intl.formatMessage(messages.creativesDesc) },
|
|
416
|
+
]}
|
|
353
417
|
/>
|
|
418
|
+
)}
|
|
419
|
+
<div className="component-wrapper">
|
|
420
|
+
{isFullMode && (
|
|
421
|
+
<CapHeader
|
|
422
|
+
title={<FormattedMessage {...messages.creatives} />}
|
|
423
|
+
{...(!useLocalTemplates && {
|
|
424
|
+
description: <FormattedMessage {...messages.creativesDesc} />,
|
|
425
|
+
})}
|
|
426
|
+
/>
|
|
427
|
+
)}
|
|
428
|
+
{hideChannelTabsForLocalSms ? (
|
|
429
|
+
<div className="templates-v2-local-sms-pane">{activeLocalPane?.content}</div>
|
|
430
|
+
) : (
|
|
431
|
+
<StyledCapTab
|
|
432
|
+
panes={panes}
|
|
433
|
+
onChange={this.channelChange}
|
|
434
|
+
activeKey={this.state.selectedChannel}
|
|
435
|
+
defaultActiveKey={this.state.selectedChannel}
|
|
436
|
+
isFullMode={isFullMode}
|
|
437
|
+
/>
|
|
438
|
+
)}
|
|
354
439
|
</div>
|
|
355
440
|
</div>
|
|
356
441
|
)
|
|
@@ -380,6 +465,19 @@ TemplatesV2.propTypes = {
|
|
|
380
465
|
FTPMode: PropTypes.string,
|
|
381
466
|
messageStrategy: PropTypes.string,
|
|
382
467
|
currentOrgDetails: PropTypes.object,
|
|
468
|
+
restrictPersonalization: PropTypes.bool,
|
|
469
|
+
isAnonymousType: PropTypes.bool,
|
|
470
|
+
// Optional: reuse grid UI with local template list (e.g. SMS fallback). Pass object or same keys as individual props.
|
|
471
|
+
localTemplatesConfig: PropTypes.shape({
|
|
472
|
+
useLocalTemplates: PropTypes.bool,
|
|
473
|
+
localTemplates: PropTypes.arrayOf(PropTypes.object),
|
|
474
|
+
localTemplatesLoading: PropTypes.bool,
|
|
475
|
+
localTemplatesLoadingTip: PropTypes.string,
|
|
476
|
+
localTemplatesFilterContent: PropTypes.node,
|
|
477
|
+
localTemplatesFooterContent: PropTypes.node,
|
|
478
|
+
localTemplatesOnPageChange: PropTypes.func,
|
|
479
|
+
localTemplatesUseSkeleton: PropTypes.bool,
|
|
480
|
+
}),
|
|
383
481
|
};
|
|
384
482
|
|
|
385
483
|
TemplatesV2.defaultProps = {
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Embedded SMS template list: localTemplatesConfig + SMS-only channel visibility (RCS SMS fallback).
|
|
3
|
+
*/
|
|
4
|
+
import React from 'react';
|
|
5
|
+
import { injectIntl } from 'react-intl';
|
|
6
|
+
import '@testing-library/jest-dom';
|
|
7
|
+
import cloneDeep from 'lodash/cloneDeep';
|
|
8
|
+
import { Provider } from 'react-redux';
|
|
9
|
+
import { configureStore } from '@capillarytech/vulcan-react-sdk/utils';
|
|
10
|
+
import history from '../../../utils/history';
|
|
11
|
+
import { initialReducer } from '../../../initialReducer';
|
|
12
|
+
import { render, screen } from '../../../utils/test-utils';
|
|
13
|
+
import { TemplatesV2 } from '../index';
|
|
14
|
+
import { Templates, authData, currentOrgDetails as currentOrgDetailsMock } from './mockData';
|
|
15
|
+
import { CHANNELS_TO_HIDE_FOR_SMS_ONLY } from '../../../v2Components/SmsFallback/constants';
|
|
16
|
+
|
|
17
|
+
const mockTemplates = jest.fn(() => <div data-testid="templates-mock">Templates</div>);
|
|
18
|
+
jest.mock('v2Containers/Templates', () => ({
|
|
19
|
+
__esModule: true,
|
|
20
|
+
default: (props) => mockTemplates(props),
|
|
21
|
+
}));
|
|
22
|
+
|
|
23
|
+
jest.mock('../../../utils/authWrapper', () => ({
|
|
24
|
+
UserIsAuthenticated: jest.fn((config) => config),
|
|
25
|
+
}));
|
|
26
|
+
|
|
27
|
+
const ComponentToRender = injectIntl(TemplatesV2);
|
|
28
|
+
const renderComponent = (p) => {
|
|
29
|
+
const store = configureStore({}, initialReducer, history);
|
|
30
|
+
return render(
|
|
31
|
+
<Provider store={store}>
|
|
32
|
+
<ComponentToRender {...p} />
|
|
33
|
+
</Provider>,
|
|
34
|
+
);
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
describe('TemplatesV2 local SMS templates (embedded)', () => {
|
|
38
|
+
const templateActions = {
|
|
39
|
+
templateActions: jest.fn(),
|
|
40
|
+
deleteTemplate: jest.fn(),
|
|
41
|
+
getAccountsSettings: jest.fn(),
|
|
42
|
+
getAllTemplates: jest.fn(),
|
|
43
|
+
getCdnTransformationConfig: jest.fn(),
|
|
44
|
+
getDefaultBeeTemplates: jest.fn(),
|
|
45
|
+
getSenderDetails: jest.fn(),
|
|
46
|
+
getTemplateDetails: jest.fn(),
|
|
47
|
+
getUserList: jest.fn(),
|
|
48
|
+
getWeCrmAccounts: jest.fn(),
|
|
49
|
+
handleHtmlUpload: jest.fn(),
|
|
50
|
+
handleZipUpload: jest.fn(),
|
|
51
|
+
resetAccount: jest.fn(),
|
|
52
|
+
resetTemplate: jest.fn(),
|
|
53
|
+
resetTemplateData: jest.fn(),
|
|
54
|
+
resetTemplateStoreData: jest.fn(),
|
|
55
|
+
resetUploadData: jest.fn(),
|
|
56
|
+
setBEETemplate: jest.fn(),
|
|
57
|
+
setChannelAccount: jest.fn(),
|
|
58
|
+
setEdmTemplate: jest.fn(),
|
|
59
|
+
setFacebookAccount: jest.fn(),
|
|
60
|
+
setViberAccount: jest.fn(),
|
|
61
|
+
setWeChatAccount: jest.fn(),
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
const baseProps = {
|
|
65
|
+
cap: {
|
|
66
|
+
user: { accessiblePermissions: ['CREATIVES_UI_VIEW'] },
|
|
67
|
+
},
|
|
68
|
+
actions: { defaultAction: jest.fn(), getTemplates: jest.fn() },
|
|
69
|
+
Templates,
|
|
70
|
+
TemplatesList: Templates?.templates,
|
|
71
|
+
authData,
|
|
72
|
+
templateActions,
|
|
73
|
+
isFullMode: false,
|
|
74
|
+
className: 'embed-test',
|
|
75
|
+
channel: 'sms',
|
|
76
|
+
channelsToHide: CHANNELS_TO_HIDE_FOR_SMS_ONLY,
|
|
77
|
+
channelsToDisable: [],
|
|
78
|
+
onChannelChange: jest.fn(),
|
|
79
|
+
enableNewChannels: [],
|
|
80
|
+
/** Without JP_LOCALE_HIDE_FEATURE so SMS panes are not stripped to Email/Line/Gallery only */
|
|
81
|
+
currentOrgDetails: {
|
|
82
|
+
...currentOrgDetailsMock,
|
|
83
|
+
accessibleFeatures: (currentOrgDetailsMock.accessibleFeatures || []).filter(
|
|
84
|
+
(f) => f !== 'JP_LOCALE_HIDE_FEATURE',
|
|
85
|
+
),
|
|
86
|
+
},
|
|
87
|
+
location: {
|
|
88
|
+
pathname: 'v2',
|
|
89
|
+
basename: '/creatives/ui/',
|
|
90
|
+
query: {},
|
|
91
|
+
},
|
|
92
|
+
router: { push: jest.fn() },
|
|
93
|
+
};
|
|
94
|
+
|
|
95
|
+
beforeEach(() => {
|
|
96
|
+
mockTemplates.mockClear();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('adds local-sms container class and single-pane layout when only SMS is visible', () => {
|
|
100
|
+
const p = cloneDeep(baseProps);
|
|
101
|
+
p.localTemplatesConfig = {
|
|
102
|
+
useLocalTemplates: true,
|
|
103
|
+
localTemplates: [],
|
|
104
|
+
localTemplatesLoading: false,
|
|
105
|
+
};
|
|
106
|
+
renderComponent(p);
|
|
107
|
+
|
|
108
|
+
const wrapper = screen.getByTestId('cap-wrapper');
|
|
109
|
+
expect(wrapper).toHaveClass('creatives-templates-container--local-sms');
|
|
110
|
+
expect(document.querySelector('.templates-v2-local-sms-pane')).toBeTruthy();
|
|
111
|
+
expect(mockTemplates).toHaveBeenCalled();
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
it('passes localTemplatesConfig into Templates for the SMS pane', () => {
|
|
115
|
+
const localConfig = {
|
|
116
|
+
useLocalTemplates: true,
|
|
117
|
+
localTemplates: [{ _id: '1', name: 'A' }],
|
|
118
|
+
localTemplatesLoading: false,
|
|
119
|
+
};
|
|
120
|
+
const p = cloneDeep(baseProps);
|
|
121
|
+
p.localTemplatesConfig = localConfig;
|
|
122
|
+
renderComponent(p);
|
|
123
|
+
|
|
124
|
+
expect(mockTemplates).toHaveBeenCalled();
|
|
125
|
+
const passed = mockTemplates.mock.calls.find(
|
|
126
|
+
(call) => call[0] && call[0].localTemplatesConfig && call[0].localTemplatesConfig.useLocalTemplates,
|
|
127
|
+
);
|
|
128
|
+
expect(passed).toBeTruthy();
|
|
129
|
+
expect(passed[0].localTemplatesConfig).toMatchObject(localConfig);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -30,7 +30,7 @@ import messages from './messages';
|
|
|
30
30
|
import creativesMessages from '../CreativesContainer/messages';
|
|
31
31
|
import TagList from '../TagList';
|
|
32
32
|
import CapTagListWithInput from '../../v2Components/CapTagListWithInput';
|
|
33
|
-
import { makeSelectMetaEntities, setInjectedTags
|
|
33
|
+
import { makeSelectMetaEntities, setInjectedTags } from '../Cap/selectors';
|
|
34
34
|
import {
|
|
35
35
|
ALLOWED_IMAGE_EXTENSIONS_REGEX_VIBER,
|
|
36
36
|
ALLOWED_EXTENSIONS_VIDEO_REGEX_VIBER,
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
NONE,
|
|
45
45
|
mediaRadioOptions,
|
|
46
46
|
buttonRadioOptions,
|
|
47
|
-
AI_CONTENT_BOT_DISABLED,
|
|
48
47
|
} from './constants';
|
|
49
48
|
import withCreatives from '../../hoc/withCreatives';
|
|
50
49
|
import {
|
|
@@ -53,6 +52,7 @@ import {
|
|
|
53
52
|
import { gtmPush } from '../../utils/gtmTrackers';
|
|
54
53
|
import { VIBER } from '../CreativesContainer/constants';
|
|
55
54
|
import { getCdnUrl } from '../../utils/cdnTransformation';
|
|
55
|
+
import { isAiContentBotDisabled } from '../../utils/common';
|
|
56
56
|
import globalMessages from '../Cap/messages';
|
|
57
57
|
import CapImageUpload from '../../v2Components/CapImageUpload';
|
|
58
58
|
import CapVideoUpload from '../../v2Components/CapVideoUpload';
|
|
@@ -81,8 +81,8 @@ export const Viber = (props) => {
|
|
|
81
81
|
getFormSubscriptionData,
|
|
82
82
|
viberData = {},
|
|
83
83
|
selectedOfferDetails = [],
|
|
84
|
-
currentOrgDetails,
|
|
85
84
|
eventContextTags,
|
|
85
|
+
waitEventContextTags,
|
|
86
86
|
// TestAndPreviewSlidebox props
|
|
87
87
|
showTestAndPreviewSlidebox: propsShowTestAndPreviewSlidebox,
|
|
88
88
|
handleTestAndPreview: propsHandleTestAndPreview,
|
|
@@ -115,10 +115,7 @@ export const Viber = (props) => {
|
|
|
115
115
|
const [buttonType, setButtonType] = useState(NONE);
|
|
116
116
|
const [ctaData, setCtadata] = useState({});
|
|
117
117
|
const [isCtaSaved, setIsCtaSaved] = useState(false);
|
|
118
|
-
const
|
|
119
|
-
const isAiContentBotDisabled = accessibleFeatures?.includes(
|
|
120
|
-
AI_CONTENT_BOT_DISABLED
|
|
121
|
-
);
|
|
118
|
+
const aiContentBotDisabled = isAiContentBotDisabled();
|
|
122
119
|
|
|
123
120
|
const updateImageSrc = React.useCallback((url) => {
|
|
124
121
|
const newUrl = getCdnUrl({url, channelName: 'VIBER'});
|
|
@@ -234,9 +231,10 @@ export const Viber = (props) => {
|
|
|
234
231
|
const { valid, isBraceError } = validateTags({
|
|
235
232
|
content: value,
|
|
236
233
|
tagsParam: tags,
|
|
237
|
-
injectedTagsParams: injectedTags,
|
|
238
234
|
location,
|
|
239
235
|
tagModule: 'outbound',
|
|
236
|
+
eventContextTags,
|
|
237
|
+
waitEventContextTags,
|
|
240
238
|
isFullMode,
|
|
241
239
|
}) || {};
|
|
242
240
|
if (value.trim() === '') {
|
|
@@ -292,6 +290,7 @@ export const Viber = (props) => {
|
|
|
292
290
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
293
291
|
selectedOfferDetails={selectedOfferDetails}
|
|
294
292
|
eventContextTags={eventContextTags}
|
|
293
|
+
waitEventContextTags={waitEventContextTags}
|
|
295
294
|
/>
|
|
296
295
|
</CapColumn>
|
|
297
296
|
<div className="viber-textarea-wrapper">
|
|
@@ -307,7 +306,7 @@ export const Viber = (props) => {
|
|
|
307
306
|
cols={2}
|
|
308
307
|
placeholder={formatMessage(messages.enterMessage)}
|
|
309
308
|
/>
|
|
310
|
-
{!
|
|
309
|
+
{!aiContentBotDisabled && (
|
|
311
310
|
<CapAskAira.ContentGenerationBot
|
|
312
311
|
text={messageContent || ""}
|
|
313
312
|
setText={(text) => {
|
|
@@ -597,6 +596,7 @@ export const Viber = (props) => {
|
|
|
597
596
|
userLocale={localStorage.getItem("jlocale") || "en"}
|
|
598
597
|
selectedOfferDetails={selectedOfferDetails}
|
|
599
598
|
eventContextTags={eventContextTags}
|
|
599
|
+
waitEventContextTags={waitEventContextTags}
|
|
600
600
|
/>
|
|
601
601
|
<CapColumn className="cta-actions">
|
|
602
602
|
<CapButton
|
|
@@ -888,7 +888,6 @@ const mapStateToProps = createStructuredSelector({
|
|
|
888
888
|
injectedTags: setInjectedTags(),
|
|
889
889
|
viberData: makeSelectViber(),
|
|
890
890
|
viber: makeSelectCreateViber(),
|
|
891
|
-
currentOrgDetails: selectCurrentOrgDetails(),
|
|
892
891
|
});
|
|
893
892
|
|
|
894
893
|
const mapDispatchToProps = (dispatch) => ({
|