@sprucelabs/spruce-profile-utils 3.0.3 → 3.0.5
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.
|
@@ -8,6 +8,8 @@ export default class ProfileCardViewController extends AbstractViewController<Ca
|
|
|
8
8
|
protected person?: Person;
|
|
9
9
|
protected authenticator: Authenticator;
|
|
10
10
|
protected onSubmitHandler?: OnSubmitHandler;
|
|
11
|
+
protected locationId?: string;
|
|
12
|
+
protected organizationId?: string;
|
|
11
13
|
constructor(options: ViewControllerOptions & ProfileCardViewControllerOptions);
|
|
12
14
|
private CardVc;
|
|
13
15
|
private FormVc;
|
|
@@ -19,6 +21,8 @@ export interface ProfileCardLoadOptions {
|
|
|
19
21
|
person: Person;
|
|
20
22
|
authenticator: Authenticator;
|
|
21
23
|
locale: Locale;
|
|
24
|
+
locationId?: string;
|
|
25
|
+
organizationId?: string;
|
|
22
26
|
}
|
|
23
27
|
export type OnSubmitHandler = (person: Person) => Promise<void>;
|
|
24
28
|
export interface ProfileCardViewControllerOptions {
|
|
@@ -69,6 +69,8 @@ class ProfileCardViewController extends AbstractViewController {
|
|
|
69
69
|
yield client.emitAndFlattenResponses('update-person::v2020_12_25', {
|
|
70
70
|
target: {
|
|
71
71
|
personId: (_a = this.person) === null || _a === void 0 ? void 0 : _a.id,
|
|
72
|
+
organizationId: this.organizationId,
|
|
73
|
+
locationId: this.locationId,
|
|
72
74
|
},
|
|
73
75
|
payload: Object.assign({}, values),
|
|
74
76
|
});
|
|
@@ -94,14 +96,12 @@ class ProfileCardViewController extends AbstractViewController {
|
|
|
94
96
|
load(options) {
|
|
95
97
|
var _a;
|
|
96
98
|
return __awaiter(this, void 0, void 0, function* () {
|
|
97
|
-
const { person, authenticator, locale } = assertOptions(options !== null && options !== void 0 ? options : {}, [
|
|
98
|
-
'person',
|
|
99
|
-
'authenticator',
|
|
100
|
-
'locale',
|
|
101
|
-
]);
|
|
99
|
+
const { person, authenticator, locale, locationId, organizationId } = assertOptions(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator', 'locale']);
|
|
102
100
|
const sortedSchema = sortTimezoneChoices(locale, personSchema, 'timezone');
|
|
103
101
|
this.person = person;
|
|
104
102
|
this.authenticator = authenticator;
|
|
103
|
+
this.locationId = locationId;
|
|
104
|
+
this.organizationId = organizationId;
|
|
105
105
|
this.formVc.updateField('timezone', {
|
|
106
106
|
fieldDefinition: Object.assign({}, sortedSchema.fields.timezone),
|
|
107
107
|
});
|
|
@@ -8,6 +8,8 @@ export default class ProfileCardViewController extends AbstractViewController<Ca
|
|
|
8
8
|
protected person?: Person;
|
|
9
9
|
protected authenticator: Authenticator;
|
|
10
10
|
protected onSubmitHandler?: OnSubmitHandler;
|
|
11
|
+
protected locationId?: string;
|
|
12
|
+
protected organizationId?: string;
|
|
11
13
|
constructor(options: ViewControllerOptions & ProfileCardViewControllerOptions);
|
|
12
14
|
private CardVc;
|
|
13
15
|
private FormVc;
|
|
@@ -19,6 +21,8 @@ export interface ProfileCardLoadOptions {
|
|
|
19
21
|
person: Person;
|
|
20
22
|
authenticator: Authenticator;
|
|
21
23
|
locale: Locale;
|
|
24
|
+
locationId?: string;
|
|
25
|
+
organizationId?: string;
|
|
22
26
|
}
|
|
23
27
|
export type OnSubmitHandler = (person: Person) => Promise<void>;
|
|
24
28
|
export interface ProfileCardViewControllerOptions {
|
|
@@ -61,6 +61,8 @@ class ProfileCardViewController extends heartwood_view_controllers_1.AbstractVie
|
|
|
61
61
|
await client.emitAndFlattenResponses('update-person::v2020_12_25', {
|
|
62
62
|
target: {
|
|
63
63
|
personId: (_a = this.person) === null || _a === void 0 ? void 0 : _a.id,
|
|
64
|
+
organizationId: this.organizationId,
|
|
65
|
+
locationId: this.locationId,
|
|
64
66
|
},
|
|
65
67
|
payload: Object.assign({}, values),
|
|
66
68
|
});
|
|
@@ -84,14 +86,12 @@ class ProfileCardViewController extends heartwood_view_controllers_1.AbstractVie
|
|
|
84
86
|
}
|
|
85
87
|
async load(options) {
|
|
86
88
|
var _a;
|
|
87
|
-
const { person, authenticator, locale } = (0, schema_1.assertOptions)(options !== null && options !== void 0 ? options : {}, [
|
|
88
|
-
'person',
|
|
89
|
-
'authenticator',
|
|
90
|
-
'locale',
|
|
91
|
-
]);
|
|
89
|
+
const { person, authenticator, locale, locationId, organizationId } = (0, schema_1.assertOptions)(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator', 'locale']);
|
|
92
90
|
const sortedSchema = (0, calendar_utils_1.sortTimezoneChoices)(locale, spruce_core_schemas_1.personSchema, 'timezone');
|
|
93
91
|
this.person = person;
|
|
94
92
|
this.authenticator = authenticator;
|
|
93
|
+
this.locationId = locationId;
|
|
94
|
+
this.organizationId = organizationId;
|
|
95
95
|
this.formVc.updateField('timezone', {
|
|
96
96
|
fieldDefinition: Object.assign({}, sortedSchema.fields.timezone),
|
|
97
97
|
});
|