@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
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
<div class="columns filter-sort-c">
|
|
4
4
|
<div class="column filter-sort">
|
|
5
5
|
<span>{{ $t('review.filter') }}</span>
|
|
6
|
-
<b-select
|
|
6
|
+
<b-select v-model="filterParam.f" :placeholder="$t('review.all')" @update:model-value="changeFilter" size="is-small">
|
|
7
7
|
<option v-for="filter in topics" :value="filter" :key="filter">
|
|
8
8
|
{{ filter }}
|
|
9
9
|
</option>
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
</div>
|
|
12
12
|
<div class="column filter-sort">
|
|
13
13
|
<span>{{ $t('review.lSortBy') }}</span>
|
|
14
|
-
<b-select
|
|
14
|
+
<b-select v-model="filterParam.sort" :placeholder="$t('review.mostHelpful')" @update:model-value="changeFilter" size="is-small">
|
|
15
15
|
<option v-for="option in sorting" :value="option.value" :key="option.value">
|
|
16
16
|
{{ option.name }}
|
|
17
17
|
</option>
|
|
@@ -19,13 +19,13 @@
|
|
|
19
19
|
</div>
|
|
20
20
|
</div>
|
|
21
21
|
|
|
22
|
-
<div ref="
|
|
22
|
+
<div ref="listRef" class="questions-list">
|
|
23
23
|
<div class="question" v-for="question in list.data" :key="question.id">
|
|
24
24
|
<div class="columns">
|
|
25
25
|
<div class="column">
|
|
26
26
|
<div class="is-flex" style="justify-content: space-between">
|
|
27
27
|
<div>{{ question.name }}</div>
|
|
28
|
-
<div style="color: #c0c0c0">{{ question.created_at
|
|
28
|
+
<div style="color: #c0c0c0">{{ $filters.date(question.created_at) }}</div>
|
|
29
29
|
</div>
|
|
30
30
|
<div class="subtitle has-text-weight-semibold">
|
|
31
31
|
{{ question.body }}
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
<div class="question-answer" v-for="(answer, i) in question.replies" :key="answer.id">
|
|
38
38
|
<div class="columns">
|
|
39
39
|
<div class="column answer-user">{{ initialState.site_name }}</div>
|
|
40
|
-
<div class="column has-text-right answer-date">{{ answer.created_at
|
|
40
|
+
<div class="column has-text-right answer-date">{{ $filters.date(answer.created_at) }}</div>
|
|
41
41
|
</div>
|
|
42
42
|
<div class="columns">
|
|
43
43
|
<div class="column answer-body">
|
|
@@ -55,7 +55,7 @@
|
|
|
55
55
|
<b-pagination
|
|
56
56
|
v-if="list.meta && list.meta.total > 20"
|
|
57
57
|
:total="list.meta.total"
|
|
58
|
-
:current
|
|
58
|
+
v-model:current="list.meta.current_page"
|
|
59
59
|
:per-page="list.meta.per_page"
|
|
60
60
|
@change="changePage"
|
|
61
61
|
aria-next-label="Next page"
|
|
@@ -71,221 +71,249 @@
|
|
|
71
71
|
<div class="no-reviews" v-if="list.data && !list.data.length"> {{ $t('review.question.noQuestions') }} </div>
|
|
72
72
|
</template>
|
|
73
73
|
|
|
74
|
-
<
|
|
75
|
-
<
|
|
76
|
-
<
|
|
77
|
-
<
|
|
78
|
-
<
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
<
|
|
82
|
-
<b-
|
|
83
|
-
<
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
74
|
+
<Teleport to="body">
|
|
75
|
+
<b-modal v-model="questionModal" :can-cancel="['x']">
|
|
76
|
+
<form action>
|
|
77
|
+
<div class="modal-card">
|
|
78
|
+
<header class="modal-card-head">
|
|
79
|
+
<p class="modal-card-title">{{ $t('review.question.askQuestion') }}</p>
|
|
80
|
+
</header>
|
|
81
|
+
<section class="modal-card-body">
|
|
82
|
+
<b-field :label="$t('review.question.chooseTopic')" label-position="inside" :type="{ 'is-danger': errors.subject }" :message="errors.subject">
|
|
83
|
+
<b-select v-model="question.subject" expanded>
|
|
84
|
+
<option v-for="option in topics" :value="option" :key="option">
|
|
85
|
+
{{ option }}
|
|
86
|
+
</option>
|
|
87
|
+
</b-select>
|
|
88
|
+
</b-field>
|
|
88
89
|
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
90
|
+
<b-field :label="$t('review.question.question')" label-position="inside" :type="{ 'is-danger': errors.body }" :message="errors.body">
|
|
91
|
+
<b-input v-model="question.body" type="textarea" />
|
|
92
|
+
</b-field>
|
|
93
|
+
</section>
|
|
94
|
+
<footer class="modal-card-foot">
|
|
95
|
+
<b-button :loading="loading" type="is-primary" @click="askQuestion">{{ $t('review.question.askQuestion') }}</b-button>
|
|
96
|
+
<b-button class="button" type="button" @click="questionModal = false">{{ $t('global.cancel') }}</b-button>
|
|
97
|
+
</footer>
|
|
98
|
+
</div>
|
|
99
|
+
</form>
|
|
100
|
+
</b-modal>
|
|
101
|
+
</Teleport>
|
|
100
102
|
|
|
101
|
-
<
|
|
102
|
-
<
|
|
103
|
-
<
|
|
104
|
-
<
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
<
|
|
109
|
-
<b-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
<
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
103
|
+
<Teleport to="body">
|
|
104
|
+
<b-modal v-model="answerModal">
|
|
105
|
+
<form>
|
|
106
|
+
<div class="modal-card">
|
|
107
|
+
<header class="modal-card-head">
|
|
108
|
+
<p class="modal-card-title">{{ $t('review.answerQuestion') }}</p>
|
|
109
|
+
</header>
|
|
110
|
+
<section class="modal-card-body">
|
|
111
|
+
<b-field :label="$t('review.question.answer')" label-position="inside" :type="{ 'is-danger': errors.body }" :message="errors.body">
|
|
112
|
+
<b-input v-model="reply.body" type="textarea" />
|
|
113
|
+
</b-field>
|
|
114
|
+
</section>
|
|
115
|
+
<footer class="modal-card-foot">
|
|
116
|
+
<b-button :loading="loading" type="is-primary" @click="postReply">{{ $t('review.question.submitAnswer') }}</b-button>
|
|
117
|
+
<b-button class="button" type="button" @click="answerModal = false">{{ $t('global.cancel') }}</b-button>
|
|
118
|
+
</footer>
|
|
119
|
+
</div>
|
|
120
|
+
</form>
|
|
121
|
+
</b-modal>
|
|
122
|
+
</Teleport>
|
|
119
123
|
</div>
|
|
120
124
|
</template>
|
|
121
125
|
|
|
122
|
-
<script>
|
|
126
|
+
<script setup>
|
|
127
|
+
import { ref, computed, onMounted, onBeforeUnmount, getCurrentInstance } from 'vue'
|
|
128
|
+
import { useBuefy, useBus, useInitialState, useT } from '../../../composables/globals'
|
|
123
129
|
import { ProductQuestions } from '../../../api'
|
|
124
|
-
import Vote from './Vote'
|
|
130
|
+
import Vote from './Vote.vue'
|
|
125
131
|
|
|
126
|
-
|
|
127
|
-
|
|
132
|
+
const buefy = useBuefy()
|
|
133
|
+
const bus = useBus()
|
|
134
|
+
const { t } = useT()
|
|
135
|
+
const initialState = useInitialState()
|
|
136
|
+
// Host app's root instance and its openModal() helper (provided by the consuming app)
|
|
137
|
+
const instance = getCurrentInstance()
|
|
128
138
|
|
|
129
|
-
|
|
139
|
+
// Get product ID from global (Vue 3 compatible)
|
|
140
|
+
const productId = typeof window !== 'undefined' && window.wkl_product ? window.wkl_product.id : null
|
|
130
141
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
question: {
|
|
141
|
-
type: 'question',
|
|
142
|
-
subject: '',
|
|
143
|
-
product_id: window.wkl_product.id
|
|
144
|
-
},
|
|
145
|
-
reply: {},
|
|
146
|
-
voteResult: {},
|
|
147
|
-
toggleAnswers: false,
|
|
148
|
-
questionModal: false,
|
|
149
|
-
answerModal: false,
|
|
150
|
-
loading: false,
|
|
151
|
-
errorLoading: ''
|
|
152
|
-
}
|
|
153
|
-
},
|
|
142
|
+
// Refs
|
|
143
|
+
const list = ref({ data: [], meta: {} })
|
|
144
|
+
const listRef = ref(null)
|
|
145
|
+
const errors = ref({})
|
|
146
|
+
const voteResult = ref({})
|
|
147
|
+
const questionModal = ref(false)
|
|
148
|
+
const answerModal = ref(false)
|
|
149
|
+
const loading = ref(false)
|
|
150
|
+
const errorLoading = ref('')
|
|
154
151
|
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
this.$t('review.question.topics.specifications'),
|
|
160
|
-
this.$t('review.question.topics.brand'),
|
|
161
|
-
this.$t('review.question.topics.usage'),
|
|
162
|
-
this.$t('review.question.topics.shipping'),
|
|
163
|
-
this.$t('review.question.topics.other')
|
|
164
|
-
]
|
|
165
|
-
},
|
|
166
|
-
sorting() {
|
|
167
|
-
return [
|
|
168
|
-
{ value: 'newest', name: this.$t('review.sortBy.newest') },
|
|
169
|
-
{ value: 'oldest', name: this.$t('review.sortBy.oldest') },
|
|
170
|
-
{ value: 'rating-low', name: this.$t('review.sortBy.ratingLow') },
|
|
171
|
-
{ value: 'rating-high', name: this.$t('review.sortBy.ratingHigh') },
|
|
172
|
-
{ value: 'most-helpful', name: this.$t('review.sortBy.mostHelpful') }
|
|
173
|
-
]
|
|
174
|
-
}
|
|
175
|
-
},
|
|
152
|
+
const filterParam = ref({
|
|
153
|
+
f: t('review.question.topics.all'),
|
|
154
|
+
sort: 'newest'
|
|
155
|
+
})
|
|
176
156
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
157
|
+
const question = ref({
|
|
158
|
+
type: 'question',
|
|
159
|
+
subject: '',
|
|
160
|
+
body: '',
|
|
161
|
+
product_id: productId
|
|
162
|
+
})
|
|
181
163
|
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
status: 1,
|
|
187
|
-
msg: this.$t('review.voteSubmitted'),
|
|
188
|
-
data: resp.data.data
|
|
189
|
-
})
|
|
190
|
-
} catch (err) {
|
|
191
|
-
this.$set(this.voteResult, item_id, {
|
|
192
|
-
status: 0,
|
|
193
|
-
msg: err.error || this.$t('review.voteSubmitError')
|
|
194
|
-
})
|
|
195
|
-
}
|
|
196
|
-
},
|
|
164
|
+
const reply = ref({
|
|
165
|
+
id: null,
|
|
166
|
+
body: ''
|
|
167
|
+
})
|
|
197
168
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
169
|
+
// Computed
|
|
170
|
+
const topics = computed(() => {
|
|
171
|
+
return [
|
|
172
|
+
t('review.question.topics.all'),
|
|
173
|
+
t('review.question.topics.specifications'),
|
|
174
|
+
t('review.question.topics.brand'),
|
|
175
|
+
t('review.question.topics.usage'),
|
|
176
|
+
t('review.question.topics.shipping'),
|
|
177
|
+
t('review.question.topics.other')
|
|
178
|
+
]
|
|
179
|
+
})
|
|
204
180
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
181
|
+
const sorting = computed(() => {
|
|
182
|
+
return [
|
|
183
|
+
{ value: 'newest', name: t('review.sortBy.newest') },
|
|
184
|
+
{ value: 'oldest', name: t('review.sortBy.oldest') },
|
|
185
|
+
{ value: 'rating-low', name: t('review.sortBy.ratingLow') },
|
|
186
|
+
{ value: 'rating-high', name: t('review.sortBy.ratingHigh') },
|
|
187
|
+
{ value: 'most-helpful', name: t('review.sortBy.mostHelpful') }
|
|
188
|
+
]
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
// Methods
|
|
192
|
+
const changeFilter = () => {
|
|
193
|
+
getQuestions(filterParam.value)
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
const submitVote = async (item_id, vote) => {
|
|
197
|
+
try {
|
|
198
|
+
const resp = await ProductQuestions.vote(item_id, { vote })
|
|
199
|
+
// Vue 3: reactive assignment instead of $set
|
|
200
|
+
voteResult.value[item_id] = {
|
|
201
|
+
status: 1,
|
|
202
|
+
msg: t('review.voteSubmitted'),
|
|
203
|
+
data: resp.data.data
|
|
204
|
+
}
|
|
205
|
+
} catch (err) {
|
|
206
|
+
voteResult.value[item_id] = {
|
|
207
|
+
status: 0,
|
|
208
|
+
msg: err.error || t('review.voteSubmitError')
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
const openQuestion = () => {
|
|
214
|
+
if (initialState.user) {
|
|
215
|
+
questionModal.value = true
|
|
216
|
+
} else {
|
|
217
|
+
instance.proxy.openModal?.('Login')
|
|
218
|
+
}
|
|
219
|
+
}
|
|
215
220
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
+
const changePage = (page) => {
|
|
222
|
+
filterParam.value.page = page
|
|
223
|
+
getQuestions(filterParam.value)
|
|
224
|
+
const tabsElement = document.querySelector('.b-tabs')
|
|
225
|
+
if (tabsElement) {
|
|
226
|
+
tabsElement.scrollIntoView({ behavior: 'smooth' })
|
|
227
|
+
}
|
|
228
|
+
}
|
|
221
229
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
230
|
+
const getQuestions = async (filter) => {
|
|
231
|
+
loading.value = true
|
|
232
|
+
errorLoading.value = ''
|
|
233
|
+
|
|
234
|
+
const loadingComponent = buefy.loading.open({ container: listRef.value })
|
|
235
|
+
|
|
236
|
+
try {
|
|
237
|
+
const { data } = await ProductQuestions.getAll(productId, filter)
|
|
238
|
+
list.value = data
|
|
239
|
+
} catch (e) {
|
|
240
|
+
errorLoading.value = t('review.question.errorLoading', [e.message])
|
|
241
|
+
console.log('Cannot load questions', e.message, errorLoading.value)
|
|
242
|
+
} finally {
|
|
243
|
+
loading.value = false
|
|
244
|
+
loadingComponent.close()
|
|
245
|
+
}
|
|
246
|
+
}
|
|
238
247
|
|
|
239
|
-
|
|
240
|
-
|
|
248
|
+
const askQuestion = async () => {
|
|
249
|
+
loading.value = true
|
|
241
250
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
251
|
+
try {
|
|
252
|
+
await ProductQuestions.sendQuestion(productId, question.value)
|
|
253
|
+
buefy.snackbar.open(t('review.question.submitted'))
|
|
254
|
+
|
|
255
|
+
setTimeout(async () => {
|
|
256
|
+
await getQuestions(filterParam.value)
|
|
257
|
+
}, 1000)
|
|
248
258
|
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
+
questionModal.value = false
|
|
260
|
+
errors.value = {}
|
|
261
|
+
question.value.subject = ''
|
|
262
|
+
question.value.body = ''
|
|
263
|
+
} catch (err) {
|
|
264
|
+
errors.value = err.errors || {}
|
|
265
|
+
} finally {
|
|
266
|
+
loading.value = false
|
|
267
|
+
}
|
|
268
|
+
}
|
|
259
269
|
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
270
|
+
const openAnswerModal = (id) => {
|
|
271
|
+
if (initialState.user) {
|
|
272
|
+
answerModal.value = true
|
|
273
|
+
} else {
|
|
274
|
+
instance.proxy.openModal?.('Login')
|
|
275
|
+
}
|
|
276
|
+
reply.value.id = id
|
|
277
|
+
}
|
|
264
278
|
|
|
265
|
-
|
|
266
|
-
|
|
279
|
+
const postReply = async () => {
|
|
280
|
+
loading.value = true
|
|
267
281
|
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
},
|
|
282
|
+
try {
|
|
283
|
+
await ProductQuestions.sendReply(reply.value.id, reply.value)
|
|
284
|
+
buefy.snackbar.open(t('review.question.answerSubmitted'))
|
|
285
|
+
answerModal.value = false
|
|
286
|
+
errors.value = {}
|
|
287
|
+
} catch (err) {
|
|
288
|
+
buefy.snackbar.open({ message: err.message, duration: 5000 })
|
|
289
|
+
} finally {
|
|
290
|
+
loading.value = false
|
|
291
|
+
}
|
|
292
|
+
}
|
|
280
293
|
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
this.$root.reviewsQuestionsActiveTab = 1
|
|
286
|
-
this.openQuestion()
|
|
287
|
-
console.log('open question event')
|
|
288
|
-
})
|
|
294
|
+
const onOpenQuestion = () => {
|
|
295
|
+
const root = instance.proxy.$root
|
|
296
|
+
if (root && root.reviewsQuestionsActiveTab !== undefined) {
|
|
297
|
+
root.reviewsQuestionsActiveTab = 1
|
|
289
298
|
}
|
|
299
|
+
openQuestion()
|
|
290
300
|
}
|
|
301
|
+
|
|
302
|
+
// Lifecycle
|
|
303
|
+
onMounted(() => {
|
|
304
|
+
getQuestions(filterParam.value)
|
|
305
|
+
|
|
306
|
+
bus.on('openQuestion', onOpenQuestion)
|
|
307
|
+
})
|
|
308
|
+
|
|
309
|
+
onBeforeUnmount(() => {
|
|
310
|
+
bus.off('openQuestion', onOpenQuestion)
|
|
311
|
+
})
|
|
312
|
+
|
|
313
|
+
// Expose refs for template
|
|
314
|
+
defineExpose({
|
|
315
|
+
list,
|
|
316
|
+
listRef,
|
|
317
|
+
openQuestion
|
|
318
|
+
})
|
|
291
319
|
</script>
|