0
0
Fork 1
Spiegel von https://github.com/paviliondev/discourse-custom-wizard.git synchronisiert 2024-11-25 18:50:27 +01:00
discourse-custom-wizard/assets/javascripts/discourse/mixins/subscription.js.es6

54 Zeilen
1,8 KiB
Text

import Mixin from "@ember/object/mixin";
import { getOwner } from "discourse-common/lib/get-owner";
import { readOnly } from "@ember/object/computed";
import discourseComputed from "discourse-common/utils/decorators";
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
2022-09-23 15:54:43 +02:00
const SUPPORT_MESSAGE =
"https://coop.pavilion.tech/new-message?username=support&title=Custom%20Wizard%20Support";
const MANAGER_CATEGORY =
"https://discourse.pluginmanager.org/c/discourse-custom-wizard";
export default Mixin.create({
subscriptionLandingUrl: PRODUCT_PAGE,
subscriptionClientUrl: "/admin/plugins/subscription-client",
@discourseComputed
adminWizards() {
2022-03-25 12:22:27 +01:00
return getOwner(this).lookup("controller:admin-wizards");
},
2022-03-25 12:22:27 +01:00
subscribed: readOnly("adminWizards.subscribed"),
subscriptionType: readOnly("adminWizards.subscriptionType"),
businessSubscription: readOnly("adminWizards.businessSubscription"),
communitySubscription: readOnly("adminWizards.communitySubscription"),
2022-03-25 12:22:27 +01:00
standardSubscription: readOnly("adminWizards.standardSubscription"),
subscriptionAttributes: readOnly("adminWizards.subscriptionAttributes"),
subscriptionClientInstalled: readOnly(
"adminWizards.subscriptionClientInstalled"
),
@discourseComputed("subscriptionClientInstalled")
subscriptionLink(subscriptionClientInstalled) {
2022-03-25 12:22:27 +01:00
return subscriptionClientInstalled
? this.subscriptionClientUrl
: this.subscriptionLandingUrl;
},
@discourseComputed("subscriptionType")
subscriptionCtaLink(subscriptionType) {
switch (subscriptionType) {
2022-09-23 15:54:43 +02:00
case "none":
return PRODUCT_PAGE;
case "standard":
return SUPPORT_MESSAGE;
case "business":
return SUPPORT_MESSAGE;
case "community":
return MANAGER_CATEGORY;
default:
return PRODUCT_PAGE;
}
},
});