@wikala/spmkt 2.31.1 → 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/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
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
v-digitsonly
|
|
22
22
|
/>
|
|
23
23
|
</div>
|
|
24
|
-
<b-slider
|
|
24
|
+
<b-slider v-model="rangeInputValue" :min="min" :max="max" :step="step" @change="sliderInput" rounded />
|
|
25
25
|
<button v-if="showApplyButton" class="button is-small" @click="applyRange">{{ $t('global.applyRange') }}</button>
|
|
26
26
|
</div>
|
|
27
27
|
</template>
|
|
@@ -29,8 +29,10 @@
|
|
|
29
29
|
<script>
|
|
30
30
|
export default {
|
|
31
31
|
name: 'RangeInput',
|
|
32
|
+
|
|
33
|
+
// Vue 3: modelValue instead of value for v-model
|
|
32
34
|
props: {
|
|
33
|
-
|
|
35
|
+
modelValue: {
|
|
34
36
|
type: Array,
|
|
35
37
|
default: function () {
|
|
36
38
|
return ['', '']
|
|
@@ -55,6 +57,9 @@ export default {
|
|
|
55
57
|
}
|
|
56
58
|
},
|
|
57
59
|
|
|
60
|
+
// Vue 3: Declare emitted events
|
|
61
|
+
emits: ['update:modelValue', 'applyRange'],
|
|
62
|
+
|
|
58
63
|
data() {
|
|
59
64
|
return {
|
|
60
65
|
rangeInputValue: ['', '']
|
|
@@ -102,13 +107,15 @@ export default {
|
|
|
102
107
|
|
|
103
108
|
//console.log('emitting range text input', selectedIndex, val)
|
|
104
109
|
this.rangeInputValue = tSelected
|
|
105
|
-
|
|
110
|
+
// Vue 3: emit update:modelValue
|
|
111
|
+
this.$emit('update:modelValue', tSelected)
|
|
106
112
|
},
|
|
107
113
|
|
|
108
114
|
sliderInput(val) {
|
|
109
|
-
//console.log('RangeInput sliderInput', val, this.
|
|
115
|
+
//console.log('RangeInput sliderInput', val, this.modelValue)
|
|
110
116
|
this.rangeInputValue = val
|
|
111
|
-
|
|
117
|
+
// Vue 3: emit update:modelValue
|
|
118
|
+
this.$emit('update:modelValue', val)
|
|
112
119
|
},
|
|
113
120
|
|
|
114
121
|
applyRange() {
|
|
@@ -123,10 +130,10 @@ export default {
|
|
|
123
130
|
},
|
|
124
131
|
|
|
125
132
|
mounted() {
|
|
126
|
-
if (this.
|
|
127
|
-
this.rangeInputValue = [this.
|
|
133
|
+
if (this.modelValue.length === 2) {
|
|
134
|
+
this.rangeInputValue = [this.modelValue[0], this.modelValue[1]]
|
|
128
135
|
}
|
|
129
|
-
//console.log('riv', this.rangeInputValue, this.
|
|
136
|
+
//console.log('riv', this.rangeInputValue, this.modelValue)
|
|
130
137
|
}
|
|
131
138
|
}
|
|
132
139
|
</script>
|
package/components/Recaptcha.vue
CHANGED
|
@@ -6,6 +6,11 @@
|
|
|
6
6
|
export default {
|
|
7
7
|
name: 'Recaptcha',
|
|
8
8
|
props: {
|
|
9
|
+
modelValue: {
|
|
10
|
+
type: String,
|
|
11
|
+
required: false,
|
|
12
|
+
default: ''
|
|
13
|
+
},
|
|
9
14
|
action: {
|
|
10
15
|
type: String,
|
|
11
16
|
required: false,
|
|
@@ -33,6 +38,8 @@ export default {
|
|
|
33
38
|
}
|
|
34
39
|
},
|
|
35
40
|
|
|
41
|
+
emits: ['update:modelValue'],
|
|
42
|
+
|
|
36
43
|
data() {
|
|
37
44
|
return {
|
|
38
45
|
captchaId: null
|
|
@@ -86,7 +93,7 @@ export default {
|
|
|
86
93
|
recaptchaExecute() {
|
|
87
94
|
try {
|
|
88
95
|
window.grecaptcha.execute(this.siteKey, { action: this.action }).then(token => {
|
|
89
|
-
this.$emit('
|
|
96
|
+
this.$emit('update:modelValue', token)
|
|
90
97
|
})
|
|
91
98
|
} catch (e) {
|
|
92
99
|
console.log('RecaptchaError: ', e.toString())
|
|
@@ -13,10 +13,10 @@
|
|
|
13
13
|
:keep-first="true"
|
|
14
14
|
:open-on-focus="true"
|
|
15
15
|
:data="filteredCountry"
|
|
16
|
-
@typing="() => (
|
|
16
|
+
@typing="() => (error = false)"
|
|
17
17
|
@select="onSelectCountry($event)"
|
|
18
18
|
>
|
|
19
|
-
<template
|
|
19
|
+
<template #empty>No results found</template>
|
|
20
20
|
</b-autocomplete>
|
|
21
21
|
</b-field>
|
|
22
22
|
<div style="margin-top: 1.5rem">
|
|
@@ -25,72 +25,91 @@
|
|
|
25
25
|
</div>
|
|
26
26
|
</template>
|
|
27
27
|
|
|
28
|
-
<script>
|
|
28
|
+
<script setup>
|
|
29
|
+
import { ref, computed, onMounted } from 'vue'
|
|
30
|
+
import { useBuefy } from '../composables/globals'
|
|
29
31
|
import config from '../config'
|
|
30
|
-
import { request, Countries}
|
|
32
|
+
import { request, Countries } from '../api'
|
|
31
33
|
|
|
32
|
-
|
|
33
|
-
name: 'SelectShippingCountry',
|
|
34
|
+
const buefy = useBuefy()
|
|
34
35
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return
|
|
51
|
-
.
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
36
|
+
const countries = ref([])
|
|
37
|
+
const selectedCountryLabel = ref('')
|
|
38
|
+
const selected = ref(null)
|
|
39
|
+
const error = ref(false)
|
|
40
|
+
const container = ref(null)
|
|
41
|
+
|
|
42
|
+
const filteredCountry = computed(() => {
|
|
43
|
+
if (!Array.isArray(countries.value)) {
|
|
44
|
+
return []
|
|
45
|
+
}
|
|
46
|
+
if (!selectedCountryLabel.value) {
|
|
47
|
+
return countries.value
|
|
48
|
+
}
|
|
49
|
+
return countries.value
|
|
50
|
+
.filter((option) => {
|
|
51
|
+
return option.name
|
|
52
|
+
.toString()
|
|
53
|
+
.toLowerCase()
|
|
54
|
+
.indexOf(selectedCountryLabel.value.toLowerCase()) >= 0
|
|
55
|
+
})
|
|
56
|
+
.slice(0, 5)
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
// Methods
|
|
60
|
+
const onSelectCountry = (selectedCountry) => {
|
|
61
|
+
if(!selectedCountry) return
|
|
62
|
+
error.value = false
|
|
63
|
+
selected.value = selectedCountry
|
|
64
|
+
selectedCountryLabel.value = selectedCountry.name
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
const changeCountry = () => {
|
|
68
|
+
if (!selectedCountryLabel.value) {
|
|
69
|
+
error.value = true
|
|
70
|
+
} else {
|
|
71
|
+
error.value = false
|
|
72
|
+
request({
|
|
73
|
+
baseURL: config.BASE_URL,
|
|
74
|
+
url: '/country/' + selected.value.iso,
|
|
75
|
+
method: 'post',
|
|
76
|
+
data: {}
|
|
77
|
+
}).then((response) => {
|
|
78
|
+
if (response.data.status === 'redirect') {
|
|
79
|
+
window.location.href = response.data.url
|
|
62
80
|
} else {
|
|
63
|
-
|
|
64
|
-
//_post('/country/'+this.selected.iso, {}, () => window.location.reload())
|
|
65
|
-
request({
|
|
66
|
-
baseURL: config.BASE_URL,
|
|
67
|
-
url: '/country/' + this.selected.iso,
|
|
68
|
-
method: 'post',
|
|
69
|
-
data: {}
|
|
70
|
-
}).then((response) => {
|
|
71
|
-
if (response.data.status === 'redirect') {
|
|
72
|
-
window.location.href = response.data.url
|
|
73
|
-
} else {
|
|
74
|
-
window.location.reload()
|
|
75
|
-
}
|
|
76
|
-
})
|
|
81
|
+
window.location.reload()
|
|
77
82
|
}
|
|
78
|
-
},
|
|
79
|
-
onSelectCountry(selected) {
|
|
80
|
-
this.error = false
|
|
81
|
-
//console.log('selected', selected)
|
|
82
|
-
this.selected = selected
|
|
83
|
-
this.selectedCountryLabel = selected.name
|
|
84
|
-
}
|
|
85
|
-
},
|
|
86
|
-
|
|
87
|
-
async mounted() {
|
|
88
|
-
const loading = this.$buefy.loading.open({
|
|
89
|
-
container: this.$refs.container
|
|
90
83
|
})
|
|
91
|
-
let countries = await Countries.get()
|
|
92
|
-
loading.close()
|
|
93
|
-
this.countries = countries.data
|
|
94
84
|
}
|
|
95
85
|
}
|
|
86
|
+
|
|
87
|
+
// Lifecycle
|
|
88
|
+
onMounted(async () => {
|
|
89
|
+
let loading = null
|
|
90
|
+
if (buefy && buefy.loading) {
|
|
91
|
+
loading = buefy.loading.open({
|
|
92
|
+
container: container.value
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
try {
|
|
96
|
+
const response = await Countries.get()
|
|
97
|
+
if (response && response.data) {
|
|
98
|
+
countries.value = response.data.data
|
|
99
|
+
}
|
|
100
|
+
console.log('Countries loaded:', countries.value)
|
|
101
|
+
} catch (err) {
|
|
102
|
+
console.error('Failed to load countries:', err)
|
|
103
|
+
// Provide fallback data in Storybook/error scenarios
|
|
104
|
+
countries.value = [
|
|
105
|
+
{ id: 'CA', iso: 'CA', name: 'Canada' },
|
|
106
|
+
{ id: 'US', iso: 'US', name: 'United States' },
|
|
107
|
+
{ id: 'MX', iso: 'MX', name: 'Mexico' },
|
|
108
|
+
]
|
|
109
|
+
} finally {
|
|
110
|
+
if (loading) {
|
|
111
|
+
loading.close()
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
})
|
|
96
115
|
</script>
|
|
@@ -9,91 +9,76 @@
|
|
|
9
9
|
</div>
|
|
10
10
|
</template>
|
|
11
11
|
|
|
12
|
-
<script>
|
|
12
|
+
<script setup>
|
|
13
|
+
import { ref, computed, onMounted } from 'vue'
|
|
14
|
+
import { useT } from '../composables/globals'
|
|
13
15
|
import Cookie from 'js-cookie'
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
props: {
|
|
19
|
-
url: {
|
|
20
|
-
type: String
|
|
21
|
-
},
|
|
22
|
-
linkText: {
|
|
23
|
-
type: String
|
|
24
|
-
},
|
|
25
|
-
duration: {
|
|
26
|
-
type: Number,
|
|
27
|
-
default: 7200
|
|
28
|
-
}
|
|
17
|
+
const props = defineProps({
|
|
18
|
+
url: {
|
|
19
|
+
type: String
|
|
29
20
|
},
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
return {
|
|
33
|
-
cookieName: '__timed_offer',
|
|
34
|
-
offerInitialTime: 0,
|
|
35
|
-
expireTime: 0,
|
|
36
|
-
durationTime: 0
|
|
37
|
-
}
|
|
21
|
+
linkText: {
|
|
22
|
+
type: String
|
|
38
23
|
},
|
|
24
|
+
duration: {
|
|
25
|
+
type: Number,
|
|
26
|
+
default: 7200
|
|
27
|
+
}
|
|
28
|
+
})
|
|
39
29
|
|
|
40
|
-
|
|
41
|
-
offerActive() {
|
|
42
|
-
//console.log('oa', this.durationTime, this.duration, this.duration-this.durationTime)
|
|
43
|
-
if (this.durationTime <= this.duration) {
|
|
44
|
-
return true
|
|
45
|
-
} else {
|
|
46
|
-
return false
|
|
47
|
-
}
|
|
48
|
-
},
|
|
30
|
+
const { t } = useT()
|
|
49
31
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
},
|
|
32
|
+
const cookieName = ref('__timed_offer')
|
|
33
|
+
const offerInitialTime = ref(0)
|
|
34
|
+
const durationTime = ref(0)
|
|
54
35
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
let days = Math.floor((seconds % 31536000) / 86400)
|
|
59
|
-
let hours = Math.floor(((seconds % 31536000) % 86400) / 3600)
|
|
60
|
-
let minutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60)
|
|
61
|
-
let nseconds = (((seconds % 31536000) % 86400) % 3600) % 60
|
|
36
|
+
const offerActive = computed(() => {
|
|
37
|
+
return durationTime.value <= props.duration
|
|
38
|
+
})
|
|
62
39
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
}
|
|
67
|
-
if (hours > 0) {
|
|
68
|
-
ret = hours + ' ' + this.$t('global.hours') + ' ' + ret
|
|
69
|
-
}
|
|
70
|
-
if (days > 0) {
|
|
71
|
-
ret = days + ' ' + this.$t('global.days') + ' ' + ret
|
|
72
|
-
}
|
|
73
|
-
if (years > 0) {
|
|
74
|
-
ret = years + ' ' + this.$t('global.years') + ' ' + ret
|
|
75
|
-
}
|
|
76
|
-
return ret
|
|
77
|
-
}
|
|
78
|
-
},
|
|
40
|
+
const expireTimeHR = computed(() => {
|
|
41
|
+
return secondsToString(props.duration - durationTime.value)
|
|
42
|
+
})
|
|
79
43
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
44
|
+
function secondsToString(seconds) {
|
|
45
|
+
let years = Math.floor(seconds / 31536000)
|
|
46
|
+
let days = Math.floor((seconds % 31536000) / 86400)
|
|
47
|
+
let hours = Math.floor(((seconds % 31536000) % 86400) / 3600)
|
|
48
|
+
let minutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60)
|
|
49
|
+
let nseconds = (((seconds % 31536000) % 86400) % 3600) % 60
|
|
50
|
+
|
|
51
|
+
let ret = nseconds + ' ' + t('global.seconds')
|
|
52
|
+
if (minutes > 0) {
|
|
53
|
+
ret = minutes + ' ' + t('global.minutes') + ' ' + ret
|
|
54
|
+
}
|
|
55
|
+
if (hours > 0) {
|
|
56
|
+
ret = hours + ' ' + t('global.hours') + ' ' + ret
|
|
57
|
+
}
|
|
58
|
+
if (days > 0) {
|
|
59
|
+
ret = days + ' ' + t('global.days') + ' ' + ret
|
|
95
60
|
}
|
|
61
|
+
if (years > 0) {
|
|
62
|
+
ret = years + ' ' + t('global.years') + ' ' + ret
|
|
63
|
+
}
|
|
64
|
+
return ret
|
|
96
65
|
}
|
|
66
|
+
|
|
67
|
+
onMounted(() => {
|
|
68
|
+
offerInitialTime.value = Cookie.get(cookieName.value)
|
|
69
|
+
if (!offerInitialTime.value) {
|
|
70
|
+
offerInitialTime.value = new Date().getTime()
|
|
71
|
+
Cookie.set(cookieName.value, offerInitialTime.value, { expires: 7 })
|
|
72
|
+
} else {
|
|
73
|
+
durationTime.value = Math.floor((new Date().getTime() - offerInitialTime.value) / 1000)
|
|
74
|
+
}
|
|
75
|
+
let toInterval = setInterval(() => {
|
|
76
|
+
durationTime.value = Math.floor((new Date().getTime() - offerInitialTime.value) / 1000)
|
|
77
|
+
if (durationTime.value > props.duration) {
|
|
78
|
+
clearInterval(toInterval)
|
|
79
|
+
}
|
|
80
|
+
}, 1000)
|
|
81
|
+
})
|
|
97
82
|
</script>
|
|
98
83
|
|
|
99
84
|
<style scoped></style>
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Access to the app-level services spmkt components rely on.
|
|
3
|
+
*
|
|
4
|
+
* The consuming app provides these as global properties (see install.js):
|
|
5
|
+
* $t / $tc translation functions (e.g. vue-i18n with globalInjection)
|
|
6
|
+
* initialState server-rendered page state (window.wkl_initial_state)
|
|
7
|
+
* $LC locale config ({ country_iso, currencySymbol, ... })
|
|
8
|
+
* $mq current breakpoint: 'mobile' | 'tablet' | 'desktop' (string or ref)
|
|
9
|
+
* installSpmkt itself provides $buefy (via Buefy) and the event bus.
|
|
10
|
+
*
|
|
11
|
+
* Use these inside setup() instead of inject('$x') or
|
|
12
|
+
* getCurrentInstance().appContext.config.globalProperties.$x.
|
|
13
|
+
*/
|
|
14
|
+
import { computed, getCurrentInstance, unref } from 'vue'
|
|
15
|
+
import { eventBus } from '../utils/event-bus'
|
|
16
|
+
|
|
17
|
+
function globals() {
|
|
18
|
+
const instance = getCurrentInstance()
|
|
19
|
+
if (!instance) {
|
|
20
|
+
throw new Error('[spmkt] composables from composables/globals must be called inside setup()')
|
|
21
|
+
}
|
|
22
|
+
return instance.appContext.config.globalProperties
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function useBus() {
|
|
26
|
+
return eventBus
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
export function useT() {
|
|
30
|
+
const g = globals()
|
|
31
|
+
// Resolved on each call so a host that installs i18n after mounting still works
|
|
32
|
+
const t = (...args) => (g.$t ? g.$t(...args) : args[0])
|
|
33
|
+
const tc = (...args) => (g.$tc ? g.$tc(...args) : t(...args))
|
|
34
|
+
return { t, tc }
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export function useBuefy() {
|
|
38
|
+
return globals().$buefy
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export function useInitialState() {
|
|
42
|
+
return globals().initialState || {}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
export function useLocale() {
|
|
46
|
+
const g = globals()
|
|
47
|
+
return g.$LC || g.initialState?.lc || {}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export function useMq() {
|
|
51
|
+
const g = globals()
|
|
52
|
+
return computed(() => unref(g.$mq) || 'desktop')
|
|
53
|
+
}
|
package/config.js
CHANGED
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
const is_production = process.env.NODE_ENV === 'production'
|
|
2
2
|
const INITIAL_STATE = window.wkl_initial_state
|
|
3
3
|
|
|
4
|
+
// Treat Storybook as a local environment so MSW can intercept relative requests
|
|
5
|
+
const is_storybook = typeof window !== 'undefined' && window.location.port === '6006'
|
|
6
|
+
|
|
4
7
|
let baseURL = ''
|
|
5
8
|
if (window) {
|
|
6
9
|
baseURL = window.location.protocol + '//' + window.location.host
|
|
7
10
|
}
|
|
8
11
|
|
|
9
|
-
const BASE_URL = is_production ? baseURL : 'https://camazon.test/'
|
|
10
|
-
const API_URL = is_production ? baseURL + '/api' : 'https://camazon.test/api'
|
|
12
|
+
const BASE_URL = is_storybook ? '' : is_production ? baseURL : 'https://camazon.test/'
|
|
13
|
+
const API_URL = is_storybook ? '/api' : is_production ? baseURL + '/api' : 'https://camazon.test/api'
|
|
11
14
|
const REQUEST_TIMEOUT = 30000
|
|
12
15
|
|
|
13
16
|
export default {
|
package/index.js
CHANGED
|
@@ -1,5 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @wikala/spmkt - Vue 3 Ecommerce Components Library
|
|
3
|
+
*
|
|
4
|
+
* Migration from Vue 2 to Vue 3:
|
|
5
|
+
* - Vue.prototype.$bus replaced with mitt event bus
|
|
6
|
+
* - Vue.filter() replaced with $filters global property
|
|
7
|
+
* - Vue.extend() replaced with createApp/h pattern
|
|
8
|
+
* - Vuex 3 replaced with Vuex 4
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import { request } from './api'
|
|
2
12
|
|
|
13
|
+
// Vue 3 installation plugin
|
|
14
|
+
import { installSpmkt } from './install'
|
|
15
|
+
|
|
16
|
+
// Event bus utility
|
|
17
|
+
import { eventBus, EventBusPlugin } from './utils/event-bus'
|
|
18
|
+
|
|
19
|
+
// Filters utility
|
|
20
|
+
import { filters, formatMoney, formatNumber, round, hidecc, date, nl2p } from './utils/filters'
|
|
21
|
+
|
|
3
22
|
import Address from './components/Address/Address' //t
|
|
4
23
|
import AddressBook from './components/Address/AddressBook' //t
|
|
5
24
|
import AddressSelect from './components/Address/AddressSelect' //t
|
|
@@ -23,15 +42,13 @@ import SelectShippingCountry from './components/SelectShippingCountry'
|
|
|
23
42
|
import TimedOffer from './components/TimedOffer' //t
|
|
24
43
|
|
|
25
44
|
import AccountDashboard from './components/Account/AccountDashboard' //t
|
|
26
|
-
import AccountSettings from './components/Account/AccountSettings' //t
|
|
45
|
+
import AccountSettings from './components/Account/Settings/AccountSettings' //t
|
|
27
46
|
import AccountStore from './components/Account/AccountStore'
|
|
28
|
-
import ChangeEmail from './components/Account/ChangeEmail' //t
|
|
29
|
-
import ChangeName from './components/Account/ChangeName' //t
|
|
30
|
-
import ChangePassword from './components/Account/ChangePassword' //t
|
|
31
|
-
import
|
|
32
|
-
import
|
|
33
|
-
import Orders from './components/Account/Orders' //t
|
|
34
|
-
import Settings from './components/Account/Settings'
|
|
47
|
+
import ChangeEmail from './components/Account/Settings/ChangeEmail' //t
|
|
48
|
+
import ChangeName from './components/Account/Settings/ChangeName' //t
|
|
49
|
+
import ChangePassword from './components/Account/Settings/ChangePassword' //t
|
|
50
|
+
import OrderDetail from './components/Account/Orders/OrderDetail' //t
|
|
51
|
+
import Orders from './components/Account/Orders/Orders' //t
|
|
35
52
|
|
|
36
53
|
import Login from './components/Auth/Login' //t
|
|
37
54
|
import Register from './components/Auth/Register' //t
|
|
@@ -75,6 +92,22 @@ import ReviewImages from './components/Product/reviews-questions/ReviewImages'
|
|
|
75
92
|
import Vote from './components/Product/reviews-questions/Vote'
|
|
76
93
|
|
|
77
94
|
export {
|
|
95
|
+
// Vue 3 plugin installer
|
|
96
|
+
installSpmkt,
|
|
97
|
+
|
|
98
|
+
// Event bus for Vue 3
|
|
99
|
+
eventBus,
|
|
100
|
+
EventBusPlugin,
|
|
101
|
+
|
|
102
|
+
// Filter functions (use directly or via $filters)
|
|
103
|
+
filters,
|
|
104
|
+
formatMoney,
|
|
105
|
+
formatNumber,
|
|
106
|
+
round,
|
|
107
|
+
hidecc,
|
|
108
|
+
date,
|
|
109
|
+
nl2p,
|
|
110
|
+
|
|
78
111
|
request,
|
|
79
112
|
Address,
|
|
80
113
|
EditAddress,
|
|
@@ -104,10 +137,8 @@ export {
|
|
|
104
137
|
ChangeEmail,
|
|
105
138
|
ChangeName,
|
|
106
139
|
ChangePassword,
|
|
107
|
-
CreditCards,
|
|
108
140
|
OrderDetail,
|
|
109
141
|
Orders,
|
|
110
|
-
Settings,
|
|
111
142
|
|
|
112
143
|
Login,
|
|
113
144
|
Register,
|
package/install.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vue 3 Installation Helper
|
|
3
|
+
*
|
|
4
|
+
* This file provides a plugin that configures all the necessary
|
|
5
|
+
* Vue 3 integrations for the @wikala/spmkt library.
|
|
6
|
+
*
|
|
7
|
+
* Usage in consuming application:
|
|
8
|
+
*
|
|
9
|
+
* ```javascript
|
|
10
|
+
* import { createApp } from 'vue'
|
|
11
|
+
* import { createStore } from 'vuex'
|
|
12
|
+
* import App from './App.vue'
|
|
13
|
+
* import { installSpmkt, CartStore } from '@wikala/spmkt'
|
|
14
|
+
*
|
|
15
|
+
* const app = createApp(App)
|
|
16
|
+
*
|
|
17
|
+
* // One root store per page: CartStore on the cart page, AccountStore on
|
|
18
|
+
* // the account page. Components read it at the root (mapState(['cart'])),
|
|
19
|
+
* // so don't nest these as modules of a combined store.
|
|
20
|
+
* app.use(createStore(CartStore))
|
|
21
|
+
* app.use(installSpmkt)
|
|
22
|
+
* app.mount('#app')
|
|
23
|
+
* ```
|
|
24
|
+
*
|
|
25
|
+
* The consuming app also provides these global properties
|
|
26
|
+
* (read by components through composables/globals.js):
|
|
27
|
+
* $t / $tc translations (e.g. vue-i18n with globalInjection)
|
|
28
|
+
* initialState the page's window.wkl_initial_state object
|
|
29
|
+
* $LC locale config ({ country_iso, currencySymbol, ... }),
|
|
30
|
+
* falls back to initialState.lc
|
|
31
|
+
* $mq 'mobile' | 'tablet' | 'desktop' as a string; for a reactive
|
|
32
|
+
* value use a getter returning ref.value (Options API
|
|
33
|
+
* components compare this.$mq directly)
|
|
34
|
+
*
|
|
35
|
+
* The Cart components also call these host helpers (globally mixed in or
|
|
36
|
+
* set as global properties) and use two host directives:
|
|
37
|
+
* getConfig(key), scrollToElement(selector), logMessage(message),
|
|
38
|
+
* getRecaptchaToken(), openModal(name, params), closeModal(),
|
|
39
|
+
* ageVerificationEnabled(), isMobileiOS
|
|
40
|
+
* v-sticky, v-mask
|
|
41
|
+
* See .storybook/preview.js for minimal stand-ins.
|
|
42
|
+
*/
|
|
43
|
+
|
|
44
|
+
import Buefy from 'buefy'
|
|
45
|
+
|
|
46
|
+
import { EventBusPlugin } from './utils/event-bus'
|
|
47
|
+
import registerDirectives from './utils/directives'
|
|
48
|
+
import registerFilters from './utils/filters'
|
|
49
|
+
import ModalContainerPlugin from './components/ModalContainer'
|
|
50
|
+
|
|
51
|
+
export const installSpmkt = {
|
|
52
|
+
install(app, options = {}) {
|
|
53
|
+
// Install Buefy 3 (Vue 3 compatible version)
|
|
54
|
+
app.use(Buefy, options.buefy)
|
|
55
|
+
|
|
56
|
+
// Install event bus ($bus)
|
|
57
|
+
app.use(EventBusPlugin)
|
|
58
|
+
|
|
59
|
+
// Install Modal Container ($modalContainer)
|
|
60
|
+
app.use(ModalContainerPlugin, options.modalContainer)
|
|
61
|
+
|
|
62
|
+
// Register custom directives
|
|
63
|
+
registerDirectives(app)
|
|
64
|
+
|
|
65
|
+
// Register global filters as $filters
|
|
66
|
+
registerFilters(app)
|
|
67
|
+
|
|
68
|
+
// Store config in global properties if provided
|
|
69
|
+
if (options.config) {
|
|
70
|
+
app.config.globalProperties.$spmktConfig = options.config
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
export default installSpmkt
|
package/locales/en.json
CHANGED
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
"resendConfirmation": "Resend confirmation",
|
|
34
34
|
"savedNotification": "Your account data was updated successfully",
|
|
35
35
|
"settings": "Settings",
|
|
36
|
-
"yourAccount": "Your
|
|
36
|
+
"yourAccount": "Your Account"
|
|
37
37
|
},
|
|
38
38
|
"address": {
|
|
39
39
|
"add": "Add a new address",
|
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"city": "City/Town",
|
|
48
48
|
"country": "Country",
|
|
49
49
|
"findStreetAddress": "Find street address",
|
|
50
|
+
"autocompleteUnavailable": "Address search is unavailable. Please enter the address manually.",
|
|
50
51
|
"firstName": "First Name",
|
|
51
52
|
"isBusiness": "This is a business address",
|
|
52
53
|
"lastName": "Last Name",
|
package/locales/sr.json
CHANGED
|
@@ -47,6 +47,7 @@
|
|
|
47
47
|
"city": "Grad",
|
|
48
48
|
"country": "Država",
|
|
49
49
|
"findStreetAddress": "",
|
|
50
|
+
"autocompleteUnavailable": "Pretraga adresa nije dostupna. Unesite adresu ručno.",
|
|
50
51
|
"firstName": "Ime",
|
|
51
52
|
"isBusiness": "Naručujem kao pravno lice",
|
|
52
53
|
"lastName": "Prezime",
|
|
@@ -176,7 +177,7 @@
|
|
|
176
177
|
"applyRange": "Primeni raspon",
|
|
177
178
|
"cancel": "Odustani",
|
|
178
179
|
"clear": "Očisti",
|
|
179
|
-
"close": "",
|
|
180
|
+
"close": "Zatvori",
|
|
180
181
|
"confirmed": "Potvrđeno",
|
|
181
182
|
"days": "dana",
|
|
182
183
|
"delete": "Obriši",
|