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
28 lines
625 B
TypeScript
28 lines
625 B
TypeScript
export interface QuickAction {
|
|
id: string;
|
|
label: string;
|
|
icon?: string;
|
|
requiresAuth?: boolean;
|
|
priority?: number;
|
|
}
|
|
|
|
export const MAX_VISIBLE_ITEMS = 4;
|
|
export const MAX_VISIBLE_LIST = 8;
|
|
|
|
export function getAvailableActions(
|
|
actions: QuickAction[],
|
|
opts?: { isAuthenticated?: boolean },
|
|
): QuickAction[] {
|
|
const isAuthenticated = opts?.isAuthenticated ?? false;
|
|
return actions.filter(
|
|
(a) => !a.requiresAuth || isAuthenticated,
|
|
);
|
|
}
|
|
|
|
export function pickSmartDefault(defaults: QuickAction[]): QuickAction | null {
|
|
if (defaults.length === 0) {
|
|
return null;
|
|
}
|
|
return defaults[0] ?? null;
|
|
}
|