@lancom/shared 0.0.387 → 0.0.388

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 (19) hide show
  1. package/components/checkout/cart/cart.mixin.js +3 -3
  2. package/components/checkout/cart/cart_shipping/cart-shipping.vue +5 -8
  3. package/components/checkout/order/address-form/address-form.vue +2 -4
  4. package/components/checkout/order/order-billing-information/order-billing-information.vue +1 -1
  5. package/components/checkout/order/order-shipping-information/order-shipping-information.vue +2 -2
  6. package/components/common/postcode_select/postcode-select.vue +2 -2
  7. package/components/modals/order_modal/order-modal.vue +3 -5
  8. package/components/product/product_price_range/product-price-range.vue +2 -2
  9. package/components/products_kit/products_kit/products-kit.scss +5 -0
  10. package/components/products_kit/products_kit/products-kit.vue +12 -17
  11. package/components/products_kit/products_kit/products_kit_cart/products-kit-cart.scss +1 -1
  12. package/components/products_kit/products_kit/products_kit_cart/products_kit_cart_options/products-kit-cart-options.vue +1 -1
  13. package/components/products_kit/products_kit/products_kit_cart/products_kit_cart_options/products_kit_cart_option/products-kit-cart-option.scss +6 -0
  14. package/components/products_kit/products_kit/products_kit_cart/products_kit_cart_options/products_kit_cart_option/products-kit-cart-option.vue +8 -1
  15. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_color/products-kit-option-color.vue +5 -0
  16. package/components/products_kit/products_kit/products_kit_options/products_kit_option/products_kit_option_size/products-kit-option-size.vue +7 -0
  17. package/package.json +1 -1
  18. package/store/cart.js +11 -0
  19. package/store/productsKit.js +2 -1
@@ -35,7 +35,7 @@ export default {
35
35
  return this.isNotValidProductsQuantity || this.isNotValidStockQuantity || this.isNotValidPrintsQuantity || this.isNotValidPrintsBigSizeQuantity;
36
36
  },
37
37
  isNotValidShipping() {
38
- return this.needToPickup ? this.notValidProductsPickup.length > 0 : !this.suburb;
38
+ return this.needToPickup ? (this.notValidProductsPickup.length > 0 && !this.suburb) : !this.suburb;
39
39
  },
40
40
  isNotValidProductsQuantity() {
41
41
  return this.notValidProductsQuantities.length > 0;
@@ -63,11 +63,11 @@ export default {
63
63
  },
64
64
  methods: {
65
65
  ...mapMutations('cart', [
66
- 'setNeedToPickup',
67
- 'setSuburb',
68
66
  'setCoupon'
69
67
  ]),
70
68
  ...mapActions('cart', [
69
+ 'setSuburb',
70
+ 'setNeedToPickup',
71
71
  'removeSimpleProductsFromCart',
72
72
  'calculateCartPrice'
73
73
  ]),
@@ -30,8 +30,7 @@
30
30
  <div
31
31
  v-if="!isAvailableForPickupSomeProducts"
32
32
  class="CartShipping__pickup-warnings">
33
- Pickup not available for current cart items
34
- {{ notValidProductsPickupBySKU }}
33
+ Pickup only available for "Code Red" brand
35
34
  </div>
36
35
  <div
37
36
  v-if="visiblePickupError && hasNotValidProductsPickup"
@@ -54,7 +53,7 @@ import { mapGetters, createNamespacedHelpers } from 'vuex';
54
53
  import PostcodeSelect from '@lancom/shared/components/common/postcode_select/postcode-select';
55
54
  import { price } from '@lancom/shared/assets/js/utils/filters';
56
55
 
57
- const { mapActions, mapMutations } = createNamespacedHelpers('cart');
56
+ const { mapActions } = createNamespacedHelpers('cart');
58
57
 
59
58
  export default {
60
59
  name: 'LancomCartShipping',
@@ -95,7 +94,7 @@ export default {
95
94
  return this.onlyPostcode ? 'Postcode' : (this.MESSAGES.CART_POSTCODE || 'Postcode');
96
95
  },
97
96
  hasNotValidProductsPickup() {
98
- return this.notValidProductsPickup.length > 0;
97
+ return this.notValidProductsPickup.length > 0 && !this.suburb;
99
98
  },
100
99
  wantsToPickup: {
101
100
  get() {
@@ -132,13 +131,11 @@ export default {
132
131
  }
133
132
  },
134
133
  methods: {
135
- ...mapMutations([
134
+ ...mapActions([
136
135
  'setSuburb',
136
+ 'calculateCartPrice',
137
137
  'setNeedToPickup'
138
138
  ]),
139
- ...mapActions([
140
- 'calculateCartPrice'
141
- ]),
142
139
  async calculatePrice() {
143
140
  await this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
144
141
  }
@@ -218,7 +218,7 @@
218
218
  </template>
219
219
 
220
220
  <script>
221
- import { mapGetters, mapMutations, mapActions } from 'vuex';
221
+ import { mapGetters, mapActions } from 'vuex';
222
222
  import PostcodeSelect from '@lancom/shared/components/common/postcode_select/postcode-select';
223
223
  import PhoneInput from '@lancom/shared/components/common/phone_input/phone-input';
224
224
 
@@ -283,10 +283,8 @@ export default {
283
283
  validateAddress() {
284
284
  // this.$refs.addressProvider.validate();
285
285
  },
286
- ...mapMutations('cart', [
287
- 'setSuburb'
288
- ]),
289
286
  ...mapActions('cart', [
287
+ 'setSuburb',
290
288
  'calculateCartPrice'
291
289
  ]),
292
290
  setAddressSuburb(suburb) {
@@ -28,7 +28,7 @@
28
28
  <h5 class="lc_h3 lc_uppercase lc_bold mt-10 mb-15">Billing Address</h5>
29
29
  <address-form
30
30
  :address="order.billingAddress"
31
- :copy-from="order.shippingAddress"
31
+ :copy-from="needToPickupWithoutErrors ? null : order.shippingAddress"
32
32
  name-prefix="Delivery "
33
33
  :without-additional-info="true" />
34
34
  </div>
@@ -18,7 +18,7 @@
18
18
  </template>
19
19
 
20
20
  <script>
21
- import { mapMutations } from 'vuex';
21
+ import { mapActions } from 'vuex';
22
22
  import AddressForm from '@/components/checkout/order/address-form/address-form';
23
23
  import ProgressStepsControls from '@lancom/shared/components/common/progress_steps/progress_steps_controls/progress-steps-controls';
24
24
 
@@ -35,7 +35,7 @@ export default {
35
35
  }
36
36
  },
37
37
  methods: {
38
- ...mapMutations('cart', [
38
+ ...mapActions('cart', [
39
39
  'setSuburb'
40
40
  ]),
41
41
  copyFromBillingAddress() {
@@ -173,11 +173,11 @@ export default {
173
173
  }
174
174
  }
175
175
  },
176
- mounted() {
176
+ async mounted() {
177
177
  if (this.suburb) {
178
178
  const option = this.createOptionFromSuburb(this.suburb);
179
179
  this.selected = option;
180
- this.options = [option];
180
+ await this.handleSearch(this.selected.value.trim())
181
181
  }
182
182
  },
183
183
  methods: {
@@ -241,7 +241,7 @@
241
241
  </template>
242
242
 
243
243
  <script>
244
- import { mapGetters, mapActions, mapMutations } from 'vuex';
244
+ import { mapGetters, mapActions } from 'vuex';
245
245
  import PostcodeSelect from '@lancom/shared/components/common/postcode_select/postcode-select';
246
246
  import PhoneInput from '@lancom/shared/components/common/phone_input/phone-input';
247
247
  import ProductTotalPricing from '@lancom/shared/components/common/products_total_pricing/products-total-pricing';
@@ -298,11 +298,9 @@ export default {
298
298
  ...mapActions('order', [
299
299
  'createOrder'
300
300
  ]),
301
- ...mapMutations('cart', [
302
- 'setSuburb'
303
- ]),
304
301
  ...mapActions('cart', [
305
- 'calculateCartPrice'
302
+ 'calculateCartPrice',
303
+ 'setSuburb'
306
304
  ]),
307
305
  setAddressSuburb(suburb) {
308
306
  this.$set(this.form, 'suburb', suburb);
@@ -2,12 +2,12 @@
2
2
  <div
3
3
  class="ProductPriceRange__wrapper">
4
4
  <div
5
- v-if="product[minPriceAttr] === product[maxPriceAttr]"
5
+ v-if="product[minPriceAttr] === product[maxPriceAttr] || !product[maxPriceAttr]"
6
6
  class="ProductPriceRange__price lc_h4">
7
7
  <div
8
8
  v-if="withGst"
9
9
  class="lc_h4">
10
- {{ product[minPriceAttr] | tax(gstTax) | price(currency) }}
10
+ {{ prePriceText }} {{ product[minPriceAttr] | tax(gstTax) | price(currency) }}
11
11
  <span
12
12
  v-if="visiblePriceInfo"
13
13
  class="lc_regular11 lc_bold">inc. {{ taxName }}</span>
@@ -51,4 +51,9 @@
51
51
  background-color: $gray;
52
52
  padding: 15px;
53
53
  }
54
+ &__message {
55
+ color: $error;
56
+ font-size: 12px;
57
+ margin-bottom: 5px;
58
+ }
54
59
  }
@@ -1,31 +1,23 @@
1
1
  <template>
2
2
  <div>
3
- <article class="ProductsKit__wrapper">
4
- <div class="ProductsKit__header-info post-full-content">
5
- <div class="post-content">
6
- <h1 class="lc_h1">
7
- {{ productsKit.name }}
8
- </h1>
9
- </div>
10
- </div>
11
- <div class="ProductsKit__post post-full-content">
12
- <div
13
- class="lc_regular14"
14
- v-html="productsKit.description"></div>
15
- </div>
16
- </article>
17
3
  <products-kit-options
18
4
  v-if="productsKit[optionsAttr]"
19
5
  class="ProductsKit__options"
20
6
  :products-kit="productsKit"
21
7
  :options-attr="optionsAttr" />
22
- <products-kit-cart
23
- class="ProductsKit__cart"
24
- :products-kit="productsKit" />
8
+ <div class="ProductsKit__cart">
9
+ <div
10
+ v-if="!isAllOptionsSelected"
11
+ class="ProductsKit__message">
12
+ Please choose one product of each required option
13
+ </div>
14
+ <products-kit-cart :products-kit="productsKit" />
15
+ </div>
25
16
  </div>
26
17
  </template>
27
18
 
28
19
  <script>
20
+ import { mapGetters } from 'vuex';
29
21
  import ProductsKitOptions from './products_kit_options/products-kit-options';
30
22
  import ProductsKitCart from './products_kit_cart/products-kit-cart';
31
23
 
@@ -44,6 +36,9 @@ export default {
44
36
  type: String,
45
37
  default: 'productsKitOptions'
46
38
  }
39
+ },
40
+ computed: {
41
+ ...mapGetters('productsKit', ['isAllOptionsSelected'])
47
42
  }
48
43
  };
49
44
  </script>
@@ -22,7 +22,7 @@
22
22
  input {
23
23
  padding: 14px;
24
24
  font-size: 20px;
25
- width: 150px;
25
+ width: 110px;
26
26
  }
27
27
  .NumberInput__side-control {
28
28
  width: 30px !important;
@@ -1,7 +1,7 @@
1
1
  <template>
2
2
  <div class="ProductsKitCartOptions__wrapper">
3
3
  <products-kit-cart-option
4
- v-for="option in productsKit.options"
4
+ v-for="option in productsKit.productsKitOptions"
5
5
  :key="option._id"
6
6
  :products-kit="productsKit"
7
7
  :option="option"
@@ -37,5 +37,11 @@
37
37
  font-weight: bold;
38
38
  color: grey;
39
39
  }
40
+ &--alert {
41
+ background-color: rgb(255, 201, 201);
42
+ span {
43
+ color: rgb(137, 38, 38);
44
+ }
45
+ }
40
46
  }
41
47
  }
@@ -14,8 +14,15 @@
14
14
  <div
15
15
  v-else
16
16
  class="ProductsKitCartOption__placeholder"
17
+ :class="{
18
+ 'ProductsKitCartOption__placeholder--alert': option.required
19
+ }"
17
20
  @click="scrollToOption()">
18
- <span>+</span>
21
+ <i
22
+ v-if="option.required"
23
+ class="icon-attention-circled"
24
+ v-tooltip="'Please choose product'"></i>
25
+ <span v-else>+</span>
19
26
  </div>
20
27
  </div>
21
28
  </template>
@@ -79,6 +79,11 @@ export default {
79
79
  },
80
80
  methods: {
81
81
  ...mapActions('productsKit', ['selectOptionColor'])
82
+ },
83
+ mounted() {
84
+ if (!this.selectedColor && this.availableColors.length === 1) {
85
+ this.selectedColor = this.availableColors[0];
86
+ }
82
87
  }
83
88
  };
84
89
  </script>
@@ -76,6 +76,13 @@ export default {
76
76
  return Array.from(uniqueSizesMap.values());
77
77
  }
78
78
  },
79
+ watch: {
80
+ selectedColor() {
81
+ if (!this.selectedSize && this.availableSizes.length === 1) {
82
+ this.selectedSize = this.availableSizes[0];
83
+ }
84
+ }
85
+ },
79
86
  methods: {
80
87
  ...mapActions('productsKit', ['selectOptionSize'])
81
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.387",
3
+ "version": "0.0.388",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/cart.js CHANGED
@@ -226,6 +226,17 @@ export const actions = {
226
226
  clearCart({ commit }) {
227
227
  commit('clearCart');
228
228
  },
229
+ setNeedToPickup({ commit }, needToPickup) {
230
+ localStorage.removeItem(SUPPLIERS_WITH_RATES_KEY);
231
+ commit('setNeedToPickup', needToPickup);
232
+ commit('setCartPricing', null);
233
+ },
234
+ setSuburb({ commit }, suburb) {
235
+ localStorage.removeItem(SUPPLIERS_WITH_RATES_KEY);
236
+ commit('setSuburb', suburb);
237
+ commit('setCartPricing', null);
238
+
239
+ },
229
240
  async selectRate({ state: { cartPricing, entities, suburb, coupon }, commit }, { supplier, rate, shop, country, currency }) {
230
241
  const suppliersWithRates = cartPricing.shipping.suppliersWithRates
231
242
  .map(supplierWithRates => ({
@@ -41,7 +41,8 @@ export const getters = {
41
41
  selectedOptionsSizes: ({ selectedOptionsSizes }) => selectedOptionsSizes,
42
42
  isAllOptionsSelected: ({ productsKit, selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes }) => {
43
43
  const selectedSimpleProducts = getSelectedSimpleProducts(selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes);
44
- return productsKit.productsKitOptions?.length === selectedSimpleProducts?.length;
44
+ const requiredOptions = productsKit.productsKitOptions?.filter(pk => pk.required) || [];
45
+ return requiredOptions?.length <= selectedSimpleProducts?.length;
45
46
  },
46
47
  selectedSimpleProducts: ({ selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes }) => getSelectedSimpleProducts(selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes),
47
48
  maxOrderQty: ({ selectedOptionsSimpleProducts, selectedOptionsColors, selectedOptionsSizes }) => {