@sentecacommerce-theme/lib 0.14.10 → 0.14.13
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/CHANGELOG.md +3 -196
- package/dist/cjs/components/Drawer/index.js +6 -6
- package/dist/cjs/contexts/CheckoutForm/utils/validateShipping.js +11 -7
- package/dist/cjs/hooks/CompareContext/CompareContext.js +141 -0
- package/dist/cjs/hooks/CompareContext/index.js +22 -0
- package/dist/cjs/hooks/useCheckoutShippingModule/index.js +4 -2
- package/dist/cjs/index.js +16 -4
- package/dist/cjs/navigation/components/SearchBox/Components/Products/index.js +2 -2
- package/dist/cjs/navigation/components/SearchBox/index.js +2 -1
- package/dist/cjs/seo/components/ProductSEO/index.js +1 -1
- package/dist/esm/build/api/query/fetchStore.js +1 -1
- package/dist/esm/components/Drawer/index.js +6 -6
- package/dist/esm/contexts/CheckoutForm/utils/validateShipping.js +11 -7
- package/dist/esm/hooks/CompareContext/CompareContext.js +114 -0
- package/dist/esm/hooks/CompareContext/index.js +1 -0
- package/dist/esm/hooks/basket-hooks/useBasketTotalPrice/index.js +1 -1
- package/dist/esm/hooks/ui-hooks/useSlideshow/index.js +1 -1
- package/dist/esm/hooks/useCheckoutShippingModule/index.js +4 -2
- package/dist/esm/index.js +1 -0
- package/dist/esm/navigation/components/SearchBox/Components/Products/index.js +2 -2
- package/dist/esm/navigation/components/SearchBox/index.js +2 -1
- package/dist/esm/seo/components/ProductSEO/index.js +1 -1
- package/dist/esm/utils/isTouchDevice.js +1 -1
- package/dist/esm/webview/hooks/useIsInWebview.js +3 -3
- package/dist/esm/webview/utils/sendMessage.js +1 -1
- package/dist/types/hooks/CompareContext/CompareContext.d.ts +16 -0
- package/dist/types/hooks/CompareContext/index.d.ts +1 -0
- package/dist/types/hooks/ui-hooks/useUI/index.d.ts +4 -1
- package/dist/types/index.d.ts +1 -0
- package/dist/types/listing/utils/extendFilter.d.ts +1 -1
- package/dist/types/navigation/components/SearchBox/Components/Products/index.d.ts +2 -1
- package/dist/types/user/hooks/useResetPassword.d.ts +1 -1
- package/package.json +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -5,397 +5,204 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline
|
|
|
5
5
|
|
|
6
6
|
## 0.7.54 (2021-04-08)
|
|
7
7
|
|
|
8
|
-
|
|
9
|
-
|
|
10
8
|
## 0.7.53 (2021-04-08)
|
|
11
9
|
|
|
12
|
-
|
|
13
|
-
|
|
14
10
|
## 0.7.52 (2021-04-06)
|
|
15
11
|
|
|
16
|
-
|
|
17
|
-
|
|
18
12
|
## 0.7.51 (2021-04-06)
|
|
19
13
|
|
|
20
|
-
|
|
21
|
-
|
|
22
14
|
## 0.7.50 (2021-04-05)
|
|
23
15
|
|
|
24
|
-
|
|
25
|
-
|
|
26
16
|
## 0.7.49 (2021-04-05)
|
|
27
17
|
|
|
28
|
-
|
|
29
|
-
|
|
30
18
|
## 0.7.48 (2021-04-02)
|
|
31
19
|
|
|
32
|
-
|
|
33
|
-
|
|
34
20
|
## 0.7.47 (2021-04-02)
|
|
35
21
|
|
|
36
|
-
|
|
37
|
-
|
|
38
22
|
## 0.7.46 (2021-03-30)
|
|
39
23
|
|
|
40
|
-
|
|
41
|
-
|
|
42
24
|
## 0.7.44 (2021-03-29)
|
|
43
25
|
|
|
44
|
-
|
|
45
|
-
|
|
46
26
|
## 0.7.43 (2021-03-29)
|
|
47
27
|
|
|
48
|
-
|
|
49
|
-
|
|
50
28
|
## 0.7.42 (2021-03-29)
|
|
51
29
|
|
|
52
|
-
|
|
53
|
-
|
|
54
30
|
## 0.7.40 (2021-03-26)
|
|
55
31
|
|
|
56
|
-
|
|
57
|
-
|
|
58
32
|
## 0.7.36 (2021-03-25)
|
|
59
33
|
|
|
60
|
-
|
|
61
|
-
|
|
62
34
|
## 0.7.35 (2021-03-25)
|
|
63
35
|
|
|
64
|
-
|
|
65
|
-
|
|
66
36
|
## 0.7.34 (2021-03-24)
|
|
67
37
|
|
|
68
|
-
|
|
69
|
-
|
|
70
38
|
## 0.7.33 (2021-03-24)
|
|
71
39
|
|
|
72
|
-
|
|
73
|
-
|
|
74
40
|
## 0.7.31 (2021-03-22)
|
|
75
41
|
|
|
76
|
-
|
|
77
|
-
|
|
78
42
|
## 0.7.27 (2021-03-19)
|
|
79
43
|
|
|
80
|
-
|
|
81
|
-
|
|
82
44
|
## 0.7.26 (2021-03-16)
|
|
83
45
|
|
|
84
|
-
|
|
85
|
-
|
|
86
46
|
## 0.7.24 (2021-03-16)
|
|
87
47
|
|
|
88
|
-
|
|
89
|
-
|
|
90
48
|
## 0.7.23 (2021-03-12)
|
|
91
49
|
|
|
92
|
-
|
|
93
|
-
|
|
94
50
|
## 0.7.22 (2021-03-12)
|
|
95
51
|
|
|
96
|
-
|
|
97
|
-
|
|
98
52
|
## 0.7.21 (2021-03-12)
|
|
99
53
|
|
|
100
|
-
|
|
101
|
-
|
|
102
54
|
## 0.7.17 (2021-03-05)
|
|
103
55
|
|
|
104
|
-
|
|
105
|
-
|
|
106
56
|
## 0.7.11 (2021-03-01)
|
|
107
57
|
|
|
108
|
-
|
|
109
|
-
|
|
110
58
|
## 0.7.7 (2021-03-01)
|
|
111
59
|
|
|
112
|
-
|
|
113
|
-
|
|
114
60
|
## 0.7.5 (2021-02-26)
|
|
115
61
|
|
|
116
|
-
|
|
117
|
-
|
|
118
62
|
## 0.7.4 (2021-02-26)
|
|
119
63
|
|
|
120
|
-
|
|
121
|
-
|
|
122
64
|
## 0.7.2 (2021-02-25)
|
|
123
65
|
|
|
124
|
-
|
|
125
|
-
|
|
126
66
|
# 0.7.0 (2021-02-25)
|
|
127
67
|
|
|
128
|
-
|
|
129
|
-
|
|
130
68
|
## 0.6.16 (2021-02-24)
|
|
131
69
|
|
|
132
|
-
|
|
133
|
-
|
|
134
70
|
## 0.6.15 (2021-02-24)
|
|
135
71
|
|
|
136
|
-
|
|
137
|
-
|
|
138
72
|
## 0.6.13 (2021-02-24)
|
|
139
73
|
|
|
140
|
-
|
|
141
|
-
|
|
142
74
|
## 0.6.9 (2021-02-18)
|
|
143
75
|
|
|
144
|
-
|
|
145
|
-
|
|
146
76
|
## 0.6.8 (2021-02-18)
|
|
147
77
|
|
|
148
|
-
|
|
149
|
-
|
|
150
78
|
## 0.6.5 (2021-02-17)
|
|
151
79
|
|
|
152
|
-
|
|
153
|
-
|
|
154
80
|
## 0.6.1 (2021-02-12)
|
|
155
81
|
|
|
156
|
-
|
|
157
|
-
|
|
158
82
|
# 0.6.0 (2021-02-11)
|
|
159
83
|
|
|
160
|
-
|
|
161
|
-
|
|
162
84
|
## 0.5.35 (2021-02-11)
|
|
163
85
|
|
|
164
|
-
|
|
165
|
-
|
|
166
86
|
## 0.5.34 (2021-02-02)
|
|
167
87
|
|
|
168
|
-
|
|
169
|
-
|
|
170
88
|
## 0.5.33 (2021-01-27)
|
|
171
89
|
|
|
172
|
-
|
|
173
|
-
|
|
174
90
|
## 0.5.32 (2021-01-22)
|
|
175
91
|
|
|
176
|
-
|
|
177
|
-
|
|
178
92
|
## 0.5.29 (2021-01-22)
|
|
179
93
|
|
|
180
|
-
|
|
181
|
-
|
|
182
94
|
## 0.5.28 (2021-01-22)
|
|
183
95
|
|
|
184
|
-
|
|
185
|
-
|
|
186
96
|
## 0.5.26 (2021-01-21)
|
|
187
97
|
|
|
188
|
-
|
|
189
|
-
|
|
190
98
|
## 0.5.24 (2021-01-21)
|
|
191
99
|
|
|
192
|
-
|
|
193
|
-
|
|
194
100
|
## 0.5.22 (2021-01-21)
|
|
195
101
|
|
|
196
|
-
|
|
197
|
-
|
|
198
102
|
## 0.5.21 (2021-01-21)
|
|
199
103
|
|
|
200
|
-
|
|
201
|
-
|
|
202
104
|
## 0.5.20 (2021-01-21)
|
|
203
105
|
|
|
204
|
-
|
|
205
|
-
|
|
206
106
|
## 0.5.17 (2021-01-20)
|
|
207
107
|
|
|
208
|
-
|
|
209
|
-
|
|
210
108
|
## 0.5.16 (2021-01-20)
|
|
211
109
|
|
|
212
|
-
|
|
213
|
-
|
|
214
110
|
## 0.5.15 (2021-01-19)
|
|
215
111
|
|
|
216
|
-
|
|
217
|
-
|
|
218
112
|
## 0.5.12 (2021-01-18)
|
|
219
113
|
|
|
220
|
-
|
|
221
|
-
|
|
222
114
|
## 0.5.11 (2021-01-18)
|
|
223
115
|
|
|
224
|
-
|
|
225
|
-
|
|
226
116
|
## 0.5.10 (2021-01-17)
|
|
227
117
|
|
|
228
|
-
|
|
229
|
-
|
|
230
118
|
## 0.5.5 (2021-01-15)
|
|
231
119
|
|
|
232
|
-
|
|
233
|
-
|
|
234
120
|
## 0.5.2 (2021-01-15)
|
|
235
121
|
|
|
236
|
-
|
|
237
122
|
### Reverts
|
|
238
123
|
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
124
|
+
- Revert "SPD-286 Basket UI (#55)" ([72174fa](https://github.com/senteca/theme/commit/72174fa08f143179188fa7ebe268aa62671024c6)), closes [#55](https://github.com/senteca/theme/issues/55)
|
|
242
125
|
|
|
243
126
|
# 0.5.0 (2020-12-17)
|
|
244
127
|
|
|
245
|
-
|
|
246
|
-
|
|
247
128
|
## 0.4.32 (2020-12-15)
|
|
248
129
|
|
|
249
|
-
|
|
250
|
-
|
|
251
130
|
## 0.4.28 (2020-12-14)
|
|
252
131
|
|
|
253
|
-
|
|
254
|
-
|
|
255
132
|
## 0.4.26 (2020-12-13)
|
|
256
133
|
|
|
257
|
-
|
|
258
|
-
|
|
259
134
|
## 0.4.25 (2020-12-12)
|
|
260
135
|
|
|
261
|
-
|
|
262
|
-
|
|
263
136
|
## 0.4.23 (2020-12-11)
|
|
264
137
|
|
|
265
|
-
|
|
266
|
-
|
|
267
138
|
## 0.4.22 (2020-12-11)
|
|
268
139
|
|
|
269
|
-
|
|
270
|
-
|
|
271
140
|
## 0.4.17 (2020-12-10)
|
|
272
141
|
|
|
273
|
-
|
|
274
|
-
|
|
275
142
|
## 0.4.15 (2020-12-08)
|
|
276
143
|
|
|
277
|
-
|
|
278
|
-
|
|
279
144
|
## 0.4.9-alpha.0 (2020-12-03)
|
|
280
145
|
|
|
281
|
-
|
|
282
|
-
|
|
283
146
|
# 0.4.0 (2020-12-01)
|
|
284
147
|
|
|
285
|
-
|
|
286
|
-
|
|
287
148
|
# 0.3.0 (2020-12-01)
|
|
288
149
|
|
|
289
|
-
|
|
290
|
-
|
|
291
150
|
## 0.2.2 (2020-12-01)
|
|
292
151
|
|
|
293
|
-
|
|
294
|
-
|
|
295
152
|
## 0.2.1 (2020-12-01)
|
|
296
153
|
|
|
297
|
-
|
|
298
|
-
|
|
299
154
|
# 0.2.0 (2020-12-01)
|
|
300
155
|
|
|
301
|
-
|
|
302
|
-
|
|
303
156
|
## 0.1.26 (2020-12-01)
|
|
304
157
|
|
|
305
|
-
|
|
306
|
-
|
|
307
158
|
## 0.1.25 (2020-11-30)
|
|
308
159
|
|
|
309
|
-
|
|
310
160
|
### Reverts
|
|
311
161
|
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
162
|
+
- Revert "EXPERIMENTAL: change format to es - remove API from lib for testing" ([0dcde73](https://github.com/senteca/theme/commit/0dcde732df1749bffdeae6c4b2072e0829770ce2))
|
|
315
163
|
|
|
316
164
|
## 0.1.24 (2020-11-30)
|
|
317
165
|
|
|
318
|
-
|
|
319
|
-
|
|
320
166
|
## 0.1.23 (2020-11-30)
|
|
321
167
|
|
|
322
|
-
|
|
323
|
-
|
|
324
168
|
## 0.1.22 (2020-11-30)
|
|
325
169
|
|
|
326
|
-
|
|
327
|
-
|
|
328
170
|
## 0.1.21 (2020-11-30)
|
|
329
171
|
|
|
330
|
-
|
|
331
|
-
|
|
332
172
|
## 0.1.19 (2020-11-30)
|
|
333
173
|
|
|
334
|
-
|
|
335
|
-
|
|
336
174
|
## 0.1.18 (2020-11-27)
|
|
337
175
|
|
|
338
|
-
|
|
339
|
-
|
|
340
176
|
## 0.1.17 (2020-11-26)
|
|
341
177
|
|
|
342
|
-
|
|
343
|
-
|
|
344
178
|
## 0.1.16 (2020-11-26)
|
|
345
179
|
|
|
346
|
-
|
|
347
|
-
|
|
348
180
|
## 0.1.15 (2020-11-20)
|
|
349
181
|
|
|
350
|
-
|
|
351
|
-
|
|
352
182
|
## 0.1.14 (2020-11-10)
|
|
353
183
|
|
|
354
|
-
|
|
355
|
-
|
|
356
184
|
## 0.1.13 (2020-11-10)
|
|
357
185
|
|
|
358
|
-
|
|
359
|
-
|
|
360
186
|
## 0.1.11 (2020-11-09)
|
|
361
187
|
|
|
362
|
-
|
|
363
|
-
|
|
364
188
|
## 0.1.6 (2020-11-07)
|
|
365
189
|
|
|
366
|
-
|
|
367
|
-
|
|
368
190
|
## 0.1.2 (2020-11-06)
|
|
369
191
|
|
|
370
|
-
|
|
371
|
-
|
|
372
192
|
## 0.1.1 (2020-11-06)
|
|
373
193
|
|
|
374
|
-
|
|
375
|
-
|
|
376
194
|
## 0.1.1-alpha.0 (2020-11-06)
|
|
377
195
|
|
|
378
|
-
|
|
379
|
-
|
|
380
196
|
# 0.1.0-alpha.0 (2020-11-06)
|
|
381
197
|
|
|
382
|
-
|
|
383
198
|
### Reverts
|
|
384
199
|
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
200
|
+
- Revert "no longer pass query cache as param" ([ac49427](https://github.com/senteca/theme/commit/ac49427d47202a492268fce88320d335dd3cf413))
|
|
390
201
|
|
|
391
202
|
## [0.7.53](https://github.com/senteca/theme/compare/v0.7.52...v0.7.53) (2021-04-08)
|
|
392
203
|
|
|
393
204
|
**Note:** Version bump only for package @sentecacommerce-theme/lib
|
|
394
205
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
206
|
## [0.7.51](https://github.com/senteca/theme/compare/v0.7.50...v0.7.51) (2021-04-06)
|
|
400
207
|
|
|
401
208
|
**Note:** Version bump only for package @sentecacommerce-theme/lib
|
|
@@ -126,10 +126,10 @@ function _templateObject7() {
|
|
|
126
126
|
}
|
|
127
127
|
function _templateObject8() {
|
|
128
128
|
var data = _taggedTemplateLiteral([
|
|
129
|
-
"\n
|
|
130
|
-
";\n
|
|
131
|
-
"ms;\n
|
|
132
|
-
";\n
|
|
129
|
+
"\n width: 100%;\n height: 100vh;\n position: fixed;\n left: 0;\n top: 0;\n background-color: ",
|
|
130
|
+
";\n animation: ",
|
|
131
|
+
"ms;\n opacity: ",
|
|
132
|
+
";\n "
|
|
133
133
|
]);
|
|
134
134
|
_templateObject8 = function _templateObject8() {
|
|
135
135
|
return data;
|
|
@@ -138,8 +138,8 @@ function _templateObject8() {
|
|
|
138
138
|
}
|
|
139
139
|
function _templateObject9() {
|
|
140
140
|
var data = _taggedTemplateLiteral([
|
|
141
|
-
"\n",
|
|
142
|
-
";\n
|
|
141
|
+
"\n ",
|
|
142
|
+
";\n"
|
|
143
143
|
]);
|
|
144
144
|
_templateObject9 = function _templateObject9() {
|
|
145
145
|
return data;
|
|
@@ -104,8 +104,12 @@ function genericOfficeValidation(param) {
|
|
|
104
104
|
}
|
|
105
105
|
function pickupFromStoreValidation(param) {
|
|
106
106
|
var mod = param.mod, errorLabels = param.errorLabels;
|
|
107
|
-
var ref;
|
|
108
|
-
|
|
107
|
+
var ref, ref12;
|
|
108
|
+
// Returning undefined means validation is passed
|
|
109
|
+
if (mod === null || mod === void 0 ? void 0 : (ref = mod.moduleData) === null || ref === void 0 ? void 0 : ref.isWarehouseShipping) {
|
|
110
|
+
return undefined;
|
|
111
|
+
}
|
|
112
|
+
return !(mod === null || mod === void 0 ? void 0 : (ref12 = mod.moduleData) === null || ref12 === void 0 ? void 0 : ref12.stockLocation) ? {
|
|
109
113
|
pickupFromStore: errorLabels.noStoreSelected
|
|
110
114
|
} : undefined;
|
|
111
115
|
}
|
|
@@ -135,8 +139,8 @@ function validateShipping(data, mod, errorLabels, validations) {
|
|
|
135
139
|
var requiredFields = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : defaultRequiredFields, enableNoShippingMethodMode = arguments.length > 5 ? arguments[5] : void 0;
|
|
136
140
|
var validateErrors = {};
|
|
137
141
|
var globalErrors = requiredFields.reduce(function(errors, field) {
|
|
138
|
-
var ref,
|
|
139
|
-
if (!(data === null || data === void 0 ? void 0 : (ref = data[field]) === null || ref === void 0 ? void 0 : (
|
|
142
|
+
var ref, ref14;
|
|
143
|
+
if (!(data === null || data === void 0 ? void 0 : (ref = data[field]) === null || ref === void 0 ? void 0 : (ref14 = ref.trim) === null || ref14 === void 0 ? void 0 : ref14.call(ref))) {
|
|
140
144
|
return _objectSpread({}, errors, _defineProperty({}, field, errorLabels.fieldIsRequired));
|
|
141
145
|
}
|
|
142
146
|
return errors;
|
|
@@ -148,13 +152,13 @@ function validateShipping(data, mod, errorLabels, validations) {
|
|
|
148
152
|
globalErrors.phoneNumber = (errorLabels === null || errorLabels === void 0 ? void 0 : errorLabels.invalidPhoneNumber) || '';
|
|
149
153
|
}
|
|
150
154
|
if (!enableNoShippingMethodMode) {
|
|
151
|
-
var
|
|
152
|
-
if (!(mod === null || mod === void 0 ? void 0 : mod.moduleKey) || !(mod === null || mod === void 0 ? void 0 : (
|
|
155
|
+
var ref15, ref13;
|
|
156
|
+
if (!(mod === null || mod === void 0 ? void 0 : mod.moduleKey) || !(mod === null || mod === void 0 ? void 0 : (ref15 = mod.moduleData) === null || ref15 === void 0 ? void 0 : ref15.methodKey)) {
|
|
153
157
|
return _objectSpread({}, globalErrors, {
|
|
154
158
|
courier: errorLabels.selectCourier
|
|
155
159
|
});
|
|
156
160
|
}
|
|
157
|
-
var validate = (
|
|
161
|
+
var validate = (ref13 = validations[mod === null || mod === void 0 ? void 0 : mod.moduleKey]) === null || ref13 === void 0 ? void 0 : ref13[mod === null || mod === void 0 ? void 0 : mod.moduleData.methodKey];
|
|
158
162
|
if (!validate) {
|
|
159
163
|
throw new Error("Validation for shipping with provider: ".concat(mod === null || mod === void 0 ? void 0 : mod.moduleKey, " and method key: ").concat(mod === null || mod === void 0 ? void 0 : mod.moduleData.methodKey, " not found"));
|
|
160
164
|
}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
exports.CompareContextProvider = CompareContextProvider;
|
|
5
|
+
exports.useCompareState = useCompareState;
|
|
6
|
+
exports.useCompareFunctions = useCompareFunctions;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
function _arrayLikeToArray(arr, len) {
|
|
9
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
10
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
11
|
+
return arr2;
|
|
12
|
+
}
|
|
13
|
+
function _arrayWithHoles(arr) {
|
|
14
|
+
if (Array.isArray(arr)) return arr;
|
|
15
|
+
}
|
|
16
|
+
function _interopRequireWildcard(obj) {
|
|
17
|
+
if (obj && obj.__esModule) {
|
|
18
|
+
return obj;
|
|
19
|
+
} else {
|
|
20
|
+
var newObj = {};
|
|
21
|
+
if (obj != null) {
|
|
22
|
+
for(var key in obj){
|
|
23
|
+
if (Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
24
|
+
var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {};
|
|
25
|
+
if (desc.get || desc.set) {
|
|
26
|
+
Object.defineProperty(newObj, key, desc);
|
|
27
|
+
} else {
|
|
28
|
+
newObj[key] = obj[key];
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
newObj.default = obj;
|
|
34
|
+
return newObj;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function _iterableToArrayLimit(arr, i) {
|
|
38
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
39
|
+
if (_i == null) return;
|
|
40
|
+
var _arr = [];
|
|
41
|
+
var _n = true;
|
|
42
|
+
var _d = false;
|
|
43
|
+
var _s, _e;
|
|
44
|
+
try {
|
|
45
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
46
|
+
_arr.push(_s.value);
|
|
47
|
+
if (i && _arr.length === i) break;
|
|
48
|
+
}
|
|
49
|
+
} catch (err) {
|
|
50
|
+
_d = true;
|
|
51
|
+
_e = err;
|
|
52
|
+
} finally{
|
|
53
|
+
try {
|
|
54
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
55
|
+
} finally{
|
|
56
|
+
if (_d) throw _e;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return _arr;
|
|
60
|
+
}
|
|
61
|
+
function _nonIterableRest() {
|
|
62
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
63
|
+
}
|
|
64
|
+
function _slicedToArray(arr, i) {
|
|
65
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
66
|
+
}
|
|
67
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
68
|
+
if (!o) return;
|
|
69
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
70
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
71
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
72
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
73
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
74
|
+
}
|
|
75
|
+
var CompareContextState = /*#__PURE__*/ _react.default.createContext(undefined);
|
|
76
|
+
var CompareContextFunctions = /*#__PURE__*/ _react.default.createContext(undefined);
|
|
77
|
+
function CompareContextProvider(param) {
|
|
78
|
+
var children = param.children;
|
|
79
|
+
var ref = _slicedToArray((0, _react).useState([]), 2), itemsToCompare = ref[0], setItemsToCompare = ref[1];
|
|
80
|
+
// notAllowedState is needed in order to trigger rerender in useEffect dependency on the client
|
|
81
|
+
// it allow us to know that we try to add more items than allowed
|
|
82
|
+
var ref1 = _slicedToArray((0, _react).useState(0), 2), notAllowedState = ref1[0], setNotAllowedState = ref1[1];
|
|
83
|
+
var itemAlreadyAdded = function(id) {
|
|
84
|
+
return itemsToCompare.filter(function(i) {
|
|
85
|
+
return i._id === id;
|
|
86
|
+
}).length !== 0;
|
|
87
|
+
};
|
|
88
|
+
var addItemToCompare = function(item, maxItemLength) {
|
|
89
|
+
var alreadyAdded = itemAlreadyAdded(item._id);
|
|
90
|
+
if (alreadyAdded) {
|
|
91
|
+
return;
|
|
92
|
+
}
|
|
93
|
+
if (itemsToCompare.length === maxItemLength) {
|
|
94
|
+
setNotAllowedState(notAllowedState + 1);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
if (itemsToCompare.length < maxItemLength) {
|
|
98
|
+
itemsToCompare.push(item);
|
|
99
|
+
setNotAllowedState(0);
|
|
100
|
+
setItemsToCompare(itemsToCompare);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
var removeComparedItem = function(id) {
|
|
104
|
+
var filtered = itemsToCompare.filter(function(i) {
|
|
105
|
+
return i._id !== id;
|
|
106
|
+
});
|
|
107
|
+
setItemsToCompare(filtered);
|
|
108
|
+
};
|
|
109
|
+
var removeAllComparedItems = function() {
|
|
110
|
+
return setItemsToCompare([]);
|
|
111
|
+
};
|
|
112
|
+
var notAllowed = function() {
|
|
113
|
+
return notAllowedState;
|
|
114
|
+
};
|
|
115
|
+
var functions = {
|
|
116
|
+
itemAlreadyAdded: itemAlreadyAdded,
|
|
117
|
+
addItemToCompare: addItemToCompare,
|
|
118
|
+
removeComparedItem: removeComparedItem,
|
|
119
|
+
removeAllComparedItems: removeAllComparedItems,
|
|
120
|
+
notAllowed: notAllowed
|
|
121
|
+
};
|
|
122
|
+
return(/*#__PURE__*/ _react.default.createElement(CompareContextState.Provider, {
|
|
123
|
+
value: itemsToCompare
|
|
124
|
+
}, /*#__PURE__*/ _react.default.createElement(CompareContextFunctions.Provider, {
|
|
125
|
+
value: functions
|
|
126
|
+
}, children)));
|
|
127
|
+
}
|
|
128
|
+
function useCompareState() {
|
|
129
|
+
var context = _react.default.useContext(CompareContextState);
|
|
130
|
+
if (context === undefined) {
|
|
131
|
+
throw new Error('CompareContextState must be used within a CompareContextProvider');
|
|
132
|
+
}
|
|
133
|
+
return context;
|
|
134
|
+
}
|
|
135
|
+
function useCompareFunctions() {
|
|
136
|
+
var context = _react.default.useContext(CompareContextFunctions);
|
|
137
|
+
if (context === undefined) {
|
|
138
|
+
throw new Error('CompareContextFunctions must be used within a CompareContextProvider');
|
|
139
|
+
}
|
|
140
|
+
return context;
|
|
141
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", {
|
|
2
|
+
value: true
|
|
3
|
+
});
|
|
4
|
+
Object.defineProperty(exports, "CompareContextProvider", {
|
|
5
|
+
enumerable: true,
|
|
6
|
+
get: function() {
|
|
7
|
+
return _compareContext.CompareContextProvider;
|
|
8
|
+
}
|
|
9
|
+
});
|
|
10
|
+
Object.defineProperty(exports, "useCompareState", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function() {
|
|
13
|
+
return _compareContext.useCompareState;
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
Object.defineProperty(exports, "useCompareFunctions", {
|
|
17
|
+
enumerable: true,
|
|
18
|
+
get: function() {
|
|
19
|
+
return _compareContext.useCompareFunctions;
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
var _compareContext = require("./CompareContext");
|
|
@@ -35,13 +35,15 @@ var useCheckoutShippingModule = function(orderQuery) {
|
|
|
35
35
|
var isEnabled = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
36
36
|
var cartData = orderQuery.data;
|
|
37
37
|
return (0, _react).useMemo(function() {
|
|
38
|
-
var ref;
|
|
38
|
+
var ref, ref1;
|
|
39
39
|
if (!isEnabled) return;
|
|
40
40
|
var shipping = cartData === null || cartData === void 0 ? void 0 : (ref = cartData.shippings) === null || ref === void 0 ? void 0 : ref[0];
|
|
41
41
|
return {
|
|
42
42
|
moduleKey: shipping === null || shipping === void 0 ? void 0 : shipping.moduleKey,
|
|
43
43
|
moduleData: _objectSpread({}, shipping === null || shipping === void 0 ? void 0 : shipping.moduleData, {
|
|
44
|
-
methodKey: shipping === null || shipping === void 0 ? void 0 : shipping.moduleMethodKey
|
|
44
|
+
methodKey: shipping === null || shipping === void 0 ? void 0 : shipping.moduleMethodKey,
|
|
45
|
+
// Special case of warehouse for christian of roma
|
|
46
|
+
isWarehouseShipping: (shipping === null || shipping === void 0 ? void 0 : shipping.moduleKey) === 'PickUpFromStore' && (shipping === null || shipping === void 0 ? void 0 : (ref1 = shipping.merchant) === null || ref1 === void 0 ? void 0 : ref1.resourceKey) === 'christian-of-roma'
|
|
45
47
|
})
|
|
46
48
|
};
|
|
47
49
|
}, [
|
package/dist/cjs/index.js
CHANGED
|
@@ -1058,6 +1058,18 @@ Object.keys(_types).forEach(function(key) {
|
|
|
1058
1058
|
}
|
|
1059
1059
|
});
|
|
1060
1060
|
});
|
|
1061
|
+
var _ = _interopRequireWildcard(require("./hooks/CompareContext/"));
|
|
1062
|
+
Object.keys(_).forEach(function(key) {
|
|
1063
|
+
if (key === "default" || key === "__esModule") return;
|
|
1064
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
1065
|
+
if (key in exports && exports[key] === _[key]) return;
|
|
1066
|
+
Object.defineProperty(exports, key, {
|
|
1067
|
+
enumerable: true,
|
|
1068
|
+
get: function() {
|
|
1069
|
+
return _[key];
|
|
1070
|
+
}
|
|
1071
|
+
});
|
|
1072
|
+
});
|
|
1061
1073
|
var _utils1 = _interopRequireWildcard(require("./utils"));
|
|
1062
1074
|
Object.keys(_utils1).forEach(function(key) {
|
|
1063
1075
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -1214,15 +1226,15 @@ Object.keys(_misc).forEach(function(key) {
|
|
|
1214
1226
|
}
|
|
1215
1227
|
});
|
|
1216
1228
|
});
|
|
1217
|
-
var
|
|
1218
|
-
Object.keys(
|
|
1229
|
+
var _1 = _interopRequireWildcard(require("./ssr/"));
|
|
1230
|
+
Object.keys(_1).forEach(function(key) {
|
|
1219
1231
|
if (key === "default" || key === "__esModule") return;
|
|
1220
1232
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
1221
|
-
if (key in exports && exports[key] ===
|
|
1233
|
+
if (key in exports && exports[key] === _1[key]) return;
|
|
1222
1234
|
Object.defineProperty(exports, key, {
|
|
1223
1235
|
enumerable: true,
|
|
1224
1236
|
get: function() {
|
|
1225
|
-
return
|
|
1237
|
+
return _1[key];
|
|
1226
1238
|
}
|
|
1227
1239
|
});
|
|
1228
1240
|
});
|
|
@@ -31,7 +31,7 @@ function _templateObject() {
|
|
|
31
31
|
return data;
|
|
32
32
|
}
|
|
33
33
|
var Products = function(param) {
|
|
34
|
-
var data = param.data, bottomMenu = param.bottomMenu, priceColor = param.priceColor, textColor = param.textColor, labelsColor = param.labelsColor, onClose = param.onClose, backgroundColor = param.backgroundColor, title = param.title, offers = param.offers, productSpacing = param.productSpacing;
|
|
34
|
+
var data = param.data, bottomMenu = param.bottomMenu, priceColor = param.priceColor, textColor = param.textColor, labelsColor = param.labelsColor, onClose = param.onClose, backgroundColor = param.backgroundColor, title = param.title, offers = param.offers, productSpacing = param.productSpacing, noResults = param.noResults;
|
|
35
35
|
return(/*#__PURE__*/ _react.default.createElement(_.Container, {
|
|
36
36
|
backgroundColor: backgroundColor,
|
|
37
37
|
labelsColor: labelsColor,
|
|
@@ -52,7 +52,7 @@ var Products = function(param) {
|
|
|
52
52
|
offers: offers,
|
|
53
53
|
productSpacing: productSpacing
|
|
54
54
|
}));
|
|
55
|
-
})) : /*#__PURE__*/ _react.default.createElement(NoResultsDesc, null,
|
|
55
|
+
})) : /*#__PURE__*/ _react.default.createElement(NoResultsDesc, null, noResults ? noResults : 'No results found')));
|
|
56
56
|
};
|
|
57
57
|
exports.Products = Products;
|
|
58
58
|
var NoResultsDesc = _styledComponents.default.p(_templateObject());
|
|
@@ -224,7 +224,8 @@ var SearchBox = function(param) {
|
|
|
224
224
|
textColor: textColor,
|
|
225
225
|
onClose: onClose,
|
|
226
226
|
backgroundColor: backgroundColor,
|
|
227
|
-
productSpacing: productSpacing
|
|
227
|
+
productSpacing: productSpacing,
|
|
228
|
+
noResults: labels === null || labels === void 0 ? void 0 : labels.noResults
|
|
228
229
|
}), bottomMenu === BottomMenuEnum.promo && promoOffers && /*#__PURE__*/ _react.default.createElement(_components.Products, {
|
|
229
230
|
data: promoOffers,
|
|
230
231
|
title: labels.promoOffers,
|
|
@@ -58,7 +58,7 @@ function ProductSEO() {
|
|
|
58
58
|
};
|
|
59
59
|
var formattedDescription = favorDescriptionTemplateOverMeta ? createTemplate(descriptionTemplate) : seoData.description || createTemplate(descriptionTemplate);
|
|
60
60
|
var formattedTitle = favorTitleTemplateOverMeta ? createTemplate(titleTemplate) : seoData.title || createTemplate(titleTemplate);
|
|
61
|
-
var productJSONLd = "{\n \"@context\": \"https://schema.org\",\n \"@type\": \"Product\",\n \"name\": \"".concat(formattedTitle, "\",\n \"image\": [").concat(generateImage(image), "],\n \"description\": \"").concat(formattedDescription, "\",\n \"sku\": \"").concat((selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.sku) || '', "\",\n ").concat(brandName ? "\"brand\": {\n \"@type\": \"Brand\",\n \"name\": \"".concat(brandName, "\"\n },") : '', "\n ").concat(hasRating ? "\"aggregateRating\": {\n \"@type\": \"AggregateRating\",\n \"ratingValue\": \"".concat((ref13 = metaData.reviewRatingStatistics) === null || ref13 === void 0 ? void 0 : ref13.averageRating, "\",\n \"reviewCount\": \"").concat((ref14 = metaData.reviewRatingStatistics) === null || ref14 === void 0 ? void 0 : ref14.count, "\"\n },") : '', "\n \"offers\": {\n \"@type\": \"Offer\",\n \"priceCurrency\": \"").concat(currencyCode, "\",\n \"price\": \"").concat(price.value, "\",\n \"itemCondition\": \"").concat(itemCondition, "\",\n \"availability\": \"").concat(availability, "\"\n }\n }");
|
|
61
|
+
var productJSONLd = "{\n \"@context\": \"https://schema.org\",\n \"@type\": \"Product\",\n \"name\": \"".concat(formattedTitle === null || formattedTitle === void 0 ? void 0 : formattedTitle.replace(/"/g, '″'), "\",\n \"image\": [").concat(generateImage(image), "],\n \"description\": \"").concat(formattedDescription === null || formattedDescription === void 0 ? void 0 : formattedDescription.replace(/"/g, '″'), "\",\n \"sku\": \"").concat((selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.sku) || '', "\",\n ").concat(brandName ? "\"brand\": {\n \"@type\": \"Brand\",\n \"name\": \"".concat(brandName, "\"\n },") : '', "\n ").concat(hasRating ? "\"aggregateRating\": {\n \"@type\": \"AggregateRating\",\n \"ratingValue\": \"".concat((ref13 = metaData.reviewRatingStatistics) === null || ref13 === void 0 ? void 0 : ref13.averageRating, "\",\n \"reviewCount\": \"").concat((ref14 = metaData.reviewRatingStatistics) === null || ref14 === void 0 ? void 0 : ref14.count, "\"\n },") : '', "\n \"offers\": {\n \"@type\": \"Offer\",\n \"priceCurrency\": \"").concat(currencyCode, "\",\n \"price\": \"").concat(price.value, "\",\n \"itemCondition\": \"").concat(itemCondition, "\",\n \"availability\": \"").concat(availability, "\"\n }\n }");
|
|
62
62
|
return(/*#__PURE__*/ _react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/ _react.default.createElement(_head.default, null, /*#__PURE__*/ _react.default.createElement("script", {
|
|
63
63
|
type: "application/ld+json",
|
|
64
64
|
dangerouslySetInnerHTML: (0, _utils).createDangerousMarkup(productJSONLd)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import regeneratorRuntime from "regenerator-runtime";
|
|
2
|
-
import { Configuration, StoresAPI } from
|
|
2
|
+
import { Configuration, StoresAPI } from '@sentecacommerce/sdk';
|
|
3
3
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
|
4
4
|
try {
|
|
5
5
|
var info = gen[key](arg);
|
|
@@ -96,10 +96,10 @@ function _templateObject7() {
|
|
|
96
96
|
}
|
|
97
97
|
function _templateObject8() {
|
|
98
98
|
var data = _taggedTemplateLiteral([
|
|
99
|
-
"\n
|
|
100
|
-
";\n
|
|
101
|
-
"ms;\n
|
|
102
|
-
";\n
|
|
99
|
+
"\n width: 100%;\n height: 100vh;\n position: fixed;\n left: 0;\n top: 0;\n background-color: ",
|
|
100
|
+
";\n animation: ",
|
|
101
|
+
"ms;\n opacity: ",
|
|
102
|
+
";\n "
|
|
103
103
|
]);
|
|
104
104
|
_templateObject8 = function _templateObject8() {
|
|
105
105
|
return data;
|
|
@@ -108,8 +108,8 @@ function _templateObject8() {
|
|
|
108
108
|
}
|
|
109
109
|
function _templateObject9() {
|
|
110
110
|
var data = _taggedTemplateLiteral([
|
|
111
|
-
"\n",
|
|
112
|
-
";\n
|
|
111
|
+
"\n ",
|
|
112
|
+
";\n"
|
|
113
113
|
]);
|
|
114
114
|
_templateObject9 = function _templateObject9() {
|
|
115
115
|
return data;
|
|
@@ -95,8 +95,12 @@ export function genericOfficeValidation(param) {
|
|
|
95
95
|
}
|
|
96
96
|
export function pickupFromStoreValidation(param) {
|
|
97
97
|
var mod = param.mod, errorLabels = param.errorLabels;
|
|
98
|
-
var ref;
|
|
99
|
-
|
|
98
|
+
var ref, ref12;
|
|
99
|
+
// Returning undefined means validation is passed
|
|
100
|
+
if (mod === null || mod === void 0 ? void 0 : (ref = mod.moduleData) === null || ref === void 0 ? void 0 : ref.isWarehouseShipping) {
|
|
101
|
+
return undefined;
|
|
102
|
+
}
|
|
103
|
+
return !(mod === null || mod === void 0 ? void 0 : (ref12 = mod.moduleData) === null || ref12 === void 0 ? void 0 : ref12.stockLocation) ? {
|
|
100
104
|
pickupFromStore: errorLabels.noStoreSelected
|
|
101
105
|
} : undefined;
|
|
102
106
|
}
|
|
@@ -125,8 +129,8 @@ export function validateShipping(data, mod, errorLabels, validations) {
|
|
|
125
129
|
var requiredFields = arguments.length > 4 && arguments[4] !== void 0 ? arguments[4] : defaultRequiredFields, enableNoShippingMethodMode = arguments.length > 5 ? arguments[5] : void 0;
|
|
126
130
|
var validateErrors = {};
|
|
127
131
|
var globalErrors = requiredFields.reduce(function(errors, field) {
|
|
128
|
-
var ref,
|
|
129
|
-
if (!(data === null || data === void 0 ? void 0 : (ref = data[field]) === null || ref === void 0 ? void 0 : (
|
|
132
|
+
var ref, ref14;
|
|
133
|
+
if (!(data === null || data === void 0 ? void 0 : (ref = data[field]) === null || ref === void 0 ? void 0 : (ref14 = ref.trim) === null || ref14 === void 0 ? void 0 : ref14.call(ref))) {
|
|
130
134
|
return _objectSpread({}, errors, _defineProperty({}, field, errorLabels.fieldIsRequired));
|
|
131
135
|
}
|
|
132
136
|
return errors;
|
|
@@ -138,13 +142,13 @@ export function validateShipping(data, mod, errorLabels, validations) {
|
|
|
138
142
|
globalErrors.phoneNumber = (errorLabels === null || errorLabels === void 0 ? void 0 : errorLabels.invalidPhoneNumber) || '';
|
|
139
143
|
}
|
|
140
144
|
if (!enableNoShippingMethodMode) {
|
|
141
|
-
var
|
|
142
|
-
if (!(mod === null || mod === void 0 ? void 0 : mod.moduleKey) || !(mod === null || mod === void 0 ? void 0 : (
|
|
145
|
+
var ref15, ref13;
|
|
146
|
+
if (!(mod === null || mod === void 0 ? void 0 : mod.moduleKey) || !(mod === null || mod === void 0 ? void 0 : (ref15 = mod.moduleData) === null || ref15 === void 0 ? void 0 : ref15.methodKey)) {
|
|
143
147
|
return _objectSpread({}, globalErrors, {
|
|
144
148
|
courier: errorLabels.selectCourier
|
|
145
149
|
});
|
|
146
150
|
}
|
|
147
|
-
var validate = (
|
|
151
|
+
var validate = (ref13 = validations[mod === null || mod === void 0 ? void 0 : mod.moduleKey]) === null || ref13 === void 0 ? void 0 : ref13[mod === null || mod === void 0 ? void 0 : mod.moduleData.methodKey];
|
|
148
152
|
if (!validate) {
|
|
149
153
|
throw new Error("Validation for shipping with provider: ".concat(mod === null || mod === void 0 ? void 0 : mod.moduleKey, " and method key: ").concat(mod === null || mod === void 0 ? void 0 : mod.moduleData.methodKey, " not found"));
|
|
150
154
|
}
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import React, { useState } from 'react';
|
|
2
|
+
function _arrayLikeToArray(arr, len) {
|
|
3
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
4
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
5
|
+
return arr2;
|
|
6
|
+
}
|
|
7
|
+
function _arrayWithHoles(arr) {
|
|
8
|
+
if (Array.isArray(arr)) return arr;
|
|
9
|
+
}
|
|
10
|
+
function _iterableToArrayLimit(arr, i) {
|
|
11
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
12
|
+
if (_i == null) return;
|
|
13
|
+
var _arr = [];
|
|
14
|
+
var _n = true;
|
|
15
|
+
var _d = false;
|
|
16
|
+
var _s, _e;
|
|
17
|
+
try {
|
|
18
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
19
|
+
_arr.push(_s.value);
|
|
20
|
+
if (i && _arr.length === i) break;
|
|
21
|
+
}
|
|
22
|
+
} catch (err) {
|
|
23
|
+
_d = true;
|
|
24
|
+
_e = err;
|
|
25
|
+
} finally{
|
|
26
|
+
try {
|
|
27
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
28
|
+
} finally{
|
|
29
|
+
if (_d) throw _e;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
return _arr;
|
|
33
|
+
}
|
|
34
|
+
function _nonIterableRest() {
|
|
35
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
36
|
+
}
|
|
37
|
+
function _slicedToArray(arr, i) {
|
|
38
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
39
|
+
}
|
|
40
|
+
function _unsupportedIterableToArray(o, minLen) {
|
|
41
|
+
if (!o) return;
|
|
42
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
|
43
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
44
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
45
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
46
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
|
47
|
+
}
|
|
48
|
+
var CompareContextState = /*#__PURE__*/ React.createContext(undefined);
|
|
49
|
+
var CompareContextFunctions = /*#__PURE__*/ React.createContext(undefined);
|
|
50
|
+
export function CompareContextProvider(param) {
|
|
51
|
+
var children = param.children;
|
|
52
|
+
var ref = _slicedToArray(useState([]), 2), itemsToCompare = ref[0], setItemsToCompare = ref[1];
|
|
53
|
+
// notAllowedState is needed in order to trigger rerender in useEffect dependency on the client
|
|
54
|
+
// it allow us to know that we try to add more items than allowed
|
|
55
|
+
var ref1 = _slicedToArray(useState(0), 2), notAllowedState = ref1[0], setNotAllowedState = ref1[1];
|
|
56
|
+
var itemAlreadyAdded = function(id) {
|
|
57
|
+
return itemsToCompare.filter(function(i) {
|
|
58
|
+
return i._id === id;
|
|
59
|
+
}).length !== 0;
|
|
60
|
+
};
|
|
61
|
+
var addItemToCompare = function(item, maxItemLength) {
|
|
62
|
+
var alreadyAdded = itemAlreadyAdded(item._id);
|
|
63
|
+
if (alreadyAdded) {
|
|
64
|
+
return;
|
|
65
|
+
}
|
|
66
|
+
if (itemsToCompare.length === maxItemLength) {
|
|
67
|
+
setNotAllowedState(notAllowedState + 1);
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
if (itemsToCompare.length < maxItemLength) {
|
|
71
|
+
itemsToCompare.push(item);
|
|
72
|
+
setNotAllowedState(0);
|
|
73
|
+
setItemsToCompare(itemsToCompare);
|
|
74
|
+
}
|
|
75
|
+
};
|
|
76
|
+
var removeComparedItem = function(id) {
|
|
77
|
+
var filtered = itemsToCompare.filter(function(i) {
|
|
78
|
+
return i._id !== id;
|
|
79
|
+
});
|
|
80
|
+
setItemsToCompare(filtered);
|
|
81
|
+
};
|
|
82
|
+
var removeAllComparedItems = function() {
|
|
83
|
+
return setItemsToCompare([]);
|
|
84
|
+
};
|
|
85
|
+
var notAllowed = function() {
|
|
86
|
+
return notAllowedState;
|
|
87
|
+
};
|
|
88
|
+
var functions = {
|
|
89
|
+
itemAlreadyAdded: itemAlreadyAdded,
|
|
90
|
+
addItemToCompare: addItemToCompare,
|
|
91
|
+
removeComparedItem: removeComparedItem,
|
|
92
|
+
removeAllComparedItems: removeAllComparedItems,
|
|
93
|
+
notAllowed: notAllowed
|
|
94
|
+
};
|
|
95
|
+
return(/*#__PURE__*/ React.createElement(CompareContextState.Provider, {
|
|
96
|
+
value: itemsToCompare
|
|
97
|
+
}, /*#__PURE__*/ React.createElement(CompareContextFunctions.Provider, {
|
|
98
|
+
value: functions
|
|
99
|
+
}, children)));
|
|
100
|
+
}
|
|
101
|
+
export function useCompareState() {
|
|
102
|
+
var context = React.useContext(CompareContextState);
|
|
103
|
+
if (context === undefined) {
|
|
104
|
+
throw new Error('CompareContextState must be used within a CompareContextProvider');
|
|
105
|
+
}
|
|
106
|
+
return context;
|
|
107
|
+
}
|
|
108
|
+
export function useCompareFunctions() {
|
|
109
|
+
var context = React.useContext(CompareContextFunctions);
|
|
110
|
+
if (context === undefined) {
|
|
111
|
+
throw new Error('CompareContextFunctions must be used within a CompareContextProvider');
|
|
112
|
+
}
|
|
113
|
+
return context;
|
|
114
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CompareContextProvider, useCompareState, useCompareFunctions } from './CompareContext';
|
|
@@ -31,13 +31,15 @@ export var useCheckoutShippingModule = function(orderQuery) {
|
|
|
31
31
|
var isEnabled = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : true;
|
|
32
32
|
var cartData = orderQuery.data;
|
|
33
33
|
return useMemo(function() {
|
|
34
|
-
var ref;
|
|
34
|
+
var ref, ref1;
|
|
35
35
|
if (!isEnabled) return;
|
|
36
36
|
var shipping = cartData === null || cartData === void 0 ? void 0 : (ref = cartData.shippings) === null || ref === void 0 ? void 0 : ref[0];
|
|
37
37
|
return {
|
|
38
38
|
moduleKey: shipping === null || shipping === void 0 ? void 0 : shipping.moduleKey,
|
|
39
39
|
moduleData: _objectSpread({}, shipping === null || shipping === void 0 ? void 0 : shipping.moduleData, {
|
|
40
|
-
methodKey: shipping === null || shipping === void 0 ? void 0 : shipping.moduleMethodKey
|
|
40
|
+
methodKey: shipping === null || shipping === void 0 ? void 0 : shipping.moduleMethodKey,
|
|
41
|
+
// Special case of warehouse for christian of roma
|
|
42
|
+
isWarehouseShipping: (shipping === null || shipping === void 0 ? void 0 : shipping.moduleKey) === 'PickUpFromStore' && (shipping === null || shipping === void 0 ? void 0 : (ref1 = shipping.merchant) === null || ref1 === void 0 ? void 0 : ref1.resourceKey) === 'christian-of-roma'
|
|
41
43
|
})
|
|
42
44
|
};
|
|
43
45
|
}, [
|
package/dist/esm/index.js
CHANGED
|
@@ -93,6 +93,7 @@ export * from './hooks/useProgressBar';
|
|
|
93
93
|
export * from './hooks/useCatalogDiscounts';
|
|
94
94
|
export * from './hooks/useLocalRating';
|
|
95
95
|
export * from './hooks/useProductVariants/types';
|
|
96
|
+
export * from './hooks/CompareContext/';
|
|
96
97
|
// Utils
|
|
97
98
|
export * from './utils';
|
|
98
99
|
export * from './types';
|
|
@@ -22,7 +22,7 @@ function _templateObject() {
|
|
|
22
22
|
return data;
|
|
23
23
|
}
|
|
24
24
|
export var Products = function(param) {
|
|
25
|
-
var data = param.data, bottomMenu = param.bottomMenu, priceColor = param.priceColor, textColor = param.textColor, labelsColor = param.labelsColor, onClose = param.onClose, backgroundColor = param.backgroundColor, title = param.title, offers = param.offers, productSpacing = param.productSpacing;
|
|
25
|
+
var data = param.data, bottomMenu = param.bottomMenu, priceColor = param.priceColor, textColor = param.textColor, labelsColor = param.labelsColor, onClose = param.onClose, backgroundColor = param.backgroundColor, title = param.title, offers = param.offers, productSpacing = param.productSpacing, noResults = param.noResults;
|
|
26
26
|
return(/*#__PURE__*/ React.createElement(Container, {
|
|
27
27
|
backgroundColor: backgroundColor,
|
|
28
28
|
labelsColor: labelsColor,
|
|
@@ -43,6 +43,6 @@ export var Products = function(param) {
|
|
|
43
43
|
offers: offers,
|
|
44
44
|
productSpacing: productSpacing
|
|
45
45
|
}));
|
|
46
|
-
})) : /*#__PURE__*/ React.createElement(NoResultsDesc, null,
|
|
46
|
+
})) : /*#__PURE__*/ React.createElement(NoResultsDesc, null, noResults ? noResults : 'No results found')));
|
|
47
47
|
};
|
|
48
48
|
var NoResultsDesc = styled.p(_templateObject());
|
|
@@ -194,7 +194,8 @@ export var SearchBox = function(param) {
|
|
|
194
194
|
textColor: textColor,
|
|
195
195
|
onClose: onClose,
|
|
196
196
|
backgroundColor: backgroundColor,
|
|
197
|
-
productSpacing: productSpacing
|
|
197
|
+
productSpacing: productSpacing,
|
|
198
|
+
noResults: labels === null || labels === void 0 ? void 0 : labels.noResults
|
|
198
199
|
}), bottomMenu === BottomMenuEnum.promo && promoOffers && /*#__PURE__*/ React.createElement(Products, {
|
|
199
200
|
data: promoOffers,
|
|
200
201
|
title: labels.promoOffers,
|
|
@@ -48,7 +48,7 @@ export function ProductSEO() {
|
|
|
48
48
|
};
|
|
49
49
|
var formattedDescription = favorDescriptionTemplateOverMeta ? createTemplate(descriptionTemplate) : seoData.description || createTemplate(descriptionTemplate);
|
|
50
50
|
var formattedTitle = favorTitleTemplateOverMeta ? createTemplate(titleTemplate) : seoData.title || createTemplate(titleTemplate);
|
|
51
|
-
var productJSONLd = "{\n \"@context\": \"https://schema.org\",\n \"@type\": \"Product\",\n \"name\": \"".concat(formattedTitle, "\",\n \"image\": [").concat(generateImage(image), "],\n \"description\": \"").concat(formattedDescription, "\",\n \"sku\": \"").concat((selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.sku) || '', "\",\n ").concat(brandName ? "\"brand\": {\n \"@type\": \"Brand\",\n \"name\": \"".concat(brandName, "\"\n },") : '', "\n ").concat(hasRating ? "\"aggregateRating\": {\n \"@type\": \"AggregateRating\",\n \"ratingValue\": \"".concat((ref13 = metaData.reviewRatingStatistics) === null || ref13 === void 0 ? void 0 : ref13.averageRating, "\",\n \"reviewCount\": \"").concat((ref14 = metaData.reviewRatingStatistics) === null || ref14 === void 0 ? void 0 : ref14.count, "\"\n },") : '', "\n \"offers\": {\n \"@type\": \"Offer\",\n \"priceCurrency\": \"").concat(currencyCode, "\",\n \"price\": \"").concat(price.value, "\",\n \"itemCondition\": \"").concat(itemCondition, "\",\n \"availability\": \"").concat(availability, "\"\n }\n }");
|
|
51
|
+
var productJSONLd = "{\n \"@context\": \"https://schema.org\",\n \"@type\": \"Product\",\n \"name\": \"".concat(formattedTitle === null || formattedTitle === void 0 ? void 0 : formattedTitle.replace(/"/g, '″'), "\",\n \"image\": [").concat(generateImage(image), "],\n \"description\": \"").concat(formattedDescription === null || formattedDescription === void 0 ? void 0 : formattedDescription.replace(/"/g, '″'), "\",\n \"sku\": \"").concat((selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.sku) || '', "\",\n ").concat(brandName ? "\"brand\": {\n \"@type\": \"Brand\",\n \"name\": \"".concat(brandName, "\"\n },") : '', "\n ").concat(hasRating ? "\"aggregateRating\": {\n \"@type\": \"AggregateRating\",\n \"ratingValue\": \"".concat((ref13 = metaData.reviewRatingStatistics) === null || ref13 === void 0 ? void 0 : ref13.averageRating, "\",\n \"reviewCount\": \"").concat((ref14 = metaData.reviewRatingStatistics) === null || ref14 === void 0 ? void 0 : ref14.count, "\"\n },") : '', "\n \"offers\": {\n \"@type\": \"Offer\",\n \"priceCurrency\": \"").concat(currencyCode, "\",\n \"price\": \"").concat(price.value, "\",\n \"itemCondition\": \"").concat(itemCondition, "\",\n \"availability\": \"").concat(availability, "\"\n }\n }");
|
|
52
52
|
return(/*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Head, null, /*#__PURE__*/ React.createElement("script", {
|
|
53
53
|
type: "application/ld+json",
|
|
54
54
|
dangerouslySetInnerHTML: createDangerousMarkup(productJSONLd)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { useEffect } from
|
|
2
|
-
import { useBoolean } from
|
|
3
|
-
import { isInWebView } from
|
|
1
|
+
import { useEffect } from 'react';
|
|
2
|
+
import { useBoolean } from '../../hooks/ui-hooks';
|
|
3
|
+
import { isInWebView } from '../utils';
|
|
4
4
|
function _arrayLikeToArray(arr, len) {
|
|
5
5
|
if (len == null || len > arr.length) len = arr.length;
|
|
6
6
|
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { SearchResultDTO, LineItemDTO } from '@sentecacommerce/sdk';
|
|
2
|
+
declare type CompareStateItemType = SearchResultDTO | LineItemDTO;
|
|
3
|
+
declare type CompareStateItemsType = SearchResultDTO[] | LineItemDTO[];
|
|
4
|
+
declare type CompareContextType = {
|
|
5
|
+
itemAlreadyAdded: (id: string) => boolean;
|
|
6
|
+
addItemToCompare: (item: CompareStateItemType, maxItemLength: number) => void;
|
|
7
|
+
removeComparedItem: (id: string) => void;
|
|
8
|
+
removeAllComparedItems: () => void;
|
|
9
|
+
notAllowed: () => number;
|
|
10
|
+
};
|
|
11
|
+
export declare function CompareContextProvider({ children }: {
|
|
12
|
+
children: any;
|
|
13
|
+
}): JSX.Element;
|
|
14
|
+
export declare function useCompareState(): CompareStateItemsType;
|
|
15
|
+
export declare function useCompareFunctions(): CompareContextType;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CompareContextProvider, useCompareState, useCompareFunctions, } from './CompareContext';
|
|
@@ -31,5 +31,8 @@ declare type UIFunctionsContextType = {
|
|
|
31
31
|
export declare function UIProvider({ children, displayNavbar, displaySidebar, customData, }: UIProviderProps): JSX.Element;
|
|
32
32
|
export declare function useUIState(): UIStateContextType;
|
|
33
33
|
export declare function useUIFunctions(): UIFunctionsContextType;
|
|
34
|
-
export declare function useCustomUI(): [
|
|
34
|
+
export declare function useCustomUI(): [
|
|
35
|
+
DefaultCustomUI,
|
|
36
|
+
(state: DefaultCustomUI) => void
|
|
37
|
+
];
|
|
35
38
|
export {};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -86,6 +86,7 @@ export * from './hooks/useProgressBar';
|
|
|
86
86
|
export * from './hooks/useCatalogDiscounts';
|
|
87
87
|
export * from './hooks/useLocalRating';
|
|
88
88
|
export * from './hooks/useProductVariants/types';
|
|
89
|
+
export * from './hooks/CompareContext/';
|
|
89
90
|
export * from './utils';
|
|
90
91
|
export * from './types';
|
|
91
92
|
export * from './seo';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BooleanField, NumberField, StringField } from '@sentecacommerce-theme/cms';
|
|
2
|
-
export declare const Products: ({ data, bottomMenu, priceColor, textColor, labelsColor, onClose, backgroundColor, title, offers, productSpacing, }: {
|
|
2
|
+
export declare const Products: ({ data, bottomMenu, priceColor, textColor, labelsColor, onClose, backgroundColor, title, offers, productSpacing, noResults, }: {
|
|
3
3
|
data?: any[] | undefined;
|
|
4
4
|
bottomMenu?: StringField;
|
|
5
5
|
priceColor?: StringField;
|
|
@@ -10,4 +10,5 @@ export declare const Products: ({ data, bottomMenu, priceColor, textColor, label
|
|
|
10
10
|
title?: StringField;
|
|
11
11
|
offers?: BooleanField;
|
|
12
12
|
productSpacing?: NumberField;
|
|
13
|
+
noResults?: StringField;
|
|
13
14
|
}) => JSX.Element;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const useResetPassword: ({ onSuccess, onError }: {
|
|
1
|
+
export declare const useResetPassword: ({ onSuccess, onError, }: {
|
|
2
2
|
onSuccess?: (() => void) | undefined;
|
|
3
3
|
onError?: (() => void) | undefined;
|
|
4
4
|
}) => import("react-query").MutationResultPair<import("@sentecacommerce/sdk").CustomerDTO, unknown, import("@sentecacommerce/sdk").PasswordResetDTO, unknown>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sentecacommerce-theme/lib",
|
|
3
3
|
"sideEffects": false,
|
|
4
|
-
"version": "0.14.
|
|
4
|
+
"version": "0.14.13",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
7
7
|
"types": "dist/types/index.d.ts",
|
|
@@ -31,13 +31,13 @@
|
|
|
31
31
|
"watch:cjs": "swc src --out-dir dist/cjs -w",
|
|
32
32
|
"watch:esm": "swc src --out-dir dist/esm --no-swcrc -w"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "0e1f7af30574ec8439e46f445d8b764a01108516",
|
|
35
35
|
"peerDependencies": {
|
|
36
36
|
"react-query": "^2.26.2"
|
|
37
37
|
},
|
|
38
38
|
"dependencies": {
|
|
39
|
-
"@sentecacommerce-theme/base": "^0.14.
|
|
40
|
-
"@sentecacommerce-theme/cms": "^0.14.
|
|
39
|
+
"@sentecacommerce-theme/base": "^0.14.13",
|
|
40
|
+
"@sentecacommerce-theme/cms": "^0.14.13",
|
|
41
41
|
"@sentecacommerce/sdk": "2.0.175",
|
|
42
42
|
"body-scroll-lock": "^3.1.5",
|
|
43
43
|
"copy-to-clipboard": "^3.3.1",
|