@lancom/shared 0.0.120 → 0.0.123

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.
@@ -28,6 +28,9 @@ export default {
28
28
  removeShop(id) {
29
29
  return _delete(`admin/shops/${id}`);
30
30
  },
31
+ fetchOrders(params) {
32
+ return _get(`admin/orders`, params);
33
+ },
31
34
  fetchOrderById(id, params) {
32
35
  return _get(`admin/order/${id}`, params);
33
36
  },
@@ -73,8 +76,8 @@ export default {
73
76
  createOrderWoTask(orderId, task) {
74
77
  return _post(`admin/order/${orderId}/wo-tasks`, task);
75
78
  },
76
- fetchPages() {
77
- return _get('admin/pages');
79
+ fetchPages(params) {
80
+ return _get('admin/pages', params);
78
81
  },
79
82
  fetchPageById(id) {
80
83
  return _get(`admin/pages/${id}`);
@@ -181,6 +184,18 @@ export default {
181
184
  removeProductType(id) {
182
185
  return _delete(`admin/product-types/${id}`);
183
186
  },
187
+ fetchSubscribes() {
188
+ return _get('admin/subscribe');
189
+ },
190
+ fetchSubscribeById(id) {
191
+ return _get(`admin/subscribe/${id}`);
192
+ },
193
+ saveSubscribe(subscribe) {
194
+ return subscribe._id ? _put(`admin/subscribe/${subscribe._id}`, subscribe) : _post('admin/subscribe', subscribe);
195
+ },
196
+ removeSubscribe(id) {
197
+ return _delete(`admin/subscribe/${id}`);
198
+ },
184
199
  fetchCoupons() {
185
200
  return _get('admin/coupons');
186
201
  },
@@ -205,8 +220,8 @@ export default {
205
220
  removeReview(id) {
206
221
  return _delete(`admin/reviews/${id}`);
207
222
  },
208
- fetchQuotes() {
209
- return _get('admin/quotes');
223
+ fetchQuotes(params) {
224
+ return _get('admin/quotes', params);
210
225
  },
211
226
  generateQuotePDF(id, option) {
212
227
  return _get(`admin/quotes/${id}/option/${option}/pdf`);
@@ -57,8 +57,8 @@ const api = {
57
57
  fetchBanners(shop, params) {
58
58
  return _get(`shop/${shop}/banners`, params);
59
59
  },
60
- fetchNews(shop) {
61
- return _get(`shop/${shop}/news`);
60
+ fetchNews(shop, params) {
61
+ return _get(`shop/${shop}/news`, params);
62
62
  },
63
63
  fetchSingleNews(shop, alias, preview = false) {
64
64
  return _get(`shop/${shop}/news/${alias}?preview=${preview}`);
@@ -3,7 +3,11 @@ export function convertQuoteToOrder(quote, option) {
3
3
  paymentMethod: option.paymentMethod || 'deposit',
4
4
  billingAddress: quote.address,
5
5
  shippingAddress: quote.address,
6
- products: option.products,
6
+ products: option.products.map(p => ({
7
+ ...p,
8
+ prints: p.prints.filter(print => !(option.prints || []).some(({ _id }) => print._id === _id))
9
+ })),
10
+ prints: option.prints,
7
11
  total: option.total,
8
12
  totalGST: option.totalGST,
9
13
  productsTotal: option.productsTotal,
package/nuxt.config.js CHANGED
@@ -102,9 +102,12 @@ module.exports = (config, axios) => ({
102
102
  const title = product.feedTitle
103
103
  ? product.feedTitle.replace('{colour}', sp.color.name).replace('{size}', sp.size.name).replace('{brand}', product.brand.name)
104
104
  : `${product.name} ${sp.color.name}`;
105
+ const description = `${product.description || product.fabricInfoShort || product.name || ''}`
106
+ .replace(/ /g, ' ')
107
+ .replace(/·/, '·');
105
108
  const info = {
106
109
  title: { _text: title },
107
- description: { _text: product.description || product.fabricInfoShort || product.name },
110
+ description: { _text: description },
108
111
  link: { _text: `https://${config.HOST_NAME}/${product.brand.alias}/${product.productType.alias}/${product.alias}?color=${sp.color.alias}` },
109
112
  'g:id': { _text: sp.SKU },
110
113
  'g:item_group_id': { _text: product.SKU },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.120",
3
+ "version": "0.0.123",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/order.js CHANGED
@@ -20,7 +20,7 @@ export const actions = {
20
20
  order.totalGST = pricing.totalPrice;
21
21
  order.total = pricing.totalPriceWithoutTax;
22
22
  order.couponTotal = pricing.coupon?.totalPrice || 0;
23
- order.couponCode = pricing.coupon?.code || 0;
23
+ order.couponCode = pricing.coupon?.code || null;
24
24
  order.productsTotal = pricing.products?.products?.totalPriceWithoutTax || 0;
25
25
  order.printsTotal = pricing.products?.prints?.totalPriceWithoutTax || 0;
26
26
  order.shippingTotal = pricing.shipping?.totalPriceWithoutTax || 0;
package/store/product.js CHANGED
@@ -231,8 +231,12 @@ export const mutations = {
231
231
  },
232
232
  setProductDetails(state, simpleProducts) {
233
233
  const { preSetPrint } = state;
234
+ console.log('');
235
+ console.log('setProductDetails: ');
236
+ console.log('simpleProducts1: ', simpleProducts);
234
237
  simpleProducts = simpleProducts.filter(sp => !preSetPrint || (preSetPrint.colors || []).includes(sp.color._id) )
235
238
  state.productDetails = { simpleProducts };
239
+ console.log('simpleProducts2: ', simpleProducts);
236
240
  const availableSizes = [];
237
241
  const sizesPerColor = simpleProducts.reduce((map, { color, size }) => {
238
242
  if (!map[color.alias]) {
@@ -278,7 +282,7 @@ export const mutations = {
278
282
  const colorId = whiteColorId || state.template.colors[0];
279
283
  state.template = {
280
284
  layers: keepLayers ? state.template.layers : [],
281
- colors: [colorId],
285
+ colors: colorId ? [colorId] : [],
282
286
  simpleProducts: getSimpleProductsByColor(state, colorId)
283
287
  };
284
288
  state.editableColor = state.availableColors.find(color => color._id === colorId);
package/store/quote.js CHANGED
@@ -38,7 +38,8 @@ export const actions = {
38
38
  const playload = {
39
39
  populatePrints: true,
40
40
  populateShop: true,
41
- populateColors: true
41
+ populateColors: true,
42
+ mergePrints: true
42
43
  };
43
44
  const quote = await api.fetchQuoteById(id, playload);
44
45
  commit('setQuote', quote);