Widget: Remove confusion with resuming sessions

This commit is contained in:
Raphael Michel
2019-07-30 14:16:33 +02:00
parent 814364fbda
commit b5fb48a55f

View File

@@ -462,7 +462,7 @@ var shared_methods = {
return;
}
if (this.$root.is_button && this.$root.items.length === 0) {
this.resume(this.$root.voucher_code);
this.voucher_open(this.$root.voucher_code);
} else {
var url = this.$root.formTarget + "&locale=" + lang + "&ajax=1";
this.$root.overlay.frame_loading = true;
@@ -546,15 +546,25 @@ var shared_methods = {
this.$root.overlay.frame_loading = true;
iframe.src = redirect_url;
},
voucher_open: function (voucher) {
var redirect_url;
redirect_url = this.$root.voucherFormTarget + '&voucher=' + voucher;
if (this.$root.widget_data) {
redirect_url += '&widget_data=' + escape(this.$root.widget_data_json);
}
if (this.$root.useIframe) {
var iframe = this.$root.overlay.$children[0].$refs['frame-container'].children[0];
this.$root.overlay.frame_loading = true;
iframe.src = redirect_url;
} else {
window.open(redirect_url);
}
},
resume: function (voucher) {
var redirect_url;
if (voucher) {
redirect_url = this.$root.voucherFormTarget + '&voucher=' + voucher;
} else {
redirect_url = this.$root.target_url + 'w/' + widget_id + '/?iframe=1&locale=' + lang;
if (this.$root.cart_id) {
redirect_url += '&take_cart_id=' + this.$root.cart_id;
}
redirect_url = this.$root.target_url + 'w/' + widget_id + '/?iframe=1&locale=' + lang;
if (this.$root.cart_id) {
redirect_url += '&take_cart_id=' + this.$root.cart_id;
}
if (this.$root.widget_data) {
redirect_url += '&widget_data=' + escape(this.$root.widget_data_json);