const USER_ENTRY_EVENT = 'User Entry'; const ENABLE_PASSAGE_MODE = 'Enable Passage Mode by Group 2'; const DISABLE_PASSAGE_MODE = 'Disable Passage Mode by Group 2'; const VALID_CSV_HEADERS = ['Date', 'Time', 'User No', 'Name', 'Event']; const doorLockEvents = { USER_LOCKED: 'locked', USER_UNLOCKED: 'unlocked', }; const unlockedIncidentLevelsPrices = { UNLOCKED_0: { id: 0, title: 'UNLOCKED_0', price: parseInt(process.env.UNLOCK_0) || 0, description: 'first month - warning', }, UNLOCKED_1: { id: 1, title: 'UNLOCKED_1', price: parseInt(process.env.UNLOCK_1) || 10, description: 'second month', }, UNLOCKED_2: { id: 2, title: 'UNLOCKED_2', price: parseInt(process.env.UNLOCK_2) || 20, description: 'third month', }, UNLOCKED_3: { id: 3, title: 'UNLOCKED_3', price: parseInt(process.env.UNLOCK_3) || 30, description: 'fourth month', }, UNLOCKED_4: { id: 4, title: 'UNLOCKED_4', price: parseInt(process.env.UNLOCK_4) || 40, description: 'fifth month', }, UNLOCKED_5: { id: 5, title: 'UNLOCKED_5', price: parseInt(process.env.UNLOCK_5) || 50, description: 'sixth month and onward', } }; const csvParserErrors = { INVALID_HEADERS: 'Invalid headers', INVALID_ENTRY_EXPECTED_USER: 'Invalid entry type. Expected user entry type', INVALID_ENTRY_EXPECTED_PASSAGE_MODE: 'Invalid entry type. Expected enable/disable passage mode following user entry', UNKNOWN_MEMBER: 'Member is not registered in OfficeRnD system', GENERIC_ERROR: 'There was error while parsing uploaded file(s)', }; const officeRnDAPIErrors = { FAILED_TO_FETCH_MEMBERS: 'Failed to fetch members', FAILED_TO_FETCH_BOOKINGS: 'Failed to fetch booking reservations', FAILED_TO_CREATE_BOOKINGS: 'Failed to create booking reservations', FAILED_TO_DELETE_BOOKINGS: 'Failed to delete booking reservations', FAILED_TO_FETCH_FEES: 'Failed to fetch existing fees from ORD', FAILED_TO_FETCH_PLANS: 'Failed to fetch plans from ORD', FAILED_TO_DELETE_FEES: 'Failed to delete fees in ORD', FAILED_TO_ADD_FEES: 'Failed to add fees in ORD', MEMBERSHIPS_ARE_NOT_LOADED_CORRECTLY: 'Memberships are not loaded correctly', OAUTH_FAILED: 'Failed to fetch new OAUTH token', FAILED_TO_FETCH_DATA: 'Failed to fetch data from ORD. Please try again in a few minutes', FAILED_TO_FETCH_RESOURCES: 'Failed to fetch resources data from ORD', FAILED_TO_FETCH_RATES: 'Failed to fetch rates data from ORD', FAILED_TO_UPDATE_MEMBERSHIP: 'Failed to update membership in ORD' }; const integrationServiceErrors = { PROCESSING_TRY_AGAIN: 'Incident calculations are in progress. Please try again in a few minutes', IMPORT_SUCCESSFUL_CALCULATION_FAILED: 'Import succeeded but fetching reservations and calculating charges failed', FAILED_TO_SAVE_BOOKINGS: 'Failed to save booking reservations', FAILED_TO_SAVE_DOOR_LOCK_ENTRIES: 'Failed to save door lock entries', FAILED_TO_SAVE_DATA_GENERIC: 'Failed to save data', INVALID_DATE_RANGE: 'Dates in date range are invalid', FAILED_TO_GENERATE_MEMBER_PRACTICE_SUMMARY: 'Failed to generate Member Practice Summary', ERRORS_IN_MEMBER_PRACTICE_SUMMARY_REPORT: 'Member Practice Summary Report is generated but there were some errors and report may be incomplete', EXPECTED_MEMBER_IDS_ARRAY: 'Expected array of member IDs', SENDING_FEES_DISABLED: 'Sending fees is disabled for current and future months', MONTH_MISSING: 'Missing month selection for sending fees to ORD', }; const incidentType = { NOT_AN_INCIDENT: 1, UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION: 2, UNSCHEDULED_INCIDENT_BEFORE_RESERVATION: 3, UNSCHEDULED_INCIDENT_AFTER_RESERVATION: 4, UNLOCKED_INCIDENT_STANDALONE: 5, UNSCHEDULED_INCIDENT_STANDALONE: 6, BOOKING_MOVED_TO_ANOTHER_DAY: 7, BOOKING_SHORTENED: 8, BOOKING_CANCELED_LATE: 9, }; const incidentTypeExplanations = {}; incidentTypeExplanations[incidentType.UNLOCKED_INCIDENT_RELATED_WITH_RESERVATION] = 'door left unlocked'; incidentTypeExplanations[incidentType.UNLOCKED_INCIDENT_STANDALONE] = 'door left unlocked'; incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_BEFORE_RESERVATION] = 'room used before reservation'; incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_AFTER_RESERVATION] = 'room used after reservation'; incidentTypeExplanations[incidentType.UNSCHEDULED_INCIDENT_STANDALONE] = 'room used without reservation'; incidentTypeExplanations[incidentType.BOOKING_MOVED_TO_ANOTHER_DAY] = 'reservation moved to another day in less than 24 hrs'; incidentTypeExplanations[incidentType.BOOKING_SHORTENED] = 'reservation shortened after grace period'; incidentTypeExplanations[incidentType.BOOKING_CANCELED_LATE] = 'reservation cancelled after grace period'; const UI_TIMEZONE = process.env.UI_TIMEZONE || 'America/Los_Angeles'; const DEFAULT_DATE_FORMAT = 'YYYY-MM-DD'; const MAX_BACK_TO_BACK_DIFFERENCE = parseInt(process.env.MAX_BACK_TO_BACK_DIFFERENCE) || 0; const UNSCHEDULED_USE_INITIAL_TIME_SEGMENT_LENGTH = parseInt(process.env.UNSCHEDULED_USE_INITIAL_TIME_SEGMENT_LENGTH) || 7; const UNSCHEDULED_TIME_RESOLUTION = parseInt(process.env.UNSCHEDULED_USE_TIME_RESOLUTION) || 5; const UNSCHEDULED_CHARGE_PRICE = parseFloat(process.env.UNSCHEDULED_USE_CHARGE_PRICE) || 5; const BOOKING_CHANGE_PERCENTAGE_CHARGE = parseInt(process.env.BOOKING_CHANGE_PERCENTAGE_CHARGE) || 100; const CHARGE_BOOKING_CHANGE_UNDER_TIME = parseInt(process.env.CHARGE_BOOKING_CHANGE_UNDER_TIME) || 1430; const ALLOWED_BOOKING_CANCELLATION_TIME = parseInt(process.env.ALLOWED_BOOKING_CANCELLATION_TIME) || 30; const discounts = { LEVEL_1:{ hoursRequired: parseInt(process.env.DISCOUNT_LEVEL_1_HOURS) || 10, percentage: parseInt(process.env.DISCOUNT_LEVEL_1_PERCENTAGE) || 5, }, LEVEL_2:{ hoursRequired: parseInt(process.env.DISCOUNT_LEVEL_2_HOURS) || 40, percentage: parseInt(process.env.DISCOUNT_LEVEL_2_PERCENTAGE) || 10, } }; const DISCOUNT_PLANS = process.env.DISCOUNT_PLANS.split(',').map(planName => planName.trim()) || []; const CUSTOM_FEES_PREFIXES = process.env.CUSTOM_FEES_PREFIXES.split(',') .map(prefix => prefix.trim()) .filter(prefix => prefix && prefix.length ? prefix.length > 0 : false) || []; const UNPAID_FEE_STATUS = 'not_paid'; const ALLOW_SENDING_FEES = parseInt(process.env.ALLOW_SENDING_FEES_FOR_CURRENT_AND_FUTURE_MONTHS) ? true : false; const TRIM_DLOCK_NAMES_LENGTH = parseInt(process.env.TRIM_DLOCK_NAMES_LENGTH) || 22; module.exports = { VALID_CSV_HEADERS, USER_ENTRY_EVENT, ENABLE_PASSAGE_MODE, DISABLE_PASSAGE_MODE, csvParserErrors, officeRnDAPIErrors, doorLockEvents, unlockedIncidentLevelsPrices, integrationServiceErrors, incidentType, incidentTypeExplanations, UI_TIMEZONE, DEFAULT_DATE_FORMAT, MAX_BACK_TO_BACK_DIFFERENCE, UNSCHEDULED_USE_INITIAL_TIME_SEGMENT_LENGTH, UNSCHEDULED_TIME_RESOLUTION, UNSCHEDULED_CHARGE_PRICE, BOOKING_CHANGE_PERCENTAGE_CHARGE, CHARGE_BOOKING_CHANGE_UNDER_TIME, ALLOWED_BOOKING_CANCELLATION_TIME, discounts, DISCOUNT_PLANS, UNPAID_FEE_STATUS, CUSTOM_FEES_PREFIXES, ALLOW_SENDING_FEES, TRIM_DLOCK_NAMES_LENGTH };