@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
@@ -2,29 +2,31 @@
2
2
  <div class="choose-addr">
3
3
  <div v-if="addAddress" class="add-address">
4
4
  <button type="button" @click="addNewAddress()" class="button">{{ $t('address.add') }}</button>
5
- <b-modal :active="showEditAddressDialog" @close="showEditAddressDialog = false" class="wkl-modal-container">
6
- <div class="edit-address-container">
7
- <header class="modal-card-head">
8
- <p class="modal-card-title">{{ addressData.id ? $t('address.title') : $t('address.add') }}</p>
9
- </header>
10
- <section class="edit-address">
11
- <EditAddress
12
- :countries="countries"
13
- :address-data="addressData"
14
- :errors="validationErrors"
15
- :show-business="orderAsBussinessEnabled"
16
- />
17
- </section>
18
- <footer class="modal-card-foot">
19
- <button @click="saveAddress" class="button is-primary is-fullwidth is-large" :class="{'is-loading': savingAddress}">{{ $t('global.save') }}</button>
20
- </footer>
21
- </div>
22
- </b-modal>
23
5
  </div>
6
+ <!-- Outside the add-address block: editing an existing address needs it too -->
7
+ <b-modal v-model="showEditAddressDialog" class="wkl-modal-container edit-address-modal" has-modal-card :can-cancel="['escape', 'outside']">
8
+ <div class="modal-card edit-address-container">
9
+ <header class="modal-card-head">
10
+ <p class="modal-card-title">{{ addressData.id ? $t('address.title') : $t('address.add') }}</p>
11
+ <button type="button" class="modal-close is-large" :aria-label="$t('global.close')" @click="showEditAddressDialog = false"></button>
12
+ </header>
13
+ <section class="modal-card-body edit-address">
14
+ <EditAddress
15
+ :countries="countries"
16
+ :address-data="addressData"
17
+ :errors="validationErrors"
18
+ :show-business="orderAsBussinessEnabled"
19
+ />
20
+ </section>
21
+ <footer class="modal-card-foot">
22
+ <button @click="saveAddress" class="button is-primary is-fullwidth is-large" :class="{'is-loading': savingAddress}">{{ $t('global.save') }}</button>
23
+ </footer>
24
+ </div>
25
+ </b-modal>
24
26
  <div v-if="addressList.length" class="address-list" ref="selectAddressContainer">
25
- <div class="address-container" v-for="(address, index) in addressList" :key="index">
27
+ <div class="is-flex address-container" v-for="(address, index) in addressList" :key="index">
26
28
  <div class="address-cb">
27
- <b-radio @input="selectAddress(address)" v-model="selectedAddressId" :native-value="address.id" size="is-small"></b-radio>
29
+ <b-radio v-model="selectedAddressId" @update:model-value="selectAddress(address)" :native-value="address.id" size="is-small"></b-radio>
28
30
  </div>
29
31
  <Address
30
32
  :repository="repository"
@@ -32,7 +34,6 @@
32
34
  :address-data="address"
33
35
  :actions-enabled="addressActionsEnabled"
34
36
  @edit="editAddress"
35
- @saved="onAddressSaved"
36
37
  @deleted="addressDeleted"
37
38
  @select="selectAddress(address)"
38
39
  />
@@ -42,13 +43,14 @@
42
43
  </template>
43
44
 
44
45
  <script>
45
- import {Address as AddressRepository} from '../../api'
46
- import gmaps from '../../utils/gmaps'
47
-
48
- import Address from './Address'
49
- import EditAddress from './Edit'
50
- import addressSchema from './address.schema'
46
+ import { ref, onMounted } from 'vue'
47
+ import { useBuefy, useT } from '../../composables/globals'
48
+ import { Address as AddressRepository } from '../../api'
49
+ import gmaps from '../../utils/google/gmaps'
51
50
 
51
+ import Address from './Address.vue'
52
+ import EditAddress from './Edit.vue'
53
+ import { addressSchema } from './address.schema'
52
54
 
53
55
  export default {
54
56
  name: 'AddressSelect',
@@ -78,7 +80,7 @@ export default {
78
80
  },
79
81
  addressActionsEnabled: {
80
82
  type: Array,
81
- default: ['edit', 'delete']
83
+ default: () => ['edit', 'delete']
82
84
  },
83
85
  context: {
84
86
  type: String,
@@ -90,106 +92,111 @@ export default {
90
92
  }
91
93
  },
92
94
 
93
- data() {
94
- return {
95
- addressData: { ...addressSchema },
96
- showEditAddressDialog: false,
97
- selectedAddressId: null,
98
- validationErrors: {},
99
- savingAddress: false
100
- }
101
- },
95
+ emits: ['select', 'addressSaved', 'addressDeleted'],
102
96
 
103
- methods: {
97
+ setup(props, { emit }) {
98
+ const $buefy = useBuefy()
99
+ const { t: $t } = useT()
104
100
 
105
- async setCoordinates() {
106
- this.addressData.coordinates = await gmaps.geocodeAddress(AddressRepository.getFormatted(this.addressData))
107
- },
101
+ const addressData = ref({ ...addressSchema })
102
+ const showEditAddressDialog = ref(false)
103
+ const selectedAddressId = ref(null)
104
+ const validationErrors = ref({})
105
+ const savingAddress = ref(false)
106
+ const selectAddressContainer = ref(null)
108
107
 
109
- addNewAddress() {
110
- this.addressData = {
111
- ...addressSchema
112
- }
113
- this.showEditAddressDialog = true;
114
- },
108
+ const setCoordinates = async () => {
109
+ addressData.value.coordinates = await gmaps.geocodeAddress(AddressRepository.getFormatted(addressData.value))
110
+ }
115
111
 
116
- async editAddress(pl, button) {
112
+ const addNewAddress = () => {
113
+ addressData.value = { ...addressSchema }
114
+ showEditAddressDialog.value = true
115
+ }
116
+
117
+ const editAddress = async (pl, button) => {
117
118
  button.classList.add('is-loading')
118
119
  try {
119
120
  let resp = await AddressRepository.get(pl)
120
- this.addressData = resp.data.data
121
- this.showEditAddressDialog = true
122
- } catch (e) {
123
- this.$buefy.toast.open({
121
+ addressData.value = resp.data.data
122
+ showEditAddressDialog.value = true
123
+ } catch (e) {
124
+ $buefy.toast.open({
124
125
  message: 'Cannot get address data',
125
126
  type: 'is-error'
126
127
  })
127
128
  } finally {
128
129
  button.classList.remove('is-loading')
129
130
  }
130
- },
131
+ }
131
132
 
132
- async saveAddress() {
133
- //this.addressData.type = '-'
134
- this.savingAddress = true
133
+ const saveAddress = async () => {
134
+ savingAddress.value = true
135
135
  try {
136
- await this.setCoordinates()
136
+ await setCoordinates()
137
137
  } catch (e) {
138
138
  console.log('Geocoder problem', e)
139
139
  }
140
140
 
141
141
  try {
142
- let response = await AddressRepository.edit(this.addressData)
142
+ let response = await AddressRepository.edit(addressData.value)
143
143
  if (response.status == 201 || response.status == 200) {
144
- this.$buefy.toast.open({
145
- message: this.$t('address.savedNotification'),
144
+ $buefy.toast.open({
145
+ message: $t('address.savedNotification'),
146
146
  type: 'is-success'
147
147
  })
148
- //this.$emit('saved', response.data.data)
149
- this.showEditAddressDialog = false
150
- this.addressData = {...addressSchema}
151
- this.selectAddress(response.data.data)
152
- this.$emit('addressSaved', response.data.data)
148
+ showEditAddressDialog.value = false
149
+ addressData.value = { ...addressSchema }
150
+ selectAddress(response.data.data)
151
+ emit('addressSaved', response.data.data)
153
152
  }
154
153
  } catch (error) {
155
154
  if (error.errors) {
156
- this.validationErrors = error.errors
155
+ validationErrors.value = error.errors
157
156
  }
158
157
  } finally {
159
- this.savingAddress = false
158
+ savingAddress.value = false
160
159
  }
161
- },
160
+ }
162
161
 
163
- selectAddress(address) {
162
+ const selectAddress = (address) => {
164
163
  let loadingSelectAddress = null
165
164
  setTimeout(() => {
166
- loadingSelectAddress = this.$buefy.loading.open({
167
- container: this.$refs.selectAddressContainer
165
+ loadingSelectAddress = $buefy.loading.open({
166
+ container: selectAddressContainer.value
168
167
  })
169
168
  }, 500)
170
169
 
171
- this.selectedAddressId = address.id
170
+ selectedAddressId.value = address.id
172
171
  setTimeout(() => {
173
172
  loadingSelectAddress.close()
174
- this.$emit('select', address)
173
+ emit('select', address)
175
174
  }, 1500)
176
- },
177
-
178
- onAddressSaved(address) {
179
- this.selectAddress(address)
180
- this.showEditAddress = false
181
- this.$emit('addressSaved', address)
182
- },
175
+ }
183
176
 
184
- addressDeleted() {
185
- this.$emit('addressDeleted')
177
+ const addressDeleted = () => {
178
+ emit('addressDeleted')
186
179
  }
187
- },
188
180
 
189
- mounted() {
190
- //console.log('AddressSelect countries ', this.countries)
191
- if (this.addressList.length > 0) {
192
- //this.selectAddress(this.addressList[0])
181
+ onMounted(() => {
182
+ // console.log('AddressSelect countries ', props.countries)
183
+ if (props.addressList.length > 0) {
184
+ // selectAddress(props.addressList[0])
185
+ }
186
+ })
187
+
188
+ return {
189
+ addressData,
190
+ showEditAddressDialog,
191
+ selectedAddressId,
192
+ validationErrors,
193
+ savingAddress,
194
+ selectAddressContainer,
195
+ addNewAddress,
196
+ editAddress,
197
+ saveAddress,
198
+ selectAddress,
199
+ addressDeleted
193
200
  }
194
201
  }
195
202
  }