@aclymatepackages/modules 2.1.8 → 2.1.10
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.
|
@@ -52,7 +52,8 @@ const CompanySelectionChip = _ref => {
|
|
|
52
52
|
};
|
|
53
53
|
const PdlCompanySelect = _ref2 => {
|
|
54
54
|
let {
|
|
55
|
-
onSelectCompany
|
|
55
|
+
onSelectCompany,
|
|
56
|
+
apiKey
|
|
56
57
|
} = _ref2;
|
|
57
58
|
const [inputValue, setInputValue] = (0, _react.useState)("");
|
|
58
59
|
const [matchingCompanies, setMatchingCompanies] = (0, _react.useState)([]);
|
|
@@ -60,7 +61,7 @@ const PdlCompanySelect = _ref2 => {
|
|
|
60
61
|
const [pdlFetchLoading, setPdlFetchLoading] = (0, _react.useState)(false);
|
|
61
62
|
const [selectedCompanyId, setSelectedCompanyId] = (0, _react.useState)(null);
|
|
62
63
|
const pdlClient = (0, _react.useMemo)(() => new _peopledatalabs.default({
|
|
63
|
-
apiKey
|
|
64
|
+
apiKey
|
|
64
65
|
}), []);
|
|
65
66
|
const fetchMatchingCompanies = async () => {
|
|
66
67
|
setPdlFetchLoading(true);
|
|
@@ -85,6 +86,14 @@ const PdlCompanySelect = _ref2 => {
|
|
|
85
86
|
setMatchingCompanies(capitalizedCompanies);
|
|
86
87
|
return setInputComplete(true);
|
|
87
88
|
};
|
|
89
|
+
const {
|
|
90
|
+
name: selectedCompanyName
|
|
91
|
+
} = matchingCompanies.find(_ref4 => {
|
|
92
|
+
let {
|
|
93
|
+
id
|
|
94
|
+
} = _ref4;
|
|
95
|
+
return selectedCompanyId === id;
|
|
96
|
+
}) || {};
|
|
88
97
|
return /*#__PURE__*/_react.default.createElement(_material.Grid, {
|
|
89
98
|
container: true,
|
|
90
99
|
spacing: 2,
|
|
@@ -96,10 +105,10 @@ const PdlCompanySelect = _ref2 => {
|
|
|
96
105
|
label: "Enter your company's name",
|
|
97
106
|
value: inputValue,
|
|
98
107
|
setValue: setInputValue,
|
|
99
|
-
onKeyPress:
|
|
108
|
+
onKeyPress: _ref5 => {
|
|
100
109
|
let {
|
|
101
110
|
key
|
|
102
|
-
} =
|
|
111
|
+
} = _ref5;
|
|
103
112
|
if (key === "Enter") {
|
|
104
113
|
return fetchMatchingCompanies();
|
|
105
114
|
}
|
|
@@ -126,11 +135,11 @@ const PdlCompanySelect = _ref2 => {
|
|
|
126
135
|
container: true,
|
|
127
136
|
spacing: 2,
|
|
128
137
|
justifyContent: "center"
|
|
129
|
-
}, matchingCompanies.map((
|
|
138
|
+
}, matchingCompanies.map((_ref6, idx) => {
|
|
130
139
|
let {
|
|
131
140
|
name,
|
|
132
141
|
meta
|
|
133
|
-
} =
|
|
142
|
+
} = _ref6;
|
|
134
143
|
return /*#__PURE__*/_react.default.createElement(CompanySelectionChip, _extends({
|
|
135
144
|
key: "company-list-item-".concat(idx),
|
|
136
145
|
name: name,
|
|
@@ -147,7 +156,7 @@ const PdlCompanySelect = _ref2 => {
|
|
|
147
156
|
}, selectedCompanyId ? /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
148
157
|
variant: "contained",
|
|
149
158
|
color: "secondary",
|
|
150
|
-
onClick: () => onSelectCompany(selectedCompanyId)
|
|
159
|
+
onClick: () => onSelectCompany(selectedCompanyId, selectedCompanyName)
|
|
151
160
|
}, "Choose this company") : /*#__PURE__*/_react.default.createElement(_material.Button, {
|
|
152
161
|
color: "primary",
|
|
153
162
|
onClick: () => onSelectCompany("none", inputValue)
|
package/package.json
CHANGED
|
@@ -35,7 +35,7 @@ const CompanySelectionChip = ({
|
|
|
35
35
|
</Grid>
|
|
36
36
|
);
|
|
37
37
|
|
|
38
|
-
const PdlCompanySelect = ({ onSelectCompany }) => {
|
|
38
|
+
const PdlCompanySelect = ({ onSelectCompany, apiKey }) => {
|
|
39
39
|
const [inputValue, setInputValue] = useState("");
|
|
40
40
|
const [matchingCompanies, setMatchingCompanies] = useState([]);
|
|
41
41
|
const [inputComplete, setInputComplete] = useState(false);
|
|
@@ -45,7 +45,7 @@ const PdlCompanySelect = ({ onSelectCompany }) => {
|
|
|
45
45
|
const pdlClient = useMemo(
|
|
46
46
|
() =>
|
|
47
47
|
new PDLJS({
|
|
48
|
-
apiKey
|
|
48
|
+
apiKey,
|
|
49
49
|
}),
|
|
50
50
|
[]
|
|
51
51
|
);
|
|
@@ -72,6 +72,9 @@ const PdlCompanySelect = ({ onSelectCompany }) => {
|
|
|
72
72
|
return setInputComplete(true);
|
|
73
73
|
};
|
|
74
74
|
|
|
75
|
+
const { name: selectedCompanyName } =
|
|
76
|
+
matchingCompanies.find(({ id }) => selectedCompanyId === id) || {};
|
|
77
|
+
|
|
75
78
|
return (
|
|
76
79
|
<Grid container spacing={2} direction="column">
|
|
77
80
|
<Grid item>
|
|
@@ -128,7 +131,9 @@ const PdlCompanySelect = ({ onSelectCompany }) => {
|
|
|
128
131
|
<Button
|
|
129
132
|
variant="contained"
|
|
130
133
|
color="secondary"
|
|
131
|
-
onClick={() =>
|
|
134
|
+
onClick={() =>
|
|
135
|
+
onSelectCompany(selectedCompanyId, selectedCompanyName)
|
|
136
|
+
}
|
|
132
137
|
>
|
|
133
138
|
Choose this company
|
|
134
139
|
</Button>
|