@logto/schemas 1.40.1 → 1.42.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/alterations/1.41.0-1779864280-add-password-expiration-policy.ts +23 -0
- package/alterations/1.41.0-1779864281-add-is-password-expired-to-users.ts +18 -0
- package/alterations/1.41.0-1780358400-drop-oidc-model-instances-legacy-grant-id-index.ts +25 -0
- package/alterations/1.41.0-1780381219-add-username-policy.ts +41 -0
- package/alterations/1.41.0-1780643665-set-sign-up-profile-fields-default.ts +20 -0
- package/alterations/1.41.0-1780906060-add-verification-code-policy.ts +19 -0
- package/alterations/1.41.0-1781689400-add-sentinel-activities-created-at-index.ts +25 -0
- package/alterations/1.41.0-1782354362-set-admin-account-center-profile-fields.ts +28 -0
- package/alterations/1.41.0-1782375106-cover-service-logs-tenant-type-index-with-created-at.ts +36 -0
- package/alterations/1.42.0-1783916980-add-domain-verification-files.ts +20 -0
- package/alterations/1.42.0-1784619793-add-service-logs-created-at-index.ts +33 -0
- package/alterations/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.ts +38 -0
- package/alterations/utils/1704934999-tables.ts +22 -1
- package/alterations-js/1.41.0-1779864280-add-password-expiration-policy.js +19 -0
- package/alterations-js/1.41.0-1779864281-add-is-password-expired-to-users.js +14 -0
- package/alterations-js/1.41.0-1780358400-drop-oidc-model-instances-legacy-grant-id-index.js +21 -0
- package/alterations-js/1.41.0-1780381219-add-username-policy.js +37 -0
- package/alterations-js/1.41.0-1780643665-set-sign-up-profile-fields-default.js +16 -0
- package/alterations-js/1.41.0-1780906060-add-verification-code-policy.js +15 -0
- package/alterations-js/1.41.0-1781689400-add-sentinel-activities-created-at-index.js +21 -0
- package/alterations-js/1.41.0-1782354362-set-admin-account-center-profile-fields.js +23 -0
- package/alterations-js/1.41.0-1782375106-cover-service-logs-tenant-type-index-with-created-at.js +32 -0
- package/alterations-js/1.42.0-1783916980-add-domain-verification-files.js +16 -0
- package/alterations-js/1.42.0-1784619793-add-service-logs-created-at-index.js +29 -0
- package/alterations-js/1.42.0-1784620000-add-saml-sso-connector-signing-keys-table.js +33 -0
- package/alterations-js/utils/1704934999-tables.js +19 -1
- package/lib/consts/experience.d.ts +3 -0
- package/lib/consts/experience.js +3 -0
- package/lib/consts/index.d.ts +2 -0
- package/lib/consts/index.js +2 -0
- package/lib/consts/message-rate-limit.d.ts +65 -0
- package/lib/consts/message-rate-limit.js +29 -0
- package/lib/consts/message-rate-limit.test.d.ts +1 -0
- package/lib/consts/message-rate-limit.test.js +20 -0
- package/lib/consts/verification-code.d.ts +10 -0
- package/lib/consts/verification-code.js +10 -0
- package/lib/db-entries/domain.d.ts +4 -2
- package/lib/db-entries/domain.js +5 -1
- package/lib/db-entries/index.d.ts +1 -0
- package/lib/db-entries/index.js +1 -0
- package/lib/db-entries/saml-sso-connector-signing-key.d.ts +32 -0
- package/lib/db-entries/saml-sso-connector-signing-key.js +49 -0
- package/lib/db-entries/sign-in-experience.d.ts +10 -4
- package/lib/db-entries/sign-in-experience.js +13 -1
- package/lib/db-entries/user.d.ts +5 -1
- package/lib/db-entries/user.js +8 -0
- package/lib/foundations/jsonb-types/account-centers.d.ts +3 -0
- package/lib/foundations/jsonb-types/account-centers.js +1 -0
- package/lib/foundations/jsonb-types/custom-domain.d.ts +57 -0
- package/lib/foundations/jsonb-types/custom-domain.js +51 -0
- package/lib/foundations/jsonb-types/custom-domain.test.d.ts +1 -0
- package/lib/foundations/jsonb-types/custom-domain.test.js +38 -0
- package/lib/foundations/jsonb-types/hooks.d.ts +4 -4
- package/lib/foundations/jsonb-types/hooks.js +2 -0
- package/lib/foundations/jsonb-types/one-time-tokens.d.ts +5 -0
- package/lib/foundations/jsonb-types/one-time-tokens.js +2 -0
- package/lib/foundations/jsonb-types/sentinel.d.ts +16 -1
- package/lib/foundations/jsonb-types/sentinel.js +15 -0
- package/lib/foundations/jsonb-types/sign-in-experience.d.ts +90 -3
- package/lib/foundations/jsonb-types/sign-in-experience.js +20 -0
- package/lib/foundations/jsonb-types/sign-in-experience.test.js +49 -1
- package/lib/foundations/jsonb-types/users.d.ts +9 -0
- package/lib/foundations/jsonb-types/users.js +1 -0
- package/lib/seeds/account-center.js +1 -0
- package/lib/seeds/sign-in-experience.js +1 -0
- package/lib/seeds/sign-in-experience.test.js +5 -1
- package/lib/types/application.d.ts +131 -1
- package/lib/types/application.js +8 -0
- package/lib/types/consent.d.ts +8 -0
- package/lib/types/custom-profile-fields.d.ts +5 -1
- package/lib/types/domain.d.ts +9 -0
- package/lib/types/hook.d.ts +9 -2
- package/lib/types/interaction-event.d.ts +11 -0
- package/lib/types/interaction-event.js +12 -0
- package/lib/types/interactions.d.ts +2 -11
- package/lib/types/interactions.js +5 -12
- package/lib/types/log/action.d.ts +7 -0
- package/lib/types/log/action.js +6 -0
- package/lib/types/log/index.d.ts +5 -2
- package/lib/types/log/index.js +1 -0
- package/lib/types/logto-config/action.d.ts +963 -0
- package/lib/types/logto-config/action.js +77 -0
- package/lib/types/logto-config/index.d.ts +91 -13
- package/lib/types/logto-config/index.js +12 -0
- package/lib/types/logto-config/index.test.js +25 -1
- package/lib/types/logto-config/jwt-customizer.d.ts +162 -1
- package/lib/types/logto-config/jwt-customizer.js +14 -0
- package/lib/types/organization.d.ts +136 -1
- package/lib/types/organization.js +3 -2
- package/lib/types/saml-application.d.ts +3 -0
- package/lib/types/saml-application.js +3 -0
- package/lib/types/sign-in-experience.d.ts +11 -4
- package/lib/types/sign-in-experience.js +1 -1
- package/lib/types/sso-connector.d.ts +58 -0
- package/lib/types/sso-connector.js +12 -0
- package/lib/types/ssr.d.ts +11 -0
- package/lib/types/user-assets.d.ts +10 -0
- package/lib/types/user-assets.js +17 -0
- package/lib/types/user-sessions.d.ts +309 -34
- package/lib/types/user-sessions.js +5 -0
- package/lib/types/user.d.ts +15 -0
- package/lib/types/user.js +1 -0
- package/lib/types/verification-records/one-time-token-verification.d.ts +5 -0
- package/package.json +8 -8
- package/tables/domains.sql +1 -0
- package/tables/oidc_model_instances.sql +0 -8
- package/tables/saml_sso_connector_signing_keys.sql +21 -0
- package/tables/sentinel_activities.sql +4 -0
- package/tables/service_logs.sql +7 -2
- package/tables/sign_in_experiences.sql +15 -2
- package/tables/users.sql +7 -0
|
@@ -12,7 +12,7 @@ type ForgotPassword = {
|
|
|
12
12
|
* the need to load the full connector metadata that is not needed for rendering.
|
|
13
13
|
*/
|
|
14
14
|
export type ExperienceSocialConnector = Omit<ConnectorMetadata, 'description' | 'configTemplate' | 'formItems' | 'readme' | 'customData'>;
|
|
15
|
-
export type FullSignInExperience = Omit<SignInExperience, 'forgotPasswordMethods'> & {
|
|
15
|
+
export type FullSignInExperience = Omit<SignInExperience, 'emailBlocklistPolicy' | 'forgotPasswordMethods'> & {
|
|
16
16
|
socialConnectors: ExperienceSocialConnector[];
|
|
17
17
|
ssoConnectors: SsoConnectorMetadata[];
|
|
18
18
|
forgotPassword: ForgotPassword;
|
|
@@ -150,6 +150,7 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
|
|
|
150
150
|
}>;
|
|
151
151
|
sentinelPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy>;
|
|
152
152
|
emailBlocklistPolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").EmailBlocklistPolicy>;
|
|
153
|
+
verificationCodePolicy: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").VerificationCodePolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").VerificationCodePolicy>;
|
|
153
154
|
forgotPasswordMethods: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").ForgotPasswordMethod[] | null, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").ForgotPasswordMethod[] | null>;
|
|
154
155
|
passkeySignIn: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").PasskeySignIn, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").PasskeySignIn>;
|
|
155
156
|
signUpProfileFields: z.ZodType<{
|
|
@@ -157,7 +158,9 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
|
|
|
157
158
|
}[] | null, z.ZodTypeDef, {
|
|
158
159
|
name: string;
|
|
159
160
|
}[] | null>;
|
|
160
|
-
|
|
161
|
+
passwordExpiration: z.ZodType<import("../foundations/jsonb-types/sign-in-experience.js").PasswordExpirationPolicy, z.ZodTypeDef, import("../foundations/jsonb-types/sign-in-experience.js").PasswordExpirationPolicy>;
|
|
162
|
+
usernamePolicy: z.ZodType<import("../foundations/jsonb-types/index.js").UsernamePolicy, z.ZodTypeDef, import("../foundations/jsonb-types/index.js").UsernamePolicy>;
|
|
163
|
+
}, "emailBlocklistPolicy" | "forgotPasswordMethods"> & {
|
|
161
164
|
socialConnectors: z.ZodArray<z.ZodObject<Omit<{
|
|
162
165
|
id: z.ZodString;
|
|
163
166
|
target: z.ZodString;
|
|
@@ -737,9 +740,11 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
|
|
|
737
740
|
unknownSessionRedirectUrl: string | null;
|
|
738
741
|
captchaPolicy: import("../foundations/jsonb-types/sign-in-experience.js").CaptchaPolicy;
|
|
739
742
|
sentinelPolicy: import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy;
|
|
740
|
-
|
|
743
|
+
verificationCodePolicy: import("../foundations/jsonb-types/sign-in-experience.js").VerificationCodePolicy;
|
|
741
744
|
passkeySignIn: import("../foundations/jsonb-types/sign-in-experience.js").PasskeySignIn;
|
|
742
745
|
signUpProfileFields: import("../foundations/jsonb-types/sign-in-experience.js").SignUpProfileFields | null;
|
|
746
|
+
passwordExpiration: import("../foundations/jsonb-types/sign-in-experience.js").PasswordExpirationPolicy;
|
|
747
|
+
usernamePolicy: import("../foundations/jsonb-types/index.js").UsernamePolicy;
|
|
743
748
|
socialConnectors: {
|
|
744
749
|
name: {
|
|
745
750
|
en: string;
|
|
@@ -937,9 +942,11 @@ export declare const fullSignInExperienceGuard: z.ZodObject<Omit<{
|
|
|
937
942
|
unknownSessionRedirectUrl: string | null;
|
|
938
943
|
captchaPolicy: import("../foundations/jsonb-types/sign-in-experience.js").CaptchaPolicy;
|
|
939
944
|
sentinelPolicy: import("../foundations/jsonb-types/sign-in-experience.js").SentinelPolicy;
|
|
940
|
-
|
|
945
|
+
verificationCodePolicy: import("../foundations/jsonb-types/sign-in-experience.js").VerificationCodePolicy;
|
|
941
946
|
passkeySignIn: import("../foundations/jsonb-types/sign-in-experience.js").PasskeySignIn;
|
|
942
947
|
signUpProfileFields: import("../foundations/jsonb-types/sign-in-experience.js").SignUpProfileFields | null;
|
|
948
|
+
passwordExpiration: import("../foundations/jsonb-types/sign-in-experience.js").PasswordExpirationPolicy;
|
|
949
|
+
usernamePolicy: import("../foundations/jsonb-types/index.js").UsernamePolicy;
|
|
943
950
|
socialConnectors: {
|
|
944
951
|
name: {
|
|
945
952
|
en: string;
|
|
@@ -4,7 +4,7 @@ import { CustomProfileFields, SignInExperiences, } from '../db-entries/index.js'
|
|
|
4
4
|
import { CaptchaType, RecaptchaEnterpriseMode } from '../foundations/jsonb-types/index.js';
|
|
5
5
|
import { ssoConnectorMetadataGuard } from './sso-connector.js';
|
|
6
6
|
export const fullSignInExperienceGuard = SignInExperiences.guard
|
|
7
|
-
.omit({ forgotPasswordMethods: true })
|
|
7
|
+
.omit({ emailBlocklistPolicy: true, forgotPasswordMethods: true })
|
|
8
8
|
.extend({
|
|
9
9
|
socialConnectors: connectorMetadataGuard
|
|
10
10
|
.omit({
|
|
@@ -168,4 +168,62 @@ export declare const extendedSocialUserInfoGuard: z.ZodObject<{
|
|
|
168
168
|
rawData: z.ZodOptional<z.ZodType<import("@withtyped/server").Json, z.ZodTypeDef, import("@withtyped/server").Json>>;
|
|
169
169
|
}, z.ZodUnknown, "strip">>;
|
|
170
170
|
export type ExtendedSocialUserInfo = z.infer<typeof extendedSocialUserInfoGuard>;
|
|
171
|
+
export declare const samlSsoConnectorSigningKeyResponseGuard: z.ZodObject<Omit<{
|
|
172
|
+
id: z.ZodType<string, z.ZodTypeDef, string>;
|
|
173
|
+
tenantId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
174
|
+
ssoConnectorId: z.ZodType<string, z.ZodTypeDef, string>;
|
|
175
|
+
privateKey: z.ZodType<string, z.ZodTypeDef, string>;
|
|
176
|
+
certificate: z.ZodType<string, z.ZodTypeDef, string>;
|
|
177
|
+
createdAt: z.ZodType<number, z.ZodTypeDef, number>;
|
|
178
|
+
expiresAt: z.ZodType<number, z.ZodTypeDef, number>;
|
|
179
|
+
active: z.ZodType<boolean, z.ZodTypeDef, boolean>;
|
|
180
|
+
}, "tenantId" | "ssoConnectorId" | "privateKey"> & {
|
|
181
|
+
fingerprints: z.ZodObject<{
|
|
182
|
+
sha256: z.ZodObject<{
|
|
183
|
+
formatted: z.ZodString;
|
|
184
|
+
unformatted: z.ZodString;
|
|
185
|
+
}, "strip", z.ZodTypeAny, {
|
|
186
|
+
formatted: string;
|
|
187
|
+
unformatted: string;
|
|
188
|
+
}, {
|
|
189
|
+
formatted: string;
|
|
190
|
+
unformatted: string;
|
|
191
|
+
}>;
|
|
192
|
+
}, "strip", z.ZodTypeAny, {
|
|
193
|
+
sha256: {
|
|
194
|
+
formatted: string;
|
|
195
|
+
unformatted: string;
|
|
196
|
+
};
|
|
197
|
+
}, {
|
|
198
|
+
sha256: {
|
|
199
|
+
formatted: string;
|
|
200
|
+
unformatted: string;
|
|
201
|
+
};
|
|
202
|
+
}>;
|
|
203
|
+
}, "strip", z.ZodTypeAny, {
|
|
204
|
+
id: string;
|
|
205
|
+
createdAt: number;
|
|
206
|
+
certificate: string;
|
|
207
|
+
active: boolean;
|
|
208
|
+
expiresAt: number;
|
|
209
|
+
fingerprints: {
|
|
210
|
+
sha256: {
|
|
211
|
+
formatted: string;
|
|
212
|
+
unformatted: string;
|
|
213
|
+
};
|
|
214
|
+
};
|
|
215
|
+
}, {
|
|
216
|
+
id: string;
|
|
217
|
+
createdAt: number;
|
|
218
|
+
certificate: string;
|
|
219
|
+
active: boolean;
|
|
220
|
+
expiresAt: number;
|
|
221
|
+
fingerprints: {
|
|
222
|
+
sha256: {
|
|
223
|
+
formatted: string;
|
|
224
|
+
unformatted: string;
|
|
225
|
+
};
|
|
226
|
+
};
|
|
227
|
+
}>;
|
|
228
|
+
export type SamlSsoConnectorSigningKeyResponse = z.infer<typeof samlSsoConnectorSigningKeyResponseGuard>;
|
|
171
229
|
export {};
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { socialUserInfoGuard } from '@logto/connector-kit';
|
|
2
2
|
import { z } from 'zod';
|
|
3
|
+
import { SamlSsoConnectorSigningKeys } from '../db-entries/saml-sso-connector-signing-key.js';
|
|
3
4
|
import { SsoConnectors } from '../db-entries/sso-connector.js';
|
|
5
|
+
import { certificateFingerprintsGuard } from './saml-application.js';
|
|
4
6
|
/**
|
|
5
7
|
* SSO Connector data type that are returned to the experience client for sign-in use.
|
|
6
8
|
*/
|
|
@@ -76,3 +78,13 @@ export var SsoAuthenticationQueryKey;
|
|
|
76
78
|
})(SsoAuthenticationQueryKey || (SsoAuthenticationQueryKey = {}));
|
|
77
79
|
// Saml assertion returned user attribute value
|
|
78
80
|
export const extendedSocialUserInfoGuard = socialUserInfoGuard.catchall(z.unknown());
|
|
81
|
+
// Make sure the `privateKey` is not exposed in the response.
|
|
82
|
+
export const samlSsoConnectorSigningKeyResponseGuard = SamlSsoConnectorSigningKeys.guard
|
|
83
|
+
.omit({
|
|
84
|
+
tenantId: true,
|
|
85
|
+
ssoConnectorId: true,
|
|
86
|
+
privateKey: true,
|
|
87
|
+
})
|
|
88
|
+
.extend({
|
|
89
|
+
fingerprints: certificateFingerprintsGuard,
|
|
90
|
+
});
|
package/lib/types/ssr.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type LocalePhrase } from '@logto/phrases-experience';
|
|
2
|
+
import { type SignInExperience } from '../db-entries/index.js';
|
|
2
3
|
import { type FullSignInExperience } from './sign-in-experience.js';
|
|
3
4
|
/**
|
|
4
5
|
* The server-side rendering data type for **experience**.
|
|
@@ -15,6 +16,16 @@ export type SsrData = {
|
|
|
15
16
|
data: LocalePhrase;
|
|
16
17
|
};
|
|
17
18
|
};
|
|
19
|
+
/**
|
|
20
|
+
* The server-side rendering data type for **account center**. Only sign-in experience color/theme
|
|
21
|
+
* data is needed for theme flash prevention.
|
|
22
|
+
*/
|
|
23
|
+
export type AccountCenterSsrSignInExperience = Pick<SignInExperience, 'color'>;
|
|
24
|
+
export type AccountCenterSsrData = {
|
|
25
|
+
signInExperience: {
|
|
26
|
+
data: AccountCenterSsrSignInExperience;
|
|
27
|
+
};
|
|
28
|
+
};
|
|
18
29
|
/**
|
|
19
30
|
* Variable placeholder for **experience** server-side rendering. The value should be replaced by
|
|
20
31
|
* the server.
|
|
@@ -7,14 +7,18 @@ export declare const userAssetsServiceStatusGuard: z.ZodObject<{
|
|
|
7
7
|
status: z.ZodUnion<[z.ZodLiteral<"ready">, z.ZodLiteral<"not_configured">]>;
|
|
8
8
|
allowUploadMimeTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["image/jpeg", "image/png", "image/gif", "image/vnd.microsoft.icon", "image/x-icon", "image/svg+xml", "image/tiff", "image/webp", "image/bmp", "application/zip"]>, "many">>;
|
|
9
9
|
maxUploadFileSize: z.ZodOptional<z.ZodNumber>;
|
|
10
|
+
/** Whether Experience avatar upload during sign-up is available on this server. */
|
|
11
|
+
isExperienceAvatarUploadEnabled: z.ZodOptional<z.ZodBoolean>;
|
|
10
12
|
}, "strip", z.ZodTypeAny, {
|
|
11
13
|
status: "ready" | "not_configured";
|
|
12
14
|
allowUploadMimeTypes?: ("image/jpeg" | "image/png" | "image/gif" | "image/vnd.microsoft.icon" | "image/x-icon" | "image/svg+xml" | "image/tiff" | "image/webp" | "image/bmp" | "application/zip")[] | undefined;
|
|
13
15
|
maxUploadFileSize?: number | undefined;
|
|
16
|
+
isExperienceAvatarUploadEnabled?: boolean | undefined;
|
|
14
17
|
}, {
|
|
15
18
|
status: "ready" | "not_configured";
|
|
16
19
|
allowUploadMimeTypes?: ("image/jpeg" | "image/png" | "image/gif" | "image/vnd.microsoft.icon" | "image/x-icon" | "image/svg+xml" | "image/tiff" | "image/webp" | "image/bmp" | "application/zip")[] | undefined;
|
|
17
20
|
maxUploadFileSize?: number | undefined;
|
|
21
|
+
isExperienceAvatarUploadEnabled?: boolean | undefined;
|
|
18
22
|
}>;
|
|
19
23
|
export type UserAssetsServiceStatus = z.infer<typeof userAssetsServiceStatusGuard>;
|
|
20
24
|
export declare const userAssetsGuard: z.ZodObject<{
|
|
@@ -45,4 +49,10 @@ type MimeTypeToFileExtensionMappings = {
|
|
|
45
49
|
[key in AllowedUploadMimeType]: readonly [string, ...string[]];
|
|
46
50
|
};
|
|
47
51
|
export declare const mimeTypeToFileExtensionMappings: MimeTypeToFileExtensionMappings;
|
|
52
|
+
/** MIME types allowed for avatar uploads (Experience, Account Center, Console). */
|
|
53
|
+
export declare const avatarMimeTypes: readonly ["image/jpeg", "image/png", "image/gif", "image/webp", "image/bmp"];
|
|
54
|
+
export type AvatarMimeType = (typeof avatarMimeTypes)[number];
|
|
55
|
+
export declare const isAvatarMimeType: (mimeType: string) => mimeType is AvatarMimeType;
|
|
56
|
+
export declare const avatarFileAccept: string;
|
|
57
|
+
export declare const avatarFileExtensionsLabel: string;
|
|
48
58
|
export {};
|
package/lib/types/user-assets.js
CHANGED
|
@@ -18,6 +18,8 @@ export const userAssetsServiceStatusGuard = z.object({
|
|
|
18
18
|
status: z.union([z.literal('ready'), z.literal('not_configured')]),
|
|
19
19
|
allowUploadMimeTypes: z.array(allowUploadMimeTypeGuard).optional(),
|
|
20
20
|
maxUploadFileSize: z.number().optional(),
|
|
21
|
+
/** Whether Experience avatar upload during sign-up is available on this server. */
|
|
22
|
+
isExperienceAvatarUploadEnabled: z.boolean().optional(),
|
|
21
23
|
});
|
|
22
24
|
export const userAssetsGuard = z.object({
|
|
23
25
|
url: z.string(),
|
|
@@ -40,3 +42,18 @@ export const mimeTypeToFileExtensionMappings = Object.freeze({
|
|
|
40
42
|
'image/bmp': ['bmp'],
|
|
41
43
|
'application/zip': ['zip'],
|
|
42
44
|
});
|
|
45
|
+
/** MIME types allowed for avatar uploads (Experience, Account Center, Console). */
|
|
46
|
+
export const avatarMimeTypes = [
|
|
47
|
+
'image/jpeg',
|
|
48
|
+
'image/png',
|
|
49
|
+
'image/gif',
|
|
50
|
+
'image/webp',
|
|
51
|
+
'image/bmp',
|
|
52
|
+
];
|
|
53
|
+
const avatarMimeTypeSet = new Set(avatarMimeTypes);
|
|
54
|
+
export const isAvatarMimeType = (mimeType) => avatarMimeTypeSet.has(mimeType);
|
|
55
|
+
export const avatarFileAccept = avatarMimeTypes.join(',');
|
|
56
|
+
const formatAvatarExtensionLabel = (extension) => extension === 'webp' ? 'WebP' : extension.toUpperCase();
|
|
57
|
+
export const avatarFileExtensionsLabel = avatarMimeTypes
|
|
58
|
+
.map((mimeType) => formatAvatarExtensionLabel(mimeTypeToFileExtensionMappings[mimeType][0]))
|
|
59
|
+
.join(', ');
|