Skip to content

Commit

Permalink
Merge pull request #58 from hCaptcha/chore/depbod-update-deps
Browse files Browse the repository at this point in the history
chore: update deps versions recommended by dependabot
  • Loading branch information
CAMOBAP authored Jun 8, 2024
2 parents 13bbe41 + 71d9728 commit 6456152
Show file tree
Hide file tree
Showing 8 changed files with 9,934 additions and 19,031 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ jobs:
- name: Run yarn add ...
working-directory: rnexample
run: |
yarn add file:../react-native-hcaptcha
yarn add @hcaptcha/react-native-hcaptcha@file:../react-native-hcaptcha
yarn add --dev ${{ env.TEST_APP_DEV_DEPS }}
yarn add ${{ env.TEST_APP_DEPS }}
cp ../react-native-hcaptcha/Example.App.js App.js
Expand Down Expand Up @@ -96,7 +96,9 @@ jobs:
working-directory: rnexample
- run: npx --yes check-peer-dependencies --npm --runOnlyOnRootDependencies
working-directory: rnexample
- run: ./gradlew assemble
- run: |
echo "org.gradle.jvmargs=-Xmx4096m -XX:MaxMetaspaceSize=1024m" >> gradle.properties
./gradlew assemble
working-directory: rnexample/android
- uses: actions/upload-artifact@v4
with:
Expand Down
12 changes: 7 additions & 5 deletions Hcaptcha.js
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ const buildHcaptchaApiUrl = (jsSrc, siteKey, hl, theme, host, sentry, endpoint,
* @param {string} assethost: Points loaded hCaptcha assets to a user defined asset location, used for proxies. Default: https://newassets.hcaptcha.com (Override only if using first-party hosting feature.)
* @param {string} imghost: Points loaded hCaptcha challenge images to a user defined image location, used for proxies. Default: https://imgs.hcaptcha.com (Override only if using first-party hosting feature.)
* @param {string} host: hCaptcha SDK host identifier. null value means that it will be generated by SDK
* @param {object} debug: debug information
*/
const Hcaptcha = ({
onMessage,
Expand All @@ -79,6 +80,7 @@ const Hcaptcha = ({
assethost,
imghost,
host,
debug,
}) => {
const apiUrl = buildHcaptchaApiUrl(jsSrc, siteKey, languageCode, theme, host, sentry, endpoint, assethost, imghost, reportapi);

Expand All @@ -92,12 +94,12 @@ const Hcaptcha = ({

const debugInfo = useMemo(
() => {
var result = [];
var result = debug || {};
try {
const {major, minor, patch} = ReactNativeVersion.version;
result.push(`rnver_${major}_${minor}_${patch}`);
result.push('dep_' + md5(Object.keys(global).join('')));
result.push('sdk_' + hcaptchaPackage.version.toString().replace(/\./g, '_'));
result[`rnver_${major}_${minor}_${patch}`] = true;
result['dep_' + md5(Object.keys(global).join(''))] = true;
result['sdk_' + hcaptchaPackage.version.toString().replace(/\./g, '_')] = true;
} catch (e) {
console.log(e);
} finally {
Expand All @@ -116,7 +118,7 @@ const Hcaptcha = ({
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<script type="text/javascript">
${JSON.stringify(debugInfo)}.forEach(function (value, i) { window[value] = true; });
Object.entries(${JSON.stringify(debugInfo)}).forEach(function (entry) { window[entry[0]] = entry[1] })
</script>
<script src="${apiUrl}" async defer></script>
<script type="text/javascript">
Expand Down
12 changes: 12 additions & 0 deletions __tests__/Hcaptcha.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,16 @@ describe('Hcaptcha snapshot tests', () => {
host="all-props-host" />);
expect(component).toMatchSnapshot();
});
it('test debug', () => {
const component = renderer.create(
<Hcaptcha
siteKey="00000000-0000-0000-0000-000000000000"
url="https://hcaptcha.com"
languageCode="en"
debug={{a: 1}}
/>
);
expect(component).toMatchSnapshot();
});
});

Loading

0 comments on commit 6456152

Please sign in to comment.