@logto/core-kit 1.0.0-beta.16 → 1.0.0-beta.18
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/lib/regex.d.ts +2 -1
- package/lib/regex.js +3 -2
- package/lib/utilities/index.d.ts +1 -0
- package/lib/utilities/index.js +1 -0
- package/lib/utilities/url.d.ts +2 -0
- package/lib/utilities/url.js +24 -0
- package/package.json +2 -3
- package/scss/_console-themes.scss +4 -4
package/lib/regex.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ export declare const emailRegEx: RegExp;
|
|
|
2
2
|
export declare const phoneRegEx: RegExp;
|
|
3
3
|
export declare const usernameRegEx: RegExp;
|
|
4
4
|
export declare const passwordRegEx: RegExp;
|
|
5
|
-
export declare const
|
|
5
|
+
export declare const webRedirectUriProtocolRegEx: RegExp;
|
|
6
|
+
export declare const mobileUriSchemeProtocolRegEx: RegExp;
|
|
6
7
|
export declare const hexColorRegEx: RegExp;
|
|
7
8
|
export declare const dateRegex: RegExp;
|
package/lib/regex.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dateRegex = exports.hexColorRegEx = exports.
|
|
3
|
+
exports.dateRegex = exports.hexColorRegEx = exports.mobileUriSchemeProtocolRegEx = exports.webRedirectUriProtocolRegEx = exports.passwordRegEx = exports.usernameRegEx = exports.phoneRegEx = exports.emailRegEx = void 0;
|
|
4
4
|
exports.emailRegEx = /^\S+@\S+\.\S+$/;
|
|
5
5
|
exports.phoneRegEx = /^\d+$/;
|
|
6
6
|
exports.usernameRegEx = /^[A-Z_a-z]\w*$/;
|
|
7
7
|
exports.passwordRegEx = /^.{6,}$/;
|
|
8
|
-
exports.
|
|
8
|
+
exports.webRedirectUriProtocolRegEx = /^https?:$/;
|
|
9
|
+
exports.mobileUriSchemeProtocolRegEx = /^[a-z][\d_a-z]*(\.[\d_a-z]+)+:$/;
|
|
9
10
|
exports.hexColorRegEx = /^#[\da-f]{3}([\da-f]{3})?$/i;
|
|
10
11
|
exports.dateRegex = /^\d{4}(-\d{2}){2}/;
|
package/lib/utilities/index.d.ts
CHANGED
package/lib/utilities/index.js
CHANGED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.validateUriOrigin = exports.validateRedirectUrl = void 0;
|
|
4
|
+
const regex_1 = require("../regex");
|
|
5
|
+
const validateRedirectUrl = (url, type) => {
|
|
6
|
+
try {
|
|
7
|
+
const { protocol } = new URL(url);
|
|
8
|
+
const protocolRegEx = type === 'mobile' ? regex_1.mobileUriSchemeProtocolRegEx : regex_1.webRedirectUriProtocolRegEx;
|
|
9
|
+
return protocolRegEx.test(protocol);
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
exports.validateRedirectUrl = validateRedirectUrl;
|
|
16
|
+
const validateUriOrigin = (url) => {
|
|
17
|
+
try {
|
|
18
|
+
return new URL(url).origin === url;
|
|
19
|
+
}
|
|
20
|
+
catch {
|
|
21
|
+
return false;
|
|
22
|
+
}
|
|
23
|
+
};
|
|
24
|
+
exports.validateUriOrigin = validateUriOrigin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@logto/core-kit",
|
|
3
|
-
"version": "1.0.0-beta.
|
|
3
|
+
"version": "1.0.0-beta.18",
|
|
4
4
|
"main": "lib/index.js",
|
|
5
5
|
"author": "Silverhand Inc. <contact@silverhand.io>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,7 +32,6 @@
|
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"@jest/types": "^29.0.3",
|
|
34
34
|
"@silverhand/eslint-config": "1.0.0",
|
|
35
|
-
"@silverhand/eslint-config-react": "1.0.0",
|
|
36
35
|
"@silverhand/essentials": "^1.2.1",
|
|
37
36
|
"@silverhand/ts-config": "1.0.0",
|
|
38
37
|
"@types/color": "^3.0.3",
|
|
@@ -59,5 +58,5 @@
|
|
|
59
58
|
"publishConfig": {
|
|
60
59
|
"access": "public"
|
|
61
60
|
},
|
|
62
|
-
"gitHead": "
|
|
61
|
+
"gitHead": "884e54c19aeddf0f5f4c694cab65a0e11a203d66"
|
|
63
62
|
}
|
|
@@ -126,8 +126,8 @@
|
|
|
126
126
|
--color-danger-pressed: var(--color-error-30);
|
|
127
127
|
--color-text: var(--color-neutral-10);
|
|
128
128
|
--color-text-link: var(--color-primary-40);
|
|
129
|
-
--color-
|
|
130
|
-
--color-
|
|
129
|
+
--color-text-secondary: var(--color-neutral-50);
|
|
130
|
+
--color-placeholder: var(--color-neutral-70);
|
|
131
131
|
--color-border: var(--color-neutral-80);
|
|
132
132
|
--color-divider: var(--color-neutral-90);
|
|
133
133
|
--color-disabled: var(--color-neutral-80);
|
|
@@ -296,8 +296,8 @@
|
|
|
296
296
|
--color-danger-pressed: var(--color-error-80);
|
|
297
297
|
--color-text: var(--color-neutral-10);
|
|
298
298
|
--color-text-link: var(--color-primary-40);
|
|
299
|
-
--color-
|
|
300
|
-
--color-
|
|
299
|
+
--color-text-secondary: var(--color-neutral-50);
|
|
300
|
+
--color-placeholder: var(--color-neutral-70);
|
|
301
301
|
--color-border: var(--color-neutral-80);
|
|
302
302
|
--color-divider: var(--color-neutral-90);
|
|
303
303
|
--color-disabled: var(--color-neutral-80);
|