{"version":3,"file":"index.BmSBbjs0.js","sources":["../../../../../../src/lib/utils/courses/cfu-courses/index.ts"],"sourcesContent":["// Mapping that pairs productCodes of CFU courses with productCodes of courses without CFUs\n// Note: This is a manual mapping, and will need to be updated if the CFU course list changes\n\n// Key: CFU course productCode\n// Value: Course productCode without CFUs\nconst coursesMap: { [key: string]: string } = {\n 'OZ23002400': 'OZ23010900',\n 'OZ22012000': 'OZ23003200',\n 'OZ23007200': 'OZ23009500',\n 'OZ23007800': 'OZ23008200',\n 'OZ23009700': 'OZ23008000',\n 'LZ23009600': 'LZ24004300',\n 'LZ24002700': 'LZ24002600'\n};\n\n// Add cookie to the browser with the choosen\nexport const setCFUCookie = (value: 'with' | 'without'): void => {\n if (value === 'with') {\n document.cookie = 'cfu=with; path=/';\n } else {\n document.cookie = 'cfu=without; path=/';\n }\n}\n\nexport const getCFUCookie = (): 'with' | 'without' | null => {\n const decodedCookie = decodeURIComponent(document.cookie);\n const ca = decodedCookie.split(';');\n for (let i = 0; i < ca.length; i++) {\n let c = ca[i].trim();\n if (c.indexOf('cfu=') === 0) {\n return c.substring('cfu='.length, c.length) as 'with' | 'without';\n }\n }\n return null;\n}\n\n// Returns the productCode of the course without CFUs given the productCode of the CFU course\nexport const getCourseWithoutCFUs = (productCode: string): string | null => {\n // return null if the productCode is not in the map\n if (!Object.keys(coursesMap).includes(productCode)) {\n return null;\n }\n return coursesMap[productCode];\n};\n\n// Returns the productCode of the course without CFUs given the productCode of the CFU course\nexport const getCourseWithCFUs = (productCode: string): string | null => {\n // return null if the productCode is not in the map\n if (!Object.values(coursesMap).includes(productCode)) {\n return null;\n }\n return Object.keys(coursesMap).find(key => coursesMap[key] === productCode);\n};\n\n// Returns true if the course is in the map\nexport const courseHasCFUCourse = (productCode: string): boolean => {\n return Object.keys(coursesMap).includes(productCode) || Object.values(coursesMap).includes(productCode);\n};\n\n// Returns true if is CFU course\nexport const isCFUCourse = (productCode: string): boolean => {\n return Object.keys(coursesMap).includes(productCode);\n};\n\n"],"names":["coursesMap","getCourseWithoutCFUs","productCode","getCourseWithCFUs","key","courseHasCFUCourse","isCFUCourse"],"mappings":"AAKA,MAAMA,EAAwC,CAC5C,WAAc,aACd,WAAc,aACd,WAAc,aACd,WAAc,aACd,WAAc,aACd,WAAc,aACd,WAAc,YAChB,EAwBaC,EAAwBC,GAE9B,OAAO,KAAKF,CAAU,EAAE,SAASE,CAAW,EAG1CF,EAAWE,CAAW,EAFpB,KAMEC,EAAqBD,GAE3B,OAAO,OAAOF,CAAU,EAAE,SAASE,CAAW,EAG5C,OAAO,KAAKF,CAAU,EAAE,KAAYI,GAAAJ,EAAWI,CAAG,IAAMF,CAAW,EAFjE,KAMEG,EAAsBH,GAC1B,OAAO,KAAKF,CAAU,EAAE,SAASE,CAAW,GAAK,OAAO,OAAOF,CAAU,EAAE,SAASE,CAAW,EAI3FI,EAAeJ,GACnB,OAAO,KAAKF,CAAU,EAAE,SAASE,CAAW"}