@servicetitan/onboarding-ui 5.0.0 → 5.2.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/dist/address-suggestion-popover/components/address-suggestion-popover.d.ts +1 -2
- package/dist/address-suggestion-popover/components/address-suggestion-popover.d.ts.map +1 -1
- package/dist/address-suggestion-popover/components/address-suggestion-popover.js +3 -7
- package/dist/address-suggestion-popover/components/address-suggestion-popover.js.map +1 -1
- package/dist/company-profile/components/company-profile-form.d.ts +8 -3
- package/dist/company-profile/components/company-profile-form.d.ts.map +1 -1
- package/dist/company-profile/components/company-profile-form.js +29 -13
- package/dist/company-profile/components/company-profile-form.js.map +1 -1
- package/dist/company-profile/stores/company-profile-form.store.d.ts +26 -10
- package/dist/company-profile/stores/company-profile-form.store.d.ts.map +1 -1
- package/dist/company-profile/stores/company-profile-form.store.js +104 -33
- package/dist/company-profile/stores/company-profile-form.store.js.map +1 -1
- package/dist/components/card-selector/add-card-selector.d.ts +8 -0
- package/dist/components/card-selector/add-card-selector.d.ts.map +1 -0
- package/dist/components/card-selector/add-card-selector.js +8 -0
- package/dist/components/card-selector/add-card-selector.js.map +1 -0
- package/dist/components/card-selector/card-selector.d.ts +26 -0
- package/dist/components/card-selector/card-selector.d.ts.map +1 -0
- package/dist/components/card-selector/card-selector.js +67 -0
- package/dist/components/card-selector/card-selector.js.map +1 -0
- package/dist/components/card-selector/card-selector.module.less +141 -0
- package/dist/components/card-selector/index.d.ts +3 -0
- package/dist/components/card-selector/index.d.ts.map +1 -0
- package/dist/components/card-selector/index.js +3 -0
- package/dist/components/card-selector/index.js.map +1 -0
- package/dist/components/index.d.ts +3 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +3 -0
- package/dist/components/index.js.map +1 -0
- package/dist/components/zip-code-input.d.ts +10 -0
- package/dist/components/zip-code-input.d.ts.map +1 -0
- package/dist/components/zip-code-input.js +30 -0
- package/dist/components/zip-code-input.js.map +1 -0
- package/dist/customer-types/assets/icon-commercial-construction.svg +43 -0
- package/dist/customer-types/assets/icon-commercial.svg +25 -0
- package/dist/customer-types/assets/icon-residential-construction.svg +41 -0
- package/dist/customer-types/assets/icon-residential.svg +19 -0
- package/dist/customer-types/components/customer-types-form.module.less +7 -0
- package/dist/customer-types/components/customer-types-selector.d.ts +10 -0
- package/dist/customer-types/components/customer-types-selector.d.ts.map +1 -0
- package/dist/customer-types/components/customer-types-selector.js +39 -0
- package/dist/customer-types/components/customer-types-selector.js.map +1 -0
- package/dist/customer-types/components/index.d.ts +2 -0
- package/dist/customer-types/components/index.d.ts.map +1 -0
- package/dist/customer-types/components/index.js +2 -0
- package/dist/customer-types/components/index.js.map +1 -0
- package/dist/customer-types/index.d.ts +4 -0
- package/dist/customer-types/index.d.ts.map +1 -0
- package/dist/customer-types/index.js +4 -0
- package/dist/customer-types/index.js.map +1 -0
- package/dist/customer-types/stores/customer-type-form.store.d.ts +22 -0
- package/dist/customer-types/stores/customer-type-form.store.d.ts.map +1 -0
- package/dist/customer-types/stores/customer-type-form.store.js +83 -0
- package/dist/customer-types/stores/customer-type-form.store.js.map +1 -0
- package/dist/customer-types/stores/index.d.ts +2 -0
- package/dist/customer-types/stores/index.d.ts.map +1 -0
- package/dist/customer-types/stores/index.js +2 -0
- package/dist/customer-types/stores/index.js.map +1 -0
- package/dist/customer-types/utils/customer-types.d.ts +7 -0
- package/dist/customer-types/utils/customer-types.d.ts.map +1 -0
- package/dist/customer-types/utils/customer-types.js +8 -0
- package/dist/customer-types/utils/customer-types.js.map +1 -0
- package/dist/customer-types/utils/index.d.ts +2 -0
- package/dist/customer-types/utils/index.d.ts.map +1 -0
- package/dist/customer-types/utils/index.js +2 -0
- package/dist/customer-types/utils/index.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/utils/country-helpers.d.ts +12 -0
- package/dist/utils/country-helpers.d.ts.map +1 -0
- package/dist/utils/country-helpers.js +46 -0
- package/dist/utils/country-helpers.js.map +1 -0
- package/dist/utils/index.d.ts +3 -0
- package/dist/utils/index.d.ts.map +1 -0
- package/dist/utils/index.js +3 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/step-version-helper.d.ts +12 -0
- package/dist/utils/step-version-helper.d.ts.map +1 -0
- package/dist/utils/step-version-helper.js +94 -0
- package/dist/utils/step-version-helper.js.map +1 -0
- package/package.json +6 -4
- package/src/address-suggestion-popover/components/address-suggestion-popover.tsx +10 -16
- package/src/company-profile/components/company-profile-form.tsx +206 -137
- package/src/company-profile/stores/company-profile-form.store.ts +109 -38
- package/src/components/card-selector/add-card-selector.tsx +22 -0
- package/src/components/card-selector/card-selector.module.less +141 -0
- package/src/components/card-selector/card-selector.module.less.d.ts +12 -0
- package/src/components/card-selector/card-selector.tsx +110 -0
- package/src/components/card-selector/index.ts +2 -0
- package/src/components/index.ts +2 -0
- package/src/components/zip-code-input.tsx +44 -0
- package/src/customer-types/assets/icon-commercial-construction.svg +43 -0
- package/src/customer-types/assets/icon-commercial.svg +25 -0
- package/src/customer-types/assets/icon-residential-construction.svg +41 -0
- package/src/customer-types/assets/icon-residential.svg +19 -0
- package/src/customer-types/components/customer-types-form.module.less +7 -0
- package/src/customer-types/components/customer-types-form.module.less.d.ts +4 -0
- package/src/customer-types/components/customer-types-selector.tsx +60 -0
- package/src/customer-types/components/index.ts +1 -0
- package/src/customer-types/index.ts +3 -0
- package/src/customer-types/stores/customer-type-form.store.ts +66 -0
- package/src/customer-types/stores/index.ts +1 -0
- package/src/customer-types/utils/customer-types.ts +6 -0
- package/src/customer-types/utils/index.ts +1 -0
- package/src/index.ts +3 -0
- package/src/utils/__tests__/country-helpers.test.ts +31 -0
- package/src/utils/country-helpers.ts +60 -0
- package/src/utils/index.ts +2 -0
- package/src/utils/step-version-helper.ts +61 -0
|
@@ -16,9 +16,8 @@ export interface AddressSuggestionResult {
|
|
|
16
16
|
title: string;
|
|
17
17
|
value: AddressModel;
|
|
18
18
|
}
|
|
19
|
-
export declare const countryValues: Map<string, string>;
|
|
20
19
|
export interface AddressSuggestionsProvider {
|
|
21
|
-
getSuggestions(address: AddressModel): Promise<AddressSuggestionResult[] | undefined
|
|
20
|
+
getSuggestions(address: AddressModel): Promise<AddressSuggestionResult[] | undefined | string>;
|
|
22
21
|
}
|
|
23
22
|
export interface AddressSuggestionPopoverProps extends PopoverProps {
|
|
24
23
|
currentAddress: AddressModel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-suggestion-popover.d.ts","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAA6B,YAAY,EAAW,MAAM,6BAA6B,CAAC;
|
|
1
|
+
{"version":3,"file":"address-suggestion-popover.d.ts","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAA6B,YAAY,EAAW,MAAM,6BAA6B,CAAC;AAK/F,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,YAAY,CAAC;CACvB;AAOD,MAAM,WAAW,0BAA0B;IACvC,cAAc,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,uBAAuB,EAAE,GAAG,SAAS,GAAG,MAAM,CAAC,CAAC;CAClG;AAED,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IAC/D,cAAc,EAAE,YAAY,CAAC;IAC7B,0BAA0B,EAAE,0BAA0B,CAAC;IACvD,kBAAkB,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CAsEtE,CAAC"}
|
|
@@ -24,14 +24,10 @@ import { useBoolean } from '@servicetitan/react-hooks';
|
|
|
24
24
|
import { BodyText, Button, Popover, Spinner } from '@servicetitan/design-system';
|
|
25
25
|
import { observer } from 'mobx-react';
|
|
26
26
|
import * as styles from './styles.module.less';
|
|
27
|
-
|
|
28
|
-
['us', 'USA'],
|
|
29
|
-
['can', 'Canada'],
|
|
30
|
-
['ca', 'Canada'],
|
|
31
|
-
]);
|
|
27
|
+
import { getCountry } from '../../utils/country-helpers';
|
|
32
28
|
const withVerifiedCountryValue = (address) => {
|
|
33
29
|
var _a;
|
|
34
|
-
address.country = (_a =
|
|
30
|
+
address.country = (_a = getCountry(address.country)) !== null && _a !== void 0 ? _a : address.country;
|
|
35
31
|
return address;
|
|
36
32
|
};
|
|
37
33
|
export const AddressSuggestionPopover = observer((_a) => {
|
|
@@ -56,6 +52,6 @@ export const AddressSuggestionPopover = observer((_a) => {
|
|
|
56
52
|
bootstrap();
|
|
57
53
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
58
54
|
}, [restProps.open]);
|
|
59
|
-
return (_jsx(Popover, Object.assign({ portal: portal, width: width, direction: direction, padding: padding }, restProps, { children: isLoading ? (_jsx("div", Object.assign({ className: "d-f justify-content-center" }, { children: _jsx(Spinner, { size: "tiny" }) }))) : (results === null || results === void 0 ? void 0 : results.length) ? (results.map(result => (_jsx(Button, Object.assign({ full: true, fill: "subtle", className: styles.verifyAddressBtn, color: "primary", onClick: () => onSuggestionSelect(withVerifiedCountryValue(result.value)) }, { children: result.title }), result.key))))
|
|
55
|
+
return (_jsx(Popover, Object.assign({ portal: portal, width: width, direction: direction, padding: padding }, restProps, { children: isLoading ? (_jsx("div", Object.assign({ className: "d-f justify-content-center" }, { children: _jsx(Spinner, { size: "tiny" }) }))) : typeof results === 'string' || !(results === null || results === void 0 ? void 0 : results.length) ? (_jsx(BodyText, Object.assign({ className: "ta-center", size: "small" }, { children: typeof results === 'string' ? results : 'No suggestions' }))) : (results.map(result => (_jsx(Button, Object.assign({ full: true, fill: "subtle", className: styles.verifyAddressBtn, color: "primary", onClick: () => onSuggestionSelect(withVerifiedCountryValue(result.value)) }, { children: result.title }), result.key)))) })));
|
|
60
56
|
});
|
|
61
57
|
//# sourceMappingURL=address-suggestion-popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-suggestion-popover.js","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAM,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAgB,OAAO,EAAE,MAAM,6BAA6B,CAAC;AAC/F,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,KAAK,MAAM,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"address-suggestion-popover.js","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAM,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAC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E,CAAC;aACpB;QACL,CAAC,CAAA,CAAC;QACF,SAAS,EAAE,CAAC;QACZ,uDAAuD;IAC3D,CAAC,EAAE,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IAErB,OAAO,CACH,KAAC,OAAO,kBACJ,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,KAAK,EACZ,SAAS,EAAE,SAAS,EACpB,OAAO,EAAE,OAAO,IACZ,SAAS,cAEZ,SAAS,CAAC,CAAC,CAAC,CACT,4BAAK,SAAS,EAAC,4BAA4B,gBACvC,KAAC,OAAO,IAAC,IAAI,EAAC,MAAM,GAAG,IACrB,CACT,CAAC,CAAC,CAAC,OAAO,OAAO,KAAK,QAAQ,IAAI,CAAC,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,MAAM,CAAA,CAAC,CAAC,CAAC,CAClD,KAAC,QAAQ,kBAAC,SAAS,EAAC,WAAW,EAAC,IAAI,EAAC,OAAO,gBACvC,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,gBAAgB,IAClD,CACd,CAAC,CAAC,CAAC,CACA,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,EAAE,CAAC,CAClB,KAAC,MAAM,kBAEH,IAAI,QACJ,IAAI,EAAC,QAAQ,EACb,SAAS,EAAE,MAAM,CAAC,gBAAgB,EAClC,KAAK,EAAC,SAAS,EACf,OAAO,EAAE,GAAG,EAAE,CACV,kBAAkB,CAAC,wBAAwB,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,gBAG7D,MAAM,CAAC,KAAK,KATR,MAAM,CAAC,GAAG,CAUV,CACZ,CAAC,CACL,IACK,CACb,CAAC;AACN,CAAC,CACJ,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { ElementType } from 'react';
|
|
2
|
+
import { AddressSuggestionsProvider } from '../../address-suggestion-popover';
|
|
3
|
+
interface CompanyProfileFormProps {
|
|
3
4
|
className?: string;
|
|
4
|
-
|
|
5
|
+
el?: ElementType;
|
|
6
|
+
addressSuggestionsProvider?: AddressSuggestionsProvider;
|
|
7
|
+
}
|
|
8
|
+
export declare const CompanyProfileForm: ({ className, el: Element, addressSuggestionsProvider }: CompanyProfileFormProps) => JSX.Element;
|
|
9
|
+
export {};
|
|
5
10
|
//# sourceMappingURL=company-profile-form.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.d.ts","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"company-profile-form.d.ts","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,WAAW,EAA6B,MAAM,OAAO,CAAC;AAC/D,OAAO,EAEH,0BAA0B,EAC7B,MAAM,kCAAkC,CAAC;AAK1C,UAAU,uBAAuB;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,0BAA0B,CAAC,EAAE,0BAA0B,CAAC;CAC3D;AAED,eAAO,MAAM,kBAAkB,2DACqC,uBAAuB,gBAoM1F,CAAC"}
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Form } from '@servicetitan/design-system';
|
|
2
|
+
import { Button, Form } from '@servicetitan/design-system';
|
|
3
|
+
import { MaskedInput } from '@servicetitan/form';
|
|
4
|
+
import { useBoolean } from '@servicetitan/react-hooks';
|
|
5
|
+
import { useDependencies } from '@servicetitan/react-ioc';
|
|
3
6
|
import classNames from 'classnames';
|
|
4
|
-
import { CountryDropdownInput } from './country-dropdown-input';
|
|
5
7
|
import { observer } from 'mobx-react';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
+
import { useEffect } from 'react';
|
|
9
|
+
import { AddressSuggestionPopover, } from '../../address-suggestion-popover';
|
|
8
10
|
import { CompanyProfileFormStore } from '../stores/company-profile-form.store';
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
import { CountryDropdownInput } from './country-dropdown-input';
|
|
12
|
+
import { StateAndProvinceDropdownInput } from './state-and-province-dropdown-input';
|
|
13
|
+
export const CompanyProfileForm = observer(({ className, el: Element = Form, addressSuggestionsProvider }) => {
|
|
14
|
+
var _a;
|
|
15
|
+
const [{ form, showFormError, zipCodeMask, einOrBnMask, einOrBnInputProps, countries, countryAndRegionData, regionToCodeMap, phoneMask, suggestionAddressModel, applyAddressSuggestion, setNeedAddressValidation, withAddressValidation, },] = useDependencies(CompanyProfileFormStore);
|
|
12
16
|
const zipCodeOnChangeHandler = (zip) => {
|
|
13
|
-
form.$.companyZipCode.onChange(zip);
|
|
17
|
+
form.$.address.$.companyZipCode.onChange(zip);
|
|
14
18
|
};
|
|
15
19
|
const einOrBnOnChangeHandler = (einOrBn) => {
|
|
16
20
|
form.$.einOrBn.onChange((einOrBn || '').replace(/[^0-9.]/g, ''));
|
|
@@ -19,14 +23,26 @@ export const CompanyProfileForm = observer((props) => {
|
|
|
19
23
|
form.$.adminPhone.onChange((phone || '').replace(/[^0-9.]/g, ''));
|
|
20
24
|
};
|
|
21
25
|
const countryOnChangeHandler = (event, data) => {
|
|
22
|
-
if (form.$.companyCountry.value &&
|
|
23
|
-
form.$.
|
|
26
|
+
if (form.$.address.$.companyCountry.value &&
|
|
27
|
+
data.value !== form.$.address.$.companyCountry.value) {
|
|
28
|
+
form.$.address.$.companyStateCode.onChange('');
|
|
24
29
|
}
|
|
25
|
-
form.$.companyCountry.onChangeHandler(event, data);
|
|
30
|
+
form.$.address.$.companyCountry.onChangeHandler(event, data);
|
|
26
31
|
};
|
|
27
|
-
const { companyName, companyStreetAddress, companyCity, companyCountry, companyStateCode, companyZipCode, adminPhone, einOrBn, } = form.$;
|
|
32
|
+
const { companyName, address: { $: { companyStreetAddress, companyCity, companyCountry, companyStateCode, companyZipCode, isCompanyAddressVerified, }, hasFormError: addressHasFormError, }, adminPhone, einOrBn, } = form.$;
|
|
28
33
|
const zipCodeHasError = companyZipCode.hasError;
|
|
29
|
-
|
|
34
|
+
const [isAddressSuggestionsOpen, { setTrue: openAddressSuggestions, setFalse: closeAddressSuggestions },] = useBoolean(false);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
setNeedAddressValidation(!!addressSuggestionsProvider);
|
|
37
|
+
}, [setNeedAddressValidation, addressSuggestionsProvider]);
|
|
38
|
+
const showAddressValidation = withAddressValidation && !isCompanyAddressVerified.value;
|
|
39
|
+
return (_jsxs(Element, Object.assign({ size: "tiny", className: classNames(className, 'ta-left', 'p-x-6') }, { children: [_jsx(Form.Input, { label: "Company Name", placeholder: "Company Name", value: companyName.value, onChange: companyName.onChangeHandler, error: (companyName.dirty || showFormError) && companyName.hasError }), _jsxs("div", Object.assign({ className: classNames('d-f', {
|
|
40
|
+
'gap-2': showAddressValidation,
|
|
41
|
+
}) }, { children: [_jsx(Form.Input, { className: "flex-grow-1", label: "Street Address", placeholder: "Street Address", value: companyStreetAddress.value, onChange: companyStreetAddress.onChangeHandler, error: (companyStreetAddress.dirty || showFormError) &&
|
|
42
|
+
(companyStreetAddress.hasError || addressHasFormError) }), _jsx(Form.Field, Object.assign({ label: '\u00a0' }, { children: showAddressValidation && (_jsx(AddressSuggestionPopover, { addressSuggestionsProvider: addressSuggestionsProvider, open: isAddressSuggestionsOpen, onClickOutside: closeAddressSuggestions, trigger: _jsx(Button, { "aria-label": "Open address suggestions", iconName: "place", outline: true, onClick: openAddressSuggestions, negative: addressHasFormError }), currentAddress: suggestionAddressModel, onSuggestionSelect: suggestedAddress => {
|
|
43
|
+
applyAddressSuggestion(suggestedAddress);
|
|
44
|
+
closeAddressSuggestions();
|
|
45
|
+
} })) }))] })), _jsxs(Form.Group, Object.assign({ width: "equal" }, { children: [_jsx(Form.Input, { fluid: true, label: "City", placeholder: "City", className: "p-r-0", width: "6", value: companyCity.value, onChange: companyCity.onChangeHandler, error: (companyCity.dirty || showFormError) && companyCity.hasError }), _jsx(StateAndProvinceDropdownInput, { width: "6", countryCode: (_a = companyCountry.value) !== null && _a !== void 0 ? _a : 'USA', fieldState: companyStateCode, error: (companyStateCode.dirty || showFormError) && companyStateCode.hasError, countryAndRegionData: countryAndRegionData, regionNameToCodeMap: regionToCodeMap })] })), _jsxs(Form.Group, Object.assign({ width: "equal" }, { children: [_jsx(MaskedInput, { fluid: true, label: "ZIP Code", placeholder: "ZIP Code", value: companyZipCode.value, onChange: zipCodeOnChangeHandler, mask: zipCodeMask, className: "p-r-0", maskChar: " ", error: (companyZipCode.dirty || showFormError) && zipCodeHasError, width: 6 }), _jsx(CountryDropdownInput, { width: "6", value: companyCountry.value, onChange: countryOnChangeHandler, error: (companyCountry.dirty || showFormError) && companyCountry.hasError, options: countries.map(x => ({
|
|
30
46
|
key: x,
|
|
31
47
|
value: x,
|
|
32
48
|
text: x === 'USA' ? 'United States' : x,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.js","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"company-profile-form.js","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,MAAM,EAAE,IAAI,EAAqB,MAAM,6BAA6B,CAAC;AAC9E,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AACvD,OAAO,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAA+B,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/D,OAAO,EACH,wBAAwB,GAE3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,CAAC,CAAC,GACL,KACO,EACb,MAAC,IAAI,CAAC,KAAK,kBAAC,KAAK,EAAC,OAAO,iBACrB,KAAC,WAAW,IACR,KAAK,QACL,KAAK,EAAC,cAAc,EACpB,WAAW,EAAC,cAAc,EAC1B,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,QAAQ,EAAE,oBAAoB,EAC9B,KAAK,EAAE,CAAC,UAAU,CAAC,KAAK,IAAI,aAAa,CAAC,IAAI,UAAU,CAAC,QAAQ,EACjE,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,CAAC,GACV,EACF,KAAC,WAAW,IACR,KAAK,QACL,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAC9B,WAAW,EAAE,iBAAiB,CAAC,WAAW,EAC1C,KAAK,EAAE,OAAO,CAAC,KAAK,EACpB,QAAQ,EAAE,sBAAsB,EAChC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAC,OAAO,EACjB,QAAQ,EAAC,GAAG,EACZ,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,IAAI,OAAO,CAAC,QAAQ,EAC3D,KAAK,EAAE,CAAC,GACV,KACO,KACP,CACb,CAAC;AACN,CAAC,CACJ,CAAC"}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import { DropdownFieldState, InputFieldState } from '@servicetitan/form';
|
|
1
2
|
import { FieldState, FormState } from 'formstate';
|
|
2
|
-
import {
|
|
3
|
+
import { AddressModel } from '../../address-suggestion-popover';
|
|
4
|
+
import { CountryType } from '../../utils/country-helpers';
|
|
3
5
|
export interface DropdownRegion {
|
|
4
6
|
Code: string;
|
|
5
7
|
Name: string;
|
|
@@ -17,18 +19,22 @@ export interface ProfileModel {
|
|
|
17
19
|
companyCity?: string | undefined;
|
|
18
20
|
companyZipCode?: string | undefined;
|
|
19
21
|
einOrBn?: string | undefined;
|
|
22
|
+
isCompanyAddressVerified?: boolean;
|
|
20
23
|
}
|
|
21
|
-
|
|
22
|
-
[key: string]: FieldState<any>;
|
|
23
|
-
companyName: InputFieldState<string>;
|
|
24
|
-
adminPhone: InputFieldState<string>;
|
|
24
|
+
declare type AddressFormType = {
|
|
25
25
|
companyStreetAddress: InputFieldState<string>;
|
|
26
|
-
companyCountry: DropdownFieldState<
|
|
26
|
+
companyCountry: DropdownFieldState<CountryType | ''>;
|
|
27
27
|
companyStateCode: DropdownFieldState<string>;
|
|
28
28
|
companyCity: InputFieldState<string>;
|
|
29
29
|
companyZipCode: InputFieldState<string>;
|
|
30
|
+
isCompanyAddressVerified: FieldState<boolean>;
|
|
31
|
+
};
|
|
32
|
+
export declare type ICompanyProfileFormType = {
|
|
33
|
+
companyName: InputFieldState<string>;
|
|
34
|
+
adminPhone: InputFieldState<string>;
|
|
30
35
|
einOrBn: InputFieldState<string>;
|
|
31
|
-
|
|
36
|
+
address: FormState<AddressFormType>;
|
|
37
|
+
};
|
|
32
38
|
export interface ICompanyProfileFormStore {
|
|
33
39
|
showFormError: boolean;
|
|
34
40
|
isInitializing: boolean;
|
|
@@ -48,18 +54,28 @@ export declare class CompanyProfileFormStore implements ICompanyProfileFormStore
|
|
|
48
54
|
countryAndRegionData: CountryWithRegions[];
|
|
49
55
|
phoneMask: string;
|
|
50
56
|
regionToCodeMap: Map<string, string>;
|
|
57
|
+
withAddressValidation: boolean;
|
|
51
58
|
form: FormState<ICompanyProfileFormType>;
|
|
52
59
|
constructor();
|
|
60
|
+
setNeedAddressValidation: (value: boolean) => void;
|
|
53
61
|
setFormErrorCheck: (value: boolean) => void;
|
|
54
|
-
|
|
55
|
-
get
|
|
56
|
-
get einOrBnMask(): "999999999" | "99-9999999";
|
|
62
|
+
get zipCodeMask(): string;
|
|
63
|
+
get einOrBnMask(): string;
|
|
57
64
|
get einOrBnInputProps(): {
|
|
58
65
|
label: string;
|
|
59
66
|
placeholder: string;
|
|
60
67
|
};
|
|
61
68
|
initForm: (formData: ProfileModel, options: CompanyProfileFormOptions) => void;
|
|
62
69
|
commitForm: () => void;
|
|
70
|
+
applyAddressSuggestion: (suggestedAddress: AddressModel) => void;
|
|
71
|
+
get suggestionAddressModel(): {
|
|
72
|
+
street: string;
|
|
73
|
+
city: string;
|
|
74
|
+
zip: string;
|
|
75
|
+
state: string;
|
|
76
|
+
country: "" | CountryType;
|
|
77
|
+
};
|
|
78
|
+
private get addressFields();
|
|
63
79
|
}
|
|
64
80
|
export {};
|
|
65
81
|
//# sourceMappingURL=company-profile-form.store.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.store.d.ts","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"company-profile-form.store.d.ts","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAEH,kBAAkB,EAClB,eAAe,EAElB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAElD,OAAO,EAAE,YAAY,EAAE,MAAM,kCAAkC,CAAC;AAChE,OAAO,EAIH,WAAW,EAId,MAAM,6BAA6B,CAAC;AAKrC,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,CAAC,EAAE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UAAS;IACvB,SAAS,EAAE,MAAM,EAAE,CAAM;IACzB,oBAAoB,EAAE,kBAAkB,EAAE,CAAM;IAChD,SAAS,SAAM;IACf,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IACjD,qBAAqB,UAAS;IAE1C,IAAI,EAAE,SAAS,CAAC,uBAAuB,CAAC,CAoBrC;;IAqBH,wBAAwB,UAAW,OAAO,UAExC;IAGF,iBAAiB,UAAW,OAAO,UAEjC;IAEF,IACI,WAAW,WAEd;IAED,IACI,WAAW,WAEd;IAED,IACI,iBAAiB;;;MAUpB;IAGD,QAAQ,aAAc,YAAY,WAAW,yBAAyB,UAiBpE;IAGF,UAAU,aAAoC;IAG9C,sBAAsB,qBAAsB,YAAY,UAgBtD;IAEF,IACI,sBAAsB;;;;;;MASzB;IAGD,OAAO,KAAK,aAAa,GASxB;CACJ"}
|
|
@@ -7,16 +7,13 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
-
import {
|
|
11
|
-
import { InputFieldState, DropdownFieldState, commitFormState, setFormStateValues, } from '@servicetitan/form';
|
|
10
|
+
import { commitFormState, DropdownFieldState, InputFieldState, setFormStateValues, } from '@servicetitan/form';
|
|
12
11
|
import { injectable } from '@servicetitan/react-ioc';
|
|
12
|
+
import { FieldState, FormState } from 'formstate';
|
|
13
|
+
import { action, computed, makeObservable, observable } from 'mobx';
|
|
14
|
+
import { Country, countryToEinBnMaskMap, countryToZipMaskMap, getCountry, isCountry, zipCodeValidator, } from '../../utils/country-helpers';
|
|
13
15
|
import { PhoneValidator } from '../utils/validators';
|
|
14
|
-
import { computed, action, observable, makeObservable } from 'mobx';
|
|
15
16
|
const required = (value) => (!value || value.length === 0) && 'cannot be empty string';
|
|
16
|
-
const usZipMask = '99999';
|
|
17
|
-
const canadaZipMask = '*** ***';
|
|
18
|
-
const canadaBNMask = '999999999';
|
|
19
|
-
const usEinMask = '99-9999999';
|
|
20
17
|
let CompanyProfileFormStore = class CompanyProfileFormStore {
|
|
21
18
|
constructor() {
|
|
22
19
|
Object.defineProperty(this, "showFormError", {
|
|
@@ -55,6 +52,12 @@ let CompanyProfileFormStore = class CompanyProfileFormStore {
|
|
|
55
52
|
writable: true,
|
|
56
53
|
value: new Map()
|
|
57
54
|
});
|
|
55
|
+
Object.defineProperty(this, "withAddressValidation", {
|
|
56
|
+
enumerable: true,
|
|
57
|
+
configurable: true,
|
|
58
|
+
writable: true,
|
|
59
|
+
value: false
|
|
60
|
+
});
|
|
58
61
|
Object.defineProperty(this, "form", {
|
|
59
62
|
enumerable: true,
|
|
60
63
|
configurable: true,
|
|
@@ -62,29 +65,36 @@ let CompanyProfileFormStore = class CompanyProfileFormStore {
|
|
|
62
65
|
value: new FormState({
|
|
63
66
|
companyName: new InputFieldState('').validators(required),
|
|
64
67
|
adminPhone: new InputFieldState(''),
|
|
65
|
-
companyStreetAddress: new InputFieldState('').validators(required),
|
|
66
|
-
companyCountry: new DropdownFieldState('').validators(required),
|
|
67
|
-
companyStateCode: new DropdownFieldState('').validators(required),
|
|
68
|
-
companyCity: new InputFieldState('').validators(required),
|
|
69
|
-
companyZipCode: new InputFieldState('').validators(required),
|
|
70
68
|
einOrBn: new InputFieldState(''),
|
|
69
|
+
address: new FormState({
|
|
70
|
+
companyStreetAddress: new InputFieldState('').validators(required),
|
|
71
|
+
companyCountry: new DropdownFieldState('').validators(required),
|
|
72
|
+
companyStateCode: new DropdownFieldState('').validators(required),
|
|
73
|
+
companyCity: new InputFieldState('').validators(required),
|
|
74
|
+
companyZipCode: new InputFieldState('').validators(required),
|
|
75
|
+
isCompanyAddressVerified: new FieldState(false),
|
|
76
|
+
}).validators($ => {
|
|
77
|
+
if (!this.withAddressValidation) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
return (!$.isCompanyAddressVerified.value && 'Please validate/confirm your Company Address.');
|
|
81
|
+
}),
|
|
71
82
|
})
|
|
72
83
|
});
|
|
73
|
-
Object.defineProperty(this, "
|
|
84
|
+
Object.defineProperty(this, "setNeedAddressValidation", {
|
|
74
85
|
enumerable: true,
|
|
75
86
|
configurable: true,
|
|
76
87
|
writable: true,
|
|
77
88
|
value: (value) => {
|
|
78
|
-
this.
|
|
89
|
+
this.withAddressValidation = value;
|
|
79
90
|
}
|
|
80
91
|
});
|
|
81
|
-
Object.defineProperty(this, "
|
|
92
|
+
Object.defineProperty(this, "setFormErrorCheck", {
|
|
82
93
|
enumerable: true,
|
|
83
94
|
configurable: true,
|
|
84
95
|
writable: true,
|
|
85
|
-
value: (
|
|
86
|
-
|
|
87
|
-
return lowerCountry === 'ca' || lowerCountry === 'canada';
|
|
96
|
+
value: (value) => {
|
|
97
|
+
this.showFormError = value;
|
|
88
98
|
}
|
|
89
99
|
});
|
|
90
100
|
Object.defineProperty(this, "initForm", {
|
|
@@ -92,17 +102,21 @@ let CompanyProfileFormStore = class CompanyProfileFormStore {
|
|
|
92
102
|
configurable: true,
|
|
93
103
|
writable: true,
|
|
94
104
|
value: (formData, options) => {
|
|
95
|
-
var _a;
|
|
105
|
+
var _a, _b, _c, _d;
|
|
96
106
|
this.form.$.adminPhone.validators(PhoneValidator(options.phonePattern, false));
|
|
97
107
|
this.countries = options.countries;
|
|
98
108
|
this.countryAndRegionData = options.countryAndRegionData;
|
|
99
109
|
this.phoneMask = options.phoneMask;
|
|
100
110
|
this.regionToCodeMap = options.regionToCodeMap;
|
|
101
|
-
let companyCountry = formData.companyCountry;
|
|
102
|
-
if (companyCountry && this.countries && !((
|
|
111
|
+
let companyCountry = (_a = getCountry(formData.companyCountry)) !== null && _a !== void 0 ? _a : '';
|
|
112
|
+
if (companyCountry && this.countries && !((_b = this.countries) === null || _b === void 0 ? void 0 : _b.includes(companyCountry))) {
|
|
103
113
|
companyCountry = '';
|
|
104
114
|
}
|
|
105
|
-
|
|
115
|
+
const companyZipCode = (_d = (isCountry(companyCountry, Country.USA)
|
|
116
|
+
? (_c = formData.companyZipCode) === null || _c === void 0 ? void 0 : _c.slice(0, 5)
|
|
117
|
+
: formData.companyZipCode)) !== null && _d !== void 0 ? _d : '';
|
|
118
|
+
setFormStateValues(this.form, Object.assign({}, formData));
|
|
119
|
+
setFormStateValues(this.form.$.address, Object.assign(Object.assign({}, formData), { companyCountry, companyZipCode }));
|
|
106
120
|
commitFormState(this.form);
|
|
107
121
|
}
|
|
108
122
|
});
|
|
@@ -112,27 +126,42 @@ let CompanyProfileFormStore = class CompanyProfileFormStore {
|
|
|
112
126
|
writable: true,
|
|
113
127
|
value: () => commitFormState(this.form)
|
|
114
128
|
});
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
129
|
+
Object.defineProperty(this, "applyAddressSuggestion", {
|
|
130
|
+
enumerable: true,
|
|
131
|
+
configurable: true,
|
|
132
|
+
writable: true,
|
|
133
|
+
value: (suggestedAddress) => {
|
|
134
|
+
this.form.$.address.$.isCompanyAddressVerified.onChange(true);
|
|
135
|
+
setFormStateValues(this.form.$.address, {
|
|
136
|
+
companyStreetAddress: suggestedAddress.street
|
|
137
|
+
? suggestedAddress.street +
|
|
138
|
+
(suggestedAddress.unit ? ', ' + suggestedAddress.unit : '')
|
|
139
|
+
: '',
|
|
140
|
+
companyCity: suggestedAddress.city,
|
|
141
|
+
companyZipCode: suggestedAddress.zip,
|
|
142
|
+
companyStateCode: suggestedAddress.state,
|
|
143
|
+
companyCountry: getCountry(suggestedAddress.country),
|
|
144
|
+
}, true);
|
|
145
|
+
}
|
|
122
146
|
});
|
|
147
|
+
makeObservable(this);
|
|
148
|
+
this.form.$.address.$.companyZipCode.validators(zipCodeValidator(() => this.form.$.address.$.companyCountry.$));
|
|
123
149
|
this.form.$.einOrBn.validators(($) => {
|
|
124
|
-
const errorMessage = `Invalid ${
|
|
150
|
+
const errorMessage = `Invalid ${isCountry(this.form.$.address.$.companyCountry.value, Country.Canada) ? 'BN' : 'EIN'}`;
|
|
125
151
|
return $ && $.length !== 9 && errorMessage;
|
|
126
152
|
});
|
|
153
|
+
this.addressFields.forEach(({ onDidChange }) => {
|
|
154
|
+
onDidChange(() => this.form.$.address.$.isCompanyAddressVerified.onChange(false));
|
|
155
|
+
});
|
|
127
156
|
}
|
|
128
157
|
get zipCodeMask() {
|
|
129
|
-
return this.
|
|
158
|
+
return countryToZipMaskMap[this.form.$.address.$.companyCountry.$ || Country.USA];
|
|
130
159
|
}
|
|
131
160
|
get einOrBnMask() {
|
|
132
|
-
return this.
|
|
161
|
+
return countryToEinBnMaskMap[this.form.$.address.$.companyCountry.$ || Country.USA];
|
|
133
162
|
}
|
|
134
163
|
get einOrBnInputProps() {
|
|
135
|
-
return
|
|
164
|
+
return isCountry(this.form.$.address.$.companyCountry.value, Country.Canada)
|
|
136
165
|
? {
|
|
137
166
|
label: 'BN Number',
|
|
138
167
|
placeholder: 'XXXXXXXXX',
|
|
@@ -142,6 +171,26 @@ let CompanyProfileFormStore = class CompanyProfileFormStore {
|
|
|
142
171
|
placeholder: 'XX-XXXXXXX',
|
|
143
172
|
};
|
|
144
173
|
}
|
|
174
|
+
get suggestionAddressModel() {
|
|
175
|
+
const form = this.form.$.address;
|
|
176
|
+
return {
|
|
177
|
+
street: form.$.companyStreetAddress.$,
|
|
178
|
+
city: form.$.companyCity.$,
|
|
179
|
+
zip: form.$.companyZipCode.$,
|
|
180
|
+
state: form.$.companyStateCode.$,
|
|
181
|
+
country: form.$.companyCountry.$,
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
get addressFields() {
|
|
185
|
+
const form = this.form.$.address;
|
|
186
|
+
return [
|
|
187
|
+
form.$.companyStreetAddress,
|
|
188
|
+
form.$.companyCity,
|
|
189
|
+
form.$.companyZipCode,
|
|
190
|
+
form.$.companyStateCode,
|
|
191
|
+
form.$.companyCountry,
|
|
192
|
+
];
|
|
193
|
+
}
|
|
145
194
|
};
|
|
146
195
|
__decorate([
|
|
147
196
|
observable,
|
|
@@ -167,6 +216,14 @@ __decorate([
|
|
|
167
216
|
observable,
|
|
168
217
|
__metadata("design:type", Map)
|
|
169
218
|
], CompanyProfileFormStore.prototype, "regionToCodeMap", void 0);
|
|
219
|
+
__decorate([
|
|
220
|
+
observable,
|
|
221
|
+
__metadata("design:type", Object)
|
|
222
|
+
], CompanyProfileFormStore.prototype, "withAddressValidation", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
action,
|
|
225
|
+
__metadata("design:type", Object)
|
|
226
|
+
], CompanyProfileFormStore.prototype, "setNeedAddressValidation", void 0);
|
|
170
227
|
__decorate([
|
|
171
228
|
action,
|
|
172
229
|
__metadata("design:type", Object)
|
|
@@ -194,6 +251,20 @@ __decorate([
|
|
|
194
251
|
action,
|
|
195
252
|
__metadata("design:type", Object)
|
|
196
253
|
], CompanyProfileFormStore.prototype, "commitForm", void 0);
|
|
254
|
+
__decorate([
|
|
255
|
+
action,
|
|
256
|
+
__metadata("design:type", Object)
|
|
257
|
+
], CompanyProfileFormStore.prototype, "applyAddressSuggestion", void 0);
|
|
258
|
+
__decorate([
|
|
259
|
+
computed,
|
|
260
|
+
__metadata("design:type", Object),
|
|
261
|
+
__metadata("design:paramtypes", [])
|
|
262
|
+
], CompanyProfileFormStore.prototype, "suggestionAddressModel", null);
|
|
263
|
+
__decorate([
|
|
264
|
+
computed,
|
|
265
|
+
__metadata("design:type", Object),
|
|
266
|
+
__metadata("design:paramtypes", [])
|
|
267
|
+
], CompanyProfileFormStore.prototype, "addressFields", null);
|
|
197
268
|
CompanyProfileFormStore = __decorate([
|
|
198
269
|
injectable(),
|
|
199
270
|
__metadata("design:paramtypes", [])
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.store.js","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"company-profile-form.store.js","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACH,eAAe,EACf,kBAAkB,EAClB,eAAe,EACf,kBAAkB,GACrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AACrD,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAEpE,OAAO,EACH,OAAO,EACP,qBAAqB,EACrB,mBAAmB,EAEnB,UAAU,EACV,SAAS,EACT,gBAAgB,GACnB,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,wBAAwB,CAAC;AAyD/F,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IA+BhC;QA9BY;;;;mBAAgB,KAAK;WAAC;QACtB;;;;mBAAiB,KAAK;WAAC;QACvB;;;;mBAAsB,EAAE;WAAC;QACzB;;;;mBAA6C,EAAE;WAAC;QAChD;;;;mBAAY,EAAE;WAAC;QACf;;;;mBAAuC,IAAI,GAAG,EAAE;WAAC;QACjD;;;;mBAAwB,KAAK;WAAC;QAE1C;;;;mBAA2C,IAAI,SAAS,CAAC;gBACrD,WAAW,EAAE,IAAI,eAAe,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;gBACzD,UAAU,EAAE,IAAI,eAAe,CAAC,EAAE,CAAC;gBACnC,OAAO,EAAE,IAAI,eAAe,CAAC,EAAE,CAAC;gBAChC,OAAO,EAAE,I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AC,CAAC,OAAO,CAAC;QACjC,OAAO;YACH,IAAI,CAAC,CAAC,CAAC,oBAAoB;YAC3B,IAAI,CAAC,CAAC,CAAC,WAAW;YAClB,IAAI,CAAC,CAAC,CAAC,cAAc;YACrB,IAAI,CAAC,CAAC,CAAC,gBAAgB;YACvB,IAAI,CAAC,CAAC,CAAC,cAAc;SACxB,CAAC;IACN,CAAC;CACJ,CAAA;AAlJe;IAAX,UAAU;;8DAAuB;AACtB;IAAX,UAAU;;+DAAwB;AACvB;IAAX,UAAU;;0DAA0B;AACzB;IAAX,UAAU;;qEAAiD;AAChD;IAAX,UAAU;;0DAAgB;AACf;IAAX,UAAU;8BAAkB,GAAG;gEAA6B;AACjD;IAAX,UAAU;;sEAA+B;AA2C1C;IADC,MAAM;;yEAGL;AAGF;IADC,MAAM;;kEAGL;AAGF;IADC,QAAQ;;;0DAGR;AAGD;IADC,QAAQ;;;0DAGR;AAGD;IADC,QAAQ;;;gEAWR;AAGD;IADC,MAAM;;yDAkBL;AAGF;IADC,MAAM;;2DACuC;AAG9C;IADC,MAAM;;uEAiBL;AAGF;IADC,QAAQ;;;qEAUR;AAGD;IADC,QAAQ;;;4DAUR;AAlJQ,uBAAuB;IADnC,UAAU,EAAE;;GACA,uBAAuB,CAmJnC;SAnJY,uBAAuB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-card-selector.d.ts","sourceRoot":"","sources":["../../../src/components/card-selector/add-card-selector.tsx"],"names":[],"mappings":";AAIA,UAAU,KAAK;IACX,iBAAiB,EAAE,MAAM,CAAC;IAC1B,OAAO,IAAI,IAAI,CAAC;CACnB;AAED,eAAO,MAAM,eAAe,UAAW,KAAK,gBAY3C,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import * as Styles from './card-selector.module.less';
|
|
3
|
+
import classnames from 'classnames';
|
|
4
|
+
import { Card } from '@servicetitan/design-system';
|
|
5
|
+
export const AddCardSelector = (props) => {
|
|
6
|
+
return (_jsx(Card, Object.assign({ hoverable: true, placeholder: true, onClick: props.onClick, className: classnames(Styles.cardStyles, Styles.addCardSelector, 'm-x-1'), padding: "thin" }, { children: _jsx("p", { children: props.addCardCustomText }) })));
|
|
7
|
+
};
|
|
8
|
+
//# sourceMappingURL=add-card-selector.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"add-card-selector.js","sourceRoot":"","sources":["../../../src/components/card-selector/add-card-selector.tsx"],"names":[],"mappings":";AAAA,OAAO,KAAK,MAAM,MAAM,6BAA6B,CAAC;AACtD,OAAO,UAAU,MAAM,YAAY,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AAOnD,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,KAAY,EAAE,EAAE;IAC5C,OAAO,CACH,KAAC,IAAI,kBACD,SAAS,QACT,WAAW,QACX,OAAO,EAAE,KAAK,CAAC,OAAO,EACtB,SAAS,EAAE,UAAU,CAAC,MAAM,CAAC,UAAU,EAAE,MAAM,CAAC,eAAe,EAAE,OAAO,CAAC,EACzE,OAAO,EAAC,MAAM,gBAEd,sBAAI,KAAK,CAAC,iBAAiB,GAAK,IAC7B,CACV,CAAC;AACN,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { CheckboxFieldState } from '@servicetitan/form';
|
|
2
|
+
import { Component, PropsWithChildren, SyntheticEvent } from 'react';
|
|
3
|
+
export interface CardSelectorProps {
|
|
4
|
+
id?: number;
|
|
5
|
+
name: string;
|
|
6
|
+
isCustom: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
fieldState: CheckboxFieldState;
|
|
9
|
+
menuIsOpen?: boolean;
|
|
10
|
+
fontStyle?: string;
|
|
11
|
+
control?: 'checkbox' | 'radio';
|
|
12
|
+
className?: string;
|
|
13
|
+
small?: boolean;
|
|
14
|
+
handleMenuClick(): void;
|
|
15
|
+
handleDeleteClick?(): void;
|
|
16
|
+
handleEditClick?(): void;
|
|
17
|
+
handleMenuClose?(): void;
|
|
18
|
+
}
|
|
19
|
+
export declare class CardSelector extends Component<PropsWithChildren<CardSelectorProps>> {
|
|
20
|
+
isChecked: () => boolean;
|
|
21
|
+
onCardClickHandler: (value: string, checked: boolean) => void;
|
|
22
|
+
handleMenuClick: (e: SyntheticEvent<any>) => void;
|
|
23
|
+
handleEditClick: (e: SyntheticEvent<any>) => void;
|
|
24
|
+
render(): JSX.Element;
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=card-selector.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"card-selector.d.ts","sourceRoot":"","sources":["../../../src/components/card-selector/card-selector.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAGxD,OAAO,EAAE,SAAS,EAAY,iBAAiB,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAG/E,MAAM,WAAW,iBAAiB;IAC9B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,UAAU,EAAE,kBAAkB,CAAC;IAC/B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,eAAe,IAAI,IAAI,CAAC;IACxB,iBAAiB,CAAC,IAAI,IAAI,CAAC;IAC3B,eAAe,CAAC,IAAI,IAAI,CAAC;IACzB,eAAe,CAAC,IAAI,IAAI,CAAC;CAC5B;AAED,qBACa,YAAa,SAAQ,SAAS,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,CAAC;IAC7E,SAAS,gBAAqC;IAE9C,kBAAkB,UAAW,MAAM,WAAW,OAAO,UAGnD;IAEF,eAAe,MAAO,eAAe,GAAG,CAAC,UAGvC;IAEF,eAAe,MAAO,eAAe,GAAG,CAAC,UAGvC;IAEF,MAAM;CAkET"}
|