@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
package/package.json CHANGED
@@ -1,60 +1,73 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.31.0",
3
+ "version": "3.0.0-beta.0",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
+ "type": "module",
6
7
  "scripts": {
7
- "serve": "vue-cli-service serve",
8
- "build": "vue-cli-service build --target lib --name @wikala/spmkt ./index.js",
9
- "test:unit": "vue-cli-service test:unit",
10
- "lint": "vue-cli-service lint"
8
+ "build": "vite build --mode lib",
9
+ "storybook": "storybook dev -p 6006",
10
+ "build-storybook": "storybook build"
11
11
  },
12
12
  "main": "index.js",
13
+ "files": [
14
+ "index.js",
15
+ "install.js",
16
+ "api.js",
17
+ "config.js",
18
+ "translations.js",
19
+ "api",
20
+ "components",
21
+ "composables",
22
+ "locales",
23
+ "utils",
24
+ "MIGRATION_GUIDE.md"
25
+ ],
13
26
  "dependencies": {
14
27
  "@googlemaps/js-api-loader": "^1.12.2",
15
28
  "animate.css": "^4.1.1",
16
- "buefy": "^0.9.10",
29
+ "axios": "^1.20.0",
17
30
  "bulma-divider": "^0.2.0",
18
- "core-js": "^3.17.2",
19
31
  "currency.js": "^2.0.4",
20
32
  "embedo": "^1.14.0",
21
33
  "intl-dateformat": "^0.1.4",
22
34
  "js-cookie": "^3.0.1",
35
+ "mitt": "^3.0.1",
23
36
  "scrollmonitor": "^1.2.4",
24
37
  "shortid": "^2.2.16",
25
38
  "underscore": "^1.13.1",
26
- "vue-mq": "^1.0.1",
27
- "vuex": "^3.6.2"
39
+ "vue3-mq": "^3.1.3"
28
40
  },
29
41
  "devDependencies": {
30
- "@babel/plugin-proposal-optional-chaining": "^7.14.5",
31
- "@vue/cli-plugin-babel": "^4.5.13",
32
- "@vue/cli-plugin-unit-jest": "~4.5.11",
33
- "@vue/cli-service": "^4.5.13",
34
- "@vue/runtime-dom": "^3.3.8",
35
- "@vue/test-utils": "^1.3.6",
36
- "axios": "^0.21.1",
37
- "babel-plugin-transform-es2015-modules-commonjs": "^6.26.2",
38
- "bootstrap-sass": "^3.4.1",
39
- "browser-sync": "^2.26.14",
40
- "browser-sync-webpack-plugin": "^2.3.0",
41
- "cross-env": "^7.0.3",
42
- "faker": "^5.5.3",
43
- "path-override-webpack-plugin": "^0.1.2",
42
+ "@storybook/addon-docs": "^10.1.11",
43
+ "@storybook/addon-links": "^10.1.11",
44
+ "@storybook/vue3-vite": "^10.1.11",
45
+ "@vitejs/plugin-vue": "^5.2.0",
46
+ "@vue/test-utils": "^2.4.3",
47
+ "buefy": "^3.0.3",
48
+ "msw": "2.12.7",
44
49
  "prettier": "^2.3.1",
45
50
  "pretty-quick": "^3.1.0",
46
51
  "sass": "^1.39.0",
47
- "sass-loader": "^10.1.1",
48
- "scss": "^0.2.4",
49
- "vue": "^2.6.14",
50
- "vue-cli-plugin-jest-puppeteer": "^0.1.5",
51
- "vue-template-compiler": "^2.6.14",
52
- "webpack": "^4.46.0",
53
- "webpack-cli": "^3.3.12"
52
+ "storybook": "^10.1.11",
53
+ "vite": "^6.0.0",
54
+ "vitest": "^4.1.11",
55
+ "vue": "^3.4.0",
56
+ "vuex": "^4.1.0"
57
+ },
58
+ "peerDependencies": {
59
+ "vue": "^3.4.0",
60
+ "vuex": "^4.1.0",
61
+ "buefy": "^3.0.3"
54
62
  },
55
63
  "husky": {
56
64
  "hooks": {
57
65
  "pre-commit": "pretty-quick --staged"
58
66
  }
67
+ },
68
+ "msw": {
69
+ "workerDirectory": [
70
+ "public"
71
+ ]
59
72
  }
60
73
  }
@@ -1,5 +1,18 @@
1
+ /**
2
+ * Vue 3 Custom Directives
3
+ *
4
+ * Vue 3 directive lifecycle hooks:
5
+ * - created (new)
6
+ * - beforeMount (was: bind)
7
+ * - mounted (was: inserted)
8
+ * - beforeUpdate (new)
9
+ * - updated (was: componentUpdated)
10
+ * - beforeUnmount (new)
11
+ * - unmounted (was: unbind)
12
+ */
13
+
1
14
  const digitsonly = {
2
- inserted: function (el, binding, vNode) {
15
+ mounted: function (el, binding, vNode) {
3
16
  let innerInputs = el.getElementsByTagName('input')
4
17
  if (innerInputs && innerInputs[0]) {
5
18
  el = innerInputs[0]
@@ -10,30 +23,28 @@ const digitsonly = {
10
23
  if (/[a-zA-Z]+/gi.test(e.target.value)) {
11
24
  let newValue = e.target.value.replace(/[a-zA-Z]+/gi, '')
12
25
  e.target.value = newValue
13
- if (vNode.componentInstance) {
14
- //console.log('is component instance')
15
- vNode.componentInstance.$emit('input', newValue)
16
- } else {
17
- //console.log('is NOT component instance')
18
- vNode.elm.dispatchEvent(new CustomEvent('input'))
19
- }
26
+ // Vue 3: use el directly, vNode structure is different
27
+ el.dispatchEvent(new CustomEvent('input', { detail: newValue }))
20
28
  }
21
29
  }
22
30
  }
23
31
  el.addEventListener('input', handler)
32
+ // Store handler for cleanup
33
+ el.__digitsOnlyHandler__ = handler
34
+ },
35
+ unmounted: function (el) {
36
+ if (el.__digitsOnlyHandler__) {
37
+ el.removeEventListener('input', el.__digitsOnlyHandler__)
38
+ el.__digitsOnlyHandler__ = null
39
+ }
24
40
  }
25
41
  }
26
42
 
27
43
  const clickoutside = {
28
- bind: function (el, binding, vNode) {
44
+ beforeMount: function (el, binding, vNode) {
29
45
  // Provided expression must evaluate to a function.
30
46
  if (typeof binding.value !== 'function') {
31
- const compName = vNode.context.name
32
47
  let warn = `[Vue-click-outside:] provided expression '${binding.expression}' is not a function, but has to be`
33
- if (compName) {
34
- warn += `Found in component '${compName}'`
35
- }
36
-
37
48
  console.warn(warn)
38
49
  }
39
50
  // Define Handler and cache it on the element
@@ -49,7 +60,7 @@ const clickoutside = {
49
60
  document.addEventListener('click', handler)
50
61
  },
51
62
 
52
- unbind: function (el, binding) {
63
+ unmounted: function (el, binding) {
53
64
  // Remove Event Listeners
54
65
  document.removeEventListener('click', el.__vueClickOutside__)
55
66
  el.__vueClickOutside__ = null
@@ -61,36 +72,8 @@ let directives = [
61
72
  { name: 'click-outside', value: clickoutside }
62
73
  ]
63
74
 
64
- export default function registerDirectives(vue) {
75
+ export default function registerDirectives(app) {
65
76
  directives.forEach((directive) => {
66
- vue.directive(directive.name, directive.value)
77
+ app.directive(directive.name, directive.value)
67
78
  })
68
79
  }
69
-
70
- /*
71
- Vue.directive('digitsonly', {
72
- inserted: function (el, binding, vNode) {
73
- let innerInputs = el.getElementsByTagName('input')
74
- if (innerInputs && innerInputs[0]) {
75
- el = innerInputs[0]
76
- }
77
-
78
- let handler = function (e) {
79
- if (e.target) {
80
- if (/[a-zA-Z]+/gi.test(e.target.value)) {
81
- let newValue = e.target.value.replace(/[a-zA-Z]+/gi, '')
82
- e.target.value = newValue
83
- if (vNode.componentInstance) {
84
- //console.log('is component instance')
85
- vNode.componentInstance.$emit('input', newValue)
86
- } else {
87
- //console.log('is NOT component instance')
88
- vNode.elm.dispatchEvent(new CustomEvent('input'))
89
- }
90
- }
91
- }
92
- }
93
- el.addEventListener('input', handler)
94
- }
95
- })
96
- */
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Event Bus for Vue 3
3
+ *
4
+ * Replaces Vue 2's $bus pattern (Vue.prototype.$bus = new Vue())
5
+ * with mitt - a tiny event emitter library.
6
+ *
7
+ * Usage:
8
+ * import { eventBus } from '@/utils/event-bus'
9
+ *
10
+ * // Emit event
11
+ * eventBus.emit('event-name', payload)
12
+ *
13
+ * // Listen to event
14
+ * eventBus.on('event-name', handler)
15
+ *
16
+ * // Remove listener
17
+ * eventBus.off('event-name', handler)
18
+ *
19
+ * // Listen once
20
+ * eventBus.once('event-name', handler)
21
+ */
22
+
23
+ import mitt from 'mitt'
24
+
25
+ const emitter = mitt()
26
+
27
+ // mitt passes a single payload to handlers; forward every argument instead,
28
+ // as Vue 2's $emit did (e.g. emit('updatePrice', price, comparePrice))
29
+ emitter.emit = (type, ...args) => {
30
+ ;(emitter.all.get(type) || []).slice().forEach((handler) => handler(...args))
31
+ ;(emitter.all.get('*') || []).slice().forEach((handler) => handler(type, ...args))
32
+ }
33
+
34
+ // Add a 'once' method for convenience (mitt doesn't have it built-in)
35
+ const originalOn = emitter.on.bind(emitter)
36
+ emitter.once = (type, handler) => {
37
+ const wrappedHandler = (...args) => {
38
+ handler(...args)
39
+ emitter.off(type, wrappedHandler)
40
+ }
41
+ originalOn(type, wrappedHandler)
42
+ }
43
+
44
+ export const eventBus = emitter
45
+
46
+ // Vue 3 plugin to install $bus globally
47
+ export const EventBusPlugin = {
48
+ install(app) {
49
+ app.config.globalProperties.$bus = eventBus
50
+
51
+ // Also provide for Composition API usage
52
+ app.provide('eventBus', eventBus)
53
+ }
54
+ }
55
+
56
+ export default eventBus
package/utils/filters.js CHANGED
@@ -1,3 +1,12 @@
1
+ /**
2
+ * Vue 3 Global Filters Migration
3
+ *
4
+ * Vue 3 removed Vue.filter(). These functions can be:
5
+ * 1. Imported and used directly in components
6
+ * 2. Registered as global properties via app.config.globalProperties
7
+ * 3. Used in templates with {{ $filters.filterName(value) }}
8
+ */
9
+
1
10
  import currency from 'currency.js'
2
11
  import config from '../config'
3
12
 
@@ -82,12 +91,20 @@ export const nl2p = function (str) {
82
91
  return '<p>' + str.split('\n\n').join('</p><p>') + '</p>'
83
92
  }
84
93
 
85
- let filters = [formatMoney, formatNumber, round, hidecc, date, nl2p]
94
+ // All filters as an object for Vue 3 global properties
95
+ export const filters = {
96
+ formatMoney,
97
+ formatNumber,
98
+ round,
99
+ hidecc,
100
+ date,
101
+ nl2p
102
+ }
86
103
 
87
- export default function registerFilters(vue) {
88
- filters.forEach((filter) => {
89
- if (typeof vue.filter === 'function') {
90
- vue.filter(filter.name, filter)
91
- }
92
- })
104
+ /**
105
+ * Vue 3 Plugin to register filters as global properties
106
+ * Usage in templates: {{ $filters.formatMoney(value) }}
107
+ */
108
+ export default function registerFilters(app) {
109
+ app.config.globalProperties.$filters = filters
93
110
  }
@@ -1,8 +1,7 @@
1
1
  import { Loader } from '@googlemaps/js-api-loader'
2
2
  import _ from 'underscore'
3
3
 
4
- const API_KEY = 'AIzaSyBiGg5anTzSl3KBp5pKg6g2wukIOcHz2CM'
5
-
4
+ let API_KEY = ''
6
5
  let MAP_OPTIONS = {
7
6
  center: {
8
7
  lat: 52.2019792,
@@ -13,6 +12,15 @@ let MAP_OPTIONS = {
13
12
  scrollwheel: false
14
13
  }
15
14
 
15
+ function configure(options) {
16
+ if (options.API_KEY) {
17
+ API_KEY = options.API_KEY
18
+ }
19
+ if (options.MAP_OPTIONS) {
20
+ MAP_OPTIONS = { ...MAP_OPTIONS, ...options.MAP_OPTIONS }
21
+ }
22
+ }
23
+
16
24
  function geocodeLatLng(latlng, map, address) {
17
25
  let geocoder = new google.maps.Geocoder()
18
26
  geocoder.geocode({ location: latlng }, (results, status) => {
@@ -78,6 +86,29 @@ function getAddressFromComponents(address, components) {
78
86
  return address
79
87
  }
80
88
 
89
+ let gmapsLoadingPromise = null
90
+ function ensureGmapsLoaded(apiKey) {
91
+ if (gmapsLoadingPromise) {
92
+ return gmapsLoadingPromise
93
+ }
94
+
95
+ if (window.google?.maps?.Map) {
96
+ return Promise.resolve()
97
+ }
98
+
99
+ const gmapsLoader = new Loader({
100
+ apiKey: apiKey || API_KEY,
101
+ version: 'weekly',
102
+ libraries: ['places', 'drawing'],
103
+ })
104
+
105
+ gmapsLoadingPromise = gmapsLoader.load().finally(() => {
106
+ gmapsLoadingPromise = null
107
+ })
108
+
109
+ return gmapsLoadingPromise
110
+ }
111
+
81
112
  async function load(vm, apiKey) {
82
113
  let gmapsLoader = new Loader({
83
114
  apiKey: apiKey ? apiKey : API_KEY,
@@ -93,12 +124,12 @@ async function load(vm, apiKey) {
93
124
  vm.loading = true
94
125
  vm.msg = 'Loading Google Maps...'
95
126
  try {
96
- await gmapsLoader.load()
127
+ await ensureGmapsLoaded(apiKey)
97
128
  vm.loading = false
98
129
  } catch (e) {
99
130
  vm.loaderFailed = true
100
131
  vm.msg = 'Cannot load Google Maps. Address and location coordinates input require Google Maps. Check your internet connection and try reloading page.'
101
- return false
132
+ console.error(e)
102
133
  }
103
134
  }
104
135
  }
@@ -222,15 +253,17 @@ function createMarker(map, lat, lng, color='red') {
222
253
  }
223
254
 
224
255
  export default {
225
- MAP_OPTIONS,
256
+ // A getter: configure() replaces the object, and components (GmapsLocations) set options on it
257
+ get MAP_OPTIONS() {
258
+ return MAP_OPTIONS
259
+ },
260
+ configure,
226
261
  createMarker,
262
+ findNearest,
227
263
  geocodeAddress,
228
264
  geocodeLatLng,
229
265
  getAddressComponent,
230
266
  getAddressFromComponents,
231
- getShapeGeoJSON,
232
- getPolygonBounds,
233
- findClosestMarker,
234
- findNearest,
235
- load
267
+ load,
268
+ ensureGmapsLoaded,
236
269
  }
@@ -8,7 +8,7 @@ class GoogleAnalyticsEEC {
8
8
 
9
9
  productView(productData) {
10
10
  //console.log('GA productView: ', productData)
11
- dataLayer.push({
11
+ window.dataLayer?.push({
12
12
  event: 'view_item',
13
13
  ecommerce: {
14
14
  items: [productData]
@@ -19,7 +19,7 @@ class GoogleAnalyticsEEC {
19
19
  signUp(source) {
20
20
  let signupSource = source || 'standard'
21
21
  console.log('dl push', 'sign_up', signupSource)
22
- dataLayer.push({
22
+ window.dataLayer?.push({
23
23
  event: 'sign_up',
24
24
  eventProps: {
25
25
  source: signupSource
@@ -39,11 +39,11 @@ class GoogleAnalyticsEEC {
39
39
  console.log('doNotTrack enabled')
40
40
  addToCartData.eventTimeout = 2000
41
41
  }
42
- dataLayer.push(addToCartData)
42
+ window.dataLayer?.push(addToCartData)
43
43
  }
44
44
 
45
45
  removeFromCart(productData) {
46
- dataLayer.push({
46
+ window.dataLayer?.push({
47
47
  event: 'remove_from_cart',
48
48
  ecommerce: {
49
49
  items: [productData]
@@ -55,14 +55,14 @@ class GoogleAnalyticsEEC {
55
55
  //step += 1 //step numbering starts from 1 in GA
56
56
  //console.log('GA EEC checkout step', step)
57
57
  if (step === 'preview') {
58
- dataLayer.push({
58
+ window.dataLayer?.push({
59
59
  event: 'begin_checkout',
60
60
  ecommerce: {
61
61
  items: payload
62
62
  }
63
63
  })
64
64
  } else {
65
- dataLayer.push({
65
+ window.dataLayer?.push({
66
66
  event: step,
67
67
  ecommerce: {
68
68
  items: payload
@@ -73,7 +73,7 @@ class GoogleAnalyticsEEC {
73
73
 
74
74
  purchase(orderData, currency) {
75
75
  console.log('purchase orderData', orderData, currency)
76
- dataLayer.push({
76
+ window.dataLayer?.push({
77
77
  event: 'purchase',
78
78
  ecommerce: {
79
79
  purchase: {
package/babel.config.js DELETED
@@ -1,5 +0,0 @@
1
- module.exports = {
2
- presets: [
3
- '@vue/cli-plugin-babel/preset'
4
- ]
5
- }
@@ -1,133 +0,0 @@
1
- <template>
2
- <div class="email-wrapper column-wrapper">
3
- <div class="email-header">
4
- <p>{{ $t('global.email') }}</p>
5
- </div>
6
- <div class="columns is-gapless email">
7
- <div class="column is-one-third">
8
- <div class="current-email">
9
- <p>{{ $t('account.currentEmail') }}</p>
10
- <p class="email-address">{{ userData.email }}</p>
11
- </div>
12
- <div class="email-status">
13
- <p class="status">{{ $t('global.status') }}</p>
14
- <p class="confirmed" v-if="userData.email_confirmed">{{ $t('global.confirmed') }}</p>
15
- <p class="not-confirmed" v-if="!userData.email_confirmed">{{ $t('global.unconfirmed') }}</p>
16
- <div v-if="!userData.email_confirmed">
17
- <button @click="resendConfirmation" :class="['button', {'is-loading': resendLoading}]" type="button">{{ $t('account.resendConfirmation') }}</button>
18
- </div>
19
- </div>
20
- </div>
21
- </div>
22
- <div class="columns-wrapper">
23
- <div class="columns is-gapless">
24
- <div class="column is-one-third">
25
- <p class="email-headline">{{ $t('account.changeEmailTitle') }}</p>
26
-
27
- <b-field
28
- :label="$t('account.lYourPassword')"
29
- label-position="inside"
30
- :type="{ 'is-danger': errors.current_password }"
31
- :message="errors.current_password"
32
- >
33
- <b-input native-value="inside" type="password" @input="clearError('current_password')" v-model="userData.current_password"></b-input>
34
- </b-field>
35
-
36
- <b-field :label="$t('account.lNewEmail')" label-position="inside" :type="{ 'is-danger': errors.email }" :message="errors.email">
37
- <b-input native-value="inside" @input="clearError('email')" v-model="userData.email"></b-input>
38
- </b-field>
39
-
40
- <b-field :label="$t('account.lConfirmNewEmail')" label-position="inside" :type="{ 'is-danger': errors.email }" :message="errors.email">
41
- <b-input native-value="inside" label-position="inside" @input="clearError('email')" v-model="userData.email_confirmation"></b-input>
42
- </b-field>
43
- </div>
44
-
45
- <div class="column"></div>
46
- </div>
47
-
48
- <button type="button" @click="warningMessage" class="button is-primary change-email">{{ $t('account.changeEmail') }}</button>
49
- </div>
50
- </div>
51
- </template>
52
-
53
- <script>
54
-
55
- import config from '../../config'
56
- import { request, User} from '../../api'
57
-
58
- export default {
59
- name: 'ChangeEmail',
60
-
61
- props: {
62
- userData: Object
63
- },
64
-
65
- data() {
66
- return {
67
- errors: {},
68
- resendLoading: false
69
- }
70
- },
71
-
72
- methods: {
73
- submit() {
74
- User.updateEmail(this.userData)
75
- .then((response) => {
76
- if (response.status === 200 || response.status === 201) {
77
- this.$buefy.toast.open({
78
- message: this.$t('account.emailUpdatedNotification'),
79
- type: 'is-success'
80
- })
81
- } else {
82
- this.$buefy.dialog.alert({
83
- title: this.$t('account.emailUpdateDialogTitle'),
84
- message: this.$t('account.emailUpdateErrorNotification'),
85
- confirmText: 'OK',
86
- type: 'is-info'
87
- })
88
- }
89
- })
90
- .catch((error) => {
91
- if (error.errors !== undefined) {
92
- this.errors = error.errors
93
- }
94
- })
95
- },
96
-
97
- async resendConfirmation() {
98
- this.resendLoading = true
99
- await request({
100
- baseURL: config.BASE_URL,
101
- url: '/account/resend-verification',
102
- method: 'post',
103
- data: {}
104
- })
105
- this.$buefy.dialog.alert({
106
- title: 'Success',
107
- message: 'Check your email for confirmation link.',
108
- confirmText: 'OK',
109
- type: 'is-info'
110
- })
111
- this.resendLoading = false
112
- },
113
-
114
- clearError(field) {
115
- if (this.errors[field]) {
116
- this.errors[field] = ''
117
- }
118
- },
119
-
120
- warningMessage() {
121
- this.$buefy.dialog.confirm({
122
- title: this.$t('account.emailUpdateDialogTitle'),
123
- message: this.$t('account.emailUpdateConfirm'),
124
- confirmText: 'Ok',
125
- type: 'is-success',
126
- onConfirm: () => {
127
- this.submit()
128
- }
129
- })
130
- }
131
- }
132
- }
133
- </script>