@servicetitan/mpa-components 1.10.0 → 2.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 (66) hide show
  1. package/CHANGELOG.md +16 -0
  2. package/lib/components/brands/brand-card/actions-button-section.d.ts +6 -0
  3. package/lib/components/brands/brand-card/actions-button-section.d.ts.map +1 -0
  4. package/lib/components/brands/brand-card/actions-button-section.js +26 -0
  5. package/lib/components/brands/brand-card/actions-button-section.js.map +1 -0
  6. package/lib/components/brands/brand-card/brand-card.d.ts +4 -0
  7. package/lib/components/brands/brand-card/brand-card.d.ts.map +1 -0
  8. package/lib/components/brands/brand-card/brand-card.js +16 -0
  9. package/lib/components/brands/brand-card/brand-card.js.map +1 -0
  10. package/lib/components/brands/brand-card/brand-logo.d.ts +6 -0
  11. package/lib/components/brands/brand-card/brand-logo.d.ts.map +1 -0
  12. package/lib/components/brands/brand-card/brand-logo.js +8 -0
  13. package/lib/components/brands/brand-card/brand-logo.js.map +1 -0
  14. package/lib/components/brands/brand-card/cart-tags.d.ts +6 -0
  15. package/lib/components/brands/brand-card/cart-tags.d.ts.map +1 -0
  16. package/lib/components/brands/brand-card/cart-tags.js +10 -0
  17. package/lib/components/brands/brand-card/cart-tags.js.map +1 -0
  18. package/lib/components/brands/brand-card/name-and-mail-section.d.ts +7 -0
  19. package/lib/components/brands/brand-card/name-and-mail-section.d.ts.map +1 -0
  20. package/lib/components/brands/brand-card/name-and-mail-section.js +7 -0
  21. package/lib/components/brands/brand-card/name-and-mail-section.js.map +1 -0
  22. package/lib/components/brands/brand-card/single-action-button.d.ts +6 -0
  23. package/lib/components/brands/brand-card/single-action-button.d.ts.map +1 -0
  24. package/lib/components/brands/brand-card/single-action-button.js +34 -0
  25. package/lib/components/brands/brand-card/single-action-button.js.map +1 -0
  26. package/lib/components/brands/cards-grid/cards-grid.d.ts +7 -0
  27. package/lib/components/brands/cards-grid/cards-grid.d.ts.map +1 -0
  28. package/lib/components/brands/cards-grid/cards-grid.js +7 -0
  29. package/lib/components/brands/cards-grid/cards-grid.js.map +1 -0
  30. package/lib/components/brands/index.d.ts +2 -0
  31. package/lib/components/brands/index.d.ts.map +1 -0
  32. package/lib/components/brands/index.js +2 -0
  33. package/lib/components/brands/index.js.map +1 -0
  34. package/lib/components/brands/styles.module.less +59 -0
  35. package/lib/enums/brands.d.ts +6 -0
  36. package/lib/enums/brands.d.ts.map +1 -0
  37. package/lib/enums/brands.js +7 -0
  38. package/lib/enums/brands.js.map +1 -0
  39. package/lib/index.d.ts +3 -0
  40. package/lib/index.d.ts.map +1 -1
  41. package/lib/index.js +3 -0
  42. package/lib/index.js.map +1 -1
  43. package/lib/utils/interfaces.d.ts +22 -0
  44. package/lib/utils/interfaces.d.ts.map +1 -0
  45. package/lib/utils/interfaces.js +2 -0
  46. package/lib/utils/interfaces.js.map +1 -0
  47. package/lib/utils/mappers.d.ts +4 -0
  48. package/lib/utils/mappers.d.ts.map +1 -0
  49. package/lib/utils/mappers.js +13 -0
  50. package/lib/utils/mappers.js.map +1 -0
  51. package/package.json +15 -11
  52. package/src/components/brands/brand-card/actions-button-section.tsx +62 -0
  53. package/src/components/brands/brand-card/brand-card.tsx +55 -0
  54. package/src/components/brands/brand-card/brand-logo.tsx +21 -0
  55. package/src/components/brands/brand-card/cart-tags.tsx +20 -0
  56. package/src/components/brands/brand-card/name-and-mail-section.tsx +28 -0
  57. package/src/components/brands/brand-card/single-action-button.tsx +84 -0
  58. package/src/components/brands/cards-grid/cards-grid.tsx +20 -0
  59. package/src/components/brands/index.ts +1 -0
  60. package/src/components/brands/styles.module.less +59 -0
  61. package/src/components/brands/styles.module.less.d.ts +10 -0
  62. package/src/enums/brands.ts +5 -0
  63. package/src/index.ts +3 -1
  64. package/src/utils/interfaces.ts +23 -0
  65. package/src/utils/mappers.ts +14 -0
  66. package/tsconfig.tsbuildinfo +1 -1
package/CHANGELOG.md CHANGED
@@ -3,6 +3,22 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.0.0](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@1.11.0...@servicetitan/mpa-components@2.0.0) (2025-04-10)
7
+
8
+ **Note:** Version bump only for package @servicetitan/mpa-components
9
+
10
+
11
+
12
+
13
+
14
+ # [1.11.0](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@1.10.0...@servicetitan/mpa-components@1.11.0) (2025-04-02)
15
+
16
+ **Note:** Version bump only for package @servicetitan/mpa-components
17
+
18
+
19
+
20
+
21
+
6
22
  # [1.10.0](https://github.com/servicetitan/marketing/compare/@servicetitan/mpa-components@1.9.0...@servicetitan/mpa-components@1.10.0) (2024-09-18)
7
23
 
8
24
  **Note:** Version bump only for package @servicetitan/mpa-components
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ import { BrandAction } from '../../../utils/interfaces';
3
+ export declare const ActionsButtonSection: FC<{
4
+ actions: BrandAction | BrandAction[];
5
+ }>;
6
+ //# sourceMappingURL=actions-button-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions-button-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAY,MAAM,OAAO,CAAC;AAMrC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAExD,eAAO,MAAM,oBAAoB,EAAE,EAAE,CAAC;IAClC,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;CACxC,CAmDA,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { useHistory } from 'react-router-dom';
4
+ import { ActionMenu, BodyText, Button, Icon } from '@servicetitan/design-system';
5
+ import { SingleActionButtonSection } from './single-action-button';
6
+ export const ActionsButtonSection = ({ actions }) => {
7
+ const [isOpen, setOpen] = useState(false);
8
+ const history = useHistory();
9
+ if (!Array.isArray(actions)) {
10
+ return _jsx(SingleActionButtonSection, { action: actions });
11
+ }
12
+ const trigger = (_jsxs(Button, { outline: true, size: "small", onClick: () => setOpen(true), className: "qa-brand-card-actions-trigger", children: ["Actions ", _jsx(Icon, { name: "keyboard_arrow_down", size: 16 })] }));
13
+ return (_jsx(ActionMenu, { trigger: trigger, open: isOpen, onClickOutside: () => setOpen(false), direction: "bl", className: "qa-brand-card-action-menu", children: actions.map(action => {
14
+ const actionClick = () => {
15
+ setOpen(false);
16
+ if (action.action) {
17
+ action.action();
18
+ }
19
+ if (action.href) {
20
+ history.push(action.href);
21
+ }
22
+ };
23
+ return (_jsx(ActionMenu.Item, { disabled: action.disabled, onClick: actionClick, className: "qa-brand-card-action-menu-item", children: _jsx(BodyText, { subdued: action.disabled, children: action.name }) }, action.name));
24
+ }) }));
25
+ };
26
+ //# sourceMappingURL=actions-button-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"actions-button-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/actions-button-section.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAM,QAAQ,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAEjF,OAAO,EAAE,yBAAyB,EAAE,MAAM,wBAAwB,CAAC;AAGnE,MAAM,CAAC,MAAM,oBAAoB,GAE5B,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE;IACjB,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC1C,MAAM,OAAO,GAAG,UAAU,EAAE,CAAC;IAE7B,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC;QAC1B,OAAO,K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/interfaces';
3
+ export declare const BrandCard: FC<BrandCardProps>;
4
+ //# sourceMappingURL=brand-card.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-card.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-card.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAS3D,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC,cAAc,CAuCxC,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { Flex, Card } from '@servicetitan/anvil2';
4
+ import { NameAndMailSection } from './name-and-mail-section';
5
+ import { ActionsButtonSection } from './actions-button-section';
6
+ import { CardTags } from './cart-tags';
7
+ import { BrandLogo } from './brand-logo';
8
+ import * as Styles from '../styles.module.less';
9
+ const BRAND_NAME_PLACEHOLDER = 'Assign Brand Name';
10
+ export const BrandCard = ({ actions, email, isDefault, isShared, logo, name, hasError, }) => {
11
+ const nameToShow = name || BRAND_NAME_PLACEHOLDER;
12
+ return (_jsx(Card, { className: classNames({
13
+ [Styles.cardWithError]: hasError,
14
+ }, Styles.brandCard, 'qa-brand-card'), padding: "large", children: _jsxs(Flex, { className: Styles.cardContent, justifyContent: "space-between", direction: "column", children: [_jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", className: "qa-brand-card-left-section", children: [_jsx(BrandLogo, { logo: logo, alt: nameToShow }), _jsx(ActionsButtonSection, { actions: actions })] }), _jsxs(Flex, { justifyContent: "space-between", children: [_jsx(NameAndMailSection, { name: name, nameToShow: nameToShow, email: email }), _jsx(CardTags, { isDefault: isDefault, isShared: isShared })] })] }) }));
15
+ };
16
+ //# sourceMappingURL=brand-card.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-card.js","sourceRoot":"","sources":["../../../../src/components/brands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AAE,KAAK,EAAE,KAAK,GAAI,EACxE,KAAC,QAAQ,IAAC,SAAS,EAAE,SAAS,EAAE,QAAQ,EAAE,QAAQ,GAAI,IACnD,IACJ,GACJ,CACV,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ export declare const BrandLogo: FC<{
3
+ logo?: string;
4
+ alt?: string;
5
+ }>;
6
+ //# sourceMappingURL=brand-logo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-logo.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-logo.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAS3B,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,GAAG,CAAC,EAAE,MAAM,CAAA;CAAE,CAWrD,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { Flex, Icon } from '@servicetitan/anvil2';
4
+ import ImageIcon from '@servicetitan/anvil2/assets/icons/material/round/image.svg';
5
+ import { tokens } from '@servicetitan/tokens/core/index';
6
+ import * as Styles from '../styles.module.less';
7
+ export const BrandLogo = ({ logo, alt }) => logo ? (_jsx("img", { className: classNames(Styles.brandImg, 'qa-brand-logo'), src: logo, alt: alt })) : (_jsx(Flex, { className: classNames(Styles.brandImgPlaceholder, 'qa-brand-logo-placeholder'), alignItems: "center", justifyContent: "center", children: _jsx(Icon, { svg: ImageIcon, size: "large", color: tokens.colorNeutral90 }) }));
8
+ //# sourceMappingURL=brand-logo.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brand-logo.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/brand-logo.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,SAAS,MAAM,4DAA4D,CAAC;AACnF,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAAwC,CAAC,EAAE,IAAI,EAAE,GAAG,EAAE,EAAE,EAAE,CAC5E,IAAI,CAAC,CAAC,CAAC,CACH,cAAK,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,GAAG,GAAI,CACxF,CAAC,CAAC,CAAC,CACA,KAAC,IAAI,IACD,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,mBAAmB,EAAE,2BAA2B,CAAC,EAC9E,UAAU,EAAC,QAAQ,EACnB,cAAc,EAAC,QAAQ,YAEvB,KAAC,IAAI,IAAC,GAAG,EAAE,SAAS,EAAE,IAAI,EAAC,OAAO,EAAC,KAAK,EAAE,MAAM,CAAC,cAAc,GAAI,GAChE,CACV,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ export declare const CardTags: FC<{
3
+ isDefault?: boolean;
4
+ isShared?: boolean;
5
+ }>;
6
+ //# sourceMappingURL=cart-tags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-tags.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/cart-tags.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAK3B,eAAO,MAAM,QAAQ,EAAE,EAAE,CAAC;IAAE,SAAS,CAAC,EAAE,OAAO,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,CAcpE,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Chip, Flex } from '@servicetitan/anvil2';
3
+ import { tokens } from '@servicetitan/tokens/core/index';
4
+ export const CardTags = ({ isDefault, isShared, }) => {
5
+ if (!isDefault && !isShared) {
6
+ return null;
7
+ }
8
+ return (_jsxs(Flex, { direction: "column", alignItems: "flex-end", className: "qa-brand-card-tags", gap: "1", children: [isShared && _jsx(Chip, { color: tokens.colorPurple100, label: "Corporate HQ", size: "small" }), isDefault && _jsx(Chip, { label: "Default", color: tokens.colorNeutral50, size: "small" })] }));
9
+ };
10
+ //# sourceMappingURL=cart-tags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cart-tags.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/cart-tags.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,MAAM,iCAAiC,CAAC;AAEzD,MAAM,CAAC,MAAM,QAAQ,GAAoD,CAAC,EACtE,SAAS,EACT,QAAQ,GACX,EAAE,EAAE;IACD,IAAI,CAAC,SAAS,IAAI,CAAC,QAAQ,EAAE,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CACH,MAAC,IAAI,IAAC,SAAS,EAAC,QAAQ,EAAC,UAAU,EAAC,UAAU,EAAC,SAAS,EAAC,oBAAoB,EAAC,GAAG,EAAC,GAAG,aAChF,QAAQ,IAAI,KAAC,IAAI,IAAC,KAAK,EAAE,MAAM,CAAC,cAAc,EAAE,KAAK,EAAC,cAAc,EAAC,IAAI,EAAC,OAAO,GAAG,EACpF,SAAS,IAAI,KAAC,IAAI,IAAC,KAAK,EAAC,SAAS,EAAC,KAAK,EAAE,MAAM,CAAC,cAAc,EAAE,IAAI,EAAC,OAAO,GAAG,IAC9E,CACV,CAAC;AACN,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ export declare const NameAndMailSection: FC<{
3
+ name?: string;
4
+ nameToShow: string;
5
+ email?: string;
6
+ }>;
7
+ //# sourceMappingURL=name-and-mail-section.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-and-mail-section.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/name-and-mail-section.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAQ3B,eAAO,MAAM,kBAAkB,EAAE,EAAE,CAAC;IAAE,IAAI,CAAC,EAAE,MAAM,CAAC;IAAC,UAAU,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAmBxF,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { BodyText, Headline } from '@servicetitan/design-system';
4
+ import { Flex } from '@servicetitan/anvil2';
5
+ import * as Styles from '../styles.module.less';
6
+ export const NameAndMailSection = ({ name, email, nameToShow, }) => (_jsxs(Flex, { justifyContent: "space-between", direction: "column", className: classNames(Styles.cardLeftSectionTexts, 'qa-brand-card-name-and-mail'), children: [_jsx(Headline, { el: "p", subdued: !name, className: "t-truncate-i m-0", title: nameToShow, children: nameToShow }), email && (_jsx(BodyText, { subdued: true, title: email, className: "t-truncate-i", children: email }))] }));
7
+ //# sourceMappingURL=name-and-mail-section.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"name-and-mail-section.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/name-and-mail-section.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,MAAM,CAAC,MAAM,kBAAkB,GAA8D,CAAC,EAC1F,IAAI,EACJ,KAAK,EACL,UAAU,GACb,EAAE,EAAE,CAAC,CACF,MAAC,IAAI,IACD,cAAc,EAAC,eAAe,EAC9B,SAAS,EAAC,QAAQ,EAClB,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,oBAAoB,EAAE,6BAA6B,CAAC,aAEjF,KAAC,QAAQ,IAAC,EAAE,EAAC,GAAG,EAAC,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,EAAC,kBAAkB,EAAC,KAAK,EAAE,UAAU,YAC1E,UAAU,GACJ,EACV,KAAK,IAAI,CACN,KAAC,QAAQ,IAAC,OAAO,QAAC,KAAK,EAAE,KAAK,EAAE,SAAS,EAAC,cAAc,YACnD,KAAK,GACC,CACd,IACE,CACV,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { FC } from 'react';
2
+ import { BrandAction } from '../../../utils/interfaces';
3
+ export declare const SingleActionButtonSection: FC<{
4
+ action: BrandAction;
5
+ }>;
6
+ //# sourceMappingURL=single-action-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-action-button.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/single-action-button.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAqB,MAAM,OAAO,CAAC;AAO9C,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAIxD,eAAO,MAAM,yBAAyB,EAAE,EAAE,CAAC;IACvC,MAAM,EAAE,WAAW,CAAC;CACvB,CAmCA,CAAC"}
@@ -0,0 +1,34 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useHistory } from 'react-router-dom';
3
+ import HelpIcon from '@servicetitan/anvil2/assets/icons/material/round/help.svg';
4
+ import { Chip, Flex, Tooltip as TooltipA2, Button } from '@servicetitan/anvil2';
5
+ import { BrandActionChipColor, BrandActionChipLabel } from '../../../utils/mappers';
6
+ export const SingleActionButtonSection = ({ action }) => {
7
+ var _a;
8
+ const history = useHistory();
9
+ const handleClick = () => {
10
+ if (action.action) {
11
+ action.action();
12
+ }
13
+ if (action.href) {
14
+ history.push(action.href);
15
+ }
16
+ };
17
+ let buttonAppearance;
18
+ if (action.status === undefined) {
19
+ buttonAppearance = 'primary';
20
+ }
21
+ else if (!action.disabled) {
22
+ buttonAppearance = 'secondary';
23
+ }
24
+ return (_jsxs(Flex, { gap: "2", alignItems: "center", className: "qa-brand-card-single-action", children: [_jsx(ActionChip, { status: action.status, statusTooltip: action.statusTooltip }), _jsx(Button, { size: "small", onClick: handleClick, disabled: action.disabled, appearance: buttonAppearance, children: action.name }), action.disabled && (_jsx(DisabledActionHelper, { children: (_a = action.disableTooltipContent) === null || _a === void 0 ? void 0 : _a.call(action) }))] }));
25
+ };
26
+ const ActionChip = ({ status, statusTooltip, }) => {
27
+ if (status === undefined) {
28
+ return null;
29
+ }
30
+ const chip = (_jsx(Chip, { label: BrandActionChipLabel[status], color: BrandActionChipColor[status], size: "small" }));
31
+ return statusTooltip ? (_jsxs(TooltipA2, { children: [_jsx(TooltipA2.Trigger, { children: chip }), _jsx(TooltipA2.Content, { children: statusTooltip })] })) : (chip);
32
+ };
33
+ const DisabledActionHelper = ({ children }) => (_jsxs(TooltipA2, { children: [_jsx(TooltipA2.Trigger, { children: _jsx(Button, { icon: HelpIcon, size: "small" }) }), _jsx(TooltipA2.Content, { children: children })] }));
34
+ //# sourceMappingURL=single-action-button.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"single-action-button.js","sourceRoot":"","sources":["../../../../src/components/brands/brand-card/single-action-button.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,OAAO,QAAQ,MAAM,2DAA2D,CAAC;AACjF,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAIhF,OAAO,EAAE,oBAAoB,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAGpF,MAAM,CAAC,MAAM,yBAAyB,GAEj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T,KAAC,IAAI,IACD,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACnC,KAAK,EAAE,oBAAoB,CAAC,MAAM,CAAC,EACnC,IAAI,EAAC,OAAO,GACd,CACL,CAAC;IAEF,OAAO,aAAa,CAAC,CAAC,CAAC,CACnB,MAAC,SAAS,eACN,KAAC,SAAS,CAAC,OAAO,cAAE,IAAI,GAAqB,EAC7C,KAAC,SAAS,CAAC,OAAO,cAAE,aAAa,GAAqB,IAC9C,CACf,CAAC,CAAC,CAAC,CACA,IAAI,CACP,CAAC;AACN,CAAC,CAAC;AAEF,MAAM,oBAAoB,GAA0B,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,CAClE,MAAC,SAAS,eACN,KAAC,SAAS,CAAC,OAAO,cACd,KAAC,MAAM,IAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAC,OAAO,GAAG,GACvB,EACpB,KAAC,SAAS,CAAC,OAAO,cAAE,QAAQ,GAAqB,IACzC,CACf,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { FC } from 'react';
2
+ import { BrandCardProps } from '../../../utils/interfaces';
3
+ export declare const CardsGrid: FC<{
4
+ brands: BrandCardProps[];
5
+ qaIdentifier: string;
6
+ }>;
7
+ //# sourceMappingURL=cards-grid.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cards-grid.d.ts","sourceRoot":"","sources":["../../../../src/components/brands/cards-grid/cards-grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAM3B,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D,eAAO,MAAM,SAAS,EAAE,EAAE,CAAC;IACvB,MAAM,EAAE,cAAc,EAAE,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACxB,CAMA,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import classNames from 'classnames';
3
+ import { Grid } from '@servicetitan/anvil2';
4
+ import { BrandCard } from '../brand-card/brand-card';
5
+ import * as Styles from '../styles.module.less';
6
+ export const CardsGrid = ({ brands, qaIdentifier }) => (_jsx(Grid, { className: classNames(Styles.grid, `qa-${qaIdentifier}-cards-grid`), gap: "6", children: brands.map(brand => (_jsx(BrandCard, { ...brand }, brand.id))) }));
7
+ //# sourceMappingURL=cards-grid.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"cards-grid.js","sourceRoot":"","sources":["../../../../src/components/brands/cards-grid/cards-grid.tsx"],"names":[],"mappings":";AACA,OAAO,UAAU,MAAM,YAAY,CAAC;AAEpC,OAAO,EAAE,IAAI,EAAE,MAAM,sBAAsB,CAAC;AAE5C,OAAO,EAAE,SAAS,EAAE,MAAM,0BAA0B,CAAC;AAGrD,OAAO,KAAK,MAAM,MAAM,uBAAuB,CAAC;AAEhD,MAAM,CAAC,MAAM,SAAS,GAGjB,CAAC,EAAE,MAAM,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,CAC/B,KAAC,IAAI,IAAC,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,IAAI,EAAE,MAAM,YAAY,aAAa,CAAC,EAAE,GAAG,EAAC,GAAG,YAC7E,MAAM,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,CAAC,CACjB,KAAC,SAAS,OAAoB,KAAK,IAAnB,KAAK,CAAC,EAAE,CAAe,CAC1C,CAAC,GACC,CACV,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './cards-grid/cards-grid';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/brands/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './cards-grid/cards-grid';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/brands/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC"}
@@ -0,0 +1,59 @@
1
+ @import (reference) '@servicetitan/tokens/dist/tokens.less';
2
+
3
+ @action-menu-item-padding: 12px;
4
+ @card-min-width: 330px;
5
+ @card-max-width: 700px;
6
+ @max-number-of-cards: 3;
7
+
8
+ .delete-tooltip {
9
+ min-width: 327px;
10
+ }
11
+
12
+ .grid {
13
+ grid-template-columns: repeat(auto-fill, minmax(@card-min-width, 1fr));
14
+ max-width: calc(@card-max-width * @max-number-of-cards + @spacing-3 * 2);
15
+ }
16
+
17
+ @media (min-width: 1120px) {
18
+ .grid {
19
+ grid-template-columns: repeat(@max-number-of-cards - 1, 1fr);
20
+ }
21
+ }
22
+
23
+ @media (min-width: 1620px) {
24
+ .grid {
25
+ grid-template-columns: repeat(@max-number-of-cards, 1fr);
26
+ }
27
+ }
28
+
29
+ .brand-card {
30
+ height: 200px;
31
+ min-width: @card-min-width;
32
+ max-width: @card-max-width;
33
+ }
34
+
35
+ .card-content {
36
+ width: 100%;
37
+ }
38
+
39
+ .card-left-section-texts {
40
+ min-width: 0;
41
+ }
42
+
43
+ .brand-img {
44
+ width: @spacing-6;
45
+ height: @spacing-6;
46
+ min-width: @spacing-6;
47
+ min-height: @spacing-6;
48
+ border-radius: @border-radius-circular;
49
+ border: solid 1px @color-neutral-60;
50
+ }
51
+
52
+ .brand-img-placeholder {
53
+ .brand-img();
54
+ background-color: @color-neutral-60;
55
+ }
56
+
57
+ .card-with-error {
58
+ border-color: @color-red-500;
59
+ }
@@ -0,0 +1,6 @@
1
+ export declare enum ActionStatus {
2
+ Error = 0,
3
+ Pending = 1,
4
+ Approved = 2
5
+ }
6
+ //# sourceMappingURL=brands.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brands.d.ts","sourceRoot":"","sources":["../../src/enums/brands.ts"],"names":[],"mappings":"AAAA,oBAAY,YAAY;IACpB,KAAK,IAAA;IACL,OAAO,IAAA;IACP,QAAQ,IAAA;CACX"}
@@ -0,0 +1,7 @@
1
+ export var ActionStatus;
2
+ (function (ActionStatus) {
3
+ ActionStatus[ActionStatus["Error"] = 0] = "Error";
4
+ ActionStatus[ActionStatus["Pending"] = 1] = "Pending";
5
+ ActionStatus[ActionStatus["Approved"] = 2] = "Approved";
6
+ })(ActionStatus || (ActionStatus = {}));
7
+ //# sourceMappingURL=brands.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"brands.js","sourceRoot":"","sources":["../../src/enums/brands.ts"],"names":[],"mappings":"AAAA,MAAM,CAAN,IAAY,YAIX;AAJD,WAAY,YAAY;IACpB,iDAAK,CAAA;IACL,qDAAO,CAAA;IACP,uDAAQ,CAAA;AACZ,CAAC,EAJW,YAAY,KAAZ,YAAY,QAIvB"}
package/lib/index.d.ts CHANGED
@@ -1,4 +1,7 @@
1
1
  export * from './components/settings';
2
2
  export * from './components/campaign-actions';
3
+ export * from './components/settings';
3
4
  export * from './utils/helpers';
5
+ export * from './utils/interfaces';
6
+ export * from './enums/brands';
4
7
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
package/lib/index.js CHANGED
@@ -1,4 +1,7 @@
1
1
  export * from './components/settings';
2
2
  export * from './components/campaign-actions';
3
+ export * from './components/settings';
3
4
  export * from './utils/helpers';
5
+ export * from './utils/interfaces';
6
+ export * from './enums/brands';
4
7
  //# sourceMappingURL=index.js.map
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAE9C,cAAc,iBAAiB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,uBAAuB,CAAC;AACtC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,22 @@
1
+ import { JSX } from 'react';
2
+ import { ActionStatus } from '../enums/brands';
3
+ export interface BrandAction {
4
+ name: string;
5
+ disabled?: boolean;
6
+ disableTooltipContent?: () => JSX.Element | string;
7
+ href?: string;
8
+ status?: ActionStatus;
9
+ statusTooltip?: string;
10
+ action?: () => void;
11
+ }
12
+ export interface BrandCardProps {
13
+ id: string;
14
+ hasError?: boolean;
15
+ actions: BrandAction | BrandAction[];
16
+ logo?: string;
17
+ name?: string;
18
+ isDefault: boolean;
19
+ email?: string;
20
+ isShared?: boolean;
21
+ }
22
+ //# sourceMappingURL=interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../src/utils/interfaces.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,OAAO,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,WAAW,WAAW;IACxB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,GAAG,CAAC,OAAO,GAAG,MAAM,CAAC;IACnD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,YAAY,CAAC;IACtB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB;AAED,MAAM,WAAW,cAAc;IAC3B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,WAAW,GAAG,WAAW,EAAE,CAAC;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,SAAS,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=interfaces.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../src/utils/interfaces.ts"],"names":[],"mappings":""}
@@ -0,0 +1,4 @@
1
+ import { ActionStatus } from '../enums/brands';
2
+ export declare const BrandActionChipLabel: Record<ActionStatus, string>;
3
+ export declare const BrandActionChipColor: Record<ActionStatus, string>;
4
+ //# sourceMappingURL=mappers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mappers.d.ts","sourceRoot":"","sources":["../../src/utils/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAG/C,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAI7D,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAI7D,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { ActionStatus } from '../enums/brands';
2
+ import { tokens } from '@servicetitan/tokens/core';
3
+ export const BrandActionChipLabel = {
4
+ [ActionStatus.Pending]: 'Pending',
5
+ [ActionStatus.Error]: 'Error',
6
+ [ActionStatus.Approved]: 'Complete',
7
+ };
8
+ export const BrandActionChipColor = {
9
+ [ActionStatus.Pending]: tokens.colorOrange200,
10
+ [ActionStatus.Error]: tokens.colorRed500,
11
+ [ActionStatus.Approved]: tokens.colorGreen200,
12
+ };
13
+ //# sourceMappingURL=mappers.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mappers.js","sourceRoot":"","sources":["../../src/utils/mappers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAEnD,MAAM,CAAC,MAAM,oBAAoB,GAAiC;IAC9D,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,SAAS;IACjC,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,OAAO;IAC7B,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,UAAU;CACtC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAiC;IAC9D,CAAC,YAAY,CAAC,OAAO,CAAC,EAAE,MAAM,CAAC,cAAc;IAC7C,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC,WAAW;IACxC,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,aAAa;CAChD,CAAC"}
package/package.json CHANGED
@@ -3,26 +3,30 @@
3
3
  "repository": {
4
4
  "url": "https://github.com/servicetitan/marketing"
5
5
  },
6
- "version": "1.10.0",
6
+ "version": "2.0.0",
7
7
  "description": "",
8
8
  "main": "./lib/index.js",
9
9
  "typings": "./lib/index.d.ts",
10
10
  "peerDependencies": {
11
- "@servicetitan/confirm": "~26.3.0",
12
- "@servicetitan/design-system": "~13.6.0",
13
- "@servicetitan/form": "~26.3.0",
14
- "@servicetitan/form-state": "~26.3.0",
15
- "@servicetitan/react-ioc": "~23.5.2",
11
+ "@servicetitan/anvil2": "^1.23.1",
12
+ "@servicetitan/confirm": "~28.5.1",
13
+ "@servicetitan/design-system": "~14.5.1",
14
+ "@servicetitan/form": "~28.5.1",
15
+ "@servicetitan/form-state": "~28.5.1",
16
+ "@servicetitan/marketing-services-api": "^3.29.0",
17
+ "@servicetitan/react-ioc": "~28.4.0",
16
18
  "@servicetitan/tokens": "~12.2.1",
17
- "formstate": "~2.1.0",
18
- "mobx": "6.10.2",
19
+ "formstate": "2.0.0",
20
+ "mobx": "6.13.5",
19
21
  "mobx-react": "9.0.2",
20
22
  "moment": "~2.29.1",
21
- "react": "~18.3.1"
23
+ "react": "~18.3.1",
24
+ "react-router-dom": "~5.3.0"
22
25
  },
23
26
  "devDependencies": {
24
27
  "@testing-library/react": "^14.0.0",
25
- "@types/history": "4.7.9"
28
+ "@types/history": "4.7.9",
29
+ "@types/react-router-dom": "~5.3.3"
26
30
  },
27
31
  "publishConfig": {
28
32
  "access": "restricted"
@@ -30,5 +34,5 @@
30
34
  "cli": {
31
35
  "webpack": false
32
36
  },
33
- "gitHead": "a80589bd64eb965e97ae60aa28232ea60b5ed19c"
37
+ "gitHead": "45fb622e2875d33d9db1a15935ec8cb327bb5326"
34
38
  }
@@ -0,0 +1,62 @@
1
+ import { FC, useState } from 'react';
2
+ import { useHistory } from 'react-router-dom';
3
+
4
+ import { ActionMenu, BodyText, Button, Icon } from '@servicetitan/design-system';
5
+
6
+ import { SingleActionButtonSection } from './single-action-button';
7
+ import { BrandAction } from '../../../utils/interfaces';
8
+
9
+ export const ActionsButtonSection: FC<{
10
+ actions: BrandAction | BrandAction[];
11
+ }> = ({ actions }) => {
12
+ const [isOpen, setOpen] = useState(false);
13
+ const history = useHistory();
14
+
15
+ if (!Array.isArray(actions)) {
16
+ return <SingleActionButtonSection action={actions} />;
17
+ }
18
+
19
+ const trigger = (
20
+ <Button
21
+ outline
22
+ size="small"
23
+ onClick={() => setOpen(true)}
24
+ className="qa-brand-card-actions-trigger"
25
+ >
26
+ Actions <Icon name="keyboard_arrow_down" size={16} />
27
+ </Button>
28
+ );
29
+
30
+ return (
31
+ <ActionMenu
32
+ trigger={trigger}
33
+ open={isOpen}
34
+ onClickOutside={() => setOpen(false)}
35
+ direction="bl"
36
+ className="qa-brand-card-action-menu"
37
+ >
38
+ {actions.map(action => {
39
+ const actionClick = () => {
40
+ setOpen(false);
41
+ if (action.action) {
42
+ action.action();
43
+ }
44
+ if (action.href) {
45
+ history.push(action.href);
46
+ }
47
+ };
48
+
49
+ return (
50
+ <ActionMenu.Item
51
+ disabled={action.disabled}
52
+ key={action.name}
53
+ onClick={actionClick}
54
+ className="qa-brand-card-action-menu-item"
55
+ >
56
+ <BodyText subdued={action.disabled}>{action.name}</BodyText>
57
+ </ActionMenu.Item>
58
+ );
59
+ })}
60
+ </ActionMenu>
61
+ );
62
+ };