@careflair/common 1.0.51 → 1.0.52
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.
|
@@ -43,6 +43,11 @@ export declare const educationTypeOptions: {
|
|
|
43
43
|
label: string;
|
|
44
44
|
value: string;
|
|
45
45
|
}[];
|
|
46
|
+
/** Role options for "looking for support" in registration (participant, support_person) */
|
|
47
|
+
export declare const LOOKING_FOR_SUPPORT_ROLE_OPTIONS: readonly {
|
|
48
|
+
label: string;
|
|
49
|
+
value: string;
|
|
50
|
+
}[];
|
|
46
51
|
export declare const ProfileAllSteps: ProfileAllStepsEnum[];
|
|
47
52
|
export declare const StateFullToShort: {
|
|
48
53
|
readonly "New South Wales (NSW)": "NSW";
|
package/dist/constants/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.flagCodeByLanguage = exports.daysOfWeek = exports.contractTypeDetails = exports.onboardingStepsDetails = exports.DocumentTypeLabels = exports.altCommunicationOptions = exports.altCommunicationLabels = exports.commonLabels = exports.supportWorkerServiceTooltip = exports.SupportWorkerServiceLabels = exports.serviceTooltip = exports.PROVIDER_SERVICES_FILTERS = exports.SUPPORT_WORKER_SERVICES_FILTERS = exports.ServiceLabels = exports.StateShortToFull = exports.StateFullToShort = exports.ProfileAllSteps = exports.educationTypeOptions = exports.providerInterestOptions = exports.providerPreferenceOptions = exports.participantInterestOptions = exports.participantPreferenceOptions = exports.complexNeedsSupportedOptions = exports.agesSupportedOptions = exports.genderOfAttendanceOptions = exports.deliveryOptions = exports.languageOptions = exports.statesOptions = void 0;
|
|
3
|
+
exports.flagCodeByLanguage = exports.daysOfWeek = exports.contractTypeDetails = exports.onboardingStepsDetails = exports.DocumentTypeLabels = exports.altCommunicationOptions = exports.altCommunicationLabels = exports.commonLabels = exports.supportWorkerServiceTooltip = exports.SupportWorkerServiceLabels = exports.serviceTooltip = exports.PROVIDER_SERVICES_FILTERS = exports.SUPPORT_WORKER_SERVICES_FILTERS = exports.ServiceLabels = exports.StateShortToFull = exports.StateFullToShort = exports.ProfileAllSteps = exports.LOOKING_FOR_SUPPORT_ROLE_OPTIONS = exports.educationTypeOptions = exports.providerInterestOptions = exports.providerPreferenceOptions = exports.participantInterestOptions = exports.participantPreferenceOptions = exports.complexNeedsSupportedOptions = exports.agesSupportedOptions = exports.genderOfAttendanceOptions = exports.deliveryOptions = exports.languageOptions = exports.statesOptions = void 0;
|
|
4
4
|
const enums_1 = require("../enums");
|
|
5
5
|
const utils_1 = require("../utils/utils");
|
|
6
6
|
exports.statesOptions = (0, utils_1.enumToOptions)(enums_1.StatesEnum);
|
|
@@ -14,6 +14,14 @@ exports.participantInterestOptions = (0, utils_1.enumToOptions)(enums_1.Particip
|
|
|
14
14
|
exports.providerPreferenceOptions = (0, utils_1.enumToOptions)(enums_1.ProviderPreferenceEnum);
|
|
15
15
|
exports.providerInterestOptions = (0, utils_1.enumToOptions)(enums_1.ProviderInterestEnum);
|
|
16
16
|
exports.educationTypeOptions = (0, utils_1.enumToOptions)(enums_1.EducationTypeEnum);
|
|
17
|
+
/** Role options for "looking for support" in registration (participant, support_person) */
|
|
18
|
+
exports.LOOKING_FOR_SUPPORT_ROLE_OPTIONS = [
|
|
19
|
+
{ label: "I am a participant", value: enums_1.UserRole.PARTICIPANT },
|
|
20
|
+
{
|
|
21
|
+
label: "I represent a participant (family/nominees/coordinators)",
|
|
22
|
+
value: enums_1.UserRole.SUPPORT_PERSON,
|
|
23
|
+
},
|
|
24
|
+
];
|
|
17
25
|
exports.ProfileAllSteps = Object.values(enums_1.ProfileAllStepsEnum);
|
|
18
26
|
// Hardcoded mapping for full name to short form and vice versa
|
|
19
27
|
exports.StateFullToShort = {
|
package/dist/utils/enum.d.ts
CHANGED
|
@@ -3,4 +3,9 @@ type Option = {
|
|
|
3
3
|
value: string;
|
|
4
4
|
};
|
|
5
5
|
export declare function enumToOptions<T extends Record<string, string>>(enumObj: T): Option[];
|
|
6
|
+
/**
|
|
7
|
+
* Map enum display values back to enum keys (for API payloads).
|
|
8
|
+
* e.g. getEnumKeysFromValues(LanguageEnum, ['English']) => ['ENGLISH']
|
|
9
|
+
*/
|
|
10
|
+
export declare function getEnumKeysFromValues<T extends Record<string, string>, K extends keyof T>(enumObj: T, values: string[]): K[];
|
|
6
11
|
export {};
|
package/dist/utils/enum.js
CHANGED
|
@@ -1,9 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enumToOptions = enumToOptions;
|
|
4
|
+
exports.getEnumKeysFromValues = getEnumKeysFromValues;
|
|
4
5
|
function enumToOptions(enumObj) {
|
|
5
6
|
return Object.values(enumObj).map((value) => ({
|
|
6
7
|
label: value, // Use the enum value for the label
|
|
7
8
|
value: value, // Use the enum value for the value
|
|
8
9
|
}));
|
|
9
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Map enum display values back to enum keys (for API payloads).
|
|
13
|
+
* e.g. getEnumKeysFromValues(LanguageEnum, ['English']) => ['ENGLISH']
|
|
14
|
+
*/
|
|
15
|
+
function getEnumKeysFromValues(enumObj, values) {
|
|
16
|
+
const reverseEnum = Object.fromEntries(Object.entries(enumObj).map(([key, value]) => [value, key]));
|
|
17
|
+
return values.map((value) => reverseEnum[value]);
|
|
18
|
+
}
|