@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.
Files changed (58) hide show
  1. package/CHANGELOG.md +17 -0
  2. package/lib/components/settings/company-details/index.d.ts +5 -0
  3. package/lib/components/settings/company-details/index.d.ts.map +1 -1
  4. package/lib/components/settings/company-details/index.js +4 -3
  5. package/lib/components/settings/company-details/index.js.map +1 -1
  6. package/lib/components/settings/company-email-footer/index.d.ts +3 -0
  7. package/lib/components/settings/company-email-footer/index.d.ts.map +1 -1
  8. package/lib/components/settings/company-email-footer/index.js +2 -2
  9. package/lib/components/settings/company-email-footer/index.js.map +1 -1
  10. package/lib/components/settings/company-email-reply-to/index.d.ts +3 -0
  11. package/lib/components/settings/company-email-reply-to/index.d.ts.map +1 -1
  12. package/lib/components/settings/company-email-reply-to/index.js +2 -2
  13. package/lib/components/settings/company-email-reply-to/index.js.map +1 -1
  14. package/lib/components/settings/company-email-sender/custom-domain-sender.d.ts +3 -0
  15. package/lib/components/settings/company-email-sender/custom-domain-sender.d.ts.map +1 -1
  16. package/lib/components/settings/company-email-sender/custom-domain-sender.js +2 -2
  17. package/lib/components/settings/company-email-sender/custom-domain-sender.js.map +1 -1
  18. package/lib/components/settings/company-email-sender/simple-sender.d.ts +3 -0
  19. package/lib/components/settings/company-email-sender/simple-sender.d.ts.map +1 -1
  20. package/lib/components/settings/company-email-sender/simple-sender.js +2 -2
  21. package/lib/components/settings/company-email-sender/simple-sender.js.map +1 -1
  22. package/lib/components/settings/company-trades-picker/index.d.ts +7 -2
  23. package/lib/components/settings/company-trades-picker/index.d.ts.map +1 -1
  24. package/lib/components/settings/company-trades-picker/index.js +4 -4
  25. package/lib/components/settings/company-trades-picker/index.js.map +1 -1
  26. package/lib/components/settings/double-opt-in/index.d.ts +3 -0
  27. package/lib/components/settings/double-opt-in/index.d.ts.map +1 -1
  28. package/lib/components/settings/double-opt-in/index.js +2 -2
  29. package/lib/components/settings/double-opt-in/index.js.map +1 -1
  30. package/lib/components/settings/form-errors-list/index.d.ts +1 -0
  31. package/lib/components/settings/form-errors-list/index.d.ts.map +1 -1
  32. package/lib/components/settings/form-errors-list/index.js +3 -2
  33. package/lib/components/settings/form-errors-list/index.js.map +1 -1
  34. package/lib/components/settings/logo-picker/index.d.ts +1 -0
  35. package/lib/components/settings/logo-picker/index.d.ts.map +1 -1
  36. package/lib/components/settings/logo-picker/index.js +2 -2
  37. package/lib/components/settings/logo-picker/index.js.map +1 -1
  38. package/lib/components/settings/opt-out-message/index.d.ts +3 -0
  39. package/lib/components/settings/opt-out-message/index.d.ts.map +1 -1
  40. package/lib/components/settings/opt-out-message/index.js +2 -2
  41. package/lib/components/settings/opt-out-message/index.js.map +1 -1
  42. package/lib/components/settings/settings-section/index.d.ts +3 -1
  43. package/lib/components/settings/settings-section/index.d.ts.map +1 -1
  44. package/lib/components/settings/settings-section/index.js +1 -1
  45. package/lib/components/settings/settings-section/index.js.map +1 -1
  46. package/package.json +2 -2
  47. package/src/components/settings/company-details/index.tsx +15 -4
  48. package/src/components/settings/company-email-footer/index.tsx +6 -2
  49. package/src/components/settings/company-email-reply-to/index.tsx +32 -26
  50. package/src/components/settings/company-email-sender/custom-domain-sender.tsx +6 -2
  51. package/src/components/settings/company-email-sender/simple-sender.tsx +6 -2
  52. package/src/components/settings/company-trades-picker/index.tsx +17 -7
  53. package/src/components/settings/double-opt-in/index.tsx +116 -110
  54. package/src/components/settings/form-errors-list/index.tsx +31 -27
  55. package/src/components/settings/logo-picker/index.tsx +12 -8
  56. package/src/components/settings/opt-out-message/index.tsx +6 -3
  57. package/src/components/settings/settings-section/index.tsx +12 -7
  58. package/tsconfig.tsbuildinfo +1 -1
@@ -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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,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,EAAE,KAAK,EAAE,IAAI,EAAE,YAAY,EAAE,MAAM,6BAA6B,CAAC;AACtF,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAEnD,OAAO,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,KAAK,MAAM,MAAM,+BAA+B,CAAC;AAgBxD,MAAM,CAAC,MAAM,aAAa,GAA2B,QAAQ,CACzD,CAAC,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12 @@
1
1
  import { ReactNode, FC } from 'react';
2
+ import { LayoutProps } from '@servicetitan/design-system';
2
3
  export interface SectionProps {
3
- title: string;
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;AAKtC,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,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;CACtB;AAED,eAAO,MAAM,eAAe,EAAE,EAAE,CAAC,YAAY,CAoB5C,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: "support", direction: "left", className: classNames(qaPrefix, className) }, { children: [_jsxs(Layout.Section, { children: [_jsx(Text, Object.assign({ size: 3, bold: true, className: `${qaPrefix}-title` }, { children: title }), void 0), 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)));
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,EAAE,MA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,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,6 +1,6 @@
1
1
  {
2
2
  "name": "@servicetitan/mpa-components",
3
- "version": "0.6.0",
3
+ "version": "1.0.0",
4
4
  "description": "",
5
5
  "main": "./lib/index.js",
6
6
  "typings": "./lib/index.d.ts",
@@ -27,5 +27,5 @@
27
27
  "cli": {
28
28
  "webpack": false
29
29
  },
30
- "gitHead": "ac950b6290c35e2be23627b9fff6c1eb9f222579"
30
+ "gitHead": "2a0735437f422320f08367221482e8df6f4c3e77"
31
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&nbsp;
30
36
  <Link
31
- href="https://help.servicetitan.com/Content/Marketing/merge-tags.htm"
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="Company Details"
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={7}
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(({ replyToEmail }) => {
14
- const handleReplyToBlur = useCallback(() => {
15
- replyToEmail.validate();
16
- }, [replyToEmail]);
15
+ export const CompanyEmailReplyTo: FC<CompanyEmailReplyToProps> = observer(
16
+ ({ replyToEmail, layout, className }) => {
17
+ const handleReplyToBlur = useCallback(() => {
18
+ replyToEmail.validate();
19
+ }, [replyToEmail]);
17
20
 
18
- return (
19
- <SettingsSection
20
- title="Reply-To"
21
- text="This is where emails will be sent if someone replies to one of your emails."
22
- qaPrefix="qa-settings-reply-to"
23
- >
24
- <Form className="m-b-0-i">
25
- <Form.Input
26
- className="m-b-0-i qa-settings-reply-to-email-address"
27
- value={replyToEmail.value}
28
- onChange={replyToEmail.onChangeHandler}
29
- error={replyToEmail.hasError}
30
- onBlur={handleReplyToBlur}
31
- label="Reply-to Email Address"
32
- placeholder="info@yourcompany.com"
33
- fluid
34
- />
35
- </Form>
36
- </SettingsSection>
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, 4).map((row, idx) => ({ row, key: `row=${idx}` })),
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={4}>
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.value}>
58
+ <Grid.Column key={trade.name}>
49
59
  <CompanyTradeCheckbox<T>
50
60
  className={`qa-settings-select-your-trades-${
51
61
  trade.qaKey ?? trade.value
@@ -3,7 +3,7 @@ import { observer } from 'mobx-react';
3
3
  import classnames from 'classnames';
4
4
 
5
5
  import { CheckboxFieldState, InputFieldState, TextAreaFieldState } from '@servicetitan/form';
6
- import { Form, Text, ToggleSwitch, Button } from '@servicetitan/design-system';
6
+ import { Form, Text, ToggleSwitch, Button, LayoutProps } from '@servicetitan/design-system';
7
7
  import { useConfirm } from '@servicetitan/confirm';
8
8
 
9
9
  import { SettingsSection } from '../settings-section';
@@ -23,121 +23,127 @@ export interface DoubleOptInPropsFormState {
23
23
  }
24
24
  export interface DoubleOptInProps {
25
25
  formState: DoubleOptInPropsFormState;
26
+ layout?: LayoutProps['type'];
27
+ className?: string;
26
28
  onHandleClickEnable?(checkd: boolean): void;
27
29
  }
28
30
 
29
- export const DoubleOptIn: FC<DoubleOptInProps> = observer(({ onHandleClickEnable, formState }) => {
30
- const { emailSubject, emailHeader, emailBody, emailButtonText, enabled } = formState;
31
- const [isPreviewOpen, setIsPreviewOpen] = useState(false);
32
- const openPreview = useCallback(() => setIsPreviewOpen(true), [setIsPreviewOpen]);
33
- const closePreview = useCallback(() => setIsPreviewOpen(false), [setIsPreviewOpen]);
31
+ export const DoubleOptIn: FC<DoubleOptInProps> = observer(
32
+ ({ onHandleClickEnable, formState, layout, className }) => {
33
+ const { emailSubject, emailHeader, emailBody, emailButtonText, enabled } = formState;
34
+ const [isPreviewOpen, setIsPreviewOpen] = useState(false);
35
+ const openPreview = useCallback(() => setIsPreviewOpen(true), [setIsPreviewOpen]);
36
+ const closePreview = useCallback(() => setIsPreviewOpen(false), [setIsPreviewOpen]);
34
37
 
35
- const handleClickEnable = useCallback(
36
- (_0: any, checked: boolean) => {
37
- onHandleClickEnable?.(checked);
38
- enabled.onChange(checked);
39
- },
40
- [enabled, onHandleClickEnable]
41
- );
38
+ const handleClickEnable = useCallback(
39
+ (_0: any, checked: boolean) => {
40
+ onHandleClickEnable?.(checked);
41
+ enabled.onChange(checked);
42
+ },
43
+ [enabled, onHandleClickEnable]
44
+ );
42
45
 
43
- const [Confirm, handleConfirmed] = useConfirm(handleClickEnable);
46
+ const [Confirm, handleConfirmed] = useConfirm(handleClickEnable);
44
47
 
45
- return (
46
- <SettingsSection
47
- qaPrefix="qa-double-opt-in"
48
- title="Double Opt-In"
49
- text={
50
- <Fragment>
51
- <div>
52
- Double opt-in ensures that your emails will go to SPAM at a much lower rate.
53
- The opt-in confirmation happens after a job has been completed.
54
- </div>
55
- <ToggleSwitch
56
- label="Enable"
57
- onChange={handleConfirmed}
58
- checked={enabled.value}
59
- className="m-t-2 qa-double-opt-in-enable"
48
+ return (
49
+ <SettingsSection
50
+ layout={layout}
51
+ className={className}
52
+ qaPrefix="qa-double-opt-in"
53
+ title="Double Opt-In"
54
+ text={
55
+ <Fragment>
56
+ <div>
57
+ Double opt-in ensures that your emails will go to SPAM at a much lower
58
+ rate. The opt-in confirmation happens after a job has been completed.
59
+ </div>
60
+ <ToggleSwitch
61
+ label="Enable"
62
+ onChange={handleConfirmed}
63
+ checked={enabled.value}
64
+ className="m-t-2 qa-double-opt-in-enable"
65
+ />
66
+ </Fragment>
67
+ }
68
+ >
69
+ <Text bold className="m-b-2">
70
+ Double Opt-In Email Content
71
+ </Text>
72
+ <Form className="m-b-0-i">
73
+ <Form.Input
74
+ className="m-b-2-i qa-double-opt-in-subject-line"
75
+ value={emailSubject.value}
76
+ onChange={emailSubject.onChangeHandler}
77
+ error={emailSubject.hasError}
78
+ label="Subject Line"
79
+ fluid
80
+ disabled={!enabled.value}
60
81
  />
61
- </Fragment>
62
- }
63
- >
64
- <Text bold className="m-b-2">
65
- Double Opt-In Email Content
66
- </Text>
67
- <Form className="m-b-0-i">
68
- <Form.Input
69
- className="m-b-2-i qa-double-opt-in-subject-line"
70
- value={emailSubject.value}
71
- onChange={emailSubject.onChangeHandler}
72
- error={emailSubject.hasError}
73
- label="Subject Line"
74
- fluid
75
- disabled={!enabled.value}
76
- />
77
- <Form.Input
78
- className="m-b-2-i qa-double-opt-in-header"
79
- value={emailHeader.value}
80
- onChange={emailHeader.onChangeHandler}
81
- error={emailHeader.hasError}
82
- label="Header"
83
- fluid
84
- disabled={!enabled.value}
85
- />
86
- <Form.TextArea
87
- className="m-b-2-i qa-double-opt-in-body-copy"
88
- label="Body Copy"
89
- value={emailBody.value}
90
- onChange={emailBody.onChangeHandler}
91
- error={emailBody.hasError}
92
- rows={2}
93
- disabled={!enabled.value}
82
+ <Form.Input
83
+ className="m-b-2-i qa-double-opt-in-header"
84
+ value={emailHeader.value}
85
+ onChange={emailHeader.onChangeHandler}
86
+ error={emailHeader.hasError}
87
+ label="Header"
88
+ fluid
89
+ disabled={!enabled.value}
90
+ />
91
+ <Form.TextArea
92
+ className="m-b-2-i qa-double-opt-in-body-copy"
93
+ label="Body Copy"
94
+ value={emailBody.value}
95
+ onChange={emailBody.onChangeHandler}
96
+ error={emailBody.hasError}
97
+ rows={2}
98
+ disabled={!enabled.value}
99
+ />
100
+ <Form.Input
101
+ className={classnames(
102
+ Styles.buttonInput,
103
+ 'm-b-2-i qa-double-opt-in-button-text'
104
+ )}
105
+ value={emailButtonText.value}
106
+ onChange={emailButtonText.onChangeHandler}
107
+ error={emailButtonText.hasError}
108
+ label="Button Text"
109
+ disabled={!enabled.value}
110
+ />
111
+ <Form.Field
112
+ className="m-b-3-i"
113
+ label={
114
+ <Fragment>
115
+ Footer&nbsp;
116
+ <Text inline size={2} subdued>
117
+ (automatically added)
118
+ </Text>
119
+ </Fragment>
120
+ }
121
+ >
122
+ <Text>{footerText}</Text>
123
+ </Form.Field>
124
+ <Button
125
+ className="qa-double-opt-in-preview-email"
126
+ primary
127
+ onClick={openPreview}
128
+ outline
129
+ small
130
+ disabled={!enabled.value}
131
+ >
132
+ Preview Email
133
+ </Button>
134
+ </Form>
135
+ <Confirm
136
+ title="Disable Double Opt-In"
137
+ message="Disabling double opt-in could potentially lead to worse email performance and higher spam rates. Are you sure?"
138
+ when={enabled.value}
94
139
  />
95
- <Form.Input
96
- className={classnames(
97
- Styles.buttonInput,
98
- 'm-b-2-i qa-double-opt-in-button-text'
99
- )}
100
- value={emailButtonText.value}
101
- onChange={emailButtonText.onChangeHandler}
102
- error={emailButtonText.hasError}
103
- label="Button Text"
104
- disabled={!enabled.value}
140
+ <OptInEmailPreview
141
+ {...formState}
142
+ open={isPreviewOpen}
143
+ footerText={footerText}
144
+ onClose={closePreview}
105
145
  />
106
- <Form.Field
107
- className="m-b-3-i"
108
- label={
109
- <Fragment>
110
- Footer&nbsp;
111
- <Text inline size={2} subdued>
112
- (automatically added)
113
- </Text>
114
- </Fragment>
115
- }
116
- >
117
- <Text>{footerText}</Text>
118
- </Form.Field>
119
- <Button
120
- className="qa-double-opt-in-preview-email"
121
- primary
122
- onClick={openPreview}
123
- outline
124
- small
125
- disabled={!enabled.value}
126
- >
127
- Preview Email
128
- </Button>
129
- </Form>
130
- <Confirm
131
- title="Disable Double Opt-In"
132
- message="Disabling double opt-in could potentially lead to worse email performance and higher spam rates. Are you sure?"
133
- when={enabled.value}
134
- />
135
- <OptInEmailPreview
136
- {...formState}
137
- open={isPreviewOpen}
138
- footerText={footerText}
139
- onClose={closePreview}
140
- />
141
- </SettingsSection>
142
- );
143
- });
146
+ </SettingsSection>
147
+ );
148
+ }
149
+ );