-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat/MSSDK-1993: Google Recaptcha integration (#448)
* Feat/MSSDK-2048: Add Google reCAPTCHA into Register flow (#443) * feat/MSSDK-2048: Add google recaptcha into Register flow * feat/MSSDK-2048: Changes after CR * [Feat/MSSDK-2050]: Add configuration method (#444) * feat/MSSDK-2048: Add google recaptcha into Register flow * feat/MSSDK-2048: Changes after CR * feat/MSSDK-2050: Add configuration method for Google reCAPTCHA * feat/MSSDK-2050: Fix sonarcube error * feat/MSSDK-2050: Remove logging * fix/MSSDK-2050: fix the ReCaptcha not being triggered (#445) * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * chore/MSSDK-2050: add debugging logs for recaptcha in register form * fix/MSSDK-2050: commit cleaned up code with the final fix * chore/MSSDK-2050: add debugging logs * chore/MSSDK-2050: add debugging logs * chore/MSSDK-2050: add debugging logs * chore/MSSDK-2050: add debugging logs * chore/MSSDK-2050: add debugging logs * chore/MSSDK-2050: add debugging logs * chore/MSSDK-2050: add debugging logs * chore/MSSDK-2050: clean up code for code review * chore/MSSDK-2050: recreate pnpm-lock * chore/MSSDK-2050: remove the isolated prop - needs confirmation if we would like to use this * feat/MSSDK-2049: captcha challenge in purchase flow (#447) * feat/MSSDK-2049: captcha challenge in purchase flow * feat/MSSDK-2049: add missing prepare script * feat/MSSDK-2049: fix deprecated husky command * feat/MSSDK-2049: fix deprecated husky command * feat/MSSDK-2049: add unit tests for the new recaptcha hook * feat/MSSDK-2112: Add errors for google recaptcha (#452) * feat/MSSDK-2112: Add errors for google recaptcha * feat/MSSDK-2112: Update after CR * fix/MSSDK-2112: Fix behaviour if challange called (#453) * fix/MSSDK-2133: Fix invalid token error nad small refactor (#459) * [chore/MSSDK-2051]: Update readme with info about Google reCAPTCHA (#468) * chore/MSSDK-2051: Update readme with info about Google reCAPTCHA config method * chore/MSSDK-2051: Update link to docs * chore/MSSDK-2051: Update readme with optional values * feat/MSSDK-1993: empty commit to bump GH actions --------- Co-authored-by: Paweł Kaczmarek <[email protected]>
- Loading branch information
Showing
22 changed files
with
862 additions
and
282 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 |
---|---|---|
@@ -1 +1,2 @@ | ||
VITE_MEDIASTORE_SDK_VERSION=$npm_package_version | ||
VITE_RECAPTCHA_SITE_KEY="6Ld0A54qAAAAANJ8mLCpJAxEp0XKtJyueFmEFVaG" |
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { fetchWithHeaders } from 'util/fetchHelper'; | ||
import getApiURL from 'util/environmentHelper'; | ||
|
||
type RegisterCustomerPayload = { | ||
email: string; | ||
password: string; | ||
publisherId: string; | ||
locale: string; | ||
country: string; | ||
currency: string; | ||
captchaValue: string; | ||
}; | ||
|
||
type RegisterCustomerResponse = { | ||
responseData?: { | ||
customerId: number; | ||
customerToken: string; | ||
jwt: string; | ||
refreshToken: string; | ||
}; | ||
errors: string[]; | ||
code?: string; | ||
message?: string; | ||
}; | ||
|
||
const registerCustomer = async ({ | ||
email, | ||
password, | ||
publisherId, | ||
locale, | ||
country, | ||
currency, | ||
captchaValue | ||
}: RegisterCustomerPayload): Promise<RegisterCustomerResponse> => { | ||
const url = `${getApiURL()}/customers`; | ||
|
||
const resp = await fetchWithHeaders(url, { | ||
method: 'POST', | ||
body: JSON.stringify({ | ||
email, | ||
password, | ||
publisherId, | ||
locale, | ||
country, | ||
currency, | ||
captchaValue | ||
}) | ||
}); | ||
const response: RegisterCustomerResponse = await resp.json(); | ||
|
||
return response; | ||
}; | ||
|
||
export default registerCustomer; |
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.