{
  "$schema": "https://ui.shadcn.com/schema/registry-item.json",
  "name": "loyalty-pass",
  "title": "Loyalty Pass",
  "type": "registry:block",
  "files": [
    {
      "path": "packages/registry-native/blocks/loyalty-pass/LoyaltyPass.tsx",
      "content": "import type { ReactElement } from 'react'\nimport { View, type ViewProps } from 'react-native'\nimport { Button } from '@/components/ui/button'\nimport { Progress } from '@/components/ui/progress'\nimport { Spinner } from '@/components/ui/spinner'\nimport { Text } from '@/components/ui/text'\nimport { useAnnouncement } from '@/lib/accessibility'\nimport { cn } from '@/lib/utils'\n\nexport type LoyaltyPassCodeStatus = 'loading' | 'ready' | 'unavailable'\n\ninterface LoyaltyPassLabels {\n  points: string\n  pointsUnavailable: string\n  rewardAt: string\n  progress: string\n  code: string\n  codeLoading: string\n  codeUnavailable: string\n  redeem: string\n  rules: string\n}\n\nexport interface LoyaltyPassProps extends Omit<ViewProps, 'children'> {\n  className?: string\n  program: string\n  points?: number\n  rewardAt?: number\n  /** Override threshold-based availability for programs with other eligibility rules. */\n  redeemable?: boolean\n  redeeming?: boolean\n  error?: string\n  code?: string\n  codeStatus?: LoyaltyPassCodeStatus\n  /** Optional scannable member code. Mounted only while the code is ready. */\n  verification?: ReactElement\n  labels?: Partial<LoyaltyPassLabels>\n  formatPoints?: (points: number) => string\n  onRedeem?: () => void\n  onViewRules?: () => void\n}\n\nconst pointFormatter = new Intl.NumberFormat()\n\nexport function LoyaltyPass({\n  className,\n  program,\n  points,\n  rewardAt,\n  redeemable,\n  redeeming = false,\n  error,\n  code,\n  codeStatus,\n  verification,\n  labels,\n  formatPoints,\n  onRedeem,\n  onViewRules,\n  ...props\n}: LoyaltyPassProps) {\n  const balance = points != null && Number.isFinite(points) && points >= 0 ? points : undefined\n  const threshold = rewardAt != null && Number.isFinite(rewardAt) && rewardAt > 0 ? rewardAt : undefined\n  const eligible = redeemable ?? (balance !== undefined && threshold !== undefined && balance >= threshold)\n  const hasCode = Boolean(code?.trim())\n  const showCode = (codeStatus === undefined || codeStatus === 'ready') && (hasCode || Boolean(verification))\n  const format = formatPoints ?? pointFormatter.format\n  const pointsLabel = labels?.points ?? 'points'\n  useAnnouncement(error)\n\n  return (\n    <View {...props} className={cn('gap-[20px] rounded-lg border border-border bg-card p-[16px]', className)}>\n      <Text size=\"title\" accessibilityRole=\"header\" className=\"text-card-foreground\">\n        {program}\n      </Text>\n      <View className=\"gap-[8px]\">\n        {balance !== undefined ? (\n          <View className=\"flex-row flex-wrap items-baseline gap-[8px]\">\n            <Text size=\"title\" className=\"text-card-foreground\" style={{ fontVariant: ['tabular-nums'] }}>\n              {format(balance)}\n            </Text>\n            <Text variant=\"muted\">{pointsLabel}</Text>\n          </View>\n        ) : (\n          <Text variant=\"muted\">{labels?.pointsUnavailable ?? 'Point balance unavailable'}</Text>\n        )}\n        {balance !== undefined && threshold !== undefined ? (\n          <>\n            <Progress\n              accessible\n              max={threshold}\n              value={balance}\n              accessibilityLabel={labels?.progress ?? 'Reward progress'}\n            />\n            <Text\n              size=\"sm\"\n              variant=\"muted\"\n            >{`${labels?.rewardAt ?? 'Reward at'} ${format(threshold)} ${pointsLabel}`}</Text>\n          </>\n        ) : null}\n      </View>\n\n      {codeStatus !== undefined || hasCode || verification ? (\n        <View className=\"items-center gap-[8px] border-t border-border pt-[16px]\">\n          {showCode ? (\n            <>\n              {verification}\n              {hasCode ? (\n                <>\n                  <Text size=\"sm\" variant=\"muted\">\n                    {labels?.code ?? 'Member code'}\n                  </Text>\n                  <Text\n                    selectable\n                    size=\"lg\"\n                    className=\"text-center font-semibold text-card-foreground\"\n                    style={{ fontVariant: ['tabular-nums'] }}\n                  >\n                    {code}\n                  </Text>\n                </>\n              ) : null}\n            </>\n          ) : codeStatus === 'loading' ? (\n            <Spinner accessibilityLabel={labels?.codeLoading ?? 'Loading member code'} />\n          ) : (\n            <Text size=\"sm\" variant=\"muted\" className=\"text-center\">\n              {labels?.codeUnavailable ?? 'Member code unavailable'}\n            </Text>\n          )}\n        </View>\n      ) : null}\n      {error ? (\n        <Text accessibilityRole=\"alert\" size=\"sm\" className=\"text-destructive\">\n          {error}\n        </Text>\n      ) : null}\n      {onRedeem || onViewRules ? (\n        <View className=\"gap-[8px]\">\n          {onRedeem ? (\n            <Button\n              accessibilityLabel={labels?.redeem ?? 'Redeem reward'}\n              disabled={!eligible}\n              loading={redeeming}\n              onPress={() => {\n                if (eligible && !redeeming) onRedeem()\n              }}\n            >\n              {labels?.redeem ?? 'Redeem reward'}\n            </Button>\n          ) : null}\n          {onViewRules ? (\n            <Button variant=\"outline\" accessibilityLabel={labels?.rules ?? 'Program rules'} onPress={onViewRules}>\n              {labels?.rules ?? 'Program rules'}\n            </Button>\n          ) : null}\n        </View>\n      ) : null}\n    </View>\n  )\n}\n",
      "type": "registry:block",
      "target": "~/components/blocks/loyalty-pass/LoyaltyPass.tsx"
    },
    {
      "path": "packages/registry-native/blocks/loyalty-pass/index.ts",
      "content": "export { LoyaltyPass, type LoyaltyPassCodeStatus, type LoyaltyPassProps } from './LoyaltyPass'\n",
      "type": "registry:block",
      "target": "~/components/blocks/loyalty-pass/index.ts"
    }
  ],
  "dependencies": [],
  "devDependencies": [],
  "registryDependencies": [
    "https://native.uipkge.dev/r/native/accessibility.json",
    "https://native.uipkge.dev/r/native/button.json",
    "https://native.uipkge.dev/r/native/progress.json",
    "https://native.uipkge.dev/r/native/spinner.json",
    "https://native.uipkge.dev/r/native/text.json",
    "https://native.uipkge.dev/r/native/utils.json"
  ],
  "description": "Member pass with a points balance, reward progress, code availability and caller-owned reward actions.",
  "categories": [
    "commerce"
  ]
}