udp-schema 0.3.0 → 1.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.
- package/dist/field-helpers.d.ts +18 -31
- package/dist/field-helpers.d.ts.map +1 -1
- package/dist/field-helpers.js +56 -51
- package/dist/field-helpers.js.map +1 -1
- package/dist/field-meta.d.ts +14 -34
- package/dist/field-meta.d.ts.map +1 -1
- package/dist/field-meta.js +13 -1991
- package/dist/field-meta.js.map +1 -1
- package/dist/index.d.ts +19 -18
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +30 -35
- package/dist/index.js.map +1 -1
- package/dist/onboarding-config.d.ts +44 -0
- package/dist/onboarding-config.d.ts.map +1 -0
- package/dist/onboarding-config.js +705 -0
- package/dist/onboarding-config.js.map +1 -0
- package/dist/profile-fields/01-profile.d.ts +264 -0
- package/dist/profile-fields/01-profile.d.ts.map +1 -0
- package/dist/profile-fields/01-profile.js +113 -0
- package/dist/profile-fields/01-profile.js.map +1 -0
- package/dist/profile-fields/02-political.d.ts +133 -0
- package/dist/profile-fields/02-political.d.ts.map +1 -0
- package/dist/profile-fields/02-political.js +42 -0
- package/dist/profile-fields/02-political.js.map +1 -0
- package/dist/profile-fields/03-electoral.d.ts +46 -0
- package/dist/profile-fields/03-electoral.d.ts.map +1 -0
- package/dist/profile-fields/03-electoral.js +21 -0
- package/dist/profile-fields/03-electoral.js.map +1 -0
- package/dist/profile-fields/04-leadership.d.ts +34 -0
- package/dist/profile-fields/04-leadership.d.ts.map +1 -0
- package/dist/profile-fields/04-leadership.js +22 -0
- package/dist/profile-fields/04-leadership.js.map +1 -0
- package/dist/profile-fields/05-psychological.d.ts +58 -0
- package/dist/profile-fields/05-psychological.d.ts.map +1 -0
- package/dist/profile-fields/05-psychological.js +20 -0
- package/dist/profile-fields/05-psychological.js.map +1 -0
- package/dist/profile-fields/06-education.d.ts +28 -0
- package/dist/profile-fields/06-education.d.ts.map +1 -0
- package/dist/profile-fields/06-education.js +23 -0
- package/dist/profile-fields/06-education.js.map +1 -0
- package/dist/profile-fields/07-employment.d.ts +75 -0
- package/dist/profile-fields/07-employment.d.ts.map +1 -0
- package/dist/profile-fields/07-employment.js +32 -0
- package/dist/profile-fields/07-employment.js.map +1 -0
- package/dist/profile-fields/08-neurodiversity.d.ts +100 -0
- package/dist/profile-fields/08-neurodiversity.d.ts.map +1 -0
- package/dist/profile-fields/08-neurodiversity.js +39 -0
- package/dist/profile-fields/08-neurodiversity.js.map +1 -0
- package/dist/profile-fields/09-health.d.ts +89 -0
- package/dist/profile-fields/09-health.d.ts.map +1 -0
- package/dist/profile-fields/09-health.js +38 -0
- package/dist/profile-fields/09-health.js.map +1 -0
- package/dist/profile-fields/10-worldview.d.ts +75 -0
- package/dist/profile-fields/10-worldview.d.ts.map +1 -0
- package/dist/profile-fields/10-worldview.js +41 -0
- package/dist/profile-fields/10-worldview.js.map +1 -0
- package/dist/profile-fields/11-residence.d.ts +3 -0
- package/dist/profile-fields/11-residence.d.ts.map +1 -0
- package/dist/profile-fields/11-residence.js +11 -0
- package/dist/profile-fields/11-residence.js.map +1 -0
- package/dist/profile-fields/12-household.d.ts +90 -0
- package/dist/profile-fields/12-household.d.ts.map +1 -0
- package/dist/profile-fields/12-household.js +37 -0
- package/dist/profile-fields/12-household.js.map +1 -0
- package/dist/profile-fields/index.d.ts +22 -0
- package/dist/profile-fields/index.d.ts.map +1 -0
- package/dist/profile-fields/index.js +47 -0
- package/dist/profile-fields/index.js.map +1 -0
- package/dist/profile-fields/types.d.ts +66 -0
- package/dist/profile-fields/types.d.ts.map +1 -0
- package/dist/profile-fields/types.js +8 -0
- package/dist/profile-fields/types.js.map +1 -0
- package/dist/progress-fields.d.ts +21 -3
- package/dist/progress-fields.d.ts.map +1 -1
- package/dist/progress-fields.js +97 -94
- package/dist/progress-fields.js.map +1 -1
- package/dist/step-01.schema.d.ts +84 -111
- package/dist/step-01.schema.d.ts.map +1 -1
- package/dist/step-01.schema.js +94 -101
- package/dist/step-01.schema.js.map +1 -1
- package/dist/step-02.schema.d.ts +31 -21
- package/dist/step-02.schema.d.ts.map +1 -1
- package/dist/step-02.schema.js +34 -27
- package/dist/step-02.schema.js.map +1 -1
- package/dist/step-03.schema.d.ts +24 -300
- package/dist/step-03.schema.d.ts.map +1 -1
- package/dist/step-03.schema.js +17 -60
- package/dist/step-03.schema.js.map +1 -1
- package/dist/step-04.schema.d.ts +56 -50
- package/dist/step-04.schema.d.ts.map +1 -1
- package/dist/step-04.schema.js +44 -43
- package/dist/step-04.schema.js.map +1 -1
- package/dist/step-05.schema.d.ts +13 -52
- package/dist/step-05.schema.d.ts.map +1 -1
- package/dist/step-05.schema.js +19 -40
- package/dist/step-05.schema.js.map +1 -1
- package/dist/step-06.schema.d.ts +101 -117
- package/dist/step-06.schema.d.ts.map +1 -1
- package/dist/step-06.schema.js +70 -75
- package/dist/step-06.schema.js.map +1 -1
- package/dist/step-07.schema.d.ts +44 -95
- package/dist/step-07.schema.d.ts.map +1 -1
- package/dist/step-07.schema.js +37 -78
- package/dist/step-07.schema.js.map +1 -1
- package/dist/step-08.schema.d.ts +31 -44
- package/dist/step-08.schema.d.ts.map +1 -1
- package/dist/step-08.schema.js +29 -48
- package/dist/step-08.schema.js.map +1 -1
- package/dist/step-09.schema.d.ts +48 -85
- package/dist/step-09.schema.d.ts.map +1 -1
- package/dist/step-09.schema.js +28 -120
- package/dist/step-09.schema.js.map +1 -1
- package/dist/step-10.schema.d.ts +32 -86
- package/dist/step-10.schema.d.ts.map +1 -1
- package/dist/step-10.schema.js +44 -120
- package/dist/step-10.schema.js.map +1 -1
- package/dist/step-11.schema.d.ts +36 -92
- package/dist/step-11.schema.d.ts.map +1 -1
- package/dist/step-11.schema.js +32 -111
- package/dist/step-11.schema.js.map +1 -1
- package/dist/step-12.schema.d.ts +56 -93
- package/dist/step-12.schema.d.ts.map +1 -1
- package/dist/step-12.schema.js +57 -133
- package/dist/step-12.schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export const familyMemberOptions = [
|
|
2
|
+
{ value: 'father', label: 'Father' }, { value: 'mother', label: 'Mother' },
|
|
3
|
+
{ value: 'step_father', label: 'Step-father' }, { value: 'step_mother', label: 'Step-mother' },
|
|
4
|
+
{ value: 'wife_husband', label: 'Wife / Husband' }, { value: 'blood_brother', label: 'Blood Brother' },
|
|
5
|
+
{ value: 'blood_sister', label: 'Blood Sister' }, { value: 'half_brother', label: 'Half Brother' },
|
|
6
|
+
{ value: 'half_sister', label: 'Half Sister' }, { value: 'step_brother', label: 'Step Brother' },
|
|
7
|
+
{ value: 'step_sister', label: 'Step Sister' }, { value: 'son', label: 'Son' },
|
|
8
|
+
{ value: 'daughter', label: 'Daughter' }, { value: 'other', label: 'Other' },
|
|
9
|
+
];
|
|
10
|
+
export const digitalAccessOptions = [
|
|
11
|
+
{ value: 'smartphone', label: 'Smartphone' }, { value: 'feature_phone', label: 'Feature phone' },
|
|
12
|
+
{ value: 'computer_laptop', label: 'Computer / Laptop' }, { value: 'internet_at_home', label: 'Internet at home' },
|
|
13
|
+
{ value: 'no_internet', label: 'No internet access' }, { value: 'no_phone', label: 'No phone' },
|
|
14
|
+
];
|
|
15
|
+
export const householdIncomeOptions = [
|
|
16
|
+
{ value: 'below_5k', label: 'Below ₹5,000' }, { value: '5k_10k', label: '₹5,000 – ₹10,000' },
|
|
17
|
+
{ value: '10k_25k', label: '₹10,000 – ₹25,000' }, { value: '25k_50k', label: '₹25,000 – ₹50,000' },
|
|
18
|
+
{ value: '50k_1L', label: '₹50,000 – ₹1 Lakh' }, { value: '1L_2.5L', label: '₹1 Lakh – ₹2.5 Lakh' },
|
|
19
|
+
{ value: 'above_2.5L', label: 'Above ₹2.5 Lakh' }, { value: 'prefer_not_to_say', label: 'Prefer not to say' },
|
|
20
|
+
];
|
|
21
|
+
export const household = {
|
|
22
|
+
key: 'household', label: 'Household & Economic Profile', step: 12,
|
|
23
|
+
description: 'Family, housing, income, and economic profile.',
|
|
24
|
+
fields: [
|
|
25
|
+
{ order: 1, key: 'maritalStatus', label: 'Marital Status', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'single', label: 'Single' }, { value: 'married', label: 'Married' }, { value: 'divorced', label: 'Divorced' }, { value: 'widowed', label: 'Widowed' }, { value: 'separated', label: 'Separated' }, { value: 'prefer_not_to_say', label: 'Prefer not to say' }] },
|
|
26
|
+
{ order: 2, key: 'familyMembers', label: 'Family Members', type: 'multi_select', step: 12, isOnboarding: true, optional: true, options: [...familyMemberOptions] },
|
|
27
|
+
{ order: 3, key: 'numberOfDependents', label: 'Number of Dependents', type: 'number', step: 12, isOnboarding: true, optional: true, min: 0, max: 50 },
|
|
28
|
+
{ order: 4, key: 'housingType', label: 'Housing Type', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'own_house', label: 'Own house' }, { value: 'rented', label: 'Rented' }, { value: 'government_quarters', label: 'Government quarters' }, { value: 'shared', label: 'Shared housing' }, { value: 'homeless', label: 'Homeless' }, { value: 'other', label: 'Other' }] },
|
|
29
|
+
{ order: 5, key: 'householdIncome', label: 'Household Income', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [...householdIncomeOptions], sensitive: true },
|
|
30
|
+
{ order: 6, key: 'bplCard', label: 'BPL Card', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'yes', label: 'Yes' }, { value: 'no', label: 'No' }, { value: 'applied', label: 'Applied / Pending' }, { value: 'dont_know', label: "Don't know" }] },
|
|
31
|
+
{ order: 7, key: 'digitalAccess', label: 'Digital Access', type: 'multi_select', step: 12, isOnboarding: true, optional: true, options: [...digitalAccessOptions] },
|
|
32
|
+
{ order: 8, key: 'migrationStatus', label: 'Migration Status', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'native', label: 'Native (always lived here)' }, { value: 'within_district', label: 'Migrated within district' }, { value: 'within_state', label: 'Migrated within state' }, { value: 'inter_state', label: 'Inter-state migrant' }, { value: 'international', label: 'International migrant' }] },
|
|
33
|
+
{ order: 9, key: 'landOwnership', label: 'Land Ownership', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'own_agricultural', label: 'Own agricultural land' }, { value: 'own_residential', label: 'Own residential land' }, { value: 'government_allotted', label: 'Government allotted' }, { value: 'no_land', label: 'No land' }, { value: 'leased', label: 'Leased land' }, { value: 'other', label: 'Other' }] },
|
|
34
|
+
{ order: 10, key: 'primaryIncomeSource', label: 'Primary Income Source', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'agriculture', label: 'Agriculture' }, { value: 'government_job', label: 'Government job' }, { value: 'private_job', label: 'Private job' }, { value: 'business', label: 'Business' }, { value: 'daily_wage', label: 'Daily wage' }, { value: 'pension', label: 'Pension' }, { value: 'remittance', label: 'Remittance' }, { value: 'no_fixed_income', label: 'No fixed income' }, { value: 'other', label: 'Other' }] },
|
|
35
|
+
],
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=12-household.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"12-household.js","sourceRoot":"","sources":["../../src/profile-fields/12-household.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;IAC1E,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE;IAC9F,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE;IACtG,EAAE,KAAK,EAAE,cAAc,EAAE,KAAK,EAAE,cAAc,EAAE,EAAE,EAAE,KAAK,EAAE,cAA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,EAAE,sBAAsB,EAAE,EAAE,EAAE,KAAK,EAAE,qBAAqB,EAAE,KAAK,EAAE,qBAAqB,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;QAC9b,EAAE,KAAK,EAAE,EAAE,EAAE,GAAG,EAAE,qBAAqB,EAAE,KAAK,EAAE,uBAAuB,EAAE,IAAI,EAAE,eAAe,EAAE,IAAI,EAAE,EAAE,EAAE,YAAY,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE,EAAE,EAAE,KAAK,EAAE,aAAa,EAAE,KAAK,EAAE,aAAa,EAAE,EAAE,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE,EAAE,EAAE,KAAK,EAAE,YAAY,EAAE,KAAK,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,iBAAiB,EAAE,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC,EAAE;KAC1jB;CACF,CAAC","sourcesContent":["import type { FieldGroup } from './types.js';\n\nexport const familyMemberOptions = [\n { value: 'father', label: 'Father' }, { value: 'mother', label: 'Mother' },\n { value: 'step_father', label: 'Step-father' }, { value: 'step_mother', label: 'Step-mother' },\n { value: 'wife_husband', label: 'Wife / Husband' }, { value: 'blood_brother', label: 'Blood Brother' },\n { value: 'blood_sister', label: 'Blood Sister' }, { value: 'half_brother', label: 'Half Brother' },\n { value: 'half_sister', label: 'Half Sister' }, { value: 'step_brother', label: 'Step Brother' },\n { value: 'step_sister', label: 'Step Sister' }, { value: 'son', label: 'Son' },\n { value: 'daughter', label: 'Daughter' }, { value: 'other', label: 'Other' },\n] as const;\n\nexport const digitalAccessOptions = [\n { value: 'smartphone', label: 'Smartphone' }, { value: 'feature_phone', label: 'Feature phone' },\n { value: 'computer_laptop', label: 'Computer / Laptop' }, { value: 'internet_at_home', label: 'Internet at home' },\n { value: 'no_internet', label: 'No internet access' }, { value: 'no_phone', label: 'No phone' },\n] as const;\n\nexport const householdIncomeOptions = [\n { value: 'below_5k', label: 'Below ₹5,000' }, { value: '5k_10k', label: '₹5,000 – ₹10,000' },\n { value: '10k_25k', label: '₹10,000 – ₹25,000' }, { value: '25k_50k', label: '₹25,000 – ₹50,000' },\n { value: '50k_1L', label: '₹50,000 – ₹1 Lakh' }, { value: '1L_2.5L', label: '₹1 Lakh – ₹2.5 Lakh' },\n { value: 'above_2.5L', label: 'Above ₹2.5 Lakh' }, { value: 'prefer_not_to_say', label: 'Prefer not to say' },\n] as const;\n\nexport const household: FieldGroup = {\n key: 'household', label: 'Household & Economic Profile', step: 12,\n description: 'Family, housing, income, and economic profile.',\n fields: [\n { order: 1, key: 'maritalStatus', label: 'Marital Status', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'single', label: 'Single' }, { value: 'married', label: 'Married' }, { value: 'divorced', label: 'Divorced' }, { value: 'widowed', label: 'Widowed' }, { value: 'separated', label: 'Separated' }, { value: 'prefer_not_to_say', label: 'Prefer not to say' }] },\n { order: 2, key: 'familyMembers', label: 'Family Members', type: 'multi_select', step: 12, isOnboarding: true, optional: true, options: [...familyMemberOptions] },\n { order: 3, key: 'numberOfDependents', label: 'Number of Dependents', type: 'number', step: 12, isOnboarding: true, optional: true, min: 0, max: 50 },\n { order: 4, key: 'housingType', label: 'Housing Type', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'own_house', label: 'Own house' }, { value: 'rented', label: 'Rented' }, { value: 'government_quarters', label: 'Government quarters' }, { value: 'shared', label: 'Shared housing' }, { value: 'homeless', label: 'Homeless' }, { value: 'other', label: 'Other' }] },\n { order: 5, key: 'householdIncome', label: 'Household Income', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [...householdIncomeOptions], sensitive: true },\n { order: 6, key: 'bplCard', label: 'BPL Card', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'yes', label: 'Yes' }, { value: 'no', label: 'No' }, { value: 'applied', label: 'Applied / Pending' }, { value: 'dont_know', label: \"Don't know\" }] },\n { order: 7, key: 'digitalAccess', label: 'Digital Access', type: 'multi_select', step: 12, isOnboarding: true, optional: true, options: [...digitalAccessOptions] },\n { order: 8, key: 'migrationStatus', label: 'Migration Status', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'native', label: 'Native (always lived here)' }, { value: 'within_district', label: 'Migrated within district' }, { value: 'within_state', label: 'Migrated within state' }, { value: 'inter_state', label: 'Inter-state migrant' }, { value: 'international', label: 'International migrant' }] },\n { order: 9, key: 'landOwnership', label: 'Land Ownership', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'own_agricultural', label: 'Own agricultural land' }, { value: 'own_residential', label: 'Own residential land' }, { value: 'government_allotted', label: 'Government allotted' }, { value: 'no_land', label: 'No land' }, { value: 'leased', label: 'Leased land' }, { value: 'other', label: 'Other' }] },\n { order: 10, key: 'primaryIncomeSource', label: 'Primary Income Source', type: 'single_select', step: 12, isOnboarding: true, optional: true, options: [{ value: 'agriculture', label: 'Agriculture' }, { value: 'government_job', label: 'Government job' }, { value: 'private_job', label: 'Private job' }, { value: 'business', label: 'Business' }, { value: 'daily_wage', label: 'Daily wage' }, { value: 'pension', label: 'Pension' }, { value: 'remittance', label: 'Remittance' }, { value: 'no_fixed_income', label: 'No fixed income' }, { value: 'other', label: 'Other' }] },\n ],\n};\n"]}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UDP Profile Fields — barrel export.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the dating-schema profile-fields pattern.
|
|
5
|
+
* Each file defines a FieldGroup with rich field metadata and options.
|
|
6
|
+
*/
|
|
7
|
+
export type { BaseField, FieldGroup, FieldOption, MultiSelectField, NumberField, ProfileField, SelectField, TextField, } from './types.js';
|
|
8
|
+
export { profile, genderOptions, religionOptions, languageOptions, reservationOptions, minorityOptions } from './01-profile.js';
|
|
9
|
+
export { politicalAssociation, politicalSpectrumOptions, partyOptions, civicEngagementOptions } from './02-political.js';
|
|
10
|
+
export { electoralBehaviour, votingIssueOptions } from './03-electoral.js';
|
|
11
|
+
export { leadershipAmbitions, leadershipSkillsetOptions } from './04-leadership.js';
|
|
12
|
+
export { psychologicalAssessment, mbtiOptions } from './05-psychological.js';
|
|
13
|
+
export { education, qualificationOptions } from './06-education.js';
|
|
14
|
+
export { employment, employmentStatusOptions, shiftOptions, incomeRangeOptions } from './07-employment.js';
|
|
15
|
+
export { neurodiversity, neurodiversityConditionOptions, sensoryPreferenceOptions, supportNeedOptions } from './08-neurodiversity.js';
|
|
16
|
+
export { healthLifestyle, disabilityOptions, substanceUseOptions, dietOptions } from './09-health.js';
|
|
17
|
+
export { worldView, lgbtqStatementOptions, transgenderStatementOptions, casteDiscriminationPlaceOptions } from './10-worldview.js';
|
|
18
|
+
export { residence } from './11-residence.js';
|
|
19
|
+
export { household, familyMemberOptions, digitalAccessOptions, householdIncomeOptions } from './12-household.js';
|
|
20
|
+
import type { FieldGroup } from './types.js';
|
|
21
|
+
export declare const allFieldGroups: readonly FieldGroup[];
|
|
22
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/profile-fields/index.ts"],"names":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,SAAS,UAAU,EAa/C,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* UDP Profile Fields — barrel export.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the dating-schema profile-fields pattern.
|
|
5
|
+
* Each file defines a FieldGroup with rich field metadata and options.
|
|
6
|
+
*/
|
|
7
|
+
// ── Field groups ────────────────────────────────────────────────────────────
|
|
8
|
+
export { profile, genderOptions, religionOptions, languageOptions, reservationOptions, minorityOptions } from './01-profile.js';
|
|
9
|
+
export { politicalAssociation, politicalSpectrumOptions, partyOptions, civicEngagementOptions } from './02-political.js';
|
|
10
|
+
export { electoralBehaviour, votingIssueOptions } from './03-electoral.js';
|
|
11
|
+
export { leadershipAmbitions, leadershipSkillsetOptions } from './04-leadership.js';
|
|
12
|
+
export { psychologicalAssessment, mbtiOptions } from './05-psychological.js';
|
|
13
|
+
export { education, qualificationOptions } from './06-education.js';
|
|
14
|
+
export { employment, employmentStatusOptions, shiftOptions, incomeRangeOptions } from './07-employment.js';
|
|
15
|
+
export { neurodiversity, neurodiversityConditionOptions, sensoryPreferenceOptions, supportNeedOptions } from './08-neurodiversity.js';
|
|
16
|
+
export { healthLifestyle, disabilityOptions, substanceUseOptions, dietOptions } from './09-health.js';
|
|
17
|
+
export { worldView, lgbtqStatementOptions, transgenderStatementOptions, casteDiscriminationPlaceOptions } from './10-worldview.js';
|
|
18
|
+
export { residence } from './11-residence.js';
|
|
19
|
+
export { household, familyMemberOptions, digitalAccessOptions, householdIncomeOptions } from './12-household.js';
|
|
20
|
+
// ── All field groups (for building lookup maps) ─────────────────────────────
|
|
21
|
+
import { profile } from './01-profile.js';
|
|
22
|
+
import { politicalAssociation } from './02-political.js';
|
|
23
|
+
import { electoralBehaviour } from './03-electoral.js';
|
|
24
|
+
import { leadershipAmbitions } from './04-leadership.js';
|
|
25
|
+
import { psychologicalAssessment } from './05-psychological.js';
|
|
26
|
+
import { education } from './06-education.js';
|
|
27
|
+
import { employment } from './07-employment.js';
|
|
28
|
+
import { neurodiversity } from './08-neurodiversity.js';
|
|
29
|
+
import { healthLifestyle } from './09-health.js';
|
|
30
|
+
import { worldView } from './10-worldview.js';
|
|
31
|
+
import { residence } from './11-residence.js';
|
|
32
|
+
import { household } from './12-household.js';
|
|
33
|
+
export const allFieldGroups = [
|
|
34
|
+
profile,
|
|
35
|
+
politicalAssociation,
|
|
36
|
+
electoralBehaviour,
|
|
37
|
+
leadershipAmbitions,
|
|
38
|
+
psychologicalAssessment,
|
|
39
|
+
education,
|
|
40
|
+
employment,
|
|
41
|
+
neurodiversity,
|
|
42
|
+
healthLifestyle,
|
|
43
|
+
worldView,
|
|
44
|
+
residence,
|
|
45
|
+
household,
|
|
46
|
+
];
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/profile-fields/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,+EAA+E;AAE/E,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,eAAe,EAAE,kBAAkB,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAChI,OAAO,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,YAAY,EAAE,sBAAsB,EAAE,MAAM,mBAAmB,CAAC;AACzH,OAAO,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EAAE,mBAAmB,EAAE,yBAAyB,EAAE,MAAM,oBAAoB,CAAC;AACpF,OAAO,EAAE,uBAAuB,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,SAAS,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,uBAAuB,EAAE,YAAY,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAC3G,OAAO,EAAE,cAAc,EAAE,8BAA8B,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n * UDP Profile Fields — barrel export.\n *\n * Mirrors the dating-schema profile-fields pattern.\n * Each file defines a FieldGroup with rich field metadata and options.\n */\n\nexport type {\n BaseField,\n FieldGroup,\n FieldOption,\n MultiSelectField,\n NumberField,\n ProfileField,\n SelectField,\n TextField,\n} from './types.js';\n\n// ── Field groups ────────────────────────────────────────────────────────────\n\nexport { profile, genderOptions, religionOptions, languageOptions, reservationOptions, minorityOptions } from './01-profile.js';\nexport { politicalAssociation, politicalSpectrumOptions, partyOptions, civicEngagementOptions } from './02-political.js';\nexport { electoralBehaviour, votingIssueOptions } from './03-electoral.js';\nexport { leadershipAmbitions, leadershipSkillsetOptions } from './04-leadership.js';\nexport { psychologicalAssessment, mbtiOptions } from './05-psychological.js';\nexport { education, qualificationOptions } from './06-education.js';\nexport { employment, employmentStatusOptions, shiftOptions, incomeRangeOptions } from './07-employment.js';\nexport { neurodiversity, neurodiversityConditionOptions, sensoryPreferenceOptions, supportNeedOptions } from './08-neurodiversity.js';\nexport { healthLifestyle, disabilityOptions, substanceUseOptions, dietOptions } from './09-health.js';\nexport { worldView, lgbtqStatementOptions, transgenderStatementOptions, casteDiscriminationPlaceOptions } from './10-worldview.js';\nexport { residence } from './11-residence.js';\nexport { household, familyMemberOptions, digitalAccessOptions, householdIncomeOptions } from './12-household.js';\n\n// ── All field groups (for building lookup maps) ─────────────────────────────\n\nimport { profile } from './01-profile.js';\nimport { politicalAssociation } from './02-political.js';\nimport { electoralBehaviour } from './03-electoral.js';\nimport { leadershipAmbitions } from './04-leadership.js';\nimport { psychologicalAssessment } from './05-psychological.js';\nimport { education } from './06-education.js';\nimport { employment } from './07-employment.js';\nimport { neurodiversity } from './08-neurodiversity.js';\nimport { healthLifestyle } from './09-health.js';\nimport { worldView } from './10-worldview.js';\nimport { residence } from './11-residence.js';\nimport { household } from './12-household.js';\nimport type { FieldGroup } from './types.js';\n\nexport const allFieldGroups: readonly FieldGroup[] = [\n profile,\n politicalAssociation,\n electoralBehaviour,\n leadershipAmbitions,\n psychologicalAssessment,\n education,\n employment,\n neurodiversity,\n healthLifestyle,\n worldView,\n residence,\n household,\n];\n"]}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for UDP profile field configuration.
|
|
3
|
+
*
|
|
4
|
+
* Mirrors the dating-schema profile-fields/types.ts pattern.
|
|
5
|
+
* These types describe field metadata — NOT the user's actual profile data.
|
|
6
|
+
*/
|
|
7
|
+
export interface FieldOption {
|
|
8
|
+
value: string;
|
|
9
|
+
label: string;
|
|
10
|
+
/** Short description — shown on chips/cards */
|
|
11
|
+
description?: string;
|
|
12
|
+
}
|
|
13
|
+
export interface BaseField {
|
|
14
|
+
/** Display order within the step */
|
|
15
|
+
order: number;
|
|
16
|
+
/** Unique key — maps to DB field name */
|
|
17
|
+
key: string;
|
|
18
|
+
/** Human-readable label */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Field type for form rendering */
|
|
21
|
+
type: 'text' | 'textarea' | 'number' | 'date' | 'single_select' | 'multi_select' | 'object' | 'object_array' | 'address';
|
|
22
|
+
/** Step number (1-12) this field belongs to */
|
|
23
|
+
step: number;
|
|
24
|
+
/** Whether this field is collected during onboarding */
|
|
25
|
+
isOnboarding: boolean;
|
|
26
|
+
/** If true, can be skipped during onboarding */
|
|
27
|
+
optional?: boolean;
|
|
28
|
+
/** Help text shown below the field */
|
|
29
|
+
description?: string;
|
|
30
|
+
/** Mark as sensitive (shown with privacy notice) */
|
|
31
|
+
sensitive?: boolean;
|
|
32
|
+
/** If set, field only applicable when referenced field has one of the listed values */
|
|
33
|
+
conditionalOn?: {
|
|
34
|
+
field: string;
|
|
35
|
+
values: string[];
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
export interface SelectField extends BaseField {
|
|
39
|
+
type: 'single_select';
|
|
40
|
+
options: FieldOption[];
|
|
41
|
+
}
|
|
42
|
+
export interface MultiSelectField extends BaseField {
|
|
43
|
+
type: 'multi_select';
|
|
44
|
+
options: FieldOption[];
|
|
45
|
+
maxSelect?: number;
|
|
46
|
+
}
|
|
47
|
+
export interface TextField extends BaseField {
|
|
48
|
+
type: 'text' | 'textarea';
|
|
49
|
+
maxLength?: number;
|
|
50
|
+
}
|
|
51
|
+
export interface NumberField extends BaseField {
|
|
52
|
+
type: 'number';
|
|
53
|
+
min?: number;
|
|
54
|
+
max?: number;
|
|
55
|
+
}
|
|
56
|
+
export type ProfileField = SelectField | MultiSelectField | TextField | NumberField | (BaseField & {
|
|
57
|
+
type: 'date' | 'object' | 'object_array' | 'address';
|
|
58
|
+
});
|
|
59
|
+
export interface FieldGroup {
|
|
60
|
+
key: string;
|
|
61
|
+
label: string;
|
|
62
|
+
description?: string;
|
|
63
|
+
step: number;
|
|
64
|
+
fields: ProfileField[];
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/profile-fields/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,+CAA+C;IAC/C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB;AAED,MAAM,WAAW,SAAS;IACxB,oCAAoC;IACpC,KAAK,EAAE,MAAM,CAAC;IACd,yCAAyC;IACzC,GAAG,EAAE,MAAM,CAAC;IACZ,2BAA2B;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,oCAAoC;IACpC,IAAI,EACA,MAAM,GACN,UAAU,GACV,QAAQ,GACR,MAAM,GACN,eAAe,GACf,cAAc,GACd,QAAQ,GACR,cAAc,GACd,SAAS,CAAC;IACd,+CAA+C;IAC/C,IAAI,EAAE,MAAM,CAAC;IACb,wDAAwD;IACxD,YAAY,EAAE,OAAO,CAAC;IACtB,gDAAgD;IAChD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sCAA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ent":["/**\n * Type definitions for UDP profile field configuration.\n *\n * Mirrors the dating-schema profile-fields/types.ts pattern.\n * These types describe field metadata — NOT the user's actual profile data.\n */\n\nexport interface FieldOption {\n value: string;\n label: string;\n /** Short description — shown on chips/cards */\n description?: string;\n}\n\nexport interface BaseField {\n /** Display order within the step */\n order: number;\n /** Unique key — maps to DB field name */\n key: string;\n /** Human-readable label */\n label: string;\n /** Field type for form rendering */\n type:\n | 'text'\n | 'textarea'\n | 'number'\n | 'date'\n | 'single_select'\n | 'multi_select'\n | 'object'\n | 'object_array'\n | 'address';\n /** Step number (1-12) this field belongs to */\n step: number;\n /** Whether this field is collected during onboarding */\n isOnboarding: boolean;\n /** If true, can be skipped during onboarding */\n optional?: boolean;\n /** Help text shown below the field */\n description?: string;\n /** Mark as sensitive (shown with privacy notice) */\n sensitive?: boolean;\n /** If set, field only applicable when referenced field has one of the listed values */\n conditionalOn?: { field: string; values: string[] };\n}\n\nexport interface SelectField extends BaseField {\n type: 'single_select';\n options: FieldOption[];\n}\n\nexport interface MultiSelectField extends BaseField {\n type: 'multi_select';\n options: FieldOption[];\n maxSelect?: number;\n}\n\nexport interface TextField extends BaseField {\n type: 'text' | 'textarea';\n maxLength?: number;\n}\n\nexport interface NumberField extends BaseField {\n type: 'number';\n min?: number;\n max?: number;\n}\n\nexport type ProfileField =\n | SelectField\n | MultiSelectField\n | TextField\n | NumberField\n | (BaseField & { type: 'date' | 'object' | 'object_array' | 'address' });\n\nexport interface FieldGroup {\n key: string;\n label: string;\n description?: string;\n step: number;\n fields: ProfileField[];\n}\n"]}
|
|
@@ -4,14 +4,14 @@
|
|
|
4
4
|
* Used by both frontend (stepper UI) and backend (computeStepProgressCounts).
|
|
5
5
|
* Each step lists the curated fields that determine filled/total progress.
|
|
6
6
|
*
|
|
7
|
-
* Dot-paths (e.g., "
|
|
7
|
+
* Dot-paths (e.g., "currentAddress.state") resolve nested subdocument fields.
|
|
8
8
|
* Only these fields count toward progress — extra fields in the schema are ignored.
|
|
9
9
|
*/
|
|
10
10
|
export declare const UDP_PROGRESS_FIELDS: Record<number, readonly string[]>;
|
|
11
11
|
/** Total number of UDP steps */
|
|
12
|
-
export declare const UDP_TOTAL_STEPS =
|
|
12
|
+
export declare const UDP_TOTAL_STEPS = 12;
|
|
13
13
|
/**
|
|
14
|
-
* Resolve a dot-path (e.g., "
|
|
14
|
+
* Resolve a dot-path (e.g., "currentAddress.state") against a data object.
|
|
15
15
|
* Works with both plain objects and Mongoose subdocuments.
|
|
16
16
|
*/
|
|
17
17
|
export declare function getNestedValue(obj: Record<string, unknown>, path: string): unknown;
|
|
@@ -25,4 +25,22 @@ export declare function calculateStepProgress(stepNumber: number, formData: Reco
|
|
|
25
25
|
filled: number;
|
|
26
26
|
total: number;
|
|
27
27
|
};
|
|
28
|
+
/**
|
|
29
|
+
* Calculate overall progress across all steps.
|
|
30
|
+
* Returns per-step breakdown + overall percentage.
|
|
31
|
+
*
|
|
32
|
+
* Mirrors dating-schema's calculateDatingOverallProgress().
|
|
33
|
+
*
|
|
34
|
+
* @param stepData - Map of step number → form data (e.g., { 1: {...}, 2: {...} })
|
|
35
|
+
*/
|
|
36
|
+
export declare function calculateOverallProgress(stepData: Record<number, Record<string, unknown> | undefined | null>): {
|
|
37
|
+
steps: {
|
|
38
|
+
stepNumber: number;
|
|
39
|
+
filled: number;
|
|
40
|
+
total: number;
|
|
41
|
+
}[];
|
|
42
|
+
totalFilled: number;
|
|
43
|
+
totalFields: number;
|
|
44
|
+
percent: number;
|
|
45
|
+
};
|
|
28
46
|
//# sourceMappingURL=progress-fields.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-fields.d.ts","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"progress-fields.d.ts","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CA+GxD,CAAC;AAEX,gCAAgC;AAChC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAYlF;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAcrD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,GACnD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAenC;AAED;;;;;;;GAOG;AACH,wBAAgB,wBAAwB,CACtC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,CAAC,GACnE;IACD,KAAK,EAAE;QAAE,UAAU,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC;IAC/D,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;CACjB,CAeA"}
|
package/dist/progress-fields.js
CHANGED
|
@@ -4,90 +4,49 @@
|
|
|
4
4
|
* Used by both frontend (stepper UI) and backend (computeStepProgressCounts).
|
|
5
5
|
* Each step lists the curated fields that determine filled/total progress.
|
|
6
6
|
*
|
|
7
|
-
* Dot-paths (e.g., "
|
|
7
|
+
* Dot-paths (e.g., "currentAddress.state") resolve nested subdocument fields.
|
|
8
8
|
* Only these fields count toward progress — extra fields in the schema are ignored.
|
|
9
9
|
*/
|
|
10
10
|
export const UDP_PROGRESS_FIELDS = {
|
|
11
11
|
1: [
|
|
12
|
-
'profilePhotoUrl',
|
|
13
|
-
'email',
|
|
14
12
|
'firstName',
|
|
15
|
-
'middleName',
|
|
16
13
|
'lastName',
|
|
17
14
|
'gender',
|
|
18
15
|
'dateOfBirth',
|
|
19
|
-
'
|
|
20
|
-
'assistedByVolunteer',
|
|
16
|
+
'whatsappNumber',
|
|
21
17
|
'primaryLanguage',
|
|
22
18
|
'secondaryLanguages',
|
|
19
|
+
'familyReligion',
|
|
20
|
+
'personalReligion',
|
|
21
|
+
'reservationStatus',
|
|
22
|
+
'minorityStatus',
|
|
23
23
|
],
|
|
24
24
|
2: [
|
|
25
|
-
'
|
|
26
|
-
'
|
|
27
|
-
'
|
|
28
|
-
'
|
|
29
|
-
'
|
|
30
|
-
'socialMedia.linkedin',
|
|
31
|
-
'socialMedia.youtube',
|
|
32
|
-
'emergencyContact.contactName',
|
|
33
|
-
'emergencyContact.contactRelation',
|
|
34
|
-
'emergencyContact.contactPhone',
|
|
25
|
+
'politicalSpectrum',
|
|
26
|
+
'selfPartyAssociation',
|
|
27
|
+
'familyPartyAssociation',
|
|
28
|
+
'publicOfficeAndElections',
|
|
29
|
+
'networkAndCivicEngagement',
|
|
35
30
|
],
|
|
36
31
|
3: [
|
|
37
|
-
'
|
|
38
|
-
'
|
|
39
|
-
'
|
|
40
|
-
'
|
|
41
|
-
'
|
|
42
|
-
'currentAddress.state',
|
|
43
|
-
'currentAddress.division',
|
|
44
|
-
'currentAddress.district',
|
|
45
|
-
'currentAddress.subDistrict',
|
|
46
|
-
'currentAddress.areaType',
|
|
47
|
-
'currentAddress.housePlotDetails',
|
|
48
|
-
'currentAddress.pincode',
|
|
49
|
-
'permanentAddress.state',
|
|
50
|
-
'permanentAddress.division',
|
|
51
|
-
'permanentAddress.district',
|
|
52
|
-
'permanentAddress.subDistrict',
|
|
53
|
-
'permanentAddress.areaType',
|
|
54
|
-
'permanentAddress.housePlotDetails',
|
|
55
|
-
'permanentAddress.pincode',
|
|
32
|
+
'epicNumber',
|
|
33
|
+
'willVoteThisTime',
|
|
34
|
+
'didVoteLastTime',
|
|
35
|
+
'votingFrequency',
|
|
36
|
+
'primaryVotingIssues',
|
|
56
37
|
],
|
|
57
38
|
4: [
|
|
58
|
-
'
|
|
59
|
-
'individualReligion',
|
|
60
|
-
'casteCategoryReservation',
|
|
61
|
-
'minorityStatus',
|
|
62
|
-
'viewOnLgbtqStatements',
|
|
63
|
-
'viewOnTransgenderInclusionStatements',
|
|
64
|
-
],
|
|
65
|
-
5: [
|
|
66
|
-
'desireToBeLeader',
|
|
39
|
+
'participateInRevolution',
|
|
67
40
|
'desiredPoliticalPosition',
|
|
68
|
-
'politicalPartyJoiningIntent',
|
|
69
|
-
'visionChangesYouWillBring',
|
|
70
41
|
'leadershipSkillset',
|
|
71
|
-
'
|
|
72
|
-
'
|
|
73
|
-
'leadershipTrainingInterest',
|
|
74
|
-
'pastLeadershipRoles',
|
|
42
|
+
'politicalExposure',
|
|
43
|
+
'comfortWithVisibility',
|
|
75
44
|
'socialInfluenceLevel',
|
|
76
|
-
'
|
|
45
|
+
'pastExperience',
|
|
46
|
+
'changesYouWantToBring',
|
|
77
47
|
],
|
|
48
|
+
5: ['mbtiType', 'oceanScores'],
|
|
78
49
|
6: [
|
|
79
|
-
'areYouMigrant',
|
|
80
|
-
'maritalStatus',
|
|
81
|
-
'familyStructureType',
|
|
82
|
-
'householdSize',
|
|
83
|
-
'housingType',
|
|
84
|
-
'annualPersonalIncomeRange',
|
|
85
|
-
'annualHouseholdIncomeRange',
|
|
86
|
-
'digitalAccess',
|
|
87
|
-
'digitalSkillLevel',
|
|
88
|
-
'literacyLevel',
|
|
89
|
-
],
|
|
90
|
-
7: [
|
|
91
50
|
'highestQualification',
|
|
92
51
|
'education10th.board',
|
|
93
52
|
'education10th.schoolName',
|
|
@@ -100,47 +59,70 @@ export const UDP_PROGRESS_FIELDS = {
|
|
|
100
59
|
'doctorates',
|
|
101
60
|
'postDoctorates',
|
|
102
61
|
],
|
|
103
|
-
|
|
62
|
+
7: [
|
|
104
63
|
'employmentStatus',
|
|
105
|
-
'
|
|
106
|
-
'
|
|
107
|
-
'
|
|
108
|
-
'
|
|
109
|
-
'
|
|
64
|
+
'occupation',
|
|
65
|
+
'workShift',
|
|
66
|
+
'comfortableWithShift',
|
|
67
|
+
'desiredShift',
|
|
68
|
+
'incomeRange',
|
|
69
|
+
'dreamOccupation',
|
|
70
|
+
],
|
|
71
|
+
8: [
|
|
72
|
+
'neurodiverseIdentity',
|
|
73
|
+
'conditions',
|
|
74
|
+
'sensoryPreferences',
|
|
75
|
+
'learningStyle',
|
|
76
|
+
'communicationPreference',
|
|
77
|
+
'supportNeeds',
|
|
110
78
|
],
|
|
111
79
|
9: [
|
|
112
|
-
'
|
|
113
|
-
'
|
|
114
|
-
'
|
|
115
|
-
'
|
|
80
|
+
'disabilityStatus',
|
|
81
|
+
'generalHealth',
|
|
82
|
+
'healthInsurance',
|
|
83
|
+
'diet',
|
|
84
|
+
'physicalActivity',
|
|
85
|
+
'sleepQuality',
|
|
86
|
+
'substanceUse',
|
|
87
|
+
'stressLevel',
|
|
116
88
|
],
|
|
117
|
-
10: [
|
|
118
|
-
|
|
119
|
-
'
|
|
120
|
-
'
|
|
121
|
-
'
|
|
122
|
-
'
|
|
89
|
+
10: [
|
|
90
|
+
'viewOnAnimalCruelty',
|
|
91
|
+
'viewOnLgbtqStatements',
|
|
92
|
+
'viewOnTransgenderInclusion',
|
|
93
|
+
'facingCasteDiscrimination',
|
|
94
|
+
'casteDiscriminationPlaces',
|
|
95
|
+
'viewOnGenderEquality',
|
|
123
96
|
],
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
'
|
|
127
|
-
'
|
|
128
|
-
'
|
|
129
|
-
'
|
|
130
|
-
'
|
|
131
|
-
'
|
|
97
|
+
11: [
|
|
98
|
+
'currentAddress.state',
|
|
99
|
+
'currentAddress.district',
|
|
100
|
+
'currentAddress.village',
|
|
101
|
+
'permanentAddress.state',
|
|
102
|
+
'permanentAddress.district',
|
|
103
|
+
'permanentAddress.village',
|
|
104
|
+
'homeNativePlace.state',
|
|
105
|
+
'homeNativePlace.district',
|
|
106
|
+
'ancestralPlace.state',
|
|
107
|
+
'ancestralPlace.district',
|
|
132
108
|
],
|
|
133
|
-
|
|
134
|
-
'
|
|
135
|
-
'
|
|
136
|
-
'
|
|
137
|
-
'
|
|
109
|
+
12: [
|
|
110
|
+
'maritalStatus',
|
|
111
|
+
'familyMembers',
|
|
112
|
+
'numberOfDependents',
|
|
113
|
+
'housingType',
|
|
114
|
+
'householdIncome',
|
|
115
|
+
'bplCard',
|
|
116
|
+
'digitalAccess',
|
|
117
|
+
'migrationStatus',
|
|
118
|
+
'landOwnership',
|
|
119
|
+
'primaryIncomeSource',
|
|
138
120
|
],
|
|
139
121
|
};
|
|
140
122
|
/** Total number of UDP steps */
|
|
141
|
-
export const UDP_TOTAL_STEPS =
|
|
123
|
+
export const UDP_TOTAL_STEPS = 12;
|
|
142
124
|
/**
|
|
143
|
-
* Resolve a dot-path (e.g., "
|
|
125
|
+
* Resolve a dot-path (e.g., "currentAddress.state") against a data object.
|
|
144
126
|
* Works with both plain objects and Mongoose subdocuments.
|
|
145
127
|
*/
|
|
146
128
|
export function getNestedValue(obj, path) {
|
|
@@ -194,4 +176,25 @@ export function calculateStepProgress(stepNumber, formData) {
|
|
|
194
176
|
}
|
|
195
177
|
return { filled, total };
|
|
196
178
|
}
|
|
179
|
+
/**
|
|
180
|
+
* Calculate overall progress across all steps.
|
|
181
|
+
* Returns per-step breakdown + overall percentage.
|
|
182
|
+
*
|
|
183
|
+
* Mirrors dating-schema's calculateDatingOverallProgress().
|
|
184
|
+
*
|
|
185
|
+
* @param stepData - Map of step number → form data (e.g., { 1: {...}, 2: {...} })
|
|
186
|
+
*/
|
|
187
|
+
export function calculateOverallProgress(stepData) {
|
|
188
|
+
const steps = [];
|
|
189
|
+
let totalFilled = 0;
|
|
190
|
+
let totalFields = 0;
|
|
191
|
+
for (let stepNumber = 1; stepNumber <= UDP_TOTAL_STEPS; stepNumber++) {
|
|
192
|
+
const { filled, total } = calculateStepProgress(stepNumber, stepData[stepNumber]);
|
|
193
|
+
steps.push({ stepNumber, filled, total });
|
|
194
|
+
totalFilled += filled;
|
|
195
|
+
totalFields += total;
|
|
196
|
+
}
|
|
197
|
+
const percent = totalFields > 0 ? Math.round((totalFilled / totalFields) * 100) : 0;
|
|
198
|
+
return { steps, totalFilled, totalFields, percent };
|
|
199
|
+
}
|
|
197
200
|
//# sourceMappingURL=progress-fields.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-fields.js","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAsC;IACpE,CAAC,EAAE;QACD,
|
|
1
|
+
{"version":3,"file":"progress-fields.js","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAsC;IACpE,CAAC,EAAE;QACD,WAAW;QACX,UAAU;QACV,QAAQ;QACR,aAAa;QACb,gBAAgB;QAChB,iBAAiB;QACjB,oBAAoB;QACpB,gBAAgB;QAChB,kBAAkB;QAClB,mBAAmB;QACnB,gBAAgB;KACjB;IACD,CAAC,EAAE;QACD,mBAAmB;QACnB,sBAAsB;QACtB,wBAAwB;QACxB,0BAA0B;QAC1B,2BAA2B;KAC5B;IACD,CAAC,EAAE;QACD,YAAY;QACZ,kBAAkB;QAClB,iBAAiB;QACjB,iBAAiB;QACjB,qBAAqB;KACtB;IACD,CAAC,EAAE;QACD,yBAAyB;QACzB,0BAA0B;QAC1B,oBAAoB;QACpB,mBAAmB;QACnB,uBAAuB;QACvB,sBAAsB;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,WAAW,EAAE,WAAW,EAAE,OAAO,EAAE,CAAC;AACtD,CAAC","sourcesContent":["/**\n * UDP Progress Fields — Single source of truth for step progress counting.\n *\n * Used by both frontend (stepper UI) and backend (computeStepProgressCounts).\n * Each step lists the curated fields that determine filled/total progress.\n *\n * Dot-paths (e.g., \"currentAddress.state\") resolve nested subdocument fields.\n * Only these fields count toward progress — extra fields in the schema are ignored.\n */\n\nexport const UDP_PROGRESS_FIELDS: Record<number, readonly string[]> = {\n 1: [\n 'firstName',\n 'lastName',\n 'gender',\n 'dateOfBirth',\n 'whatsappNumber',\n 'primaryLanguage',\n 'secondaryLanguages',\n 'familyReligion',\n 'personalReligion',\n 'reservationStatus',\n 'minorityStatus',\n ],\n 2: [\n 'politicalSpectrum',\n 'selfPartyAssociation',\n 'familyPartyAssociation',\n 'publicOfficeAndElections',\n 'networkAndCivicEngagement',\n ],\n 3: [\n 'epicNumber',\n 'willVoteThisTime',\n 'didVoteLastTime',\n 'votingFrequency',\n 'primaryVotingIssues',\n ],\n 4: [\n 'participateInRevolution',\n 'desiredPoliticalPosition',\n 'leadershipSkillset',\n 'politicalExposure',\n 'comfortWithVisibility',\n 'socialInfluenceLevel',\n 'pastExperience',\n 'changesYouWantToBring',\n ],\n 5: ['mbtiType', 'oceanScores'],\n 6: [\n 'highestQualification',\n 'education10th.board',\n 'education10th.schoolName',\n 'education10th.yearOfPassing',\n 'education12th.institutionName',\n 'education12th.yearOfPassing',\n 'diplomas',\n 'graduations',\n 'postGraduations',\n 'doctorates',\n 'postDoctorates',\n ],\n 7: [\n 'employmentStatus',\n 'occupation',\n 'workShift',\n 'comfortableWithShift',\n 'desiredShift',\n 'incomeRange',\n 'dreamOccupation',\n ],\n 8: [\n 'neurodiverseIdentity',\n 'conditions',\n 'sensoryPreferences',\n 'learningStyle',\n 'communicationPreference',\n 'supportNeeds',\n ],\n 9: [\n 'disabilityStatus',\n 'generalHealth',\n 'healthInsurance',\n 'diet',\n 'physicalActivity',\n 'sleepQuality',\n 'substanceUse',\n 'stressLevel',\n ],\n 10: [\n 'viewOnAnimalCruelty',\n 'viewOnLgbtqStatements',\n 'viewOnTransgenderInclusion',\n 'facingCasteDiscrimination',\n 'casteDiscriminationPlaces',\n 'viewOnGenderEquality',\n ],\n 11: [\n 'currentAddress.state',\n 'currentAddress.district',\n 'currentAddress.village',\n 'permanentAddress.state',\n 'permanentAddress.district',\n 'permanentAddress.village',\n 'homeNativePlace.state',\n 'homeNativePlace.district',\n 'ancestralPlace.state',\n 'ancestralPlace.district',\n ],\n 12: [\n 'maritalStatus',\n 'familyMembers',\n 'numberOfDependents',\n 'housingType',\n 'householdIncome',\n 'bplCard',\n 'digitalAccess',\n 'migrationStatus',\n 'landOwnership',\n 'primaryIncomeSource',\n ],\n} as const;\n\n/** Total number of UDP steps */\nexport const UDP_TOTAL_STEPS = 12;\n\n/**\n * Resolve a dot-path (e.g., \"currentAddress.state\") against a data object.\n * Works with both plain objects and Mongoose subdocuments.\n */\nexport function getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split('.');\n let current: unknown = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== 'object') {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n\n return current;\n}\n\n/** Determine if a field value counts as \"filled\" for progress */\nexport function isFieldFilled(value: unknown): boolean {\n if (value === null || value === undefined) return false;\n if (typeof value === 'string') return value.trim().length > 0;\n if (typeof value === 'number') return true;\n if (typeof value === 'boolean') return true;\n if (Array.isArray(value)) return value.length > 0;\n if (typeof value === 'object') {\n // Area entity ref - check for name\n if ('name' in value && typeof (value as Record<string, unknown>).name === 'string') {\n return (value as Record<string, unknown>).name !== '';\n }\n return Object.keys(value).length > 0;\n }\n return false;\n}\n\n/**\n * Calculate progress for a single step.\n * Shared between frontend (stepper UI) and backend (API response).\n */\nexport function calculateStepProgress(\n stepNumber: number,\n formData: Record<string, unknown> | undefined | null,\n): { filled: number; total: number } {\n const fields = UDP_PROGRESS_FIELDS[stepNumber];\n if (!fields) return { filled: 0, total: 0 };\n\n const total = fields.length;\n if (!formData || total === 0) return { filled: 0, total };\n\n let filled = 0;\n for (const fieldPath of fields) {\n if (isFieldFilled(getNestedValue(formData, fieldPath))) {\n filled++;\n }\n }\n\n return { filled, total };\n}\n\n/**\n * Calculate overall progress across all steps.\n * Returns per-step breakdown + overall percentage.\n *\n * Mirrors dating-schema's calculateDatingOverallProgress().\n *\n * @param stepData - Map of step number → form data (e.g., { 1: {...}, 2: {...} })\n */\nexport function calculateOverallProgress(\n stepData: Record<number, Record<string, unknown> | undefined | null>,\n): {\n steps: { stepNumber: number; filled: number; total: number }[];\n totalFilled: number;\n totalFields: number;\n percent: number;\n} {\n const steps: { stepNumber: number; filled: number; total: number }[] = [];\n let totalFilled = 0;\n let totalFields = 0;\n\n for (let stepNumber = 1; stepNumber <= UDP_TOTAL_STEPS; stepNumber++) {\n const { filled, total } = calculateStepProgress(stepNumber, stepData[stepNumber]);\n steps.push({ stepNumber, filled, total });\n totalFilled += filled;\n totalFields += total;\n }\n\n const percent = totalFields > 0 ? Math.round((totalFilled / totalFields) * 100) : 0;\n\n return { steps, totalFilled, totalFields, percent };\n}\n"]}
|