@wikala/spmkt 2.31.1 → 3.0.0-beta.1

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 (132) hide show
  1. package/MIGRATION_GUIDE.md +310 -0
  2. package/api/product.js +1 -0
  3. package/api/request.js +12 -6
  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/CreditCard/Everyware.vue +10 -10
  30. package/components/Cart/CreditCard/ExtendedCreditCard.vue +5 -5
  31. package/components/Cart/CreditCard/SquarePay.vue +18 -16
  32. package/components/Cart/CreditCard/StandardCreditCard.vue +9 -9
  33. package/components/Cart/Delivery/Delivery.vue +16 -12
  34. package/components/Cart/Delivery/DeliveryAddress.vue +1 -1
  35. package/components/Cart/Delivery/DeliveryMethods.vue +1 -1
  36. package/components/Cart/Delivery/DeliveryOptions.vue +15 -9
  37. package/components/Cart/Delivery/DeliveryTypes.vue +8 -5
  38. package/components/Cart/Delivery/ReservationSlots.vue +14 -8
  39. package/components/Cart/Disclaimer.vue +1 -1
  40. package/components/Cart/OrderConfirmation.vue +1 -1
  41. package/components/Cart/Payment/Payment.vue +37 -33
  42. package/components/Cart/Payment/PaymentMethods.vue +6 -4
  43. package/components/Cart/ReviewAndSubmit.vue +9 -7
  44. package/components/Cart/ShoppingCart.vue +42 -31
  45. package/components/Cart/Store/actions.js +1 -1
  46. package/components/Cart/Store/getters.js +2 -1
  47. package/components/Cart/Store/index.js +1 -1
  48. package/components/Cart/Store/mutations.js +9 -7
  49. package/components/Cart/Store/state.js +2 -2
  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 +24 -24
  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/MobileMenu/icons/LeftArrowIcon.vue +1 -1
  61. package/components/MobileMenu/icons/MenuIcon.vue +1 -1
  62. package/components/MobileMenu/icons/RightArrowIcon.vue +1 -1
  63. package/components/ModalContainer/ModalContainer.vue +20 -13
  64. package/components/ModalContainer/index.js +62 -18
  65. package/components/Product/AddToCart.vue +237 -221
  66. package/components/Product/BoxAddToCart.vue +114 -86
  67. package/components/Product/Compare.vue +91 -49
  68. package/components/Product/CompareBox.vue +128 -123
  69. package/components/Product/Lookup.vue +92 -65
  70. package/components/Product/Photo.vue +105 -66
  71. package/components/Product/Price.vue +64 -43
  72. package/components/Product/ProductAutocomplete.vue +52 -57
  73. package/components/Product/ProductBox.vue +61 -38
  74. package/components/Product/ProductImages.vue +83 -86
  75. package/components/Product/Quantity.vue +115 -53
  76. package/components/Product/QuickView.vue +52 -45
  77. package/components/Product/RelatedProducts.vue +88 -23
  78. package/components/Product/SKU.vue +27 -8
  79. package/components/Product/Variants.vue +336 -342
  80. package/components/Product/reviews-questions/ProductQuestions.vue +226 -198
  81. package/components/Product/reviews-questions/ProductReviews.vue +122 -107
  82. package/components/Product/reviews-questions/Review.vue +54 -59
  83. package/components/Product/reviews-questions/ReviewForm.vue +222 -170
  84. package/components/Product/reviews-questions/ReviewImages.vue +197 -216
  85. package/components/Product/reviews-questions/Vote.vue +83 -57
  86. package/components/QuantityInput.vue +18 -8
  87. package/components/RangeInput.vue +15 -8
  88. package/components/Recaptcha.vue +8 -1
  89. package/components/SelectShippingCountry.vue +81 -62
  90. package/components/TimedOffer.vue +59 -74
  91. package/composables/globals.js +53 -0
  92. package/config.js +5 -2
  93. package/index.js +41 -10
  94. package/install.js +88 -0
  95. package/locales/en.json +2 -1
  96. package/locales/sr.json +2 -1
  97. package/package.json +49 -37
  98. package/utils/animate.css +50 -0
  99. package/utils/animate.js +1 -1
  100. package/utils/buefy.js +62 -0
  101. package/utils/directives.js +28 -45
  102. package/utils/event-bus.js +56 -0
  103. package/utils/filters.js +24 -7
  104. package/utils/format-date.js +17 -0
  105. package/utils/{gmaps.js → google/gmaps.js} +43 -10
  106. package/utils/{google-analytics-eec.js → google/google-analytics-eec.js} +7 -7
  107. package/utils/random-id.js +10 -0
  108. package/babel.config.js +0 -5
  109. package/components/Account/ChangeEmail.vue +0 -133
  110. package/components/Account/ChangeName.vue +0 -92
  111. package/components/Account/ChangePassword.vue +0 -94
  112. package/components/Account/CreditCards.vue +0 -18
  113. package/components/Account/Orders.vue +0 -110
  114. package/components/Account/Settings.vue +0 -18
  115. package/components/Cart/Delivery/DeliveryAddressGuest.spec.js +0 -128
  116. package/components/Cart/Delivery/DeliveryTypes.spec.js +0 -83
  117. package/components/Cart/PCIBadge/SecurityMetrics.vue +0 -11
  118. package/components/Instagram.vue +0 -49
  119. package/components/ProductImageModal.vue +0 -41
  120. package/jest.config.js +0 -16
  121. package/test/e2e/.babelrc.js +0 -8
  122. package/test/e2e/.eslintrc.js +0 -11
  123. package/test/e2e/accAuth.spec.js +0 -64
  124. package/test/e2e/ageGate.spec.js +0 -26
  125. package/test/e2e/checkout.spec.js +0 -106
  126. package/test/e2e/compare.spec.js +0 -52
  127. package/test/e2e/config/data.js +0 -21
  128. package/test/e2e/config/routes.js +0 -11
  129. package/test/e2e/region.spec.js +0 -46
  130. package/test/e2e/search.spec.js +0 -32
  131. package/tests/vueBuefy.js +0 -4
  132. package/tsconfig.json +0 -8
@@ -2,63 +2,125 @@
2
2
  <div class="quantity">
3
3
  <span class="quantity-label">{{ $t('global.quantity') }}</span>
4
4
  <div class="quantity-input">
5
- <button @click="decrease"><i class="fal fa-minus"></i></button>
6
- <input type="tel" @input="qtyInput" :value="value" />
7
- <button @click="increase"><i class="fal fa-plus"></i></button>
5
+ <button @click="decrease"><i class="fa fa-minus"></i></button>
6
+ <input type="tel" @input="qtyInput" :value="modelValue" />
7
+ <button @click="increase"><i class="fa fa-plus"></i></button>
8
8
  </div>
9
9
  </div>
10
10
  </template>
11
11
 
12
- <script>
13
- export default {
14
- name: 'Quantity',
15
- props: {
16
- value: {
17
- type: [Number, String],
18
- default: 1
19
- }
20
- },
21
- methods: {
22
- decrease() {
23
- let val = 0;
24
- if(this.value !== '') {
25
- val = this.value;
26
- }
27
- if (val >= 2) {
28
- this.$emit('input', val - 1)
29
- } else {
30
- this.$emit('input', 1)
31
- }
32
- },
33
- increase() {
34
- let val = 0;
35
- if(this.value !== '') {
36
- val = this.value;
37
- }
38
- this.$emit('input', val + 1)
39
- },
40
- qtyInput(event) {
41
- if(event.target.value.trim() === '') {
42
- this.$emit('input', '')
43
- return
44
- }
45
- let val = parseInt(event.target.value, 10)
46
- if (isNaN(val)) {
47
- event.target.value = 1
48
- this.value !== 1 && this.$emit('input', 1)
49
- return
50
- }
51
- if (val < 0) {
52
- event.target.value = 0
53
- this.value !== 0 && this.$emit('input', 0)
54
- } else if (val > 99) {
55
- event.target.value = 99
56
- this.value !== 0 && this.$emit('input', 99)
57
- } else {
58
- event.target.value = val
59
- this.value !== val && this.$emit('input', val)
60
- }
61
- }
12
+ <script setup>
13
+
14
+ defineOptions({ name: 'Quantity' })
15
+
16
+ const props = defineProps({
17
+ modelValue: {
18
+ type: [Number, String],
19
+ default: 1
20
+ }
21
+ })
22
+
23
+ const emit = defineEmits(['update:modelValue'])
24
+
25
+ const decrease = () => {
26
+ let val = 0
27
+ if (props.modelValue !== '') {
28
+ val = props.modelValue
29
+ }
30
+ if (val >= 2) {
31
+ emit('update:modelValue', val - 1)
32
+ } else {
33
+ emit('update:modelValue', 1)
34
+ }
35
+ }
36
+
37
+ const increase = () => {
38
+ let val = 0
39
+ if (props.modelValue !== '') {
40
+ val = props.modelValue
41
+ }
42
+ emit('update:modelValue', val + 1)
43
+ }
44
+
45
+ const qtyInput = (event) => {
46
+ if (event.target.value.trim() === '') {
47
+ emit('update:modelValue', '')
48
+ return
49
+ }
50
+ let val = parseInt(event.target.value, 10)
51
+ if (isNaN(val)) {
52
+ event.target.value = 1
53
+ props.modelValue !== 1 && emit('update:modelValue', 1)
54
+ return
55
+ }
56
+ if (val < 0) {
57
+ event.target.value = 0
58
+ props.modelValue !== 0 && emit('update:modelValue', 0)
59
+ } else if (val > 99) {
60
+ event.target.value = 99
61
+ props.modelValue !== 0 && emit('update:modelValue', 99)
62
+ } else {
63
+ event.target.value = val
64
+ props.modelValue !== val && emit('update:modelValue', val)
62
65
  }
63
66
  }
64
67
  </script>
68
+
69
+ <style scoped>
70
+ .quantity {
71
+ display: flex;
72
+ align-items: center;
73
+ gap: 0.5rem;
74
+ }
75
+
76
+ .quantity-label {
77
+ font-weight: 500;
78
+ }
79
+
80
+ .quantity-input {
81
+ display: flex;
82
+ align-items: center;
83
+ border: 1px solid #dbdbdb;
84
+ border-radius: 4px;
85
+ overflow: hidden;
86
+ }
87
+
88
+ .quantity-input button {
89
+ background: #f5f5f5;
90
+ border: none;
91
+ padding: 0.5rem 0.75rem;
92
+ cursor: pointer;
93
+ transition: background-color 0.2s;
94
+ display: flex;
95
+ align-items: center;
96
+ justify-content: center;
97
+ }
98
+
99
+ .quantity-input button:hover {
100
+ background: #e8e8e8;
101
+ }
102
+
103
+ .quantity-input button:active {
104
+ background: #d8d8d8;
105
+ }
106
+
107
+ .quantity-input input {
108
+ border: none;
109
+ width: 60px;
110
+ text-align: center;
111
+ padding: 0.5rem;
112
+ font-size: 1rem;
113
+ appearance: textfield;
114
+ -moz-appearance: textfield;
115
+ }
116
+
117
+ .quantity-input input::-webkit-outer-spin-button,
118
+ .quantity-input input::-webkit-inner-spin-button {
119
+ -webkit-appearance: none;
120
+ margin: 0;
121
+ }
122
+
123
+ .quantity-input input:focus {
124
+ outline: none;
125
+ }
126
+ </style>
@@ -1,6 +1,6 @@
1
1
  <template>
2
2
  <div>
3
- <b-modal :can-cancel="true" :active="showModal" @close="close" custom-class="wkl-modal-container quick-view-modal">
3
+ <b-modal :can-cancel="true" v-model="showModal" @close="close" custom-class="wkl-modal-container quick-view-modal">
4
4
  <div
5
5
  ref="qvModal"
6
6
  :class="['quick-view-main', 'product-main', 'product-container', { 'is-flower': product.class === 'flower' }]"
@@ -84,55 +84,62 @@
84
84
  </div>
85
85
  </template>
86
86
 
87
- <script>
87
+ <script setup>
88
+ import { ref, onMounted, onBeforeUnmount } from 'vue'
89
+ import { useInitialState } from '../../composables/globals'
88
90
  import config from '../../config'
89
91
  import { request } from '../../api'
92
+ import { eventBus } from '../../utils/event-bus'
90
93
 
91
- import AddToCart from '../../components/Product/AddToCart'
92
- import Price from '../../components/Product/Price'
93
- import ProductImages from '../../components/Product/ProductImages'
94
- import Variants from '../../components/Product/Variants'
95
-
96
- export default {
97
- name: 'QuickView',
98
- components: { AddToCart, Price, ProductImages, Variants },
99
-
100
- data() {
101
- return {
102
- showModal: false,
103
- isLoading: false,
104
- product: {},
105
- variant_id: null,
106
- meta: {}
107
- }
108
- },
109
-
110
- methods: {
111
- close() {
112
- this.$set(this, 'product', {})
113
- this.$set(this, 'meta', {})
114
- this.showModal = false
115
- }
116
- },
117
-
118
- mounted() {
119
- this.$bus.$on('quickView', async (product_id, variant_id) => {
120
- this.showModal = true
121
- this.isLoading = true
122
- if(variant_id) {
123
- this.variant_id = variant_id
124
- }
125
- let resp = await request({
126
- baseURL: config.BASE_URL,
127
- url: '/products/' + product_id
128
- })
129
- this.isLoading = false
130
- this.$set(this, 'product', resp.data.product_resource)
131
- this.product = resp.data.product_resource
132
- this.meta = resp.data.meta
133
- })
94
+ import AddToCart from './AddToCart.vue'
95
+ import Price from './Price.vue'
96
+ import ProductImages from './ProductImages.vue'
97
+ import Variants from './Variants.vue'
98
+
99
+ defineOptions({ name: 'QuickView' })
100
+
101
+ const initialState = useInitialState()
102
+
103
+ // Template refs
104
+ const qvModal = ref(null)
105
+
106
+ // Reactive state
107
+ const showModal = ref(false)
108
+ const isLoading = ref(false)
109
+ const product = ref({})
110
+ const variant_id = ref(null)
111
+ const meta = ref({})
112
+
113
+ // Methods
114
+ const close = () => {
115
+ product.value = {}
116
+ meta.value = {}
117
+ showModal.value = false
118
+ }
119
+
120
+ const handleQuickView = async (product_id, vid) => {
121
+ showModal.value = true
122
+ isLoading.value = true
123
+ if (vid) {
124
+ variant_id.value = vid
134
125
  }
126
+ let resp = await request({
127
+ baseURL: config.BASE_URL,
128
+ url: '/products/' + product_id
129
+ })
130
+ isLoading.value = false
131
+ product.value = resp.data.product_resource
132
+ meta.value = resp.data.meta
135
133
  }
134
+
135
+ // Lifecycle hooks
136
+ onMounted(() => {
137
+ eventBus.on('quickView', handleQuickView)
138
+ })
139
+
140
+ onBeforeUnmount(() => {
141
+ eventBus.off('quickView', handleQuickView)
142
+ })
136
143
  </script>
137
144
 
138
145
  <style scoped></style>
@@ -1,39 +1,104 @@
1
1
  <template>
2
2
  <div class="related-products">
3
- <!--div v-if="!showRelated" class="has-text-centered">
4
- <button class="button" @click="showRelated = true">Load More</button>
5
- </div-->
6
-
7
3
  <div v-if="showRelated" class="columns is-mobile is-multiline">
8
- <ProductBox v-for="product in products" :key="product.id" :product="product" grid="column is-2-desktop is-half-mobile" />
4
+ <ProductBox
5
+ v-for="product in products"
6
+ :key="product.id"
7
+ :product="product"
8
+ grid="column is-2-desktop is-half-mobile"
9
+ />
9
10
  </div>
10
11
  </div>
11
12
  </template>
12
13
 
13
- <script>
14
+ <script setup>
15
+ import { computed, onMounted, ref, watch } from 'vue'
16
+ import { Product } from '../../api'
17
+ import ProductBox from './ProductBox.vue'
14
18
 
15
- import { Product } from '../../api'
16
- import ProductBox from './ProductBox'
19
+ defineOptions({ name: 'RelatedProducts' })
17
20
 
18
- export default {
19
- name: 'RelatedProducts',
21
+ const props = defineProps({
22
+ productId: {
23
+ type: [Number, String],
24
+ default: null
25
+ },
26
+ relatedIds: {
27
+ type: Array,
28
+ default: () => []
29
+ },
30
+ initialProducts: {
31
+ type: Array,
32
+ default: () => []
33
+ },
34
+ autoLoad: {
35
+ type: Boolean,
36
+ default: true
37
+ }
38
+ })
20
39
 
21
- components: { ProductBox },
40
+ const products = ref([...(props.initialProducts || [])])
41
+ const showRelated = ref(products.value.length > 0)
42
+ const isLoading = ref(false)
22
43
 
23
- data() {
24
- return {
25
- products: [],
26
- showRelated: false
27
- }
28
- },
44
+ const resolvedProductId = computed(() => {
45
+ if (props.productId !== null && props.productId !== undefined) {
46
+ return props.productId
47
+ }
48
+ if (typeof window !== 'undefined' && window.wkl_product?.id) {
49
+ return window.wkl_product.id
50
+ }
51
+ return null
52
+ })
29
53
 
30
- async mounted() {
31
- const products = await Product.relatedProducts(window.wkl_product.id, {
32
- relatedIds: window.wkl_product.relatedIds
54
+ const resolvedRelatedIds = computed(() => {
55
+ if (props.relatedIds && props.relatedIds.length) {
56
+ return props.relatedIds
57
+ }
58
+ if (typeof window !== 'undefined' && Array.isArray(window.wkl_product?.relatedIds)) {
59
+ return window.wkl_product.relatedIds
60
+ }
61
+ return []
62
+ })
63
+
64
+ async function loadRelatedProducts() {
65
+ if (!resolvedProductId.value || isLoading.value) {
66
+ return
67
+ }
68
+ isLoading.value = true
69
+ try {
70
+ const response = await Product.relatedProducts(resolvedProductId.value, {
71
+ relatedIds: resolvedRelatedIds.value
33
72
  })
34
- if(products.data?.data) {
35
- this.products = products.data.data
36
- }
73
+ const payload = Array.isArray(response?.data?.data) ? response.data.data : []
74
+ products.value = payload
75
+ showRelated.value = products.value.length > 0
76
+ } catch (error) {
77
+ console.error('Failed to load related products', error)
78
+ products.value = []
79
+ showRelated.value = false
80
+ } finally {
81
+ isLoading.value = false
37
82
  }
38
83
  }
84
+
85
+ onMounted(() => {
86
+ if (props.autoLoad && !products.value.length) {
87
+ loadRelatedProducts()
88
+ } else if (products.value.length) {
89
+ showRelated.value = true
90
+ }
91
+ })
92
+
93
+ watch([resolvedProductId, resolvedRelatedIds], () => {
94
+ if (props.autoLoad) {
95
+ loadRelatedProducts()
96
+ }
97
+ }, { deep: true })
98
+
99
+ watch(() => props.initialProducts, (nextProducts) => {
100
+ const incoming = Array.isArray(nextProducts) ? nextProducts : []
101
+ products.value = [...incoming]
102
+ showRelated.value = products.value.length > 0
103
+ }, { deep: true })
39
104
  </script>
@@ -1,27 +1,46 @@
1
1
  <template>
2
- <span v-if="value !== '-' && value !== ''">
3
- <span class="sku-label">{{label}}</span>
4
- <span class="sku-val">{{value}}</span>
2
+ <span v-if="modelValue !== '-' && modelValue !== ''">
3
+ <span class="sku-label">{{ label }}</span>
4
+ <span class="sku-val">{{ modelValue }}</span>
5
5
  </span>
6
6
  </template>
7
7
 
8
8
  <script>
9
+ import { onMounted, onBeforeUnmount } from 'vue'
10
+ import { useBus } from '../../composables/globals'
11
+
9
12
  export default {
10
- name: 'sku',
13
+ name: 'SKU',
14
+
11
15
  props: {
12
16
  label: {
13
17
  type: String,
14
18
  default: 'SKU:'
15
19
  },
16
- value: {
20
+ modelValue: {
17
21
  type: [String, Number],
18
22
  default: '-'
19
23
  }
20
24
  },
21
- mounted() {
22
- this.$bus.$on('updateSKU', (sku) => {
23
- this.$emit('input', sku)
25
+
26
+ emits: ['update:modelValue'],
27
+
28
+ setup(props, { emit }) {
29
+ const eventBus = useBus()
30
+
31
+ const handleUpdateSKU = (sku) => {
32
+ emit('update:modelValue', sku)
33
+ }
34
+
35
+ onMounted(() => {
36
+ eventBus.on('updateSKU', handleUpdateSKU)
37
+ })
38
+
39
+ onBeforeUnmount(() => {
40
+ eventBus.off('updateSKU', handleUpdateSKU)
24
41
  })
42
+
43
+ return {}
25
44
  }
26
45
  }
27
46
  </script>