@ecomplus/storefront-components 1.0.0-beta.175 → 1.0.0-beta.176
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -19,6 +19,7 @@ import ShippingLine from '../ShippingLine.vue'
|
|
|
19
19
|
|
|
20
20
|
const localStorage = typeof window === 'object' && window.localStorage
|
|
21
21
|
const zipStorageKey = 'shipping-to-zip'
|
|
22
|
+
const globalOpts = (typeof window === 'object' && window.propsShippingCalculator) || {}
|
|
22
23
|
|
|
23
24
|
const reduceItemBody = itemOrProduct => {
|
|
24
25
|
const shippedItem = {}
|
|
@@ -54,9 +55,17 @@ export default {
|
|
|
54
55
|
props: {
|
|
55
56
|
zipCode: String,
|
|
56
57
|
canSelectServices: Boolean,
|
|
58
|
+
canAutoSelectService: {
|
|
59
|
+
type: Boolean,
|
|
60
|
+
default: typeof globalOpts.canAutoSelectService === 'boolean'
|
|
61
|
+
? globalOpts.canAutoSelectService
|
|
62
|
+
: true
|
|
63
|
+
},
|
|
57
64
|
canInputZip: {
|
|
58
65
|
type: Boolean,
|
|
59
|
-
default:
|
|
66
|
+
default: typeof globalOpts.canInputZip === 'boolean'
|
|
67
|
+
? globalOpts.canInputZip
|
|
68
|
+
: true
|
|
60
69
|
},
|
|
61
70
|
countryCode: {
|
|
62
71
|
type: String,
|
|
@@ -193,7 +202,9 @@ export default {
|
|
|
193
202
|
? -1
|
|
194
203
|
: 1
|
|
195
204
|
})
|
|
196
|
-
this.
|
|
205
|
+
if (this.canAutoSelectService) {
|
|
206
|
+
this.setSelectedService(0)
|
|
207
|
+
}
|
|
197
208
|
this.hasPaidOption = Boolean(this.shippingServices.find(service => {
|
|
198
209
|
return service.shipping_line.total_price || service.shipping_line.price
|
|
199
210
|
}))
|
package/src/js/ShippingLine.js
CHANGED
|
@@ -14,6 +14,8 @@ import {
|
|
|
14
14
|
formatMoney
|
|
15
15
|
} from '@ecomplus/utils'
|
|
16
16
|
|
|
17
|
+
const globalOpts = (typeof window === 'object' && window.propsShippingLine) || {}
|
|
18
|
+
|
|
17
19
|
export default {
|
|
18
20
|
name: 'ShippingLine',
|
|
19
21
|
|
|
@@ -25,6 +27,10 @@ export default {
|
|
|
25
27
|
productionDeadline: {
|
|
26
28
|
type: Number,
|
|
27
29
|
default: 0
|
|
30
|
+
},
|
|
31
|
+
getDeadlineStr: {
|
|
32
|
+
type: Function,
|
|
33
|
+
default: globalOpts.getDeadlineStr
|
|
28
34
|
}
|
|
29
35
|
},
|
|
30
36
|
|
|
@@ -38,6 +44,14 @@ export default {
|
|
|
38
44
|
days += shipping.delivery_time.days
|
|
39
45
|
}
|
|
40
46
|
days += this.productionDeadline
|
|
47
|
+
if (this.getDeadlineStr) {
|
|
48
|
+
const str = this.getDeadlineStr({
|
|
49
|
+
days,
|
|
50
|
+
isWorkingDays,
|
|
51
|
+
shippingLine: this.shippingLine
|
|
52
|
+
})
|
|
53
|
+
if (str) return str
|
|
54
|
+
}
|
|
41
55
|
if (days > 1) {
|
|
42
56
|
return `${i18n(i19upTo)} ${days} ` +
|
|
43
57
|
i18n(isWorkingDays ? i19workingDays : i19days).toLowerCase()
|