@sprucelabs/spruce-profile-utils 3.0.48 → 3.1.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.
|
@@ -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
|
}
|
|
@@ -98,16 +98,21 @@ class ProfileCardViewController extends AbstractViewController {
|
|
|
98
98
|
load(options) {
|
|
99
99
|
var _a;
|
|
100
100
|
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');
|
|
101
|
+
const { person, authenticator, locale, locationId, organizationId } = assertOptions(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator']);
|
|
103
102
|
this.person = person;
|
|
104
103
|
this.authenticator = authenticator;
|
|
105
104
|
this.locationId = locationId;
|
|
106
105
|
this.organizationId = organizationId;
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
106
|
+
if (locale) {
|
|
107
|
+
const sortedSchema = sortTimezoneChoices(locale, personSchema, 'timezone');
|
|
108
|
+
this.formVc.updateField('timezone', {
|
|
109
|
+
fieldDefinition: Object.assign({}, sortedSchema.fields.timezone),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
else {
|
|
113
|
+
this.formVc.removeField('timezone');
|
|
114
|
+
}
|
|
115
|
+
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
116
|
this.formVc.disable();
|
|
112
117
|
this.cardVc.setIsBusy(false);
|
|
113
118
|
});
|
|
@@ -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
|
}
|
|
@@ -88,16 +88,21 @@ class ProfileCardViewController extends heartwood_view_controllers_1.AbstractVie
|
|
|
88
88
|
}
|
|
89
89
|
async load(options) {
|
|
90
90
|
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');
|
|
91
|
+
const { person, authenticator, locale, locationId, organizationId } = (0, schema_1.assertOptions)(options !== null && options !== void 0 ? options : {}, ['person', 'authenticator']);
|
|
93
92
|
this.person = person;
|
|
94
93
|
this.authenticator = authenticator;
|
|
95
94
|
this.locationId = locationId;
|
|
96
95
|
this.organizationId = organizationId;
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
96
|
+
if (locale) {
|
|
97
|
+
const sortedSchema = (0, calendar_utils_1.sortTimezoneChoices)(locale, spruce_core_schemas_1.personSchema, 'timezone');
|
|
98
|
+
this.formVc.updateField('timezone', {
|
|
99
|
+
fieldDefinition: Object.assign({}, sortedSchema.fields.timezone),
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
else {
|
|
103
|
+
this.formVc.removeField('timezone');
|
|
104
|
+
}
|
|
105
|
+
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
106
|
this.formVc.disable();
|
|
102
107
|
this.cardVc.setIsBusy(false);
|
|
103
108
|
}
|