mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-12 13:13:45 +01:00
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:
@@ -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)
|
||||
}
|
||||
|
||||
@@ -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 }
|
||||
)
|
||||
|
||||
@@ -22,4 +22,9 @@ export type LabsDetails = {
|
||||
description: string
|
||||
icon: string
|
||||
surveyLink: string
|
||||
successNotification?: {
|
||||
content?: string
|
||||
buttonLabel?: string
|
||||
buttonUrl?: string
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user