@wikala/spmkt 2.29.7 → 2.31.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.
@@ -2,7 +2,7 @@
2
2
  <div>
3
3
  <div class="columns is-gapless">
4
4
  <div class="column">
5
- <button @click="addAddress" class="button is-primary" type="button">{{ $t('address.add') }}</button>
5
+ <button @click="addAddress" class="button is-primary" data-test="add-address-btn" type="button">{{ $t('address.add') }}</button>
6
6
  </div>
7
7
  </div>
8
8
 
@@ -32,7 +32,7 @@
32
32
  />
33
33
  </section>
34
34
  <footer class="modal-card-foot">
35
- <button @click="saveAddress" class="button is-primary is-fullwidth is-large">{{ $t('global.save') }}</button>
35
+ <button @click="saveAddress" class="button is-primary is-fullwidth is-large" data-test="save-address-btn">{{ $t('global.save') }}</button>
36
36
  </footer>
37
37
  </div>
38
38
  </b-modal>
@@ -1,5 +1,5 @@
1
1
  <template>
2
- <div class="edit-address-container">
2
+ <div class="edit-address-container" data-test="address-form">
3
3
 
4
4
  <template v-if="showEditAutocompleteAddress">
5
5
  <div class="has-margin-bottom-lg" :class="{'is-hidden': !gmapsAutocomplete}">
@@ -36,6 +36,7 @@
36
36
  v-model="addressData.first_name"
37
37
  type="text"
38
38
  name="first_name"
39
+ data-test="address-first-name"
39
40
  autocomplete="given-name"
40
41
  />
41
42
  </b-field>
@@ -50,6 +51,7 @@
50
51
  <b-input
51
52
  v-model="addressData.last_name"
52
53
  name="last_name"
54
+ data-test="address-last-name"
53
55
  autocomplete="family-name"
54
56
  />
55
57
  </b-field>
@@ -115,6 +117,7 @@
115
117
  native-value="inside"
116
118
  v-model="addressData.address1"
117
119
  name="address1"
120
+ data-test="address-street"
118
121
  autocomplete="address-line1"
119
122
  />
120
123
  </b-field>
@@ -145,6 +148,7 @@
145
148
  native-value="inside"
146
149
  v-model="addressData.city"
147
150
  name="city"
151
+ data-test="address-city"
148
152
  autocomplete="address-level2"
149
153
  />
150
154
  </b-field>
@@ -172,6 +176,7 @@
172
176
  native-value="inside"
173
177
  v-model="addressData.phone"
174
178
  name="phone"
179
+ data-test="address-phone"
175
180
  autocomplete="tel"
176
181
  />
177
182
  </b-field>
@@ -10,6 +10,7 @@
10
10
  native-value="inside"
11
11
  :value="value"
12
12
  name="postcode"
13
+ data-test="address-postcode"
13
14
  autocomplete="postal-code"
14
15
  />
15
16
  </b-field>
@@ -59,7 +59,7 @@
59
59
  </div>
60
60
 
61
61
  <div>
62
- <button name="create_account" class="button is-fullwidth has-text-weight-bold" @click.prevent="showCreateAccountDialog = true">
62
+ <button name="create_account" data-test="create-account-btn" class="button is-fullwidth has-text-weight-bold" @click.prevent="showCreateAccountDialog = true">
63
63
  {{ $t('auth.createAnAccount', ['an']) }}
64
64
  </button>
65
65
  </div>
@@ -13,6 +13,7 @@
13
13
  <b-input
14
14
  native-value="inside"
15
15
  name="first_name"
16
+ data-test="register-first-name"
16
17
  ref="first_name"
17
18
  @input="clearError('first_name')"
18
19
  @focus="clearError('first_name')"
@@ -26,6 +27,7 @@
26
27
  <b-input
27
28
  native-value="inside"
28
29
  name="last_name"
30
+ data-test="register-last-name"
29
31
  @input="clearError('last_name')"
30
32
  @focus="clearError('last_name')"
31
33
  v-model="registrationData.last_name"
@@ -40,13 +42,14 @@
40
42
  </div>
41
43
 
42
44
  <b-field :label="$t('global.email')" label-position="inside" :type="{ 'is-danger': errors.email }" :message="errors.email">
43
- <b-input native-value="inside" name="email" @input="clearError('email')" @focus="clearError('email')" v-model="registrationData.email"></b-input>
45
+ <b-input native-value="inside" name="email" data-test="register-email" @input="clearError('email')" @focus="clearError('email')" v-model="registrationData.email"></b-input>
44
46
  </b-field>
45
47
 
46
48
  <b-field :label="$t('auth.password')" label-position="inside" :type="{ 'is-danger': errors.password }" :message="errors.password">
47
49
  <b-input
48
50
  native-value="inside"
49
51
  name="password"
52
+ data-test="register-password"
50
53
  @input="clearError('password')"
51
54
  @focus="clearError('password')"
52
55
  type="password"
@@ -64,6 +67,7 @@
64
67
  <b-input
65
68
  native-value="inside"
66
69
  name="password_confirmation"
70
+ data-test="register-password-confirm"
67
71
  @input="clearError('password_confirmation')"
68
72
  @focus="clearError('password_confirmation')"
69
73
  type="password"
@@ -72,7 +76,7 @@
72
76
  </b-field>
73
77
 
74
78
  <div class="field">
75
- <b-checkbox name="register_tos" v-model="registrationData.terms_of_service" type="is-info">
79
+ <b-checkbox name="register_tos" data-test="register-tos" v-model="registrationData.terms_of_service" type="is-info">
76
80
  <span v-html="$t('auth.acceptTOS', [initialState.site_name])"></span>
77
81
  </b-checkbox>
78
82
  <p class="help is-danger" v-if="errors.terms_of_service">
@@ -82,7 +86,7 @@
82
86
  </section>
83
87
 
84
88
  <footer class="modal-card-foot">
85
- <button name="register" :class="['button', 'is-primary', 'is-fullwidth', { 'is-loading': loading }]" type="submit">
89
+ <button name="register" data-test="register-submit" :class="['button', 'is-primary', 'is-fullwidth', { 'is-loading': loading }]" type="submit">
86
90
  {{ $t('auth.createAnAccount', ['']) }}
87
91
  </button>
88
92
  </footer>
@@ -166,7 +170,7 @@ export default {
166
170
  this.registrationData = { ...registrationDataSchema }
167
171
  this.$buefy.dialog.alert({
168
172
  title: this.$t('auth.createAnAccount', ['']),
169
- message: this.$t('auth.createAccountNotification'),
173
+ message: '<div data-test="account-created-message">' + this.$t('auth.createAccountNotification') + '</div>',
170
174
  confirmText: 'OK',
171
175
  type: 'is-primary',
172
176
  onConfirm: () => {
@@ -39,7 +39,7 @@
39
39
  <div class="columns">
40
40
  <div class="column">
41
41
  <div class="checkout">
42
- <button @click="goToCart" class="button buy-now-button">{{ $t('cart.viewCart') }}</button>
42
+ <button @click="goToCart" class="button buy-now-button" data-test="buy-now-btn">{{ $t('cart.viewCart') }}</button>
43
43
  </div>
44
44
  </div>
45
45
  </div>
@@ -71,7 +71,7 @@
71
71
  </div>
72
72
  <div class="columns">
73
73
  <div class="column">
74
- <button name="continue_to_delivery" class="button is-primary is-large has-margin-top-lg is-fullwidth" @click="cartModeContinue">{{ $t('cart.continue') }}</button>
74
+ <button name="continue_to_delivery" data-test="continue-to-delivery-btn" class="button is-primary is-large has-margin-top-lg is-fullwidth" @click="cartModeContinue">{{ $t('cart.continue') }}</button>
75
75
  </div>
76
76
  <div class="column">
77
77
  </div>
@@ -36,7 +36,7 @@
36
36
  <div class="column is-one-third is-4-desktop is-5-tablet">
37
37
  <CartSummary :total-label="$t('global.total')" />
38
38
  <div v-if="activeStep === 0" class="has-text-centered proceed-btn-container">
39
- <button :disabled="emptyCart || itemsWithErrorsCount > 0 || cart.equivalent_qty > 30" @click="proceedToCheckout" class="button is-primary is-large" name="to_checkout">
39
+ <button :disabled="emptyCart || itemsWithErrorsCount > 0 || cart.equivalent_qty > 30" @click="proceedToCheckout" class="button is-primary is-large" data-test="to-checkout-btn" name="to_checkout">
40
40
  {{ $t('cart.proceedToCheckout') }}
41
41
  </button>
42
42
  </div>
@@ -5,6 +5,17 @@
5
5
  <input @keyup.enter="applyCoupon" v-model="couponCode" class="input" type="text" name="coupon_code" :placeholder="$t('cart.enterCouponPlaceholder')" />
6
6
  <button name="enter_coupon" @click="applyCoupon" class="button is-small" :class="{ 'is-loading': acLoading }">{{ $t('cart.applyCoupon') }}</button>
7
7
  </div>
8
+ <!-- Coupon the shop offers to this customer, passed by the server in initial state as offered_coupon -->
9
+ <div v-if="showOfferedCoupon" class="pc-offer" data-test="offered-coupon">
10
+ <div>
11
+ {{ $t('cart.offeredCoupon') }}: <strong class="pc-offer-code">{{ offeredCoupon.code }}</strong>
12
+ <button type="button" name="apply_offered_coupon" class="button is-small pc-offer-apply" @click="applyCode(offeredCoupon.code)">{{ $t('cart.applyOfferedCoupon') }}</button>
13
+ </div>
14
+ <div class="pc-offer-details">
15
+ {{ offeredCoupon.description }}
16
+ <template v-if="offeredCoupon.expires_at">{{ $t('cart.couponValidUntil', { date: offeredCoupon.expires_at }) }}</template>
17
+ </div>
18
+ </div>
8
19
  <div v-if="cart.discount">
9
20
  <div class="applied-discounts has-text-weight-bold">
10
21
  <div class="has-text-success">{{ $t('cart.discountApplied') }} [{{ cart.coupon_code }}]</div>
@@ -34,6 +45,7 @@
34
45
  <script>
35
46
  import { mapState, mapMutations } from 'vuex'
36
47
  import { formatMoney } from '../../utils/filters'
48
+ import config from '../../config'
37
49
 
38
50
  import { request } from '../../api'
39
51
 
@@ -42,17 +54,28 @@ export default {
42
54
  data() {
43
55
  return {
44
56
  acLoading: false,
45
- couponCode: ''
57
+ couponCode: '',
58
+ offeredCoupon: config.INITIAL_STATE?.offered_coupon || null
46
59
  }
47
60
  },
48
61
  computed: {
49
- ...mapState(['cart'])
62
+ ...mapState(['cart']),
63
+
64
+ showOfferedCoupon() {
65
+ return this.offeredCoupon !== null
66
+ && String(this.cart.coupon_code || '').toUpperCase() !== this.offeredCoupon.code.toUpperCase()
67
+ }
50
68
  },
51
69
  methods: {
52
70
  ...mapMutations(['setCart']),
53
71
 
54
72
  formatMoney,
55
73
 
74
+ applyCode(code) {
75
+ this.couponCode = code
76
+ this.applyCoupon()
77
+ },
78
+
56
79
  applyCoupon() {
57
80
  this.acLoading = true
58
81
  request({
@@ -62,7 +62,7 @@
62
62
 
63
63
  <div v-if="addressValid" class="columns">
64
64
  <div class="column">
65
- <button @click="continueToPayment" :class="['button', 'is-primary', 'is-large', 'has-margin-top-lg', { 'is-loading': continueButtonLoading }]" name="to_checkout">
65
+ <button @click="continueToPayment" :class="['button', 'is-primary', 'is-large', 'has-margin-top-lg', { 'is-loading': continueButtonLoading }]" data-test="to-checkout-btn" name="to_checkout">
66
66
  {{ $t('cart.proceedToCheckout') }}
67
67
  </button>
68
68
  </div>
@@ -27,7 +27,7 @@
27
27
 
28
28
  <div v-if="!addressValid" class="columns">
29
29
  <div class="column">
30
- <button name="validate_address" class="button is-primary is-large has-margin-top-lg" @click="onAddressContinue">{{ $t('cart.deliverToThisAddress') }}</button>
30
+ <button name="validate_address" data-test="validate-address-btn" class="button is-primary is-large has-margin-top-lg" @click="onAddressContinue">{{ $t('cart.deliverToThisAddress') }}</button>
31
31
  </div>
32
32
  <div class="column">
33
33
  </div>
@@ -2,7 +2,7 @@
2
2
  <div class="container m-3">
3
3
  <div class="columns">
4
4
  <div class="column is-two-thirds">
5
- <h1 class="is-size-3 is-choomblue"> {{ $t('cart.cartThankYou') }} </h1>
5
+ <h1 class="is-size-3 is-choomblue" data-test="checkout-success-title"> {{ $t('cart.cartThankYou') }} </h1>
6
6
  <div class="order-confirmation">
7
7
  <div class="oc-summary"> {{ $t('cart.orderNumber') }} {{ orderData.id }} </div>
8
8
  <div class="oc-summary"> {{ $t('cart.orderDate') }} {{ orderData.date }} </div>
@@ -61,7 +61,7 @@
61
61
  </div>
62
62
 
63
63
  <div class="cart-accept-tos mt-6 mb-6" v-if="initialState.acceptTOSAtCheckout">
64
- <b-checkbox name="accept_tos" v-model="acceptTOS" @input="acceptTOSChange">
64
+ <b-checkbox name="accept_tos" data-test="accept-tos" v-model="acceptTOS" @input="acceptTOSChange">
65
65
  <span v-html="$t('cart.acceptTOS')"></span>
66
66
  </b-checkbox>
67
67
  <p class="help is-danger" v-if="acceptTOSError">
@@ -70,7 +70,7 @@
70
70
  </div>
71
71
 
72
72
  <div class="cc-submit">
73
- <button type="button" @click="placeOrder" class="button is-primary is-large">{{ $t('cart.placeYourOrder') }}</button>
73
+ <button type="button" @click="placeOrder" class="button is-primary is-large" data-test="place-order-btn">{{ $t('cart.placeYourOrder') }}</button>
74
74
  </div>
75
75
  </div>
76
76
  <div class="column is-4 is-hidden-mobile">
@@ -9,6 +9,7 @@
9
9
  :value="value"
10
10
  @input="$emit('input', $event)"
11
11
  name="paymentmethod"
12
+ :data-test="'payment-method-' + pm.id"
12
13
  :native-value="pm.id"
13
14
  :style="{
14
15
  display: 'flex',
@@ -14,6 +14,7 @@
14
14
  :loading="checkingEmail"
15
15
  type="email"
16
16
  name="email"
17
+ data-test="guest-email"
17
18
  autocomplete="email"
18
19
  />
19
20
  </b-field>
@@ -33,7 +34,7 @@
33
34
  :type="{ 'is-danger': errors.first_name }"
34
35
  :message="errors.first_name"
35
36
  >
36
- <b-input native-value="inside" v-model="userIdentity.first_name" type="text" name="first_name" autocomplete="given-name"></b-input>
37
+ <b-input native-value="inside" v-model="userIdentity.first_name" type="text" name="first_name" data-test="guest-first-name" autocomplete="given-name"></b-input>
37
38
  </b-field>
38
39
  </div>
39
40
  <div class="column">
@@ -43,7 +44,7 @@
43
44
  :type="{ 'is-danger': errors.last_name }"
44
45
  :message="errors.last_name"
45
46
  >
46
- <b-input v-model="userIdentity.last_name" name="last_name" autocomplete="family-name" />
47
+ <b-input v-model="userIdentity.last_name" name="last_name" data-test="guest-last-name" autocomplete="family-name" />
47
48
  </b-field>
48
49
  </div>
49
50
  </div>
@@ -55,7 +56,7 @@
55
56
  :type="{ 'is-danger': errors.phone }"
56
57
  :message="errors.phone"
57
58
  >
58
- <b-input v-mask="initialState.phoneNumberMask" native-value="inside" v-model="userIdentity.phone" name="phone" autocomplete="tel"/>
59
+ <b-input v-mask="initialState.phoneNumberMask" native-value="inside" v-model="userIdentity.phone" name="phone" data-test="guest-phone" autocomplete="tel"/>
59
60
  </b-field>
60
61
  </div>
61
62
  </div>
@@ -4,10 +4,10 @@
4
4
  <quantity v-model="qty"></quantity>
5
5
  </template>
6
6
  <div v-if="inStock" class="actions">
7
- <button name="add_to_cart" @click="addToCart" :class="['button', 'add-to-cart-button', { 'is-loading': loadingAddToCart }]" :disabled="!inStock">
7
+ <button name="add_to_cart" data-test="add-to-cart-btn" @click="addToCart" :class="['button', 'add-to-cart-button', { 'is-loading': loadingAddToCart }]" :disabled="!inStock">
8
8
  {{ $t('cart.addToCart') }}
9
9
  </button>
10
- <button v-if="buyNowEnabled" @click="buyNow" :class="['button', 'buy-now-button', { 'is-loading': loadingBuyNow }]" :disabled="!inStock">
10
+ <button v-if="buyNowEnabled" data-test="buy-now-btn" @click="buyNow" :class="['button', 'buy-now-button', { 'is-loading': loadingBuyNow }]" :disabled="!inStock">
11
11
  {{ $t('cart.buyNow') }}
12
12
  </button>
13
13
  </div>
@@ -1,11 +1,11 @@
1
1
  <template>
2
2
  <div style="display: flex; justify-content: flex-end; flex-direction: column;">
3
- <select class="select" v-if="showSelect" @change="qtySelectChange($event)" v-model="qty" style="text-align:center;">
3
+ <select data-test="cart-item-qty" class="select" v-if="showSelect" @change="qtySelectChange($event)" v-model="qty" style="text-align:center;">
4
4
  <option v-for="qty in selectRange" :value="qty" :key="qty">{{ qty }}</option>
5
5
  <option value="smp">{{ selectMax + 1 }}+</option>
6
6
  </select>
7
7
  <form @submit.prevent="qtyUpdate" style="display:flex; flex-direction: column;">
8
- <input ref="textInput" v-if="!showSelect" class="input" @input="qtyInput" :value="qty" style="text-align:center; border:unset" />
8
+ <input data-test="cart-item-qty" ref="textInput" v-if="!showSelect" class="input" @input="qtyInput" :value="qty" style="text-align:center; border:unset" />
9
9
  <button v-if="showUpdateButton" class="button is-small">{{ $t('global.update') }}</button>
10
10
  </form>
11
11
  </div>
package/locales/en.json CHANGED
@@ -93,6 +93,7 @@
93
93
  "accountExistsError": "There is an existing account associated with this email address. Please sign in to continue or use a different email address.",
94
94
  "addToCart": "Add to cart",
95
95
  "applyCoupon": "Apply",
96
+ "applyOfferedCoupon": "Apply",
96
97
  "billingAddressError": "Please select billing address",
97
98
  "buyNow": "Buy now",
98
99
  "cart": "Cart",
@@ -105,6 +106,7 @@
105
106
  "continue": "Continue",
106
107
  "continueShopping": "Continue shopping",
107
108
  "continueToPayment": "Continue to payment",
109
+ "couponValidUntil": "Valid until {date}.",
108
110
  "deliveryCost": "",
109
111
  "deliveryCostFree": "FREE",
110
112
  "deliverToThisAddress": "Deliver to this address",
@@ -123,6 +125,7 @@
123
125
  "itemAdded": "Item added to your cart",
124
126
  "itemsShippedFrom": "Items shipped from {0}",
125
127
  "lBillingAddressSameAsDelivery": "Billing address same as delivery",
128
+ "offeredCoupon": "Your discount code",
126
129
  "orderDate": "Order time:",
127
130
  "orderInfo": "\n A confirmation email will be sent to\n <strong>{0}</strong> once your order has been processed. You will receive another email with tracking information once your order\n has been shipped. In the unlikely event that we anticipate a delay, you will be notified via email.\n ",
128
131
  "orderNumber": "Order number: ",
package/locales/sr.json CHANGED
@@ -93,6 +93,7 @@
93
93
  "accountExistsError": "Već postoji nalog sa unetom email adresom. Molimo vas da se ulogujete ili da unesete drugu email adresu.",
94
94
  "addToCart": "Dodaj u korpu",
95
95
  "applyCoupon": "Primeni kupon",
96
+ "applyOfferedCoupon": "Primeni kupon",
96
97
  "billingAddressError": "Odaberite adresu za naplatu",
97
98
  "buyNow": "Kupi odmah",
98
99
  "cart": "Korpa",
@@ -105,6 +106,7 @@
105
106
  "continue": "Dalje",
106
107
  "continueShopping": "Nastavite sa kupovinom",
107
108
  "continueToPayment": "Nastavite sa plaćanjem",
109
+ "couponValidUntil": "Kupon važi do {date}.",
108
110
  "deliveryCost": "Cena isporuke:",
109
111
  "deliveryCostFree": "Besplatna isporuka",
110
112
  "deliverToThisAddress": "Dostavite na ovu adresu",
@@ -123,6 +125,7 @@
123
125
  "itemAdded": "Proizvod je dodat u vašu korpu",
124
126
  "itemsShippedFrom": "Isporučuje {0}",
125
127
  "lBillingAddressSameAsShipping": "Adresa za naplatu ista kao i adresa za isporuku",
128
+ "offeredCoupon": "Vaš kod za popust",
126
129
  "orderDate": "Datum narudžbenice:",
127
130
  "orderInfo": "\n Potvrda će biti poslata na \n <strong>{0}</strong> kada vaša narudžbenica bude obrađena. Dobićete još jedan mail kada kurirska služba preuzme pošiljku. U slučaju da nastupi neki problem takođe ćemo vas obavestiti na email.\n",
128
131
  "orderNumber": "Broj narudžbenice:",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wikala/spmkt",
3
- "version": "2.29.7",
3
+ "version": "2.31.0",
4
4
  "private": false,
5
5
  "description": "supermarket",
6
6
  "scripts": {
@@ -1,10 +0,0 @@
1
- {
2
- "permissions": {
3
- "allow": [
4
- "Bash(grep:*)",
5
- "Bash(head:*)",
6
- "Bash(git -C /Users/svp/projects/fe-supermarket log --all --name-only --oneline api/index.js)",
7
- "Bash(git -C /Users/svp/projects/fe-supermarket status --short)"
8
- ]
9
- }
10
- }