@sprucelabs/spruce-people-utils 3.5.0 → 3.6.0
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.
- package/build/esm/inviting/InvitePersonCard.vc.d.ts +2 -0
- package/build/esm/inviting/InvitePersonCard.vc.js +5 -1
- package/build/esm/viewControllers/PersonSelectInput.vc.js +6 -0
- package/build/inviting/InvitePersonCard.vc.d.ts +2 -0
- package/build/inviting/InvitePersonCard.vc.js +5 -1
- package/build/viewControllers/PersonSelectInput.vc.js +6 -0
- package/package.json +1 -1
|
@@ -13,6 +13,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
|
|
|
13
13
|
private isLoaded;
|
|
14
14
|
private client;
|
|
15
15
|
private invitedPersonId?;
|
|
16
|
+
private startingPhone?;
|
|
16
17
|
constructor(options: ViewControllerOptions & InvitePersonOptions);
|
|
17
18
|
protected SuccessTalkingVc(): TalkingSprucebotViewController;
|
|
18
19
|
private WaitingTalkingVc;
|
|
@@ -38,6 +39,7 @@ export interface InvitePersonOptions {
|
|
|
38
39
|
organizationId?: string;
|
|
39
40
|
locationId?: string;
|
|
40
41
|
onDone?: DoneHandler;
|
|
42
|
+
phone?: string;
|
|
41
43
|
}
|
|
42
44
|
declare const inviteFormSchema: {
|
|
43
45
|
id: string;
|
|
@@ -21,9 +21,10 @@ class InvitePersonCardViewController extends AbstractViewController {
|
|
|
21
21
|
if (!options.organizationId) {
|
|
22
22
|
required.push('locationId');
|
|
23
23
|
}
|
|
24
|
-
const { organizationId, locationId, onDone } = assertOptions(options, required);
|
|
24
|
+
const { organizationId, locationId, onDone, phone } = assertOptions(options, required);
|
|
25
25
|
this.organizationId = organizationId;
|
|
26
26
|
this.locationId = locationId;
|
|
27
|
+
this.startingPhone = phone;
|
|
27
28
|
this.waitingTalkingVc = this.WaitingTalkingVc();
|
|
28
29
|
this.successTalkingVc = this.SuccessTalkingVc();
|
|
29
30
|
this.formVc = this.FormVc();
|
|
@@ -163,6 +164,9 @@ class InvitePersonCardViewController extends AbstractViewController {
|
|
|
163
164
|
return this.Controller('form', buildForm({
|
|
164
165
|
schema: inviteFormSchema,
|
|
165
166
|
shouldShowCancelButton: false,
|
|
167
|
+
values: {
|
|
168
|
+
phone: this.startingPhone,
|
|
169
|
+
},
|
|
166
170
|
onSubmit: this.handleSubmitNamePhoneForm.bind(this),
|
|
167
171
|
sections: [
|
|
168
172
|
{
|
|
@@ -8,6 +8,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
});
|
|
9
9
|
};
|
|
10
10
|
import { AbstractViewController, } from '@sprucelabs/heartwood-view-controllers';
|
|
11
|
+
import { isValidNumber } from '@sprucelabs/schema';
|
|
11
12
|
import InvitePersonCardViewController from '../inviting/InvitePersonCard.vc.js';
|
|
12
13
|
import searchPeopleToSuggestions, { renderLabel, } from './searchPeopleToSuggestions.js';
|
|
13
14
|
class PersonSelectInputViewController extends AbstractViewController {
|
|
@@ -117,10 +118,15 @@ class PersonSelectInputViewController extends AbstractViewController {
|
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
InvitePersonVc(onDone) {
|
|
121
|
+
let search = this.autoCompleteVc.getRenderedValue();
|
|
122
|
+
if (!isValidNumber(search)) {
|
|
123
|
+
search = '';
|
|
124
|
+
}
|
|
120
125
|
const vc = this.Controller('people.invite-person-card', {
|
|
121
126
|
organizationId: this.organizationId,
|
|
122
127
|
locationId: this.locationId,
|
|
123
128
|
onDone,
|
|
129
|
+
phone: search,
|
|
124
130
|
});
|
|
125
131
|
return vc;
|
|
126
132
|
}
|
|
@@ -13,6 +13,7 @@ export default class InvitePersonCardViewController extends AbstractViewControll
|
|
|
13
13
|
private isLoaded;
|
|
14
14
|
private client;
|
|
15
15
|
private invitedPersonId?;
|
|
16
|
+
private startingPhone?;
|
|
16
17
|
constructor(options: ViewControllerOptions & InvitePersonOptions);
|
|
17
18
|
protected SuccessTalkingVc(): TalkingSprucebotViewController;
|
|
18
19
|
private WaitingTalkingVc;
|
|
@@ -38,6 +39,7 @@ export interface InvitePersonOptions {
|
|
|
38
39
|
organizationId?: string;
|
|
39
40
|
locationId?: string;
|
|
40
41
|
onDone?: DoneHandler;
|
|
42
|
+
phone?: string;
|
|
41
43
|
}
|
|
42
44
|
declare const inviteFormSchema: {
|
|
43
45
|
id: string;
|
|
@@ -14,9 +14,10 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
14
14
|
if (!options.organizationId) {
|
|
15
15
|
required.push('locationId');
|
|
16
16
|
}
|
|
17
|
-
const { organizationId, locationId, onDone } = (0, schema_1.assertOptions)(options, required);
|
|
17
|
+
const { organizationId, locationId, onDone, phone } = (0, schema_1.assertOptions)(options, required);
|
|
18
18
|
this.organizationId = organizationId;
|
|
19
19
|
this.locationId = locationId;
|
|
20
|
+
this.startingPhone = phone;
|
|
20
21
|
this.waitingTalkingVc = this.WaitingTalkingVc();
|
|
21
22
|
this.successTalkingVc = this.SuccessTalkingVc();
|
|
22
23
|
this.formVc = this.FormVc();
|
|
@@ -148,6 +149,9 @@ class InvitePersonCardViewController extends heartwood_view_controllers_1.Abstra
|
|
|
148
149
|
return this.Controller('form', (0, heartwood_view_controllers_1.buildForm)({
|
|
149
150
|
schema: inviteFormSchema,
|
|
150
151
|
shouldShowCancelButton: false,
|
|
152
|
+
values: {
|
|
153
|
+
phone: this.startingPhone,
|
|
154
|
+
},
|
|
151
155
|
onSubmit: this.handleSubmitNamePhoneForm.bind(this),
|
|
152
156
|
sections: [
|
|
153
157
|
{
|
|
@@ -27,6 +27,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
29
|
const heartwood_view_controllers_1 = require("@sprucelabs/heartwood-view-controllers");
|
|
30
|
+
const schema_1 = require("@sprucelabs/schema");
|
|
30
31
|
const InvitePersonCard_vc_1 = __importDefault(require("../inviting/InvitePersonCard.vc"));
|
|
31
32
|
const searchPeopleToSuggestions_1 = __importStar(require("./searchPeopleToSuggestions"));
|
|
32
33
|
class PersonSelectInputViewController extends heartwood_view_controllers_1.AbstractViewController {
|
|
@@ -126,10 +127,15 @@ class PersonSelectInputViewController extends heartwood_view_controllers_1.Abstr
|
|
|
126
127
|
await vc.load();
|
|
127
128
|
}
|
|
128
129
|
InvitePersonVc(onDone) {
|
|
130
|
+
let search = this.autoCompleteVc.getRenderedValue();
|
|
131
|
+
if (!(0, schema_1.isValidNumber)(search)) {
|
|
132
|
+
search = '';
|
|
133
|
+
}
|
|
129
134
|
const vc = this.Controller('people.invite-person-card', {
|
|
130
135
|
organizationId: this.organizationId,
|
|
131
136
|
locationId: this.locationId,
|
|
132
137
|
onDone,
|
|
138
|
+
phone: search,
|
|
133
139
|
});
|
|
134
140
|
return vc;
|
|
135
141
|
}
|