@sprucelabs/spruce-people-utils 6.0.179 → 6.0.180

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
- var _a;
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 !== null && shouldAllowAddAnonymous !== void 0 ? shouldAllowAddAnonymous : true;
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
- var _a;
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 === null || cb === void 0 ? void 0 : cb(person),
13
+ onClick: () => cb?.(person),
14
14
  };
15
15
  }
16
16
  function renderLabel(p) {
17
- var _a;
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 !== null && name !== void 0 ? name : 'your new friend'} to check their phone and to click the link I just sent!`,
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 !== null && name !== void 0 ? name : 'Your friend'} has accepted your invite! Lets go! 👇`,
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
- var _a;
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((_a = header.title) !== null && _a !== void 0 ? _a : null);
143
- this.swipeVc.setHeaderSubtitle((_b = header.subtitle) !== null && _b !== void 0 ? _b : null);
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 (_a = this.doneHandler) === null || _a === void 0 ? void 0 : _a.call(this, invite.autoAcceptedPersonId);
185
+ return this.doneHandler?.(invite.autoAcceptedPersonId);
189
186
  }
190
187
  this.pendingInvite = invite;
191
188
  }
192
189
  catch (err) {
193
- console.error((_b = err.stack) !== null && _b !== void 0 ? _b : err.message);
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
- var _a;
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();
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-people-utils",
3
3
  "description": "People Utilities",
4
- "version": "6.0.179",
4
+ "version": "6.0.180",
5
5
  "skill": {
6
6
  "namespace": "invite"
7
7
  },