@lancom/shared 0.0.158 → 0.0.160
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/assets/js/utils/colors.js +1 -1
- package/assets/js/utils/filters.js +15 -1
- package/components/checkout/order/address-form/address-form.vue +5 -0
- package/components/checkout/order/order-payment-information/order-payment-information.vue +8 -4
- package/components/news/news_list_item/news-list-item.vue +2 -1
- package/components/product/gallery/gallery.vue +6 -3
- package/nuxt.config.js +7 -0
- package/package.json +1 -1
- package/plugins/envs.js +6 -0
- package/plugins/vee-validate.js +1 -1
- package/plugins/vue-recaptcha.js +0 -1
- package/store/cart.js +6 -4
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import dayjs from 'dayjs';
|
|
2
2
|
import DateOnly from 'dateonly';
|
|
3
|
+
import Vue from 'vue';
|
|
3
4
|
|
|
4
5
|
import currencies from '../constants/currencies';
|
|
5
6
|
import { printsLabels } from '../constants/prints';
|
|
@@ -88,7 +89,20 @@ export const sydneyTime = d => dayjs(d).utc().utcOffset(10).format('MMM D, YYYY
|
|
|
88
89
|
|
|
89
90
|
export const priceInRange = (prices, amount) => ((prices || []).find(({ min, max }) => min <= amount && (!max || max >= amount)) || { price: 0 }).price;
|
|
90
91
|
|
|
91
|
-
export const staticLink = link =>
|
|
92
|
+
export const staticLink = link => {
|
|
93
|
+
const { PROD_S3_BUCKET, DEV_S3_BUCKET, PROD_CDN_URL, DEV_CDN_URL, STATIC_URL } = Vue.$env;
|
|
94
|
+
if ((link || '').startsWith('http')) {
|
|
95
|
+
if (PROD_S3_BUCKET && PROD_CDN_URL) {
|
|
96
|
+
link = link.replace(new RegExp(`https://${PROD_S3_BUCKET}[a-z\-\.0-9]+.amazonaws.com`), PROD_CDN_URL);
|
|
97
|
+
}
|
|
98
|
+
if (DEV_S3_BUCKET && PROD_CDN_URL) {
|
|
99
|
+
link = link.replace(new RegExp(`https://${DEV_S3_BUCKET}[a-z\-\.0-9]+.amazonaws.com`), DEV_CDN_URL);
|
|
100
|
+
}
|
|
101
|
+
return link;
|
|
102
|
+
} else {
|
|
103
|
+
return `${STATIC_URL}${link}`;
|
|
104
|
+
};
|
|
105
|
+
}
|
|
92
106
|
|
|
93
107
|
export const nl2br = text => text.replace(/\n/g, '<br>');
|
|
94
108
|
|
|
@@ -147,6 +147,7 @@
|
|
|
147
147
|
'is-danger': errors.length,
|
|
148
148
|
filled: address.addressLine1
|
|
149
149
|
}"
|
|
150
|
+
@input="validateAddress"
|
|
150
151
|
@keyup.enter="$refs.addressLine1.focus()" />
|
|
151
152
|
<span
|
|
152
153
|
v-if="errors.length"
|
|
@@ -176,6 +177,7 @@
|
|
|
176
177
|
'is-danger': errors.length,
|
|
177
178
|
filled: address.addressLine2
|
|
178
179
|
}"
|
|
180
|
+
@input="validateAddress"
|
|
179
181
|
@keyup.enter="$refs.addressLine2.focus()" />
|
|
180
182
|
<span
|
|
181
183
|
v-if="errors.length"
|
|
@@ -279,6 +281,9 @@ export default {
|
|
|
279
281
|
}
|
|
280
282
|
},
|
|
281
283
|
methods: {
|
|
284
|
+
validateAddress() {
|
|
285
|
+
this.$refs.addressProvider.validate();
|
|
286
|
+
},
|
|
282
287
|
...mapMutations('cart', [
|
|
283
288
|
'setSuburb'
|
|
284
289
|
]),
|
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
<div v-if="creating">
|
|
8
8
|
<spinner />
|
|
9
9
|
</div>
|
|
10
|
-
<div
|
|
10
|
+
<div
|
|
11
|
+
v-else
|
|
12
|
+
class="form-row OrderPaymentInformation__form">
|
|
11
13
|
<label
|
|
12
14
|
class="form-label OrderPaymentInformation__checkbox"
|
|
13
15
|
@click="updatePaymentType(false)">
|
|
@@ -121,22 +123,24 @@ export default {
|
|
|
121
123
|
}).join('</p><p>')}</p>`;
|
|
122
124
|
},
|
|
123
125
|
async submit() {
|
|
126
|
+
this.creating = true;
|
|
124
127
|
this.errorMessage = null;
|
|
125
128
|
if (this.isDepositPayment) {
|
|
126
129
|
this.setCard(null);
|
|
127
|
-
this.submitOrder();
|
|
130
|
+
await this.submitOrder();
|
|
128
131
|
} else {
|
|
129
132
|
let card = null;
|
|
130
133
|
try {
|
|
131
134
|
card = await this.$refs.paymentCart.tokenize();
|
|
132
135
|
} catch (e) {
|
|
133
|
-
this.handleErrors(e);
|
|
136
|
+
await this.handleErrors(e);
|
|
134
137
|
}
|
|
135
138
|
if (card) {
|
|
136
139
|
this.setCard(card);
|
|
137
|
-
this.submitOrder();
|
|
140
|
+
await this.submitOrder();
|
|
138
141
|
}
|
|
139
142
|
}
|
|
143
|
+
this.creating = false;
|
|
140
144
|
// this.$emit('next');
|
|
141
145
|
},
|
|
142
146
|
async submitOrder() {
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
|
|
38
38
|
<script>
|
|
39
39
|
import { date } from '@lancom/shared/assets/js/utils/filters';
|
|
40
|
+
import { staticLink } from '@lancom/shared/assets/js/utils/filters';
|
|
40
41
|
|
|
41
42
|
export default {
|
|
42
43
|
name: 'NewsListItem',
|
|
@@ -54,7 +55,7 @@ export default {
|
|
|
54
55
|
return `/news/${this.item.alias}`;
|
|
55
56
|
},
|
|
56
57
|
backgroundImage() {
|
|
57
|
-
return this.item.image ? `url('${this.item.image.medium}')` : '';
|
|
58
|
+
return this.item.image ? `url('${staticLink(this.item.image.medium)}')` : '';
|
|
58
59
|
}
|
|
59
60
|
},
|
|
60
61
|
methods: {
|
|
@@ -19,6 +19,7 @@
|
|
|
19
19
|
v-hammer:panend="onPanend"
|
|
20
20
|
class="Gallery__big-image"
|
|
21
21
|
:style="{
|
|
22
|
+
'background-image': `url(${staticLink(image.large)}`,
|
|
22
23
|
'background-size': backgroundSize,
|
|
23
24
|
'background-position': backgroundPosition,
|
|
24
25
|
'touch-action': zoomEnable ? 'none' : 'auto'
|
|
@@ -26,8 +27,7 @@
|
|
|
26
27
|
@mousedown="onMouseDown"
|
|
27
28
|
@mouseenter="onMouseEnter"
|
|
28
29
|
@mouseleave="onMouseLeave"
|
|
29
|
-
@mousemove="onMouseMove"
|
|
30
|
-
v-lazy:background-image="staticLink(image.large)">
|
|
30
|
+
@mousemove="onMouseMove">
|
|
31
31
|
<div
|
|
32
32
|
v-if="image.print"
|
|
33
33
|
class="Gallery__big-print">
|
|
@@ -65,7 +65,9 @@
|
|
|
65
65
|
'Gallery__small-image--active': index === activeIndex
|
|
66
66
|
}"
|
|
67
67
|
@click="goToSlideAndChangeColor(index)"
|
|
68
|
-
|
|
68
|
+
:style="{
|
|
69
|
+
'background-image': `url(${staticLink(image.small)}`
|
|
70
|
+
}">
|
|
69
71
|
<div class="Gallery__small-printed">
|
|
70
72
|
{{ image.printType ? 'Printed' : (product.prePrint ? product.prePrintText : image.colorName || 'Blank') }}
|
|
71
73
|
</div>
|
|
@@ -175,6 +177,7 @@ export default {
|
|
|
175
177
|
if (index > -1) {
|
|
176
178
|
this.goToSlide(index, true);
|
|
177
179
|
}
|
|
180
|
+
console.log('filteredImages: ', this.filteredImages);
|
|
178
181
|
},
|
|
179
182
|
methods: {
|
|
180
183
|
...mapActions('product', ['selectColor']),
|
package/nuxt.config.js
CHANGED
|
@@ -52,6 +52,7 @@ module.exports = (config, axios, { raygunClient } = {}) => ({
|
|
|
52
52
|
{ src: '@/node_modules/@lancom/shared/plugins/error-handler', ssr: false },
|
|
53
53
|
// { src: '@/node_modules/@lancom/shared/plugins/aos', ssr: false },
|
|
54
54
|
'@/node_modules/@lancom/shared/plugins/aos-animation',
|
|
55
|
+
'@/node_modules/@lancom/shared/plugins/envs',
|
|
55
56
|
{ src: '@/node_modules/@lancom/shared/plugins/vue-recaptcha', ssr: false },
|
|
56
57
|
// { src: '@/node_modules/@lancom/shared/plugins/vue-tables-2', ssr: false }
|
|
57
58
|
],
|
|
@@ -68,6 +69,12 @@ module.exports = (config, axios, { raygunClient } = {}) => ({
|
|
|
68
69
|
env: {
|
|
69
70
|
NODE_ENV: config.NODE_ENV || 'development'
|
|
70
71
|
},
|
|
72
|
+
publicRuntimeConfig: {
|
|
73
|
+
PROD_CDN_URL: process.env.PROD_CDN_URL,
|
|
74
|
+
DEV_CDN_URL: process.env.DEV_CDN_URL,
|
|
75
|
+
PROD_S3_BUCKET: process.env.PROD_S3_BUCKET,
|
|
76
|
+
DEV_S3_BUCKET: process.env.DEV_S3_BUCKET
|
|
77
|
+
},
|
|
71
78
|
build: {
|
|
72
79
|
publicPath: '/client/',
|
|
73
80
|
transpile: [
|
package/package.json
CHANGED
package/plugins/envs.js
ADDED
package/plugins/vee-validate.js
CHANGED
package/plugins/vue-recaptcha.js
CHANGED
package/store/cart.js
CHANGED
|
@@ -122,8 +122,9 @@ export const actions = {
|
|
|
122
122
|
await api.saveCart(payload, shop._id);
|
|
123
123
|
commit('setEntities', entities);
|
|
124
124
|
},
|
|
125
|
-
async calculateCartPrice({ state: { suburb, entities, coupon }, commit }, { shop }) {
|
|
126
|
-
const
|
|
125
|
+
async calculateCartPrice({ state: { suburb, entities, coupon, cartPricing }, commit }, { shop }) {
|
|
126
|
+
const selectedSuppliersWithRates = cartPricing?.shipping?.suppliersWithRates;
|
|
127
|
+
const payload = generateCalculatePriceData(entities, suburb, null, coupon, selectedSuppliersWithRates);
|
|
127
128
|
try {
|
|
128
129
|
const response = await api.calculateProductPrice(payload, shop._id);
|
|
129
130
|
commit('setCartPricing', response);
|
|
@@ -209,7 +210,7 @@ export const mutations = {
|
|
|
209
210
|
}
|
|
210
211
|
};
|
|
211
212
|
|
|
212
|
-
function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon) {
|
|
213
|
+
function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, selectedSuppliersWithRates) {
|
|
213
214
|
const getSimpleObj = i => i && ({ _id: i._id, name: i.name });
|
|
214
215
|
return {
|
|
215
216
|
entities: entities.map(({ _id, guid, prints, simpleProducts, product }) => ({
|
|
@@ -241,6 +242,7 @@ function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon
|
|
|
241
242
|
postcode: suburb && suburb.postcode,
|
|
242
243
|
address: suburb ? [suburb.locality, suburb.state, suburb.postcode].filter(i => !!i).join(', ') : null,
|
|
243
244
|
coupon,
|
|
244
|
-
suppliersWithRates
|
|
245
|
+
suppliersWithRates,
|
|
246
|
+
selectedSuppliersWithRates
|
|
245
247
|
};
|
|
246
248
|
}
|