@sprucelabs/spruce-people-utils 6.0.179 → 6.0.181
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.
@@ -12,8 +12,7 @@ class SpyInviteInviteViewController extends InvitePersonCard_vc_1.default {
|
|
12
12
|
return this.organizationId;
|
13
13
|
}
|
14
14
|
async clickDone(personId) {
|
15
|
-
|
16
|
-
await ((_a = this.doneHandler) === null || _a === void 0 ? void 0 : _a.call(this, personId));
|
15
|
+
await this.doneHandler?.(personId);
|
17
16
|
}
|
18
17
|
}
|
19
18
|
exports.default = SpyInviteInviteViewController;
|
@@ -37,7 +37,7 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
37
37
|
const { organizationId, locationId, shouldAllowAddAnonymous } = options;
|
38
38
|
this.organizationId = organizationId;
|
39
39
|
this.locationId = locationId;
|
40
|
-
this.shouldAllowAddAnonymous = shouldAllowAddAnonymous
|
40
|
+
this.shouldAllowAddAnonymous = shouldAllowAddAnonymous ?? true;
|
41
41
|
this.autoCompleteVc = this.Controller('autocompleteInput', {
|
42
42
|
...options,
|
43
43
|
onChangeRenderedValue: this.handleOnChangeRenderedValue.bind(this),
|
@@ -97,8 +97,7 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
97
97
|
}
|
98
98
|
}
|
99
99
|
isErrorUnauthorized(err) {
|
100
|
-
|
101
|
-
return ((_a = err === null || err === void 0 ? void 0 : err.options) === null || _a === void 0 ? void 0 : _a.code) === 'UNAUTHORIZED_ACCESS';
|
100
|
+
return err?.options?.code === 'UNAUTHORIZED_ACCESS';
|
102
101
|
}
|
103
102
|
setHandlers(options) {
|
104
103
|
this.autoCompleteVc.setHandlers(options);
|
@@ -10,10 +10,9 @@ function searchPersonToSuggestion(person, cb) {
|
|
10
10
|
return {
|
11
11
|
id: person.id,
|
12
12
|
label: renderLabel(person),
|
13
|
-
onClick: () => cb
|
13
|
+
onClick: () => cb?.(person),
|
14
14
|
};
|
15
15
|
}
|
16
16
|
function renderLabel(p) {
|
17
|
-
|
18
|
-
return `${(_a = p.fullName) !== null && _a !== void 0 ? _a : 'friend'} (${p.phone})`;
|
17
|
+
return `${p.fullName ?? 'friend'} (${p.phone})`;
|
19
18
|
}
|
@@ -94,7 +94,7 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
94
94
|
case 1:
|
95
95
|
this.waitingTalkingVc.setSentences([
|
96
96
|
{
|
97
|
-
words: `Tell ${name
|
97
|
+
words: `Tell ${name ?? 'your new friend'} to check their phone and to click the link I just sent!`,
|
98
98
|
},
|
99
99
|
]);
|
100
100
|
await this.waitingTalkingVc.play();
|
@@ -102,7 +102,7 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
102
102
|
case 2:
|
103
103
|
this.successTalkingVc.setSentences([
|
104
104
|
{
|
105
|
-
words: `${name
|
105
|
+
words: `${name ?? 'Your friend'} has accepted your invite! Lets go! 👇`,
|
106
106
|
},
|
107
107
|
]);
|
108
108
|
await this.successTalkingVc.play();
|
@@ -129,18 +129,16 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
129
129
|
}
|
130
130
|
}
|
131
131
|
async handleClickDone() {
|
132
|
-
|
133
|
-
await ((_a = this.doneHandler) === null || _a === void 0 ? void 0 : _a.call(this, this.invitedPersonId));
|
132
|
+
await this.doneHandler?.(this.invitedPersonId);
|
134
133
|
}
|
135
134
|
async handleClickBack() {
|
136
135
|
this.pendingInvite = undefined;
|
137
136
|
await this.swipeVc.jumpToSlide(0);
|
138
137
|
}
|
139
138
|
updateHeader() {
|
140
|
-
var _a, _b;
|
141
139
|
const header = inviteCardHeaders_1.inviteCardHeaders[this.slideIdx];
|
142
|
-
this.swipeVc.setHeaderTitle(
|
143
|
-
this.swipeVc.setHeaderSubtitle(
|
140
|
+
this.swipeVc.setHeaderTitle(header.title ?? null);
|
141
|
+
this.swipeVc.setHeaderSubtitle(header.subtitle ?? null);
|
144
142
|
}
|
145
143
|
get slideIdx() {
|
146
144
|
return this.swipeVc.getPresentSlide();
|
@@ -165,7 +163,6 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
165
163
|
return super.destroy();
|
166
164
|
}
|
167
165
|
async handleSubmitNamePhoneForm() {
|
168
|
-
var _a, _b;
|
169
166
|
this.swipeVc.setIsBusy(true);
|
170
167
|
await this.swipeVc.jumpToSlide(1);
|
171
168
|
try {
|
@@ -185,12 +182,12 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
185
182
|
},
|
186
183
|
});
|
187
184
|
if (invite.autoAcceptedPersonId) {
|
188
|
-
return
|
185
|
+
return this.doneHandler?.(invite.autoAcceptedPersonId);
|
189
186
|
}
|
190
187
|
this.pendingInvite = invite;
|
191
188
|
}
|
192
189
|
catch (err) {
|
193
|
-
console.error(
|
190
|
+
console.error(err.stack ?? err.message);
|
194
191
|
await this.alert({ title: 'Invite failed!', message: err.message });
|
195
192
|
await this.swipeVc.jumpToSlide(0);
|
196
193
|
}
|
@@ -209,8 +206,7 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
209
206
|
return this.handleDidAcceptInvite(payload.inviteId, payload.personId);
|
210
207
|
}
|
211
208
|
async handleDidAcceptInvite(inviteId, personId) {
|
212
|
-
|
213
|
-
if (((_a = this.pendingInvite) === null || _a === void 0 ? void 0 : _a.id) === inviteId) {
|
209
|
+
if (this.pendingInvite?.id === inviteId) {
|
214
210
|
await this.swipeVc.jumpToSlide(2);
|
215
211
|
this.invitedPersonId = personId;
|
216
212
|
this.updateFooter();
|