@statusas/react 0.1.0 → 0.3.0
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/README.md +14 -0
- package/dist/index.d.mts +38 -2
- package/dist/index.d.ts +38 -2
- package/dist/index.js +110 -28
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +105 -27
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,6 +33,20 @@ The `slug` is your status page's subdomain — `your-page-slug.statusas.lt`. Pas
|
|
|
33
33
|
<StatusWidget slug="your-page-slug" href="https://status.your-company.com" />
|
|
34
34
|
```
|
|
35
35
|
|
|
36
|
+
## Language
|
|
37
|
+
|
|
38
|
+
The label defaults to English. Pass `locale` for one of the eight languages a
|
|
39
|
+
status page serves — `lt`, `en`, `fr`, `de`, `tr`, `hi`, `ko`, `ja`:
|
|
40
|
+
|
|
41
|
+
```tsx
|
|
42
|
+
<StatusWidget slug="your-page-slug" locale="lt" />
|
|
43
|
+
// Veikia
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The badge sets `lang` on its own element, so a screen reader announces the
|
|
47
|
+
label in the right voice even when the surrounding page is in another language.
|
|
48
|
+
An unrecognised locale falls back to English rather than throwing.
|
|
49
|
+
|
|
36
50
|
## Styles
|
|
37
51
|
|
|
38
52
|
With Tailwind v4, tell it to scan the package:
|
package/dist/index.d.mts
CHANGED
|
@@ -1,14 +1,50 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The languages the widget speaks.
|
|
5
|
+
*
|
|
6
|
+
* The same eight a status page serves, so a badge on a customer's marketing
|
|
7
|
+
* site can match the page it links to. Kept as a literal list inside the
|
|
8
|
+
* package rather than imported from `@statusas/locales`: this is the one piece
|
|
9
|
+
* of the product that gets installed into somebody else's app, and it should
|
|
10
|
+
* carry no workspace dependencies.
|
|
11
|
+
*/
|
|
12
|
+
declare const widgetLocales: readonly ["lt", "en", "fr", "de", "tr", "hi", "ko", "ja"];
|
|
13
|
+
type WidgetLocale = (typeof widgetLocales)[number];
|
|
14
|
+
declare const defaultWidgetLocale: WidgetLocale;
|
|
15
|
+
/** Colour is not a language: it stays out of the translations. */
|
|
16
|
+
declare const statusColors: Record<Status, string>;
|
|
17
|
+
/**
|
|
18
|
+
* The label and colour for a status, in the chosen language.
|
|
19
|
+
*
|
|
20
|
+
* An unknown locale falls back to English rather than throwing: the badge's
|
|
21
|
+
* whole job is to render, and a typo in a prop must not take down the page it
|
|
22
|
+
* sits on.
|
|
23
|
+
*/
|
|
24
|
+
declare function statusDisplay(status: Status, locale?: WidgetLocale): {
|
|
25
|
+
label: string;
|
|
26
|
+
color: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
3
29
|
type Status = "operational" | "degraded_performance" | "partial_outage" | "major_outage" | "under_maintenance" | "unknown" | "incident";
|
|
4
30
|
type StatusResponse = {
|
|
5
31
|
status: Status;
|
|
32
|
+
/**
|
|
33
|
+
* Where the page actually lives — the customer's own domain once they have
|
|
34
|
+
* attached one. Null when the page is private or does not exist.
|
|
35
|
+
*/
|
|
36
|
+
url?: string | null;
|
|
6
37
|
};
|
|
7
38
|
declare function getStatus(slug: string, baseUrl?: string): Promise<StatusResponse>;
|
|
8
39
|
type StatusWidgetProps = {
|
|
9
40
|
slug: string;
|
|
10
41
|
href?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The language of the label. Defaults to English — a badge dropped into an
|
|
44
|
+
* unknown page should not surprise anyone with Lithuanian.
|
|
45
|
+
*/
|
|
46
|
+
locale?: WidgetLocale;
|
|
11
47
|
};
|
|
12
|
-
declare function StatusWidget({ slug, href }: StatusWidgetProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
48
|
+
declare function StatusWidget({ slug, href, locale, }: StatusWidgetProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
13
49
|
|
|
14
|
-
export { Status, StatusResponse, StatusWidget, StatusWidgetProps, getStatus };
|
|
50
|
+
export { Status, StatusResponse, StatusWidget, StatusWidgetProps, WidgetLocale, defaultWidgetLocale, getStatus, statusColors, statusDisplay, widgetLocales };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,14 +1,50 @@
|
|
|
1
1
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* The languages the widget speaks.
|
|
5
|
+
*
|
|
6
|
+
* The same eight a status page serves, so a badge on a customer's marketing
|
|
7
|
+
* site can match the page it links to. Kept as a literal list inside the
|
|
8
|
+
* package rather than imported from `@statusas/locales`: this is the one piece
|
|
9
|
+
* of the product that gets installed into somebody else's app, and it should
|
|
10
|
+
* carry no workspace dependencies.
|
|
11
|
+
*/
|
|
12
|
+
declare const widgetLocales: readonly ["lt", "en", "fr", "de", "tr", "hi", "ko", "ja"];
|
|
13
|
+
type WidgetLocale = (typeof widgetLocales)[number];
|
|
14
|
+
declare const defaultWidgetLocale: WidgetLocale;
|
|
15
|
+
/** Colour is not a language: it stays out of the translations. */
|
|
16
|
+
declare const statusColors: Record<Status, string>;
|
|
17
|
+
/**
|
|
18
|
+
* The label and colour for a status, in the chosen language.
|
|
19
|
+
*
|
|
20
|
+
* An unknown locale falls back to English rather than throwing: the badge's
|
|
21
|
+
* whole job is to render, and a typo in a prop must not take down the page it
|
|
22
|
+
* sits on.
|
|
23
|
+
*/
|
|
24
|
+
declare function statusDisplay(status: Status, locale?: WidgetLocale): {
|
|
25
|
+
label: string;
|
|
26
|
+
color: string;
|
|
27
|
+
};
|
|
28
|
+
|
|
3
29
|
type Status = "operational" | "degraded_performance" | "partial_outage" | "major_outage" | "under_maintenance" | "unknown" | "incident";
|
|
4
30
|
type StatusResponse = {
|
|
5
31
|
status: Status;
|
|
32
|
+
/**
|
|
33
|
+
* Where the page actually lives — the customer's own domain once they have
|
|
34
|
+
* attached one. Null when the page is private or does not exist.
|
|
35
|
+
*/
|
|
36
|
+
url?: string | null;
|
|
6
37
|
};
|
|
7
38
|
declare function getStatus(slug: string, baseUrl?: string): Promise<StatusResponse>;
|
|
8
39
|
type StatusWidgetProps = {
|
|
9
40
|
slug: string;
|
|
10
41
|
href?: string;
|
|
42
|
+
/**
|
|
43
|
+
* The language of the label. Defaults to English — a badge dropped into an
|
|
44
|
+
* unknown page should not surprise anyone with Lithuanian.
|
|
45
|
+
*/
|
|
46
|
+
locale?: WidgetLocale;
|
|
11
47
|
};
|
|
12
|
-
declare function StatusWidget({ slug, href }: StatusWidgetProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
48
|
+
declare function StatusWidget({ slug, href, locale, }: StatusWidgetProps): Promise<react_jsx_runtime.JSX.Element>;
|
|
13
49
|
|
|
14
|
-
export { Status, StatusResponse, StatusWidget, StatusWidgetProps, getStatus };
|
|
50
|
+
export { Status, StatusResponse, StatusWidget, StatusWidgetProps, WidgetLocale, defaultWidgetLocale, getStatus, statusColors, statusDisplay, widgetLocales };
|
package/dist/index.js
CHANGED
|
@@ -41,41 +41,114 @@ var __async = (__this, __arguments, generator) => {
|
|
|
41
41
|
var src_exports = {};
|
|
42
42
|
__export(src_exports, {
|
|
43
43
|
StatusWidget: () => StatusWidget,
|
|
44
|
-
|
|
44
|
+
defaultWidgetLocale: () => defaultWidgetLocale,
|
|
45
|
+
getStatus: () => getStatus,
|
|
46
|
+
statusColors: () => statusColors,
|
|
47
|
+
statusDisplay: () => statusDisplay,
|
|
48
|
+
widgetLocales: () => widgetLocales
|
|
45
49
|
});
|
|
46
50
|
module.exports = __toCommonJS(src_exports);
|
|
47
51
|
|
|
48
52
|
// src/utils.ts
|
|
49
|
-
var
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
var widgetLocales = [
|
|
54
|
+
"lt",
|
|
55
|
+
"en",
|
|
56
|
+
"fr",
|
|
57
|
+
"de",
|
|
58
|
+
"tr",
|
|
59
|
+
"hi",
|
|
60
|
+
"ko",
|
|
61
|
+
"ja"
|
|
62
|
+
];
|
|
63
|
+
var defaultWidgetLocale = "en";
|
|
64
|
+
var statusColors = {
|
|
65
|
+
operational: "bg-green-500",
|
|
66
|
+
degraded_performance: "bg-yellow-500",
|
|
67
|
+
partial_outage: "bg-yellow-500",
|
|
68
|
+
major_outage: "bg-red-500",
|
|
69
|
+
under_maintenance: "bg-blue-500",
|
|
70
|
+
incident: "bg-yellow-500",
|
|
71
|
+
unknown: "bg-gray-500"
|
|
72
|
+
};
|
|
73
|
+
var labels = {
|
|
74
|
+
en: {
|
|
75
|
+
operational: "Operational",
|
|
76
|
+
degraded_performance: "Degraded Performance",
|
|
77
|
+
partial_outage: "Partial Outage",
|
|
78
|
+
major_outage: "Major Outage",
|
|
79
|
+
under_maintenance: "Under Maintenance",
|
|
80
|
+
incident: "Incident",
|
|
81
|
+
unknown: "Unknown"
|
|
82
|
+
},
|
|
83
|
+
lt: {
|
|
84
|
+
operational: "Veikia",
|
|
85
|
+
degraded_performance: "Sul\u0117t\u0117j\u0119s veikimas",
|
|
86
|
+
partial_outage: "Dalinis sutrikimas",
|
|
87
|
+
major_outage: "Didelis sutrikimas",
|
|
88
|
+
under_maintenance: "Planiniai darbai",
|
|
89
|
+
incident: "Incidentas",
|
|
90
|
+
unknown: "Ne\u017Einoma"
|
|
53
91
|
},
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
92
|
+
fr: {
|
|
93
|
+
operational: "Op\xE9rationnel",
|
|
94
|
+
degraded_performance: "Performances d\xE9grad\xE9es",
|
|
95
|
+
partial_outage: "Panne partielle",
|
|
96
|
+
major_outage: "Panne majeure",
|
|
97
|
+
under_maintenance: "En maintenance",
|
|
98
|
+
incident: "Incident",
|
|
99
|
+
unknown: "Inconnu"
|
|
57
100
|
},
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
101
|
+
de: {
|
|
102
|
+
operational: "Betriebsbereit",
|
|
103
|
+
degraded_performance: "Eingeschr\xE4nkte Leistung",
|
|
104
|
+
partial_outage: "Teilausfall",
|
|
105
|
+
major_outage: "Schwerer Ausfall",
|
|
106
|
+
under_maintenance: "Wartungsarbeiten",
|
|
107
|
+
incident: "St\xF6rung",
|
|
108
|
+
unknown: "Unbekannt"
|
|
61
109
|
},
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
110
|
+
tr: {
|
|
111
|
+
operational: "\xC7al\u0131\u015F\u0131yor",
|
|
112
|
+
degraded_performance: "Performans d\xFC\u015F\xFCk",
|
|
113
|
+
partial_outage: "K\u0131smi kesinti",
|
|
114
|
+
major_outage: "B\xFCy\xFCk kesinti",
|
|
115
|
+
under_maintenance: "Bak\u0131mda",
|
|
116
|
+
incident: "Olay",
|
|
117
|
+
unknown: "Bilinmiyor"
|
|
65
118
|
},
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
119
|
+
hi: {
|
|
120
|
+
operational: "\u091A\u093E\u0932\u0942",
|
|
121
|
+
degraded_performance: "\u092A\u094D\u0930\u0926\u0930\u094D\u0936\u0928 \u0927\u0940\u092E\u093E",
|
|
122
|
+
partial_outage: "\u0906\u0902\u0936\u093F\u0915 \u0930\u0941\u0915\u093E\u0935\u091F",
|
|
123
|
+
major_outage: "\u092C\u0921\u093C\u0940 \u0930\u0941\u0915\u093E\u0935\u091F",
|
|
124
|
+
under_maintenance: "\u0930\u0916\u0930\u0916\u093E\u0935 \u091C\u093E\u0930\u0940",
|
|
125
|
+
incident: "\u0918\u091F\u0928\u093E",
|
|
126
|
+
unknown: "\u0905\u091C\u094D\u091E\u093E\u0924"
|
|
69
127
|
},
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
128
|
+
ko: {
|
|
129
|
+
operational: "\uC815\uC0C1 \uC791\uB3D9",
|
|
130
|
+
degraded_performance: "\uC131\uB2A5 \uC800\uD558",
|
|
131
|
+
partial_outage: "\uBD80\uBD84 \uC7A5\uC560",
|
|
132
|
+
major_outage: "\uC2EC\uAC01\uD55C \uC7A5\uC560",
|
|
133
|
+
under_maintenance: "\uC810\uAC80 \uC911",
|
|
134
|
+
incident: "\uC7A5\uC560",
|
|
135
|
+
unknown: "\uC54C \uC218 \uC5C6\uC74C"
|
|
73
136
|
},
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
137
|
+
ja: {
|
|
138
|
+
operational: "\u6B63\u5E38\u7A3C\u50CD\u4E2D",
|
|
139
|
+
degraded_performance: "\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u4F4E\u4E0B",
|
|
140
|
+
partial_outage: "\u4E00\u90E8\u969C\u5BB3",
|
|
141
|
+
major_outage: "\u91CD\u5927\u306A\u969C\u5BB3",
|
|
142
|
+
under_maintenance: "\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\u4E2D",
|
|
143
|
+
incident: "\u969C\u5BB3",
|
|
144
|
+
unknown: "\u4E0D\u660E"
|
|
77
145
|
}
|
|
78
146
|
};
|
|
147
|
+
function statusDisplay(status, locale = defaultWidgetLocale) {
|
|
148
|
+
var _a;
|
|
149
|
+
const dictionary = (_a = labels[locale]) != null ? _a : labels[defaultWidgetLocale];
|
|
150
|
+
return { label: dictionary[status], color: statusColors[status] };
|
|
151
|
+
}
|
|
79
152
|
|
|
80
153
|
// src/widget.tsx
|
|
81
154
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
@@ -96,14 +169,19 @@ function getStatus(_0) {
|
|
|
96
169
|
});
|
|
97
170
|
}
|
|
98
171
|
function StatusWidget(_0) {
|
|
99
|
-
return __async(this, arguments, function* ({
|
|
100
|
-
|
|
101
|
-
|
|
172
|
+
return __async(this, arguments, function* ({
|
|
173
|
+
slug,
|
|
174
|
+
href,
|
|
175
|
+
locale = defaultWidgetLocale
|
|
176
|
+
}) {
|
|
177
|
+
const { status, url } = yield getStatus(slug);
|
|
178
|
+
const { label, color } = statusDisplay(status, locale);
|
|
102
179
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
103
180
|
"a",
|
|
104
181
|
{
|
|
182
|
+
lang: locale,
|
|
105
183
|
className: "inline-flex max-w-fit items-center gap-2 rounded-md border border-gray-200 px-3 py-1 text-sm text-gray-700 hover:bg-gray-100 hover:text-black dark:border-gray-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-white",
|
|
106
|
-
href: href || `https://${slug}.statusas.lt`,
|
|
184
|
+
href: href || url || `https://${slug}.statusas.lt`,
|
|
107
185
|
target: "_blank",
|
|
108
186
|
rel: "noreferrer",
|
|
109
187
|
children: [
|
|
@@ -130,6 +208,10 @@ function StatusWidget(_0) {
|
|
|
130
208
|
// Annotate the CommonJS export names for ESM import in node:
|
|
131
209
|
0 && (module.exports = {
|
|
132
210
|
StatusWidget,
|
|
133
|
-
|
|
211
|
+
defaultWidgetLocale,
|
|
212
|
+
getStatus,
|
|
213
|
+
statusColors,
|
|
214
|
+
statusDisplay,
|
|
215
|
+
widgetLocales
|
|
134
216
|
});
|
|
135
217
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/widget.tsx"],"sourcesContent":["export * from \"./widget\";\n","import type { Status } from \"./widget\";\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/utils.ts","../src/widget.tsx"],"sourcesContent":["export * from \"./widget\";\n","import type { Status } from \"./widget\";\n\n/**\n * The languages the widget speaks.\n *\n * The same eight a status page serves, so a badge on a customer's marketing\n * site can match the page it links to. Kept as a literal list inside the\n * package rather than imported from `@statusas/locales`: this is the one piece\n * of the product that gets installed into somebody else's app, and it should\n * carry no workspace dependencies.\n */\nexport const widgetLocales = [\n\t\"lt\",\n\t\"en\",\n\t\"fr\",\n\t\"de\",\n\t\"tr\",\n\t\"hi\",\n\t\"ko\",\n\t\"ja\",\n] as const;\n\nexport type WidgetLocale = (typeof widgetLocales)[number];\n\nexport const defaultWidgetLocale: WidgetLocale = \"en\";\n\n/** Colour is not a language: it stays out of the translations. */\nexport const statusColors: Record<Status, string> = {\n\toperational: \"bg-green-500\",\n\tdegraded_performance: \"bg-yellow-500\",\n\tpartial_outage: \"bg-yellow-500\",\n\tmajor_outage: \"bg-red-500\",\n\tunder_maintenance: \"bg-blue-500\",\n\tincident: \"bg-yellow-500\",\n\tunknown: \"bg-gray-500\",\n};\n\nconst labels: Record<WidgetLocale, Record<Status, string>> = {\n\ten: {\n\t\toperational: \"Operational\",\n\t\tdegraded_performance: \"Degraded Performance\",\n\t\tpartial_outage: \"Partial Outage\",\n\t\tmajor_outage: \"Major Outage\",\n\t\tunder_maintenance: \"Under Maintenance\",\n\t\tincident: \"Incident\",\n\t\tunknown: \"Unknown\",\n\t},\n\tlt: {\n\t\toperational: \"Veikia\",\n\t\tdegraded_performance: \"Sulėtėjęs veikimas\",\n\t\tpartial_outage: \"Dalinis sutrikimas\",\n\t\tmajor_outage: \"Didelis sutrikimas\",\n\t\tunder_maintenance: \"Planiniai darbai\",\n\t\tincident: \"Incidentas\",\n\t\tunknown: \"Nežinoma\",\n\t},\n\tfr: {\n\t\toperational: \"Opérationnel\",\n\t\tdegraded_performance: \"Performances dégradées\",\n\t\tpartial_outage: \"Panne partielle\",\n\t\tmajor_outage: \"Panne majeure\",\n\t\tunder_maintenance: \"En maintenance\",\n\t\tincident: \"Incident\",\n\t\tunknown: \"Inconnu\",\n\t},\n\tde: {\n\t\toperational: \"Betriebsbereit\",\n\t\tdegraded_performance: \"Eingeschränkte Leistung\",\n\t\tpartial_outage: \"Teilausfall\",\n\t\tmajor_outage: \"Schwerer Ausfall\",\n\t\tunder_maintenance: \"Wartungsarbeiten\",\n\t\tincident: \"Störung\",\n\t\tunknown: \"Unbekannt\",\n\t},\n\ttr: {\n\t\toperational: \"Çalışıyor\",\n\t\tdegraded_performance: \"Performans düşük\",\n\t\tpartial_outage: \"Kısmi kesinti\",\n\t\tmajor_outage: \"Büyük kesinti\",\n\t\tunder_maintenance: \"Bakımda\",\n\t\tincident: \"Olay\",\n\t\tunknown: \"Bilinmiyor\",\n\t},\n\thi: {\n\t\toperational: \"चालू\",\n\t\tdegraded_performance: \"प्रदर्शन धीमा\",\n\t\tpartial_outage: \"आंशिक रुकावट\",\n\t\tmajor_outage: \"बड़ी रुकावट\",\n\t\tunder_maintenance: \"रखरखाव जारी\",\n\t\tincident: \"घटना\",\n\t\tunknown: \"अज्ञात\",\n\t},\n\tko: {\n\t\toperational: \"정상 작동\",\n\t\tdegraded_performance: \"성능 저하\",\n\t\tpartial_outage: \"부분 장애\",\n\t\tmajor_outage: \"심각한 장애\",\n\t\tunder_maintenance: \"점검 중\",\n\t\tincident: \"장애\",\n\t\tunknown: \"알 수 없음\",\n\t},\n\tja: {\n\t\toperational: \"正常稼働中\",\n\t\tdegraded_performance: \"パフォーマンス低下\",\n\t\tpartial_outage: \"一部障害\",\n\t\tmajor_outage: \"重大な障害\",\n\t\tunder_maintenance: \"メンテナンス中\",\n\t\tincident: \"障害\",\n\t\tunknown: \"不明\",\n\t},\n};\n\n/**\n * The label and colour for a status, in the chosen language.\n *\n * An unknown locale falls back to English rather than throwing: the badge's\n * whole job is to render, and a typo in a prop must not take down the page it\n * sits on.\n */\nexport function statusDisplay(\n\tstatus: Status,\n\tlocale: WidgetLocale = defaultWidgetLocale,\n): { label: string; color: string } {\n\tconst dictionary = labels[locale] ?? labels[defaultWidgetLocale];\n\treturn { label: dictionary[status], color: statusColors[status] };\n}\n","import {\n defaultWidgetLocale,\n statusDisplay,\n type WidgetLocale,\n} from \"./utils\";\n\nexport {\n defaultWidgetLocale,\n statusColors,\n statusDisplay,\n widgetLocales,\n type WidgetLocale,\n} from \"./utils\";\n\nexport type Status =\n | \"operational\"\n | \"degraded_performance\"\n | \"partial_outage\"\n | \"major_outage\"\n | \"under_maintenance\"\n | \"unknown\"\n | \"incident\";\n\nexport type StatusResponse = {\n status: Status;\n /**\n * Where the page actually lives — the customer's own domain once they have\n * attached one. Null when the page is private or does not exist.\n */\n url?: string | null;\n};\n\nexport async function getStatus(\n slug: string,\n baseUrl = process.env.STATUSAS_API_URL ?? \"https://api.statusas.lt\",\n): Promise<StatusResponse> {\n // read at runtime on the server: no NEXT_PUBLIC_ prefix, so deployments\n // shipping prebuilt images can still point badges at their own API\n const base = baseUrl.replace(/\\/+$/, \"\") || \"https://api.statusas.lt\";\n try {\n const res = await fetch(`${base}/public/status/${slug}`, {\n cache: \"no-cache\",\n });\n\n if (res.ok) {\n const data = (await res.json()) as StatusResponse;\n return data;\n }\n } catch {\n // network-level failures (unreachable host, DNS, …) degrade to \"unknown\"\n // instead of bubbling a 500 out of the badge routes\n }\n return { status: \"unknown\" };\n}\n\nexport type StatusWidgetProps = {\n slug: string;\n href?: string;\n /**\n * The language of the label. Defaults to English — a badge dropped into an\n * unknown page should not surprise anyone with Lithuanian.\n */\n locale?: WidgetLocale;\n};\n\nexport async function StatusWidget({\n slug,\n href,\n locale = defaultWidgetLocale,\n}: StatusWidgetProps) {\n // The API knows the custom domain; the slug alone cannot. `href` still wins,\n // because a caller who passed one meant it.\n const { status, url } = await getStatus(slug);\n\n const { label, color } = statusDisplay(status, locale);\n\n return (\n <a\n lang={locale}\n className=\"inline-flex max-w-fit items-center gap-2 rounded-md border border-gray-200 px-3 py-1 text-sm text-gray-700 hover:bg-gray-100 hover:text-black dark:border-gray-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-white\"\n href={href || url || `https://${slug}.statusas.lt`}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {label}\n <span className=\"relative flex h-2 w-2\">\n {status === \"operational\" ? (\n <span\n className={`absolute inline-flex h-full w-full animate-ping rounded-full ${color} opacity-75 duration-1000`}\n />\n ) : null}\n <span\n className={`relative inline-flex h-2 w-2 rounded-full ${color}`}\n />\n </span>\n </a>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACWO,IAAM,gBAAgB;AAAA,EAC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AO;AAAA,QACP,KAAI;AAAA,QAEH;AAAA;AAAA,UACD,6CAAC,UAAK,WAAU,yBACb;AAAA,uBAAW,gBACV;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,gEAAgE,KAAK;AAAA;AAAA,YAClF,IACE;AAAA,YACJ;AAAA,cAAC;AAAA;AAAA,gBACC,WAAW,6CAA6C,KAAK;AAAA;AAAA,YAC/D;AAAA,aACF;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AAAA;","names":[]}
|
package/dist/index.mjs
CHANGED
|
@@ -20,36 +20,105 @@ var __async = (__this, __arguments, generator) => {
|
|
|
20
20
|
};
|
|
21
21
|
|
|
22
22
|
// src/utils.ts
|
|
23
|
-
var
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
23
|
+
var widgetLocales = [
|
|
24
|
+
"lt",
|
|
25
|
+
"en",
|
|
26
|
+
"fr",
|
|
27
|
+
"de",
|
|
28
|
+
"tr",
|
|
29
|
+
"hi",
|
|
30
|
+
"ko",
|
|
31
|
+
"ja"
|
|
32
|
+
];
|
|
33
|
+
var defaultWidgetLocale = "en";
|
|
34
|
+
var statusColors = {
|
|
35
|
+
operational: "bg-green-500",
|
|
36
|
+
degraded_performance: "bg-yellow-500",
|
|
37
|
+
partial_outage: "bg-yellow-500",
|
|
38
|
+
major_outage: "bg-red-500",
|
|
39
|
+
under_maintenance: "bg-blue-500",
|
|
40
|
+
incident: "bg-yellow-500",
|
|
41
|
+
unknown: "bg-gray-500"
|
|
42
|
+
};
|
|
43
|
+
var labels = {
|
|
44
|
+
en: {
|
|
45
|
+
operational: "Operational",
|
|
46
|
+
degraded_performance: "Degraded Performance",
|
|
47
|
+
partial_outage: "Partial Outage",
|
|
48
|
+
major_outage: "Major Outage",
|
|
49
|
+
under_maintenance: "Under Maintenance",
|
|
50
|
+
incident: "Incident",
|
|
51
|
+
unknown: "Unknown"
|
|
52
|
+
},
|
|
53
|
+
lt: {
|
|
54
|
+
operational: "Veikia",
|
|
55
|
+
degraded_performance: "Sul\u0117t\u0117j\u0119s veikimas",
|
|
56
|
+
partial_outage: "Dalinis sutrikimas",
|
|
57
|
+
major_outage: "Didelis sutrikimas",
|
|
58
|
+
under_maintenance: "Planiniai darbai",
|
|
59
|
+
incident: "Incidentas",
|
|
60
|
+
unknown: "Ne\u017Einoma"
|
|
27
61
|
},
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
62
|
+
fr: {
|
|
63
|
+
operational: "Op\xE9rationnel",
|
|
64
|
+
degraded_performance: "Performances d\xE9grad\xE9es",
|
|
65
|
+
partial_outage: "Panne partielle",
|
|
66
|
+
major_outage: "Panne majeure",
|
|
67
|
+
under_maintenance: "En maintenance",
|
|
68
|
+
incident: "Incident",
|
|
69
|
+
unknown: "Inconnu"
|
|
31
70
|
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
71
|
+
de: {
|
|
72
|
+
operational: "Betriebsbereit",
|
|
73
|
+
degraded_performance: "Eingeschr\xE4nkte Leistung",
|
|
74
|
+
partial_outage: "Teilausfall",
|
|
75
|
+
major_outage: "Schwerer Ausfall",
|
|
76
|
+
under_maintenance: "Wartungsarbeiten",
|
|
77
|
+
incident: "St\xF6rung",
|
|
78
|
+
unknown: "Unbekannt"
|
|
35
79
|
},
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
80
|
+
tr: {
|
|
81
|
+
operational: "\xC7al\u0131\u015F\u0131yor",
|
|
82
|
+
degraded_performance: "Performans d\xFC\u015F\xFCk",
|
|
83
|
+
partial_outage: "K\u0131smi kesinti",
|
|
84
|
+
major_outage: "B\xFCy\xFCk kesinti",
|
|
85
|
+
under_maintenance: "Bak\u0131mda",
|
|
86
|
+
incident: "Olay",
|
|
87
|
+
unknown: "Bilinmiyor"
|
|
39
88
|
},
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
89
|
+
hi: {
|
|
90
|
+
operational: "\u091A\u093E\u0932\u0942",
|
|
91
|
+
degraded_performance: "\u092A\u094D\u0930\u0926\u0930\u094D\u0936\u0928 \u0927\u0940\u092E\u093E",
|
|
92
|
+
partial_outage: "\u0906\u0902\u0936\u093F\u0915 \u0930\u0941\u0915\u093E\u0935\u091F",
|
|
93
|
+
major_outage: "\u092C\u0921\u093C\u0940 \u0930\u0941\u0915\u093E\u0935\u091F",
|
|
94
|
+
under_maintenance: "\u0930\u0916\u0930\u0916\u093E\u0935 \u091C\u093E\u0930\u0940",
|
|
95
|
+
incident: "\u0918\u091F\u0928\u093E",
|
|
96
|
+
unknown: "\u0905\u091C\u094D\u091E\u093E\u0924"
|
|
43
97
|
},
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
98
|
+
ko: {
|
|
99
|
+
operational: "\uC815\uC0C1 \uC791\uB3D9",
|
|
100
|
+
degraded_performance: "\uC131\uB2A5 \uC800\uD558",
|
|
101
|
+
partial_outage: "\uBD80\uBD84 \uC7A5\uC560",
|
|
102
|
+
major_outage: "\uC2EC\uAC01\uD55C \uC7A5\uC560",
|
|
103
|
+
under_maintenance: "\uC810\uAC80 \uC911",
|
|
104
|
+
incident: "\uC7A5\uC560",
|
|
105
|
+
unknown: "\uC54C \uC218 \uC5C6\uC74C"
|
|
47
106
|
},
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
107
|
+
ja: {
|
|
108
|
+
operational: "\u6B63\u5E38\u7A3C\u50CD\u4E2D",
|
|
109
|
+
degraded_performance: "\u30D1\u30D5\u30A9\u30FC\u30DE\u30F3\u30B9\u4F4E\u4E0B",
|
|
110
|
+
partial_outage: "\u4E00\u90E8\u969C\u5BB3",
|
|
111
|
+
major_outage: "\u91CD\u5927\u306A\u969C\u5BB3",
|
|
112
|
+
under_maintenance: "\u30E1\u30F3\u30C6\u30CA\u30F3\u30B9\u4E2D",
|
|
113
|
+
incident: "\u969C\u5BB3",
|
|
114
|
+
unknown: "\u4E0D\u660E"
|
|
51
115
|
}
|
|
52
116
|
};
|
|
117
|
+
function statusDisplay(status, locale = defaultWidgetLocale) {
|
|
118
|
+
var _a;
|
|
119
|
+
const dictionary = (_a = labels[locale]) != null ? _a : labels[defaultWidgetLocale];
|
|
120
|
+
return { label: dictionary[status], color: statusColors[status] };
|
|
121
|
+
}
|
|
53
122
|
|
|
54
123
|
// src/widget.tsx
|
|
55
124
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -70,14 +139,19 @@ function getStatus(_0) {
|
|
|
70
139
|
});
|
|
71
140
|
}
|
|
72
141
|
function StatusWidget(_0) {
|
|
73
|
-
return __async(this, arguments, function* ({
|
|
74
|
-
|
|
75
|
-
|
|
142
|
+
return __async(this, arguments, function* ({
|
|
143
|
+
slug,
|
|
144
|
+
href,
|
|
145
|
+
locale = defaultWidgetLocale
|
|
146
|
+
}) {
|
|
147
|
+
const { status, url } = yield getStatus(slug);
|
|
148
|
+
const { label, color } = statusDisplay(status, locale);
|
|
76
149
|
return /* @__PURE__ */ jsxs(
|
|
77
150
|
"a",
|
|
78
151
|
{
|
|
152
|
+
lang: locale,
|
|
79
153
|
className: "inline-flex max-w-fit items-center gap-2 rounded-md border border-gray-200 px-3 py-1 text-sm text-gray-700 hover:bg-gray-100 hover:text-black dark:border-gray-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-white",
|
|
80
|
-
href: href || `https://${slug}.statusas.lt`,
|
|
154
|
+
href: href || url || `https://${slug}.statusas.lt`,
|
|
81
155
|
target: "_blank",
|
|
82
156
|
rel: "noreferrer",
|
|
83
157
|
children: [
|
|
@@ -103,6 +177,10 @@ function StatusWidget(_0) {
|
|
|
103
177
|
}
|
|
104
178
|
export {
|
|
105
179
|
StatusWidget,
|
|
106
|
-
|
|
180
|
+
defaultWidgetLocale,
|
|
181
|
+
getStatus,
|
|
182
|
+
statusColors,
|
|
183
|
+
statusDisplay,
|
|
184
|
+
widgetLocales
|
|
107
185
|
};
|
|
108
186
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/utils.ts","../src/widget.tsx"],"sourcesContent":["import type { Status } from \"./widget\";\n\nexport const
|
|
1
|
+
{"version":3,"sources":["../src/utils.ts","../src/widget.tsx"],"sourcesContent":["import type { Status } from \"./widget\";\n\n/**\n * The languages the widget speaks.\n *\n * The same eight a status page serves, so a badge on a customer's marketing\n * site can match the page it links to. Kept as a literal list inside the\n * package rather than imported from `@statusas/locales`: this is the one piece\n * of the product that gets installed into somebody else's app, and it should\n * carry no workspace dependencies.\n */\nexport const widgetLocales = [\n\t\"lt\",\n\t\"en\",\n\t\"fr\",\n\t\"de\",\n\t\"tr\",\n\t\"hi\",\n\t\"ko\",\n\t\"ja\",\n] as const;\n\nexport type WidgetLocale = (typeof widgetLocales)[number];\n\nexport const defaultWidgetLocale: WidgetLocale = \"en\";\n\n/** Colour is not a language: it stays out of the translations. */\nexport const statusColors: Record<Status, string> = {\n\toperational: \"bg-green-500\",\n\tdegraded_performance: \"bg-yellow-500\",\n\tpartial_outage: \"bg-yellow-500\",\n\tmajor_outage: \"bg-red-500\",\n\tunder_maintenance: \"bg-blue-500\",\n\tincident: \"bg-yellow-500\",\n\tunknown: \"bg-gray-500\",\n};\n\nconst labels: Record<WidgetLocale, Record<Status, string>> = {\n\ten: {\n\t\toperational: \"Operational\",\n\t\tdegraded_performance: \"Degraded Performance\",\n\t\tpartial_outage: \"Partial Outage\",\n\t\tmajor_outage: \"Major Outage\",\n\t\tunder_maintenance: \"Under Maintenance\",\n\t\tincident: \"Incident\",\n\t\tunknown: \"Unknown\",\n\t},\n\tlt: {\n\t\toperational: \"Veikia\",\n\t\tdegraded_performance: \"Sulėtėjęs veikimas\",\n\t\tpartial_outage: \"Dalinis sutrikimas\",\n\t\tmajor_outage: \"Didelis sutrikimas\",\n\t\tunder_maintenance: \"Planiniai darbai\",\n\t\tincident: \"Incidentas\",\n\t\tunknown: \"Nežinoma\",\n\t},\n\tfr: {\n\t\toperational: \"Opérationnel\",\n\t\tdegraded_performance: \"Performances dégradées\",\n\t\tpartial_outage: \"Panne partielle\",\n\t\tmajor_outage: \"Panne majeure\",\n\t\tunder_maintenance: \"En maintenance\",\n\t\tincident: \"Incident\",\n\t\tunknown: \"Inconnu\",\n\t},\n\tde: {\n\t\toperational: \"Betriebsbereit\",\n\t\tdegraded_performance: \"Eingeschränkte Leistung\",\n\t\tpartial_outage: \"Teilausfall\",\n\t\tmajor_outage: \"Schwerer Ausfall\",\n\t\tunder_maintenance: \"Wartungsarbeiten\",\n\t\tincident: \"Störung\",\n\t\tunknown: \"Unbekannt\",\n\t},\n\ttr: {\n\t\toperational: \"Çalışıyor\",\n\t\tdegraded_performance: \"Performans düşük\",\n\t\tpartial_outage: \"Kısmi kesinti\",\n\t\tmajor_outage: \"Büyük kesinti\",\n\t\tunder_maintenance: \"Bakımda\",\n\t\tincident: \"Olay\",\n\t\tunknown: \"Bilinmiyor\",\n\t},\n\thi: {\n\t\toperational: \"चालू\",\n\t\tdegraded_performance: \"प्रदर्शन धीमा\",\n\t\tpartial_outage: \"आंशिक रुकावट\",\n\t\tmajor_outage: \"बड़ी रुकावट\",\n\t\tunder_maintenance: \"रखरखाव जारी\",\n\t\tincident: \"घटना\",\n\t\tunknown: \"अज्ञात\",\n\t},\n\tko: {\n\t\toperational: \"정상 작동\",\n\t\tdegraded_performance: \"성능 저하\",\n\t\tpartial_outage: \"부분 장애\",\n\t\tmajor_outage: \"심각한 장애\",\n\t\tunder_maintenance: \"점검 중\",\n\t\tincident: \"장애\",\n\t\tunknown: \"알 수 없음\",\n\t},\n\tja: {\n\t\toperational: \"正常稼働中\",\n\t\tdegraded_performance: \"パフォーマンス低下\",\n\t\tpartial_outage: \"一部障害\",\n\t\tmajor_outage: \"重大な障害\",\n\t\tunder_maintenance: \"メンテナンス中\",\n\t\tincident: \"障害\",\n\t\tunknown: \"不明\",\n\t},\n};\n\n/**\n * The label and colour for a status, in the chosen language.\n *\n * An unknown locale falls back to English rather than throwing: the badge's\n * whole job is to render, and a typo in a prop must not take down the page it\n * sits on.\n */\nexport function statusDisplay(\n\tstatus: Status,\n\tlocale: WidgetLocale = defaultWidgetLocale,\n): { label: string; color: string } {\n\tconst dictionary = labels[locale] ?? labels[defaultWidgetLocale];\n\treturn { label: dictionary[status], color: statusColors[status] };\n}\n","import {\n defaultWidgetLocale,\n statusDisplay,\n type WidgetLocale,\n} from \"./utils\";\n\nexport {\n defaultWidgetLocale,\n statusColors,\n statusDisplay,\n widgetLocales,\n type WidgetLocale,\n} from \"./utils\";\n\nexport type Status =\n | \"operational\"\n | \"degraded_performance\"\n | \"partial_outage\"\n | \"major_outage\"\n | \"under_maintenance\"\n | \"unknown\"\n | \"incident\";\n\nexport type StatusResponse = {\n status: Status;\n /**\n * Where the page actually lives — the customer's own domain once they have\n * attached one. Null when the page is private or does not exist.\n */\n url?: string | null;\n};\n\nexport async function getStatus(\n slug: string,\n baseUrl = process.env.STATUSAS_API_URL ?? \"https://api.statusas.lt\",\n): Promise<StatusResponse> {\n // read at runtime on the server: no NEXT_PUBLIC_ prefix, so deployments\n // shipping prebuilt images can still point badges at their own API\n const base = baseUrl.replace(/\\/+$/, \"\") || \"https://api.statusas.lt\";\n try {\n const res = await fetch(`${base}/public/status/${slug}`, {\n cache: \"no-cache\",\n });\n\n if (res.ok) {\n const data = (await res.json()) as StatusResponse;\n return data;\n }\n } catch {\n // network-level failures (unreachable host, DNS, …) degrade to \"unknown\"\n // instead of bubbling a 500 out of the badge routes\n }\n return { status: \"unknown\" };\n}\n\nexport type StatusWidgetProps = {\n slug: string;\n href?: string;\n /**\n * The language of the label. Defaults to English — a badge dropped into an\n * unknown page should not surprise anyone with Lithuanian.\n */\n locale?: WidgetLocale;\n};\n\nexport async function StatusWidget({\n slug,\n href,\n locale = defaultWidgetLocale,\n}: StatusWidgetProps) {\n // The API knows the custom domain; the slug alone cannot. `href` still wins,\n // because a caller who passed one meant it.\n const { status, url } = await getStatus(slug);\n\n const { label, color } = statusDisplay(status, locale);\n\n return (\n <a\n lang={locale}\n className=\"inline-flex max-w-fit items-center gap-2 rounded-md border border-gray-200 px-3 py-1 text-sm text-gray-700 hover:bg-gray-100 hover:text-black dark:border-gray-800 dark:text-gray-300 dark:hover:bg-gray-900 dark:hover:text-white\"\n href={href || url || `https://${slug}.statusas.lt`}\n target=\"_blank\"\n rel=\"noreferrer\"\n >\n {label}\n <span className=\"relative flex h-2 w-2\">\n {status === \"operational\" ? (\n <span\n className={`absolute inline-flex h-full w-full animate-ping rounded-full ${color} opacity-75 duration-1000`}\n />\n ) : null}\n <span\n className={`relative inline-flex h-2 w-2 rounded-full ${color}`}\n />\n </span>\n </a>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAWO,IAAM,gBAAgB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAIO,IAAM,sBAAoC;AAG1C,IAAM,eAAuC;AAAA,EACnD,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,gBAAgB;AAAA,EAChB,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,UAAU;AAAA,EACV,SAAS;AACV;AAEA,IAAM,SAAuD;AAAA,EAC5D,IAAI;AAAA,IACH,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AAAA,EACA,IAAI;AAAA,IACH,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AAAA,EACA,IAAI;AAAA,IACH,aAAa;AAAA,IACb,sBAAsB;AAAA,IACtB,gBAAgB;AAAA,IAChB,cAAc;AAAA,IACd,mBAAmB;AAAA,IACnB,UAAU;AAAA,IACV,SAAS;AAAA,EACV;AAAA,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