@medplum/react 0.9.24 → 0.9.25
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.js +10 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/index.min.js +1 -1
- package/dist/cjs/index.min.js.map +1 -1
- package/dist/esm/index.js +10 -7
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/index.min.js +1 -1
- package/dist/esm/index.min.js.map +1 -1
- package/dist/types/RegisterForm.d.ts +1 -0
- package/dist/types/index.d.ts +1 -0
- package/dist/types/utils/recaptcha.d.ts +4 -2
- package/package.json +9 -9
package/dist/cjs/index.js
CHANGED
|
@@ -4968,20 +4968,22 @@
|
|
|
4968
4968
|
/**
|
|
4969
4969
|
* Dynamically loads the recaptcha script.
|
|
4970
4970
|
* We do not want to load the script on page load unless the user needs it.
|
|
4971
|
+
* @param siteKey The reCAPTCHA site key, available from the reCAPTCHA admin page.
|
|
4971
4972
|
*/
|
|
4972
|
-
function initRecaptcha() {
|
|
4973
|
+
function initRecaptcha(siteKey) {
|
|
4973
4974
|
if (typeof grecaptcha === 'undefined') {
|
|
4974
|
-
createScriptTag('https://www.google.com/recaptcha/api.js?render=' +
|
|
4975
|
+
createScriptTag('https://www.google.com/recaptcha/api.js?render=' + siteKey);
|
|
4975
4976
|
}
|
|
4976
4977
|
}
|
|
4977
4978
|
/**
|
|
4978
4979
|
* Starts a request to generate a recapcha token.
|
|
4980
|
+
* @param siteKey The reCAPTCHA site key, available from the reCAPTCHA admin page.
|
|
4979
4981
|
* @returns Promise to a recaptcha token for the current user.
|
|
4980
4982
|
*/
|
|
4981
|
-
function getRecaptcha() {
|
|
4983
|
+
function getRecaptcha(siteKey) {
|
|
4982
4984
|
return new Promise((resolve) => {
|
|
4983
4985
|
grecaptcha.ready(() => {
|
|
4984
|
-
grecaptcha.execute(
|
|
4986
|
+
grecaptcha.execute(siteKey, { action: 'submit' }).then(resolve);
|
|
4985
4987
|
});
|
|
4986
4988
|
});
|
|
4987
4989
|
}
|
|
@@ -4989,9 +4991,10 @@
|
|
|
4989
4991
|
function RegisterForm(props) {
|
|
4990
4992
|
const medplum = useMedplum();
|
|
4991
4993
|
const googleClientId = getGoogleClientId(props.googleClientId);
|
|
4994
|
+
const recaptchaSiteKey = props.recaptchaSiteKey;
|
|
4992
4995
|
const [outcome, setOutcome] = React.useState();
|
|
4993
4996
|
const issues = getIssuesForExpression(outcome, undefined);
|
|
4994
|
-
React.useEffect(initRecaptcha, []);
|
|
4997
|
+
React.useEffect(() => initRecaptcha(recaptchaSiteKey), [recaptchaSiteKey]);
|
|
4995
4998
|
function handleAuthResponse(registerRequest, partialLogin) {
|
|
4996
4999
|
return __awaiter(this, void 0, void 0, function* () {
|
|
4997
5000
|
try {
|
|
@@ -5013,7 +5016,7 @@
|
|
|
5013
5016
|
return (React__default["default"].createElement(Document, { width: 450 },
|
|
5014
5017
|
React__default["default"].createElement(Form, { style: { maxWidth: 400 }, onSubmit: (formData) => __awaiter(this, void 0, void 0, function* () {
|
|
5015
5018
|
try {
|
|
5016
|
-
const recaptchaToken = yield getRecaptcha();
|
|
5019
|
+
const recaptchaToken = yield getRecaptcha(recaptchaSiteKey);
|
|
5017
5020
|
const registerRequest = Object.assign(Object.assign({}, formData), { recaptchaToken });
|
|
5018
5021
|
const userLogin = yield medplum.startNewUser(registerRequest);
|
|
5019
5022
|
handleAuthResponse(registerRequest, userLogin);
|
|
@@ -5850,6 +5853,7 @@
|
|
|
5850
5853
|
exports.HumanNameInput = HumanNameInput;
|
|
5851
5854
|
exports.IdentifierInput = IdentifierInput;
|
|
5852
5855
|
exports.Input = Input;
|
|
5856
|
+
exports.InputRow = InputRow;
|
|
5853
5857
|
exports.Loading = Loading;
|
|
5854
5858
|
exports.Logo = Logo;
|
|
5855
5859
|
exports.MedplumLink = MedplumLink;
|