@sprucelabs/spruce-people-utils 1.0.13 → 1.0.16
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.
|
@@ -45,21 +45,30 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
45
45
|
}
|
|
46
46
|
populateSuggestions(value) {
|
|
47
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
48
|
+
assertOptions({ organizationId: this.organizationId }, ['organizationId'], `You gotta set an organizationId to your person select input for it to function. Try using 'this.vc.setOrganizationId(...)'!`);
|
|
49
|
+
try {
|
|
50
|
+
const people = yield this.search(value);
|
|
51
|
+
const suggestions = searchPeopleToSuggestions(people, (person) => __awaiter(this, void 0, void 0, function* () { return this.handleClickSuggestion(person); }));
|
|
52
|
+
this.autoCompleteVc.showSuggestions([
|
|
53
|
+
...suggestions,
|
|
54
|
+
{
|
|
55
|
+
id: 'invite',
|
|
56
|
+
label: 'Invite person',
|
|
57
|
+
onClick: this.handleClickInvitePerson.bind(this),
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: 'anonymous',
|
|
61
|
+
label: 'Add anonymously',
|
|
62
|
+
onClick: this.handleClickInviteAnonymous.bind(this),
|
|
63
|
+
},
|
|
64
|
+
]);
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
console.error(err);
|
|
68
|
+
yield this.alert({
|
|
69
|
+
message: `I could not complete your search!! I've let the humans know and they are on it!`,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
63
72
|
});
|
|
64
73
|
}
|
|
65
74
|
handleClickInviteAnonymous() {
|
|
@@ -99,11 +108,10 @@ export default class PersonSelectInputViewController extends AbstractViewControl
|
|
|
99
108
|
}
|
|
100
109
|
search(value) {
|
|
101
110
|
return __awaiter(this, void 0, void 0, function* () {
|
|
102
|
-
const { organizationId } = assertOptions({ organizationId: this.organizationId }, ['organizationId'], `You gotta set an organizationId to your person select input for it to function. Try using 'this.vc.setOrganizationId(...)'!`);
|
|
103
111
|
const client = yield this.connectToApi();
|
|
104
112
|
const [{ people }] = yield client.emitAndFlattenResponses('people.search::v2022_05_29', {
|
|
105
113
|
target: {
|
|
106
|
-
organizationId,
|
|
114
|
+
organizationId: this.organizationId,
|
|
107
115
|
},
|
|
108
116
|
payload: {
|
|
109
117
|
query: value,
|
|
@@ -56,21 +56,30 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
|
56
56
|
this.shouldIgnoreNextChange = false;
|
|
57
57
|
}
|
|
58
58
|
async populateSuggestions(value) {
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
59
|
+
(0, schema_1.assertOptions)({ organizationId: this.organizationId }, ['organizationId'], `You gotta set an organizationId to your person select input for it to function. Try using 'this.vc.setOrganizationId(...)'!`);
|
|
60
|
+
try {
|
|
61
|
+
const people = await this.search(value);
|
|
62
|
+
const suggestions = (0, searchPeopleToSuggestions_1.default)(people, async (person) => this.handleClickSuggestion(person));
|
|
63
|
+
this.autoCompleteVc.showSuggestions([
|
|
64
|
+
...suggestions,
|
|
65
|
+
{
|
|
66
|
+
id: 'invite',
|
|
67
|
+
label: 'Invite person',
|
|
68
|
+
onClick: this.handleClickInvitePerson.bind(this),
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'anonymous',
|
|
72
|
+
label: 'Add anonymously',
|
|
73
|
+
onClick: this.handleClickInviteAnonymous.bind(this),
|
|
74
|
+
},
|
|
75
|
+
]);
|
|
76
|
+
}
|
|
77
|
+
catch (err) {
|
|
78
|
+
console.error(err);
|
|
79
|
+
await this.alert({
|
|
80
|
+
message: `I could not complete your search!! I've let the humans know and they are on it!`,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
74
83
|
}
|
|
75
84
|
async handleClickInviteAnonymous() {
|
|
76
85
|
this.autoCompleteVc.hideSuggestions();
|
|
@@ -104,11 +113,10 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
|
104
113
|
return vc;
|
|
105
114
|
}
|
|
106
115
|
async search(value) {
|
|
107
|
-
const { organizationId } = (0, schema_1.assertOptions)({ organizationId: this.organizationId }, ['organizationId'], `You gotta set an organizationId to your person select input for it to function. Try using 'this.vc.setOrganizationId(...)'!`);
|
|
108
116
|
const client = await this.connectToApi();
|
|
109
117
|
const [{ people }] = await client.emitAndFlattenResponses('people.search::v2022_05_29', {
|
|
110
118
|
target: {
|
|
111
|
-
organizationId,
|
|
119
|
+
organizationId: this.organizationId,
|
|
112
120
|
},
|
|
113
121
|
payload: {
|
|
114
122
|
query: value,
|