@ecomplus/storefront-components 1.0.0-beta.189 → 1.0.0-beta.190

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ecomplus/storefront-components",
3
- "version": "1.0.0-beta.189",
3
+ "version": "1.0.0-beta.190",
4
4
  "description": "Vue components for E-Com Plus Storefront",
5
5
  "main": "dist/storefront-components.min.js",
6
6
  "scripts": {
@@ -21,7 +21,19 @@
21
21
  <i class="i-arrow-down"></i> <b>{{ discount }}</b>%
22
22
  </span>
23
23
  </slot>
24
- <slot name="stamps" />
24
+
25
+ <slot name="stamps">
26
+ <div v-if="validStamps.length" class="product-card__stamps">
27
+ <span
28
+ v-for="(stamp, i) in validStamps"
29
+ :key="`s-${i}`"
30
+ :class="'product-card__stamps-' +
31
+ + `${(stamp.id || '').toLowerCase().replace(/\s/g, '-')}`"
32
+ >
33
+ <img :src="stamp.img" :alt="stamp.id">
34
+ </span>
35
+ </div>
36
+ </slot>
25
37
 
26
38
  <slot name="body">
27
39
  <a-link
@@ -74,7 +74,13 @@ export default {
74
74
  },
75
75
  isLoaded: Boolean,
76
76
  installmentsOption: Object,
77
- discountOption: Object
77
+ discountOption: Object,
78
+ stamps: {
79
+ type: Array,
80
+ default () {
81
+ return window.productCardStamps || []
82
+ }
83
+ }
78
84
  },
79
85
 
80
86
  data () {
@@ -137,6 +143,18 @@ export default {
137
143
  return checkOnPromotion(body)
138
144
  ? Math.round(((body.base_price - getPrice(body)) * 100) / body.base_price)
139
145
  : 0
146
+ },
147
+
148
+ validStamps () {
149
+ if (!Array.isArray(this.stamps)) return []
150
+ return this.stamps.filter((stamp) => {
151
+ if (stamp && stamp.img) {
152
+ if (Array.isArray(stamp.skus) && stamp.skus.length) {
153
+ return stamp.skus.includes(this.body.sku)
154
+ }
155
+ }
156
+ return false
157
+ })
140
158
  }
141
159
  },
142
160
 
@@ -35,6 +35,11 @@ export default {
35
35
  },
36
36
 
37
37
  computed: {
38
+ i19workingDay: () => i18n({
39
+ en_us: 'Working day',
40
+ pt_br: 'Dia útil'
41
+ }),
42
+
38
43
  deadlineStr () {
39
44
  const shipping = this.shippingLine
40
45
  const isWorkingDays = (shipping.posting_deadline && shipping.posting_deadline.working_days) ||
@@ -56,9 +61,13 @@ export default {
56
61
  return `${i18n(i19upTo)} ${days} ` +
57
62
  i18n(isWorkingDays ? i19workingDays : i19days).toLowerCase()
58
63
  }
59
- return i18n(days === 1
60
- ? i19untilTomorrow
61
- : shipping.pick_up ? i19pickUpToday : i19receiveToday)
64
+ if (days === 1) {
65
+ if (isWorkingDays) {
66
+ return `${i18n(i19upTo)} 1 ` + i18n(this.i19workingDay).toLowerCase()
67
+ }
68
+ return i19untilTomorrow
69
+ }
70
+ return shipping.pick_up ? i19pickUpToday : i19receiveToday
62
71
  },
63
72
 
64
73
  freightValueStr () {