@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
@@ -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>