@servicetitan/mpa-components 1.8.0 → 1.9.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 +4 -0
- 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-email-footer/company-email-footer.stories.d.ts +1 -1
- 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-reply-to/company-email-reply-to.stories.d.ts +1 -1
- 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-sender/company-email-sender.stories.d.ts +2 -2
- 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-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 +2 -2
- 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 -1
- 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/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 +7 -6
- package/lib/components/settings/logo-picker/index.js.map +1 -1
- package/lib/components/settings/opt-out-message/opt-out-message.stories.d.ts +1 -1
- 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/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/package.json +2 -2
- package/src/components/settings/company-details/company-details-form.stories.tsx +18 -26
- package/src/components/settings/company-email-footer/company-email-footer.stories.tsx +3 -5
- package/src/components/settings/company-email-reply-to/company-email-reply-to.stories.tsx +4 -5
- package/src/components/settings/company-email-sender/company-email-sender.stories.tsx +6 -12
- package/src/components/settings/company-trades-picker/index.tsx +3 -1
- package/src/components/settings/double-opt-in/double-opt-in.stories.tsx +4 -7
- package/src/components/settings/logo-picker/index.tsx +102 -70
- package/src/components/settings/opt-out-message/opt-out-message.stories.tsx +3 -7
- package/src/components/settings/settings-section/index.tsx +4 -2
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -2,5 +2,5 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import classNames from 'classnames';
|
|
3
3
|
import { observer } from 'mobx-react';
|
|
4
4
|
import { Text, Card, Layout } from '@servicetitan/design-system';
|
|
5
|
-
export const SettingsSection = observer(({ title, text, children, qaPrefix, className = '', layout = 'support' }) => (_jsxs(Layout, Object.assign({ type: layout, direction: "left", className: classNames(qaPrefix, className) }, { children: [_jsxs(Layout.Section, { children: [typeof title === 'string' ? (_jsx(Text, Object.assign({ size: 3, bold: true, className: `${qaPrefix}-title` }, { children: title }))) : (title), text
|
|
5
|
+
export const SettingsSection = observer(({ title, text, children, qaPrefix, className = '', layout = 'support' }) => (_jsxs(Layout, Object.assign({ type: layout, direction: "left", className: classNames(qaPrefix, className) }, { children: [_jsxs(Layout.Section, { children: [typeof title === 'string' ? (_jsx(Text, Object.assign({ size: 3, bold: true, className: `${qaPrefix}-title` }, { children: title }))) : (title), typeof text === 'string' ? (_jsx(Text, Object.assign({ size: 2, subdued: true, className: `${qaPrefix}-text` }, { children: text }))) : (text)] }), _jsx(Layout.Section, { children: _jsx(Card, Object.assign({ raised: true }, { children: _jsx(Card.Section, Object.assign({ className: `${qaPrefix}-content` }, { children: children })) })) })] }))));
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/settings/settings-section/index.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAe,MAAM,6BAA6B,CAAC;AAW9E,MAAM,CAAC,MAAM,eAAe,GAAqB,QAAQ,CACrD,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,EAAgB,EAAE,EAAE,CAAC,CACvF,MAAC,MAAM,kBAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,iBAC7E,MAAC,MAAM,CAAC,OAAO,eACV,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CACzB,KAAC,IAAI,kBAAC,IAAI,EAAE,CAAC,EAAE,IAAI,QAAC,SAAS,EAAE,GAAG,QAAQ,QAAQ,gBAC7C,KAAK,IACH,CACV,CAAC,CAAC,CAAC,CACA,KAAK,CACR,EACA,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/settings/settings-section/index.tsx"],"names":[],"mappings":";AAAA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAe,MAAM,6BAA6B,CAAC;AAW9E,MAAM,CAAC,MAAM,eAAe,GAAqB,QAAQ,CACrD,CAAC,EAAE,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,SAAS,GAAG,EAAE,EAAE,MAAM,GAAG,SAAS,EAAgB,EAAE,EAAE,CAAC,CACvF,MAAC,MAAM,kBAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAC,MAAM,EAAC,SAAS,EAAE,UAAU,CAAC,QAAQ,EAAE,SAAS,CAAC,iBAC7E,MAAC,MAAM,CAAC,OAAO,eACV,OAAO,KAAK,KAAK,QAAQ,CAAC,CAAC,CAAC,CACzB,KAAC,IAAI,kBAAC,IAAI,EAAE,CAAC,EAAE,IAAI,QAAC,SAAS,EAAE,GAAG,QAAQ,QAAQ,gBAC7C,KAAK,IACH,CACV,CAAC,CAAC,CAAC,CACA,KAAK,CACR,EACA,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,CACxB,KAAC,IAAI,kBAAC,IAAI,EAAE,CAAC,EAAE,OAAO,QAAC,SAAS,EAAE,GAAG,QAAQ,OAAO,gBAC/C,IAAI,IACF,CACV,CAAC,CAAC,CAAC,CACA,IAAI,CACP,IACY,EACjB,KAAC,MAAM,CAAC,OAAO,cACX,KAAC,IAAI,kBAAC,MAAM,sBACR,KAAC,IAAI,CAAC,OAAO,kBAAC,SAAS,EAAE,GAAG,QAAQ,UAAU,gBAAG,QAAQ,IAAgB,IACtE,GACM,KACZ,CACZ,CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"repository": {
|
|
4
4
|
"url": "https://github.com/servicetitan/marketing"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.
|
|
6
|
+
"version": "1.9.0",
|
|
7
7
|
"description": "",
|
|
8
8
|
"main": "./lib/index.js",
|
|
9
9
|
"typings": "./lib/index.d.ts",
|
|
@@ -30,5 +30,5 @@
|
|
|
30
30
|
"cli": {
|
|
31
31
|
"webpack": false
|
|
32
32
|
},
|
|
33
|
-
"gitHead": "
|
|
33
|
+
"gitHead": "f962c4d0df9cf9d0e724d910d437450d5bf541fa"
|
|
34
34
|
}
|
|
@@ -1,50 +1,42 @@
|
|
|
1
1
|
import { InputFieldState } from '@servicetitan/form';
|
|
2
|
-
import { injectable, provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
2
|
import { FormState } from 'formstate';
|
|
4
3
|
|
|
5
4
|
import { CompanyDetails as Component } from '.';
|
|
6
5
|
import { LogoPicker } from '../logo-picker/logo-picker.stories';
|
|
7
6
|
import omit from 'lodash/omit';
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
yearEstablished: new InputFieldState(1999),
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export const CompanyDetailsWithoutWebsite = provide({ singletons: [DetailsStore] })(() => {
|
|
26
|
-
const [store] = useDependencies(DetailsStore);
|
|
8
|
+
const form = new FormState({
|
|
9
|
+
companyName: new InputFieldState('Acme Inc'),
|
|
10
|
+
tagline: new InputFieldState('Ayo! The Acme rules'),
|
|
11
|
+
street: new InputFieldState('Backed st.'),
|
|
12
|
+
unit: new InputFieldState('123'),
|
|
13
|
+
city: new InputFieldState('Glendale'),
|
|
14
|
+
state: new InputFieldState('CA'),
|
|
15
|
+
zipCode: new InputFieldState('91203'),
|
|
16
|
+
companyEmail: new InputFieldState('info@acme.com'),
|
|
17
|
+
companyWebsite: new InputFieldState('www.acme.com'),
|
|
18
|
+
yearEstablished: new InputFieldState(1999),
|
|
19
|
+
});
|
|
27
20
|
|
|
21
|
+
export const CompanyDetailsWithoutWebsite = () => {
|
|
28
22
|
return (
|
|
29
23
|
<Component
|
|
30
|
-
formState={omit(
|
|
24
|
+
formState={omit(form.$, ['companyWebsite'])}
|
|
31
25
|
logoPicker={<LogoPicker />}
|
|
32
26
|
handleCompanyEmailBlur={() => alert('company email blurred')}
|
|
33
27
|
/>
|
|
34
28
|
);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export const CompanyDetails = provide({ singletons: [DetailsStore] })(() => {
|
|
38
|
-
const [store] = useDependencies(DetailsStore);
|
|
29
|
+
};
|
|
39
30
|
|
|
31
|
+
export const CompanyDetails = () => {
|
|
40
32
|
return (
|
|
41
33
|
<Component
|
|
42
|
-
formState={
|
|
34
|
+
formState={form.$}
|
|
43
35
|
logoPicker={<LogoPicker />}
|
|
44
36
|
handleCompanyEmailBlur={() => alert('company email blurred')}
|
|
45
37
|
/>
|
|
46
38
|
);
|
|
47
|
-
}
|
|
39
|
+
};
|
|
48
40
|
|
|
49
41
|
export default {
|
|
50
42
|
title: 'MPA Components/settings/CompanyDetails',
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InputFieldState, TextAreaFieldState } from '@servicetitan/form';
|
|
2
|
-
import { injectable, provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
2
|
import { FormState } from 'formstate';
|
|
4
3
|
|
|
5
4
|
import { CompanyEmailFooter as Component } from '.';
|
|
@@ -10,7 +9,6 @@ export default {
|
|
|
10
9
|
parameters: {},
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
@injectable()
|
|
14
12
|
class CompanyEmailStore {
|
|
15
13
|
form = new FormState({
|
|
16
14
|
legalCopy: new TextAreaFieldState('Legal copy example'),
|
|
@@ -19,8 +17,8 @@ class CompanyEmailStore {
|
|
|
19
17
|
});
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
const [store] = useDependencies(CompanyEmailStore);
|
|
20
|
+
const store = new CompanyEmailStore();
|
|
24
21
|
|
|
22
|
+
export const CompanyEmailFooter = () => {
|
|
25
23
|
return <Component formState={store.form.$} />;
|
|
26
|
-
}
|
|
24
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InputFieldState } from '@servicetitan/form';
|
|
2
|
-
import { injectable, provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
2
|
import { FormState } from 'formstate';
|
|
4
3
|
|
|
5
4
|
import { CompanyEmailReplyTo as Component } from '.';
|
|
@@ -10,14 +9,14 @@ export default {
|
|
|
10
9
|
parameters: {},
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
@injectable()
|
|
14
12
|
class CompanyEmailReplyToStore {
|
|
15
13
|
form = new FormState({
|
|
16
14
|
replyToEmail: new InputFieldState('info@acme.com'),
|
|
17
15
|
});
|
|
18
16
|
}
|
|
19
17
|
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
const store = new CompanyEmailReplyToStore();
|
|
19
|
+
|
|
20
|
+
export const CompanyEmailReplyTo = () => {
|
|
22
21
|
return <Component replyToEmail={store.form.$.replyToEmail} />;
|
|
23
|
-
}
|
|
22
|
+
};
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { InputFieldState } from '@servicetitan/form';
|
|
2
|
-
import { injectable, provide, useDependencies } from '@servicetitan/react-ioc';
|
|
3
2
|
import { FormState } from 'formstate';
|
|
4
3
|
|
|
5
4
|
import { CompanyEmailSender as Simple, CompanyEmailSenderCustomDomain as Custom } from '.';
|
|
@@ -10,7 +9,6 @@ export default {
|
|
|
10
9
|
parameters: {},
|
|
11
10
|
};
|
|
12
11
|
|
|
13
|
-
@injectable()
|
|
14
12
|
class CompanyEmailSenderStore {
|
|
15
13
|
form = new FormState({
|
|
16
14
|
senderEmail: new InputFieldState('email@acme.com'),
|
|
@@ -19,16 +17,12 @@ class CompanyEmailSenderStore {
|
|
|
19
17
|
});
|
|
20
18
|
}
|
|
21
19
|
|
|
22
|
-
|
|
23
|
-
() => {
|
|
24
|
-
const [store] = useDependencies(CompanyEmailSenderStore);
|
|
20
|
+
const store = new CompanyEmailSenderStore();
|
|
25
21
|
|
|
26
|
-
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
export const CompanyEmailSender = provide({ singletons: [CompanyEmailSenderStore] })(() => {
|
|
31
|
-
const [store] = useDependencies(CompanyEmailSenderStore);
|
|
22
|
+
export const CompanyEmailSenderCustomDomain = () => {
|
|
23
|
+
return <Custom formState={store.form.$} senderTld="tld.com" />;
|
|
24
|
+
};
|
|
32
25
|
|
|
26
|
+
export const CompanyEmailSender = () => {
|
|
33
27
|
return <Simple senderName={store.form.$.senderName} senderEmail={store.form.$.senderEmail} />;
|
|
34
|
-
}
|
|
28
|
+
};
|
|
@@ -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,6 +36,7 @@ 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}` })),
|
|
@@ -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
|
+
};
|
|
@@ -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) {
|
|
@@ -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
|
|
@@ -258,3 +208,85 @@ export const LogoPicker: FC<LogoPickerProps> = observer(
|
|
|
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
|
+
};
|
|
@@ -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>
|