Skip to content

Commit

Permalink
Merge branch 'develop' into PWA-3052
Browse files Browse the repository at this point in the history
  • Loading branch information
dpatil-magento authored Jan 17, 2023
2 parents 83d5a8f + 83c8980 commit 0e6f61b
Show file tree
Hide file tree
Showing 34 changed files with 263 additions and 125 deletions.
184 changes: 101 additions & 83 deletions CHANGELOG.md

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions magento-compatibility.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

// PWA Studio version -> Magento version.
module.exports = {
'13.0.0': '2.4.5',
'12.7.0': '2.4.5',
'12.6.0': '2.4.5',
'12.5.0': '2.4.4',
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/pwa-studio",
"version": "12.7.0",
"version": "13.0.0",
"private": true,
"workspaces": [
"packages/babel-preset-peregrine",
Expand Down
4 changes: 2 additions & 2 deletions packages/create-pwa/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/create-pwa",
"version": "2.3.3",
"version": "2.3.4",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -30,7 +30,7 @@
"homepage": "https://github.com/magento/pwa-studio/tree/main/packages/create-pwa#readme",
"dependencies": {
"@magento/pwa-buildpack": "~11.4.1",
"@magento/venia-concept": "~12.7.0",
"@magento/venia-concept": "~13.0.0",
"chalk": "^2.4.2",
"change-case": "^3.1.0",
"compression": "~1.7.4",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/experience-platform-connector",
"version": "1.0.2",
"version": "1.0.3",
"publishConfig": {
"access": "public"
},
Expand All @@ -12,13 +12,13 @@
"repository": "github:magento/pwa-studio",
"license": "(OSL-3.0 OR AFL-3.0)",
"dependencies": {
"@adobe/magento-storefront-event-collector": "~1.1.13",
"@adobe/magento-storefront-events-sdk": "~1.1.13"
"@adobe/magento-storefront-event-collector": "~1.1.19",
"@adobe/magento-storefront-events-sdk": "~1.1.19"
},
"devDependencies": {},
"peerDependencies": {
"@apollo/client": "~3.5.0",
"@magento/peregrine": "~12.6.0",
"@magento/peregrine": "~13.0.0",
"@magento/pwa-buildpack": "~11.4.1",
"react": "~17.0.1"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,13 @@ export default {
name: 'Selena Pants',
sku: '343g3434t',
currency_code: 'USD',
price: {
regularPrice: {
amount: {
value: 40
}
}
},
price_range: {
maximum_price: {
final_price: 40
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ describe('handle()', () => {
it('calls the correct sdk functions with the correct context value', () => {
const mockSdk = {
context: {
setShoppingCart: jest.fn()
setShoppingCart: jest.fn(),
setProduct: jest.fn(),
setChangedProducts: jest.fn()
},
publish: {
addToCart: jest.fn()
Expand Down Expand Up @@ -54,8 +56,13 @@ describe('handle()', () => {
},
],
"name": "Johanna Skirt",
"pricing": Object {
"currencyCode": "USD",
"regularPrice": 78,
},
"sku": "VSK03",
},
"quantity": 1,
},
],
"possibleOnepageCheckout": false,
Expand All @@ -68,6 +75,9 @@ describe('handle()', () => {
}
`);

expect(mockSdk.context.setProduct).toHaveBeenCalledTimes(1);
expect(mockSdk.context.setChangedProducts).toHaveBeenCalledTimes(1);

expect(mockSdk.publish.addToCart).toHaveBeenCalledTimes(1);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ describe('handle()', () => {
"pricing": Object {
"currencyCode": "USD",
"maximalPrice": 40,
"regularPrice": 40,
},
"productId": "234d",
"sku": "343g3434t",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const handle = (sdk, event) => {
const {
cartId,
currencyCode,
pricing,
priceTotal,
quantity,
name,
Expand Down Expand Up @@ -35,22 +36,32 @@ const handle = (sdk, event) => {
product: {
name: name,
sku: sku,
configurableOptions: configurableOptions
configurableOptions: configurableOptions,
pricing: {
regularPrice:
pricing?.regularPrice?.amount.value || priceTotal,
currencyCode:
pricing?.regularPrice?.amount.currency ||
currencyCode
}
},
prices: {
price: {
value: priceTotal,
currency: currencyCode
}
}
},
quantity: quantity
}
],
possibleOnepageCheckout: false,
giftMessageSelected: false,
giftWrappingSelected: false
};

sdk.context.setProduct(cartItemContext.items[0]);
sdk.context.setShoppingCart(cartItemContext);
sdk.context.setChangedProducts({ items: cartItemContext.items });
sdk.publish.addToCart();
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,15 @@ const canHandle = event => event.type === 'PRODUCT_PAGE_VIEW';
const handle = (sdk, event) => {
const { payload } = event;

const { name, id, currency_code, price_range, sku, url_key } = payload;
const {
name,
id,
currency_code,
price_range,
price,
sku,
url_key
} = payload;

const pageContext = {
pageType: 'PDP',
Expand All @@ -25,6 +33,7 @@ const handle = (sdk, event) => {
sku,
pricing: {
currencyCode: currency_code,
regularPrice: price?.regularPrice?.amount.value,
maximalPrice: price_range.maximum_price.final_price
},
canonicalUrl: url_key
Expand Down
4 changes: 2 additions & 2 deletions packages/extensions/upward-security-headers/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/upward-security-headers",
"version": "1.0.11",
"version": "1.0.12",
"publishConfig": {
"access": "public"
},
Expand All @@ -14,7 +14,7 @@
"license": "(OSL-3.0 OR AFL-3.0)",
"peerDependencies": {
"@magento/pwa-buildpack": "~11.4.1",
"@magento/venia-ui": "~9.7.0",
"@magento/venia-ui": "~10.0.0",
"webpack": "~4.46.0"
},
"pwa-studio": {
Expand Down
4 changes: 2 additions & 2 deletions packages/extensions/venia-sample-eventing/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/venia-sample-eventing",
"version": "0.0.3",
"version": "0.0.4",
"publishConfig": {
"access": "public"
},
Expand All @@ -12,7 +12,7 @@
"repository": "github:magento/pwa-studio",
"license": "(OSL-3.0 OR AFL-3.0)",
"peerDependencies": {
"@magento/peregrine": "~12.6.0",
"@magento/peregrine": "~13.0.0",
"@magento/pwa-buildpack": "~11.4.1",
"react": "~17.0.1"
},
Expand Down
4 changes: 2 additions & 2 deletions packages/extensions/venia-sample-language-packs/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/venia-sample-language-packs",
"version": "0.0.11",
"version": "0.0.12",
"publishConfig": {
"access": "public"
},
Expand All @@ -13,7 +13,7 @@
"license": "(OSL-3.0 OR AFL-3.0)",
"peerDependencies": {
"@magento/pwa-buildpack": "~11.4.1",
"@magento/venia-ui": "~9.7.0"
"@magento/venia-ui": "~10.0.0"
},
"pwa-studio": {
"targets": {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/venia-sample-payments-checkmo",
"version": "0.0.9",
"version": "0.0.10",
"publishConfig": {
"access": "public"
},
Expand All @@ -12,9 +12,9 @@
"repository": "github:magento/pwa-studio",
"license": "(OSL-3.0 OR AFL-3.0)",
"peerDependencies": {
"@magento/peregrine": "~12.6.0",
"@magento/peregrine": "~13.0.0",
"@magento/pwa-buildpack": "~11.4.1",
"@magento/venia-ui": "~9.7.0",
"@magento/venia-ui": "~10.0.0",
"react": "~17.0.1",
"react-intl": "~5.20.0",
"react-router-dom": "~5.2.0"
Expand Down
10 changes: 5 additions & 5 deletions packages/pagebuilder/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@magento/pagebuilder",
"version": "7.4.2",
"version": "8.0.0",
"publishConfig": {
"access": "public"
},
Expand Down Expand Up @@ -34,9 +34,9 @@
"homepage": "https://github.com/magento/pwa-studio/tree/main/packages/pagebuilder#readme",
"dependencies": {},
"devDependencies": {
"@magento/peregrine": "~12.6.0",
"@magento/peregrine": "~13.0.0",
"@magento/pwa-buildpack": "~11.4.1",
"@magento/venia-ui": "~9.7.0",
"@magento/venia-ui": "~10.0.0",
"@storybook/react": "~6.3.7",
"jarallax": "~1.11.1",
"load-google-maps-api": "~2.0.1",
Expand All @@ -50,9 +50,9 @@
"peerDependencies": {
"@apollo/client": "~3.5.0",
"@magento/babel-preset-peregrine": "~1.2.2",
"@magento/peregrine": "~12.6.0",
"@magento/peregrine": "~13.0.0",
"@magento/pwa-buildpack": "~11.4.1",
"@magento/venia-ui": "~9.7.0",
"@magento/venia-ui": "~10.0.0",
"jarallax": "~1.11.1",
"load-google-maps-api": "~2.0.1",
"lodash.escape": "~4.0.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@ Object {
"discountAmount": 0,
"name": "Shirt",
"priceTotal": 123.45,
"pricing": Object {
"regularPrice": Object {
"amount": Object {
"currency": "USD",
"value": 123.45,
},
},
},
"quantity": 1,
"selectedOptions": Array [
Object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,14 @@ const mockItem = {
configurable_options: [{ id: 1, value_id: 'red-id' }],
product: {
name: 'Shirt',
price: {
regularPrice: {
amount: {
value: 123.45,
currency: 'USD'
}
}
},
configurable_options: [
{
label: 'Color',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,7 @@ export const useAddToCartDialog = props => {
cartId,
sku: item.product.sku,
name: item.product.name,
pricing: item.product.price,
priceTotal: currentPrice.value,
currencyCode: currentPrice.currency,
discountAmount: currentDiscount.amount_off,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ Object {
"discountAmount": 10,
"name": "Strive Shoulder Pac",
"priceTotal": 99,
"pricing": Object {
"regularPrice": Object {
"amount": Object {
"currency": "USD",
"value": 99,
},
},
},
"quantity": 1,
"selectedOptions": null,
"sku": "97ahsf9",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@ const defaultProps = {
value: 99,
currency: 'USD'
},
regular_price: {
value: 99,
currency: 'USD'
},
discount: {
amount_off: 10
}
Expand Down
6 changes: 6 additions & 0 deletions packages/peregrine/lib/talons/Gallery/useAddToCartButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,12 @@ export const useAddToCartButton = props => {
cartId,
sku: item.sku,
name: item.name,
pricing: {
regularPrice: {
amount:
item.price_range.maximum_price.regular_price
}
},
priceTotal:
item.price_range.maximum_price.final_price.value,
currencyCode:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,14 @@ Object {
"discountAmount": 10,
"name": "Strive Shoulder Pac",
"priceTotal": 99,
"pricing": Object {
"regularPrice": Object {
"amount": Object {
"currency": "USD",
"value": 99,
},
},
},
"quantity": 2,
"selectedOptions": Array [],
"sku": "MySimpleProductSku",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -497,6 +497,7 @@ export const useProductFullDetail = props => {
cartId,
sku: product.sku,
name: product.name,
pricing: product.price,
priceTotal: productPrice.final_price.value,
currencyCode: productPrice.final_price.currency,
discountAmount: productPrice.discount.amount_off,
Expand Down
Loading

0 comments on commit 0e6f61b

Please sign in to comment.