@cosmicdrift/kumiko-bundled-features 0.208.2 → 0.208.3
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cosmicdrift/kumiko-bundled-features",
|
|
3
|
-
"version": "0.208.
|
|
3
|
+
"version": "0.208.3",
|
|
4
4
|
"description": "Built-in features — tenant, user, auth, delivery. The stuff you'd rewrite anyway, already typed.",
|
|
5
5
|
"license": "BUSL-1.1",
|
|
6
6
|
"author": "Marc Frost <marc@cosmicdriftgamestudio.com>",
|
|
@@ -126,12 +126,12 @@
|
|
|
126
126
|
"./step-dispatcher": "./src/step-dispatcher/index.ts"
|
|
127
127
|
},
|
|
128
128
|
"dependencies": {
|
|
129
|
-
"@cosmicdrift/kumiko-dispatcher-live": "0.208.
|
|
130
|
-
"@cosmicdrift/kumiko-framework": "0.208.
|
|
131
|
-
"@cosmicdrift/kumiko-headless": "0.208.
|
|
132
|
-
"@cosmicdrift/kumiko-renderer": "0.208.
|
|
133
|
-
"@cosmicdrift/kumiko-renderer-web": "0.208.
|
|
134
|
-
"@cosmicdrift/kumiko-types": "0.208.
|
|
129
|
+
"@cosmicdrift/kumiko-dispatcher-live": "0.208.3",
|
|
130
|
+
"@cosmicdrift/kumiko-framework": "0.208.3",
|
|
131
|
+
"@cosmicdrift/kumiko-headless": "0.208.3",
|
|
132
|
+
"@cosmicdrift/kumiko-renderer": "0.208.3",
|
|
133
|
+
"@cosmicdrift/kumiko-renderer-web": "0.208.3",
|
|
134
|
+
"@cosmicdrift/kumiko-types": "0.208.3",
|
|
135
135
|
"@mollie/api-client": "^4.5.0",
|
|
136
136
|
"@node-rs/argon2": "^2.0.2",
|
|
137
137
|
"@types/mailparser": "^3.4.6",
|
|
@@ -160,6 +160,6 @@
|
|
|
160
160
|
"devDependencies": {
|
|
161
161
|
"@testing-library/user-event": "^14.6.1",
|
|
162
162
|
"@types/qrcode": "^1.5.5",
|
|
163
|
-
"@cosmicdrift/kumiko-locale-de": "0.208.
|
|
163
|
+
"@cosmicdrift/kumiko-locale-de": "0.208.3"
|
|
164
164
|
}
|
|
165
165
|
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, test } from "bun:test";
|
|
2
|
+
import { DEFAULT_LOCALES } from "@cosmicdrift/kumiko-framework/engine";
|
|
3
|
+
import { buildTenantSettingsKeys } from "../config";
|
|
4
|
+
|
|
5
|
+
describe("buildTenantSettingsKeys — locale", () => {
|
|
6
|
+
test("defaults to a select field with the engine's DEFAULT_LOCALES", () => {
|
|
7
|
+
const { locale } = buildTenantSettingsKeys();
|
|
8
|
+
if (locale?.type !== "select") throw new Error("expected select");
|
|
9
|
+
|
|
10
|
+
expect(locale.options).toEqual(DEFAULT_LOCALES);
|
|
11
|
+
});
|
|
12
|
+
|
|
13
|
+
test("passes through a custom locales list", () => {
|
|
14
|
+
const { locale } = buildTenantSettingsKeys({ locales: ["de", "en", "fr"] });
|
|
15
|
+
if (locale?.type !== "select") throw new Error("expected select");
|
|
16
|
+
|
|
17
|
+
expect(locale.options).toEqual(["de", "en", "fr"]);
|
|
18
|
+
});
|
|
19
|
+
});
|
|
@@ -3,17 +3,16 @@ import {
|
|
|
3
3
|
type ConfigKeyDefinition,
|
|
4
4
|
createTenantConfig,
|
|
5
5
|
DEFAULT_CURRENCIES,
|
|
6
|
+
DEFAULT_LOCALES,
|
|
6
7
|
} from "@cosmicdrift/kumiko-framework/engine";
|
|
7
8
|
|
|
8
|
-
// ISO-639-1, optional ISO-3166-1 region ("de" or "de-DE") — apps constrain
|
|
9
|
-
// further via their own i18n setup; this only guards against garbage input.
|
|
10
|
-
const LOCALE_PATTERN = { regex: "^[a-z]{2}(-[A-Z]{2})?$" } as const;
|
|
11
|
-
|
|
12
9
|
export type TenantSettingsKeyOptions = {
|
|
13
10
|
/** Selectable currencies. Default: DEFAULT_CURRENCIES (engine). */
|
|
14
11
|
readonly currencies?: readonly string[];
|
|
15
12
|
/** Fallback when a tenant never set the key. Default: "EUR". */
|
|
16
13
|
readonly defaultCurrency?: string;
|
|
14
|
+
/** Selectable locales. Default: DEFAULT_LOCALES (engine). */
|
|
15
|
+
readonly locales?: readonly string[];
|
|
17
16
|
/** Fallback when a tenant never set the key. Default: "en". */
|
|
18
17
|
readonly defaultLocale?: string;
|
|
19
18
|
/** Who may change the tenant's settings. Default: access.admin. */
|
|
@@ -34,9 +33,9 @@ export function buildTenantSettingsKeys(
|
|
|
34
33
|
write,
|
|
35
34
|
mask: { title: "tenant-settings.currency", icon: "coins", order: 1 },
|
|
36
35
|
}),
|
|
37
|
-
locale: createTenantConfig("
|
|
36
|
+
locale: createTenantConfig("select", {
|
|
38
37
|
default: opts.defaultLocale ?? "en",
|
|
39
|
-
|
|
38
|
+
options: opts.locales ?? DEFAULT_LOCALES,
|
|
40
39
|
write,
|
|
41
40
|
mask: { title: "tenant-settings.locale", icon: "languages", order: 2 },
|
|
42
41
|
}),
|