@wikala/spmkt 2.31.0 → 3.0.0-beta.0
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.
- package/MIGRATION_GUIDE.md +261 -0
- package/api/product.js +1 -0
- package/api/request.js +9 -4
- package/api/user.js +1 -1
- package/components/Account/AccountDashboard.vue +101 -101
- package/components/Account/AccountStore.js +57 -31
- package/components/Account/AffiliateReport.vue +56 -60
- package/components/Account/{OrderDetail.vue → Orders/OrderDetail.vue} +44 -30
- package/components/Account/Orders/Orders.vue +124 -0
- package/components/Account/{AccountSettings.vue → Settings/AccountSettings.vue} +4 -4
- package/components/Account/Settings/ChangeEmail.vue +136 -0
- package/components/Account/Settings/ChangeName.vue +82 -0
- package/components/Account/Settings/ChangePassword.vue +91 -0
- package/components/Address/Address.vue +38 -57
- package/components/Address/AddressBook.vue +77 -57
- package/components/Address/AddressSelect.vue +94 -87
- package/components/Address/Edit.vue +253 -265
- package/components/Address/PostalCode.vue +22 -21
- package/components/AgeGate.vue +11 -5
- package/components/Auth/Login.vue +62 -44
- package/components/Auth/Register.vue +82 -60
- package/components/Auth/ResetPassword.vue +45 -30
- package/components/Cart/AgeVerification/AgeChecker.vue +3 -3
- package/components/Cart/CartBadge.vue +15 -4
- package/components/Cart/CartBox.vue +19 -11
- package/components/Cart/CartItem.vue +3 -3
- package/components/Cart/CartMode.vue +6 -5
- package/components/Cart/CartPreview.vue +24 -18
- package/components/Cart/Coupon.vue +4 -5
- package/components/Cart/CreditCard/Everyware.vue +10 -10
- package/components/Cart/CreditCard/ExtendedCreditCard.vue +5 -5
- package/components/Cart/CreditCard/SquarePay.vue +18 -16
- package/components/Cart/CreditCard/StandardCreditCard.vue +9 -9
- package/components/Cart/Delivery/Delivery.vue +16 -12
- package/components/Cart/Delivery/DeliveryAddress.vue +1 -1
- package/components/Cart/Delivery/DeliveryMethods.vue +1 -1
- package/components/Cart/Delivery/DeliveryOptions.vue +15 -9
- package/components/Cart/Delivery/DeliveryTypes.vue +8 -5
- package/components/Cart/Delivery/ReservationSlots.vue +14 -8
- package/components/Cart/Disclaimer.vue +1 -1
- package/components/Cart/OrderConfirmation.vue +1 -1
- package/components/Cart/Payment/Payment.vue +37 -33
- package/components/Cart/Payment/PaymentMethods.vue +6 -4
- package/components/Cart/ReviewAndSubmit.vue +9 -7
- package/components/Cart/ShoppingCart.vue +42 -31
- package/components/Cart/Store/actions.js +1 -1
- package/components/Cart/Store/getters.js +2 -1
- package/components/Cart/Store/index.js +1 -1
- package/components/Cart/Store/mutations.js +7 -5
- package/components/Cart/UserIdentity.vue +1 -1
- package/components/Category/CategoryFilter.vue +128 -114
- package/components/Category/CategorySort.vue +44 -32
- package/components/Category/LoadMore.vue +39 -23
- package/components/DeliverTo.vue +10 -15
- package/components/DeliveryNotice.vue +72 -68
- package/components/DobInput.vue +23 -23
- package/components/Gmaps/GmapsAutocomplete.vue +139 -78
- package/components/Gmaps/GmapsLocations.vue +1 -1
- package/components/Gmaps/GmapsSingleLocation.vue +121 -87
- package/components/ModalContainer/ModalContainer.vue +12 -9
- package/components/ModalContainer/index.js +61 -18
- package/components/Product/AddToCart.vue +237 -221
- package/components/Product/BoxAddToCart.vue +114 -86
- package/components/Product/Compare.vue +68 -48
- package/components/Product/CompareBox.vue +128 -123
- package/components/Product/Lookup.vue +92 -65
- package/components/Product/Photo.vue +105 -66
- package/components/Product/Price.vue +64 -43
- package/components/Product/ProductAutocomplete.vue +52 -57
- package/components/Product/ProductBox.vue +61 -38
- package/components/Product/ProductImages.vue +83 -86
- package/components/Product/Quantity.vue +115 -53
- package/components/Product/QuickView.vue +52 -45
- package/components/Product/RelatedProducts.vue +88 -23
- package/components/Product/SKU.vue +27 -8
- package/components/Product/Variants.vue +335 -341
- package/components/Product/reviews-questions/ProductQuestions.vue +226 -198
- package/components/Product/reviews-questions/ProductReviews.vue +122 -107
- package/components/Product/reviews-questions/Review.vue +54 -59
- package/components/Product/reviews-questions/ReviewForm.vue +222 -170
- package/components/Product/reviews-questions/ReviewImages.vue +197 -216
- package/components/Product/reviews-questions/Vote.vue +83 -57
- package/components/QuantityInput.vue +18 -8
- package/components/RangeInput.vue +15 -8
- package/components/Recaptcha.vue +8 -1
- package/components/SelectShippingCountry.vue +81 -62
- package/components/TimedOffer.vue +59 -74
- package/composables/globals.js +53 -0
- package/config.js +5 -2
- package/index.js +41 -10
- package/install.js +75 -0
- package/locales/en.json +2 -1
- package/locales/sr.json +2 -1
- package/package.json +43 -30
- package/utils/directives.js +28 -45
- package/utils/event-bus.js +56 -0
- package/utils/filters.js +24 -7
- package/utils/{gmaps.js → google/gmaps.js} +43 -10
- package/utils/{google-analytics-eec.js → google/google-analytics-eec.js} +7 -7
- package/babel.config.js +0 -5
- package/components/Account/ChangeEmail.vue +0 -133
- package/components/Account/ChangeName.vue +0 -92
- package/components/Account/ChangePassword.vue +0 -94
- package/components/Account/CreditCards.vue +0 -18
- package/components/Account/Orders.vue +0 -110
- package/components/Account/Settings.vue +0 -18
- package/components/Cart/Delivery/DeliveryAddressGuest.spec.js +0 -128
- package/components/Cart/Delivery/DeliveryTypes.spec.js +0 -83
- package/components/Cart/PCIBadge/SecurityMetrics.vue +0 -11
- package/components/Instagram.vue +0 -49
- package/components/ProductImageModal.vue +0 -41
- package/jest.config.js +0 -16
- package/test/e2e/.babelrc.js +0 -8
- package/test/e2e/.eslintrc.js +0 -11
- package/test/e2e/accAuth.spec.js +0 -64
- package/test/e2e/ageGate.spec.js +0 -26
- package/test/e2e/checkout.spec.js +0 -106
- package/test/e2e/compare.spec.js +0 -52
- package/test/e2e/config/data.js +0 -21
- package/test/e2e/config/routes.js +0 -11
- package/test/e2e/region.spec.js +0 -46
- package/test/e2e/search.spec.js +0 -32
- package/tests/vueBuefy.js +0 -4
- package/tsconfig.json +0 -8
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
<div class="column is-8">
|
|
5
5
|
|
|
6
6
|
<PaymentMethods
|
|
7
|
-
:
|
|
7
|
+
:modelValue="paymentMethod.id"
|
|
8
8
|
:methods="paymentMethods"
|
|
9
9
|
:error="paymentMethodError"
|
|
10
|
-
@
|
|
10
|
+
@update:modelValue="onPaymentMethodsInput"
|
|
11
11
|
/>
|
|
12
12
|
|
|
13
13
|
<div class="mt-6" v-if="paymentMethod && paymentMethod.type === 'realtime'">
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
<b-checkbox
|
|
24
24
|
v-if="showBillingAddressCheckbox"
|
|
25
25
|
v-model="billingAddressSameAsShipping"
|
|
26
|
-
@
|
|
26
|
+
@update:model-value="billingAddressSameAsShippingChange($event)"
|
|
27
27
|
type="is-info"
|
|
28
28
|
size="is-small"
|
|
29
29
|
>
|
|
@@ -37,6 +37,7 @@
|
|
|
37
37
|
context="billing-guest"
|
|
38
38
|
:countries="countryList"
|
|
39
39
|
:address-data="billing_address"
|
|
40
|
+
:errors="billingAddressErrors"
|
|
40
41
|
:with-email="false"
|
|
41
42
|
:show-footer="false"
|
|
42
43
|
content-class=""
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
</div>
|
|
62
63
|
|
|
63
64
|
<div class="cart-accept-tos mt-6 mb-6" v-if="initialState.acceptTOSAtCheckout">
|
|
64
|
-
<b-checkbox name="accept_tos" data-test="accept-tos" v-model="acceptTOS" @
|
|
65
|
+
<b-checkbox name="accept_tos" data-test="accept-tos" v-model="acceptTOS" @update:model-value="acceptTOSChange">
|
|
65
66
|
<span v-html="$t('cart.acceptTOS')"></span>
|
|
66
67
|
</b-checkbox>
|
|
67
68
|
<p class="help is-danger" v-if="acceptTOSError">
|
|
@@ -129,6 +130,7 @@ export default {
|
|
|
129
130
|
showBillingAddressCheckbox: false,
|
|
130
131
|
billingAddressSameAsShipping: true,
|
|
131
132
|
billing_address: {},
|
|
133
|
+
billingAddressErrors: {},
|
|
132
134
|
validationErrors: {},
|
|
133
135
|
paymentMethodError: false,
|
|
134
136
|
recaptchaToken: '',
|
|
@@ -164,12 +166,16 @@ export default {
|
|
|
164
166
|
methods: {
|
|
165
167
|
...mapMutations(['setActiveStep', 'setCreditCard', 'setCardToken', 'setBillingAddress', 'setRecaptchaToken', 'setIdempotencyKey', 'setPaymentMethod', 'setAffiliate']),
|
|
166
168
|
|
|
167
|
-
...mapActions(['getAddresses']),
|
|
169
|
+
...mapActions(['getAddresses', 'validateAddress']),
|
|
168
170
|
|
|
169
171
|
acceptTOSChange() {
|
|
170
172
|
this.acceptTOSError = ''
|
|
171
173
|
},
|
|
172
174
|
|
|
175
|
+
onAddressesChanged() {
|
|
176
|
+
this.getAddresses()
|
|
177
|
+
},
|
|
178
|
+
|
|
173
179
|
onPaymentMethodsInput(pl) {
|
|
174
180
|
this.paymentMethodError = false
|
|
175
181
|
this.paymentMethod = _.findWhere(this.paymentMethods, {id: pl})
|
|
@@ -185,17 +191,25 @@ export default {
|
|
|
185
191
|
selectBillingAddress(address) {
|
|
186
192
|
//console.log('CreditCard selecting billing address ', address)
|
|
187
193
|
this.setBillingAddress(address)
|
|
188
|
-
this.$bus
|
|
194
|
+
this.$bus.emit('billingAddressChange', address)
|
|
189
195
|
},
|
|
190
196
|
|
|
191
|
-
validateBillingAddress() {
|
|
197
|
+
async validateBillingAddress() {
|
|
192
198
|
if (this.guestMode) {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
this
|
|
196
|
-
|
|
197
|
-
} else {
|
|
199
|
+
this.billingAddressErrors = {}
|
|
200
|
+
try {
|
|
201
|
+
await this.validateAddress(this.billing_address)
|
|
202
|
+
this.setBillingAddress(this.billing_address)
|
|
198
203
|
return true
|
|
204
|
+
} catch (e) {
|
|
205
|
+
this.billingAddressErrors = e.errors || {}
|
|
206
|
+
this.$buefy.toast.open({
|
|
207
|
+
duration: 3000,
|
|
208
|
+
message: e.message,
|
|
209
|
+
position: 'is-top',
|
|
210
|
+
type: 'is-danger'
|
|
211
|
+
})
|
|
212
|
+
return false
|
|
199
213
|
}
|
|
200
214
|
}
|
|
201
215
|
|
|
@@ -225,7 +239,7 @@ export default {
|
|
|
225
239
|
|
|
226
240
|
async submitPayment() {
|
|
227
241
|
this.isLoading = true
|
|
228
|
-
const cqLoading = this.$buefy.loading.open()
|
|
242
|
+
const cqLoading = this.$buefy.loading.open({})
|
|
229
243
|
|
|
230
244
|
this.setAffiliateData()
|
|
231
245
|
await this.paymentGetRecaptchaToken()
|
|
@@ -311,7 +325,7 @@ export default {
|
|
|
311
325
|
return this.checkoutRequestData.billing_address.postcode || this.checkoutRequestData.shipping_address.postcode
|
|
312
326
|
},
|
|
313
327
|
|
|
314
|
-
handleToken(token, errors) {
|
|
328
|
+
async handleToken(token, errors) {
|
|
315
329
|
if (token) {
|
|
316
330
|
this.setCardToken(token)
|
|
317
331
|
if (this.billingAddressSameAsShipping) {
|
|
@@ -322,7 +336,7 @@ export default {
|
|
|
322
336
|
}
|
|
323
337
|
}
|
|
324
338
|
|
|
325
|
-
if (!this.billingAddressSameAsShipping && !this.validateBillingAddress()) {
|
|
339
|
+
if (!this.billingAddressSameAsShipping && !(await this.validateBillingAddress())) {
|
|
326
340
|
return false
|
|
327
341
|
} else {
|
|
328
342
|
this.submitPayment()
|
|
@@ -337,7 +351,7 @@ export default {
|
|
|
337
351
|
//console.log('handleToken ', token, errors)
|
|
338
352
|
},
|
|
339
353
|
|
|
340
|
-
placeOrder() {
|
|
354
|
+
async placeOrder() {
|
|
341
355
|
if(!this.paymentMethod.id) {
|
|
342
356
|
this.paymentMethodError = true
|
|
343
357
|
return
|
|
@@ -366,7 +380,7 @@ export default {
|
|
|
366
380
|
return false
|
|
367
381
|
}
|
|
368
382
|
|
|
369
|
-
if (!this.billingAddressSameAsShipping && !this.validateBillingAddress()) {
|
|
383
|
+
if (!this.billingAddressSameAsShipping && !(await this.validateBillingAddress())) {
|
|
370
384
|
return false
|
|
371
385
|
} else {
|
|
372
386
|
this.submitPayment()
|
|
@@ -410,23 +424,13 @@ export default {
|
|
|
410
424
|
}
|
|
411
425
|
}
|
|
412
426
|
|
|
413
|
-
this.$bus
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
this.$bus.$on('EditAddress:saved', () => {
|
|
418
|
-
this.getAddresses()
|
|
419
|
-
})
|
|
427
|
+
this.$bus.on('addressAdded', this.onAddressesChanged)
|
|
428
|
+
this.$bus.on('EditAddress:saved', this.onAddressesChanged)
|
|
429
|
+
},
|
|
420
430
|
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
return
|
|
425
|
-
}
|
|
426
|
-
console.log('onAddressValid:billing', context, address)
|
|
427
|
-
this.setBillingAddress(address)
|
|
428
|
-
this.submitPayment()
|
|
429
|
-
})
|
|
431
|
+
beforeUnmount() {
|
|
432
|
+
this.$bus.off('addressAdded', this.onAddressesChanged)
|
|
433
|
+
this.$bus.off('EditAddress:saved', this.onAddressesChanged)
|
|
430
434
|
}
|
|
431
435
|
}
|
|
432
436
|
</script>
|
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
<b-radio
|
|
7
7
|
v-for="(pm, index) in methods"
|
|
8
8
|
:key="'_pm_' + pm.id"
|
|
9
|
-
:value="
|
|
10
|
-
@
|
|
9
|
+
:model-value="modelValue"
|
|
10
|
+
@update:model-value="$emit('update:modelValue', $event)"
|
|
11
11
|
name="paymentmethod"
|
|
12
12
|
:data-test="'payment-method-' + pm.id"
|
|
13
13
|
:native-value="pm.id"
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
export default {
|
|
34
34
|
name: 'PaymentMethods',
|
|
35
35
|
props: {
|
|
36
|
-
|
|
36
|
+
modelValue: {
|
|
37
37
|
type: [String, Number]
|
|
38
38
|
},
|
|
39
39
|
methods: {
|
|
@@ -46,9 +46,11 @@ export default {
|
|
|
46
46
|
}
|
|
47
47
|
},
|
|
48
48
|
|
|
49
|
+
emits: ['update:modelValue'],
|
|
50
|
+
|
|
49
51
|
mounted() {
|
|
50
52
|
if (this.methods.length === 1) {
|
|
51
|
-
this.$emit('
|
|
53
|
+
this.$emit('update:modelValue', this.methods[0].id)
|
|
52
54
|
}
|
|
53
55
|
}
|
|
54
56
|
}
|
|
@@ -17,10 +17,10 @@
|
|
|
17
17
|
<br />
|
|
18
18
|
{{ $getProp(checkoutRequestData.shipping_address, ['country', 'name']) }}<br />
|
|
19
19
|
Phone number: {{ checkoutRequestData.shipping_address.phone }}<br />
|
|
20
|
-
<button @click="$bus
|
|
20
|
+
<button @click="$bus.emit('setStep', steps.shipping)" class="button"> Change </button>
|
|
21
21
|
</div>
|
|
22
22
|
<div v-else>
|
|
23
|
-
<button @click="$bus
|
|
23
|
+
<button @click="$bus.emit('setStep', steps.shipping)" class="button"> Select shipping address </button>
|
|
24
24
|
</div>
|
|
25
25
|
</div>
|
|
26
26
|
</div>
|
|
@@ -31,12 +31,12 @@
|
|
|
31
31
|
<div>
|
|
32
32
|
<div v-if="checkoutRequestData.card_number">
|
|
33
33
|
{{ checkoutRequestData.card_type.toUpperCase() }}
|
|
34
|
-
{{ checkoutRequestData.card_number
|
|
34
|
+
{{ hidecc(checkoutRequestData.card_number) }}<br />
|
|
35
35
|
Exp: {{ checkoutRequestData.card_expiry_month }}/{{ checkoutRequestData.card_expiry_year }}<br />
|
|
36
|
-
<button @click="$bus
|
|
36
|
+
<button @click="$bus.emit('setStep', steps.payment)" class="button"> Change </button>
|
|
37
37
|
</div>
|
|
38
38
|
<div v-else>
|
|
39
|
-
<button @click="$bus
|
|
39
|
+
<button @click="$bus.emit('setStep', steps.payment)" class="button"> Please enter your payment details </button>
|
|
40
40
|
</div>
|
|
41
41
|
</div>
|
|
42
42
|
</div>
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
</div>
|
|
64
64
|
<div class="column is-2"></div>
|
|
65
65
|
|
|
66
|
-
<b-loading :is-full-page="false"
|
|
66
|
+
<b-loading :is-full-page="false" v-model="isLoading" :can-cancel="true"></b-loading>
|
|
67
67
|
</div>
|
|
68
68
|
</div>
|
|
69
69
|
</template>
|
|
@@ -72,6 +72,7 @@
|
|
|
72
72
|
import { mapState, mapMutations } from 'vuex'
|
|
73
73
|
|
|
74
74
|
import { Cart } from '../../api'
|
|
75
|
+
import { hidecc } from '../../utils/filters'
|
|
75
76
|
|
|
76
77
|
import CartPreview from './CartPreview'
|
|
77
78
|
import CartSummary from './CartSummary'
|
|
@@ -97,6 +98,7 @@ export default {
|
|
|
97
98
|
...mapState(['steps', 'cart', 'checkoutRequestData', 'guestMode'])
|
|
98
99
|
},
|
|
99
100
|
methods: {
|
|
101
|
+
hidecc,
|
|
100
102
|
...mapMutations(['setRecaptchaToken']),
|
|
101
103
|
|
|
102
104
|
refreshRecaptchaToken() {
|
|
@@ -122,7 +124,7 @@ export default {
|
|
|
122
124
|
Cart.checkout(this.checkoutRequestData, this.guestMode)
|
|
123
125
|
.then((response) => {
|
|
124
126
|
this.isLoading = false
|
|
125
|
-
this.$bus
|
|
127
|
+
this.$bus.emit('showOrderConfirmation', response.data)
|
|
126
128
|
})
|
|
127
129
|
.catch((error) => {
|
|
128
130
|
this.isLoading = false
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
<div class="cart-top"></div>
|
|
7
7
|
<b-tabs v-if="!showOrderConfirmation" v-model="activeStep" @click="tabClick" type="is-toggle" expanded>
|
|
8
8
|
<b-tab-item>
|
|
9
|
-
<template
|
|
9
|
+
<template #header>
|
|
10
10
|
<span class="cart-tab-label"><i class="fad fa-check"></i> {{ $t('cart.cart') }}</span>
|
|
11
11
|
<i class="fas fa-chevron-right cart-tab-chevron"></i>
|
|
12
12
|
</template>
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
</b-tab-item>
|
|
17
17
|
|
|
18
18
|
<b-tab-item :disabled="stepsDisabled[1]">
|
|
19
|
-
<template
|
|
19
|
+
<template #header>
|
|
20
20
|
<span class="cart-tab-label"><i class="fad fa-check"></i> {{ $t('cart.pickupDelivery') }} </span>
|
|
21
21
|
<i class="fas fa-chevron-right cart-tab-chevron"></i>
|
|
22
22
|
</template>
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
</b-tab-item>
|
|
31
31
|
|
|
32
32
|
<b-tab-item :disabled="stepsDisabled[2]">
|
|
33
|
-
<template
|
|
33
|
+
<template #header>
|
|
34
34
|
<span class="cart-tab-label"><i class="fad fa-check"></i> {{ $t('cart.payment') }}</span>
|
|
35
35
|
<i class="fas fa-chevron-right cart-tab-chevron"></i>
|
|
36
36
|
</template>
|
|
@@ -58,7 +58,7 @@
|
|
|
58
58
|
import { mapState, mapMutations, mapActions, mapGetters } from 'vuex'
|
|
59
59
|
import _ from 'underscore'
|
|
60
60
|
|
|
61
|
-
import GoogleAnalyticsEEC from '../../utils/google-analytics-eec.js'
|
|
61
|
+
import GoogleAnalyticsEEC from '../../utils/google/google-analytics-eec.js'
|
|
62
62
|
|
|
63
63
|
import CartPreview from './CartPreview'
|
|
64
64
|
import Payment from './Payment/Payment'
|
|
@@ -160,35 +160,38 @@ export default {
|
|
|
160
160
|
return
|
|
161
161
|
},
|
|
162
162
|
|
|
163
|
-
|
|
164
|
-
this.$
|
|
165
|
-
|
|
166
|
-
|
|
163
|
+
onUpdateCart(cartData) {
|
|
164
|
+
this.$store.commit('setCart', cartData)
|
|
165
|
+
},
|
|
166
|
+
|
|
167
|
+
onNextStep() {
|
|
168
|
+
this.setActiveStep(this.activeStep + 1, this.initialState.site_name)
|
|
169
|
+
if (this.$mq === 'mobile') {
|
|
170
|
+
this.scrollTop()
|
|
171
|
+
}
|
|
172
|
+
},
|
|
167
173
|
|
|
168
|
-
|
|
174
|
+
onSetStep(step) {
|
|
175
|
+
this.setActiveStep(step, this.initialState.site_name)
|
|
176
|
+
if (this.$mq === 'mobile') {
|
|
169
177
|
this.scrollTop()
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
window.addEventListener('popstate',
|
|
187
|
-
console.log('popstate ', this.activeStep)
|
|
188
|
-
if (this.activeStep > 0) {
|
|
189
|
-
this.setActiveStep(this.activeStep - 1, this.initialState.site_name)
|
|
190
|
-
}
|
|
191
|
-
})
|
|
178
|
+
}
|
|
179
|
+
},
|
|
180
|
+
|
|
181
|
+
onPopState() {
|
|
182
|
+
console.log('popstate ', this.activeStep)
|
|
183
|
+
if (this.activeStep > 0) {
|
|
184
|
+
this.setActiveStep(this.activeStep - 1, this.initialState.site_name)
|
|
185
|
+
}
|
|
186
|
+
},
|
|
187
|
+
|
|
188
|
+
processEvents() {
|
|
189
|
+
this.$bus.on('updateCart', this.onUpdateCart)
|
|
190
|
+
this.$bus.on('scrollTop', this.scrollTop)
|
|
191
|
+
this.$bus.on('nextStep', this.onNextStep)
|
|
192
|
+
this.$bus.on('setStep', this.onSetStep)
|
|
193
|
+
|
|
194
|
+
window.addEventListener('popstate', this.onPopState)
|
|
192
195
|
}
|
|
193
196
|
},
|
|
194
197
|
|
|
@@ -203,6 +206,14 @@ export default {
|
|
|
203
206
|
e.returnValue = ''
|
|
204
207
|
})*/
|
|
205
208
|
//console.log(this.initialState)
|
|
209
|
+
},
|
|
210
|
+
|
|
211
|
+
beforeUnmount() {
|
|
212
|
+
this.$bus.off('updateCart', this.onUpdateCart)
|
|
213
|
+
this.$bus.off('scrollTop', this.scrollTop)
|
|
214
|
+
this.$bus.off('nextStep', this.onNextStep)
|
|
215
|
+
this.$bus.off('setStep', this.onSetStep)
|
|
216
|
+
window.removeEventListener('popstate', this.onPopState)
|
|
206
217
|
}
|
|
207
218
|
}
|
|
208
219
|
</script>
|
|
@@ -26,7 +26,8 @@ export default {
|
|
|
26
26
|
|
|
27
27
|
cartStructureEEC: (state) => {
|
|
28
28
|
let cartStructureEEC = []
|
|
29
|
-
state.cart.items
|
|
29
|
+
let items = state.cart.items || []
|
|
30
|
+
items.forEach((item) => {
|
|
30
31
|
cartStructureEEC.push({
|
|
31
32
|
item_id: item.id,
|
|
32
33
|
item_name: item.name,
|
|
@@ -3,9 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
import _ from 'underscore'
|
|
5
5
|
import shortid from 'shortid'
|
|
6
|
-
import GoogleAnalyticsEEC from '../../../utils/google-analytics-eec'
|
|
6
|
+
import GoogleAnalyticsEEC from '../../../utils/google/google-analytics-eec'
|
|
7
7
|
import { addressSchema } from '../../Address/address.schema'
|
|
8
8
|
import { Address } from '../../../api'
|
|
9
|
+
import { nextTick } from 'vue'
|
|
9
10
|
|
|
10
11
|
export default {
|
|
11
12
|
setGuestMode(state, guestMode) {
|
|
@@ -27,16 +28,17 @@ export default {
|
|
|
27
28
|
state.activeStep = intStep
|
|
28
29
|
history.pushState(null, siteName + ' Cart', '?step=' + _.invert(state.steps)[intStep])
|
|
29
30
|
|
|
30
|
-
|
|
31
|
+
// `this` is the store in a mutation
|
|
32
|
+
GoogleAnalyticsEEC.checkoutStep(_.invert(state.steps)[intStep], this.getters.cartStructureEEC)
|
|
31
33
|
|
|
32
34
|
state.stepKey[state.activeStep]++
|
|
33
35
|
state.stepChangeIncrement++
|
|
34
36
|
|
|
35
|
-
|
|
37
|
+
nextTick(function () {
|
|
36
38
|
let tabs = document.querySelectorAll('.tabs li')
|
|
37
39
|
for (let i = 0; i < tabs.length; i++) {
|
|
38
|
-
if (i <
|
|
39
|
-
//console.log(i, '<',
|
|
40
|
+
if (i < intStep) {
|
|
41
|
+
//console.log(i, '<', intStep)
|
|
40
42
|
if (!tabs[i].classList.contains('step-completed')) {
|
|
41
43
|
//console.log('set ', tabs[i], ' to step-completed')
|
|
42
44
|
tabs[i].classList.add('step-completed')
|