@capillarytech/creatives-library 8.0.296 → 8.0.297
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/v2Components/CommonTestAndPreview/DeliverySettings/ModifyDeliverySettings.js +3 -8
- package/v2Components/CommonTestAndPreview/DeliverySettings/constants.js +0 -29
- package/v2Components/CommonTestAndPreview/DeliverySettings/index.js +15 -27
- package/v2Components/CommonTestAndPreview/tests/DeliverySettings/index.test.js +11 -12
package/package.json
CHANGED
|
@@ -22,9 +22,6 @@ import messages from './messages';
|
|
|
22
22
|
import {
|
|
23
23
|
CHANNELS,
|
|
24
24
|
DEFAULT_DELIVERY_SETTINGS_BY_CHANNEL,
|
|
25
|
-
NO_OPTIONS_LABEL,
|
|
26
|
-
HEADER_SIZE_LABEL,
|
|
27
|
-
BUTTON_TYPE_PRIMARY,
|
|
28
25
|
ROW_KEY_PREFIX,
|
|
29
26
|
DELIVERY_SETTING_KEY_DOMAIN_ID,
|
|
30
27
|
DELIVERY_SETTING_KEY_DOMAIN_GATEWAY_MAP_ID,
|
|
@@ -90,9 +87,7 @@ const ModifyDeliverySettings = (props) => {
|
|
|
90
87
|
senderDetailsOptions,
|
|
91
88
|
]);
|
|
92
89
|
|
|
93
|
-
const noOptionsLabel = formatMessage
|
|
94
|
-
? formatMessage(messages.noOptions)
|
|
95
|
-
: NO_OPTIONS_LABEL;
|
|
90
|
+
const noOptionsLabel = formatMessage(messages.noOptions);
|
|
96
91
|
|
|
97
92
|
const allDomainOptions = useMemo(
|
|
98
93
|
() => (senderDetailsOptions || []).map((senderDetails) => ({
|
|
@@ -245,7 +240,7 @@ const ModifyDeliverySettings = (props) => {
|
|
|
245
240
|
}) => (
|
|
246
241
|
<CapRow className="modify-delivery-settings__field-row" key={rowKey}>
|
|
247
242
|
<CapHeader
|
|
248
|
-
size=
|
|
243
|
+
size="label"
|
|
249
244
|
title={<FormattedMessage {...titleMessage} />}
|
|
250
245
|
className="modify-delivery-settings__field-header"
|
|
251
246
|
/>
|
|
@@ -386,7 +381,7 @@ const ModifyDeliverySettings = (props) => {
|
|
|
386
381
|
disabled: field.disabled,
|
|
387
382
|
}))}
|
|
388
383
|
<CapRow className="modify-delivery-settings__actions">
|
|
389
|
-
<CapButton type=
|
|
384
|
+
<CapButton type="primary" onClick={handleDone}>
|
|
390
385
|
<FormattedMessage {...messages.done} />
|
|
391
386
|
</CapButton>
|
|
392
387
|
</CapRow>
|
|
@@ -5,21 +5,9 @@
|
|
|
5
5
|
|
|
6
6
|
import { CHANNELS } from '../constants';
|
|
7
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
8
|
/** Placeholder shown in summary when a value is empty */
|
|
15
9
|
export const SUMMARY_EMPTY_PLACEHOLDER = '—';
|
|
16
10
|
|
|
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
11
|
/** Channel names — use CHANNELS.SMS, CHANNELS.EMAIL, CHANNELS.WHATSAPP from parent constants */
|
|
24
12
|
export { CHANNELS } from '../constants';
|
|
25
13
|
|
|
@@ -34,26 +22,9 @@ export const DELIVERY_SETTING_KEY_SENDER_REPLY_TO = 'senderReplyTo';
|
|
|
34
22
|
export const DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER = 'sourceAccountIdentifier';
|
|
35
23
|
export const DELIVERY_SETTING_KEY_SENDER_MOB_NUM = 'senderMobNum';
|
|
36
24
|
|
|
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
25
|
/** data-testid for delivery settings edit icon */
|
|
49
26
|
export const TEST_ID_DELIVERY_SETTINGS_EDIT = 'delivery-settings-edit';
|
|
50
27
|
|
|
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
28
|
/** Prefix for row keys in field list map */
|
|
58
29
|
export const ROW_KEY_PREFIX = 'row-';
|
|
59
30
|
|
|
@@ -7,13 +7,11 @@
|
|
|
7
7
|
|
|
8
8
|
import React, { useState, useCallback } from "react";
|
|
9
9
|
import PropTypes from "prop-types";
|
|
10
|
-
import
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
CapSlideBox,
|
|
16
|
-
} from "@capillarytech/cap-ui-library";
|
|
10
|
+
import CapRow from "@capillarytech/cap-ui-library/CapRow";
|
|
11
|
+
import CapHeading from "@capillarytech/cap-ui-library/CapHeading";
|
|
12
|
+
import CapIcon from "@capillarytech/cap-ui-library/CapIcon";
|
|
13
|
+
import CapLabel from "@capillarytech/cap-ui-library/CapLabel";
|
|
14
|
+
import CapSlideBox from "@capillarytech/cap-ui-library/CapSlideBox";
|
|
17
15
|
import { FormattedMessage } from "react-intl";
|
|
18
16
|
import get from "lodash/get";
|
|
19
17
|
import messages from "./messages";
|
|
@@ -21,10 +19,7 @@ import ModifyDeliverySettings from "./ModifyDeliverySettings";
|
|
|
21
19
|
import {
|
|
22
20
|
CHANNELS,
|
|
23
21
|
CHANNELS_WITH_DELIVERY_SETTINGS,
|
|
24
|
-
NOT_CONFIGURED_LABEL,
|
|
25
22
|
SUMMARY_EMPTY_PLACEHOLDER,
|
|
26
|
-
HEADING_TYPE_H10,
|
|
27
|
-
ROW_TYPE_FLEX,
|
|
28
23
|
DELIVERY_SETTING_KEY_DOMAIN_ID,
|
|
29
24
|
DELIVERY_SETTING_KEY_GSM_SENDER_ID,
|
|
30
25
|
DELIVERY_SETTING_KEY_SENDER_EMAIL,
|
|
@@ -32,11 +27,6 @@ import {
|
|
|
32
27
|
DELIVERY_SETTING_KEY_SENDER_REPLY_TO,
|
|
33
28
|
DELIVERY_SETTING_KEY_SOURCE_ACCOUNT_IDENTIFIER,
|
|
34
29
|
DELIVERY_SETTING_KEY_SENDER_MOB_NUM,
|
|
35
|
-
LABEL_TYPE_LABEL1,
|
|
36
|
-
LABEL_TYPE_LABEL2,
|
|
37
|
-
LABEL_TYPE_LABEL9,
|
|
38
|
-
ICON_TYPE_EDIT,
|
|
39
|
-
SLIDE_BOX_SIZE_L,
|
|
40
30
|
TEST_ID_DELIVERY_SETTINGS_EDIT,
|
|
41
31
|
} from "./constants";
|
|
42
32
|
import "./DeliverySettings.scss";
|
|
@@ -72,9 +62,7 @@ const DeliverySettings = (props) => {
|
|
|
72
62
|
return null;
|
|
73
63
|
}
|
|
74
64
|
|
|
75
|
-
const notConfiguredLabel = formatMessage
|
|
76
|
-
? formatMessage(messages.notConfigured)
|
|
77
|
-
: NOT_CONFIGURED_LABEL;
|
|
65
|
+
const notConfiguredLabel = formatMessage(messages.notConfigured);
|
|
78
66
|
|
|
79
67
|
const getSummaryText = () => {
|
|
80
68
|
const empty = SUMMARY_EMPTY_PLACEHOLDER;
|
|
@@ -165,19 +153,19 @@ const DeliverySettings = (props) => {
|
|
|
165
153
|
return (
|
|
166
154
|
<CapRow className="delivery-settings">
|
|
167
155
|
<CapRow className="delivery-settings__heading-row">
|
|
168
|
-
<CapHeading type=
|
|
156
|
+
<CapHeading type="h10">
|
|
169
157
|
<FormattedMessage {...messages.deliverySettings} />
|
|
170
158
|
</CapHeading>
|
|
171
159
|
</CapRow>
|
|
172
|
-
<CapRow type=
|
|
173
|
-
<CapRow type=
|
|
160
|
+
<CapRow type="flex" className="delivery-settings__summary-row">
|
|
161
|
+
<CapRow type="flex" className="delivery-settings__summary-inner">
|
|
174
162
|
{summaryObject == null ? (
|
|
175
|
-
<CapLabel type=
|
|
163
|
+
<CapLabel type="label2">{notConfiguredLabel}</CapLabel>
|
|
176
164
|
) : (
|
|
177
165
|
Object.entries(summaryObject).map(([key, value]) => (
|
|
178
|
-
<CapRow type=
|
|
179
|
-
<CapLabel type=
|
|
180
|
-
<CapLabel type=
|
|
166
|
+
<CapRow type="flex" key={key} className="delivery-settings__summary-entry">
|
|
167
|
+
<CapLabel type="label1" className="delivery-settings__summary-key">{key}</CapLabel>
|
|
168
|
+
<CapLabel type="label9">
|
|
181
169
|
:
|
|
182
170
|
{' '}
|
|
183
171
|
{value}
|
|
@@ -187,7 +175,7 @@ const DeliverySettings = (props) => {
|
|
|
187
175
|
)}
|
|
188
176
|
</CapRow>
|
|
189
177
|
<CapIcon
|
|
190
|
-
type=
|
|
178
|
+
type="edit"
|
|
191
179
|
onClick={openSlideBox}
|
|
192
180
|
className="delivery-settings__edit-icon"
|
|
193
181
|
data-testid={TEST_ID_DELIVERY_SETTINGS_EDIT}
|
|
@@ -198,7 +186,7 @@ const DeliverySettings = (props) => {
|
|
|
198
186
|
{isSlideBoxOpen && (
|
|
199
187
|
<CapSlideBox
|
|
200
188
|
show
|
|
201
|
-
size=
|
|
189
|
+
size="size-l"
|
|
202
190
|
header={<FormattedMessage {...messages.deliverySettings} />}
|
|
203
191
|
handleClose={closeSlideBox}
|
|
204
192
|
content={(
|
|
@@ -11,18 +11,17 @@ import { CHANNELS } from '../../constants';
|
|
|
11
11
|
|
|
12
12
|
jest.mock('../../DeliverySettings/DeliverySettings.scss', () => ({}));
|
|
13
13
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}));
|
|
14
|
+
// Mock subpath imports (used by DeliverySettings/index.js and ModifyDeliverySettings.js)
|
|
15
|
+
jest.mock('@capillarytech/cap-ui-library/CapRow', () => ({ children, className, ...rest }) => <div className={className} data-testid="cap-row" {...rest}>{children}</div>);
|
|
16
|
+
jest.mock('@capillarytech/cap-ui-library/CapHeading', () => ({ children }) => <div data-testid="cap-heading">{children}</div>);
|
|
17
|
+
jest.mock('@capillarytech/cap-ui-library/CapIcon', () => ({ onClick, className, 'data-testid': testId }) => <button type="button" onClick={onClick} className={className} data-testid={testId || 'cap-icon'} aria-label="edit" />);
|
|
18
|
+
jest.mock('@capillarytech/cap-ui-library/CapLabel', () => ({ children, type }) => <span data-type={type}>{children}</span>);
|
|
19
|
+
jest.mock('@capillarytech/cap-ui-library/CapSlideBox', () => ({ show, content, handleClose }) => (show ? (
|
|
20
|
+
<div data-testid="cap-slidebox">
|
|
21
|
+
<button type="button" onClick={handleClose} data-testid="slidebox-close">Close</button>
|
|
22
|
+
{content}
|
|
23
|
+
</div>
|
|
24
|
+
) : null));
|
|
26
25
|
|
|
27
26
|
const mockModifyDeliverySettings = jest.fn();
|
|
28
27
|
jest.mock('../../DeliverySettings/ModifyDeliverySettings', () => function MockModifyDeliverySettings(props) {
|