Skip to content

Commit

Permalink
[IRON-22825] Fall back the value of allowDisagreed to group settings …
Browse files Browse the repository at this point in the history
…if not specified (#77)

* fall back the value of allow_disagreed to group settings if not specified

* revert back the conditional check && update readme

* bump version
  • Loading branch information
cdhcs1516 authored Jul 14, 2023
1 parent 7c9d0c1 commit 7e40a07
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 10 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ You can hook into events using the triggered event callback props described here
| `signerId` | Use this to set the signer id directly. Note that if this value is tied to a state variable updated via user input, you may hit rate limits if it is updated frequently in a short period of time. To avoid hitting a rate limit, it is best to set the value tied to this prop only when the user's input is complete as opposed to changing this value on a per character basis. | string | No, unless `signerIdSelector` is not passed | undefined |
| `snapshotLocation` | Ironclad Clickwrap Snapshot Location Key, this is found within the Snapshot Location configuration | string | No | undefined |
| `testMode` | Enable this to register any contract acceptances as test data that can be cleared within the Ironclad Clickwrap UI | bool | No | false |
| `allowDisagreed` | Enable this to allow invalid events to be triggered when a signer unchecks a checkbox. | bool | If `onInvalid` is passed | false |
| `allowDisagreed` | Enable this to allow invalid events to be triggered when a signer unchecks a checkbox. | bool | Required to be true if `onInvalid` is passed | Value specified in Ironclad Clickwrap Group's UI |
| `onAll` | See [onAll](#onAll) below | function | No | undefined |
| `onSent` | See [onSent](#onSent) below | function | No | undefined |
| `onRetrieved` | See [onRetrieved](#onRetrieved) below | function | No | undefined |
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pactsafe/pactsafe-react-sdk",
"version": "2.10.0",
"version": "2.10.1",
"description": "Ironclad Clickwrap React SDK - SDK for easy Ironclad Clickwrap implementations leveraging the Ironclad JavaScript Library & API",
"author": "Ironclad",
"license": "MIT",
Expand Down
2 changes: 1 addition & 1 deletion src/PSClickWrap.js
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ class PSClickWrap extends React.Component {
allowDisagreed,
} = this.props;
const options = {
allow_disagreed: allowDisagreed || false,
...(allowDisagreed !== undefined && { allow_disagreed: allowDisagreed }),
...(acceptanceLanguage !== undefined && { acceptance_language: acceptanceLanguage }),
auto_run: displayImmediately,
...(confirmationEmail !== undefined && { confirmation_email: confirmationEmail }),
Expand Down
5 changes: 0 additions & 5 deletions tests/PSClickWrap.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,11 +198,6 @@ describe('PSClickWrap _ps interface tests', () => {
expect(_ps.mock.calls[FUNC.LOAD][2].allow_disagreed).toBe(true);
});

it('sets allowDisagreed to false if not passed as a prop', () => {
mount(<PSClickWrap accessId="0000000-000000-0000-0000000" groupKey="example-clickwrap" signerId="[email protected]" />);
expect(_ps.mock.calls[FUNC.LOAD][2].allow_disagreed).toBe(false);
});

it('a console error should be shown if onInvalid is passed without setting allowDisagreed', () => {
const logSpy = jest.spyOn(console, 'error');
mount(<PSClickWrap accessId="0000000-000000-0000-0000000" groupKey="example-clickwrap" signerId="[email protected]" onInvalid={() => {}} />);
Expand Down

0 comments on commit 7e40a07

Please sign in to comment.