forked from openedx/frontend-app-authn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: add personalized recommendations (openedx#1024) * use Algolia for personalized recommendations * show personalized recommendations to use that have consented to functional cookies * update tests VAN-1599 * Revert "fix: special characters in redirect url getting decoded to space (openedx#1029)" (openedx#1030) This reverts commit fc62241. * feat: update recommendations page design (openedx#1036) VAN-1598 * feat: add events for recommendations (openedx#1039) * feat: remove static recommendations --------- Co-authored-by: Syed Sajjad Hussain Shah <52817156+syedsajjadkazmii@users.noreply.github.com>
- Loading branch information
Showing
34 changed files
with
1,200 additions
and
348 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { getConfig } from '@edx/frontend-platform'; | ||
import algoliasearch from 'algoliasearch'; | ||
|
||
// initialize Algolia workers | ||
const initializeSearchClient = () => algoliasearch( | ||
getConfig().ALGOLIA_APP_ID, | ||
getConfig().ALGOLIA_SEARCH_API_KEY, | ||
); | ||
|
||
const getLocationRestrictionFilter = (userCountry) => { | ||
if (userCountry) { | ||
return `NOT blocked_in:"${userCountry}" AND (allowed_in:"null" OR allowed_in:"${userCountry}")`; | ||
} | ||
return ''; | ||
}; | ||
|
||
export { | ||
initializeSearchClient, | ||
getLocationRestrictionFilter, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
const isOneTrustFunctionalCookieEnabled = () => !!window?.OnetrustActiveGroups?.includes('C0003'); | ||
|
||
export default isOneTrustFunctionalCookieEnabled; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { getLocationRestrictionFilter } from '../algolia'; | ||
|
||
describe('algoliaUtilsTests', () => { | ||
it('test getLocationRestrictionFilter returns filter if country is passed', () => { | ||
const countryCode = 'PK'; | ||
const filter = getLocationRestrictionFilter(countryCode); | ||
const expectedFilter = `NOT blocked_in:"${countryCode}" AND (allowed_in:"null" OR allowed_in:"${countryCode}")`; | ||
expect(filter).toEqual(expectedFilter); | ||
}); | ||
it('test getLocationRestrictionFilter returns empty string if country is not passed', () => { | ||
const countryCode = ''; | ||
const filter = getLocationRestrictionFilter(countryCode); | ||
const expectedFilter = ''; | ||
expect(filter).toEqual(expectedFilter); | ||
}); | ||
}); |
2 changes: 1 addition & 1 deletion
2
src/data/utils/dataUtils.test.js → src/data/tests/dataUtils.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.