@servicetitan/onboarding-ui 1.10.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/address-suggestion-popover/components/address-suggestion-popover.d.ts +4 -0
- package/dist/address-suggestion-popover/components/address-suggestion-popover.d.ts.map +1 -1
- package/dist/address-suggestion-popover/components/address-suggestion-popover.js +11 -2
- package/dist/address-suggestion-popover/components/address-suggestion-popover.js.map +1 -1
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.d.ts +4 -0
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.d.ts.map +1 -1
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.js +3 -0
- package/dist/address-suggestion-popover/utils/google-geocoder-suggestions-provider.js.map +1 -1
- package/package.json +3 -3
- package/src/address-suggestion-popover/components/address-suggestion-popover.tsx +16 -1
- package/src/address-suggestion-popover/utils/google-geocoder-suggestions-provider.ts +3 -0
|
@@ -7,12 +7,16 @@ export interface AddressModel {
|
|
|
7
7
|
state?: string;
|
|
8
8
|
zip?: string;
|
|
9
9
|
country?: string;
|
|
10
|
+
latitude?: number;
|
|
11
|
+
longitude?: number;
|
|
12
|
+
locationType?: string;
|
|
10
13
|
}
|
|
11
14
|
export interface AddressSuggestionResult {
|
|
12
15
|
key: string;
|
|
13
16
|
title: string;
|
|
14
17
|
value: AddressModel;
|
|
15
18
|
}
|
|
19
|
+
export declare const countryValues: Map<string, string>;
|
|
16
20
|
export interface AddressSuggestionsProvider {
|
|
17
21
|
getSuggestions(address: AddressModel): Promise<AddressSuggestionResult[] | undefined> | AddressSuggestionResult[] | undefined;
|
|
18
22
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-suggestion-popover.d.ts","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAA6B,YAAY,EAAW,MAAM,6BAA6B,CAAC;AAI/F,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"address-suggestion-popover.d.ts","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAuB,EAAE,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,EAA6B,YAAY,EAAW,MAAM,6BAA6B,CAAC;AAI/F,MAAM,WAAW,YAAY;IACzB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,YAAY,CAAC;CACvB;AAED,eAAO,MAAM,aAAa,qBAGxB,CAAC;AAOH,MAAM,WAAW,0BAA0B;IACvC,cAAc,CACV,OAAO,EAAE,YAAY,GACtB,OAAO,CAAC,uBAAuB,EAAE,GAAG,SAAS,CAAC,GAAG,uBAAuB,EAAE,GAAG,SAAS,CAAC;CAC7F;AAED,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IAC/D,cAAc,EAAE,YAAY,CAAC;IAC7B,0BAA0B,EAAE,0BAA0B,CAAC;IACvD,kBAAkB,CAAC,UAAU,EAAE,YAAY,GAAG,IAAI,CAAC;CACtD;AAED,eAAO,MAAM,wBAAwB,EAAE,EAAE,CAAC,6BAA6B,CAqEtE,CAAC"}
|
|
@@ -39,13 +39,22 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
39
39
|
return t;
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
exports.AddressSuggestionPopover = void 0;
|
|
42
|
+
exports.AddressSuggestionPopover = exports.countryValues = void 0;
|
|
43
43
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
44
44
|
const react_1 = require("react");
|
|
45
45
|
const react_hooks_1 = require("@servicetitan/react-hooks");
|
|
46
46
|
const design_system_1 = require("@servicetitan/design-system");
|
|
47
47
|
const mobx_react_1 = require("mobx-react");
|
|
48
48
|
const styles = __importStar(require("./styles.module.less"));
|
|
49
|
+
exports.countryValues = new Map([
|
|
50
|
+
['us', 'USA'],
|
|
51
|
+
['can', 'Canada'],
|
|
52
|
+
]);
|
|
53
|
+
const withVerifiedCountryValue = (address) => {
|
|
54
|
+
var _a;
|
|
55
|
+
address.country = (_a = exports.countryValues.get(address.country.toLowerCase())) !== null && _a !== void 0 ? _a : address.country;
|
|
56
|
+
return address;
|
|
57
|
+
};
|
|
49
58
|
exports.AddressSuggestionPopover = (0, mobx_react_1.observer)((_a) => {
|
|
50
59
|
var { portal = true, width = 'm', direction = 'l', padding = 's', currentAddress, addressSuggestionsProvider, onSuggestionSelect } = _a, restProps = __rest(_a, ["portal", "width", "direction", "padding", "currentAddress", "addressSuggestionsProvider", "onSuggestionSelect"]);
|
|
51
60
|
const [isLoading, { setFalse: disableLoading, setTrue: enabledLoading }] = (0, react_hooks_1.useBoolean)(true);
|
|
@@ -68,6 +77,6 @@ exports.AddressSuggestionPopover = (0, mobx_react_1.observer)((_a) => {
|
|
|
68
77
|
bootstrap();
|
|
69
78
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
70
79
|
}, [restProps.open]);
|
|
71
|
-
return ((0, jsx_runtime_1.jsx)(design_system_1.Popover, Object.assign({ portal: portal, width: width, direction: direction, padding: padding }, restProps, { children: isLoading ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "d-f justify-content-center" }, { children: (0, jsx_runtime_1.jsx)(design_system_1.Spinner, { size: "tiny" }, void 0) }), void 0)) : (results === null || results === void 0 ? void 0 : results.length) ? (results.map(result => ((0, jsx_runtime_1.jsx)(design_system_1.Button, Object.assign({ full: true, fill: "subtle", className: styles.verifyAddressBtn, color: "primary", onClick: () => onSuggestionSelect(result.value) }, { children: result.title }), result.key)))) : ((0, jsx_runtime_1.jsx)(design_system_1.BodyText, Object.assign({ className: "c-blue-400 ta-center", bold: true }, { children: "No suggestions" }), void 0)) }), void 0));
|
|
80
|
+
return ((0, jsx_runtime_1.jsx)(design_system_1.Popover, Object.assign({ portal: portal, width: width, direction: direction, padding: padding }, restProps, { children: isLoading ? ((0, jsx_runtime_1.jsx)("div", Object.assign({ className: "d-f justify-content-center" }, { children: (0, jsx_runtime_1.jsx)(design_system_1.Spinner, { size: "tiny" }, void 0) }), void 0)) : (results === null || results === void 0 ? void 0 : results.length) ? (results.map(result => ((0, jsx_runtime_1.jsx)(design_system_1.Button, Object.assign({ full: true, fill: "subtle", className: styles.verifyAddressBtn, color: "primary", onClick: () => onSuggestionSelect(withVerifiedCountryValue(result.value)) }, { children: result.title }), result.key)))) : ((0, jsx_runtime_1.jsx)(design_system_1.BodyText, Object.assign({ className: "c-blue-400 ta-center", bold: true }, { children: "No suggestions" }), void 0)) }), void 0));
|
|
72
81
|
});
|
|
73
82
|
//# sourceMappingURL=address-suggestion-popover.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"address-suggestion-popover.js","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgD;AAChD,2DAAuD;AACvD,+DAA+F;AAC/F,2CAAsC;AACtC,6DAA+C;
|
|
1
|
+
{"version":3,"file":"address-suggestion-popover.js","sourceRoot":"","sources":["../../../src/address-suggestion-popover/components/address-suggestion-popover.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iCAAgD;AAChD,2DAAuD;AACvD,+DAA+F;AAC/F,2CAAsC;AACtC,6DAA+C;AAoBlC,QAAA,aAAa,GAAG,IAAI,GAAG,CAAC;IACjC,CAAC,IAAI,EAAE,KAAK,CAAC;IACb,CAAC,KAAK,EAAE,QAAQ,CAAC;CACpB,CAAC,CAAC;AAEH,MAAM,wBAAwB,GAAG,CAAC,OAAqB,EAAgB,EAAE;;IACrE,OAAO,CAAC,OAAO,GAAG,MAAA,qBAAa,CAAC,GAAG,CAAC,OAAO,CAAC,OAAQ,CAAC,WAAW,EAAE,CAAC,mCAAI,OAAO,CAAC,OAAO,CAAC;IACvF,OAAO,OAAO,CAAC;AACnB,CAAC,CAAC;AAcW,QAAA,wBAAwB,GAAsC,IAAA,qBAAQ,EAC/E,CAAC,EASA,EAAE,EAAE;QATJ,EACG,MAAM,GAAG,IAAI,EACb,KAAK,GAAG,GAAG,EACX,SAAS,GAAG,GAAG,EACf,OAAO,GAAG,GAAG,EACb,cAAc,EACd,0BAA0B,EAC1B,kBAAkB,OAErB,EADM,SAAS,cARf,iHASA,CADe;IAEZ,MAAM,CAAC,SAAS,EAAE,EAAE,QAAQ,EAAE,cAAc,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC,GAAG,IAAA,wBAAU,EAAC,IAAI,CAAC,CAAC;IAC5F,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC,GAAG,IAAA,gBAAQ,EAAwC,SAAS,CAAC,CAAC;IAEzF,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,MAA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;AACN,CAAC,CACJ,CAAC"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="google.maps" />
|
|
1
2
|
import { AddressModel, AddressSuggestionsProvider } from '../components/address-suggestion-popover';
|
|
2
3
|
export declare class GoogleGeocoderSuggestionsProvider implements AddressSuggestionsProvider {
|
|
3
4
|
getSuggestions: (address: AddressModel) => Promise<{
|
|
@@ -10,6 +11,9 @@ export declare class GoogleGeocoderSuggestionsProvider implements AddressSuggest
|
|
|
10
11
|
state: string | undefined;
|
|
11
12
|
zip: string | undefined;
|
|
12
13
|
country: string | undefined;
|
|
14
|
+
latitude: number;
|
|
15
|
+
longitude: number;
|
|
16
|
+
locationType: google.maps.GeocoderLocationType;
|
|
13
17
|
};
|
|
14
18
|
}[] | undefined>;
|
|
15
19
|
private addressToString;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-geocoder-suggestions-provider.d.ts","sourceRoot":"","sources":["../../../src/address-suggestion-popover/utils/google-geocoder-suggestions-provider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAEpG,qBAAa,iCAAkC,YAAW,0BAA0B;IAChF,cAAc,YAAmB,YAAY
|
|
1
|
+
{"version":3,"file":"google-geocoder-suggestions-provider.d.ts","sourceRoot":"","sources":["../../../src/address-suggestion-popover/utils/google-geocoder-suggestions-provider.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,YAAY,EAAE,0BAA0B,EAAE,MAAM,0CAA0C,CAAC;AAEpG,qBAAa,iCAAkC,YAAW,0BAA0B;IAChF,cAAc,YAAmB,YAAY;;;;;;;;;;;;;;qBAa3C;IAEF,OAAO,CAAC,eAAe,CAiBrB;IAEF,OAAO,CAAC,uBAAuB,CAsC7B;IAEF,OAAO,CAAC,yBAAyB,CAO3B;IAEN,OAAO,CAAC,OAAO,CAuBb;CACL"}
|
|
@@ -75,6 +75,9 @@ class GoogleGeocoderSuggestionsProvider {
|
|
|
75
75
|
state: this.getAddressComponentByType(result.address_components, 'administrative_area_level_1'),
|
|
76
76
|
zip: this.getAddressComponentByType(result.address_components, 'postal_code'),
|
|
77
77
|
country: this.getAddressComponentByType(result.address_components, 'country'),
|
|
78
|
+
latitude: result.geometry.location.lat(),
|
|
79
|
+
longitude: result.geometry.location.lng(),
|
|
80
|
+
locationType: result.geometry.location_type,
|
|
78
81
|
},
|
|
79
82
|
};
|
|
80
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"google-geocoder-suggestions-provider.js","sourceRoot":"","sources":["../../../src/address-suggestion-popover/utils/google-geocoder-suggestions-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,iCAAiC;IAA9C;QACI;;;;mBAAiB,CAAO,OAAqB,EAAE,EAAE;gBAC7C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAChB,OAAO;iBACV;gBACD,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;gBACjD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC/D,MAAM,MAAM,GAAG;oBACX,OAAO,EAAE,UAAU;oBACnB,MAAM,EAAE,WAAW;iBACtB,CAAC;gBACF,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC5C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACnD,OAAO,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,uBAAuB,CAAC,CAAC;YACrD,CAAC,CAAA;WAAC;QAEF;;;;mBAA0B,CAAC,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,OAAO,EAAgB,EAAE,EAAE;gBACpF,MAAM,YA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CAAC,WAAW,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS;wBAClE,IAAI,EAAE,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,kBAAkB,EAAE,YAAY,CAAC;wBAC7E,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,kBAAkB,CAAC;wBACvE,KAAK,EAAE,IAAI,CAAC,yBAAyB,CACjC,MAAM,CAAC,kBAAkB,EACzB,6BAA6B,CAChC;wBACD,GAAG,EAAE,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,kBAAkB,EAAE,aAAa,CAAC;wBAC7E,OAAO,EAAE,IAAI,CAAC,yBAAyB,CAAC,MAAM,CAAC,kBAAkB,EAAE,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"google-geocoder-suggestions-provider.js","sourceRoot":"","sources":["../../../src/address-suggestion-popover/utils/google-geocoder-suggestions-provider.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEA,MAAa,iCAAiC;IAA9C;QACI;;;;mBAAiB,CAAO,OAAqB,EAAE,EAAE;gBAC7C,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE;oBAChB,OAAO;iBACV;gBACD,MAAM,UAAU,GAAG,IAAI,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;gBACjD,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;gBAC/D,MAAM,MAAM,GAAG;oBACX,OAAO,EAAE,UAAU;oBACnB,MAAM,EAAE,WAAW;iBACtB,CAAC;gBACF,MAAM,QAAQ,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBAC5C,MAAM,EAAE,OAAO,EAAE,GAAG,MAAM,QAAQ,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBACnD,OAAO,OAAO,CAAC,GAAG,CAA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icetitan/onboarding-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"description": "Shared components between servicetitan monolith and Onboarding",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -38,7 +38,6 @@
|
|
|
38
38
|
"@servicetitan/form": "~14.3.0",
|
|
39
39
|
"@servicetitan/react-ioc": "~14.3.0",
|
|
40
40
|
"@types/contentful-resolve-response": "^0.1.31",
|
|
41
|
-
"@types/google.maps": "^3.45.6",
|
|
42
41
|
"@types/react": "~17.0.15",
|
|
43
42
|
"@types/react-dom": "~17.0.0",
|
|
44
43
|
"axios": "~0.21.1",
|
|
@@ -53,6 +52,7 @@
|
|
|
53
52
|
"@contentful/rich-text-react-renderer": "^15.6.2",
|
|
54
53
|
"@contentful/rich-text-types": "^15.7.0",
|
|
55
54
|
"@servicetitan/react-hooks": "^2.3.0",
|
|
55
|
+
"@types/google.maps": "^3.45.6",
|
|
56
56
|
"classnames": "~2.3.1",
|
|
57
57
|
"contentful-resolve-response": "^1.3.0",
|
|
58
58
|
"query-string": "^7.0.1"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"less": true,
|
|
70
70
|
"webpack": false
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "5f40b19a512d0bb0880a4c17eec6cebf371632d8"
|
|
73
73
|
}
|
|
@@ -11,6 +11,9 @@ export interface AddressModel {
|
|
|
11
11
|
state?: string;
|
|
12
12
|
zip?: string;
|
|
13
13
|
country?: string;
|
|
14
|
+
latitude?: number;
|
|
15
|
+
longitude?: number;
|
|
16
|
+
locationType?: string;
|
|
14
17
|
}
|
|
15
18
|
|
|
16
19
|
export interface AddressSuggestionResult {
|
|
@@ -19,6 +22,16 @@ export interface AddressSuggestionResult {
|
|
|
19
22
|
value: AddressModel;
|
|
20
23
|
}
|
|
21
24
|
|
|
25
|
+
export const countryValues = new Map([
|
|
26
|
+
['us', 'USA'],
|
|
27
|
+
['can', 'Canada'],
|
|
28
|
+
]);
|
|
29
|
+
|
|
30
|
+
const withVerifiedCountryValue = (address: AddressModel): AddressModel => {
|
|
31
|
+
address.country = countryValues.get(address.country!.toLowerCase()) ?? address.country;
|
|
32
|
+
return address;
|
|
33
|
+
};
|
|
34
|
+
|
|
22
35
|
export interface AddressSuggestionsProvider {
|
|
23
36
|
getSuggestions(
|
|
24
37
|
address: AddressModel
|
|
@@ -85,7 +98,9 @@ export const AddressSuggestionPopover: FC<AddressSuggestionPopoverProps> = obser
|
|
|
85
98
|
fill="subtle"
|
|
86
99
|
className={styles.verifyAddressBtn}
|
|
87
100
|
color="primary"
|
|
88
|
-
onClick={() =>
|
|
101
|
+
onClick={() =>
|
|
102
|
+
onSuggestionSelect(withVerifiedCountryValue(result.value))
|
|
103
|
+
}
|
|
89
104
|
>
|
|
90
105
|
{result.title}
|
|
91
106
|
</Button>
|
|
@@ -68,6 +68,9 @@ export class GoogleGeocoderSuggestionsProvider implements AddressSuggestionsProv
|
|
|
68
68
|
),
|
|
69
69
|
zip: this.getAddressComponentByType(result.address_components, 'postal_code'),
|
|
70
70
|
country: this.getAddressComponentByType(result.address_components, 'country'),
|
|
71
|
+
latitude: result.geometry.location.lat(),
|
|
72
|
+
longitude: result.geometry.location.lng(),
|
|
73
|
+
locationType: result.geometry.location_type,
|
|
71
74
|
},
|
|
72
75
|
};
|
|
73
76
|
};
|