@servicetitan/mpa-components 1.8.0 → 1.10.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 +12 -0
- package/lib/components/campaign-actions/action-button/action-button-archive.js +1 -1
- package/lib/components/campaign-actions/action-button/action-button-archive.js.map +1 -1
- package/lib/components/campaign-actions/action-button/action-button-clone.js +1 -1
- package/lib/components/campaign-actions/action-button/action-button-clone.js.map +1 -1
- package/lib/components/campaign-actions/action-button/action-button-edit.js +1 -1
- package/lib/components/campaign-actions/action-button/action-button-edit.js.map +1 -1
- package/lib/components/campaign-actions/action-button/action-button-unarchive.js +1 -1
- package/lib/components/campaign-actions/action-button/action-button-unarchive.js.map +1 -1
- package/lib/components/campaign-actions/action-button/action-button.js +2 -2
- package/lib/components/campaign-actions/action-button/action-button.js.map +1 -1
- package/lib/components/campaign-actions/actions-button/actions-button.js +2 -2
- package/lib/components/campaign-actions/actions-button/actions-button.js.map +1 -1
- package/lib/components/campaign-actions/actions-button/campaign-actions.js +2 -2
- package/lib/components/campaign-actions/actions-button/campaign-actions.js.map +1 -1
- package/lib/components/settings/company-details/company-details-form.stories.d.ts +3 -3
- package/lib/components/settings/company-details/company-details-form.stories.d.ts.map +1 -1
- package/lib/components/settings/company-details/company-details-form.stories.js +17 -38
- package/lib/components/settings/company-details/company-details-form.stories.js.map +1 -1
- package/lib/components/settings/company-details/index.js +2 -2
- package/lib/components/settings/company-details/index.js.map +1 -1
- package/lib/components/settings/company-email-footer/company-email-footer.stories.d.ts +1 -2
- package/lib/components/settings/company-email-footer/company-email-footer.stories.d.ts.map +1 -1
- package/lib/components/settings/company-email-footer/company-email-footer.stories.js +5 -15
- package/lib/components/settings/company-email-footer/company-email-footer.stories.js.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/company-email-reply-to.stories.d.ts +1 -2
- package/lib/components/settings/company-email-reply-to/company-email-reply-to.stories.d.ts.map +1 -1
- package/lib/components/settings/company-email-reply-to/company-email-reply-to.stories.js +5 -15
- package/lib/components/settings/company-email-reply-to/company-email-reply-to.stories.js.map +1 -1
- package/lib/components/settings/company-email-reply-to/index.js +1 -1
- package/lib/components/settings/company-email-reply-to/index.js.map +1 -1
- package/lib/components/settings/company-email-sender/company-email-sender.stories.d.ts +2 -3
- package/lib/components/settings/company-email-sender/company-email-sender.stories.d.ts.map +1 -1
- package/lib/components/settings/company-email-sender/company-email-sender.stories.js +7 -18
- package/lib/components/settings/company-email-sender/company-email-sender.stories.js.map +1 -1
- package/lib/components/settings/company-email-sender/custom-domain-sender.js +3 -3
- package/lib/components/settings/company-email-sender/custom-domain-sender.js.map +1 -1
- package/lib/components/settings/company-email-sender/simple-sender.js +1 -1
- package/lib/components/settings/company-email-sender/simple-sender.js.map +1 -1
- package/lib/components/settings/company-trade-checkbox/index.d.ts +0 -1
- package/lib/components/settings/company-trade-checkbox/index.d.ts.map +1 -1
- package/lib/components/settings/company-trade-checkbox/index.js +1 -1
- package/lib/components/settings/company-trade-checkbox/index.js.map +1 -1
- package/lib/components/settings/company-trades-picker/company-trades-picker.stories.js +4 -1
- package/lib/components/settings/company-trades-picker/company-trades-picker.stories.js.map +1 -1
- package/lib/components/settings/company-trades-picker/index.d.ts +2 -1
- package/lib/components/settings/company-trades-picker/index.d.ts.map +1 -1
- package/lib/components/settings/company-trades-picker/index.js +6 -6
- package/lib/components/settings/company-trades-picker/index.js.map +1 -1
- package/lib/components/settings/double-opt-in/double-opt-in.stories.d.ts +1 -2
- package/lib/components/settings/double-opt-in/double-opt-in.stories.d.ts.map +1 -1
- package/lib/components/settings/double-opt-in/double-opt-in.stories.js +5 -17
- package/lib/components/settings/double-opt-in/double-opt-in.stories.js.map +1 -1
- package/lib/components/settings/double-opt-in/index.js +1 -1
- package/lib/components/settings/double-opt-in/index.js.map +1 -1
- package/lib/components/settings/email-preview/email-preview.js +1 -1
- package/lib/components/settings/email-preview/email-preview.js.map +1 -1
- package/lib/components/settings/email-preview/opt-in-email-preview.js.map +1 -1
- package/lib/components/settings/email-preview/opt-out-email-preview.js.map +1 -1
- package/lib/components/settings/email-validation/email-validation.stories.js +26 -37
- package/lib/components/settings/email-validation/email-validation.stories.js.map +1 -1
- package/lib/components/settings/email-validation/index.d.ts.map +1 -1
- package/lib/components/settings/email-validation/index.js +2 -2
- package/lib/components/settings/email-validation/index.js.map +1 -1
- package/lib/components/settings/form-errors-list/index.js +2 -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 +10 -18
- package/lib/components/settings/logo-picker/index.js.map +1 -1
- package/lib/components/settings/opt-out-message/index.js +1 -1
- package/lib/components/settings/opt-out-message/index.js.map +1 -1
- package/lib/components/settings/opt-out-message/opt-out-message.stories.d.ts +1 -2
- package/lib/components/settings/opt-out-message/opt-out-message.stories.d.ts.map +1 -1
- package/lib/components/settings/opt-out-message/opt-out-message.stories.js +5 -17
- package/lib/components/settings/opt-out-message/opt-out-message.stories.js.map +1 -1
- package/lib/components/settings/result-definitions-modal/header.js +1 -1
- package/lib/components/settings/result-definitions-modal/header.js.map +1 -1
- package/lib/components/settings/result-definitions-modal/index.js +1 -1
- package/lib/components/settings/result-definitions-modal/index.js.map +1 -1
- package/lib/components/settings/result-definitions-modal/row.js +1 -1
- package/lib/components/settings/result-definitions-modal/row.js.map +1 -1
- package/lib/components/settings/settings-section/index.d.ts +1 -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/lib/components/settings/settings-section/settings-section.stories.d.ts +0 -1
- package/lib/components/settings/settings-section/settings-section.stories.d.ts.map +1 -1
- package/lib/components/settings/settings-section/settings-section.stories.js +1 -1
- package/lib/components/settings/settings-section/settings-section.stories.js.map +1 -1
- package/lib/utils/helpers.js +1 -1
- package/lib/utils/helpers.js.map +1 -1
- package/package.json +2 -2
- package/src/components/settings/company-details/company-details-form.stories.tsx +18 -26
- package/src/components/settings/company-details/index.tsx +1 -1
- package/src/components/settings/company-email-footer/company-email-footer.stories.tsx +3 -5
- package/src/components/settings/company-email-footer/index.tsx +1 -1
- package/src/components/settings/company-email-reply-to/company-email-reply-to.stories.tsx +4 -5
- package/src/components/settings/company-email-reply-to/index.tsx +1 -1
- package/src/components/settings/company-email-sender/company-email-sender.stories.tsx +6 -12
- package/src/components/settings/company-email-sender/custom-domain-sender.tsx +4 -4
- package/src/components/settings/company-email-sender/simple-sender.tsx +2 -2
- package/src/components/settings/company-trades-picker/company-trades-picker.stories.tsx +2 -2
- package/src/components/settings/company-trades-picker/index.tsx +4 -2
- package/src/components/settings/double-opt-in/double-opt-in.stories.tsx +4 -7
- package/src/components/settings/double-opt-in/index.tsx +3 -3
- package/src/components/settings/email-preview/email-preview.tsx +1 -1
- package/src/components/settings/email-preview/opt-in-email-preview.tsx +1 -1
- package/src/components/settings/email-validation/index.tsx +5 -5
- package/src/components/settings/form-errors-list/index.tsx +2 -2
- package/src/components/settings/logo-picker/index.tsx +104 -72
- package/src/components/settings/opt-out-message/index.tsx +2 -2
- package/src/components/settings/opt-out-message/opt-out-message.stories.tsx +3 -7
- package/src/components/settings/settings-section/index.tsx +5 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -40,7 +40,7 @@ export const CompanyEmailSender: FC<CompanyEmailSenderProps> = observer(
|
|
|
40
40
|
|
|
41
41
|
senderName.onChange(data.value);
|
|
42
42
|
},
|
|
43
|
-
[senderName]
|
|
43
|
+
[senderName],
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
const handleSenderDomainChange = useCallback(
|
|
@@ -51,7 +51,7 @@ export const CompanyEmailSender: FC<CompanyEmailSenderProps> = observer(
|
|
|
51
51
|
|
|
52
52
|
senderDomain.onChange(data.value);
|
|
53
53
|
},
|
|
54
|
-
[senderDomain]
|
|
54
|
+
[senderDomain],
|
|
55
55
|
);
|
|
56
56
|
|
|
57
57
|
const handleSenderEmailChange = useCallback(
|
|
@@ -62,7 +62,7 @@ export const CompanyEmailSender: FC<CompanyEmailSenderProps> = observer(
|
|
|
62
62
|
|
|
63
63
|
senderEmail.onChange(data.value);
|
|
64
64
|
},
|
|
65
|
-
[senderEmail]
|
|
65
|
+
[senderEmail],
|
|
66
66
|
);
|
|
67
67
|
|
|
68
68
|
return (
|
|
@@ -156,5 +156,5 @@ export const CompanyEmailSender: FC<CompanyEmailSenderProps> = observer(
|
|
|
156
156
|
</Form>
|
|
157
157
|
</SettingsSection>
|
|
158
158
|
);
|
|
159
|
-
}
|
|
159
|
+
},
|
|
160
160
|
);
|
|
@@ -22,7 +22,7 @@ export const CompanyEmailSender: FC<CompanyEmailSender> = observer(
|
|
|
22
22
|
|
|
23
23
|
senderName.onChange(data.value);
|
|
24
24
|
},
|
|
25
|
-
[senderName]
|
|
25
|
+
[senderName],
|
|
26
26
|
);
|
|
27
27
|
|
|
28
28
|
const handleSenderEmailBlur = useCallback(() => {
|
|
@@ -71,5 +71,5 @@ export const CompanyEmailSender: FC<CompanyEmailSender> = observer(
|
|
|
71
71
|
</Form>
|
|
72
72
|
</SettingsSection>
|
|
73
73
|
);
|
|
74
|
-
}
|
|
74
|
+
},
|
|
75
75
|
);
|
|
@@ -68,10 +68,10 @@ export function CompanyTradesPicker() {
|
|
|
68
68
|
trades.map(trade => ({
|
|
69
69
|
...trade,
|
|
70
70
|
active: trade.value === t ? !trade.active : trade.active,
|
|
71
|
-
}))
|
|
71
|
+
})),
|
|
72
72
|
);
|
|
73
73
|
},
|
|
74
|
-
[trades]
|
|
74
|
+
[trades],
|
|
75
75
|
);
|
|
76
76
|
|
|
77
77
|
return <Component<TradeType> trades={trades} onTradeChange={selectTrade} />;
|
|
@@ -24,6 +24,7 @@ export interface CompanyTradesPickerProps<TradeType extends string | number = st
|
|
|
24
24
|
layout?: LayoutProps['type'];
|
|
25
25
|
className?: string;
|
|
26
26
|
title?: ReactNode;
|
|
27
|
+
text?: ReactNode | string;
|
|
27
28
|
columns?: number;
|
|
28
29
|
onTradeChange(t?: TradeType): void;
|
|
29
30
|
}
|
|
@@ -35,10 +36,11 @@ export function CompanyTradesPicker<T extends string | number = string>({
|
|
|
35
36
|
className,
|
|
36
37
|
columns = 4,
|
|
37
38
|
title = 'Select Your Trades',
|
|
39
|
+
text = 'Choose which trades describe your business so we can give you relevant content and merge tags.',
|
|
38
40
|
}: CompanyTradesPickerProps<T>) {
|
|
39
41
|
const rows = useMemo(
|
|
40
42
|
() => chunk(trades, columns).map((row, idx) => ({ row, key: `row=${idx}` })),
|
|
41
|
-
[trades, columns]
|
|
43
|
+
[trades, columns],
|
|
42
44
|
);
|
|
43
45
|
|
|
44
46
|
return (
|
|
@@ -47,7 +49,7 @@ export function CompanyTradesPicker<T extends string | number = string>({
|
|
|
47
49
|
layout={layout}
|
|
48
50
|
title={title}
|
|
49
51
|
qaPrefix="qa-settings-select-your-trades"
|
|
50
|
-
text=
|
|
52
|
+
text={text}
|
|
51
53
|
>
|
|
52
54
|
<Grid columns={columns as GridColumnsCount}>
|
|
53
55
|
{rows.map(({ row, key }) => {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CheckboxFieldState, InputFieldState, TextAreaFieldState } from '@servicetitan/form';
|
|
2
|
-
import { injectable, provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
2
|
import { FormState } from 'formstate';
|
|
4
3
|
import { DoubleOptIn as Component } from '.';
|
|
5
4
|
|
|
@@ -9,7 +8,6 @@ export default {
|
|
|
9
8
|
parameters: {},
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
@injectable()
|
|
13
11
|
class DoubleOptInStore {
|
|
14
12
|
form = new FormState({
|
|
15
13
|
emailSubject: new InputFieldState('Jump in'),
|
|
@@ -20,9 +18,8 @@ class DoubleOptInStore {
|
|
|
20
18
|
});
|
|
21
19
|
}
|
|
22
20
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
const [store] = useDependencies(DoubleOptInStore);
|
|
21
|
+
const store = new DoubleOptInStore();
|
|
22
|
+
|
|
23
|
+
export const DoubleOptIn = () => {
|
|
27
24
|
return <Component formState={store.form.$} />;
|
|
28
|
-
}
|
|
25
|
+
};
|
|
@@ -40,7 +40,7 @@ export const DoubleOptIn: FC<DoubleOptInProps> = observer(
|
|
|
40
40
|
onHandleClickEnable?.(checked);
|
|
41
41
|
enabled.onChange(checked);
|
|
42
42
|
},
|
|
43
|
-
[enabled, onHandleClickEnable]
|
|
43
|
+
[enabled, onHandleClickEnable],
|
|
44
44
|
);
|
|
45
45
|
|
|
46
46
|
const [Confirm, handleConfirmed] = useConfirm(handleClickEnable);
|
|
@@ -100,7 +100,7 @@ export const DoubleOptIn: FC<DoubleOptInProps> = observer(
|
|
|
100
100
|
<Form.Input
|
|
101
101
|
className={classnames(
|
|
102
102
|
Styles.buttonInput,
|
|
103
|
-
'm-b-2-i qa-double-opt-in-button-text'
|
|
103
|
+
'm-b-2-i qa-double-opt-in-button-text',
|
|
104
104
|
)}
|
|
105
105
|
value={emailButtonText.value}
|
|
106
106
|
onChange={emailButtonText.onChangeHandler}
|
|
@@ -145,5 +145,5 @@ export const DoubleOptIn: FC<DoubleOptInProps> = observer(
|
|
|
145
145
|
/>
|
|
146
146
|
</SettingsSection>
|
|
147
147
|
);
|
|
148
|
-
}
|
|
148
|
+
},
|
|
149
149
|
);
|
|
@@ -44,7 +44,7 @@ export interface EmailValidationTableRecord<T> {
|
|
|
44
44
|
|
|
45
45
|
export interface EmailValidationProps<
|
|
46
46
|
TEmailValidationType extends string | number = string,
|
|
47
|
-
TEmailValidationResult extends string | number = string
|
|
47
|
+
TEmailValidationResult extends string | number = string,
|
|
48
48
|
> {
|
|
49
49
|
className?: string;
|
|
50
50
|
loading: boolean;
|
|
@@ -56,7 +56,7 @@ export interface EmailValidationProps<
|
|
|
56
56
|
|
|
57
57
|
interface EmailValidationHocOptions<
|
|
58
58
|
TEmailValidationType extends string | number = string,
|
|
59
|
-
TEmailValidationResult extends string | number = string
|
|
59
|
+
TEmailValidationResult extends string | number = string,
|
|
60
60
|
> {
|
|
61
61
|
resultToText: Map<TEmailValidationResult, string>;
|
|
62
62
|
levelTypeMap: {
|
|
@@ -71,7 +71,7 @@ interface EmailValidationHocOptions<
|
|
|
71
71
|
|
|
72
72
|
export function emailValidationHoc<
|
|
73
73
|
TEmailValidationType extends string | number = string,
|
|
74
|
-
TEmailValidationResult extends string | number = string
|
|
74
|
+
TEmailValidationResult extends string | number = string,
|
|
75
75
|
>({
|
|
76
76
|
resultToText,
|
|
77
77
|
levelTypeMap,
|
|
@@ -81,7 +81,7 @@ export function emailValidationHoc<
|
|
|
81
81
|
}: EmailValidationHocOptions<TEmailValidationType, TEmailValidationResult>) {
|
|
82
82
|
const ResultColumnMenuFilter = multiSelectColumnMenuFilter(
|
|
83
83
|
[...resultToText.keys()],
|
|
84
|
-
result => resultToText.get(result)
|
|
84
|
+
result => resultToText.get(result)!,
|
|
85
85
|
);
|
|
86
86
|
|
|
87
87
|
const ResultCell: FC<TableCellProps> = props => {
|
|
@@ -115,7 +115,7 @@ export function emailValidationHoc<
|
|
|
115
115
|
(riskType: TEmailValidationType) => () => {
|
|
116
116
|
setValidationRiskType(riskType);
|
|
117
117
|
},
|
|
118
|
-
[setValidationRiskType]
|
|
118
|
+
[setValidationRiskType],
|
|
119
119
|
);
|
|
120
120
|
|
|
121
121
|
const handleClickLearnMore = () => {
|
|
@@ -20,7 +20,7 @@ export const FormErrorsList: FC<FormErrorsListProps> = observer(
|
|
|
20
20
|
{field.error}
|
|
21
21
|
</li>
|
|
22
22
|
) : null;
|
|
23
|
-
}
|
|
23
|
+
},
|
|
24
24
|
);
|
|
25
25
|
};
|
|
26
26
|
|
|
@@ -39,5 +39,5 @@ export const FormErrorsList: FC<FormErrorsListProps> = observer(
|
|
|
39
39
|
<ul className="qa-settings-email-error-list">{getErrors()}</ul>
|
|
40
40
|
</Banner>
|
|
41
41
|
);
|
|
42
|
-
}
|
|
42
|
+
},
|
|
43
43
|
);
|
|
@@ -41,6 +41,7 @@ export interface LogoPickerProps {
|
|
|
41
41
|
minDimensions?: { width: number; height: number };
|
|
42
42
|
tips?: ReactNode;
|
|
43
43
|
deletable?: boolean;
|
|
44
|
+
isGrid?: boolean;
|
|
44
45
|
|
|
45
46
|
deleteImage(): void;
|
|
46
47
|
downloadImage?(): void;
|
|
@@ -64,17 +65,15 @@ export const LogoPicker: FC<LogoPickerProps> = observer(
|
|
|
64
65
|
setError,
|
|
65
66
|
deletable = true,
|
|
66
67
|
tips = DEFAULT_LOGO_TIPS,
|
|
68
|
+
isGrid = true,
|
|
67
69
|
}) => {
|
|
68
70
|
const [recommendLargerImage, setRecommendLargerImage] = useState(false);
|
|
69
71
|
const [localError, setLocalError] = useState('');
|
|
70
72
|
const [isLoading, setIsLoading] = useState(false);
|
|
71
73
|
const [sizeError, setSizeError] = useState('');
|
|
72
74
|
|
|
73
|
-
const fileRef = useRef<HTMLInputElement>(null);
|
|
74
75
|
const formattedMaxSize = useRef(formatBytes(maxSize, 2, false));
|
|
75
76
|
|
|
76
|
-
const handleClick = () => fileRef.current?.click();
|
|
77
|
-
|
|
78
77
|
useEffect(() => {
|
|
79
78
|
const handleImageUrlChange = async () => {
|
|
80
79
|
if (!imageUrl || !minDimensions) {
|
|
@@ -85,7 +84,7 @@ export const LogoPicker: FC<LogoPickerProps> = observer(
|
|
|
85
84
|
try {
|
|
86
85
|
const size = await getImageSize(imageUrl);
|
|
87
86
|
setRecommendLargerImage(
|
|
88
|
-
size.height < minDimensions.height || size.width < minDimensions.width
|
|
87
|
+
size.height < minDimensions.height || size.width < minDimensions.width,
|
|
89
88
|
);
|
|
90
89
|
setLocalError('');
|
|
91
90
|
|
|
@@ -169,77 +168,28 @@ export const LogoPicker: FC<LogoPickerProps> = observer(
|
|
|
169
168
|
accept="image/png, image/jpeg"
|
|
170
169
|
onSelected={onFileChange}
|
|
171
170
|
/>
|
|
172
|
-
) : (
|
|
171
|
+
) : isGrid ? (
|
|
173
172
|
<Grid>
|
|
174
173
|
<Grid.Column width={4}>
|
|
175
|
-
<
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
<ButtonGroup>
|
|
184
|
-
<Tooltip el="div" text="Replace">
|
|
185
|
-
<Button
|
|
186
|
-
outline
|
|
187
|
-
iconName="sync"
|
|
188
|
-
onClick={handleClick}
|
|
189
|
-
className="qa-settings-logo-replace shadow-1-i bg-white-i"
|
|
190
|
-
/>
|
|
191
|
-
<input
|
|
192
|
-
hidden
|
|
193
|
-
type="file"
|
|
194
|
-
accept="image/png, image/jpeg"
|
|
195
|
-
ref={fileRef}
|
|
196
|
-
onChange={({ currentTarget: { files } }) =>
|
|
197
|
-
onFileChange(files)
|
|
198
|
-
}
|
|
199
|
-
/>
|
|
200
|
-
</Tooltip>
|
|
201
|
-
<Tooltip el="div" text="Download">
|
|
202
|
-
{downloadImage || image !== undefined ? (
|
|
203
|
-
<Button
|
|
204
|
-
className="qa-settings-logo-download shadow-1-i bg-white-i"
|
|
205
|
-
disabled={image !== undefined}
|
|
206
|
-
onClick={downloadImage}
|
|
207
|
-
iconName="file_download"
|
|
208
|
-
outline
|
|
209
|
-
/>
|
|
210
|
-
) : (
|
|
211
|
-
<a
|
|
212
|
-
download={`logo.${imageUrl
|
|
213
|
-
.split('.')
|
|
214
|
-
.pop()}`}
|
|
215
|
-
rel="noreferrer"
|
|
216
|
-
target="_blank"
|
|
217
|
-
href={imageUrl}
|
|
218
|
-
>
|
|
219
|
-
<Button
|
|
220
|
-
className="qa-settings-logo-download shadow-1-i bg-white-i"
|
|
221
|
-
iconName="file_download"
|
|
222
|
-
outline
|
|
223
|
-
/>
|
|
224
|
-
</a>
|
|
225
|
-
)}
|
|
226
|
-
</Tooltip>
|
|
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
|
-
)}
|
|
237
|
-
</ButtonGroup>
|
|
238
|
-
</div>
|
|
239
|
-
</Card.Section>
|
|
240
|
-
</Card>
|
|
174
|
+
<LogoCard
|
|
175
|
+
imageUrl={imageUrl}
|
|
176
|
+
onFileChange={onFileChange}
|
|
177
|
+
image={image}
|
|
178
|
+
downloadImage={downloadImage}
|
|
179
|
+
deletable={deletable}
|
|
180
|
+
deleteImage={deleteImage}
|
|
181
|
+
/>
|
|
241
182
|
</Grid.Column>
|
|
242
183
|
</Grid>
|
|
184
|
+
) : (
|
|
185
|
+
<LogoCard
|
|
186
|
+
imageUrl={imageUrl}
|
|
187
|
+
onFileChange={onFileChange}
|
|
188
|
+
image={image}
|
|
189
|
+
downloadImage={downloadImage}
|
|
190
|
+
deletable={deletable}
|
|
191
|
+
deleteImage={deleteImage}
|
|
192
|
+
/>
|
|
243
193
|
)}
|
|
244
194
|
{recommendLargerImage && minDimensions && (imageUrl || image) && (
|
|
245
195
|
<Banner
|
|
@@ -256,5 +206,87 @@ export const LogoPicker: FC<LogoPickerProps> = observer(
|
|
|
256
206
|
)}
|
|
257
207
|
</div>
|
|
258
208
|
);
|
|
259
|
-
}
|
|
209
|
+
},
|
|
260
210
|
);
|
|
211
|
+
|
|
212
|
+
interface LogoCardProps {
|
|
213
|
+
imageUrl: string;
|
|
214
|
+
image?: File;
|
|
215
|
+
deletable?: boolean;
|
|
216
|
+
onFileChange(files: FileList | null): void;
|
|
217
|
+
downloadImage?(): void;
|
|
218
|
+
deleteImage(): void;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
const LogoCard: FC<LogoCardProps> = ({
|
|
222
|
+
imageUrl,
|
|
223
|
+
onFileChange,
|
|
224
|
+
image,
|
|
225
|
+
downloadImage,
|
|
226
|
+
deletable = true,
|
|
227
|
+
deleteImage,
|
|
228
|
+
}) => {
|
|
229
|
+
const fileRef = useRef<HTMLInputElement>(null);
|
|
230
|
+
const handleClick = () => fileRef.current?.click();
|
|
231
|
+
|
|
232
|
+
return (
|
|
233
|
+
<Card raised padding="none" className={Styles.logoCard}>
|
|
234
|
+
<Card.Section>
|
|
235
|
+
<img className="qa-settings-logo-image" src={imageUrl} alt="logo" />
|
|
236
|
+
<div className={Styles.logoAction}>
|
|
237
|
+
<ButtonGroup>
|
|
238
|
+
<Tooltip el="div" text="Replace">
|
|
239
|
+
<Button
|
|
240
|
+
outline
|
|
241
|
+
iconName="sync"
|
|
242
|
+
onClick={handleClick}
|
|
243
|
+
className="qa-settings-logo-replace shadow-1-i bg-white-i"
|
|
244
|
+
/>
|
|
245
|
+
<input
|
|
246
|
+
hidden
|
|
247
|
+
type="file"
|
|
248
|
+
accept="image/png, image/jpeg"
|
|
249
|
+
ref={fileRef}
|
|
250
|
+
onChange={({ currentTarget: { files } }) => onFileChange(files)}
|
|
251
|
+
/>
|
|
252
|
+
</Tooltip>
|
|
253
|
+
<Tooltip el="div" text="Download">
|
|
254
|
+
{downloadImage || image !== undefined ? (
|
|
255
|
+
<Button
|
|
256
|
+
className="qa-settings-logo-download shadow-1-i bg-white-i"
|
|
257
|
+
disabled={image !== undefined}
|
|
258
|
+
onClick={downloadImage}
|
|
259
|
+
iconName="file_download"
|
|
260
|
+
outline
|
|
261
|
+
/>
|
|
262
|
+
) : (
|
|
263
|
+
<a
|
|
264
|
+
download={`logo.${imageUrl.split('.').pop()}`}
|
|
265
|
+
rel="noreferrer"
|
|
266
|
+
target="_blank"
|
|
267
|
+
href={imageUrl}
|
|
268
|
+
>
|
|
269
|
+
<Button
|
|
270
|
+
className="qa-settings-logo-download shadow-1-i bg-white-i"
|
|
271
|
+
iconName="file_download"
|
|
272
|
+
outline
|
|
273
|
+
/>
|
|
274
|
+
</a>
|
|
275
|
+
)}
|
|
276
|
+
</Tooltip>
|
|
277
|
+
{deletable && (
|
|
278
|
+
<Tooltip el="div" text="Delete">
|
|
279
|
+
<Button
|
|
280
|
+
className="qa-settings-logo-delete shadow-1-i bg-white-i"
|
|
281
|
+
onClick={deleteImage}
|
|
282
|
+
iconName="delete"
|
|
283
|
+
outline
|
|
284
|
+
/>
|
|
285
|
+
</Tooltip>
|
|
286
|
+
)}
|
|
287
|
+
</ButtonGroup>
|
|
288
|
+
</div>
|
|
289
|
+
</Card.Section>
|
|
290
|
+
</Card>
|
|
291
|
+
);
|
|
292
|
+
};
|
|
@@ -106,7 +106,7 @@ export const OptOutMessage: FC<OptOutMessageProps> = observer(
|
|
|
106
106
|
<Form.Input
|
|
107
107
|
className={classnames(
|
|
108
108
|
Styles.buttonInput,
|
|
109
|
-
'm-b-3-i qa-opt-out-message-button-text'
|
|
109
|
+
'm-b-3-i qa-opt-out-message-button-text',
|
|
110
110
|
)}
|
|
111
111
|
value={buttonText.value}
|
|
112
112
|
onChange={buttonText.onChangeHandler}
|
|
@@ -153,5 +153,5 @@ export const OptOutMessage: FC<OptOutMessageProps> = observer(
|
|
|
153
153
|
<OptOutEmailPreview {...formState} open={isPreviewOpen} onClose={closePreview} />
|
|
154
154
|
</SettingsSection>
|
|
155
155
|
);
|
|
156
|
-
}
|
|
156
|
+
},
|
|
157
157
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { CheckboxFieldState, InputFieldState, TextAreaFieldState } from '@servicetitan/form';
|
|
2
|
-
import { injectable, provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
2
|
import { FormState } from 'formstate';
|
|
4
3
|
import { OptOutMessage as Component } from '.';
|
|
5
4
|
|
|
@@ -9,7 +8,6 @@ export default {
|
|
|
9
8
|
parameters: {},
|
|
10
9
|
};
|
|
11
10
|
|
|
12
|
-
@injectable()
|
|
13
11
|
class OptOutStore {
|
|
14
12
|
form = new FormState({
|
|
15
13
|
subjectLine: new InputFieldState('Good bye'),
|
|
@@ -22,10 +20,8 @@ class OptOutStore {
|
|
|
22
20
|
});
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
|
|
26
|
-
singletons: [OptOutStore],
|
|
27
|
-
})(() => {
|
|
28
|
-
const [store] = useDependencies(OptOutStore);
|
|
23
|
+
const store = new OptOutStore();
|
|
29
24
|
|
|
25
|
+
export const OptOutMessage = () => {
|
|
30
26
|
return <Component formState={store.form.$} />;
|
|
31
|
-
}
|
|
27
|
+
};
|
|
@@ -6,7 +6,7 @@ import { Text, Card, Layout, LayoutProps } from '@servicetitan/design-system';
|
|
|
6
6
|
|
|
7
7
|
export interface SectionProps {
|
|
8
8
|
title: ReactNode;
|
|
9
|
-
text?:
|
|
9
|
+
text?: ReactNode | string;
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
qaPrefix?: string;
|
|
12
12
|
className?: string;
|
|
@@ -24,10 +24,12 @@ export const SettingsSection: FC<SectionProps> = observer(
|
|
|
24
24
|
) : (
|
|
25
25
|
title
|
|
26
26
|
)}
|
|
27
|
-
{text
|
|
27
|
+
{typeof text === 'string' ? (
|
|
28
28
|
<Text size={2} subdued className={`${qaPrefix}-text`}>
|
|
29
29
|
{text}
|
|
30
30
|
</Text>
|
|
31
|
+
) : (
|
|
32
|
+
text
|
|
31
33
|
)}
|
|
32
34
|
</Layout.Section>
|
|
33
35
|
<Layout.Section>
|
|
@@ -36,5 +38,5 @@ export const SettingsSection: FC<SectionProps> = observer(
|
|
|
36
38
|
</Card>
|
|
37
39
|
</Layout.Section>
|
|
38
40
|
</Layout>
|
|
39
|
-
)
|
|
41
|
+
),
|
|
40
42
|
);
|