@sprucelabs/spruce-invite-utils 10.1.46 → 10.1.48

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.
@@ -83,7 +83,6 @@ class ConfirmJoinCardViewController extends heartwood_view_controllers_1.Abstrac
83
83
  return this.isLoaded;
84
84
  }
85
85
  async load() {
86
- var _a, _b, _c, _d, _e, _f, _g, _h;
87
86
  try {
88
87
  const client = await this.connectToApi();
89
88
  await Promise.all([
@@ -93,9 +92,9 @@ class ConfirmJoinCardViewController extends heartwood_view_controllers_1.Abstrac
93
92
  this.isLoaded = true;
94
93
  const person = this.authenticator.getPerson();
95
94
  const listVc = this.Controller('list', (0, renderAcceptCardSections_1.renderPermsList)({
96
- firstName: (_a = person === null || person === void 0 ? void 0 : person.firstName) !== null && _a !== void 0 ? _a : '',
97
- lastName: (_b = person === null || person === void 0 ? void 0 : person.lastName) !== null && _b !== void 0 ? _b : '',
98
- phone: (_c = person === null || person === void 0 ? void 0 : person.phone) !== null && _c !== void 0 ? _c : '',
95
+ firstName: person?.firstName ?? '',
96
+ lastName: person?.lastName ?? '',
97
+ phone: person?.phone ?? '',
99
98
  onClickToggle: () => this.askForAVote({
100
99
  featureKey: 'selectable-perms',
101
100
  skillNamespace: 'invite',
@@ -104,9 +103,9 @@ class ConfirmJoinCardViewController extends heartwood_view_controllers_1.Abstrac
104
103
  }));
105
104
  this.cardVc.setSections([
106
105
  ...(0, renderAcceptCardSections_1.default)({
107
- orgName: (_e = (_d = this.org) === null || _d === void 0 ? void 0 : _d.name) !== null && _e !== void 0 ? _e : 'a company',
108
- roleName: (_f = this.viewContext.roleName) !== null && _f !== void 0 ? _f : 'Guest',
109
- locationAddress: (_g = this.location) === null || _g === void 0 ? void 0 : _g.address,
106
+ orgName: this.org?.name ?? 'a company',
107
+ roleName: this.viewContext.roleName ?? 'Guest',
108
+ locationAddress: this.location?.address,
110
109
  }),
111
110
  {
112
111
  list: listVc.render(),
@@ -116,11 +115,10 @@ class ConfirmJoinCardViewController extends heartwood_view_controllers_1.Abstrac
116
115
  }
117
116
  catch (err) {
118
117
  await this.alert({ message: err.message });
119
- await ((_h = this.onErrorHandler) === null || _h === void 0 ? void 0 : _h.call(this, err));
118
+ await this.onErrorHandler?.(err);
120
119
  }
121
120
  }
122
121
  async loadOrg(client) {
123
- var _a;
124
122
  try {
125
123
  const [{ organization }] = await client.emitAndFlattenResponses('get-organization::v2020_12_25', {
126
124
  target: {
@@ -130,7 +128,7 @@ class ConfirmJoinCardViewController extends heartwood_view_controllers_1.Abstrac
130
128
  this.org = organization;
131
129
  }
132
130
  catch (err) {
133
- if (((_a = err.options) === null || _a === void 0 ? void 0 : _a.code) === 'UNAUTHORIZED_ACCESS') {
131
+ if (err.options?.code === 'UNAUTHORIZED_ACCESS') {
134
132
  this.org = {
135
133
  id: this.organizationId,
136
134
  dateCreated: 0,
@@ -144,7 +142,6 @@ class ConfirmJoinCardViewController extends heartwood_view_controllers_1.Abstrac
144
142
  }
145
143
  }
146
144
  async optionallyLoadLocation(client) {
147
- var _a;
148
145
  if (this.locationId) {
149
146
  try {
150
147
  const [{ location }] = await client.emitAndFlattenResponses('get-location::v2020_12_25', {
@@ -155,7 +152,7 @@ class ConfirmJoinCardViewController extends heartwood_view_controllers_1.Abstrac
155
152
  this.location = location;
156
153
  }
157
154
  catch (err) {
158
- if (((_a = err.options) === null || _a === void 0 ? void 0 : _a.code) === 'UNAUTHORIZED_ACCESS') {
155
+ if (err.options?.code === 'UNAUTHORIZED_ACCESS') {
159
156
  this.location = {
160
157
  id: this.locationId,
161
158
  dateCreated: 0,
@@ -11,7 +11,6 @@ class LoginAndConfirmJoinControllerFactory {
11
11
  this.Class = Class;
12
12
  }
13
13
  static Controller(options) {
14
- var _a;
15
14
  const { views } = (0, schema_1.assertOptions)(options, [
16
15
  'authenticator',
17
16
  'views',
@@ -21,7 +20,7 @@ class LoginAndConfirmJoinControllerFactory {
21
20
  if (!views.hasController('invite.confirm-join-card')) {
22
21
  views.setController('invite.confirm-join-card', ConfirmJoinCard_vc_1.default);
23
22
  }
24
- return new ((_a = this.Class) !== null && _a !== void 0 ? _a : LoginAndConfirmJoinControllerImpl)(options);
23
+ return new (this.Class ?? LoginAndConfirmJoinControllerImpl)(options);
25
24
  }
26
25
  }
27
26
  exports.LoginAndConfirmJoinControllerFactory = LoginAndConfirmJoinControllerFactory;
@@ -37,7 +36,7 @@ class LoginAndConfirmJoinControllerImpl {
37
36
  }
38
37
  async promptForLoginAndConfirmJoin(options) {
39
38
  this.client = await this.connectToApi();
40
- this.confirmJoinContext = options === null || options === void 0 ? void 0 : options.confirmJoinViewContext;
39
+ this.confirmJoinContext = options?.confirmJoinViewContext;
41
40
  let person = this.authenticator.getPerson();
42
41
  if (!this.authenticator.isLoggedIn()) {
43
42
  person = await this.promptForLogin();
@@ -66,13 +65,11 @@ class LoginAndConfirmJoinControllerImpl {
66
65
  let accepted = false;
67
66
  const confirmVc = this.views.Controller('invite.confirm-join-card', {
68
67
  onAccept: async () => {
69
- var _a;
70
68
  accepted = true;
71
- await ((_a = this.dialog) === null || _a === void 0 ? void 0 : _a.hide());
69
+ await this.dialog?.hide();
72
70
  },
73
71
  onDecline: async () => {
74
- var _a;
75
- await ((_a = this.dialog) === null || _a === void 0 ? void 0 : _a.hide());
72
+ await this.dialog?.hide();
76
73
  },
77
74
  onError: () => { },
78
75
  organizationId: this.organizationId,
@@ -89,19 +86,17 @@ class LoginAndConfirmJoinControllerImpl {
89
86
  let person;
90
87
  const loginVc = this.views.Controller('login', {
91
88
  onLogin: async (options) => {
92
- var _a;
93
89
  person = options.person;
94
- await ((_a = this.dialog) === null || _a === void 0 ? void 0 : _a.hide());
90
+ await this.dialog?.hide();
95
91
  },
96
92
  });
97
93
  await this.renderInDialogAndWait(loginVc.render());
98
94
  return person;
99
95
  }
100
96
  async renderInDialogAndWait(view) {
101
- var _a;
102
97
  //@ts-ignore
103
98
  this.dialog = this.vc.renderInDialog(view);
104
- await ((_a = this.dialog) === null || _a === void 0 ? void 0 : _a.wait());
99
+ await this.dialog?.wait();
105
100
  }
106
101
  }
107
102
  exports.default = LoginAndConfirmJoinControllerImpl;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sprucelabs/spruce-invite-utils",
3
3
  "description": "Invite Utilities",
4
- "version": "10.1.46",
4
+ "version": "10.1.48",
5
5
  "skill": {
6
6
  "namespace": "invite"
7
7
  },