-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Migrate to Stripe Payment Element #344
- Loading branch information
Showing
23 changed files
with
380 additions
and
175 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import PropTypes from 'prop-types'; | ||
|
||
RenderIfTrue.propTypes = { | ||
condition: PropTypes.bool.isRequired, | ||
children: PropTypes.node.isRequired | ||
}; | ||
|
||
export default function RenderIfTrue({ condition, children }) { | ||
return condition ? children : null; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 0 additions & 5 deletions
5
packages/evershop/src/components/frontStore/stripe/checkout/CheckoutForm.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lobal/[notification]notFound[response].js → .../pages/global/[auth]notFound[response].js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
const jest = require('jest-mock'); | ||
const notFound = require('../../../../../../../../modules/base/pages/global/[notification]notFound[response]'); | ||
const notFound = require('../../../../../../../../modules/base/pages/global/[auth]notFound[response]'); | ||
|
||
module.exports = jest.fn(notFound); |
3 changes: 0 additions & 3 deletions
3
...rc/lib/middleware/tests/app/modules/basecopy/pages/global/[auth]notification[response].js
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
7 changes: 0 additions & 7 deletions
7
packages/evershop/src/modules/base/pages/global/[auth]notification[response].js
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
packages/evershop/src/modules/base/services/notifications.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
const { hookable } = require('@evershop/evershop/src/lib/util/hookable'); | ||
const { getValueSync } = require('@evershop/evershop/src/lib/util/registry'); | ||
|
||
function addNotification(request, message, type = 'info') { | ||
const notification = { | ||
message: getValueSync('notificationMessage', message), | ||
type // Suppport 'success', 'error', 'info', 'warning' | ||
}; | ||
const { session } = request; | ||
session.notifications = session.notifications || []; | ||
session.notifications.push(notification); | ||
} | ||
|
||
function getNotifications(request) { | ||
const { session } = request; | ||
const notifications = session.notifications || []; | ||
session.notifications = []; | ||
return notifications; | ||
} | ||
|
||
module.exports = { | ||
addNotification: (request, message, type) => | ||
hookable(addNotification)(request, message, type), | ||
getNotifications | ||
}; |
Oops, something went wrong.