@magento/experience-platform-connector 1.0.3-alpha.1 → 1.0.3-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@magento/experience-platform-connector",
|
|
3
|
-
"version": "1.0.3-
|
|
3
|
+
"version": "1.0.3-beta.1",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -12,13 +12,13 @@
|
|
|
12
12
|
"repository": "github:magento/pwa-studio",
|
|
13
13
|
"license": "(OSL-3.0 OR AFL-3.0)",
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@adobe/magento-storefront-event-collector": "~1.1.
|
|
16
|
-
"@adobe/magento-storefront-events-sdk": "~1.1.
|
|
15
|
+
"@adobe/magento-storefront-event-collector": "~1.1.19",
|
|
16
|
+
"@adobe/magento-storefront-events-sdk": "~1.1.19"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {},
|
|
19
19
|
"peerDependencies": {
|
|
20
20
|
"@apollo/client": "~3.5.0",
|
|
21
|
-
"@magento/peregrine": "13.0.0-
|
|
21
|
+
"@magento/peregrine": "13.0.0-beta.1",
|
|
22
22
|
"@magento/pwa-buildpack": "~11.4.1",
|
|
23
23
|
"react": "~17.0.1"
|
|
24
24
|
},
|
|
@@ -22,7 +22,9 @@ describe('handle()', () => {
|
|
|
22
22
|
it('calls the correct sdk functions with the correct context value', () => {
|
|
23
23
|
const mockSdk = {
|
|
24
24
|
context: {
|
|
25
|
-
setShoppingCart: jest.fn()
|
|
25
|
+
setShoppingCart: jest.fn(),
|
|
26
|
+
setProduct: jest.fn(),
|
|
27
|
+
setChangedProducts: jest.fn()
|
|
26
28
|
},
|
|
27
29
|
publish: {
|
|
28
30
|
addToCart: jest.fn()
|
|
@@ -54,8 +56,13 @@ describe('handle()', () => {
|
|
|
54
56
|
},
|
|
55
57
|
],
|
|
56
58
|
"name": "Johanna Skirt",
|
|
59
|
+
"pricing": Object {
|
|
60
|
+
"currencyCode": "USD",
|
|
61
|
+
"regularPrice": 78,
|
|
62
|
+
},
|
|
57
63
|
"sku": "VSK03",
|
|
58
64
|
},
|
|
65
|
+
"quantity": 1,
|
|
59
66
|
},
|
|
60
67
|
],
|
|
61
68
|
"possibleOnepageCheckout": false,
|
|
@@ -68,6 +75,9 @@ describe('handle()', () => {
|
|
|
68
75
|
}
|
|
69
76
|
`);
|
|
70
77
|
|
|
78
|
+
expect(mockSdk.context.setProduct).toHaveBeenCalledTimes(1);
|
|
79
|
+
expect(mockSdk.context.setChangedProducts).toHaveBeenCalledTimes(1);
|
|
80
|
+
|
|
71
81
|
expect(mockSdk.publish.addToCart).toHaveBeenCalledTimes(1);
|
|
72
82
|
});
|
|
73
83
|
});
|
|
@@ -6,6 +6,7 @@ const handle = (sdk, event) => {
|
|
|
6
6
|
const {
|
|
7
7
|
cartId,
|
|
8
8
|
currencyCode,
|
|
9
|
+
pricing,
|
|
9
10
|
priceTotal,
|
|
10
11
|
quantity,
|
|
11
12
|
name,
|
|
@@ -35,14 +36,22 @@ const handle = (sdk, event) => {
|
|
|
35
36
|
product: {
|
|
36
37
|
name: name,
|
|
37
38
|
sku: sku,
|
|
38
|
-
configurableOptions: configurableOptions
|
|
39
|
+
configurableOptions: configurableOptions,
|
|
40
|
+
pricing: {
|
|
41
|
+
regularPrice:
|
|
42
|
+
pricing?.regularPrice?.amount.value || priceTotal,
|
|
43
|
+
currencyCode:
|
|
44
|
+
pricing?.regularPrice?.amount.currency ||
|
|
45
|
+
currencyCode
|
|
46
|
+
}
|
|
39
47
|
},
|
|
40
48
|
prices: {
|
|
41
49
|
price: {
|
|
42
50
|
value: priceTotal,
|
|
43
51
|
currency: currencyCode
|
|
44
52
|
}
|
|
45
|
-
}
|
|
53
|
+
},
|
|
54
|
+
quantity: quantity
|
|
46
55
|
}
|
|
47
56
|
],
|
|
48
57
|
possibleOnepageCheckout: false,
|
|
@@ -50,7 +59,9 @@ const handle = (sdk, event) => {
|
|
|
50
59
|
giftWrappingSelected: false
|
|
51
60
|
};
|
|
52
61
|
|
|
62
|
+
sdk.context.setProduct(cartItemContext.items[0]);
|
|
53
63
|
sdk.context.setShoppingCart(cartItemContext);
|
|
64
|
+
sdk.context.setChangedProducts({ items: cartItemContext.items });
|
|
54
65
|
sdk.publish.addToCart();
|
|
55
66
|
};
|
|
56
67
|
|
|
@@ -3,7 +3,15 @@ const canHandle = event => event.type === 'PRODUCT_PAGE_VIEW';
|
|
|
3
3
|
const handle = (sdk, event) => {
|
|
4
4
|
const { payload } = event;
|
|
5
5
|
|
|
6
|
-
const {
|
|
6
|
+
const {
|
|
7
|
+
name,
|
|
8
|
+
id,
|
|
9
|
+
currency_code,
|
|
10
|
+
price_range,
|
|
11
|
+
price,
|
|
12
|
+
sku,
|
|
13
|
+
url_key
|
|
14
|
+
} = payload;
|
|
7
15
|
|
|
8
16
|
const pageContext = {
|
|
9
17
|
pageType: 'PDP',
|
|
@@ -25,6 +33,7 @@ const handle = (sdk, event) => {
|
|
|
25
33
|
sku,
|
|
26
34
|
pricing: {
|
|
27
35
|
currencyCode: currency_code,
|
|
36
|
+
regularPrice: price?.regularPrice?.amount.value,
|
|
28
37
|
maximalPrice: price_range.maximum_price.final_price
|
|
29
38
|
},
|
|
30
39
|
canonicalUrl: url_key
|