Skip to content

Commit

Permalink
Merge pull request #61 from pactsafe/next
Browse files Browse the repository at this point in the history
v2.8.0 Release - Support Custom Data and Custom acceptanceLanguage, Update Dependencies
  • Loading branch information
timothymorse authored Sep 29, 2022
2 parents f9e1f0b + cd45295 commit 3072822
Show file tree
Hide file tree
Showing 11 changed files with 27,303 additions and 43,200 deletions.
18 changes: 16 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
{
"extends": ["airbnb"],
"parser": "babel-eslint",
"parser": "@babel/eslint-parser",
"parserOptions": {
"requireConfigFile": false,
"babelOptions": {
"presets": ["@babel/preset-env", "@babel/preset-react"],
"plugins": ["@babel/plugin-proposal-export-default-from"]
}
},
"env": {
"es6": true,
"browser": true,
Expand Down Expand Up @@ -38,6 +45,13 @@
{
"allow": "single-child"
}
]
],
"react/forbid-prop-types": [
1,
{
"forbid": ["any", "array"]
}
],
"react/jsx-props-no-spreading": "off"
}
}
93 changes: 28 additions & 65 deletions README.md

Large diffs are not rendered by default.

40 changes: 18 additions & 22 deletions demo/src/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
{
"extends": [
"airbnb"
],
"rules": {
"import/no-extraneous-dependencies": "off", //don't want to load react-dom in on other's npm install, so keeping as devDependency
"no-console": "off", // for the demo page we want to keep console.logs to show triggered events
"no-alert": "off", // same for alerts
"react/jsx-filename-extension": "off",
"jsx-a11y/label-has-associated-control": [
2,
{
"assert": "either",
"controlComponents": [
"Form.Field"
],
"depth": 3
}
],
"jsx-a11y/label-has-for": "off",
},
}
{
"extends": ["airbnb"],
"rules": {
"import/no-extraneous-dependencies": "off", //don't want to load react-dom in on other's npm install, so keeping as devDependency
"no-console": "off", // for the demo page we want to keep console.logs to show triggered events
"no-alert": "off", // same for alerts
"react/jsx-filename-extension": "off",
"jsx-a11y/label-has-associated-control": [
2,
{
"assert": "either",
"controlComponents": ["Form.Field"],
"depth": 3
}
],
"jsx-a11y/label-has-for": "off"
}
}
50 changes: 25 additions & 25 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,23 @@ class Demo extends React.Component {
};
}

static onEventMethod = (name, ...args) => {
console.log(`${name} prop callback called for PSClickwrap with parameters: `, [...args]);
};

static onError = (...args) => {
if (args[0] === 'Command aborted on: validationTask, Error: missing_signer_id') {
alert('Please enter a signer ID (email address) before agreeing.');
}
Demo.onEventMethod('onError', ...args);
};

handleChangeSignerId = (e) => {
this.setState({ signerIdValue: e.target.value });
};

updateRenderData = () => {
this.setState(state => ({
this.setState((state) => ({
dynamicRenderData: {
...state.dynamicRenderData,
another_token_value: 'This value was updated through user interaction!',
Expand All @@ -37,35 +48,24 @@ class Demo extends React.Component {
this.setState({ clickwrapStyle: e.target.value });
};

onEventMethod = (name, ...args) => {
console.log(`${name} prop callback called for PSClickwrap with parameters: `, [...args]);
};

onUpdateSignerId = (...args) => {
this.setState(state => ({
this.setState((state) => ({
dynamicRenderData: {
...state.dynamicRenderData,
user_token_value: args[0],
},
}));
this.onEventMethod('onSetSignerId', ...args);
Demo.onEventMethod('onSetSignerId', ...args);
};

onValid = (...args) => {
this.setState({ hasAgreed: true });
this.onEventMethod('onValid', ...args);
Demo.onEventMethod('onValid', ...args);
};

onInvalid = (...args) => {
this.setState({ hasAgreed: false });
this.onEventMethod('onInvalid', ...args);
};

onError = (...args) => {
if (args[0] === 'Command aborted on: validationTask, Error: missing_signer_id') {
alert('Please enter a signer ID (email address) before agreeing.');
}
this.onEventMethod('onError', ...args);
Demo.onEventMethod('onInvalid', ...args);
};

onClickSubmit = () => {
Expand Down Expand Up @@ -95,7 +95,7 @@ class Demo extends React.Component {
integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm"
crossOrigin="anonymous"
/>
<h1>PactSafe React SDK - Example Clickwrap & Browsewrap</h1>
<h1>Ironclad Clickwrap React SDK - Example Clickwrap</h1>
<h2>
<a href="https://github.com/PactSafe/pactsafe-react-sdk">View project on GitHub</a>
</h2>
Expand Down Expand Up @@ -167,7 +167,7 @@ class Demo extends React.Component {
<br />
<PSClickWrap
accessId={process.env.PACTSAFE_ACCESS_ID}
groupKey="dynamic-clickwrap"
groupKey="example-web-group"
confirmationEmail
displayImmediately={false}
testMode
Expand All @@ -176,18 +176,18 @@ class Demo extends React.Component {
renderData={dynamicRenderData}
clickWrapStyle={clickwrapStyle}
onValid={this.onValid}
onSent={(...args) => this.onEventMethod('onSent', ...args)}
onSent={(...args) => Demo.onEventMethod('onSent', ...args)}
onInvalid={this.onInvalid}
onDisplayed={(...args) => this.onEventMethod('onDisplayed', ...args)}
onError={this.onError}
onDisplayed={(...args) => Demo.onEventMethod('onDisplayed', ...args)}
onError={Demo.onError}
onSetSignerId={this.onUpdateSignerId}
onSet={(...args) => this.onEventMethod('onSet', ...args)}
onRendered={(...args) => this.onEventMethod('onRendered', ...args)}
onRetrieved={(...args) => this.onEventMethod('onRetrieved', ...args)}
onSet={(...args) => Demo.onEventMethod('onSet', ...args)}
onRendered={(...args) => Demo.onEventMethod('onRendered', ...args)}
onRetrieved={(...args) => Demo.onEventMethod('onRetrieved', ...args)}
/>
{needsAgreeWarning && (
<div className="alert alert-warning" role="alert">
Please agree to all contracts with an email address above before submitting!
Please agree to all contracts with an email address above before submitting!

</div>
)}
Expand Down
3 changes: 2 additions & 1 deletion jest.transform.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
module.exports = require('babel-jest').createTransformer({
presets: ['env', 'react', 'stage-1'],
presets: ['@babel/preset-env', '@babel/preset-react'],
plugins: ['@babel/plugin-proposal-export-default-from']
});
1 change: 1 addition & 0 deletions nwb.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ module.exports = {
},
babel: {
plugins: [
['@babel/plugin-proposal-export-default-from'],
[
'search-and-replace',
{
Expand Down
Loading

0 comments on commit 3072822

Please sign in to comment.