@lancom/shared 0.0.157 → 0.0.159
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/api/admin.js +2 -2
- 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 +32 -1
- 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/assets/js/api/admin.js
CHANGED
|
@@ -40,8 +40,8 @@ export default {
|
|
|
40
40
|
removeNewsTag(id) {
|
|
41
41
|
return _delete(`admin/news-tag/${id}`);
|
|
42
42
|
},
|
|
43
|
-
fetchCanonicalProducts() {
|
|
44
|
-
return _get('admin/canonical-product');
|
|
43
|
+
fetchCanonicalProducts(params) {
|
|
44
|
+
return _get('admin/canonical-product', params);
|
|
45
45
|
},
|
|
46
46
|
fetchCanonicalProductById(id) {
|
|
47
47
|
return _get(`admin/canonical-product/${id}`);
|
|
@@ -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"
|
|
@@ -183,6 +185,23 @@
|
|
|
183
185
|
{{ errors[0] }}
|
|
184
186
|
</span>
|
|
185
187
|
</validation-provider>
|
|
188
|
+
<validation-provider
|
|
189
|
+
ref="addressProvider"
|
|
190
|
+
v-slot="{ errors }"
|
|
191
|
+
tag="div"
|
|
192
|
+
name="Full Address"
|
|
193
|
+
class="form-row"
|
|
194
|
+
:rules="{ max: 45 }">
|
|
195
|
+
<input
|
|
196
|
+
v-model="fullAddress"
|
|
197
|
+
name="fullAddress"
|
|
198
|
+
type="hidden" />
|
|
199
|
+
<span
|
|
200
|
+
v-if="errors.length"
|
|
201
|
+
class="form-help is-danger">
|
|
202
|
+
Full Address max length is 45
|
|
203
|
+
</span>
|
|
204
|
+
</validation-provider>
|
|
186
205
|
<div class="form-row--cols">
|
|
187
206
|
<postcode-select
|
|
188
207
|
class="form-col col-half"
|
|
@@ -268,7 +287,16 @@ export default {
|
|
|
268
287
|
]),
|
|
269
288
|
...mapGetters('auth', [
|
|
270
289
|
'user'
|
|
271
|
-
])
|
|
290
|
+
]),
|
|
291
|
+
fullAddress: {
|
|
292
|
+
get() {
|
|
293
|
+
return [
|
|
294
|
+
(this.address.addressLine1 || ''),
|
|
295
|
+
(this.address.addressLine2 || '')
|
|
296
|
+
].filter(a => !!a).join(', ');
|
|
297
|
+
},
|
|
298
|
+
set() {}
|
|
299
|
+
}
|
|
272
300
|
},
|
|
273
301
|
created() {
|
|
274
302
|
if (!this.address.suburb && !this.suburb && this.user?.suburb) {
|
|
@@ -279,6 +307,9 @@ export default {
|
|
|
279
307
|
}
|
|
280
308
|
},
|
|
281
309
|
methods: {
|
|
310
|
+
validateAddress() {
|
|
311
|
+
this.$refs.addressProvider.validate();
|
|
312
|
+
},
|
|
282
313
|
...mapMutations('cart', [
|
|
283
314
|
'setSuburb'
|
|
284
315
|
]),
|
|
@@ -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