diff --git a/assets/js/components/Config/GeneralConfig.vue b/assets/js/components/Config/GeneralConfig.vue
index a34628789..c15f45bc2 100644
--- a/assets/js/components/Config/GeneralConfig.vue
+++ b/assets/js/components/Config/GeneralConfig.vue
@@ -105,7 +105,8 @@ export default {
},
sponsorStatus() {
const sponsor = store.state?.sponsor || {};
- const { name, expiresSoon } = sponsor;
+ const name = sponsor.status.name;
+ const expiresSoon = sponsor.status.expiresSoon;
let textClass = "";
let badgeClass = "";
let title = name;
diff --git a/assets/js/components/Config/SponsorModal.vue b/assets/js/components/Config/SponsorModal.vue
index 3190658f7..bcbd57151 100644
--- a/assets/js/components/Config/SponsorModal.vue
+++ b/assets/js/components/Config/SponsorModal.vue
@@ -110,13 +110,13 @@ export default {
return store?.state?.sponsor;
},
token() {
- return this.sponsor?.token;
+ return this.sponsor?.status.token;
},
fromYaml() {
return this.sponsor?.fromYaml;
},
name() {
- return this.sponsor?.name || "";
+ return this.sponsor?.status.name || "";
},
showTokenForm() {
return this.editMode || !this.token;
diff --git a/assets/js/components/Config/TelemetryModal.vue b/assets/js/components/Config/TelemetryModal.vue
index 7989e7c0e..7b20ed390 100644
--- a/assets/js/components/Config/TelemetryModal.vue
+++ b/assets/js/components/Config/TelemetryModal.vue
@@ -6,7 +6,7 @@
data-testid="telemetry-modal"
>
{{ $t("config.telemetry.description") }}
-
+
@@ -23,5 +23,10 @@ export default defineComponent({
sponsor: { type: Object as PropType },
telemetry: { type: Boolean },
},
+ computed: {
+ sponsorActive(): boolean {
+ return !!this.sponsor?.status.name;
+ },
+ },
});
diff --git a/assets/js/components/Savings/Savings.vue b/assets/js/components/Savings/Savings.vue
index bc5c91023..284a21a45 100644
--- a/assets/js/components/Savings/Savings.vue
+++ b/assets/js/components/Savings/Savings.vue
@@ -191,7 +191,7 @@
@@ -241,6 +241,9 @@ export default defineComponent({
};
},
computed: {
+ sponsorActive(): boolean {
+ return !!this.sponsor?.status.name;
+ },
tariffLink() {
return `${docsPrefix()}/docs/reference/configuration/tariffs`;
},
diff --git a/assets/js/components/Savings/Sponsor.stories.ts b/assets/js/components/Savings/Sponsor.stories.ts
index 344b84f7f..1183f6eee 100644
--- a/assets/js/components/Savings/Sponsor.stories.ts
+++ b/assets/js/components/Savings/Sponsor.stories.ts
@@ -46,23 +46,25 @@ NoSponsor.args = {};
export const Trial = Template.bind({});
Trial.args = {
- name: "trial",
+ status: { name: "trial" },
};
export const IndividualSponsor = Template.bind({});
IndividualSponsor.args = {
- name: "naltatis",
+ status: { name: "naltatis" },
};
export const VictronDevice = Template.bind({});
VictronDevice.args = {
- name: "victron",
+ status: { name: "victron" },
};
// Add an extra story showing the expiring state
export const ExpiringSponsor = Template.bind({});
ExpiringSponsor.args = {
- name: "naltatis",
- expiresSoon: true,
- expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(), // 7 days from now
+ status: {
+ name: "naltatis",
+ expiresSoon: true,
+ expiresAt: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000).toISOString(), // 7 days from now
+ },
};
diff --git a/assets/js/components/Savings/Sponsor.vue b/assets/js/components/Savings/Sponsor.vue
index 3b15a4599..9d69c3c3f 100644
--- a/assets/js/components/Savings/Sponsor.vue
+++ b/assets/js/components/Savings/Sponsor.vue
@@ -67,7 +67,8 @@ import "@h2d2/shopicons/es/regular/heart";
import "@h2d2/shopicons/es/regular/stars";
import "@h2d2/shopicons/es/regular/clock";
import { docsPrefix } from "@/i18n";
-import { defineComponent } from "vue";
+import { defineComponent, type PropType } from "vue";
+import type { SponsorStatus } from "@/types/evcc";
export const TRIAL = "trial";
export const VICTRON_DEVICE = "victron";
@@ -75,13 +76,13 @@ export const VICTRON_DEVICE = "victron";
export default defineComponent({
name: "Sponsor",
props: {
- name: String,
- expiresAt: String,
- expiresSoon: Boolean,
+ status: Object as PropType,
fromYaml: Boolean,
- token: String,
},
computed: {
+ name() {
+ return this.status?.name;
+ },
isTrial() {
return this.name === TRIAL;
},
diff --git a/assets/js/components/Savings/SponsorTokenExpires.stories.ts b/assets/js/components/Savings/SponsorTokenExpires.stories.ts
index 6457ccd7d..0f0124645 100644
--- a/assets/js/components/Savings/SponsorTokenExpires.stories.ts
+++ b/assets/js/components/Savings/SponsorTokenExpires.stories.ts
@@ -26,8 +26,10 @@ const Template: StoryFn = (args) => ({
// Create stories for each variant
export const SomeDay = Template.bind({});
SomeDay.args = {
- expiresSoon: true,
- expiresAt: new Date(Date.now() + 22 * 20 * 60 * 1000).toISOString(),
+ status: {
+ expiresSoon: true,
+ expiresAt: new Date(Date.now() + 22 * 20 * 60 * 1000).toISOString(),
+ },
};
export const Empty = Template.bind({});
diff --git a/assets/js/components/Savings/SponsorTokenExpires.vue b/assets/js/components/Savings/SponsorTokenExpires.vue
index ea72d6cf6..59884fc50 100644
--- a/assets/js/components/Savings/SponsorTokenExpires.vue
+++ b/assets/js/components/Savings/SponsorTokenExpires.vue
@@ -1,15 +1,28 @@