Merge pull request #1177 from Safelite/feature/skiener/INSR-2124-Remove-Conditional

INSR-2124 | Remove conditional env logic
This commit is contained in:
scottkiener-at-safelite 2026-04-13 13:43:38 -04:00 committed by GitHub
commit f018b614b7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 12 additions and 60 deletions

View file

@ -1,5 +1,3 @@
import applicationConfig from './application-config';
const ACCOUNT_BASE_URL = '/account/api/v1/account';
const ANALYTICS_BASE_URL = '/analytics/api/v1/analytics';
const CLIENT_AUTH_BASE_URL = '/clientauth/api/v1/clientauth';
@ -9,18 +7,11 @@ const EXPERIMENTS_BASE_URL = '/experiments/api/v1/experiments';
const LOCATION_BASE_URL = '/location/api/v1/location';
const ORDER_BASE_URL = '/order/api/v1/order';
const PARTS_BASE_URL = '/parts/api/v2/parts';
const PARTS_V1_BASE_URL = '/parts/api/v1/parts';
const PRICE_BASE_URL = '/price/api/v1/price';
const SCHEDULE_BASE_URL = '/schedule/api/v1/schedule';
const VEHICLE_BASE_URL = '/vehicle/api/v1/vehicle';
const PAYMENT_BASE_URL = '/payment/api/v1/payment';
const isLocalOrDev = (() => {
const currentEnv = (applicationConfig?.CURRENT_ENVIRONMENT || '').toLowerCase();
return currentEnv === 'localhost' || currentEnv === 'dev';
})();
const PARTS_EFFECTIVE_BASE_URL = isLocalOrDev ? PARTS_BASE_URL : PARTS_V1_BASE_URL;
const endpoints = Object.freeze({
GetRouteInfo: {
url: (applicationAbbreviation) => `${CONTENT_BASE_URL}/${applicationAbbreviation}/RouteInfo`,
@ -51,7 +42,7 @@ const endpoints = Object.freeze({
method: 'POST'
},
GetMobilePremiumFee: {
url: `${PARTS_EFFECTIVE_BASE_URL}/mobile-premium-fee`,
url: `${PARTS_BASE_URL}/mobile-premium-fee`,
method: 'GET'
},
GetVehicleYears: {
@ -71,15 +62,15 @@ const endpoints = Object.freeze({
method: 'GET'
},
GetDamageOptions: {
url: `${PARTS_EFFECTIVE_BASE_URL}/damage-options`,
url: `${PARTS_BASE_URL}/damage-options`,
method: 'GET'
},
GetPartsOrQuestions: {
url: `${PARTS_EFFECTIVE_BASE_URL}/parts-or-questions`,
url: `${PARTS_BASE_URL}/parts-or-questions`,
method: 'POST'
},
GetParts: {
url: `${PARTS_EFFECTIVE_BASE_URL}/parts`,
url: `${PARTS_BASE_URL}/parts`,
method: 'POST'
},
GetITACPriceOrderItems: {
@ -108,19 +99,19 @@ const endpoints = Object.freeze({
method: 'GET'
},
GetCapabilityQuestions: {
url: `${PARTS_EFFECTIVE_BASE_URL}/capability-questions`,
url: `${PARTS_BASE_URL}/capability-questions`,
method: 'GET'
},
GetPartFromCapabilityAnswer: {
url: `${PARTS_EFFECTIVE_BASE_URL}/part-from-capability-answer`,
url: `${PARTS_BASE_URL}/part-from-capability-answer`,
method: 'POST'
},
GetWipers: {
url: `${PARTS_EFFECTIVE_BASE_URL}/wipers`,
url: `${PARTS_BASE_URL}/wipers`,
method: 'GET'
},
GetRainDefense: {
url: `${PARTS_EFFECTIVE_BASE_URL}/rain-repel`,
url: `${PARTS_BASE_URL}/rain-repel`,
method: 'GET'
},
GetRecalParts: {
@ -132,19 +123,19 @@ const endpoints = Object.freeze({
zipCode,
applicationName,
referralSequenceNumber
) => `${PARTS_EFFECTIVE_BASE_URL}/recal-parts/${carId}/${partNumber}/${recalibrationType}/${parentAccountNumber}/${zipCode}/${applicationName}/${referralSequenceNumber}`,
) => `${PARTS_BASE_URL}/recal-parts/${carId}/${partNumber}/${recalibrationType}/${parentAccountNumber}/${zipCode}/${applicationName}/${referralSequenceNumber}`,
method: 'GET'
},
GetGlassFees: {
url: `${PARTS_EFFECTIVE_BASE_URL}/glass-fees`,
url: `${PARTS_BASE_URL}/glass-fees`,
method: 'GET'
},
GetSupportingItems: {
url: `${PARTS_EFFECTIVE_BASE_URL}/supporting-items`,
url: `${PARTS_BASE_URL}/supporting-items`,
method: 'POST'
},
GetMobileFeePart: {
url: `${PARTS_EFFECTIVE_BASE_URL}/mobile-fee`,
url: `${PARTS_BASE_URL}/mobile-fee`,
method: 'GET'
},
GetServiceabilityDetails: {

View file

@ -1349,45 +1349,6 @@ export const useMainStore = defineStore({
});
},
getServiceabilityDetails(serviceZipCode) {
console.log('BEEP BOOP');
console.log('--ENVIRONMENT DETECTOR ROBOT ENGAGED--');
const currentEnvironment = applicationConfig.CURRENT_ENVIRONMENT;
console.log('I HAVE DETERMINED THAT THE CURRENT ENVIRONMENT IS:', currentEnvironment);
console.log('---');
console.log('---');
if (currentEnvironment === 'Localhost' || currentEnvironment === 'Dev') {
console.log('NEW SERVICEABILITY DETAILS METHOD ACTIVATED');
return this.getServiceabilityDetailsNewMethod(serviceZipCode);
} else {
console.log('OLD SERVICEABILITY DETAILS METHOD ACTIVATED');
return this.getServiceabilityDetailsOldMethod(serviceZipCode);
}
},
getServiceabilityDetailsOldMethod(serviceZipCode) {
const { vehicle, damage, parentAccountNumber, referralSequenceNumber, lineItems } = this.order;
const { carId } = vehicle;
const glassArray = convertGlassPieceNamingForApi(damage.glassToReplace);
const lineItemParts = [...(lineItems.glassParts || []), ...(lineItems.supportingItems || [])].map((part) => ({
partNumber: part.partNumber,
recalibrationType: part.recalibrationType
}));
const params = buildURLSearchParams({
applicationName: applicationConfig.APPLICATION_NAME,
parentAccountNumber,
referralSequenceNumber,
zip: serviceZipCode,
carId,
glassPieces: glassArray,
lineItems: lineItemParts
});
return globalMethods.callHttpClient({
method: endpoints.GetServiceabilityDetails.method,
endpoint: `${endpoints.GetServiceabilityDetails.url}?${params.toString()}`
});
},
getServiceabilityDetailsNewMethod(serviceZipCode) {
const { damage, lineItems, parentAccountNumber, vehicle } = this.order;
const { carId } = vehicle;
const flattenedGlassParts = getLineItemsFlattened(lineItems.glassParts);