@lancom/shared 0.0.283 → 0.0.285

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 (25) hide show
  1. package/assets/scss/_common.scss +5 -0
  2. package/components/checkout/cart/cart.mixin.js +2 -2
  3. package/components/checkout/cart/cart.vue +14 -4
  4. package/components/checkout/cart/cart_price_info/cart-price-info.vue +2 -2
  5. package/components/checkout/cart/cart_shipments_pricing/cart-shipments-pricing.vue +1 -1
  6. package/components/checkout/order/address-form/address-form.scss +0 -16
  7. package/components/checkout/order/address-form/address-form.vue +95 -212
  8. package/components/checkout/order/order-billing-information/order-billing-information.vue +1 -1
  9. package/components/checkout/order/order-shipping-information/order-shipping-information.vue +1 -1
  10. package/components/checkout/order/order-shipping-method/order-shipping-method.vue +2 -2
  11. package/components/common/coupon_select/coupon-select.vue +27 -23
  12. package/components/common/postcode_select/postcode-select.vue +2 -2
  13. package/components/editor/editor_pricing/editor-pricing.vue +2 -2
  14. package/components/editor/editor_print_area_options/editor-print-area-options.vue +21 -32
  15. package/components/editor/editor_workspace/editor-workspace.vue +1 -1
  16. package/components/modals/order_modal/order-modal.vue +1 -1
  17. package/components/pricing/pricing_example/pricing-example.vue +2 -2
  18. package/components/pricing/pricing_products_calculator/pricing_product_calculator/pricing-product-calculator.vue +2 -2
  19. package/components/product/editor_pricing/editor-pricing.vue +1 -1
  20. package/feeds/google-shopping.js +2 -2
  21. package/mixins/add-to-cart.js +1 -1
  22. package/mixins/products-price.js +3 -2
  23. package/package.json +1 -1
  24. package/store/cart.js +7 -6
  25. package/store/product.js +2 -2
@@ -4,6 +4,11 @@ body {
4
4
  overflow-x: hidden;
5
5
  }
6
6
 
7
+ .multiselect__spinner {
8
+ z-index: 2 !important;
9
+ top: 6px !important;
10
+ }
11
+
7
12
  .content {
8
13
  width: 100%;
9
14
  margin-top: $navbar_height;
@@ -65,11 +65,11 @@ export default {
65
65
  ]),
66
66
  handleSuburbChange(suburb) {
67
67
  this.setSuburb(suburb);
68
- this.calculateCartPrice({ shop: this.shop, country: this.country });
68
+ this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
69
69
  },
70
70
  handleCouponChange(coupon) {
71
71
  this.setCoupon(coupon);
72
- this.calculateCartPrice({ shop: this.shop, country: this.country });
72
+ this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
73
73
  },
74
74
  async removeSimpleProducts(simpleProducts) {
75
75
  const message = 'This will delete all items in this row, Press OK to continue or Cancel';
@@ -26,15 +26,15 @@
26
26
  <postcode-select
27
27
  :suburb="suburb"
28
28
  :labelless="true"
29
- placeholder="Postcode"
30
- label-text="Enter postcode to calculate shipping"
29
+ :placeholder="postcodeLabel"
30
+ :label-text="postcodeInfoLabel"
31
31
  @select="handleSuburbChange" />
32
32
  </div>
33
33
  <div class="Cart__coupon-container">
34
34
  <coupon-select
35
35
  v-model="cartCoupon"
36
36
  :pricing="cartPricingCalculating ? null : cartPricing"
37
- label-text="Enter coupon code" />
37
+ :label-text="couponLabel" />
38
38
  </div>
39
39
  <div class="Cart__quantity-errors">
40
40
  <cart-quantity-errors />
@@ -91,14 +91,24 @@ export default {
91
91
  filters: { price },
92
92
  mixins: [CartMixin],
93
93
  computed: {
94
+ ...mapGetters(['MESSAGES']),
94
95
  ...mapGetters('cart', ['isEmpty', 'cartPricingError', 'cartPricing', 'cartPricingCalculating', 'entities']),
96
+ postcodeLabel() {
97
+ return this.MESSAGES.CART_POSTCODE || 'Postcode';
98
+ },
99
+ postcodeInfoLabel() {
100
+ return this.MESSAGES.CART_POSTCODE_INFO || 'Enter postcode to calculate shipping';
101
+ },
102
+ couponLabel() {
103
+ return (this.MESSAGES.CART_COUPON || 'Coupon code').trim();
104
+ },
95
105
  cartCoupon: {
96
106
  get() {
97
107
  return this.coupon;
98
108
  },
99
109
  set(coupon) {
100
110
  this.setCoupon(coupon);
101
- this.calculateCartPrice({ shop: this.shop, country: this.country });
111
+ this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
102
112
  }
103
113
  }
104
114
  },
@@ -40,7 +40,7 @@ export default {
40
40
  };
41
41
  },
42
42
  computed: {
43
- ...mapGetters(['shop', 'country']),
43
+ ...mapGetters(['shop', 'country', 'currency']),
44
44
  ...mapGetters('cart', [
45
45
  'entities',
46
46
  'cartPricing',
@@ -61,7 +61,7 @@ export default {
61
61
  'calculateCartPrice'
62
62
  ]),
63
63
  async calculatePrice() {
64
- await this.calculateCartPrice({ shop: this.shop, country: this.country });
64
+ await this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
65
65
  }
66
66
  }
67
67
  };
@@ -33,7 +33,7 @@
33
33
  :class="{
34
34
  'CartShipmentsPricing__rate--disabled': rate.disabled
35
35
  }"
36
- @click="selectRate({ supplier, rate, shop, country })">
36
+ @click="selectRate({ supplier, rate, shop, country, currency })">
37
37
  <div class="CartShipmentsPricing__rate-info">
38
38
  <div class="CartShipmentsPricing__rate-icon">
39
39
  <checked-icon :checked="rate.selected" />
@@ -14,20 +14,4 @@
14
14
  }
15
15
  }
16
16
  }
17
- }
18
-
19
- .CustomerAddressForm {
20
- &__toggle-address {
21
- margin-bottom: 10px;
22
- cursor: pointer;
23
- display: inline-block;
24
- color: $green;
25
- border-bottom: 1px dashed $green;
26
- }
27
- &__section {
28
- padding: 15px;
29
- border: 1px solid #d7d7d7;
30
- margin-bottom: 10px;
31
- border-radius: 4px;
32
- }
33
17
  }
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div class="CustomerAddressForm__wrapper">
3
- <div class="CustomerAddressForm__form CustomerAddressForm__section">
3
+ <div class="CustomerAddressForm__form">
4
4
  <div class="form-row--cols">
5
5
  <validation-provider
6
6
  v-slot="{ errors }"
@@ -124,16 +124,74 @@
124
124
  </span>
125
125
  </validation-provider>
126
126
  </div>
127
- </div>
128
- <div class="CustomerAddressForm__section">
127
+ <validation-provider
128
+ v-slot="{ errors }"
129
+ tag="div"
130
+ name="Address line 1"
131
+ rules="required"
132
+ class="form-row">
133
+ <label
134
+ for="addressLine1"
135
+ class="form-label">
136
+ Address line 1
137
+ </label>
138
+ <input
139
+ id="addressLine1"
140
+ ref="addressLine1"
141
+ v-model="address.addressLine1"
142
+ name="addressLine1"
143
+ type="text"
144
+ class="form-field labelless"
145
+ placeholder="Address line 1"
146
+ :class="{
147
+ 'is-danger': errors.length,
148
+ filled: address.addressLine1
149
+ }"
150
+ @input="validateAddress"
151
+ @keyup.enter="$refs.addressLine1.focus()" />
152
+ <span
153
+ v-if="errors.length"
154
+ class="form-help is-danger">
155
+ {{ errors[0] }}
156
+ </span>
157
+ </validation-provider>
158
+ <validation-provider
159
+ v-slot="{ errors }"
160
+ tag="div"
161
+ name="Address line 2"
162
+ class="form-row">
163
+ <label
164
+ for="addressLine2"
165
+ class="form-label">
166
+ Address line 2
167
+ </label>
168
+ <input
169
+ id="addressLine2"
170
+ ref="addressLine2"
171
+ v-model="address.addressLine2"
172
+ name="addressLine2"
173
+ type="text"
174
+ class="form-field labelless"
175
+ placeholder="Address line 2"
176
+ :class="{
177
+ 'is-danger': errors.length,
178
+ filled: address.addressLine2
179
+ }"
180
+ @input="validateAddress"
181
+ @keyup.enter="$refs.addressLine2.focus()" />
182
+ <span
183
+ v-if="errors.length"
184
+ class="form-help is-danger">
185
+ {{ errors[0] }}
186
+ </span>
187
+ </validation-provider>
129
188
  <div class="form-row--cols">
130
189
  <postcode-select
131
- v-if="!visibleFullAddress"
132
190
  class="form-col col-half"
133
191
  :suburb="suburb"
134
192
  :labelless="true"
135
193
  :required="true"
136
- :placeholder="postcodeLabel"
194
+ placeholder="Suburb"
137
195
  @select="handleSuburbChange">
138
196
  </postcode-select>
139
197
  <div class="form-col col-half">
@@ -152,190 +210,36 @@
152
210
  disabled />
153
211
  </div>
154
212
  </div>
155
- <div
156
- @click="visibleFullAddress = !visibleFullAddress"
157
- class="CustomerAddressForm__toggle-address">
158
- {{ visibleFullAddress ? 'Find a Different Address' : 'Enter Address Manually' }}
159
- </div>
160
- <div v-if="visibleFullAddress">
161
- <validation-provider
162
- v-slot="{ errors }"
163
- tag="div"
164
- name="Address line 1"
165
- rules="required"
166
- class="form-row">
167
- <label
168
- for="addressLine1"
169
- class="form-label">
170
- Address line 1
171
- </label>
172
- <input
173
- id="addressLine1"
174
- ref="addressLine1"
175
- v-model="address.addressLine1"
176
- name="addressLine1"
177
- type="text"
178
- class="form-field labelless"
179
- placeholder="Address line 1"
180
- :class="{
181
- 'is-danger': errors.length,
182
- filled: address.addressLine1
183
- }"
184
- @input="validateAddress"
185
- @keyup.enter="$refs.addressLine1.focus()" />
186
- <span
187
- v-if="errors.length"
188
- class="form-help is-danger">
189
- {{ errors[0] }}
190
- </span>
191
- </validation-provider>
192
- <validation-provider
193
- v-slot="{ errors }"
194
- tag="div"
195
- name="Address line 2"
196
- class="form-row">
197
- <label
198
- for="addressLine2"
199
- class="form-label">
200
- Address line 2
201
- </label>
202
- <input
203
- id="addressLine2"
204
- ref="addressLine2"
205
- v-model="address.addressLine2"
206
- name="addressLine2"
207
- type="text"
208
- class="form-field labelless"
209
- placeholder="Address line 2"
210
- :class="{
211
- 'is-danger': errors.length,
212
- filled: address.addressLine2
213
- }"
214
- @input="validateAddress"
215
- @keyup.enter="$refs.addressLine2.focus()" />
216
- <span
217
- v-if="errors.length"
218
- class="form-help is-danger">
219
- {{ errors[0] }}
220
- </span>
221
- </validation-provider>
222
- <validation-provider
223
- v-if="!withoutAdditionalInfo"
224
- v-slot="{ errors }"
225
- tag="div"
213
+ <validation-provider
214
+ v-if="!withoutAdditionalInfo"
215
+ v-slot="{ errors }"
216
+ tag="div"
217
+ name="additionalInfo"
218
+ class="form-row">
219
+ <label
220
+ for="additionalInfo"
221
+ class="form-label">
222
+ Additional Info
223
+ </label>
224
+ <input
225
+ id="additionalInfo"
226
+ ref="additionalInfo"
227
+ v-model="address.additionalInfo"
226
228
  name="additionalInfo"
227
- class="form-row">
228
- <label
229
- for="additionalInfo"
230
- class="form-label">
231
- Additional Info
232
- </label>
233
- <input
234
- id="additionalInfo"
235
- ref="additionalInfo"
236
- v-model="address.additionalInfo"
237
- name="additionalInfo"
238
- placeholder="Additional Info"
239
- type="text"
240
- class="form-field labelless"
241
- :class="{
242
- 'is-danger': errors.length,
243
- filled: address.additionalInfo
244
- }"
245
- @keyup.enter="$refs.additionalInfo.focus()" />
246
- <span
247
- v-if="errors.length"
248
- class="form-help is-danger">
249
- {{ errors[0] }}
250
- </span>
251
- </validation-provider>
252
- <div class="form-row--cols">
253
- <validation-provider
254
- v-slot="{ errors }"
255
- tag="div"
256
- name="postcode"
257
- class="form-col">
258
- <label
259
- for="postcode"
260
- class="form-label">
261
- Postcode
262
- </label>
263
- <input
264
- id="postcode"
265
- ref="postcode"
266
- v-model="address.postcode"
267
- name="postcode"
268
- placeholder="Postcode"
269
- type="text"
270
- class="form-field labelless"
271
- :class="{
272
- 'is-danger': errors.length,
273
- filled: address.postcode
274
- }" />
275
- <span
276
- v-if="errors.length"
277
- class="form-help is-danger">
278
- {{ errors[0] }}
279
- </span>
280
- </validation-provider>
281
- <validation-provider
282
- v-slot="{ errors }"
283
- tag="div"
284
- :name="localityLabel"
285
- class="form-col">
286
- <label
287
- for="locality"
288
- class="form-label">
289
- {{ localityLabel }}
290
- </label>
291
- <input
292
- id="locality"
293
- ref="locality"
294
- v-model="address.city"
295
- name="locality"
296
- :placeholder="localityLabel"
297
- type="text"
298
- class="form-field labelless"
299
- :class="{
300
- 'is-danger': errors.length,
301
- filled: address.city
302
- }" />
303
- <span
304
- v-if="errors.length"
305
- class="form-help is-danger">
306
- {{ errors[0] }}
307
- </span>
308
- </validation-provider>
309
- <validation-provider
310
- v-slot="{ errors }"
311
- tag="div"
312
- :name="stateLabel"
313
- class="form-col">
314
- <label
315
- for="state"
316
- class="form-label">
317
- {{ stateLabel }}
318
- </label>
319
- <input
320
- id="state"
321
- ref="state"
322
- v-model="address.state"
323
- name="state"
324
- :placeholder="stateLabel"
325
- type="text"
326
- class="form-field labelless"
327
- :class="{
328
- 'is-danger': errors.length,
329
- filled: address.state
330
- }" />
331
- <span
332
- v-if="errors.length"
333
- class="form-help is-danger">
334
- {{ errors[0] }}
335
- </span>
336
- </validation-provider>
337
- </div>
338
- </div>
229
+ placeholder="Additional Info"
230
+ type="text"
231
+ class="form-field labelless"
232
+ :class="{
233
+ 'is-danger': errors.length,
234
+ filled: address.additionalInfo
235
+ }"
236
+ @keyup.enter="$refs.additionalInfo.focus()" />
237
+ <span
238
+ v-if="errors.length"
239
+ class="form-help is-danger">
240
+ {{ errors[0] }}
241
+ </span>
242
+ </validation-provider>
339
243
  </div>
340
244
  </div>
341
245
  </template>
@@ -349,11 +253,6 @@ export default {
349
253
  components: {
350
254
  PostcodeSelect
351
255
  },
352
- data() {
353
- return {
354
- visibleFullAddress: false
355
- };
356
- },
357
256
  props: {
358
257
  address: {
359
258
  type: Object,
@@ -365,22 +264,13 @@ export default {
365
264
  }
366
265
  },
367
266
  computed: {
368
- ...mapGetters(['shop', 'country', 'MESSAGES']),
267
+ ...mapGetters(['shop', 'country']),
369
268
  ...mapGetters('cart', [
370
269
  'suburb'
371
270
  ]),
372
271
  ...mapGetters('auth', [
373
272
  'user'
374
- ]),
375
- postcodeLabel() {
376
- return this.MESSAGES?.POSTCODES_LABEL || 'Suburb';
377
- },
378
- localityLabel() {
379
- return this.MESSAGES?.LOCALITY || 'Locality';
380
- },
381
- stateLabel() {
382
- return this.MESSAGES?.STATE || 'State';
383
- }
273
+ ])
384
274
  },
385
275
  created() {
386
276
  if (!this.address.suburb && !this.suburb && this.user?.suburb) {
@@ -407,16 +297,9 @@ export default {
407
297
  this.$set(this.address, 'postcode', suburb.postcode);
408
298
  this.$set(this.address, 'city', suburb.locality);
409
299
  this.$set(this.address, 'country', suburb.country);
410
- if (suburb.addressLine1) {
411
- this.$set(this.address, 'addressLine1', suburb.addressLine1);
412
- }
413
- if (suburb.addressLine2) {
414
- this.$set(this.address, 'addressLine2', suburb.addressLine2);
415
- }
416
300
  }
417
301
  },
418
302
  handleSuburbChange(suburb) {
419
- this.visibleFullAddress = true;
420
303
  this.setAddressSuburb(suburb);
421
304
  this.setSuburb(suburb);
422
305
  this.calculateCartPrice({ shop: this.shop, country: this.country });
@@ -427,4 +310,4 @@ export default {
427
310
 
428
311
  <style lang="scss" scoped>
429
312
  @import 'address-form.scss';
430
- </style>
313
+ </style>
@@ -29,7 +29,7 @@ import gtm from '@lancom/shared/assets/js/utils/gtm';
29
29
  import { generateOrderData } from '@lancom/shared/assets/js/utils/order';
30
30
  import CartQuantityErrors from '@lancom/shared/components/checkout/cart/cart_quantity_errors/cart-quantity-errors';
31
31
  import CartMixin from '@lancom/shared/components/checkout/cart/cart.mixin';
32
- import AddressForm from '@lancom/shared/components/checkout/order/address-form/address-form';
32
+ import AddressForm from '@/components/checkout/order/address-form/address-form';
33
33
  import ProgressStepsControls from '@lancom/shared/components/common/progress_steps/progress_steps_controls/progress-steps-controls';
34
34
 
35
35
  export default {
@@ -19,7 +19,7 @@
19
19
 
20
20
  <script>
21
21
  import { mapMutations } from 'vuex';
22
- import AddressForm from '@lancom/shared/components/checkout/order/address-form/address-form';
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
 
25
25
  export default {
@@ -45,7 +45,7 @@ export default {
45
45
  };
46
46
  },
47
47
  computed: {
48
- ...mapGetters(['shop', 'country']),
48
+ ...mapGetters(['shop', 'country', 'currency']),
49
49
  ...mapGetters('cart', ['cartPricing']),
50
50
  shippingPricing() {
51
51
  return this.cartPricing?.shipping;
@@ -53,7 +53,7 @@ export default {
53
53
  },
54
54
  mounted() {
55
55
  if (!this.shippingPricing) {
56
- this.calculateCartPrice({ shop: this.shop, country: this.country });
56
+ this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
57
57
  }
58
58
  },
59
59
  methods: {
@@ -1,33 +1,37 @@
1
1
  <template>
2
- <div class="CouponSelect__wrapper form-row">
2
+ <div class="CouponSelect__wrapper">
3
3
  <validation-provider
4
4
  tag="div"
5
5
  name="coupon"
6
6
  class="form-col col-half">
7
- <label
8
- for="coupon"
9
- class="form-label">
10
- {{ labelText }}
11
- </label>
12
7
  <div class="row">
13
8
  <div class="col-7">
14
- <input
15
- id="coupon"
16
- ref="coupon"
17
- v-model="code"
18
- placeholder="Coupon"
19
- name="coupon"
20
- type="text"
21
- class="form-field labelless"
22
- :class="{
23
- 'is-danger': code && notValidCoupon,
24
- filled: code
25
- }"
26
- @keydown.enter="validateCoupon" />
27
- <span
28
- v-if="value"
29
- class="CouponSelect__clear"
30
- @click="clearCoupon()">remove coupon</span>
9
+ <div class="form-row">
10
+ <input
11
+ id="coupon"
12
+ ref="coupon"
13
+ v-model="code"
14
+ placeholder="Coupon"
15
+ name="coupon"
16
+ type="text"
17
+ class="form-field"
18
+ :class="{
19
+ 'is-danger': code && notValidCoupon,
20
+ filled: code
21
+ }"
22
+ @keydown.enter="validateCoupon" />
23
+ <label
24
+ v-if="labelText"
25
+ for="coupon"
26
+ class="form-label label-inner"
27
+ style="color: #999 !important;">
28
+ {{ labelText }}
29
+ </label>
30
+ <span
31
+ v-if="value"
32
+ class="CouponSelect__clear"
33
+ @click="clearCoupon()">remove coupon</span>
34
+ </div>
31
35
  </div>
32
36
  <div class="col-5">
33
37
  <btn
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="PostcodeSelect">
2
+ <div class="PostcodeSelect form-row">
3
3
  <validation-provider
4
4
  v-slot="{ errors }"
5
5
  tag="div"
@@ -151,7 +151,7 @@ export default {
151
151
  },
152
152
  methods: {
153
153
  async handleSearch(query) {
154
- if (query.trim().length > 2) {
154
+ if (query.trim().length > 1) {
155
155
  this.isLoading = true;
156
156
  const country = this.codeCountry || this.country;
157
157
  const countryName = country ? (country.isoCode === 'GB' ? 'England' : (country.name || country)) : 'Australia';
@@ -116,11 +116,11 @@ export default {
116
116
  return {
117
117
  price: null,
118
118
  showDetails: false,
119
- calculatePriceWithDebounce: debounce(() => this.calculateProductPrice({ shop: this.shop, country: this.country }), 500)
119
+ calculatePriceWithDebounce: debounce(() => this.calculateProductPrice({ shop: this.shop, country: this.country, currency: this.currency }), 500)
120
120
  };
121
121
  },
122
122
  computed: {
123
- ...mapGetters(['shop', 'country']),
123
+ ...mapGetters(['shop', 'country', 'currency']),
124
124
  ...mapGetters('product', [
125
125
  'defaultSimpleProduct',
126
126
  'usedSimpleProducts',
@@ -12,10 +12,7 @@
12
12
  <editor-print-area-option
13
13
  :option="option"
14
14
  :product="product"
15
- :selected="
16
- (option.printArea && option.printArea._id === selected) ||
17
- (option.suboptions && option.printArea && option.printArea._id === selected)
18
- "
15
+ :selected="option.printArea && option.printArea._id === selected"
19
16
  @select="select"
20
17
  @option-mouseover="$emit('option-mouseover', $event)"
21
18
  @option-mouseleave="$emit('option-mouseleave', $event)" />
@@ -52,41 +49,33 @@ export default {
52
49
  default: false
53
50
  }
54
51
  },
55
- data() {
56
- return {
57
- options: []
58
- };
59
- },
60
- watch: {
61
- side() {
62
- this.updateOptions();
52
+ computed: {
53
+ options() {
54
+ const groupItemToOption = printArea => ({ printArea, label: printArea.name, size: printArea.printSize.alias });
55
+ const productsOptions = (this.product.printAreas || [])
56
+ .map(printArea => {
57
+ const mainOption = { ...groupItemToOption(printArea), sides: [printArea.side] };
58
+ const suboptions = [
59
+ mainOption,
60
+ ...(printArea.sizes || []).map(i => ({ ...groupItemToOption({ ...i, side: printArea.side }), sides: [printArea.side] }))
61
+ ];
62
+ return {
63
+ ...(suboptions.find(s => s.printArea?._id === this.selected) || mainOption),
64
+ suboptions
65
+ };
66
+ });
67
+ const options = productsOptions.filter(({ sides }) => sides.includes(this.side));
68
+ return this.allowNoPrint ? [...options, { label: 'No Print' }] : options;
63
69
  }
64
70
  },
65
71
  mounted() {
66
- this.updateOptions();
72
+ if (!this.selected) {
73
+ this.select(this.options[0]);
74
+ }
67
75
  },
68
76
  methods: {
69
- updateOptions() {
70
- const productsOptions = this.getProductOptions();
71
- const options = productsOptions.filter(({ sides }) => sides.includes(this.side));
72
- this.options = this.allowNoPrint ? [...options, { label: 'No Print' }] : options;
73
-
74
- this.select(this.options[0]);
75
- },
76
77
  select(option) {
77
78
  this.$emit('select', option);
78
- },
79
- getProductOptions() {
80
- const groupItemToOption = printArea => ({ printArea, label: printArea.name, size: printArea.printSize.alias });
81
- return (this.product.printAreas || [])
82
- .map(printArea => ({
83
- ...groupItemToOption(printArea),
84
- sides: [printArea.side],
85
- suboptions: [
86
- { ...groupItemToOption(printArea), sides: [printArea.side] },
87
- ...(printArea.sizes || []).map(i => ({ ...groupItemToOption(i), sides: [printArea.side] }))
88
- ]
89
- }));
90
79
  }
91
80
  }
92
81
  };
@@ -93,7 +93,7 @@
93
93
  v-if="productDetailsLoaded"
94
94
  ref="areaOptions"
95
95
  :product="product"
96
- :selected="selectedPrintArea && selectedPrintArea._id"
96
+ :selected="editablePrintArea && editablePrintArea._id"
97
97
  :side="editableSide.id"
98
98
  @select="selectPrintArea"
99
99
  @option-mouseover="toogleBoundBox(true, $event)"
@@ -347,7 +347,7 @@ export default {
347
347
  this.form.suburb = suburb;
348
348
  this.setAddressSuburb(suburb);
349
349
  this.setSuburb(suburb);
350
- this.calculateCartPrice({ shop: this.shop, country: this.country });
350
+ this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
351
351
  },
352
352
  back() {
353
353
  this.switchModal('showCartModal');
@@ -139,7 +139,7 @@ export default {
139
139
  };
140
140
  },
141
141
  computed: {
142
- ...mapGetters(['shop', 'country', 'taxName']),
142
+ ...mapGetters(['shop', 'country', 'currency', 'taxName']),
143
143
  printsPricing() {
144
144
  return this.productPricing?.products[this.product._id]?.prints.prints || [];
145
145
  }
@@ -152,7 +152,7 @@ export default {
152
152
  const prints = this.generateSidesPrints();
153
153
  const layers = prints.map(({ printType, printSize, printArea }) => ({ printType: printType?._id, printSize: printSize?._id, printArea: printArea?._id }));
154
154
  const entities = getProductsForCalculatePricing(this.product, [this.simpleProduct], layers, true, true);
155
- this.productPricing = await api.calculateProductPrice({ entities, country: this.country?._id }, this.shop._id);
155
+ this.productPricing = await api.calculateProductPrice({ entities, country: this.country?._id, currency: this.currency?._id }, this.shop._id);
156
156
  },
157
157
  generateSidesPrints() {
158
158
  return this.sides
@@ -216,7 +216,7 @@ export default {
216
216
  };
217
217
  },
218
218
  computed: {
219
- ...mapGetters(['shop', 'country']),
219
+ ...mapGetters(['shop', 'country', 'currency']),
220
220
  maxScreenPrintColors() {
221
221
  const printTypes = this.product.printTypes.filter(printType => printType.type === 'screen print');
222
222
  return Math.max(...printTypes.map(printType => printType.colorsQuantity));
@@ -262,7 +262,7 @@ export default {
262
262
  const prints = this.generateSidesPrints(type);
263
263
  const layers = prints.map(({ printType, printSize, printArea }) => ({ printType: printType?._id, printSize: printSize?._id, printArea: printArea?._id }));
264
264
  const entities = getProductsForCalculatePricing(this.product, [this.simpleProduct], layers, true, true);
265
- const pricing = await api.calculateProductPrice({ entities, postcode: this.postcode, country: this.country?._id }, this.shop._id);
265
+ const pricing = await api.calculateProductPrice({ entities, postcode: this.postcode, country: this.country?._id, currency: this.currency?._id }, this.shop._id);
266
266
  return { pricing, prints, type };
267
267
  })
268
268
  );
@@ -119,7 +119,7 @@ export default {
119
119
  return {
120
120
  price: null,
121
121
  showDetails: false,
122
- calculatePriceWithDebounce: debounce(() => this.calculateProductPrice({ shop: this.shop, country: this.country }), 500)
122
+ calculatePriceWithDebounce: debounce(() => this.calculateProductPrice({ shop: this.shop, country: this.country, currency: this.currency }), 500)
123
123
  };
124
124
  },
125
125
  props: {
@@ -58,7 +58,7 @@ async function googleShoppingFeed(axios, config, availableStores, country) {
58
58
  'g:id': { _text: sp.SKU },
59
59
  'g:item_group_id': { _text: product.SKU },
60
60
  'g:size': { _text: sp.size.name },
61
- 'g:size_system': 'AU',
61
+ 'g:size_system': country || 'AU',
62
62
  'g:size_type': 'regular',
63
63
  'g:gender': { _text: product.gender },
64
64
  'g:material': { _text: product.fabricInfoShort },
@@ -68,7 +68,7 @@ async function googleShoppingFeed(axios, config, availableStores, country) {
68
68
  'g:color': { _text: sp.color.name },
69
69
  'g:image_link': { _text: sp.image || image },
70
70
  'g:additional_image_link': (sp.image ? [image, ...images] : images).map(i => ({ _text: i })),
71
- 'g:price': { _text: `${(sp.price || 0)} ${sp.currency || 'AUD'}` },
71
+ 'g:price': { _text: `${(sp.price || 0)} ${sp.currencyCode || 'AUD'}` },
72
72
  'g:availability': { _text: sp.quantityStock > 0 ? 'in_stock' : 'out_of_stock' },
73
73
  'g:google_product_category': { _text: product.feedGoogleProductCategory || 2047 },
74
74
  'g:product_type': { _text: product.feedProductType || `Home > Products > ${product.productType.name}`, },
@@ -52,7 +52,7 @@ export default {
52
52
 
53
53
  this.clearTemplate(true);
54
54
 
55
- this.calculateCartPrice({ shop: this.shop, country: this.country });
55
+ this.calculateCartPrice({ shop: this.shop, country: this.country, currency: this.currency });
56
56
 
57
57
  // this.resetLayers();
58
58
  // this.setIsPrintPricing(false);
@@ -22,7 +22,7 @@ const productsPrice = {
22
22
  };
23
23
  },
24
24
  computed: {
25
- ...mapGetters(['pricingSettings', 'shop', 'country']),
25
+ ...mapGetters(['pricingSettings', 'shop', 'country', 'currency']),
26
26
  printsPricing() {
27
27
  const pricing = {};
28
28
  if (this.productPricing) {
@@ -73,7 +73,8 @@ const productsPrice = {
73
73
  products: this.calcProducts,
74
74
  postcode: this.postcode,
75
75
  screenPrint: this.screenPrint,
76
- country: this.country?._id
76
+ country: this.country?._id,
77
+ currency: this.currency?._id
77
78
  };
78
79
  this.productPricing = await api.calculateProductPrice(playload, this.shop._id);
79
80
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lancom/shared",
3
- "version": "0.0.283",
3
+ "version": "0.0.285",
4
4
  "description": "lancom common scripts",
5
5
  "author": "e.tokovenko <e.tokovenko@gmail.com>",
6
6
  "repository": {
package/store/cart.js CHANGED
@@ -153,9 +153,9 @@ export const actions = {
153
153
  await api.saveCart(payload, shop._id);
154
154
  commit('setEntities', entities);
155
155
  },
156
- async calculateCartPrice({ state: { suburb, entities, coupon, cartPricing }, commit }, { shop, country }) {
156
+ async calculateCartPrice({ state: { suburb, entities, coupon, cartPricing }, commit }, { shop, country, currency }) {
157
157
  const selectedSuppliersWithRates = cartPricing?.shipping?.suppliersWithRates;
158
- const payload = generateCalculatePriceData(entities, suburb, null, coupon, selectedSuppliersWithRates, country);
158
+ const payload = generateCalculatePriceData(entities, suburb, null, coupon, selectedSuppliersWithRates, country, currency);
159
159
  console.log('calculateCartPrice:payload: ', payload)
160
160
  try {
161
161
  commit('setCartPricingCalculating', true);
@@ -186,7 +186,7 @@ export const actions = {
186
186
  clearCart({ commit }) {
187
187
  commit('clearCart');
188
188
  },
189
- async selectRate({ state: { cartPricing, entities, suburb, coupon }, commit }, { supplier, rate, shop, country }) {
189
+ async selectRate({ state: { cartPricing, entities, suburb, coupon }, commit }, { supplier, rate, shop, country, currency }) {
190
190
  const suppliersWithRates = cartPricing.shipping.suppliersWithRates
191
191
  .map(supplierWithRates => ({
192
192
  ...(
@@ -197,7 +197,7 @@ export const actions = {
197
197
  })
198
198
  : supplierWithRates)
199
199
  }));
200
- const payload = generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, null, country);
200
+ const payload = generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, null, country, currency);
201
201
  try {
202
202
  commit('setCartPricingCalculating', true);
203
203
  const response = await api.calculateProductPrice(payload, shop._id);
@@ -254,7 +254,7 @@ export const mutations = {
254
254
  }
255
255
  };
256
256
 
257
- function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, selectedSuppliersWithRates, country) {
257
+ function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon, selectedSuppliersWithRates, country, currency) {
258
258
  const getSimpleObj = i => i && ({ _id: i._id, name: i.name });
259
259
  return {
260
260
  entities: entities.map(({ _id, guid, prints, simpleProducts, product }) => ({
@@ -295,6 +295,7 @@ function generateCalculatePriceData(entities, suburb, suppliersWithRates, coupon
295
295
  coupon,
296
296
  suppliersWithRates,
297
297
  selectedSuppliersWithRates,
298
- country: country?._id
298
+ country: country?._id,
299
+ currency: currency?._id
299
300
  };
300
301
  }
package/store/product.js CHANGED
@@ -201,10 +201,10 @@ export const actions = {
201
201
  async updatePriceIncludeGST({ commit }, value) {
202
202
  commit('setPriceIncludeGST', value);
203
203
  },
204
- async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, { shop, country }) {
204
+ async calculateProductPrice({ state: { template, product, isPrintPricing }, commit, getters }, { shop, country, currency }) {
205
205
  commit('setCalculatingPrice', true);
206
206
  const entities = getProductsForCalculatePricing(product, getters.usedSimpleProducts, template.layers, isPrintPricing, true);
207
- const response = await api.calculateProductPrice({ entities, country: country?._id }, shop._id);
207
+ const response = await api.calculateProductPrice({ entities, country: country?._id, currency: currency?._id }, shop._id);
208
208
  commit('setProductPricing', response);
209
209
  commit('setCalculatingPrice', false);
210
210
  },