@enyo-energy/energy-app-sdk 0.0.128 → 0.0.129
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/packages/energy-app-notification.d.cts +56 -32
- package/dist/cjs/types/enyo-appliance.cjs +1 -1
- package/dist/cjs/types/enyo-appliance.d.cts +3 -1
- package/dist/cjs/types/enyo-notification.d.cts +122 -27
- package/dist/cjs/version.cjs +1 -1
- package/dist/cjs/version.d.cts +1 -1
- package/dist/packages/energy-app-notification.d.ts +56 -32
- package/dist/types/enyo-appliance.d.ts +3 -1
- package/dist/types/enyo-appliance.js +1 -1
- package/dist/types/enyo-notification.d.ts +122 -27
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
|
@@ -1,50 +1,74 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnyoNotificationCategory, EnyoNotificationCategoryRegistration, EnyoNotificationOptions, EnyoNotificationTranslation } from "../types/enyo-notification.cjs";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for managing user notifications within Energy App packages.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* Notifications are grouped by {@link EnyoNotificationCategory}. Every
|
|
6
|
+
* category that a package intends to use must first be registered with the
|
|
7
|
+
* host via {@link registerNotificationCategory}; attempts to send a
|
|
8
|
+
* notification for an unregistered category fail with a `not-registered`
|
|
9
|
+
* error.
|
|
10
|
+
*
|
|
11
|
+
* The host may additionally enforce rate limits per category. When the limit
|
|
12
|
+
* is exceeded, {@link sendNotification} fails with a `rate-limit` error and
|
|
13
|
+
* the caller must back off before retrying.
|
|
5
14
|
*/
|
|
6
15
|
export interface EnergyAppNotification {
|
|
7
16
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
17
|
+
* Registers a notification category with the host.
|
|
18
|
+
*
|
|
19
|
+
* Categories must be registered before any notification using that
|
|
20
|
+
* category can be sent. Registration is idempotent: calling it again for
|
|
21
|
+
* the same category updates the translated `name` and `description` used
|
|
22
|
+
* by the host UI.
|
|
10
23
|
*
|
|
11
|
-
* @param
|
|
12
|
-
*
|
|
13
|
-
* @param translations - Array of translated notification messages for different supported languages
|
|
14
|
-
* @returns Unique notification ID that can be used for tracking and removal
|
|
24
|
+
* @param registration - Category identifier together with the translated
|
|
25
|
+
* `name` (and optional `description`) shown by the host.
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
17
28
|
* ```typescript
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* [
|
|
21
|
-
* { language: 'en',
|
|
22
|
-
* { language: 'de',
|
|
29
|
+
* registerNotificationCategory({
|
|
30
|
+
* category: 'connection-issue',
|
|
31
|
+
* name: [
|
|
32
|
+
* { language: 'en', name: 'Connection issue' },
|
|
33
|
+
* { language: 'de', name: 'Verbindungsproblem' }
|
|
23
34
|
* ]
|
|
24
|
-
* );
|
|
35
|
+
* });
|
|
25
36
|
* ```
|
|
26
37
|
*/
|
|
27
|
-
|
|
38
|
+
registerNotificationCategory(registration: EnyoNotificationCategoryRegistration): void;
|
|
28
39
|
/**
|
|
29
|
-
*
|
|
30
|
-
* Returns notifications in chronological order (newest first) unless sorted by priority.
|
|
40
|
+
* Shows a notification to the user with multi-language support.
|
|
31
41
|
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
* If the notification doesn't exist, this method completes silently.
|
|
42
|
+
* The notification's `category` must have been registered first via
|
|
43
|
+
* {@link registerNotificationCategory}. Each translation supplies both a
|
|
44
|
+
* `title` (used for list rows and system banners) and a `body` (used in
|
|
45
|
+
* the expanded detail view). When `options.target` is provided, the host
|
|
46
|
+
* routes the user to that destination on interaction — e.g. an onboarding
|
|
47
|
+
* guide for the `onboarding-required` category.
|
|
39
48
|
*
|
|
40
|
-
* @param
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
49
|
+
* @param type - Visual style of the notification (info, warning, error, success).
|
|
50
|
+
* @param category - Lifecycle category; must be registered beforehand.
|
|
51
|
+
* @param options - Display/behavior options, including optional routing target.
|
|
52
|
+
* @param translations - Per-language `title`/`body` pairs.
|
|
53
|
+
* @returns Unique notification ID that can be used for tracking and removal.
|
|
54
|
+
* @throws {EnyoNotificationSendError} `not-registered` if the supplied
|
|
55
|
+
* category has not been registered with the host.
|
|
56
|
+
* @throws {EnyoNotificationSendError} `rate-limit` if the host's
|
|
57
|
+
* notification rate limit for this category has been exceeded.
|
|
46
58
|
*
|
|
47
|
-
* @
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const notificationId = sendNotification(
|
|
62
|
+
* 'onboarding-required',
|
|
63
|
+
* {
|
|
64
|
+
* target: { type: 'onboarding', onboardingName: 'wallbox-setup' }
|
|
65
|
+
* },
|
|
66
|
+
* [
|
|
67
|
+
* { language: 'en', title: 'Finish setup', body: 'Complete wallbox onboarding to start charging.' },
|
|
68
|
+
* { language: 'de', title: 'Einrichtung abschließen', body: 'Schließe das Wallbox-Onboarding ab, um zu laden.' }
|
|
69
|
+
* ]
|
|
70
|
+
* );
|
|
71
|
+
* ```
|
|
48
72
|
*/
|
|
49
|
-
|
|
73
|
+
sendNotification(category: EnyoNotificationCategory, options: EnyoNotificationOptions, translations: EnyoNotificationTranslation[]): string;
|
|
50
74
|
}
|
|
@@ -60,7 +60,7 @@ var EnyoApplianceTopologyFeatureEnum;
|
|
|
60
60
|
/** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
|
|
61
61
|
EnyoApplianceTopologyFeatureEnum["IntermediateOfPrimaryMeter"] = "IntermediateOfPrimaryMeter";
|
|
62
62
|
/** If the meter is an Intermediate Meter for a single appliance */
|
|
63
|
-
EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "
|
|
63
|
+
EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "IntermediateMeter";
|
|
64
64
|
/** If the inverter does a direct grid feed in without self consumption */
|
|
65
65
|
EnyoApplianceTopologyFeatureEnum["InverterFullGridFeedIn"] = "InverterFullGridFeedIn";
|
|
66
66
|
})(EnyoApplianceTopologyFeatureEnum || (exports.EnyoApplianceTopologyFeatureEnum = EnyoApplianceTopologyFeatureEnum = {}));
|
|
@@ -136,7 +136,7 @@ export declare enum EnyoApplianceTopologyFeatureEnum {
|
|
|
136
136
|
/** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
|
|
137
137
|
IntermediateOfPrimaryMeter = "IntermediateOfPrimaryMeter",
|
|
138
138
|
/** If the meter is an Intermediate Meter for a single appliance */
|
|
139
|
-
IntermediateMeter = "
|
|
139
|
+
IntermediateMeter = "IntermediateMeter",
|
|
140
140
|
/** If the inverter does a direct grid feed in without self consumption */
|
|
141
141
|
InverterFullGridFeedIn = "InverterFullGridFeedIn"
|
|
142
142
|
}
|
|
@@ -144,6 +144,8 @@ export interface EnyoApplianceTopology {
|
|
|
144
144
|
features: EnyoApplianceTopologyFeatureEnum[];
|
|
145
145
|
/** Information, behind which meter this appliance is located, for example if the wallbox is behind the primary meter or a submeter. Put the appliance ID of the meter */
|
|
146
146
|
behindMeterApplianceId?: string;
|
|
147
|
+
/** Information, in front of which appliance this appliance is located (i.e. upstream on the electrical path). Put the appliance ID of the downstream appliance. */
|
|
148
|
+
inFrontOfApplianceId?: string;
|
|
147
149
|
}
|
|
148
150
|
/**
|
|
149
151
|
* Represents an appliance managed by the enyo system.
|
|
@@ -1,48 +1,143 @@
|
|
|
1
1
|
import { EnergyAppPackageLanguage } from "../energy-app-package-definition.cjs";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Lifecycle category of a notification.
|
|
4
|
+
*
|
|
5
|
+
* Categories must be registered with the host (via
|
|
6
|
+
* {@link EnergyAppNotification.registerNotificationCategory}) before any
|
|
7
|
+
* notification using that category can be sent. This allows the host to
|
|
8
|
+
* pre-allocate UI surfaces (badges, sections, inbox tabs) and to enforce
|
|
9
|
+
* per-category rate limits.
|
|
10
|
+
*
|
|
11
|
+
* - `connection-issue`: The package has detected a connectivity problem with
|
|
12
|
+
* an appliance, gateway, or upstream service that requires user attention.
|
|
13
|
+
* - `onboarding-required`: The package needs the user to complete (or revisit)
|
|
14
|
+
* an onboarding flow before it can continue operating normally.
|
|
4
15
|
*/
|
|
5
|
-
export type
|
|
16
|
+
export type EnyoNotificationCategory = 'connection-issue' | 'onboarding-required';
|
|
6
17
|
/**
|
|
7
|
-
*
|
|
18
|
+
* Registration payload describing a notification category to the host.
|
|
19
|
+
*
|
|
20
|
+
* The host uses the translated `name` and optional `description` to render
|
|
21
|
+
* the category in user-facing surfaces (settings screens, inbox filters,
|
|
22
|
+
* etc.) without the package needing to ship per-host UI strings.
|
|
8
23
|
*/
|
|
9
|
-
export
|
|
24
|
+
export interface EnyoNotificationCategoryRegistration {
|
|
25
|
+
/** Category identifier this registration applies to. */
|
|
26
|
+
category: EnyoNotificationCategory;
|
|
27
|
+
/** Translated, human-readable name of the category. */
|
|
28
|
+
name: EnyoNotificationCategoryTranslation[];
|
|
29
|
+
/** Optional translated description shown alongside the category name. */
|
|
30
|
+
description?: EnyoNotificationCategoryTranslation[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Translated label for a notification category, used during registration.
|
|
34
|
+
*/
|
|
35
|
+
export interface EnyoNotificationCategoryTranslation {
|
|
36
|
+
/** Language code for this translation. */
|
|
37
|
+
language: EnergyAppPackageLanguage;
|
|
38
|
+
/** Display name of the category in the given language. */
|
|
39
|
+
name: string;
|
|
40
|
+
/** Optional description of the category in the given language. */
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
10
43
|
/**
|
|
11
|
-
*
|
|
44
|
+
* Target object describing an in-app destination the user is routed to when
|
|
45
|
+
* they interact with a notification. Discriminated by the `type` field so
|
|
46
|
+
* additional target kinds can be added without breaking existing consumers.
|
|
47
|
+
*/
|
|
48
|
+
export type EnyoNotificationTarget = EnyoNotificationOnboardingTarget | EnyoNotificationEnergyAppSettingsTarget | EnyoNotificationApplianceSettingsTarget;
|
|
49
|
+
/**
|
|
50
|
+
* Target that opens an onboarding guide previously registered with the host.
|
|
51
|
+
*
|
|
52
|
+
* Use this for notifications whose category is `onboarding-required` (or any
|
|
53
|
+
* other case where the resolution is "walk the user through onboarding").
|
|
54
|
+
*/
|
|
55
|
+
export interface EnyoNotificationOnboardingTarget {
|
|
56
|
+
/** Discriminator identifying this as an onboarding target. */
|
|
57
|
+
type: 'onboarding';
|
|
58
|
+
/**
|
|
59
|
+
* Name of the onboarding guide to open. Must match the `guideName` of a
|
|
60
|
+
* guide previously registered via the onboarding package.
|
|
61
|
+
*/
|
|
62
|
+
onboardingName: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Target that opens the settings screen for the energy app package itself
|
|
66
|
+
* (package-wide settings registered via the settings package, not scoped to
|
|
67
|
+
* a specific appliance).
|
|
68
|
+
*/
|
|
69
|
+
export interface EnyoNotificationEnergyAppSettingsTarget {
|
|
70
|
+
/** Discriminator identifying this as an energy app settings target. */
|
|
71
|
+
type: 'energy-app-settings';
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Target that opens the settings screen for a specific appliance managed by
|
|
75
|
+
* the energy app package.
|
|
76
|
+
*/
|
|
77
|
+
export interface EnyoNotificationApplianceSettingsTarget {
|
|
78
|
+
/** Discriminator identifying this as an appliance settings target. */
|
|
79
|
+
type: 'appliance-settings';
|
|
80
|
+
/**
|
|
81
|
+
* Identifier of the appliance whose settings should be opened. Must match
|
|
82
|
+
* an appliance id known to the host.
|
|
83
|
+
*/
|
|
84
|
+
applianceId: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Configuration options for notification display and behavior.
|
|
12
88
|
*/
|
|
13
89
|
export interface EnyoNotificationOptions {
|
|
14
|
-
/**
|
|
15
|
-
permanent?: boolean;
|
|
16
|
-
/** Optional expiration time in ISO format for auto-dismissal */
|
|
17
|
-
expiresAtIso?: string;
|
|
18
|
-
/** Priority level affecting display order and visual emphasis */
|
|
19
|
-
priority?: EnyoNotificationPriority;
|
|
20
|
-
/** Optional appliance ID if notification is specific to an appliance */
|
|
90
|
+
/** Optional appliance ID if notification is specific to an appliance. */
|
|
21
91
|
applianceId?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Optional in-app destination the user is routed to when they interact
|
|
94
|
+
* with the notification.
|
|
95
|
+
*/
|
|
96
|
+
target?: EnyoNotificationTarget;
|
|
22
97
|
}
|
|
23
98
|
/**
|
|
24
|
-
* Translated notification content for multi-language support
|
|
99
|
+
* Translated notification content for multi-language support.
|
|
100
|
+
*
|
|
101
|
+
* Each translation provides both a short `title` (shown in lists, headers
|
|
102
|
+
* and system notifications) and a longer `body` (shown in the expanded
|
|
103
|
+
* detail view).
|
|
25
104
|
*/
|
|
26
105
|
export interface EnyoNotificationTranslation {
|
|
27
|
-
/** Language code for this translation */
|
|
106
|
+
/** Language code for this translation. */
|
|
28
107
|
language: EnergyAppPackageLanguage;
|
|
29
|
-
/**
|
|
30
|
-
|
|
108
|
+
/** Short headline shown in notification lists and system banners. */
|
|
109
|
+
title: string;
|
|
110
|
+
/** Longer message body shown when the notification is expanded. */
|
|
111
|
+
body: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Error reasons returned by {@link EnergyAppNotification.sendNotification}
|
|
115
|
+
* when a notification cannot be delivered.
|
|
116
|
+
*
|
|
117
|
+
* - `not-registered`: The supplied category has not been registered with the
|
|
118
|
+
* host via {@link EnergyAppNotification.registerNotificationCategory}.
|
|
119
|
+
* - `rate-limit`: The package has exceeded the host's notification rate
|
|
120
|
+
* limit for the supplied category and must back off before retrying.
|
|
121
|
+
*/
|
|
122
|
+
export type EnyoNotificationSendErrorType = 'not-registered' | 'rate-limit';
|
|
123
|
+
/**
|
|
124
|
+
* Error thrown or returned by {@link EnergyAppNotification.sendNotification}
|
|
125
|
+
* when a notification cannot be delivered.
|
|
126
|
+
*/
|
|
127
|
+
export interface EnyoNotificationSendError {
|
|
128
|
+
/** Machine-readable error reason. */
|
|
129
|
+
type: EnyoNotificationSendErrorType;
|
|
130
|
+
/** Optional human-readable detail describing the error. */
|
|
131
|
+
message?: string;
|
|
31
132
|
}
|
|
32
133
|
/**
|
|
33
|
-
* Complete notification object containing all notification data
|
|
134
|
+
* Complete notification object containing all notification data.
|
|
34
135
|
*/
|
|
35
136
|
export interface EnyoNotification {
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
type: EnyoNotificationType;
|
|
40
|
-
/** Configuration options for display and behavior */
|
|
137
|
+
/** Category of the notification; must be registered before sending. */
|
|
138
|
+
category: EnyoNotificationCategory;
|
|
139
|
+
/** Configuration options for display and behavior. */
|
|
41
140
|
options: EnyoNotificationOptions;
|
|
42
|
-
/** Array of translated notification messages for different languages */
|
|
141
|
+
/** Array of translated notification messages for different languages. */
|
|
43
142
|
translations: EnyoNotificationTranslation[];
|
|
44
|
-
/** ISO timestamp when the notification was created */
|
|
45
|
-
createdAtIso: string;
|
|
46
|
-
/** Optional ISO timestamp when the notification was last updated */
|
|
47
|
-
updatedAtIso?: string;
|
|
48
143
|
}
|
package/dist/cjs/version.cjs
CHANGED
|
@@ -9,7 +9,7 @@ exports.getSdkVersion = getSdkVersion;
|
|
|
9
9
|
/**
|
|
10
10
|
* Current version of the enyo Energy App SDK.
|
|
11
11
|
*/
|
|
12
|
-
exports.SDK_VERSION = '0.0.
|
|
12
|
+
exports.SDK_VERSION = '0.0.129';
|
|
13
13
|
/**
|
|
14
14
|
* Gets the current SDK version.
|
|
15
15
|
* @returns The semantic version string of the SDK
|
package/dist/cjs/version.d.cts
CHANGED
|
@@ -1,50 +1,74 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { EnyoNotificationCategory, EnyoNotificationCategoryRegistration, EnyoNotificationOptions, EnyoNotificationTranslation } from "../types/enyo-notification.js";
|
|
2
2
|
/**
|
|
3
3
|
* Interface for managing user notifications within Energy App packages.
|
|
4
|
-
*
|
|
4
|
+
*
|
|
5
|
+
* Notifications are grouped by {@link EnyoNotificationCategory}. Every
|
|
6
|
+
* category that a package intends to use must first be registered with the
|
|
7
|
+
* host via {@link registerNotificationCategory}; attempts to send a
|
|
8
|
+
* notification for an unregistered category fail with a `not-registered`
|
|
9
|
+
* error.
|
|
10
|
+
*
|
|
11
|
+
* The host may additionally enforce rate limits per category. When the limit
|
|
12
|
+
* is exceeded, {@link sendNotification} fails with a `rate-limit` error and
|
|
13
|
+
* the caller must back off before retrying.
|
|
5
14
|
*/
|
|
6
15
|
export interface EnergyAppNotification {
|
|
7
16
|
/**
|
|
8
|
-
*
|
|
9
|
-
*
|
|
17
|
+
* Registers a notification category with the host.
|
|
18
|
+
*
|
|
19
|
+
* Categories must be registered before any notification using that
|
|
20
|
+
* category can be sent. Registration is idempotent: calling it again for
|
|
21
|
+
* the same category updates the translated `name` and `description` used
|
|
22
|
+
* by the host UI.
|
|
10
23
|
*
|
|
11
|
-
* @param
|
|
12
|
-
*
|
|
13
|
-
* @param translations - Array of translated notification messages for different supported languages
|
|
14
|
-
* @returns Unique notification ID that can be used for tracking and removal
|
|
24
|
+
* @param registration - Category identifier together with the translated
|
|
25
|
+
* `name` (and optional `description`) shown by the host.
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
17
28
|
* ```typescript
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
* [
|
|
21
|
-
* { language: 'en',
|
|
22
|
-
* { language: 'de',
|
|
29
|
+
* registerNotificationCategory({
|
|
30
|
+
* category: 'connection-issue',
|
|
31
|
+
* name: [
|
|
32
|
+
* { language: 'en', name: 'Connection issue' },
|
|
33
|
+
* { language: 'de', name: 'Verbindungsproblem' }
|
|
23
34
|
* ]
|
|
24
|
-
* );
|
|
35
|
+
* });
|
|
25
36
|
* ```
|
|
26
37
|
*/
|
|
27
|
-
|
|
38
|
+
registerNotificationCategory(registration: EnyoNotificationCategoryRegistration): void;
|
|
28
39
|
/**
|
|
29
|
-
*
|
|
30
|
-
* Returns notifications in chronological order (newest first) unless sorted by priority.
|
|
40
|
+
* Shows a notification to the user with multi-language support.
|
|
31
41
|
*
|
|
32
|
-
*
|
|
33
|
-
* @
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
*
|
|
38
|
-
* If the notification doesn't exist, this method completes silently.
|
|
42
|
+
* The notification's `category` must have been registered first via
|
|
43
|
+
* {@link registerNotificationCategory}. Each translation supplies both a
|
|
44
|
+
* `title` (used for list rows and system banners) and a `body` (used in
|
|
45
|
+
* the expanded detail view). When `options.target` is provided, the host
|
|
46
|
+
* routes the user to that destination on interaction — e.g. an onboarding
|
|
47
|
+
* guide for the `onboarding-required` category.
|
|
39
48
|
*
|
|
40
|
-
* @param
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
*
|
|
45
|
-
*
|
|
49
|
+
* @param type - Visual style of the notification (info, warning, error, success).
|
|
50
|
+
* @param category - Lifecycle category; must be registered beforehand.
|
|
51
|
+
* @param options - Display/behavior options, including optional routing target.
|
|
52
|
+
* @param translations - Per-language `title`/`body` pairs.
|
|
53
|
+
* @returns Unique notification ID that can be used for tracking and removal.
|
|
54
|
+
* @throws {EnyoNotificationSendError} `not-registered` if the supplied
|
|
55
|
+
* category has not been registered with the host.
|
|
56
|
+
* @throws {EnyoNotificationSendError} `rate-limit` if the host's
|
|
57
|
+
* notification rate limit for this category has been exceeded.
|
|
46
58
|
*
|
|
47
|
-
* @
|
|
59
|
+
* @example
|
|
60
|
+
* ```typescript
|
|
61
|
+
* const notificationId = sendNotification(
|
|
62
|
+
* 'onboarding-required',
|
|
63
|
+
* {
|
|
64
|
+
* target: { type: 'onboarding', onboardingName: 'wallbox-setup' }
|
|
65
|
+
* },
|
|
66
|
+
* [
|
|
67
|
+
* { language: 'en', title: 'Finish setup', body: 'Complete wallbox onboarding to start charging.' },
|
|
68
|
+
* { language: 'de', title: 'Einrichtung abschließen', body: 'Schließe das Wallbox-Onboarding ab, um zu laden.' }
|
|
69
|
+
* ]
|
|
70
|
+
* );
|
|
71
|
+
* ```
|
|
48
72
|
*/
|
|
49
|
-
|
|
73
|
+
sendNotification(category: EnyoNotificationCategory, options: EnyoNotificationOptions, translations: EnyoNotificationTranslation[]): string;
|
|
50
74
|
}
|
|
@@ -136,7 +136,7 @@ export declare enum EnyoApplianceTopologyFeatureEnum {
|
|
|
136
136
|
/** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
|
|
137
137
|
IntermediateOfPrimaryMeter = "IntermediateOfPrimaryMeter",
|
|
138
138
|
/** If the meter is an Intermediate Meter for a single appliance */
|
|
139
|
-
IntermediateMeter = "
|
|
139
|
+
IntermediateMeter = "IntermediateMeter",
|
|
140
140
|
/** If the inverter does a direct grid feed in without self consumption */
|
|
141
141
|
InverterFullGridFeedIn = "InverterFullGridFeedIn"
|
|
142
142
|
}
|
|
@@ -144,6 +144,8 @@ export interface EnyoApplianceTopology {
|
|
|
144
144
|
features: EnyoApplianceTopologyFeatureEnum[];
|
|
145
145
|
/** Information, behind which meter this appliance is located, for example if the wallbox is behind the primary meter or a submeter. Put the appliance ID of the meter */
|
|
146
146
|
behindMeterApplianceId?: string;
|
|
147
|
+
/** Information, in front of which appliance this appliance is located (i.e. upstream on the electrical path). Put the appliance ID of the downstream appliance. */
|
|
148
|
+
inFrontOfApplianceId?: string;
|
|
147
149
|
}
|
|
148
150
|
/**
|
|
149
151
|
* Represents an appliance managed by the enyo system.
|
|
@@ -57,7 +57,7 @@ export var EnyoApplianceTopologyFeatureEnum;
|
|
|
57
57
|
/** If the meter is an Intermediate Meter (like the meter of an Inverter) directly behind the Primary Meter */
|
|
58
58
|
EnyoApplianceTopologyFeatureEnum["IntermediateOfPrimaryMeter"] = "IntermediateOfPrimaryMeter";
|
|
59
59
|
/** If the meter is an Intermediate Meter for a single appliance */
|
|
60
|
-
EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "
|
|
60
|
+
EnyoApplianceTopologyFeatureEnum["IntermediateMeter"] = "IntermediateMeter";
|
|
61
61
|
/** If the inverter does a direct grid feed in without self consumption */
|
|
62
62
|
EnyoApplianceTopologyFeatureEnum["InverterFullGridFeedIn"] = "InverterFullGridFeedIn";
|
|
63
63
|
})(EnyoApplianceTopologyFeatureEnum || (EnyoApplianceTopologyFeatureEnum = {}));
|
|
@@ -1,48 +1,143 @@
|
|
|
1
1
|
import { EnergyAppPackageLanguage } from "../energy-app-package-definition.js";
|
|
2
2
|
/**
|
|
3
|
-
*
|
|
3
|
+
* Lifecycle category of a notification.
|
|
4
|
+
*
|
|
5
|
+
* Categories must be registered with the host (via
|
|
6
|
+
* {@link EnergyAppNotification.registerNotificationCategory}) before any
|
|
7
|
+
* notification using that category can be sent. This allows the host to
|
|
8
|
+
* pre-allocate UI surfaces (badges, sections, inbox tabs) and to enforce
|
|
9
|
+
* per-category rate limits.
|
|
10
|
+
*
|
|
11
|
+
* - `connection-issue`: The package has detected a connectivity problem with
|
|
12
|
+
* an appliance, gateway, or upstream service that requires user attention.
|
|
13
|
+
* - `onboarding-required`: The package needs the user to complete (or revisit)
|
|
14
|
+
* an onboarding flow before it can continue operating normally.
|
|
4
15
|
*/
|
|
5
|
-
export type
|
|
16
|
+
export type EnyoNotificationCategory = 'connection-issue' | 'onboarding-required';
|
|
6
17
|
/**
|
|
7
|
-
*
|
|
18
|
+
* Registration payload describing a notification category to the host.
|
|
19
|
+
*
|
|
20
|
+
* The host uses the translated `name` and optional `description` to render
|
|
21
|
+
* the category in user-facing surfaces (settings screens, inbox filters,
|
|
22
|
+
* etc.) without the package needing to ship per-host UI strings.
|
|
8
23
|
*/
|
|
9
|
-
export
|
|
24
|
+
export interface EnyoNotificationCategoryRegistration {
|
|
25
|
+
/** Category identifier this registration applies to. */
|
|
26
|
+
category: EnyoNotificationCategory;
|
|
27
|
+
/** Translated, human-readable name of the category. */
|
|
28
|
+
name: EnyoNotificationCategoryTranslation[];
|
|
29
|
+
/** Optional translated description shown alongside the category name. */
|
|
30
|
+
description?: EnyoNotificationCategoryTranslation[];
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Translated label for a notification category, used during registration.
|
|
34
|
+
*/
|
|
35
|
+
export interface EnyoNotificationCategoryTranslation {
|
|
36
|
+
/** Language code for this translation. */
|
|
37
|
+
language: EnergyAppPackageLanguage;
|
|
38
|
+
/** Display name of the category in the given language. */
|
|
39
|
+
name: string;
|
|
40
|
+
/** Optional description of the category in the given language. */
|
|
41
|
+
description?: string;
|
|
42
|
+
}
|
|
10
43
|
/**
|
|
11
|
-
*
|
|
44
|
+
* Target object describing an in-app destination the user is routed to when
|
|
45
|
+
* they interact with a notification. Discriminated by the `type` field so
|
|
46
|
+
* additional target kinds can be added without breaking existing consumers.
|
|
47
|
+
*/
|
|
48
|
+
export type EnyoNotificationTarget = EnyoNotificationOnboardingTarget | EnyoNotificationEnergyAppSettingsTarget | EnyoNotificationApplianceSettingsTarget;
|
|
49
|
+
/**
|
|
50
|
+
* Target that opens an onboarding guide previously registered with the host.
|
|
51
|
+
*
|
|
52
|
+
* Use this for notifications whose category is `onboarding-required` (or any
|
|
53
|
+
* other case where the resolution is "walk the user through onboarding").
|
|
54
|
+
*/
|
|
55
|
+
export interface EnyoNotificationOnboardingTarget {
|
|
56
|
+
/** Discriminator identifying this as an onboarding target. */
|
|
57
|
+
type: 'onboarding';
|
|
58
|
+
/**
|
|
59
|
+
* Name of the onboarding guide to open. Must match the `guideName` of a
|
|
60
|
+
* guide previously registered via the onboarding package.
|
|
61
|
+
*/
|
|
62
|
+
onboardingName: string;
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Target that opens the settings screen for the energy app package itself
|
|
66
|
+
* (package-wide settings registered via the settings package, not scoped to
|
|
67
|
+
* a specific appliance).
|
|
68
|
+
*/
|
|
69
|
+
export interface EnyoNotificationEnergyAppSettingsTarget {
|
|
70
|
+
/** Discriminator identifying this as an energy app settings target. */
|
|
71
|
+
type: 'energy-app-settings';
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Target that opens the settings screen for a specific appliance managed by
|
|
75
|
+
* the energy app package.
|
|
76
|
+
*/
|
|
77
|
+
export interface EnyoNotificationApplianceSettingsTarget {
|
|
78
|
+
/** Discriminator identifying this as an appliance settings target. */
|
|
79
|
+
type: 'appliance-settings';
|
|
80
|
+
/**
|
|
81
|
+
* Identifier of the appliance whose settings should be opened. Must match
|
|
82
|
+
* an appliance id known to the host.
|
|
83
|
+
*/
|
|
84
|
+
applianceId: string;
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Configuration options for notification display and behavior.
|
|
12
88
|
*/
|
|
13
89
|
export interface EnyoNotificationOptions {
|
|
14
|
-
/**
|
|
15
|
-
permanent?: boolean;
|
|
16
|
-
/** Optional expiration time in ISO format for auto-dismissal */
|
|
17
|
-
expiresAtIso?: string;
|
|
18
|
-
/** Priority level affecting display order and visual emphasis */
|
|
19
|
-
priority?: EnyoNotificationPriority;
|
|
20
|
-
/** Optional appliance ID if notification is specific to an appliance */
|
|
90
|
+
/** Optional appliance ID if notification is specific to an appliance. */
|
|
21
91
|
applianceId?: string;
|
|
92
|
+
/**
|
|
93
|
+
* Optional in-app destination the user is routed to when they interact
|
|
94
|
+
* with the notification.
|
|
95
|
+
*/
|
|
96
|
+
target?: EnyoNotificationTarget;
|
|
22
97
|
}
|
|
23
98
|
/**
|
|
24
|
-
* Translated notification content for multi-language support
|
|
99
|
+
* Translated notification content for multi-language support.
|
|
100
|
+
*
|
|
101
|
+
* Each translation provides both a short `title` (shown in lists, headers
|
|
102
|
+
* and system notifications) and a longer `body` (shown in the expanded
|
|
103
|
+
* detail view).
|
|
25
104
|
*/
|
|
26
105
|
export interface EnyoNotificationTranslation {
|
|
27
|
-
/** Language code for this translation */
|
|
106
|
+
/** Language code for this translation. */
|
|
28
107
|
language: EnergyAppPackageLanguage;
|
|
29
|
-
/**
|
|
30
|
-
|
|
108
|
+
/** Short headline shown in notification lists and system banners. */
|
|
109
|
+
title: string;
|
|
110
|
+
/** Longer message body shown when the notification is expanded. */
|
|
111
|
+
body: string;
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Error reasons returned by {@link EnergyAppNotification.sendNotification}
|
|
115
|
+
* when a notification cannot be delivered.
|
|
116
|
+
*
|
|
117
|
+
* - `not-registered`: The supplied category has not been registered with the
|
|
118
|
+
* host via {@link EnergyAppNotification.registerNotificationCategory}.
|
|
119
|
+
* - `rate-limit`: The package has exceeded the host's notification rate
|
|
120
|
+
* limit for the supplied category and must back off before retrying.
|
|
121
|
+
*/
|
|
122
|
+
export type EnyoNotificationSendErrorType = 'not-registered' | 'rate-limit';
|
|
123
|
+
/**
|
|
124
|
+
* Error thrown or returned by {@link EnergyAppNotification.sendNotification}
|
|
125
|
+
* when a notification cannot be delivered.
|
|
126
|
+
*/
|
|
127
|
+
export interface EnyoNotificationSendError {
|
|
128
|
+
/** Machine-readable error reason. */
|
|
129
|
+
type: EnyoNotificationSendErrorType;
|
|
130
|
+
/** Optional human-readable detail describing the error. */
|
|
131
|
+
message?: string;
|
|
31
132
|
}
|
|
32
133
|
/**
|
|
33
|
-
* Complete notification object containing all notification data
|
|
134
|
+
* Complete notification object containing all notification data.
|
|
34
135
|
*/
|
|
35
136
|
export interface EnyoNotification {
|
|
36
|
-
/**
|
|
37
|
-
|
|
38
|
-
/**
|
|
39
|
-
type: EnyoNotificationType;
|
|
40
|
-
/** Configuration options for display and behavior */
|
|
137
|
+
/** Category of the notification; must be registered before sending. */
|
|
138
|
+
category: EnyoNotificationCategory;
|
|
139
|
+
/** Configuration options for display and behavior. */
|
|
41
140
|
options: EnyoNotificationOptions;
|
|
42
|
-
/** Array of translated notification messages for different languages */
|
|
141
|
+
/** Array of translated notification messages for different languages. */
|
|
43
142
|
translations: EnyoNotificationTranslation[];
|
|
44
|
-
/** ISO timestamp when the notification was created */
|
|
45
|
-
createdAtIso: string;
|
|
46
|
-
/** Optional ISO timestamp when the notification was last updated */
|
|
47
|
-
updatedAtIso?: string;
|
|
48
143
|
}
|
package/dist/version.d.ts
CHANGED
package/dist/version.js
CHANGED