@capillarytech/creatives-library 8.0.318 → 8.0.320
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/constants/unified.js +15 -0
- package/package.json +1 -1
- package/services/api.js +6 -0
- package/services/tests/api.test.js +7 -0
- package/utils/common.js +6 -1
- package/utils/templateVarUtils.js +172 -0
- package/utils/tests/templateVarUtils.test.js +160 -0
- package/v2Components/CapTagList/index.js +10 -0
- package/v2Components/CommonTestAndPreview/CustomValuesEditor.js +70 -49
- package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +8 -2
- package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +207 -21
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +16 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +85 -10
- package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +30 -0
- package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +79 -11
- package/v2Components/CommonTestAndPreview/SendTestMessage.js +11 -5
- package/v2Components/CommonTestAndPreview/UnifiedPreview/_unifiedPreview.scss +20 -1
- package/v2Components/CommonTestAndPreview/UnifiedPreview/index.js +133 -4
- package/v2Components/CommonTestAndPreview/_commonTestAndPreview.scss +12 -0
- package/v2Components/CommonTestAndPreview/constants.js +38 -0
- package/v2Components/CommonTestAndPreview/index.js +693 -155
- package/v2Components/CommonTestAndPreview/messages.js +41 -3
- package/v2Components/CommonTestAndPreview/previewApiUtils.js +59 -0
- package/v2Components/CommonTestAndPreview/sagas.js +15 -6
- package/v2Components/CommonTestAndPreview/tests/CustomValuesEditor.test.js +352 -0
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +269 -1
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +118 -5
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +341 -0
- package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +25 -4
- package/v2Components/CommonTestAndPreview/tests/UnifiedPreview/index.test.js +199 -1
- package/v2Components/CommonTestAndPreview/tests/index.test.js +132 -4
- package/v2Components/CommonTestAndPreview/tests/previewApiUtils.test.js +67 -0
- package/v2Components/CommonTestAndPreview/tests/sagas.test.js +2 -2
- package/v2Components/FormBuilder/index.js +7 -1
- package/v2Components/SmsFallback/SmsFallbackLocalSelector.js +87 -0
- package/v2Components/SmsFallback/constants.js +73 -0
- package/v2Components/SmsFallback/index.js +956 -0
- package/v2Components/SmsFallback/index.scss +265 -0
- package/v2Components/SmsFallback/messages.js +78 -0
- package/v2Components/SmsFallback/smsFallbackUtils.js +107 -0
- package/v2Components/SmsFallback/tests/SmsFallbackLocalSelector.test.js +50 -0
- package/v2Components/SmsFallback/tests/rcsSmsFallback.acceptance.test.js +147 -0
- package/v2Components/SmsFallback/tests/smsFallbackHandlers.test.js +304 -0
- package/v2Components/SmsFallback/tests/smsFallbackUi.test.js +197 -0
- package/v2Components/SmsFallback/tests/smsFallbackUtils.test.js +261 -0
- package/v2Components/SmsFallback/tests/useLocalTemplateList.test.js +422 -0
- package/v2Components/SmsFallback/useLocalTemplateList.js +92 -0
- package/v2Components/TestAndPreviewSlidebox/index.js +8 -1
- package/v2Components/TestAndPreviewSlidebox/sagas.js +11 -4
- package/v2Components/TestAndPreviewSlidebox/tests/saga.test.js +3 -1
- package/v2Components/VarSegmentMessageEditor/constants.js +2 -0
- package/v2Components/VarSegmentMessageEditor/index.js +125 -0
- package/v2Components/VarSegmentMessageEditor/index.scss +46 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +291 -0
- package/v2Containers/CommunicationFlow/CommunicationFlow.scss +25 -0
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +255 -0
- package/v2Containers/CommunicationFlow/constants.js +200 -0
- package/v2Containers/CommunicationFlow/index.js +102 -0
- package/v2Containers/CommunicationFlow/messages.js +346 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +522 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +170 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +796 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +95 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/Tests/CommunicationStrategyStep.test.js +133 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +289 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.scss +70 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.js +319 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/SenderDetails.scss +69 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +616 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/SenderDetails.test.js +577 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/deliverySettingsConfig.test.js +1111 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/deliverySettingsConfig.js +696 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/index.js +7 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.js +102 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/DynamicControlsStep.scss +36 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/Tests/DynamicControlsStep.test.js +91 -0
- package/v2Containers/CommunicationFlow/steps/DynamicControlsStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/MessageTypeStep.js +86 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/Tests/MessageTypeStep.test.js +100 -0
- package/v2Containers/CommunicationFlow/steps/MessageTypeStep/index.js +5 -0
- package/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +30 -0
- package/v2Containers/CreativesContainer/CreativesSlideBoxWrapper.js +43 -0
- package/v2Containers/CreativesContainer/SlideBoxContent.js +36 -4
- package/v2Containers/CreativesContainer/SlideBoxFooter.js +10 -1
- package/v2Containers/CreativesContainer/SlideBoxHeader.js +29 -4
- package/v2Containers/CreativesContainer/constants.js +12 -0
- package/v2Containers/CreativesContainer/embeddedSlideboxUtils.js +67 -0
- package/v2Containers/CreativesContainer/index.js +289 -99
- package/v2Containers/CreativesContainer/index.scss +51 -1
- package/v2Containers/CreativesContainer/tests/SlideBoxContent.localTemplates.test.js +90 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxFooter.test.js +104 -0
- package/v2Containers/CreativesContainer/tests/SlideBoxHeader.test.js +110 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +8 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxHeader.test.js.snap +363 -0
- package/v2Containers/CreativesContainer/tests/__snapshots__/index.test.js.snap +20 -10
- package/v2Containers/CreativesContainer/tests/embeddedSlideboxUtils.test.js +258 -0
- package/v2Containers/CreativesContainer/tests/index.test.js +71 -9
- package/v2Containers/CreativesContainer/tests/useLocalTemplatesProp.test.js +125 -0
- package/v2Containers/Rcs/constants.js +32 -1
- package/v2Containers/Rcs/index.js +950 -873
- package/v2Containers/Rcs/index.scss +85 -6
- package/v2Containers/Rcs/messages.js +10 -1
- package/v2Containers/Rcs/rcsLibraryHydrationUtils.js +205 -0
- package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +40834 -1963
- package/v2Containers/Rcs/tests/__snapshots__/utils.test.js.snap +0 -5
- package/v2Containers/Rcs/tests/index.test.js +41 -38
- package/v2Containers/Rcs/tests/mockData.js +38 -0
- package/v2Containers/Rcs/tests/rcsLibraryHydrationUtils.test.js +251 -0
- package/v2Containers/Rcs/tests/utils.test.js +379 -1
- package/v2Containers/Rcs/utils.js +358 -10
- package/v2Containers/Sms/Create/index.js +81 -36
- package/v2Containers/Sms/smsFormDataHelpers.js +67 -0
- package/v2Containers/Sms/tests/smsFormDataHelpers.test.js +253 -0
- package/v2Containers/SmsTrai/Create/index.js +9 -4
- package/v2Containers/SmsTrai/Edit/constants.js +2 -0
- package/v2Containers/SmsTrai/Edit/index.js +609 -128
- package/v2Containers/SmsTrai/Edit/index.scss +121 -0
- package/v2Containers/SmsTrai/Edit/messages.js +9 -4
- package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +4327 -2374
- package/v2Containers/SmsWrapper/index.js +37 -8
- package/v2Containers/TagList/index.js +6 -0
- package/v2Containers/Templates/TemplatesActionBar.js +101 -0
- package/v2Containers/Templates/_templates.scss +61 -2
- package/v2Containers/Templates/actions.js +11 -0
- package/v2Containers/Templates/constants.js +2 -0
- package/v2Containers/Templates/index.js +90 -40
- package/v2Containers/Templates/sagas.js +57 -12
- package/v2Containers/Templates/tests/TemplatesActionBar.test.js +120 -0
- package/v2Containers/Templates/tests/__snapshots__/index.test.js.snap +1043 -1079
- package/v2Containers/Templates/tests/sagas.test.js +193 -12
- package/v2Containers/Templates/tests/smsTemplatesListApi.test.js +180 -0
- package/v2Containers/Templates/utils/smsTemplatesListApi.js +79 -0
- package/v2Containers/TemplatesV2/TemplatesV2.style.js +72 -1
- package/v2Containers/TemplatesV2/index.js +86 -23
- package/v2Containers/TemplatesV2/tests/TemplatesV2.localTemplates.test.js +131 -0
- package/v2Containers/Whatsapp/index.js +3 -20
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +578 -34
|
@@ -16,6 +16,7 @@ import { isTraiDLTEnable } from '../../utils/common';
|
|
|
16
16
|
import { formatString } from '../../utils/Formatter';
|
|
17
17
|
import {
|
|
18
18
|
CAP_SPACE_12,
|
|
19
|
+
CAP_SPACE_16,
|
|
19
20
|
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
20
21
|
import { WHATSAPP_HELP_DOC_LINK, JOURNEY } from './constants';
|
|
21
22
|
|
|
@@ -24,7 +25,7 @@ const StyledLabel = styled(CapLabelInline)`
|
|
|
24
25
|
margin-right: ${CAP_SPACE_12};
|
|
25
26
|
`;
|
|
26
27
|
const PrefixWrapper = styled.div`
|
|
27
|
-
margin-right:
|
|
28
|
+
margin-right: ${CAP_SPACE_16};
|
|
28
29
|
`;
|
|
29
30
|
const renderData = (type, value, channel) => (
|
|
30
31
|
<StyledLabel className={channel?.toLowerCase() === ZALO ? 'zalo-template-name-spacing' : ''} type={type}>
|
|
@@ -33,7 +34,25 @@ const renderData = (type, value, channel) => (
|
|
|
33
34
|
);
|
|
34
35
|
|
|
35
36
|
export function SlideBoxHeader(props) {
|
|
36
|
-
const {
|
|
37
|
+
const {
|
|
38
|
+
slidBoxContent,
|
|
39
|
+
templateData,
|
|
40
|
+
onShowTemplates,
|
|
41
|
+
creativesMode,
|
|
42
|
+
isFullMode,
|
|
43
|
+
showPrefix,
|
|
44
|
+
shouldShowTemplateName,
|
|
45
|
+
channel,
|
|
46
|
+
templateNameRenderProp,
|
|
47
|
+
weChatTemplateType,
|
|
48
|
+
onWeChatMaptemplateStepChange,
|
|
49
|
+
weChatMaptemplateStep,
|
|
50
|
+
templateStep,
|
|
51
|
+
smsRegister,
|
|
52
|
+
handleClose,
|
|
53
|
+
moduleType,
|
|
54
|
+
useLocalTemplates = false,
|
|
55
|
+
} = props;
|
|
37
56
|
const showTemplateNameHeader = isFullMode && shouldShowTemplateName;
|
|
38
57
|
const mapTemplateCreate = !showTemplateNameHeader && slidBoxContent === 'createTemplate' && weChatTemplateType === MAP_TEMPLATE && templateStep !== 'modeSelection';
|
|
39
58
|
const isTraiDlt = isTraiDLTEnable(isFullMode, smsRegister);
|
|
@@ -81,6 +100,9 @@ export function SlideBoxHeader(props) {
|
|
|
81
100
|
window.open(WHATSAPP_HELP_DOC_LINK, '_blank');
|
|
82
101
|
};
|
|
83
102
|
|
|
103
|
+
const showCreativesTemplatesBackButton =
|
|
104
|
+
!isFullMode && (moduleType === JOURNEY || useLocalTemplates);
|
|
105
|
+
|
|
84
106
|
return (
|
|
85
107
|
<div key="creatives-container-slidebox-header-content">
|
|
86
108
|
{slidBoxContent === 'templates' && !showTemplateNameHeader && (
|
|
@@ -89,7 +111,7 @@ export function SlideBoxHeader(props) {
|
|
|
89
111
|
description={![NO_COMMUNICATION, FTP].includes(channel) &&
|
|
90
112
|
<FormattedMessage {...messages.creativeTemplatesDesc} />
|
|
91
113
|
}
|
|
92
|
-
prefix={
|
|
114
|
+
prefix={showCreativesTemplatesBackButton &&
|
|
93
115
|
<PrefixWrapper>
|
|
94
116
|
<CapIcons.backIcon onClick={handleClose} />
|
|
95
117
|
</PrefixWrapper>
|
|
@@ -135,7 +157,7 @@ export function SlideBoxHeader(props) {
|
|
|
135
157
|
}
|
|
136
158
|
</>
|
|
137
159
|
}
|
|
138
|
-
prefix={
|
|
160
|
+
prefix={!isFullMode && showPrefix &&
|
|
139
161
|
<PrefixWrapper>
|
|
140
162
|
<CapIcons.backIcon onClick={onShowTemplates} />
|
|
141
163
|
</PrefixWrapper>
|
|
@@ -191,5 +213,8 @@ SlideBoxHeader.propTypes = {
|
|
|
191
213
|
shouldShowTemplateName: PropTypes.bool,
|
|
192
214
|
templateNameRenderProp: PropTypes.func,
|
|
193
215
|
smsRegister: PropTypes.any,
|
|
216
|
+
handleClose: PropTypes.func,
|
|
217
|
+
moduleType: PropTypes.string,
|
|
218
|
+
useLocalTemplates: PropTypes.bool,
|
|
194
219
|
};
|
|
195
220
|
export default SlideBoxHeader;
|
|
@@ -11,6 +11,7 @@ export const EBILL = "EBILL";
|
|
|
11
11
|
export const LINE = "LINE";
|
|
12
12
|
export const CALL_TASK = "CALL_TASK";
|
|
13
13
|
export const MOBILE_PUSH = "MOBILEPUSH";
|
|
14
|
+
export const MPUSH = "MPUSH";
|
|
14
15
|
export const WECHAT = "WECHAT";
|
|
15
16
|
export const FACEBOOK = "FACEBOOK";
|
|
16
17
|
export const FTP = "FTP";
|
|
@@ -57,6 +58,8 @@ export const COMMON_CHANNELS = ['sms', 'email', 'wechat', 'mobilepush', 'webpush
|
|
|
57
58
|
export const NORMALIZED_CHANNEL_ALIASES = {
|
|
58
59
|
we_chat: WECHAT.toLowerCase(),
|
|
59
60
|
m_push: MOBILE_PUSH.toLowerCase(),
|
|
61
|
+
// paneKey `inApp` → `in_app`; TemplatesV2 pane uses key INAPP → `inapp` — both must match for channelsToHide
|
|
62
|
+
in_app: INAPP.toLowerCase(),
|
|
60
63
|
};
|
|
61
64
|
export const MIXED = "MIXED";
|
|
62
65
|
export const VISITOR = "VISITOR";
|
|
@@ -64,3 +67,12 @@ export const ALLOWED_CHANNELS_FOR_ANONYMOUS = ['mobilepush', 'webpush'];
|
|
|
64
67
|
export const ALL_CHANNELS_NEW = [
|
|
65
68
|
'sms', 'email', 'whatsapp', 'facebook', 'line', 'viber', 'rcs', 'zalo', 'inapp', 'call_task', 'ftp',
|
|
66
69
|
];
|
|
70
|
+
|
|
71
|
+
export const LOCAL_TEMPLATE_CONFIG_KEYS = ['useLocalTemplates', 'localTemplates', 'localTemplatesLoading', 'localTemplatesFilterContent', 'localTemplatesUseSkeleton', 'localTemplatesOnPageChange'];
|
|
72
|
+
|
|
73
|
+
/** Keys passed from parents into `Templates` when using local SMS template list (extends `LOCAL_TEMPLATE_CONFIG_KEYS`). */
|
|
74
|
+
export const LOCAL_TEMPLATE_CONFIG_KEYS_FOR_PICK = [
|
|
75
|
+
...LOCAL_TEMPLATE_CONFIG_KEYS,
|
|
76
|
+
'localTemplatesLoadingTip',
|
|
77
|
+
'localTemplatesFooterContent',
|
|
78
|
+
];
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared logic for CreativesContainer slidebox + embedded flows (e.g. RCS SMS fallback)
|
|
3
|
+
* that mirror the same footer liquid errors and layout margins.
|
|
4
|
+
*/
|
|
5
|
+
import get from 'lodash/get';
|
|
6
|
+
import {
|
|
7
|
+
CAP_SPACE_32,
|
|
8
|
+
CAP_SPACE_56,
|
|
9
|
+
CAP_SPACE_64,
|
|
10
|
+
} from '@capillarytech/cap-ui-library/styled/variables';
|
|
11
|
+
import * as constants from './constants';
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* Returns true if value is "deep empty": no errors present.
|
|
15
|
+
* Same rules as CreativesContainer (used for liquid / standard error payloads).
|
|
16
|
+
*/
|
|
17
|
+
export function isDeepEmpty(value) {
|
|
18
|
+
if (value == null) return true;
|
|
19
|
+
if (typeof value === 'string') return value.length === 0;
|
|
20
|
+
if (Array.isArray(value)) return value.length === 0;
|
|
21
|
+
if (typeof value === 'object') {
|
|
22
|
+
return Object.values(value).every(isDeepEmpty);
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Header/content margin below slidebox chrome when ErrorInfoNote stacks errors — same formula as CreativesContainer#render.
|
|
29
|
+
*/
|
|
30
|
+
export function getSlideBoxWrapperMarginFromLiquidErrors(liquidErrorMessage) {
|
|
31
|
+
return (get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0
|
|
32
|
+
&& get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0)
|
|
33
|
+
? CAP_SPACE_64
|
|
34
|
+
: get(liquidErrorMessage, 'LIQUID_ERROR_MSG.length', 0) > 0
|
|
35
|
+
? CAP_SPACE_56
|
|
36
|
+
: get(liquidErrorMessage, 'STANDARD_ERROR_MSG.length', 0) > 0
|
|
37
|
+
? CAP_SPACE_32
|
|
38
|
+
: 0;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* Maps FormBuilder `showLiquidErrorInFooter` args to slidebox footer state.
|
|
43
|
+
* Returns `null` when CreativesContainer intentionally skips updating (Mobile Push OLD empty clear).
|
|
44
|
+
*/
|
|
45
|
+
export function computeLiquidFooterUpdateFromFormBuilder(
|
|
46
|
+
errorMessagesFromFormBuilder,
|
|
47
|
+
currentFormBuilderTab,
|
|
48
|
+
{ previousIsLiquidValidationError, currentChannelUpper } = {},
|
|
49
|
+
) {
|
|
50
|
+
const liquidMsgs = get(errorMessagesFromFormBuilder, constants.LIQUID_ERROR_MSG, []);
|
|
51
|
+
const standardMsgs = get(errorMessagesFromFormBuilder, constants.STANDARD_ERROR_MSG, []);
|
|
52
|
+
const hasLiquid = !isDeepEmpty(liquidMsgs);
|
|
53
|
+
const hasStandard = !isDeepEmpty(standardMsgs);
|
|
54
|
+
const isLiquidValidationError = hasLiquid || hasStandard;
|
|
55
|
+
const isMobilePush = currentChannelUpper === constants.MOBILE_PUSH;
|
|
56
|
+
if (!hasLiquid && !hasStandard && previousIsLiquidValidationError && isMobilePush) {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return {
|
|
60
|
+
isLiquidValidationError,
|
|
61
|
+
liquidErrorMessage: errorMessagesFromFormBuilder,
|
|
62
|
+
activeFormBuilderTab:
|
|
63
|
+
currentFormBuilderTab === 1
|
|
64
|
+
? constants.ANDROID
|
|
65
|
+
: (currentFormBuilderTab === 2 ? constants.IOS : null),
|
|
66
|
+
};
|
|
67
|
+
}
|