mirror of
https://github.com/fluxerapp/fluxer
synced 2026-10-19 05:55:34 +09:00
feat(app): gate the expression info card behind an experiment (#2773)
This commit is contained in:
1 parent
7c9274847f
commit
6339c3b8ad
110 files changed
+12827
-5191
No files matched your search
@@ -8,6 +8,10 @@ import {
|
||||
BlockedMessageGroupsAssignmentResponse,
|
||||
INERT_BLOCKED_MESSAGE_GROUPS_ASSIGNMENT,
|
||||
} from '@fluxer/schema/src/domains/experiment/BlockedMessageGroupsSchemas';
|
||||
import {
|
||||
ExpressionInfoCardAssignmentResponse,
|
||||
INERT_EXPRESSION_INFO_CARD_ASSIGNMENT,
|
||||
} from '@fluxer/schema/src/domains/experiment/ExpressionInfoCardSchemas';
|
||||
import {
|
||||
GuildActivityLogPresentationAssignmentResponse,
|
||||
INERT_GUILD_ACTIVITY_LOG_PRESENTATION_ASSIGNMENT,
|
||||
@@ -62,6 +66,7 @@ const ExperimentAssignmentsSchema = z.object({
|
||||
message_keyboard_focus: MessageKeyboardFocusAssignmentResponse.optional(),
|
||||
blocked_message_groups: BlockedMessageGroupsAssignmentResponse.optional(),
|
||||
guild_activity_log_presentation: GuildActivityLogPresentationAssignmentResponse.optional(),
|
||||
expression_info_card: ExpressionInfoCardAssignmentResponse.optional(),
|
||||
});
|
||||
|
||||
export const ExperimentAssignmentsResponse = z.object({
|
||||
@@ -107,3 +112,9 @@ export function readGuildActivityLogPresentationAssignment(
|
||||
): GuildActivityLogPresentationAssignmentResponse {
|
||||
return response.assignments.guild_activity_log_presentation ?? INERT_GUILD_ACTIVITY_LOG_PRESENTATION_ASSIGNMENT;
|
||||
}
|
||||
|
||||
export function readExpressionInfoCardAssignment(
|
||||
response: ExperimentAssignmentsResponse,
|
||||
): ExpressionInfoCardAssignmentResponse {
|
||||
return response.assignments.expression_info_card ?? INERT_EXPRESSION_INFO_CARD_ASSIGNMENT;
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// SPDX-License-Identifier: AGPL-3.0-or-later
|
||||
|
||||
import {createClientBehaviorExperiment} from '@fluxer/schema/src/domains/experiment/ClientBehaviorExperiment';
|
||||
import type {z} from 'zod';
|
||||
|
||||
const expressionInfoCard = createClientBehaviorExperiment({defaultRolloutSalt: 'expression-info-card-v1'});
|
||||
|
||||
export const ExpressionInfoCardConfigSchema = expressionInfoCard.ConfigSchema;
|
||||
|
||||
export type ExpressionInfoCardConfig = z.infer<typeof ExpressionInfoCardConfigSchema>;
|
||||
|
||||
export const DEFAULT_EXPRESSION_INFO_CARD_CONFIG: ExpressionInfoCardConfig = expressionInfoCard.DEFAULT_CONFIG;
|
||||
|
||||
export const ExpressionInfoCardConfigUpdateRequest = expressionInfoCard.ConfigUpdateRequest;
|
||||
|
||||
export type ExpressionInfoCardConfigUpdateRequest = z.infer<typeof ExpressionInfoCardConfigUpdateRequest>;
|
||||
|
||||
export const ExpressionInfoCardConfigResponse = expressionInfoCard.ConfigSchema;
|
||||
|
||||
export type ExpressionInfoCardConfigResponse = ExpressionInfoCardConfig;
|
||||
|
||||
export const ExpressionInfoCardAssignmentResponse = expressionInfoCard.AssignmentResponse;
|
||||
|
||||
export type ExpressionInfoCardAssignmentResponse = z.infer<typeof ExpressionInfoCardAssignmentResponse>;
|
||||
|
||||
export const INERT_EXPRESSION_INFO_CARD_ASSIGNMENT: ExpressionInfoCardAssignmentResponse =
|
||||
expressionInfoCard.INERT_ASSIGNMENT;
|
||||
|
||||
export function resolveExpressionInfoCardAssignment(
|
||||
config: ExpressionInfoCardConfig,
|
||||
userId: string,
|
||||
): ExpressionInfoCardAssignmentResponse {
|
||||
return expressionInfoCard.resolveAssignment(config, userId);
|
||||
}
|
||||
Reference in new issue
Block a user