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

Update README.md #4379

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
a986a12
The current problem is that the 3D Secure feature is not working. Whe…
rtsehynka-gm Jul 20, 2022
36fd306
[PWA Studio] - Test Braintree #D Secure fix for Venia
rtsehynka-gm Jul 29, 2022
5fc8db3
[PWA Studio] - Add to frame-src *.cardinalcommerce.com (for test only)
rtsehynka-gm Jul 29, 2022
3440add
[PWA Studio] - Add to frame-src *.cardinalcommerce.com (for test only)
rtsehynka-gm Aug 9, 2022
dc8fc3f
Merge branch 'develop' into gomage/plugin-braintree-three-d-secure
rtsehynka-gm Aug 11, 2022
7b33ab5
Merge branch 'develop' into gomage/plugin-braintree-three-d-secure
dpatil-magento Aug 24, 2022
7d26462
Merge branch 'develop' into gomage/plugin-braintree-three-d-secure
rtsehynka-gm Jun 15, 2023
3eca535
PWA-2968::[Issue] Gomage/plugin braintree three d secure
glo82145 Aug 8, 2024
dcd95e5
PWA-2968::[Issue] Gomage/plugin braintree three d secure
glo82145 Aug 8, 2024
050189a
PWA-2968::[Issue] Gomage/plugin braintree three d secure
glo82145 Aug 8, 2024
efbb67c
Resolve clean issue
glo82145 Aug 13, 2024
287a68c
PWA-2968:updating version
chetana11 Oct 17, 2024
8bf8c5b
Adding license field else showing error during yarn clean:all
chetana11 Oct 22, 2024
3d939f9
Merge branch 'develop' into PWA-2968-v1
glo82145 Jan 22, 2025
82a64e0
Gomage/plugin braintree three d secure
glo82145 Jan 23, 2025
d8a1a8a
Update README.md
glo80684 Jan 23, 2025
c1359b3
updating run-codebuild-create-pwa-scaffold-build file
glo80684 Jan 26, 2025
2c3a4eb
Merge branch 'pwa-2968-v2' into testing
glo80684 Jan 27, 2025
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
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ If you are looking for an issue to work on, visit our [community backlog board][

For more information about contributing to this repository, see the [Contribution guide][].




## Useful links

[PWA Studio documentation site][documentation site] -
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/**
* adding to brainTreeDropIn 3D secure part
* @param targets
*/
function localIntercept(targets) {
const { Targetables } = require('@magento/pwa-buildpack');
const targetables = Targetables.using(targets);

/**
* We can disable the logic if you will add to .env param CHECKOUT_BRAINTREE_3D with value false
*/
if (process.env.CHECKOUT_BRAINTREE_3D != 'false') {
const brainTreeDropIn = targetables.reactComponent(
'@magento/venia-ui/lib/components/CheckoutPage/PaymentInformation/brainTreeDropIn.js'
);

/**
* import 3d secure plugin
*/
brainTreeDropIn.addImport(
'{useBraintreeThreeDSecure} from "@gomage/plugin-braintree-three-d-secure"'
);
brainTreeDropIn.addImport(
'{usePriceSummary} from "@magento/peregrine/lib/talons/CartPage/PriceSummary/usePriceSummary"'
);

/**
* add hook for getting of client token
*/
brainTreeDropIn.insertAfterSource(
'const [dropinInstance, setDropinInstance] = useState();',
'\n const clientToken = useBraintreeThreeDSecure();' +
'\n const talonProps = usePriceSummary();'
);
/**
* check if exist clientToken
*/
brainTreeDropIn.insertAfterSource(
'const createDropinInstance = useCallback(async () => {',
'\n if(clientToken){ '
);
/**
* end condition of check if exist clientToken
*/
brainTreeDropIn.insertAfterSource('return dropinInstance;', '\n}');
/**
* setting new dependency clientToken to useCallback createDropinInstance hook
*/
brainTreeDropIn.insertAfterSource(
'[containerId',
' ,clientToken, talonProps.flatData.total.value'
);

/**
* check if exist clientToken
*/
brainTreeDropIn.insertBeforeSource(
'const renderDropin = async () => {',
'\n if(clientToken){ '
);

/**
* end condition of check if exist clientToken
*/
brainTreeDropIn.insertBeforeSource(
'}, [createDropinInstance, onReady]);',
'} \n'
);

/**
* setting new dependency clientToken to useEffect hook
*/
brainTreeDropIn.insertAfterSource(
'[createDropinInstance, onReady',
' ,clientToken'
);

/**
* change of value token to client Token
*/
brainTreeDropIn.insertAfterSource(
'const dropinInstance = await dropIn.create({\n' +
' authorization',
':clientToken'
);

/**
* enable 3d secure
*/
brainTreeDropIn.insertAfterSource(
'container: `#${containerId}`,',
'\n threeDSecure: {amount:talonProps.flatData.total.value},'
);

/**
* update brain tree if total was changes
*/
brainTreeDropIn.insertBeforeSource(
'if (isError) {',
'useEffect(() => {\n' +
' if(dropinInstance) {\n' +
' dropinInstance.teardown();\n' +
' }\n' +
' }, [\n' +
' talonProps.flatData.total.value,\n' +
']);'
);
}
}

module.exports = localIntercept;
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { useMutation } from '@apollo/client';
import { useEffect } from 'react';
import { GET_BRAINTREE_CLIENT_TOKEN } from '../Queries/createBraintreeClientToken.gql';

/**
*
* @returns {*|string}
*/
export const useBraintreeThreeDSecure = () => {
const [setBraintreeClientToken, { data }] = useMutation(
GET_BRAINTREE_CLIENT_TOKEN
);
const clientToken = data ? data.createBraintreeClientToken : '';
/**
* set Braintree Client Token
*/
useEffect(() => {
if (!clientToken) {
setBraintreeClientToken();
}
}, [clientToken, setBraintreeClientToken]);

return clientToken;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { gql } from '@apollo/client';
/**
*
* @type {DocumentNode}
*/
export const GET_BRAINTREE_CLIENT_TOKEN = gql`
mutation {
createBraintreeClientToken
}
`;
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# GoMage Braintree 3D Secure

GoMage Braintree 3D Secure

That plugin works only as a fix bugs of PWA Studio and adds 3d secure part.

If you need to disable the module, you can add to the .env parameter CHECKOUT_BRAINTREE_3D=false, or remove the plugin.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
export { useBraintreeThreeDSecure } from './Model/useBraintreeThreeDSecure';
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/**
*
* @param targets
*/
function localIntercept(targets) {
require('@gomage/plugin-braintree-three-d-secure/Intercepts/brainTreeDropIn')(
targets
);
}

module.exports = localIntercept;
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"name": "@gomage/plugin-braintree-three-d-secure",
"version": "3.94.0",
"description": "GoMage Braintree 3D Secure",
"main": "./index.js",
"author": "GoMage",
"dependencies": {
"braintree-web-drop-in": "~1.43.0"
},

"scripts": {
"clean": " "
},
"license": "SEE LICENSE IN LICENSE.txt",
"pwa-studio": {
"targets": {
"intercept": "./intercept.js"
}
}
}
4 changes: 2 additions & 2 deletions packages/extensions/upward-security-headers/upward.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ veniaSecurityHeaders:
base-uri 'none';
child-src 'self';
font-src 'self' fonts.gstatic.com;
frame-src assets.braintreegateway.com *.google.com *.youtube.com *.youtu.be *.vimeo.com
frame-src *.braintreegateway.com *.google.com *.youtube.com *.youtu.be *.vimeo.com *.cardinalcommerce.com
"
default:
inline: "
Expand All @@ -36,7 +36,7 @@ veniaSecurityHeaders:
base-uri 'none';
child-src 'self';
font-src 'self' fonts.gstatic.com;
frame-src assets.braintreegateway.com *.google.com *.youtube.com *.youtu.be *.vimeo.com
frame-src *.braintreegateway.com *.google.com *.youtube.com *.youtu.be *.vimeo.com *.cardinalcommerce.com
"
strict-transport-security:
inline: max-age=31536000
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`returns concatenated error message when allowErrorMessages 1`] = `"GraphQL Error 1, GraphQL Error 2"`;
exports[`returns concatenated error message when allowErrorMessages 1`] = `"formError.responseError"`;

exports[`returns general error message 1`] = `"formError.errorMessage, Generic Error"`;
exports[`returns general error message 1`] = `"formError.responseError, Generic Error"`;
Original file line number Diff line number Diff line change
Expand Up @@ -273,8 +273,8 @@ exports.Checkbox = Checkbox;
var _react = require(\\"react\\");
const _excluded = [\\"classes\\", \\"fieldState\\", \\"id\\", \\"label\\", \\"message\\"];
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var s = Object.getOwnPropertySymbols(e); for (r = 0; r < s.length; r++) o = s[r], t.includes(o) || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.includes(n)) continue; t[n] = r[n]; } return t; }
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], t.indexOf(o) >= 0 || {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (e.indexOf(n) >= 0) continue; t[n] = r[n]; } return t; }
function _getRequireWildcardCache(e) { if (\\"function\\" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || \\"object\\" != typeof e && \\"function\\" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if (\\"default\\" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
const DynamicComponent$3 = (0, _react.lazy)(() => Promise.resolve().then(() => _interopRequireWildcard(require('./path/to/a-third/component'))));
Expand Down
9 changes: 7 additions & 2 deletions packages/venia-concept/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
},
"homepage": "https://github.com/magento/pwa-studio/tree/main/packages/venia-concept#readme",
"dependencies": {
"@gomage/plugin-braintree-three-d-secure": "3.94.0",
"@magento/pwa-buildpack": "~11.5.3"
},
"devDependencies": {
Expand All @@ -50,6 +51,7 @@
"@babel/plugin-transform-runtime": "~7.4.4",
"@babel/preset-env": "~7.16.0",
"@babel/runtime": "~7.15.3",
"@gomage/plugin-braintree-three-d-secure": "3.94.0",
"@magento/babel-preset-peregrine": "~1.3.3",
"@magento/eslint-config": "~1.5.0",
"@magento/pagebuilder": "~9.3.2",
Expand All @@ -69,7 +71,7 @@
"babel-plugin-graphql-tag": "~2.0.0",
"babel-plugin-module-resolver": "~3.2.0",
"babel-plugin-react-remove-properties": "~0.3.0",
"braintree-web-drop-in": "~1.33.3",
"braintree-web-drop-in": "~1.43.0",
"compression": "~1.7.4",
"css-loader": "~5.2.7",
"dotenv": "~6.2.0",
Expand Down Expand Up @@ -144,6 +146,9 @@
"pwa-studio": {
"targets": {
"intercept": "./local-intercept.js"
}
},
"trusted-vendors": [
"@gomage"
]
}
}
2 changes: 1 addition & 1 deletion packages/venia-ui/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@
"@magento/peregrine": "~14.4.1",
"@magento/pwa-buildpack": "~11.5.3",
"apollo-cache-persist": "~0.1.1",
"braintree-web-drop-in": "~1.33.3",
"braintree-web-drop-in": "~1.43.0",
"graphql": "~15.5.0",
"react": "~17.0.1",
"react-intl": "~5.20.0",
Expand Down
Loading