@sprucelabs/spruce-profile-utils 3.0.48 → 3.1.1
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.
|
@@ -20,7 +20,7 @@ export default class ProfileCardViewController extends AbstractViewController<Ca
|
|
|
20
20
|
export interface ProfileCardLoadOptions {
|
|
21
21
|
person: Person;
|
|
22
22
|
authenticator: Authenticator;
|
|
23
|
-
locale
|
|
23
|
+
locale?: Locale;
|
|
24
24
|
locationId?: string;
|
|
25
25
|
organizationId?: string;
|
|
26
26
|
}
|
|
@@ -54,6 +54,7 @@ class ProfileCardViewController extends AbstractViewController {
|
|
|
54
54
|
fields: ['firstName', 'lastName'],
|
|
55
55
|
},
|
|
56
56
|
{
|
|
57
|
+
id: 'location',
|
|
57
58
|
title: 'Location info',
|
|
58
59
|
fields: ['timezone'],
|
|
59
60
|
},
|
|
@@ -98,16 +99,21 @@ class ProfileCardViewController extends AbstractViewController {
|
|
|
98
99
|
load(options) {
|
|
99
100
|
var _a;
|
|
100
101
|
return __awaiter(this, void 0, void 0, function* () {
|
|
101
|
-
const { person, authenticator, locale, locationId, organizationId } = assertOptions(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator'
|
|
102
|
-
const sortedSchema = sortTimezoneChoices(locale, personSchema, 'timezone');
|
|
102
|
+
const { person, authenticator, locale, locationId, organizationId } = assertOptions(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator']);
|
|
103
103
|
this.person = person;
|
|
104
104
|
this.authenticator = authenticator;
|
|
105
105
|
this.locationId = locationId;
|
|
106
106
|
this.organizationId = organizationId;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
107
|
+
if (locale) {
|
|
108
|
+
const sortedSchema = sortTimezoneChoices(locale, personSchema, 'timezone');
|
|
109
|
+
this.formVc.updateField('timezone', {
|
|
110
|
+
fieldDefinition: Object.assign({}, sortedSchema.fields.timezone),
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
else {
|
|
114
|
+
this.formVc.removeSection('location');
|
|
115
|
+
}
|
|
116
|
+
yield this.formVc.setValues(Object.assign(Object.assign({}, options.person), { timezone: (_a = person.timezone) !== null && _a !== void 0 ? _a : locale === null || locale === void 0 ? void 0 : locale.getZoneName() }));
|
|
111
117
|
this.formVc.disable();
|
|
112
118
|
this.cardVc.setIsBusy(false);
|
|
113
119
|
});
|
|
@@ -20,7 +20,7 @@ export default class ProfileCardViewController extends AbstractViewController<Ca
|
|
|
20
20
|
export interface ProfileCardLoadOptions {
|
|
21
21
|
person: Person;
|
|
22
22
|
authenticator: Authenticator;
|
|
23
|
-
locale
|
|
23
|
+
locale?: Locale;
|
|
24
24
|
locationId?: string;
|
|
25
25
|
organizationId?: string;
|
|
26
26
|
}
|
|
@@ -47,6 +47,7 @@ class ProfileCardViewController extends heartwood_view_controllers_1.AbstractVie
|
|
|
47
47
|
fields: ['firstName', 'lastName'],
|
|
48
48
|
},
|
|
49
49
|
{
|
|
50
|
+
id: 'location',
|
|
50
51
|
title: 'Location info',
|
|
51
52
|
fields: ['timezone'],
|
|
52
53
|
},
|
|
@@ -88,16 +89,21 @@ class ProfileCardViewController extends heartwood_view_controllers_1.AbstractVie
|
|
|
88
89
|
}
|
|
89
90
|
async load(options) {
|
|
90
91
|
var _a;
|
|
91
|
-
const { person, authenticator, locale, locationId, organizationId } = (0, schema_1.assertOptions)(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator'
|
|
92
|
-
const sortedSchema = (0, calendar_utils_1.sortTimezoneChoices)(locale, spruce_core_schemas_1.personSchema, 'timezone');
|
|
92
|
+
const { person, authenticator, locale, locationId, organizationId } = (0, schema_1.assertOptions)(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator']);
|
|
93
93
|
this.person = person;
|
|
94
94
|
this.authenticator = authenticator;
|
|
95
95
|
this.locationId = locationId;
|
|
96
96
|
this.organizationId = organizationId;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
97
|
+
if (locale) {
|
|
98
|
+
const sortedSchema = (0, calendar_utils_1.sortTimezoneChoices)(locale, spruce_core_schemas_1.personSchema, 'timezone');
|
|
99
|
+
this.formVc.updateField('timezone', {
|
|
100
|
+
fieldDefinition: Object.assign({}, sortedSchema.fields.timezone),
|
|
101
|
+
});
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
this.formVc.removeSection('location');
|
|
105
|
+
}
|
|
106
|
+
await this.formVc.setValues(Object.assign(Object.assign({}, options.person), { timezone: (_a = person.timezone) !== null && _a !== void 0 ? _a : locale === null || locale === void 0 ? void 0 : locale.getZoneName() }));
|
|
101
107
|
this.formVc.disable();
|
|
102
108
|
this.cardVc.setIsBusy(false);
|
|
103
109
|
}
|