learning_ai_common_plat/packages/quick-actions/src/index.ts
Saravana Achu Mac 1ee97327ee feat(packages): create 9 NomGap-required platform packages
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
2026-03-29 22:24:02 -07:00

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;
}