-
Notifications
You must be signed in to change notification settings - Fork 683
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' into supernova/239_shipping_methods
- Loading branch information
Showing
38 changed files
with
245 additions
and
194 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
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
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
22 changes: 19 additions & 3 deletions
22
packages/pwa-buildpack/lib/WebpackTools/__tests__/MagentoResolver.spec.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
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
36 changes: 34 additions & 2 deletions
36
...lib/components/CartPage/PriceSummary/__tests__/__snapshots__/giftCardSummary.spec.js.snap
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
1 change: 1 addition & 0 deletions
1
packages/venia-ui/lib/components/CartPage/PriceSummary/giftCardSummary.ce.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 @@ | ||
export default () => null; |
52 changes: 52 additions & 0 deletions
52
packages/venia-ui/lib/components/CartPage/PriceSummary/giftCardSummary.ee.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,52 @@ | ||
import React from 'react'; | ||
import { Price } from '@magento/peregrine'; | ||
|
||
import { mergeClasses } from '../../../classify'; | ||
|
||
const DEFAULT_AMOUNT = { | ||
currency: 'USD', | ||
value: 0 | ||
}; | ||
|
||
/** | ||
* Reduces applied gift card amounts into a single amount. | ||
* | ||
* @param {Array} cards | ||
*/ | ||
const getGiftCards = (cards = []) => { | ||
if (!cards.length) { | ||
return DEFAULT_AMOUNT; | ||
} else { | ||
return { | ||
currency: 'USD', | ||
value: cards.reduce( | ||
(acc, card) => acc + card.applied_balance.value, | ||
0 | ||
) | ||
}; | ||
} | ||
}; | ||
|
||
/** | ||
* A component that renders the gift card summary line item. | ||
* | ||
* @param {Object} props.classes | ||
* @param {Object} props.data fragment response data | ||
*/ | ||
|
||
export default props => { | ||
const classes = mergeClasses({}, props.classes); | ||
const cards = getGiftCards(props.data); | ||
|
||
return cards.value ? ( | ||
<> | ||
<span className={classes.lineItemLabel}> | ||
{'Gift Card(s) applied'} | ||
</span> | ||
<span className={classes.price}> | ||
{'-'} | ||
<Price value={cards.value} currencyCode={cards.currency} /> | ||
</span> | ||
</> | ||
) : null; | ||
}; |
92 changes: 0 additions & 92 deletions
92
packages/venia-ui/lib/components/CartPage/PriceSummary/giftCardSummary.js
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.