@viur/shop-components 0.8.0 → 0.9.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@viur/shop-components",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Frontend Vue components for the shop module of ViUR",
5
5
  "repository": {
6
6
  "type": "git",
@@ -38,7 +38,12 @@
38
38
  <template v-else-if="shopStore.state.order?.['payment_provider'] === 'unzer-ideal'">
39
39
  <div id="ideal-element" class="field"></div>
40
40
  </template>
41
+ <p
42
+ v-if="!!shopStore.state?.paymentProviderData?.redirectUrl"
43
+ v-html="$t('viur.shop.payment_link', {url: shopStore.state.paymentProviderData.redirectUrl})"
44
+ />
41
45
  </form>
46
+
42
47
  <button :disabled="state.loading" class="unzerUI primary button fluid" @click="submitFormToUnzer">{{ $t('viur.shop.pay') }}</button>
43
48
  <sl-button :disabled="state.loading" variant="danger" @click="cancelPayment">{{ $t('actions.cancel') }}</sl-button>
44
49
  </div>
@@ -56,11 +61,15 @@ const {fetchOrder} = useOrder()
56
61
  const emits = defineEmits(['cancel'])
57
62
 
58
63
  const { pause:PaymentCheckPause, resume:PaymentCheckResume, isActive:PaymentCheckIsActive } = useIntervalFn(() => {
59
- fetchOrder(shopStore.state.orderKey)
64
+ console.debug('checking ...')
60
65
 
61
- if (shopStore.state.order?.['is_paid']){
62
- PaymentCheckPause()
63
- }
66
+ fetchOrder(shopStore.state.orderKey).then(()=>{
67
+ if (shopStore.state.order?.['is_paid']){
68
+ console.debug('Order is paid')
69
+ shopStore.navigateToTab('complete');
70
+ PaymentCheckPause();
71
+ }
72
+ })
64
73
 
65
74
  }, 2000,{immediate:false})
66
75
 
@@ -126,6 +135,7 @@ function initUnzerForm(){
126
135
  }
127
136
 
128
137
  function paymentError(error){
138
+ console.error(error)
129
139
  state.loading = false
130
140
  state.hasError = true
131
141
  }
package/src/shop.js CHANGED
@@ -74,7 +74,7 @@ export const useViurShopStore = defineStore("viurshopStore", () => {
74
74
  params:{},
75
75
  displayName: "viur.shop.order_step_complete", //Bestellung Abgeschlossen
76
76
  icon: { name: "bag-check" },
77
- active:computed(()=>state.order?.['is_ordered'] && state.order?.['is_rts']), // active if ordered
77
+ active:computed(()=>state.order?.['is_ordered'] && (state.order?.['is_rts'] || state.order?.['is_paid'])), // active if ordered
78
78
  validating:false,
79
79
  valid:false
80
80
  },
@@ -156,6 +156,10 @@ export const useViurShopStore = defineStore("viurshopStore", () => {
156
156
 
157
157
  function navigateToTab(name){
158
158
  // navigate to Tab
159
+ if (!state.tabs[name].active) {
160
+ console.warn(`navigateToTab called at ${state.currentTab}, but tab (${name}) not active yet`);
161
+ return false;
162
+ }
159
163
  state.currentTab = name
160
164
 
161
165
  const params = useUrlSearchParams('hash')
@@ -166,11 +170,20 @@ export const useViurShopStore = defineStore("viurshopStore", () => {
166
170
  });
167
171
  }
168
172
 
169
- function navigateToNext(){
170
- // shorthand for next Tab
171
- if (state.tabIndexMap[state.currentTab] === state.stepperLength-1) return false
172
- navigateToTab(state.indexTabMap[state.tabIndexMap[state.currentTab]+1])
173
+ function navigateToNext() {
174
+ // shorthand for next Tab
175
+ const currentTabIndex0 = state.tabIndexMap[state.currentTab];
176
+ if (currentTabIndex0 === state.stepperLength - 1) {
177
+ console.warn(`Tab end reached`);
178
+ return false;
179
+ }
180
+ const nextTabName = state.indexTabMap[currentTabIndex0 + 1];
181
+ if (!state.tabs[nextTabName].active) {
182
+ console.warn(`navigateToNext called at ${state.currentTab}, but next tab (${nextTabName}) not active yet`);
183
+ return false;
173
184
  }
185
+ navigateToTab(nextTabName);
186
+ }
174
187
 
175
188
  function navigateToPrevious(){
176
189
  // shorthand for previous Tab
@@ -236,7 +249,7 @@ export const useViurShopStore = defineStore("viurshopStore", () => {
236
249
  state.order = data['skel']
237
250
  state.paymentProviderData = data['payment']
238
251
 
239
- if(state.order?.['is_ordered'] && state.order?.['is_rts']){
252
+ if(state.order?.['is_ordered'] && (state.order?.['is_rts'] || state.order?.['is_paid'])){
240
253
  // order is finished
241
254
  useTimeoutFn(() => {
242
255
  navigateToTab('complete')
@@ -10,6 +10,7 @@ export default {
10
10
  'order_pay': 'Zahlungspflichtig bestellen',
11
11
  'order_number': 'Ihre Vorgangsnummer',
12
12
  'order_thanks': 'Vielen Dank für Ihre Bestellung',
13
+ 'order_abort': 'Die Bestellung wurde abgebrochen.',
13
14
  'order_message': 'Wir haben Ihre Bestellung erhalten und werden diese schnellstmöglich bearbeiten.<br /> Sie erhalten in wenigen Minuten eine Bestätigung per E-Mail.',
14
15
  'order_paid': 'Ihre Zahlung ist bei uns eingegangen.',
15
16
  'order_ready_to_ship': 'Ihre Bestellung ist fertig für den Versand.',
@@ -55,7 +56,8 @@ export default {
55
56
  'order_step_payment': 'Zahlungsart',
56
57
  'order_step_verify': 'Bestellung prüfen',
57
58
  'order_step_complete': 'Bestellung Abgeschlossen',
58
- 'paypal_client_popup_info':"Bitte prüfen Sie, ob Ihr Browser das PayPal-Popup zulässt."
59
+ 'paypal_client_popup_info': 'Bitte prüfen Sie, ob Ihr Browser das PayPal-Popup zulässt.',
60
+ 'payment_link': 'Ihr Browser öffnet kein Popup? Dann klicken Sie bitte <a href="{url}" target="_blank">hier</a>.',
59
61
  },
60
62
  },
61
63
  messages: {
@@ -10,6 +10,7 @@ export default {
10
10
  'order_pay': 'Place binding order',
11
11
  'order_number': 'Your order number',
12
12
  'order_thanks': 'Thank you for your order',
13
+ 'order_abort': 'The order was canceled.',
13
14
  'order_message': 'We have received your order and will process it as soon as possible.<br /> You will receive a confirmation email in a few minutes.',
14
15
  'order_paid': 'Your payment has been received.',
15
16
  'order_ready_to_ship': 'Your order is ready for shipping.',
@@ -55,7 +56,8 @@ export default {
55
56
  'order_step_payment': 'Payment method',
56
57
  'order_step_verify': 'Review order',
57
58
  'order_step_complete': 'Order complete',
58
- 'paypal_client_popup_info':"Please make sure your browser allows the PayPal popup."
59
+ 'paypal_client_popup_info': 'Please make sure your browser allows the PayPal popup.',
60
+ 'payment_link': 'Your browser does not open a popup? Then please click <a href="{{url}}" target="_blank">here</a>.',
59
61
  },
60
62
  },
61
63
  messages: {
@@ -10,6 +10,7 @@ export default {
10
10
  'order_pay': 'Valider',
11
11
  'order_number': 'N° de commande',
12
12
  'order_thanks': 'Merci pour votre commande et l’intérêt porté à notre société.',
13
+ 'order_abort': 'La commande a été annulée.',
13
14
  'order_message': 'Nous avons bien reçu votre commande et nous allons la traiter dans les plus brefs délais.<br /> Vous recevrez une confirmation par e-mail dans quelques minutes',
14
15
  'order_paid': 'Nous avons bien reçu votre paiement',
15
16
  'order_ready_to_ship': 'Votre commande est prête à être expédiée',
@@ -55,7 +56,8 @@ export default {
55
56
  'order_step_payment': 'Mode de paiement',
56
57
  'order_step_verify': 'Vérifier la commande',
57
58
  'order_step_complete': 'Valider la commande',
58
- 'paypal_client_popup_info':"Assurez-vous que votre navigateur autorise la fenêtre contextuelle PayPal."
59
+ 'paypal_client_popup_info':"Assurez-vous que votre navigateur autorise la fenêtre contextuelle PayPal.",
60
+ 'payment_link': 'Votre navigateur n\'ouvre pas de popup ? Alors cliquez <a href="{{url}}" target="_blank">ici</a>.',
59
61
  },
60
62
  },
61
63
  messages: {