@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
@@ -0,0 +1,91 @@
1
+ <template>
2
+ <div class="password-wrapper column-wrapper">
3
+ <div class="password-header">
4
+ <p>Password</p>
5
+ </div>
6
+ <div class="columns-wrapper">
7
+ <div class="columns is-gapless">
8
+ <div class="column is-one-third">
9
+ <b-field
10
+ :label="$t('account.lCurrentPassword')"
11
+ label-position="inside"
12
+ :type="{ 'is-danger': errors.current_password }"
13
+ :message="errors.current_password"
14
+ >
15
+ <b-input type="password" native-value="inside" v-model="user.current_password" @update:model-value="clearError('current_password')"></b-input>
16
+ </b-field>
17
+
18
+ <b-field :label="$t('account.lNewPassword')" label-position="inside" :type="{ 'is-danger': errors.new_password }" :message="errors.new_password">
19
+ <b-input type="password" native-value="inside" v-model="user.new_password" @update:model-value="clearError('new_password')"></b-input>
20
+ </b-field>
21
+
22
+ <b-field :label="$t('account.lConfirmNewPassword')" label-position="inside">
23
+ <b-input type="password" native-value="inside" v-model="user.new_password_confirmation" @update:model-value="clearError('new_password')"></b-input>
24
+ </b-field>
25
+ </div>
26
+
27
+ <div class="column"></div>
28
+ </div>
29
+
30
+ <button type="button" @click="warningMessage" class="button is-primary change-password">{{ $t('account.changePassword') }}</button>
31
+ </div>
32
+ </div>
33
+ </template>
34
+
35
+ <script setup>
36
+ import { ref } from 'vue'
37
+ import { useBuefy, useT } from '../../../composables/globals'
38
+ import { User } from '../../../api'
39
+
40
+ const { t: $t } = useT()
41
+ const $buefy = useBuefy()
42
+
43
+ const errors = ref({})
44
+ const user = ref({
45
+ current_password: '',
46
+ new_password: '',
47
+ new_password_confirmation: ''
48
+ })
49
+
50
+ const submit = () => {
51
+ User.updatePassword(user.value)
52
+ .then((response) => {
53
+ if (response.status === 200 || response.status === 201) {
54
+ $buefy.toast.open({
55
+ message: $t('account.passwordChangedNotification'),
56
+ type: 'is-success'
57
+ })
58
+ } else {
59
+ $buefy.dialog.alert({
60
+ title: $t('account.dialogTitle'),
61
+ message: $t('account.passwordChangeErrorNotification'),
62
+ confirmText: 'OK',
63
+ type: 'is-info'
64
+ })
65
+ }
66
+ })
67
+ .catch((error) => {
68
+ if (error.errors !== undefined) {
69
+ errors.value = error.errors
70
+ }
71
+ })
72
+ }
73
+
74
+ const clearError = (field) => {
75
+ if (errors.value[field]) {
76
+ errors.value[field] = ''
77
+ }
78
+ }
79
+
80
+ const warningMessage = () => {
81
+ $buefy.dialog.confirm({
82
+ title: $t('account.dialogTitle'),
83
+ message: $t('account.passwordChangeConfirm'),
84
+ confirmText: 'Ok',
85
+ type: 'is-info',
86
+ onConfirm: () => {
87
+ submit()
88
+ }
89
+ })
90
+ }
91
+ </script>
@@ -8,7 +8,7 @@
8
8
  ><span v-if="addressData.state && addressData.state.abbr">, {{ addressData.state.abbr }}</span
9
9
  ><span v-if="addressData.postcode">, {{ addressData.postcode }}</span>
10
10
  </div>
11
- <p>{{ $getProp(addressData, ['country', 'name']) }}</p>
11
+ <p>{{ addressData.country?.name }}</p>
12
12
  <p v-if="addressData.phone">{{ $t('address.phoneNumber') }} {{ addressData.phone }}</p>
13
13
  </div>
14
14
  <div v-if="actionsEnabled" class="buttons-container">
@@ -36,28 +36,16 @@
36
36
  {{ $t('global.setAsDefault') }}
37
37
  </a>
38
38
  </div>
39
- <b-modal class="modal" :active="showEditAddress" @close="showEditAddress = false" :can-cancel="['x']">
40
- <EditAddress
41
- :title="$t('address.title')"
42
- context="context"
43
- :countries="countries"
44
- :address-data="refreshAddressData"
45
- :show-footer="true"
46
- @saved="onAddressSaved"
47
- >
48
- </EditAddress>
49
- </b-modal>
50
39
  </div>
51
40
  </template>
52
41
 
53
42
  <script>
54
- import EditAddress from './Edit'
43
+ import { ref } from 'vue'
44
+ import { useBuefy, useT } from '../../composables/globals'
55
45
 
56
46
  export default {
57
47
  name: 'Address',
58
48
 
59
- components: { EditAddress },
60
-
61
49
  props: {
62
50
  repository: {
63
51
  type: Object,
@@ -85,52 +73,40 @@ export default {
85
73
  }
86
74
  },
87
75
 
88
- data() {
89
- return {
90
- showEditAddress: false,
91
- loading: '',
92
- refreshAddressData: {}
93
- }
94
- },
76
+ emits: ['select', 'edit', 'deleted'],
95
77
 
96
- methods: {
97
- onAddressSaved(address) {
98
- this.showEditAddress = false
99
- this.$emit('saved', address)
100
- },
78
+ setup(props, { emit }) {
79
+ const $buefy = useBuefy()
80
+ const { t: $t } = useT()
101
81
 
102
- editAddress(id, event) {
82
+ const loading = ref('')
83
+
84
+ const editAddress = (id, event) => {
103
85
  if (!id) {
104
86
  return
105
87
  }
106
- let button = event.target
107
- this.$emit('edit', id, button)
108
- /*
109
- this.repository.get(id).then((response) => {
110
- this.loading = ''
111
- ;(this.refreshAddressData = response.data.data), (this.showEditAddress = true)
112
- })
113
- */
114
- },
88
+ // The parent (AddressBook, AddressSelect) fetches the address and opens its own edit modal
89
+ emit('edit', id, event.target)
90
+ }
115
91
 
116
- deleteAddress(id) {
117
- this.loading = 'delete'
118
- this.$buefy.dialog.confirm({
119
- title: this.$t('address.confirmTitle'),
120
- message: this.$t('address.confirmDelete'),
92
+ const deleteAddress = (id) => {
93
+ loading.value = 'delete'
94
+ $buefy.dialog.confirm({
95
+ title: $t('address.confirmTitle'),
96
+ message: $t('address.confirmDelete'),
121
97
  onConfirm: () => {
122
- this.repository
98
+ props.repository
123
99
  .delete(id)
124
100
  .then(() => {
125
- this.loading = ''
126
- this.$buefy.toast.open(this.$t('deletedNotification'))
127
- this.$emit('deleted')
101
+ loading.value = ''
102
+ $buefy.toast.open($t('address.deletedNotification'))
103
+ emit('deleted')
128
104
  })
129
105
  .catch((error) => {
130
- this.loading = ''
131
- this.$buefy.toast.open({
106
+ loading.value = ''
107
+ $buefy.toast.open({
132
108
  duration: 10000,
133
- message: this.$t('global.error') + error.statusText,
109
+ message: $t('global.error') + error.statusText,
134
110
  position: 'is-top',
135
111
  type: 'is-danger'
136
112
  })
@@ -138,23 +114,28 @@ export default {
138
114
  })
139
115
  },
140
116
  onCancel: () => {
141
- this.loading = ''
117
+ loading.value = ''
142
118
  }
143
119
  })
144
- },
120
+ }
145
121
 
146
- setDefault(id) {
147
- this.repository.setDefault(id).then(() => {
148
- this.$buefy.toast.open({
122
+ const setDefault = (id) => {
123
+ props.repository.setDefault(id).then(() => {
124
+ $buefy.toast.open({
149
125
  duration: 10000,
150
- message: this.$t('address.setAsDefaultNotification'),
126
+ message: $t('address.setAsDefaultNotification'),
151
127
  position: 'is-top',
152
128
  type: 'is-success'
153
129
  })
154
130
  })
155
131
  }
156
- },
157
132
 
158
- mounted() {}
133
+ return {
134
+ loading,
135
+ editAddress,
136
+ deleteAddress,
137
+ setDefault
138
+ }
139
+ }
159
140
  }
160
141
  </script>
@@ -18,12 +18,13 @@
18
18
  </div>
19
19
  </div>
20
20
 
21
- <b-modal v-model="showEditAddressDialog" class="wkl-modal-container">
22
- <div class="edit-address-container">
21
+ <b-modal v-model="showEditAddressDialog" class="wkl-modal-container edit-address-modal" has-modal-card :can-cancel="['escape', 'outside']">
22
+ <div class="modal-card edit-address-container">
23
23
  <header class="modal-card-head">
24
24
  <p class="modal-card-title">{{ addressData.id ? $t('address.title') : $t('address.add') }}</p>
25
+ <button type="button" class="modal-close is-large" :aria-label="$t('global.close')" @click="showEditAddressDialog = false"></button>
25
26
  </header>
26
- <section class="edit-address">
27
+ <section class="modal-card-body edit-address">
27
28
  <EditAddress
28
29
  :countries="countries"
29
30
  :address-data="addressData"
@@ -41,16 +42,24 @@
41
42
  </template>
42
43
 
43
44
  <script>
44
-
45
- import gmaps from '../../utils/gmaps'
45
+ import { ref, onMounted } from 'vue'
46
+ import { useBuefy, useT } from '../../composables/globals'
47
+ import gmaps from '../../utils/google/gmaps'
46
48
  import { Address as AddressRepository } from '../../api'
49
+ import { eventBus } from '../../utils/event-bus'
47
50
 
48
- import Address from './Address'
49
- import EditAddress from './Edit'
50
- import addressSchema from './address.schema'
51
+ import Address from './Address.vue'
52
+ import EditAddress from './Edit.vue'
53
+ import { addressSchema } from './address.schema'
51
54
 
52
55
  export default {
53
56
  name: 'AddressBook',
57
+
58
+ components: {
59
+ Address,
60
+ EditAddress
61
+ },
62
+
54
63
  props: {
55
64
  countries: {
56
65
  type: Array,
@@ -63,89 +72,100 @@ export default {
63
72
  default: false
64
73
  }
65
74
  },
66
- components: {
67
- Address,
68
- EditAddress
69
- },
70
75
 
71
- data() {
72
- return {
73
- addressRepository: AddressRepository,
74
- addresses: [],
75
- addressData: { ...addressSchema },
76
- validationErrors: {},
77
- showEditAddressDialog: false
78
- }
79
- },
76
+ emits: ['saved'],
77
+
78
+ setup(props, { emit }) {
79
+ const $buefy = useBuefy()
80
+ const { t: $t } = useT()
80
81
 
81
- methods: {
82
- getAddresses() {
82
+ // Reactive state
83
+ const addressRepository = AddressRepository
84
+ const addresses = ref([])
85
+ const addressData = ref({ ...addressSchema })
86
+ const validationErrors = ref({})
87
+ const showEditAddressDialog = ref(false)
88
+
89
+ // Methods
90
+ const getAddresses = () => {
83
91
  AddressRepository.getList().then((response) => {
84
- this.addresses = response.data.data
92
+ addresses.value = response.data.data
85
93
  })
86
- },
94
+ }
87
95
 
88
- addAddress() {
89
- this.addressData = {...addressSchema}
90
- this.showEditAddressDialog = true
91
- },
96
+ const addAddress = () => {
97
+ addressData.value = { ...addressSchema }
98
+ showEditAddressDialog.value = true
99
+ }
92
100
 
93
- async editAddress(pl, button) {
101
+ const editAddress = async (pl, button) => {
94
102
  button.classList.add('is-loading')
95
103
  try {
96
104
  let resp = await AddressRepository.get(pl)
97
- this.addressData = resp.data.data
98
- this.showEditAddressDialog = true
99
- } catch (e) {
100
- this.$buefy.toast.open({
105
+ addressData.value = resp.data.data
106
+ showEditAddressDialog.value = true
107
+ } catch (e) {
108
+ $buefy.toast.open({
101
109
  message: 'Cannot get address data',
102
110
  type: 'is-error'
103
111
  })
104
112
  } finally {
105
113
  button.classList.remove('is-loading')
106
114
  }
107
- },
115
+ }
108
116
 
109
- async setCoordinates() {
110
- this.addressData.coordinates = await gmaps.geocodeAddress(AddressRepository.getFormatted(this.addressData))
111
- },
117
+ const setCoordinates = async () => {
118
+ addressData.value.coordinates = await gmaps.geocodeAddress(
119
+ AddressRepository.getFormatted(addressData.value)
120
+ )
121
+ }
112
122
 
113
- async saveAddress() {
114
- //this.addressData.type = '-'
123
+ const saveAddress = async () => {
115
124
  try {
116
- await this.setCoordinates()
125
+ await setCoordinates()
117
126
  } catch (e) {
118
127
  console.log('Geocoder problem', e)
119
128
  }
120
129
 
121
130
  try {
122
- let response = await AddressRepository.edit(this.addressData)
131
+ let response = await AddressRepository.edit(addressData.value)
123
132
  if (response.status == 201 || response.status == 200) {
124
- this.$buefy.toast.open({
125
- message: this.$t('address.savedNotification'),
133
+ $buefy.toast.open({
134
+ message: $t('address.savedNotification'),
126
135
  type: 'is-success'
127
136
  })
128
- this.$emit('saved', response.data.data)
129
- this.showEditAddressDialog = false
130
- this.addressData = {...addressSchema}
131
- this.getAddresses()
137
+ emit('saved', response.data.data)
138
+ showEditAddressDialog.value = false
139
+ addressData.value = { ...addressSchema }
140
+ getAddresses()
132
141
  }
133
142
  } catch (error) {
134
143
  if (error.errors) {
135
- this.validationErrors = error.errors
144
+ validationErrors.value = error.errors
136
145
  }
137
146
  }
138
- },
139
-
140
- },
147
+ }
141
148
 
142
- mounted() {
143
- this.getAddresses()
149
+ // Lifecycle
150
+ onMounted(() => {
151
+ getAddresses()
144
152
 
145
- this.$bus.$on('EditAddress:saved', () => {
146
- //console.log('EditAddress:saved received')
147
- this.getAddresses()
153
+ eventBus.on('EditAddress:saved', () => {
154
+ getAddresses()
155
+ })
148
156
  })
157
+
158
+ return {
159
+ addressRepository,
160
+ addresses,
161
+ addressData,
162
+ validationErrors,
163
+ showEditAddressDialog,
164
+ getAddresses,
165
+ addAddress,
166
+ editAddress,
167
+ saveAddress
168
+ }
149
169
  }
150
170
  }
151
171
  </script>