Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update deps versions recommended by dependabot #58

Merged
merged 4 commits into from
Jun 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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