@capillarytech/creatives-library 9.0.13 → 9.0.14
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/package.json +1 -1
- package/services/api.js +10 -0
- package/services/tests/api.test.js +83 -0
- package/v2Components/CommonTestAndPreview/UnifiedPreview/WhatsAppPreviewContent.js +5 -3
- package/v2Components/CommonTestAndPreview/index.js +7 -0
- package/v2Components/NavigationBar/index.js +27 -0
- package/v2Components/NavigationBar/messages.js +4 -0
- package/v2Components/NavigationBar/tests/index.test.js +19 -0
- package/v2Components/NewCallTask/index.js +6 -1
- package/v2Components/TemplatePreview/index.js +4 -2
- package/v2Containers/Cap/index.js +3 -1
- package/v2Containers/CommunicationFlow/CommunicationFlow.js +130 -20
- package/v2Containers/CommunicationFlow/CommunicationFlow.scss +154 -0
- package/v2Containers/CommunicationFlow/CommunicationFlowCard.js +240 -0
- package/v2Containers/CommunicationFlow/DemoPage.js +47 -0
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlow.test.js +369 -2
- package/v2Containers/CommunicationFlow/Tests/CommunicationFlowCard.test.js +619 -0
- package/v2Containers/CommunicationFlow/Tests/DemoPage.test.js +77 -0
- package/v2Containers/CommunicationFlow/Tests/getContentBody.test.js +933 -0
- package/v2Containers/CommunicationFlow/constants.js +45 -10
- package/v2Containers/CommunicationFlow/index.js +5 -2
- package/v2Containers/CommunicationFlow/messages.js +20 -0
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.js +94 -31
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/ChannelSelectionStep.scss +14 -11
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/Tests/ChannelSelectionStep.test.js +1144 -32
- package/v2Containers/CommunicationFlow/steps/ChannelSelectionStep/extractContentForPreview.js +183 -0
- package/v2Containers/CommunicationFlow/steps/CommunicationStrategyStep/CommunicationStrategyStep.js +3 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/DeliverySettingsSection.js +39 -0
- package/v2Containers/CommunicationFlow/steps/DeliverySettingsStep/Tests/DeliverySettingsSection.test.js +6 -2
- package/v2Containers/CommunicationFlow/utils/getContentBody.js +369 -0
- package/v2Containers/CommunicationFlow/utils/getContentBody.scss +19 -0
- package/v2Containers/CommunicationFlow/utils/getEnabledSteps.js +1 -1
- package/v2Containers/CreativesContainer/constants.js +6 -0
- package/v2Containers/CreativesContainer/index.js +68 -1
- package/v2Containers/CreativesContainer/tests/__snapshots__/SlideBoxContent.test.js.snap +2 -2
- package/v2Containers/Templates/index.js +2 -2
- package/v2Containers/TemplatesV2/index.js +9 -1
- package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +41 -34
|
@@ -10,6 +10,123 @@
|
|
|
10
10
|
}
|
|
11
11
|
}
|
|
12
12
|
|
|
13
|
+
// Mobilepush preview styles for CommunicationFlowCard (CapCard context, no .MOBILEPUSH wrapper)
|
|
14
|
+
.communication-flow-summary-card {
|
|
15
|
+
border-color: $CAP_G12;
|
|
16
|
+
width: 40rem;
|
|
17
|
+
|
|
18
|
+
.summary-card-title-row {
|
|
19
|
+
gap: 0.25rem;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
.card-body-row {
|
|
23
|
+
height: 10.125rem;
|
|
24
|
+
display: flex;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.card-body-left-col {
|
|
28
|
+
padding: 1rem;
|
|
29
|
+
border-right: 0.0625rem solid $CAP_G12;
|
|
30
|
+
height: 100%;
|
|
31
|
+
overflow: auto;
|
|
32
|
+
|
|
33
|
+
.channel-header-row {
|
|
34
|
+
gap: 0.5rem;
|
|
35
|
+
margin-bottom: 0.5rem;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.card-body-right-col {
|
|
40
|
+
padding: 1rem;
|
|
41
|
+
height: 100%;
|
|
42
|
+
overflow: auto;
|
|
43
|
+
|
|
44
|
+
.control-row {
|
|
45
|
+
margin-top: 0.5rem;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.mobilepush-container {
|
|
50
|
+
background-color: $CAP_WHITE;
|
|
51
|
+
padding: $CAP_SPACE_12;
|
|
52
|
+
.app-header {
|
|
53
|
+
color: #5D5D5D;
|
|
54
|
+
font-weight: 600;
|
|
55
|
+
padding: 0.285rem 0.571rem;
|
|
56
|
+
display: flex;
|
|
57
|
+
align-items: center;
|
|
58
|
+
justify-content: space-between;
|
|
59
|
+
.app-header-left {
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
div {
|
|
63
|
+
overflow-wrap: break-word;
|
|
64
|
+
}
|
|
65
|
+
.app-icon {
|
|
66
|
+
width: 0.857rem;
|
|
67
|
+
height: 0.857rem;
|
|
68
|
+
border-radius: 50%;
|
|
69
|
+
background-color: #737070;
|
|
70
|
+
margin-right: $CAP_SPACE_06;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
.mobilepush-message {
|
|
75
|
+
padding-left: 1.65rem;
|
|
76
|
+
}
|
|
77
|
+
.mobilepush-image {
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 7.5rem;
|
|
80
|
+
margin-top: 0.625rem;
|
|
81
|
+
}
|
|
82
|
+
.mobilepush-image-padding {
|
|
83
|
+
padding-left: 1.65rem;
|
|
84
|
+
}
|
|
85
|
+
.scroll-container {
|
|
86
|
+
overflow-x: auto;
|
|
87
|
+
display: flex;
|
|
88
|
+
padding-top: $CAP_SPACE_06;
|
|
89
|
+
padding-right: $CAP_SPACE_06;
|
|
90
|
+
white-space: nowrap;
|
|
91
|
+
scrollbar-width: none;
|
|
92
|
+
&::-webkit-scrollbar {
|
|
93
|
+
display: none;
|
|
94
|
+
}
|
|
95
|
+
height: 100%;
|
|
96
|
+
width: 100%;
|
|
97
|
+
margin-left: 1.65rem;
|
|
98
|
+
.whatsapp-carousel-container {
|
|
99
|
+
padding: $CAP_SPACE_04 0 $CAP_SPACE_08;
|
|
100
|
+
border-radius: $CAP_SPACE_06;
|
|
101
|
+
background-color: $CAP_WHITE;
|
|
102
|
+
width: 80%;
|
|
103
|
+
flex-shrink: 0;
|
|
104
|
+
white-space: pre-wrap;
|
|
105
|
+
overflow-wrap: break-word;
|
|
106
|
+
.whatsapp-carousel-card {
|
|
107
|
+
margin: $CAP_SPACE_02;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
.actions {
|
|
112
|
+
background-color: $CAP_WHITE;
|
|
113
|
+
height: auto;
|
|
114
|
+
padding: $CAP_SPACE_08;
|
|
115
|
+
text-align: center;
|
|
116
|
+
display: flex;
|
|
117
|
+
flex-direction: column;
|
|
118
|
+
align-items: center;
|
|
119
|
+
justify-content: center;
|
|
120
|
+
gap: $CAP_SPACE_08;
|
|
121
|
+
.action {
|
|
122
|
+
font-weight: 600;
|
|
123
|
+
color: #1970DA;
|
|
124
|
+
height: 1.25rem;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
13
130
|
.communication-flow-container {
|
|
14
131
|
.step-divider {
|
|
15
132
|
margin: $CAP_SPACE_32 0;
|
|
@@ -23,3 +140,40 @@
|
|
|
23
140
|
padding: $CAP_SPACE_16 0 $CAP_SPACE_08;
|
|
24
141
|
}
|
|
25
142
|
}
|
|
143
|
+
|
|
144
|
+
.communication-flow-card-empty {
|
|
145
|
+
width: 30rem;
|
|
146
|
+
border-color: $CAP_G12;
|
|
147
|
+
|
|
148
|
+
.empty-card-body-row {
|
|
149
|
+
height: 100%;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
.empty-card-illustration-col {
|
|
153
|
+
display: flex;
|
|
154
|
+
align-items: center;
|
|
155
|
+
justify-content: center;
|
|
156
|
+
height: 100%;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
.empty-card-action-col {
|
|
160
|
+
padding: 1.5rem 1rem;
|
|
161
|
+
height: 100%;
|
|
162
|
+
display: flex;
|
|
163
|
+
align-items: center;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
.slide-box-wrapper {
|
|
168
|
+
.cap-slide-box-v2-container {
|
|
169
|
+
.slidebox-header,
|
|
170
|
+
.slidebox-content-container,
|
|
171
|
+
.slidebox-footer {
|
|
172
|
+
margin-bottom: 0;
|
|
173
|
+
padding: 0;
|
|
174
|
+
&.has-footer {
|
|
175
|
+
overflow-x: hidden;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CommunicationFlowCard
|
|
3
|
+
*
|
|
4
|
+
* Card-based entry point for CommunicationFlow.
|
|
5
|
+
* - Empty state: shows an "Add" button that opens CommunicationFlow in a CapSlideBox (create mode)
|
|
6
|
+
* - Configured state: shows a two-column CapCard with pen icon, channel preview (left), dynamic controls (right)
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import React, { useState, useCallback } from 'react';
|
|
10
|
+
import PropTypes from 'prop-types';
|
|
11
|
+
import { injectIntl } from 'react-intl';
|
|
12
|
+
import { CAP_G09 } from '@capillarytech/cap-ui-library/styled/variables';
|
|
13
|
+
import CapButton from '@capillarytech/cap-ui-library/CapButton';
|
|
14
|
+
import CapCard from '@capillarytech/cap-ui-library/CapCard';
|
|
15
|
+
import CapColumn from '@capillarytech/cap-ui-library/CapColumn';
|
|
16
|
+
import CapImage from '@capillarytech/cap-ui-library/CapImage';
|
|
17
|
+
import CapRow from '@capillarytech/cap-ui-library/CapRow';
|
|
18
|
+
import CapIcon from '@capillarytech/cap-ui-library/CapIcon';
|
|
19
|
+
import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
|
|
20
|
+
import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
|
|
21
|
+
import CapSlideBox from '@capillarytech/cap-ui-library/CapSlideBox';
|
|
22
|
+
import CommunicationFlow from './index';
|
|
23
|
+
import { CHANNELS, DEFAULT_COMMUNICATION_STRATEGY_OPTIONS, DYNAMIC_CONTROLS_CONFIG } from './constants';
|
|
24
|
+
import {
|
|
25
|
+
VIBER, SMS, EMAIL, WHATSAPP, RCS, ZALO,
|
|
26
|
+
} from '../CreativesContainer/constants';
|
|
27
|
+
import getContentBody from './utils/getContentBody';
|
|
28
|
+
import messages from './messages';
|
|
29
|
+
import addCreativesIllustration from '../Assets/images/addCreativesIllustration.svg';
|
|
30
|
+
import './CommunicationFlow.scss';
|
|
31
|
+
|
|
32
|
+
const resolveValue = (val) => {
|
|
33
|
+
if (val == null || val === '') return null;
|
|
34
|
+
if (Array.isArray(val)) return resolveValue(val[0]);
|
|
35
|
+
if (typeof val === 'object') {
|
|
36
|
+
const inner = val.value ?? val.label;
|
|
37
|
+
return inner != null ? resolveValue(inner) : null;
|
|
38
|
+
}
|
|
39
|
+
return String(val) || null;
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
const SENDER_ID_RESOLVERS = {
|
|
43
|
+
[SMS]: (setting) => resolveValue(setting?.gsmSenderId),
|
|
44
|
+
[EMAIL]: (setting) => resolveValue(setting?.senderEmail),
|
|
45
|
+
[VIBER]: (setting) => resolveValue(setting?.sender) || resolveValue(setting?.gsmSenderId),
|
|
46
|
+
[WHATSAPP]: (setting) => resolveValue(setting?.senderMobNum),
|
|
47
|
+
[RCS]: (setting) => resolveValue(setting?.senderMobNum) || resolveValue(setting?.rcsSender),
|
|
48
|
+
[ZALO]: (setting) => resolveValue(setting?.zaloSenderId),
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
const getSenderIdValue = (item, savedData) => {
|
|
52
|
+
const channel = item?.channel?.toUpperCase();
|
|
53
|
+
const channelSetting = savedData?.deliverySetting?.channelSetting?.[channel] || {};
|
|
54
|
+
return SENDER_ID_RESOLVERS[channel]?.(channelSetting) ?? null;
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const getStrategyLabel = (config, strategyValue) => {
|
|
58
|
+
const options = config?.features?.communicationStrategyData?.options || DEFAULT_COMMUNICATION_STRATEGY_OPTIONS;
|
|
59
|
+
const match = options.find((option) => option.value === strategyValue);
|
|
60
|
+
return match?.label || strategyValue || '';
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
const getMessageTypeLabel = (config, messageTypeValue) => {
|
|
64
|
+
const options = config?.features?.messageTypeData?.options || [];
|
|
65
|
+
const match = options.find((option) => option.value === messageTypeValue);
|
|
66
|
+
return match?.label || messageTypeValue || null;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
const CommunicationFlowCard = ({
|
|
70
|
+
config,
|
|
71
|
+
initialData,
|
|
72
|
+
onSave,
|
|
73
|
+
onCancel,
|
|
74
|
+
onChange,
|
|
75
|
+
cap,
|
|
76
|
+
intl,
|
|
77
|
+
}) => {
|
|
78
|
+
const { formatMessage } = intl || {};
|
|
79
|
+
const [showSlideBox, setShowSlideBox] = useState(false);
|
|
80
|
+
const [savedData, setSavedData] = useState(initialData || null);
|
|
81
|
+
|
|
82
|
+
const handleSave = useCallback((data) => {
|
|
83
|
+
setSavedData(data);
|
|
84
|
+
setShowSlideBox(false);
|
|
85
|
+
onSave?.(data);
|
|
86
|
+
}, [onSave]);
|
|
87
|
+
|
|
88
|
+
const handleClose = useCallback(() => {
|
|
89
|
+
setShowSlideBox(false);
|
|
90
|
+
onCancel?.();
|
|
91
|
+
}, [onCancel]);
|
|
92
|
+
|
|
93
|
+
const handleOpen = useCallback(() => {
|
|
94
|
+
setShowSlideBox(true);
|
|
95
|
+
}, []);
|
|
96
|
+
|
|
97
|
+
const firstItem = savedData?.contentItems?.[0];
|
|
98
|
+
const channelConfig = firstItem
|
|
99
|
+
? CHANNELS.find((c) => c.value === firstItem.channel || c.channelProp === firstItem.channel?.toLowerCase())
|
|
100
|
+
: null;
|
|
101
|
+
|
|
102
|
+
const renderSummaryCard = () => {
|
|
103
|
+
if (!firstItem) return null;
|
|
104
|
+
|
|
105
|
+
const strategyLabel = getStrategyLabel(config, savedData?.communicationStrategy);
|
|
106
|
+
const messageTypeLabel = getMessageTypeLabel(config, savedData?.messageType);
|
|
107
|
+
const senderIdValue = getSenderIdValue(firstItem, savedData);
|
|
108
|
+
const controls = config?.features?.dynamicControlsData?.controls || DYNAMIC_CONTROLS_CONFIG;
|
|
109
|
+
const dynamicControlKeys = Object.keys(savedData?.dynamicControls || {});
|
|
110
|
+
const channel = firstItem.channel?.toUpperCase();
|
|
111
|
+
const senderLabel = [WHATSAPP, RCS].includes(channel)
|
|
112
|
+
? formatMessage(messages.senderNumberLabel)
|
|
113
|
+
: formatMessage(messages.senderIdLabel);
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<CapCard
|
|
117
|
+
className="communication-flow-summary-card"
|
|
118
|
+
title={(
|
|
119
|
+
<CapRow type="flex" align="middle" className="summary-card-title-row">
|
|
120
|
+
<CapLabel type="label8">Message:</CapLabel>
|
|
121
|
+
<CapLabel type="label2">{strategyLabel}</CapLabel>
|
|
122
|
+
{messageTypeLabel && (
|
|
123
|
+
<CapLabel type="label1">({messageTypeLabel})</CapLabel>
|
|
124
|
+
)}
|
|
125
|
+
</CapRow>
|
|
126
|
+
)}
|
|
127
|
+
extra={(
|
|
128
|
+
<CapIcon
|
|
129
|
+
type="edit"
|
|
130
|
+
onClick={handleOpen}
|
|
131
|
+
style={{ cursor: 'pointer' }}
|
|
132
|
+
/>
|
|
133
|
+
)}
|
|
134
|
+
headStyle={{ background: CAP_G09, width: '100%' }}
|
|
135
|
+
bodyStyle={{ padding: 0 }}
|
|
136
|
+
>
|
|
137
|
+
<CapRow gutter={0} className="card-body-row">
|
|
138
|
+
<CapColumn span={12} className="card-body-left-col">
|
|
139
|
+
<CapRow type="flex" align="middle" className="channel-header-row">
|
|
140
|
+
<CapIcon type={channelConfig?.iconType || 'sms'} size="s" />
|
|
141
|
+
<CapLabel type="label8">{channelConfig?.label || firstItem.channel}</CapLabel>
|
|
142
|
+
{senderIdValue && (
|
|
143
|
+
<CapLabel type="label1">({senderLabel}: {senderIdValue})</CapLabel>
|
|
144
|
+
)}
|
|
145
|
+
</CapRow>
|
|
146
|
+
{getContentBody(firstItem)}
|
|
147
|
+
</CapColumn>
|
|
148
|
+
<CapColumn span={12} className="card-body-right-col">
|
|
149
|
+
<CapLabel type="label8">{formatMessage(messages.dynamicControlsTitle)}</CapLabel>
|
|
150
|
+
{dynamicControlKeys.map((key) => {
|
|
151
|
+
const controlConfig = controls.find((c) => c.key === key);
|
|
152
|
+
if (!controlConfig) return null;
|
|
153
|
+
return (
|
|
154
|
+
<CapRow key={key} type="flex" justify="space-between" className="control-row">
|
|
155
|
+
<CapLabel type="label2">{controlConfig.label}</CapLabel>
|
|
156
|
+
<CapLabel type="label2">
|
|
157
|
+
{savedData.dynamicControls[key]
|
|
158
|
+
? formatMessage(messages.yes)
|
|
159
|
+
: formatMessage(messages.no)}
|
|
160
|
+
</CapLabel>
|
|
161
|
+
</CapRow>
|
|
162
|
+
);
|
|
163
|
+
})}
|
|
164
|
+
</CapColumn>
|
|
165
|
+
</CapRow>
|
|
166
|
+
</CapCard>
|
|
167
|
+
);
|
|
168
|
+
};
|
|
169
|
+
|
|
170
|
+
const flowMode = savedData ? 'edit' : 'create';
|
|
171
|
+
const flowConfig = { ...config, mode: flowMode };
|
|
172
|
+
|
|
173
|
+
return (
|
|
174
|
+
<>
|
|
175
|
+
{!firstItem ? (
|
|
176
|
+
<CapCard
|
|
177
|
+
className="communication-flow-card-empty"
|
|
178
|
+
bodyStyle={{ padding: 0, height: 152 }}
|
|
179
|
+
>
|
|
180
|
+
<CapRow type="flex" align="middle" gutter={0} className="empty-card-body-row">
|
|
181
|
+
<CapColumn span={10} className="empty-card-illustration-col">
|
|
182
|
+
<CapImage src={addCreativesIllustration} />
|
|
183
|
+
</CapColumn>
|
|
184
|
+
<CapColumn span={14} className="empty-card-action-col">
|
|
185
|
+
<CapButton type="secondary" onClick={handleOpen}>
|
|
186
|
+
{formatMessage(messages.addCreatives)}
|
|
187
|
+
</CapButton>
|
|
188
|
+
</CapColumn>
|
|
189
|
+
</CapRow>
|
|
190
|
+
</CapCard>
|
|
191
|
+
) : (
|
|
192
|
+
renderSummaryCard()
|
|
193
|
+
)}
|
|
194
|
+
|
|
195
|
+
<CapRow className="slide-box-wrapper">
|
|
196
|
+
<CapSlideBox
|
|
197
|
+
show={showSlideBox}
|
|
198
|
+
handleClose={handleClose}
|
|
199
|
+
size="size-xl"
|
|
200
|
+
header={(
|
|
201
|
+
<CapHeader
|
|
202
|
+
title={formatMessage(messages.addMessage)}
|
|
203
|
+
handleClose={handleClose}
|
|
204
|
+
/>
|
|
205
|
+
)}
|
|
206
|
+
content={(
|
|
207
|
+
<CommunicationFlow
|
|
208
|
+
config={flowConfig}
|
|
209
|
+
initialData={savedData}
|
|
210
|
+
onSave={handleSave}
|
|
211
|
+
onCancel={handleClose}
|
|
212
|
+
onChange={onChange}
|
|
213
|
+
cap={cap}
|
|
214
|
+
/>
|
|
215
|
+
)}
|
|
216
|
+
/>
|
|
217
|
+
</CapRow>
|
|
218
|
+
</>
|
|
219
|
+
);
|
|
220
|
+
};
|
|
221
|
+
|
|
222
|
+
CommunicationFlowCard.propTypes = {
|
|
223
|
+
config: PropTypes.object.isRequired,
|
|
224
|
+
initialData: PropTypes.object,
|
|
225
|
+
onSave: PropTypes.func,
|
|
226
|
+
onCancel: PropTypes.func,
|
|
227
|
+
onChange: PropTypes.func,
|
|
228
|
+
cap: PropTypes.object,
|
|
229
|
+
intl: PropTypes.object.isRequired,
|
|
230
|
+
};
|
|
231
|
+
|
|
232
|
+
CommunicationFlowCard.defaultProps = {
|
|
233
|
+
initialData: null,
|
|
234
|
+
onSave: null,
|
|
235
|
+
onCancel: null,
|
|
236
|
+
onChange: null,
|
|
237
|
+
cap: null,
|
|
238
|
+
};
|
|
239
|
+
|
|
240
|
+
export default injectIntl(CommunicationFlowCard);
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CommunicationFlowCard } from './index';
|
|
3
|
+
|
|
4
|
+
const CommunicationFlowDemoPage = () => {
|
|
5
|
+
const config = {
|
|
6
|
+
consumer: 'PROGRAM',
|
|
7
|
+
mode: 'create',
|
|
8
|
+
useCCS: true,
|
|
9
|
+
features: {
|
|
10
|
+
messageTypeData: {
|
|
11
|
+
required: false,
|
|
12
|
+
},
|
|
13
|
+
communicationStrategyData: {
|
|
14
|
+
required: true,
|
|
15
|
+
disabled: false,
|
|
16
|
+
},
|
|
17
|
+
contentTemplateData: {
|
|
18
|
+
required: true,
|
|
19
|
+
channelsToHide: [],
|
|
20
|
+
channelsToDisable: [],
|
|
21
|
+
},
|
|
22
|
+
incentivesData: {
|
|
23
|
+
required: false,
|
|
24
|
+
},
|
|
25
|
+
deliverySettingsData: {
|
|
26
|
+
required: false,
|
|
27
|
+
deliverySettings: [{}],
|
|
28
|
+
},
|
|
29
|
+
showDynamicControls: true,
|
|
30
|
+
},
|
|
31
|
+
context: {
|
|
32
|
+
orgUnitId: '1231',
|
|
33
|
+
campaignId: '456789',
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const handleSave = (data) => {
|
|
38
|
+
// eslint-disable-next-line no-console
|
|
39
|
+
console.log('Save called with data:', data);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<CommunicationFlowCard config={config} onSave={handleSave} />
|
|
44
|
+
);
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export default CommunicationFlowDemoPage;
|