@shopgate/engage 7.20.0-beta.1 → 7.20.0-beta.10
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/account/actions/addContacts.js +1 -1
- package/account/actions/deleteContact.js +1 -1
- package/account/actions/deleteCustomer.js +1 -1
- package/account/actions/fetchContacts.js +1 -1
- package/account/actions/fetchCustomer.js +1 -1
- package/account/actions/updateContact.js +1 -1
- package/account/actions/updateCustomer.js +1 -1
- package/account/components/Account/Account.js +1 -1
- package/account/reducers/index.js +2 -2
- package/cart/cart.helpers.js +8 -1
- package/cart/components/CartItem/CartItemProductLayout.js +2 -1
- package/cart/index.js +2 -1
- package/cart/streams/index.js +1 -0
- package/checkout/components/Checkout/CheckoutPickupContactForm.config.js +1 -1
- package/checkout/components/GuestCheckout/GuestCheckoutPickupNotes.config.js +1 -1
- package/checkout/components/index.js +1 -1
- package/checkout/constants/index.js +1 -1
- package/checkout/index.js +3 -4
- package/checkout/paymentMethods/stripe/sdk.js +3 -2
- package/components/ChipLayout/style.js +2 -2
- package/components/ConditionalWrapper/ConditionalWrapper.js +7 -2
- package/components/QuantityInput/QuantityInput.js +5 -4
- package/components/ResponsiveContainer/ResponsiveContainer.js +2 -6
- package/components/ResponsiveContainer/breakpoints.js +2 -1
- package/components/ResponsiveContainer/hooks.js +20 -0
- package/components/ScrollHeader/index.js +2 -2
- package/components/ScrollHeader/style.js +1 -1
- package/core/constants/index.js +1 -1
- package/core/helpers/appFeatures.js +2 -1
- package/core/helpers/i18n.js +1 -1
- package/core/helpers/index.js +1 -1
- package/core/hooks/index.js +1 -1
- package/core/streams/index.js +1 -1
- package/core/subscriptions/app.js +2 -2
- package/favorites/components/Item/Item.js +6 -6
- package/favorites/components/List/List.js +17 -6
- package/favorites/components/List/ListAccordionLabel.js +4 -0
- package/favorites/components/List/ListContent.js +8 -0
- package/favorites/components/List/ListItemWrapper.js +6 -0
- package/favorites/components/List/styles.js +1 -0
- package/favorites/components/Lists/Lists.js +4 -4
- package/favorites/components/Lists/ListsModal.js +3 -2
- package/favorites/constants/index.js +1 -0
- package/filter/actions/index.js +1 -0
- package/filter/components/PriceSlider/style.js +1 -3
- package/filter/components/index.js +1 -0
- package/filter/constants/index.js +1 -1
- package/filter/helpers/buildInitialFilters.js +1 -1
- package/filter/helpers/translateFilterLabel.js +3 -3
- package/filter/index.js +2 -7
- package/filter/selectors/index.js +1 -1
- package/filter/streams/index.js +1 -0
- package/i18n/locale/cs-cz/countries.json +255 -0
- package/i18n/locale/de-de/countries.json +26 -28
- package/i18n/locale/el-gr/countries.json +255 -0
- package/i18n/locale/en-us/countries.json +12 -14
- package/i18n/locale/es-es/countries.json +65 -67
- package/i18n/locale/fi-fi/countries.json +255 -0
- package/i18n/locale/fr-fr/countries.json +85 -87
- package/i18n/locale/hu-hu/countries.json +255 -0
- package/i18n/locale/it-it/countries.json +11 -13
- package/i18n/locale/nl-nl/countries.json +42 -44
- package/i18n/locale/pl-pl/countries.json +255 -0
- package/i18n/locale/pt-pt/countries.json +128 -130
- package/i18n/locale/ro-ro/countries.json +255 -0
- package/i18n/locale/sv-se/countries.json +255 -0
- package/locations/action-creators/receiveInventories.js +3 -5
- package/locations/components/StoreList/StoreListSearch.js +3 -1
- package/locations/subscriptions.js +2 -2
- package/orders/index.js +1 -1
- package/package.json +7 -7
- package/page/selectors/index.js +7 -1
- package/product/components/Options/components/Content/spec.js +1 -1
- package/product/components/ProductSlider/index.js +1 -1
- package/product/components/QuantityPicker/hooks.js +5 -0
- package/product/components/QuantityPicker/index.js +2 -2
- package/product/components/Rating/spec.js +1 -1
- package/product/components/UnitQuantityPicker/CartUnitQuantityPicker.js +2 -2
- package/product/components/UnitQuantityPicker/ProductUnitQuantityPicker.js +3 -2
- package/product/components/UnitQuantityPicker/UnitQuantityPicker.js +6 -3
- package/product/components/UnitQuantityPicker/UnitQuantityPickerWithSection.js +7 -0
- package/product/components/UnitQuantityPicker/index.js +1 -1
- package/product/components/index.js +1 -1
- package/product/providers/ProductListType/context.js +2 -1
- package/product/providers/ProductListType/index.js +2 -1
- package/product/providers/index.js +1 -1
- package/product/selectors/product.js +12 -2
- package/push-opt-in/components/PushOptInModal/index.js +5 -6
- package/push-opt-in/subscriptions/optInTrigger.js +3 -5
- package/registration/components/index.js +1 -0
- package/registration/index.js +1 -1
- package/registration/streams/index.js +4 -0
- package/registration/subscriptions/index.js +4 -4
- package/reviews/components/Reviews/components/Header/components/ReviewsExcerpt/style.js +1 -2
- package/reviews/components/Reviews/components/RatingCount/style.js +1 -2
- package/reviews/index.js +3 -1
- package/styles/helpers/initCSSCustomProperties.js +2 -2
- package/styles/helpers/loadCustomStyles.js +2 -2
- package/styles/helpers/setPageBackgroundColor.js +2 -1
- package/tracking/action-creators/cookieConsent.js +24 -0
- package/tracking/action-creators/index.js +1 -4
- package/tracking/actions/cookieConsent.js +21 -0
- package/tracking/actions/index.js +1 -0
- package/tracking/components/CookieConsentModal/connector.js +6 -0
- package/tracking/components/CookieConsentModal/index.js +9 -0
- package/tracking/components/CookieConsentModal/style.js +1 -0
- package/tracking/components/CookieConsentModal/tracking-opt-in.svg +18 -0
- package/tracking/components/PrivacySettings/connector.js +6 -0
- package/tracking/components/PrivacySettings/index.js +4 -0
- package/tracking/components/PrivacySettings/style.js +1 -0
- package/tracking/components/index.js +1 -1
- package/tracking/constants/index.js +0 -1
- package/tracking/reducers/cookieConsentModal.js +6 -0
- package/tracking/reducers/cookieSettings.js +6 -0
- package/tracking/reducers/index.js +1 -0
- package/tracking/selectors/cookieConsent.js +35 -0
- package/tracking/selectors/index.js +1 -4
- package/tracking/streams/cookieConsent.js +46 -0
- package/tracking/streams/index.js +1 -1
- package/tracking/subscriptions/analytics.js +11 -0
- package/tracking/subscriptions/cookieConsent.js +13 -0
- package/tracking/subscriptions/index.js +1 -4
- package/user/index.js +1 -1
- package/i18n/locale/ru-ru/countries.json +0 -251
- package/product/components/QuantityPicker/helpers.js +0 -5
- package/tracking/components/CookieConsent/CookieConsent.connector.js +0 -4
- package/tracking/components/CookieConsent/CookieConsent.js +0 -4
- package/tracking/components/CookieConsent/CookieConsentButtons.js +0 -3
- package/tracking/components/CookieConsent/CookieConsentCheckboxes.js +0 -3
- package/tracking/components/CookieConsent/CookieConsentContent.js +0 -4
- package/tracking/components/CookieConsent/CookieConsentMessage.js +0 -4
- package/tracking/components/CookieConsent/index.js +0 -1
- package/tracking/helpers/index.js +0 -7
- package/tracking/hooks/index.js +0 -4
- package/tracking/index.js +0 -1
- package/tracking/providers/CookieConsentProvider.connector.js +0 -4
- package/tracking/providers/CookieConsentProvider.context.js +0 -1
- package/tracking/providers/CookieConsentProvider.js +0 -8
- /package/product/{components/ProductProvider → providers/Product}/connector.js +0 -0
- /package/product/{components/ProductProvider → providers/Product}/index.js +0 -0
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
{
|
|
2
|
+
"AF": "Afghanistan",
|
|
3
|
+
"AX": "Åland",
|
|
4
|
+
"AL": "Albanien",
|
|
5
|
+
"DZ": "Algeriet",
|
|
6
|
+
"VI": "Amerikanska Jungfruöarna",
|
|
7
|
+
"AS": "Amerikanska Samoa",
|
|
8
|
+
"AD": "Andorra",
|
|
9
|
+
"AO": "Angola",
|
|
10
|
+
"AI": "Anguilla",
|
|
11
|
+
"AQ": "Antarktis",
|
|
12
|
+
"AG": "Antigua och Barbuda",
|
|
13
|
+
"AR": "Argentina",
|
|
14
|
+
"AM": "Armenien",
|
|
15
|
+
"AW": "Aruba",
|
|
16
|
+
"AC": "Ascension",
|
|
17
|
+
"AU": "Australien",
|
|
18
|
+
"AZ": "Azerbajdzjan",
|
|
19
|
+
"BS": "Bahamas",
|
|
20
|
+
"BH": "Bahrain",
|
|
21
|
+
"BD": "Bangladesh",
|
|
22
|
+
"BB": "Barbados",
|
|
23
|
+
"BY": "Belarus",
|
|
24
|
+
"BE": "Belgien",
|
|
25
|
+
"BZ": "Belize",
|
|
26
|
+
"BJ": "Benin",
|
|
27
|
+
"BM": "Bermuda",
|
|
28
|
+
"BT": "Bhutan",
|
|
29
|
+
"BO": "Bolivia",
|
|
30
|
+
"BA": "Bosnien och Hercegovina",
|
|
31
|
+
"BW": "Botswana",
|
|
32
|
+
"BR": "Brasilien",
|
|
33
|
+
"VG": "Brittiska Jungfruöarna",
|
|
34
|
+
"IO": "Brittiska territoriet i Indiska oceanen",
|
|
35
|
+
"BN": "Brunei",
|
|
36
|
+
"BG": "Bulgarien",
|
|
37
|
+
"BF": "Burkina Faso",
|
|
38
|
+
"BI": "Burundi",
|
|
39
|
+
"KY": "Caymanöarna",
|
|
40
|
+
"CF": "Centralafrikanska republiken",
|
|
41
|
+
"EA": "Ceuta och Melilla",
|
|
42
|
+
"CL": "Chile",
|
|
43
|
+
"CO": "Colombia",
|
|
44
|
+
"CK": "Cooköarna",
|
|
45
|
+
"CR": "Costa Rica",
|
|
46
|
+
"CW": "Curaçao",
|
|
47
|
+
"CY": "Cypern",
|
|
48
|
+
"DK": "Danmark",
|
|
49
|
+
"DG": "Diego Garcia",
|
|
50
|
+
"DJ": "Djibouti",
|
|
51
|
+
"DM": "Dominica",
|
|
52
|
+
"DO": "Dominikanska republiken",
|
|
53
|
+
"EC": "Ecuador",
|
|
54
|
+
"EG": "Egypten",
|
|
55
|
+
"GQ": "Ekvatorialguinea",
|
|
56
|
+
"SV": "El Salvador",
|
|
57
|
+
"CI": "Elfenbenskusten",
|
|
58
|
+
"ER": "Eritrea",
|
|
59
|
+
"EE": "Estland",
|
|
60
|
+
"SZ": "Eswatini",
|
|
61
|
+
"ET": "Etiopien",
|
|
62
|
+
"FK": "Falklandsöarna",
|
|
63
|
+
"FO": "Färöarna",
|
|
64
|
+
"FJ": "Fiji",
|
|
65
|
+
"PH": "Filippinerna",
|
|
66
|
+
"FI": "Finland",
|
|
67
|
+
"AE": "Förenade Arabemiraten",
|
|
68
|
+
"FR": "Frankrike",
|
|
69
|
+
"GF": "Franska Guyana",
|
|
70
|
+
"PF": "Franska Polynesien",
|
|
71
|
+
"TF": "Franska sydterritorierna",
|
|
72
|
+
"GA": "Gabon",
|
|
73
|
+
"GM": "Gambia",
|
|
74
|
+
"GE": "Georgien",
|
|
75
|
+
"GH": "Ghana",
|
|
76
|
+
"GI": "Gibraltar",
|
|
77
|
+
"GR": "Grekland",
|
|
78
|
+
"GD": "Grenada",
|
|
79
|
+
"GL": "Grönland",
|
|
80
|
+
"GP": "Guadeloupe",
|
|
81
|
+
"GU": "Guam",
|
|
82
|
+
"GT": "Guatemala",
|
|
83
|
+
"GG": "Guernsey",
|
|
84
|
+
"GN": "Guinea",
|
|
85
|
+
"GW": "Guinea-Bissau",
|
|
86
|
+
"GY": "Guyana",
|
|
87
|
+
"HT": "Haiti",
|
|
88
|
+
"HN": "Honduras",
|
|
89
|
+
"HK": "Hongkong",
|
|
90
|
+
"IN": "Indien",
|
|
91
|
+
"ID": "Indonesien",
|
|
92
|
+
"IQ": "Irak",
|
|
93
|
+
"IR": "Iran",
|
|
94
|
+
"IE": "Irland",
|
|
95
|
+
"IS": "Island",
|
|
96
|
+
"IM": "Isle of Man",
|
|
97
|
+
"IL": "Israel",
|
|
98
|
+
"IT": "Italien",
|
|
99
|
+
"JM": "Jamaica",
|
|
100
|
+
"JP": "Japan",
|
|
101
|
+
"YE": "Jemen",
|
|
102
|
+
"JE": "Jersey",
|
|
103
|
+
"JO": "Jordanien",
|
|
104
|
+
"CX": "Julön",
|
|
105
|
+
"KH": "Kambodja",
|
|
106
|
+
"CM": "Kamerun",
|
|
107
|
+
"CA": "Kanada",
|
|
108
|
+
"IC": "Kanarieöarna",
|
|
109
|
+
"CV": "Kap Verde",
|
|
110
|
+
"BQ": "Karibiska Nederländerna",
|
|
111
|
+
"KZ": "Kazakstan",
|
|
112
|
+
"KE": "Kenya",
|
|
113
|
+
"CN": "Kina",
|
|
114
|
+
"KG": "Kirgizistan",
|
|
115
|
+
"KI": "Kiribati",
|
|
116
|
+
"CC": "Kokosöarna (Keelingöarna)",
|
|
117
|
+
"KM": "Komorerna",
|
|
118
|
+
"CG": "Kongo-Brazzaville",
|
|
119
|
+
"CD": "Kongo-Kinshasa",
|
|
120
|
+
"XK": "Kosovo",
|
|
121
|
+
"HR": "Kroatien",
|
|
122
|
+
"CU": "Kuba",
|
|
123
|
+
"KW": "Kuwait",
|
|
124
|
+
"LA": "Laos",
|
|
125
|
+
"LS": "Lesotho",
|
|
126
|
+
"LV": "Lettland",
|
|
127
|
+
"LB": "Libanon",
|
|
128
|
+
"LR": "Liberia",
|
|
129
|
+
"LY": "Libyen",
|
|
130
|
+
"LI": "Liechtenstein",
|
|
131
|
+
"LT": "Litauen",
|
|
132
|
+
"LU": "Luxemburg",
|
|
133
|
+
"MO": "Macao",
|
|
134
|
+
"MG": "Madagaskar",
|
|
135
|
+
"MW": "Malawi",
|
|
136
|
+
"MY": "Malaysia",
|
|
137
|
+
"MV": "Maldiverna",
|
|
138
|
+
"ML": "Mali",
|
|
139
|
+
"MT": "Malta",
|
|
140
|
+
"MA": "Marocko",
|
|
141
|
+
"MH": "Marshallöarna",
|
|
142
|
+
"MQ": "Martinique",
|
|
143
|
+
"MR": "Mauretanien",
|
|
144
|
+
"MU": "Mauritius",
|
|
145
|
+
"YT": "Mayotte",
|
|
146
|
+
"MX": "Mexiko",
|
|
147
|
+
"FM": "Mikronesiens federerade stater",
|
|
148
|
+
"MZ": "Moçambique",
|
|
149
|
+
"MD": "Moldavien",
|
|
150
|
+
"MC": "Monaco",
|
|
151
|
+
"MN": "Mongoliet",
|
|
152
|
+
"ME": "Montenegro",
|
|
153
|
+
"MS": "Montserrat",
|
|
154
|
+
"MM": "Myanmar (Burma)",
|
|
155
|
+
"NA": "Namibia",
|
|
156
|
+
"NR": "Nauru",
|
|
157
|
+
"NL": "Nederländerna",
|
|
158
|
+
"NP": "Nepal",
|
|
159
|
+
"NI": "Nicaragua",
|
|
160
|
+
"NE": "Niger",
|
|
161
|
+
"NG": "Nigeria",
|
|
162
|
+
"NU": "Niue",
|
|
163
|
+
"KP": "Nordkorea",
|
|
164
|
+
"MK": "Nordmakedonien",
|
|
165
|
+
"MP": "Nordmarianerna",
|
|
166
|
+
"NF": "Norfolkön",
|
|
167
|
+
"NO": "Norge",
|
|
168
|
+
"NC": "Nya Kaledonien",
|
|
169
|
+
"NZ": "Nya Zeeland",
|
|
170
|
+
"OM": "Oman",
|
|
171
|
+
"AT": "Österrike",
|
|
172
|
+
"TL": "Östtimor",
|
|
173
|
+
"PK": "Pakistan",
|
|
174
|
+
"PW": "Palau",
|
|
175
|
+
"PS": "Palestinska territorierna",
|
|
176
|
+
"PA": "Panama",
|
|
177
|
+
"PG": "Papua Nya Guinea",
|
|
178
|
+
"PY": "Paraguay",
|
|
179
|
+
"PE": "Peru",
|
|
180
|
+
"PN": "Pitcairnöarna",
|
|
181
|
+
"PL": "Polen",
|
|
182
|
+
"PT": "Portugal",
|
|
183
|
+
"PR": "Puerto Rico",
|
|
184
|
+
"QA": "Qatar",
|
|
185
|
+
"RE": "Réunion",
|
|
186
|
+
"RO": "Rumänien",
|
|
187
|
+
"RW": "Rwanda",
|
|
188
|
+
"RU": "Ryssland",
|
|
189
|
+
"KN": "Saint Kitts och Nevis",
|
|
190
|
+
"LC": "Saint Lucia",
|
|
191
|
+
"VC": "Saint Vincent och Grenadinerna",
|
|
192
|
+
"BL": "Saint-Barthélemy",
|
|
193
|
+
"MF": "Saint-Martin",
|
|
194
|
+
"PM": "Saint-Pierre och Miquelon",
|
|
195
|
+
"SB": "Salomonöarna",
|
|
196
|
+
"WS": "Samoa",
|
|
197
|
+
"SM": "San Marino",
|
|
198
|
+
"SH": "Sankta Helena",
|
|
199
|
+
"ST": "São Tomé och Príncipe",
|
|
200
|
+
"SA": "Saudiarabien",
|
|
201
|
+
"CH": "Schweiz",
|
|
202
|
+
"SN": "Senegal",
|
|
203
|
+
"RS": "Serbien",
|
|
204
|
+
"SC": "Seychellerna",
|
|
205
|
+
"SL": "Sierra Leone",
|
|
206
|
+
"SG": "Singapore",
|
|
207
|
+
"SX": "Sint Maarten",
|
|
208
|
+
"SK": "Slovakien",
|
|
209
|
+
"SI": "Slovenien",
|
|
210
|
+
"SO": "Somalia",
|
|
211
|
+
"ES": "Spanien",
|
|
212
|
+
"LK": "Sri Lanka",
|
|
213
|
+
"GB": "Storbritannien",
|
|
214
|
+
"SD": "Sudan",
|
|
215
|
+
"SR": "Surinam",
|
|
216
|
+
"SJ": "Svalbard och Jan Mayen",
|
|
217
|
+
"SE": "Sverige",
|
|
218
|
+
"ZA": "Sydafrika",
|
|
219
|
+
"GS": "Sydgeorgien och Sydsandwichöarna",
|
|
220
|
+
"KR": "Sydkorea",
|
|
221
|
+
"SS": "Sydsudan",
|
|
222
|
+
"SY": "Syrien",
|
|
223
|
+
"TJ": "Tadzjikistan",
|
|
224
|
+
"TW": "Taiwan",
|
|
225
|
+
"TZ": "Tanzania",
|
|
226
|
+
"TD": "Tchad",
|
|
227
|
+
"TH": "Thailand",
|
|
228
|
+
"CZ": "Tjeckien",
|
|
229
|
+
"TG": "Togo",
|
|
230
|
+
"TK": "Tokelau",
|
|
231
|
+
"TO": "Tonga",
|
|
232
|
+
"TT": "Trinidad och Tobago",
|
|
233
|
+
"TA": "Tristan da Cunha",
|
|
234
|
+
"TN": "Tunisien",
|
|
235
|
+
"TR": "Turkiet",
|
|
236
|
+
"TM": "Turkmenistan",
|
|
237
|
+
"TC": "Turks- och Caicosöarna",
|
|
238
|
+
"TV": "Tuvalu",
|
|
239
|
+
"DE": "Tyskland",
|
|
240
|
+
"UG": "Uganda",
|
|
241
|
+
"UA": "Ukraina",
|
|
242
|
+
"HU": "Ungern",
|
|
243
|
+
"UY": "Uruguay",
|
|
244
|
+
"US": "USA",
|
|
245
|
+
"UM": "USA:s yttre öar",
|
|
246
|
+
"UZ": "Uzbekistan",
|
|
247
|
+
"VU": "Vanuatu",
|
|
248
|
+
"EH": "Västsahara",
|
|
249
|
+
"VA": "Vatikanstaten",
|
|
250
|
+
"VE": "Venezuela",
|
|
251
|
+
"VN": "Vietnam",
|
|
252
|
+
"WF": "Wallis och Futuna",
|
|
253
|
+
"ZM": "Zambia",
|
|
254
|
+
"ZW": "Zimbabwe"
|
|
255
|
+
}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import{RECEIVE_INVENTORIES}from"../constants";/**
|
|
2
|
-
* Creates the dispatched
|
|
3
|
-
* @param {Array}
|
|
4
|
-
* @
|
|
5
|
-
* @param {Array} inventories List of product invetories.
|
|
6
|
-
* @return {Object} The RECEIVE_PRODUCT_LOCATIONS action.
|
|
2
|
+
* Creates the dispatched RECEIVE_INVENTORIES action object.
|
|
3
|
+
* @param {Array} productInventories List of product inventories.
|
|
4
|
+
* @return {Object} The RECEIVE_INVENTORIES action.
|
|
7
5
|
*/var receiveInventories=function receiveInventories(productInventories){return{type:RECEIVE_INVENTORIES,productInventories:productInventories};};export default receiveInventories;
|
|
@@ -7,7 +7,9 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function asyncGenera
|
|
|
7
7
|
setMessage('locations.error_no_store_found');}else{setMessage('');}},[isLoading,locations,message]);/**
|
|
8
8
|
* Triggers an update when the value of the country selector changed.
|
|
9
9
|
* @param {SyntheticEvent} event A React event object.
|
|
10
|
-
*/var handleCountrySelectChange=useCallback(function(event){setCountryCode(event.target.value,productId,isStoreFinder);},[isStoreFinder,productId,setCountryCode])
|
|
10
|
+
*/var handleCountrySelectChange=useCallback(function(event){setCountryCode(event.target.value,productId,isStoreFinder);},[isStoreFinder,productId,setCountryCode]);useEffect(function(){if(!Array.isArray(supportedCountries)||!supportedCountries.length){return;}// Check if current countryCode is included in supportedCountries. Update the code to a valid
|
|
11
|
+
// one if nothing was found.
|
|
12
|
+
if(!supportedCountries.includes(countryCode)){handleCountrySelectChange({target:{value:supportedCountries[0]}});}},[countryCode,handleCountrySelectChange,supportedCountries]);/**
|
|
11
13
|
* Blurs the postal code input to trigger an update.
|
|
12
14
|
* @param {SyntheticEvent} event A React event object.
|
|
13
15
|
*/var handlePostalCodeSubmitKeyDown=useCallback(function(event){if(event.keyCode===13){inputEl.current.blur();}},[]);/**
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getProductsResult,productIsReady$,productsReceived$,productsReceivedCached$,RECEIVE_PRODUCTS_CACHED,variantDidChange$}from'@shopgate/engage/product';import{cartReceived$,fetchCart,cartDidEnter$,getCartItems}from'@shopgate/engage/cart';import{userDidLogin$}from'@shopgate/engage/user';import{appDidStart$,routeWillEnter$,UIEvents,getCurrentRoute,hex2bin,getThemeSettings,getCurrentSearchQuery}from'@shopgate/engage/core';import{receiveFavoritesWhileVisible$}from'@shopgate/pwa-common-commerce/favorites/streams';import{getFavoritesProductsIds,isFetching}from'@shopgate/pwa-common-commerce/favorites/selectors';import{categoryDidBackEnter$}from'@shopgate/pwa-common-commerce/category/streams';import{searchDidBackEntered$}from'@shopgate/pwa-common-commerce/search/streams';import{hasNewServices}from'@shopgate/engage/core/helpers';import{getUserSearch,getStoreFinderSearch,getPreferredLocation,getIsPending,getProductAlternativeLocationParams,getProductAlternativeLocations}from"./selectors";import{fetchLocations,fetchProductLocations,setPending,setUserGeolocation}from"./actions";import{setShowInventoryInLists,showInventoryInLists}from"./helpers/showInventoryInLists";import fetchInventories from"./actions/fetchInventories";import{EVENT_SET_OPEN}from"./providers/FulfillmentProvider";import fetchProductInventories from"./actions/fetchProductInventories";import{submitReservationSuccess$,userSearchChanged$,storeFinderWillEnter$,preferredLocationDidUpdateOnPDP$,provideAlternativeLocation$,preferredLocationDidUpdateGlobalOnWishlist$}from"./locations.streams";import selectLocation from"./action-creators/selectLocation";import{SET_STORE_FINDER_SEARCH_RADIUS}from"./constants";import selectGlobalLocation from"./action-creators/selectGlobalLocation";var initialLocationsResolve;var initialLocationsReject;var initialLocationsPromise=new Promise(function(resolve,reject){initialLocationsResolve=resolve;initialLocationsReject=reject;});/**
|
|
1
|
+
import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value;}catch(error){reject(error);return;}if(info.done){resolve(value);}else{Promise.resolve(value).then(_next,_throw);}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value);}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err);}_next(undefined);});};}import{getProductsResult,productIsReady$,productsReceived$,productsReceivedCached$,RECEIVE_PRODUCTS_CACHED,variantDidChange$}from'@shopgate/engage/product';import{cartReceived$,fetchCart,cartDidEnter$,getCartItems}from'@shopgate/engage/cart';import{userDidLogin$}from'@shopgate/engage/user';import{appDidStart$,routeWillEnter$,UIEvents,getCurrentRoute,hex2bin,getThemeSettings,getCurrentSearchQuery}from'@shopgate/engage/core';import{receiveFavoritesWhileVisible$}from'@shopgate/pwa-common-commerce/favorites/streams';import{getFavoritesProductsIds,isFetching}from'@shopgate/pwa-common-commerce/favorites/selectors';import{categoryDidBackEnter$}from'@shopgate/pwa-common-commerce/category/streams';import{searchDidBackEntered$}from'@shopgate/pwa-common-commerce/search/streams';import{hasNewServices}from'@shopgate/engage/core/helpers';import{cookieConsentInitialized$}from'@shopgate/engage/tracking/streams';import{getUserSearch,getStoreFinderSearch,getPreferredLocation,getIsPending,getProductAlternativeLocationParams,getProductAlternativeLocations}from"./selectors";import{fetchLocations,fetchProductLocations,setPending,setUserGeolocation}from"./actions";import{setShowInventoryInLists,showInventoryInLists}from"./helpers/showInventoryInLists";import fetchInventories from"./actions/fetchInventories";import{EVENT_SET_OPEN}from"./providers/FulfillmentProvider";import fetchProductInventories from"./actions/fetchProductInventories";import{submitReservationSuccess$,userSearchChanged$,storeFinderWillEnter$,preferredLocationDidUpdateOnPDP$,provideAlternativeLocation$,preferredLocationDidUpdateGlobalOnWishlist$}from"./locations.streams";import selectLocation from"./action-creators/selectLocation";import{SET_STORE_FINDER_SEARCH_RADIUS}from"./constants";import selectGlobalLocation from"./action-creators/selectGlobalLocation";var initialLocationsResolve;var initialLocationsReject;var initialLocationsPromise=new Promise(function(resolve,reject){initialLocationsResolve=resolve;initialLocationsReject=reject;});/**
|
|
2
2
|
* Sets a location once the location has been validated.
|
|
3
3
|
* @param {string} locationCode Location code
|
|
4
4
|
* @param {Function} dispatch Redux dispatch function
|
|
@@ -6,7 +6,7 @@ import _regeneratorRuntime from"@babel/runtime/regenerator";function _extends(){
|
|
|
6
6
|
*/var setLocationOnceAvailable=/*#__PURE__*/function(){var _ref=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(locationCode,dispatch){var _ref3,initialLocations;return _regeneratorRuntime.wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;_context.next=3;return initialLocationsPromise;case 3:_ref3=_context.sent;initialLocations=_ref3.locations;if(initialLocations.some(function(l){return l.code===locationCode;})){_context.next=7;break;}return _context.abrupt("return");case 7:dispatch(selectLocation({code:locationCode}));requestAnimationFrame(function(){dispatch(setPending(false));});_context.next=13;break;case 11:_context.prev=11;_context.t0=_context["catch"](0);case 13:case"end":return _context.stop();}},_callee,null,[[0,11]]);}));return function setLocationOnceAvailable(_x,_x2){return _ref.apply(this,arguments);};}();/**
|
|
7
7
|
* Locations subscriptions.
|
|
8
8
|
* @param {Function} subscribe The subscribe function.
|
|
9
|
-
*/function locationsSubscriber(subscribe){subscribe(
|
|
9
|
+
*/function locationsSubscriber(subscribe){subscribe(cookieConsentInitialized$,/*#__PURE__*/function(){var _ref5=_asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee2(_ref4){var dispatch,getState,userSearch,_ref7,locations,preferredLocation,code,hasLocation,_ref9,preferredLocationDefault,locationToPreselect;return _regeneratorRuntime.wrap(function _callee2$(_context2){while(1)switch(_context2.prev=_context2.next){case 0:dispatch=_ref4.dispatch,getState=_ref4.getState;if(hasNewServices()){_context2.next=3;break;}return _context2.abrupt("return");case 3:// Fetch merchants locations.
|
|
10
10
|
userSearch=getUserSearch(getState());_context2.prev=4;_context2.next=7;return dispatch(fetchLocations(userSearch));case 7:_ref7=_context2.sent;locations=_ref7.locations;preferredLocation=getPreferredLocation(getState());if(!preferredLocation){_context2.next=16;break;}code=preferredLocation.code;// Check if the preferred location is included within the fetched locations
|
|
11
11
|
hasLocation=!!locations.find(function(location){return location.code===code;});if(hasLocation){_context2.next=16;break;}_context2.next=16;return dispatch(fetchLocations({codes:[code]}));case 16:// Preset preferredLocation if configured
|
|
12
12
|
_ref9=getThemeSettings('@shopgate/engage/locations')||{},preferredLocationDefault=_ref9.preferredLocationDefault;if(preferredLocationDefault){// check if there is already a preferredLocation for the user, if not set one
|
package/orders/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/** @module orders */import{CHECKOUT_PATH}from'@shopgate/pwa-common/constants/RoutePaths';// CONSTANTS
|
|
2
|
-
export*from'@shopgate/pwa-common-commerce/orders/constants';export{CHECKOUT_PATH};export{
|
|
2
|
+
export*from'@shopgate/pwa-common-commerce/orders/constants';export{CHECKOUT_PATH};export{makeGetOrderById}from"./selectors";export{getTranslatedOrderStatus,getTranslatedLineItemStatus,getLineItemActiveStatus}from"./helpers";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shopgate/engage",
|
|
3
|
-
"version": "7.20.0-beta.
|
|
3
|
+
"version": "7.20.0-beta.10",
|
|
4
4
|
"description": "Shopgate's ENGAGE library.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"author": "Shopgate <support@shopgate.com>",
|
|
@@ -16,12 +16,12 @@
|
|
|
16
16
|
],
|
|
17
17
|
"dependencies": {
|
|
18
18
|
"@shopgate/native-modules": "1.0.0-beta.18",
|
|
19
|
-
"@shopgate/pwa-common": "7.20.0-beta.
|
|
20
|
-
"@shopgate/pwa-common-commerce": "7.20.0-beta.
|
|
21
|
-
"@shopgate/pwa-core": "7.20.0-beta.
|
|
22
|
-
"@shopgate/pwa-ui-ios": "7.20.0-beta.
|
|
23
|
-
"@shopgate/pwa-ui-material": "7.20.0-beta.
|
|
24
|
-
"@shopgate/pwa-ui-shared": "7.20.0-beta.
|
|
19
|
+
"@shopgate/pwa-common": "7.20.0-beta.10",
|
|
20
|
+
"@shopgate/pwa-common-commerce": "7.20.0-beta.10",
|
|
21
|
+
"@shopgate/pwa-core": "7.20.0-beta.10",
|
|
22
|
+
"@shopgate/pwa-ui-ios": "7.20.0-beta.10",
|
|
23
|
+
"@shopgate/pwa-ui-material": "7.20.0-beta.10",
|
|
24
|
+
"@shopgate/pwa-ui-shared": "7.20.0-beta.10",
|
|
25
25
|
"@stripe/react-stripe-js": "^1.1.2",
|
|
26
26
|
"@stripe/stripe-js": "^1.3.1",
|
|
27
27
|
"@virtuous/conductor": "~2.5.0",
|
package/page/selectors/index.js
CHANGED
|
@@ -1 +1,7 @@
|
|
|
1
|
-
export*from'@shopgate/pwa-common/selectors/page'
|
|
1
|
+
import{createSelector}from'reselect';import{makeGetMenu,makeGetIsFetchingMenu}from'@shopgate/engage/core/selectors';import{LEGAL_MENU}from'@shopgate/engage/core/constants';import{hasNewServices}from'@shopgate/engage/core';import{PRIVACY_PATH}from"../constants";export*from'@shopgate/pwa-common/selectors/page';/**
|
|
2
|
+
* Creates a selector that retrieves the privacy policy link.
|
|
3
|
+
*
|
|
4
|
+
* When the new services are active, the link is extracted from the "shopgate.cms.getMenu" response.
|
|
5
|
+
* Otherwise it's a static link to the legacy privacy page.
|
|
6
|
+
* @returns {string|null}
|
|
7
|
+
*/export var makeGetPrivacyPolicyLink=function makeGetPrivacyPolicyLink(){var getMenu=makeGetMenu(LEGAL_MENU);var getIsFetchingMenu=makeGetIsFetchingMenu(LEGAL_MENU);return createSelector(getMenu,getIsFetchingMenu,function(menu,fetching){if(!hasNewServices()){return PRIVACY_PATH;}if(fetching||!menu){return null;}var entry=menu.find(function(item){return item.url.includes('privacy');})||{};return(entry===null||entry===void 0?void 0:entry.url)||null;});};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import React from'react';import{mount,shallow}from'enzyme';import{PickerUtilize as Picker}from'@shopgate/engage/components';import Options from"./index";jest.mock('@shopgate/engage/product/contexts',function(){return{ProductContext:{Consumer:jest.fn(function(_ref){var children=_ref.children;return children({setOption:jest.fn(),currency:'EUR'});})}};})
|
|
1
|
+
import React from'react';import{mount,shallow}from'enzyme';import{PickerUtilize as Picker}from'@shopgate/engage/components';import Options from"./index";jest.mock('@shopgate/engage/components');jest.mock('@shopgate/engage/product/contexts',function(){return{ProductContext:{Consumer:jest.fn(function(_ref){var children=_ref.children;return children({setOption:jest.fn(),currency:'EUR'});})}};});// Mock the redux connect() method instead of providing a fake store.
|
|
2
2
|
jest.mock("./connector",function(){return function(obj){var newObj=obj;var mockOptions=[{id:'test-id',type:'select',label:'label',items:[{currency:'USD',price:10,priceDifference:0},{currency:'USD',price:10,priceDifference:0}]}];newObj.defaultProps={options:mockOptions,currentOptions:{}};return newObj;};});describe('<Options />',function(){var mockOptions=[{id:'test-id',type:'select',label:'label',items:[{currency:'USD',price:10,priceDifference:0},{currency:'USD',price:10,priceDifference:0}]}];describe('Given the component was mounted to the DOM',function(){it('should match snapshot',function(){var wrapper=shallow(React.createElement(Options,{currentOptions:{}})).dive();expect(wrapper).toMatchSnapshot();});it('should render correct number of options',function(){var wrapper=mount(React.createElement(Options,{options:mockOptions}));var picker=wrapper.find(Picker);expect(picker.length).toBe(mockOptions.length);});});});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from'react';import PropTypes from'prop-types';import{useWidgetSettings}from'@shopgate/engage/core';import{Swiper}from'@shopgate/engage/components';import{Theme}from'@shopgate/engage/core/contexts';import{ProductListTypeProvider,ProductListEntryProvider}from'@shopgate/engage/product/providers';import{container,items}from"./style";export var WIDGET_ID='@shopgate/engage/product/ProductSlider';/**
|
|
2
2
|
* @param {Object} props The component props.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/function ProductSlider(props){var autoplay=props.autoplay,className=props.className,delay=props.delay,productIds=props.productIds,snap=props.snap,scope=props.scope;var widgetSettings=useWidgetSettings(WIDGET_ID)||{};var _ref=props.slidesPerView?props:widgetSettings,_ref$slidesPerView=_ref.slidesPerView,slidesPerView=_ref$slidesPerView===void 0?2.3:_ref$slidesPerView;return React.createElement(Theme,null,function(_ref2){var ProductCard=_ref2.ProductCard;var Item=props.item||ProductCard;return React.createElement(ProductListTypeProvider,{type:"productSlider",subType:scope},React.createElement(Swiper,{autoPlay:autoplay,className:"".concat(className," engage__product__product-slider"),controls:false,indicators:false,interval:delay,loop:false,freeMode:!snap,slidesPerView:slidesPerView},productIds.map(function(id){return React.createElement(Swiper.Item,{key:id,className:container},React.createElement(ProductListEntryProvider,{productId:id},React.createElement(Item,{productId:id,style:items})));})));});}ProductSlider.WIDGET_ID=WIDGET_ID;ProductSlider.defaultProps={autoplay:false,className:null,delay:10,item:null,slidesPerView:null,snap:false,scope:null};export default ProductSlider;
|
|
4
|
+
*/function ProductSlider(props){var autoplay=props.autoplay,className=props.className,delay=props.delay,productIds=props.productIds,snap=props.snap,scope=props.scope,meta=props.meta;var widgetSettings=useWidgetSettings(WIDGET_ID)||{};var _ref=props.slidesPerView?props:widgetSettings,_ref$slidesPerView=_ref.slidesPerView,slidesPerView=_ref$slidesPerView===void 0?2.3:_ref$slidesPerView;return React.createElement(Theme,null,function(_ref2){var ProductCard=_ref2.ProductCard;var Item=props.item||ProductCard;return React.createElement(ProductListTypeProvider,{type:"productSlider",subType:scope,meta:meta},React.createElement(Swiper,{autoPlay:autoplay,className:"".concat(className," engage__product__product-slider"),controls:false,indicators:false,interval:delay,loop:false,freeMode:!snap,slidesPerView:slidesPerView},productIds.map(function(id){return React.createElement(Swiper.Item,{key:id,className:container},React.createElement(ProductListEntryProvider,{productId:id},React.createElement(Item,{productId:id,style:items})));})));});}ProductSlider.WIDGET_ID=WIDGET_ID;ProductSlider.defaultProps={autoplay:false,className:null,delay:10,item:null,slidesPerView:null,snap:false,scope:null,meta:null};export default ProductSlider;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import{useWidgetSettings}from"../../../core";/**
|
|
2
|
+
* @param {Object} [productStock={}] product.stock object
|
|
3
|
+
* @returns {Object}
|
|
4
|
+
*/export var useQuantityRange=function useQuantityRange(){var _ref,_ref2;var productStock=arguments.length>0&&arguments[0]!==undefined?arguments[0]:{};var settings=useWidgetSettings('@shopgate/engage/product/QuantityPicker');if(!productStock){return null;}var min=(_ref=settings===null||settings===void 0?void 0:settings.minOrderQuantity)!==null&&_ref!==void 0?_ref:1;if(productStock.minOrderQuantity>0){min=productStock.minOrderQuantity;}var max=(_ref2=settings===null||settings===void 0?void 0:settings.maxOrderQuantity)!==null&&_ref2!==void 0?_ref2:50;if(productStock.maxOrderQuantity>0){max=Math.min(Math.max(min,max),productStock.maxOrderQuantity);}// Normalize min if max is finally less then min
|
|
5
|
+
min=Math.min(min,max);return{min:min,max:max};};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useState,useEffect}from'react';import PropTypes from'prop-types';import{css}from'glamor';import{
|
|
1
|
+
function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useState,useEffect}from'react';import PropTypes from'prop-types';import{css}from'glamor';import{logger}from"../../../core/helpers";import{useWidgetStyles}from"../../../core/hooks";import{I18n,SheetDrawer,SheetList}from"../../../components";import{useQuantityRange}from"./hooks";var deprecationWarning='QuantityPicker is deprecated in favor of the UnitQuantityPicker component.\nUnitQuantityPicker now additionally supports units and floating point values.';/** */function triggerDeprecation(){if(deprecationWarning){logger.warn(deprecationWarning);deprecationWarning=null;}}/**
|
|
2
2
|
* The QuantityPicker component.
|
|
3
3
|
* @deprecated Use UnitQuantityPicker to also support different units for quantity.
|
|
4
4
|
* @returns {JSX}
|
|
@@ -16,4 +16,4 @@ setPromiseResolve(function(){return resolve;});// Open sheet
|
|
|
16
16
|
setOpened(true);});};// Mount effect
|
|
17
17
|
useEffect(function(){// Add most late conditioner
|
|
18
18
|
conditioner.addConditioner('product-quantity',checkQuantity,100);},[conditioner]);// Update resolveValue effect
|
|
19
|
-
useEffect(function(){if(resolveValue===null){return;}if(promiseResolve){promiseResolve(resolveValue);}setResolveValue(null);},[promiseResolve,resolveValue]);var styles=useWidgetStyles('@shopgate/engage/product/QuantityPicker');if(!stock){return null;}var
|
|
19
|
+
useEffect(function(){if(resolveValue===null){return;}if(promiseResolve){promiseResolve(resolveValue);}setResolveValue(null);},[promiseResolve,resolveValue]);var styles=useWidgetStyles('@shopgate/engage/product/QuantityPicker');var quantityRange=useQuantityRange(stock);if(!stock){return null;}var min=quantityRange.min,max=quantityRange.max;var items=Array(max-min+1).fill(min).map(function(v,index){return String(v+index);});return React.createElement(SheetDrawer,{title:React.createElement(I18n.Text,{string:"product.quantity"}),isOpen:opened,onClose:handleCloseSheet,contentClassName:css(styles.sheet).toString()},React.createElement(SheetList,null,items.map(function(item){return React.createElement(SheetList.Item,{title:item,key:item,onClick:function onClick(){return handleSelectQuantity(parseInt(item,10));}});})));};QuantityPicker.defaultProps={stock:null};export default QuantityPicker;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import{Provider}from'react-redux';import configureStore from'redux-mock-store';import{mount}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import{setMocks,mockedStateWithTwoReviews,mockedStateWithoutReview}from'@shopgate/pwa-common-commerce/reviews/mock';import Rating from"./index";import{getElementById}from"./mock";setMocks();describe('Rating (product header)',function(){var mockedStore=configureStore();/**
|
|
1
|
+
import React from'react';import{Provider}from'react-redux';import configureStore from'redux-mock-store';import{mount}from'enzyme';import mockRenderOptions from'@shopgate/pwa-common/helpers/mocks/mockRenderOptions';import{setMocks,mockedStateWithTwoReviews,mockedStateWithoutReview}from'@shopgate/pwa-common-commerce/reviews/mock';import Rating from"./index";import{getElementById}from"./mock";setMocks();jest.mock('@shopgate/engage/components');describe('Rating (product header)',function(){var mockedStore=configureStore();/**
|
|
2
2
|
* Makes component.
|
|
3
3
|
* @param {Object} state State
|
|
4
4
|
* @returns {Object}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React from'react';import UnitQuantityPicker from"./UnitQuantityPicker";import{small,big}from"./styles";/**
|
|
1
|
+
import React from'react';import PropTypes from'prop-types';import noop from'lodash/noop';import UnitQuantityPicker from"./UnitQuantityPicker";import{small,big}from"./styles";/**
|
|
2
2
|
* @param {Object} props The component props.
|
|
3
3
|
* @returns {JSX}
|
|
4
|
-
*/var CartUnitQuantityPicker=function CartUnitQuantityPicker(_ref){var unit=_ref.unit,value=_ref.value,onChange=_ref.onChange,classNames=_ref.classNames,hasCatchWeight=_ref.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;var withDecimals=classNames.withDecimals,withoutDecimals=classNames.withoutDecimals;return React.createElement(UnitQuantityPicker,{className
|
|
4
|
+
*/var CartUnitQuantityPicker=function CartUnitQuantityPicker(_ref){var unit=_ref.unit,value=_ref.value,onChange=_ref.onChange,classNames=_ref.classNames,hasCatchWeight=_ref.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;var withDecimals=classNames.withDecimals,withoutDecimals=classNames.withoutDecimals;return React.createElement(UnitQuantityPicker,{className:!hasUnitWithDecimals?withDecimals:withoutDecimals,unit:hasUnitWithDecimals?unit:null,maxDecimals:hasUnitWithDecimals?2:0,incrementStep:hasUnitWithDecimals?0.25:1,decrementStep:hasUnitWithDecimals?0.25:1,onChange:onChange,value:value});};CartUnitQuantityPicker.defaultProps={unit:null,onChange:noop,classNames:{withDecimals:big,withoutDecimals:small},hasCatchWeight:false};export default CartUnitQuantityPicker;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import React,{useContext,useMemo}from'react';import PropTypes from'prop-types';import{css}from'glamor';import classNames from'classnames';import{I18n,SurroundPortals}from'@shopgate/engage/components';import{themeConfig}from'@shopgate/engage';import{PRODUCT_UNIT_QUANTITY_PICKER,ProductContext}from'@shopgate/engage/product';import{withCurrentProduct}from'@shopgate/engage/core';import UnitQuantityPicker from"./UnitQuantityPicker";import connect from"./ProductUnitQuantityPicker.connector";import{small,big}from"./styles";var variables=themeConfig.variables;var styles={root:css({
|
|
1
|
+
import React,{useContext,useMemo}from'react';import PropTypes from'prop-types';import{css}from'glamor';import classNames from'classnames';import{I18n,SurroundPortals}from'@shopgate/engage/components';import{themeConfig}from'@shopgate/engage';import{PRODUCT_UNIT_QUANTITY_PICKER,ProductContext}from'@shopgate/engage/product';import{hasNewServices}from'@shopgate/engage/core/helpers';import{withCurrentProduct}from'@shopgate/engage/core/hocs';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import UnitQuantityPicker from"./UnitQuantityPicker";import connect from"./ProductUnitQuantityPicker.connector";import{small,big}from"./styles";var variables=themeConfig.variables;var styles={root:css({padding:variables.gap.big}),title:css({fontSize:'1rem',fontWeight:500,marginBottom:'0.5rem'}).toString()};/**
|
|
2
2
|
* Renders the quantity picker enriched with current product data.
|
|
3
3
|
* @param {Object} props Props
|
|
4
4
|
* @returns {JSX}
|
|
5
|
-
*/var ProductUnitQuantityPicker=function ProductUnitQuantityPicker(_ref){var children=_ref.children,className=_ref.className,product=_ref.product,disabled=_ref.disabled,stockInfo=_ref.stockInfo;var _useContext=useContext(ProductContext),quantity=_useContext.quantity,setQuantity=_useContext.setQuantity;var _useMemo=useMemo(function(){var min;var max;if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.minOrderQuantity)>0){min=stockInfo.minOrderQuantity;}if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.maxOrderQuantity)>0){max=stockInfo.maxOrderQuantity;}return{minValue:min,maxValue:max};},[stockInfo]),minValue=_useMemo.minValue,maxValue=_useMemo.maxValue;if(!product){return null;}var unit=product.unit,hasCatchWeight=product.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;return React.createElement(SurroundPortals,{portalName:PRODUCT_UNIT_QUANTITY_PICKER},React.createElement("div",{className:classNames(styles.root,className)},React.createElement("div",null
|
|
5
|
+
*/var ProductUnitQuantityPicker=function ProductUnitQuantityPicker(_ref){var children=_ref.children,className=_ref.className,classes=_ref.classes,product=_ref.product,disabled=_ref.disabled,stockInfo=_ref.stockInfo,size=_ref.size,quantityLabel=_ref.quantityLabel,hideHeadline=_ref.hideHeadline;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/product/components/UnitQuantityPicker'),_useWidgetSettings$sh=_useWidgetSettings.show,show=_useWidgetSettings$sh===void 0?hasNewServices():_useWidgetSettings$sh;var _useContext=useContext(ProductContext),quantity=_useContext.quantity,setQuantity=_useContext.setQuantity;var _useMemo=useMemo(function(){var min;var max;if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.minOrderQuantity)>0){min=stockInfo.minOrderQuantity;}if((stockInfo===null||stockInfo===void 0?void 0:stockInfo.maxOrderQuantity)>0){max=stockInfo.maxOrderQuantity;}return{minValue:min,maxValue:max};},[stockInfo]),minValue=_useMemo.minValue,maxValue=_useMemo.maxValue;if(!product||!show){return null;}var unit=product.unit,hasCatchWeight=product.hasCatchWeight;var hasUnitWithDecimals=unit&&hasCatchWeight||false;return React.createElement(SurroundPortals,{portalName:PRODUCT_UNIT_QUANTITY_PICKER},React.createElement("div",{className:classNames(styles.root,className)},React.createElement("div",null,!hideHeadline&&React.createElement("div",{className:styles.title},React.createElement(I18n.Text,{string:"product.sections.quantity"})),React.createElement(UnitQuantityPicker// eslint-disable-next-line no-nested-ternary
|
|
6
|
+
,{className:(classes===null||classes===void 0?void 0:classes.picker)?classes.picker:hasUnitWithDecimals?big:small,unit:hasUnitWithDecimals?unit:null,maxDecimals:hasUnitWithDecimals?2:0,incrementStep:hasUnitWithDecimals?0.25:1,decrementStep:hasUnitWithDecimals?0.25:1,onChange:setQuantity,value:quantity,disabled:disabled,minValue:minValue,maxValue:maxValue,size:size,quantityLabel:quantityLabel})),children&&React.createElement("div",null,children)));};ProductUnitQuantityPicker.defaultProps={disabled:false,product:null,size:undefined,stockInfo:null,children:null,className:null,quantityLabel:null,classes:{picker:null},hideHeadline:false};export default withCurrentProduct(connect(ProductUnitQuantityPicker));
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}import React,{useCallback,useEffect,useState,useRef}from'react';import PropTypes from'prop-types';import{i18n,UIEvents}from'@shopgate/engage/core';import{css}from'glamor';import classNames from'classnames';import{themeConfig}from'@shopgate/engage';import{RippleButton,QuantityInput}from'@shopgate/engage/components';import{broadcastLiveMessage}from'@shopgate/engage/a11y';var variables=themeConfig.variables,colors=themeConfig.colors;var styles={root:css({display:'flex',flexDirection:'row',position:'relative',zIndex:5}).toString(),backdrop:css({zIndex:4,top:0,left:0,height:'100%',width:'100%',position:'fixed'}),input:css({padding:"0 ".concat(variables.gap.small,"px"),textAlign:'center',
|
|
1
|
+
function _defineProperty(obj,key,value){if(key in obj){Object.defineProperty(obj,key,{value:value,enumerable:true,configurable:true,writable:true});}else{obj[key]=value;}return obj;}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_nonIterableRest();}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance");}function _iterableToArrayLimit(arr,i){var _arr=[];var _n=true;var _d=false;var _e=undefined;try{for(var _i=arr[Symbol.iterator](),_s;!(_n=(_s=_i.next()).done);_n=true){_arr.push(_s.value);if(i&&_arr.length===i)break;}}catch(err){_d=true;_e=err;}finally{try{if(!_n&&_i["return"]!=null)_i["return"]();}finally{if(_d)throw _e;}}return _arr;}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr;}function _extends(){_extends=Object.assign||function(target){for(var i=1;i<arguments.length;i++){var source=arguments[i];for(var key in source){if(Object.prototype.hasOwnProperty.call(source,key)){target[key]=source[key];}}}return target;};return _extends.apply(this,arguments);}import React,{useCallback,useEffect,useState,useRef,useMemo}from'react';import PropTypes from'prop-types';import{i18n,hasNewServices}from'@shopgate/engage/core/helpers';import{UIEvents}from'@shopgate/engage/core';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import{css}from'glamor';import classNames from'classnames';import{themeConfig}from'@shopgate/engage';import{RippleButton,QuantityInput}from'@shopgate/engage/components';import{broadcastLiveMessage}from'@shopgate/engage/a11y/helpers';var variables=themeConfig.variables,colors=themeConfig.colors;var styles={root:css({display:'flex',flexDirection:'row',position:'relative',zIndex:5}).toString(),backdrop:css({zIndex:4,top:0,left:0,height:'100%',width:'100%',position:'fixed'}),inputWrapper:function inputWrapper(_ref){var inputColor=_ref.inputColor,inputBgColor=_ref.inputBgColor;return css(_extends({display:'flex',alignItems:'center',width:'100%',fontSize:16,backgroundColor:"var(--color-background-accent, ".concat(colors.shade8,")")},inputColor&&{color:"".concat(inputColor," !important")},{},inputBgColor&&{backgroundColor:"".concat(inputBgColor," !important")},{' .quantity-label':{paddingLeft:variables.gap.small,paddingRight:4,textAlign:'center',width:'calc(100% - 32px)',textOverflow:'ellipsis',overflow:'hidden',whiteSpace:'nowrap'}}));},input:function input(_ref2){var inputColor=_ref2.inputColor,inputBgColor=_ref2.inputBgColor,hasLabel=_ref2.hasLabel,size=_ref2.size;var fontWeight=size==='large'?600:'normal';return css(_extends({padding:"0 ".concat(variables.gap.small,"px"),textAlign:hasLabel?'left':'center',fontWeight:fontWeight,height:'100%',width:'100%'},inputColor&&{color:"".concat(inputColor)},{},inputBgColor&&{backgroundColor:"".concat(inputBgColor," !important")},{},hasLabel&&{paddingLeft:0},{outline:'none','&:focus:not(:focus-visible)':{outline:'none'}})).toString();},button:function button(_ref3){var _ref3$size=_ref3.size,size=_ref3$size===void 0?'default':_ref3$size,buttonColor=_ref3.buttonColor,buttonBgColor=_ref3.buttonBgColor;var sizeValue=size==='large'?36:28;return css({width:sizeValue,' &&':{minWidth:sizeValue,padding:0},height:sizeValue,fontSize:"".concat(Math.floor(sizeValue/28*100),"% !important"),'&:not(:disabled)':_extends({},buttonColor&&{color:"".concat(buttonColor," !important")},{},buttonBgColor&&{backgroundColor:"".concat(buttonBgColor," !important")})});},buttonRipple:css({padding:0}).toString(),buttonNoRadiusLeft:css({' &&':{borderTopLeftRadius:0,borderBottomLeftRadius:0}}).toString(),buttonNoRadiusRight:css({' &&':{borderTopRightRadius:0,borderBottomRightRadius:0}}).toString(),disabled:css({' > div':{padding:0}}).toString()};/**
|
|
2
2
|
* A Quantity Picker with unit support.
|
|
3
3
|
* @returns {JSX.Element}
|
|
4
|
-
*/var UnitQuantityPicker=function UnitQuantityPicker(
|
|
4
|
+
*/var UnitQuantityPicker=function UnitQuantityPicker(_ref4){var className=_ref4.className,onChange=_ref4.onChange,value=_ref4.value,allowDecrement=_ref4.allowDecrement,allowIncrement=_ref4.allowIncrement,allowZero=_ref4.allowZero,decrementStep=_ref4.decrementStep,incrementStep=_ref4.incrementStep,maxDecimals=_ref4.maxDecimals,unit=_ref4.unit,disabled=_ref4.disabled,minValue=_ref4.minValue,maxValue=_ref4.maxValue,size=_ref4.size,toggleTabBarOnFocus=_ref4.toggleTabBarOnFocus,quantityLabel=_ref4.quantityLabel;var widgetDefaults=useMemo(function(){if(hasNewServices()){// The widget configuration was introduced with CCP-2449 in PWA6. It's inactive for now
|
|
5
|
+
// when running on new services, since for those shops it never existed and the default
|
|
6
|
+
// values would introduce breaking changes.
|
|
7
|
+
return{};}return{buttonColor:colors.shade8,buttonBgColor:colors.primary,inputColor:colors.dark,inputBgColor:colors.shade8,showLabel:true};},[]);var _useWidgetSettings=useWidgetSettings('@shopgate/engage/product/components/UnitQuantityPicker'),_useWidgetSettings$bu=_useWidgetSettings.buttonColor,buttonColor=_useWidgetSettings$bu===void 0?widgetDefaults.buttonColor:_useWidgetSettings$bu,_useWidgetSettings$bu2=_useWidgetSettings.buttonBgColor,buttonBgColor=_useWidgetSettings$bu2===void 0?widgetDefaults.buttonBgColor:_useWidgetSettings$bu2,_useWidgetSettings$in=_useWidgetSettings.inputColor,inputColor=_useWidgetSettings$in===void 0?widgetDefaults.inputColor:_useWidgetSettings$in,_useWidgetSettings$in2=_useWidgetSettings.inputBgColor,inputBgColor=_useWidgetSettings$in2===void 0?widgetDefaults.inputBgColor:_useWidgetSettings$in2,_useWidgetSettings$sh=_useWidgetSettings.showLabel,showLabel=_useWidgetSettings$sh===void 0?widgetDefaults.showLabel:_useWidgetSettings$sh;var _useState=useState(false),_useState2=_slicedToArray(_useState,2),isFocused=_useState2[0],setIsFocused=_useState2[1];var inputRef=useRef(null);var handleOnFocus=useCallback(function(){setIsFocused(true);if(toggleTabBarOnFocus){UIEvents.emit('HIDE_TAB_BAR');}},[toggleTabBarOnFocus]);var handleOnBlur=useCallback(function(){setIsFocused(false);if(toggleTabBarOnFocus){UIEvents.emit('SHOW_TAB_BAR');}},[toggleTabBarOnFocus]);var handleManualChange=useCallback(function(newValue){onChange(newValue);var message;if(newValue<value){message='product.decreased_quantity_to';}if(newValue>value){message='product.increased_quantity_to';}if(message){broadcastLiveMessage(message,{params:{quantity:newValue}});}},[onChange,value]);var handleDecrement=useCallback(function(event){var newValue=value-decrementStep;if(newValue<=0&&!allowZero||minValue&&newValue<minValue){newValue=value;}handleManualChange(newValue);event.preventDefault();event.stopPropagation();},[allowZero,decrementStep,handleManualChange,minValue,value]);var handleIncrement=useCallback(function(event){var newValue=value+incrementStep;if(maxValue&&newValue>maxValue){newValue=value;}handleManualChange(newValue);event.preventDefault();event.stopPropagation();},[handleManualChange,incrementStep,maxValue,value]);useEffect(function(){if(minValue&&value<minValue){onChange(minValue);}if(maxValue&&value>maxValue){onChange(maxValue);}/* eslint-disable react-hooks/exhaustive-deps */},[]);/* eslint-enable react-hooks/exhaustive-deps */ /**
|
|
5
8
|
* Handler for pressing "enter" on Android
|
|
6
9
|
*/var handleKeyDown=useCallback(function(event){if(event.key==='Enter'&&inputRef.current!==null){try{inputRef.current.blur();}catch(e){// nothing to do here
|
|
7
10
|
}}},[]);return React.createElement(React.Fragment,null,isFocused&&// Show hidden backdrop when focused to avoid side effects when user blurs the input
|
|
8
11
|
// e.g. opening links unintended
|
|
9
|
-
React.createElement("div",{className:styles.backdrop}),React.createElement("div",{className:"".concat(styles.root," ").concat(className)},React.createElement(RippleButton,{rippleClassName:styles.buttonRipple,className:classNames(styles.button,styles.buttonNoRadiusRight,_defineProperty({},styles.disabled
|
|
12
|
+
React.createElement("div",{className:styles.backdrop}),React.createElement("div",{className:"".concat(styles.root," ").concat(className)},React.createElement(RippleButton,{type:"secondary",disabled:!allowDecrement||disabled,rippleClassName:styles.buttonRipple,className:classNames(styles.button({size:size,buttonColor:buttonColor,buttonBgColor:buttonBgColor}),styles.buttonNoRadiusRight,_defineProperty({},styles.disabled,!allowDecrement||disabled)),onClick:handleDecrement,"aria-label":i18n.text('product.decrease_quantity')},"-"),React.createElement("span",{className:styles.inputWrapper({inputColor:inputColor,inputBgColor:inputBgColor})},quantityLabel&&showLabel&&React.createElement("span",{"aria-hidden":true,className:"quantity-label"},quantityLabel),React.createElement(QuantityInput,{className:styles.input({inputColor:inputColor,inputBgColor:inputBgColor,hasLabel:showLabel&&!!quantityLabel,size:size}),value:value,onChange:onChange,maxDecimals:maxDecimals,unit:unit,disabled:disabled,minValue:minValue,maxValue:maxValue,"aria-label":i18n.text('product.quantity'),onFocus:handleOnFocus,onBlur:handleOnBlur,onKeyDown:handleKeyDown,ref:inputRef})),React.createElement(RippleButton,{type:"secondary",disabled:!allowIncrement||disabled,rippleClassName:styles.buttonRipple,className:classNames(styles.button({size:size,buttonColor:buttonColor,buttonBgColor:buttonBgColor}),styles.buttonNoRadiusLeft,_defineProperty({},styles.disabled,!allowIncrement||disabled)),onClick:handleIncrement,"aria-label":i18n.text('product.increase_quantity')},"+")));};UnitQuantityPicker.defaultProps={className:'',allowZero:false,allowIncrement:true,allowDecrement:true,incrementStep:0.25,decrementStep:0.25,maxDecimals:2,unit:null,disabled:false,minValue:null,size:'default',maxValue:null,quantityLabel:null,toggleTabBarOnFocus:false};export default UnitQuantityPicker;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React,{useMemo}from'react';import{css}from'glamor';import PropTypes from'prop-types';import{connect}from'react-redux';import{hasNewServices,i18n}from'@shopgate/engage/core/helpers';import{useWidgetSettings}from'@shopgate/engage/core/hooks';import{withCurrentProduct,withWidgetSettings}from'@shopgate/engage/core/hocs';import{Section}from'@shopgate/engage/a11y/components';import{makeGetCurrentProductPropertyByLabel}from'@shopgate/engage/product/selectors/product';import ProductUnitQuantityPicker from"./ProductUnitQuantityPicker";import OrderQuantityHint from"../OrderQuantityHint";var styles={quantityPicker:css({display:'flex',flexDirection:'column'}).toString(),quantityPickerPicker:css({width:'100%'}).toString(),quantityHint:css({'&:not(:empty)':{paddingTop:8,marginBottom:-4}}).toString()};/**
|
|
2
|
+
* A Quantity Picker with unit support.
|
|
3
|
+
* @returns {JSX.Element}
|
|
4
|
+
*/var UnitQuantityPickerWithSection=function UnitQuantityPickerWithSection(_ref){var productId=_ref.productId,variantId=_ref.variantId,productProperty=_ref.productProperty;var _useWidgetSettings=useWidgetSettings('@shopgate/engage/product/components/UnitQuantityPicker'),_useWidgetSettings$sh=_useWidgetSettings.show,show=_useWidgetSettings$sh===void 0?hasNewServices():_useWidgetSettings$sh;var quantityLabel=useMemo(function(){var _ref2;if(!show){return null;}var label=i18n.text('product.sections.quantity');if(((_ref2=productProperty===null||productProperty===void 0?void 0:productProperty.value)!==null&&_ref2!==void 0?_ref2:'')!==''){label=productProperty.value;}return label;},[productProperty,show]);if(!show){return null;}return React.createElement(Section,{title:"product.sections.quantity"},React.createElement(ProductUnitQuantityPicker,{className:styles.quantityPicker,classes:{picker:styles.quantityPickerPicker},size:"large",quantityLabel:quantityLabel,hideHeadline:true},React.createElement(OrderQuantityHint,{productId:variantId||productId,className:styles.quantityHint})));};UnitQuantityPickerWithSection.defaultProps={productId:null,variantId:null,productProperty:null};/**
|
|
5
|
+
* Creates the mapStateToProps connector function.
|
|
6
|
+
* @returns {Function}
|
|
7
|
+
*/var makeMapStateToProps=function makeMapStateToProps(){var getCurrentProductPropertyByLabel=makeGetCurrentProductPropertyByLabel();return function(state,props){return{productProperty:getCurrentProductPropertyByLabel(state,props)};};};export default withWidgetSettings(withCurrentProduct(connect(makeMapStateToProps)(UnitQuantityPickerWithSection)),'@shopgate/engage/product/components/UnitQuantityPicker');
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as
|
|
1
|
+
export{default as CartUnitQuantityPicker}from"./CartUnitQuantityPicker";export{default as ProductUnitQuantityPicker}from"./ProductUnitQuantityPicker";export{default as UnitQuantityPicker}from"./UnitQuantityPicker";export{default as UnitQuantityPickerWithSection}from"./UnitQuantityPickerWithSection";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export*from"./Availability";export{default as Characteristics}from"./Characteristics";export{default as Description}from"./Description";export{default as EffectivityDates}from"./EffectivityDates";export{default as MapPriceHint}from"./MapPriceHint";export*from"./Media";export{default as MediaSlider}from"./MediaSlider";export{default as Options}from"./Options";export{default as OrderQuantityHint}from"./OrderQuantityHint";export{default as PriceDifference}from"./PriceDifference";export*from"./PriceInfo";export{default as ProductBadges}from"./ProductBadges";export{default as ProductCard}from"./ProductCard";export{default as ProductCharacteristics}from"./ProductCharacteristics";export{default as ProductDiscountBadge}from"./ProductDiscountBadge";export{default as ProductGridPrice}from"./ProductGridPrice";export{default as ProductImage}from"./ProductImage";export{default as ProductList}from"./ProductList";export*from"./ProductName";export{default as ProductProperties}from"./ProductProperties/ProductProperties";export{default as
|
|
1
|
+
export*from"./Availability";export{default as Characteristics}from"./Characteristics";export{default as Description}from"./Description";export{default as EffectivityDates}from"./EffectivityDates";export{default as MapPriceHint}from"./MapPriceHint";export*from"./Media";export{default as MediaSlider}from"./MediaSlider";export{default as Options}from"./Options";export{default as OrderQuantityHint}from"./OrderQuantityHint";export{default as PriceDifference}from"./PriceDifference";export*from"./PriceInfo";export{default as ProductBadges}from"./ProductBadges";export{default as ProductCard}from"./ProductCard";export{default as ProductCharacteristics}from"./ProductCharacteristics";export{default as ProductDiscountBadge}from"./ProductDiscountBadge";export{default as ProductGridPrice}from"./ProductGridPrice";export{default as ProductImage}from"./ProductImage";export{default as ProductList}from"./ProductList";export*from"./ProductName";export{default as ProductProperties}from"./ProductProperties/ProductProperties";export{default as ProductSlider}from"./ProductSlider";export*from"./ProductVariants";export{default as QuantityPicker}from"./QuantityPicker";export{default as Rating}from"./Rating";export*from"./RelationsSlider";export*from"./Swatch";export*from"./Swatches";export*from"./UnitQuantityPicker";
|
|
@@ -9,4 +9,5 @@ import React from'react';/* eslint-disable max-len */ /**
|
|
|
9
9
|
* @property {ProductListTypeContextSubType} [subType=null] Optional sub type of the active
|
|
10
10
|
* ProductListTypeContext. Depending on its usage it can make a statement about in which context
|
|
11
11
|
* the product list is used e.g. "widgets".
|
|
12
|
-
|
|
12
|
+
* @property {Object} [meta=null] Optional meta information that can be used by child components
|
|
13
|
+
*/export{};export default React.createContext({type:null,subType:null,meta:null});
|
|
@@ -10,5 +10,6 @@ import React,{useMemo}from'react';import PropTypes from'prop-types';import Conte
|
|
|
10
10
|
* @param {string} param.type Type of the context e.g. "productSlider" or "productGrid".
|
|
11
11
|
* @param {string} param.subType Optional sub type of the context. Depending on its usage it can
|
|
12
12
|
* make a statement about in which context the product list is used e.g. "widgets".
|
|
13
|
+
* @param {Object} param.meta Optional meta information that can be used by child components
|
|
13
14
|
* @returns {JSX}
|
|
14
|
-
*/function ProductListTypeProvider(_ref){var children=_ref.children,type=_ref.type,subType=_ref.subType;var value=useMemo(function(){return{type:type,subType:subType};},[subType,type]);return React.createElement(Context.Provider,{value:value},children);}ProductListTypeProvider.defaultProps={children:null,subType:null};export default ProductListTypeProvider;
|
|
15
|
+
*/function ProductListTypeProvider(_ref){var children=_ref.children,type=_ref.type,subType=_ref.subType,meta=_ref.meta;var value=useMemo(function(){return{type:type,subType:subType,meta:meta};},[meta,subType,type]);return React.createElement(Context.Provider,{value:value},children);}ProductListTypeProvider.defaultProps={children:null,subType:null,meta:null};export default ProductListTypeProvider;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export{default as ProductListTypeProvider}from"./ProductListType";export{default as ProductListEntryProvider}from"./ProductListEntry";
|
|
1
|
+
export{default as ProductProvider}from"./Product";export{default as ProductListTypeProvider}from"./ProductListType";export{default as ProductListEntryProvider}from"./ProductListEntry";
|
|
@@ -71,11 +71,21 @@ var _product$baseProductI=product.baseProductId,baseProductId=_product$baseProdu
|
|
|
71
71
|
* @returns {Function}
|
|
72
72
|
*/export function makeGetProductFeaturedMedia(){return createSelector(getProduct,function(product){if(!product){return null;}return!product.featuredMedia?null:product.featuredMedia;});}/**
|
|
73
73
|
* Creates a selector to indicate if a product is active.
|
|
74
|
+
*
|
|
75
|
+
* @param {boolean} [returnNullIfProductMissing=false] - Flag to determine the return value when
|
|
76
|
+
* the product is not found. If set to `true`, the selector will return `null` when the product
|
|
77
|
+
* is not found. If `false`, it will return `false`.
|
|
78
|
+
*
|
|
74
79
|
* @returns {Function}
|
|
75
|
-
*/export var makeIsProductActive=function makeIsProductActive(){return createSelector(getProduct,function(product){if(!product){return false;}return(product===null||product===void 0?void 0:product.active)||false;});};/**
|
|
80
|
+
*/export var makeIsProductActive=function makeIsProductActive(){var returnNullIfProductMissing=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return createSelector(getProduct,function(product){if(!product){return returnNullIfProductMissing?null:false;}return(product===null||product===void 0?void 0:product.active)||false;});};/**
|
|
76
81
|
* Creates a selector to indicate if the base product is active.
|
|
82
|
+
*
|
|
83
|
+
* @param {boolean} [returnNullIfProductMissing=false] - Flag to determine the return value when
|
|
84
|
+
* the product is not found. If set to `true`, the selector will return `null` when the product
|
|
85
|
+
* is not found. If `false`, it will return `false`.
|
|
86
|
+
*
|
|
77
87
|
* @returns {Function}
|
|
78
|
-
*/export var makeIsBaseProductActive=function makeIsBaseProductActive(){return createSelector(getBaseProduct,function(baseProduct){if(!baseProduct){return false;}return(baseProduct===null||baseProduct===void 0?void 0:baseProduct.active)||false;});};/**
|
|
88
|
+
*/export var makeIsBaseProductActive=function makeIsBaseProductActive(){var returnNullIfProductMissing=arguments.length>0&&arguments[0]!==undefined?arguments[0]:false;return createSelector(getBaseProduct,function(baseProduct){if(!baseProduct){return returnNullIfProductMissing?null:false;}return(baseProduct===null||baseProduct===void 0?void 0:baseProduct.active)||false;});};/**
|
|
79
89
|
* Creates a selector to get the property of a product based on a given label
|
|
80
90
|
* @returns {Function}
|
|
81
91
|
*/export var makeGetCurrentProductPropertyByLabel=function makeGetCurrentProductPropertyByLabel(){var getProductPropertiesUnfiltered=makeGetProductPropertiesUnfiltered();return createSelector(getProductPropertiesUnfiltered,function(state,props){return props.widgetSettings;},function(currentProductProperties,widgetSettings){if(!currentProductProperties||!widgetSettings||!widgetSettings.propertyLabel){return null;}return currentProductProperties.find(function(_ref3){var label=_ref3.label;return label===widgetSettings.propertyLabel;});});};/**
|
|
@@ -2,9 +2,8 @@ import React,{useMemo}from'react';import PropTypes from'prop-types';import class
|
|
|
2
2
|
* The Push opt-in modal component.
|
|
3
3
|
* @param {Object} props The component props.
|
|
4
4
|
* @returns {JSX.Element}
|
|
5
|
-
*/var PushOptInModal=function PushOptInModal(_ref){var isPushOptInModalVisible=_ref.isPushOptInModalVisible,allowPushOptIn=_ref.allowPushOptIn,denyPushOptIn=_ref.denyPushOptIn;var _appConfig$pushOptIn=appConfig.pushOptIn,_appConfig$pushOptIn2=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn,modalMessage=_appConfig$pushOptIn2.modalMessage,modalTitle=_appConfig$pushOptIn2.modalTitle,modalButtonDeny=_appConfig$pushOptIn2.modalButtonDeny,modalButtonAllow=_appConfig$pushOptIn2.modalButtonAllow,modalImageURL=_appConfig$pushOptIn2.modalImageURL,modalImageSVG=_appConfig$pushOptIn2.modalImageSVG;var imageSRC=useMemo(function(){//
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
var
|
|
10
|
-
var base64=btoa(decoded);return"data:image/svg+xml;base64,".concat(base64);}catch(e){return pushImage;}},[modalImageSVG,modalImageURL]);if(!isPushOptInModalVisible){return null;}return React.createElement(Modal,{isOpened:isPushOptInModalVisible,classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{className:classNames(styles.container,'push-opt-in-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"pushOptInDialogTitle","aria-describedby":"pushOptInDialogMessage"},React.createElement(Grid.Item,{className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'push-opt-in-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'push-opt-in-modal__title'),string:modalTitle||'pushOptInModal.title',id:"pushOptInDialogTitle"}),React.createElement(I18n.Text,{className:classNames('push-opt-in-modal__message'),string:modalMessage||'pushOptInModal.message',id:"pushOptInDialogMessage"}),React.createElement(Button,{onClick:allowPushOptIn,type:"primary",className:classNames(styles.button,'push-opt-in-modal__button-allow')},React.createElement(I18n.Text,{string:modalButtonAllow||'pushOptInModal.buttonAllow'})),React.createElement(Button,{onClick:denyPushOptIn,type:"plain",className:classNames(styles.button,'push-opt-in-modal__button-deny')},React.createElement(I18n.Text,{string:modalButtonDeny||'pushOptInModal.buttonDeny',className:styles.buttonText})))));};export default connect(PushOptInModal);
|
|
5
|
+
*/var PushOptInModal=function PushOptInModal(_ref){var isPushOptInModalVisible=_ref.isPushOptInModalVisible,allowPushOptIn=_ref.allowPushOptIn,denyPushOptIn=_ref.denyPushOptIn;var _appConfig$pushOptIn=appConfig.pushOptIn,_appConfig$pushOptIn2=_appConfig$pushOptIn===void 0?{}:_appConfig$pushOptIn,modalMessage=_appConfig$pushOptIn2.modalMessage,modalTitle=_appConfig$pushOptIn2.modalTitle,modalButtonDeny=_appConfig$pushOptIn2.modalButtonDeny,modalButtonAllow=_appConfig$pushOptIn2.modalButtonAllow,modalImageURL=_appConfig$pushOptIn2.modalImageURL,modalImageSVG=_appConfig$pushOptIn2.modalImageSVG;var imageSRC=useMemo(function(){if(!modalImageURL&&!modalImageSVG){return pushImage;}if(modalImageURL){return modalImageURL;}// SVG overwrite configured -> create data url
|
|
6
|
+
try{// encode SVG string to UTF-8 byte array to handle non-Latin1 characters
|
|
7
|
+
// (e.g. Unicode characters like emojis)
|
|
8
|
+
var utf8Encoder=new TextEncoder();var svgBytes=utf8Encoder.encode(modalImageSVG);// Convert the byte array to a Base64 string
|
|
9
|
+
var base64Svg=btoa(String.fromCharCode.apply(null,svgBytes));return"data:image/svg+xml;base64,".concat(base64Svg);}catch(e){return pushImage;}},[modalImageSVG,modalImageURL]);if(!isPushOptInModalVisible){return null;}return React.createElement(Modal,{isOpened:isPushOptInModalVisible,classes:{content:styles.modalContent,layout:styles.modalLayout}},React.createElement(Grid,{className:classNames(styles.container,'push-opt-in-modal__container'),role:"alertdialog","aria-modal":true,"aria-labelledby":"pushOptInDialogTitle","aria-describedby":"pushOptInDialogMessage"},React.createElement(Grid.Item,{className:styles.item},React.createElement("img",{src:imageSRC,className:classNames(styles.image,'push-opt-in-modal__image'),alt:"","aria-hidden":"true"}),React.createElement(I18n.Text,{className:classNames(styles.title,'push-opt-in-modal__title'),string:modalTitle||'pushOptInModal.title',id:"pushOptInDialogTitle"}),React.createElement(I18n.Text,{className:classNames('push-opt-in-modal__message'),string:modalMessage||'pushOptInModal.message',id:"pushOptInDialogMessage"}),React.createElement(Button,{onClick:allowPushOptIn,type:"primary",className:classNames(styles.button,'push-opt-in-modal__button-allow')},React.createElement(I18n.Text,{string:modalButtonAllow||'pushOptInModal.buttonAllow'})),React.createElement(Button,{onClick:denyPushOptIn,type:"plain",className:classNames(styles.button,'push-opt-in-modal__button-deny')},React.createElement(I18n.Text,{string:modalButtonDeny||'pushOptInModal.buttonDeny',className:styles.buttonText})))));};export default connect(PushOptInModal);
|