Commits vergleichen
66 Commits
main
...
use_subscr
Autor | SHA1 | Datum | |
---|---|---|---|
|
e120a1a426 | ||
|
fdfccf51e2 | ||
|
e17f90c5fd | ||
|
df9a3c6e6e | ||
|
4007fd9c65 | ||
|
c8263ed6aa | ||
|
13fb5dc1ea | ||
|
da2a56adc6 | ||
|
4422badf6a | ||
|
c0082b82b9 | ||
|
6aa68ebd5f | ||
|
1a32862fd1 | ||
|
c5d8003761 | ||
|
ea02e53882 | ||
|
80fcddc45f | ||
|
45db2270ec | ||
|
43ad5785e1 | ||
|
8407227f53 | ||
|
2c109c54f5 | ||
|
0ad8616239 | ||
|
6755c70d31 | ||
|
648b976ee0 | ||
|
1fdd78bc7e | ||
|
c89dbbb7a8 | ||
|
74a96af622 | ||
|
0399cff6a5 | ||
|
885fdd1215 | ||
|
18001bebc1 | ||
|
56181f65f4 | ||
|
15f596e8ec | ||
|
db7d9c14bc | ||
|
d5bd3c3c47 | ||
|
73e8b0a7fc | ||
|
5192e08893 | ||
|
9cc65d24b5 | ||
|
dd7f2a7e52 | ||
|
f97d15ac42 | ||
|
a8af37b334 | ||
|
7f245d6a59 | ||
|
e43fbd0b50 | ||
|
0b2e66ba0e | ||
|
390f53a8a2 | ||
|
ca11dacf8e | ||
|
f012dc2407 | ||
|
26e4267d23 | ||
|
6a1ead0322 | ||
|
eefbe0a1fc | ||
|
b1fddc33a7 | ||
|
a558e19a54 | ||
|
d6ca154668 | ||
|
b454340263 | ||
|
4f8ab0b249 | ||
|
4f887a858e | ||
|
2f206f60c7 | ||
|
051d1dbcfd | ||
|
437709446e | ||
|
baf533a8f4 | ||
|
76288932c8 | ||
|
b78914e4fd | ||
|
28f17045c5 | ||
|
07bed7ec86 | ||
|
bcd6f86fc8 | ||
|
f1e3db48a3 | ||
|
3a0ba4589d | ||
|
c2ffa7699b | ||
|
27cde861b6 |
71 geänderte Dateien mit 506 neuen und 336 gelöschten Zeilen
|
@ -2,16 +2,6 @@
|
||||||
class CustomWizard::AdminController < ::Admin::AdminController
|
class CustomWizard::AdminController < ::Admin::AdminController
|
||||||
before_action :ensure_admin
|
before_action :ensure_admin
|
||||||
|
|
||||||
def index
|
|
||||||
subcription = CustomWizard::Subscription.new
|
|
||||||
render_json_dump(
|
|
||||||
subscribed: subcription.subscribed?,
|
|
||||||
subscription_type: subcription.type,
|
|
||||||
subscription_attributes: CustomWizard::Subscription.attributes,
|
|
||||||
subscription_client_installed: CustomWizard::Subscription.client_installed?
|
|
||||||
)
|
|
||||||
end
|
|
||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def find_wizard
|
def find_wizard
|
||||||
|
|
13
app/controllers/custom_wizard/admin/subscription.rb
Normale Datei
13
app/controllers/custom_wizard/admin/subscription.rb
Normale Datei
|
@ -0,0 +1,13 @@
|
||||||
|
# frozen_string_literal: true
|
||||||
|
class CustomWizard::SubscriptionController < ::Admin::AdminController
|
||||||
|
before_action :ensure_admin
|
||||||
|
|
||||||
|
def index
|
||||||
|
subscription = CustomWizard::Subscription.new
|
||||||
|
render_json_dump(
|
||||||
|
subscribed: subscription.subscribed?,
|
||||||
|
subscription_type: subscription.type,
|
||||||
|
subscription_attributes: CustomWizard::Subscription.attributes,
|
||||||
|
)
|
||||||
|
end
|
||||||
|
end
|
|
@ -5,11 +5,13 @@ import I18n from "I18n";
|
||||||
export default class AdminWizardsColumnComponent extends Component {
|
export default class AdminWizardsColumnComponent extends Component {
|
||||||
title = I18n.t("admin.wizard.edit_columns");
|
title = I18n.t("admin.wizard.edit_columns");
|
||||||
|
|
||||||
@action save() {
|
@action
|
||||||
|
save() {
|
||||||
this.args.closeModal();
|
this.args.closeModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action resetToDefault() {
|
@action
|
||||||
|
resetToDefault() {
|
||||||
this.args.model.reset();
|
this.args.model.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,13 +18,15 @@ export default class NextSessionScheduledComponent extends Component {
|
||||||
return moment().isAfter(this.bufferedDateTime);
|
return moment().isAfter(this.bufferedDateTime);
|
||||||
}
|
}
|
||||||
|
|
||||||
@action submit() {
|
@action
|
||||||
|
submit() {
|
||||||
const dateTime = this.bufferedDateTime;
|
const dateTime = this.bufferedDateTime;
|
||||||
this.args.model.update(moment(dateTime).utc().toISOString());
|
this.args.model.update(moment(dateTime).utc().toISOString());
|
||||||
this.args.closeModal();
|
this.args.closeModal();
|
||||||
}
|
}
|
||||||
|
|
||||||
@action dateTimeChanged(dateTime) {
|
@action
|
||||||
|
dateTimeChanged(dateTime) {
|
||||||
this.bufferedDateTime = dateTime;
|
this.bufferedDateTime = dateTime;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import {
|
||||||
import Component from "@ember/component";
|
import Component from "@ember/component";
|
||||||
import { bind, later } from "@ember/runloop";
|
import { bind, later } from "@ember/runloop";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
import Subscription from "../mixins/subscription";
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
const customFieldActionMap = {
|
const customFieldActionMap = {
|
||||||
topic: ["create_topic", "send_message"],
|
topic: ["create_topic", "send_message"],
|
||||||
|
@ -27,8 +27,9 @@ const customFieldActionMap = {
|
||||||
|
|
||||||
const values = ["present", "true", "false"];
|
const values = ["present", "true", "false"];
|
||||||
|
|
||||||
export default Component.extend(Subscription, {
|
export default Component.extend({
|
||||||
classNameBindings: [":mapper-selector", "activeType"],
|
classNameBindings: [":mapper-selector", "activeType"],
|
||||||
|
subscription: service(),
|
||||||
|
|
||||||
showText: computed("activeType", function () {
|
showText: computed("activeType", function () {
|
||||||
return this.showInput("text");
|
return this.showInput("text");
|
||||||
|
@ -130,7 +131,11 @@ export default Component.extend(Subscription, {
|
||||||
return this.connector === "is";
|
return this.connector === "is";
|
||||||
}),
|
}),
|
||||||
|
|
||||||
@discourseComputed("site.groups", "guestGroup", "subscriptionType")
|
@discourseComputed(
|
||||||
|
"site.groups",
|
||||||
|
"guestGroup",
|
||||||
|
"subscription.subscriptionType"
|
||||||
|
)
|
||||||
groups(groups, guestGroup, subscriptionType) {
|
groups(groups, guestGroup, subscriptionType) {
|
||||||
let result = groups;
|
let result = groups;
|
||||||
if (!guestGroup) {
|
if (!guestGroup) {
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
<DButton
|
||||||
|
@action={{this.click}}
|
||||||
|
class="wizard-subscription-badge {{this.subscription.subscriptionType}}"
|
||||||
|
@title={{this.title}}
|
||||||
|
>
|
||||||
|
<svg
|
||||||
|
width="300px"
|
||||||
|
height="300px"
|
||||||
|
viewBox="0 0 300 300"
|
||||||
|
version="1.1"
|
||||||
|
xmlns="http://www.w3.org/2000/svg"
|
||||||
|
xmlns:xlink="http://www.w3.org/1999/xlink"
|
||||||
|
>
|
||||||
|
<g
|
||||||
|
id="pavilion-logo"
|
||||||
|
stroke="none"
|
||||||
|
stroke-width="1"
|
||||||
|
fill="none"
|
||||||
|
fill-rule="evenodd"
|
||||||
|
>
|
||||||
|
<path
|
||||||
|
id="Combined-Shape"
|
||||||
|
stroke="currentColor"
|
||||||
|
stroke-width="35"
|
||||||
|
d="M41.1381822,291.00006 L40.5778853,130.009744 M258.850727,291.638415 L259.290397,130.37133 M36.0002279,140.721678 L139.995368,36.2122772 M263.350577,141.009083 L138.927245,16.2478517"
|
||||||
|
></path>
|
||||||
|
</g>
|
||||||
|
</svg>
|
||||||
|
<span>{{this.label}}</span>
|
||||||
|
</DButton>
|
33
assets/javascripts/discourse/components/wizard-subscription-badge.js
Normale Datei
33
assets/javascripts/discourse/components/wizard-subscription-badge.js
Normale Datei
|
@ -0,0 +1,33 @@
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
import { action, computed } from "@ember/object";
|
||||||
|
import Component from "@glimmer/component";
|
||||||
|
import DiscourseURL from "discourse/lib/url";
|
||||||
|
import I18n from "I18n";
|
||||||
|
|
||||||
|
export default class WizardSubscriptionBadge extends Component {
|
||||||
|
@service subscription;
|
||||||
|
|
||||||
|
@computed("subscription.subscriptionType")
|
||||||
|
get i18nKey() {
|
||||||
|
return `admin.wizard.subscription.type.${
|
||||||
|
this.subscription.subscriptionType
|
||||||
|
? this.subscription.subscriptionType
|
||||||
|
: "none"
|
||||||
|
}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed("i18nKey")
|
||||||
|
get title() {
|
||||||
|
return `${this.i18nKey}.title`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed("i18nKey")
|
||||||
|
get label() {
|
||||||
|
return I18n.t(`${this.i18nKey}.label`);
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
click() {
|
||||||
|
DiscourseURL.routeTo(this.subscription.subscriptionLink);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,30 +0,0 @@
|
||||||
import Component from "@ember/component";
|
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import Subscription from "../mixins/subscription";
|
|
||||||
import DiscourseURL from "discourse/lib/url";
|
|
||||||
import I18n from "I18n";
|
|
||||||
|
|
||||||
export default Component.extend(Subscription, {
|
|
||||||
tagName: "a",
|
|
||||||
classNameBindings: [":wizard-subscription-badge", "subscriptionType"],
|
|
||||||
attributeBindings: ["title"],
|
|
||||||
|
|
||||||
@discourseComputed("subscriptionType")
|
|
||||||
i18nKey(type) {
|
|
||||||
return `admin.wizard.subscription.type.${type ? type : "none"}`;
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("i18nKey")
|
|
||||||
title(i18nKey) {
|
|
||||||
return I18n.t(`${i18nKey}.title`);
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("i18nKey")
|
|
||||||
label(i18nKey) {
|
|
||||||
return I18n.t(`${i18nKey}.label`);
|
|
||||||
},
|
|
||||||
|
|
||||||
click() {
|
|
||||||
DiscourseURL.routeTo(this.subscriptionLink);
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -0,0 +1,17 @@
|
||||||
|
<div
|
||||||
|
class="wizard-subscription-container
|
||||||
|
{{if this.subscription.subscribed 'subscribed'}}"
|
||||||
|
>
|
||||||
|
<div class="subscription-header">
|
||||||
|
<h4>{{i18n "admin.wizard.subscription.title"}}</h4>
|
||||||
|
|
||||||
|
<a href={{subscriptionLink}} title={{i18n subscribedTitle}}>
|
||||||
|
{{d-icon subscribedIcon}}
|
||||||
|
{{i18n subscribedLabel}}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="subscription-settings">
|
||||||
|
{{yield}}
|
||||||
|
</div>
|
||||||
|
</div>
|
|
@ -0,0 +1,26 @@
|
||||||
|
import Component from "@glimmer/component";
|
||||||
|
import { computed } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
|
export default class WizardSubscriptionContainer extends Component {
|
||||||
|
@service subscription;
|
||||||
|
|
||||||
|
@computed("subscription.subscribed")
|
||||||
|
get subscribedIcon() {
|
||||||
|
return this.subscription.subscribed ? "check" : "times";
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed("subscription.subscribed")
|
||||||
|
get subscribedLabel() {
|
||||||
|
return `admin.wizard.subscription.${
|
||||||
|
this.subscription.subscribed ? "subscribed" : "not_subscribed"
|
||||||
|
}.label`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed("subscription.subscribed")
|
||||||
|
get subscribedTitle() {
|
||||||
|
return `admin.wizard.subscription.${
|
||||||
|
this.subscription.subscribed ? "subscribed" : "not_subscribed"
|
||||||
|
}.title`;
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,26 +0,0 @@
|
||||||
import Component from "@ember/component";
|
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import Subscription from "../mixins/subscription";
|
|
||||||
|
|
||||||
export default Component.extend(Subscription, {
|
|
||||||
classNameBindings: [":wizard-subscription-container", "subscribed"],
|
|
||||||
|
|
||||||
@discourseComputed("subscribed")
|
|
||||||
subscribedIcon(subscribed) {
|
|
||||||
return subscribed ? "check" : "times";
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("subscribed")
|
|
||||||
subscribedLabel(subscribed) {
|
|
||||||
return `admin.wizard.subscription.${
|
|
||||||
subscribed ? "subscribed" : "not_subscribed"
|
|
||||||
}.label`;
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("subscribed")
|
|
||||||
subscribedTitle(subscribed) {
|
|
||||||
return `admin.wizard.subscription.${
|
|
||||||
subscribed ? "subscribed" : "not_subscribed"
|
|
||||||
}.title`;
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
<DButton
|
||||||
|
@action={{this.click}}
|
||||||
|
class="btn btn-pavilion-support {{this.subscription.subscriptionType}}"
|
||||||
|
@title={{this.title}}
|
||||||
|
@label={{this.label}}
|
||||||
|
@icon={{this.icon}}
|
||||||
|
/>
|
34
assets/javascripts/discourse/components/wizard-subscription-cta.js
Normale Datei
34
assets/javascripts/discourse/components/wizard-subscription-cta.js
Normale Datei
|
@ -0,0 +1,34 @@
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
import { action, computed } from "@ember/object";
|
||||||
|
import Component from "@glimmer/component";
|
||||||
|
|
||||||
|
export default class WizardSubscriptionCta extends Component {
|
||||||
|
@service subscription;
|
||||||
|
|
||||||
|
@computed("subscription.subscribed")
|
||||||
|
get i18nKey() {
|
||||||
|
return `admin.wizard.subscription.cta.${
|
||||||
|
this.subscription.subscribed ? "subscribed" : "none"
|
||||||
|
}`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed("subscription.subscribed")
|
||||||
|
get icon() {
|
||||||
|
return this.subscription.subscribed ? "far-life-ring" : "external-link-alt";
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed("i18nKey")
|
||||||
|
get title() {
|
||||||
|
return `${this.i18nKey}.title`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@computed("i18nKey")
|
||||||
|
get label() {
|
||||||
|
return `${this.i18nKey}.label`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
click() {
|
||||||
|
window.open(this.subscription.subscriptionCtaLink, "_blank").focus();
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,36 +0,0 @@
|
||||||
import Component from "@ember/component";
|
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
|
||||||
import Subscription from "../mixins/subscription";
|
|
||||||
import I18n from "I18n";
|
|
||||||
|
|
||||||
export default Component.extend(Subscription, {
|
|
||||||
tagName: "a",
|
|
||||||
classNameBindings: [":btn", ":btn-pavilion-support", "subscriptionType"],
|
|
||||||
attributeBindings: ["title"],
|
|
||||||
|
|
||||||
@discourseComputed("subscribed")
|
|
||||||
i18nKey(subscribed) {
|
|
||||||
return `admin.wizard.subscription.cta.${
|
|
||||||
subscribed ? "subscribed" : "none"
|
|
||||||
}`;
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("subscribed")
|
|
||||||
icon(subscribed) {
|
|
||||||
return subscribed ? "far-life-ring" : "external-link-alt";
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("i18nKey")
|
|
||||||
title(i18nKey) {
|
|
||||||
return I18n.t(`${i18nKey}.title`);
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("i18nKey")
|
|
||||||
label(i18nKey) {
|
|
||||||
return I18n.t(`${i18nKey}.label`);
|
|
||||||
},
|
|
||||||
|
|
||||||
click() {
|
|
||||||
window.open(this.subscriptionCtaLink, "_blank").focus();
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,5 +1,5 @@
|
||||||
import SingleSelectComponent from "select-kit/components/single-select";
|
import SingleSelectComponent from "select-kit/components/single-select";
|
||||||
import Subscription from "../mixins/subscription";
|
import { inject as service } from "@ember/service";
|
||||||
import { filterValues } from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
|
import { filterValues } from "discourse/plugins/discourse-custom-wizard/discourse/lib/wizard-schema";
|
||||||
import discourseComputed from "discourse-common/utils/decorators";
|
import discourseComputed from "discourse-common/utils/decorators";
|
||||||
import I18n from "I18n";
|
import I18n from "I18n";
|
||||||
|
@ -12,8 +12,9 @@ const nameKey = function (feature, attribute, value) {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
export default SingleSelectComponent.extend(Subscription, {
|
export default SingleSelectComponent.extend({
|
||||||
classNames: ["combo-box", "wizard-subscription-selector"],
|
classNames: ["combo-box", "wizard-subscription-selector"],
|
||||||
|
subscription: service(),
|
||||||
|
|
||||||
selectKitOptions: {
|
selectKitOptions: {
|
||||||
autoFilterable: false,
|
autoFilterable: false,
|
||||||
|
@ -26,7 +27,7 @@ export default SingleSelectComponent.extend(Subscription, {
|
||||||
},
|
},
|
||||||
|
|
||||||
allowedSubscriptionTypes(feature, attribute, value) {
|
allowedSubscriptionTypes(feature, attribute, value) {
|
||||||
let attributes = this.subscriptionAttributes[feature];
|
let attributes = this.subscription.subscriptionAttributes[feature];
|
||||||
if (!attributes || !attributes[attribute]) {
|
if (!attributes || !attributes[attribute]) {
|
||||||
return ["none"];
|
return ["none"];
|
||||||
}
|
}
|
||||||
|
@ -59,10 +60,9 @@ export default SingleSelectComponent.extend(Subscription, {
|
||||||
name: I18n.t(nameKey(feature, attribute, value)),
|
name: I18n.t(nameKey(feature, attribute, value)),
|
||||||
subscriptionRequired,
|
subscriptionRequired,
|
||||||
};
|
};
|
||||||
|
|
||||||
if (subscriptionRequired) {
|
if (subscriptionRequired) {
|
||||||
let subscribed = allowedSubscriptionTypes.includes(
|
let subscribed = allowedSubscriptionTypes.includes(
|
||||||
this.subscriptionType
|
this.subscription.subscriptionType
|
||||||
);
|
);
|
||||||
let selectorKey = subscribed ? "subscribed" : "not_subscribed";
|
let selectorKey = subscribed ? "subscribed" : "not_subscribed";
|
||||||
let selectorLabel = `admin.wizard.subscription.${selectorKey}.selector`;
|
let selectorLabel = `admin.wizard.subscription.${selectorKey}.selector`;
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
<div class="supplier-authorize">
|
||||||
|
{{#if authorized}}
|
||||||
|
{{conditional-loading-spinner size="small" condition=unauthorizing}}
|
||||||
|
<DButton
|
||||||
|
class="deauthorize"
|
||||||
|
@title=admin.wizard.subscription.deauthorize.title
|
||||||
|
@disabled={{unauthorizing}}
|
||||||
|
@action={{this.deauthorize}}
|
||||||
|
>
|
||||||
|
{{i18n "admin.wizard.subscription.deauthorize.label"}}
|
||||||
|
</DButton>
|
||||||
|
{{else}}
|
||||||
|
<DButton
|
||||||
|
@icon="id-card"
|
||||||
|
class="btn-primary"
|
||||||
|
@label=admin.wizard.subscription.authorize.label
|
||||||
|
@title=admin.wizard.subscription.authorize.title
|
||||||
|
@action={{this.authorize}}
|
||||||
|
/>
|
||||||
|
{{/if}}
|
||||||
|
<WizardSubscriptionBadge />
|
||||||
|
<WizardSubscriptionCta />
|
||||||
|
</div>
|
|
@ -0,0 +1,54 @@
|
||||||
|
import { action } from "@ember/object";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
import Component from "@glimmer/component";
|
||||||
|
import { tracked } from "@glimmer/tracking";
|
||||||
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
|
||||||
|
export default class WizardSubscriptionStatus extends Component {
|
||||||
|
@service siteSettings;
|
||||||
|
@service subscription;
|
||||||
|
@tracked supplierId = null;
|
||||||
|
@tracked authorized = false;
|
||||||
|
@tracked unauthorizing = false;
|
||||||
|
basePath = "/admin/plugins/subscription-client/suppliers";
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
super(...arguments);
|
||||||
|
ajax(`${this.basePath}`)
|
||||||
|
.then((result) => {
|
||||||
|
this.supplierId = result.suppliers[0].id;
|
||||||
|
this.authorized = result.suppliers[0].authorized;
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.subscription.retrieveSubscriptionStatus();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
authorize() {
|
||||||
|
window.location.href = `${this.basePath}/authorize?supplier_id=${this.supplierId}&final_landing_path=/admin/wizards/wizard`;
|
||||||
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
deauthorize() {
|
||||||
|
this.unauthorizing = true;
|
||||||
|
|
||||||
|
ajax(`${this.basePath}/authorize`, {
|
||||||
|
type: "DELETE",
|
||||||
|
data: {
|
||||||
|
supplier_id: this.supplierId,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
.then((result) => {
|
||||||
|
this.supplierId = result.supplier.id;
|
||||||
|
this.authorized = !(result.supplier.authorized_at === null);
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
this.unauthorizing = false;
|
||||||
|
this.subscription.retrieveSubscriptionStatus();
|
||||||
|
//window.location.reload();
|
||||||
|
})
|
||||||
|
.catch(popupAjaxError);
|
||||||
|
}
|
||||||
|
}
|
|
@ -1,9 +1,12 @@
|
||||||
import Controller from "@ember/controller";
|
import Controller from "@ember/controller";
|
||||||
import { equal, or } from "@ember/object/computed";
|
import { or } from "@ember/object/computed";
|
||||||
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default Controller.extend({
|
export default Controller.extend({
|
||||||
businessSubscription: equal("subscriptionType", "business"),
|
subscription: service(),
|
||||||
communitySubscription: equal("subscriptionType", "community"),
|
|
||||||
standardSubscription: equal("subscriptionType", "standard"),
|
showApi: or(
|
||||||
showApi: or("businessSubscription", "communitySubscription"),
|
"subscription.businessSubscription",
|
||||||
|
"subscription.communitySubscription"
|
||||||
|
),
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,53 +0,0 @@
|
||||||
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";
|
|
||||||
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() {
|
|
||||||
return getOwner(this).lookup("controller:admin-wizards");
|
|
||||||
},
|
|
||||||
|
|
||||||
subscribed: readOnly("adminWizards.subscribed"),
|
|
||||||
subscriptionType: readOnly("adminWizards.subscriptionType"),
|
|
||||||
businessSubscription: readOnly("adminWizards.businessSubscription"),
|
|
||||||
communitySubscription: readOnly("adminWizards.communitySubscription"),
|
|
||||||
standardSubscription: readOnly("adminWizards.standardSubscription"),
|
|
||||||
subscriptionAttributes: readOnly("adminWizards.subscriptionAttributes"),
|
|
||||||
subscriptionClientInstalled: readOnly(
|
|
||||||
"adminWizards.subscriptionClientInstalled"
|
|
||||||
),
|
|
||||||
|
|
||||||
@discourseComputed("subscriptionClientInstalled")
|
|
||||||
subscriptionLink(subscriptionClientInstalled) {
|
|
||||||
return subscriptionClientInstalled
|
|
||||||
? this.subscriptionClientUrl
|
|
||||||
: this.subscriptionLandingUrl;
|
|
||||||
},
|
|
||||||
|
|
||||||
@discourseComputed("subscriptionType")
|
|
||||||
subscriptionCtaLink(subscriptionType) {
|
|
||||||
switch (subscriptionType) {
|
|
||||||
case "none":
|
|
||||||
return PRODUCT_PAGE;
|
|
||||||
case "standard":
|
|
||||||
return SUPPORT_MESSAGE;
|
|
||||||
case "business":
|
|
||||||
return SUPPORT_MESSAGE;
|
|
||||||
case "community":
|
|
||||||
return MANAGER_CATEGORY;
|
|
||||||
default:
|
|
||||||
return PRODUCT_PAGE;
|
|
||||||
}
|
|
||||||
},
|
|
||||||
});
|
|
|
@ -1,23 +1,9 @@
|
||||||
import DiscourseRoute from "discourse/routes/discourse";
|
import DiscourseRoute from "discourse/routes/discourse";
|
||||||
import { ajax } from "discourse/lib/ajax";
|
|
||||||
import { inject as service } from "@ember/service";
|
import { inject as service } from "@ember/service";
|
||||||
|
|
||||||
export default DiscourseRoute.extend({
|
export default DiscourseRoute.extend({
|
||||||
router: service(),
|
router: service(),
|
||||||
|
|
||||||
model() {
|
|
||||||
return ajax("/admin/wizards");
|
|
||||||
},
|
|
||||||
|
|
||||||
setupController(controller, model) {
|
|
||||||
controller.setProperties({
|
|
||||||
subscribed: model.subscribed,
|
|
||||||
subscriptionType: model.subscription_type,
|
|
||||||
subscriptionAttributes: model.subscription_attributes,
|
|
||||||
subscriptionClientInstalled: model.subscription_client_installed,
|
|
||||||
});
|
|
||||||
},
|
|
||||||
|
|
||||||
afterModel(model, transition) {
|
afterModel(model, transition) {
|
||||||
if (transition.targetName === "adminWizards.index") {
|
if (transition.targetName === "adminWizards.index") {
|
||||||
this.router.transitionTo("adminWizardsWizard");
|
this.router.transitionTo("adminWizardsWizard");
|
||||||
|
|
57
assets/javascripts/discourse/services/subscription.js
Normale Datei
57
assets/javascripts/discourse/services/subscription.js
Normale Datei
|
@ -0,0 +1,57 @@
|
||||||
|
import Service from "@ember/service";
|
||||||
|
import { tracked } from "@glimmer/tracking";
|
||||||
|
import { ajax } from "discourse/lib/ajax";
|
||||||
|
import { popupAjaxError } from "discourse/lib/ajax-error";
|
||||||
|
|
||||||
|
const PRODUCT_PAGE = "https://custom-wizard.pavilion.tech";
|
||||||
|
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 class SubscriptionService extends Service {
|
||||||
|
@tracked subscribed = false;
|
||||||
|
@tracked subscriptionType = "";
|
||||||
|
@tracked businessSubscription = false;
|
||||||
|
@tracked communitySubscription = false;
|
||||||
|
@tracked standardSubscription = false;
|
||||||
|
@tracked subscriptionAttributes = {};
|
||||||
|
subscriptionLandingUrl = PRODUCT_PAGE;
|
||||||
|
|
||||||
|
init() {
|
||||||
|
super.init(...arguments);
|
||||||
|
this.retrieveSubscriptionStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
retrieveSubscriptionStatus() {
|
||||||
|
ajax("/admin/wizards/subscription")
|
||||||
|
.then((result) => {
|
||||||
|
this.subscribed = result.subscribed;
|
||||||
|
this.subscriptionType = result.subscription_type;
|
||||||
|
this.subscriptionAttributes = result.subscription_attributes;
|
||||||
|
this.businessSubscription = this.subscriptionType === "business";
|
||||||
|
this.communitySubscription = this.subscriptionType === "community";
|
||||||
|
this.standardSubscription = this.subscriptionType === "standard";
|
||||||
|
})
|
||||||
|
.catch(popupAjaxError);
|
||||||
|
}
|
||||||
|
|
||||||
|
get subscriptionLink() {
|
||||||
|
return this.subscriptionLandingUrl;
|
||||||
|
}
|
||||||
|
|
||||||
|
get subscriptionCtaLink() {
|
||||||
|
switch (this.subscriptionType) {
|
||||||
|
case "none":
|
||||||
|
return PRODUCT_PAGE;
|
||||||
|
case "standard":
|
||||||
|
return SUPPORT_MESSAGE;
|
||||||
|
case "business":
|
||||||
|
return SUPPORT_MESSAGE;
|
||||||
|
case "community":
|
||||||
|
return MANAGER_CATEGORY;
|
||||||
|
default:
|
||||||
|
return PRODUCT_PAGE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,8 +18,7 @@
|
||||||
}}
|
}}
|
||||||
|
|
||||||
<div class="admin-actions">
|
<div class="admin-actions">
|
||||||
{{wizard-subscription-badge}}
|
<WizardSubscriptionStatus />
|
||||||
{{wizard-subscription-cta}}
|
|
||||||
</div>
|
</div>
|
||||||
{{/admin-nav}}
|
{{/admin-nav}}
|
||||||
|
|
||||||
|
|
|
@ -1,24 +0,0 @@
|
||||||
<svg
|
|
||||||
width="300px"
|
|
||||||
height="300px"
|
|
||||||
viewBox="0 0 300 300"
|
|
||||||
version="1.1"
|
|
||||||
xmlns="http://www.w3.org/2000/svg"
|
|
||||||
xmlns:xlink="http://www.w3.org/1999/xlink"
|
|
||||||
>
|
|
||||||
<g
|
|
||||||
id="pavilion-logo"
|
|
||||||
stroke="none"
|
|
||||||
stroke-width="1"
|
|
||||||
fill="none"
|
|
||||||
fill-rule="evenodd"
|
|
||||||
>
|
|
||||||
<path
|
|
||||||
id="Combined-Shape"
|
|
||||||
stroke="currentColor"
|
|
||||||
stroke-width="35"
|
|
||||||
d="M41.1381822,291.00006 L40.5778853,130.009744 M258.850727,291.638415 L259.290397,130.37133 M36.0002279,140.721678 L139.995368,36.2122772 M263.350577,141.009083 L138.927245,16.2478517"
|
|
||||||
></path>
|
|
||||||
</g>
|
|
||||||
</svg>
|
|
||||||
<span>{{label}}</span>
|
|
Vorher Breite: | Höhe: | Größe: 602 B |
|
@ -1,12 +0,0 @@
|
||||||
<div class="subscription-header">
|
|
||||||
<h4>{{i18n "admin.wizard.subscription.title"}}</h4>
|
|
||||||
|
|
||||||
<a href={{subscriptionLink}} title={{i18n subscribedTitle}}>
|
|
||||||
{{d-icon subscribedIcon}}
|
|
||||||
{{i18n subscribedLabel}}
|
|
||||||
</a>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="subscription-settings">
|
|
||||||
{{yield}}
|
|
||||||
</div>
|
|
|
@ -1 +0,0 @@
|
||||||
{{d-icon icon}}{{label}}
|
|
|
@ -49,6 +49,10 @@ $error: #ef1700;
|
||||||
.btn-pavilion-support {
|
.btn-pavilion-support {
|
||||||
margin-left: 10px;
|
margin-left: 10px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.supplier-authorize .btn-primary {
|
||||||
|
margin-right: 10px;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.wizard-message {
|
.wizard-message {
|
||||||
|
|
|
@ -545,6 +545,12 @@ en:
|
||||||
|
|
||||||
subscription:
|
subscription:
|
||||||
title: Subscriber Features
|
title: Subscriber Features
|
||||||
|
authorize:
|
||||||
|
label: Authorize
|
||||||
|
title: Authorize your subscription on this site
|
||||||
|
deauthorize:
|
||||||
|
label: deauthorize
|
||||||
|
title: Deauthorize your subscription on this site
|
||||||
subscribed:
|
subscribed:
|
||||||
label: Subscribed
|
label: Subscribed
|
||||||
title: You're subscribed and can use these features
|
title: You're subscribed and can use these features
|
||||||
|
|
|
@ -14,6 +14,7 @@ Discourse::Application.routes.append do
|
||||||
|
|
||||||
scope module: 'custom_wizard', constraints: AdminConstraint.new do
|
scope module: 'custom_wizard', constraints: AdminConstraint.new do
|
||||||
get 'admin/wizards' => 'admin#index'
|
get 'admin/wizards' => 'admin#index'
|
||||||
|
get 'admin/wizards/subscription' => 'subscription#index'
|
||||||
|
|
||||||
get 'admin/wizards/wizard' => 'admin_wizard#index'
|
get 'admin/wizards/wizard' => 'admin_wizard#index'
|
||||||
get 'admin/wizards/wizard/create' => 'admin#index'
|
get 'admin/wizards/wizard/create' => 'admin#index'
|
||||||
|
|
|
@ -1,4 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
require "discourse_subscription_client"
|
||||||
|
|
||||||
class CustomWizard::Subscription
|
class CustomWizard::Subscription
|
||||||
PRODUCT_HIERARCHY = %w[
|
PRODUCT_HIERARCHY = %w[
|
||||||
community
|
community
|
||||||
|
@ -10,19 +12,19 @@ class CustomWizard::Subscription
|
||||||
{
|
{
|
||||||
wizard: {
|
wizard: {
|
||||||
required: {
|
required: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
permitted: {
|
permitted: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*', "!#{CustomWizard::Wizard::GUEST_GROUP_ID}"]
|
community: ['*', "!#{CustomWizard::Wizard::GUEST_GROUP_ID}"]
|
||||||
},
|
},
|
||||||
restart_on_revisit: {
|
restart_on_revisit: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -30,19 +32,19 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
required_data: {
|
required_data: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
permitted_params: {
|
permitted_params: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -50,19 +52,19 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
field: {
|
field: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ['text', 'textarea', 'text_only', 'date', 'time', 'date_time', 'number', 'checkbox', 'dropdown', 'upload'],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
realtime_validations: {
|
realtime_validations: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ['*'],
|
standard: ['*'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -70,7 +72,7 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ['create_topic', 'update_profile', 'open_composer', 'route_to'],
|
||||||
standard: ['create_topic', 'update_profile', 'open_composer', 'route_to', 'send_message', 'watch_categories', 'watch_tags', 'add_to_group'],
|
standard: ['create_topic', 'update_profile', 'open_composer', 'route_to', 'send_message', 'watch_categories', 'watch_tags', 'add_to_group'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -78,13 +80,13 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
custom_field: {
|
custom_field: {
|
||||||
klass: {
|
klass: {
|
||||||
none: ['*'],
|
none: ['topic', 'post'],
|
||||||
standard: ['topic', 'post'],
|
standard: ['topic', 'post'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ['string', 'boolean', 'integer'],
|
||||||
standard: ['string', 'boolean', 'integer'],
|
standard: ['string', 'boolean', 'integer'],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -92,7 +94,7 @@ class CustomWizard::Subscription
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
all: {
|
all: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: [],
|
standard: [],
|
||||||
business: ['*'],
|
business: ['*'],
|
||||||
community: ['*']
|
community: ['*']
|
||||||
|
@ -105,24 +107,22 @@ class CustomWizard::Subscription
|
||||||
:product_slug
|
:product_slug
|
||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
if CustomWizard::Subscription.client_installed?
|
result = ::DiscourseSubscriptionClient.find_subscriptions("discourse-custom-wizard")
|
||||||
result = DiscourseSubscriptionClient.find_subscriptions("discourse-custom-wizard")
|
|
||||||
|
|
||||||
if result&.any?
|
if result&.any?
|
||||||
ids_and_slugs = result.subscriptions.map do |subscription|
|
ids_and_slugs = result.subscriptions.map do |subscription|
|
||||||
{
|
{
|
||||||
id: subscription.product_id,
|
id: subscription.product_id,
|
||||||
slug: result.products[subscription.product_id]
|
slug: result.products[subscription.product_id]
|
||||||
}
|
}
|
||||||
end
|
|
||||||
|
|
||||||
id_and_slug = ids_and_slugs.sort do |a, b|
|
|
||||||
PRODUCT_HIERARCHY.index(b[:slug]) - PRODUCT_HIERARCHY.index(a[:slug])
|
|
||||||
end.first
|
|
||||||
|
|
||||||
@product_id = id_and_slug[:id]
|
|
||||||
@product_slug = id_and_slug[:slug]
|
|
||||||
end
|
end
|
||||||
|
|
||||||
|
id_and_slug = ids_and_slugs.sort do |a, b|
|
||||||
|
PRODUCT_HIERARCHY.index(b[:slug]) - PRODUCT_HIERARCHY.index(a[:slug])
|
||||||
|
end.first
|
||||||
|
|
||||||
|
@product_id = id_and_slug[:id]
|
||||||
|
@product_slug = id_and_slug[:slug]
|
||||||
end
|
end
|
||||||
|
|
||||||
@product_slug ||= ENV["CUSTOM_WIZARD_PRODUCT_SLUG"]
|
@product_slug ||= ENV["CUSTOM_WIZARD_PRODUCT_SLUG"]
|
||||||
|
@ -154,11 +154,14 @@ class CustomWizard::Subscription
|
||||||
end
|
end
|
||||||
|
|
||||||
def type
|
def type
|
||||||
return :business
|
return :none unless subscribed?
|
||||||
|
return :business if business?
|
||||||
|
return :standard if standard?
|
||||||
|
:community if community?
|
||||||
end
|
end
|
||||||
|
|
||||||
def subscribed?
|
def subscribed?
|
||||||
true
|
standard? || business? || community?
|
||||||
end
|
end
|
||||||
|
|
||||||
def standard?
|
def standard?
|
||||||
|
@ -166,17 +169,13 @@ class CustomWizard::Subscription
|
||||||
end
|
end
|
||||||
|
|
||||||
def business?
|
def business?
|
||||||
true
|
product_slug === "business"
|
||||||
end
|
end
|
||||||
|
|
||||||
def community?
|
def community?
|
||||||
product_slug === "community"
|
product_slug === "community"
|
||||||
end
|
end
|
||||||
|
|
||||||
def self.client_installed?
|
|
||||||
defined?(DiscourseSubscriptionClient) == 'constant' && DiscourseSubscriptionClient.class == Module
|
|
||||||
end
|
|
||||||
|
|
||||||
def self.subscribed?
|
def self.subscribed?
|
||||||
new.subscribed?
|
new.subscribed?
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
# name: discourse-custom-wizard
|
# name: discourse-custom-wizard
|
||||||
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
# about: Forms for Discourse. Better onboarding, structured posting, data enrichment, automated actions and much more.
|
||||||
# version: 2.4.23
|
# version: 2.4.24
|
||||||
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
|
# authors: Angus McLeod, Faizaan Gagan, Robert Barrow, Keegan George, Kaitlin Maddever, Juan Marcos Gutierrez Ramos
|
||||||
# url: https://github.com/paviliondev/discourse-custom-wizard
|
# url: https://github.com/paviliondev/discourse-custom-wizard
|
||||||
# contact_emails: development@pavilion.tech
|
# contact_emails: development@pavilion.tech
|
||||||
# subscription_url: https://coop.pavilion.tech
|
# subscription_url: https://coop.pavilion.tech
|
||||||
|
|
||||||
gem 'liquid', '5.0.1', require: true
|
gem 'liquid', '5.0.1', require: true
|
||||||
|
gem "discourse_subscription_client", "0.1.0.pre15", require_name: "discourse_subscription_client"
|
||||||
|
|
||||||
register_asset 'stylesheets/common/admin.scss'
|
register_asset 'stylesheets/common/admin.scss'
|
||||||
register_asset 'stylesheets/common/wizard.scss'
|
register_asset 'stylesheets/common/wizard.scss'
|
||||||
|
|
||||||
|
@ -35,6 +37,7 @@ after_initialize do
|
||||||
../lib/custom_wizard/engine.rb
|
../lib/custom_wizard/engine.rb
|
||||||
../config/routes.rb
|
../config/routes.rb
|
||||||
../app/controllers/custom_wizard/admin/admin.rb
|
../app/controllers/custom_wizard/admin/admin.rb
|
||||||
|
../app/controllers/custom_wizard/admin/subscription.rb
|
||||||
../app/controllers/custom_wizard/admin/wizard.rb
|
../app/controllers/custom_wizard/admin/wizard.rb
|
||||||
../app/controllers/custom_wizard/admin/submissions.rb
|
../app/controllers/custom_wizard/admin/submissions.rb
|
||||||
../app/controllers/custom_wizard/admin/api.rb
|
../app/controllers/custom_wizard/admin/api.rb
|
||||||
|
|
|
@ -42,6 +42,7 @@ describe CustomWizard::Action do
|
||||||
}
|
}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
Group.refresh_automatic_group!(:trust_level_2)
|
Group.refresh_automatic_group!(:trust_level_2)
|
||||||
update_template(wizard_template)
|
update_template(wizard_template)
|
||||||
end
|
end
|
||||||
|
|
|
@ -29,6 +29,7 @@ describe CustomWizard::Builder do
|
||||||
}
|
}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
Group.refresh_automatic_group!(:trust_level_3)
|
Group.refresh_automatic_group!(:trust_level_3)
|
||||||
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
||||||
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe CustomWizard::CustomField do
|
||||||
let(:custom_field_subscription_json) { get_wizard_fixture("custom_field/subscription_custom_fields") }
|
let(:custom_field_subscription_json) { get_wizard_fixture("custom_field/subscription_custom_fields") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::CustomField.invalidate_cache
|
CustomWizard::CustomField.invalidate_cache
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe CustomWizard::Submission do
|
||||||
let(:guest_id) { CustomWizard::Wizard.generate_guest_id }
|
let(:guest_id) { CustomWizard::Wizard.generate_guest_id }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(template_json, skip_jobs: true)
|
CustomWizard::Template.save(template_json, skip_jobs: true)
|
||||||
@wizard = CustomWizard::Wizard.create(template_json["id"], user)
|
@wizard = CustomWizard::Wizard.create(template_json["id"], user)
|
||||||
described_class.new(@wizard, step_1_field_1: "I am user submission").save
|
described_class.new(@wizard, step_1_field_1: "I am user submission").save
|
||||||
|
|
|
@ -13,41 +13,9 @@ describe CustomWizard::Subscription do
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
after do
|
context "with subscription client gem mocked out" do
|
||||||
undefine_client_classes
|
|
||||||
end
|
|
||||||
|
|
||||||
it "detects the subscription client" do
|
|
||||||
undefine_client_classes
|
|
||||||
expect(described_class.client_installed?).to eq(false)
|
|
||||||
end
|
|
||||||
|
|
||||||
context "without a subscription client" do
|
|
||||||
it "is not subscribed" do
|
|
||||||
expect(described_class.subscribed?).to eq(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "has none type" do
|
|
||||||
subscription = described_class.new
|
|
||||||
expect(subscription.type).to eq(:none)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "non subscriber features are included" do
|
|
||||||
expect(described_class.includes?(:wizard, :after_signup, true)).to eq(true)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "subscriber features are not included" do
|
|
||||||
expect(described_class.includes?(:wizard, :permitted, {})).to eq(false)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context "with subscription client" do
|
|
||||||
before do
|
before do
|
||||||
define_client_classes
|
stub_out_subscription_classes
|
||||||
end
|
|
||||||
|
|
||||||
it "detects the subscription client" do
|
|
||||||
expect(described_class.client_installed?).to eq(true)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "without a subscription" do
|
context "without a subscription" do
|
||||||
|
@ -69,11 +37,12 @@ describe CustomWizard::Subscription do
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with subscriptions" do
|
context "with subscriptions" do
|
||||||
|
|
||||||
def get_subscription_result(product_ids)
|
def get_subscription_result(product_ids)
|
||||||
result = DiscourseSubscriptionClient::Subscriptions::Result.new
|
result = DiscourseSubscriptionClient::Subscriptions::Result.new
|
||||||
result.supplier = SubscriptionClientSupplier.new(product_slugs)
|
result.supplier = SubscriptionClientSupplier.new(product_slugs)
|
||||||
result.resource = SubscriptionClientResource.new
|
result.resource = SubscriptionClientResource.new
|
||||||
result.subscriptions = product_ids.map { |product_id| SubscriptionClientSubscription.new(product_id) }
|
result.subscriptions = product_ids.map { |product_id| ::SubscriptionClientSubscription.new(product_id) }
|
||||||
result.products = product_slugs
|
result.products = product_slugs
|
||||||
result
|
result
|
||||||
end
|
end
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe CustomWizard::Template do
|
||||||
fab!(:upload) { Fabricate(:upload) }
|
fab!(:upload) { Fabricate(:upload) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(template_json, skip_jobs: true)
|
CustomWizard::Template.save(template_json, skip_jobs: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -39,6 +39,10 @@ describe CustomWizard::TemplateValidator do
|
||||||
expect(validator.errors.first.message).to eq("Liquid syntax error in #{object_id}: #{message}")
|
expect(validator.errors.first.message).to eq("Liquid syntax error in #{object_id}: #{message}")
|
||||||
end
|
end
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
|
end
|
||||||
|
|
||||||
it "validates valid templates" do
|
it "validates valid templates" do
|
||||||
expect(
|
expect(
|
||||||
CustomWizard::TemplateValidator.new(template).perform
|
CustomWizard::TemplateValidator.new(template).perform
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe CustomWizard::UpdateValidator do
|
||||||
let(:url_field) { get_wizard_fixture("field/url") }
|
let(:url_field) { get_wizard_fixture("field/url") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(template, skip_jobs: true)
|
CustomWizard::Template.save(template, skip_jobs: true)
|
||||||
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,7 @@ describe CustomWizard::Wizard do
|
||||||
let(:step_json) { get_wizard_fixture("step/step") }
|
let(:step_json) { get_wizard_fixture("step/step") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
Group.refresh_automatic_group!(:trust_level_3)
|
Group.refresh_automatic_group!(:trust_level_3)
|
||||||
@permitted_template = template_json.dup
|
@permitted_template = template_json.dup
|
||||||
@permitted_template["permitted"] = permitted_json["permitted"]
|
@permitted_template["permitted"] = permitted_json["permitted"]
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe "custom field extensions" do
|
||||||
let(:subscription_custom_field_json) { get_wizard_fixture("custom_field/subscription_custom_fields") }
|
let(:subscription_custom_field_json) { get_wizard_fixture("custom_field/subscription_custom_fields") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
custom_field_json['custom_fields'].each do |field_json|
|
custom_field_json['custom_fields'].each do |field_json|
|
||||||
custom_field = CustomWizard::CustomField.new(nil, field_json)
|
custom_field = CustomWizard::CustomField.new(nil, field_json)
|
||||||
custom_field.save
|
custom_field.save
|
||||||
|
|
|
@ -7,6 +7,7 @@ describe ExtraLocalesControllerCustomWizard, type: :request do
|
||||||
let(:permitted) { get_wizard_fixture("wizard/permitted") }
|
let(:permitted) { get_wizard_fixture("wizard/permitted") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(template, skip_jobs: true)
|
CustomWizard::Template.save(template, skip_jobs: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ describe ::Guardian do
|
||||||
end
|
end
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
||||||
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe InvitesControllerCustomWizard, type: :request do
|
||||||
let(:template) { get_wizard_fixture("wizard") }
|
let(:template) { get_wizard_fixture("wizard") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
@controller = InvitesController.new
|
@controller = InvitesController.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -4,6 +4,7 @@ describe CustomWizardUsersController, type: :request do
|
||||||
let(:template) { get_wizard_fixture("wizard") }
|
let(:template) { get_wizard_fixture("wizard") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
@controller = UsersController.new
|
@controller = UsersController.new
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
6
spec/fixtures/subscription_client.rb
gevendort
6
spec/fixtures/subscription_client.rb
gevendort
|
@ -5,7 +5,7 @@ module DiscourseSubscriptionClient
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class SubscriptionClientSupplier
|
SubscriptionClientSupplier = Class.new Object do
|
||||||
attr_reader :product_slugs
|
attr_reader :product_slugs
|
||||||
|
|
||||||
def initialize(product_slugs)
|
def initialize(product_slugs)
|
||||||
|
@ -13,10 +13,10 @@ class SubscriptionClientSupplier
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
class SubscriptionClientResource
|
SubscriptionClientResource = Class.new Object do
|
||||||
end
|
end
|
||||||
|
|
||||||
class SubscriptionClientSubscription
|
SubscriptionClientSubscription = Class.new Object do
|
||||||
attr_reader :product_id
|
attr_reader :product_id
|
||||||
|
|
||||||
def initialize(product_id)
|
def initialize(product_id)
|
||||||
|
|
|
@ -9,11 +9,13 @@ def get_wizard_fixture(path)
|
||||||
end
|
end
|
||||||
|
|
||||||
def enable_subscription(type)
|
def enable_subscription(type)
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Subscription.stubs("#{type}?".to_sym).returns(true)
|
CustomWizard::Subscription.stubs("#{type}?".to_sym).returns(true)
|
||||||
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(true)
|
CustomWizard::Subscription.any_instance.stubs("#{type}?".to_sym).returns(true)
|
||||||
end
|
end
|
||||||
|
|
||||||
def disable_subscriptions
|
def disable_subscriptions
|
||||||
|
stub_out_subscription_classes
|
||||||
%w[
|
%w[
|
||||||
standard
|
standard
|
||||||
business
|
business
|
||||||
|
@ -24,11 +26,11 @@ def disable_subscriptions
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def undefine_client_classes
|
def unstub_out_subscription_classes
|
||||||
Object.send(:remove_const, :DiscourseSubscriptionClient) if Object.constants.include?(:DiscourseSubscriptionClient)
|
Object.send(:remove_const, :DiscourseSubscriptionClient) if Object.constants.include?(:DiscourseSubscriptionClient)
|
||||||
Object.send(:remove_const, :SubscriptionClientSubscription) if Object.constants.include?(:SubscriptionClientSubscription)
|
Object.send(:remove_const, :SubscriptionClientSubscription) if Object.constants.include?(:SubscriptionClientSubscription)
|
||||||
end
|
end
|
||||||
|
|
||||||
def define_client_classes
|
def stub_out_subscription_classes
|
||||||
load File.expand_path("#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/subscription_client.rb", __FILE__)
|
load File.expand_path("#{Rails.root}/plugins/discourse-custom-wizard/spec/fixtures/subscription_client.rb", __FILE__)
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe CustomWizard::AdminApiController do
|
||||||
let(:api_json) { get_wizard_fixture("api/api") }
|
let(:api_json) { get_wizard_fixture("api/api") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
sign_in(admin_user)
|
sign_in(admin_user)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe CustomWizard::AdminCustomFieldsController do
|
||||||
let(:custom_field_json) { get_wizard_fixture("custom_field/custom_fields") }
|
let(:custom_field_json) { get_wizard_fixture("custom_field/custom_fields") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
custom_field_json['custom_fields'].each do |field_json|
|
custom_field_json['custom_fields'].each do |field_json|
|
||||||
CustomWizard::CustomField.new(nil, field_json).save
|
CustomWizard::CustomField.new(nil, field_json).save
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe CustomWizard::AdminLogsController do
|
||||||
let(:template) { get_wizard_fixture("wizard") }
|
let(:template) { get_wizard_fixture("wizard") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
["first", "second", "third"].each_with_index do |key, index|
|
["first", "second", "third"].each_with_index do |key, index|
|
||||||
temp = template.dup
|
temp = template.dup
|
||||||
temp["id"] = "#{key}_test_wizard"
|
temp["id"] = "#{key}_test_wizard"
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe CustomWizard::AdminManagerController do
|
||||||
let(:template) { get_wizard_fixture("wizard") }
|
let(:template) { get_wizard_fixture("wizard") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
sign_in(admin_user)
|
sign_in(admin_user)
|
||||||
|
|
||||||
template_2 = template.dup
|
template_2 = template.dup
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# frozen_string_literal: true
|
# frozen_string_literal: true
|
||||||
|
|
||||||
describe CustomWizard::AdminController do
|
describe CustomWizard::SubscriptionController do
|
||||||
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
fab!(:admin_user) { Fabricate(:user, admin: true) }
|
||||||
|
|
||||||
it "requires an admin" do
|
it "requires an admin" do
|
||||||
|
@ -16,28 +16,26 @@ describe CustomWizard::AdminController do
|
||||||
context "without a subscription" do
|
context "without a subscription" do
|
||||||
before do
|
before do
|
||||||
disable_subscriptions
|
disable_subscriptions
|
||||||
define_client_classes
|
stub_out_subscription_classes
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the right subscription details" do
|
it "returns the right subscription details" do
|
||||||
get "/admin/wizards.json"
|
get "/admin/wizards/subscription.json"
|
||||||
expect(response.parsed_body["subscribed"]).to eq(false)
|
expect(response.parsed_body["subscribed"]).to eq(false)
|
||||||
expect(response.parsed_body["subscription_attributes"]).to eq(CustomWizard::Subscription.attributes.as_json)
|
expect(response.parsed_body["subscription_attributes"]).to eq(CustomWizard::Subscription.attributes.as_json)
|
||||||
expect(response.parsed_body["subscription_client_installed"]).to eq(true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context "with a subscription" do
|
context "with a subscription" do
|
||||||
before do
|
before do
|
||||||
enable_subscription("standard")
|
enable_subscription("standard")
|
||||||
define_client_classes
|
stub_out_subscription_classes
|
||||||
end
|
end
|
||||||
|
|
||||||
it "returns the right subscription details" do
|
it "returns the right subscription details" do
|
||||||
get "/admin/wizards.json"
|
get "/admin/wizards/subscription.json"
|
||||||
expect(response.parsed_body["subscribed"]).to eq(true)
|
expect(response.parsed_body["subscribed"]).to eq(true)
|
||||||
expect(response.parsed_body["subscription_type"]).to eq("standard")
|
expect(response.parsed_body["subscription_type"]).to eq("standard")
|
||||||
expect(response.parsed_body["subscription_client_installed"]).to eq(true)
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
|
@ -8,9 +8,8 @@ describe CustomWizard::AdminWizardController do
|
||||||
let(:category) { Fabricate(:category, custom_fields: { create_topic_wizard: template['name'].parameterize(separator: "_") }) }
|
let(:category) { Fabricate(:category, custom_fields: { create_topic_wizard: template['name'].parameterize(separator: "_") }) }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
CustomWizard::Template.save(template, skip_jobs: true)
|
|
||||||
enable_subscription("standard")
|
enable_subscription("standard")
|
||||||
|
CustomWizard::Template.save(template, skip_jobs: true)
|
||||||
template_2 = template.dup
|
template_2 = template.dup
|
||||||
template_2["id"] = 'super_mega_fun_wizard_2'
|
template_2["id"] = 'super_mega_fun_wizard_2'
|
||||||
template_2["permitted"] = template_2['permitted']
|
template_2["permitted"] = template_2['permitted']
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe ApplicationController do
|
||||||
let(:wizard_template) { get_wizard_fixture("wizard") }
|
let(:wizard_template) { get_wizard_fixture("wizard") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
||||||
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
||||||
end
|
end
|
||||||
|
|
|
@ -10,6 +10,7 @@ describe "custom field extensions" do
|
||||||
let(:subscription_custom_field_json) { get_wizard_fixture("custom_field/subscription_custom_fields") }
|
let(:subscription_custom_field_json) { get_wizard_fixture("custom_field/subscription_custom_fields") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
custom_field_json['custom_fields'].each do |field_json|
|
custom_field_json['custom_fields'].each do |field_json|
|
||||||
custom_field = CustomWizard::CustomField.new(nil, field_json)
|
custom_field = CustomWizard::CustomField.new(nil, field_json)
|
||||||
custom_field.save
|
custom_field.save
|
||||||
|
|
|
@ -11,6 +11,7 @@ describe CustomWizard::StepsController do
|
||||||
let(:guests_permitted) { get_wizard_fixture("wizard/guests_permitted") }
|
let(:guests_permitted) { get_wizard_fixture("wizard/guests_permitted") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe CustomWizard::WizardController do
|
||||||
let(:permitted_json) { get_wizard_fixture("wizard/permitted") }
|
let(:permitted_json) { get_wizard_fixture("wizard/permitted") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
||||||
@template = CustomWizard::Template.find("super_mega_fun_wizard")
|
@template = CustomWizard::Template.find("super_mega_fun_wizard")
|
||||||
end
|
end
|
||||||
|
|
|
@ -4,6 +4,10 @@ describe CustomWizard::BasicWizardSerializer do
|
||||||
fab!(:user) { Fabricate(:user) }
|
fab!(:user) { Fabricate(:user) }
|
||||||
let(:template) { get_wizard_fixture("wizard") }
|
let(:template) { get_wizard_fixture("wizard") }
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
|
end
|
||||||
|
|
||||||
it 'should return basic wizard attributes' do
|
it 'should return basic wizard attributes' do
|
||||||
CustomWizard::Template.save(template, skip_jobs: true)
|
CustomWizard::Template.save(template, skip_jobs: true)
|
||||||
json = CustomWizard::BasicWizardSerializer.new(
|
json = CustomWizard::BasicWizardSerializer.new(
|
||||||
|
|
|
@ -4,6 +4,10 @@ describe CustomWizard::CustomFieldSerializer do
|
||||||
fab!(:user) { Fabricate(:user) }
|
fab!(:user) { Fabricate(:user) }
|
||||||
let(:custom_field_json) { get_wizard_fixture("custom_field/custom_fields") }
|
let(:custom_field_json) { get_wizard_fixture("custom_field/custom_fields") }
|
||||||
|
|
||||||
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
|
end
|
||||||
|
|
||||||
it 'should return custom field attributes' do
|
it 'should return custom field attributes' do
|
||||||
custom_field_json['custom_fields'].each do |field_json|
|
custom_field_json['custom_fields'].each do |field_json|
|
||||||
CustomWizard::CustomField.new(nil, field_json).save
|
CustomWizard::CustomField.new(nil, field_json).save
|
||||||
|
|
|
@ -13,6 +13,7 @@ describe CustomWizard::SubmissionSerializer do
|
||||||
}
|
}
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(template_json, skip_jobs: true)
|
CustomWizard::Template.save(template_json, skip_jobs: true)
|
||||||
|
|
||||||
wizard = CustomWizard::Wizard.create(template_json["id"], user1)
|
wizard = CustomWizard::Wizard.create(template_json["id"], user1)
|
||||||
|
@ -24,7 +25,7 @@ describe CustomWizard::SubmissionSerializer do
|
||||||
|
|
||||||
it 'should return submission attributes' do
|
it 'should return submission attributes' do
|
||||||
wizard = CustomWizard::Wizard.create(template_json["id"])
|
wizard = CustomWizard::Wizard.create(template_json["id"])
|
||||||
list = CustomWizard::Submission.list(wizard, page: 0, order_by: 'id')
|
list = CustomWizard::Submission.list(wizard, page: 0)
|
||||||
|
|
||||||
json_array = ActiveModel::ArraySerializer.new(
|
json_array = ActiveModel::ArraySerializer.new(
|
||||||
list.submissions,
|
list.submissions,
|
||||||
|
|
|
@ -5,6 +5,7 @@ describe CustomWizard::FieldSerializer do
|
||||||
let(:template) { get_wizard_fixture("wizard") }
|
let(:template) { get_wizard_fixture("wizard") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(template, skip_jobs: true)
|
CustomWizard::Template.save(template, skip_jobs: true)
|
||||||
@wizard = CustomWizard::Builder.new("super_mega_fun_wizard", user).build
|
@wizard = CustomWizard::Builder.new("super_mega_fun_wizard", user).build
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,7 @@ describe CustomWizard::WizardSerializer do
|
||||||
let(:advanced_fields) { get_wizard_fixture("field/advanced_types") }
|
let(:advanced_fields) { get_wizard_fixture("field/advanced_types") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(template, skip_jobs: true)
|
CustomWizard::Template.save(template, skip_jobs: true)
|
||||||
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
@template = CustomWizard::Template.find('super_mega_fun_wizard')
|
||||||
end
|
end
|
||||||
|
|
|
@ -6,6 +6,7 @@ describe CustomWizard::StepSerializer do
|
||||||
let(:required_data_json) { get_wizard_fixture("step/required_data") }
|
let(:required_data_json) { get_wizard_fixture("step/required_data") }
|
||||||
|
|
||||||
before do
|
before do
|
||||||
|
stub_out_subscription_classes
|
||||||
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
CustomWizard::Template.save(wizard_template, skip_jobs: true)
|
||||||
@wizard = CustomWizard::Builder.new("super_mega_fun_wizard", user).build
|
@wizard = CustomWizard::Builder.new("super_mega_fun_wizard", user).build
|
||||||
end
|
end
|
||||||
|
|
|
@ -8,6 +8,7 @@ import { click, fillIn, findAll, visit, waitUntil } from "@ember/test-helpers";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import {
|
import {
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
|
getSuppliers,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
@ -24,7 +25,7 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
return helper.response(getWizard);
|
return helper.response(getWizard);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getUnsubscribedAdminWizards);
|
return helper.response(getUnsubscribedAdminWizards);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/custom-fields", () => {
|
server.get("/admin/wizards/custom-fields", () => {
|
||||||
|
@ -36,6 +37,9 @@ acceptance("Admin | Custom Fields Unsubscribed", function (needs) {
|
||||||
server.delete("/admin/wizards/custom-fields/topic_custom_field", () => {
|
server.delete("/admin/wizards/custom-fields/topic_custom_field", () => {
|
||||||
return helper.response({ success: "OK" });
|
return helper.response({ success: "OK" });
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function selectTypeAndSerializerAndFillInName(
|
async function selectTypeAndSerializerAndFillInName(
|
||||||
|
|
|
@ -3,6 +3,7 @@ import { test } from "qunit";
|
||||||
import { click, findAll, visit } from "@ember/test-helpers";
|
import { click, findAll, visit } from "@ember/test-helpers";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import {
|
import {
|
||||||
|
getSuppliers,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
getWizardTestingLog,
|
getWizardTestingLog,
|
||||||
|
@ -23,12 +24,15 @@ acceptance("Admin | Logs", function (needs) {
|
||||||
server.get("/admin/wizards/logs/this_is_testing_wizard", () => {
|
server.get("/admin/wizards/logs/this_is_testing_wizard", () => {
|
||||||
return helper.response(getWizardTestingLog);
|
return helper.response(getWizardTestingLog);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getUnsubscribedAdminWizards);
|
return helper.response(getUnsubscribedAdminWizards);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
return helper.response(getWizard);
|
return helper.response(getWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test("viewing logs fields tab", async (assert) => {
|
test("viewing logs fields tab", async (assert) => {
|
||||||
await visit("/admin/wizards/logs");
|
await visit("/admin/wizards/logs");
|
||||||
|
|
|
@ -2,6 +2,7 @@ import { acceptance, query } from "discourse/tests/helpers/qunit-helpers";
|
||||||
import { test } from "qunit";
|
import { test } from "qunit";
|
||||||
import { click, find, findAll, visit, waitUntil } from "@ember/test-helpers";
|
import { click, find, findAll, visit, waitUntil } from "@ember/test-helpers";
|
||||||
import {
|
import {
|
||||||
|
getSuppliers,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
getWizardTestingLog,
|
getWizardTestingLog,
|
||||||
|
@ -18,7 +19,7 @@ acceptance("Admin | Manager", function (needs) {
|
||||||
server.get("/admin/wizards/manager/this_is_testing_wizard", () => {
|
server.get("/admin/wizards/manager/this_is_testing_wizard", () => {
|
||||||
return helper.response(getWizardTestingLog);
|
return helper.response(getWizardTestingLog);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getUnsubscribedAdminWizards);
|
return helper.response(getUnsubscribedAdminWizards);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
|
@ -33,6 +34,9 @@ acceptance("Admin | Manager", function (needs) {
|
||||||
failures: [],
|
failures: [],
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
async function waitForDestructionAndResetMessage() {
|
async function waitForDestructionAndResetMessage() {
|
||||||
await waitUntil(
|
await waitUntil(
|
||||||
|
|
|
@ -4,6 +4,7 @@ import { click, findAll, visit } from "@ember/test-helpers";
|
||||||
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
import selectKit from "discourse/tests/helpers/select-kit-helper";
|
||||||
import {
|
import {
|
||||||
getAnotherWizardSubmission,
|
getAnotherWizardSubmission,
|
||||||
|
getSuppliers,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
getWizardSubmissions,
|
getWizardSubmissions,
|
||||||
|
@ -28,12 +29,15 @@ acceptance("Admin | Submissions", function (needs) {
|
||||||
server.get("/admin/wizards/submissions/another_wizard", () => {
|
server.get("/admin/wizards/submissions/another_wizard", () => {
|
||||||
return helper.response(getAnotherWizardSubmission);
|
return helper.response(getAnotherWizardSubmission);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getUnsubscribedAdminWizards);
|
return helper.response(getUnsubscribedAdminWizards);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
return helper.response(getWizard);
|
return helper.response(getWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
test("View submissions fields tab and content", async (assert) => {
|
test("View submissions fields tab and content", async (assert) => {
|
||||||
await visit("/admin/wizards/submissions");
|
await visit("/admin/wizards/submissions");
|
||||||
|
|
|
@ -6,6 +6,7 @@ import {
|
||||||
getBusinessAdminWizard,
|
getBusinessAdminWizard,
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
getNewApi,
|
getNewApi,
|
||||||
|
getSuppliers,
|
||||||
getWizard,
|
getWizard,
|
||||||
putNewApi,
|
putNewApi,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
@ -21,7 +22,7 @@ acceptance("Admin | API tab", function (needs) {
|
||||||
server.get("/admin/wizards/wizard", () => {
|
server.get("/admin/wizards/wizard", () => {
|
||||||
return helper.response(getWizard);
|
return helper.response(getWizard);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getBusinessAdminWizard);
|
return helper.response(getBusinessAdminWizard);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/custom-fields", () => {
|
server.get("/admin/wizards/custom-fields", () => {
|
||||||
|
@ -45,6 +46,9 @@ acceptance("Admin | API tab", function (needs) {
|
||||||
server.get("/admin/wizards/api/new_api", () => {
|
server.get("/admin/wizards/api/new_api", () => {
|
||||||
return helper.response(getNewApi);
|
return helper.response(getNewApi);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Visit API tab and fill data", async function (assert) {
|
test("Visit API tab and fill data", async function (assert) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
getBusinessAdminWizard,
|
getBusinessAdminWizard,
|
||||||
getCreatedWizard,
|
getCreatedWizard,
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
|
getSuppliers,
|
||||||
getWizard,
|
getWizard,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
server.get("/admin/wizards/custom-fields", () => {
|
server.get("/admin/wizards/custom-fields", () => {
|
||||||
return helper.response(getCustomFields);
|
return helper.response(getCustomFields);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getBusinessAdminWizard);
|
return helper.response(getBusinessAdminWizard);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/api", () => {
|
server.get("/admin/wizards/api", () => {
|
||||||
|
@ -49,6 +50,9 @@ acceptance("Admin | Custom Wizard Business Subscription", function (needs) {
|
||||||
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
||||||
return helper.response(getCreatedWizard);
|
return helper.response(getCreatedWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Displaying all tabs including API", async (assert) => {
|
test("Displaying all tabs including API", async (assert) => {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
getCreatedWizard,
|
getCreatedWizard,
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
getStandardAdminWizard,
|
getStandardAdminWizard,
|
||||||
|
getSuppliers,
|
||||||
getWizard,
|
getWizard,
|
||||||
} from "../helpers/admin-wizard";
|
} from "../helpers/admin-wizard";
|
||||||
|
|
||||||
|
@ -28,7 +29,7 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||||
server.get("/admin/wizards/custom-fields", () => {
|
server.get("/admin/wizards/custom-fields", () => {
|
||||||
return helper.response(getCustomFields);
|
return helper.response(getCustomFields);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getStandardAdminWizard);
|
return helper.response(getStandardAdminWizard);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/api", () => {
|
server.get("/admin/wizards/api", () => {
|
||||||
|
@ -49,6 +50,9 @@ acceptance("Admin | Custom Wizard Standard Subscription", function (needs) {
|
||||||
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
server.get("/admin/wizards/wizard/new_wizard_for_testing", () => {
|
||||||
return helper.response(getCreatedWizard);
|
return helper.response(getCreatedWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test("Displaying all tabs except API", async (assert) => {
|
test("Displaying all tabs except API", async (assert) => {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import {
|
||||||
getAdminTestingWizard,
|
getAdminTestingWizard,
|
||||||
getCreatedWizard,
|
getCreatedWizard,
|
||||||
getCustomFields,
|
getCustomFields,
|
||||||
|
getSuppliers,
|
||||||
getUniqueWizard,
|
getUniqueWizard,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
getWizard,
|
getWizard,
|
||||||
|
@ -30,7 +31,7 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||||
server.get("/admin/wizards/custom-fields", () => {
|
server.get("/admin/wizards/custom-fields", () => {
|
||||||
return helper.response(getCustomFields);
|
return helper.response(getCustomFields);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards", () => {
|
server.get("/admin/wizards/subscription", () => {
|
||||||
return helper.response(getUnsubscribedAdminWizards);
|
return helper.response(getUnsubscribedAdminWizards);
|
||||||
});
|
});
|
||||||
server.get("/admin/wizards/api", () => {
|
server.get("/admin/wizards/api", () => {
|
||||||
|
@ -54,6 +55,9 @@ acceptance("Admin | Custom Wizard Unsubscribed", function (needs) {
|
||||||
server.get("/admin/wizards/wizard/unique_wizard", () => {
|
server.get("/admin/wizards/wizard/unique_wizard", () => {
|
||||||
return helper.response(getUniqueWizard);
|
return helper.response(getUniqueWizard);
|
||||||
});
|
});
|
||||||
|
server.get("/admin/plugins/subscription-client/suppliers", () => {
|
||||||
|
return helper.response(getSuppliers);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
async function appendText(selector, text) {
|
async function appendText(selector, text) {
|
|
@ -121,19 +121,19 @@ const getUnsubscribedAdminWizards = {
|
||||||
subscription_attributes: {
|
subscription_attributes: {
|
||||||
wizard: {
|
wizard: {
|
||||||
required: {
|
required: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
permitted: {
|
permitted: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
restart_on_revisit: {
|
restart_on_revisit: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
|
@ -141,19 +141,19 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
step: {
|
step: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
required_data: {
|
required_data: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
permitted_params: {
|
permitted_params: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
|
@ -161,19 +161,30 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
field: {
|
field: {
|
||||||
condition: {
|
condition: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: [
|
||||||
|
"text",
|
||||||
|
"textarea",
|
||||||
|
"text_only",
|
||||||
|
"date",
|
||||||
|
"time",
|
||||||
|
"date_time",
|
||||||
|
"number",
|
||||||
|
"checkbox",
|
||||||
|
"dropdown",
|
||||||
|
"upload",
|
||||||
|
],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
realtime_validations: {
|
realtime_validations: {
|
||||||
none: ['*'],
|
none: [],
|
||||||
standard: ["*"],
|
standard: ["*"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
|
@ -181,7 +192,7 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
action: {
|
action: {
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ["create_topic", "update_profile", "open_composer", "route_to"],
|
||||||
standard: [
|
standard: [
|
||||||
"create_topic",
|
"create_topic",
|
||||||
"update_profile",
|
"update_profile",
|
||||||
|
@ -197,23 +208,22 @@ const getUnsubscribedAdminWizards = {
|
||||||
},
|
},
|
||||||
custom_field: {
|
custom_field: {
|
||||||
klass: {
|
klass: {
|
||||||
none: ['*'],
|
none: ["topic", "post"],
|
||||||
standard: ["topic", "post"],
|
standard: ["topic", "post"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
type: {
|
type: {
|
||||||
none: ['*'],
|
none: ["string", "boolean", "integer"],
|
||||||
standard: ["string", "boolean", "integer"],
|
standard: ["string", "boolean", "integer"],
|
||||||
business: ["*"],
|
business: ["*"],
|
||||||
community: ["*"],
|
community: ["*"],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
api: {
|
api: {
|
||||||
all: { none: ["*"], standard: [], business: ["*"], community: ["*"] },
|
all: { none: [], standard: [], business: ["*"], community: ["*"] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
subscription_client_installed: false,
|
|
||||||
};
|
};
|
||||||
const getCustomFields = {
|
const getCustomFields = {
|
||||||
custom_fields: [
|
custom_fields: [
|
||||||
|
@ -467,7 +477,6 @@ const getBusinessAdminWizard = {
|
||||||
all: { none: [], standard: [], business: ["*"], community: ["*"] },
|
all: { none: [], standard: [], business: ["*"], community: ["*"] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
subscription_client_installed: false,
|
|
||||||
};
|
};
|
||||||
const getStandardAdminWizard = {
|
const getStandardAdminWizard = {
|
||||||
subscribed: true,
|
subscribed: true,
|
||||||
|
@ -578,7 +587,6 @@ const getStandardAdminWizard = {
|
||||||
all: { none: [], standard: [], business: ["*"], community: ["*"] },
|
all: { none: [], standard: [], business: ["*"], community: ["*"] },
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
subscription_client_installed: false,
|
|
||||||
};
|
};
|
||||||
const getAdminTestingWizard = {
|
const getAdminTestingWizard = {
|
||||||
id: "this_is_testing_wizard",
|
id: "this_is_testing_wizard",
|
||||||
|
@ -906,6 +914,19 @@ const putNewApi = {
|
||||||
log: [],
|
log: [],
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSuppliers = {
|
||||||
|
suppliers: [
|
||||||
|
{
|
||||||
|
id: 1,
|
||||||
|
name: "Pavilion",
|
||||||
|
authorized: false,
|
||||||
|
authorized_at: null,
|
||||||
|
user: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
};
|
||||||
|
|
||||||
export {
|
export {
|
||||||
getWizard,
|
getWizard,
|
||||||
getUnsubscribedAdminWizards,
|
getUnsubscribedAdminWizards,
|
||||||
|
@ -920,4 +941,5 @@ export {
|
||||||
putNewApi,
|
putNewApi,
|
||||||
getAnotherWizardSubmission,
|
getAnotherWizardSubmission,
|
||||||
getUniqueWizard,
|
getUniqueWizard,
|
||||||
|
getSuppliers,
|
||||||
};
|
};
|
||||||
|
|
Laden …
In neuem Issue referenzieren