@servicetitan/onboarding-ui 1.10.0 → 1.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/address-suggestion-popover/components/address-suggestion-popover.d.ts +1 -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/package.json +2 -2
- package/src/address-suggestion-popover/components/address-suggestion-popover.tsx +13 -1
|
@@ -13,6 +13,7 @@ export interface AddressSuggestionResult {
|
|
|
13
13
|
title: string;
|
|
14
14
|
value: AddressModel;
|
|
15
15
|
}
|
|
16
|
+
export declare const countryValues: Map<string, string>;
|
|
16
17
|
export interface AddressSuggestionsProvider {
|
|
17
18
|
getSuggestions(address: AddressModel): Promise<AddressSuggestionResult[] | undefined> | AddressSuggestionResult[] | undefined;
|
|
18
19
|
}
|
|
@@ -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;CACpB;AAED,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,YAAY,CAAC;CACvB;AAED,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,
|
|
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;CACpB;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;AAiBlC,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,MAAM,SAAS,GAAG,GAAS,EAAE;YACzB,IAAI,CAAC,S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@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@servicetitan/onboarding-ui",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.11.0",
|
|
4
4
|
"description": "Shared components between servicetitan monolith and Onboarding",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"less": true,
|
|
70
70
|
"webpack": false
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "8da23d975b0100841c2fa24ef87fbb172562c798"
|
|
73
73
|
}
|
|
@@ -19,6 +19,16 @@ export interface AddressSuggestionResult {
|
|
|
19
19
|
value: AddressModel;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
export const countryValues = new Map([
|
|
23
|
+
['us', 'USA'],
|
|
24
|
+
['can', 'Canada'],
|
|
25
|
+
]);
|
|
26
|
+
|
|
27
|
+
const withVerifiedCountryValue = (address: AddressModel): AddressModel => {
|
|
28
|
+
address.country = countryValues.get(address.country!.toLowerCase()) ?? address.country;
|
|
29
|
+
return address;
|
|
30
|
+
};
|
|
31
|
+
|
|
22
32
|
export interface AddressSuggestionsProvider {
|
|
23
33
|
getSuggestions(
|
|
24
34
|
address: AddressModel
|
|
@@ -85,7 +95,9 @@ export const AddressSuggestionPopover: FC<AddressSuggestionPopoverProps> = obser
|
|
|
85
95
|
fill="subtle"
|
|
86
96
|
className={styles.verifyAddressBtn}
|
|
87
97
|
color="primary"
|
|
88
|
-
onClick={() =>
|
|
98
|
+
onClick={() =>
|
|
99
|
+
onSuggestionSelect(withVerifiedCountryValue(result.value))
|
|
100
|
+
}
|
|
89
101
|
>
|
|
90
102
|
{result.title}
|
|
91
103
|
</Button>
|