@koloseum/utils 0.3.2 → 0.3.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/dist/client.d.ts +12 -1
- package/dist/client.js +21 -3
- package/dist/formatting.d.ts +1 -1
- package/dist/platform.d.ts +1 -1
- package/dist/platform.js +1 -1
- package/package.json +5 -3
package/dist/client.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { BrowserInfo, Microservice, MicroserviceFeature, MicroserviceGroup, MicroserviceObject, MicroserviceRole, UserWithCustomMetadata } from "@koloseum/types/general";
|
|
2
|
-
import type { PronounsCheckboxes } from "@koloseum/types/public
|
|
2
|
+
import type { PronounsCheckboxes } from "@koloseum/types/public/auth";
|
|
3
3
|
import type { IOptions } from "@suprsend/web-components/dist/types/interface.d.ts";
|
|
4
4
|
import type { Page, SubmitFunction } from "@sveltejs/kit";
|
|
5
5
|
export declare const Browser: {
|
|
@@ -128,4 +128,15 @@ export declare const Interface: {
|
|
|
128
128
|
* @returns `true` if the page is active, `false` otherwise.
|
|
129
129
|
*/
|
|
130
130
|
pageIsActive: (page: Page, slug: string | undefined, microservice?: Microservice<MicroserviceGroup>, base?: string) => boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Resolves a path and returns the result.
|
|
133
|
+
* Wraps around the `resolve` function in SvelteKit's `$app/paths` module.
|
|
134
|
+
*
|
|
135
|
+
* https://svelte.dev/docs/kit/$app-paths#resolve
|
|
136
|
+
*
|
|
137
|
+
* @param path - The path to resolve
|
|
138
|
+
* @param params - The parameters to resolve the path with
|
|
139
|
+
* @returns {string} The resolved path without the leading dot
|
|
140
|
+
*/
|
|
141
|
+
resolvePath: (path: string, params?: Record<string, string>) => Promise<string>;
|
|
131
142
|
};
|
package/dist/client.js
CHANGED
|
@@ -117,7 +117,7 @@ export const Browser = {
|
|
|
117
117
|
if (typeof window === "undefined")
|
|
118
118
|
return {
|
|
119
119
|
title: "Browser compatibility issue",
|
|
120
|
-
message: "Browser detection is not available on
|
|
120
|
+
message: "Browser detection is not available on the server.",
|
|
121
121
|
recommendations: [],
|
|
122
122
|
critical: false
|
|
123
123
|
};
|
|
@@ -467,9 +467,12 @@ export const Interface = {
|
|
|
467
467
|
await goto(result.location);
|
|
468
468
|
return;
|
|
469
469
|
}
|
|
470
|
-
// Update form
|
|
470
|
+
// Update form
|
|
471
|
+
// OTP buttons are not restored on failure/error so OTP flows keep the loading state
|
|
471
472
|
await update();
|
|
472
|
-
|
|
473
|
+
const isOtpButton = button.classList.contains("otp-button");
|
|
474
|
+
const isFailureOrError = result.type === "failure" || result.type === "error";
|
|
475
|
+
if (!isOtpButton || !isFailureOrError) {
|
|
473
476
|
button.disabled = false;
|
|
474
477
|
button.innerHTML = innerHTML;
|
|
475
478
|
}
|
|
@@ -707,5 +710,20 @@ export const Interface = {
|
|
|
707
710
|
// Match exact or subpath otherwise
|
|
708
711
|
const target = `${cleanBase}/${slug}`;
|
|
709
712
|
return page.url.pathname === target || page.url.pathname.startsWith(`${target}/`);
|
|
713
|
+
},
|
|
714
|
+
/**
|
|
715
|
+
* Resolves a path and returns the result.
|
|
716
|
+
* Wraps around the `resolve` function in SvelteKit's `$app/paths` module.
|
|
717
|
+
*
|
|
718
|
+
* https://svelte.dev/docs/kit/$app-paths#resolve
|
|
719
|
+
*
|
|
720
|
+
* @param path - The path to resolve
|
|
721
|
+
* @param params - The parameters to resolve the path with
|
|
722
|
+
* @returns {string} The resolved path without the leading dot
|
|
723
|
+
*/
|
|
724
|
+
resolvePath: async (path, params = {}) => {
|
|
725
|
+
const { resolve } = await import("$app/paths");
|
|
726
|
+
const resolved = resolve(path, params);
|
|
727
|
+
return resolved.charAt(0) === "." ? resolved.slice(1) : resolved;
|
|
710
728
|
}
|
|
711
729
|
};
|
package/dist/formatting.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { IdentityType, PronounsItem, Sex, SocialMediaPlatform, SocialMediaPlatformObject } from "@koloseum/types/public
|
|
1
|
+
import type { IdentityType, PronounsItem, Sex, SocialMediaPlatform, SocialMediaPlatformObject } from "@koloseum/types/public/auth";
|
|
2
2
|
import type { MobilePhoneLocale } from "validator";
|
|
3
3
|
export declare const Transform: {
|
|
4
4
|
/**
|
package/dist/platform.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CustomError, MicroserviceGroup, MicroserviceObject, UserWithCustomMetadata } from "@koloseum/types/general";
|
|
2
|
-
import type { BranchAddressObject, County } from "@koloseum/types/public
|
|
2
|
+
import type { BranchAddressObject, County } from "@koloseum/types/public/auth";
|
|
3
3
|
export declare const Config: {
|
|
4
4
|
/**
|
|
5
5
|
* A reference of microservices available on the platform, represented as an object with each user group (i.e. `public`, `players`, `lounges`, and `backroom`) having its own array of microservices. Each microservice in a list is an object with the following properties:
|
package/dist/platform.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koloseum/utils",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"author": "Koloseum Technologies Limited",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Utility logic for use across Koloseum web apps (TypeScript)",
|
|
@@ -48,7 +48,8 @@
|
|
|
48
48
|
"build": "rm -rf dist && npx tsc",
|
|
49
49
|
"check": "npx tsc --noEmit && prettier --check .",
|
|
50
50
|
"format": "prettier --write .",
|
|
51
|
-
"test": "vitest --run"
|
|
51
|
+
"test": "vitest --run",
|
|
52
|
+
"test:coverage": "vitest run --coverage"
|
|
52
53
|
},
|
|
53
54
|
"dependencies": {
|
|
54
55
|
"@supabase/supabase-js": "^2.57.4",
|
|
@@ -61,12 +62,13 @@
|
|
|
61
62
|
"validator": "^13.15.15"
|
|
62
63
|
},
|
|
63
64
|
"devDependencies": {
|
|
64
|
-
"@koloseum/types": "^0.3.
|
|
65
|
+
"@koloseum/types": "^0.3.2",
|
|
65
66
|
"@playwright/test": "^1.55.0",
|
|
66
67
|
"@suprsend/web-components": "^0.4.0",
|
|
67
68
|
"@types/sanitize-html": "^2.16.0",
|
|
68
69
|
"@types/uuid": "^10.0.0",
|
|
69
70
|
"@types/validator": "^13.15.3",
|
|
71
|
+
"@vitest/coverage-v8": "^3.2.4",
|
|
70
72
|
"prettier": "^3.6.2",
|
|
71
73
|
"typescript": "^5.9.2",
|
|
72
74
|
"vitest": "^3.2.4"
|