@servicetitan/mpa-components 0.6.0 → 1.0.0
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/CHANGELOG.md +17 -0
- package/lib/components/settings/company-details/index.d.ts +5 -0
- package/lib/components/settings/company-details/index.d.ts.map +1 -1
- package/lib/components/settings/company-details/index.js +4 -3
- package/lib/components/settings/company-details/index.js.map +1 -1
- package/lib/components/settings/company-email-footer/index.d.ts +3 -0
- package/lib/components/settings/company-email-footer/index.d.ts.map +1 -1
- package/lib/components/settings/company-email-footer/index.js +2 -2
- package/lib/components/settings/company-email-footer/index.js.map +1 -1
- package/lib/components/settings/company-email-reply-to/index.d.ts +3 -0
- package/lib/components/settings/company-email-reply-to/index.d.ts.map +1 -1
- package/lib/components/settings/company-email-reply-to/index.js +2 -2
- package/lib/components/settings/company-email-reply-to/index.js.map +1 -1
- package/lib/components/settings/company-email-sender/custom-domain-sender.d.ts +3 -0
- package/lib/components/settings/company-email-sender/custom-domain-sender.d.ts.map +1 -1
- package/lib/components/settings/company-email-sender/custom-domain-sender.js +2 -2
- package/lib/components/settings/company-email-sender/custom-domain-sender.js.map +1 -1
- package/lib/components/settings/company-email-sender/simple-sender.d.ts +3 -0
- package/lib/components/settings/company-email-sender/simple-sender.d.ts.map +1 -1
- package/lib/components/settings/company-email-sender/simple-sender.js +2 -2
- package/lib/components/settings/company-email-sender/simple-sender.js.map +1 -1
- package/lib/components/settings/company-trades-picker/index.d.ts +7 -2
- package/lib/components/settings/company-trades-picker/index.d.ts.map +1 -1
- package/lib/components/settings/company-trades-picker/index.js +4 -4
- package/lib/components/settings/company-trades-picker/index.js.map +1 -1
- package/lib/components/settings/double-opt-in/index.d.ts +3 -0
- package/lib/components/settings/double-opt-in/index.d.ts.map +1 -1
- package/lib/components/settings/double-opt-in/index.js +2 -2
- package/lib/components/settings/double-opt-in/index.js.map +1 -1
- package/lib/components/settings/form-errors-list/index.d.ts +1 -0
- package/lib/components/settings/form-errors-list/index.d.ts.map +1 -1
- package/lib/components/settings/form-errors-list/index.js +3 -2
- package/lib/components/settings/form-errors-list/index.js.map +1 -1
- package/lib/components/settings/logo-picker/index.d.ts +1 -0
- package/lib/components/settings/logo-picker/index.d.ts.map +1 -1
- package/lib/components/settings/logo-picker/index.js +2 -2
- package/lib/components/settings/logo-picker/index.js.map +1 -1
- package/lib/components/settings/opt-out-message/index.d.ts +3 -0
- package/lib/components/settings/opt-out-message/index.d.ts.map +1 -1
- package/lib/components/settings/opt-out-message/index.js +2 -2
- package/lib/components/settings/opt-out-message/index.js.map +1 -1
- package/lib/components/settings/settings-section/index.d.ts +3 -1
- package/lib/components/settings/settings-section/index.d.ts.map +1 -1
- package/lib/components/settings/settings-section/index.js +1 -1
- package/lib/components/settings/settings-section/index.js.map +1 -1
- package/package.json +2 -2
- package/src/components/settings/company-details/index.tsx +15 -4
- package/src/components/settings/company-email-footer/index.tsx +6 -2
- package/src/components/settings/company-email-reply-to/index.tsx +32 -26
- package/src/components/settings/company-email-sender/custom-domain-sender.tsx +6 -2
- package/src/components/settings/company-email-sender/simple-sender.tsx +6 -2
- package/src/components/settings/company-trades-picker/index.tsx +17 -7
- package/src/components/settings/double-opt-in/index.tsx +116 -110
- package/src/components/settings/form-errors-list/index.tsx +31 -27
- package/src/components/settings/logo-picker/index.tsx +12 -8
- package/src/components/settings/opt-out-message/index.tsx +6 -3
- package/src/components/settings/settings-section/index.tsx +12 -7
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -3,37 +3,41 @@ import { observer } from 'mobx-react';
|
|
|
3
3
|
import { ComposibleValidatable, FormState, ValidatableMapOrArray } from 'formstate';
|
|
4
4
|
|
|
5
5
|
import { Banner } from '@servicetitan/design-system';
|
|
6
|
+
import classNames from 'classnames';
|
|
6
7
|
|
|
7
8
|
export interface FormErrorsListProps<T extends ValidatableMapOrArray = ValidatableMapOrArray> {
|
|
9
|
+
className?: string;
|
|
8
10
|
form: FormState<T>;
|
|
9
11
|
}
|
|
10
12
|
|
|
11
|
-
export const FormErrorsList: FC<FormErrorsListProps> = observer(
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
(
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
{
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
13
|
+
export const FormErrorsList: FC<FormErrorsListProps> = observer(
|
|
14
|
+
({ form, className }: FormErrorsListProps) => {
|
|
15
|
+
const getErrors = () => {
|
|
16
|
+
return Object.entries(form.$).map(
|
|
17
|
+
([key, field]: [key: string, field: ComposibleValidatable<unknown>]) => {
|
|
18
|
+
return field.hasError ? (
|
|
19
|
+
<li key={key} className="qa-settings-email-error-list-item">
|
|
20
|
+
{field.error}
|
|
21
|
+
</li>
|
|
22
|
+
) : null;
|
|
23
|
+
}
|
|
24
|
+
);
|
|
25
|
+
};
|
|
23
26
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
if (!form.hasError) {
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
27
30
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
}
|
|
31
|
+
return (
|
|
32
|
+
<Banner
|
|
33
|
+
status="critical"
|
|
34
|
+
title="Missing Fields"
|
|
35
|
+
icon
|
|
36
|
+
className={classNames('m-b-2 qa-settings-email-error', className)}
|
|
37
|
+
>
|
|
38
|
+
<p>Please complete all required fields:</p>
|
|
39
|
+
<ul className="qa-settings-email-error-list">{getErrors()}</ul>
|
|
40
|
+
</Banner>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
@@ -40,6 +40,7 @@ export interface LogoPickerProps {
|
|
|
40
40
|
maxSize?: number;
|
|
41
41
|
minDimensions?: { width: number; height: number };
|
|
42
42
|
tips?: ReactNode;
|
|
43
|
+
deletable?: boolean;
|
|
43
44
|
|
|
44
45
|
deleteImage(): void;
|
|
45
46
|
downloadImage?(): void;
|
|
@@ -61,6 +62,7 @@ export const LogoPicker: FC<LogoPickerProps> = observer(
|
|
|
61
62
|
onBadImage,
|
|
62
63
|
onFileChange,
|
|
63
64
|
setError,
|
|
65
|
+
deletable = true,
|
|
64
66
|
tips = DEFAULT_LOGO_TIPS,
|
|
65
67
|
}) => {
|
|
66
68
|
const [recommendLargerImage, setRecommendLargerImage] = useState(false);
|
|
@@ -222,14 +224,16 @@ export const LogoPicker: FC<LogoPickerProps> = observer(
|
|
|
222
224
|
</a>
|
|
223
225
|
)}
|
|
224
226
|
</Tooltip>
|
|
225
|
-
|
|
226
|
-
<
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
227
|
+
{deletable && (
|
|
228
|
+
<Tooltip el="div" text="Delete">
|
|
229
|
+
<Button
|
|
230
|
+
className="qa-settings-logo-delete shadow-1-i bg-white-i"
|
|
231
|
+
onClick={deleteImage}
|
|
232
|
+
iconName="delete"
|
|
233
|
+
outline
|
|
234
|
+
/>
|
|
235
|
+
</Tooltip>
|
|
236
|
+
)}
|
|
233
237
|
</ButtonGroup>
|
|
234
238
|
</div>
|
|
235
239
|
</Card.Section>
|
|
@@ -3,7 +3,7 @@ import { FC, Fragment, useCallback, useState } from 'react';
|
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
|
|
5
5
|
import { CheckboxFieldState, InputFieldState, TextAreaFieldState } from '@servicetitan/form';
|
|
6
|
-
import { Button, Form, Stack, Text, ToggleSwitch } from '@servicetitan/design-system';
|
|
6
|
+
import { Button, Form, LayoutProps, Stack, Text, ToggleSwitch } from '@servicetitan/design-system';
|
|
7
7
|
import { useConfirm } from '@servicetitan/confirm';
|
|
8
8
|
|
|
9
9
|
import { SettingsSection } from '../settings-section';
|
|
@@ -22,11 +22,13 @@ export interface OptOutMessageState {
|
|
|
22
22
|
}
|
|
23
23
|
export interface OptOutMessageProps {
|
|
24
24
|
formState: OptOutMessageState;
|
|
25
|
+
layout?: LayoutProps['type'];
|
|
26
|
+
className?: string;
|
|
25
27
|
onHandleClickEnable?(checked: boolean): void;
|
|
26
28
|
}
|
|
27
29
|
|
|
28
30
|
export const OptOutMessage: FC<OptOutMessageProps> = observer(
|
|
29
|
-
({ onHandleClickEnable, formState }) => {
|
|
31
|
+
({ onHandleClickEnable, formState, layout, className }) => {
|
|
30
32
|
const {
|
|
31
33
|
subjectLine,
|
|
32
34
|
header,
|
|
@@ -50,7 +52,8 @@ export const OptOutMessage: FC<OptOutMessageProps> = observer(
|
|
|
50
52
|
|
|
51
53
|
return (
|
|
52
54
|
<SettingsSection
|
|
53
|
-
|
|
55
|
+
layout={layout}
|
|
56
|
+
className={classnames(Styles.outOutMessage, className)}
|
|
54
57
|
qaPrefix="qa-opt-out-message"
|
|
55
58
|
title="Opt-Out Message"
|
|
56
59
|
text={
|
|
@@ -2,23 +2,28 @@ import classNames from 'classnames';
|
|
|
2
2
|
import { ReactNode, FC } from 'react';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
|
|
5
|
-
import { Text, Card, Layout } from '@servicetitan/design-system';
|
|
5
|
+
import { Text, Card, Layout, LayoutProps } from '@servicetitan/design-system';
|
|
6
6
|
|
|
7
7
|
export interface SectionProps {
|
|
8
|
-
title:
|
|
8
|
+
title: ReactNode;
|
|
9
9
|
text?: JSX.Element | string;
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
qaPrefix?: string;
|
|
12
12
|
className?: string;
|
|
13
|
+
layout?: LayoutProps['type'];
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export const SettingsSection: FC<SectionProps> = observer(
|
|
16
|
-
({ title, text, children, qaPrefix, className = '' }: SectionProps) => (
|
|
17
|
-
<Layout type=
|
|
17
|
+
({ title, text, children, qaPrefix, className = '', layout = 'support' }: SectionProps) => (
|
|
18
|
+
<Layout type={layout} direction="left" className={classNames(qaPrefix, className)}>
|
|
18
19
|
<Layout.Section>
|
|
19
|
-
|
|
20
|
-
{title}
|
|
21
|
-
|
|
20
|
+
{typeof title === 'string' ? (
|
|
21
|
+
<Text size={3} bold className={`${qaPrefix}-title`}>
|
|
22
|
+
{title}
|
|
23
|
+
</Text>
|
|
24
|
+
) : (
|
|
25
|
+
title
|
|
26
|
+
)}
|
|
22
27
|
{text && (
|
|
23
28
|
<Text size={2} subdued className={`${qaPrefix}-text`}>
|
|
24
29
|
{text}
|