@logto/core-kit 2.2.0 → 2.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/lib/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './utils/index.js';
2
2
  export * from './regex.js';
3
- export * from './scope.js';
3
+ export * from './openid.js';
4
4
  export * from './models/index.js';
5
5
  export * from './http.js';
6
6
  export * from './password-policy.js';
package/lib/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  export * from './utils/index.js';
2
2
  export * from './regex.js';
3
- export * from './scope.js';
3
+ export * from './openid.js';
4
4
  export * from './models/index.js';
5
5
  export * from './http.js';
6
6
  export * from './password-policy.js';
@@ -0,0 +1,112 @@
1
+ /** Scopes that reserved by Logto, which will be added to the auth request automatically. */
2
+ export declare enum ReservedScope {
3
+ OpenId = "openid",
4
+ OfflineAccess = "offline_access"
5
+ }
6
+ /** Resources that reserved by Logto, which cannot be defined by users. */
7
+ export declare enum ReservedResource {
8
+ /**
9
+ * The resource for organization template per RFC 0001.
10
+ *
11
+ * @see {@link https://github.com/logto-io/rfcs | RFC 0001} for more details.
12
+ */
13
+ Organization = "urn:logto:resource:organizations"
14
+ }
15
+ export type UserClaim = 'name' | 'picture' | 'username' | 'email' | 'email_verified' | 'phone_number' | 'phone_number_verified' | 'roles' | 'organizations' | 'organization_data' | 'organization_roles' | 'custom_data' | 'identities';
16
+ /**
17
+ * Scopes for ID Token and Userinfo Endpoint.
18
+ */
19
+ export declare enum UserScope {
20
+ /**
21
+ * Scope for basic user info.
22
+ *
23
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
24
+ */
25
+ Profile = "profile",
26
+ /**
27
+ * Scope for user email address.
28
+ *
29
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
30
+ */
31
+ Email = "email",
32
+ /**
33
+ * Scope for user phone number.
34
+ *
35
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
36
+ */
37
+ Phone = "phone",
38
+ /**
39
+ * Scope for user's custom data.
40
+ *
41
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
42
+ */
43
+ CustomData = "custom_data",
44
+ /**
45
+ * Scope for user's social identity details.
46
+ *
47
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
48
+ */
49
+ Identities = "identities",
50
+ /**
51
+ * Scope for user's roles.
52
+ *
53
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
54
+ */
55
+ Roles = "roles",
56
+ /**
57
+ * Scope for user's organization IDs and perform organization token grant per [RFC 0001](https://github.com/logto-io/rfcs).
58
+ *
59
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
60
+ */
61
+ Organizations = "urn:logto:scope:organizations",
62
+ /**
63
+ * Scope for user's organization roles per [RFC 0001](https://github.com/logto-io/rfcs).
64
+ *
65
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
66
+ */
67
+ OrganizationRoles = "urn:logto:scope:organization_roles"
68
+ }
69
+ /**
70
+ * Mapped claims that ID Token includes.
71
+ */
72
+ export declare const idTokenClaims: Readonly<Record<UserScope, UserClaim[]>>;
73
+ /**
74
+ * Additional claims that Userinfo Endpoint returns.
75
+ */
76
+ export declare const userinfoClaims: Readonly<Record<UserScope, UserClaim[]>>;
77
+ export declare const userClaims: Readonly<Record<UserScope, UserClaim[]>>;
78
+ /**
79
+ * The prefix of the URN (Uniform Resource Name) for the organization in Logto.
80
+ *
81
+ * @example
82
+ * ```
83
+ * urn:logto:organization:123 // organization with ID 123
84
+ * ```
85
+ * @see {@link https://en.wikipedia.org/wiki/Uniform_Resource_Name | Uniform Resource Name}
86
+ */
87
+ export declare const organizationUrnPrefix = "urn:logto:organization:";
88
+ /**
89
+ * Build the URN (Uniform Resource Name) for the organization in Logto.
90
+ *
91
+ * @param organizationId The ID of the organization.
92
+ * @returns The URN for the organization.
93
+ * @see {@link organizationUrnPrefix} for the prefix of the URN.
94
+ * @example
95
+ * ```ts
96
+ * buildOrganizationUrn('1') // returns 'urn:logto:organization:1'
97
+ * ```
98
+ */
99
+ export declare const buildOrganizationUrn: (organizationId: string) => string;
100
+ /**
101
+ * Get the organization ID from the URN (Uniform Resource Name) for the organization in Logto.
102
+ *
103
+ * @param urn The URN for the organization. Must start with {@link organizationUrnPrefix}.
104
+ * @returns The ID of the organization.
105
+ * @throws {TypeError} If the URN is invalid.
106
+ * @example
107
+ * ```ts
108
+ * getOrganizationIdFromUrn('1') // throws TypeError
109
+ * getOrganizationIdFromUrn('urn:logto:organization:1') // returns '1'
110
+ * ```
111
+ */
112
+ export declare const getOrganizationIdFromUrn: (urn: string) => string;
package/lib/openid.js ADDED
@@ -0,0 +1,143 @@
1
+ /** Scopes that reserved by Logto, which will be added to the auth request automatically. */
2
+ export var ReservedScope;
3
+ (function (ReservedScope) {
4
+ ReservedScope["OpenId"] = "openid";
5
+ ReservedScope["OfflineAccess"] = "offline_access";
6
+ })(ReservedScope || (ReservedScope = {}));
7
+ /** Resources that reserved by Logto, which cannot be defined by users. */
8
+ export var ReservedResource;
9
+ (function (ReservedResource) {
10
+ /**
11
+ * The resource for organization template per RFC 0001.
12
+ *
13
+ * @see {@link https://github.com/logto-io/rfcs | RFC 0001} for more details.
14
+ */
15
+ ReservedResource["Organization"] = "urn:logto:resource:organizations";
16
+ })(ReservedResource || (ReservedResource = {}));
17
+ /**
18
+ * Scopes for ID Token and Userinfo Endpoint.
19
+ */
20
+ export var UserScope;
21
+ (function (UserScope) {
22
+ /**
23
+ * Scope for basic user info.
24
+ *
25
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
26
+ */
27
+ UserScope["Profile"] = "profile";
28
+ /**
29
+ * Scope for user email address.
30
+ *
31
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
32
+ */
33
+ UserScope["Email"] = "email";
34
+ /**
35
+ * Scope for user phone number.
36
+ *
37
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
38
+ */
39
+ UserScope["Phone"] = "phone";
40
+ /**
41
+ * Scope for user's custom data.
42
+ *
43
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
44
+ */
45
+ UserScope["CustomData"] = "custom_data";
46
+ /**
47
+ * Scope for user's social identity details.
48
+ *
49
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
50
+ */
51
+ UserScope["Identities"] = "identities";
52
+ /**
53
+ * Scope for user's roles.
54
+ *
55
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
56
+ */
57
+ UserScope["Roles"] = "roles";
58
+ /**
59
+ * Scope for user's organization IDs and perform organization token grant per [RFC 0001](https://github.com/logto-io/rfcs).
60
+ *
61
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
62
+ */
63
+ UserScope["Organizations"] = "urn:logto:scope:organizations";
64
+ /**
65
+ * Scope for user's organization roles per [RFC 0001](https://github.com/logto-io/rfcs).
66
+ *
67
+ * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
68
+ */
69
+ UserScope["OrganizationRoles"] = "urn:logto:scope:organization_roles";
70
+ })(UserScope || (UserScope = {}));
71
+ /**
72
+ * Mapped claims that ID Token includes.
73
+ */
74
+ export const idTokenClaims = Object.freeze({
75
+ [UserScope.Profile]: ['name', 'picture', 'username'],
76
+ [UserScope.Email]: ['email', 'email_verified'],
77
+ [UserScope.Phone]: ['phone_number', 'phone_number_verified'],
78
+ [UserScope.Roles]: ['roles'],
79
+ [UserScope.Organizations]: ['organizations'],
80
+ [UserScope.OrganizationRoles]: ['organization_roles'],
81
+ [UserScope.CustomData]: [],
82
+ [UserScope.Identities]: [],
83
+ });
84
+ /**
85
+ * Additional claims that Userinfo Endpoint returns.
86
+ */
87
+ export const userinfoClaims = Object.freeze({
88
+ [UserScope.Profile]: [],
89
+ [UserScope.Email]: [],
90
+ [UserScope.Phone]: [],
91
+ [UserScope.Roles]: [],
92
+ [UserScope.Organizations]: ['organization_data'],
93
+ [UserScope.OrganizationRoles]: [],
94
+ [UserScope.CustomData]: ['custom_data'],
95
+ [UserScope.Identities]: ['identities'],
96
+ });
97
+ export const userClaims = Object.freeze(
98
+ // Hard to infer type directly, use `as` for a workaround.
99
+ // eslint-disable-next-line no-restricted-syntax
100
+ Object.fromEntries(Object.values(UserScope).map((current) => [
101
+ current,
102
+ [...idTokenClaims[current], ...userinfoClaims[current]],
103
+ ])));
104
+ /**
105
+ * The prefix of the URN (Uniform Resource Name) for the organization in Logto.
106
+ *
107
+ * @example
108
+ * ```
109
+ * urn:logto:organization:123 // organization with ID 123
110
+ * ```
111
+ * @see {@link https://en.wikipedia.org/wiki/Uniform_Resource_Name | Uniform Resource Name}
112
+ */
113
+ export const organizationUrnPrefix = 'urn:logto:organization:';
114
+ /**
115
+ * Build the URN (Uniform Resource Name) for the organization in Logto.
116
+ *
117
+ * @param organizationId The ID of the organization.
118
+ * @returns The URN for the organization.
119
+ * @see {@link organizationUrnPrefix} for the prefix of the URN.
120
+ * @example
121
+ * ```ts
122
+ * buildOrganizationUrn('1') // returns 'urn:logto:organization:1'
123
+ * ```
124
+ */
125
+ export const buildOrganizationUrn = (organizationId) => `${organizationUrnPrefix}${organizationId}`;
126
+ /**
127
+ * Get the organization ID from the URN (Uniform Resource Name) for the organization in Logto.
128
+ *
129
+ * @param urn The URN for the organization. Must start with {@link organizationUrnPrefix}.
130
+ * @returns The ID of the organization.
131
+ * @throws {TypeError} If the URN is invalid.
132
+ * @example
133
+ * ```ts
134
+ * getOrganizationIdFromUrn('1') // throws TypeError
135
+ * getOrganizationIdFromUrn('urn:logto:organization:1') // returns '1'
136
+ * ```
137
+ */
138
+ export const getOrganizationIdFromUrn = (urn) => {
139
+ if (!urn.startsWith(organizationUrnPrefix)) {
140
+ throw new TypeError('Invalid organization URN.');
141
+ }
142
+ return urn.slice(organizationUrnPrefix.length);
143
+ };
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" resolution-mode="require"/>
2
+ import { type webcrypto } from 'node:crypto';
1
3
  import { type DeepPartial } from '@silverhand/essentials';
2
4
  import { z } from 'zod';
3
5
  /** Password policy configuration type. */
@@ -137,7 +139,7 @@ export type UserInfo = Partial<{
137
139
  */
138
140
  export declare class PasswordPolicyChecker {
139
141
  /** The Web Crypto API to use. By default, the global `crypto.subtle` will be used. */
140
- protected readonly subtle: SubtleCrypto;
142
+ protected readonly subtle: webcrypto.SubtleCrypto | SubtleCrypto;
141
143
  static symbols: "!\"#$%&'()*+,-./:;<=>?@[\\]^_`{|}~ ";
142
144
  /** A set of characters that are considered as sequential. */
143
145
  static sequence: readonly ["0123456789", "abcdefghijklmnopqrstuvwxyz", "qwertyuiop", "asdfghjkl", "zxcvbnm", "1qaz", "2wsx", "3edc", "4rfv", "5tgb", "6yhn", "7ujm", "8ik", "9ol"];
@@ -153,7 +155,7 @@ export declare class PasswordPolicyChecker {
153
155
  readonly policy: PasswordPolicy;
154
156
  constructor(policy: DeepPartial<PasswordPolicy>,
155
157
  /** The Web Crypto API to use. By default, the global `crypto.subtle` will be used. */
156
- subtle?: SubtleCrypto);
158
+ subtle?: webcrypto.SubtleCrypto | SubtleCrypto);
157
159
  /**
158
160
  * Check if a password meets all the policy requirements.
159
161
  *
@@ -43,7 +43,7 @@ export const passwordPolicyGuard = z.object({
43
43
  * // ]
44
44
  * ```
45
45
  */
46
- class PasswordPolicyChecker {
46
+ export class PasswordPolicyChecker {
47
47
  static { this.symbols = Object.freeze('!"#$%&\'()*+,-./:;<=>?@[\\]^_`{|}~ '); }
48
48
  /** A set of characters that are considered as sequential. */
49
49
  static { this.sequence = Object.freeze([
@@ -356,4 +356,3 @@ class PasswordPolicyChecker {
356
356
  return false;
357
357
  }
358
358
  }
359
- export { PasswordPolicyChecker };
package/lib/regex.d.ts CHANGED
@@ -7,3 +7,5 @@ export declare const mobileUriSchemeProtocolRegEx: RegExp;
7
7
  export declare const hexColorRegEx: RegExp;
8
8
  export declare const dateRegex: RegExp;
9
9
  export declare const noSpaceRegEx: RegExp;
10
+ /** Full domain that consists of at least 3 parts, e.g. foo.bar.com */
11
+ export declare const domainRegEx: RegExp;
package/lib/regex.js CHANGED
@@ -7,3 +7,5 @@ export const mobileUriSchemeProtocolRegEx = /^[a-z][\d+_a-z-]*(\.[\d+_a-z-]+)+:$
7
7
  export const hexColorRegEx = /^#[\da-f]{3}([\da-f]{3})?$/i;
8
8
  export const dateRegex = /^\d{4}(-\d{2}){2}/;
9
9
  export const noSpaceRegEx = /^\S+$/;
10
+ /** Full domain that consists of at least 3 parts, e.g. foo.bar.com */
11
+ export const domainRegEx = /^[\dA-Za-z]+(\.[\dA-Za-z]+){2,}$/;
@@ -1,2 +1,3 @@
1
1
  export * from './color.js';
2
+ export * from './regex.js';
2
3
  export * from './url.js';
@@ -1,2 +1,3 @@
1
1
  export * from './color.js';
2
+ export * from './regex.js';
2
3
  export * from './url.js';
@@ -0,0 +1 @@
1
+ export declare const isValidRegEx: (regEx?: string) => boolean;
@@ -0,0 +1,8 @@
1
+ export const isValidRegEx = (regEx) => {
2
+ try {
3
+ return Boolean(regEx && new RegExp(regEx));
4
+ }
5
+ catch {
6
+ return false;
7
+ }
8
+ };
@@ -1,2 +1,3 @@
1
1
  export declare const validateRedirectUrl: (url: string, type: 'web' | 'mobile') => boolean;
2
2
  export declare const validateUriOrigin: (url: string) => boolean;
3
+ export declare const isValidUrl: (url?: string) => boolean;
package/lib/utils/url.js CHANGED
@@ -17,3 +17,11 @@ export const validateUriOrigin = (url) => {
17
17
  return false;
18
18
  }
19
19
  };
20
+ export const isValidUrl = (url) => {
21
+ try {
22
+ return Boolean(url && new URL(url));
23
+ }
24
+ catch {
25
+ return false;
26
+ }
27
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@logto/core-kit",
3
- "version": "2.2.0",
3
+ "version": "2.3.0",
4
4
  "author": "Silverhand Inc. <contact@silverhand.io>",
5
5
  "homepage": "https://github.com/logto-io/toolkit#readme",
6
6
  "repository": {
@@ -26,34 +26,34 @@
26
26
  "scss"
27
27
  ],
28
28
  "engines": {
29
- "node": "^18.12.0"
29
+ "node": "^20.9.0"
30
30
  },
31
31
  "dependencies": {
32
- "@logto/language-kit": "^1.0.0",
33
- "@logto/shared": "^3.0.0",
32
+ "@logto/language-kit": "^1.1.0",
33
+ "@logto/shared": "^3.1.0",
34
34
  "color": "^4.2.3"
35
35
  },
36
36
  "optionalDependencies": {
37
- "zod": "^3.20.2"
37
+ "zod": "^3.22.4"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@jest/types": "^29.0.3",
41
- "@silverhand/eslint-config": "4.0.1",
42
- "@silverhand/essentials": "^2.8.4",
43
- "@silverhand/ts-config": "4.0.0",
44
- "@silverhand/ts-config-react": "4.0.0",
41
+ "@silverhand/eslint-config": "5.0.0",
42
+ "@silverhand/essentials": "^2.9.0",
43
+ "@silverhand/ts-config": "5.0.0",
44
+ "@silverhand/ts-config-react": "5.0.0",
45
45
  "@types/color": "^3.0.3",
46
46
  "@types/jest": "^29.4.0",
47
- "@types/node": "^18.11.18",
47
+ "@types/node": "^20.9.5",
48
48
  "@types/react": "^18.0.31",
49
49
  "eslint": "^8.44.0",
50
- "jest": "^29.5.0",
51
- "lint-staged": "^14.0.0",
52
- "postcss": "^8.4.6",
50
+ "jest": "^29.7.0",
51
+ "lint-staged": "^15.0.0",
52
+ "postcss": "^8.4.31",
53
53
  "prettier": "^3.0.0",
54
54
  "stylelint": "^15.0.0",
55
55
  "tslib": "^2.4.1",
56
- "typescript": "^5.0.0"
56
+ "typescript": "^5.3.3"
57
57
  },
58
58
  "eslintConfig": {
59
59
  "extends": "@silverhand"
@@ -92,6 +92,7 @@
92
92
  --color-alert-99: #fff5eb;
93
93
 
94
94
  // color aliases
95
+ --color-static-white: #fff;
95
96
  --color-primary: var(--color-primary-40);
96
97
  --color-on-primary: var(--color-all-100);
97
98
  --color-primary-container: var(--color-primary-90);
@@ -158,6 +159,10 @@
158
159
  --color-env-tag-development: rgba(93, 52, 242, 15%);
159
160
  --color-env-tag-staging: rgba(255, 185, 90, 35%);
160
161
  --color-env-tag-production: rgba(131, 218, 133, 35%);
162
+ --color-specific-icon-bg: #f3effa;
163
+ --color-specific-toggle-off-enable: var(--color-neutral-90);
164
+ --color-specific-unselected-disabled: var(--color-hover); // 8% Neutral-10
165
+ --color-function-n-overlay-primary-focused: rgba(93, 52, 242, 16%); // 16% Primary-40
161
166
 
162
167
  // Shadows
163
168
  --shadow-1: 0 4px 8px rgba(0, 0, 0, 8%);
@@ -173,16 +178,19 @@
173
178
  --color-tooltip-background: #34353f; // dark theme Surface-4
174
179
  --color-tooltip-text: var(--color-neutral-99);
175
180
  --color-overlay: rgba(0, 0, 0, 30%);
181
+ --color-overlay-default-focused: rgba(25, 28, 29, 16%);
176
182
  --color-drawer-overlay: rgba(0, 0, 0, 40%);
177
183
  --color-guide-dropdown-background: var(--color-white);
178
184
  --color-guide-dropdown-border: var(--color-border);
179
185
  --color-skeleton-shimmer-rgb: 255, 255, 255; // rgb of Layer-1
180
186
  --color-specific-tag-upsell: var(--color-primary-50);
187
+ --color-specific-tag-test: var(--color-tertiary-50);
188
+ --color-specific-toggle-thumb-disabled: #ffffffb3;
181
189
 
182
190
  // Background
183
191
  --color-bg-body-base: var(--color-neutral-95);
184
192
  --color-bg-body: var(--color-neutral-100);
185
- --color-bg-layer-1: var(--color-static-white);
193
+ --color-bg-layer-1: var(--color-all-100);
186
194
  --color-bg-layer-2: var(--color-neutral-95);
187
195
  --color-bg-body-overlay: var(--color-neutral-100);
188
196
  --color-bg-float-base: var(--color-neutral-variant-90);
@@ -192,6 +200,7 @@
192
200
  --color-bg-toast: var(--color-neutral-20);
193
201
  --color-bg-state-unselected: var(--color-neutral-90);
194
202
  --color-bg-state-disabled: rgba(25, 28, 29, 8%); // 8% --color-neutral-10
203
+ --color-bg-info-tag: rgba(229, 225, 236, 80%); // 80% --color-neutral-variant-90
195
204
  }
196
205
 
197
206
  @mixin dark {
@@ -288,6 +297,7 @@
288
297
  --color-alert-99: #2b1700;
289
298
 
290
299
  // color aliases
300
+ --color-static-white: #fff;
291
301
  --color-primary: var(--color-primary-70);
292
302
  --color-on-primary: var(--color-all-0);
293
303
  --color-primary-container: var(--color-primary-30);
@@ -354,6 +364,10 @@
354
364
  --color-env-tag-development: rgba(202, 190, 255, 32%);
355
365
  --color-env-tag-staging: rgba(235, 153, 24, 36%);
356
366
  --color-env-tag-production: rgba(104, 190, 108, 36%);
367
+ --color-specific-icon-bg: rgba(247, 248, 248, 12%);
368
+ --color-specific-toggle-off-enable: var(--color-neutral-90);
369
+ --color-specific-unselected-disabled: var(--color-hover); // 8% Neutral-10
370
+ --color-function-n-overlay-primary-focused: rgba(202, 190, 255, 16%); // 16% Primary-40
357
371
 
358
372
  // Shadows
359
373
  --shadow-1: 0 4px 8px rgba(0, 0, 0, 8%);
@@ -369,11 +383,14 @@
369
383
  --color-tooltip-background: var(--color-surface-4);
370
384
  --color-tooltip-text: var(--color-neutral-10);
371
385
  --color-overlay: rgba(0, 0, 0, 70%); // 70% Neutral-100
386
+ --color-overlay-default-focused: rgba(247, 248, 248, 16%);
372
387
  --color-drawer-overlay: rgba(0, 0, 0, 60%);
373
388
  --color-guide-dropdown-background: var(--color-neutral-variant-80);
374
389
  --color-guide-dropdown-border: var(--color-neutral-variant-70);
375
390
  --color-skeleton-shimmer-rgb: 42, 44, 50; // rgb of Layer-1
376
391
  --color-specific-tag-upsell: var(--color-primary-70);
392
+ --color-specific-tag-test: var(--color-tertiary-80);
393
+ --color-specific-toggle-thumb-disabled: #ffffff4d;
377
394
 
378
395
  // Background
379
396
  --color-bg-body-base: var(--color-neutral-100);
@@ -391,4 +408,5 @@
391
408
  --color-bg-toast: var(--color-neutral-80);
392
409
  --color-bg-state-unselected: var(--color-neutral-90);
393
410
  --color-bg-state-disabled: rgba(247, 248, 248, 8%); // 8% --color-neutral-10
411
+ --color-bg-info-tag: var(--color-neutral-variant-90);
394
412
  }
package/lib/scope.d.ts DELETED
@@ -1,55 +0,0 @@
1
- export declare enum ReservedScope {
2
- OpenId = "openid",
3
- OfflineAccess = "offline_access"
4
- }
5
- export type UserClaim = 'name' | 'picture' | 'username' | 'email' | 'email_verified' | 'phone_number' | 'phone_number_verified' | 'roles' | 'custom_data' | 'identities';
6
- /**
7
- * Scopes for ID Token and Userinfo Endpoint.
8
- */
9
- export declare enum UserScope {
10
- /**
11
- * Scope for basic user info.
12
- *
13
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
14
- */
15
- Profile = "profile",
16
- /**
17
- * Scope for user email address.
18
- *
19
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
20
- */
21
- Email = "email",
22
- /**
23
- * Scope for user phone number.
24
- *
25
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
26
- */
27
- Phone = "phone",
28
- /**
29
- * Scope for user's custom data.
30
- *
31
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
32
- */
33
- CustomData = "custom_data",
34
- /**
35
- * Scope for user's social identity details.
36
- *
37
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
38
- */
39
- Identities = "identities",
40
- /**
41
- * Scope for user's roles.
42
- *
43
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
44
- */
45
- Roles = "roles"
46
- }
47
- /**
48
- * Mapped claims that ID Token includes.
49
- */
50
- export declare const idTokenClaims: Readonly<Record<UserScope, UserClaim[]>>;
51
- /**
52
- * Additional claims that Userinfo Endpoint returns.
53
- */
54
- export declare const userinfoClaims: Readonly<Record<UserScope, UserClaim[]>>;
55
- export declare const userClaims: Readonly<Record<UserScope, UserClaim[]>>;
package/lib/scope.js DELETED
@@ -1,76 +0,0 @@
1
- export var ReservedScope;
2
- (function (ReservedScope) {
3
- ReservedScope["OpenId"] = "openid";
4
- ReservedScope["OfflineAccess"] = "offline_access";
5
- })(ReservedScope || (ReservedScope = {}));
6
- /**
7
- * Scopes for ID Token and Userinfo Endpoint.
8
- */
9
- export var UserScope;
10
- (function (UserScope) {
11
- /**
12
- * Scope for basic user info.
13
- *
14
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
15
- */
16
- UserScope["Profile"] = "profile";
17
- /**
18
- * Scope for user email address.
19
- *
20
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
21
- */
22
- UserScope["Email"] = "email";
23
- /**
24
- * Scope for user phone number.
25
- *
26
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
27
- */
28
- UserScope["Phone"] = "phone";
29
- /**
30
- * Scope for user's custom data.
31
- *
32
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
33
- */
34
- UserScope["CustomData"] = "custom_data";
35
- /**
36
- * Scope for user's social identity details.
37
- *
38
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
39
- */
40
- UserScope["Identities"] = "identities";
41
- /**
42
- * Scope for user's roles.
43
- *
44
- * See {@link idTokenClaims} for mapped claims in ID Token and {@link userinfoClaims} for additional claims in Userinfo Endpoint.
45
- */
46
- UserScope["Roles"] = "roles";
47
- })(UserScope || (UserScope = {}));
48
- /**
49
- * Mapped claims that ID Token includes.
50
- */
51
- export const idTokenClaims = Object.freeze({
52
- [UserScope.Profile]: ['name', 'picture', 'username'],
53
- [UserScope.Email]: ['email', 'email_verified'],
54
- [UserScope.Phone]: ['phone_number', 'phone_number_verified'],
55
- [UserScope.Roles]: ['roles'],
56
- [UserScope.CustomData]: [],
57
- [UserScope.Identities]: [],
58
- });
59
- /**
60
- * Additional claims that Userinfo Endpoint returns.
61
- */
62
- export const userinfoClaims = Object.freeze({
63
- [UserScope.Profile]: [],
64
- [UserScope.Email]: [],
65
- [UserScope.Phone]: [],
66
- [UserScope.Roles]: [],
67
- [UserScope.CustomData]: ['custom_data'],
68
- [UserScope.Identities]: ['identities'],
69
- });
70
- export const userClaims = Object.freeze(
71
- // Hard to infer type directly, use `as` for a workaround.
72
- // eslint-disable-next-line no-restricted-syntax
73
- Object.fromEntries(Object.values(UserScope).map((current) => [
74
- current,
75
- [...idTokenClaims[current], ...userinfoClaims[current]],
76
- ])));