@capillarytech/creatives-library 8.0.295 → 8.0.296

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.
Files changed (39) hide show
  1. package/package.json +1 -1
  2. package/v2Components/CommonTestAndPreview/DeliverySettings/DeliverySettings.scss +33 -0
  3. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +425 -0
  4. package/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.scss +36 -0
  5. package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +92 -0
  6. package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +251 -0
  7. package/v2Components/CommonTestAndPreview/DeliverySettings/messages.js +111 -0
  8. package/v2Components/CommonTestAndPreview/DeliverySettings/utils/parseSenderDetailsResponse.js +88 -0
  9. package/v2Components/CommonTestAndPreview/SendTestMessage.js +51 -1
  10. package/v2Components/CommonTestAndPreview/actions.js +20 -0
  11. package/v2Components/CommonTestAndPreview/constants.js +15 -0
  12. package/v2Components/CommonTestAndPreview/index.js +200 -16
  13. package/v2Components/CommonTestAndPreview/reducer.js +47 -0
  14. package/v2Components/CommonTestAndPreview/sagas.js +61 -0
  15. package/v2Components/CommonTestAndPreview/selectors.js +51 -0
  16. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/ModifyDeliverySettings.test.js +889 -0
  17. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +222 -0
  18. package/v2Components/CommonTestAndPreview/tests/DeliverySettings/utils/parseSenderDetailsResponse.test.js +235 -0
  19. package/v2Components/CommonTestAndPreview/tests/SendTestMessage.test.js +135 -0
  20. package/v2Components/CommonTestAndPreview/tests/actions.test.js +50 -0
  21. package/v2Components/CommonTestAndPreview/tests/constants.test.js +18 -0
  22. package/v2Components/CommonTestAndPreview/tests/index.test.js +783 -2
  23. package/v2Components/CommonTestAndPreview/tests/reducer.test.js +118 -0
  24. package/v2Components/CommonTestAndPreview/tests/sagas.test.js +145 -0
  25. package/v2Components/CommonTestAndPreview/tests/selectors.test.js +146 -0
  26. package/v2Components/FormBuilder/index.js +1 -1
  27. package/v2Components/HtmlEditor/HTMLEditor.js +0 -1
  28. package/v2Components/HtmlEditor/__tests__/HTMLEditor.test.js +0 -1
  29. package/v2Components/HtmlEditor/hooks/__tests__/useValidation.test.js +3 -132
  30. package/v2Components/HtmlEditor/hooks/useValidation.js +9 -12
  31. package/v2Components/HtmlEditor/utils/htmlValidator.js +2 -4
  32. package/v2Components/TestAndPreviewSlidebox/index.js +14 -0
  33. package/v2Containers/EmailWrapper/components/EmailHTMLEditor.js +2 -2
  34. package/v2Containers/EmailWrapper/components/__tests__/EmailHTMLEditor.test.js +18 -110
  35. package/v2Containers/Rcs/tests/__snapshots__/index.test.js.snap +697 -12
  36. package/v2Containers/SmsTrai/Edit/index.js +5 -1
  37. package/v2Containers/SmsTrai/Edit/tests/__snapshots__/index.test.js.snap +201 -0
  38. package/v2Containers/Whatsapp/index.js +1 -1
  39. package/v2Containers/Whatsapp/tests/__snapshots__/index.test.js.snap +26242 -4225
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@capillarytech/creatives-library",
3
3
  "author": "meharaj",
4
- "version": "8.0.295",
4
+ "version": "8.0.296",
5
5
  "description": "Capillary creatives ui",
6
6
  "main": "./index.js",
7
7
  "module": "./index.es.js",
@@ -0,0 +1,33 @@
1
+ /**
2
+ * DeliverySettings — summary row + edit icon for Test and Preview (SMS, Email, WhatsApp).
3
+ */
4
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
5
+
6
+ .delivery-settings {
7
+ &__heading-row {
8
+ margin-bottom: $CAP_SPACE_08;
9
+ }
10
+
11
+ &__summary-row {
12
+ margin-bottom: $CAP_SPACE_04;
13
+ }
14
+
15
+ &__summary-inner {
16
+ align-items: center;
17
+ margin-bottom: $CAP_SPACE_08;
18
+ }
19
+
20
+ &__summary-entry {
21
+ margin-right: $CAP_SPACE_18;
22
+ }
23
+
24
+ &__summary-key {
25
+ line-height: $CAP_SPACE_16;
26
+ }
27
+
28
+ &__edit-icon {
29
+ cursor: pointer;
30
+ position: absolute;
31
+ right: 0;
32
+ }
33
+ }
@@ -0,0 +1,425 @@
1
+ /**
2
+ * ModifyDeliverySettings — CapSlideBox content for Test and Preview delivery settings.
3
+ * Channel-specific dropdowns (SMS: domain + sender number; Email: domain + sender + reply-to; WhatsApp: account + sender number).
4
+ * Reference: cap-campaigns-v2 ModifyDeliverySettings + SenderDetails (field layout and options shape).
5
+ */
6
+
7
+ import React, {
8
+ useState, useCallback, useMemo, useEffect,
9
+ } from 'react';
10
+ import PropTypes from 'prop-types';
11
+ import CapRow from '@capillarytech/cap-ui-library/CapRow';
12
+ import CapHeader from '@capillarytech/cap-ui-library/CapHeader';
13
+ import CapSelect from '@capillarytech/cap-ui-library/CapSelect';
14
+ import CapButton from '@capillarytech/cap-ui-library/CapButton';
15
+ import CapSpin from '@capillarytech/cap-ui-library/CapSpin';
16
+ import CapLabel from '@capillarytech/cap-ui-library/CapLabel';
17
+ import { FormattedMessage } from 'react-intl';
18
+ import get from 'lodash/get';
19
+ import find from 'lodash/find';
20
+ import cloneDeep from 'lodash/cloneDeep';
21
+ import messages from './messages';
22
+ import {
23
+ CHANNELS,
24
+ DEFAULT_DELIVERY_SETTINGS_BY_CHANNEL,
25
+ NO_OPTIONS_LABEL,
26
+ HEADER_SIZE_LABEL,
27
+ BUTTON_TYPE_PRIMARY,
28
+ ROW_KEY_PREFIX,
29
+ DELIVERY_SETTING_KEY_DOMAIN_ID,
30
+ DELIVERY_SETTING_KEY_DOMAIN_GATEWAY_MAP_ID,
31
+ DELIVERY_SETTING_KEY_GSM_SENDER_ID,
32
+ DELIVERY_SETTING_KEY_CDMA_SENDER_ID,
33
+ DELIVERY_SETTING_KEY_SENDER_EMAIL,
34
+ DELIVERY_SETTING_KEY_SENDER_LABEL,
35
+ DELIVERY_SETTING_KEY_SENDER_REPLY_TO,
36
+ DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER,
37
+ DELIVERY_SETTING_KEY_SENDER_MOB_NUM,
38
+ } from './constants';
39
+ import './ModifyDeliverySettings.scss';
40
+
41
+ const findDefault = (array) => find(array, { default: true }) || (array && array[0]) || {};
42
+
43
+ const ModifyDeliverySettings = (props) => {
44
+ const {
45
+ channel,
46
+ deliverySettings: initialSettings = {},
47
+ senderDetailsOptions = [],
48
+ wecrmAccounts = [],
49
+ onSaveDeliverySettings,
50
+ onClose,
51
+ isLoading,
52
+ formatMessage,
53
+ smsTraiDltEnabled,
54
+ registeredSenderIds = [],
55
+ whatsappAccountFromForm,
56
+ } = props;
57
+
58
+ const defaultForChannel = DEFAULT_DELIVERY_SETTINGS_BY_CHANNEL[channel] || {};
59
+ const [localSettings, setLocalSettings] = useState(() => ({
60
+ ...defaultForChannel,
61
+ ...initialSettings,
62
+ }));
63
+
64
+ const isWhatsappAccountLocked = channel === CHANNELS.WHATSAPP && !!whatsappAccountFromForm?.accountName;
65
+
66
+ useEffect(() => {
67
+ if (!isWhatsappAccountLocked || !whatsappAccountFromForm?.accountName) return;
68
+ const accountByName = (wecrmAccounts || []).find(
69
+ (a) => (a.name || '') === whatsappAccountFromForm.accountName,
70
+ );
71
+ const sourceAccountId = accountByName?.sourceAccountIdentifier;
72
+ if (!sourceAccountId) return;
73
+ setLocalSettings((prev) => {
74
+ if (prev[DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER] === sourceAccountId) return prev;
75
+ const next = cloneDeep(prev);
76
+ next[DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER] = sourceAccountId;
77
+ const domain = (senderDetailsOptions || []).find(
78
+ (senderDetails) => senderDetails.sourceAccountIdentifier === sourceAccountId,
79
+ );
80
+ const first = domain?.gsmSenders?.[0];
81
+ if (first?.value != null) {
82
+ next[DELIVERY_SETTING_KEY_SENDER_MOB_NUM] = first.value;
83
+ }
84
+ return next;
85
+ });
86
+ }, [
87
+ isWhatsappAccountLocked,
88
+ whatsappAccountFromForm?.accountName,
89
+ wecrmAccounts,
90
+ senderDetailsOptions,
91
+ ]);
92
+
93
+ const noOptionsLabel = formatMessage
94
+ ? formatMessage(messages.noOptions)
95
+ : NO_OPTIONS_LABEL;
96
+
97
+ const allDomainOptions = useMemo(
98
+ () => (senderDetailsOptions || []).map((senderDetails) => ({
99
+ label: senderDetails.domainName || senderDetails.domainId,
100
+ value: senderDetails.domainId,
101
+ ...senderDetails,
102
+ })),
103
+ [senderDetailsOptions],
104
+ );
105
+
106
+ const domainOptions = useMemo(() => {
107
+ if (!(channel === CHANNELS.SMS && smsTraiDltEnabled)) {
108
+ return allDomainOptions;
109
+ }
110
+
111
+ return allDomainOptions.filter((domain) => (domain.gsmSenders || []).some(
112
+ (gsmId) => registeredSenderIds.includes(gsmId.value),
113
+ ));
114
+ }, [allDomainOptions, channel, registeredSenderIds, smsTraiDltEnabled]);
115
+
116
+ const selectedDomain = useMemo(
117
+ () => (senderDetailsOptions || []).find(
118
+ (d) => d.domainId === get(localSettings, DELIVERY_SETTING_KEY_DOMAIN_ID),
119
+ ) || {},
120
+ [senderDetailsOptions, localSettings.domainId],
121
+ );
122
+ const {
123
+ gsmSenders: selectedDomainGsmSenders = [],
124
+ emailSenders: selectedDomainEmailSenders = [],
125
+ emailRepliers: selectedDomainEmailRepliers = [],
126
+ } = selectedDomain;
127
+
128
+ const gsmOptions = useMemo(
129
+ () => {
130
+ const smsGsmSenders = channel === CHANNELS.SMS && smsTraiDltEnabled
131
+ ? selectedDomainGsmSenders.filter((gsmId) => registeredSenderIds.includes(gsmId.value))
132
+ : selectedDomainGsmSenders;
133
+
134
+ return smsGsmSenders.map((o) => ({
135
+ label: o.value || o.label,
136
+ value: o.value,
137
+ }));
138
+ },
139
+ [channel, registeredSenderIds, selectedDomainGsmSenders, smsTraiDltEnabled],
140
+ );
141
+
142
+ const emailSenderOptions = useMemo(
143
+ () => selectedDomainEmailSenders.map((o) => ({
144
+ label: o.value || o.label,
145
+ value: o.value,
146
+ senderLabel: o.label,
147
+ })),
148
+ [selectedDomainEmailSenders],
149
+ );
150
+
151
+ const emailSenderIdOptions = useMemo(
152
+ () => selectedDomainEmailSenders.map((emailSender) => ({
153
+ label: emailSender.label || emailSender.value,
154
+ value: emailSender.label || emailSender.value,
155
+ senderEmail: emailSender.value,
156
+ })),
157
+ [selectedDomainEmailSenders],
158
+ );
159
+
160
+ const emailReplyToOptions = useMemo(
161
+ () => selectedDomainEmailRepliers.map((emailReplyTo) => ({
162
+ label: emailReplyTo.value || emailReplyTo.label,
163
+ value: emailReplyTo.value,
164
+ })),
165
+ [selectedDomainEmailRepliers],
166
+ );
167
+
168
+ const wecrmAccountOptions = useMemo(
169
+ () => (wecrmAccounts || []).map((wecrmAccount) => ({
170
+ label: wecrmAccount.name || wecrmAccount.sourceAccountIdentifier,
171
+ value: wecrmAccount.sourceAccountIdentifier,
172
+ ...wecrmAccount,
173
+ })),
174
+ [wecrmAccounts],
175
+ );
176
+
177
+ const whatsappAccountOptionsForDisplay = useMemo(() => {
178
+ if (!isWhatsappAccountLocked || !whatsappAccountFromForm?.accountName) return wecrmAccountOptions;
179
+ const name = whatsappAccountFromForm.accountName;
180
+ const match = wecrmAccountOptions.find(
181
+ (a) => (a.label === name || a.name === name),
182
+ );
183
+ if (match) return [match];
184
+ return [{ label: name, value: name }];
185
+ }, [isWhatsappAccountLocked, whatsappAccountFromForm?.accountName, wecrmAccountOptions]);
186
+
187
+ const whatsappSenderOptions = useMemo(() => {
188
+ const selectedAccId = get(localSettings, DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER);
189
+ if (!selectedAccId) {
190
+ return (senderDetailsOptions || []).flatMap((senderDetails) => (senderDetails.gsmSenders || []).map((gsmSender) => ({
191
+ label: gsmSender.value,
192
+ value: gsmSender.value,
193
+ })));
194
+ }
195
+ const domainForAccount = (senderDetailsOptions || []).find(
196
+ (senderDetails) => senderDetails?.sourceAccountIdentifier === selectedAccId,
197
+ );
198
+ return (domainForAccount?.gsmSenders || []).map((gsmSender) => ({
199
+ label: gsmSender.value,
200
+ value: gsmSender.value,
201
+ }));
202
+ }, [senderDetailsOptions, localSettings.sourceAccountIdentifier]);
203
+
204
+ const updateSetting = useCallback((key, value) => {
205
+ setLocalSettings((prev) => {
206
+ const next = cloneDeep(prev);
207
+ next[key] = value;
208
+ return next;
209
+ });
210
+ }, []);
211
+
212
+ const onDomainChange = useCallback(
213
+ (value) => {
214
+ const domain = domainOptions.find((d) => d.value === value);
215
+ updateSetting(DELIVERY_SETTING_KEY_DOMAIN_ID, value);
216
+ if (domain?.dgmId != null) updateSetting(DELIVERY_SETTING_KEY_DOMAIN_GATEWAY_MAP_ID, domain.dgmId);
217
+ if (channel === CHANNELS.SMS && domain) {
218
+ const smsGsmSenders = smsTraiDltEnabled
219
+ ? (domain.gsmSenders || []).filter((gsmId) => registeredSenderIds.includes(gsmId.value))
220
+ : domain.gsmSenders;
221
+ const def = findDefault(smsGsmSenders);
222
+ updateSetting(DELIVERY_SETTING_KEY_GSM_SENDER_ID, def?.value || '');
223
+ const defCdma = findDefault(domain.cdmaSenders);
224
+ updateSetting(DELIVERY_SETTING_KEY_CDMA_SENDER_ID, defCdma?.value || '');
225
+ }
226
+ if (channel === CHANNELS.EMAIL && domain) {
227
+ const defSender = findDefault(domain.emailSenders);
228
+ const defReply = findDefault(domain.emailRepliers);
229
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_EMAIL, defSender?.value || '');
230
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_LABEL, defSender?.label || '');
231
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_REPLY_TO, defReply?.value || '');
232
+ }
233
+ },
234
+ [channel, domainOptions, registeredSenderIds, smsTraiDltEnabled, updateSetting],
235
+ );
236
+
237
+ const handleDone = useCallback(() => {
238
+ onSaveDeliverySettings(localSettings);
239
+ if (onClose) onClose();
240
+ }, [localSettings, onSaveDeliverySettings, onClose]);
241
+
242
+ const renderSelectRow = useCallback(
243
+ ({
244
+ titleMessage, options, value, onChange, rowKey, disabled,
245
+ }) => (
246
+ <CapRow className="modify-delivery-settings__field-row" key={rowKey}>
247
+ <CapHeader
248
+ size={HEADER_SIZE_LABEL}
249
+ title={<FormattedMessage {...titleMessage} />}
250
+ className="modify-delivery-settings__field-header"
251
+ />
252
+ <CapSelect
253
+ options={options}
254
+ value={value}
255
+ onChange={onChange}
256
+ placeholder={noOptionsLabel}
257
+ componentClassName={`modify-delivery-settings__select${disabled ? ' modify-delivery-settings__select--disabled' : ''}`}
258
+ disabled={disabled}
259
+ />
260
+ {disabled && <CapLabel type="label3">{formatMessage(messages.disabledMessage)}</CapLabel>}
261
+ </CapRow>
262
+ ),
263
+ [noOptionsLabel],
264
+ );
265
+
266
+ const getChannelFields = useCallback(() => {
267
+ const smsFields = [
268
+ {
269
+ titleMessage: messages.senderDomainLabel,
270
+ options: domainOptions,
271
+ value: get(localSettings, DELIVERY_SETTING_KEY_DOMAIN_ID),
272
+ onChange: (val) => onDomainChange(val),
273
+ },
274
+ {
275
+ titleMessage: messages.senderIdLabel,
276
+ options: gsmOptions,
277
+ value: get(localSettings, DELIVERY_SETTING_KEY_GSM_SENDER_ID),
278
+ onChange: (val) => updateSetting(DELIVERY_SETTING_KEY_GSM_SENDER_ID, val),
279
+ },
280
+ ];
281
+ const emailFields = [
282
+ {
283
+ titleMessage: messages.emailDomainLabel,
284
+ options: domainOptions,
285
+ value: get(localSettings, DELIVERY_SETTING_KEY_DOMAIN_ID),
286
+ onChange: (val) => onDomainChange(val),
287
+ },
288
+ {
289
+ titleMessage: messages.senderIdLabel,
290
+ options: emailSenderOptions,
291
+ value: get(localSettings, DELIVERY_SETTING_KEY_SENDER_EMAIL),
292
+ onChange: (val) => {
293
+ const sender = selectedDomainEmailSenders.find(
294
+ (s) => s.value === val,
295
+ );
296
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_EMAIL, val);
297
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_LABEL, sender?.label || val);
298
+ },
299
+ },
300
+ {
301
+ titleMessage: messages.senderNameLabelEmail,
302
+ options: emailSenderIdOptions,
303
+ value: get(localSettings, DELIVERY_SETTING_KEY_SENDER_LABEL) || '',
304
+ onChange: (val) => {
305
+ const sender = selectedDomainEmailSenders.find(
306
+ (s) => (s.label || s.value) === val,
307
+ );
308
+ if (sender) {
309
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_EMAIL, sender.value);
310
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_LABEL, sender.label || sender.value);
311
+ } else {
312
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_LABEL, val);
313
+ }
314
+ },
315
+ },
316
+ {
317
+ titleMessage: messages.replyToIdLabel,
318
+ options: emailReplyToOptions,
319
+ value: get(localSettings, DELIVERY_SETTING_KEY_SENDER_REPLY_TO),
320
+ onChange: (val) => updateSetting(DELIVERY_SETTING_KEY_SENDER_REPLY_TO, val),
321
+ },
322
+ ];
323
+ const whatsappAccountValue = isWhatsappAccountLocked && whatsappAccountOptionsForDisplay.length > 0
324
+ ? whatsappAccountOptionsForDisplay[0]?.value
325
+ : get(localSettings, DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER);
326
+ const whatsappFields = [
327
+ {
328
+ titleMessage: messages.accountLabel,
329
+ options: whatsappAccountOptionsForDisplay,
330
+ value: whatsappAccountValue,
331
+ onChange: (val) => {
332
+ updateSetting(DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER, val);
333
+ const domain = (senderDetailsOptions || []).find(
334
+ (d) => d.sourceAccountIdentifier === val,
335
+ );
336
+ const first = domain?.gsmSenders?.[0];
337
+ updateSetting(DELIVERY_SETTING_KEY_SENDER_MOB_NUM, first?.value || '');
338
+ },
339
+ disabled: isWhatsappAccountLocked,
340
+ },
341
+ {
342
+ titleMessage: messages.senderNumberLabel,
343
+ options: whatsappSenderOptions,
344
+ value: get(localSettings, DELIVERY_SETTING_KEY_SENDER_MOB_NUM),
345
+ onChange: (val) => updateSetting(DELIVERY_SETTING_KEY_SENDER_MOB_NUM, val),
346
+ },
347
+ ];
348
+ const byChannel = {
349
+ [CHANNELS.SMS]: smsFields,
350
+ [CHANNELS.EMAIL]: emailFields,
351
+ [CHANNELS.WHATSAPP]: whatsappFields,
352
+ };
353
+ return byChannel[channel] || [];
354
+ }, [
355
+ channel,
356
+ domainOptions,
357
+ gsmOptions,
358
+ emailSenderOptions,
359
+ emailSenderIdOptions,
360
+ emailReplyToOptions,
361
+ wecrmAccountOptions,
362
+ whatsappAccountOptionsForDisplay,
363
+ whatsappSenderOptions,
364
+ localSettings,
365
+ selectedDomainEmailSenders,
366
+ senderDetailsOptions,
367
+ onDomainChange,
368
+ updateSetting,
369
+ isWhatsappAccountLocked,
370
+ whatsappAccountFromForm,
371
+ ]);
372
+
373
+ if (isLoading) {
374
+ return (
375
+ <CapRow className="modify-delivery-settings__loading-row">
376
+ <CapSpin spinning />
377
+ </CapRow>
378
+ );
379
+ }
380
+
381
+ return (
382
+ <CapRow className="modify-delivery-settings">
383
+ {getChannelFields().map((field, idx) => renderSelectRow({
384
+ ...field,
385
+ rowKey: field.titleMessage?.id || `${ROW_KEY_PREFIX}${idx}`,
386
+ disabled: field.disabled,
387
+ }))}
388
+ <CapRow className="modify-delivery-settings__actions">
389
+ <CapButton type={BUTTON_TYPE_PRIMARY} onClick={handleDone}>
390
+ <FormattedMessage {...messages.done} />
391
+ </CapButton>
392
+ </CapRow>
393
+ </CapRow>
394
+ );
395
+ };
396
+
397
+ ModifyDeliverySettings.propTypes = {
398
+ channel: PropTypes.oneOf([CHANNELS.SMS, CHANNELS.EMAIL, CHANNELS.WHATSAPP]).isRequired,
399
+ deliverySettings: PropTypes.object,
400
+ senderDetailsOptions: PropTypes.array,
401
+ wecrmAccounts: PropTypes.array,
402
+ onSaveDeliverySettings: PropTypes.func.isRequired,
403
+ onClose: PropTypes.func,
404
+ isLoading: PropTypes.bool,
405
+ formatMessage: PropTypes.func,
406
+ smsTraiDltEnabled: PropTypes.bool,
407
+ registeredSenderIds: PropTypes.array,
408
+ whatsappAccountFromForm: PropTypes.shape({
409
+ accountName: PropTypes.string,
410
+ }),
411
+ };
412
+
413
+ ModifyDeliverySettings.defaultProps = {
414
+ deliverySettings: {},
415
+ senderDetailsOptions: [],
416
+ wecrmAccounts: [],
417
+ onClose: undefined,
418
+ isLoading: false,
419
+ formatMessage: undefined,
420
+ smsTraiDltEnabled: false,
421
+ registeredSenderIds: [],
422
+ whatsappAccountFromForm: undefined,
423
+ };
424
+
425
+ export default ModifyDeliverySettings;
@@ -0,0 +1,36 @@
1
+ /**
2
+ * ModifyDeliverySettings — styles for delivery settings form (SMS, Email, WhatsApp).
3
+ * Field rows, select width, and actions row.
4
+ */
5
+ @import '~@capillarytech/cap-ui-library/styles/_variables.scss';
6
+
7
+ .modify-delivery-settings {
8
+ height: 100%;
9
+ &__field-row {
10
+ margin-bottom: $CAP_SPACE_24;
11
+ }
12
+
13
+ &__field-header {
14
+ margin-bottom: $CAP_SPACE_08;
15
+ }
16
+
17
+ &__select {
18
+ width: 22.85rem;
19
+
20
+ &--disabled {
21
+ background-color: $CAP_G08;
22
+ pointer-events: none;
23
+ }
24
+ }
25
+
26
+ &__actions {
27
+ margin-top: $CAP_SPACE_24;
28
+ position: absolute;
29
+ bottom: 0;
30
+ margin-bottom: $CAP_SPACE_16;
31
+ }
32
+
33
+ &__loading-row {
34
+ display: block;
35
+ }
36
+ }
@@ -0,0 +1,92 @@
1
+ /**
2
+ * DeliverySettings constants for Test and Preview (SMS, Email, WhatsApp).
3
+ * Aligned with cap-campaigns-v2 DeliverySettingsV2/ModifyDeliverySettings field names.
4
+ */
5
+
6
+ import { CHANNELS } from '../constants';
7
+
8
+ /** Fallback label when no dropdown options (used when formatMessage unavailable) */
9
+ export const NO_OPTIONS_LABEL = 'No options';
10
+
11
+ /** Fallback label when delivery settings are not configured (used when formatMessage unavailable) */
12
+ export const NOT_CONFIGURED_LABEL = 'Not configured';
13
+
14
+ /** Placeholder shown in summary when a value is empty */
15
+ export const SUMMARY_EMPTY_PLACEHOLDER = '—';
16
+
17
+ /** CapHeading type for delivery settings section title */
18
+ export const HEADING_TYPE_H10 = 'h10';
19
+
20
+ /** CapRow type for flex layout */
21
+ export const ROW_TYPE_FLEX = 'flex';
22
+
23
+ /** Channel names — use CHANNELS.SMS, CHANNELS.EMAIL, CHANNELS.WHATSAPP from parent constants */
24
+ export { CHANNELS } from '../constants';
25
+
26
+ /** Delivery settings object keys (for get(deliverySettings, key) / updateSetting(key, value)) */
27
+ export const DELIVERY_SETTING_KEY_DOMAIN_ID = 'domainId';
28
+ export const DELIVERY_SETTING_KEY_DOMAIN_GATEWAY_MAP_ID = 'domainGatewayMapId';
29
+ export const DELIVERY_SETTING_KEY_GSM_SENDER_ID = 'gsmSenderId';
30
+ export const DELIVERY_SETTING_KEY_CDMA_SENDER_ID = 'cdmaSenderId';
31
+ export const DELIVERY_SETTING_KEY_SENDER_EMAIL = 'senderEmail';
32
+ export const DELIVERY_SETTING_KEY_SENDER_LABEL = 'senderLabel';
33
+ export const DELIVERY_SETTING_KEY_SENDER_REPLY_TO = 'senderReplyTo';
34
+ export const DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER = 'sourceAccountIdentifier';
35
+ export const DELIVERY_SETTING_KEY_SENDER_MOB_NUM = 'senderMobNum';
36
+
37
+ /** CapLabel type props */
38
+ export const LABEL_TYPE_LABEL1 = 'label1';
39
+ export const LABEL_TYPE_LABEL2 = 'label2';
40
+ export const LABEL_TYPE_LABEL9 = 'label9';
41
+
42
+ /** CapIcon type for edit action */
43
+ export const ICON_TYPE_EDIT = 'edit';
44
+
45
+ /** CapSlideBox size prop */
46
+ export const SLIDE_BOX_SIZE_L = 'size-l';
47
+
48
+ /** data-testid for delivery settings edit icon */
49
+ export const TEST_ID_DELIVERY_SETTINGS_EDIT = 'delivery-settings-edit';
50
+
51
+ /** CapHeader size prop for form labels */
52
+ export const HEADER_SIZE_LABEL = 'label';
53
+
54
+ /** CapButton type for primary action */
55
+ export const BUTTON_TYPE_PRIMARY = 'primary';
56
+
57
+ /** Prefix for row keys in field list map */
58
+ export const ROW_KEY_PREFIX = 'row-';
59
+
60
+ export const CHANNELS_WITH_DELIVERY_SETTINGS = [
61
+ CHANNELS.SMS,
62
+ CHANNELS.EMAIL,
63
+ CHANNELS.WHATSAPP,
64
+ ];
65
+
66
+ /** Default empty delivery setting per channel (campaigns-style shape) */
67
+ export const DEFAULT_DELIVERY_SETTING_SMS = {
68
+ domainId: null,
69
+ domainGatewayMapId: null,
70
+ gsmSenderId: '',
71
+ cdmaSenderId: '',
72
+ };
73
+
74
+ export const DEFAULT_DELIVERY_SETTING_EMAIL = {
75
+ domainId: null,
76
+ domainGatewayMapId: null,
77
+ senderEmail: '',
78
+ senderLabel: '',
79
+ senderReplyTo: '',
80
+ };
81
+
82
+ export const DEFAULT_DELIVERY_SETTING_WHATSAPP = {
83
+ domainId: null,
84
+ senderMobNum: '',
85
+ sourceAccountIdentifier: '',
86
+ };
87
+
88
+ export const DEFAULT_DELIVERY_SETTINGS_BY_CHANNEL = {
89
+ [CHANNELS.SMS]: DEFAULT_DELIVERY_SETTING_SMS,
90
+ [CHANNELS.EMAIL]: DEFAULT_DELIVERY_SETTING_EMAIL,
91
+ [CHANNELS.WHATSAPP]: DEFAULT_DELIVERY_SETTING_WHATSAPP,
92
+ };