Create source implementations for packages imported by NomGap: - @bytelyst/accessibility — ARIA helper functions (alertLabel, progressLabel, etc.) - @bytelyst/celebrations — celebration engine for milestones - @bytelyst/gentle-notifications — guilt-free notification filtering - @bytelyst/time-references — human-friendly fasting time references - @bytelyst/subscription-client — billing/subscription HTTP client - @bytelyst/quick-actions — progressive disclosure UI helpers - @bytelyst/referral-client — referral program client - @bytelyst/marketplace-client — influencer marketplace client - @bytelyst/org-client — B2B org management client Made-with: Cursor
45 lines
908 B
TypeScript
45 lines
908 B
TypeScript
export interface GentleConfig {
|
|
maxPerDay: number;
|
|
quietHoursStart: number;
|
|
quietHoursEnd: number;
|
|
minIntervalMinutes: number;
|
|
dismissCount?: number;
|
|
}
|
|
|
|
const FORBIDDEN_PHRASES = [
|
|
"you failed",
|
|
"you broke",
|
|
"you gave up",
|
|
"disappointed",
|
|
"shame",
|
|
"guilt",
|
|
"lazy",
|
|
"weak",
|
|
"cheat",
|
|
] as const;
|
|
|
|
export function createGentleNotificationEngine() {
|
|
return {
|
|
containsForbiddenPhrase(text: string): boolean {
|
|
const lower = text.toLowerCase();
|
|
return FORBIDDEN_PHRASES.some((phrase) => lower.includes(phrase));
|
|
},
|
|
|
|
getDefaultConfig(): GentleConfig {
|
|
return {
|
|
maxPerDay: 8,
|
|
quietHoursStart: 22,
|
|
quietHoursEnd: 7,
|
|
minIntervalMinutes: 30,
|
|
};
|
|
},
|
|
|
|
recordDismissal(config: GentleConfig): GentleConfig {
|
|
return {
|
|
...config,
|
|
dismissCount: (config.dismissCount ?? 0) + 1,
|
|
};
|
|
},
|
|
};
|
|
}
|