@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
@@ -21,7 +21,7 @@
21
21
  v-digitsonly
22
22
  />
23
23
  </div>
24
- <b-slider :value="rangeInputValue" :min="min" :max="max" :step="step" @change="sliderInput" rounded />
24
+ <b-slider v-model="rangeInputValue" :min="min" :max="max" :step="step" @change="sliderInput" rounded />
25
25
  <button v-if="showApplyButton" class="button is-small" @click="applyRange">{{ $t('global.applyRange') }}</button>
26
26
  </div>
27
27
  </template>
@@ -29,8 +29,10 @@
29
29
  <script>
30
30
  export default {
31
31
  name: 'RangeInput',
32
+
33
+ // Vue 3: modelValue instead of value for v-model
32
34
  props: {
33
- value: {
35
+ modelValue: {
34
36
  type: Array,
35
37
  default: function () {
36
38
  return ['', '']
@@ -55,6 +57,9 @@ export default {
55
57
  }
56
58
  },
57
59
 
60
+ // Vue 3: Declare emitted events
61
+ emits: ['update:modelValue', 'applyRange'],
62
+
58
63
  data() {
59
64
  return {
60
65
  rangeInputValue: ['', '']
@@ -102,13 +107,15 @@ export default {
102
107
 
103
108
  //console.log('emitting range text input', selectedIndex, val)
104
109
  this.rangeInputValue = tSelected
105
- this.$emit('input', tSelected)
110
+ // Vue 3: emit update:modelValue
111
+ this.$emit('update:modelValue', tSelected)
106
112
  },
107
113
 
108
114
  sliderInput(val) {
109
- //console.log('RangeInput sliderInput', val, this.value)
115
+ //console.log('RangeInput sliderInput', val, this.modelValue)
110
116
  this.rangeInputValue = val
111
- this.$emit('input', val)
117
+ // Vue 3: emit update:modelValue
118
+ this.$emit('update:modelValue', val)
112
119
  },
113
120
 
114
121
  applyRange() {
@@ -123,10 +130,10 @@ export default {
123
130
  },
124
131
 
125
132
  mounted() {
126
- if (this.value.length === 2) {
127
- this.rangeInputValue = [this.value[0], this.value[1]]
133
+ if (this.modelValue.length === 2) {
134
+ this.rangeInputValue = [this.modelValue[0], this.modelValue[1]]
128
135
  }
129
- //console.log('riv', this.rangeInputValue, this.value)
136
+ //console.log('riv', this.rangeInputValue, this.modelValue)
130
137
  }
131
138
  }
132
139
  </script>
@@ -6,6 +6,11 @@
6
6
  export default {
7
7
  name: 'Recaptcha',
8
8
  props: {
9
+ modelValue: {
10
+ type: String,
11
+ required: false,
12
+ default: ''
13
+ },
9
14
  action: {
10
15
  type: String,
11
16
  required: false,
@@ -33,6 +38,8 @@ export default {
33
38
  }
34
39
  },
35
40
 
41
+ emits: ['update:modelValue'],
42
+
36
43
  data() {
37
44
  return {
38
45
  captchaId: null
@@ -86,7 +93,7 @@ export default {
86
93
  recaptchaExecute() {
87
94
  try {
88
95
  window.grecaptcha.execute(this.siteKey, { action: this.action }).then(token => {
89
- this.$emit('input', token)
96
+ this.$emit('update:modelValue', token)
90
97
  })
91
98
  } catch (e) {
92
99
  console.log('RecaptchaError: ', e.toString())
@@ -13,10 +13,10 @@
13
13
  :keep-first="true"
14
14
  :open-on-focus="true"
15
15
  :data="filteredCountry"
16
- @typing="() => (this.error = false)"
16
+ @typing="() => (error = false)"
17
17
  @select="onSelectCountry($event)"
18
18
  >
19
- <template slot="empty">No results found</template>
19
+ <template #empty>No results found</template>
20
20
  </b-autocomplete>
21
21
  </b-field>
22
22
  <div style="margin-top: 1.5rem">
@@ -25,72 +25,91 @@
25
25
  </div>
26
26
  </template>
27
27
 
28
- <script>
28
+ <script setup>
29
+ import { ref, computed, onMounted } from 'vue'
30
+ import { useBuefy } from '../composables/globals'
29
31
  import config from '../config'
30
- import { request, Countries} from '../api'
32
+ import { request, Countries } from '../api'
31
33
 
32
- export default {
33
- name: 'SelectShippingCountry',
34
+ const buefy = useBuefy()
34
35
 
35
- data() {
36
- return {
37
- countries: [],
38
- selectedCountryLabel: '',
39
- selected: null,
40
- error: false
41
- }
42
- },
43
- computed: {
44
- filteredCountry() {
45
- if (!this.selectedCountryLabel) {
46
- this.selectedState = null
47
- this.selectedStateLabel = ''
48
- return this.countries //.slice(0, 50)
49
- }
50
- return this.countries
51
- .filter((option) => {
52
- //console.log('filter opt ', option.name.toString().toLowerCase())
53
- return option.name.toString().toLowerCase().indexOf(this.selectedCountryLabel.toLowerCase()) >= 0
54
- })
55
- .slice(0, 5)
56
- }
57
- },
58
- methods: {
59
- changeCountry() {
60
- if (!this.selectedCountryLabel) {
61
- this.error = true
36
+ const countries = ref([])
37
+ const selectedCountryLabel = ref('')
38
+ const selected = ref(null)
39
+ const error = ref(false)
40
+ const container = ref(null)
41
+
42
+ const filteredCountry = computed(() => {
43
+ if (!Array.isArray(countries.value)) {
44
+ return []
45
+ }
46
+ if (!selectedCountryLabel.value) {
47
+ return countries.value
48
+ }
49
+ return countries.value
50
+ .filter((option) => {
51
+ return option.name
52
+ .toString()
53
+ .toLowerCase()
54
+ .indexOf(selectedCountryLabel.value.toLowerCase()) >= 0
55
+ })
56
+ .slice(0, 5)
57
+ })
58
+
59
+ // Methods
60
+ const onSelectCountry = (selectedCountry) => {
61
+ if(!selectedCountry) return
62
+ error.value = false
63
+ selected.value = selectedCountry
64
+ selectedCountryLabel.value = selectedCountry.name
65
+ }
66
+
67
+ const changeCountry = () => {
68
+ if (!selectedCountryLabel.value) {
69
+ error.value = true
70
+ } else {
71
+ error.value = false
72
+ request({
73
+ baseURL: config.BASE_URL,
74
+ url: '/country/' + selected.value.iso,
75
+ method: 'post',
76
+ data: {}
77
+ }).then((response) => {
78
+ if (response.data.status === 'redirect') {
79
+ window.location.href = response.data.url
62
80
  } else {
63
- this.error = false
64
- //_post('/country/'+this.selected.iso, {}, () => window.location.reload())
65
- request({
66
- baseURL: config.BASE_URL,
67
- url: '/country/' + this.selected.iso,
68
- method: 'post',
69
- data: {}
70
- }).then((response) => {
71
- if (response.data.status === 'redirect') {
72
- window.location.href = response.data.url
73
- } else {
74
- window.location.reload()
75
- }
76
- })
81
+ window.location.reload()
77
82
  }
78
- },
79
- onSelectCountry(selected) {
80
- this.error = false
81
- //console.log('selected', selected)
82
- this.selected = selected
83
- this.selectedCountryLabel = selected.name
84
- }
85
- },
86
-
87
- async mounted() {
88
- const loading = this.$buefy.loading.open({
89
- container: this.$refs.container
90
83
  })
91
- let countries = await Countries.get()
92
- loading.close()
93
- this.countries = countries.data
94
84
  }
95
85
  }
86
+
87
+ // Lifecycle
88
+ onMounted(async () => {
89
+ let loading = null
90
+ if (buefy && buefy.loading) {
91
+ loading = buefy.loading.open({
92
+ container: container.value
93
+ })
94
+ }
95
+ try {
96
+ const response = await Countries.get()
97
+ if (response && response.data) {
98
+ countries.value = response.data.data
99
+ }
100
+ console.log('Countries loaded:', countries.value)
101
+ } catch (err) {
102
+ console.error('Failed to load countries:', err)
103
+ // Provide fallback data in Storybook/error scenarios
104
+ countries.value = [
105
+ { id: 'CA', iso: 'CA', name: 'Canada' },
106
+ { id: 'US', iso: 'US', name: 'United States' },
107
+ { id: 'MX', iso: 'MX', name: 'Mexico' },
108
+ ]
109
+ } finally {
110
+ if (loading) {
111
+ loading.close()
112
+ }
113
+ }
114
+ })
96
115
  </script>
@@ -9,91 +9,76 @@
9
9
  </div>
10
10
  </template>
11
11
 
12
- <script>
12
+ <script setup>
13
+ import { ref, computed, onMounted } from 'vue'
14
+ import { useT } from '../composables/globals'
13
15
  import Cookie from 'js-cookie'
14
16
 
15
- export default {
16
- name: 'TimedOffer',
17
-
18
- props: {
19
- url: {
20
- type: String
21
- },
22
- linkText: {
23
- type: String
24
- },
25
- duration: {
26
- type: Number,
27
- default: 7200
28
- }
17
+ const props = defineProps({
18
+ url: {
19
+ type: String
29
20
  },
30
-
31
- data() {
32
- return {
33
- cookieName: '__timed_offer',
34
- offerInitialTime: 0,
35
- expireTime: 0,
36
- durationTime: 0
37
- }
21
+ linkText: {
22
+ type: String
38
23
  },
24
+ duration: {
25
+ type: Number,
26
+ default: 7200
27
+ }
28
+ })
39
29
 
40
- computed: {
41
- offerActive() {
42
- //console.log('oa', this.durationTime, this.duration, this.duration-this.durationTime)
43
- if (this.durationTime <= this.duration) {
44
- return true
45
- } else {
46
- return false
47
- }
48
- },
30
+ const { t } = useT()
49
31
 
50
- expireTimeHR() {
51
- return this.secondsToString(this.duration - this.durationTime)
52
- }
53
- },
32
+ const cookieName = ref('__timed_offer')
33
+ const offerInitialTime = ref(0)
34
+ const durationTime = ref(0)
54
35
 
55
- methods: {
56
- secondsToString(seconds) {
57
- let years = Math.floor(seconds / 31536000)
58
- let days = Math.floor((seconds % 31536000) / 86400)
59
- let hours = Math.floor(((seconds % 31536000) % 86400) / 3600)
60
- let minutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60)
61
- let nseconds = (((seconds % 31536000) % 86400) % 3600) % 60
36
+ const offerActive = computed(() => {
37
+ return durationTime.value <= props.duration
38
+ })
62
39
 
63
- let ret = nseconds + ' ' + this.$t('global.seconds')
64
- if (minutes > 0) {
65
- ret = minutes + ' ' + this.$t('global.minutes') + ' ' + ret
66
- }
67
- if (hours > 0) {
68
- ret = hours + ' ' + this.$t('global.hours') + ' ' + ret
69
- }
70
- if (days > 0) {
71
- ret = days + ' ' + this.$t('global.days') + ' ' + ret
72
- }
73
- if (years > 0) {
74
- ret = years + ' ' + this.$t('global.years') + ' ' + ret
75
- }
76
- return ret
77
- }
78
- },
40
+ const expireTimeHR = computed(() => {
41
+ return secondsToString(props.duration - durationTime.value)
42
+ })
79
43
 
80
- mounted() {
81
- this.offerInitialTime = Cookie.get(this.cookieName)
82
- if (!this.offerInitialTime) {
83
- this.offerInitialTime = new Date().getTime()
84
- Cookie.set(this.cookieName, this.offerInitialTime, { expires: 7 })
85
- } else {
86
- this.durationTime = Math.floor((new Date().getTime() - this.offerInitialTime) / 1000)
87
- }
88
- let toInterval = setInterval(() => {
89
- this.durationTime = Math.floor((new Date().getTime() - this.offerInitialTime) / 1000)
90
- //console.log('durationTime interval', this.durationTime, this.offerInitialTime)
91
- if (this.durationTime > this.duration) {
92
- clearInterval(toInterval)
93
- }
94
- }, 1000)
44
+ function secondsToString(seconds) {
45
+ let years = Math.floor(seconds / 31536000)
46
+ let days = Math.floor((seconds % 31536000) / 86400)
47
+ let hours = Math.floor(((seconds % 31536000) % 86400) / 3600)
48
+ let minutes = Math.floor((((seconds % 31536000) % 86400) % 3600) / 60)
49
+ let nseconds = (((seconds % 31536000) % 86400) % 3600) % 60
50
+
51
+ let ret = nseconds + ' ' + t('global.seconds')
52
+ if (minutes > 0) {
53
+ ret = minutes + ' ' + t('global.minutes') + ' ' + ret
54
+ }
55
+ if (hours > 0) {
56
+ ret = hours + ' ' + t('global.hours') + ' ' + ret
57
+ }
58
+ if (days > 0) {
59
+ ret = days + ' ' + t('global.days') + ' ' + ret
95
60
  }
61
+ if (years > 0) {
62
+ ret = years + ' ' + t('global.years') + ' ' + ret
63
+ }
64
+ return ret
96
65
  }
66
+
67
+ onMounted(() => {
68
+ offerInitialTime.value = Cookie.get(cookieName.value)
69
+ if (!offerInitialTime.value) {
70
+ offerInitialTime.value = new Date().getTime()
71
+ Cookie.set(cookieName.value, offerInitialTime.value, { expires: 7 })
72
+ } else {
73
+ durationTime.value = Math.floor((new Date().getTime() - offerInitialTime.value) / 1000)
74
+ }
75
+ let toInterval = setInterval(() => {
76
+ durationTime.value = Math.floor((new Date().getTime() - offerInitialTime.value) / 1000)
77
+ if (durationTime.value > props.duration) {
78
+ clearInterval(toInterval)
79
+ }
80
+ }, 1000)
81
+ })
97
82
  </script>
98
83
 
99
84
  <style scoped></style>
@@ -0,0 +1,53 @@
1
+ /**
2
+ * Access to the app-level services spmkt components rely on.
3
+ *
4
+ * The consuming app provides these as global properties (see install.js):
5
+ * $t / $tc translation functions (e.g. vue-i18n with globalInjection)
6
+ * initialState server-rendered page state (window.wkl_initial_state)
7
+ * $LC locale config ({ country_iso, currencySymbol, ... })
8
+ * $mq current breakpoint: 'mobile' | 'tablet' | 'desktop' (string or ref)
9
+ * installSpmkt itself provides $buefy (via Buefy) and the event bus.
10
+ *
11
+ * Use these inside setup() instead of inject('$x') or
12
+ * getCurrentInstance().appContext.config.globalProperties.$x.
13
+ */
14
+ import { computed, getCurrentInstance, unref } from 'vue'
15
+ import { eventBus } from '../utils/event-bus'
16
+
17
+ function globals() {
18
+ const instance = getCurrentInstance()
19
+ if (!instance) {
20
+ throw new Error('[spmkt] composables from composables/globals must be called inside setup()')
21
+ }
22
+ return instance.appContext.config.globalProperties
23
+ }
24
+
25
+ export function useBus() {
26
+ return eventBus
27
+ }
28
+
29
+ export function useT() {
30
+ const g = globals()
31
+ // Resolved on each call so a host that installs i18n after mounting still works
32
+ const t = (...args) => (g.$t ? g.$t(...args) : args[0])
33
+ const tc = (...args) => (g.$tc ? g.$tc(...args) : t(...args))
34
+ return { t, tc }
35
+ }
36
+
37
+ export function useBuefy() {
38
+ return globals().$buefy
39
+ }
40
+
41
+ export function useInitialState() {
42
+ return globals().initialState || {}
43
+ }
44
+
45
+ export function useLocale() {
46
+ const g = globals()
47
+ return g.$LC || g.initialState?.lc || {}
48
+ }
49
+
50
+ export function useMq() {
51
+ const g = globals()
52
+ return computed(() => unref(g.$mq) || 'desktop')
53
+ }
package/config.js CHANGED
@@ -1,13 +1,16 @@
1
1
  const is_production = process.env.NODE_ENV === 'production'
2
2
  const INITIAL_STATE = window.wkl_initial_state
3
3
 
4
+ // Treat Storybook as a local environment so MSW can intercept relative requests
5
+ const is_storybook = typeof window !== 'undefined' && window.location.port === '6006'
6
+
4
7
  let baseURL = ''
5
8
  if (window) {
6
9
  baseURL = window.location.protocol + '//' + window.location.host
7
10
  }
8
11
 
9
- const BASE_URL = is_production ? baseURL : 'https://camazon.test/'
10
- const API_URL = is_production ? baseURL + '/api' : 'https://camazon.test/api'
12
+ const BASE_URL = is_storybook ? '' : is_production ? baseURL : 'https://camazon.test/'
13
+ const API_URL = is_storybook ? '/api' : is_production ? baseURL + '/api' : 'https://camazon.test/api'
11
14
  const REQUEST_TIMEOUT = 30000
12
15
 
13
16
  export default {
package/index.js CHANGED
@@ -1,5 +1,24 @@
1
+ /**
2
+ * @wikala/spmkt - Vue 3 Ecommerce Components Library
3
+ *
4
+ * Migration from Vue 2 to Vue 3:
5
+ * - Vue.prototype.$bus replaced with mitt event bus
6
+ * - Vue.filter() replaced with $filters global property
7
+ * - Vue.extend() replaced with createApp/h pattern
8
+ * - Vuex 3 replaced with Vuex 4
9
+ */
10
+
1
11
  import { request } from './api'
2
12
 
13
+ // Vue 3 installation plugin
14
+ import { installSpmkt } from './install'
15
+
16
+ // Event bus utility
17
+ import { eventBus, EventBusPlugin } from './utils/event-bus'
18
+
19
+ // Filters utility
20
+ import { filters, formatMoney, formatNumber, round, hidecc, date, nl2p } from './utils/filters'
21
+
3
22
  import Address from './components/Address/Address' //t
4
23
  import AddressBook from './components/Address/AddressBook' //t
5
24
  import AddressSelect from './components/Address/AddressSelect' //t
@@ -23,15 +42,13 @@ import SelectShippingCountry from './components/SelectShippingCountry'
23
42
  import TimedOffer from './components/TimedOffer' //t
24
43
 
25
44
  import AccountDashboard from './components/Account/AccountDashboard' //t
26
- import AccountSettings from './components/Account/AccountSettings' //t
45
+ import AccountSettings from './components/Account/Settings/AccountSettings' //t
27
46
  import AccountStore from './components/Account/AccountStore'
28
- import ChangeEmail from './components/Account/ChangeEmail' //t
29
- import ChangeName from './components/Account/ChangeName' //t
30
- import ChangePassword from './components/Account/ChangePassword' //t
31
- import CreditCards from './components/Account/CreditCards'
32
- import OrderDetail from './components/Account/OrderDetail' //t
33
- import Orders from './components/Account/Orders' //t
34
- import Settings from './components/Account/Settings'
47
+ import ChangeEmail from './components/Account/Settings/ChangeEmail' //t
48
+ import ChangeName from './components/Account/Settings/ChangeName' //t
49
+ import ChangePassword from './components/Account/Settings/ChangePassword' //t
50
+ import OrderDetail from './components/Account/Orders/OrderDetail' //t
51
+ import Orders from './components/Account/Orders/Orders' //t
35
52
 
36
53
  import Login from './components/Auth/Login' //t
37
54
  import Register from './components/Auth/Register' //t
@@ -75,6 +92,22 @@ import ReviewImages from './components/Product/reviews-questions/ReviewImages'
75
92
  import Vote from './components/Product/reviews-questions/Vote'
76
93
 
77
94
  export {
95
+ // Vue 3 plugin installer
96
+ installSpmkt,
97
+
98
+ // Event bus for Vue 3
99
+ eventBus,
100
+ EventBusPlugin,
101
+
102
+ // Filter functions (use directly or via $filters)
103
+ filters,
104
+ formatMoney,
105
+ formatNumber,
106
+ round,
107
+ hidecc,
108
+ date,
109
+ nl2p,
110
+
78
111
  request,
79
112
  Address,
80
113
  EditAddress,
@@ -104,10 +137,8 @@ export {
104
137
  ChangeEmail,
105
138
  ChangeName,
106
139
  ChangePassword,
107
- CreditCards,
108
140
  OrderDetail,
109
141
  Orders,
110
- Settings,
111
142
 
112
143
  Login,
113
144
  Register,
package/install.js ADDED
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Vue 3 Installation Helper
3
+ *
4
+ * This file provides a plugin that configures all the necessary
5
+ * Vue 3 integrations for the @wikala/spmkt library.
6
+ *
7
+ * Usage in consuming application:
8
+ *
9
+ * ```javascript
10
+ * import { createApp } from 'vue'
11
+ * import { createStore } from 'vuex'
12
+ * import App from './App.vue'
13
+ * import { installSpmkt, CartStore } from '@wikala/spmkt'
14
+ *
15
+ * const app = createApp(App)
16
+ *
17
+ * // One root store per page: CartStore on the cart page, AccountStore on
18
+ * // the account page. Components read it at the root (mapState(['cart'])),
19
+ * // so don't nest these as modules of a combined store.
20
+ * app.use(createStore(CartStore))
21
+ * app.use(installSpmkt)
22
+ * app.mount('#app')
23
+ * ```
24
+ *
25
+ * The consuming app also provides these global properties
26
+ * (read by components through composables/globals.js):
27
+ * $t / $tc translations (e.g. vue-i18n with globalInjection)
28
+ * initialState the page's window.wkl_initial_state object
29
+ * $LC locale config ({ country_iso, currencySymbol, ... }),
30
+ * falls back to initialState.lc
31
+ * $mq 'mobile' | 'tablet' | 'desktop' as a string; for a reactive
32
+ * value use a getter returning ref.value (Options API
33
+ * components compare this.$mq directly)
34
+ *
35
+ * The Cart components also call these host helpers (globally mixed in or
36
+ * set as global properties) and use two host directives:
37
+ * getConfig(key), scrollToElement(selector), logMessage(message),
38
+ * getRecaptchaToken(), openModal(name, params), closeModal(),
39
+ * ageVerificationEnabled(), isMobileiOS
40
+ * v-sticky, v-mask
41
+ * See .storybook/preview.js for minimal stand-ins.
42
+ */
43
+
44
+ import { installBuefy } from './utils/buefy'
45
+ import { EventBusPlugin } from './utils/event-bus'
46
+ import registerDirectives from './utils/directives'
47
+ import registerFilters from './utils/filters'
48
+ import ModalContainerPlugin from './components/ModalContainer'
49
+ // window.customEventBus and window.GoogleAnalyticsEEC, which host scripts may use on
50
+ // pages whose components don't import them
51
+ import './utils/custom-event-bus'
52
+ import './utils/google/google-analytics-eec'
53
+
54
+ // window._post / window._get for the host's inline scripts. request.js (and axios) loads
55
+ // on the first call, so pages whose components make no API calls don't bundle it.
56
+ const lazyRequest = (name) => (...args) => {
57
+ import('./api/request').then((request) => request[name](...args))
58
+ return true
59
+ }
60
+
61
+ export const installSpmkt = {
62
+ install(app, options = {}) {
63
+ // Install the Buefy 3 components spmkt uses (see utils/buefy.js)
64
+ installBuefy(app, options.buefy)
65
+
66
+ // Install event bus ($bus)
67
+ app.use(EventBusPlugin)
68
+
69
+ // Install Modal Container ($modalContainer)
70
+ app.use(ModalContainerPlugin, options.modalContainer)
71
+
72
+ // Register custom directives
73
+ registerDirectives(app)
74
+
75
+ // Register global filters as $filters
76
+ registerFilters(app)
77
+
78
+ window._post = lazyRequest('_post')
79
+ window._get = lazyRequest('_get')
80
+
81
+ // Store config in global properties if provided
82
+ if (options.config) {
83
+ app.config.globalProperties.$spmktConfig = options.config
84
+ }
85
+ }
86
+ }
87
+
88
+ export default installSpmkt
package/locales/en.json CHANGED
@@ -33,7 +33,7 @@
33
33
  "resendConfirmation": "Resend confirmation",
34
34
  "savedNotification": "Your account data was updated successfully",
35
35
  "settings": "Settings",
36
- "yourAccount": "Your Choom Plus Account"
36
+ "yourAccount": "Your Account"
37
37
  },
38
38
  "address": {
39
39
  "add": "Add a new address",
@@ -47,6 +47,7 @@
47
47
  "city": "City/Town",
48
48
  "country": "Country",
49
49
  "findStreetAddress": "Find street address",
50
+ "autocompleteUnavailable": "Address search is unavailable. Please enter the address manually.",
50
51
  "firstName": "First Name",
51
52
  "isBusiness": "This is a business address",
52
53
  "lastName": "Last Name",