', itemHtml += '
', itemHtml += globalize.translate("ListItemPremiereSub", item.planType, item.expDate, item.store), itemHtml += "
", itemHtml += '
', itemHtml += globalize.translate("Stripe" == item.store ? item.autoRenew ? "LabelClickToCancel" : "LabelAlreadyCancelled" : "LabelCancelInfo", item.store), itemHtml += "
", itemHtml += "
", itemHtml += "" + tagName + ">"
})
}
function cancelSub(e) {
console.log("Cancel ");
var feature = this.getAttribute("data-feature"),
key = this.getAttribute("data-key");
confirm({
title: globalize.translate("HeaderCancelSub"),
text: globalize.translate("MessageConfirmSubCancel"),
confirmText: globalize.translate("ButtonCancelSub"),
cancelText: globalize.translate("ButtonDontCancelSub"),
primary: "cancel"
}).then(function() {
console.log("after confirm");
var postData = "key=" + key + "&feature=" + feature;
fetchHelper.ajax({
url: "https://mb3admin.local/admin/service/stripe/requestSubCancel",
type: "POST",
data: postData,
contentType: "application/x-www-form-urlencoded"
}).then(function(response) {
alertText({
text: globalize.translate("MessageSubCancelReqSent"),
title: globalize.translate("HeaderConfirmation")
})
}, function(response) {
alertText({
text: globalize.translate("MessageSubCancelError", "cancel@emby.media")
})
})
})
}
function retrieveSupporterKey(e) {
loading.show();
var form = this,
email = form.querySelector("#txtEmail").value,
url = "https://mb3admin.local/admin/service/supporter/retrievekey?email=" + email;
return console.log(url), fetchHelper.ajax({
url: url,
type: "POST",
dataType: "json"
}).then(function(result) {
loading.hide(), result.Success ? require(["toast"], function(toast) {
toast(globalize.translate("MessageKeyEmailedTo").replace("{0}", email))
}) : require(["toast"], function(toast) {
toast(result.ErrorMessage)
}), console.log(result)
}), e.preventDefault(), !1
}
function alertText(options) {
require(["alert"], function(alert) {
alert(options)
})
}
function updateSupporterKey(e) {
loading.show();
var form = this,
key = form.querySelector("#txtSupporterKey").value,
info = {
SupporterKey: key
};
return ApiClient.updatePluginSecurityInfo(info).then(function() {
loading.hide(), alertText(key ? {
text: globalize.translate("MessageKeyUpdated"),
title: globalize.translate("HeaderConfirmation")
} : {
text: globalize.translate("MessageKeyRemoved"),
title: globalize.translate("HeaderConfirmation")
}), connectionManager.resetRegistrationInfo(ApiClient), load(dom.parentWithClass(form, "page"))
}, function() {
loading.hide(), connectionManager.resetRegistrationInfo(ApiClient), load(dom.parentWithClass(form, "page"))
}), e.preventDefault(), !1
}
function onSupporterLinkClick(e) {
registrationServices.showPremiereInfo(), e.preventDefault(), e.stopPropagation()
}
return function(view, params) {
view.querySelector("#supporterKeyForm").addEventListener("submit", updateSupporterKey), view.querySelector("#lostKeyForm").addEventListener("submit", retrieveSupporterKey), view.querySelector(".benefits").innerHTML = globalize.translate("HeaderSupporterBenefit", '