@servicetitan/onboarding-ui 1.13.1 → 1.16.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/company-profile/components/company-profile-form.d.ts.map +1 -1
- package/dist/company-profile/components/company-profile-form.js +10 -7
- package/dist/company-profile/components/company-profile-form.js.map +1 -1
- package/dist/company-profile/components/country-dropdown-input.d.ts.map +1 -1
- package/dist/company-profile/components/country-dropdown-input.js +2 -4
- package/dist/company-profile/components/country-dropdown-input.js.map +1 -1
- package/dist/company-profile/stores/company-profile-form.store.d.ts.map +1 -1
- package/dist/company-profile/stores/company-profile-form.store.js +6 -1
- package/dist/company-profile/stores/company-profile-form.store.js.map +1 -1
- package/package.json +3 -4
- package/src/company-profile/components/company-profile-form.tsx +25 -11
- package/src/company-profile/components/country-dropdown-input.tsx +2 -4
- package/src/company-profile/stores/company-profile-form.store.ts +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.d.ts","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":";AAUA,eAAO,MAAM,kBAAkB,UAAoB;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,
|
|
1
|
+
{"version":3,"file":"company-profile-form.d.ts","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":";AAUA,eAAO,MAAM,kBAAkB,UAAoB;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,gBA2IvE,CAAC"}
|
|
@@ -14,25 +14,28 @@ const state_and_province_dropdown_input_1 = require("./state-and-province-dropdo
|
|
|
14
14
|
const company_profile_form_store_1 = require("../stores/company-profile-form.store");
|
|
15
15
|
const form_1 = require("@servicetitan/form");
|
|
16
16
|
exports.CompanyProfileForm = (0, mobx_react_1.observer)((props) => {
|
|
17
|
-
const [
|
|
18
|
-
const { form, showFormError, zipCodeMask, einOrBnMask, einOrBnInputProps } = store;
|
|
17
|
+
const [{ form, showFormError, zipCodeMask, einOrBnMask, einOrBnInputProps, countries, countryAndRegionData, regionToCodeMap, phoneMask, },] = (0, react_ioc_1.useDependencies)(company_profile_form_store_1.CompanyProfileFormStore);
|
|
19
18
|
const zipCodeOnChangeHandler = (zip) => {
|
|
20
19
|
form.$.companyZipCode.onChange(zip);
|
|
21
20
|
};
|
|
22
21
|
const einOrBnOnChangeHandler = (einOrBn) => {
|
|
23
|
-
form.$.einOrBn.onChange(einOrBn);
|
|
22
|
+
form.$.einOrBn.onChange((einOrBn || '').replace(/[^0-9.]/g, ''));
|
|
24
23
|
};
|
|
25
24
|
const phoneOnChangeHandler = (phone) => {
|
|
26
|
-
form.$.adminPhone.onChange(phone);
|
|
25
|
+
form.$.adminPhone.onChange((phone || '').replace(/[^0-9.]/g, ''));
|
|
27
26
|
};
|
|
28
27
|
const countryOnChangeHandler = (event, data) => {
|
|
29
|
-
if (form.$.companyCountry
|
|
28
|
+
if (form.$.companyCountry.value && data.value !== form.$.companyCountry.value) {
|
|
30
29
|
form.$.companyStateCode.onChange('');
|
|
31
30
|
}
|
|
32
31
|
form.$.companyCountry.onChangeHandler(event, data);
|
|
33
32
|
};
|
|
34
|
-
const { companyName, companyStreetAddress, companyCity, companyCountry, companyStateCode, companyZipCode, adminPhone, einOrBn, } =
|
|
33
|
+
const { companyName, companyStreetAddress, companyCity, companyCountry, companyStateCode, companyZipCode, adminPhone, einOrBn, } = form.$;
|
|
35
34
|
const zipCodeHasError = companyZipCode.hasError;
|
|
36
|
-
return ((0, jsx_runtime_1.jsxs)(design_system_1.Form, Object.assign({ size: "tiny", className: (0, classnames_1.default)(props.className, 'ta-left', 'p-x-6') }, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Form.Input, { label: "Company Name", placeholder: "Company Name", value: companyName.value, onChange: companyName.onChangeHandler, error: (companyName.dirty || showFormError) && companyName.hasError }, void 0), (0, jsx_runtime_1.jsx)(design_system_1.Form.Input, { label: "Street Address", placeholder: "Street Address", value: companyStreetAddress.value, onChange: companyStreetAddress.onChangeHandler, error: (companyStreetAddress.dirty || showFormError) && companyStreetAddress.hasError }, void 0), (0, jsx_runtime_1.jsxs)(design_system_1.Form.Group, Object.assign({ width: "equal" }, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Form.Input, { fluid: true, label: "City", placeholder: "City", className: "p-r-0", width: "6", value: companyCity.value, onChange: companyCity.onChangeHandler, error: (companyCity.dirty || showFormError) && companyCity.hasError }, void 0), (0, jsx_runtime_1.jsx)(state_and_province_dropdown_input_1.StateAndProvinceDropdownInput, { width: "6", countryCode: companyCountry.value || 'USA', fieldState: companyStateCode, error: (companyStateCode.dirty || showFormError) && companyStateCode.hasError, countryAndRegionData:
|
|
35
|
+
return ((0, jsx_runtime_1.jsxs)(design_system_1.Form, Object.assign({ size: "tiny", className: (0, classnames_1.default)(props.className, 'ta-left', 'p-x-6') }, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Form.Input, { label: "Company Name", placeholder: "Company Name", value: companyName.value, onChange: companyName.onChangeHandler, error: (companyName.dirty || showFormError) && companyName.hasError }, void 0), (0, jsx_runtime_1.jsx)(design_system_1.Form.Input, { label: "Street Address", placeholder: "Street Address", value: companyStreetAddress.value, onChange: companyStreetAddress.onChangeHandler, error: (companyStreetAddress.dirty || showFormError) && companyStreetAddress.hasError }, void 0), (0, jsx_runtime_1.jsxs)(design_system_1.Form.Group, Object.assign({ width: "equal" }, { children: [(0, jsx_runtime_1.jsx)(design_system_1.Form.Input, { fluid: true, label: "City", placeholder: "City", className: "p-r-0", width: "6", value: companyCity.value, onChange: companyCity.onChangeHandler, error: (companyCity.dirty || showFormError) && companyCity.hasError }, void 0), (0, jsx_runtime_1.jsx)(state_and_province_dropdown_input_1.StateAndProvinceDropdownInput, { width: "6", countryCode: companyCountry.value || 'USA', fieldState: companyStateCode, error: (companyStateCode.dirty || showFormError) && companyStateCode.hasError, countryAndRegionData: countryAndRegionData, regionNameToCodeMap: regionToCodeMap }, void 0)] }), void 0), (0, jsx_runtime_1.jsxs)(design_system_1.Form.Group, Object.assign({ width: "equal" }, { children: [(0, jsx_runtime_1.jsx)(form_1.MaskedInput, { fluid: true, label: "ZIP Code", placeholder: "ZIP Code", value: companyZipCode.value, onChange: zipCodeOnChangeHandler, mask: zipCodeMask, className: "p-r-0", maskChar: " ", error: (companyZipCode.dirty || showFormError) && zipCodeHasError, width: 6 }, void 0), (0, jsx_runtime_1.jsx)(country_dropdown_input_1.CountryDropdownInput, { width: "6", value: companyCountry.value, onChange: countryOnChangeHandler, error: (companyCountry.dirty || showFormError) && companyCountry.hasError, options: countries.map(x => ({
|
|
36
|
+
key: x,
|
|
37
|
+
value: x,
|
|
38
|
+
text: x === 'USA' ? 'United States' : x,
|
|
39
|
+
})) }, void 0)] }), void 0), (0, jsx_runtime_1.jsxs)(design_system_1.Form.Group, Object.assign({ width: "equal" }, { children: [(0, jsx_runtime_1.jsx)(form_1.MaskedInput, { fluid: true, label: "Phone Number", placeholder: "Phone Number", value: adminPhone.value, onChange: phoneOnChangeHandler, error: (adminPhone.dirty || showFormError) && adminPhone.hasError, mask: phoneMask, width: 6 }, void 0), (0, jsx_runtime_1.jsx)(form_1.MaskedInput, { fluid: true, label: einOrBnInputProps.label, placeholder: einOrBnInputProps.placeholder, value: einOrBn.value, onChange: einOrBnOnChangeHandler, mask: einOrBnMask, className: "p-r-0", maskChar: " ", error: (einOrBn.dirty || showFormError) && einOrBn.hasError, width: 6 }, void 0)] }), void 0)] }), void 0));
|
|
37
40
|
});
|
|
38
41
|
//# sourceMappingURL=company-profile-form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.js","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":";;;;;;;AACA,+DAAsE;AACtE,4DAAoC;AACpC,qEAAgE;AAChE,2CAAsC;AACtC,uDAA0D;AAC1D,2FAAoF;AACpF,qFAA+E;AAC/E,6CAAiD;AAEpC,QAAA,kBAAkB,GAAG,IAAA,qBAAQ,EAAC,CAAC,KAA6B,EAAE,EAAE;IACzE,MAAM,
|
|
1
|
+
{"version":3,"file":"company-profile-form.js","sourceRoot":"","sources":["../../../src/company-profile/components/company-profile-form.tsx"],"names":[],"mappings":";;;;;;;AACA,+DAAsE;AACtE,4DAAoC;AACpC,qEAAgE;AAChE,2CAAsC;AACtC,uDAA0D;AAC1D,2FAAoF;AACpF,qFAA+E;AAC/E,6CAAiD;AAEpC,QAAA,kBAAkB,GAAG,IAAA,qBAAQ,EAAC,CAAC,KAA6B,EAAE,EAAE;IACzE,MAAM,CACF,EACI,IAAI,EACJ,aAAa,EACb,WAAW,EACX,WAAW,EACX,iBAAiB,EACjB,SAAS,EACT,oBAAoB,EACpB,eAAe,EACf,SAAS,GACZ,EACJ,GAAG,IAAA,2BAAe,EAAC,oDAAuB,CAAC,CAAC;IAE7C,MAAM,sBAAsB,GAAG,CAAC,GAAW,EAAE,EAAE;QAC3C,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC,CAAC;IAEF,MAAM,sBAAsB,GAAG,CAAC,OAAe,EAAE,EAAE;QAC/C,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,OAAO,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;IACrE,CAAC,CAAC;IAEF,MAAM,oBAAoB,GAAG,CAAC,KAAa,EAAE,EAAE;QAC3C,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,KAAK,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,CAAC;IACtE,CAAC,CAAC;IAEF,MAAM,sBAAsB,GAAG,CAC3B,KAAkC,EAClC,IAAuB,EACzB,EAAE;QACA,IAAI,IAAI,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,IAAI,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AAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,CAAC;yBAC1C,CAAC,CAAC,WACL,aACO,EACb,wBAAC,oBAAI,CAAC,KAAK,kBAAC,KAAK,EAAC,OAAO,iBACrB,uBAAC,kBAAW,IACR,KAAK,QACL,KAAK,EAAC,cAAc,EACpB,WAAW,EAAC,cAAc,EAC1B,KAAK,EAAE,UAAU,CAAC,KAAK,EACvB,QAAQ,EAAE,oBAAoB,EAC9B,KAAK,EAAE,CAAC,UAAU,CAAC,KAAK,IAAI,aAAa,CAAC,IAAI,UAAU,CAAC,QAAQ,EACjE,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,CAAC,WACV,EACF,uBAAC,kBAAW,IACR,KAAK,QACL,KAAK,EAAE,iBAAiB,CAAC,KAAK,EAC9B,WAAW,EAAE,iBAAiB,CAAC,WAAW,EAC1C,KAAK,EAAE,OAAO,CAAC,KAAK,EACpB,QAAQ,EAAE,sBAAsB,EAChC,IAAI,EAAE,WAAW,EACjB,SAAS,EAAC,OAAO,EACjB,QAAQ,EAAC,GAAG,EACZ,KAAK,EAAE,CAAC,OAAO,CAAC,KAAK,IAAI,aAAa,CAAC,IAAI,OAAO,CAAC,QAAQ,EAC3D,KAAK,EAAE,CAAC,WACV,aACO,aACV,CACV,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country-dropdown-input.d.ts","sourceRoot":"","sources":["../../../src/company-profile/components/country-dropdown-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAQ,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEtF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC5D,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,eAAO,MAAM,oBAAoB,UAAoB,qBAAqB,
|
|
1
|
+
{"version":3,"file":"country-dropdown-input.d.ts","sourceRoot":"","sources":["../../../src/company-profile/components/country-dropdown-input.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAQ,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAEtF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAE5C,MAAM,WAAW,qBAAsB,SAAQ,iBAAiB;IAC5D,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;IAC1B,KAAK,CAAC,EAAE,cAAc,CAAC;CAC1B;AAED,eAAO,MAAM,oBAAoB,UAAoB,qBAAqB,gBAaxE,CAAC"}
|
|
@@ -16,9 +16,7 @@ const jsx_runtime_1 = require("react/jsx-runtime");
|
|
|
16
16
|
const design_system_1 = require("@servicetitan/design-system");
|
|
17
17
|
const mobx_react_1 = require("mobx-react");
|
|
18
18
|
exports.CountryDropdownInput = (0, mobx_react_1.observer)((props) => {
|
|
19
|
-
const { value
|
|
20
|
-
|
|
21
|
-
const country = value && (value === 'canada' || value === 'ca' ? 'Canada' : 'USA');
|
|
22
|
-
return ((0, jsx_runtime_1.jsx)(design_system_1.Form.Select, Object.assign({ fluid: true, search: true, width: width !== null && width !== void 0 ? width : '12', label: "Country", placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Country', value: country }, rest), void 0));
|
|
19
|
+
const { value, width, placeholder } = props, rest = __rest(props, ["value", "width", "placeholder"]);
|
|
20
|
+
return ((0, jsx_runtime_1.jsx)(design_system_1.Form.Select, Object.assign({ fluid: true, search: true, width: width !== null && width !== void 0 ? width : '12', label: "Country", placeholder: placeholder !== null && placeholder !== void 0 ? placeholder : 'Country', value: value }, rest), void 0));
|
|
23
21
|
});
|
|
24
22
|
//# sourceMappingURL=country-dropdown-input.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"country-dropdown-input.js","sourceRoot":"","sources":["../../../src/company-profile/components/country-dropdown-input.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAsF;AACtF,2CAAsC;AAQzB,QAAA,oBAAoB,GAAG,IAAA,qBAAQ,EAAC,CAAC,KAA4B,EAAE,EAAE;IAC1E,MAAM,EAAE,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"country-dropdown-input.js","sourceRoot":"","sources":["../../../src/company-profile/components/country-dropdown-input.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,+DAAsF;AACtF,2CAAsC;AAQzB,QAAA,oBAAoB,GAAG,IAAA,qBAAQ,EAAC,CAAC,KAA4B,EAAE,EAAE;IAC1E,MAAM,EAAE,KAAK,EAAE,KAAK,EAAE,WAAW,KAAc,KAAK,EAAd,IAAI,UAAK,KAAK,EAA9C,iCAAsC,CAAQ,CAAC;IACrD,OAAO,CACH,uBAAC,oBAAI,CAAC,MAAM,kBACR,KAAK,QACL,MAAM,QACN,KAAK,EAAE,KAAK,aAAL,KAAK,cAAL,KAAK,GAAI,IAAI,EACpB,KAAK,EAAC,SAAS,EACf,WAAW,EAAE,WAAW,aAAX,WAAW,cAAX,WAAW,GAAI,SAAS,EACrC,KAAK,EAAE,KAAK,IACR,IAAI,UACV,CACL,CAAC;AACN,CAAC,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.store.d.ts","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACH,eAAe,EACf,kBAAkB,EAGrB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC7B;A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AAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CACxC;AAED,qBACa,uBAAwB,YAAW,wBAAwB;IACxD,aAAa,UAAS;IACtB,cAAc,UAAS;IACvB,SAAS,EAAE,MAAM,EAAE,CAAM;IACzB,oBAAoB,EAAE,kBAAkB,EAAE,CAAM;IAChD,SAAS,SAAM;IACf,eAAe,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAAa;IAE7D,IAAI,EAAE,SAAS,CAAC,uBAAuB,CAAC,CASrC;;IAsBH,iBAAiB,UAAW,OAAO,UAEjC;IAEF,QAAQ,YAAa,MAAM,aAGzB;IAEF,IACI,WAAW,wBAEd;IAED,IACI,WAAW,+BAEd;IAED,IACI,iBAAiB;;;MAUpB;IAGD,QAAQ,aAAc,YAAY,WAAW,yBAAyB,
|
|
1
|
+
{"version":3,"file":"company-profile-form.store.d.ts","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,EACH,eAAe,EACf,kBAAkB,EAGrB,MAAM,oBAAoB,CAAC;AAO5B,MAAM,WAAW,cAAc;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,kBAAkB;IAC/B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC7B;AAED,MAAM,WAAW,YAAY;IACzB,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,oBAAoB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,cAAc,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,gBAAgB,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,GAA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CAAC,uBAAuB,CAAC,CASrC;;IAsBH,iBAAiB,UAAW,OAAO,UAEjC;IAEF,QAAQ,YAAa,MAAM,aAGzB;IAEF,IACI,WAAW,wBAEd;IAED,IACI,WAAW,+BAEd;IAED,IACI,iBAAiB;;;MAUpB;IAGD,QAAQ,aAAc,YAAY,WAAW,yBAAyB,UAYpE;IAGF,UAAU,aAAoC;CACjD"}
|
|
@@ -95,12 +95,17 @@ let CompanyProfileFormStore = class CompanyProfileFormStore {
|
|
|
95
95
|
configurable: true,
|
|
96
96
|
writable: true,
|
|
97
97
|
value: (formData, options) => {
|
|
98
|
+
var _a;
|
|
98
99
|
this.form.$.adminPhone.validators((0, validators_1.PhoneValidator)(options.phonePattern, false));
|
|
99
100
|
this.countries = options.countries;
|
|
100
101
|
this.countryAndRegionData = options.countryAndRegionData;
|
|
101
102
|
this.phoneMask = options.phoneMask;
|
|
102
103
|
this.regionToCodeMap = options.regionToCodeMap;
|
|
103
|
-
|
|
104
|
+
let companyCountry = formData.companyCountry;
|
|
105
|
+
if (companyCountry && this.countries && !((_a = this.countries) === null || _a === void 0 ? void 0 : _a.includes(companyCountry))) {
|
|
106
|
+
companyCountry = '';
|
|
107
|
+
}
|
|
108
|
+
(0, form_1.setFormStateValues)(this.form, Object.assign(Object.assign({}, formData), { companyCountry }));
|
|
104
109
|
(0, form_1.commitFormState)(this.form);
|
|
105
110
|
}
|
|
106
111
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"company-profile-form.store.js","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAkD;AAClD,6CAK4B;AAC5B,uDAAqD;AACrD,oDAAqD;AACrD,+BAAoE;AAEpE,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,wBAAwB,CAAC;AAuB/F,MAA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AP,OAAO,CAAE,WAAW,EAAE,CAAC;gBAC5C,OAAO,YAAY,KAAK,IAAI,IAAI,YAAY,KAAK,QAAQ,CAAC;YAC9D,CAAC;WAAC;QA0BF;;;;mBAAW,CAAC,QAAsB,EAAE,OAAkC,EAAE,EAAE
|
|
1
|
+
{"version":3,"file":"company-profile-form.store.js","sourceRoot":"","sources":["../../../src/company-profile/stores/company-profile-form.store.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yCAAkD;AAClD,6CAK4B;AAC5B,uDAAqD;AACrD,oDAAqD;AACrD,+BAAoE;AAEpE,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,CAAC,IAAI,wBAAwB,CAAC;AAuB/F,MAAM,SAAS,GAAG,OAAO,CAAC;AAC1B,MAAM,aAAa,GAAG,SAAS,CAAC;AAChC,MAAM,YAAY,GAAG,WAAW,CAAC;AACjC,MAAM,SAAS,GAAG,YAAY,CAAC;AA6B/B,IAAa,uBAAuB,GAApC,MAAa,uBAAuB;IAmBhC;QAlBY;;;;mBAAgB,KAAK;WAAC;QACtB;;;;mBAAiB,KAAK;WAAC;QACvB;;;;mBAAsB,EAAE;WAAC;QACzB;;;;mBAA6C,EAAE;WAAC;QAChD;;;;mBAAY,EAAE;WAAC;QACf;;;;mBAAuC,IAAI,GAAG,EAAE;WAAC;QAE7D;;;;mBAA2C,IAAI,qBAAS,CAAC;gBACrD,WAAW,EAAE,IAAI,sBAAe,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;gBACzD,UAAU,EAAE,IAAI,sBAAe,CAAC,EAAE,CAAC;gBACnC,oBAAoB,EAAE,IAAI,sBAAe,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAClE,cAAc,EAAE,IAAI,yBAAkB,CAAC,EAAE,CAAC,CAAC,UAAU,CAAC,QAAQ,CAAC;gBAC/D,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|
"description": "Shared components between servicetitan monolith and Onboarding",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"dependencies": {
|
|
52
52
|
"@contentful/rich-text-react-renderer": "^15.6.2",
|
|
53
53
|
"@contentful/rich-text-types": "^15.7.0",
|
|
54
|
-
"@servicetitan/react-hooks": "^2.
|
|
54
|
+
"@servicetitan/react-hooks": "^2.6.0",
|
|
55
55
|
"@types/google.maps": "^3.45.6",
|
|
56
56
|
"classnames": "~2.3.1",
|
|
57
57
|
"contentful-resolve-response": "^1.3.0",
|
|
@@ -61,7 +61,6 @@
|
|
|
61
61
|
"companyProfile"
|
|
62
62
|
],
|
|
63
63
|
"author": "Suman Lama",
|
|
64
|
-
"license": "ISC",
|
|
65
64
|
"publishConfig": {
|
|
66
65
|
"access": "public"
|
|
67
66
|
},
|
|
@@ -69,5 +68,5 @@
|
|
|
69
68
|
"less": true,
|
|
70
69
|
"webpack": false
|
|
71
70
|
},
|
|
72
|
-
"gitHead": "
|
|
71
|
+
"gitHead": "c7ad5d5adaf18bf3e67cda4f4d616bd986b63b66"
|
|
73
72
|
}
|
|
@@ -9,27 +9,37 @@ import { CompanyProfileFormStore } from '../stores/company-profile-form.store';
|
|
|
9
9
|
import { MaskedInput } from '@servicetitan/form';
|
|
10
10
|
|
|
11
11
|
export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
12
|
-
const [
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
const [
|
|
13
|
+
{
|
|
14
|
+
form,
|
|
15
|
+
showFormError,
|
|
16
|
+
zipCodeMask,
|
|
17
|
+
einOrBnMask,
|
|
18
|
+
einOrBnInputProps,
|
|
19
|
+
countries,
|
|
20
|
+
countryAndRegionData,
|
|
21
|
+
regionToCodeMap,
|
|
22
|
+
phoneMask,
|
|
23
|
+
},
|
|
24
|
+
] = useDependencies(CompanyProfileFormStore);
|
|
15
25
|
|
|
16
26
|
const zipCodeOnChangeHandler = (zip: string) => {
|
|
17
27
|
form.$.companyZipCode.onChange(zip);
|
|
18
28
|
};
|
|
19
29
|
|
|
20
30
|
const einOrBnOnChangeHandler = (einOrBn: string) => {
|
|
21
|
-
form.$.einOrBn.onChange(einOrBn);
|
|
31
|
+
form.$.einOrBn.onChange((einOrBn || '').replace(/[^0-9.]/g, ''));
|
|
22
32
|
};
|
|
23
33
|
|
|
24
34
|
const phoneOnChangeHandler = (phone: string) => {
|
|
25
|
-
form.$.adminPhone.onChange(phone);
|
|
35
|
+
form.$.adminPhone.onChange((phone || '').replace(/[^0-9.]/g, ''));
|
|
26
36
|
};
|
|
27
37
|
|
|
28
38
|
const countryOnChangeHandler = (
|
|
29
39
|
event: SyntheticEvent<HTMLElement>,
|
|
30
40
|
data: FormDropdownProps
|
|
31
41
|
) => {
|
|
32
|
-
if (form.$.companyCountry
|
|
42
|
+
if (form.$.companyCountry.value && data.value !== form.$.companyCountry.value) {
|
|
33
43
|
form.$.companyStateCode.onChange('');
|
|
34
44
|
}
|
|
35
45
|
form.$.companyCountry.onChangeHandler(event, data);
|
|
@@ -44,7 +54,7 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
44
54
|
companyZipCode,
|
|
45
55
|
adminPhone,
|
|
46
56
|
einOrBn,
|
|
47
|
-
} =
|
|
57
|
+
} = form.$;
|
|
48
58
|
|
|
49
59
|
const zipCodeHasError = companyZipCode.hasError;
|
|
50
60
|
|
|
@@ -82,8 +92,8 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
82
92
|
countryCode={companyCountry.value || 'USA'}
|
|
83
93
|
fieldState={companyStateCode}
|
|
84
94
|
error={(companyStateCode.dirty || showFormError) && companyStateCode.hasError}
|
|
85
|
-
countryAndRegionData={
|
|
86
|
-
regionNameToCodeMap={
|
|
95
|
+
countryAndRegionData={countryAndRegionData}
|
|
96
|
+
regionNameToCodeMap={regionToCodeMap}
|
|
87
97
|
/>
|
|
88
98
|
</Form.Group>
|
|
89
99
|
<Form.Group width="equal">
|
|
@@ -104,7 +114,11 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
104
114
|
value={companyCountry.value}
|
|
105
115
|
onChange={countryOnChangeHandler}
|
|
106
116
|
error={(companyCountry.dirty || showFormError) && companyCountry.hasError}
|
|
107
|
-
options={
|
|
117
|
+
options={countries.map(x => ({
|
|
118
|
+
key: x,
|
|
119
|
+
value: x,
|
|
120
|
+
text: x === 'USA' ? 'United States' : x,
|
|
121
|
+
}))}
|
|
108
122
|
/>
|
|
109
123
|
</Form.Group>
|
|
110
124
|
<Form.Group width="equal">
|
|
@@ -115,7 +129,7 @@ export const CompanyProfileForm = observer((props: { className?: string }) => {
|
|
|
115
129
|
value={adminPhone.value}
|
|
116
130
|
onChange={phoneOnChangeHandler}
|
|
117
131
|
error={(adminPhone.dirty || showFormError) && adminPhone.hasError}
|
|
118
|
-
mask={
|
|
132
|
+
mask={phoneMask}
|
|
119
133
|
width={6}
|
|
120
134
|
/>
|
|
121
135
|
<MaskedInput
|
|
@@ -8,9 +8,7 @@ export interface ICountryDropdownInput extends FormDropdownProps {
|
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export const CountryDropdownInput = observer((props: ICountryDropdownInput) => {
|
|
11
|
-
const { value
|
|
12
|
-
const value = propsValue && propsValue!.toString().toLowerCase();
|
|
13
|
-
const country = value && (value === 'canada' || value === 'ca' ? 'Canada' : 'USA');
|
|
11
|
+
const { value, width, placeholder, ...rest } = props;
|
|
14
12
|
return (
|
|
15
13
|
<Form.Select
|
|
16
14
|
fluid
|
|
@@ -18,7 +16,7 @@ export const CountryDropdownInput = observer((props: ICountryDropdownInput) => {
|
|
|
18
16
|
width={width ?? '12'}
|
|
19
17
|
label="Country"
|
|
20
18
|
placeholder={placeholder ?? 'Country'}
|
|
21
|
-
value={
|
|
19
|
+
value={value}
|
|
22
20
|
{...rest}
|
|
23
21
|
/>
|
|
24
22
|
);
|
|
@@ -142,7 +142,11 @@ export class CompanyProfileFormStore implements ICompanyProfileFormStore {
|
|
|
142
142
|
this.countryAndRegionData = options.countryAndRegionData;
|
|
143
143
|
this.phoneMask = options.phoneMask;
|
|
144
144
|
this.regionToCodeMap = options.regionToCodeMap;
|
|
145
|
-
|
|
145
|
+
let companyCountry = formData.companyCountry;
|
|
146
|
+
if (companyCountry && this.countries && !this.countries?.includes(companyCountry)) {
|
|
147
|
+
companyCountry = '';
|
|
148
|
+
}
|
|
149
|
+
setFormStateValues(this.form, { ...formData, companyCountry });
|
|
146
150
|
commitFormState(this.form);
|
|
147
151
|
};
|
|
148
152
|
|