group: nonEmptyString()

in libs/newsletters-data-client/src/lib/schemas/legacy-newsletter-type.ts [44:86]


	group: nonEmptyString().describe(
		'the name of the section of the newsletters page the newsletter will be listed under',
	),
	description: z
		.string()
		.optional()
		.describe('a short description of the newsletter to display to users'),
	regionFocus: z
		.string()
		.optional()
		.describe('Which region (AU, UK, US, EUR) the newsletter is targetted at'),
	frequency: z
		.string()
		.optional()
		.describe('how often the newsletter is sent.'),
	listId: z.number().describe('a unique reference number for the newsletter'),
	listIdV1: z
		.number()
		.describe(
			'a legacy reference number - no longer needed, but retained on older newsletters for reference.',
		),
	emailEmbed: emailEmbedSchema.optional(),
	campaignName: z.string().optional(),
	campaignCode: z.string().optional(),
	brazeSubscribeAttributeNameAlternate: z.array(z.string()).optional(),
	signupPage: z
		.string()
		.optional()
		.describe('the relative link to the sign-up page on theguardian.com'),
	exampleUrl: z
		.string()
		.optional()
		.describe(
			'a relative link to a page on theguardian.com rendering an example chapter of the newsletter',
		),
	illustration: illustrationSchema.optional(),
});

type Base = z.infer<typeof baseLegacyNewsletterSchema>;
export const getPropertyDescription = (key: keyof Base): string =>
	baseLegacyNewsletterSchema.shape[key].description ?? '';

export const legacyNewsletterSchema = baseLegacyNewsletterSchema.extend({