@servicetitan/mpa-components 0.5.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 +28 -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/result-definitions-modal/row.js +3 -3
- package/lib/components/settings/result-definitions-modal/row.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 +7 -6
- 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/result-definitions-modal/row.tsx +3 -3
- package/src/components/settings/settings-section/index.tsx +12 -7
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
2
|
import { CheckboxFieldState, InputFieldState, TextAreaFieldState } from '@servicetitan/form';
|
|
3
|
+
import { LayoutProps } from '@servicetitan/design-system';
|
|
3
4
|
export interface OptOutMessageState {
|
|
4
5
|
subjectLine: InputFieldState<string | undefined>;
|
|
5
6
|
header: InputFieldState<string | undefined>;
|
|
@@ -11,6 +12,8 @@ export interface OptOutMessageState {
|
|
|
11
12
|
}
|
|
12
13
|
export interface OptOutMessageProps {
|
|
13
14
|
formState: OptOutMessageState;
|
|
15
|
+
layout?: LayoutProps['type'];
|
|
16
|
+
className?: string;
|
|
14
17
|
onHandleClickEnable?(checked: boolean): void;
|
|
15
18
|
}
|
|
16
19
|
export declare const OptOutMessage: FC<OptOutMessageProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/settings/opt-out-message/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAmC,MAAM,OAAO,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/settings/opt-out-message/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,EAAE,EAAmC,MAAM,OAAO,CAAC;AAG5D,OAAO,EAAE,kBAAkB,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAgB,WAAW,EAA6B,MAAM,6BAA6B,CAAC;AAQnG,MAAM,WAAW,kBAAkB;IAC/B,WAAW,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,MAAM,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC5C,IAAI,EAAE,kBAAkB,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAC7C,UAAU,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IAChD,WAAW,EAAE,eAAe,CAAC,MAAM,GAAG,SAAS,CAAC,CAAC;IACjD,OAAO,EAAE,kBAAkB,CAAC;IAC5B,sBAAsB,EAAE,kBAAkB,CAAC;CAC9C;AACD,MAAM,WAAW,kBAAkB;IAC/B,SAAS,EAAE,kBAAkB,CAAC;IAC9B,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,mBAAmB,CAAC,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;CAChD;AAED,eAAO,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CA+HhD,CAAC"}
|
|
@@ -7,7 +7,7 @@ import { useConfirm } from '@servicetitan/confirm';
|
|
|
7
7
|
import { SettingsSection } from '../settings-section';
|
|
8
8
|
import { OptOutEmailPreview } from '../email-preview/opt-out-email-preview';
|
|
9
9
|
import * as Styles from './opt-out-message.module.less';
|
|
10
|
-
export const OptOutMessage = observer(({ onHandleClickEnable, formState }) => {
|
|
10
|
+
export const OptOutMessage = observer(({ onHandleClickEnable, formState, layout, className }) => {
|
|
11
11
|
const { subjectLine, header, body, buttonText, monthsLimit, enabled, autoSuppressionEnabled, } = formState;
|
|
12
12
|
const [isPreviewOpen, setIsPreviewOpen] = useState(false);
|
|
13
13
|
const openPreview = useCallback(() => setIsPreviewOpen(true), [setIsPreviewOpen]);
|
|
@@ -17,6 +17,6 @@ export const OptOutMessage = observer(({ onHandleClickEnable, formState }) => {
|
|
|
17
17
|
enabled.onChange(checked);
|
|
18
18
|
};
|
|
19
19
|
const [Confirm, handleConfirmed] = useConfirm(handleClickEnable);
|
|
20
|
-
return (_jsxs(SettingsSection, Object.assign({ className: Styles.outOutMessage, qaPrefix: "qa-opt-out-message", title: "Opt-Out Message", text: _jsxs(Fragment, { children: [_jsxs("div", { children: ["If customers haven\u2019t ", _jsx("b", { children: "opened" }, void 0), " one of your emails in a set time frame, you can send an opt-out message to allow them to set their email preferences."] }, void 0), _jsx(ToggleSwitch, { label: "Enable", onChange: handleConfirmed, checked: enabled.value, className: "m-t-2 qa-opt-out-message-enable" }, void 0)] }, void 0) }, { children: [_jsx(Text, Object.assign({ bold: true, className: "m-b-2" }, { children: "Opt-Out Email Content" }), void 0), _jsxs(Form, Object.assign({ className: "m-b-0-i" }, { children: [_jsx(Form.Input, { className: "m-b-2-i qa-opt-out-message-subject-line", value: subjectLine.value, onChange: subjectLine.onChangeHandler, error: subjectLine.hasError, label: "Subject Line", fluid: true, disabled: !enabled.value }, void 0), _jsx(Form.Input, { className: "m-b-2-i qa-opt-out-message-header", value: header.value, onChange: header.onChangeHandler, error: header.hasError, label: "Header", fluid: true, disabled: !enabled.value }, void 0), _jsx(Form.TextArea, { className: "m-b-2-i qa-opt-out-message-body-copy", label: "Body Copy", value: body.value, onChange: body.onChangeHandler, error: body.hasError, rows: 2, disabled: !enabled.value }, void 0), _jsx(Form.Input, { className: classnames(Styles.buttonInput, 'm-b-3-i qa-opt-out-message-button-text'), value: buttonText.value, onChange: buttonText.onChangeHandler, error: buttonText.hasError, label: "Button Text", disabled: !enabled.value }, void 0), _jsx(Button, Object.assign({ className: "qa-opt-out-message-preview-email", primary: true, onClick: openPreview, outline: true, small: true, disabled: !enabled.value }, { children: "Preview Email" }), void 0), _jsx("hr", {}, void 0)] }), void 0), _jsxs(Stack, Object.assign({ alignItems: "center", wrap: "wrap" }, { children: [_jsx(Text, Object.assign({ className: "m-b-1" }, { children: "Send when a recipient hasn\u2019t opened an email in" }), void 0), _jsx(Form.Input, { className: classnames(Styles.input, 'qa-opt-out-message-months', 'm-b-0'), value: monthsLimit.value, onChange: monthsLimit.onChangeHandler, error: monthsLimit.hasError, disabled: !enabled.value }, void 0), _jsx(Text, Object.assign({ className: "m-b-1" }, { children: "months." }), void 0)] }), void 0), _jsx(Form.Checkbox, { className: classnames('m-t-2-i', 'qa-opt-out-message-auto-suppress'), checked: autoSuppressionEnabled.value, onChange: autoSuppressionEnabled.onChangeHandler, disabled: !enabled.value, label: "Auto-suppress dormant emails" }, void 0), _jsx(Confirm, { title: "Disable Opt-Out Messaging", message: "Opt-Out messaging helps you keep dormant emails out of your audiences. Disabling it could potentially lead to worse email performance. Are you sure?", when: enabled.value }, void 0), _jsx(OptOutEmailPreview, Object.assign({}, formState, { open: isPreviewOpen, onClose: closePreview }), void 0)] }), void 0));
|
|
20
|
+
return (_jsxs(SettingsSection, Object.assign({ layout: layout, className: classnames(Styles.outOutMessage, className), qaPrefix: "qa-opt-out-message", title: "Opt-Out Message", text: _jsxs(Fragment, { children: [_jsxs("div", { children: ["If customers haven\u2019t ", _jsx("b", { children: "opened" }, void 0), " one of your emails in a set time frame, you can send an opt-out message to allow them to set their email preferences."] }, void 0), _jsx(ToggleSwitch, { label: "Enable", onChange: handleConfirmed, checked: enabled.value, className: "m-t-2 qa-opt-out-message-enable" }, void 0)] }, void 0) }, { children: [_jsx(Text, Object.assign({ bold: true, className: "m-b-2" }, { children: "Opt-Out Email Content" }), void 0), _jsxs(Form, Object.assign({ className: "m-b-0-i" }, { children: [_jsx(Form.Input, { className: "m-b-2-i qa-opt-out-message-subject-line", value: subjectLine.value, onChange: subjectLine.onChangeHandler, error: subjectLine.hasError, label: "Subject Line", fluid: true, disabled: !enabled.value }, void 0), _jsx(Form.Input, { className: "m-b-2-i qa-opt-out-message-header", value: header.value, onChange: header.onChangeHandler, error: header.hasError, label: "Header", fluid: true, disabled: !enabled.value }, void 0), _jsx(Form.TextArea, { className: "m-b-2-i qa-opt-out-message-body-copy", label: "Body Copy", value: body.value, onChange: body.onChangeHandler, error: body.hasError, rows: 2, disabled: !enabled.value }, void 0), _jsx(Form.Input, { className: classnames(Styles.buttonInput, 'm-b-3-i qa-opt-out-message-button-text'), value: buttonText.value, onChange: buttonText.onChangeHandler, error: buttonText.hasError, label: "Button Text", disabled: !enabled.value }, void 0), _jsx(Button, Object.assign({ className: "qa-opt-out-message-preview-email", primary: true, onClick: openPreview, outline: true, small: true, disabled: !enabled.value }, { children: "Preview Email" }), void 0), _jsx("hr", {}, void 0)] }), void 0), _jsxs(Stack, Object.assign({ alignItems: "center", wrap: "wrap" }, { children: [_jsx(Text, Object.assign({ className: "m-b-1" }, { children: "Send when a recipient hasn\u2019t opened an email in" }), void 0), _jsx(Form.Input, { className: classnames(Styles.input, 'qa-opt-out-message-months', 'm-b-0'), value: monthsLimit.value, onChange: monthsLimit.onChangeHandler, error: monthsLimit.hasError, disabled: !enabled.value }, void 0), _jsx(Text, Object.assign({ className: "m-b-1" }, { children: "months." }), void 0)] }), void 0), _jsx(Form.Checkbox, { className: classnames('m-t-2-i', 'qa-opt-out-message-auto-suppress'), checked: autoSuppressionEnabled.value, onChange: autoSuppressionEnabled.onChangeHandler, disabled: !enabled.value, label: "Auto-suppress dormant emails" }, void 0), _jsx(Confirm, { title: "Disable Opt-Out Messaging", message: "Opt-Out messaging helps you keep dormant emails out of your audiences. Disabling it could potentially lead to worse email performance. Are you sure?", when: enabled.value }, void 0), _jsx(OptOutEmailPreview, Object.assign({}, formState, { open: isPreviewOpen, onClose: closePreview }), void 0)] }), void 0));
|
|
21
21
|
});
|
|
22
22
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/settings/opt-out-message/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAM,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,IAAI,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/settings/opt-out-message/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAM,QAAQ,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5D,OAAO,UAAU,MAAM,YAAY,CAAC;AAGpC,OAAO,EAAE,MAAM,EAAE,IAAI,EAAe,KAAK,EAAE,IAAI,EA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;AACN,CAAC,CACJ,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Grid, Text, Tag } from '@servicetitan/design-system';
|
|
3
|
-
import tokens from '@servicetitan/tokens';
|
|
3
|
+
import { core as tokens } from '@servicetitan/tokens';
|
|
4
4
|
export var RiskType;
|
|
5
5
|
(function (RiskType) {
|
|
6
6
|
RiskType[RiskType["Medium"] = 0] = "Medium";
|
|
@@ -9,8 +9,8 @@ export var RiskType;
|
|
|
9
9
|
})(RiskType || (RiskType = {}));
|
|
10
10
|
const riskTypeToColor = new Map([
|
|
11
11
|
[RiskType.Medium, 'warning'],
|
|
12
|
-
[RiskType.High, tokens.colorRed500],
|
|
13
|
-
[RiskType.VeryHigh, tokens.colorRed600],
|
|
12
|
+
[RiskType.High, tokens.default.tokens.colorRed500],
|
|
13
|
+
[RiskType.VeryHigh, tokens.default.tokens.colorRed600],
|
|
14
14
|
]);
|
|
15
15
|
const riskTypeToText = new Map([
|
|
16
16
|
[RiskType.Medium, 'Medium'],
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"row.js","sourceRoot":"","sources":["../../../../src/components/settings/result-definitions-modal/row.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,MAAM,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"row.js","sourceRoot":"","sources":["../../../../src/components/settings/result-definitions-modal/row.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,GAAG,EAAE,MAAM,6BAA6B,CAAC;AAC9D,OAAO,EAAE,IAAI,IAAI,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAEtD,MAAM,CAAN,IAAY,QAIX;AAJD,WAAY,QAAQ;IAChB,2CAAM,CAAA;IACN,uCAAI,CAAA;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
|
|
2
3
|
export interface SectionProps {
|
|
3
|
-
title:
|
|
4
|
+
title: ReactNode;
|
|
4
5
|
text?: JSX.Element | string;
|
|
5
6
|
children: ReactNode;
|
|
6
7
|
qaPrefix?: string;
|
|
7
8
|
className?: string;
|
|
9
|
+
layout?: LayoutProps['type'];
|
|
8
10
|
}
|
|
9
11
|
export declare const SettingsSection: FC<SectionProps>;
|
|
10
12
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/settings/settings-section/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/settings/settings-section/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,SAAS,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAGtC,OAAO,EAAsB,WAAW,EAAE,MAAM,6BAA6B,CAAC;AAE9E,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IAC5B,QAAQ,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,YAAY,CAwB5C,CAAC"}
|
|
@@ -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 = '' }) => (_jsxs(Layout, Object.assign({ type:
|
|
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 }), void 0)) : (title), text && (_jsx(Text, Object.assign({ size: 2, subdued: true, className: `${qaPrefix}-text` }, { children: text }), void 0))] }, void 0), _jsx(Layout.Section, { children: _jsx(Card, Object.assign({ raised: true }, { children: _jsx(Card.Section, Object.assign({ className: `${qaPrefix}-content` }, { children: children }), void 0) }), void 0) }, void 0)] }), void 0)));
|
|
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,
|
|
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,YACH,CACV,CAAC,CAAC,CAAC,CACA,KAAK,CACR,EACA,IAAI,IAAI,CACL,KAAC,IAAI,kBAAC,IAAI,EAAE,CAAC,EAAE,OAAO,QAAC,SAAS,EAAE,GAAG,QAAQ,OAAO,gBAC/C,IAAI,YACF,CACV,YACY,EACjB,KAAC,MAAM,CAAC,OAAO,cACX,KAAC,IAAI,kBAAC,MAAM,sBACR,KAAC,IAAI,CAAC,OAAO,kBAAC,SAAS,EAAE,GAAG,QAAQ,UAAU,gBAAG,QAAQ,YAAgB,YACtE,WACM,aACZ,CACZ,CACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/mpa-components",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "./lib/index.js",
|
|
6
6
|
"typings": "./lib/index.d.ts",
|
|
7
7
|
"peerDependencies": {
|
|
8
8
|
"@servicetitan/confirm": "~21.4.1",
|
|
9
|
-
"@servicetitan/design-system": "~
|
|
10
|
-
"@servicetitan/form": "~
|
|
11
|
-
"@servicetitan/
|
|
12
|
-
"@servicetitan/
|
|
9
|
+
"@servicetitan/design-system": "~12.2.1",
|
|
10
|
+
"@servicetitan/form": "~22.4.4",
|
|
11
|
+
"@servicetitan/form-state": "~22.4.4",
|
|
12
|
+
"@servicetitan/react-ioc": "~21.10.0",
|
|
13
|
+
"@servicetitan/tokens": "~12.1.11",
|
|
13
14
|
"formstate": "~2.0.0",
|
|
14
15
|
"mobx": "~6.3.2",
|
|
15
16
|
"mobx-react": "~7.2.0",
|
|
@@ -26,5 +27,5 @@
|
|
|
26
27
|
"cli": {
|
|
27
28
|
"webpack": false
|
|
28
29
|
},
|
|
29
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "2a0735437f422320f08367221482e8df6f4c3e77"
|
|
30
31
|
}
|
|
@@ -2,7 +2,7 @@ import { FC, Fragment, ReactNode } from 'react';
|
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
import { FieldState } from 'formstate';
|
|
4
4
|
|
|
5
|
-
import { Form, Link } from '@servicetitan/design-system';
|
|
5
|
+
import { Form, LayoutProps, Link } from '@servicetitan/design-system';
|
|
6
6
|
import { NumberInput, InputFieldState } from '@servicetitan/form';
|
|
7
7
|
|
|
8
8
|
import { SettingsSection } from '../settings-section';
|
|
@@ -20,15 +20,21 @@ export interface CompanyDetailsProps {
|
|
|
20
20
|
};
|
|
21
21
|
logoPicker?: ReactNode;
|
|
22
22
|
sectionDescription?: string | JSX.Element;
|
|
23
|
+
layout?: LayoutProps['type'];
|
|
24
|
+
className?: string;
|
|
25
|
+
title?: ReactNode;
|
|
23
26
|
handleCompanyEmailBlur?: () => void;
|
|
24
27
|
}
|
|
25
28
|
|
|
29
|
+
export const MERGE_TAGS_DOCUMENTATION_LINK =
|
|
30
|
+
'https://help.servicetitan.com/Content/Marketing/merge-tags.htm';
|
|
31
|
+
|
|
26
32
|
const DEFAULT_SECTION_DESCRIPTION = (
|
|
27
33
|
<Fragment>
|
|
28
34
|
Enter these details as you would like them to appear in your campaign. Much of this info can
|
|
29
35
|
be utilized as
|
|
30
36
|
<Link
|
|
31
|
-
href=
|
|
37
|
+
href={MERGE_TAGS_DOCUMENTATION_LINK}
|
|
32
38
|
target="_blank"
|
|
33
39
|
primary
|
|
34
40
|
className="qa-settings-company-details-merge-tags"
|
|
@@ -45,11 +51,16 @@ export const CompanyDetails: FC<CompanyDetailsProps> = observer(
|
|
|
45
51
|
logoPicker,
|
|
46
52
|
sectionDescription = DEFAULT_SECTION_DESCRIPTION,
|
|
47
53
|
handleCompanyEmailBlur = () => {},
|
|
54
|
+
layout,
|
|
55
|
+
className = '',
|
|
56
|
+
title = 'Company Details',
|
|
48
57
|
}: CompanyDetailsProps) => {
|
|
49
58
|
return (
|
|
50
59
|
<SettingsSection
|
|
60
|
+
className={className}
|
|
61
|
+
layout={layout}
|
|
51
62
|
qaPrefix="qa-settings-company-details"
|
|
52
|
-
title=
|
|
63
|
+
title={title}
|
|
53
64
|
text={sectionDescription}
|
|
54
65
|
>
|
|
55
66
|
<Form className="m-b-0-i">
|
|
@@ -117,7 +128,7 @@ export const CompanyDetails: FC<CompanyDetailsProps> = observer(
|
|
|
117
128
|
label="Zip Code"
|
|
118
129
|
placeholder="91203"
|
|
119
130
|
fluid
|
|
120
|
-
maxLength={
|
|
131
|
+
maxLength={10}
|
|
121
132
|
/>
|
|
122
133
|
</Form.Group>
|
|
123
134
|
<Form.Group className="m-b-2-i">
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FC, Fragment } from 'react';
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
|
|
4
|
-
import { Form, Text } from '@servicetitan/design-system';
|
|
4
|
+
import { Form, LayoutProps, Text } from '@servicetitan/design-system';
|
|
5
5
|
import { InputFieldState, TextAreaFieldState } from '@servicetitan/form';
|
|
6
6
|
|
|
7
7
|
import { SettingsSection } from '../settings-section';
|
|
@@ -12,12 +12,16 @@ export interface CompanyEmailFooterProps {
|
|
|
12
12
|
license: InputFieldState<string | undefined>;
|
|
13
13
|
copyrightText: InputFieldState<string | undefined>;
|
|
14
14
|
};
|
|
15
|
+
layout?: LayoutProps['type'];
|
|
16
|
+
className?: string;
|
|
15
17
|
}
|
|
16
18
|
|
|
17
19
|
export const CompanyEmailFooter: FC<CompanyEmailFooterProps> = observer(
|
|
18
|
-
({ formState: { legalCopy, license, copyrightText } }) => {
|
|
20
|
+
({ formState: { legalCopy, license, copyrightText }, layout, className }) => {
|
|
19
21
|
return (
|
|
20
22
|
<SettingsSection
|
|
23
|
+
className={className}
|
|
24
|
+
layout={layout}
|
|
21
25
|
title="Footer"
|
|
22
26
|
text={`Your footer will be partially generated from the Company Details section above.
|
|
23
27
|
Please enter the additional info so that it is CAN-SPAM compliant.`}
|
|
@@ -2,37 +2,43 @@ import { FC, useCallback } from 'react';
|
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
|
|
4
4
|
import { InputFieldState } from '@servicetitan/form';
|
|
5
|
-
import { Form } from '@servicetitan/design-system';
|
|
5
|
+
import { Form, LayoutProps } from '@servicetitan/design-system';
|
|
6
6
|
|
|
7
7
|
import { SettingsSection } from '../settings-section';
|
|
8
8
|
|
|
9
9
|
export interface CompanyEmailReplyToProps {
|
|
10
10
|
replyToEmail: InputFieldState<string | undefined>;
|
|
11
|
+
layout?: LayoutProps['type'];
|
|
12
|
+
className?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
|
-
export const CompanyEmailReplyTo: FC<CompanyEmailReplyToProps> = observer(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
15
|
+
export const CompanyEmailReplyTo: FC<CompanyEmailReplyToProps> = observer(
|
|
16
|
+
({ replyToEmail, layout, className }) => {
|
|
17
|
+
const handleReplyToBlur = useCallback(() => {
|
|
18
|
+
replyToEmail.validate();
|
|
19
|
+
}, [replyToEmail]);
|
|
17
20
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
21
|
+
return (
|
|
22
|
+
<SettingsSection
|
|
23
|
+
layout={layout}
|
|
24
|
+
className={className}
|
|
25
|
+
title="Reply-To"
|
|
26
|
+
text="This is where emails will be sent if someone replies to one of your emails."
|
|
27
|
+
qaPrefix="qa-settings-reply-to"
|
|
28
|
+
>
|
|
29
|
+
<Form className="m-b-0-i">
|
|
30
|
+
<Form.Input
|
|
31
|
+
className="m-b-0-i qa-settings-reply-to-email-address"
|
|
32
|
+
value={replyToEmail.value}
|
|
33
|
+
onChange={replyToEmail.onChangeHandler}
|
|
34
|
+
error={replyToEmail.hasError}
|
|
35
|
+
onBlur={handleReplyToBlur}
|
|
36
|
+
label="Reply-to Email Address"
|
|
37
|
+
placeholder="info@yourcompany.com"
|
|
38
|
+
fluid
|
|
39
|
+
/>
|
|
40
|
+
</Form>
|
|
41
|
+
</SettingsSection>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SyntheticEvent, Fragment, useCallback, FC } from 'react';
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
|
|
4
|
-
import { Form, Text } from '@servicetitan/design-system';
|
|
4
|
+
import { Form, LayoutProps, Text } from '@servicetitan/design-system';
|
|
5
5
|
import { InputFieldState } from '@servicetitan/form';
|
|
6
6
|
|
|
7
7
|
import { SettingsSection } from '../settings-section';
|
|
@@ -17,10 +17,12 @@ export interface CompanyEmailSenderProps {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
senderTld: string;
|
|
20
|
+
layout?: LayoutProps['type'];
|
|
21
|
+
className?: string;
|
|
20
22
|
}
|
|
21
23
|
|
|
22
24
|
export const CompanyEmailSender: FC<CompanyEmailSenderProps> = observer(
|
|
23
|
-
({ formState: { senderDomain, senderName, senderEmail }, senderTld }) => {
|
|
25
|
+
({ formState: { senderDomain, senderName, senderEmail }, senderTld, layout, className }) => {
|
|
24
26
|
const handleSenderNameChange = useCallback(
|
|
25
27
|
(_0: SyntheticEvent<HTMLInputElement>, data: { value: string }) => {
|
|
26
28
|
if (data.value.length > 80) {
|
|
@@ -56,6 +58,8 @@ export const CompanyEmailSender: FC<CompanyEmailSenderProps> = observer(
|
|
|
56
58
|
|
|
57
59
|
return (
|
|
58
60
|
<SettingsSection
|
|
61
|
+
className={className}
|
|
62
|
+
layout={layout}
|
|
59
63
|
title="Sender"
|
|
60
64
|
text="Configure sender name and email."
|
|
61
65
|
qaPrefix="qa-settings-sender"
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { SyntheticEvent, Fragment, useCallback, FC } from 'react';
|
|
2
2
|
import { observer } from 'mobx-react';
|
|
3
3
|
|
|
4
|
-
import { Form, Text } from '@servicetitan/design-system';
|
|
4
|
+
import { Form, LayoutProps, Text } from '@servicetitan/design-system';
|
|
5
5
|
import { InputFieldState } from '@servicetitan/form';
|
|
6
6
|
import { SettingsSection } from '../settings-section';
|
|
7
7
|
|
|
8
8
|
export interface CompanyEmailSender {
|
|
9
9
|
senderName: InputFieldState<string | undefined>;
|
|
10
10
|
senderEmail: InputFieldState<string | undefined>;
|
|
11
|
+
layout?: LayoutProps['type'];
|
|
12
|
+
className?: string;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
export const CompanyEmailSender: FC<CompanyEmailSender> = observer(
|
|
14
|
-
({ senderName, senderEmail }) => {
|
|
16
|
+
({ senderName, senderEmail, layout, className }) => {
|
|
15
17
|
const handleSenderNameChange = useCallback(
|
|
16
18
|
(_0: SyntheticEvent<HTMLInputElement, Event>, data: { value: string }) => {
|
|
17
19
|
if (data.value.length > 80) {
|
|
@@ -29,6 +31,8 @@ export const CompanyEmailSender: FC<CompanyEmailSender> = observer(
|
|
|
29
31
|
|
|
30
32
|
return (
|
|
31
33
|
<SettingsSection
|
|
34
|
+
layout={layout}
|
|
35
|
+
className={className}
|
|
32
36
|
title="Sender"
|
|
33
37
|
text="Configure sender name and email."
|
|
34
38
|
qaPrefix="qa-settings-sender"
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
1
|
+
import { ReactNode, useMemo } from 'react';
|
|
2
2
|
import chunk from 'lodash/chunk';
|
|
3
3
|
|
|
4
|
-
import { Grid, Text } from '@servicetitan/design-system';
|
|
4
|
+
import { Grid, GridColumnsCount, LayoutProps, Text } from '@servicetitan/design-system';
|
|
5
5
|
|
|
6
6
|
import { SettingsSection } from '../settings-section';
|
|
7
7
|
import { CompanyTradeCheckbox } from '../company-trade-checkbox';
|
|
@@ -21,31 +21,41 @@ export interface Trade<TradeType extends string | number> {
|
|
|
21
21
|
|
|
22
22
|
export interface CompanyTradesPickerProps<TradeType extends string | number = string> {
|
|
23
23
|
trades: Trade<TradeType>[];
|
|
24
|
+
layout?: LayoutProps['type'];
|
|
25
|
+
className?: string;
|
|
26
|
+
title?: ReactNode;
|
|
27
|
+
columns?: number;
|
|
24
28
|
onTradeChange(t?: TradeType): void;
|
|
25
29
|
}
|
|
26
30
|
|
|
27
31
|
export function CompanyTradesPicker<T extends string | number = string>({
|
|
28
32
|
trades,
|
|
29
33
|
onTradeChange,
|
|
34
|
+
layout,
|
|
35
|
+
className,
|
|
36
|
+
columns = 4,
|
|
37
|
+
title = 'Select Your Trades',
|
|
30
38
|
}: CompanyTradesPickerProps<T>) {
|
|
31
39
|
const rows = useMemo(
|
|
32
|
-
() => chunk(trades,
|
|
33
|
-
[trades]
|
|
40
|
+
() => chunk(trades, columns).map((row, idx) => ({ row, key: `row=${idx}` })),
|
|
41
|
+
[trades, columns]
|
|
34
42
|
);
|
|
35
43
|
|
|
36
44
|
return (
|
|
37
45
|
<SettingsSection
|
|
46
|
+
className={className}
|
|
47
|
+
layout={layout}
|
|
48
|
+
title={title}
|
|
38
49
|
qaPrefix="qa-settings-select-your-trades"
|
|
39
|
-
title="Select Your Trades"
|
|
40
50
|
text="Choose which trades describe your business so we can give you relevant content and merge tags."
|
|
41
51
|
>
|
|
42
|
-
<Grid columns={
|
|
52
|
+
<Grid columns={columns as GridColumnsCount}>
|
|
43
53
|
{rows.map(({ row, key }) => {
|
|
44
54
|
return (
|
|
45
55
|
<Grid.Row key={key} stretched className="p-0">
|
|
46
56
|
{row.map(trade => {
|
|
47
57
|
return (
|
|
48
|
-
<Grid.Column key={trade.
|
|
58
|
+
<Grid.Column key={trade.name}>
|
|
49
59
|
<CompanyTradeCheckbox<T>
|
|
50
60
|
className={`qa-settings-select-your-trades-${
|
|
51
61
|
trade.qaKey ?? trade.value
|