@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.
Files changed (124) hide show
  1. package/MIGRATION_GUIDE.md +261 -0
  2. package/api/product.js +1 -0
  3. package/api/request.js +9 -4
  4. package/api/user.js +1 -1
  5. package/components/Account/AccountDashboard.vue +101 -101
  6. package/components/Account/AccountStore.js +57 -31
  7. package/components/Account/AffiliateReport.vue +56 -60
  8. package/components/Account/{OrderDetail.vue → Orders/OrderDetail.vue} +44 -30
  9. package/components/Account/Orders/Orders.vue +124 -0
  10. package/components/Account/{AccountSettings.vue → Settings/AccountSettings.vue} +4 -4
  11. package/components/Account/Settings/ChangeEmail.vue +136 -0
  12. package/components/Account/Settings/ChangeName.vue +82 -0
  13. package/components/Account/Settings/ChangePassword.vue +91 -0
  14. package/components/Address/Address.vue +38 -57
  15. package/components/Address/AddressBook.vue +77 -57
  16. package/components/Address/AddressSelect.vue +94 -87
  17. package/components/Address/Edit.vue +253 -265
  18. package/components/Address/PostalCode.vue +22 -21
  19. package/components/AgeGate.vue +11 -5
  20. package/components/Auth/Login.vue +62 -44
  21. package/components/Auth/Register.vue +82 -60
  22. package/components/Auth/ResetPassword.vue +45 -30
  23. package/components/Cart/AgeVerification/AgeChecker.vue +3 -3
  24. package/components/Cart/CartBadge.vue +15 -4
  25. package/components/Cart/CartBox.vue +19 -11
  26. package/components/Cart/CartItem.vue +3 -3
  27. package/components/Cart/CartMode.vue +6 -5
  28. package/components/Cart/CartPreview.vue +24 -18
  29. package/components/Cart/Coupon.vue +4 -5
  30. package/components/Cart/CreditCard/Everyware.vue +10 -10
  31. package/components/Cart/CreditCard/ExtendedCreditCard.vue +5 -5
  32. package/components/Cart/CreditCard/SquarePay.vue +18 -16
  33. package/components/Cart/CreditCard/StandardCreditCard.vue +9 -9
  34. package/components/Cart/Delivery/Delivery.vue +16 -12
  35. package/components/Cart/Delivery/DeliveryAddress.vue +1 -1
  36. package/components/Cart/Delivery/DeliveryMethods.vue +1 -1
  37. package/components/Cart/Delivery/DeliveryOptions.vue +15 -9
  38. package/components/Cart/Delivery/DeliveryTypes.vue +8 -5
  39. package/components/Cart/Delivery/ReservationSlots.vue +14 -8
  40. package/components/Cart/Disclaimer.vue +1 -1
  41. package/components/Cart/OrderConfirmation.vue +1 -1
  42. package/components/Cart/Payment/Payment.vue +37 -33
  43. package/components/Cart/Payment/PaymentMethods.vue +6 -4
  44. package/components/Cart/ReviewAndSubmit.vue +9 -7
  45. package/components/Cart/ShoppingCart.vue +42 -31
  46. package/components/Cart/Store/actions.js +1 -1
  47. package/components/Cart/Store/getters.js +2 -1
  48. package/components/Cart/Store/index.js +1 -1
  49. package/components/Cart/Store/mutations.js +7 -5
  50. package/components/Cart/UserIdentity.vue +1 -1
  51. package/components/Category/CategoryFilter.vue +128 -114
  52. package/components/Category/CategorySort.vue +44 -32
  53. package/components/Category/LoadMore.vue +39 -23
  54. package/components/DeliverTo.vue +10 -15
  55. package/components/DeliveryNotice.vue +72 -68
  56. package/components/DobInput.vue +23 -23
  57. package/components/Gmaps/GmapsAutocomplete.vue +139 -78
  58. package/components/Gmaps/GmapsLocations.vue +1 -1
  59. package/components/Gmaps/GmapsSingleLocation.vue +121 -87
  60. package/components/ModalContainer/ModalContainer.vue +12 -9
  61. package/components/ModalContainer/index.js +61 -18
  62. package/components/Product/AddToCart.vue +237 -221
  63. package/components/Product/BoxAddToCart.vue +114 -86
  64. package/components/Product/Compare.vue +68 -48
  65. package/components/Product/CompareBox.vue +128 -123
  66. package/components/Product/Lookup.vue +92 -65
  67. package/components/Product/Photo.vue +105 -66
  68. package/components/Product/Price.vue +64 -43
  69. package/components/Product/ProductAutocomplete.vue +52 -57
  70. package/components/Product/ProductBox.vue +61 -38
  71. package/components/Product/ProductImages.vue +83 -86
  72. package/components/Product/Quantity.vue +115 -53
  73. package/components/Product/QuickView.vue +52 -45
  74. package/components/Product/RelatedProducts.vue +88 -23
  75. package/components/Product/SKU.vue +27 -8
  76. package/components/Product/Variants.vue +335 -341
  77. package/components/Product/reviews-questions/ProductQuestions.vue +226 -198
  78. package/components/Product/reviews-questions/ProductReviews.vue +122 -107
  79. package/components/Product/reviews-questions/Review.vue +54 -59
  80. package/components/Product/reviews-questions/ReviewForm.vue +222 -170
  81. package/components/Product/reviews-questions/ReviewImages.vue +197 -216
  82. package/components/Product/reviews-questions/Vote.vue +83 -57
  83. package/components/QuantityInput.vue +18 -8
  84. package/components/RangeInput.vue +15 -8
  85. package/components/Recaptcha.vue +8 -1
  86. package/components/SelectShippingCountry.vue +81 -62
  87. package/components/TimedOffer.vue +59 -74
  88. package/composables/globals.js +53 -0
  89. package/config.js +5 -2
  90. package/index.js +41 -10
  91. package/install.js +75 -0
  92. package/locales/en.json +2 -1
  93. package/locales/sr.json +2 -1
  94. package/package.json +43 -30
  95. package/utils/directives.js +28 -45
  96. package/utils/event-bus.js +56 -0
  97. package/utils/filters.js +24 -7
  98. package/utils/{gmaps.js → google/gmaps.js} +43 -10
  99. package/utils/{google-analytics-eec.js → google/google-analytics-eec.js} +7 -7
  100. package/babel.config.js +0 -5
  101. package/components/Account/ChangeEmail.vue +0 -133
  102. package/components/Account/ChangeName.vue +0 -92
  103. package/components/Account/ChangePassword.vue +0 -94
  104. package/components/Account/CreditCards.vue +0 -18
  105. package/components/Account/Orders.vue +0 -110
  106. package/components/Account/Settings.vue +0 -18
  107. package/components/Cart/Delivery/DeliveryAddressGuest.spec.js +0 -128
  108. package/components/Cart/Delivery/DeliveryTypes.spec.js +0 -83
  109. package/components/Cart/PCIBadge/SecurityMetrics.vue +0 -11
  110. package/components/Instagram.vue +0 -49
  111. package/components/ProductImageModal.vue +0 -41
  112. package/jest.config.js +0 -16
  113. package/test/e2e/.babelrc.js +0 -8
  114. package/test/e2e/.eslintrc.js +0 -11
  115. package/test/e2e/accAuth.spec.js +0 -64
  116. package/test/e2e/ageGate.spec.js +0 -26
  117. package/test/e2e/checkout.spec.js +0 -106
  118. package/test/e2e/compare.spec.js +0 -52
  119. package/test/e2e/config/data.js +0 -21
  120. package/test/e2e/config/routes.js +0 -11
  121. package/test/e2e/region.spec.js +0 -46
  122. package/test/e2e/search.spec.js +0 -32
  123. package/tests/vueBuefy.js +0 -4
  124. package/tsconfig.json +0 -8
@@ -3,7 +3,7 @@
3
3
  <div v-if="reviews.meta && reviews.meta.total" class="columns filter-sort-c">
4
4
  <div class="column filter-sort">
5
5
  <span>{{ $t('review.lSortBy') }}</span>
6
- <b-select @input="changeSort" :placeholder="$t('review.mostHelpful')" v-model="filterParams.sort" size="is-small">
6
+ <b-select v-model="filterParams.sort" :placeholder="$t('review.mostHelpful')" @update:model-value="changeSort" size="is-small">
7
7
  <option v-for="option in sorting" :value="option.value" :key="option.value">
8
8
  {{ option.name }}
9
9
  </option>
@@ -18,7 +18,7 @@
18
18
  </div>
19
19
  </div>
20
20
  <div class="column include-ratings">
21
- <b-checkbox v-model="filterParams.include_ratings" @input="changeIncludeRatings" size="is-small" true-value="1" false-value="0">{{
21
+ <b-checkbox v-model="filterParams.include_ratings" @update:model-value="changeIncludeRatings" size="is-small" true-value="1" false-value="0">{{
22
22
  $t('review.includeRatings')
23
23
  }}</b-checkbox>
24
24
  </div>
@@ -42,7 +42,7 @@
42
42
  <b-pagination
43
43
  v-if="reviews.meta && reviews.meta.last_page > 1"
44
44
  :total="reviews.meta.total"
45
- :current.sync="reviews.meta.current_page"
45
+ v-model:current="reviews.meta.current_page"
46
46
  :per-page="reviews.meta.per_page"
47
47
  @change="changePage"
48
48
  aria-next-label="Next page"
@@ -53,115 +53,130 @@
53
53
  </div>
54
54
  </template>
55
55
 
56
- <script>
56
+ <script setup>
57
+ import { ref, computed, onMounted, getCurrentInstance } from 'vue'
58
+ import { useBuefy, useMq, useT } from '../../../composables/globals'
57
59
  import { ProductReviews } from '../../../api'
58
- import Review from './Review'
59
-
60
- export default {
61
- name: 'ProductReviews',
62
-
63
- components: { Review },
64
-
65
- data() {
66
- return {
67
- reviews: {},
68
- loading: null,
69
- filterParams: {
70
- thumb_size: this.$mq === 'mobile' ? '100x100' : '200x200',
71
- per_page: 20,
72
- page: 1,
73
- sort: 'newest',
74
- rating: null,
75
- include_ratings: null
76
- },
77
- errorLoading: ''
78
- }
79
- },
80
-
81
- computed: {
82
- noReviewsText() {
83
- if (this.errorLoading) {
84
- console.log('errorloading', this.errorLoading)
85
- return this.errorLoading
86
- }
87
- if (this.filterParams.rating) {
88
- return this.$t('review.noReviewsRating', [this.filterParams.rating])
89
- } else {
90
- return this.$t('review.noReviews')
91
- }
92
- },
93
- sorting() {
94
- return [
95
- { value: 'newest', name: this.$t('review.sortBy.newest') },
96
- { value: 'oldest', name: this.$t('review.sortBy.oldest') },
97
- { value: 'rating-low', name: this.$t('review.sortBy.ratingLow') },
98
- { value: 'rating-high', name: this.$t('review.sortBy.ratingHigh') },
99
- { value: 'most-helpful', name: this.$t('review.sortBy.mostHelpful') }
100
- ]
101
- }
102
- },
103
-
104
- methods: {
105
- async getReviews() {
106
- this.loading = this.$buefy.loading.open({
107
- container: this.$refs.reviewsList
108
- })
109
- this.errorLoading = ''
110
- try {
111
- let response = await ProductReviews.getList(window.wkl_product.id, this.filterParams)
112
- this.$set(this, 'reviews', response.data)
113
- } catch (e) {
114
- this.errorLoading = this.$t('review.errorLoading', [e.message])
115
- console.log('Cannot load reviews', e.message, this.errorLoading)
116
- } finally {
117
- this.loading.close()
118
- }
119
- },
120
-
121
- changeSort() {
122
- this.getReviews()
123
- },
124
-
125
- changeIncludeRatings() {
126
- this.getReviews()
127
- },
128
-
129
- async changePage(page) {
130
- this.filterParams.page = page
131
- await this.getReviews(this.filterParams)
132
- this.$bus.$emit('addToCumulativeData', this.reviews.data, this.reviews.meta.current_page)
133
- document.querySelector('.reviews-questions-tab').scrollIntoView({ behavior: 'smooth' })
134
- },
135
-
136
- showAll() {
137
- document.querySelectorAll('.star-count').forEach((item) => {
138
- if (!item.classList.contains('has-text-info')) {
139
- item.classList.add('has-text-info')
140
- }
141
- })
142
- this.filterParams.rating = null
143
- this.getReviews()
144
- },
145
-
146
- viewImage($event) {
147
- console.log('ProductReviews.viewimage ', $event)
60
+ import { eventBus } from '../../../utils/event-bus'
61
+ import Review from './Review.vue'
62
+
63
+ // Props
64
+ const props = defineProps({
65
+ productId: {
66
+ type: [Number, String],
67
+ default: null
68
+ }
69
+ })
70
+
71
+ // For the host root's openReviewForm()
72
+ const instance = getCurrentInstance()
73
+ const { t: $t } = useT()
74
+ const mq = useMq()
75
+ const $buefy = useBuefy()
76
+
77
+ // Refs
78
+ const reviewsList = ref(null)
79
+ const reviews = ref({})
80
+ const loading = ref(null)
81
+ const errorLoading = ref('')
82
+ const filterParams = ref({
83
+ thumb_size: mq.value === 'mobile' ? '100x100' : '200x200',
84
+ per_page: 20,
85
+ page: 1,
86
+ sort: 'newest',
87
+ rating: null,
88
+ include_ratings: null
89
+ })
90
+
91
+ // Computed
92
+ const noReviewsText = computed(() => {
93
+ if (errorLoading.value) {
94
+ console.log('errorloading', errorLoading.value)
95
+ return errorLoading.value
96
+ }
97
+ if (filterParams.value.rating) {
98
+ return $t('review.noReviewsRating', [filterParams.value.rating])
99
+ } else {
100
+ return $t('review.noReviews')
101
+ }
102
+ })
103
+
104
+ const sorting = computed(() => [
105
+ { value: 'newest', name: $t('review.sortBy.newest') },
106
+ { value: 'oldest', name: $t('review.sortBy.oldest') },
107
+ { value: 'rating-low', name: $t('review.sortBy.ratingLow') },
108
+ { value: 'rating-high', name: $t('review.sortBy.ratingHigh') },
109
+ { value: 'most-helpful', name: $t('review.sortBy.mostHelpful') }
110
+ ])
111
+
112
+ // Methods
113
+ const getReviews = async () => {
114
+ if ($buefy && reviewsList.value) {
115
+ loading.value = $buefy.loading.open({
116
+ container: reviewsList.value
117
+ })
118
+ }
119
+ errorLoading.value = ''
120
+ try {
121
+ const productIdToUse = props.productId || window.wkl_product?.id
122
+ const response = await ProductReviews.getList(productIdToUse, filterParams.value)
123
+ reviews.value = response.data
124
+ } catch (e) {
125
+ errorLoading.value = $t('review.errorLoading', [e.message])
126
+ console.log('Cannot load reviews', e.message, errorLoading.value)
127
+ } finally {
128
+ if (loading.value) {
129
+ loading.value.close()
148
130
  }
149
- },
131
+ }
132
+ }
150
133
 
151
- mounted() {
152
- this.getReviews()
134
+ const changeSort = () => {
135
+ getReviews()
136
+ }
153
137
 
154
- let reviewInvitationToken = new URL(window.location.href).searchParams.get('token')
155
- if (reviewInvitationToken) {
156
- this.$root.openReviewForm(reviewInvitationToken)
157
- }
138
+ const changeIncludeRatings = () => {
139
+ getReviews()
140
+ }
158
141
 
159
- this.$bus.$on('filterReview', (rating) => {
160
- this.filterParams.rating = rating
161
- this.filterParams.include_ratings = 1
162
- this.filterParams.page = 1
163
- this.getReviews(this.filterParams)
164
- })
142
+ const changePage = async (page) => {
143
+ filterParams.value.page = page
144
+ await getReviews()
145
+ eventBus.emit('addToCumulativeData', reviews.value.data, reviews.value.meta.current_page)
146
+ const tabElement = document.querySelector('.reviews-questions-tab')
147
+ if (tabElement) {
148
+ tabElement.scrollIntoView({ behavior: 'smooth' })
165
149
  }
166
150
  }
151
+
152
+ const showAll = () => {
153
+ document.querySelectorAll('.star-count').forEach((item) => {
154
+ if (!item.classList.contains('has-text-info')) {
155
+ item.classList.add('has-text-info')
156
+ }
157
+ })
158
+ filterParams.value.rating = null
159
+ getReviews()
160
+ }
161
+
162
+ const viewImage = ($event) => {
163
+ console.log('ProductReviews.viewimage ', $event)
164
+ }
165
+
166
+ // Lifecycle
167
+ onMounted(() => {
168
+ getReviews()
169
+
170
+ const reviewInvitationToken = new URL(window.location.href).searchParams.get('token')
171
+ if (reviewInvitationToken && instance?.proxy?.$root?.openReviewForm) {
172
+ instance.proxy.$root.openReviewForm(reviewInvitationToken)
173
+ }
174
+
175
+ eventBus.on('filterReview', (rating) => {
176
+ filterParams.value.rating = rating
177
+ filterParams.value.include_ratings = 1
178
+ filterParams.value.page = 1
179
+ getReviews()
180
+ })
181
+ })
167
182
  </script>
@@ -12,7 +12,7 @@
12
12
  <i v-for="(sc, i) in starRating(review.rating)" :key="i" :class="['fas', 'fa-star', sc]"></i>
13
13
  </div>
14
14
  </div>
15
- <div v-if="!productNameTitle" class="review-createdat">{{ review.created_at | date }}</div>
15
+ <div v-if="!productNameTitle" class="review-createdat">{{ $filters.date(review.created_at) }}</div>
16
16
  </div>
17
17
  <div v-if="productNameTitle" class="review-title"><a :href="'/'+review.product.slug">{{ review.product.name }}</a></div>
18
18
  <template v-else>
@@ -49,7 +49,7 @@
49
49
  <blockquote>
50
50
  <div v-if="reply.name" class="columns is-mobile reply-head">
51
51
  <span class="column has-text-weight-bold">{{ reply.name }} {{ $t('review.replied') }}:</span>
52
- <span class="column review-createdat">{{ reply.created_at | date }}</span>
52
+ <span class="column review-createdat">{{ $filters.date(reply.created_at) }}</span>
53
53
  </div>
54
54
  <div>{{ reply.body }}</div>
55
55
  </blockquote>
@@ -59,73 +59,68 @@
59
59
  </div>
60
60
  </template>
61
61
 
62
- <script>
62
+ <script setup>
63
+ import { ref } from 'vue'
64
+ import { useT } from '../../../composables/globals'
63
65
  import { nl2p } from '../../../utils/filters'
64
-
66
+ import { eventBus } from '../../../utils/event-bus'
65
67
  import { ProductReviews } from '../../../api'
66
- import Vote from './Vote'
68
+ import Vote from './Vote.vue'
67
69
 
68
- export default {
69
- name: 'Review',
70
- components: { Vote },
71
- props: {
72
- review: {
73
- type: Object
74
- },
75
- activeImageIndex: {
76
- type: Number,
77
- default: null
78
- },
79
- productNameTitle: {
80
- type: Boolean,
81
- default: false
82
- }
70
+ const props = defineProps({
71
+ review: {
72
+ type: Object,
73
+ required: true
83
74
  },
84
-
85
- data() {
86
- return {
87
- voteResult: {}
88
- }
75
+ activeImageIndex: {
76
+ type: Number,
77
+ default: null
89
78
  },
79
+ productNameTitle: {
80
+ type: Boolean,
81
+ default: false
82
+ }
83
+ })
90
84
 
91
- methods: {
92
- nl2p: nl2p,
85
+ const emit = defineEmits(['update:modelValue'])
93
86
 
94
- starRating(rating) {
95
- let stars = Math.floor(rating)
96
- let halfStars = rating - stars > 0.4 ? 1 : 0
97
- let other = 5 - stars - halfStars
98
- let s = ''
99
- s += 'fa-star star-on,'.repeat(stars)
100
- s += 'fa-star-half-alt star-on,'.repeat(halfStars)
101
- s += 'fa-star star-off,'.repeat(other)
102
- return s.substring(0, s.length - 1).split(',')
103
- },
87
+ // Access global properties like $t
88
+ const { t: $t } = useT()
104
89
 
105
- async submitVote(review_id, vote) {
106
- try {
107
- let resp = await ProductReviews.vote(review_id, { vote })
108
- this.$set(this.voteResult, review_id, {
109
- status: 1,
110
- msg: this.$t('review.voteSubmitted'),
111
- data: resp.data.data
112
- })
113
- } catch (err) {
114
- this.$set(this.voteResult, review_id, {
115
- status: 0,
116
- msg: err.error || this.$t('review.voteSubmitError')
117
- })
118
- }
119
- },
90
+ const voteResult = ref({})
120
91
 
121
- thumbClick(pl) {
122
- //this.activeImageIndex = pl.idx
123
- this.$emit('input', pl.idx)
124
- this.$bus.$emit('viewImage', {
125
- review_id: pl.review_id,
126
- image_id: pl.image_id
127
- })
92
+ function starRating(rating) {
93
+ const stars = Math.floor(rating)
94
+ const halfStars = rating - stars > 0.4 ? 1 : 0
95
+ const other = 5 - stars - halfStars
96
+ let s = ''
97
+ s += 'fa-star star-on,'.repeat(stars)
98
+ s += 'fa-star-half-alt star-on,'.repeat(halfStars)
99
+ s += 'fa-star star-off,'.repeat(other)
100
+ return s.substring(0, s.length - 1).split(',')
101
+ }
102
+
103
+ async function submitVote(review_id, vote) {
104
+ try {
105
+ const resp = await ProductReviews.vote(review_id, { vote })
106
+ voteResult.value[review_id] = {
107
+ status: 1,
108
+ msg: $t('review.voteSubmitted'),
109
+ data: resp.data.data
110
+ }
111
+ } catch (err) {
112
+ voteResult.value[review_id] = {
113
+ status: 0,
114
+ msg: err.error || $t('review.voteSubmitError')
128
115
  }
129
116
  }
130
117
  }
118
+
119
+ function thumbClick(pl) {
120
+ emit('update:modelValue', pl.idx)
121
+ eventBus.emit('viewImage', {
122
+ review_id: pl.review_id,
123
+ image_id: pl.image_id
124
+ })
125
+ }
131
126
  </script>