@lancom/shared 0.0.464 → 0.0.465

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.
@@ -2,4 +2,17 @@
2
2
 
3
3
  table {
4
4
  min-width: 200px;
5
- }
5
+ }
6
+
7
+ .PricingDiscountsTable__see-more {
8
+ text-align: center;
9
+ cursor: pointer;
10
+ font-size: 12px;
11
+ color: $link;
12
+ padding: 4px 0;
13
+ user-select: none;
14
+
15
+ &:hover {
16
+ text-decoration: underline;
17
+ }
18
+ }
@@ -11,7 +11,7 @@
11
11
  </thead>
12
12
  <tbody class="centered">
13
13
  <tr
14
- v-for="(range, index) in prices"
14
+ v-for="(range, index) in visiblePrices"
15
15
  :key="range.min"
16
16
  :class="{
17
17
  active: amount >= range.min && ((range.max && amount <= range.max) || !range.max)
@@ -46,6 +46,16 @@
46
46
  </td>
47
47
  </tr>
48
48
  </tbody>
49
+ <tfoot v-if="limit && prices.length > limit">
50
+ <tr>
51
+ <td
52
+ :colspan="visibleDiscount ? 3 : 2"
53
+ class="PricingDiscountsTable__see-more"
54
+ @click="showAll = !showAll">
55
+ {{ showAll ? 'Show less' : `See more (${prices.length - limit})` }}
56
+ </td>
57
+ </tr>
58
+ </tfoot>
49
59
  </table>
50
60
  </template>
51
61
 
@@ -91,14 +101,26 @@ export default {
91
101
  priceLabel: {
92
102
  type: String,
93
103
  default: 'Price'
104
+ },
105
+ limit: {
106
+ type: Number,
107
+ default: 4
94
108
  }
95
109
  },
110
+ data() {
111
+ return {
112
+ showAll: false
113
+ };
114
+ },
96
115
  computed: {
97
116
  ...mapGetters([
98
117
  'pricingSettings'
99
118
  ]),
100
119
  maxPrice() {
101
120
  return this.prices?.[0]?.price || 0;
121
+ },
122
+ visiblePrices() {
123
+ return this.limit && !this.showAll ? this.prices.slice(0, this.limit) : this.prices;
102
124
  }
103
125
  }
104
126
  };
@@ -1,7 +1,4 @@
1
1
  .OrderView {
2
- &__wrapper {
3
- margin-top: 50px;
4
- }
5
2
  &__logo {
6
3
  margin-bottom: 10px;
7
4
  }
@@ -12,7 +9,7 @@
12
9
  }
13
10
  &__table {
14
11
  margin-top: 20px;
15
- td {
12
+ td {
16
13
  width: 50%;
17
14
  padding: 20px;
18
15
  }
@@ -42,7 +39,7 @@
42
39
  align-items: flex-end;
43
40
  &--paid {
44
41
  background-image: url(../../../static/images/paid.svg);
45
- background-repeat: no-repeat;
42
+ background-repeat: no-repeat;
46
43
  background-position: 0px 0px;
47
44
  background-size: 500px;
48
45
  }
@@ -54,4 +51,4 @@
54
51
  }
55
52
  .uppercase {
56
53
  text-transform: uppercase;
57
- }
54
+ }
@@ -0,0 +1,62 @@
1
+ <template>
2
+ <div class="AddToCartBtnGuarded__wrapper">
3
+ <add-to-cart-btn
4
+ v-if="!addToCartDisabled || !clicked"
5
+ :btn-class="btnClass"
6
+ :allow-click="!clicked"
7
+ @proceed="onProceed">
8
+ <template
9
+ v-if="$slots['icon-before']"
10
+ #icon-before>
11
+ <slot name="icon-before" />
12
+ </template>
13
+ </add-to-cart-btn>
14
+ <v-popover
15
+ v-else
16
+ trigger="hover"
17
+ :delay="{ hide: 400, show: 400 }">
18
+ <add-to-cart-btn :btn-class="btnClass">
19
+ <template
20
+ v-if="$slots['icon-before']"
21
+ #icon-before>
22
+ <slot name="icon-before" />
23
+ </template>
24
+ </add-to-cart-btn>
25
+ <template slot="popover">
26
+ <slot name="popover-message">
27
+ <p>You've not added any art or text to print. We only sell custom printed products.</p>
28
+ </slot>
29
+ </template>
30
+ </v-popover>
31
+ </div>
32
+ </template>
33
+
34
+ <script>
35
+ import addToCartMixin from '@lancom/shared/mixins/add-to-cart';
36
+ import AddToCartBtn from '@lancom/shared/components/product/add-to-cart-btn';
37
+
38
+ export default {
39
+ name: 'AddToCartBtnGuarded',
40
+ components: {
41
+ AddToCartBtn
42
+ },
43
+ mixins: [addToCartMixin],
44
+ props: {
45
+ btnClass: {
46
+ type: String,
47
+ default: 'green'
48
+ }
49
+ },
50
+ data() {
51
+ return {
52
+ clicked: false
53
+ };
54
+ },
55
+ methods: {
56
+ onProceed(result) {
57
+ this.clicked = true;
58
+ this.$emit('proceed', result);
59
+ }
60
+ }
61
+ };
62
+ </script>
@@ -7,7 +7,7 @@
7
7
  <editor-pricing-details />
8
8
  </div>
9
9
  <div
10
- v-if="visibleAlert"
10
+ v-if="visibleAlert || forceAlert"
11
11
  class="EditorPricing__alerts-wrapper">
12
12
  <div
13
13
  v-if="addedToCart"
@@ -52,7 +52,7 @@
52
52
  v-else-if="!isValidOrderQuantity && isValidBigSizeOrderQuantity && minimumOrderQuantity > 1"
53
53
  class="EditorPricing__main-alert">
54
54
  <img src="~static/images/sad.svg" />
55
- Minimum order of these items must be {{ minimumOrderQuantity }} or more
55
+ Minimum order {{ selectedPrintTypeNames.length ? `for ${selectedPrintTypeNames.join(', ')}` : 'of these items' }} must be {{ minimumOrderQuantity }} or more
56
56
  </div>
57
57
 
58
58
  <div
@@ -68,6 +68,13 @@
68
68
  <img src="~static/images/smile.svg" />
69
69
  {{ hasPrintIssues ? 'Proceed with order, Will be in touch regarding print issue' : 'All good to go!' }}
70
70
  </div>
71
+
72
+ <div
73
+ v-else-if="!hasUsedSimpleProducts && forceAlert"
74
+ class="EditorPricing__main-alert">
75
+ <img src="~static/images/sad.svg" />
76
+ No products selected
77
+ </div>
71
78
  </div>
72
79
  <div
73
80
  v-if="product.isClearance || clearanceColorsWithQty.length > 0"
@@ -106,9 +113,14 @@
106
113
  {{ showDetails ? 'Hide' : 'Show' }} detail
107
114
  </div>
108
115
  <slot>
109
- <add-to-cart-btn
116
+ <add-to-cart-btn-guarded
110
117
  v-if="hasCartBtn"
111
- class="EditorPricing__add-to-cart-button" />
118
+ class="EditorPricing__add-to-cart-button"
119
+ @proceed="forceAlert = !$event">
120
+ <template #popover-message>
121
+ <p>Please select your product colours &amp; quantities and add your artwork or text before adding to cart.</p>
122
+ </template>
123
+ </add-to-cart-btn-guarded>
112
124
  </slot>
113
125
  </div>
114
126
  </div>
@@ -121,6 +133,7 @@ import { mapGetters, mapActions } from 'vuex';
121
133
  import debounce from 'lodash.debounce';
122
134
  import { price, sizesRange, printsRange, tax } from '@lancom/shared/assets/js/utils/filters';
123
135
  import AddToCartBtn from '@lancom/shared/components/product/add-to-cart-btn';
136
+ import AddToCartBtnGuarded from '@lancom/shared/components/product/add-to-cart-btn-guarded/add-to-cart-btn-guarded';
124
137
  import EditorPricingDetails from '@lancom/shared/components/editor/editor_pricing/editor_pricing_details/editor-pricing-details';
125
138
  import addToCartMixin from '@lancom/shared/mixins/add-to-cart';
126
139
 
@@ -134,7 +147,8 @@ export default {
134
147
  },
135
148
  components: {
136
149
  EditorPricingDetails,
137
- AddToCartBtn
150
+ AddToCartBtn,
151
+ AddToCartBtnGuarded
138
152
  },
139
153
  mixins: [addToCartMixin],
140
154
  props: {
@@ -154,6 +168,7 @@ export default {
154
168
  data() {
155
169
  return {
156
170
  clickedAddToCart: false,
171
+ forceAlert: false,
157
172
  price: null,
158
173
  showDetails: false,
159
174
  calculatePriceWithDebounce: debounce(() => this.calculateProductPrice({ shop: this.shop, country: this.country, currency: this.currency }), 500)
@@ -181,6 +196,13 @@ export default {
181
196
  hasPrintIssues() {
182
197
  return this.offsetWarningVisible || this.showRecommendationToUseLargerImage || this.showErrorAboutSmallImage;
183
198
  },
199
+ selectedPrintTypeNames() {
200
+ const layerPrintTypeIds = (this.layers || []).map(l => l.printType?._id || l.printType).filter(Boolean);
201
+ return (this.product.printTypes || [])
202
+ .filter(pt => layerPrintTypeIds.includes(pt._id || pt))
203
+ .map(pt => pt.name)
204
+ .filter(Boolean);
205
+ },
184
206
  hasUsedSimpleProducts() {
185
207
  return this.usedSimpleProducts.length > 0;
186
208
  },
@@ -201,10 +201,10 @@
201
201
  }
202
202
  &__zoom-image {
203
203
  position: absolute;
204
- right: -250px;
204
+ right: -200px;
205
205
  top: 0;
206
- width: 350px;
207
- height: 350px;
206
+ width: 500px;
207
+ height: 500px;
208
208
  z-index: 2;
209
209
  background-color: white;
210
210
  box-shadow: 0 0 10px gray;
@@ -212,14 +212,14 @@
212
212
  pointer-events: none;
213
213
  img {
214
214
  position: absolute;
215
- max-width: 800px;
216
- max-height: 800px;
215
+ max-width: 1000px;
216
+ max-height: 1000px;
217
217
  }
218
218
  &.preview {
219
219
  img {
220
- max-width: 350px;
221
- max-height: 350px;
220
+ max-width: 500px;
221
+ max-height: 500px;
222
222
  }
223
223
  }
224
224
  }
225
- }
225
+ }
@@ -28,7 +28,7 @@
28
28
  :aria-label="size.name"
29
29
  :disabled="disabled"
30
30
  @wheel="onWheel"
31
- @focus="onFocus()"
31
+ @focus="onFocus($event)"
32
32
  @blur="onBlur()" />
33
33
  <div
34
34
  class="ProductSizeSelectorColorCell__side-control ProductSizeSelectorColorCell__side-control--right"
@@ -141,7 +141,8 @@ export default {
141
141
  onWheel(e) {
142
142
  e.target.blur();
143
143
  },
144
- onFocus() {
144
+ onFocus(e) {
145
+ this.$nextTick(() => e.target.select());
145
146
  this.defaultValue = '';
146
147
  },
147
148
  onBlur() {
@@ -59,6 +59,7 @@
59
59
  <script>
60
60
  import { mapGetters, mapMutations } from 'vuex';
61
61
  import Info from '@lancom/shared/components/common/info-popover';
62
+ import { SETTINGS } from '@/settings';
62
63
 
63
64
  export default {
64
65
  name: 'WizardPrint',
@@ -76,7 +77,7 @@ export default {
76
77
  'Free Setup on all Black prints',
77
78
  'Standard turn around time of 5-10 days',
78
79
  'Same or next day rush service available',
79
- 'Pickup from warehouse in Mount Druitt'
80
+ `Pickup from warehouse in ${SETTINGS?.DEFAULT_PICKUP_WAREHOUSE || 'Mount Druitt'}`
80
81
  ]
81
82
  // info: 'DIGITAL - minimum 12'
82
83
  }, {
@@ -126,7 +126,7 @@ export default {
126
126
  },
127
127
  hasProductionTime: {
128
128
  type: Boolean,
129
- default: true
129
+ default: false
130
130
  },
131
131
  hasMinimumQty: {
132
132
  type: Boolean,
@@ -144,6 +144,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
144
144
  if (!this.product) {
145
145
  const query = this.getProductQuery();
146
146
  await this.fetchProduct(query);
147
+ await this.fetchProductDetails(query);
147
148
  }
148
149
 
149
150
  await this.loadProductStockDetails();
@@ -213,7 +214,7 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
213
214
  ...mapMutations(['clearProduct', 'clearTemplate', 'addTemplateLayer', 'setSimpleProductAmount', 'setPriceIncludeGST']),
214
215
  staticLink,
215
216
  getProductQuery() {
216
- const { slug } = this.$route.params;
217
+ const slug = this.slug || this.$route.params.slug;
217
218
  const { color, colour, size } = this.$route.query;
218
219
  const data = {
219
220
  shop: this.shop._id,
@@ -221,8 +222,8 @@ export default (IS_PRODUCT_PRESET_PRINT_PRICING, isEditor = false) => ({
221
222
  country: this.country?._id,
222
223
  stockCountry: this.stockCountry?._id,
223
224
  currency: this.currency?._id,
224
- defaultColor: color || colour,
225
- defaultSize: size
225
+ defaultColor: this.defaultColor || color || colour,
226
+ defaultSize: this.defaultSize || size
226
227
  };
227
228
 
228
229
  return data;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.464",
3
+ "version": "0.0.465",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {