@viur/shop-components 0.7.2 → 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
|
@@ -31,13 +31,19 @@
|
|
|
31
31
|
</template>
|
|
32
32
|
|
|
33
33
|
<template v-else-if="shopStore.state.order?.['payment_provider'] === 'unzer-paypal'">
|
|
34
|
+
<sl-alert open variant="danger">{{$t('viur.shop.paypal_client_popup_info')}}</sl-alert>
|
|
34
35
|
<div id="paypal-element" class="field"></div>
|
|
35
36
|
</template>
|
|
36
37
|
|
|
37
38
|
<template v-else-if="shopStore.state.order?.['payment_provider'] === 'unzer-ideal'">
|
|
38
39
|
<div id="ideal-element" class="field"></div>
|
|
39
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
|
+
/>
|
|
40
45
|
</form>
|
|
46
|
+
|
|
41
47
|
<button :disabled="state.loading" class="unzerUI primary button fluid" @click="submitFormToUnzer">{{ $t('viur.shop.pay') }}</button>
|
|
42
48
|
<sl-button :disabled="state.loading" variant="danger" @click="cancelPayment">{{ $t('actions.cancel') }}</sl-button>
|
|
43
49
|
</div>
|
|
@@ -55,11 +61,15 @@ const {fetchOrder} = useOrder()
|
|
|
55
61
|
const emits = defineEmits(['cancel'])
|
|
56
62
|
|
|
57
63
|
const { pause:PaymentCheckPause, resume:PaymentCheckResume, isActive:PaymentCheckIsActive } = useIntervalFn(() => {
|
|
58
|
-
|
|
64
|
+
console.debug('checking ...')
|
|
59
65
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
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
|
+
})
|
|
63
73
|
|
|
64
74
|
}, 2000,{immediate:false})
|
|
65
75
|
|
|
@@ -125,6 +135,7 @@ function initUnzerForm(){
|
|
|
125
135
|
}
|
|
126
136
|
|
|
127
137
|
function paymentError(error){
|
|
138
|
+
console.error(error)
|
|
128
139
|
state.loading = false
|
|
129
140
|
state.hasError = true
|
|
130
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
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')
|
package/src/translations/de.js
CHANGED
|
@@ -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,6 +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',
|
|
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>.',
|
|
58
61
|
},
|
|
59
62
|
},
|
|
60
63
|
messages: {
|
package/src/translations/en.js
CHANGED
|
@@ -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,6 +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',
|
|
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>.',
|
|
58
61
|
},
|
|
59
62
|
},
|
|
60
63
|
messages: {
|
package/src/translations/fr.js
CHANGED
|
@@ -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,6 +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',
|
|
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>.',
|
|
58
61
|
},
|
|
59
62
|
},
|
|
60
63
|
messages: {
|