@lancom/shared 0.0.264 → 0.0.266

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.
Files changed (51) hide show
  1. package/assets/js/api/admin.js +14 -11
  2. package/assets/js/constants/country.js +1 -1
  3. package/assets/scss/ui_kit/_forms.scss +2 -2
  4. package/assets/scss/ui_kit/_tooltip.scss +3 -1
  5. package/assets/scss/variables/_theme.scss +3 -3
  6. package/components/checkout/cart/cart.mixin.js +5 -5
  7. package/components/checkout/cart/cart_price_info/cart-price-info.vue +2 -2
  8. package/components/checkout/cart/cart_shipments_pricing/cart-shipments-pricing.vue +2 -2
  9. package/components/checkout/order/address-form/address-form.vue +4 -3
  10. package/components/checkout/order/order-shipping-method/order-shipping-method.vue +2 -2
  11. package/components/checkout/order/order.vue +1 -1
  12. package/components/common/payment/payment_card/pinpayment/pinpayment.vue +34 -5
  13. package/components/common/postcode_select/postcode-select.vue +5 -1
  14. package/components/common/products_total_pricing/products-total-pricing.vue +5 -1
  15. package/components/design/approve_design_header/approve-design-header.vue +1 -1
  16. package/components/editor/editor.vue +8 -2
  17. package/components/editor/editor_pricing/editor-pricing.vue +2 -2
  18. package/components/editor/editor_pricing/editor_pricing_details/editor_pricing_details_prints/editor-pricing-details-prints.vue +8 -7
  19. package/components/editor/editor_pricing/editor_pricing_details/editor_pricing_details_products/editor-pricing-details-products.vue +13 -5
  20. package/components/editor/editor_product_details/editor-product-details.scss +6 -0
  21. package/components/editor/editor_product_details/editor-product-details.vue +12 -2
  22. package/components/faq/faq.vue +2 -2
  23. package/components/modals/order_modal/order-modal.vue +17 -3
  24. package/components/order/order_price/order-price.vue +5 -3
  25. package/components/order/order_prints_groups/order-prints-groups.vue +3 -1
  26. package/components/order/order_products_groups/order-products-groups.vue +3 -1
  27. package/components/order/order_refund_view/order-refund-view.vue +5 -3
  28. package/components/order/order_setup_groups/order-setup-groups.vue +4 -2
  29. package/components/order/order_sku_groups/order-sku-groups.vue +3 -1
  30. package/components/order/order_view/order-view.vue +10 -6
  31. package/components/pricing/pricing_digital_printing/pricing-digital-printing.vue +3 -1
  32. package/components/pricing/pricing_example/pricing-example.vue +3 -3
  33. package/components/pricing/pricing_how_we_calculate/pricing-how-we-calculate.vue +7 -2
  34. package/components/pricing/pricing_products_calculator/pricing_product_calculator/pricing-product-calculator.vue +2 -2
  35. package/components/pricing/pricing_screen_printing/pricing-screen-printing.vue +3 -1
  36. package/components/product/product_multipacks_carousel/product-multipacks-carousel.scss +60 -0
  37. package/components/product/product_multipacks_carousel/product-multipacks-carousel.vue +80 -0
  38. package/components/product/product_multipacks_carousel/product_multipack/product-multipack.scss +43 -0
  39. package/components/product/product_multipacks_carousel/product_multipack/product-multipack.vue +81 -0
  40. package/components/product/product_price_range/product-price-range.vue +6 -5
  41. package/components/product/product_prints_price_info/product-prints-price-info.vue +2 -2
  42. package/components/products/products_autocomplete/products-autocomplete.scss +10 -12
  43. package/components/quotes/quote_request/quote-request.vue +1 -1
  44. package/components/quotes/quote_view/quote_option_view/quote-option-view.vue +5 -4
  45. package/feeds/google-shopping.js +16 -11
  46. package/mixins/meta-info.js +4 -1
  47. package/mixins/products-price.js +3 -2
  48. package/package.json +1 -1
  49. package/store/cart.js +7 -6
  50. package/store/index.js +16 -5
  51. package/store/product.js +3 -2
@@ -10,20 +10,21 @@
10
10
  right: 0;
11
11
  top: 41px;
12
12
  padding: 10px;
13
- background-color: $black;
14
- color: $white;
13
+ background-color: white;
14
+ border: 1px solid $medium_gray;
15
+ z-index: 999;
15
16
  }
16
17
  &__result-item {
17
18
  padding-bottom: 10px;
18
19
  margin-bottom: 10px;
19
- border-bottom: 1px solid $gray_main;
20
+ border-bottom: 1px solid $medium_gray;
20
21
  &:last-child {
21
22
  border-bottom: none;
22
23
  margin-bottom: 0px;
23
24
  }
24
25
  ::v-deep {
25
26
  a {
26
- color: $white;
27
+ color: $gray_main;
27
28
  font-size: 13px;
28
29
  text-decoration: none;
29
30
  }
@@ -33,24 +34,22 @@
33
34
  padding: 10px;
34
35
  text-align: center;
35
36
  display: block;
36
- background-color: $white;
37
+ background-color: $black;
38
+ color: $white !important;
37
39
  &:hover {
38
- background-color: $black;
39
- color: $white;
40
+ background-color: $white;
41
+ color: $black !important;
40
42
  }
41
43
  }
42
44
  }
43
45
  &__input {
44
46
  input {
45
- background-color: #535353;
46
- border: none;
47
+ border-color: $medium_gray;
47
48
  border-radius: 0px;
48
- color: $white;
49
49
  height: 41px;
50
50
  position: relative;
51
51
  z-index: 1;
52
52
  &::placeholder {
53
- font-weight: 600;
54
53
  font-size: 14px;
55
54
  color: $grey_3;
56
55
  }
@@ -61,7 +60,6 @@
61
60
  right: 10px;
62
61
  font-size: 17px;
63
62
  pointer-events: none;
64
- color: $white;
65
63
  &.icon-search {
66
64
  z-index: 2;
67
65
  pointer-events: all;
@@ -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: '',
@@ -11,9 +11,9 @@
11
11
  <div>Products Total: <b>{{ option.productsTotal | price(currency) }}</b></div>
12
12
  <div>Prints Total: <b>{{ option.printsTotal | price(currency) }}</b></div>
13
13
  <div>Shipping Total: <b>{{ option.shippingTotal | price(currency) }}</b></div>
14
- <div>Total ex GST: <b>{{ option.total | price(currency) }}</b></div>
15
- <div>GST: <b>{{ optionGst(option) | price(currency) }}</b></div>
16
- <div>Total inc GST: <b>{{ option.total | tax(gstTax) | price(currency) }}</b></div>
14
+ <div>Total ex {{ taxName }}: <b>{{ option.total | price(currency) }}</b></div>
15
+ <div>{{ taxName }}: <b>{{ optionGst(option) | price(currency) }}</b></div>
16
+ <div>Total inc {{ taxName }}: <b>{{ option.total | tax(gstTax) | price(currency) }}</b></div>
17
17
  </div>
18
18
  </div>
19
19
  </template>
@@ -40,7 +40,8 @@ export default {
40
40
  },
41
41
  computed: {
42
42
  ...mapGetters([
43
- 'gstTax'
43
+ 'gstTax',
44
+ 'taxName'
44
45
  ])
45
46
  },
46
47
  methods: {
@@ -35,7 +35,7 @@ async function googleShoppingFeed(axios, config, availableStores) {
35
35
  const frontImages = (product.images || []).filter(i => (i.types || []).includes('front') && sp.color._id === i.color).map(i => i.image);
36
36
  const backImages = (product.images || []).filter(i => (i.types || []).includes('back') && sp.color._id === i.color).map(i => i.image);
37
37
  const catalogFrontImages = (product.images || []).filter(i => (i.types || []).includes('catalog_front')).map(i => i.image);
38
- const image = spliceFirstImage(feedImages) || spliceFirstImage(frontImages) || spliceFirstImage(catalogFrontImages) || spliceFirstImage(backImages) || {};
38
+ const image = spliceFirstImage(feedImages) || spliceFirstImage(frontImages) || spliceFirstImage(catalogFrontImages) || spliceFirstImage(backImages) || null;
39
39
  const images = getImages(backImages) || getImages(frontImages) || [];
40
40
  const feedTitle = (product.feedTitle || '')
41
41
  .replace(/{colour}/g, sp.color.name)
@@ -45,10 +45,15 @@ async function googleShoppingFeed(axios, config, availableStores) {
45
45
  const description = `${product.description || product.fabricInfoShort || product.name || ''}`
46
46
  .replace(/&nbsp;/g, ' ')
47
47
  .replace(/&middot;/, '·');
48
- const link = `https://${config.HOST_NAME}/${product.brand.alias}/${product.productType.alias}/${product.alias}?color=${sp.color.alias}`;
48
+ let link = `https://${config.HOST_NAME}/${product.brand.alias}/${product.productType.alias}/${product.alias}?color=${sp.color.alias}`;
49
+ if (sp.multipackQty) {
50
+ link = `${link}&multipack=${sp.SKU}`
51
+ }
52
+
53
+ const productWeight = +((product.weight || 0) * (sp.multipackQty || 1)).toFixed(3);
49
54
  const info = {
50
- title: { _text: title },
51
- description: { _text: description },
55
+ title: { _text: sp.title || title },
56
+ description: { _text: sp.description || description },
52
57
  link: { _text: link },
53
58
  'g:id': { _text: sp.SKU },
54
59
  'g:item_group_id': { _text: product.SKU },
@@ -61,16 +66,16 @@ async function googleShoppingFeed(axios, config, availableStores) {
61
66
  'g:condition': { _text: 'new' },
62
67
  'g:mpn': { _text: sp.SKU },
63
68
  'g:color': { _text: sp.color.name },
64
- 'g:image_link': { _text: image },
65
- 'g:additional_image_link': images.map(i => ({ _text: i })),
69
+ 'g:image_link': { _text: sp.image || image },
70
+ 'g:additional_image_link': (sp.image ? [image, ...images] : images).map(i => ({ _text: i })),
66
71
  'g:price': { _text: `${(sp.price || 0)} AUD` },
67
72
  'g:availability': { _text: sp.quantityStock > 0 ? 'in_stock' : 'out_of_stock' },
68
73
  'g:google_product_category': { _text: product.feedGoogleProductCategory || 2047 },
69
74
  'g:product_type': { _text: product.feedProductType || `Home > Products > ${product.productType.name}`, },
70
75
  'g:is_bundle': { _text: 'no' },
71
76
  'g:identifier_exists': sp.gtin ? 'yes' : 'no',
72
- 'g:product_weight': { _text: `${product.weight} kg` },
73
- 'g:shipping_weight': { _text: `${((product.weight || 0) + (product.weight || 0) * 0.05).toFixed(3)} kg` },
77
+ 'g:product_weight': { _text: `${productWeight} kg` },
78
+ 'g:shipping_weight': { _text: `${(productWeight + productWeight * 0.05).toFixed(3)} kg` },
74
79
  'g:quantity': { _text: sp.quantityStock },
75
80
  };
76
81
 
@@ -91,13 +96,13 @@ async function googleShoppingFeed(axios, config, availableStores) {
91
96
  }
92
97
  if (product.volume) {
93
98
  if (product.volume.length) {
94
- info['g:shipping_length'] = { _text: `${product.volume.length} cm` };
99
+ info['g:shipping_length'] = { _text: `${parseInt(product.volume.length * (sp.multipackQty || 1))} cm` };
95
100
  }
96
101
  if (product.volume.width) {
97
- info['g:shipping_width'] = { _text: `${product.volume.width} cm` };
102
+ info['g:shipping_width'] = { _text: `${parseInt(product.volume.width * (sp.multipackQty || 1))} cm` };
98
103
  }
99
104
  if (product.volume.height) {
100
- info['g:shipping_height'] = { _text: `${product.volume.height} cm` };
105
+ info['g:shipping_height'] = { _text: `${parseInt(product.volume.height * (sp.multipackQty || 1))} cm` };
101
106
  }
102
107
  }
103
108
 
@@ -34,7 +34,10 @@ const metaInfo = {
34
34
  }
35
35
  },
36
36
  head() {
37
- const hasQueryParams = Object.keys(this.$route.query || {}).length > 0;
37
+ const hasQueryParams = Object
38
+ .keys(this.$route.query || {})
39
+ .filter(key => !['color', 'store'].includes(`${key || ''}`.toLowerCase()))
40
+ .length > 0;
38
41
 
39
42
  const { short_text: shortText, image, meta = {} } = this.routeInfo || {};
40
43
  const pageItemMeta = this.pageItem?.meta || {};
@@ -22,7 +22,7 @@ const productsPrice = {
22
22
  };
23
23
  },
24
24
  computed: {
25
- ...mapGetters(['pricingSettings', 'shop']),
25
+ ...mapGetters(['pricingSettings', 'shop', 'country']),
26
26
  printsPricing() {
27
27
  const pricing = {};
28
28
  if (this.productPricing) {
@@ -72,7 +72,8 @@ const productsPrice = {
72
72
  const playload = {
73
73
  products: this.calcProducts,
74
74
  postcode: this.postcode,
75
- screenPrint: this.screenPrint
75
+ screenPrint: this.screenPrint,
76
+ country: this.country?._id
76
77
  };
77
78
  this.productPricing = await api.calculateProductPrice(playload, this.shop._id);
78
79
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.264",
3
+ "version": "0.0.266",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/cart.js CHANGED
@@ -148,9 +148,9 @@ export const actions = {
148
148
  await api.saveCart(payload, shop._id);
149
149
  commit('setEntities', entities);
150
150
  },
151
- async calculateCartPrice({ state: { suburb, entities, coupon, cartPricing }, commit }, { shop }) {
151
+ async calculateCartPrice({ state: { suburb, entities, coupon, cartPricing }, commit }, { shop, country }) {
152
152
  const selectedSuppliersWithRates = cartPricing?.shipping?.suppliersWithRates;
153
- const payload = generateCalculatePriceData(entities, suburb, null, coupon, selectedSuppliersWithRates);
153
+ const payload = generateCalculatePriceData(entities, suburb, null, coupon, selectedSuppliersWithRates, country);
154
154
  try {
155
155
  commit('setCartPricingCalculating', true);
156
156
  const response = await api.calculateProductPrice(payload, shop._id);
@@ -179,7 +179,7 @@ export const actions = {
179
179
  clearCart({ commit }) {
180
180
  commit('clearCart');
181
181
  },
182
- async selectRate({ state: { cartPricing, entities, suburb, coupon }, commit }, { supplier, rate, shop }) {
182
+ async selectRate({ state: { cartPricing, entities, suburb, coupon }, commit }, { supplier, rate, shop, country }) {
183
183
  const suppliersWithRates = cartPricing.shipping.suppliersWithRates
184
184
  .map(supplierWithRates => ({
185
185
  ...(
@@ -190,7 +190,7 @@ export const actions = {
190
190
  })
191
191
  : supplierWithRates)
192
192
  }));
193
- const payload = generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon);
193
+ const payload = generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, null, country);
194
194
  try {
195
195
  commit('setCartPricingCalculating', true);
196
196
  const response = await api.calculateProductPrice(payload, shop._id);
@@ -245,7 +245,7 @@ export const mutations = {
245
245
  }
246
246
  };
247
247
 
248
- function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, selectedSuppliersWithRates) {
248
+ function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, selectedSuppliersWithRates, country) {
249
249
  const getSimpleObj = i => i && ({ _id: i._id, name: i.name });
250
250
  return {
251
251
  entities: entities.map(({ _id, guid, prints, simpleProducts, product }) => ({
@@ -285,6 +285,7 @@ function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon
285
285
  address: suburb ? [suburb.locality, suburb.state, suburb.postcode].filter(i => !!i).join(', ') : null,
286
286
  coupon,
287
287
  suppliersWithRates,
288
- selectedSuppliersWithRates
288
+ selectedSuppliersWithRates,
289
+ country: country?._id
289
290
  };
290
291
  }
package/store/index.js CHANGED
@@ -35,6 +35,7 @@ export const getters = {
35
35
  pricingSettings: ({ pricing }) => pricing || {},
36
36
  orderSettings: ({ orderInfo }) => orderInfo || {},
37
37
  gstTax: ({ pricing }) => pricing?.gstTax || 0,
38
+ taxName: ({ pricing }) => pricing?.taxName || 'GST',
38
39
  displayPricingWithTax: ({ pricing }) => !!pricing?.displayPricingWithTax,
39
40
  screenPrintsPrices: ({ pricing }) => pricing?.screenPrintsPrices || {},
40
41
  depositInfo: ({ depositInfo }) => depositInfo || {}
@@ -55,14 +56,15 @@ export const actions = {
55
56
  commit('setCountry', settings.country);
56
57
  commit('setCurrency', settings.currency);
57
58
 
59
+ const countrySettings = (shop.countries || []).find(c => c.country?._id === settings.country?._id) || { settings: [] };
60
+
58
61
  if (process.env.PINPAYMENT_PUBLISHABLE_API_KEY) {
59
62
  commit('setPayment', {
60
63
  type: 'pinpayment',
61
64
  clientKey: process.env.PINPAYMENT_PUBLISHABLE_API_KEY
62
65
  });
63
66
  } else {
64
- const countrySettings = (shop.countries || []).find(c => c.country?._id === settings.country?._id) || { settings: [] };
65
- const countrySetting = countrySettings.settings.find(s => !!s.settings.app.STRIPE_PUBLIC_KEY);
67
+ const countrySetting = (countrySettings?.settings || []).find(s => !!s.settings.app.STRIPE_PUBLIC_KEY);
66
68
  if (countrySetting) {
67
69
  commit('setPayment', {
68
70
  type: 'stripe',
@@ -71,6 +73,13 @@ export const actions = {
71
73
  }
72
74
  }
73
75
 
76
+
77
+ const pricingSetting = (countrySettings?.settings || []).find(s => !!s.settings.pricing);
78
+ commit('setPricing', {
79
+ ...shop.settings.pricing,
80
+ ...(pricingSetting?.settings?.pricing || {})
81
+ });
82
+
74
83
  // }
75
84
  try {
76
85
  if (req.headers.cookie) {
@@ -99,7 +108,7 @@ export const actions = {
99
108
  commit('cart/setCoupon', coupon);
100
109
  } catch (e) {}
101
110
  }
102
- dispatch('cart/calculateCartPrice', { shop });
111
+ dispatch('cart/calculateCartPrice', { shop, country });
103
112
  }
104
113
  }
105
114
  const closedNotification = localStorage.getItem(CLOSED_NOTIFICATION);
@@ -121,15 +130,17 @@ export const mutations = {
121
130
  setPayment(state, payment) {
122
131
  state.payment = payment;
123
132
  },
133
+ setPricing(state, pricing) {
134
+ state.pricing = pricing;
135
+ },
124
136
  setCountry(state, country) {
125
137
  state.country = country;
126
138
  },
127
139
  setCurrency(state, currency) {
128
140
  state.currency = currency;
129
141
  },
130
- setSettings(state, { contacts, pricing, notificationBar, discountPopup, order, depositInfo }) {
142
+ setSettings(state, { contacts, notificationBar, discountPopup, order, depositInfo }) {
131
143
  state.contacts = contacts;
132
- state.pricing = pricing;
133
144
  state.orderInfo = order;
134
145
  state.notificationBar = notificationBar;
135
146
  state.discountPopup = discountPopup;
package/store/product.js CHANGED
@@ -160,6 +160,7 @@ export const actions = {
160
160
  commit('setSelectedPrintArea', { printArea: first._id, size: first.printSize });
161
161
  }
162
162
  } catch (e) {
163
+ console.log(e);
163
164
  const { status, data } = e?.response || {};
164
165
  const statusCode = status || 500;
165
166
  commit('setLoadError', {
@@ -199,10 +200,10 @@ export const actions = {
199
200
  async updatePriceIncludeGST({ commit }, value) {
200
201
  commit('setPriceIncludeGST', value);
201
202
  },
202
- async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, shop) {
203
+ async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, { shop, country }) {
203
204
  commit('setCalculatingPrice', true);
204
205
  const entities = getProductsForCalculatePricing(product, getters.usedSimpleProducts, template.layers, isPrintPricing, true);
205
- const response = await api.calculateProductPrice({ entities }, shop._id);
206
+ const response = await api.calculateProductPrice({ entities, country: country?._id }, shop._id);
206
207
  commit('setProductPricing', response);
207
208
  commit('setCalculatingPrice', false);
208
209
  },