@sprucelabs/spruce-people-utils 1.0.62 → 1.0.65

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.
@@ -2,7 +2,7 @@ import { AbstractViewController, FormViewController, ViewControllerOptions, Swip
2
2
  import { SendInvite } from '../types/people-module.types';
3
3
  export default class InvitePersonCardViewController extends AbstractViewController<Card> {
4
4
  static id: string;
5
- protected cardVc: SwipeCardViewController;
5
+ protected swipeVc: SwipeCardViewController;
6
6
  protected organizationId: string;
7
7
  protected locationId?: string;
8
8
  protected formVc: FormViewController<InviteFormSchema>;
@@ -14,7 +14,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
14
14
  private client;
15
15
  private invitedPersonId?;
16
16
  constructor(options: ViewControllerOptions & InvitePersonOptions);
17
- SuccessTalkingVc(): TalkingSprucebotViewController;
17
+ protected SuccessTalkingVc(): TalkingSprucebotViewController;
18
18
  private WaitingTalkingVc;
19
19
  private CardVc;
20
20
  private handleSlideChange;
@@ -27,7 +27,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
27
27
  this.waitingTalkingVc = this.WaitingTalkingVc();
28
28
  this.successTalkingVc = this.SuccessTalkingVc();
29
29
  this.formVc = this.FormVc();
30
- this.cardVc = this.CardVc();
30
+ this.swipeVc = this.CardVc();
31
31
  this.doneHandler = onDone;
32
32
  this._handleDidAcceptInvite = this._handleDidAcceptInvite.bind(this);
33
33
  }
@@ -41,7 +41,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
41
41
  isPlaying: false,
42
42
  sentences: [
43
43
  {
44
- words: `First name has accepted the invite, let's go!`,
44
+ words: `The invite has been accepted, let's go!`,
45
45
  },
46
46
  ],
47
47
  });
@@ -97,23 +97,31 @@ export default class InvitePersonCardViewController extends AbstractViewControll
97
97
  updateTalkingSprucebot() {
98
98
  return __awaiter(this, void 0, void 0, function* () {
99
99
  const name = this.formVc.getValue('firstName');
100
+ this.waitingTalkingVc.pause();
101
+ this.successTalkingVc.pause();
100
102
  switch (this.slideIdx) {
101
103
  case 1:
102
104
  this.waitingTalkingVc.setSentences([
103
105
  {
104
- words: `Tell ${name} to check their phone and to click the link I just sent!`,
106
+ words: `Tell ${name !== null && name !== void 0 ? name : 'your new friend'} to check their phone and to click the link I just sent!`,
105
107
  },
106
108
  ]);
107
109
  yield this.waitingTalkingVc.play();
108
110
  break;
109
- default:
110
- this.waitingTalkingVc.pause();
111
+ case 2:
112
+ this.successTalkingVc.setSentences([
113
+ {
114
+ words: `${name !== null && name !== void 0 ? name : 'Your friend'} has accepted your invite! Lets go! 👇`,
115
+ },
116
+ ]);
117
+ yield this.successTalkingVc.play();
118
+ break;
111
119
  }
112
120
  });
113
121
  }
114
122
  updateFooter() {
115
123
  if (this.slideIdx > 0) {
116
- this.cardVc.setFooter({
124
+ this.swipeVc.setFooter({
117
125
  buttons: [
118
126
  {
119
127
  type: this.invitedPersonId ? 'primary' : 'secondary',
@@ -127,7 +135,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
127
135
  });
128
136
  }
129
137
  else {
130
- this.cardVc.setFooter(null);
138
+ this.swipeVc.setFooter(null);
131
139
  }
132
140
  }
133
141
  handleClickDone() {
@@ -139,17 +147,17 @@ export default class InvitePersonCardViewController extends AbstractViewControll
139
147
  handleClickBack() {
140
148
  return __awaiter(this, void 0, void 0, function* () {
141
149
  this.pendingInvite = undefined;
142
- yield this.cardVc.jumpToSlide(0);
150
+ yield this.swipeVc.jumpToSlide(0);
143
151
  });
144
152
  }
145
153
  updateHeader() {
146
154
  var _a, _b;
147
155
  const header = inviteCardHeaders[this.slideIdx];
148
- this.cardVc.setHeaderTitle((_a = header.title) !== null && _a !== void 0 ? _a : null);
149
- this.cardVc.setHeaderSubtitle((_b = header.subtitle) !== null && _b !== void 0 ? _b : null);
156
+ this.swipeVc.setHeaderTitle((_a = header.title) !== null && _a !== void 0 ? _a : null);
157
+ this.swipeVc.setHeaderSubtitle((_b = header.subtitle) !== null && _b !== void 0 ? _b : null);
150
158
  }
151
159
  get slideIdx() {
152
- return this.cardVc.getPresentSlide();
160
+ return this.swipeVc.getPresentSlide();
153
161
  }
154
162
  FormVc() {
155
163
  return this.Controller('form', buildForm({
@@ -174,8 +182,8 @@ export default class InvitePersonCardViewController extends AbstractViewControll
174
182
  }
175
183
  handleSubmitNamePhoneForm() {
176
184
  return __awaiter(this, void 0, void 0, function* () {
177
- this.cardVc.setIsBusy(true);
178
- yield this.cardVc.jumpToSlide(1);
185
+ this.swipeVc.setIsBusy(true);
186
+ yield this.swipeVc.jumpToSlide(1);
179
187
  try {
180
188
  const client = yield this.connectToApi();
181
189
  const [{ invite }] = yield client.emitAndFlattenResponses('invite.send::v2021_12_16', {
@@ -196,9 +204,9 @@ export default class InvitePersonCardViewController extends AbstractViewControll
196
204
  }
197
205
  catch (err) {
198
206
  yield this.alert({ title: 'Invite failed!', message: err.message });
199
- yield this.cardVc.jumpToSlide(0);
207
+ yield this.swipeVc.jumpToSlide(0);
200
208
  }
201
- this.cardVc.setIsBusy(false);
209
+ this.swipeVc.setIsBusy(false);
202
210
  });
203
211
  }
204
212
  getIsLoaded() {
@@ -207,7 +215,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
207
215
  load() {
208
216
  return __awaiter(this, void 0, void 0, function* () {
209
217
  this.isLoaded = true;
210
- this.cardVc.setIsBusy(false);
218
+ this.swipeVc.setIsBusy(false);
211
219
  this.client = yield this.connectToApi();
212
220
  yield this.client.on('invite.did-accept::v2021_12_16', this._handleDidAcceptInvite);
213
221
  });
@@ -221,14 +229,14 @@ export default class InvitePersonCardViewController extends AbstractViewControll
221
229
  var _a;
222
230
  return __awaiter(this, void 0, void 0, function* () {
223
231
  if (((_a = this.pendingInvite) === null || _a === void 0 ? void 0 : _a.id) === inviteId) {
224
- yield this.cardVc.jumpToSlide(2);
232
+ yield this.swipeVc.jumpToSlide(2);
225
233
  this.invitedPersonId = personId;
226
234
  this.updateFooter();
227
235
  }
228
236
  });
229
237
  }
230
238
  render() {
231
- return this.cardVc.render();
239
+ return this.swipeVc.render();
232
240
  }
233
241
  }
234
242
  InvitePersonCardViewController.id = 'invite-person-card';
@@ -2,7 +2,7 @@ import { AbstractViewController, FormViewController, ViewControllerOptions, Swip
2
2
  import { SendInvite } from '../types/people-module.types';
3
3
  export default class InvitePersonCardViewController extends AbstractViewController<Card> {
4
4
  static id: string;
5
- protected cardVc: SwipeCardViewController;
5
+ protected swipeVc: SwipeCardViewController;
6
6
  protected organizationId: string;
7
7
  protected locationId?: string;
8
8
  protected formVc: FormViewController<InviteFormSchema>;
@@ -14,7 +14,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
14
14
  private client;
15
15
  private invitedPersonId?;
16
16
  constructor(options: ViewControllerOptions & InvitePersonOptions);
17
- SuccessTalkingVc(): TalkingSprucebotViewController;
17
+ protected SuccessTalkingVc(): TalkingSprucebotViewController;
18
18
  private WaitingTalkingVc;
19
19
  private CardVc;
20
20
  private handleSlideChange;
@@ -20,7 +20,7 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
20
20
  this.waitingTalkingVc = this.WaitingTalkingVc();
21
21
  this.successTalkingVc = this.SuccessTalkingVc();
22
22
  this.formVc = this.FormVc();
23
- this.cardVc = this.CardVc();
23
+ this.swipeVc = this.CardVc();
24
24
  this.doneHandler = onDone;
25
25
  this._handleDidAcceptInvite = this._handleDidAcceptInvite.bind(this);
26
26
  }
@@ -34,7 +34,7 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
34
34
  isPlaying: false,
35
35
  sentences: [
36
36
  {
37
- words: `First name has accepted the invite, let's go!`,
37
+ words: `The invite has been accepted, let's go!`,
38
38
  },
39
39
  ],
40
40
  });
@@ -87,22 +87,30 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
87
87
  }
88
88
  async updateTalkingSprucebot() {
89
89
  const name = this.formVc.getValue('firstName');
90
+ this.waitingTalkingVc.pause();
91
+ this.successTalkingVc.pause();
90
92
  switch (this.slideIdx) {
91
93
  case 1:
92
94
  this.waitingTalkingVc.setSentences([
93
95
  {
94
- words: `Tell ${name} to check their phone and to click the link I just sent!`,
96
+ words: `Tell ${name !== null && name !== void 0 ? name : 'your new friend'} to check their phone and to click the link I just sent!`,
95
97
  },
96
98
  ]);
97
99
  await this.waitingTalkingVc.play();
98
100
  break;
99
- default:
100
- this.waitingTalkingVc.pause();
101
+ case 2:
102
+ this.successTalkingVc.setSentences([
103
+ {
104
+ words: `${name !== null && name !== void 0 ? name : 'Your friend'} has accepted your invite! Lets go! 👇`,
105
+ },
106
+ ]);
107
+ await this.successTalkingVc.play();
108
+ break;
101
109
  }
102
110
  }
103
111
  updateFooter() {
104
112
  if (this.slideIdx > 0) {
105
- this.cardVc.setFooter({
113
+ this.swipeVc.setFooter({
106
114
  buttons: [
107
115
  {
108
116
  type: this.invitedPersonId ? 'primary' : 'secondary',
@@ -116,7 +124,7 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
116
124
  });
117
125
  }
118
126
  else {
119
- this.cardVc.setFooter(null);
127
+ this.swipeVc.setFooter(null);
120
128
  }
121
129
  }
122
130
  async handleClickDone() {
@@ -125,16 +133,16 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
125
133
  }
126
134
  async handleClickBack() {
127
135
  this.pendingInvite = undefined;
128
- await this.cardVc.jumpToSlide(0);
136
+ await this.swipeVc.jumpToSlide(0);
129
137
  }
130
138
  updateHeader() {
131
139
  var _a, _b;
132
140
  const header = inviteCardHeaders_1.inviteCardHeaders[this.slideIdx];
133
- this.cardVc.setHeaderTitle((_a = header.title) !== null && _a !== void 0 ? _a : null);
134
- this.cardVc.setHeaderSubtitle((_b = header.subtitle) !== null && _b !== void 0 ? _b : null);
141
+ this.swipeVc.setHeaderTitle((_a = header.title) !== null && _a !== void 0 ? _a : null);
142
+ this.swipeVc.setHeaderSubtitle((_b = header.subtitle) !== null && _b !== void 0 ? _b : null);
135
143
  }
136
144
  get slideIdx() {
137
- return this.cardVc.getPresentSlide();
145
+ return this.swipeVc.getPresentSlide();
138
146
  }
139
147
  FormVc() {
140
148
  return this.Controller('form', (0, heartwood_view_controllers_1.buildForm)({
@@ -153,8 +161,8 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
153
161
  return super.destroy();
154
162
  }
155
163
  async handleSubmitNamePhoneForm() {
156
- this.cardVc.setIsBusy(true);
157
- await this.cardVc.jumpToSlide(1);
164
+ this.swipeVc.setIsBusy(true);
165
+ await this.swipeVc.jumpToSlide(1);
158
166
  try {
159
167
  const client = await this.connectToApi();
160
168
  const [{ invite }] = await client.emitAndFlattenResponses('invite.send::v2021_12_16', {
@@ -175,16 +183,16 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
175
183
  }
176
184
  catch (err) {
177
185
  await this.alert({ title: 'Invite failed!', message: err.message });
178
- await this.cardVc.jumpToSlide(0);
186
+ await this.swipeVc.jumpToSlide(0);
179
187
  }
180
- this.cardVc.setIsBusy(false);
188
+ this.swipeVc.setIsBusy(false);
181
189
  }
182
190
  getIsLoaded() {
183
191
  return this.isLoaded;
184
192
  }
185
193
  async load() {
186
194
  this.isLoaded = true;
187
- this.cardVc.setIsBusy(false);
195
+ this.swipeVc.setIsBusy(false);
188
196
  this.client = await this.connectToApi();
189
197
  await this.client.on('invite.did-accept::v2021_12_16', this._handleDidAcceptInvite);
190
198
  }
@@ -194,13 +202,13 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
194
202
  async handleDidAcceptInvite(inviteId, personId) {
195
203
  var _a;
196
204
  if (((_a = this.pendingInvite) === null || _a === void 0 ? void 0 : _a.id) === inviteId) {
197
- await this.cardVc.jumpToSlide(2);
205
+ await this.swipeVc.jumpToSlide(2);
198
206
  this.invitedPersonId = personId;
199
207
  this.updateFooter();
200
208
  }
201
209
  }
202
210
  render() {
203
- return this.cardVc.render();
211
+ return this.swipeVc.render();
204
212
  }
205
213
  }
206
214
  exports.default = InvitePersonCardViewController;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-people-utils",
3
3
  "description": "People Utilities",
4
- "version": "1.0.62",
4
+ "version": "1.0.65",
5
5
  "skill": {
6
6
  "namespace": "invite"
7
7
  },