Accounts 1.9.0, @crosscode/demo 1.0.0: messaging.get, WhatsApp opt-out, demo scenarios
Accounts 1.9.0 (one migration): - messaging.get (sealed settings) and the messaging.changed hint to products that asked, on admin or product changes - the WhatsApp opt-out for every product: whatsapp.optout, Accounts' own WAWP webhook, WhatsAppOptOut kept per number, whatsapp_opted_out in user.updated, no WhatsApp from Accounts to an opted-out person, "Turn WhatsApp back on" - demo scenarios: npm run demo -- --profile <scenario> --force replaces the church profile (with an SVG logo and icon at /api/demo-assets/) and the demo people, ids kept across loads @crosscode/demo 1.0.0 (new): the eight scenarios' churches, people and logos. crosscode script: crosscode demo <church> accounts, --scenario on every demo, Accounts installs and builds packages/demo. Checked on PostgreSQL 18: migrations, scenario loads, opt-out, npm run demo. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,166 @@
|
||||
import type { BrandStyle, Church, agent } from "@crosscode/contracts";
|
||||
|
||||
/**
|
||||
* Each demo scenario's church (APP-1.0-PLAN §12, "Demo scenarios"; the list is
|
||||
* `agent.DEMO_SCENARIOS` in the contracts). Loading a scenario puts this profile into Accounts, so
|
||||
* Cross Events, the Website and the App all show the same church. Every name, address and number is
|
||||
* made up: contact addresses are at example.com, social links at example.com, and there are no
|
||||
* phone numbers (nothing a demo sends can reach a real person).
|
||||
*/
|
||||
|
||||
/** The simple mark each church's logo and icon are drawn with (`./logo`). */
|
||||
export type DemoMark = "arch" | "cross" | "flame" | "wave" | "tree" | "sun" | "north" | "river";
|
||||
|
||||
/** The profile fields Accounts takes from a scenario (it fills in the rest: ids, links, logo addresses). */
|
||||
export type DemoChurchProfile = Pick<Church, "name" | "shortName" | "timezone" | "locale" | "campuses" | "serviceTimes" | "social"> & {
|
||||
colours: { primary: string; accent: string };
|
||||
style: { fontPairing: NonNullable<BrandStyle["fontPairing"]>; corners: NonNullable<BrandStyle["corners"]> };
|
||||
contact: Omit<Church["contact"], "phone" | "whatsapp">;
|
||||
};
|
||||
|
||||
export interface DemoChurch {
|
||||
scenario: agent.DemoScenarioKey;
|
||||
/** Used in demo addresses: `office.<slug>@example.com`. */
|
||||
slug: string;
|
||||
mark: DemoMark;
|
||||
profile: DemoChurchProfile;
|
||||
}
|
||||
|
||||
const ZA = "Africa/Johannesburg";
|
||||
const address = (line1: string, suburb: string | null, city: string, province: string, postalCode: string) =>
|
||||
({ line1, line2: null, suburb, city, province, postalCode, country: "ZA", geo: null });
|
||||
const social = (slug: string, networks: ("facebook" | "instagram" | "youtube" | "spotify")[]) =>
|
||||
networks.map((network) => ({ network, url: `https://example.com/${network}/${slug}` }));
|
||||
const contact = (slug: string, addr: ReturnType<typeof address>) => ({ email: `office.${slug}@example.com`, address: addr });
|
||||
|
||||
export const DEMO_CHURCHES: readonly DemoChurch[] = [
|
||||
{
|
||||
scenario: "heritage-parish", slug: "stcolumbas", mark: "arch",
|
||||
profile: {
|
||||
name: "St Columba's Church", shortName: "St Columba's", timezone: ZA, locale: "en-ZA",
|
||||
colours: { primary: "#5b2333", accent: "#c9a227" }, style: { fontPairing: "classic", corners: "sharp" },
|
||||
campuses: [],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "09:00", label: "Sung Eucharist", campus: null, note: "Sunday school in the hall during the service" },
|
||||
{ day: "wednesday", time: "10:00", label: "Midweek communion", campus: null, note: null },
|
||||
],
|
||||
contact: contact("stcolumbas", address("3 Glebe Lane", "Old Town", "Grahamstown", "Eastern Cape", "6139")),
|
||||
social: social("stcolumbas", ["facebook"]),
|
||||
},
|
||||
},
|
||||
{
|
||||
scenario: "heritage-city", slug: "gracecathedral", mark: "cross",
|
||||
profile: {
|
||||
name: "Grace Cathedral", shortName: "Grace", timezone: ZA, locale: "en-ZA",
|
||||
colours: { primary: "#1d3557", accent: "#e09f3e" }, style: { fontPairing: "editorial", corners: "sharp" },
|
||||
campuses: [],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "07:30", label: "Early communion", campus: null, note: null },
|
||||
{ day: "sunday", time: "09:30", label: "Cathedral Eucharist", campus: null, note: "Choir and children's church" },
|
||||
{ day: "sunday", time: "18:00", label: "Choral evensong", campus: null, note: null },
|
||||
{ day: "wednesday", time: "12:30", label: "Lunchtime prayer", campus: null, note: "Thirty minutes, then soup in the crypt" },
|
||||
],
|
||||
contact: contact("gracecathedral", address("1 Cathedral Square", "City Centre", "Cape Town", "Western Cape", "8001")),
|
||||
social: social("gracecathedral", ["facebook", "youtube", "spotify"]),
|
||||
},
|
||||
},
|
||||
{
|
||||
scenario: "bold-youth", slug: "ignite", mark: "flame",
|
||||
profile: {
|
||||
name: "Ignite Church", shortName: "Ignite", timezone: ZA, locale: "en-ZA",
|
||||
colours: { primary: "#e4572e", accent: "#17bebb" }, style: { fontPairing: "impact", corners: "round" },
|
||||
campuses: [],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "10:00", label: "Sunday gathering", campus: null, note: "Kids zone for ages 3 to 11" },
|
||||
{ day: "sunday", time: "17:30", label: "Ignite Night", campus: null, note: "Worship night for students and young adults" },
|
||||
{ day: "friday", time: "19:00", label: "Youth", campus: null, note: "Grades 8 to 12" },
|
||||
],
|
||||
contact: contact("ignite", address("48 Factory Road", "Maboneng", "Johannesburg", "Gauteng", "2094")),
|
||||
social: social("ignite", ["instagram", "youtube", "spotify"]),
|
||||
},
|
||||
},
|
||||
{
|
||||
scenario: "bold-plant", slug: "harbourcity", mark: "wave",
|
||||
profile: {
|
||||
name: "Harbour City Church", shortName: "Harbour City", timezone: ZA, locale: "en-ZA",
|
||||
colours: { primary: "#0b6e99", accent: "#f4b942" }, style: { fontPairing: "contemporary", corners: "round" },
|
||||
campuses: [],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "09:30", label: "Sunday service", campus: null, note: "In the hall of Seaview Primary School" },
|
||||
],
|
||||
contact: contact("harbourcity", address("Seaview Primary School, 12 Marine Drive", "Humewood", "Gqeberha", "Eastern Cape", "6001")),
|
||||
social: social("harbourcity", ["instagram", "facebook"]),
|
||||
},
|
||||
},
|
||||
{
|
||||
scenario: "community-family", slug: "acaciahill", mark: "tree",
|
||||
profile: {
|
||||
name: "Acacia Hill Church", shortName: "Acacia Hill", timezone: ZA, locale: "en-ZA",
|
||||
colours: { primary: "#2f6f4f", accent: "#e9a23b" }, style: { fontPairing: "warm", corners: "soft" },
|
||||
campuses: [],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "08:30", label: "Early service", campus: null, note: null },
|
||||
{ day: "sunday", time: "10:30", label: "Family service", campus: null, note: "Kids' church for ages 2 to 12" },
|
||||
{ day: "wednesday", time: "18:30", label: "Prayer evening", campus: null, note: null },
|
||||
],
|
||||
contact: contact("acaciahill", address("27 Acacia Avenue", "Lynnwood", "Pretoria", "Gauteng", "0081")),
|
||||
social: social("acaciahill", ["facebook", "instagram", "youtube"]),
|
||||
},
|
||||
},
|
||||
{
|
||||
scenario: "community-town", slug: "karoo", mark: "sun",
|
||||
profile: {
|
||||
name: "Karoo Gemeenskapskerk", shortName: "Karoo Kerk", timezone: ZA, locale: "af-ZA",
|
||||
colours: { primary: "#9c4a1a", accent: "#d9b44a" }, style: { fontPairing: "friendly", corners: "soft" },
|
||||
campuses: [],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "09:00", label: "Erediens", campus: null, note: "Kinderkerk tydens die diens" },
|
||||
{ day: "sunday", time: "18:00", label: "Aanddiens (English)", campus: null, note: null },
|
||||
{ day: "wednesday", time: "19:00", label: "Bidstond", campus: null, note: null },
|
||||
],
|
||||
contact: contact("karoo", address("14 Kerkstraat", null, "Graaff-Reinet", "Eastern Cape", "6280")),
|
||||
social: social("karoo", ["facebook"]),
|
||||
},
|
||||
},
|
||||
{
|
||||
scenario: "clean-modern", slug: "northpoint", mark: "north",
|
||||
profile: {
|
||||
name: "Northpoint Church", shortName: "Northpoint", timezone: ZA, locale: "en-ZA",
|
||||
colours: { primary: "#22313f", accent: "#3fb68b" }, style: { fontPairing: "modern", corners: "soft" },
|
||||
campuses: [],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "08:30", label: "First service", campus: null, note: null },
|
||||
{ day: "sunday", time: "10:30", label: "Second service", campus: null, note: "Kids and youth during the service" },
|
||||
{ day: "sunday", time: "18:00", label: "Evening service", campus: null, note: null },
|
||||
],
|
||||
contact: contact("northpoint", address("200 Northpoint Boulevard", "Umhlanga Ridge", "Durban", "KwaZulu-Natal", "4319")),
|
||||
social: social("northpoint", ["facebook", "instagram", "youtube", "spotify"]),
|
||||
},
|
||||
},
|
||||
{
|
||||
scenario: "clean-campus", slug: "riverside", mark: "river",
|
||||
profile: {
|
||||
name: "Riverside Church", shortName: "Riverside", timezone: ZA, locale: "en-ZA",
|
||||
colours: { primary: "#264653", accent: "#2a9d8f" }, style: { fontPairing: "modern", corners: "sharp" },
|
||||
campuses: [
|
||||
{ slug: "stellenbosch", name: "Stellenbosch", address: address("5 Riverbank Road", "Die Boord", "Stellenbosch", "Western Cape", "7600") },
|
||||
{ slug: "paarl", name: "Paarl", address: address("88 Main Road", "Paarl Central", "Paarl", "Western Cape", "7646") },
|
||||
{ slug: "somerset-west", name: "Somerset West", address: address("12 Lourens Street", null, "Somerset West", "Western Cape", "7130") },
|
||||
],
|
||||
serviceTimes: [
|
||||
{ day: "sunday", time: "09:00", label: "Morning service", campus: "stellenbosch", note: null },
|
||||
{ day: "sunday", time: "18:30", label: "Students' service", campus: "stellenbosch", note: "Supper afterwards in the courtyard" },
|
||||
{ day: "sunday", time: "09:30", label: "Morning service", campus: "paarl", note: "Kids' church during the service" },
|
||||
{ day: "sunday", time: "10:00", label: "Morning service", campus: "somerset-west", note: null },
|
||||
],
|
||||
contact: contact("riverside", address("5 Riverbank Road", "Die Boord", "Stellenbosch", "Western Cape", "7600")),
|
||||
social: social("riverside", ["instagram", "youtube"]),
|
||||
},
|
||||
},
|
||||
];
|
||||
|
||||
export function demoChurch(scenario: agent.DemoScenarioKey): DemoChurch {
|
||||
const c = DEMO_CHURCHES.find((x) => x.scenario === scenario);
|
||||
if (!c) throw new Error(`No demo church for ${scenario}`);
|
||||
return c;
|
||||
}
|
||||
Reference in New Issue
Block a user