/**
* NAM-1450: accessibility props for the paywall image element (WCAG 1.1.1).
*
* A non-blank `alt` on the template's image component opts the image into screen
* reader exposure: accessible element, image role, label = alt (raw — no smart-text,
* matching the Web SDK's `
` handling). Anything else keeps RN's default
* `accessible={false}`, i.e. the image stays decorative.
*
* RN-free module so the jest node environment can unit-test it (see
* tests/components/elements/textInputStyle.test.ts for the pattern).
*/
export const getImageAccessibilityProps = (
component: unknown,
): { accessible: true; accessibilityRole: 'image'; accessibilityLabel: string } | Record => {
const alt = (component as { alt?: unknown } | null | undefined)?.alt;
const trimmed = typeof alt === 'string' ? alt.trim() : '';
if (!trimmed) return {};
return { accessible: true, accessibilityRole: 'image', accessibilityLabel: trimmed };
};