Merge pull request #34318 from overleaf/dp-labs-custom-success-notification

Add customisable success notification for Labs experiment enrollment

GitOrigin-RevId: 7d60ea3bac124909b19f8f537e1ab2b6db8d787e
This commit is contained in:
David
2026-06-09 08:06:14 +00:00
committed by Copybot
parent 38e3104edf
commit a16274409e
4 changed files with 34 additions and 0 deletions
@@ -836,6 +836,11 @@ async function _loadSplitTestInfoInLocals(locals, splitTestName, session) {
description: splitTest.labsDescription || '',
icon: splitTest.labsIcon || '',
surveyLink: splitTest.badgeInfo?.labs?.url || '',
successNotification: {
content: splitTest.labsSuccessNotification?.content || '',
buttonLabel: splitTest.labsSuccessNotification?.buttonLabel || '',
buttonUrl: splitTest.labsSuccessNotification?.buttonUrl || '',
},
isFull: SplitTestUtils.isExperimentFull(variant),
versionCreatedAt:
currentVersion.createdAt instanceof Date
@@ -131,6 +131,7 @@ async function createSplitTest(
labsTitle: labsInfo.title,
labsDescription: labsInfo.description,
labsIcon: labsInfo.icon,
labsSuccessNotification: labsInfo.successNotification,
versions: [
{
versionNumber: 1,
@@ -205,6 +206,7 @@ async function updateSplitTestInfo(name, info, labsInfo) {
splitTest.labsTitle = labsInfo.title
splitTest.labsDescription = labsInfo.description
splitTest.labsIcon = labsInfo.icon
splitTest.labsSuccessNotification = labsInfo.successNotification
}
return _saveSplitTest(splitTest)
}
+22
View File
@@ -40,6 +40,24 @@ const BadgeInfoSchema = new Schema(
{ _id: false }
)
const LabsSuccessNotificationSchema = new Schema(
{
content: {
type: String,
required: false,
},
buttonLabel: {
type: String,
required: false,
},
buttonUrl: {
type: String,
required: false,
},
},
{ _id: false }
)
const VariantSchema = new Schema(
{
name: {
@@ -187,6 +205,10 @@ export const SplitTestSchema = new Schema(
type: String,
required: false,
},
labsSuccessNotification: {
type: LabsSuccessNotificationSchema,
required: false,
},
},
{ minimize: false }
)
+5
View File
@@ -22,4 +22,9 @@ export type LabsDetails = {
description: string
icon: string
surveyLink: string
successNotification?: {
content?: string
buttonLabel?: string
buttonUrl?: string
}
}