@servicetitan/onboarding-ui 16.1.0 → 16.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.js.map +1 -1
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.js +2 -2
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.js.map +1 -1
- package/dist/company-profile/components/company-profile-form.js +1 -1
- package/dist/company-profile/components/company-profile-form.js.map +1 -1
- package/dist/company-profile/components/country-dropdown-input.js.map +1 -1
- package/dist/company-profile/components/state-and-province-dropdown-input.js.map +1 -1
- package/dist/company-profile/stores/company-profile-form.store.js +1 -2
- package/dist/company-profile/stores/company-profile-form.store.js.map +1 -1
- package/dist/components/card-selector/card-selector.js +1 -1
- package/dist/components/card-selector/card-selector.js.map +1 -1
- package/dist/components/zip-code-input.js.map +1 -1
- package/dist/contentful/marketing-carousel.store.js +2 -2
- package/dist/contentful/marketing-carousel.store.js.map +1 -1
- package/dist/customer-types/components/customer-types-selector.js +1 -1
- package/dist/customer-types/components/customer-types-selector.js.map +1 -1
- package/dist/pusher/presence.store.js +2 -2
- package/dist/pusher/presence.store.js.map +1 -1
- package/dist/pusher/pusher.store.js.map +1 -1
- package/package.json +8 -8
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"sourcesContent":["import { useEffect, useState, FC } from 'react';\nimport { useBoolean } from '@servicetitan/react-hooks';\nimport { BodyText, Button, Popover, PopoverProps, Spinner } from '@servicetitan/design-system';\nimport { observer } from 'mobx-react';\nimport * as styles from './styles.module.less';\nimport { getCountry } from '../../utils/country-helpers';\n\nexport interface AddressModel {\n street?: string;\n unit?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n latitude?: number;\n longitude?: number;\n locationType?: string;\n}\n\nexport interface AddressSuggestionResult {\n key: string;\n title: string;\n value: AddressModel;\n}\n\nconst withVerifiedCountryValue = (address: AddressModel): AddressModel => {\n address.country = getCountry(address.country) ?? address.country;\n return address;\n};\n\nexport interface AddressSuggestionsProvider {\n getSuggestions(address: AddressModel): Promise<AddressSuggestionResult[] | undefined | string>;\n}\n\nexport interface AddressSuggestionPopoverProps extends PopoverProps {\n currentAddress: AddressModel;\n addressSuggestionsProvider: AddressSuggestionsProvider;\n onSuggestionSelect(suggestion: AddressModel): void;\n}\n\nexport const AddressSuggestionPopover: FC<AddressSuggestionPopoverProps> = observer(\n ({\n portal = true,\n width = 'm',\n direction = 'l',\n padding = 's',\n currentAddress,\n addressSuggestionsProvider,\n onSuggestionSelect,\n ...restProps\n }) => {\n const [isLoading, { setFalse: disableLoading, setTrue: enabledLoading }] = useBoolean(true);\n const [results, setResults] =\n useState<Awaited<ReturnType<AddressSuggestionsProvider['getSuggestions']>>>(undefined);\n\n useEffect(() => {\n const bootstrap = async () => {\n if (!restProps.open) {\n return;\n }\n\n enabledLoading();\n setResults(undefined);\n\n try {\n const results = await addressSuggestionsProvider.getSuggestions(currentAddress);\n setResults(results);\n } finally {\n disableLoading();\n }\n };\n bootstrap();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [restProps.open]);\n\n return (\n <Popover\n portal={portal}\n width={width}\n direction={direction}\n padding={padding}\n {...restProps}\n >\n {isLoading ? (\n <div className=\"d-f justify-content-center\">\n <Spinner size=\"tiny\" />\n </div>\n ) : typeof results === 'string' || !results?.length ? (\n <BodyText className=\"ta-center\" size=\"small\">\n {typeof results === 'string' ? results : 'No suggestions'}\n </BodyText>\n ) : (\n results.map(result => (\n <Button\n key={result.key}\n full\n fill=\"subtle\"\n className={styles.verifyAddressBtn}\n color=\"primary\"\n onClick={() =>\n onSuggestionSelect(withVerifiedCountryValue(result.value))\n }\n >\n {result.title}\n </Button>\n ))\n )}\n </Popover>\n );\n }\n);\n"],"names":["useEffect","useState","useBoolean","BodyText","Button","Popover","Spinner","observer","styles","getCountry","withVerifiedCountryValue","address","country","AddressSuggestionPopover","portal","width","direction","padding","currentAddress","addressSuggestionsProvider","onSuggestionSelect","restProps","isLoading","setFalse","disableLoading","setTrue","enabledLoading","results","setResults","undefined","bootstrap","open","getSuggestions","div","className","size","length","map","result","full","fill","verifyAddressBtn","color","onClick","value","title","key"],"mappings":";AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAY,QAAQ;AAChD,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAgBC,OAAO,QAAQ,8BAA8B;AAC/F,SAASC,QAAQ,QAAQ,aAAa;AACtC,YAAYC,YAAY,uBAAuB;AAC/C,SAASC,UAAU,QAAQ,8BAA8B;AAoBzD,MAAMC,2BAA2B,CAACC;QACZF;IAAlBE,QAAQC,OAAO,
|
|
1
|
+
{"version":3,"sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"sourcesContent":["import { useEffect, useState, FC } from 'react';\nimport { useBoolean } from '@servicetitan/react-hooks';\nimport { BodyText, Button, Popover, PopoverProps, Spinner } from '@servicetitan/design-system';\nimport { observer } from 'mobx-react';\nimport * as styles from './styles.module.less';\nimport { getCountry } from '../../utils/country-helpers';\n\nexport interface AddressModel {\n street?: string;\n unit?: string;\n city?: string;\n state?: string;\n zip?: string;\n country?: string;\n latitude?: number;\n longitude?: number;\n locationType?: string;\n}\n\nexport interface AddressSuggestionResult {\n key: string;\n title: string;\n value: AddressModel;\n}\n\nconst withVerifiedCountryValue = (address: AddressModel): AddressModel => {\n address.country = getCountry(address.country) ?? address.country;\n return address;\n};\n\nexport interface AddressSuggestionsProvider {\n getSuggestions(address: AddressModel): Promise<AddressSuggestionResult[] | undefined | string>;\n}\n\nexport interface AddressSuggestionPopoverProps extends PopoverProps {\n currentAddress: AddressModel;\n addressSuggestionsProvider: AddressSuggestionsProvider;\n onSuggestionSelect(suggestion: AddressModel): void;\n}\n\nexport const AddressSuggestionPopover: FC<AddressSuggestionPopoverProps> = observer(\n ({\n portal = true,\n width = 'm',\n direction = 'l',\n padding = 's',\n currentAddress,\n addressSuggestionsProvider,\n onSuggestionSelect,\n ...restProps\n }) => {\n const [isLoading, { setFalse: disableLoading, setTrue: enabledLoading }] = useBoolean(true);\n const [results, setResults] =\n useState<Awaited<ReturnType<AddressSuggestionsProvider['getSuggestions']>>>(undefined);\n\n useEffect(() => {\n const bootstrap = async () => {\n if (!restProps.open) {\n return;\n }\n\n enabledLoading();\n setResults(undefined);\n\n try {\n const results = await addressSuggestionsProvider.getSuggestions(currentAddress);\n setResults(results);\n } finally {\n disableLoading();\n }\n };\n bootstrap();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [restProps.open]);\n\n return (\n <Popover\n portal={portal}\n width={width}\n direction={direction}\n padding={padding}\n {...restProps}\n >\n {isLoading ? (\n <div className=\"d-f justify-content-center\">\n <Spinner size=\"tiny\" />\n </div>\n ) : typeof results === 'string' || !results?.length ? (\n <BodyText className=\"ta-center\" size=\"small\">\n {typeof results === 'string' ? results : 'No suggestions'}\n </BodyText>\n ) : (\n results.map(result => (\n <Button\n key={result.key}\n full\n fill=\"subtle\"\n className={styles.verifyAddressBtn}\n color=\"primary\"\n onClick={() =>\n onSuggestionSelect(withVerifiedCountryValue(result.value))\n }\n >\n {result.title}\n </Button>\n ))\n )}\n </Popover>\n );\n }\n);\n"],"names":["useEffect","useState","useBoolean","BodyText","Button","Popover","Spinner","observer","styles","getCountry","withVerifiedCountryValue","address","country","AddressSuggestionPopover","portal","width","direction","padding","currentAddress","addressSuggestionsProvider","onSuggestionSelect","restProps","isLoading","setFalse","disableLoading","setTrue","enabledLoading","results","setResults","undefined","bootstrap","open","getSuggestions","div","className","size","length","map","result","full","fill","verifyAddressBtn","color","onClick","value","title","key"],"mappings":";AAAA,SAASA,SAAS,EAAEC,QAAQ,QAAY,QAAQ;AAChD,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,QAAQ,EAAEC,MAAM,EAAEC,OAAO,EAAg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BACLN,WAAW1B,OAAOiC,gBAAgB;gBAClCC,OAAM;gBACNC,SAAS,IACLvB,mBAAmBV,yBAAyB4B,OAAOM,KAAK;0BAG3DN,OAAOO,KAAK;eATRP,OAAOQ,GAAG;;AAevC,GACF"}
|
|
@@ -73,6 +73,7 @@ export class GoogleGeocoderSuggestionsProvider {
|
|
|
73
73
|
return (_components_find = components.find((component)=>component.types.includes(type))) === null || _components_find === void 0 ? void 0 : _components_find[longName ? 'long_name' : 'short_name'];
|
|
74
74
|
});
|
|
75
75
|
_define_property(this, "getCity", (address, components)=>{
|
|
76
|
+
var _ref, _ref1, _ref2;
|
|
76
77
|
const getAsRegexpWithWordBounds = (text)=>{
|
|
77
78
|
return new RegExp('\\b' + text + '\\b');
|
|
78
79
|
};
|
|
@@ -96,8 +97,7 @@ export class GoogleGeocoderSuggestionsProvider {
|
|
|
96
97
|
if (area2 && getAsRegexpWithWordBounds(area2).test(address)) {
|
|
97
98
|
return area2;
|
|
98
99
|
}
|
|
99
|
-
|
|
100
|
-
return (_ref2 = (_ref1 = (_ref = locality !== null && locality !== void 0 ? locality : area3) !== null && _ref !== void 0 ? _ref : sublocality) !== null && _ref1 !== void 0 ? _ref1 : neighborhood) !== null && _ref2 !== void 0 ? _ref2 : area2;
|
|
100
|
+
return (_ref = (_ref1 = (_ref2 = locality !== null && locality !== void 0 ? locality : area3) !== null && _ref2 !== void 0 ? _ref2 : sublocality) !== null && _ref1 !== void 0 ? _ref1 : neighborhood) !== null && _ref !== void 0 ? _ref : area2;
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/address-suggestion-popover/utils/google-geocoder-suggestions-provider.ts"],"sourcesContent":["import { AddressModel, AddressSuggestionsProvider } from '../components/address-suggestion-popover';\n\nexport class GoogleGeocoderSuggestionsProvider implements AddressSuggestionsProvider {\n getSuggestions = async (address: AddressModel) => {\n if (!window.google) {\n return;\n }\n const addressStr = this.addressToString(address);\n const countryCode = address.country === 'Canada' ? 'ca' : 'us';\n const params = {\n address: addressStr,\n region: countryCode,\n };\n const geocoder = new google.maps.Geocoder();\n const { results } = await geocoder.geocode(params);\n return results.map(this.composeSuggestionResult);\n };\n\n private addressToString = ({ street, unit, city, state, zip, country }: AddressModel) => {\n const addressArray: string[] = [];\n\n const appendPart = (prefix: string, part?: string) => {\n if (part) {\n addressArray.push(prefix, part);\n }\n };\n\n appendPart('', street);\n appendPart(' ', unit ? '#' + unit : undefined);\n appendPart(', ', city);\n appendPart(', ', state);\n appendPart(' ', zip);\n appendPart(' ', country);\n\n return addressArray.join();\n };\n\n private composeSuggestionResult = (result: google.maps.GeocoderResult) => {\n const streetParts = [];\n const streetNumber = this.getAddressComponentByType(\n result.address_components,\n 'street_number'\n );\n\n if (streetNumber) {\n streetParts.push(streetNumber);\n }\n\n const streetRoute = this.getAddressComponentByType(\n result.address_components,\n 'route',\n true\n );\n\n if (streetRoute) {\n streetParts.push(streetRoute);\n }\n return {\n key: result.formatted_address,\n title: result.formatted_address,\n value: {\n street: streetParts.length > 0 ? streetParts.join(' ') : undefined,\n unit: this.getAddressComponentByType(result.address_components, 'subpremise'),\n city: this.getCity(result.formatted_address, result.address_components),\n state: this.getAddressComponentByType(\n result.address_components,\n 'administrative_area_level_1'\n ),\n zip: this.getAddressComponentByType(result.address_components, 'postal_code'),\n country: this.getAddressComponentByType(result.address_components, 'country'),\n latitude: result.geometry.location.lat(),\n longitude: result.geometry.location.lng(),\n locationType: result.geometry.location_type,\n },\n };\n };\n\n private getAddressComponentByType = (\n components: google.maps.GeocoderAddressComponent[],\n type: string,\n longName?: boolean\n ) =>\n components.find(component => component.types.includes(type))?.[\n longName ? 'long_name' : 'short_name'\n ];\n\n private getCity = (address: string, components: google.maps.GeocoderAddressComponent[]) => {\n const getAsRegexpWithWordBounds = (text: string) => {\n return new RegExp('\\\\b' + text + '\\\\b');\n };\n\n const locality = this.getAddressComponentByType(components, 'locality', true);\n if (locality && getAsRegexpWithWordBounds(locality).test(address)) {\n return locality;\n }\n const area3 = this.getAddressComponentByType(components, 'administrative_area_level_3');\n if (area3 && getAsRegexpWithWordBounds(area3).test(address)) {\n return area3;\n }\n const sublocality = this.getAddressComponentByType(components, 'sublocality');\n if (sublocality && getAsRegexpWithWordBounds(sublocality).test(address)) {\n return sublocality;\n }\n const neighborhood = this.getAddressComponentByType(components, 'neighborhood');\n if (neighborhood && getAsRegexpWithWordBounds(neighborhood).test(address)) {\n return neighborhood;\n }\n const area2 =\n this.getAddressComponentByType(components, 'country', true) === 'Canada'\n ? this.getAddressComponentByType(components, 'administrative_area_level_2')\n : undefined;\n if (area2 && getAsRegexpWithWordBounds(area2).test(address)) {\n return area2;\n }\n\n return locality ?? area3 ?? sublocality ?? neighborhood ?? area2;\n };\n}\n"],"names":["GoogleGeocoderSuggestionsProvider","getSuggestions","address","window","google","addressStr","addressToString","countryCode","country","params","region","geocoder","maps","Geocoder","results","geocode","map","composeSuggestionResult","street","unit","city","state","zip","addressArray","appendPart","prefix","part","push","undefined","join","result","streetParts","streetNumber","getAddressComponentByType","address_components","streetRoute","key","formatted_address","title","value","length","getCity","latitude","geometry","location","lat","longitude","lng","locationType","location_type","components","type","longName","find","component","types","includes","getAsRegexpWithWordBounds","text","RegExp","
|
|
1
|
+
{"version":3,"sources":["../../../src/address-suggestion-popover/utils/google-geocoder-suggestions-provider.ts"],"sourcesContent":["import { AddressModel, AddressSuggestionsProvider } from '../components/address-suggestion-popover';\n\nexport class GoogleGeocoderSuggestionsProvider implements AddressSuggestionsProvider {\n getSuggestions = async (address: AddressModel) => {\n if (!window.google) {\n return;\n }\n const addressStr = this.addressToString(address);\n const countryCode = address.country === 'Canada' ? 'ca' : 'us';\n const params = {\n address: addressStr,\n region: countryCode,\n };\n const geocoder = new google.maps.Geocoder();\n const { results } = await geocoder.geocode(params);\n return results.map(this.composeSuggestionResult);\n };\n\n private addressToString = ({ street, unit, city, state, zip, country }: AddressModel) => {\n const addressArray: string[] = [];\n\n const appendPart = (prefix: string, part?: string) => {\n if (part) {\n addressArray.push(prefix, part);\n }\n };\n\n appendPart('', street);\n appendPart(' ', unit ? '#' + unit : undefined);\n appendPart(', ', city);\n appendPart(', ', state);\n appendPart(' ', zip);\n appendPart(' ', country);\n\n return addressArray.join();\n };\n\n private composeSuggestionResult = (result: google.maps.GeocoderResult) => {\n const streetParts = [];\n const streetNumber = this.getAddressComponentByType(\n result.address_components,\n 'street_number'\n );\n\n if (streetNumber) {\n streetParts.push(streetNumber);\n }\n\n const streetRoute = this.getAddressComponentByType(\n result.address_components,\n 'route',\n true\n );\n\n if (streetRoute) {\n streetParts.push(streetRoute);\n }\n return {\n key: result.formatted_address,\n title: result.formatted_address,\n value: {\n street: streetParts.length > 0 ? streetParts.join(' ') : undefined,\n unit: this.getAddressComponentByType(result.address_components, 'subpremise'),\n city: this.getCity(result.formatted_address, result.address_components),\n state: this.getAddressComponentByType(\n result.address_components,\n 'administrative_area_level_1'\n ),\n zip: this.getAddressComponentByType(result.address_components, 'postal_code'),\n country: this.getAddressComponentByType(result.address_components, 'country'),\n latitude: result.geometry.location.lat(),\n longitude: result.geometry.location.lng(),\n locationType: result.geometry.location_type,\n },\n };\n };\n\n private getAddressComponentByType = (\n components: google.maps.GeocoderAddressComponent[],\n type: string,\n longName?: boolean\n ) =>\n components.find(component => component.types.includes(type))?.[\n longName ? 'long_name' : 'short_name'\n ];\n\n private getCity = (address: string, components: google.maps.GeocoderAddressComponent[]) => {\n const getAsRegexpWithWordBounds = (text: string) => {\n return new RegExp('\\\\b' + text + '\\\\b');\n };\n\n const locality = this.getAddressComponentByType(components, 'locality', true);\n if (locality && getAsRegexpWithWordBounds(locality).test(address)) {\n return locality;\n }\n const area3 = this.getAddressComponentByType(components, 'administrative_area_level_3');\n if (area3 && getAsRegexpWithWordBounds(area3).test(address)) {\n return area3;\n }\n const sublocality = this.getAddressComponentByType(components, 'sublocality');\n if (sublocality && getAsRegexpWithWordBounds(sublocality).test(address)) {\n return sublocality;\n }\n const neighborhood = this.getAddressComponentByType(components, 'neighborhood');\n if (neighborhood && getAsRegexpWithWordBounds(neighborhood).test(address)) {\n return neighborhood;\n }\n const area2 =\n this.getAddressComponentByType(components, 'country', true) === 'Canada'\n ? this.getAddressComponentByType(components, 'administrative_area_level_2')\n : undefined;\n if (area2 && getAsRegexpWithWordBounds(area2).test(address)) {\n return area2;\n }\n\n return locality ?? area3 ?? sublocality ?? neighborhood ?? area2;\n };\n}\n"],"names":["GoogleGeocoderSuggestionsProvider","getSuggestions","address","window","google","addressStr","addressToString","countryCode","country","params","region","geocoder","maps","Geocoder","results","geocode","map","composeSuggestionResult","street","unit","city","state","zip","addressArray","appendPart","prefix","part","push","undefined","join","result","streetParts","streetNumber","getAddressComponentByType","address_components","streetRoute","key","formatted_address","title","value","length","getCity","latitude","geometry","location","lat","longitude","lng","locationType","location_type","components","type","longName","find","component","types","includes","locality","getAsRegexpWithWordBounds","text","RegExp","test","area3","sublocality","neighborhood","area2"],"mappings":";;;;;;;;;;;;;AAEA,OAAO,MAAMA;;QACTC,uBAAAA,kBAAiB,OAAOC;YACpB,IAAI,CAACC,OAAOC,MAAM,EAAE;gBAChB;YACJ;YACA,MAAMC,aAAa,IAAI,CAACC,eAAe,CAACJ;YACxC,MAAMK,cAAcL,QAAQM,OAAO,KAAK,WAAW,OAAO;YAC1D,MAAMC,SAAS;gBACXP,SAASG;gBACTK,QAAQH;YACZ;YACA,MAAMI,WAAW,IAAIP,OAAOQ,IAAI,CAACC,QAAQ;YACzC,MAAM,EAAEC,OAAO,EAAE,GAAG,MAAMH,SAASI,OAAO,CAACN;YAC3C,OAAOK,QAAQE,GAAG,CAAC,IAAI,CAACC,uBAAuB;QACnD;QAEA,uBAAQX,mBAAkB,CAAC,EAAEY,MAAM,EAAEC,IAAI,EAAEC,IAAI,EAAEC,KAAK,EAAEC,GAAG,EAAEd,OAAO,EAAgB;YAChF,MAAMe,eAAyB,EAAE;YAEjC,MAAMC,aAA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
|
|
@@ -12,6 +12,7 @@ import { CountryDropdownInput } from './country-dropdown-input';
|
|
|
12
12
|
import { StateAndProvinceDropdownInput } from './state-and-province-dropdown-input';
|
|
13
13
|
import { ImagePicker } from './image-picker';
|
|
14
14
|
export const CompanyProfileForm = observer(({ className, el: Element = Form, addressSuggestionsProvider })=>{
|
|
15
|
+
var _companyCountry_value;
|
|
15
16
|
const [{ form, showFormError, zipCodeMask, einOrBnMask, einOrBnInputProps, countries, countryAndRegionData, regionToCodeMap, phoneMask, suggestionAddressModel, applyAddressSuggestion, setNeedAddressValidation, withAddressValidation }] = useDependencies(CompanyProfileFormStore);
|
|
16
17
|
const zipCodeOnChangeHandler = (zip)=>{
|
|
17
18
|
form.$.address.$.companyZipCode.onChange(zip);
|
|
@@ -38,7 +39,6 @@ export const CompanyProfileForm = observer(({ className, el: Element = Form, add
|
|
|
38
39
|
addressSuggestionsProvider
|
|
39
40
|
]);
|
|
40
41
|
const showAddressValidation = withAddressValidation && !isCompanyAddressVerified.value;
|
|
41
|
-
var _companyCountry_value;
|
|
42
42
|
return /*#__PURE__*/ _jsxs(Element, {
|
|
43
43
|
size: "tiny",
|
|
44
44
|
className: classNames(className, 'ta-left', 'p-x-6'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/company-profile/components/company-profile-form.tsx"],"sourcesContent":["import { Button, Form, FormDropdownProps } from '@servicetitan/design-system';\nimport { MaskedInput } from '@servicetitan/form';\nimport { useBoolean } from '@servicetitan/react-hooks';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport classNames from 'classnames';\nimport { observer } from 'mobx-react';\nimport { ElementType, SyntheticEvent, useEffect } from 'react';\nimport {\n AddressSuggestionPopover,\n AddressSuggestionsProvider,\n} from '../../address-suggestion-popover';\nimport { CompanyProfileFormStore } from '../stores/company-profile-form.store';\nimport { CountryDropdownInput } from './country-dropdown-input';\nimport { StateAndProvinceDropdownInput } from './state-and-province-dropdown-input';\nimport { ImagePicker } from './image-picker';\n\ninterface CompanyProfileFormProps {\n className?: string;\n el?: ElementType;\n addressSuggestionsProvider?: AddressSuggestionsProvider;\n}\n\nexport const CompanyProfileForm = observer(\n ({ className, el: Element = Form, addressSuggestionsProvider }: CompanyProfileFormProps) => {\n const [\n {\n form,\n showFormError,\n zipCodeMask,\n einOrBnMask,\n einOrBnInputProps,\n countries,\n countryAndRegionData,\n regionToCodeMap,\n phoneMask,\n suggestionAddressModel,\n applyAddressSuggestion,\n setNeedAddressValidation,\n withAddressValidation,\n },\n ] = useDependencies(CompanyProfileFormStore);\n\n const zipCodeOnChangeHandler = (zip: string) => {\n form.$.address.$.companyZipCode.onChange(zip);\n };\n\n const einOrBnOnChangeHandler = (einOrBn: string) => {\n form.$.einOrBn.onChange((einOrBn || '').replace(/[^0-9.]/g, ''));\n };\n\n const phoneOnChangeHandler = (phone: string) => {\n form.$.adminPhone.onChange((phone || '').replace(/[^0-9.]/g, ''));\n };\n\n const countryOnChangeHandler = (\n event: SyntheticEvent<HTMLElement>,\n data: FormDropdownProps\n ) => {\n if (\n form.$.address.$.companyCountry.value &&\n data.value !== form.$.address.$.companyCountry.value\n ) {\n form.$.address.$.companyStateCode.onChange('');\n }\n form.$.address.$.companyCountry.onChangeHandler(event, data);\n };\n\n const {\n companyName,\n address: {\n $: {\n companyStreetAddress,\n companyCity,\n companyCountry,\n companyStateCode,\n companyZipCode,\n isCompanyAddressVerified,\n },\n hasFormError: addressHasFormError,\n },\n adminPhone,\n einOrBn,\n companyLogo,\n } = form.$;\n\n const zipCodeHasError = companyZipCode.hasError;\n\n const [\n isAddressSuggestionsOpen,\n { setTrue: openAddressSuggestions, setFalse: closeAddressSuggestions },\n ] = useBoolean(false);\n\n useEffect(() => {\n setNeedAddressValidation(!!addressSuggestionsProvider);\n }, [setNeedAddressValidation, addressSuggestionsProvider]);\n\n const showAddressValidation = withAddressValidation && !isCompanyAddressVerified.value;\n return (\n <Element size=\"tiny\" className={classNames(className, 'ta-left', 'p-x-6')}>\n <ImagePicker\n value={companyLogo.value}\n onChange={companyLogo.onChange}\n onDelete={() => companyLogo.onChange(undefined)}\n label=\"Company Logo\"\n description=\"Your uploaded logo will show on customer invoices and estimates.\"\n error={companyLogo.error}\n />\n <Form.Input\n label=\"Company Name\"\n placeholder=\"Company Name\"\n value={companyName.value}\n onChange={companyName.onChangeHandler}\n error={(companyName.dirty || showFormError) && companyName.hasError}\n />\n <div\n className={classNames('d-f', {\n 'gap-2': showAddressValidation,\n })}\n >\n <Form.Input\n className=\"flex-grow-1\"\n label=\"Street Address\"\n placeholder=\"Street Address\"\n value={companyStreetAddress.value}\n onChange={companyStreetAddress.onChangeHandler}\n error={\n (companyStreetAddress.dirty || showFormError) &&\n (companyStreetAddress.hasError || addressHasFormError)\n }\n />\n <Form.Field label={'\\u00a0'}>\n {showAddressValidation && (\n <AddressSuggestionPopover\n addressSuggestionsProvider={addressSuggestionsProvider!}\n open={isAddressSuggestionsOpen}\n onClickOutside={closeAddressSuggestions}\n trigger={\n <Button\n aria-label=\"Open address suggestions\"\n iconName=\"place\"\n outline\n onClick={openAddressSuggestions}\n negative={addressHasFormError}\n />\n }\n currentAddress={suggestionAddressModel}\n onSuggestionSelect={suggestedAddress => {\n applyAddressSuggestion(suggestedAddress);\n closeAddressSuggestions();\n }}\n />\n )}\n </Form.Field>\n </div>\n <Form.Group width=\"equal\">\n <Form.Input\n fluid\n label=\"City\"\n placeholder=\"City\"\n className=\"p-r-0\"\n width=\"6\"\n value={companyCity.value}\n onChange={companyCity.onChangeHandler}\n error={(companyCity.dirty || showFormError) && companyCity.hasError}\n />\n <StateAndProvinceDropdownInput\n width=\"6\"\n countryCode={companyCountry.value ?? 'USA'}\n fieldState={companyStateCode}\n error={\n (companyStateCode.dirty || showFormError) && companyStateCode.hasError\n }\n countryAndRegionData={countryAndRegionData}\n regionNameToCodeMap={regionToCodeMap}\n />\n </Form.Group>\n <Form.Group width=\"equal\">\n <MaskedInput\n fluid\n label=\"ZIP Code\"\n placeholder=\"ZIP Code\"\n value={companyZipCode.value}\n onChange={zipCodeOnChangeHandler}\n mask={zipCodeMask}\n className=\"p-r-0\"\n maskChar=\" \"\n error={(companyZipCode.dirty || showFormError) && zipCodeHasError}\n width={6}\n />\n <CountryDropdownInput\n width=\"6\"\n value={companyCountry.value}\n onChange={countryOnChangeHandler}\n error={(companyCountry.dirty || showFormError) && companyCountry.hasError}\n options={countries.map(x => ({\n key: x,\n value: x,\n text: x === 'USA' ? 'United States' : x,\n }))}\n />\n </Form.Group>\n <Form.Group width=\"equal\">\n <MaskedInput\n fluid\n label=\"Phone Number\"\n placeholder=\"Phone Number\"\n value={adminPhone.value}\n onChange={phoneOnChangeHandler}\n error={(adminPhone.dirty || showFormError) && adminPhone.hasError}\n mask={phoneMask}\n width={6}\n />\n <MaskedInput\n fluid\n label={einOrBnInputProps.label}\n placeholder={einOrBnInputProps.placeholder}\n value={einOrBn.value}\n onChange={einOrBnOnChangeHandler}\n mask={einOrBnMask}\n className=\"p-r-0\"\n maskChar=\" \"\n error={(einOrBn.dirty || showFormError) && einOrBn.hasError}\n width={6}\n />\n </Form.Group>\n </Element>\n );\n }\n);\n"],"names":["Button","Form","MaskedInput","useBoolean","useDependencies","classNames","observer","useEffect","AddressSuggestionPopover","CompanyProfileFormStore","CountryDropdownInput","StateAndProvinceDropdownInput","ImagePicker","CompanyProfileForm","className","el","Element","addressSuggestionsProvider","form","showFormError","zipCodeMask","einOrBnMask","einOrBnInputProps","countries","countryAndRegionData","regionToCodeMap","phoneMask","suggestionAddressModel","applyAddressSuggestion","setNeedAddressValidation","withAddressValidation","zipCodeOnChangeHandler","zip","$","address","companyZipCode","onChange","einOrBnOnChangeHandler","einOrBn","replace","phoneOnChangeHandler","phone","adminPhone","countryOnChangeHandler","event","data","companyCountry","value","companyStateCode","onChangeHandler","companyName","companyStreetAddress","companyCity","isCompanyAddressVerified","hasFormError","addressHasFormError","companyLogo","zipCodeHasError","hasError","isAddressSuggestionsOpen","setTrue","openAddressSuggestions","setFalse","closeAddressSuggestions","showAddressValidation","size","onDelete","undefined","label","description","error","Input","placeholder","dirty","div","Field","open","onClickOutside","trigger","aria-label","iconName","outline","onClick","negative","currentAddress","onSuggestionSelect","suggestedAddress","Group","width","fluid","countryCode","fieldState","regionNameToCodeMap","mask","maskChar","options","map","x","key","text"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAA2B,8BAA8B;AAC9E,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAAsCC,SAAS,QAAQ,QAAQ;AAC/D,SACIC,wBAAwB,QAErB,mCAAmC;AAC1C,SAASC,uBAAuB,QAAQ,uCAAuC;AAC/E,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,6BAA6B,QAAQ,sCAAsC;AACpF,SAASC,WAAW,QAAQ,iBAAiB;AAQ7C,OAAO,MAAMC,qBAAqBP,SAC9B,CAAC,EAAEQ,SAAS,EAAEC,IAAIC,UAAUf,IAAI,EAAEgB,0BAA0B,EAA2B;IACnF,MAAM,CACF,EACIC,IAAI,EACJC,aAAa,EACbC,WAAW,EACXC,WAAW,EACXC,iBAAiB,EACjBC,SAAS,EACTC,oBAAoB,EACpBC,eAAe,EACfC,SAAS,EACTC,sBAAsB,EACtBC,sBAAsB,EACtBC,wBAAwB,EACxBC,qBAAqB,EACxB,CACJ,GAAG1B,gBAAgBK;IAEpB,MAAMsB,yBAAyB,CAACC;QAC5Bd,KAAKe,CAAC,CAACC,OAAO,CAACD,CAAC,CAACE,cAAc,CAACC,QAAQ,CAACJ;IAC7C;IAEA,MAAMK,yBAAyB,CAACC;QAC5BpB,KAAKe,CAAC,CAACK,OAAO,CAACF,QAAQ,CAAC,AAACE,CAAAA,WAAW,EAAC,EAAGC,OAAO,CAAC,YAAY;IAChE;IAEA,MAAMC,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Y,KAAMmB,QAAQoB,QAAQ;wBAC3D8B,OAAO;;;;;;AAK3B,GACF"}
|
|
1
|
+
{"version":3,"sources":["../../../src/company-profile/components/company-profile-form.tsx"],"sourcesContent":["import { Button, Form, FormDropdownProps } from '@servicetitan/design-system';\nimport { MaskedInput } from '@servicetitan/form';\nimport { useBoolean } from '@servicetitan/react-hooks';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport classNames from 'classnames';\nimport { observer } from 'mobx-react';\nimport { ElementType, SyntheticEvent, useEffect } from 'react';\nimport {\n AddressSuggestionPopover,\n AddressSuggestionsProvider,\n} from '../../address-suggestion-popover';\nimport { CompanyProfileFormStore } from '../stores/company-profile-form.store';\nimport { CountryDropdownInput } from './country-dropdown-input';\nimport { StateAndProvinceDropdownInput } from './state-and-province-dropdown-input';\nimport { ImagePicker } from './image-picker';\n\ninterface CompanyProfileFormProps {\n className?: string;\n el?: ElementType;\n addressSuggestionsProvider?: AddressSuggestionsProvider;\n}\n\nexport const CompanyProfileForm = observer(\n ({ className, el: Element = Form, addressSuggestionsProvider }: CompanyProfileFormProps) => {\n const [\n {\n form,\n showFormError,\n zipCodeMask,\n einOrBnMask,\n einOrBnInputProps,\n countries,\n countryAndRegionData,\n regionToCodeMap,\n phoneMask,\n suggestionAddressModel,\n applyAddressSuggestion,\n setNeedAddressValidation,\n withAddressValidation,\n },\n ] = useDependencies(CompanyProfileFormStore);\n\n const zipCodeOnChangeHandler = (zip: string) => {\n form.$.address.$.companyZipCode.onChange(zip);\n };\n\n const einOrBnOnChangeHandler = (einOrBn: string) => {\n form.$.einOrBn.onChange((einOrBn || '').replace(/[^0-9.]/g, ''));\n };\n\n const phoneOnChangeHandler = (phone: string) => {\n form.$.adminPhone.onChange((phone || '').replace(/[^0-9.]/g, ''));\n };\n\n const countryOnChangeHandler = (\n event: SyntheticEvent<HTMLElement>,\n data: FormDropdownProps\n ) => {\n if (\n form.$.address.$.companyCountry.value &&\n data.value !== form.$.address.$.companyCountry.value\n ) {\n form.$.address.$.companyStateCode.onChange('');\n }\n form.$.address.$.companyCountry.onChangeHandler(event, data);\n };\n\n const {\n companyName,\n address: {\n $: {\n companyStreetAddress,\n companyCity,\n companyCountry,\n companyStateCode,\n companyZipCode,\n isCompanyAddressVerified,\n },\n hasFormError: addressHasFormError,\n },\n adminPhone,\n einOrBn,\n companyLogo,\n } = form.$;\n\n const zipCodeHasError = companyZipCode.hasError;\n\n const [\n isAddressSuggestionsOpen,\n { setTrue: openAddressSuggestions, setFalse: closeAddressSuggestions },\n ] = useBoolean(false);\n\n useEffect(() => {\n setNeedAddressValidation(!!addressSuggestionsProvider);\n }, [setNeedAddressValidation, addressSuggestionsProvider]);\n\n const showAddressValidation = withAddressValidation && !isCompanyAddressVerified.value;\n return (\n <Element size=\"tiny\" className={classNames(className, 'ta-left', 'p-x-6')}>\n <ImagePicker\n value={companyLogo.value}\n onChange={companyLogo.onChange}\n onDelete={() => companyLogo.onChange(undefined)}\n label=\"Company Logo\"\n description=\"Your uploaded logo will show on customer invoices and estimates.\"\n error={companyLogo.error}\n />\n <Form.Input\n label=\"Company Name\"\n placeholder=\"Company Name\"\n value={companyName.value}\n onChange={companyName.onChangeHandler}\n error={(companyName.dirty || showFormError) && companyName.hasError}\n />\n <div\n className={classNames('d-f', {\n 'gap-2': showAddressValidation,\n })}\n >\n <Form.Input\n className=\"flex-grow-1\"\n label=\"Street Address\"\n placeholder=\"Street Address\"\n value={companyStreetAddress.value}\n onChange={companyStreetAddress.onChangeHandler}\n error={\n (companyStreetAddress.dirty || showFormError) &&\n (companyStreetAddress.hasError || addressHasFormError)\n }\n />\n <Form.Field label={'\\u00a0'}>\n {showAddressValidation && (\n <AddressSuggestionPopover\n addressSuggestionsProvider={addressSuggestionsProvider!}\n open={isAddressSuggestionsOpen}\n onClickOutside={closeAddressSuggestions}\n trigger={\n <Button\n aria-label=\"Open address suggestions\"\n iconName=\"place\"\n outline\n onClick={openAddressSuggestions}\n negative={addressHasFormError}\n />\n }\n currentAddress={suggestionAddressModel}\n onSuggestionSelect={suggestedAddress => {\n applyAddressSuggestion(suggestedAddress);\n closeAddressSuggestions();\n }}\n />\n )}\n </Form.Field>\n </div>\n <Form.Group width=\"equal\">\n <Form.Input\n fluid\n label=\"City\"\n placeholder=\"City\"\n className=\"p-r-0\"\n width=\"6\"\n value={companyCity.value}\n onChange={companyCity.onChangeHandler}\n error={(companyCity.dirty || showFormError) && companyCity.hasError}\n />\n <StateAndProvinceDropdownInput\n width=\"6\"\n countryCode={companyCountry.value ?? 'USA'}\n fieldState={companyStateCode}\n error={\n (companyStateCode.dirty || showFormError) && companyStateCode.hasError\n }\n countryAndRegionData={countryAndRegionData}\n regionNameToCodeMap={regionToCodeMap}\n />\n </Form.Group>\n <Form.Group width=\"equal\">\n <MaskedInput\n fluid\n label=\"ZIP Code\"\n placeholder=\"ZIP Code\"\n value={companyZipCode.value}\n onChange={zipCodeOnChangeHandler}\n mask={zipCodeMask}\n className=\"p-r-0\"\n maskChar=\" \"\n error={(companyZipCode.dirty || showFormError) && zipCodeHasError}\n width={6}\n />\n <CountryDropdownInput\n width=\"6\"\n value={companyCountry.value}\n onChange={countryOnChangeHandler}\n error={(companyCountry.dirty || showFormError) && companyCountry.hasError}\n options={countries.map(x => ({\n key: x,\n value: x,\n text: x === 'USA' ? 'United States' : x,\n }))}\n />\n </Form.Group>\n <Form.Group width=\"equal\">\n <MaskedInput\n fluid\n label=\"Phone Number\"\n placeholder=\"Phone Number\"\n value={adminPhone.value}\n onChange={phoneOnChangeHandler}\n error={(adminPhone.dirty || showFormError) && adminPhone.hasError}\n mask={phoneMask}\n width={6}\n />\n <MaskedInput\n fluid\n label={einOrBnInputProps.label}\n placeholder={einOrBnInputProps.placeholder}\n value={einOrBn.value}\n onChange={einOrBnOnChangeHandler}\n mask={einOrBnMask}\n className=\"p-r-0\"\n maskChar=\" \"\n error={(einOrBn.dirty || showFormError) && einOrBn.hasError}\n width={6}\n />\n </Form.Group>\n </Element>\n );\n }\n);\n"],"names":["Button","Form","MaskedInput","useBoolean","useDependencies","classNames","observer","useEffect","AddressSuggestionPopover","CompanyProfileFormStore","CountryDropdownInput","StateAndProvinceDropdownInput","ImagePicker","CompanyProfileForm","className","el","Element","addressSuggestionsProvider","companyCountry","form","showFormError","zipCodeMask","einOrBnMask","einOrBnInputProps","countries","countryAndRegionData","regionToCodeMap","phoneMask","suggestionAddressModel","applyAddressSuggestion","setNeedAddressValidation","withAddressValidation","zipCodeOnChangeHandler","zip","$","address","companyZipCode","onChange","einOrBnOnChangeHandler","einOrBn","replace","phoneOnChangeHandler","phone","adminPhone","countryOnChangeHandler","event","data","value","companyStateCode","onChangeHandler","companyName","companyStreetAddress","companyCity","isCompanyAddressVerified","hasFormError","addressHasFormError","companyLogo","zipCodeHasError","hasError","isAddressSuggestionsOpen","setTrue","openAddressSuggestions","setFalse","closeAddressSuggestions","showAddressValidation","size","onDelete","undefined","label","description","error","Input","placeholder","dirty","div","Field","open","onClickOutside","trigger","aria-label","iconName","outline","onClick","negative","currentAddress","onSuggestionSelect","suggestedAddress","Group","width","fluid","countryCode","fieldState","regionNameToCodeMap","mask","maskChar","options","map","x","key","text"],"mappings":";AAAA,SAASA,MAAM,EAAEC,IAAI,QAA2B,8BAA8B;AAC9E,SAASC,WAAW,QAAQ,qBAAqB;AACjD,SAASC,UAAU,QAAQ,4BAA4B;AACvD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAAsCC,SAAS,QAAQ,QAAQ;AAC/D,SACIC,wBAAwB,QAErB,mCAAmC;AAC1C,SAASC,uBAAuB,QAAQ,uCAAuC;AAC/E,SAASC,oBAAoB,QAAQ,2BAA2B;AAChE,SAASC,6BAA6B,QAAQ,sCAAsC;AACpF,SAASC,WAAW,QAAQ,iBAAiB;AAQ7C,OAAO,MAAMC,qBAAqBP,SAC9B,CAAC,EAAEQ,SAAS,EAAEC,IAAIC,UAAUf,IAA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QAAQ,kBAAkBA;4BAC1C,CAAA;;;;0BAGR,MAAChG,KAAKsF,KAAK;gBAACC,OAAM;;kCACd,KAACtF;wBACGuF,KAAK;wBACLrB,OAAM;wBACNI,aAAY;wBACZzB,OAAOJ,WAAWI,KAAK;wBACvBV,UAAUI;wBACV6B,OAAO,AAAC3B,CAAAA,WAAW8B,KAAK,IAAIrD,aAAY,KAAMuB,WAAWe,QAAQ;wBACjEmC,MAAMlE;wBACN6D,OAAO;;kCAEX,KAACtF;wBACGuF,KAAK;wBACLrB,OAAO7C,kBAAkB6C,KAAK;wBAC9BI,aAAajD,kBAAkBiD,WAAW;wBAC1CzB,OAAOR,QAAQQ,KAAK;wBACpBV,UAAUC;wBACVuD,MAAMvE;wBACNR,WAAU;wBACVgF,UAAS;wBACTxB,OAAO,AAAC/B,CAAAA,QAAQkC,KAAK,IAAIrD,aAAY,KAAMmB,QAAQmB,QAAQ;wBAC3D8B,OAAO;;;;;;AAK3B,GACF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/company-profile/components/country-dropdown-input.tsx"],"sourcesContent":["import { FormDropdownProps, Form, SemanticWIDTHS } from '@servicetitan/design-system';\nimport { observer } from 'mobx-react';\nimport { Option } from '@servicetitan/form';\n\nexport interface ICountryDropdownInput extends FormDropdownProps {\n options: Option<string>[];\n width?: SemanticWIDTHS;\n}\n\nexport const CountryDropdownInput = observer((props: ICountryDropdownInput) => {\n const { value, width, placeholder, ...rest } = props;\n return (\n <Form.Select\n fluid\n search\n width={width ?? '12'}\n label=\"Country\"\n placeholder={placeholder ?? 'Country'}\n value={value}\n {...rest}\n />\n );\n});\n"],"names":["Form","observer","CountryDropdownInput","props","value","width","placeholder","rest","Select","fluid","search","label"],"mappings":";AAAA,SAA4BA,IAAI,QAAwB,8BAA8B;AACtF,SAASC,QAAQ,QAAQ,aAAa;AAQtC,OAAO,MAAMC,uBAAuBD,SAAS,CAACE;IAC1C,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,WAAW,EAAE,GAAGC,MAAM,GAAGJ;IAC/C,qBACI,KAACH,KAAKQ,MAAM;QACRC,KAAK;QACLC,MAAM;QACNL,
|
|
1
|
+
{"version":3,"sources":["../../../src/company-profile/components/country-dropdown-input.tsx"],"sourcesContent":["import { FormDropdownProps, Form, SemanticWIDTHS } from '@servicetitan/design-system';\nimport { observer } from 'mobx-react';\nimport { Option } from '@servicetitan/form';\n\nexport interface ICountryDropdownInput extends FormDropdownProps {\n options: Option<string>[];\n width?: SemanticWIDTHS;\n}\n\nexport const CountryDropdownInput = observer((props: ICountryDropdownInput) => {\n const { value, width, placeholder, ...rest } = props;\n return (\n <Form.Select\n fluid\n search\n width={width ?? '12'}\n label=\"Country\"\n placeholder={placeholder ?? 'Country'}\n value={value}\n {...rest}\n />\n );\n});\n"],"names":["Form","observer","CountryDropdownInput","props","value","width","placeholder","rest","Select","fluid","search","label"],"mappings":";AAAA,SAA4BA,IAAI,QAAwB,8BAA8B;AACtF,SAASC,QAAQ,QAAQ,aAAa;AAQtC,OAAO,MAAMC,uBAAuBD,SAAS,CAACE;IAC1C,MAAM,EAAEC,KAAK,EAAEC,KAAK,EAAEC,WAAW,EAAE,GAAGC,MAAM,GAAGJ;IAC/C,qBACI,KAACH,KAAKQ,MAAM;QACRC,KAAK;QACLC,MAAM;QACNL,KAAK,EAAEA,kBAAAA,mBAAAA,QAAS;QAChBM,OAAM;QACNL,WAAW,EAAEA,wBAAAA,yBAAAA,cAAe;QAC5BF,OAAOA;QACN,GAAGG,IAAI;;AAGpB,GAAG"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/company-profile/components/state-and-province-dropdown-input.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { Form, FormDropdownProps, SemanticWIDTHS } from '@servicetitan/design-system';\nimport { observer } from 'mobx-react';\nimport { DropdownFieldState } from '@servicetitan/form';\nimport { CountryWithRegions, DropdownRegion } from '../stores/company-profile-form.store';\nimport { isCountry, Country } from '../../utils/country-helpers';\n\ninterface StateAndProvinceDropdownInputProps extends FormDropdownProps {\n countryCode: string;\n fieldState: DropdownFieldState<string>;\n countryAndRegionData: CountryWithRegions[];\n regionNameToCodeMap: Map<string, string>;\n width?: SemanticWIDTHS;\n}\n\nconst toTitleCase = (str: string) =>\n str.replace(/\\w\\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());\n\nexport const StateAndProvinceDropdownInput = observer(\n (props: StateAndProvinceDropdownInputProps) => {\n const {\n fieldState,\n regionNameToCodeMap,\n countryAndRegionData,\n countryCode,\n width,\n placeholder,\n ...rest\n } = props;\n const { value, onChange, onChangeHandler } = fieldState;\n\n useEffect(() => {\n /*\n * requirement: convert any incoming state value that is a full state/province name\n * to it's respective state code (e.g. 'Alabama' => 'AL')\n * The incoming value may not have proper casing\n * (salesforce data input through text input field not dropdown),\n * so convert to proper casing to find value in map\n * https://servicetitan.atlassian.net/browse/OX-948\n */\n if (value && value.length > 2 && !isCountry(countryCode, Country.Australia)) {\n onChange(regionNameToCodeMap.get(toTitleCase(value)) ?? ' ');\n }\n }, [countryCode, onChange, regionNameToCodeMap, value]);\n\n let americanRegionalData;\n let canadianRegionalData;\n let australiaRegionalData;\n\n countryAndRegionData.forEach((countryOption: CountryWithRegions) => {\n const data = countryOption.Regions.map((option: DropdownRegion) => ({\n key: option.Code,\n value: option.Code,\n text: option.Name,\n }));\n if (countryOption.Country === 'US') {\n americanRegionalData = data;\n }\n if (countryOption.Country === 'CA') {\n canadianRegionalData = data;\n }\n if (countryOption.Country === 'AU') {\n australiaRegionalData = data;\n }\n });\n\n const regionType =\n countryCode.toLowerCase() === 'canada' || countryCode.toLowerCase() === 'ca'\n ? 'Province'\n : 'State';\n let options = americanRegionalData;\n switch (countryCode.toLowerCase()) {\n case 'us':\n case 'usa':\n options = americanRegionalData;\n break;\n case 'ca':\n case 'canada':\n options = canadianRegionalData;\n break;\n case 'au':\n case 'australia':\n options = australiaRegionalData;\n break;\n default:\n options = americanRegionalData;\n break;\n }\n\n return (\n <Form.Select\n search\n fluid\n width={width ?? '12'}\n label={regionType}\n placeholder={placeholder ?? regionType}\n value={value}\n onChange={onChangeHandler}\n options={options!}\n {...rest}\n />\n );\n }\n);\n"],"names":["useEffect","Form","observer","isCountry","Country","toTitleCase","str","replace","txt","charAt","toUpperCase","substr","toLowerCase","StateAndProvinceDropdownInput","props","fieldState","regionNameToCodeMap","countryAndRegionData","countryCode","width","placeholder","rest","value","onChange","onChangeHandler","length","Australia","get","americanRegionalData","canadianRegionalData","australiaRegionalData","forEach","countryOption","data","Regions","map","option","key","Code","text","Name","regionType","options","Select","search","fluid","label"],"mappings":";AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,IAAI,QAA2C,8BAA8B;AACtF,SAASC,QAAQ,QAAQ,aAAa;AAGtC,SAASC,SAAS,EAAEC,OAAO,QAAQ,8BAA8B;AAUjE,MAAMC,cAAc,CAACC,MACjBA,IAAIC,OAAO,CAAC,UAAUC,CAAAA,MAAOA,IAAIC,MAAM,CAAC,GAAGC,WAAW,KAAKF,IAAIG,MAAM,CAAC,GAAGC,WAAW;AAExF,OAAO,MAAMC,gCAAgCX,SACzC,CAACY;IACG,MAAM,EACFC,UAAU,EACVC,mBAAmB,EACnBC,oBAAoB,EACpBC,WAAW,EACXC,KAAK,EACLC,WAAW,EACX,GAAGC,MACN,GAAGP;IACJ,MAAM,EAAEQ,KAAK,EAAEC,QAAQ,EAAEC,eAAe,EAAE,GAAGT;IAE7Cf,UAAU;QACN;;;;;;;aAOC,GACD,IAAIsB,SAASA,MAAMG,MAAM,GAAG,KAAK,CAACtB,UAAUe,aAAad,QAAQsB,SAAS,GAAG;gBAChEV;YAATO,
|
|
1
|
+
{"version":3,"sources":["../../../src/company-profile/components/state-and-province-dropdown-input.tsx"],"sourcesContent":["import { useEffect } from 'react';\nimport { Form, FormDropdownProps, SemanticWIDTHS } from '@servicetitan/design-system';\nimport { observer } from 'mobx-react';\nimport { DropdownFieldState } from '@servicetitan/form';\nimport { CountryWithRegions, DropdownRegion } from '../stores/company-profile-form.store';\nimport { isCountry, Country } from '../../utils/country-helpers';\n\ninterface StateAndProvinceDropdownInputProps extends FormDropdownProps {\n countryCode: string;\n fieldState: DropdownFieldState<string>;\n countryAndRegionData: CountryWithRegions[];\n regionNameToCodeMap: Map<string, string>;\n width?: SemanticWIDTHS;\n}\n\nconst toTitleCase = (str: string) =>\n str.replace(/\\w\\S*/g, txt => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase());\n\nexport const StateAndProvinceDropdownInput = observer(\n (props: StateAndProvinceDropdownInputProps) => {\n const {\n fieldState,\n regionNameToCodeMap,\n countryAndRegionData,\n countryCode,\n width,\n placeholder,\n ...rest\n } = props;\n const { value, onChange, onChangeHandler } = fieldState;\n\n useEffect(() => {\n /*\n * requirement: convert any incoming state value that is a full state/province name\n * to it's respective state code (e.g. 'Alabama' => 'AL')\n * The incoming value may not have proper casing\n * (salesforce data input through text input field not dropdown),\n * so convert to proper casing to find value in map\n * https://servicetitan.atlassian.net/browse/OX-948\n */\n if (value && value.length > 2 && !isCountry(countryCode, Country.Australia)) {\n onChange(regionNameToCodeMap.get(toTitleCase(value)) ?? ' ');\n }\n }, [countryCode, onChange, regionNameToCodeMap, value]);\n\n let americanRegionalData;\n let canadianRegionalData;\n let australiaRegionalData;\n\n countryAndRegionData.forEach((countryOption: CountryWithRegions) => {\n const data = countryOption.Regions.map((option: DropdownRegion) => ({\n key: option.Code,\n value: option.Code,\n text: option.Name,\n }));\n if (countryOption.Country === 'US') {\n americanRegionalData = data;\n }\n if (countryOption.Country === 'CA') {\n canadianRegionalData = data;\n }\n if (countryOption.Country === 'AU') {\n australiaRegionalData = data;\n }\n });\n\n const regionType =\n countryCode.toLowerCase() === 'canada' || countryCode.toLowerCase() === 'ca'\n ? 'Province'\n : 'State';\n let options = americanRegionalData;\n switch (countryCode.toLowerCase()) {\n case 'us':\n case 'usa':\n options = americanRegionalData;\n break;\n case 'ca':\n case 'canada':\n options = canadianRegionalData;\n break;\n case 'au':\n case 'australia':\n options = australiaRegionalData;\n break;\n default:\n options = americanRegionalData;\n break;\n }\n\n return (\n <Form.Select\n search\n fluid\n width={width ?? '12'}\n label={regionType}\n placeholder={placeholder ?? regionType}\n value={value}\n onChange={onChangeHandler}\n options={options!}\n {...rest}\n />\n );\n }\n);\n"],"names":["useEffect","Form","observer","isCountry","Country","toTitleCase","str","replace","txt","charAt","toUpperCase","substr","toLowerCase","StateAndProvinceDropdownInput","props","fieldState","regionNameToCodeMap","countryAndRegionData","countryCode","width","placeholder","rest","value","onChange","onChangeHandler","length","Australia","get","americanRegionalData","canadianRegionalData","australiaRegionalData","forEach","countryOption","data","Regions","map","option","key","Code","text","Name","regionType","options","Select","search","fluid","label"],"mappings":";AAAA,SAASA,SAAS,QAAQ,QAAQ;AAClC,SAASC,IAAI,QAA2C,8BAA8B;AACtF,SAASC,QAAQ,QAAQ,aAAa;AAGtC,SAASC,SAAS,EAAEC,OAAO,QAAQ,8BAA8B;AAUjE,MAAMC,cAAc,CAACC,MACjBA,IAAIC,OAAO,CAAC,UAAUC,CAAAA,MAAOA,IAAIC,MAAM,CAAC,GAAGC,WAAW,KAAKF,IAAIG,MAAM,CAAC,GAAGC,WAAW;AAExF,OAAO,MAAMC,gCAAgCX,SACzC,CAACY;IACG,MAAM,EACFC,UAAU,EACVC,mBAAmB,EACnBC,oBAAoB,EACpBC,WAAW,EACXC,KAAK,EACLC,WAAW,EACX,GAAGC,MACN,GAAGP;IACJ,MAAM,EAAEQ,KAAK,EAAEC,QAAQ,EAAEC,eAAe,EAAE,GAAGT;IAE7Cf,UAAU;QACN;;;;;;;aAOC,GACD,IAAIsB,SAASA,MAAMG,MAAM,GAAG,KAAK,CAACtB,UAAUe,aAAad,QAAQsB,SAAS,GAAG;gBAChEV;YAATO,UAASP,2BAAAA,oBAAoBW,GAAG,CAACtB,YAAYiB,qBAApCN,sCAAAA,2BAA+C;QAC5D;IACJ,GAAG;QAACE;QAAaK;QAAUP;QAAqBM;KAAM;IAEtD,IAAIM;IACJ,IAAIC;IACJ,IAAIC;IAEJb,qBAAqBc,OAAO,CAAC,CAACC;QAC1B,MAAMC,OAAOD,cAAcE,OAAO,CAACC,GAAG,CAAC,CAACC,SAA4B,CAAA;gBAChEC,KAAKD,OAAOE,IAAI;gBAChBhB,OAAOc,OAAOE,IAAI;gBAClBC,MAAMH,OAAOI,IAAI;YACrB,CAAA;QACA,IAAIR,cAAc5B,OAAO,KAAK,MAAM;YAChCwB,uBAAuBK;QAC3B;QACA,IAAID,cAAc5B,OAAO,KAAK,MAAM;YAChCyB,uBAAuBI;QAC3B;QACA,IAAID,cAAc5B,OAAO,KAAK,MAAM;YAChC0B,wBAAwBG;QAC5B;IACJ;IAEA,MAAMQ,aACFvB,YAAYN,WAAW,OAAO,YAAYM,YAAYN,WAAW,OAAO,OAClE,aACA;IACV,IAAI8B,UAAUd;IACd,OAAQV,YAAYN,WAAW;QAC3B,KAAK;QACL,KAAK;YACD8B,UAAUd;YACV;QACJ,KAAK;QACL,KAAK;YACDc,UAAUb;YACV;QACJ,KAAK;QACL,KAAK;YACDa,UAAUZ;YACV;QACJ;YACIY,UAAUd;YACV;IACR;IAEA,qBACI,KAAC3B,KAAK0C,MAAM;QACRC,MAAM;QACNC,KAAK;QACL1B,KAAK,EAAEA,kBAAAA,mBAAAA,QAAS;QAChB2B,OAAOL;QACPrB,WAAW,EAAEA,wBAAAA,yBAAAA,cAAeqB;QAC5BnB,OAAOA;QACPC,UAAUC;QACVkB,SAASA;QACR,GAAGrB,IAAI;;AAGpB,GACF"}
|
|
@@ -120,18 +120,17 @@ export class CompanyProfileFormStore {
|
|
|
120
120
|
this.showFormError = value;
|
|
121
121
|
});
|
|
122
122
|
_define_property(this, "initForm", (formData, options)=>{
|
|
123
|
+
var _getCountry, _ref;
|
|
123
124
|
var _this_countries, _formData_companyZipCode;
|
|
124
125
|
this.form.$.adminPhone.validators(PhoneValidator(options.phonePattern, false));
|
|
125
126
|
this.countries = options.countries;
|
|
126
127
|
this.countryAndRegionData = options.countryAndRegionData;
|
|
127
128
|
this.phoneMask = options.phoneMask;
|
|
128
129
|
this.regionToCodeMap = options.regionToCodeMap;
|
|
129
|
-
var _getCountry;
|
|
130
130
|
let companyCountry = (_getCountry = getCountry(formData.companyCountry)) !== null && _getCountry !== void 0 ? _getCountry : '';
|
|
131
131
|
if (companyCountry && this.countries && !((_this_countries = this.countries) === null || _this_countries === void 0 ? void 0 : _this_countries.includes(companyCountry))) {
|
|
132
132
|
companyCountry = '';
|
|
133
133
|
}
|
|
134
|
-
var _ref;
|
|
135
134
|
const companyZipCode = (_ref = isCountry(companyCountry, Country.USA) ? (_formData_companyZipCode = formData.companyZipCode) === null || _formData_companyZipCode === void 0 ? void 0 : _formData_companyZipCode.slice(0, 5) : formData.companyZipCode) !== null && _ref !== void 0 ? _ref : '';
|
|
136
135
|
setFormStateValues(this.form, {
|
|
137
136
|
...formData
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"sourcesContent":["import {\n commitFormState,\n DropdownFieldState,\n InputFieldState,\n setFormStateValues,\n} from '@servicetitan/form';\nimport { injectable } from '@servicetitan/react-ioc';\nimport { FieldState, FormState } from 'formstate';\nimport { action, computed, makeObservable, observable } from 'mobx';\nimport { AddressModel } from '../../address-suggestion-popover';\nimport {\n Country,\n countryToEinBnMaskMap,\n countryToZipMaskMap,\n CountryType,\n getCountry,\n isCountry,\n zipCodeValidator,\n} from '../../utils/country-helpers';\nimport { PhoneValidator } from '../utils/validators';\n\nconst required = (value: string) => (!value || value.length === 0) && 'cannot be empty string';\n\nexport interface DropdownRegion {\n Code: string;\n Name: string;\n}\n\nexport interface CountryWithRegions {\n Country: string;\n Regions: DropdownRegion[];\n}\n\nexport interface ProfileModel {\n companyName?: string | undefined;\n adminPhone?: string | undefined;\n companyStreetAddress?: string | undefined;\n companyCountry?: string | undefined;\n companyStateCode?: string | undefined;\n companyCity?: string | undefined;\n companyZipCode?: string | undefined;\n einOrBn?: string | undefined;\n isCompanyAddressVerified?: boolean;\n companyLogo?: string | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ntype AddressFormType = {\n companyStreetAddress: InputFieldState<string>;\n companyCountry: DropdownFieldState<CountryType | ''>;\n companyStateCode: DropdownFieldState<string>;\n companyCity: InputFieldState<string>;\n companyZipCode: InputFieldState<string>;\n isCompanyAddressVerified: FieldState<boolean>;\n};\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type ICompanyProfileFormType = {\n companyName: InputFieldState<string>;\n adminPhone: InputFieldState<string>;\n einOrBn: InputFieldState<string>;\n address: FormState<AddressFormType>;\n companyLogo: FieldState<string | File | undefined>;\n};\n\nexport interface ICompanyProfileFormStore {\n showFormError: boolean;\n isInitializing: boolean;\n form: FormState<ICompanyProfileFormType>;\n}\n\ninterface CompanyProfileFormOptions {\n phonePattern: RegExp;\n countries: string[];\n countryAndRegionData: CountryWithRegions[];\n phoneMask: string;\n regionToCodeMap: Map<string, string>;\n}\n\n@injectable()\nexport class CompanyProfileFormStore implements ICompanyProfileFormStore {\n @observable showFormError = false;\n @observable isInitializing = false;\n @observable countries: string[] = [];\n @observable countryAndRegionData: CountryWithRegions[] = [];\n @observable phoneMask = '';\n @observable regionToCodeMap: Map<string, string> = new Map();\n @observable withAddressValidation = false;\n\n form: FormState<ICompanyProfileFormType> = new FormState({\n companyName: new InputFieldState('').validators(required),\n adminPhone: new InputFieldState(''),\n einOrBn: new InputFieldState(''),\n address: new FormState({\n companyStreetAddress: new InputFieldState('').validators(required),\n companyCountry: new DropdownFieldState<CountryType | ''>('').validators(required),\n companyStateCode: new DropdownFieldState('').validators(required),\n companyCity: new InputFieldState('').validators(required),\n companyZipCode: new InputFieldState('').validators(required),\n isCompanyAddressVerified: new FieldState(false),\n }).validators($ => {\n if (!this.withAddressValidation) {\n return false;\n }\n\n return (\n !$.isCompanyAddressVerified.value && 'Please validate/confirm your Company Address.'\n );\n }),\n companyLogo: new FieldState<string | File | undefined>(undefined).validators(value => {\n if (value instanceof File) {\n const maxSize = 10 * 1024 * 1024;\n if (value.size > maxSize) {\n return 'File size must be less than 10 MB';\n }\n\n const allowedTypes = ['.jpg', '.jpeg', '.png', '.bmp', '.tif'];\n if (!value.name.includes('.')) {\n return `File must have a valid extension (e.g., ${allowedTypes.join(', ')}).`;\n }\n\n const fileExtension = '.' + value.name.split('.').pop()?.toLowerCase();\n if (!allowedTypes.includes(fileExtension)) {\n return `File must be one of the following formats: ${allowedTypes.map(extension => extension.slice(1)).join(', ')}`;\n }\n }\n return false;\n }),\n });\n\n constructor() {\n makeObservable(this);\n\n this.form.$.address.$.companyZipCode.validators(\n zipCodeValidator(() => this.form.$.address.$.companyCountry.$)\n );\n\n this.form.$.einOrBn.validators(($: string) => {\n const errorMessage = `Invalid ${\n isCountry(this.form.$.address.$.companyCountry.value, Country.Canada) ? 'BN' : 'EIN'\n }`;\n return $ && $.length !== 9 && errorMessage;\n });\n this.addressFields.forEach(({ onDidChange }) => {\n onDidChange(() => this.form.$.address.$.isCompanyAddressVerified.onChange(false));\n });\n }\n\n @action\n setNeedAddressValidation = (value: boolean) => {\n this.withAddressValidation = value;\n };\n\n @action\n setFormErrorCheck = (value: boolean) => {\n this.showFormError = value;\n };\n\n @computed\n get zipCodeMask() {\n return countryToZipMaskMap[this.form.$.address.$.companyCountry.$ || Country.USA];\n }\n\n @computed\n get einOrBnMask() {\n return countryToEinBnMaskMap[this.form.$.address.$.companyCountry.$ || Country.USA];\n }\n\n @computed\n get einOrBnInputProps() {\n return isCountry(this.form.$.address.$.companyCountry.value, Country.Canada)\n ? {\n label: 'BN Number',\n placeholder: 'XXXXXXXXX',\n }\n : {\n label: 'EIN Number',\n placeholder: 'XX-XXXXXXX',\n };\n }\n\n @action\n initForm = (formData: ProfileModel, options: CompanyProfileFormOptions) => {\n this.form.$.adminPhone.validators(PhoneValidator(options.phonePattern, false));\n this.countries = options.countries;\n this.countryAndRegionData = options.countryAndRegionData;\n this.phoneMask = options.phoneMask;\n this.regionToCodeMap = options.regionToCodeMap;\n let companyCountry = getCountry(formData.companyCountry) ?? ('' as const);\n if (companyCountry && this.countries && !this.countries?.includes(companyCountry)) {\n companyCountry = '';\n }\n const companyZipCode =\n (isCountry(companyCountry, Country.USA)\n ? formData.companyZipCode?.slice(0, 5)\n : formData.companyZipCode) ?? '';\n setFormStateValues(this.form, { ...formData });\n setFormStateValues(this.form.$.address, { ...formData, companyCountry, companyZipCode });\n commitFormState(this.form);\n };\n\n @action\n commitForm = () => commitFormState(this.form);\n\n @action\n applyAddressSuggestion = (suggestedAddress: AddressModel) => {\n this.form.$.address.$.isCompanyAddressVerified.onChange(true);\n setFormStateValues(\n this.form.$.address,\n {\n companyStreetAddress: suggestedAddress.street\n ? suggestedAddress.street +\n (suggestedAddress.unit ? ', ' + suggestedAddress.unit : '')\n : '',\n companyCity: suggestedAddress.city,\n companyZipCode: suggestedAddress.zip,\n companyStateCode: suggestedAddress.state,\n companyCountry: getCountry(suggestedAddress.country),\n },\n true\n );\n };\n\n @computed\n get suggestionAddressModel() {\n const form = this.form.$.address;\n return {\n street: form.$.companyStreetAddress.$,\n city: form.$.companyCity.$,\n zip: form.$.companyZipCode.$,\n state: form.$.companyStateCode.$,\n country: form.$.companyCountry.$,\n };\n }\n\n @computed\n private get addressFields() {\n const form = this.form.$.address;\n return [\n form.$.companyStreetAddress,\n form.$.companyCity,\n form.$.companyZipCode,\n form.$.companyStateCode,\n form.$.companyCountry,\n ];\n }\n}\n"],"names":["commitFormState","DropdownFieldState","InputFieldState","setFormStateValues","injectable","FieldState","FormState","action","computed","makeObservable","observable","Country","countryToEinBnMaskMap","countryToZipMaskMap","getCountry","isCountry","zipCodeValidator","PhoneValidator","required","value","length","CompanyProfileFormStore","zipCodeMask","form","$","address","companyCountry","USA","einOrBnMask","einOrBnInputProps","Canada","label","placeholder","suggestionAddressModel","street","companyStreetAddress","city","companyCity","zip","companyZipCode","state","companyStateCode","country","addressFields","showFormError","isInitializing","countries","countryAndRegionData","phoneMask","regionToCodeMap","Map","withAddressValidation","companyName","validators","adminPhone","einOrBn","isCompanyAddressVerified","companyLogo","undefined","File","maxSize","size","allowedTypes","name","includes","join","fileExtension","split","pop","toLowerCase","map","extension","slice","setNeedAddressValidation","setFormErrorCheck","initForm","formData","options","phonePattern","commitForm","applyAddressSuggestion","suggestedAddress","onChange","unit","errorMessage","forEach","onDidChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SACIA,eAAe,EACfC,kBAAkB,EAClBC,eAAe,EACfC,kBAAkB,QACf,qBAAqB;AAC5B,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,UAAU,EAAEC,SAAS,QAAQ,YAAY;AAClD,SAASC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,UAAU,QAAQ,OAAO;AAEpE,SACIC,OAAO,EACPC,qBAAqB,EACrBC,mBAAmB,EAEnBC,UAAU,EACVC,SAAS,EACTC,gBAAgB,QACb,8BAA8B;AACrC,SAASC,cAAc,QAAQ,sBAAsB;AAErD,MAAMC,WAAW,CAACC,QAAkB,AAAC,CAAA,CAACA,SAASA,MAAMC,MAAM,KAAK,CAAA,KAAM;AA2DtE,OAAO,MAAMC;IA8ET,IACIC,cAAc;QACd,OAAOT,mBAAmB,CAAC,IAAI,CAACU,IAAI,CAACC,CAAC,CAACC,OAAO,CAACD,CAAC,CAACE,cAAc,CAACF,CAAC,IAAIb,QAAQgB,GAAG,CAAC;IACrF;IAEA,IACIC,cAAc;QACd,OAAOhB,qBAAqB,CAAC,IAAI,CAACW,IAAI,CAACC,CAAC,CAACC,OAAO,CAACD,CAAC,CAACE,cAAc,CAACF,CAAC,IAAIb,QAAQgB,GAAG,CAAC;IACvF;IAEA,IACIE,oBAAoB;QACpB,OAAOd,UAAU,IAAI,CAACQ,IAAI,CAACC,CAAC,CAACC,OAAO,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AwB,CAAC0B,QAAQ,CAAC;YACxD/E,mBACI,IAAI,CAACoB,IAAI,CAACC,CAAC,CAACC,OAAO,EACnB;gBACIU,sBAAsB8C,iBAAiB/C,MAAM,GACvC+C,iBAAiB/C,MAAM,GACtB+C,CAAAA,iBAAiBE,IAAI,GAAG,OAAOF,iBAAiBE,IAAI,GAAG,EAAC,IACzD;gBACN9C,aAAa4C,iBAAiB7C,IAAI;gBAClCG,gBAAgB0C,iBAAiB3C,GAAG;gBACpCG,kBAAkBwC,iBAAiBzC,KAAK;gBACxCd,gBAAgBZ,WAAWmE,iBAAiBvC,OAAO;YACvD,GACA;QAER;QA1FIjC,eAAe,IAAI;QAEnB,IAAI,CAACc,IAAI,CAACC,CAAC,CAACC,OAAO,CAACD,CAAC,CAACe,cAAc,CAACc,UAAU,CAC3CrC,iBAAiB,IAAM,IAAI,CAACO,IAAI,CAACC,CAAC,CAACC,OAAO,CAACD,CAAC,CAACE,cAAc,CAACF,CAAC;QAGjE,IAAI,CAACD,IAAI,CAACC,CAAC,CAAC+B,OAAO,CAACF,UAAU,CAAC,CAAC7B;YAC5B,MAAM4D,eAAe,CAAC,QAAQ,EAC1BrE,UAAU,IAAI,CAACQ,IAAI,CAACC,CAAC,CAACC,OAAO,CAACD,CAAC,CAACE,cAAc,CAACP,KAAK,EAAER,QAAQmB,MAAM,IAAI,OAAO,OACjF;YACF,OAAON,KAAKA,EAAEJ,MAAM,KAAK,KAAKgE;QAClC;QACA,IAAI,CAACzC,aAAa,CAAC0C,OAAO,CAAC,CAAC,EAAEC,WAAW,EAAE;YACvCA,YAAY,IAAM,IAAI,CAAC/D,IAAI,CAACC,CAAC,CAACC,OAAO,CAACD,CAAC,CAACgC,wBAAwB,CAAC0B,QAAQ,CAAC;QAC9E;IACJ;AAoGJ"}
|
|
1
|
+
{"version":3,"sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"sourcesContent":["import {\n commitFormState,\n DropdownFieldState,\n InputFieldState,\n setFormStateValues,\n} from '@servicetitan/form';\nimport { injectable } from '@servicetitan/react-ioc';\nimport { FieldState, FormState } from 'formstate';\nimport { action, computed, makeObservable, observable } from 'mobx';\nimport { AddressModel } from '../../address-suggestion-popover';\nimport {\n Country,\n countryToEinBnMaskMap,\n countryToZipMaskMap,\n CountryType,\n getCountry,\n isCountry,\n zipCodeValidator,\n} from '../../utils/country-helpers';\nimport { PhoneValidator } from '../utils/validators';\n\nconst required = (value: string) => (!value || value.length === 0) && 'cannot be empty string';\n\nexport interface DropdownRegion {\n Code: string;\n Name: string;\n}\n\nexport interface CountryWithRegions {\n Country: string;\n Regions: DropdownRegion[];\n}\n\nexport interface ProfileModel {\n companyName?: string | undefined;\n adminPhone?: string | undefined;\n companyStreetAddress?: string | undefined;\n companyCountry?: string | undefined;\n companyStateCode?: string | undefined;\n companyCity?: string | undefined;\n companyZipCode?: string | undefined;\n einOrBn?: string | undefined;\n isCompanyAddressVerified?: boolean;\n companyLogo?: string | undefined;\n}\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\ntype AddressFormType = {\n companyStreetAddress: InputFieldState<string>;\n companyCountry: DropdownFieldState<CountryType | ''>;\n companyStateCode: DropdownFieldState<string>;\n companyCity: InputFieldState<string>;\n companyZipCode: InputFieldState<string>;\n isCompanyAddressVerified: FieldState<boolean>;\n};\n\n// eslint-disable-next-line @typescript-eslint/consistent-type-definitions\nexport type ICompanyProfileFormType = {\n companyName: InputFieldState<string>;\n adminPhone: InputFieldState<string>;\n einOrBn: InputFieldState<string>;\n address: FormState<AddressFormType>;\n companyLogo: FieldState<string | File | undefined>;\n};\n\nexport interface ICompanyProfileFormStore {\n showFormError: boolean;\n isInitializing: boolean;\n form: FormState<ICompanyProfileFormType>;\n}\n\ninterface CompanyProfileFormOptions {\n phonePattern: RegExp;\n countries: string[];\n countryAndRegionData: CountryWithRegions[];\n phoneMask: string;\n regionToCodeMap: Map<string, string>;\n}\n\n@injectable()\nexport class CompanyProfileFormStore implements ICompanyProfileFormStore {\n @observable showFormError = false;\n @observable isInitializing = false;\n @observable countries: string[] = [];\n @observable countryAndRegionData: CountryWithRegions[] = [];\n @observable phoneMask = '';\n @observable regionToCodeMap: Map<string, string> = new Map();\n @observable withAddressValidation = false;\n\n form: FormState<ICompanyProfileFormType> = new FormState({\n companyName: new InputFieldState('').validators(required),\n adminPhone: new InputFieldState(''),\n einOrBn: new InputFieldState(''),\n address: new FormState({\n companyStreetAddress: new InputFieldState('').validators(required),\n companyCountry: new DropdownFieldState<CountryType | ''>('').validators(required),\n companyStateCode: new DropdownFieldState('').validators(required),\n companyCity: new InputFieldState('').validators(required),\n companyZipCode: new InputFieldState('').validators(required),\n isCompanyAddressVerified: new FieldState(false),\n }).validators($ => {\n if (!this.withAddressValidation) {\n return false;\n }\n\n return (\n !$.isCompanyAddressVerified.value && 'Please validate/confirm your Company Address.'\n );\n }),\n companyLogo: new FieldState<string | File | undefined>(undefined).validators(value => {\n if (value instanceof File) {\n const maxSize = 10 * 1024 * 1024;\n if (value.size > maxSize) {\n return 'File size must be less than 10 MB';\n }\n\n const allowedTypes = ['.jpg', '.jpeg', '.png', '.bmp', '.tif'];\n if (!value.name.includes('.')) {\n return `File must have a valid extension (e.g., ${allowedTypes.join(', ')}).`;\n }\n\n const fileExtension = '.' + value.name.split('.').pop()?.toLowerCase();\n if (!allowedTypes.includes(fileExtension)) {\n return `File must be one of the following formats: ${allowedTypes.map(extension => extension.slice(1)).join(', ')}`;\n }\n }\n return false;\n }),\n });\n\n constructor() {\n makeObservable(this);\n\n this.form.$.address.$.companyZipCode.validators(\n zipCodeValidator(() => this.form.$.address.$.companyCountry.$)\n );\n\n this.form.$.einOrBn.validators(($: string) => {\n const errorMessage = `Invalid ${\n isCountry(this.form.$.address.$.companyCountry.value, Country.Canada) ? 'BN' : 'EIN'\n }`;\n return $ && $.length !== 9 && errorMessage;\n });\n this.addressFields.forEach(({ onDidChange }) => {\n onDidChange(() => this.form.$.address.$.isCompanyAddressVerified.onChange(false));\n });\n }\n\n @action\n setNeedAddressValidation = (value: boolean) => {\n this.withAddressValidation = value;\n };\n\n @action\n setFormErrorCheck = (value: boolean) => {\n this.showFormError = value;\n };\n\n @computed\n get zipCodeMask() {\n return countryToZipMaskMap[this.form.$.address.$.companyCountry.$ || Country.USA];\n }\n\n @computed\n get einOrBnMask() {\n return countryToEinBnMaskMap[this.form.$.address.$.companyCountry.$ || Country.USA];\n }\n\n @computed\n get einOrBnInputProps() {\n return isCountry(this.form.$.address.$.companyCountry.value, Country.Canada)\n ? {\n label: 'BN Number',\n placeholder: 'XXXXXXXXX',\n }\n : {\n label: 'EIN Number',\n placeholder: 'XX-XXXXXXX',\n };\n }\n\n @action\n initForm = (formData: ProfileModel, options: CompanyProfileFormOptions) => {\n this.form.$.adminPhone.validators(PhoneValidator(options.phonePattern, false));\n this.countries = options.countries;\n this.countryAndRegionData = options.countryAndRegionData;\n this.phoneMask = options.phoneMask;\n this.regionToCodeMap = options.regionToCodeMap;\n let companyCountry = getCountry(formData.companyCountry) ?? ('' as const);\n if (companyCountry && this.countries && !this.countries?.includes(companyCountry)) {\n companyCountry = '';\n }\n const companyZipCode =\n (isCountry(companyCountry, Country.USA)\n ? formData.companyZipCode?.slice(0, 5)\n : formData.companyZipCode) ?? '';\n setFormStateValues(this.form, { ...formData });\n setFormStateValues(this.form.$.address, { ...formData, companyCountry, companyZipCode });\n commitFormState(this.form);\n };\n\n @action\n commitForm = () => commitFormState(this.form);\n\n @action\n applyAddressSuggestion = (suggestedAddress: AddressModel) => {\n this.form.$.address.$.isCompanyAddressVerified.onChange(true);\n setFormStateValues(\n this.form.$.address,\n {\n companyStreetAddress: suggestedAddress.street\n ? suggestedAddress.street +\n (suggestedAddress.unit ? ', ' + suggestedAddress.unit : '')\n : '',\n companyCity: suggestedAddress.city,\n companyZipCode: suggestedAddress.zip,\n companyStateCode: suggestedAddress.state,\n companyCountry: getCountry(suggestedAddress.country),\n },\n true\n );\n };\n\n @computed\n get suggestionAddressModel() {\n const form = this.form.$.address;\n return {\n street: form.$.companyStreetAddress.$,\n city: form.$.companyCity.$,\n zip: form.$.companyZipCode.$,\n state: form.$.companyStateCode.$,\n country: form.$.companyCountry.$,\n };\n }\n\n @computed\n private get addressFields() {\n const form = this.form.$.address;\n return [\n form.$.companyStreetAddress,\n form.$.companyCity,\n form.$.companyZipCode,\n form.$.companyStateCode,\n form.$.companyCountry,\n ];\n }\n}\n"],"names":["commitFormState","DropdownFieldState","InputFieldState","setFormStateValues","injectable","FieldState","FormState","action","computed","makeObservable","observable","Country","countryToEinBnMaskMap","countryToZipMaskMap","getCountry","isCountry","zipCodeValidator","PhoneValidator","required","value","length","CompanyProfileFormStore","zipCodeMask","form","$","address","companyCountry","USA","einOrBnMask","einOrBnInputProps","Canada","label","placeholder","suggestionAddressModel","street","companyStreetAddress","city","companyCity","zip","companyZipCode","state","companyStateCode","country","addressFields","showFormError","isInitializing","countries","countryAndRegionData","phoneMask","regionToCodeMap","Map","withAddressValidation","companyName","validators","adminPhone","einOrBn","isCompanyAddressVerified","companyLogo","undefined","File","maxSize","size","allowedTypes","name","includes","join","fileExtension","split","pop","toLowerCase","map","extension","slice","setNeedAddressValidation","setFormErrorCheck","initForm","formData","options","phonePattern","commitForm","applyAddressSuggestion","suggestedAddress","onChange","unit","errorMessage","forEach","onDidChange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SACIA,eAAe,EACfC,kBAAkB,EAClBC,eAAe,EACfC,kBAAkB,QACf,qBAAqB;AAC5B,SAASC,UAAU,QAAQ,0BAA0B;AACrD,SAASC,UAAU,EAAEC,SAAS,QAAQ,YAAY;AAClD,SAASC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,UAAU,QAAQ,OAAO;AAEpE,SACIC,OAAO,EACPC,qBAAqB,EACrBC,mBAAmB,EAEnBC,UAAU,EACVC,SAAS,EACTC,gBAAgB,QACb,8BAA8B;AACrC,SAASC,cAAc,QAAQ,sBAAsB;AAErD,MAAMC,WAAW,CAACC,QAAkB,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AACC,OAAO,CAACD,CAAC,CAACE,cAAc,CAACP,KAAK,EAAER,QAAQmB,MAAM,IAAI,OAAO,OACjF;YACF,OAAON,KAAKA,EAAEJ,MAAM,KAAK,KAAKgE;QAClC;QACA,IAAI,CAACzC,aAAa,CAAC0C,OAAO,CAAC,CAAC,EAAEC,WAAW,EAAE;YACvCA,YAAY,IAAM,IAAI,CAAC/D,IAAI,CAACC,CAAC,CAACC,OAAO,CAACD,CAAC,CAACgC,wBAAwB,CAAC0B,QAAQ,CAAC;QAC9E;IACJ;AAoGJ"}
|
|
@@ -25,6 +25,7 @@ import { Component, Fragment } from 'react';
|
|
|
25
25
|
import * as Styles from './card-selector.module.less';
|
|
26
26
|
export class CardSelector extends Component {
|
|
27
27
|
render() {
|
|
28
|
+
var _this_props_control;
|
|
28
29
|
const menuIcon = this.props.isCustom && /*#__PURE__*/ _jsx(Icon, {
|
|
29
30
|
name: "more_vert",
|
|
30
31
|
size: 24,
|
|
@@ -89,7 +90,6 @@ export class CardSelector extends Component {
|
|
|
89
90
|
]
|
|
90
91
|
});
|
|
91
92
|
};
|
|
92
|
-
var _this_props_control;
|
|
93
93
|
return /*#__PURE__*/ _jsx(Togglebox, {
|
|
94
94
|
hoverable: true,
|
|
95
95
|
control: (_this_props_control = this.props.control) !== null && _this_props_control !== void 0 ? _this_props_control : 'radio',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/card-selector/card-selector.tsx"],"sourcesContent":["import { BodyText, Button, Icon, Popover, Stack, Togglebox } from '@servicetitan/design-system';\nimport { CheckboxFieldState } from '@servicetitan/form';\nimport classnames from 'classnames';\nimport { observer } from 'mobx-react';\nimport { Component, Fragment, PropsWithChildren, SyntheticEvent } from 'react';\nimport * as Styles from './card-selector.module.less';\n\nexport interface CardSelectorProps {\n id?: number;\n name: string;\n isCustom: boolean;\n disabled?: boolean;\n fieldState: CheckboxFieldState;\n menuIsOpen?: boolean;\n fontStyle?: string;\n control?: 'checkbox' | 'radio';\n className?: string;\n small?: boolean;\n handleMenuClick(): void;\n handleDeleteClick?(): void;\n handleEditClick?(): void;\n handleMenuClose?(): void;\n}\n\n@observer\nexport class CardSelector extends Component<PropsWithChildren<CardSelectorProps>> {\n isChecked = () => this.props.fieldState.value;\n\n onCardClickHandler = (value: string, checked: boolean) => {\n this.props.handleMenuClose?.();\n this.props.fieldState!.onChangeHandler(value, !checked);\n };\n\n handleMenuClick = (e: SyntheticEvent<any>) => {\n e.stopPropagation();\n this.props.handleMenuClick();\n };\n\n handleEditClick = (e: SyntheticEvent<any>) => {\n e.stopPropagation();\n this.props.handleEditClick!();\n };\n\n render() {\n const menuIcon = this.props.isCustom && (\n <Icon name=\"more_vert\" size={24} color=\"grey\" onClick={this.handleMenuClick} />\n );\n\n const cardLabelProp = () => (\n <Fragment>\n <div\n className={classnames(Styles.cornerCheckmark, {\n [Styles.checkmarkVisible]: this.isChecked(),\n })}\n >\n <Icon name=\"done\" size={12} className=\"m-l-half-i\" />\n </div>\n {this.props.isCustom && (\n <Popover\n contentNoPadding\n open={this.props.menuIsOpen}\n trigger={menuIcon}\n direction=\"bl\"\n width=\"xs\"\n className=\"m-0-i\"\n >\n <Button width=\"full\" fill=\"none\" onClick={this.handleEditClick}>\n <span>Edit</span>\n </Button>\n {this.props.id === undefined && (\n <Button width=\"full\" fill=\"none\" onClick={this.props.handleDeleteClick}>\n <span>Delete</span>\n </Button>\n )}\n </Popover>\n )}\n\n <Stack\n className={Styles.graphicContainer}\n directon=\"column\"\n justifyContent=\"center\"\n >\n {this.props.children}\n <div className={this.props.children ? Styles.nameContainer : ''}>\n <BodyText className={this.props.fontStyle ?? 'fs-4-i'}>\n {this.props.name}\n </BodyText>\n </div>\n </Stack>\n </Fragment>\n );\n\n return (\n <Togglebox\n hoverable\n control={this.props.control ?? 'radio'}\n checked={this.isChecked()}\n className={classnames(\n this.props.className,\n Styles.cardStyles,\n this.props.small ? Styles.minDimensionSmall : Styles.minDimensionLarge\n )}\n onClick={this.onCardClickHandler}\n label={cardLabelProp()}\n value={this.props.name}\n disabled={this.props.disabled}\n />\n );\n }\n}\n"],"names":["BodyText","Button","Icon","Popover","Stack","Togglebox","classnames","observer","Component","Fragment","Styles","CardSelector","render","menuIcon","props","isCustom","name","size","color","onClick","handleMenuClick","cardLabelProp","div","className","cornerCheckmark","checkmarkVisible","isChecked","contentNoPadding","open","menuIsOpen","trigger","direction","width","fill","handleEditClick","span","id","undefined","handleDeleteClick","graphicContainer","directon","justifyContent","children","nameContainer","fontStyle","hoverable","control","checked","cardStyles","small","minDimensionSmall","minDimensionLarge","onCardClickHandler","label","value","disabled","fieldState","handleMenuClose","onChangeHandler","e","stopPropagation"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAEC,SAAS,QAAQ,8BAA8B;AAEhG,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,SAAS,EAAEC,QAAQ,QAA2C,QAAQ;AAC/E,YAAYC,YAAY,8BAA8B;AAoBtD,OAAO,MAAMC,qBAAqBH;IAkB9BI,SAAS;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/card-selector/card-selector.tsx"],"sourcesContent":["import { BodyText, Button, Icon, Popover, Stack, Togglebox } from '@servicetitan/design-system';\nimport { CheckboxFieldState } from '@servicetitan/form';\nimport classnames from 'classnames';\nimport { observer } from 'mobx-react';\nimport { Component, Fragment, PropsWithChildren, SyntheticEvent } from 'react';\nimport * as Styles from './card-selector.module.less';\n\nexport interface CardSelectorProps {\n id?: number;\n name: string;\n isCustom: boolean;\n disabled?: boolean;\n fieldState: CheckboxFieldState;\n menuIsOpen?: boolean;\n fontStyle?: string;\n control?: 'checkbox' | 'radio';\n className?: string;\n small?: boolean;\n handleMenuClick(): void;\n handleDeleteClick?(): void;\n handleEditClick?(): void;\n handleMenuClose?(): void;\n}\n\n@observer\nexport class CardSelector extends Component<PropsWithChildren<CardSelectorProps>> {\n isChecked = () => this.props.fieldState.value;\n\n onCardClickHandler = (value: string, checked: boolean) => {\n this.props.handleMenuClose?.();\n this.props.fieldState!.onChangeHandler(value, !checked);\n };\n\n handleMenuClick = (e: SyntheticEvent<any>) => {\n e.stopPropagation();\n this.props.handleMenuClick();\n };\n\n handleEditClick = (e: SyntheticEvent<any>) => {\n e.stopPropagation();\n this.props.handleEditClick!();\n };\n\n render() {\n const menuIcon = this.props.isCustom && (\n <Icon name=\"more_vert\" size={24} color=\"grey\" onClick={this.handleMenuClick} />\n );\n\n const cardLabelProp = () => (\n <Fragment>\n <div\n className={classnames(Styles.cornerCheckmark, {\n [Styles.checkmarkVisible]: this.isChecked(),\n })}\n >\n <Icon name=\"done\" size={12} className=\"m-l-half-i\" />\n </div>\n {this.props.isCustom && (\n <Popover\n contentNoPadding\n open={this.props.menuIsOpen}\n trigger={menuIcon}\n direction=\"bl\"\n width=\"xs\"\n className=\"m-0-i\"\n >\n <Button width=\"full\" fill=\"none\" onClick={this.handleEditClick}>\n <span>Edit</span>\n </Button>\n {this.props.id === undefined && (\n <Button width=\"full\" fill=\"none\" onClick={this.props.handleDeleteClick}>\n <span>Delete</span>\n </Button>\n )}\n </Popover>\n )}\n\n <Stack\n className={Styles.graphicContainer}\n directon=\"column\"\n justifyContent=\"center\"\n >\n {this.props.children}\n <div className={this.props.children ? Styles.nameContainer : ''}>\n <BodyText className={this.props.fontStyle ?? 'fs-4-i'}>\n {this.props.name}\n </BodyText>\n </div>\n </Stack>\n </Fragment>\n );\n\n return (\n <Togglebox\n hoverable\n control={this.props.control ?? 'radio'}\n checked={this.isChecked()}\n className={classnames(\n this.props.className,\n Styles.cardStyles,\n this.props.small ? Styles.minDimensionSmall : Styles.minDimensionLarge\n )}\n onClick={this.onCardClickHandler}\n label={cardLabelProp()}\n value={this.props.name}\n disabled={this.props.disabled}\n />\n );\n }\n}\n"],"names":["BodyText","Button","Icon","Popover","Stack","Togglebox","classnames","observer","Component","Fragment","Styles","CardSelector","render","menuIcon","props","isCustom","name","size","color","onClick","handleMenuClick","cardLabelProp","div","className","cornerCheckmark","checkmarkVisible","isChecked","contentNoPadding","open","menuIsOpen","trigger","direction","width","fill","handleEditClick","span","id","undefined","handleDeleteClick","graphicContainer","directon","justifyContent","children","nameContainer","fontStyle","hoverable","control","checked","cardStyles","small","minDimensionSmall","minDimensionLarge","onCardClickHandler","label","value","disabled","fieldState","handleMenuClose","onChangeHandler","e","stopPropagation"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA,SAASA,QAAQ,EAAEC,MAAM,EAAEC,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAEC,SAAS,QAAQ,8BAA8B;AAEhG,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,QAAQ,aAAa;AACtC,SAASC,SAAS,EAAEC,QAAQ,QAA2C,QAAQ;AAC/E,YAAYC,YAAY,8BAA8B;AAoBtD,OAAO,MAAMC,qBAAqBH;IAkB9BI,SAAS;YAoDY;QAnDjB,MAAMC,WAAW,IAAI,CAACC,KAAK,CAACC,QAAQ,kBAChC,KAACb;YAAKc,MAAK;YAAYC,MAAM;YAAIC,OAAM;YAAOC,SAAS,IAAI,CAACC,eAAe;;QAG/E,MAAMC,gBAAgB;gBAoCe;iCAnCjC,MAACZ;;kCACG,KAACa;wBACGC,WAAWjB,WAAWI,OAAOc,eAAe,EAAE;4BAC1C,CAACd,OAAOe,gBAAgB,CAAC,EAAE,IAAI,CAACC,SAAS;wBAC7C;kCAEA,cAAA,KAACxB;4BAAKc,MAAK;4BAAOC,MAAM;4BAAIM,WAAU;;;oBAEzC,IAAI,CAACT,KAAK,CAACC,QAAQ,kBAChB,MAACZ;wBACGwB,gBAAgB;wBAChBC,MAAM,IAAI,CAACd,KAAK,CAACe,UAAU;wBAC3BC,SAASjB;wBACTkB,WAAU;wBACVC,OAAM;wBACNT,WAAU;;0CAEV,KAACtB;gCAAO+B,OAAM;gCAAOC,MAA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ACjC,KAAK,EAAC2C,eAAe,cAA1B,kDAAA,iCAAA;YACA,IAAI,CAAC3C,KAAK,CAAC0C,UAAU,CAAEE,eAAe,CAACJ,OAAO,CAACP;QACnD,IAEA3B,uBAAAA,mBAAkB,CAACuC;YACfA,EAAEC,eAAe;YACjB,IAAI,CAAC9C,KAAK,CAACM,eAAe;QAC9B,IAEAc,uBAAAA,mBAAkB,CAACyB;YACfA,EAAEC,eAAe;YACjB,IAAI,CAAC9C,KAAK,CAACoB,eAAe;QAC9B;;AAoEJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/components/zip-code-input.tsx"],"sourcesContent":["import { Form, FormInputProps } from '@servicetitan/design-system';\nimport { InputFieldState } from '@servicetitan/form';\nimport { observer } from 'mobx-react';\nimport { ChangeEvent, FC, InputHTMLAttributes } from 'react';\nimport ReactInputMask from 'react-input-mask';\nimport { countryToZipMaskMap, getCountry } from '../utils';\n\ninterface IZipCodeInputProps extends FormInputProps {\n countryCode?: string;\n fieldState: InputFieldState<string>;\n}\nexport const ZipCodeInput: FC<IZipCodeInputProps> = observer(\n ({ countryCode, fieldState, ...otherProps }) => {\n const zipCodeMask = countryToZipMaskMap[getCountry(countryCode) ?? 'USA'];\n const handleOnChange = (e: ChangeEvent<HTMLInputElement>) => {\n fieldState.onChangeHandler(e, {\n value: e.target.value,\n });\n };\n const error = fieldState.error;\n const renderFunction = (props: InputHTMLAttributes<HTMLInputElement>) => (\n <Form.Input\n {...props}\n fluid\n className=\"p-r-0\"\n width=\"12\"\n label=\"ZIP Code\"\n placeholder=\"ZIP Code\"\n error={error}\n {...otherProps}\n />\n );\n return (\n <ReactInputMask\n maskChar=\" \"\n mask={zipCodeMask}\n value={fieldState.value}\n onChange={handleOnChange}\n >\n {renderFunction as any}\n </ReactInputMask>\n );\n }\n);\nZipCodeInput.displayName = 'ZipCodeInput';\n"],"names":["Form","observer","ReactInputMask","countryToZipMaskMap","getCountry","ZipCodeInput","countryCode","fieldState","otherProps","zipCodeMask","handleOnChange","e","onChangeHandler","value","target","error","renderFunction","props","Input","fluid","className","width","label","placeholder","maskChar","mask","onChange","displayName"],"mappings":";AAAA,SAASA,IAAI,QAAwB,8BAA8B;AAEnE,SAASC,QAAQ,QAAQ,aAAa;AAEtC,OAAOC,oBAAoB,mBAAmB;AAC9C,SAASC,mBAAmB,EAAEC,UAAU,QAAQ,WAAW;AAM3D,OAAO,MAAMC,eAAuCJ,SAChD,CAAC,EAAEK,WAAW,EAAEC,UAAU,EAAE,GAAGC,YAAY;QACCJ;IAAxC,MAAMK,cAAcN,mBAAmB,
|
|
1
|
+
{"version":3,"sources":["../../src/components/zip-code-input.tsx"],"sourcesContent":["import { Form, FormInputProps } from '@servicetitan/design-system';\nimport { InputFieldState } from '@servicetitan/form';\nimport { observer } from 'mobx-react';\nimport { ChangeEvent, FC, InputHTMLAttributes } from 'react';\nimport ReactInputMask from 'react-input-mask';\nimport { countryToZipMaskMap, getCountry } from '../utils';\n\ninterface IZipCodeInputProps extends FormInputProps {\n countryCode?: string;\n fieldState: InputFieldState<string>;\n}\nexport const ZipCodeInput: FC<IZipCodeInputProps> = observer(\n ({ countryCode, fieldState, ...otherProps }) => {\n const zipCodeMask = countryToZipMaskMap[getCountry(countryCode) ?? 'USA'];\n const handleOnChange = (e: ChangeEvent<HTMLInputElement>) => {\n fieldState.onChangeHandler(e, {\n value: e.target.value,\n });\n };\n const error = fieldState.error;\n const renderFunction = (props: InputHTMLAttributes<HTMLInputElement>) => (\n <Form.Input\n {...props}\n fluid\n className=\"p-r-0\"\n width=\"12\"\n label=\"ZIP Code\"\n placeholder=\"ZIP Code\"\n error={error}\n {...otherProps}\n />\n );\n return (\n <ReactInputMask\n maskChar=\" \"\n mask={zipCodeMask}\n value={fieldState.value}\n onChange={handleOnChange}\n >\n {renderFunction as any}\n </ReactInputMask>\n );\n }\n);\nZipCodeInput.displayName = 'ZipCodeInput';\n"],"names":["Form","observer","ReactInputMask","countryToZipMaskMap","getCountry","ZipCodeInput","countryCode","fieldState","otherProps","zipCodeMask","handleOnChange","e","onChangeHandler","value","target","error","renderFunction","props","Input","fluid","className","width","label","placeholder","maskChar","mask","onChange","displayName"],"mappings":";AAAA,SAASA,IAAI,QAAwB,8BAA8B;AAEnE,SAASC,QAAQ,QAAQ,aAAa;AAEtC,OAAOC,oBAAoB,mBAAmB;AAC9C,SAASC,mBAAmB,EAAEC,UAAU,QAAQ,WAAW;AAM3D,OAAO,MAAMC,eAAuCJ,SAChD,CAAC,EAAEK,WAAW,EAAEC,UAAU,EAAE,GAAGC,YAAY;QACCJ;IAAxC,MAAMK,cAAcN,mBAAmB,EAACC,cAAAA,WAAWE,0BAAXF,yBAAAA,cAA2B,MAAM;IACzE,MAAMM,iBAAiB,CAACC;QACpBJ,WAAWK,eAAe,CAACD,GAAG;YAC1BE,OAAOF,EAAEG,MAAM,CAACD,KAAK;QACzB;IACJ;IACA,MAAME,QAAQR,WAAWQ,KAAK;IAC9B,MAAMC,iBAAiB,CAACC,sBACpB,KAACjB,KAAKkB,KAAK;YACN,GAAGD,KAAK;YACTE,KAAK;YACLC,WAAU;YACVC,OAAM;YACNC,OAAM;YACNC,aAAY;YACZR,OAAOA;YACN,GAAGP,UAAU;;IAGtB,qBACI,KAACN;QACGsB,UAAS;QACTC,MAAMhB;QACNI,OAAON,WAAWM,KAAK;QACvBa,UAAUhB;kBAETM;;AAGb,GACF;AACFX,aAAasB,WAAW,GAAG"}
|
|
@@ -46,18 +46,18 @@ export class MarketingCarouselStore {
|
|
|
46
46
|
}
|
|
47
47
|
get carouselData() {
|
|
48
48
|
try {
|
|
49
|
+
var _this_photoGalleryData_items_filter_map;
|
|
49
50
|
var _this_photoGalleryData, _this_fallbackData;
|
|
50
51
|
if (!((_this_photoGalleryData = this.photoGalleryData) === null || _this_photoGalleryData === void 0 ? void 0 : _this_photoGalleryData.items)) {
|
|
51
52
|
var _this_fallbackData1;
|
|
52
53
|
return (_this_fallbackData1 = this.fallbackData) === null || _this_fallbackData1 === void 0 ? void 0 : _this_fallbackData1.carouselData;
|
|
53
54
|
}
|
|
54
|
-
var _this_photoGalleryData_items_filter_map;
|
|
55
55
|
return (_this_photoGalleryData_items_filter_map = this.photoGalleryData.items.filter(({ showDate, hideDate })=>this.isDateRangeActive(showDate, hideDate)).map(({ ctaLink, ctaTrackingCode, media, ...fields })=>({
|
|
56
56
|
...fields,
|
|
57
57
|
ctaLink: this.getCtaLink(ctaLink, ctaTrackingCode),
|
|
58
58
|
imageUrl: media.file.url.replace('//', 'https://')
|
|
59
59
|
}))) !== null && _this_photoGalleryData_items_filter_map !== void 0 ? _this_photoGalleryData_items_filter_map : (_this_fallbackData = this.fallbackData) === null || _this_fallbackData === void 0 ? void 0 : _this_fallbackData.carouselData;
|
|
60
|
-
} catch (
|
|
60
|
+
} catch (unused) {
|
|
61
61
|
var _this_fallbackData2;
|
|
62
62
|
return (_this_fallbackData2 = this.fallbackData) === null || _this_fallbackData2 === void 0 ? void 0 : _this_fallbackData2.carouselData;
|
|
63
63
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/contentful/marketing-carousel.store.ts"],"sourcesContent":["import { inject, injectable } from '@servicetitan/react-ioc';\nimport { action, computed, makeObservable, observable, runInAction } from 'mobx';\nimport queryString from 'query-string';\nimport type { IContentfulApi } from '@servicetitan/contentful-proxy';\nimport { CONTENTFUL_API_TOKEN } from '@servicetitan/contentful-proxy';\nimport type { OxPhotoGalleryFields } from './interfaces';\n\nconst carouselBackgroundLightPath =\n 'https://static.servicetitan.com/acm/auth/sign-in-carousel-background.png';\n\nexport enum MarketingCarouselColorTheme {\n Light = 'Light',\n Dark = 'Dark',\n}\n\nexport interface MarketingCarouselFallbackData {\n carouselSettings: {\n colorTheme: MarketingCarouselColorTheme;\n backgroundImageUrl: string;\n };\n carouselData: MarketingCarouselItem[];\n}\n\ninterface MarketingCarouselStoreOptions {\n codeId: string;\n isPreview?: boolean;\n utmSource?: string;\n fallbackData?: MarketingCarouselFallbackData;\n}\n\ninterface MarketingCarouselItem {\n headline: string;\n ctaLink: string;\n ctaLabel: string;\n imageUrl: string;\n description: string;\n}\n\n@injectable()\nexport class MarketingCarouselStore {\n @observable isInitializing = false;\n @observable private photoGalleryData?: OxPhotoGalleryFields;\n @observable private utmSource?: string;\n @observable private fallbackData?: MarketingCarouselFallbackData;\n\n constructor(@inject(CONTENTFUL_API_TOKEN) private contentfulApi: IContentfulApi) {\n makeObservable(this);\n }\n\n @action\n initialize = async ({\n codeId,\n utmSource,\n fallbackData,\n isPreview = false,\n }: MarketingCarouselStoreOptions) => {\n this.isInitializing = true;\n this.utmSource = utmSource;\n this.fallbackData = fallbackData;\n try {\n const data = await this.contentfulApi.getContentfulData<OxPhotoGalleryFields>({\n entryType: 'oxPhotoGallery',\n codeId,\n isPreview: isPreview ?? false,\n });\n if (!data?.items.length) {\n return;\n }\n runInAction(() => {\n this.photoGalleryData = data;\n });\n } finally {\n runInAction(() => {\n this.isInitializing = false;\n });\n }\n };\n\n // colorTheme and backgroundImageUrl are not not part of initial release of contentful\n @computed\n get carouselSettings() {\n return this.photoGalleryData\n ? {\n backgroundImageUrl: carouselBackgroundLightPath,\n colorTheme: MarketingCarouselColorTheme.Light,\n }\n : this.fallbackData?.carouselSettings;\n }\n\n @computed\n get carouselData(): MarketingCarouselItem[] | undefined {\n try {\n if (!this.photoGalleryData?.items) {\n return this.fallbackData?.carouselData;\n }\n return (\n this.photoGalleryData.items\n .filter(({ showDate, hideDate }) => this.isDateRangeActive(showDate, hideDate))\n .map(({ ctaLink, ctaTrackingCode, media, ...fields }) => ({\n ...fields,\n ctaLink: this.getCtaLink(ctaLink, ctaTrackingCode),\n imageUrl: media.file.url.replace('//', 'https://'),\n })) ?? this.fallbackData?.carouselData\n );\n } catch {\n return this.fallbackData?.carouselData;\n }\n }\n\n private getCtaLink = (ctaLink: string, ctaTrackingCode?: string) => {\n if (!ctaTrackingCode) {\n return ctaLink;\n }\n const qs = queryString.parse(ctaTrackingCode);\n if (this.utmSource) {\n qs.utm_source = this.utmSource;\n }\n return `${ctaLink}?${queryString.stringify(qs)}`;\n };\n\n private isDateRangeActive = (start?: string, end?: string) => {\n if (!start && !end) {\n return true;\n }\n const localCurrentTime = new Date().getTime();\n const inStartRange = !start || localCurrentTime >= new Date(start).getTime();\n const inEndRange = !end || localCurrentTime < new Date(end).getTime();\n return inStartRange && inEndRange;\n };\n}\n"],"names":["inject","injectable","action","computed","makeObservable","observable","runInAction","queryString","CONTENTFUL_API_TOKEN","carouselBackgroundLightPath","MarketingCarouselColorTheme","MarketingCarouselStore","carouselSettings","photoGalleryData","backgroundImageUrl","colorTheme","fallbackData","carouselData","items","filter","showDate","hideDate","isDateRangeActive","map","ctaLink","ctaTrackingCode","media","fields","getCtaLink","imageUrl","file","url","replace","contentfulApi","isInitializing","utmSource","initialize","codeId","isPreview","data","getContentfulData","entryType","length","qs","parse","utm_source","stringify","start","end","localCurrentTime","Date","getTime","inStartRange","inEndRange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM,EAAEC,UAAU,QAAQ,0BAA0B;AAC7D,SAASC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,UAAU,EAAEC,WAAW,QAAQ,OAAO;AACjF,OAAOC,iBAAiB,eAAe;AAEvC,SAASC,oBAAoB,QAAQ,iCAAiC;AAGtE,MAAMC,8BACF;AAEJ,OAAO,IAAA,AAAKC,qDAAAA;;;WAAAA;MAGX;AA0BD,OAAO,MAAMC;IAuCT,sFAAsF;IACtF,IACIC,mBAAmB;YAMb;QALN,OAAO,IAAI,CAACC,gBAAgB,GACtB;YACIC,oBAAoBL;YACpBM,UAAU;QACd,KACA,qBAAA,IAAI,CAACC,YAAY,cAAjB,yCAAA,mBAAmBJ,gBAAgB;IAC7C;IAEA,IACIK,eAAoD;QACpD,IAAI;
|
|
1
|
+
{"version":3,"sources":["../../src/contentful/marketing-carousel.store.ts"],"sourcesContent":["import { inject, injectable } from '@servicetitan/react-ioc';\nimport { action, computed, makeObservable, observable, runInAction } from 'mobx';\nimport queryString from 'query-string';\nimport type { IContentfulApi } from '@servicetitan/contentful-proxy';\nimport { CONTENTFUL_API_TOKEN } from '@servicetitan/contentful-proxy';\nimport type { OxPhotoGalleryFields } from './interfaces';\n\nconst carouselBackgroundLightPath =\n 'https://static.servicetitan.com/acm/auth/sign-in-carousel-background.png';\n\nexport enum MarketingCarouselColorTheme {\n Light = 'Light',\n Dark = 'Dark',\n}\n\nexport interface MarketingCarouselFallbackData {\n carouselSettings: {\n colorTheme: MarketingCarouselColorTheme;\n backgroundImageUrl: string;\n };\n carouselData: MarketingCarouselItem[];\n}\n\ninterface MarketingCarouselStoreOptions {\n codeId: string;\n isPreview?: boolean;\n utmSource?: string;\n fallbackData?: MarketingCarouselFallbackData;\n}\n\ninterface MarketingCarouselItem {\n headline: string;\n ctaLink: string;\n ctaLabel: string;\n imageUrl: string;\n description: string;\n}\n\n@injectable()\nexport class MarketingCarouselStore {\n @observable isInitializing = false;\n @observable private photoGalleryData?: OxPhotoGalleryFields;\n @observable private utmSource?: string;\n @observable private fallbackData?: MarketingCarouselFallbackData;\n\n constructor(@inject(CONTENTFUL_API_TOKEN) private contentfulApi: IContentfulApi) {\n makeObservable(this);\n }\n\n @action\n initialize = async ({\n codeId,\n utmSource,\n fallbackData,\n isPreview = false,\n }: MarketingCarouselStoreOptions) => {\n this.isInitializing = true;\n this.utmSource = utmSource;\n this.fallbackData = fallbackData;\n try {\n const data = await this.contentfulApi.getContentfulData<OxPhotoGalleryFields>({\n entryType: 'oxPhotoGallery',\n codeId,\n isPreview: isPreview ?? false,\n });\n if (!data?.items.length) {\n return;\n }\n runInAction(() => {\n this.photoGalleryData = data;\n });\n } finally {\n runInAction(() => {\n this.isInitializing = false;\n });\n }\n };\n\n // colorTheme and backgroundImageUrl are not not part of initial release of contentful\n @computed\n get carouselSettings() {\n return this.photoGalleryData\n ? {\n backgroundImageUrl: carouselBackgroundLightPath,\n colorTheme: MarketingCarouselColorTheme.Light,\n }\n : this.fallbackData?.carouselSettings;\n }\n\n @computed\n get carouselData(): MarketingCarouselItem[] | undefined {\n try {\n if (!this.photoGalleryData?.items) {\n return this.fallbackData?.carouselData;\n }\n return (\n this.photoGalleryData.items\n .filter(({ showDate, hideDate }) => this.isDateRangeActive(showDate, hideDate))\n .map(({ ctaLink, ctaTrackingCode, media, ...fields }) => ({\n ...fields,\n ctaLink: this.getCtaLink(ctaLink, ctaTrackingCode),\n imageUrl: media.file.url.replace('//', 'https://'),\n })) ?? this.fallbackData?.carouselData\n );\n } catch {\n return this.fallbackData?.carouselData;\n }\n }\n\n private getCtaLink = (ctaLink: string, ctaTrackingCode?: string) => {\n if (!ctaTrackingCode) {\n return ctaLink;\n }\n const qs = queryString.parse(ctaTrackingCode);\n if (this.utmSource) {\n qs.utm_source = this.utmSource;\n }\n return `${ctaLink}?${queryString.stringify(qs)}`;\n };\n\n private isDateRangeActive = (start?: string, end?: string) => {\n if (!start && !end) {\n return true;\n }\n const localCurrentTime = new Date().getTime();\n const inStartRange = !start || localCurrentTime >= new Date(start).getTime();\n const inEndRange = !end || localCurrentTime < new Date(end).getTime();\n return inStartRange && inEndRange;\n };\n}\n"],"names":["inject","injectable","action","computed","makeObservable","observable","runInAction","queryString","CONTENTFUL_API_TOKEN","carouselBackgroundLightPath","MarketingCarouselColorTheme","MarketingCarouselStore","carouselSettings","photoGalleryData","backgroundImageUrl","colorTheme","fallbackData","carouselData","items","filter","showDate","hideDate","isDateRangeActive","map","ctaLink","ctaTrackingCode","media","fields","getCtaLink","imageUrl","file","url","replace","contentfulApi","isInitializing","utmSource","initialize","codeId","isPreview","data","getContentfulData","entryType","length","qs","parse","utm_source","stringify","start","end","localCurrentTime","Date","getTime","inStartRange","inEndRange"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM,EAAEC,UAAU,QAAQ,0BAA0B;AAC7D,SAASC,MAAM,EAAEC,QAAQ,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AKH,OAAOI,OAAO;YAC1E,MAAME,aAAa,CAACL,OAAOC,mBAAmB,IAAIC,KAAKF,KAAKG,OAAO;YACnE,OAAOC,gBAAgBC;QAC3B;QAlFIjD,eAAe,IAAI;IACvB;AAkFJ"}
|
|
@@ -53,11 +53,11 @@ export const CustomerTypesSelector = observer(({ small })=>{
|
|
|
53
53
|
'w-50 m-t-2': !small
|
|
54
54
|
}),
|
|
55
55
|
children: getEnumValues(CustomerTypes).map((customerTypeEnum, index)=>{
|
|
56
|
+
var _customerTypeCardDetails_get;
|
|
56
57
|
const fieldState = form.$[customerTypeEnum];
|
|
57
58
|
if (!fieldState) {
|
|
58
59
|
return null;
|
|
59
60
|
}
|
|
60
|
-
var _customerTypeCardDetails_get;
|
|
61
61
|
const { name, icon } = (_customerTypeCardDetails_get = customerTypeCardDetails.get(customerTypeEnum)) !== null && _customerTypeCardDetails_get !== void 0 ? _customerTypeCardDetails_get : {
|
|
62
62
|
name: ''
|
|
63
63
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/customer-types/components/customer-types-selector.tsx"],"sourcesContent":["import { Stack } from '@servicetitan/design-system';\nimport { getEnumValues } from '@servicetitan/form';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport classNames from 'classnames';\nimport { observer } from 'mobx-react';\nimport { FC } from 'react';\nimport { CardSelector } from '../../components/card-selector/card-selector';\nimport { CustomerTypeFormStore } from '../stores/customer-type-form.store';\nimport { CustomerTypes } from '../utils/customer-types';\nimport { customerTypesMinWidth } from './customer-types-form.module.less';\nconst iconResidential = require('../assets/icon-residential.svg');\nconst iconCommercial = require('../assets/icon-commercial.svg');\nconst iconResidentialConstruction = require('../assets/icon-residential-construction.svg');\nconst iconCommercialConstruction = require('../assets/icon-commercial-construction.svg');\n\nexport const customerTypeCardDetails: Map<CustomerTypes, { name: string; icon: string }> = new Map([\n [CustomerTypes.ResSR, { name: 'Residential Service & Replacement', icon: iconResidential }],\n [CustomerTypes.CommSR, { name: 'Commercial Service & Replacement', icon: iconCommercial }],\n [CustomerTypes.ResNC, { name: 'Residential Construction', icon: iconResidentialConstruction }],\n [CustomerTypes.CommNC, { name: 'Commercial Construction', icon: iconCommercialConstruction }],\n]);\n\nexport const CustomerTypesSelector: FC<{ small?: boolean }> = observer(({ small }) => {\n const [{ form }] = useDependencies(CustomerTypeFormStore);\n return (\n <Stack\n spacing={2}\n wrap={small ? 'nowrap' : 'wrap'}\n justifyContent={small ? 'space-evenly' : 'center'}\n className={classNames(customerTypesMinWidth, {\n 'w-50 m-t-2': !small,\n })}\n >\n {getEnumValues(CustomerTypes).map((customerTypeEnum, index) => {\n const fieldState = form.$[customerTypeEnum];\n if (!fieldState) {\n return null;\n }\n const { name, icon } = customerTypeCardDetails.get(customerTypeEnum) ?? {\n name: '',\n };\n return (\n <CardSelector\n {...{ index, name, fieldState }}\n small\n key={name}\n isCustom={false}\n handleMenuClick={() => null}\n fontStyle={small ? 'fs-2-i' : 'fs-3-i'}\n className={classNames({ 'm-t-2-i': !small })}\n control=\"checkbox\"\n >\n {icon && <img src={icon} className=\"m-a\" />}\n </CardSelector>\n );\n })}\n </Stack>\n );\n});\nCustomerTypesSelector.displayName = 'CustomerTypesSelector';\n"],"names":["Stack","getEnumValues","useDependencies","classNames","observer","CardSelector","CustomerTypeFormStore","CustomerTypes","customerTypesMinWidth","iconResidential","require","iconCommercial","iconResidentialConstruction","iconCommercialConstruction","customerTypeCardDetails","Map","ResSR","name","icon","CommSR","ResNC","CommNC","CustomerTypesSelector","small","form","spacing","wrap","justifyContent","className","map","customerTypeEnum","index","fieldState","$","get","key","isCustom","handleMenuClick","fontStyle","control","img","src","displayName"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,8BAA8B;AACpD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,YAAY,QAAQ,+CAA+C;AAC5E,SAASC,qBAAqB,QAAQ,qCAAqC;AAC3E,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,MAAMC,kBAAkBC,QAAQ;AAChC,MAAMC,iBAAiBD,QAAQ;AAC/B,MAAME,8BAA8BF,QAAQ;AAC5C,MAAMG,6BAA6BH,QAAQ;AAE3C,OAAO,MAAMI,0BAA8E,IAAIC,IAAI;IAC/F;QAACR,cAAcS,KAAK;QAAE;YAAEC,MAAM;YAAqCC,MAAMT;QAAgB;KAAE;IAC3F;QAACF,cAAcY,MAAM;QAAE;YAAEF,MAAM;YAAoCC,MAAMP;QAAe;KAAE;IAC1F;QAACJ,cAAca,KAAK;QAAE;YAAEH,MAAM;YAA4BC,MAAMN;QAA4B;KAAE;IAC9F;QAACL,cAAcc,MAAM;QAAE;YAAEJ,MAAM;YAA2BC,MAAML;QAA2B;KAAE;CAChG,EAAE;AAEH,OAAO,MAAMS,wBAAiDlB,SAAS,CAAC,EAAEmB,KAAK,EAAE;IAC7E,MAAM,CAAC,EAAEC,IAAI,EAAE,CAAC,GAAGtB,gBAAgBI;IACnC,qBACI,KAACN;QACGyB,SAAS;QACTC,MAAMH,QAAQ,WAAW;QACzBI,gBAAgBJ,QAAQ,iBAAiB;QACzCK,WAAWzB,WAAWK,uBAAuB;YACzC,cAAc,CAACe;QACnB;kBAECtB,cAAcM,eAAesB,GAAG,CAAC,CAACC,kBAAkBC;
|
|
1
|
+
{"version":3,"sources":["../../../src/customer-types/components/customer-types-selector.tsx"],"sourcesContent":["import { Stack } from '@servicetitan/design-system';\nimport { getEnumValues } from '@servicetitan/form';\nimport { useDependencies } from '@servicetitan/react-ioc';\nimport classNames from 'classnames';\nimport { observer } from 'mobx-react';\nimport { FC } from 'react';\nimport { CardSelector } from '../../components/card-selector/card-selector';\nimport { CustomerTypeFormStore } from '../stores/customer-type-form.store';\nimport { CustomerTypes } from '../utils/customer-types';\nimport { customerTypesMinWidth } from './customer-types-form.module.less';\nconst iconResidential = require('../assets/icon-residential.svg');\nconst iconCommercial = require('../assets/icon-commercial.svg');\nconst iconResidentialConstruction = require('../assets/icon-residential-construction.svg');\nconst iconCommercialConstruction = require('../assets/icon-commercial-construction.svg');\n\nexport const customerTypeCardDetails: Map<CustomerTypes, { name: string; icon: string }> = new Map([\n [CustomerTypes.ResSR, { name: 'Residential Service & Replacement', icon: iconResidential }],\n [CustomerTypes.CommSR, { name: 'Commercial Service & Replacement', icon: iconCommercial }],\n [CustomerTypes.ResNC, { name: 'Residential Construction', icon: iconResidentialConstruction }],\n [CustomerTypes.CommNC, { name: 'Commercial Construction', icon: iconCommercialConstruction }],\n]);\n\nexport const CustomerTypesSelector: FC<{ small?: boolean }> = observer(({ small }) => {\n const [{ form }] = useDependencies(CustomerTypeFormStore);\n return (\n <Stack\n spacing={2}\n wrap={small ? 'nowrap' : 'wrap'}\n justifyContent={small ? 'space-evenly' : 'center'}\n className={classNames(customerTypesMinWidth, {\n 'w-50 m-t-2': !small,\n })}\n >\n {getEnumValues(CustomerTypes).map((customerTypeEnum, index) => {\n const fieldState = form.$[customerTypeEnum];\n if (!fieldState) {\n return null;\n }\n const { name, icon } = customerTypeCardDetails.get(customerTypeEnum) ?? {\n name: '',\n };\n return (\n <CardSelector\n {...{ index, name, fieldState }}\n small\n key={name}\n isCustom={false}\n handleMenuClick={() => null}\n fontStyle={small ? 'fs-2-i' : 'fs-3-i'}\n className={classNames({ 'm-t-2-i': !small })}\n control=\"checkbox\"\n >\n {icon && <img src={icon} className=\"m-a\" />}\n </CardSelector>\n );\n })}\n </Stack>\n );\n});\nCustomerTypesSelector.displayName = 'CustomerTypesSelector';\n"],"names":["Stack","getEnumValues","useDependencies","classNames","observer","CardSelector","CustomerTypeFormStore","CustomerTypes","customerTypesMinWidth","iconResidential","require","iconCommercial","iconResidentialConstruction","iconCommercialConstruction","customerTypeCardDetails","Map","ResSR","name","icon","CommSR","ResNC","CommNC","CustomerTypesSelector","small","form","spacing","wrap","justifyContent","className","map","customerTypeEnum","index","fieldState","$","get","key","isCustom","handleMenuClick","fontStyle","control","img","src","displayName"],"mappings":";;AAAA,SAASA,KAAK,QAAQ,8BAA8B;AACpD,SAASC,aAAa,QAAQ,qBAAqB;AACnD,SAASC,eAAe,QAAQ,0BAA0B;AAC1D,OAAOC,gBAAgB,aAAa;AACpC,SAASC,QAAQ,QAAQ,aAAa;AAEtC,SAASC,YAAY,QAAQ,+CAA+C;AAC5E,SAASC,qBAAqB,QAAQ,qCAAqC;AAC3E,SAASC,aAAa,QAAQ,0BAA0B;AACxD,SAASC,qBAAqB,QAAQ,oCAAoC;AAC1E,MAAMC,kBAAkBC,QAAQ;AAChC,MAAMC,iBAAiBD,QAAQ;AAC/B,MAAME,8BAA8BF,QAAQ;AAC5C,MAAMG,6BAA6BH,QAAQ;AAE3C,OAAO,MAAMI,0BAA8E,IAAIC,IAAI;IAC/F;QAACR,cAAcS,KAAK;QAAE;YAAEC,MAAM;YAAqCC,MAAMT;QAAgB;KAAE;IAC3F;QAACF,cAAcY,MAAM;QAAE;YAAEF,MAAM;YAAoCC,MAAMP;QAAe;KAAE;IAC1F;QAACJ,cAAca,KAAK;QAAE;YAAEH,MAAM;YAA4BC,MAAMN;QAA4B;KAAE;IAC9F;QAACL,cAAcc,MAAM;QAAE;YAAEJ,MAAM;YAA2BC,MAAML;QAA2B;KAAE;CAChG,EAAE;AAEH,OAAO,MAAMS,wBAAiDlB,SAAS,CAAC,EAAEmB,KAAK,EAAE;IAC7E,MAAM,CAAC,EAAEC,IAAI,EAAE,CAAC,GAAGtB,gBAAgBI;IACnC,qBACI,KAACN;QACGyB,SAAS;QACTC,MAAMH,QAAQ,WAAW;QACzBI,gBAAgBJ,QAAQ,iBAAiB;QACzCK,WAAWzB,WAAWK,uBAAuB;YACzC,cAAc,CAACe;QACnB;kBAECtB,cAAcM,eAAesB,GAAG,CAAC,CAACC,kBAAkBC;gBAK1BjB;YAJvB,MAAMkB,aAAaR,KAAKS,CAAC,CAACH,iBAAiB;YAC3C,IAAI,CAACE,YAAY;gBACb,OAAO;YACX;YACA,MAAM,EAAEf,IAAI,EAAEC,IAAI,EAAE,IAAGJ,+BAAAA,wBAAwBoB,GAAG,CAACJ,+BAA5BhB,0CAAAA,+BAAiD;gBACpEG,MAAM;YACV;YACA,qBACI,eAACZ;gBACS0B;gBAAOd;gBAAMe;gBACnBT,KAAK;gBACLY,KAAKlB;gBACLmB,UAAU;gBACVC,iBAAiB,IAAM;gBACvBC,WAAWf,QAAQ,WAAW;gBAC9BK,WAAWzB,WAAW;oBAAE,WAAW,CAACoB;gBAAM;gBAC1CgB,SAAQ;eAEPrB,sBAAQ,KAACsB;gBAAIC,KAAKvB;gBAAMU,WAAU;;QAG/C;;AAGZ,GAAG;AACHN,sBAAsBoB,WAAW,GAAG"}
|
|
@@ -58,9 +58,9 @@ export class PresenceStore {
|
|
|
58
58
|
return this.channel.members.me;
|
|
59
59
|
}
|
|
60
60
|
get lastUser() {
|
|
61
|
+
var _ref;
|
|
61
62
|
var _this_users__info, _this_users_;
|
|
62
|
-
|
|
63
|
-
return (_this_users__info_Name = (_this_users_ = this.users[this.users.length - 1]) === null || _this_users_ === void 0 ? void 0 : (_this_users__info = _this_users_.info) === null || _this_users__info === void 0 ? void 0 : _this_users__info.Name) !== null && _this_users__info_Name !== void 0 ? _this_users__info_Name : '-';
|
|
63
|
+
return (_ref = (_this_users_ = this.users[this.users.length - 1]) === null || _this_users_ === void 0 ? void 0 : (_this_users__info = _this_users_.info) === null || _this_users__info === void 0 ? void 0 : _this_users__info.Name) !== null && _ref !== void 0 ? _ref : '-';
|
|
64
64
|
}
|
|
65
65
|
constructor(pusherStore){
|
|
66
66
|
_define_property(this, "pusherStore", void 0);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pusher/presence.store.ts"],"sourcesContent":["import { inject, injectable } from '@servicetitan/react-ioc';\nimport { action, computed, makeObservable, observable } from 'mobx';\nimport { PresenceChannel } from 'pusher-js';\nimport { sortBy } from '../utils';\nimport { PusherStore } from './pusher.store';\n\ninterface MemberInfo {\n EnteredDate: number;\n Name: string;\n IsFromAdmin: boolean;\n}\ninterface Member {\n id: string;\n info: MemberInfo;\n}\n\n@injectable()\nexport class PresenceStore {\n @observable private instance?: PresenceChannel;\n\n constructor(@inject(PusherStore) private pusherStore: PusherStore) {\n makeObservable(this);\n }\n\n @action\n initialize = async (channelName: string) => {\n const presenceChannelName = this.pusherStore.combinePresenceChannelName(channelName);\n this.instance = this.pusherStore.pusher.subscribe(presenceChannelName) as PresenceChannel;\n return new Promise<void>((resolve, reject) => {\n this.channel.bind('pusher:subscription_succeeded', resolve);\n this.channel.bind('pusher:subscription_error', reject);\n });\n };\n\n @action\n dispose = () => {\n this.pusherStore.pusher.unsubscribe(this.channel.name);\n this.instance = undefined;\n };\n\n @computed\n get first() {\n return this.users[0];\n }\n\n @computed\n get amIFirst() {\n return this.first?.id === this.me?.id;\n }\n\n @computed\n private get channel() {\n if (!this.instance) {\n throw new Error('Presence channel is not initialized');\n }\n return this.instance;\n }\n\n @computed\n get allMembers() {\n const result: Member[] = [];\n for (const id in this.channel.members.members) {\n result.push(this.channel.members.get(id));\n }\n return result;\n }\n\n @computed\n get users() {\n return this.allMembers\n .filter(({ info: { IsFromAdmin } }) => !IsFromAdmin)\n .sort(sortBy(member => member.info.EnteredDate));\n }\n\n @computed\n private get me() {\n return this.channel.members.me as Member;\n }\n\n @computed\n get lastUser() {\n return this.users[this.users.length - 1]?.info?.Name ?? '-';\n }\n}\n"],"names":["inject","injectable","action","computed","makeObservable","observable","PresenceChannel","sortBy","PusherStore","PresenceStore","first","users","amIFirst","id","me","channel","instance","Error","allMembers","result","members","push","get","filter","info","IsFromAdmin","sort","member","EnteredDate","lastUser","length","Name","pusherStore","initialize","dispose","channelName","presenceChannelName","combinePresenceChannelName","pusher","subscribe","Promise","resolve","reject","bind","unsubscribe","name","undefined"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,MAAM,EAAEC,UAAU,QAAQ,0BAA0B;AAC7D,SAASC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,UAAU,QAAQ,OAAO;AACpE,SAASC,eAAe,QAAQ,YAAY;AAC5C,SAASC,MAAM,QAAQ,WAAW;AAClC,SAASC,WAAW,QAAQ,iBAAiB;AAa7C,OAAO,MAAMC;IAuBT,IACIC,QAAQ;QACR,OAAO,IAAI,CAACC,KAAK,CAAC,EAAE;IACxB;IAEA,IACIC,WAAW;YACJ,aAAmB;QAA1B,OAAO,EAAA,cAAA,IAAI,CAACF,KAAK,cAAV,kCAAA,YAAYG,EAAE,QAAK,WAAA,IAAI,CAACC,EAAE,cAAP,+BAAA,SAASD,EAAE;IACzC;IAEA,IACYE,UAAU;QAClB,IAAI,CAAC,IAAI,CAACC,QAAQ,EAAE;YAChB,MAAM,IAAIC,MAAM;QACpB;QACA,OAAO,IAAI,CAACD,QAAQ;IACxB;IAEA,IACIE,aAAa;QACb,MAAMC,SAAmB,EAAE;QAC3B,IAAK,MAAMN,MAAM,IAAI,CAACE,OAAO,CAACK,OAAO,CAACA,OAAO,CAAE;YAC3CD,OAAOE,IAAI,CAAC,IAAI,CAACN,OAAO,CAACK,OAAO,CAACE,GAAG,CAACT;QACzC;QACA,OAAOM;IACX;IAEA,IACIR,QAAQ;QACR,OAAO,IAAI,CAACO,UAAU,CACjBK,MAAM,CAAC,CAAC,EAAEC,MAAM,EAAEC,WAAW,EAAE,EAAE,GAAK,CAACA,aACvCC,IAAI,CAACnB,OAAOoB,CAAAA,SAAUA,OAAOH,IAAI,CAACI,WAAW;IACtD;IAEA,IACYd,KAAK;QACb,OAAO,IAAI,CAACC,OAAO,CAACK,OAAO,CAACN,EAAE;IAClC;IAEA,IACIe,WAAW
|
|
1
|
+
{"version":3,"sources":["../../src/pusher/presence.store.ts"],"sourcesContent":["import { inject, injectable } from '@servicetitan/react-ioc';\nimport { action, computed, makeObservable, observable } from 'mobx';\nimport { PresenceChannel } from 'pusher-js';\nimport { sortBy } from '../utils';\nimport { PusherStore } from './pusher.store';\n\ninterface MemberInfo {\n EnteredDate: number;\n Name: string;\n IsFromAdmin: boolean;\n}\ninterface Member {\n id: string;\n info: MemberInfo;\n}\n\n@injectable()\nexport class PresenceStore {\n @observable private instance?: PresenceChannel;\n\n constructor(@inject(PusherStore) private pusherStore: PusherStore) {\n makeObservable(this);\n }\n\n @action\n initialize = async (channelName: string) => {\n const presenceChannelName = this.pusherStore.combinePresenceChannelName(channelName);\n this.instance = this.pusherStore.pusher.subscribe(presenceChannelName) as PresenceChannel;\n return new Promise<void>((resolve, reject) => {\n this.channel.bind('pusher:subscription_succeeded', resolve);\n this.channel.bind('pusher:subscription_error', reject);\n });\n };\n\n @action\n dispose = () => {\n this.pusherStore.pusher.unsubscribe(this.channel.name);\n this.instance = undefined;\n };\n\n @computed\n get first() {\n return this.users[0];\n }\n\n @computed\n get amIFirst() {\n return this.first?.id === this.me?.id;\n }\n\n @computed\n private get channel() {\n if (!this.instance) {\n throw new Error('Presence channel is not initialized');\n }\n return this.instance;\n }\n\n @computed\n get allMembers() {\n const result: Member[] = [];\n for (const id in this.channel.members.members) {\n result.push(this.channel.members.get(id));\n }\n return result;\n }\n\n @computed\n get users() {\n return this.allMembers\n .filter(({ info: { IsFromAdmin } }) => !IsFromAdmin)\n .sort(sortBy(member => member.info.EnteredDate));\n }\n\n @computed\n private get me() {\n return this.channel.members.me as Member;\n }\n\n @computed\n get lastUser() {\n return this.users[this.users.length - 1]?.info?.Name ?? '-';\n }\n}\n"],"names":["inject","injectable","action","computed","makeObservable","observable","PresenceChannel","sortBy","PusherStore","PresenceStore","first","users","amIFirst","id","me","channel","instance","Error","allMembers","result","members","push","get","filter","info","IsFromAdmin","sort","member","EnteredDate","lastUser","length","Name","pusherStore","initialize","dispose","channelName","presenceChannelName","combinePresenceChannelName","pusher","subscribe","Promise","resolve","reject","bind","unsubscribe","name","undefined"],"mappings":";;;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EAAE,cAAjC,oCAAA,oBAAA,aAAmCN,IAAI,cAAvC,wCAAA,kBAAyCO,IAAI,uCAAI;IAC5D;IA9DA,YAAY,AAA6BC,WAAwB,CAAE;;QAFnE,uBAAoBhB,YAApB,KAAA;QAMA,uBACAiB,cADA,KAAA;QAUA,uBACAC,WADA,KAAA;aAdyCF,cAAAA;aAKzCC,aAAa,OAAOE;YAChB,MAAMC,sBAAsB,IAAI,CAACJ,WAAW,CAACK,0BAA0B,CAACF;YACxE,IAAI,CAACnB,QAAQ,GAAG,IAAI,CAACgB,WAAW,CAACM,MAAM,CAACC,SAAS,CAACH;YAClD,OAAO,IAAII,QAAc,CAACC,SAASC;gBAC/B,IAAI,CAAC3B,OAAO,CAAC4B,IAAI,CAAC,iCAAiCF;gBACnD,IAAI,CAAC1B,OAAO,CAAC4B,IAAI,CAAC,6BAA6BD;YACnD;QACJ;aAGAR,UAAU;YACN,IAAI,CAACF,WAAW,CAACM,MAAM,CAACM,WAAW,CAAC,IAAI,CAAC7B,OAAO,CAAC8B,IAAI;YACrD,IAAI,CAAC7B,QAAQ,GAAG8B;QACpB;QAjBI1C,eAAe,IAAI;IACvB;AA6DJ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/pusher/pusher.store.ts"],"sourcesContent":["import { injectable } from '@servicetitan/react-ioc';\nimport { action, computed, makeObservable, observable } from 'mobx';\nimport Pusher, { Channel } from 'pusher-js';\n\nexport interface PusherConfig {\n authEndpoint: string;\n tenantId: string;\n pusherNamespace: string;\n globalPusherChannelName?: string;\n appKey?: string;\n}\nconst APP_KEY = '59831c16dcf080351f5b';\n\n@injectable()\nexport class PusherStore {\n @observable private instance?: Pusher;\n @observable private config?: PusherConfig;\n\n constructor() {\n makeObservable(this);\n }\n\n @action\n initialize = (config: PusherConfig) => {\n this.instance = new Pusher(config.appKey ?? APP_KEY, {\n authEndpoint: config.authEndpoint,\n cluster: 'mt1',\n });\n this.config = config;\n this.pusher.subscribe(this.combineChannelName('global'));\n };\n\n @action\n findChannel = (channelName: string): Channel | undefined => {\n return this.pusher.channels.find(this.combineChannelName(channelName));\n };\n\n @action\n combineChannelName = (channelName: string) =>\n `private-${this.combineChannelSuffix(channelName)}`;\n\n @action\n combinePresenceChannelName = (channelName: string) =>\n `presence-${this.combineChannelSuffix(channelName)}`;\n\n @action\n dispose = () => {\n this.instance?.disconnect();\n this.instance = undefined;\n };\n\n private combineChannelSuffix = (channelName: string) =>\n `${this.config?.pusherNamespace}-${channelName}-${this.config?.tenantId}`;\n\n @computed\n get pusher() {\n if (!this.instance) {\n throw new Error('Pusher instance is not initialized');\n }\n return this.instance;\n }\n}\n"],"names":["injectable","action","computed","makeObservable","observable","Pusher","APP_KEY","PusherStore","pusher","instance","Error","config","initialize","appKey","authEndpoint","cluster","subscribe","combineChannelName","findChannel","channelName","channels","find","combineChannelSuffix","combinePresenceChannelName","dispose","disconnect","undefined","pusherNamespace","tenantId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,UAAU,QAAQ,OAAO;AACpE,OAAOC,YAAyB,YAAY;AAS5C,MAAMC,UAAU;AAGhB,OAAO,MAAMC;IAwCT,IACIC,SAAS;QACT,IAAI,CAAC,IAAI,CAACC,QAAQ,EAAE;YAChB,MAAM,IAAIC,MAAM;QACpB;QACA,OAAO,IAAI,CAACD,QAAQ;IACxB;IA1CA,aAAc;QAHd,uBAAoBA,YAApB,KAAA;QACA,uBAAoBE,UAApB,KAAA;QAMA,uBACAC,cAAa,CAACD;gBACiBA;YAA3B,IAAI,CAACF,QAAQ,GAAG,IAAIJ,
|
|
1
|
+
{"version":3,"sources":["../../src/pusher/pusher.store.ts"],"sourcesContent":["import { injectable } from '@servicetitan/react-ioc';\nimport { action, computed, makeObservable, observable } from 'mobx';\nimport Pusher, { Channel } from 'pusher-js';\n\nexport interface PusherConfig {\n authEndpoint: string;\n tenantId: string;\n pusherNamespace: string;\n globalPusherChannelName?: string;\n appKey?: string;\n}\nconst APP_KEY = '59831c16dcf080351f5b';\n\n@injectable()\nexport class PusherStore {\n @observable private instance?: Pusher;\n @observable private config?: PusherConfig;\n\n constructor() {\n makeObservable(this);\n }\n\n @action\n initialize = (config: PusherConfig) => {\n this.instance = new Pusher(config.appKey ?? APP_KEY, {\n authEndpoint: config.authEndpoint,\n cluster: 'mt1',\n });\n this.config = config;\n this.pusher.subscribe(this.combineChannelName('global'));\n };\n\n @action\n findChannel = (channelName: string): Channel | undefined => {\n return this.pusher.channels.find(this.combineChannelName(channelName));\n };\n\n @action\n combineChannelName = (channelName: string) =>\n `private-${this.combineChannelSuffix(channelName)}`;\n\n @action\n combinePresenceChannelName = (channelName: string) =>\n `presence-${this.combineChannelSuffix(channelName)}`;\n\n @action\n dispose = () => {\n this.instance?.disconnect();\n this.instance = undefined;\n };\n\n private combineChannelSuffix = (channelName: string) =>\n `${this.config?.pusherNamespace}-${channelName}-${this.config?.tenantId}`;\n\n @computed\n get pusher() {\n if (!this.instance) {\n throw new Error('Pusher instance is not initialized');\n }\n return this.instance;\n }\n}\n"],"names":["injectable","action","computed","makeObservable","observable","Pusher","APP_KEY","PusherStore","pusher","instance","Error","config","initialize","appKey","authEndpoint","cluster","subscribe","combineChannelName","findChannel","channelName","channels","find","combineChannelSuffix","combinePresenceChannelName","dispose","disconnect","undefined","pusherNamespace","tenantId"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,SAASA,UAAU,QAAQ,0BAA0B;AACrD,SAASC,MAAM,EAAEC,QAAQ,EAAEC,cAAc,EAAEC,UAAU,QAAQ,OAAO;AACpE,OAAOC,YAAyB,YAAY;AAS5C,MAAMC,UAAU;AAGhB,OAAO,MAAMC;IAwCT,IACIC,SAAS;QACT,IAAI,CAAC,IAAI,CAACC,QAAQ,EAAE;YAChB,MAAM,IAAIC,MAAM;QACpB;QACA,OAAO,IAAI,CAACD,QAAQ;IACxB;IA1CA,aAAc;QAHd,uBAAoBA,YAApB,KAAA;QACA,uBAAoBE,UAApB,KAAA;QAMA,uBACAC,cAAa,CAACD;gBACiBA;YAA3B,IAAI,CAACF,QAAQ,GAAG,IAAIJ,QAAOM,iBAAAA,OAAOE,MAAM,cAAbF,4BAAAA,iBAAiBL,SAAS;gBACjDQ,cAAcH,OAAOG,YAAY;gBACjCC,SAAS;YACb;YACA,IAAI,CAACJ,MAAM,GAAGA;YACd,IAAI,CAACH,MAAM,CAACQ,SAAS,CAAC,IAAI,CAACC,kBAAkB,CAAC;QAClD;QAEA,uBACAC,eAAc,CAACC;YACX,OAAO,IAAI,CAACX,MAAM,CAACY,QAAQ,CAACC,IAAI,CAAC,IAAI,CAACJ,kBAAkB,CAACE;QAC7D;QAEA,uBACAF,sBAAqB,CAACE,cAClB,CAAC,QAAQ,EAAE,IAAI,CAACG,oBAAoB,CAACH,cAAc;QAEvD,uBACAI,8BAA6B,CAACJ,cAC1B,CAAC,SAAS,EAAE,IAAI,CAACG,oBAAoB,CAACH,cAAc;QAExD,uBACAK,WAAU;gBACN;aAAA,iBAAA,IAAI,CAACf,QAAQ,cAAb,qCAAA,eAAegB,UAAU;YACzB,IAAI,CAAChB,QAAQ,GAAGiB;QACpB;QAEA,uBAAQJ,wBAAuB,CAACH;gBACzB,cAA+C;mBAAlD,IAAG,eAAA,IAAI,CAACR,MAAM,cAAX,mCAAA,aAAagB,eAAe,CAAC,CAAC,EAAER,YAAY,CAAC,GAAE,gBAAA,IAAI,CAACR,MAAM,cAAX,oCAAA,cAAaiB,QAAQ,EAAE;;QAjCzEzB,eAAe,IAAI;IACvB;AAyCJ"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/onboarding-ui",
|
|
3
|
-
"version": "16.
|
|
3
|
+
"version": "16.2.0",
|
|
4
4
|
"description": "Shared components between servicetitan monolith and Onboarding",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -30,12 +30,12 @@
|
|
|
30
30
|
"resumablejs": "~1.0.2"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
|
-
"@servicetitan/confirm": "^38.
|
|
34
|
-
"@servicetitan/culture": "^38.
|
|
35
|
-
"@servicetitan/data-query": "^38.
|
|
33
|
+
"@servicetitan/confirm": "^38.2.0",
|
|
34
|
+
"@servicetitan/culture": "^38.2.0",
|
|
35
|
+
"@servicetitan/data-query": "^38.2.0",
|
|
36
36
|
"@servicetitan/design-system": "~14.5.1",
|
|
37
|
-
"@servicetitan/form": "^38.
|
|
38
|
-
"@servicetitan/react-ioc": "^
|
|
37
|
+
"@servicetitan/form": "^38.2.0",
|
|
38
|
+
"@servicetitan/react-ioc": "^34.0.1",
|
|
39
39
|
"@types/contentful-resolve-response": "^0.1.31",
|
|
40
40
|
"@types/react": "~18.2.55",
|
|
41
41
|
"@types/react-input-mask": "~2.0.5",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"@contentful/rich-text-react-renderer": "^15.6.2",
|
|
51
51
|
"@contentful/rich-text-types": "^15.7.0",
|
|
52
52
|
"@servicetitan/contentful-proxy": "^1.1.11",
|
|
53
|
-
"@servicetitan/react-hooks": "^7.
|
|
53
|
+
"@servicetitan/react-hooks": "^7.2.0",
|
|
54
54
|
"@types/google.maps": "^3.45.6",
|
|
55
55
|
"classnames": "^2.3.1",
|
|
56
56
|
"contentful-resolve-response": "^1.3.0",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"less": true,
|
|
70
70
|
"webpack": false
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "b013c9f39c05c44f888a5bca5ff6aadb89cd7a6f"
|
|
73
73
|
}
|