@magento/experience-platform-connector 1.0.0-alpha.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.
Files changed (56) hide show
  1. package/intercept.js +24 -0
  2. package/package.json +30 -0
  3. package/src/__tests__/__snapshots__/utils.spec.js.snap +137 -0
  4. package/src/__tests__/utils.spec.js +52 -0
  5. package/src/config.js +31 -0
  6. package/src/handleEvent.js +9 -0
  7. package/src/handlers/__tests__/__mocks__/cartAddItem.js +36 -0
  8. package/src/handlers/__tests__/__mocks__/cartPageView.js +880 -0
  9. package/src/handlers/__tests__/__mocks__/categoryPageView.js +9 -0
  10. package/src/handlers/__tests__/__mocks__/checkoutPageView.js +138 -0
  11. package/src/handlers/__tests__/__mocks__/completeCheckout.js +156 -0
  12. package/src/handlers/__tests__/__mocks__/createAccount.js +9 -0
  13. package/src/handlers/__tests__/__mocks__/editAccount.js +9 -0
  14. package/src/handlers/__tests__/__mocks__/miniCartView.js +846 -0
  15. package/src/handlers/__tests__/__mocks__/orderConfirmationPageView.js +67 -0
  16. package/src/handlers/__tests__/__mocks__/pageView.js +7 -0
  17. package/src/handlers/__tests__/__mocks__/placeOrderButtonClicked.js +161 -0
  18. package/src/handlers/__tests__/__mocks__/productPageView.js +15 -0
  19. package/src/handlers/__tests__/__mocks__/searchPageRequest.js +22 -0
  20. package/src/handlers/__tests__/__mocks__/searchRequestSent.js +34 -0
  21. package/src/handlers/__tests__/__mocks__/searchResponseReceived.js +106 -0
  22. package/src/handlers/__tests__/__snapshots__/shoppingMiniCartView.spec.js.snap +137 -0
  23. package/src/handlers/__tests__/addToCart.spec.js +73 -0
  24. package/src/handlers/__tests__/categoryPageView.spec.js +55 -0
  25. package/src/handlers/__tests__/completeCheckout.spec.js +70 -0
  26. package/src/handlers/__tests__/createAccount.spec.js +43 -0
  27. package/src/handlers/__tests__/editAccount.spec.js +43 -0
  28. package/src/handlers/__tests__/pageView.spec.js +46 -0
  29. package/src/handlers/__tests__/placeOrder.spec.js +55 -0
  30. package/src/handlers/__tests__/productPageView.spec.js +64 -0
  31. package/src/handlers/__tests__/searchRequestSent.spec.js +119 -0
  32. package/src/handlers/__tests__/searchResponseReceived.spec.js +143 -0
  33. package/src/handlers/__tests__/shoppingCartPageView.spec.js +198 -0
  34. package/src/handlers/__tests__/shoppingMiniCartView.spec.js +36 -0
  35. package/src/handlers/__tests__/signIn.spec.js +73 -0
  36. package/src/handlers/__tests__/startCheckout.spec.js +193 -0
  37. package/src/handlers/addToCart.js +60 -0
  38. package/src/handlers/categoryPageView.js +34 -0
  39. package/src/handlers/completeCheckout.js +49 -0
  40. package/src/handlers/createAccount.js +25 -0
  41. package/src/handlers/editAccount.js +25 -0
  42. package/src/handlers/pageView.js +26 -0
  43. package/src/handlers/placeOrder.js +32 -0
  44. package/src/handlers/productPageView.js +41 -0
  45. package/src/handlers/searchRequestSent.js +38 -0
  46. package/src/handlers/searchResponseReceived.js +39 -0
  47. package/src/handlers/shoppingCartPageView.js +45 -0
  48. package/src/handlers/shoppingMiniCartView.js +31 -0
  49. package/src/handlers/signIn.js +29 -0
  50. package/src/handlers/startCheckout.js +45 -0
  51. package/src/hooks/useExtensionContext.js +21 -0
  52. package/src/main.js +116 -0
  53. package/src/queries/getExtensionContext.js +31 -0
  54. package/src/utils.js +101 -0
  55. package/src/wrappers/wrapUseAccountMenu.js +29 -0
  56. package/src/wrappers/wrapUseAutocomplete.js +48 -0
@@ -0,0 +1,9 @@
1
+ export default {
2
+ type: 'CATEGORY_PAGE_VIEW',
3
+ payload: {
4
+ id: 'MTQ=',
5
+ name: 'Dresses',
6
+ url_key: 'venia-dresses',
7
+ url_path: 'venia-dresses'
8
+ }
9
+ };
@@ -0,0 +1,138 @@
1
+ export default {
2
+ type: 'CHECKOUT_PAGE_VIEW',
3
+ payload: {
4
+ cart_id: 'adaIGWl4UsoKOGIeX17FPrnMq3bXHVZA',
5
+ products: [
6
+ {
7
+ __typename: 'ConfigurableCartItem',
8
+ uid: 'Mjk3Nw==',
9
+ product: {
10
+ __typename: 'ConfigurableProduct',
11
+ uid: 'MTEzNw==',
12
+ stock_status: 'IN_STOCK',
13
+ sku: 'VP08',
14
+ name: 'Bella Eyelet Capris',
15
+ thumbnail: {
16
+ __typename: 'ProductImage',
17
+ url:
18
+ 'https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/catalog/product/cache/609faca36a4bc16a754bc2f43c184970/v/p/vp08-rn_main_2.jpg'
19
+ }
20
+ },
21
+ prices: {
22
+ __typename: 'CartItemPrices',
23
+ price: {
24
+ __typename: 'Money',
25
+ currency: 'USD',
26
+ value: 98
27
+ },
28
+ row_total: {
29
+ __typename: 'Money',
30
+ value: 294
31
+ },
32
+ total_item_discount: {
33
+ __typename: 'Money',
34
+ value: 0
35
+ }
36
+ },
37
+ quantity: 3,
38
+ configurable_options: [
39
+ {
40
+ __typename: 'SelectedConfigurableOption',
41
+ configurable_product_option_uid:
42
+ 'Y29uZmlndXJhYmxlLzExMzcvMTU3',
43
+ option_label: 'Fashion Color',
44
+ configurable_product_option_value_uid:
45
+ 'Y29uZmlndXJhYmxlLzE1Ny8zNQ==',
46
+ value_label: 'Mint'
47
+ },
48
+ {
49
+ __typename: 'SelectedConfigurableOption',
50
+ configurable_product_option_uid:
51
+ 'Y29uZmlndXJhYmxlLzExMzcvMTkw',
52
+ option_label: 'Fashion Size',
53
+ configurable_product_option_value_uid:
54
+ 'Y29uZmlndXJhYmxlLzE5MC80OQ==',
55
+ value_label: '6'
56
+ }
57
+ ]
58
+ },
59
+ {
60
+ __typename: 'ConfigurableCartItem',
61
+ uid: 'Mjk3OQ==',
62
+ product: {
63
+ __typename: 'ConfigurableProduct',
64
+ uid: 'MTE1OA==',
65
+ stock_status: 'IN_STOCK',
66
+ sku: 'VA09',
67
+ name: 'Thin Leather Braided Belt',
68
+ thumbnail: {
69
+ __typename: 'ProductImage',
70
+ url:
71
+ 'https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/catalog/product/cache/609faca36a4bc16a754bc2f43c184970/v/a/va09-br_main_2.jpg'
72
+ }
73
+ },
74
+ prices: {
75
+ __typename: 'CartItemPrices',
76
+ price: {
77
+ __typename: 'Money',
78
+ currency: 'USD',
79
+ value: 38
80
+ },
81
+ row_total: {
82
+ __typename: 'Money',
83
+ value: 38
84
+ },
85
+ total_item_discount: {
86
+ __typename: 'Money',
87
+ value: 0
88
+ }
89
+ },
90
+ quantity: 1,
91
+ configurable_options: [
92
+ {
93
+ __typename: 'SelectedConfigurableOption',
94
+ configurable_product_option_uid:
95
+ 'Y29uZmlndXJhYmxlLzExNTgvMTkw',
96
+ option_label: 'Fashion Size',
97
+ configurable_product_option_value_uid:
98
+ 'Y29uZmlndXJhYmxlLzE5MC80NA==',
99
+ value_label: 'M'
100
+ }
101
+ ]
102
+ },
103
+ {
104
+ __typename: 'SimpleCartItem',
105
+ uid: 'Mjk4Nw==',
106
+ product: {
107
+ __typename: 'SimpleProduct',
108
+ uid: 'MTI=',
109
+ stock_status: 'IN_STOCK',
110
+ sku: 'VA22-SI-NA',
111
+ name: 'Silver Amor Bangle Set',
112
+ thumbnail: {
113
+ __typename: 'ProductImage',
114
+ url:
115
+ 'https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/catalog/product/cache/609faca36a4bc16a754bc2f43c184970/v/a/va22-si_main.jpg'
116
+ }
117
+ },
118
+ prices: {
119
+ __typename: 'CartItemPrices',
120
+ price: {
121
+ __typename: 'Money',
122
+ currency: 'USD',
123
+ value: 98
124
+ },
125
+ row_total: {
126
+ __typename: 'Money',
127
+ value: 98
128
+ },
129
+ total_item_discount: {
130
+ __typename: 'Money',
131
+ value: 0
132
+ }
133
+ },
134
+ quantity: 1
135
+ }
136
+ ]
137
+ }
138
+ };
@@ -0,0 +1,156 @@
1
+ export default {
2
+ type: 'ORDER_CONFIRMATION_PAGE_VIEW',
3
+ payload: {
4
+ amount: {
5
+ grand_total: {
6
+ value: 40
7
+ }
8
+ },
9
+ cart_id: '123',
10
+ order_number: '001',
11
+ payment: {
12
+ title: 'Visa'
13
+ },
14
+ products: [
15
+ {
16
+ __typename: 'ConfigurableCartItem',
17
+ uid: 'Mjk3Nw==',
18
+ product: {
19
+ __typename: 'ConfigurableProduct',
20
+ uid: 'MTEzNw==',
21
+ stock_status: 'IN_STOCK',
22
+ sku: 'VP08',
23
+ name: 'Bella Eyelet Capris',
24
+ thumbnail: {
25
+ __typename: 'ProductImage',
26
+ url:
27
+ 'https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/catalog/product/cache/609faca36a4bc16a754bc2f43c184970/v/p/vp08-rn_main_2.jpg'
28
+ }
29
+ },
30
+ prices: {
31
+ __typename: 'CartItemPrices',
32
+ price: {
33
+ __typename: 'Money',
34
+ currency: 'USD',
35
+ value: 98
36
+ },
37
+ row_total: {
38
+ __typename: 'Money',
39
+ value: 294
40
+ },
41
+ total_item_discount: {
42
+ __typename: 'Money',
43
+ value: 0
44
+ }
45
+ },
46
+ quantity: 3,
47
+ configurable_options: [
48
+ {
49
+ __typename: 'SelectedConfigurableOption',
50
+ configurable_product_option_uid:
51
+ 'Y29uZmlndXJhYmxlLzExMzcvMTU3',
52
+ option_label: 'Fashion Color',
53
+ configurable_product_option_value_uid:
54
+ 'Y29uZmlndXJhYmxlLzE1Ny8zNQ==',
55
+ value_label: 'Mint'
56
+ },
57
+ {
58
+ __typename: 'SelectedConfigurableOption',
59
+ configurable_product_option_uid:
60
+ 'Y29uZmlndXJhYmxlLzExMzcvMTkw',
61
+ option_label: 'Fashion Size',
62
+ configurable_product_option_value_uid:
63
+ 'Y29uZmlndXJhYmxlLzE5MC80OQ==',
64
+ value_label: '6'
65
+ }
66
+ ]
67
+ },
68
+ {
69
+ __typename: 'ConfigurableCartItem',
70
+ uid: 'Mjk3OQ==',
71
+ product: {
72
+ __typename: 'ConfigurableProduct',
73
+ uid: 'MTE1OA==',
74
+ stock_status: 'IN_STOCK',
75
+ sku: 'VA09',
76
+ name: 'Thin Leather Braided Belt',
77
+ thumbnail: {
78
+ __typename: 'ProductImage',
79
+ url:
80
+ 'https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/catalog/product/cache/609faca36a4bc16a754bc2f43c184970/v/a/va09-br_main_2.jpg'
81
+ }
82
+ },
83
+ prices: {
84
+ __typename: 'CartItemPrices',
85
+ price: {
86
+ __typename: 'Money',
87
+ currency: 'USD',
88
+ value: 38
89
+ },
90
+ row_total: {
91
+ __typename: 'Money',
92
+ value: 38
93
+ },
94
+ total_item_discount: {
95
+ __typename: 'Money',
96
+ value: 0
97
+ }
98
+ },
99
+ quantity: 1,
100
+ configurable_options: [
101
+ {
102
+ __typename: 'SelectedConfigurableOption',
103
+ configurable_product_option_uid:
104
+ 'Y29uZmlndXJhYmxlLzExNTgvMTkw',
105
+ option_label: 'Fashion Size',
106
+ configurable_product_option_value_uid:
107
+ 'Y29uZmlndXJhYmxlLzE5MC80NA==',
108
+ value_label: 'M'
109
+ }
110
+ ]
111
+ },
112
+ {
113
+ __typename: 'SimpleCartItem',
114
+ uid: 'Mjk4Nw==',
115
+ product: {
116
+ __typename: 'SimpleProduct',
117
+ uid: 'MTI=',
118
+ stock_status: 'IN_STOCK',
119
+ sku: 'VA22-SI-NA',
120
+ name: 'Silver Amor Bangle Set',
121
+ thumbnail: {
122
+ __typename: 'ProductImage',
123
+ url:
124
+ 'https://master-7rqtwti-mfwmkrjfqvbjk.us-4.magentosite.cloud/media/catalog/product/cache/609faca36a4bc16a754bc2f43c184970/v/a/va22-si_main.jpg'
125
+ }
126
+ },
127
+ prices: {
128
+ __typename: 'CartItemPrices',
129
+ price: {
130
+ __typename: 'Money',
131
+ currency: 'USD',
132
+ value: 98
133
+ },
134
+ row_total: {
135
+ __typename: 'Money',
136
+ value: 98
137
+ },
138
+ total_item_discount: {
139
+ __typename: 'Money',
140
+ value: 0
141
+ }
142
+ },
143
+ quantity: 1
144
+ }
145
+ ],
146
+ shipping: [
147
+ {
148
+ carrier_title: 'carrier',
149
+ method_title: 'method',
150
+ amount: {
151
+ value: 13
152
+ }
153
+ }
154
+ ]
155
+ }
156
+ };
@@ -0,0 +1,9 @@
1
+ export default {
2
+ type: 'USER_CREATE_ACCOUNT',
3
+ payload: {
4
+ email: 'Stephen.Strange@fake.email',
5
+ firstName: 'Stephen',
6
+ lastName: 'Strange',
7
+ isSubscribed: true
8
+ }
9
+ };
@@ -0,0 +1,9 @@
1
+ export default {
2
+ type: 'USER_ACCOUNT_UPDATE',
3
+ payload: {
4
+ email: 'Stephen.Strange@fake.email',
5
+ firstName: 'Stephen',
6
+ lastName: 'Strange',
7
+ isSubscribed: true
8
+ }
9
+ };