@lancom/shared 0.0.248 → 0.0.249

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.
@@ -132,34 +132,34 @@ export default {
132
132
  return _post(`admin/orders/pick-pdf`, { orders });
133
133
  },
134
134
  saveOrderSubsequentInvoice(order, invoice) {
135
- return invoice._id ? _put(`admin/shop/${order.shop}/order/${order._id}/invoice/${invoice._id}`, invoice) : _post(`admin/shop/${order.shop}/order/${order._id}/invoice`, invoice);
135
+ return invoice._id ? _put(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/invoice/${invoice._id}`, invoice) : _post(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/invoice`, invoice);
136
136
  },
137
137
  sendOrderSubsequentInvoice(order, invoice) {
138
- return _post(`admin/shop/${order.shop}/order/${order._id}/invoice/${invoice}/send`);
138
+ return _post(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/invoice/${invoice}/send`);
139
139
  },
140
- exportOrderToStarshipit(order, shipment) {
141
- return _post(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/export-to-starshipit`, shipment);
140
+ exportOrderToShippingService(order, shipment) {
141
+ return _post(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/export-to-shipping-service`, shipment);
142
142
  },
143
143
  markShipmentAsDispatched(order, shipment) {
144
- return _post(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/dispatched`, shipment);
144
+ return _post(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/dispatched`, shipment);
145
145
  },
146
146
  markSubOrderAsDispatched(order, subOrder) {
147
- return _post(`admin/shop/${order.shop}/order/${order._id}/sub-order/${subOrder._id}/dispatched`, subOrder);
147
+ return _post(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/sub-order/${subOrder._id}/dispatched`, subOrder);
148
148
  },
149
149
  generateDuplicateOrderCode(order) {
150
150
  return _get(`admin/order/${order}/duplicate-code`);
151
151
  },
152
152
  sendShipmentTracking(order, shipment, tracking) {
153
- return _post(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/tracking/${tracking._id}/send`, tracking);
153
+ return _post(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/tracking/${tracking._id}/send`, tracking);
154
154
  },
155
- removeShipmentFromStarshipit(order, shipment) {
156
- return _delete(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}`);
155
+ removeShipment(order, shipment) {
156
+ return _delete(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}`);
157
157
  },
158
158
  calculateShipmentRates(order, shipment) {
159
- return _get(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/calculate-shipping`);
159
+ return _get(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/calculate-shipping`);
160
160
  },
161
161
  createPrintLabels(order, shipment, rate) {
162
- return _post(`admin/shop/${order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/print-labels`, rate);
162
+ return _post(`admin/shop/${order.shop?._id || order.shop}/order/${order._id}/shipment/${shipment._id || shipment.guid}/print-labels`, rate);
163
163
  },
164
164
  createOrderRefund(order, refund, shop) {
165
165
  return _post(`shop/${shop}/order/${order}/refund`, refund);
@@ -1,4 +1,4 @@
1
1
  export const COUNTRIES_CODES = {
2
2
  Australia: 'AU',
3
- 'United Kingdom': 'UK'
3
+ 'United Kingdom': 'GB'
4
4
  };
@@ -203,7 +203,7 @@
203
203
  <input
204
204
  id="country"
205
205
  ref="country"
206
- value="Only Australia"
206
+ :value="address.country === 'Australia' ? 'Only Australia' : address.country"
207
207
  name="country"
208
208
  type="country"
209
209
  class="form-field filled labelless"
@@ -296,6 +296,7 @@ export default {
296
296
  this.$set(this.address, 'state', suburb.state);
297
297
  this.$set(this.address, 'postcode', suburb.postcode);
298
298
  this.$set(this.address, 'city', suburb.locality);
299
+ this.$set(this.address, 'country', suburb.country);
299
300
  }
300
301
  },
301
302
  handleSuburbChange(suburb) {
@@ -98,7 +98,7 @@ export default {
98
98
  company: null,
99
99
  additionalInfo: null,
100
100
  suburb: null,
101
- country: 'Australia',
101
+ country: null,
102
102
  state: null,
103
103
  postcode: null
104
104
  };
@@ -88,6 +88,9 @@ export default {
88
88
  },
89
89
  filters: { highlight },
90
90
  props: {
91
+ country: {
92
+ type: Object
93
+ },
91
94
  value: {
92
95
  type: String
93
96
  },
@@ -147,7 +150,8 @@ export default {
147
150
  async handleSearch(query) {
148
151
  if (query.length) {
149
152
  this.isLoading = true;
150
- this.suburbs = await api.fetchSuburbs({ query });
153
+ const country = this.country ? (this.country.isoCode === 'GB' ? 'England' : (this.country.name || this.country)) : 'Australia';
154
+ this.suburbs = await api.fetchSuburbs({ query, country });
151
155
  this.options = this.suburbs.map(this.createOptionFromSuburb);
152
156
  this.isLoading = false;
153
157
  } else {
@@ -36,7 +36,7 @@
36
36
  {{ order.postcode }},
37
37
  {{ order.state }},
38
38
  {{ order.city }},
39
- Australia
39
+ {{ order.country || 'Australia'}}
40
40
  </span>
41
41
  </div>
42
42
  </div>
@@ -127,11 +127,11 @@
127
127
  {{ errors[0] }}
128
128
  </span>
129
129
  </validation-provider>
130
- <div class="form-row">
130
+ <div v-if="suburb" class="form-row">
131
131
  <input
132
132
  id="country"
133
133
  ref="country"
134
- value="Only Australia"
134
+ :value="suburb.country"
135
135
  name="country"
136
136
  type="country"
137
137
  class="form-field filled labelless"
@@ -303,6 +303,9 @@ export default {
303
303
  mounted() {
304
304
  if (this.orderData) {
305
305
  this.form = {
306
+ state: null,
307
+ country: null,
308
+ postcode: null,
306
309
  city: this.orderData.city,
307
310
  phone: this.orderData.phone,
308
311
  addressLine1: this.orderData.addressLine1,
@@ -325,8 +328,18 @@ export default {
325
328
  ...mapActions('cart', [
326
329
  'calculateCartPrice'
327
330
  ]),
331
+ setAddressSuburb(suburb) {
332
+ this.$set(this.form, 'suburb', suburb);
333
+ if (suburb) {
334
+ this.$set(this.form, 'state', suburb.state);
335
+ this.$set(this.form, 'postcode', suburb.postcode);
336
+ this.$set(this.form, 'city', suburb.locality);
337
+ this.$set(this.form, 'country', suburb.country);
338
+ }
339
+ },
328
340
  handleSuburbChange(suburb) {
329
341
  this.form.suburb = suburb;
342
+ this.setAddressSuburb(suburb);
330
343
  this.setSuburb(suburb);
331
344
  this.calculateCartPrice({ shop: this.shop });
332
345
  },
@@ -335,6 +348,7 @@ export default {
335
348
  },
336
349
  async submit() {
337
350
  try {
351
+ debugger;
338
352
  this.processing = true;
339
353
  const recaptchaToken = await this.getRecaptcha('create_order');
340
354
  await this.createOrder({
@@ -354,7 +354,7 @@ export default {
354
354
  email: '',
355
355
  phone: '',
356
356
  suburb: null,
357
- country: 'Australia'
357
+ country: null
358
358
  },
359
359
  expectedItemsQuantity: null,
360
360
  description: '',
@@ -2,7 +2,10 @@ async function googleLocalShoppingFeed(axios, config, availableStores) {
2
2
  const result = await googleShoppingFeed(axios, config, availableStores);
3
3
 
4
4
  const fields = [
5
+ // 'title',
6
+ // 'description',
5
7
  'g:availability',
8
+ // 'g:link_template',
6
9
  'g:id',
7
10
  'g:pickup_method',
8
11
  'g:pickup_sla',
@@ -11,7 +14,11 @@ async function googleLocalShoppingFeed(axios, config, availableStores) {
11
14
  'g:store_code'
12
15
  ];
13
16
  result.rss.channel.item = result.rss.channel.item
14
- .map(i => fields.reduce((item, field) => ({ ...item, [field]: i[field] }), {}));
17
+ .map(i => fields
18
+ .reduce((item, field) => ({
19
+ ...item,
20
+ [field]: i[field],
21
+ }), {}));
15
22
  return result;
16
23
  }
17
24
  async function googleShoppingFeed(axios, config, availableStores) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.248",
3
+ "version": "0.0.249",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
@@ -0,0 +1,4 @@
1
+ module.exports = function (req, res, next) {
2
+ res.setHeader('Cache-Control', `max-age=${86400}`); // 1 day
3
+ next();
4
+ };