-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #95 from wednesday-solutions/feat/eslint-and-growt…
…hbook Eslint fixes, dotenv and growthbook
- Loading branch information
Showing
18 changed files
with
370 additions
and
23 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
JSON_PLACEHOLDER_API="https://jsonplaceholder.typicode.com" | ||
SIMPSONS_API="https://thesimpsonsquoteapi.glitch.me/" | ||
SENTRY_DSN= "https://0fbf25b4bfb443b7ae58aa4baf34460e@o4505374929584128.ingest.us.sentry.io/4505374931812352" |
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 |
---|---|---|
|
@@ -62,4 +62,5 @@ buck-out/ | |
web-build/ | ||
dist/ | ||
reports | ||
coverage | ||
coverage | ||
.env.local |
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,7 @@ | ||
|
||
auth.token=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 | ||
|
||
defaults.org=wednesday-solutions-5p | ||
defaults.project=react-native | ||
|
||
defaults.url=https://sentry.io/ |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { JSON_PLACEHOLDER_API } from '@env'; | ||
|
||
export const Config = { | ||
API_URL: 'https://jsonplaceholder.typicode.com/users/' | ||
API_URL: `${JSON_PLACEHOLDER_API}/users/` | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { SIMPSONS_API } from '@env'; | ||
|
||
export const Config = { | ||
API_URL: 'https://thesimpsonsquoteapi.glitch.me/' | ||
API_URL: SIMPSONS_API | ||
}; |
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 |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { JSON_PLACEHOLDER_API } from '@env'; | ||
|
||
export const Config = { | ||
API_URL: 'https://jsonplaceholder.typicode.com/users/' | ||
API_URL: `${JSON_PLACEHOLDER_API}/users/` | ||
}; |
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,64 @@ | ||
import { GrowthBook } from '@growthbook/growthbook'; | ||
import { GROWTH_BOOK_API_HOST, GROWTH_BOOK_CLIENT_KEY } from '@env'; | ||
|
||
let growthBookClient; | ||
|
||
/** | ||
* creates an instance of the growthBook client | ||
* @returns growthBook client | ||
*/ | ||
export const createGrowthBookClient = userEmail => { | ||
const growthBook = new GrowthBook({ | ||
apiHost: GROWTH_BOOK_API_HOST, | ||
clientKey: GROWTH_BOOK_CLIENT_KEY, | ||
enableDevMode: true, | ||
subscribeToChanges: true | ||
}); | ||
|
||
growthBook.setAttributes({ | ||
email: userEmail | ||
}); | ||
|
||
return growthBook; | ||
}; | ||
|
||
/** | ||
* Function to get the GrowthBook client instance | ||
* @returns {GrowthBook} growthBook instance | ||
*/ | ||
export function getGrowthBookClient(email) { | ||
if (growthBookClient) { | ||
return growthBookClient; | ||
} | ||
return createGrowthBookClient(email); | ||
} | ||
|
||
/** | ||
* Function to get growthBook feature | ||
* @param {String} email | ||
* @returns {Applicant} growthBook feature value | ||
*/ | ||
export async function getGrowthBookFeaturesData(name, email) { | ||
try { | ||
const growthBook = getGrowthBookClient(email); | ||
await growthBook.loadFeatures(); | ||
return growthBook.getFeatureValue(name); | ||
} catch (error) { | ||
return new Error(error); | ||
} | ||
} | ||
|
||
/** | ||
* Function to get growthBook feature | ||
* @param {String} name | ||
* @returns {Boolean} growthBook feature status | ||
*/ | ||
export async function getGrowthBookFeatureFlag(name, email) { | ||
try { | ||
const growthBook = getGrowthBookClient(email); | ||
await growthBook.loadFeatures(); | ||
return growthBook.isOn(name); | ||
} catch (error) { | ||
return new Error(error); | ||
} | ||
} |
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
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,7 @@ | ||
|
||
auth.token=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 | ||
|
||
defaults.org=wednesday-solutions-5p | ||
defaults.project=react-native | ||
|
||
defaults.url=https://sentry.io/ |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
// Learn more https://docs.expo.io/guides/customizing-metro | ||
const { getDefaultConfig } = require('@expo/metro-config'); | ||
const { getSentryExpoConfig } = require('@sentry/react-native/metro'); | ||
|
||
// eslint-disable-next-line fp/no-mutation | ||
module.exports = getDefaultConfig(__dirname); | ||
module.exports = getSentryExpoConfig(__dirname); |
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.