@fluid-app/portal-sdk 0.1.321 → 0.1.322

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (23) hide show
  1. package/dist/{AddressAutocompleteInput-PJBI9E5E.mjs → AddressAutocompleteInput-BpbBARKk.mjs} +4 -1
  2. package/dist/AddressAutocompleteInput-BpbBARKk.mjs.map +1 -0
  3. package/dist/{AddressAutocompleteInput-CQLCLiwR.cjs → AddressAutocompleteInput-DkFs_leA.cjs} +4 -1
  4. package/dist/AddressAutocompleteInput-DkFs_leA.cjs.map +1 -0
  5. package/dist/{ProfileScreen-DyLQihOW.cjs → ProfileScreen-C3zOvEhX.cjs} +90 -2
  6. package/dist/ProfileScreen-C3zOvEhX.cjs.map +1 -0
  7. package/dist/{ProfileScreen-C7scpZZH.mjs → ProfileScreen-Chk8YkMW.mjs} +91 -3
  8. package/dist/ProfileScreen-Chk8YkMW.mjs.map +1 -0
  9. package/dist/{ProfileScreen-C9aqx1sO.cjs → ProfileScreen-CxOJ1D3H.cjs} +2 -2
  10. package/dist/{ProfileScreen-imlOJIjC.mjs → ProfileScreen-DZFMc4E9.mjs} +2 -2
  11. package/dist/{SubscriptionsScreen-BP-sSa__.mjs → SubscriptionsScreen-8cPR9vpX.mjs} +2 -2
  12. package/dist/{SubscriptionsScreen-B3kKkAuA.cjs → SubscriptionsScreen-93eTwtFE.cjs} +2 -2
  13. package/dist/{SubscriptionsScreen-D0BtuCfM.cjs → SubscriptionsScreen-CyL91O4w.cjs} +2 -2
  14. package/dist/{SubscriptionsScreen-D0BtuCfM.cjs.map → SubscriptionsScreen-CyL91O4w.cjs.map} +1 -1
  15. package/dist/{SubscriptionsScreen-CQ3L8wDE.mjs → SubscriptionsScreen-u_q5j115.mjs} +2 -2
  16. package/dist/{SubscriptionsScreen-CQ3L8wDE.mjs.map → SubscriptionsScreen-u_q5j115.mjs.map} +1 -1
  17. package/dist/index.cjs +7 -7
  18. package/dist/index.mjs +7 -7
  19. package/package.json +13 -13
  20. package/dist/AddressAutocompleteInput-CQLCLiwR.cjs.map +0 -1
  21. package/dist/AddressAutocompleteInput-PJBI9E5E.mjs.map +0 -1
  22. package/dist/ProfileScreen-C7scpZZH.mjs.map +0 -1
  23. package/dist/ProfileScreen-DyLQihOW.cjs.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"AddressAutocompleteInput-PJBI9E5E.mjs","names":["FormTextField","FormTextField","FormTextField"],"sources":["../../../profile/core/src/translation-api-context.ts","../../../profile/core/src/translation-dictionary.ts","../../../profile/core/src/translation-adapter.ts","../src/providers/ProfileTranslationBridge.tsx","../../../profile/ui/src/components/ellipses-dropdown.tsx","../../../profile/ui/src/components/confirm-action-dialog.tsx","../../../profile/ui/src/components/form-fields.tsx","../../../profile/ui/src/components/user-info-dialog.tsx","../../../profile/ui/src/components/payment-method-card-internals.tsx","../../../profile/core/src/context.ts","../../../fluid-pay/core/src/context.ts","../../../fluid-pay/core/src/provider.tsx","../../../fluid-pay/core/src/utils/country-config.ts","../../../fluid-pay/core/src/hooks/use-country-states.ts","../../../profile/ui/src/components/edit-payment-method-dialog.tsx","../../../profile/ui/src/components/my-site-profile-section.tsx","../../../fluid-pay/ui/src/components/form-fields/FormTextField.tsx","../../../fluid-pay/ui/src/components/form-fields/FormComboboxField.tsx","../../../fluid-pay/ui/src/components/AddressFormDialog.tsx","../../../fluid-pay/ui/src/hooks/use-vgs-collect.ts","../../../fluid-pay/ui/src/components/CreditCardFormDialog.tsx","../src/adapters/fluid-pay-api-adapter.ts","../../../platform/address-autocomplete/src/components/AddressAutocompleteInput.tsx"],"sourcesContent":["import type { Provider } from \"react\";\nimport { createTranslationContext } from \"@fluid-app/i18n/translation-api-context-factory\";\nimport type { TranslationApi } from \"@fluid-app/i18n/translation-api\";\nimport type { ProfileDict } from \"./translation-dictionary\";\n\nconst { Provider: ProfileProvider, useTranslation } =\n createTranslationContext<ProfileDict>(\"Profile\");\n\nexport const ProfileTranslationProvider: Provider<TranslationApi<ProfileDict> | null> =\n ProfileProvider;\nexport const useProfileTranslation = useTranslation;\n","export const profileEn = {\n breadcrumb: \"Profile\",\n edit_profile: \"Edit Profile\",\n first_name: \"First Name\",\n last_name: \"Last Name\",\n phone_number: \"Phone Number\",\n bio: \"Bio\",\n add_a_short_bio: \"Add a short bio\",\n language: \"Language\",\n first_name_is_required: \"First name is required\",\n last_name_is_required: \"Last name is required\",\n language_is_required: \"Language is required\",\n saving: \"Saving...\",\n save_changes: \"Save Changes\",\n select_an_option: \"Select an option\",\n points_history: \"Points History\",\n points_available: \"Points Available\",\n points_awarded: \"Points Awarded\",\n points_redeemed: \"Points Redeemed\",\n transaction: \"Transaction\",\n no_points_history_found: \"No points history found\",\n email: \"Email\",\n shipping_addresses: \"Shipping Addresses\",\n add_an_address: \"Add an Address\",\n delete_address: \"Delete Address\",\n delete_address_message:\n \"Are you sure you want to delete this address? This action cannot be undone.\",\n delete: \"Delete\",\n no_saved_addresses_found: \"No saved addresses found\",\n add_address: \"Add Address\",\n edit_address: \"Edit Address\",\n set_as_default_address: \"Set as default address\",\n save_address: \"Save Address\",\n card_number: \"Card Number\",\n expiration_date: \"Expiration (MM / YY)\",\n cvc: \"CVC\",\n cardholder_name: \"Cardholder Name\",\n add_credit_card: \"Add Credit Card\",\n save_card: \"Save Card\",\n securing: \"Loading secure form...\",\n payment_methods: \"Payment Methods\",\n add_payment_method: \"Add Payment Method\",\n delete_credit_card: \"Delete Credit Card\",\n delete_credit_card_message:\n \"Are you sure you want to delete this payment method? This action cannot be undone.\",\n delete_card: \"Delete card\",\n deleting: \"Deleting...\",\n tap_to_confirm: \"Tap to confirm\",\n edit_card: \"Card Details\",\n billing_address: \"Billing Address\",\n country: \"Country\",\n name: \"Name\",\n address_line_1: \"Address Line 1\",\n address_line_2: \"Apartment, suite, etc.\",\n city: \"City\",\n state: \"State\",\n province: \"Province\",\n zip_code: \"Zip Code\",\n postal_code: \"Postal Code\",\n select_state: \"Select state\",\n set_as_default_payment_method: \"Set as default payment method\",\n same_as_shipping: \"Same as shipping address\",\n use_a_different_address: \"Use a different address\",\n add_billing_address: \"Add billing address\",\n cancel: \"Cancel\",\n save: \"Save\",\n close: \"Close\",\n edit: \"Edit\",\n default: \"Default\",\n card_expires: \"Expires\",\n no_billing_address: \"No billing address on file\",\n default_payment_method_updated: \"Payment method updated\",\n failed_to_set_default_payment_method: \"Failed to update payment method\",\n personal_information: \"Personal information\",\n phone: \"Phone\",\n add_phone_number: \"Add phone number\",\n pts_available: \"{{count}} pts available\",\n see_all_transactions: \"See all {{count}} transactions\",\n no_points_yet: \"No points yet\",\n earn_points_hint: \"Earn points on every order to unlock rewards.\",\n your_mysite_link: \"Your MySite link\",\n edit_link: \"Edit link\",\n public_link: \"Public link\",\n set_your_mysite_link: \"Set your MySite link\",\n copy: \"Copy\",\n cardholder: \"Cardholder\",\n accepted_cards: \"Visa, Mastercard, Amex\",\n address: \"Address\",\n social_media: \"Social media\",\n connected_count: \"{{count}} connected\",\n connect: \"Connect\",\n sign_out: \"Sign out\",\n sign_out_description: \"You can sign back in any time\",\n profile_updated: \"Profile updated\",\n failed_to_update_profile: \"Failed to update profile\",\n failed_to_delete_payment_method: \"Failed to delete payment method\",\n failed_to_update_payment_method: \"Failed to update payment method\",\n address_created: \"Address created\",\n failed_to_create_address: \"Failed to create address\",\n address_updated: \"Address updated\",\n failed_to_update_address: \"Failed to update address\",\n address_deleted: \"Address deleted\",\n failed_to_delete_address: \"Failed to delete address\",\n payment_method_added: \"Payment method added\",\n failed_to_add_payment_method: \"Failed to add payment method\",\n mysite_link_copied: \"MySite link copied\",\n failed_to_copy_link: \"Failed to copy link\",\n platform_not_editable: \"This platform isn't editable yet\",\n social_link_updated: \"Social link updated\",\n failed_to_update_social_link: \"Failed to update social link\",\n edit_social_link: \"Edit social link\",\n edit_platform_link: \"Edit {{platform}} link\",\n url: \"URL\",\n make_default: \"Make Default\",\n please_enter_new_email: \"Please enter a new email address\",\n please_enter_valid_email: \"Please enter a valid email address\",\n new_email_must_be_different:\n \"New email must be different from your current email\",\n failed_to_initiate_email_change: \"Failed to initiate email change\",\n sending: \"Sending...\",\n send_verification: \"Send verification\",\n name_is_required: \"Name is required\",\n address_line_1_is_required: \"Address line 1 is required\",\n city_is_required: \"City is required\",\n state_is_required: \"State is required\",\n zip_code_is_required: \"Zip code is required\",\n country_is_required: \"Country is required\",\n about_me: \"About Me\",\n profile_image_alt: \"Profile\",\n social_media_links: \"Social Media Links\",\n whatsapp_placeholder: \"Phone number or link\",\n wechat_placeholder: \"WeChat ID\",\n bio_placeholder: \"Tell people a little about yourself...\",\n unable_to_load_account:\n \"Unable to load account data. Please try again later.\",\n account_fallback: \"Account\",\n pts: \"pts\",\n change: \"Change\",\n personal_information_title: \"Personal Information\",\n error_updating_profile:\n \"Error updating profile. Please verify your information and try again.\",\n payment_method_deleted: \"Payment method deleted\",\n default_address_updated: \"Default address updated\",\n failed_to_update_default_address: \"Failed to update default address\",\n unable_to_delete_payment_method:\n \"We were unable to delete this payment method. Please try again.\",\n unable_to_delete_address:\n \"We were unable to delete this address. Please try again.\",\n add_a_payment_method: \"+ Add a payment method\",\n payment_method_alt: \"Payment Method\",\n add_an_address_action: \"+ Add an address\",\n add_payment_method_action: \"+ Add Payment Method\",\n shipping_address_updated: \"Shipping address updated\",\n failed_to_update_shipping_address: \"Failed to update shipping address\",\n email_change_pending: \"Email change pending\",\n email_being_changed_to: \"Your email is being changed to\",\n new_email_verified: \"Your new email has been verified.\",\n check_new_inbox_verification:\n \"Check your new inbox and click the verification link to complete the change.\",\n request_expired: \"This request has expired.\",\n request_expires_in_one_day: \"This request expires in 1 day.\",\n request_expires_in_days: \"This request expires in {{days}} days.\",\n cancel_change: \"Cancel change\",\n card_fallback: \"Card\",\n enter_new_email_placeholder: \"Enter your new email...\",\n email_verification_hint:\n \"We'll send a verification link to your new email. Click it to complete the change.\",\n changing_email_to: \"Changing to\",\n check_new_email_verification:\n \"Check your new email inbox and click the verification link to complete the change.\",\n unexpected_error: \"An unexpected error occurred. Please try again.\",\n} as const satisfies Record<string, string>;\n\nexport type ProfileDict = typeof profileEn;\n","import {\n createDomainTranslations,\n type DomainTranslations,\n} from \"@fluid-app/i18n/translations\";\nimport { createStaticDictAdapter } from \"@fluid-app/i18n/static-dict-adapter\";\nimport type { TranslationApi } from \"@fluid-app/i18n/translation-api\";\nimport { profileEn, type ProfileDict } from \"./translation-dictionary\";\n\nexport const profileDomain: DomainTranslations<ProfileDict> =\n createDomainTranslations<ProfileDict>({\n fallback: profileEn,\n loaders: {\n de: () =>\n import(\"./locale/de.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n el: () =>\n import(\"./locale/el.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n es: () =>\n import(\"./locale/es.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n fr: () =>\n import(\"./locale/fr.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n he: () =>\n import(\"./locale/he.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n hu: () =>\n import(\"./locale/hu.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n id: () =>\n import(\"./locale/id.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n it: () =>\n import(\"./locale/it.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n ja: () =>\n import(\"./locale/ja.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n ko: () =>\n import(\"./locale/ko.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n nl: () =>\n import(\"./locale/nl.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n pl: () =>\n import(\"./locale/pl.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n pt: () =>\n import(\"./locale/pt.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n ro: () =>\n import(\"./locale/ro.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n ru: () =>\n import(\"./locale/ru.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n th: () =>\n import(\"./locale/th.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n tl: () =>\n import(\"./locale/tl.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n tr: () =>\n import(\"./locale/tr.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n zh_CN: () =>\n import(\"./locale/zh_CN.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n zh_TW: () =>\n import(\"./locale/zh_TW.json\").then(\n (m): ProfileDict => m.default as ProfileDict,\n ),\n },\n });\n\nexport function createProfileTranslationAdapter(\n locale: string,\n dict: ProfileDict,\n): TranslationApi<ProfileDict> {\n return createStaticDictAdapter(locale, dict);\n}\n","import { useMemo, type ReactNode } from \"react\";\nimport { useActiveLocale } from \"@fluid-app/i18n/locale-context\";\nimport { useDomainDict } from \"@fluid-app/i18n/use-domain-dict\";\nimport {\n profileDomain,\n createProfileTranslationAdapter,\n} from \"@fluid-app/profile-core/translation-adapter\";\nimport { ProfileTranslationProvider } from \"@fluid-app/profile-core/translation-api-context\";\n\nexport function ProfileTranslationBridge({\n children,\n}: {\n children: ReactNode;\n}): React.JSX.Element {\n const { locale } = useActiveLocale();\n const dict = useDomainDict(profileDomain, locale);\n const api = useMemo(\n () => createProfileTranslationAdapter(locale, dict),\n [locale, dict],\n );\n return (\n <ProfileTranslationProvider value={api}>\n {children}\n </ProfileTranslationProvider>\n );\n}\n","import type { JSX } from \"react\";\nimport {\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n Button,\n} from \"@fluid-app/ui-primitives\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\n\nexport default function EllipsesDropdown({\n onDelete,\n onEdit,\n onMakeDefault,\n editLabel,\n deleteLabel,\n makeDefaultLabel,\n disabled = false,\n}: {\n onDelete?: () => void;\n onEdit?: () => void;\n onMakeDefault?: () => void;\n editLabel?: string;\n deleteLabel?: string;\n makeDefaultLabel?: string;\n disabled?: boolean;\n}): JSX.Element {\n const { t } = useProfileTranslation();\n const resolvedEditLabel = editLabel ?? t(\"edit\");\n const resolvedDeleteLabel = deleteLabel ?? t(\"delete\");\n const resolvedMakeDefaultLabel = makeDefaultLabel ?? t(\"make_default\");\n if (disabled) {\n return (\n <Button variant=\"ghost\" disabled>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 128 512\"\n className=\"fill-muted-foreground h-4 w-1\"\n >\n <path d=\"M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z\" />\n </svg>\n </Button>\n );\n }\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <Button variant=\"ghost\">\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 128 512\"\n className=\"fill-muted-foreground h-4 w-1\"\n >\n <path d=\"M64 360a56 56 0 1 0 0 112 56 56 0 1 0 0-112zm0-160a56 56 0 1 0 0 112 56 56 0 1 0 0-112zM120 96A56 56 0 1 0 8 96a56 56 0 1 0 112 0z\" />\n </svg>\n </Button>\n </DropdownMenuTrigger>\n <DropdownMenuContent className=\"text-foreground min-w-28 space-y-1 text-sm\">\n {onEdit && (\n <>\n <DropdownMenuItem\n className=\"hover:bg-muted flex cursor-pointer flex-row items-center gap-x-2 rounded px-2\"\n onClick={(e) => {\n e.stopPropagation();\n onEdit();\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className=\"h-3.5 w-3.5 flex-shrink-0\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"m16.862 4.487 1.687-1.688a1.875 1.875 0 1 1 2.652 2.652L10.582 16.07a4.5 4.5 0 0 1-1.897 1.13L6 18l.8-2.685a4.5 4.5 0 0 1 1.13-1.897l8.932-8.931Zm0 0L19.5 7.125M18 14v4.75A2.25 2.25 0 0 1 15.75 21H5.25A2.25 2.25 0 0 1 3 18.75V8.25A2.25 2.25 0 0 1 5.25 6H10\"\n />\n </svg>\n <span>{resolvedEditLabel}</span>\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n </>\n )}\n {onMakeDefault && (\n <>\n <DropdownMenuItem\n className=\"hover:bg-muted flex cursor-pointer flex-row items-center gap-x-2 rounded px-2\"\n onClick={(e) => {\n e.stopPropagation();\n onMakeDefault();\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className=\"h-3.5 w-3.5 flex-shrink-0\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"m4.5 12.75 6 6 9-13.5\"\n />\n </svg>\n <span>{resolvedMakeDefaultLabel}</span>\n </DropdownMenuItem>\n <DropdownMenuSeparator />\n </>\n )}\n <DropdownMenuItem\n className=\"text-destructive hover:bg-destructive/10 flex cursor-pointer flex-row items-center gap-x-2 rounded px-2\"\n onClick={(e) => {\n e.stopPropagation();\n onDelete?.();\n }}\n >\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n fill=\"none\"\n viewBox=\"0 0 24 24\"\n strokeWidth={1.5}\n stroke=\"currentColor\"\n className=\"h-3.5 w-3.5 flex-shrink-0\"\n >\n <path\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n d=\"m14.74 9-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 0 1-2.244 2.077H8.084a2.25 2.25 0 0 1-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 0 0-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 0 1 3.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 0 0-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 0 0-7.5 0\"\n />\n </svg>\n <span>{resolvedDeleteLabel}</span>\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n","import type { JSX } from \"react\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogFooter,\n DialogClose,\n Button,\n} from \"@fluid-app/ui-primitives\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\n\ntype ConfirmActionDialogProps = {\n title: string;\n description: string;\n onAction: () => void;\n openDialog: boolean;\n setOpenDialog: (open: boolean) => void;\n errorMsg?: string;\n isLoading?: boolean;\n actionText?: string;\n};\n\nexport default function ConfirmActionDialog({\n title,\n description,\n onAction,\n openDialog,\n setOpenDialog,\n errorMsg,\n isLoading,\n actionText,\n}: ConfirmActionDialogProps): JSX.Element {\n const { t } = useProfileTranslation();\n const resolvedActionText = actionText ?? t(\"delete\");\n\n return (\n <Dialog open={openDialog} onOpenChange={setOpenDialog}>\n <DialogContent className=\"max-w-sm md:w-90\">\n <DialogHeader className=\"flex flex-row justify-between\">\n <DialogTitle className=\"w-full text-left\">{title}</DialogTitle>\n </DialogHeader>\n\n <div className=\"space-y-4\">\n <p className=\"text-muted-foreground text-left text-sm\">\n {description}\n </p>\n </div>\n\n {errorMsg && <p className=\"text-destructive text-sm\">{errorMsg}</p>}\n\n <DialogFooter>\n <div className=\"flex w-full flex-row justify-between space-x-2\">\n <DialogClose asChild>\n <Button\n variant=\"secondary\"\n className=\"min-w-[70px]\"\n onClick={() => setOpenDialog(false)}\n >\n {t(\"cancel\")}\n </Button>\n </DialogClose>\n <Button\n type=\"button\"\n variant=\"destructive\"\n className=\"min-w-[70px]\"\n onClick={onAction}\n disabled={isLoading}\n >\n {isLoading ? (\n <div className=\"border-primary-foreground h-5 w-5 animate-spin rounded-full border-4 border-t-4 border-t-transparent\" />\n ) : (\n resolvedActionText\n )}\n </Button>\n </div>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n","import {\n useController,\n type Control,\n type FieldPath,\n type FieldValues,\n} from \"react-hook-form\";\nimport {\n Input,\n Label,\n Select,\n SelectTrigger,\n SelectContent,\n SelectItem,\n SelectValue,\n Textarea,\n cn,\n} from \"@fluid-app/ui-primitives\";\n\nexport type NameValue = { name: string; value: string | number };\n\nexport function FormTextField<T extends FieldValues>({\n control,\n name,\n label,\n containerClassName,\n ...props\n}: {\n control: Control<T>;\n name: FieldPath<T>;\n label?: string;\n containerClassName?: string;\n} & Omit<React.ComponentProps<\"input\">, \"name\">) {\n const {\n field,\n fieldState: { error },\n } = useController({ name, control });\n return (\n <div className={cn(\"space-y-1\", containerClassName)}>\n {label && (\n <Label htmlFor={name} className=\"mb-1.5 block text-sm font-medium\">\n {label}\n </Label>\n )}\n <Input\n {...field}\n {...props}\n id={name}\n value={field.value ?? \"\"}\n className={cn(error && \"ring-destructive ring-1\", props.className)}\n />\n {error && <p className=\"text-destructive text-sm\">{error.message}</p>}\n </div>\n );\n}\n\nexport function FormTextareaField<T extends FieldValues>({\n control,\n name,\n label,\n containerClassName,\n ...props\n}: {\n control: Control<T>;\n name: FieldPath<T>;\n label?: string;\n containerClassName?: string;\n} & Omit<React.ComponentProps<\"textarea\">, \"name\">) {\n const {\n field,\n fieldState: { error },\n } = useController({ name, control });\n return (\n <div className={cn(\"space-y-1\", containerClassName)}>\n {label && (\n <Label htmlFor={name} className=\"mb-1.5 block text-sm font-medium\">\n {label}\n </Label>\n )}\n <Textarea\n {...field}\n {...props}\n id={name}\n value={field.value ?? \"\"}\n className={cn(error && \"ring-destructive ring-1\", props.className)}\n />\n {error && <p className=\"text-destructive text-sm\">{error.message}</p>}\n </div>\n );\n}\n\nexport function FormSelectField<T extends FieldValues>({\n control,\n name,\n label,\n options,\n placeholder,\n containerClassName,\n onChange,\n}: {\n control: Control<T>;\n name: FieldPath<T>;\n label?: string;\n options?: NameValue[];\n placeholder?: string;\n containerClassName?: string;\n onChange?: (value: string) => void;\n}) {\n const {\n field,\n fieldState: { error },\n } = useController({ name, control });\n return (\n <div className={cn(\"space-y-1\", containerClassName)}>\n {label && (\n <Label htmlFor={name} className=\"block text-sm font-medium\">\n {label}\n </Label>\n )}\n <Select\n value={field.value?.toString() ?? \"\"}\n onValueChange={(val) => {\n field.onChange(val);\n onChange?.(val);\n }}\n >\n <SelectTrigger\n id={name}\n className={cn(\"w-full\", error && \"ring-destructive ring-1\")}\n >\n <SelectValue placeholder={placeholder} />\n </SelectTrigger>\n <SelectContent>\n {options?.map((opt) => (\n <SelectItem\n key={`${opt.name}-${opt.value}`}\n value={opt.value.toString()}\n >\n {opt.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n {error && <p className=\"text-destructive text-sm\">{error.message}</p>}\n </div>\n );\n}\n","import { useState, type JSX } from \"react\";\nimport type { Control } from \"react-hook-form\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogFooter,\n Button,\n Input,\n} from \"@fluid-app/ui-primitives\";\nimport { Info } from \"lucide-react\";\nimport {\n FormTextField,\n FormTextareaField,\n FormSelectField,\n type NameValue,\n} from \"./form-fields\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\n\nexport type UserFormData = {\n first_name: string;\n last_name: string;\n phone_number?: string;\n language: string;\n bio?: string;\n};\n\nexport default function UserInfoDialog({\n control,\n isOpen,\n onSubmit,\n handleClose,\n languageOptions,\n errorMsg,\n isSubmitting,\n email,\n onChangeEmail,\n isChangingEmail,\n pendingEmail,\n}: {\n control: Control<UserFormData>;\n isOpen: boolean;\n onSubmit: () => void;\n handleClose: () => void;\n languageOptions?: NameValue[];\n errorMsg: string | undefined;\n isSubmitting: boolean;\n email?: string;\n onChangeEmail?: (newEmail: string) => Promise<void> | void;\n isChangingEmail?: boolean;\n pendingEmail?: string;\n}): JSX.Element {\n const { t } = useProfileTranslation();\n const [isEditingEmail, setIsEditingEmail] = useState(false);\n const [newEmail, setNewEmail] = useState(\"\");\n const [emailError, setEmailError] = useState<string | undefined>(undefined);\n\n const handleEmailSubmit = async () => {\n setEmailError(undefined);\n const trimmed = newEmail.trim();\n if (!trimmed) {\n setEmailError(t(\"please_enter_new_email\"));\n return;\n }\n const emailRegex = /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/;\n if (!emailRegex.test(trimmed)) {\n setEmailError(t(\"please_enter_valid_email\"));\n return;\n }\n if (email && trimmed.toLowerCase() === email.toLowerCase()) {\n setEmailError(t(\"new_email_must_be_different\"));\n return;\n }\n try {\n await onChangeEmail?.(trimmed);\n setIsEditingEmail(false);\n setNewEmail(\"\");\n } catch (err) {\n setEmailError(\n err instanceof Error\n ? err.message\n : t(\"failed_to_initiate_email_change\"),\n );\n }\n };\n\n const handleCancelEmailEdit = () => {\n setIsEditingEmail(false);\n setNewEmail(\"\");\n setEmailError(undefined);\n };\n\n const handleDialogClose = () => {\n handleCancelEmailEdit();\n handleClose();\n };\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && handleDialogClose()}>\n <DialogContent className=\"max-w-sm md:max-w-lg\">\n <DialogHeader>\n <DialogTitle>{t(\"edit_profile\")}</DialogTitle>\n </DialogHeader>\n <div className=\"space-y-4\">\n <FormTextField\n control={control}\n name=\"first_name\"\n label={t(\"first_name\")}\n />\n <FormTextField\n control={control}\n name=\"last_name\"\n label={t(\"last_name\")}\n />\n <FormTextField\n control={control}\n name=\"phone_number\"\n label={t(\"phone_number\")}\n type=\"tel\"\n />\n <FormTextareaField\n control={control}\n name=\"bio\"\n label={t(\"bio\")}\n rows={3}\n placeholder={t(\"add_a_short_bio\")}\n />\n <FormSelectField\n control={control}\n name=\"language\"\n label={t(\"language\")}\n options={languageOptions}\n placeholder={t(\"select_an_option\")}\n />\n </div>\n {email && (\n <div className=\"space-y-2\">\n <label className=\"text-foreground text-sm font-medium\">\n {t(\"email\")}\n </label>\n {isEditingEmail ? (\n <div className=\"space-y-2\">\n <Input\n type=\"email\"\n placeholder={t(\"enter_new_email_placeholder\")}\n value={newEmail}\n onChange={(e) => {\n setNewEmail(e.target.value);\n setEmailError(undefined);\n }}\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n handleEmailSubmit();\n }\n if (e.key === \"Escape\") {\n handleCancelEmailEdit();\n }\n }}\n aria-invalid={!!emailError || undefined}\n autoFocus\n />\n {emailError && (\n <p className=\"text-destructive text-xs\">{emailError}</p>\n )}\n <div className=\"bg-muted flex items-start gap-2.5 rounded-md px-3 py-2.5\">\n <Info className=\"text-primary mt-0.5 h-4 w-4 shrink-0\" />\n <p className=\"text-muted-foreground text-xs\">\n {t(\"email_verification_hint\")}\n </p>\n </div>\n <div className=\"flex gap-2\">\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={handleCancelEmailEdit}\n >\n {t(\"cancel\")}\n </Button>\n <Button\n type=\"button\"\n size=\"sm\"\n onClick={handleEmailSubmit}\n disabled={!newEmail.trim() || isChangingEmail}\n >\n {isChangingEmail && (\n <div className=\"mr-2 h-3.5 w-3.5 animate-spin rounded-full border-2 border-current/30 border-t-current\" />\n )}\n {isChangingEmail ? t(\"sending\") : t(\"send_verification\")}\n </Button>\n </div>\n </div>\n ) : pendingEmail ? (\n <div className=\"space-y-2\">\n <div className=\"bg-muted text-muted-foreground min-w-0 rounded-md px-3 py-2 text-sm\">\n {email}\n </div>\n <div className=\"bg-muted flex items-start gap-2.5 rounded-md px-3 py-2.5\">\n <Info className=\"text-primary mt-0.5 h-4 w-4 shrink-0\" />\n <p className=\"text-muted-foreground text-xs\">\n {t(\"changing_email_to\")}{\" \"}\n <span className=\"text-foreground font-medium\">\n {pendingEmail}\n </span>\n . {t(\"check_new_email_verification\")}\n </p>\n </div>\n </div>\n ) : (\n <div className=\"flex items-center gap-2\">\n <div className=\"bg-muted text-muted-foreground min-w-0 flex-1 rounded-md px-3 py-2 text-sm\">\n {email}\n </div>\n {onChangeEmail && (\n <Button\n type=\"button\"\n variant=\"outline\"\n size=\"sm\"\n onClick={() => setIsEditingEmail(true)}\n className=\"shrink-0\"\n >\n {t(\"change\")}\n </Button>\n )}\n </div>\n )}\n </div>\n )}\n {errorMsg && <p className=\"text-destructive text-sm\">{errorMsg}</p>}\n <DialogFooter className=\"flex flex-row items-center justify-end\">\n <div className=\"flex-1 text-right\">\n <Button type=\"button\" onClick={onSubmit}>\n {isSubmitting && (\n <div className=\"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current\" />\n )}\n {isSubmitting ? t(\"saving\") : t(\"save_changes\")}\n </Button>\n </div>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n","import { useState, type JSX } from \"react\";\nimport type { fluidPay } from \"@fluid-app/fluid-pay-core\";\n\nconst PAYMENT_ICON_BASE = \"https://assets.fluid.app/images/payment_icons\";\nconst GENERIC_PAYMENT_ICON = `${PAYMENT_ICON_BASE}/generic.svg`;\n\nexport function brandIconUrl(brand: string | null | undefined): string {\n if (!brand) return GENERIC_PAYMENT_ICON;\n const slug = brand.toLowerCase().replace(/\\s+/g, \"_\");\n return `${PAYMENT_ICON_BASE}/${slug}.svg`;\n}\n\nexport function PaymentIcon({\n logoUrl,\n brand,\n alt,\n}: {\n logoUrl?: string;\n brand: string | null | undefined;\n alt: string;\n}): JSX.Element {\n const computedSrc = logoUrl || brandIconUrl(brand);\n const [hasError, setHasError] = useState(false);\n const src = hasError ? GENERIC_PAYMENT_ICON : computedSrc;\n return (\n <img\n src={src}\n alt={alt}\n width={40}\n height={24}\n className=\"object-contain\"\n onError={() => setHasError(true)}\n />\n );\n}\n\nexport function getCardDisplayName(\n paymentMethod: fluidPay.CustomerPaymentMethod,\n cardFallback = \"Card\",\n): string {\n const lastFour = paymentMethod.details.last_four;\n if (lastFour != null || paymentMethod.payment_type === \"Credit Card\") {\n const brand = paymentMethod.details.card_type || cardFallback;\n return `${brand} •••• ${lastFour || \"••••\"}`;\n }\n return paymentMethod.payment_type;\n}\n\nexport function getCardExpiry(\n paymentMethod: fluidPay.CustomerPaymentMethod,\n expiresLabel = \"Expires\",\n): string {\n const { exp_month, exp_year } = paymentMethod.details;\n if (exp_month != null && exp_year != null) {\n return `${expiresLabel} ${exp_month}/${exp_year}`;\n }\n return \"\";\n}\n","import { createContext, useContext } from \"react\";\n\nexport type TranslationFn = (key: string) => string;\n\nexport interface ProfileUIContextValue {\n t: TranslationFn;\n}\n\nexport const ProfileUIContext = createContext<ProfileUIContextValue | null>(\n null,\n);\n\nexport function useProfileUI(): ProfileUIContextValue {\n const context = useContext(ProfileUIContext);\n if (!context) {\n throw new Error(\"useProfileUI must be used within a ProfileUIProvider\");\n }\n return context;\n}\n","import { createContext, useContext } from \"react\";\nimport type { FluidPayApi } from \"./api-interface\";\n\nconst FluidPayApiContext = createContext<FluidPayApi | null>(null);\n\nexport const FluidPayApiProvider = FluidPayApiContext.Provider;\n\nexport function useFluidPayApi(): FluidPayApi {\n const api = useContext(FluidPayApiContext);\n if (!api) {\n throw new Error(\n \"useFluidPayApi must be used within a FluidPayCoreProvider\",\n );\n }\n return api;\n}\n","import type { JSX } from \"react\";\nimport type { FluidPayApi } from \"./api-interface\";\nimport { FluidPayApiProvider } from \"./context\";\n\nexport interface FluidPayCoreProviderProps {\n api: FluidPayApi;\n children: React.ReactNode;\n}\n\nexport function FluidPayCoreProvider({\n api,\n children,\n}: FluidPayCoreProviderProps): JSX.Element {\n return <FluidPayApiProvider value={api}>{children}</FluidPayApiProvider>;\n}\n","export interface State {\n name: string;\n isoCode: string;\n}\n\nexport interface RegionConfig {\n regionLabel: string;\n postalLabel: string;\n}\n\nexport const US_STATES: State[] = [\n { name: \"Alabama\", isoCode: \"AL\" },\n { name: \"Alaska\", isoCode: \"AK\" },\n { name: \"Arizona\", isoCode: \"AZ\" },\n { name: \"Arkansas\", isoCode: \"AR\" },\n { name: \"California\", isoCode: \"CA\" },\n { name: \"Colorado\", isoCode: \"CO\" },\n { name: \"Connecticut\", isoCode: \"CT\" },\n { name: \"Delaware\", isoCode: \"DE\" },\n { name: \"Florida\", isoCode: \"FL\" },\n { name: \"Georgia\", isoCode: \"GA\" },\n { name: \"Hawaii\", isoCode: \"HI\" },\n { name: \"Idaho\", isoCode: \"ID\" },\n { name: \"Illinois\", isoCode: \"IL\" },\n { name: \"Indiana\", isoCode: \"IN\" },\n { name: \"Iowa\", isoCode: \"IA\" },\n { name: \"Kansas\", isoCode: \"KS\" },\n { name: \"Kentucky\", isoCode: \"KY\" },\n { name: \"Louisiana\", isoCode: \"LA\" },\n { name: \"Maine\", isoCode: \"ME\" },\n { name: \"Maryland\", isoCode: \"MD\" },\n { name: \"Massachusetts\", isoCode: \"MA\" },\n { name: \"Michigan\", isoCode: \"MI\" },\n { name: \"Minnesota\", isoCode: \"MN\" },\n { name: \"Mississippi\", isoCode: \"MS\" },\n { name: \"Missouri\", isoCode: \"MO\" },\n { name: \"Montana\", isoCode: \"MT\" },\n { name: \"Nebraska\", isoCode: \"NE\" },\n { name: \"Nevada\", isoCode: \"NV\" },\n { name: \"New Hampshire\", isoCode: \"NH\" },\n { name: \"New Jersey\", isoCode: \"NJ\" },\n { name: \"New Mexico\", isoCode: \"NM\" },\n { name: \"New York\", isoCode: \"NY\" },\n { name: \"North Carolina\", isoCode: \"NC\" },\n { name: \"North Dakota\", isoCode: \"ND\" },\n { name: \"Ohio\", isoCode: \"OH\" },\n { name: \"Oklahoma\", isoCode: \"OK\" },\n { name: \"Oregon\", isoCode: \"OR\" },\n { name: \"Pennsylvania\", isoCode: \"PA\" },\n { name: \"Rhode Island\", isoCode: \"RI\" },\n { name: \"South Carolina\", isoCode: \"SC\" },\n { name: \"South Dakota\", isoCode: \"SD\" },\n { name: \"Tennessee\", isoCode: \"TN\" },\n { name: \"Texas\", isoCode: \"TX\" },\n { name: \"Utah\", isoCode: \"UT\" },\n { name: \"Vermont\", isoCode: \"VT\" },\n { name: \"Virginia\", isoCode: \"VA\" },\n { name: \"Washington\", isoCode: \"WA\" },\n { name: \"West Virginia\", isoCode: \"WV\" },\n { name: \"Wisconsin\", isoCode: \"WI\" },\n { name: \"Wyoming\", isoCode: \"WY\" },\n { name: \"District of Columbia\", isoCode: \"DC\" },\n];\n\nexport const COUNTRY_CONFIGS: Record<string, RegionConfig> = {\n US: { regionLabel: \"State\", postalLabel: \"ZIP Code\" },\n JP: { regionLabel: \"Prefecture\", postalLabel: \"Postal Code\" },\n};\n\nconst DEFAULT_REGION_CONFIG: RegionConfig = {\n regionLabel: \"Province\",\n postalLabel: \"Postal Code\",\n};\n\nexport function getRegionConfig(countryCode: string): RegionConfig {\n return COUNTRY_CONFIGS[countryCode] ?? DEFAULT_REGION_CONFIG;\n}\n\nexport const DEFAULT_ADDRESS_FIELDS = [\n { field: \"first_name\", label: \"First Name\", required: true },\n { field: \"last_name\", label: \"Last Name\", required: true },\n { field: \"address1\", label: \"Address\", required: true },\n { field: \"address2\", label: \"Apartment, suite, etc.\", required: false },\n { field: \"city\", label: \"City\", required: true },\n { field: \"state\", label: \"State\", required: true },\n { field: \"postal_code\", label: \"Postal Code\", required: true },\n { field: \"country_code\", label: \"Country\", required: true },\n];\n","import { useCallback, useState } from \"react\";\nimport {\n US_STATES,\n getRegionConfig,\n type State,\n} from \"../utils/country-config\";\n\nexport default function useCountryStates() {\n const [selectedCountry, setSelectedCountry] = useState<string>(\"US\");\n const [stateOptions, setStateOptions] = useState<State[]>(US_STATES);\n\n const handleCountryChange = useCallback(\n (\n selectedCountryCode: string,\n fetchStates?: (countryCode: string) => Promise<State[]>,\n ) => {\n setSelectedCountry(selectedCountryCode);\n if (selectedCountryCode === \"US\") {\n setStateOptions(US_STATES);\n } else if (fetchStates) {\n fetchStates(selectedCountryCode)\n .then((states) => setStateOptions(states))\n .catch((error) => {\n console.error(\"Failed to fetch states:\", error);\n setStateOptions([]);\n });\n } else {\n setStateOptions([]);\n }\n },\n [],\n );\n\n const config = getRegionConfig(selectedCountry);\n\n return { handleCountryChange, stateOptions, config, selectedCountry };\n}\n","import { useEffect, useMemo, useState, type JSX } from \"react\";\nimport { useWatch } from \"react-hook-form\";\nimport { z } from \"zod\";\nimport { Trash2 } from \"lucide-react\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n DialogFooter,\n Button,\n useZodForm,\n} from \"@fluid-app/ui-primitives\";\nimport { FormTextField, FormSelectField } from \"./form-fields\";\nimport type { fluidPay } from \"@fluid-app/fluid-pay-core\";\nimport { useCountryStates } from \"@fluid-app/profile-core\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\nimport type { BillingAddress } from \"./view-payment-method-dialog\";\n\nfunction createEditPaymentMethodFormSchema(t: (key: string) => string) {\n return z.object({\n billing_address: z.object({\n name: z.string().min(1, t(\"name_is_required\")),\n address1: z.string().min(1, t(\"address_line_1_is_required\")),\n address2: z.string().optional().nullable(),\n city: z.string().min(1, t(\"city_is_required\")),\n state: z.string().min(1, t(\"state_is_required\")),\n zip: z.string().min(1, t(\"zip_code_is_required\")),\n country_code: z.string().min(1, t(\"country_is_required\")),\n }),\n set_as_default: z.boolean(),\n });\n}\n\nexport type EditPaymentMethodFormData = z.infer<\n ReturnType<typeof createEditPaymentMethodFormSchema>\n>;\n\ninterface CountryOption {\n iso: string;\n name: string;\n}\n\ninterface EditPaymentMethodDialogProps {\n isOpen: boolean;\n paymentMethod: fluidPay.CustomerPaymentMethod | null;\n billingAddress?: BillingAddress | null;\n onClose: () => void;\n onSubmit: (data: EditPaymentMethodFormData) => void;\n isSubmitting: boolean;\n error?: string;\n countries?: CountryOption[];\n onDelete?: () => void;\n isDeleting?: boolean;\n}\n\nexport default function EditPaymentMethodDialog({\n isOpen,\n paymentMethod,\n billingAddress,\n onClose,\n onSubmit,\n isSubmitting,\n error,\n countries = [],\n onDelete,\n isDeleting = false,\n}: EditPaymentMethodDialogProps): JSX.Element | null {\n const { t } = useProfileTranslation();\n const [confirmDelete, setConfirmDelete] = useState(false);\n\n useEffect(() => {\n if (!isOpen) setConfirmDelete(false);\n }, [isOpen]);\n\n useEffect(() => {\n if (!confirmDelete) return;\n const timeoutId = setTimeout(() => setConfirmDelete(false), 3000);\n return () => clearTimeout(timeoutId);\n }, [confirmDelete]);\n\n const editPaymentMethodFormSchema = useMemo(\n () => createEditPaymentMethodFormSchema((key) => t(key as never)),\n [t],\n );\n\n const { control, handleSubmit, reset, setValue } =\n useZodForm<EditPaymentMethodFormData>(editPaymentMethodFormSchema, {\n defaultValues: {\n billing_address: {\n name: \"\",\n address1: \"\",\n address2: \"\",\n city: \"\",\n state: \"\",\n zip: \"\",\n country_code: \"US\",\n },\n set_as_default: false,\n },\n });\n\n const billingCountry = useWatch({\n control,\n name: \"billing_address.country_code\",\n });\n const setAsDefault = useWatch({ control, name: \"set_as_default\" });\n\n const { stateOptions, config, handleCountryChange } = useCountryStates();\n\n const countryOptions = [...countries]\n .map((country) => ({\n name: country.name,\n value: country.iso,\n }))\n .sort((a, b) => {\n if (a.value === billingCountry) return -1;\n if (b.value === billingCountry) return 1;\n return a.name.localeCompare(b.name);\n });\n\n const stateSelectOptions = stateOptions.map((state) => ({\n name: state.name,\n value: state.isoCode,\n }));\n\n useEffect(() => {\n if (paymentMethod && isOpen) {\n reset({\n billing_address: {\n name: billingAddress?.name ?? \"\",\n address1: billingAddress?.address1 ?? \"\",\n address2: billingAddress?.address2 ?? \"\",\n city: billingAddress?.city ?? \"\",\n state: billingAddress?.state ?? \"\",\n zip: billingAddress?.zip ?? \"\",\n country_code: billingAddress?.country_code ?? \"US\",\n },\n set_as_default: paymentMethod.default,\n });\n }\n }, [paymentMethod, billingAddress, isOpen, reset]);\n\n const handleCountrySelect = (countryCode: string) => {\n handleCountryChange(countryCode);\n setValue(\"billing_address.country_code\", countryCode, {\n shouldValidate: true,\n });\n };\n\n const handleFormSubmit = handleSubmit((data) => {\n onSubmit(data);\n });\n\n const deleteButtonLabel = useMemo(() => {\n if (isDeleting) return t(\"deleting\");\n if (confirmDelete) return t(\"tap_to_confirm\");\n return t(\"delete_card\");\n }, [isDeleting, confirmDelete, t]);\n\n if (!paymentMethod) return null;\n\n const { details } = paymentMethod;\n const cardBrand = details.card_type ?? t(\"card_fallback\");\n const lastFour = details.last_four ?? \"****\";\n const expMonth = details.exp_month;\n const expYear = details.exp_year;\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogContent className=\"max-h-[90vh] max-w-sm overflow-y-auto md:max-w-lg\">\n <DialogHeader>\n <DialogTitle>{t(\"edit_card\")}</DialogTitle>\n </DialogHeader>\n\n <div className=\"space-y-4\">\n <div className=\"bg-muted rounded-lg p-4\">\n <div className=\"flex items-center space-x-3\">\n {details.logo_url && (\n <div className=\"h-6 w-10 flex-shrink-0\">\n <img\n src={details.logo_url}\n alt={cardBrand}\n width={40}\n height={24}\n className=\"object-contain\"\n />\n </div>\n )}\n <div className=\"flex flex-col\">\n <span className=\"text-foreground text-sm font-medium\">\n {cardBrand} •••• {lastFour}\n </span>\n {expMonth != null && expYear != null && (\n <span className=\"text-muted-foreground text-sm\">\n {t(\"card_expires\")} {expMonth}/{expYear}\n </span>\n )}\n </div>\n </div>\n </div>\n\n <div>\n <h3 className=\"text-foreground mb-3 text-sm font-medium\">\n {t(\"billing_address\")}\n </h3>\n <div className=\"space-y-3\">\n <FormSelectField\n control={control}\n name=\"billing_address.country_code\"\n label={t(\"country\")}\n options={countryOptions}\n placeholder={t(\"select_an_option\")}\n onChange={(val) => {\n handleCountrySelect(val);\n }}\n />\n <FormTextField\n control={control}\n name=\"billing_address.name\"\n label={t(\"name\")}\n />\n <FormTextField\n control={control}\n name=\"billing_address.address1\"\n label={t(\"address_line_1\")}\n />\n <FormTextField\n control={control}\n name=\"billing_address.address2\"\n label={t(\"address_line_2\")}\n />\n <div className=\"grid grid-cols-1 gap-3 sm:grid-cols-3\">\n <FormTextField\n control={control}\n name=\"billing_address.city\"\n label={t(\"city\")}\n />\n <FormSelectField\n control={control}\n name=\"billing_address.state\"\n label={\n config?.regionLabel\n ? t(config.regionLabel as never)\n : t(\"state\")\n }\n options={stateSelectOptions}\n placeholder={t(\"select_state\")}\n />\n <FormTextField\n control={control}\n name=\"billing_address.zip\"\n label={\n config?.postalLabel\n ? t(config.postalLabel as never)\n : t(\"zip_code\")\n }\n />\n </div>\n </div>\n </div>\n </div>\n\n <div className=\"mt-2 flex items-center space-x-2\">\n <input\n type=\"checkbox\"\n id=\"set_as_default\"\n checked={setAsDefault}\n onChange={() => setValue(\"set_as_default\", !setAsDefault)}\n className=\"h-4 w-4\"\n />\n <label htmlFor=\"set_as_default\" className=\"text-sm\">\n {t(\"set_as_default_payment_method\")}\n </label>\n </div>\n\n {error && <div className=\"text-destructive text-sm\">{error}</div>}\n\n <DialogFooter className=\"flex flex-row items-center justify-between gap-2\">\n {onDelete ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => {\n if (confirmDelete) {\n onDelete();\n } else {\n setConfirmDelete(true);\n }\n }}\n disabled={isSubmitting || isDeleting}\n className=\"text-destructive hover:bg-destructive/10 hover:text-destructive\"\n >\n <Trash2 className=\"size-4\" />\n {deleteButtonLabel}\n </Button>\n ) : (\n <span />\n )}\n <div className=\"flex items-center gap-2\">\n <Button\n type=\"button\"\n variant=\"secondary\"\n onClick={onClose}\n disabled={isSubmitting || isDeleting}\n >\n {t(\"cancel\")}\n </Button>\n <Button\n type=\"button\"\n onClick={handleFormSubmit}\n disabled={isSubmitting || isDeleting}\n >\n {isSubmitting && (\n <div className=\"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current\" />\n )}\n {isSubmitting ? t(\"saving\") : t(\"save_changes\")}\n </Button>\n </div>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}\n","import type React from \"react\";\nimport { useController, type Control } from \"react-hook-form\";\nimport {\n Button,\n Card,\n CardContent,\n CardHeader,\n CardTitle,\n Label,\n Textarea,\n cn,\n} from \"@fluid-app/ui-primitives\";\nimport { z } from \"zod\";\nimport { FormTextField } from \"./form-fields\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\n\nfunction normalizeUrl(value: string): string {\n const trimmed = value.trim();\n if (!trimmed) return \"\";\n if (/^https?:\\/\\//i.test(trimmed)) return trimmed;\n return `https://${trimmed}`;\n}\n\nconst urlField = z\n .string()\n .transform(normalizeUrl)\n .pipe(z.string().url().or(z.literal(\"\")));\n\nexport const mySiteProfileSchema = z.object({\n bio: z.string().optional(),\n linkedin: urlField,\n facebook: urlField,\n twitter: urlField,\n instagram: urlField,\n youtube: urlField,\n pinterest: urlField,\n tiktok: urlField,\n whatsapp: z.string().optional(),\n wechat: z.string().optional(),\n});\n\nexport type MySiteProfileFormData = z.infer<typeof mySiteProfileSchema>;\n\nexport const socialFields = [\n {\n name: \"linkedin\",\n label: \"LinkedIn\",\n placeholder: \"linkedin.com/in/username\",\n },\n { name: \"facebook\", label: \"Facebook\", placeholder: \"facebook.com/username\" },\n { name: \"twitter\", label: \"X (Twitter)\", placeholder: \"x.com/username\" },\n {\n name: \"instagram\",\n label: \"Instagram\",\n placeholder: \"instagram.com/username\",\n },\n { name: \"youtube\", label: \"YouTube\", placeholder: \"youtube.com/@channel\" },\n {\n name: \"pinterest\",\n label: \"Pinterest\",\n placeholder: \"pinterest.com/username\",\n },\n { name: \"tiktok\", label: \"TikTok\", placeholder: \"tiktok.com/@username\" },\n { name: \"whatsapp\", label: \"WhatsApp\", placeholder: \"Phone number or link\" },\n { name: \"wechat\", label: \"WeChat\", placeholder: \"WeChat ID\" },\n] as const satisfies readonly {\n name: keyof Omit<MySiteProfileFormData, \"bio\">;\n label: string;\n placeholder: string;\n}[];\n\nexport interface MySiteProfileSectionProps {\n avatarUrl?: string | null;\n initial?: string;\n control: Control<MySiteProfileFormData>;\n}\n\nfunction BioField({ control }: { control: Control<MySiteProfileFormData> }) {\n const { t } = useProfileTranslation();\n const {\n field,\n fieldState: { error },\n } = useController({ name: \"bio\", control });\n return (\n <div className=\"space-y-1\">\n <Label htmlFor=\"mysite-bio\" className=\"block text-sm font-medium\">\n {t(\"bio\")}\n </Label>\n <Textarea\n id=\"mysite-bio\"\n rows={4}\n placeholder={t(\"bio_placeholder\")}\n className={cn(error && \"ring-destructive ring-1\")}\n {...field}\n value={field.value ?? \"\"}\n />\n {error && <p className=\"text-destructive text-sm\">{error.message}</p>}\n </div>\n );\n}\n\nexport function MySiteProfileSection({\n avatarUrl,\n initial,\n control,\n}: MySiteProfileSectionProps): React.JSX.Element {\n const { t } = useProfileTranslation();\n return (\n <Card>\n <CardHeader>\n <CardTitle>{t(\"about_me\")}</CardTitle>\n </CardHeader>\n <CardContent className=\"flex flex-col gap-6 lg:flex-row lg:gap-10\">\n <div className=\"bg-muted relative h-[120px] w-[120px] shrink-0 self-center overflow-hidden rounded-full lg:self-auto\">\n {avatarUrl ? (\n <img\n src={avatarUrl}\n alt={t(\"profile_image_alt\")}\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div className=\"bg-background text-foreground flex h-full w-full items-center justify-center text-xl font-semibold\">\n {initial ?? \"U\"}\n </div>\n )}\n </div>\n\n <div className=\"min-w-0 flex-1\">\n <BioField control={control} />\n </div>\n </CardContent>\n </Card>\n );\n}\n\nexport interface MySiteProfileSocialSectionProps {\n control: Control<MySiteProfileFormData>;\n}\n\nexport function MySiteProfileSocialSection({\n control,\n}: MySiteProfileSocialSectionProps): React.JSX.Element {\n const { t } = useProfileTranslation();\n return (\n <Card>\n <CardHeader>\n <CardTitle>{t(\"social_media_links\")}</CardTitle>\n </CardHeader>\n <CardContent>\n <div className=\"space-y-4\">\n {socialFields.map((field) => {\n let placeholder: string = field.placeholder;\n if (field.name === \"whatsapp\")\n placeholder = t(\"whatsapp_placeholder\");\n if (field.name === \"wechat\") placeholder = t(\"wechat_placeholder\");\n return (\n <FormTextField\n key={field.name}\n control={control}\n name={field.name}\n label={field.label}\n placeholder={placeholder}\n />\n );\n })}\n </div>\n </CardContent>\n </Card>\n );\n}\n\nexport interface MySiteProfileSaveButtonProps {\n isDirty: boolean;\n isPending: boolean;\n onSubmit: () => void;\n}\n\nexport function MySiteProfileSaveButton({\n isDirty,\n isPending,\n onSubmit,\n}: MySiteProfileSaveButtonProps): React.JSX.Element {\n const { t } = useProfileTranslation();\n return (\n <div className=\"flex justify-end pb-6\">\n <Button\n type=\"button\"\n onClick={onSubmit}\n disabled={!isDirty || isPending}\n className=\"w-full sm:w-auto\"\n >\n {isPending && (\n <div className=\"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current\" />\n )}\n {isPending ? t(\"saving\") : t(\"save\")}\n </Button>\n </div>\n );\n}\n","\"use client\";\n\nimport type { Control, FieldPath, FieldValues } from \"react-hook-form\";\nimport { useController } from \"react-hook-form\";\nimport { Input, Label, cn } from \"@fluid-app/ui-primitives\";\n\ninterface FormTextFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n control: Control<TFieldValues>;\n name: TName;\n label?: string;\n placeholder?: string;\n containerClassName?: string;\n type?: React.HTMLInputTypeAttribute;\n disabled?: boolean;\n inputMode?: React.HTMLAttributes<HTMLInputElement>[\"inputMode\"];\n}\n\nexport function FormTextField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n control,\n name,\n label,\n placeholder,\n containerClassName,\n type,\n disabled,\n inputMode,\n}: FormTextFieldProps<TFieldValues, TName>) {\n const {\n field,\n fieldState: { error },\n } = useController({ name, control });\n\n return (\n <div className={cn(\"space-y-1\", containerClassName)}>\n {label && (\n <Label htmlFor={name} className=\"mb-1.5 block text-sm font-medium\">\n {label}\n </Label>\n )}\n <Input\n {...field}\n value={field.value ?? \"\"}\n id={name}\n type={type}\n disabled={disabled}\n inputMode={inputMode}\n placeholder={placeholder}\n aria-invalid={!!error}\n />\n {error?.message && (\n <p className=\"text-destructive text-sm\">{error.message}</p>\n )}\n </div>\n );\n}\n","\"use client\";\n\nimport { useMemo } from \"react\";\nimport type { Control, FieldPath, FieldValues } from \"react-hook-form\";\nimport { Controller } from \"react-hook-form\";\nimport { Label, cn } from \"@fluid-app/ui-primitives\";\nimport { Combobox } from \"@fluid-app/ui-components/components/Combobox\";\n\ntype NameValue = { name: string; value: string | number };\n\ninterface FormComboboxFieldProps<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n> {\n control: Control<TFieldValues>;\n name: TName;\n label?: string;\n placeholder?: string;\n emptyText?: string;\n options?: NameValue[];\n containerClassName?: string;\n disabled?: boolean;\n}\n\nexport function FormComboboxField<\n TFieldValues extends FieldValues = FieldValues,\n TName extends FieldPath<TFieldValues> = FieldPath<TFieldValues>,\n>({\n control,\n name,\n label,\n placeholder = \"Select\",\n emptyText = \"No results found.\",\n options,\n containerClassName,\n disabled,\n}: FormComboboxFieldProps<TFieldValues, TName>) {\n const comboboxOptions = useMemo(\n () =>\n options?.map((opt) => ({\n label: opt.name,\n value: opt.value.toString(),\n })) ?? [],\n [options],\n );\n\n return (\n <div className={cn(\"space-y-1\", containerClassName)}>\n {label && (\n <Label htmlFor={name} className=\"mb-1.5 block text-sm font-medium\">\n {label}\n </Label>\n )}\n <Controller\n control={control}\n name={name}\n render={({ field: { onChange, value }, fieldState: { error } }) => (\n <>\n <Combobox\n options={comboboxOptions}\n value={value?.toString() ?? \"\"}\n onValueChange={onChange}\n placeholder={placeholder}\n emptyText={emptyText}\n disabled={disabled}\n />\n {error?.message && (\n <p className=\"text-destructive text-sm\">{error.message}</p>\n )}\n </>\n )}\n />\n </div>\n );\n}\n","import { type JSX, type ReactNode, useEffect, useMemo, useState } from \"react\";\nimport { useWatch, type Control, type UseFormSetValue } from \"react-hook-form\";\nimport { Trash2 } from \"lucide-react\";\nimport { z } from \"zod\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n Button,\n useZodForm,\n} from \"@fluid-app/ui-primitives\";\nimport { FormTextField } from \"./form-fields/FormTextField\";\nimport { FormComboboxField } from \"./form-fields/FormComboboxField\";\nimport type { fluidPay } from \"@fluid-app/fluid-pay-core\";\nimport { useCountryStates, type State } from \"@fluid-app/fluid-pay-core\";\n\nconst addressFormSchema = z.object({\n first_name: z.string().min(1, \"First name is required\"),\n last_name: z.string().min(1, \"Last name is required\"),\n address1: z.string().min(1, \"Address line 1 is required\"),\n address2: z.string().optional().nullable(),\n city: z.string().min(1, \"City is required\"),\n state: z.string().min(1, \"State is required\"),\n postal_code: z.string().min(1, \"Postal code is required\"),\n country_code: z.string().min(1, \"Country is required\"),\n default: z.boolean(),\n});\n\nexport type AddressFormData = z.infer<typeof addressFormSchema>;\n\ninterface CountryOption {\n iso: string;\n name: string;\n}\n\nexport interface AddressAutocompleteRenderProps {\n control: Control<AddressFormData>;\n setValue: UseFormSetValue<AddressFormData>;\n countryCode: string;\n}\n\ninterface AddressFormDialogProps {\n isOpen: boolean;\n onClose: () => void;\n selectedAddress: fluidPay.CustomerAddress | null;\n onSubmit: (data: fluidPay.CreateAddressBody) => void;\n isSubmitting: boolean;\n countries?: CountryOption[];\n error?: string;\n renderAddressAutocomplete?: (\n props: AddressAutocompleteRenderProps,\n ) => ReactNode;\n fetchStates?: (countryCode: string) => Promise<State[]>;\n t: (key: string) => string;\n onDelete?: () => void;\n isDeleting?: boolean;\n defaultCountry?: string;\n}\n\nexport default function AddressFormDialog({\n isOpen,\n onClose,\n selectedAddress,\n onSubmit,\n isSubmitting,\n countries = [],\n error,\n renderAddressAutocomplete,\n fetchStates,\n t,\n onDelete,\n isDeleting = false,\n defaultCountry = \"US\",\n}: AddressFormDialogProps): JSX.Element {\n const [confirmDelete, setConfirmDelete] = useState(false);\n\n useEffect(() => {\n if (!isOpen) setConfirmDelete(false);\n }, [isOpen]);\n\n useEffect(() => {\n if (!confirmDelete) return;\n const timeoutId = setTimeout(() => setConfirmDelete(false), 3000);\n return () => clearTimeout(timeoutId);\n }, [confirmDelete]);\n\n const deleteButtonLabel = useMemo(() => {\n if (isDeleting) return t(\"deleting\");\n if (confirmDelete) return t(\"tap_to_confirm\");\n return t(\"delete_address\");\n }, [isDeleting, confirmDelete, t]);\n const { control, handleSubmit, reset, setValue } =\n useZodForm<AddressFormData>(addressFormSchema, {\n defaultValues: {\n first_name: \"\",\n last_name: \"\",\n address1: \"\",\n address2: \"\",\n city: \"\",\n state: \"\",\n postal_code: \"\",\n country_code: defaultCountry,\n default: false,\n },\n });\n\n const selectedCountryCode = useWatch({ control, name: \"country_code\" });\n const isDefault = useWatch({ control, name: \"default\" });\n\n const { stateOptions, config, handleCountryChange } = useCountryStates();\n\n const countrySelectOptions = [...countries]\n .map((country) => ({\n name: country.name,\n value: country.iso,\n }))\n .sort((a, b) => {\n if (a.value === selectedCountryCode) return -1;\n if (b.value === selectedCountryCode) return 1;\n return a.name.localeCompare(b.name);\n });\n\n const stateSelectOptions = stateOptions.map((state) => ({\n name: state.name,\n value: state.isoCode,\n }));\n\n useEffect(() => {\n if (isOpen) {\n if (selectedAddress) {\n const nameParts = (selectedAddress.name ?? \"\").split(\" \");\n const firstName = nameParts[0] ?? \"\";\n const lastName = nameParts.slice(1).join(\" \");\n reset({\n first_name: firstName,\n last_name: lastName,\n address1: selectedAddress.address1,\n address2: selectedAddress.address2 ?? \"\",\n city: selectedAddress.city,\n state: selectedAddress.state,\n postal_code: selectedAddress.postal_code,\n country_code: selectedAddress.country_code ?? defaultCountry,\n default: selectedAddress.default,\n });\n handleCountryChange(\n selectedAddress.country_code ?? defaultCountry,\n fetchStates,\n );\n } else {\n reset({\n first_name: \"\",\n last_name: \"\",\n address1: \"\",\n address2: \"\",\n city: \"\",\n state: \"\",\n postal_code: \"\",\n country_code: defaultCountry,\n default: false,\n });\n handleCountryChange(defaultCountry, fetchStates);\n }\n }\n // defaultCountry intentionally omitted from deps: a background addresses\n // refetch can change the parent-computed defaultCountry while the dialog\n // is open, which would otherwise wipe the user's in-progress edits.\n // Reading it via closure means we pick up the latest value only when one\n // of the listed deps fires (open transition, selectedAddress swap).\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [selectedAddress, isOpen, reset, handleCountryChange, fetchStates]);\n\n useEffect(() => {\n handleCountryChange(selectedCountryCode, fetchStates);\n }, [selectedCountryCode, handleCountryChange, fetchStates]);\n\n const handleFormSubmit = handleSubmit((data) => {\n onSubmit({\n address: {\n first_name: data.first_name,\n last_name: data.last_name,\n address1: data.address1,\n address2: data.address2 ?? null,\n city: data.city,\n state: data.state,\n postal_code: data.postal_code,\n country_code: data.country_code,\n default: data.default,\n },\n });\n });\n\n const isEditMode = selectedAddress !== null;\n\n return (\n <Dialog open={isOpen} onOpenChange={(open) => !open && onClose()}>\n <DialogContent className=\"max-h-[90vh] max-w-md overflow-y-auto rounded md:max-w-xl\">\n <DialogHeader>\n <DialogTitle className=\"text-lg font-medium\">\n {isEditMode ? t(\"edit_address\") : t(\"add_an_address\")}\n </DialogTitle>\n </DialogHeader>\n\n <div className=\"space-y-3 pt-2\">\n <FormComboboxField\n control={control}\n name=\"country_code\"\n label={t(\"country\")}\n placeholder={t(\"select_an_option\")}\n options={countrySelectOptions}\n disabled={isSubmitting}\n />\n <div className=\"flex gap-3\">\n <FormTextField\n control={control}\n name=\"first_name\"\n label={t(\"first_name\")}\n containerClassName=\"flex-1\"\n disabled={isSubmitting}\n />\n <FormTextField\n control={control}\n name=\"last_name\"\n label={t(\"last_name\")}\n containerClassName=\"flex-1\"\n disabled={isSubmitting}\n />\n </div>\n {renderAddressAutocomplete ? (\n renderAddressAutocomplete({\n control,\n setValue,\n countryCode: selectedCountryCode,\n })\n ) : (\n <FormTextField\n control={control}\n name=\"address1\"\n label={t(\"address_line_1\")}\n disabled={isSubmitting}\n />\n )}\n <FormTextField\n control={control}\n name=\"address2\"\n label={t(\"address_line_2\")}\n disabled={isSubmitting}\n />\n <div className=\"flex gap-3\">\n <FormTextField\n control={control}\n name=\"city\"\n label={t(\"city\")}\n containerClassName=\"flex-1\"\n disabled={isSubmitting}\n />\n <FormComboboxField\n control={control}\n name=\"state\"\n label={config?.regionLabel ? t(config.regionLabel) : t(\"state\")}\n placeholder={t(\"select_state\")}\n options={stateSelectOptions}\n containerClassName=\"flex-1\"\n disabled={isSubmitting}\n />\n <FormTextField\n control={control}\n name=\"postal_code\"\n label={\n config?.postalLabel ? t(config.postalLabel) : t(\"zip_code\")\n }\n containerClassName=\"flex-1\"\n disabled={isSubmitting}\n />\n </div>\n </div>\n\n <div className=\"mt-4 flex flex-wrap items-center justify-between gap-3\">\n {onDelete ? (\n <Button\n type=\"button\"\n variant=\"ghost\"\n onClick={() => {\n if (confirmDelete) {\n onDelete();\n } else {\n setConfirmDelete(true);\n }\n }}\n disabled={isSubmitting || isDeleting}\n className=\"text-destructive hover:bg-destructive/10 hover:text-destructive\"\n >\n <Trash2 className=\"size-4\" />\n {deleteButtonLabel}\n </Button>\n ) : (\n <span />\n )}\n <div className=\"flex items-center gap-3\">\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"checkbox\"\n id=\"set_as_default_address\"\n checked={isDefault}\n onChange={() => setValue(\"default\", !isDefault)}\n disabled={isSubmitting || isDeleting}\n className=\"h-4 w-4\"\n />\n <label htmlFor=\"set_as_default_address\" className=\"text-sm\">\n {t(\"set_as_default_address\")}\n </label>\n </div>\n\n <Button\n type=\"submit\"\n onClick={handleFormSubmit}\n disabled={isSubmitting || isDeleting}\n >\n {isSubmitting && (\n <div className=\"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current\" />\n )}\n {isSubmitting ? t(\"saving\") : t(\"save_address\")}\n </Button>\n </div>\n </div>\n\n {error && <div className=\"text-destructive mt-2 text-sm\">{error}</div>}\n </DialogContent>\n </Dialog>\n );\n}\n","import { useEffect, useRef, useState, useCallback } from \"react\";\nimport type { fluidPay } from \"@fluid-app/fluid-pay-core\";\n\nexport type VgsFieldState = {\n isFocused: boolean;\n isValid: boolean;\n isEmpty: boolean;\n};\n\nexport type VgsFormState = {\n [key: string]: VgsFieldState;\n};\n\ninterface VGSCollectForm {\n setRouteId: (routeId: string) => void;\n field: (selector: string, config: Record<string, unknown>) => void;\n submit: (\n path: string,\n options: { headers?: Record<string, string> },\n successCallback: (\n status: number,\n response: fluidPay.VgsCollectSubmitResponse,\n ) => void,\n errorCallback: (errors: Record<string, string[]>) => void,\n ) => void;\n unmount: () => void;\n}\n\ninterface VGSCollectLibrary {\n create: (\n vaultId: string,\n environment: string,\n stateCallback: (state: Record<string, Partial<VgsFieldState>>) => void,\n ) => VGSCollectForm;\n}\n\nconst getVGSCollect = (): VGSCollectLibrary | null => {\n if (typeof window !== \"undefined\") {\n return (\n (window as unknown as { VGSCollect?: VGSCollectLibrary }).VGSCollect ||\n null\n );\n }\n return null;\n};\n\nconst DEFAULT_FIELD_STATE: VgsFormState = {\n card_number: { isFocused: false, isValid: false, isEmpty: true },\n card_exp: { isFocused: false, isValid: false, isEmpty: true },\n card_cvc: { isFocused: false, isValid: false, isEmpty: true },\n card_holder: { isFocused: false, isValid: false, isEmpty: true },\n};\n\nexport function useVgsCollect() {\n const [isFormReady, setIsFormReady] = useState(false);\n const [isLoading, setIsLoading] = useState(false);\n const [isScriptLoaded, setIsScriptLoaded] = useState(false);\n const [scriptLoadError, setScriptLoadError] = useState<string | undefined>(\n undefined,\n );\n\n const [vgsFieldState, setVgsFieldState] =\n useState<VgsFormState>(DEFAULT_FIELD_STATE);\n\n const formRef = useRef<VGSCollectForm | null>(null);\n const onSuccessRef = useRef<\n ((response: fluidPay.VgsCollectSubmitResponse) => void) | null\n >(null);\n const onErrorRef = useRef<((error: string) => void) | null>(null);\n\n // Load VGS Collect script\n useEffect(() => {\n if (typeof window === \"undefined\") return;\n\n const vgsCollect = getVGSCollect();\n if (vgsCollect) {\n const timeoutId = window.setTimeout(() => {\n setIsScriptLoaded(true);\n }, 0);\n return () => window.clearTimeout(timeoutId);\n }\n\n if (isScriptLoaded) return;\n\n const script = document.createElement(\"script\");\n script.src =\n \"https://js.verygoodvault.com/vgs-collect/3.3.0/vgs-collect.js\";\n script.async = true;\n script.onload = () => setIsScriptLoaded(true);\n // Surface load failures both to a registered consumer (if any) and to\n // state, so a consumer mounting after the failure still sees it.\n script.onerror = () => {\n const message = \"Failed to load payment form\";\n setScriptLoadError(message);\n onErrorRef.current?.(message);\n };\n document.head.appendChild(script);\n }, [isScriptLoaded]);\n\n const updateFieldState = useCallback(\n (state: Record<string, Partial<VgsFieldState>>) => {\n if (!state) return;\n\n setVgsFieldState((prev) => {\n const newState: VgsFormState = { ...prev };\n let hasChanges = false;\n\n Object.keys(state).forEach((key) => {\n const field = state[key];\n if (!field) return;\n\n const next: VgsFieldState = {\n isFocused: !!field.isFocused,\n isValid: !!field.isValid,\n isEmpty: !!field.isEmpty,\n };\n\n if (\n !newState[key] ||\n JSON.stringify(newState[key]) !== JSON.stringify(next)\n ) {\n newState[key] = next;\n hasChanges = true;\n }\n });\n\n return hasChanges ? newState : prev;\n });\n },\n [],\n );\n\n const resetVgs = useCallback(() => {\n if (formRef.current) {\n try {\n formRef.current.unmount();\n } catch (e) {\n console.warn(\"VGS unmount error\", e);\n }\n formRef.current = null;\n }\n\n setIsFormReady(false);\n setVgsFieldState({ ...DEFAULT_FIELD_STATE });\n }, []);\n\n const initializeForm = useCallback(\n async (credentials: fluidPay.VaultResponse) => {\n if (!isScriptLoaded) return;\n\n const VGSCollect = getVGSCollect();\n if (!VGSCollect) {\n onErrorRef.current?.(\"Payment script not loaded\");\n return;\n }\n\n try {\n setIsLoading(true);\n\n const vgsEnvironment =\n credentials.vault.environment === \"sandbox\" ? \"sandbox\" : \"live-eu-1\";\n\n const form = VGSCollect.create(\n credentials.vault.vault_id,\n vgsEnvironment,\n (state) => updateFieldState(state),\n );\n\n if (credentials.vault.route_id) {\n form.setRouteId(credentials.vault.route_id);\n }\n\n formRef.current = form;\n\n // Wait for DOM elements\n let retries = 0;\n const maxRetries = 20;\n const retryDelay = 200;\n\n const waitForDom = async (): Promise<boolean> => {\n const allExist = [\n \"vgs-card-number\",\n \"vgs-expiration-date\",\n \"vgs-cvc\",\n \"vgs-card-holder\",\n ].every((id) => {\n const el = document.getElementById(id);\n return el && el.isConnected;\n });\n\n if (allExist) return true;\n if (retries >= maxRetries) return false;\n\n retries++;\n await new Promise((resolve) => setTimeout(resolve, retryDelay));\n return waitForDom();\n };\n\n const domReady = await waitForDom();\n if (!domReady) {\n throw new Error(\"Payment form elements not ready\");\n }\n\n // Resolve theme tokens from the wrapper element. The theme engine\n // applies `data-theme` on a subtree element (not <html>), so CSS\n // variables aren't visible on document.documentElement — only on a\n // node inside the themed subtree. Cross-origin iframe contents\n // can't see parent CSS variables, so we resolve concrete values\n // here and pass them to VGS.\n //\n // The `vgs-card-number` element is guaranteed to exist at this\n // point: the `waitForDom` check above blocks until all four VGS\n // wrapper elements are mounted. The hardcoded fallback colors only\n // activate if the CSS variables themselves are unset.\n const themedNode = document.getElementById(\"vgs-card-number\");\n const probeStyle = themedNode ? getComputedStyle(themedNode) : null;\n const foregroundColor =\n probeStyle?.getPropertyValue(\"--color-foreground\").trim() ||\n \"#0a0a0a\";\n const mutedForegroundColor =\n probeStyle?.getPropertyValue(\"--color-muted-foreground\").trim() ||\n \"#737373\";\n\n // Wrapper is `h-9 py-1` (Input primitive). Content area = 36 - 2 (border) - 8 (py-1) = 26px.\n const css = {\n fontSize: \"14px\",\n fontFamily:\n \"-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif\",\n color: foregroundColor,\n background: \"transparent\",\n paddingTop: \"0px\",\n paddingBottom: \"0px\",\n paddingLeft: \"0px\",\n paddingRight: \"0px\",\n boxSizing: \"border-box\",\n lineHeight: \"26px\",\n height: \"100%\",\n width: \"100%\",\n \"&::placeholder\": { color: mutedForegroundColor, opacity: 1 },\n \"&:focus\": { outline: \"none\" },\n };\n\n form.field(\"#vgs-card-number\", {\n type: \"card-number\",\n name: \"card_number\",\n placeholder: \"0000 0000 0000 0000\",\n showCardIcon: true,\n css: { ...css, paddingRight: \"40px\" },\n autoComplete: \"cc-number\",\n validations: [\"required\", \"validCardNumber\"],\n });\n\n form.field(\"#vgs-expiration-date\", {\n type: \"card-expiration-date\",\n name: \"card_exp\",\n yearLength: 2,\n placeholder: \"MM / YY\",\n css,\n autoComplete: \"cc-exp\",\n validations: [\"required\", \"validCardExpirationDate\"],\n });\n\n form.field(\"#vgs-cvc\", {\n type: \"card-security-code\",\n name: \"card_cvc\",\n placeholder: \"123\",\n css,\n autoComplete: \"cc-csc\",\n validations: [\"required\", \"validCardSecurityCode\"],\n });\n\n form.field(\"#vgs-card-holder\", {\n type: \"text\",\n name: \"card_holder\",\n placeholder: \"Full Name\",\n css,\n autoComplete: \"cc-name\",\n validations: [\"required\"],\n });\n\n setIsFormReady(true);\n } catch (error) {\n console.error(\"Failed to initialize VGS:\", error);\n onErrorRef.current?.(\"Failed to initialize payment form\");\n } finally {\n setIsLoading(false);\n }\n },\n [isScriptLoaded, updateFieldState],\n );\n\n const submitCard = useCallback(() => {\n if (!formRef.current) {\n onErrorRef.current?.(\"Form not initialized\");\n return;\n }\n\n formRef.current.submit(\n `/post`,\n {},\n (status: number, response: fluidPay.VgsCollectSubmitResponse) => {\n if (status >= 200 && status < 400) {\n onSuccessRef.current?.(response);\n } else {\n onErrorRef.current?.(\"Payment failed\");\n }\n },\n (errors: Record<string, string[]>) => {\n const allErrors = Object.values(errors)\n .flat()\n .filter(\n (msg) =>\n typeof msg === \"string\" &&\n msg.trim().length > 0 &&\n msg !== \"Required\",\n );\n\n const uniqueErrors = Array.from(new Set(allErrors));\n\n let errorMsg = \"Please verify your payment details.\";\n if (uniqueErrors.length > 0) {\n errorMsg = uniqueErrors.join(\", \");\n } else {\n const rawErrors = Object.values(errors).flat();\n if (rawErrors.length > 0) {\n errorMsg = \"Please fill in all required fields.\";\n }\n }\n\n onErrorRef.current?.(errorMsg);\n },\n );\n }, []);\n\n // Cleanup on unmount\n useEffect(() => {\n return () => {\n if (formRef.current) {\n try {\n formRef.current.unmount();\n } catch (e) {\n console.warn(\"VGS unmount error\", e);\n }\n formRef.current = null;\n }\n };\n }, []);\n\n return {\n isFormReady,\n isLoading,\n isScriptLoaded,\n scriptLoadError,\n initializeForm,\n submitCard,\n vgsFieldState,\n resetVgs,\n onSuccessRef,\n onErrorRef,\n };\n}\n","import {\n type JSX,\n type ReactNode,\n useCallback,\n useEffect,\n useMemo,\n useState,\n} from \"react\";\nimport { Controller } from \"react-hook-form\";\nimport { z } from \"zod\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n Button,\n Label,\n Select,\n SelectContent,\n SelectItem,\n SelectTrigger,\n SelectValue,\n cn,\n useZodForm,\n} from \"@fluid-app/ui-primitives\";\nimport type { fluidPay } from \"@fluid-app/fluid-pay-core\";\nimport { useFluidPayApi } from \"@fluid-app/fluid-pay-core\";\nimport {\n useVgsCollect,\n type VgsFieldState,\n type VgsFormState,\n} from \"../hooks/use-vgs-collect\";\n\nconst SENTINEL_CREATE_NEW = \"__create_new__\";\n\nconst formSchema = z.object({\n billing_address_selection: z\n .string()\n .refine((value) => value !== \"\" && value !== SENTINEL_CREATE_NEW, {\n message: \"Please select a billing address\",\n }),\n set_as_default: z.boolean(),\n});\n\ntype FormData = z.infer<typeof formSchema>;\n\nexport interface CreditCardFormSubmitData {\n set_as_default: boolean;\n payment_method: {\n token: string;\n cvv_token: string;\n exp_month: string;\n exp_year: string;\n card_holder: string;\n };\n billing_address_id: number;\n}\n\nexport interface RenderAddressFormDialogProps {\n isOpen: boolean;\n onClose: () => void;\n onAddressCreated: (address: fluidPay.CustomerAddress) => void;\n}\n\ninterface CreditCardFormDialogProps {\n isOpen: boolean;\n onClose: () => void;\n onSubmit: (data: CreditCardFormSubmitData) => void;\n isSubmitting: boolean;\n error?: string;\n jwt: string;\n /** When provided, adds a top \"Same as shipping\" option referencing this address. */\n shippingAddress?: fluidPay.CustomerAddress | null;\n /** Saved customer addresses populating the dropdown. */\n savedAddresses?: fluidPay.CustomerAddress[];\n /** ID of the customer's preferred billing address; used to pre-select. */\n defaultBillingAddressId?: number;\n /**\n * Render-prop slot for AddressFormDialog. The host wires the dialog so this\n * component doesn't import it directly, keeping the address-create flow's\n * data plumbing (mutations, error toasts) under host control.\n */\n renderAddressFormDialog?: (props: RenderAddressFormDialogProps) => ReactNode;\n t: (key: string) => string;\n}\n\nfunction VgsInputWrapper({\n id,\n label,\n fieldState,\n className,\n}: {\n id: string;\n label: string;\n fieldState?: VgsFieldState;\n className?: string;\n}) {\n const isInvalid =\n fieldState?.isValid === false &&\n !fieldState?.isFocused &&\n !fieldState?.isEmpty;\n const isFocused = !!fieldState?.isFocused;\n\n return (\n <div\n id={id}\n role=\"group\"\n aria-label={label}\n data-invalid={isInvalid ? \"\" : undefined}\n className={cn(\n \"border-input selection:bg-primary selection:text-primary-foreground file:text-foreground placeholder:text-muted-foreground h-9 w-full min-w-0 rounded-md border bg-transparent px-3 py-1 text-base shadow-xs transition-[color,box-shadow] outline-none file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50 md:text-sm\",\n \"focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px]\",\n \"data-[invalid]:border-destructive data-[invalid]:ring-destructive/20\",\n \"[&_iframe]:block! [&_iframe]:h-full! [&_iframe]:w-full! [&_iframe]:border-0!\",\n isFocused && \"border-ring ring-ring/50 ring-[3px]\",\n isFocused && isInvalid && \"border-destructive ring-destructive/20\",\n className,\n )}\n />\n );\n}\n\nfunction VgsCardForm({\n vgsFieldState,\n networkError,\n}: {\n vgsFieldState: VgsFormState;\n networkError?: string;\n}) {\n return (\n <div className=\"space-y-4\" aria-label=\"Credit card form\">\n <VgsInputWrapper\n id=\"vgs-card-number\"\n label=\"Card number\"\n fieldState={vgsFieldState[\"card_number\"]}\n />\n\n <div className=\"flex gap-3\">\n <div className=\"flex-1\">\n <VgsInputWrapper\n id=\"vgs-expiration-date\"\n label=\"Expiration date\"\n fieldState={vgsFieldState[\"card_exp\"]}\n />\n </div>\n <div className=\"flex-1\">\n <VgsInputWrapper\n id=\"vgs-cvc\"\n label=\"CVC\"\n fieldState={vgsFieldState[\"card_cvc\"]}\n />\n </div>\n </div>\n\n <VgsInputWrapper\n id=\"vgs-card-holder\"\n label=\"Cardholder name\"\n fieldState={vgsFieldState[\"card_holder\"]}\n />\n\n {networkError && networkError.trim().length > 0 && (\n <div className=\"bg-destructive/10 text-destructive rounded-md p-3 text-sm\">\n {networkError}\n </div>\n )}\n </div>\n );\n}\n\nfunction formatAddressOneLine(addr: fluidPay.CustomerAddress): string {\n const cityStateZip = [addr.city, addr.state, addr.postal_code]\n .filter((p): p is string => Boolean(p && p.trim().length > 0))\n .join(\", \");\n const parts = [\n addr.address1,\n addr.address2,\n cityStateZip,\n addr.country_code,\n ].filter((p): p is string => Boolean(p && p.trim().length > 0));\n return parts.join(\" • \");\n}\n\nfunction AddressSummaryCard({\n address,\n}: {\n address: fluidPay.CustomerAddress;\n}) {\n return (\n <div className=\"border-input bg-muted/30 rounded-md border p-3 text-sm break-words\">\n {address.name && <div className=\"font-medium\">{address.name}</div>}\n <div className=\"text-muted-foreground\">{address.address1}</div>\n {address.address2 && (\n <div className=\"text-muted-foreground\">{address.address2}</div>\n )}\n <div className=\"text-muted-foreground\">\n {[address.city, address.state].filter(Boolean).join(\", \")}\n {address.postal_code ? ` ${address.postal_code}` : \"\"}\n </div>\n {address.country_code && (\n <div className=\"text-muted-foreground\">{address.country_code}</div>\n )}\n </div>\n );\n}\n\nexport default function CreditCardFormDialog({\n isOpen,\n onClose,\n onSubmit,\n isSubmitting,\n error,\n jwt,\n shippingAddress,\n savedAddresses = [],\n defaultBillingAddressId,\n renderAddressFormDialog,\n t,\n}: CreditCardFormDialogProps): JSX.Element {\n const api = useFluidPayApi();\n const [cardError, setCardError] = useState<string | undefined>(undefined);\n const [isVgsSubmitting, setIsVgsSubmitting] = useState(false);\n const [createdAddresses, setCreatedAddresses] = useState<\n fluidPay.CustomerAddress[]\n >([]);\n const [isAddressDialogOpen, setIsAddressDialogOpen] = useState(false);\n\n const {\n isFormReady,\n isLoading: isVgsLoading,\n isScriptLoaded,\n scriptLoadError,\n initializeForm,\n submitCard,\n vgsFieldState,\n resetVgs,\n onSuccessRef,\n onErrorRef,\n } = useVgsCollect();\n\n const shippingId = shippingAddress?.id ?? null;\n const dedupedSavedAddresses = useMemo(\n () =>\n shippingId === null\n ? savedAddresses\n : savedAddresses.filter((a) => a.id !== shippingId),\n [savedAddresses, shippingId],\n );\n\n const allAddresses = useMemo<fluidPay.CustomerAddress[]>(() => {\n const list: fluidPay.CustomerAddress[] = [];\n if (shippingAddress) list.push(shippingAddress);\n list.push(...dedupedSavedAddresses);\n list.push(...createdAddresses);\n return list;\n }, [shippingAddress, dedupedSavedAddresses, createdAddresses]);\n\n const hasRealAddresses = allAddresses.length > 0;\n\n // Default selection per ticket: shipping → default billing → first saved → \"use different\".\n const initialSelection = useMemo<string>(() => {\n if (shippingAddress) return shippingAddress.id.toString();\n if (\n defaultBillingAddressId &&\n dedupedSavedAddresses.some((a) => a.id === defaultBillingAddressId)\n ) {\n return defaultBillingAddressId.toString();\n }\n const first = dedupedSavedAddresses[0];\n if (first) return first.id.toString();\n return SENTINEL_CREATE_NEW;\n }, [shippingAddress, defaultBillingAddressId, dedupedSavedAddresses]);\n\n const { control, handleSubmit, reset, setValue, watch } =\n useZodForm<FormData>(formSchema, {\n defaultValues: {\n billing_address_selection: initialSelection,\n set_as_default: false,\n },\n });\n\n // Reset the form whenever the dialog (re)opens or the upstream address list\n // changes — the initial selection depends on shipping/saved/default props.\n useEffect(() => {\n if (isOpen) {\n reset({\n billing_address_selection: initialSelection,\n set_as_default: false,\n });\n setCreatedAddresses([]);\n }\n }, [isOpen, initialSelection, reset]);\n\n const currentSelection = watch(\"billing_address_selection\");\n const setAsDefault = watch(\"set_as_default\");\n\n const selectedAddress = useMemo(() => {\n if (!currentSelection || currentSelection === SENTINEL_CREATE_NEW) {\n return null;\n }\n const id = Number(currentSelection);\n if (!Number.isFinite(id)) return null;\n return allAddresses.find((a) => a.id === id) ?? null;\n }, [currentSelection, allAddresses]);\n\n const selectOptions = useMemo(() => {\n const options: { name: string; value: string }[] = [];\n if (shippingAddress) {\n options.push({\n name: t(\"same_as_shipping\"),\n value: shippingAddress.id.toString(),\n });\n }\n for (const addr of dedupedSavedAddresses) {\n options.push({\n name: formatAddressOneLine(addr),\n value: addr.id.toString(),\n });\n }\n for (const addr of createdAddresses) {\n options.push({\n name: formatAddressOneLine(addr),\n value: addr.id.toString(),\n });\n }\n options.push({\n name: t(\"use_a_different_address\"),\n value: SENTINEL_CREATE_NEW,\n });\n return options;\n }, [shippingAddress, dedupedSavedAddresses, createdAddresses, t]);\n\n const handleSelectionChange = useCallback(\n (value: string) => {\n if (value === SENTINEL_CREATE_NEW) {\n // Don't commit the sentinel to form state — opening the sub-modal is\n // the action. The form's previous selection remains intact so closing\n // the sub-modal without saving leaves the dropdown unchanged.\n setIsAddressDialogOpen(true);\n return;\n }\n setValue(\"billing_address_selection\", value, { shouldValidate: true });\n },\n [setValue],\n );\n\n const handleAddressCreated = useCallback(\n (address: fluidPay.CustomerAddress) => {\n setCreatedAddresses((list) => [...list, address]);\n setValue(\"billing_address_selection\", address.id.toString(), {\n shouldValidate: true,\n });\n setIsAddressDialogOpen(false);\n },\n [setValue],\n );\n\n const handleVgsSuccess = useCallback(\n (response: fluidPay.VgsCollectSubmitResponse) => {\n const expValue = response?.card_exp;\n if (!expValue) {\n setCardError(\"Missing expiration date from payment form\");\n setIsVgsSubmitting(false);\n return;\n }\n\n const cleanExp = expValue.replace(/\\s+/g, \"\");\n const [expMonth, expYearShort] = cleanExp.split(\"/\");\n\n if (!expMonth || !expYearShort) {\n setCardError(\"Invalid expiration date format\");\n setIsVgsSubmitting(false);\n return;\n }\n\n const expYear =\n expYearShort.length === 2 ? `20${expYearShort}` : expYearShort;\n\n const cardholderName = response?.card_holder?.trim();\n if (!cardholderName) {\n setCardError(\"Cardholder name is required\");\n setIsVgsSubmitting(false);\n return;\n }\n\n handleSubmit(\n (formData) => {\n const billingAddressId = Number(formData.billing_address_selection);\n if (!Number.isFinite(billingAddressId)) {\n setCardError(\"Please select a billing address.\");\n setIsVgsSubmitting(false);\n return;\n }\n\n onSubmit({\n set_as_default: formData.set_as_default,\n payment_method: {\n token: response.card_number,\n cvv_token: response.card_cvc,\n exp_month: expMonth,\n exp_year: expYear,\n card_holder: cardholderName,\n },\n billing_address_id: billingAddressId,\n });\n setIsVgsSubmitting(false);\n },\n () => {\n setCardError(\"Please select a billing address.\");\n setIsVgsSubmitting(false);\n },\n )();\n },\n [handleSubmit, onSubmit],\n );\n\n const handleVgsError = useCallback((err: string) => {\n setCardError(err);\n setIsVgsSubmitting(false);\n }, []);\n\n useEffect(() => {\n onSuccessRef.current = handleVgsSuccess;\n onErrorRef.current = handleVgsError;\n }, [handleVgsSuccess, handleVgsError, onSuccessRef, onErrorRef]);\n\n useEffect(() => {\n if (!isOpen || !isScriptLoaded) return;\n\n let cancelled = false;\n\n const init = async () => {\n try {\n const credentials = await api.vault.fetchCredentials(jwt);\n if (!cancelled) {\n await initializeForm(credentials);\n }\n } catch (err) {\n console.error(\"Failed to fetch vault credentials:\", err);\n if (!cancelled) {\n setCardError(\"Failed to initialize payment form\");\n }\n }\n };\n\n init();\n\n return () => {\n cancelled = true;\n };\n }, [isOpen, isScriptLoaded, jwt, api, initializeForm]);\n\n const handleClose = () => {\n resetVgs();\n reset();\n setCardError(undefined);\n setIsVgsSubmitting(false);\n setIsAddressDialogOpen(false);\n onClose();\n };\n\n const handleFormSubmit = handleSubmit(() => {\n setIsVgsSubmitting(true);\n setCardError(undefined);\n submitCard();\n });\n\n const isBusy = isSubmitting || isVgsSubmitting;\n\n return (\n <>\n <Dialog open={isOpen} onOpenChange={(open) => !open && handleClose()}>\n <DialogContent className=\"max-h-[90vh] max-w-md overflow-y-auto p-0 md:max-w-xl\">\n <div className=\"relative min-w-0 p-6\">\n {(isVgsLoading || !isFormReady) && !scriptLoadError && (\n <div className=\"bg-background/80 absolute inset-0 z-10 flex items-center justify-center rounded backdrop-blur-[1px]\">\n <div className=\"flex items-center justify-center\">\n <div className=\"border-primary mr-3 h-5 w-5 animate-spin rounded-full border-2 border-t-2 border-t-transparent\" />\n <p className=\"text-muted-foreground text-sm font-medium\">\n {t(\"securing\")}\n </p>\n </div>\n </div>\n )}\n <DialogHeader>\n <DialogTitle>{t(\"add_credit_card\")}</DialogTitle>\n </DialogHeader>\n\n <div className=\"space-y-4 pt-6\">\n <VgsCardForm\n vgsFieldState={vgsFieldState}\n networkError={cardError ?? scriptLoadError ?? error}\n />\n\n <div className=\"space-y-3 pt-2\">\n <h3 className=\"text-muted-foreground text-sm font-medium\">\n {t(\"billing_address\")}\n </h3>\n {hasRealAddresses ? (\n <Controller\n control={control}\n name=\"billing_address_selection\"\n render={({\n field: { value },\n fieldState: { error: fieldError },\n }) => (\n <div className=\"space-y-1\">\n <Label\n htmlFor=\"billing-address-selection\"\n className=\"mb-1.5 block text-sm font-medium\"\n >\n {t(\"billing_address\")}\n </Label>\n <Select\n value={value}\n onValueChange={handleSelectionChange}\n disabled={isBusy}\n >\n <SelectTrigger\n id=\"billing-address-selection\"\n aria-invalid={!!fieldError}\n className=\"w-full min-w-0 [&>span]:block! [&>span]:min-w-0 [&>span]:truncate\"\n >\n <SelectValue placeholder={t(\"select_an_option\")} />\n </SelectTrigger>\n <SelectContent>\n {selectOptions.map((opt) => (\n <SelectItem\n key={opt.value}\n value={opt.value}\n // Radix Select fires onValueChange only when the value\n // *changes*. Picking the already-selected sentinel\n // would otherwise be a no-op, leaving the user with\n // no way to reopen the address form.\n onClick={\n opt.value === SENTINEL_CREATE_NEW\n ? () => setIsAddressDialogOpen(true)\n : undefined\n }\n >\n {opt.name}\n </SelectItem>\n ))}\n </SelectContent>\n </Select>\n {fieldError?.message && (\n <p className=\"text-destructive text-sm\">\n {fieldError.message}\n </p>\n )}\n </div>\n )}\n />\n ) : (\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setIsAddressDialogOpen(true)}\n disabled={isBusy}\n className=\"w-full\"\n >\n {t(\"add_billing_address\")}\n </Button>\n )}\n\n {selectedAddress && (\n <AddressSummaryCard address={selectedAddress} />\n )}\n </div>\n </div>\n\n <div className=\"mt-4 flex items-center justify-between\">\n <div className=\"flex items-center space-x-2\">\n <input\n type=\"checkbox\"\n id=\"set_as_default_cc\"\n checked={setAsDefault}\n onChange={() => setValue(\"set_as_default\", !setAsDefault)}\n disabled={isBusy}\n className=\"h-4 w-4\"\n />\n <label htmlFor=\"set_as_default_cc\" className=\"text-sm\">\n {t(\"set_as_default_payment_method\")}\n </label>\n </div>\n\n <Button\n type=\"button\"\n onClick={handleFormSubmit}\n disabled={isBusy}\n >\n {isBusy && (\n <div className=\"mr-2 h-4 w-4 animate-spin rounded-full border-2 border-current/30 border-t-current\" />\n )}\n {isBusy ? t(\"saving\") : t(\"save_card\")}\n </Button>\n </div>\n </div>\n </DialogContent>\n </Dialog>\n\n {renderAddressFormDialog?.({\n isOpen: isAddressDialogOpen,\n onClose: () => setIsAddressDialogOpen(false),\n onAddressCreated: handleAddressCreated,\n })}\n </>\n );\n}\n","import { type FluidPayApi, type fluidPay } from \"@fluid-app/fluid-pay-core\";\nimport type { PayApi } from \"@fluid-app/portal-core/pay-api\";\nimport type { PayPaymentMethod } from \"@fluid-app/portal-core/pay-types\";\n\n/**\n * Maps a portal-tenant PayPaymentMethod to the fluidPay shape consumed by\n * profile-ui components (PaymentMethodDropdown, CreditCardFormDialog, etc.).\n * Co-located with the adapter because both speak the portal-tenant ↔ fluid-pay\n * boundary.\n */\nexport function mapToFluidPayPaymentMethod(\n raw: PayPaymentMethod,\n): fluidPay.CustomerPaymentMethod {\n return {\n id: raw.id,\n created_at: raw.created_at ?? \"\",\n default: raw.default,\n details: {\n card_type: raw.brand,\n card_brand: raw.brand,\n last_four: raw.last_four,\n exp_month: raw.exp_month ?? undefined,\n exp_year: raw.exp_year ?? undefined,\n },\n billing_address: raw.billing_address\n ? {\n name: raw.billing_address.name,\n address1: raw.billing_address.street1,\n address2: raw.billing_address.street2,\n city: raw.billing_address.city,\n state: raw.billing_address.state,\n zip: raw.billing_address.zip,\n country_code: raw.billing_address.country,\n }\n : null,\n payment_type: raw.type,\n source: \"\",\n updated_at: raw.updated_at ?? \"\",\n };\n}\n\nconst notImplemented = () => {\n throw new Error(\"Not available in portal-tenant context\");\n};\n\n/**\n * Adapts the portal-tenant PayApi to the FluidPayApi shape required by\n * FluidPayCoreProvider. Only `vault.fetchCredentials` is implemented —\n * the rest of the FluidPayApi surface is not used by the profile-ui\n * components that consume this provider in the portal context.\n */\nexport function createFluidPayApiAdapter(payApi: PayApi): FluidPayApi {\n return {\n customers: { fetchAccount: notImplemented, update: notImplemented },\n addresses: {\n fetchAll: notImplemented,\n create: notImplemented,\n update: notImplemented,\n delete: notImplemented,\n },\n paymentMethods: {\n fetchAll: notImplemented,\n addCreditCard: notImplemented,\n delete: notImplemented,\n updateDefault: notImplemented,\n update: notImplemented,\n },\n vault: {\n fetchCredentials: async () => {\n const response = await payApi.fetchVaultCredentials();\n return {\n vault: {\n vault_id: response.vault.vault_id,\n environment: response.vault.environment,\n route_id: response.vault.route_id ?? \"\",\n requires_3ds: false,\n },\n meta: {\n request_id: response.meta?.request_id ?? \"\",\n timestamp: response.meta?.timestamp ?? \"\",\n },\n } satisfies fluidPay.VaultResponse;\n },\n },\n };\n}\n","import {\n useCallback,\n useEffect,\n useMemo,\n useRef,\n useState,\n type ChangeEvent,\n type JSX,\n} from \"react\";\nimport {\n useController,\n type Control,\n type FieldValues,\n type Path,\n type PathValue,\n type UseFormSetValue,\n} from \"react-hook-form\";\nimport { Input } from \"@fluid-app/ui-primitives\";\nimport { useAddressAutocompleteApi } from \"../api-context\";\nimport type { AddressDetails, AddressSuggestion } from \"../api\";\n\nexport interface AddressAutocompleteInputProps<T extends FieldValues> {\n readonly control: Control<T>;\n readonly setValue: UseFormSetValue<T>;\n readonly countryIso: string;\n readonly addressLineField: Path<T>;\n readonly cityField: Path<T>;\n readonly stateField: Path<T>;\n readonly postalCodeField: Path<T>;\n readonly placeholder?: string;\n readonly disabled?: boolean;\n}\n\nconst SET_OPTS = {\n shouldValidate: true,\n shouldDirty: true,\n shouldTouch: true,\n} as const;\n\nconst DEBOUNCE_MS = 250;\n\nexport function AddressAutocompleteInput<T extends FieldValues>({\n control,\n setValue,\n countryIso,\n addressLineField,\n cityField,\n stateField,\n postalCodeField,\n placeholder = \"Start typing your address...\",\n disabled,\n}: AddressAutocompleteInputProps<T>): JSX.Element {\n const api = useAddressAutocompleteApi();\n const { field } = useController({ name: addressLineField, control });\n const [suggestions, setSuggestions] = useState<readonly AddressSuggestion[]>(\n [],\n );\n const [isOpen, setIsOpen] = useState(false);\n const [needsCountry, setNeedsCountry] = useState(false);\n const containerRef = useRef<HTMLDivElement | null>(null);\n // Monotonically increasing request ID. We only apply a fetch result when its\n // ID still matches the latest issued one — guards against stale responses\n // arriving out of order under network jitter.\n const requestIdRef = useRef(0);\n const debounceTimerRef = useRef<ReturnType<typeof setTimeout> | null>(null);\n const isCountrySelected = useMemo(\n () => Boolean(countryIso && countryIso.trim() !== \"\"),\n [countryIso],\n );\n\n useEffect(() => {\n function onClickOutside(e: MouseEvent) {\n if (\n containerRef.current &&\n !containerRef.current.contains(e.target as Node)\n ) {\n setIsOpen(false);\n setNeedsCountry(false);\n }\n }\n document.addEventListener(\"mousedown\", onClickOutside);\n return () => document.removeEventListener(\"mousedown\", onClickOutside);\n }, []);\n\n useEffect(\n () => () => {\n if (debounceTimerRef.current !== null) {\n clearTimeout(debounceTimerRef.current);\n }\n },\n [],\n );\n\n const populate = useCallback(\n (s: AddressDetails) => {\n setValue(\n addressLineField,\n s.streetLine as PathValue<T, Path<T>>,\n SET_OPTS,\n );\n setValue(cityField, s.city as PathValue<T, Path<T>>, SET_OPTS);\n setValue(stateField, s.state as PathValue<T, Path<T>>, SET_OPTS);\n setValue(\n postalCodeField,\n s.postalCode as PathValue<T, Path<T>>,\n SET_OPTS,\n );\n },\n [addressLineField, cityField, postalCodeField, setValue, stateField],\n );\n\n const handleChange = useCallback(\n (e: ChangeEvent<HTMLInputElement>) => {\n const value = e.target.value;\n field.onChange(value);\n\n // Cancel any pending fetch from a prior keystroke.\n if (debounceTimerRef.current !== null) {\n clearTimeout(debounceTimerRef.current);\n debounceTimerRef.current = null;\n }\n\n if (value.length < 1) {\n setIsOpen(false);\n setNeedsCountry(false);\n setSuggestions([]);\n return;\n }\n if (!isCountrySelected) {\n setNeedsCountry(true);\n setIsOpen(true);\n return;\n }\n setNeedsCountry(false);\n\n const requestId = ++requestIdRef.current;\n debounceTimerRef.current = setTimeout(() => {\n debounceTimerRef.current = null;\n void api.fetchSuggestions({ query: value, countryIso }).then((next) => {\n // Drop stale responses — a newer keystroke has already issued a\n // request, and applying this would clobber its result.\n if (requestId !== requestIdRef.current) return;\n setSuggestions(next);\n setIsOpen(true);\n });\n }, DEBOUNCE_MS);\n },\n [api, countryIso, field, isCountrySelected],\n );\n\n const handleClick = useCallback(\n async (suggestion: AddressSuggestion) => {\n // Cancel any debounced fetch still pending from a recent keystroke and\n // advance the request ID so any in-flight response is dropped — without\n // this, the timer could fire after a selection and re-open the dropdown.\n if (debounceTimerRef.current !== null) {\n clearTimeout(debounceTimerRef.current);\n debounceTimerRef.current = null;\n }\n const clickId = ++requestIdRef.current;\n\n if (!suggestion.needsDetailLookup) {\n populate({\n streetLine: suggestion.streetLine ?? suggestion.text,\n city: suggestion.city ?? \"\",\n state: suggestion.state ?? \"\",\n postalCode: suggestion.postalCode ?? \"\",\n });\n setIsOpen(false);\n return;\n }\n const { details, drilldownSuggestions } = await api.fetchDetails({\n suggestion,\n countryIso,\n });\n // Drop the result if the user typed during the network round-trip — a\n // newer keystroke has superseded this click and applying its result\n // would clobber what the user has since entered.\n if (clickId !== requestIdRef.current) return;\n if (details) {\n populate(details);\n setIsOpen(false);\n return;\n }\n setSuggestions(drilldownSuggestions);\n setIsOpen(true);\n },\n [api, countryIso, populate],\n );\n\n return (\n <div ref={containerRef} className=\"relative\">\n <Input\n type=\"text\"\n ref={field.ref}\n value={(field.value as string) ?? \"\"}\n onChange={handleChange}\n onBlur={field.onBlur}\n placeholder={placeholder}\n disabled={disabled}\n />\n {isOpen && needsCountry && (\n <div className=\"bg-muted text-foreground absolute z-50 mt-1 w-full rounded-md px-3 py-2 text-sm shadow-lg\">\n Please select a country first to enable address suggestions\n </div>\n )}\n {isOpen && !needsCountry && suggestions.length > 0 && (\n <div className=\"bg-background text-foreground border-border absolute z-50 mt-1 max-h-60 w-full overflow-y-auto rounded-md border shadow-lg\">\n {suggestions.map((s) => (\n <button\n key={s.id}\n type=\"button\"\n onClick={() => {\n void handleClick(s).catch((err) => {\n // handleClick is async because of fetchDetails — the current\n // Smarty adapter and NULL_API swallow errors, so this is\n // belt-and-suspenders for future adapters that might throw.\n console.error(\"Address autocomplete click failed:\", err);\n });\n }}\n className=\"hover:bg-muted block w-full cursor-pointer px-3 py-2 text-left text-sm\"\n >\n {s.text}\n {s.needsDetailLookup ? \" →\" : \"\"}\n </button>\n ))}\n </div>\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;AAKA,MAAM,EAAE,UAAU,iBAAiB,mBACjC,yBAAsC,UAAU;AAElD,MAAa,6BACX;AACF,MAAa,wBAAwB;;;AEFrC,MAAa,gBACX,yBAAsC;CACpC,UDVqB;EACvB,YAAY;EACZ,cAAc;EACd,YAAY;EACZ,WAAW;EACX,cAAc;EACd,KAAK;EACL,iBAAiB;EACjB,UAAU;EACV,wBAAwB;EACxB,uBAAuB;EACvB,sBAAsB;EACtB,QAAQ;EACR,cAAc;EACd,kBAAkB;EAClB,gBAAgB;EAChB,kBAAkB;EAClB,gBAAgB;EAChB,iBAAiB;EACjB,aAAa;EACb,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AAkC;AAIvC,MAAI,iBAAiB,YAAY,MAAM;AACrC,gBAAa,iBAAiB,QAAQ;AACtC,oBAAiB,UAAU;;EAE7B,MAAM,UAAU,EAAE,aAAa;AAE/B,MAAI,CAAC,WAAW,mBAAmB;AACjC,YAAS;IACP,YAAY,WAAW,cAAc,WAAW;IAChD,MAAM,WAAW,QAAQ;IACzB,OAAO,WAAW,SAAS;IAC3B,YAAY,WAAW,cAAc;IACtC,CAAC;AACF,aAAU,MAAM;AAChB;;EAEF,MAAM,EAAE,SAAS,yBAAyB,MAAM,IAAI,aAAa;GAC/D;GACA;GACD,CAAC;AAIF,MAAI,YAAY,aAAa,QAAS;AACtC,MAAI,SAAS;AACX,YAAS,QAAQ;AACjB,aAAU,MAAM;AAChB;;AAEF,iBAAe,qBAAqB;AACpC,YAAU,KAAK;IAEjB;EAAC;EAAK;EAAY;EAAS,CAC5B;AAED,QACE,qBAAC,OAAD;EAAK,KAAK;EAAc,WAAU;YAAlC;GACE,oBAAC,OAAD;IACE,MAAK;IACL,KAAK,MAAM;IACX,OAAQ,MAAM,SAAoB;IAClC,UAAU;IACV,QAAQ,MAAM;IACD;IACH;IACV,CAAA;GACD,UAAU,gBACT,oBAAC,OAAD;IAAK,WAAU;cAA4F;IAErG,CAAA;GAEP,UAAU,CAAC,gBAAgB,YAAY,SAAS,KAC/C,oBAAC,OAAD;IAAK,WAAU;cACZ,YAAY,KAAK,MAChB,qBAAC,UAAD;KAEE,MAAK;KACL,eAAe;AACR,kBAAY,EAAE,CAAC,OAAO,QAAQ;AAIjC,eAAQ,MAAM,sCAAsC,IAAI;QACxD;;KAEJ,WAAU;eAXZ,CAaG,EAAE,MACF,EAAE,oBAAoB,OAAO,GACvB;OAdF,EAAE,GAcA,CACT;IACE,CAAA;GAEJ"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"ProfileScreen-C7scpZZH.mjs","names":[],"sources":["../src/screens/profile/derive-last-name.ts","../src/screens/profile/ProfileLayout.tsx","../src/screens/ProfileContentScreen.tsx","../src/screens/ProfileScreen.tsx"],"sourcesContent":["export function deriveLastName(firstName: string, fullName: string): string {\n if (!firstName) return \"\";\n const prefix = `${firstName} `;\n return fullName.startsWith(prefix) ? fullName.slice(prefix.length) : \"\";\n}\n","import { type JSX, type ReactNode, useState, type ComponentType } from \"react\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogTitle,\n} from \"@fluid-app/ui-primitives\";\nimport {\n Sparkles,\n Pencil,\n Plus,\n Copy,\n Link2,\n MapPin,\n User,\n Mail,\n Phone,\n Quote,\n Linkedin,\n Facebook,\n Twitter,\n Instagram,\n Youtube,\n Globe,\n LogOut,\n} from \"lucide-react\";\nimport type { fluidPay } from \"@fluid-app/fluid-pay-core\";\nimport type { PointsLedger } from \"@fluid-app/profile-core\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\nimport { EllipsesDropdown } from \"@fluid-app/profile-ui\";\nimport type { AccountRep } from \"@fluid-app/portal-core/account-types\";\n\ninterface ProfileLayoutProps {\n account: AccountRep;\n pointsBalance: number | undefined;\n pointsLedger?: PointsLedger[];\n rewardsEnabled?: boolean;\n addresses: fluidPay.CustomerAddress[];\n paymentMethods: fluidPay.CustomerPaymentMethod[];\n mySiteDisplayUrl: string;\n socialLinks: Partial<Record<SocialKey, string>>;\n onEditPersonalInfo: () => void;\n onAddAddress: () => void;\n onEditAddress: (address: fluidPay.CustomerAddress) => void;\n onDeleteAddress: (address: fluidPay.CustomerAddress) => void;\n onAddPaymentMethod: () => void;\n onEditPaymentMethod: (method: fluidPay.CustomerPaymentMethod) => void;\n onCopyMySiteLink: () => void;\n onEditMySiteLink?: () => void;\n onConnectSocial: (key: SocialKey) => void;\n onSignOut?: () => void;\n}\n\nexport function ProfileLayout(props: ProfileLayoutProps): JSX.Element {\n const { t } = useProfileTranslation();\n const {\n account,\n pointsBalance,\n pointsLedger,\n rewardsEnabled,\n addresses,\n paymentMethods,\n mySiteDisplayUrl,\n socialLinks,\n onEditPersonalInfo,\n onAddAddress,\n onEditAddress,\n onDeleteAddress,\n onAddPaymentMethod,\n onEditPaymentMethod,\n onCopyMySiteLink,\n onEditMySiteLink,\n onConnectSocial,\n onSignOut,\n } = props;\n\n const fullName =\n `${account.first_name ?? \"\"} ${account.last_name ?? \"\"}`.trim();\n const heroFirstName = (account.first_name || \"\").trim().split(\" \")[0] || \"\";\n const heroDisplay =\n heroFirstName || account.email?.split(\"@\")[0] || t(\"account_fallback\");\n const connectedSocialCount = Object.values(socialLinks).filter(\n (v) => typeof v === \"string\" && v.length > 0,\n ).length;\n const [isPointsHistoryOpen, setIsPointsHistoryOpen] = useState(false);\n const POINTS_PREVIEW_COUNT = 4;\n const ledger = pointsLedger ?? [];\n const ledgerPreview = ledger.slice(0, POINTS_PREVIEW_COUNT);\n const hasMoreLedger = ledger.length > POINTS_PREVIEW_COUNT;\n\n return (\n <div className=\"relative\">\n <div className=\"relative mx-auto max-w-4xl px-5 pt-8 pb-20 md:px-8\">\n {/* Hero */}\n <section className=\"flex items-center gap-3.5\">\n <div className=\"relative size-12 shrink-0 overflow-hidden rounded-full ring-1 ring-black/5 md:size-13\">\n {account.avatar_url ? (\n <img\n src={account.avatar_url}\n alt=\"\"\n className=\"h-full w-full object-cover\"\n />\n ) : (\n <div className=\"bg-primary text-primary-foreground flex h-full w-full items-center justify-center text-lg font-semibold\">\n {heroDisplay.charAt(0).toUpperCase()}\n </div>\n )}\n </div>\n <div className=\"min-w-0 flex-1\">\n <h1 className=\"text-foreground truncate text-xl font-bold tracking-tight md:text-2xl\">\n {heroDisplay}\n </h1>\n <p className=\"text-muted-foreground mt-0.5 truncate text-sm\">\n {account.email}\n </p>\n </div>\n <div className=\"flex shrink-0 items-center gap-2\">\n {rewardsEnabled && (\n <div className=\"ring-border text-foreground inline-flex items-center gap-1.5 rounded-md bg-transparent px-2.5 py-1 text-xs font-semibold ring-1\">\n <Sparkles className=\"text-primary size-3\" strokeWidth={2.25} />\n {(pointsBalance ?? 0).toLocaleString()} {t(\"pts\")}\n </div>\n )}\n </div>\n </section>\n\n {/* Personal information */}\n <SectionHeader\n title={t(\"personal_information\")}\n action={\n <PillButton\n onClick={onEditPersonalInfo}\n icon={Pencil}\n label={t(\"edit\")}\n />\n }\n />\n <div className=\"ring-border mt-2.5 overflow-hidden rounded-2xl bg-transparent ring-1\">\n <FieldRow\n icon={User}\n label={t(\"name\")}\n value={fullName || account.first_name || \"\"}\n />\n <FieldRow\n icon={Mail}\n label={t(\"email\")}\n value={account.email ?? \"\"}\n />\n <FieldRow\n icon={Phone}\n label={t(\"phone\")}\n value={account.phone ?? \"\"}\n placeholder={t(\"add_phone_number\")}\n />\n <FieldRow\n icon={Quote}\n label={t(\"bio\")}\n value={account.bio ?? \"\"}\n placeholder={t(\"add_a_short_bio\")}\n multiline\n isLast\n />\n </div>\n\n {/* Payment methods */}\n <SectionHeader title={t(\"payment_methods\")} />\n <div className=\"mt-2.5 grid grid-cols-1 gap-2.5 sm:grid-cols-3\">\n {paymentMethods.map((method) => (\n <PaymentCardVisual\n key={method.id}\n method={method}\n onClick={() => onEditPaymentMethod(method)}\n />\n ))}\n <AddPaymentTile onClick={onAddPaymentMethod} />\n </div>\n\n {/* Points history */}\n {rewardsEnabled && (\n <>\n <SectionHeader\n title={t(\"points_history\")}\n action={\n <span className=\"text-muted-foreground/75 text-xs\">\n {t(\"pts_available\", {\n count: String((pointsBalance ?? 0).toLocaleString()),\n })}\n </span>\n }\n />\n {ledger.length > 0 ? (\n <div className=\"ring-border mt-2.5 overflow-hidden rounded-2xl bg-transparent ring-1\">\n {ledgerPreview.map((entry, i) => (\n <PointsLedgerRow\n key={entry.id}\n entry={entry}\n isLast={!hasMoreLedger && i === ledgerPreview.length - 1}\n />\n ))}\n {hasMoreLedger && (\n <button\n type=\"button\"\n onClick={() => setIsPointsHistoryOpen(true)}\n className=\"text-foreground hover:bg-muted flex w-full items-center justify-center gap-1 px-4 py-3 text-xs font-bold transition-colors\"\n >\n {t(\"see_all_transactions\", { count: ledger.length })}\n </button>\n )}\n </div>\n ) : (\n <div className=\"ring-dashed ring-border mt-2.5 flex flex-col items-center justify-center gap-1 rounded-2xl bg-transparent px-4 py-8 text-center ring-1\">\n <Sparkles\n className=\"text-muted-foreground/75 size-5\"\n strokeWidth={1.75}\n />\n <div className=\"text-foreground text-sm font-bold\">\n {t(\"no_points_yet\")}\n </div>\n <div className=\"text-muted-foreground text-xs\">\n {t(\"earn_points_hint\")}\n </div>\n </div>\n )}\n </>\n )}\n\n {/* Your MySite link */}\n <SectionHeader\n title={t(\"your_mysite_link\")}\n action={\n onEditMySiteLink ? (\n <PillButton\n onClick={onEditMySiteLink}\n icon={Pencil}\n label={t(\"edit_link\")}\n />\n ) : undefined\n }\n />\n <div className=\"ring-border mt-2.5 flex items-center gap-3 rounded-2xl bg-transparent p-3.5 ring-1\">\n <div className=\"bg-muted text-foreground flex size-11 shrink-0 items-center justify-center rounded-full\">\n <Link2 className=\"size-[18px]\" strokeWidth={2} />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-muted-foreground/75 text-xs font-bold tracking-widest uppercase\">\n {t(\"public_link\")}\n </div>\n <div className=\"text-foreground mt-0.5 truncate font-mono text-sm font-semibold\">\n {mySiteDisplayUrl || t(\"set_your_mysite_link\")}\n </div>\n </div>\n <button\n type=\"button\"\n onClick={onCopyMySiteLink}\n disabled={!mySiteDisplayUrl}\n className=\"ring-border text-foreground hover:bg-muted inline-flex items-center gap-1 rounded-md bg-transparent px-3 py-1.5 text-xs font-bold ring-1 transition-all disabled:cursor-not-allowed disabled:opacity-40\"\n >\n <Copy className=\"size-3\" strokeWidth={2.25} />\n {t(\"copy\")}\n </button>\n </div>\n\n {/* Shipping addresses */}\n <SectionHeader title={t(\"shipping_addresses\")} />\n <div className=\"mt-2.5 grid grid-cols-1 gap-2.5 sm:grid-cols-2\">\n {addresses.map((address) => (\n <AddressCard\n key={address.id}\n address={address}\n onEdit={() => onEditAddress(address)}\n onDelete={\n address.default ? undefined : () => onDeleteAddress(address)\n }\n />\n ))}\n <AddAddressTile onClick={onAddAddress} />\n </div>\n\n {/* Social media */}\n <SectionHeader\n title={t(\"social_media\")}\n action={\n <span className=\"text-muted-foreground/75 text-xs\">\n {t(\"connected_count\", { count: connectedSocialCount })}\n </span>\n }\n />\n <div className=\"ring-border mt-2.5 overflow-hidden rounded-2xl bg-transparent ring-1\">\n {SOCIAL_ENTRIES.map((entry, i) => (\n <SocialRow\n key={entry.key}\n entry={entry}\n handle={socialLinks[entry.key] ?? \"\"}\n isLast={i === SOCIAL_ENTRIES.length - 1}\n onConnect={() => onConnectSocial(entry.key)}\n />\n ))}\n </div>\n\n <Dialog\n open={isPointsHistoryOpen}\n onOpenChange={setIsPointsHistoryOpen}\n >\n <DialogContent className=\"max-w-md md:max-w-lg\">\n <DialogHeader>\n <DialogTitle>{t(\"points_history\")}</DialogTitle>\n </DialogHeader>\n <div className=\"ring-border max-h-[60vh] overflow-y-auto rounded-2xl bg-transparent ring-1\">\n {ledger.map((entry, i) => (\n <PointsLedgerRow\n key={entry.id}\n entry={entry}\n isLast={i === ledger.length - 1}\n />\n ))}\n </div>\n </DialogContent>\n </Dialog>\n\n {onSignOut && (\n <div className=\"ring-border mt-8 flex flex-wrap items-center justify-between gap-3 rounded-2xl bg-transparent p-3.5 ring-1\">\n <div className=\"flex items-center gap-3\">\n <div className=\"bg-destructive/10 flex size-9 items-center justify-center rounded-md\">\n <LogOut\n className=\"text-destructive size-4\"\n strokeWidth={2.25}\n />\n </div>\n <div>\n <div className=\"text-foreground text-sm font-bold\">\n {t(\"sign_out\")}\n </div>\n <div className=\"text-muted-foreground text-xs\">\n {t(\"sign_out_description\")}\n </div>\n </div>\n </div>\n <button\n type=\"button\"\n onClick={onSignOut}\n className=\"bg-destructive/15 text-destructive hover:bg-destructive/25 rounded-md px-4 py-2 text-xs font-bold transition-colors\"\n >\n {t(\"sign_out\")}\n </button>\n </div>\n )}\n </div>\n </div>\n );\n}\n\nfunction SectionHeader({\n title,\n action,\n}: {\n title: string;\n action?: ReactNode;\n}): JSX.Element {\n return (\n <div className=\"mt-8 flex items-end justify-between\">\n <h2 className=\"text-foreground text-base font-bold tracking-tight\">\n {title}\n </h2>\n {action ?? null}\n </div>\n );\n}\n\nfunction PillButton({\n onClick,\n icon: Icon,\n label,\n disabled,\n}: {\n onClick: () => void;\n icon: ComponentType<{ className?: string; strokeWidth?: number }>;\n label: string;\n disabled?: boolean;\n}): JSX.Element {\n return (\n <button\n type=\"button\"\n onClick={onClick}\n disabled={disabled}\n className=\"ring-border text-foreground hover:bg-muted inline-flex items-center gap-1 rounded-md bg-transparent px-3 py-1.5 text-xs font-bold ring-1 transition-all disabled:cursor-not-allowed disabled:opacity-40\"\n >\n <Icon className=\"size-3\" strokeWidth={2.25} />\n {label}\n </button>\n );\n}\n\nfunction PointsLedgerRow({\n entry,\n isLast,\n}: {\n entry: PointsLedger;\n isLast: boolean;\n}): JSX.Element {\n const { t } = useProfileTranslation();\n const isCredit = entry.amount >= 0;\n const sign = isCredit ? \"+\" : \"−\";\n const magnitude = Math.abs(entry.amount).toLocaleString();\n const amountColor = isCredit ? \"text-emerald-600\" : \"text-destructive\";\n const sourceName = entry.metadata?.source?.name?.trim();\n const transactionType = entry.metadata?.transaction_type;\n const label =\n sourceName ||\n (transactionType\n ? transactionType.charAt(0).toUpperCase() + transactionType.slice(1)\n : isCredit\n ? t(\"points_awarded\")\n : t(\"points_redeemed\"));\n const dateLabel = formatLedgerDate(entry.created_at);\n return (\n <div\n className={`flex items-center gap-3 px-4 py-3.5 ${isLast ? \"\" : \"border-border border-b\"}`}\n >\n <div className=\"bg-muted flex size-9 shrink-0 items-center justify-center rounded-full\">\n <Sparkles\n className={`size-4 ${isCredit ? \"text-primary\" : \"text-muted-foreground\"}`}\n strokeWidth={2}\n />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-foreground truncate text-sm font-medium\">\n {label}\n </div>\n <div className=\"text-muted-foreground text-xs\">{dateLabel}</div>\n </div>\n <div\n className={`shrink-0 font-mono text-sm font-bold tabular-nums ${amountColor}`}\n >\n {sign}\n {magnitude}\n </div>\n </div>\n );\n}\n\nfunction formatLedgerDate(iso: string): string {\n try {\n const d = new Date(iso);\n return d.toLocaleDateString(undefined, {\n month: \"short\",\n day: \"numeric\",\n year: \"numeric\",\n });\n } catch {\n return iso;\n }\n}\n\nfunction FieldRow({\n icon: Icon,\n label,\n value,\n placeholder,\n isLast,\n multiline,\n}: {\n icon: ComponentType<{ className?: string; strokeWidth?: number }>;\n label: string;\n value: string;\n placeholder?: string;\n isLast?: boolean;\n multiline?: boolean;\n}): JSX.Element {\n const display = value || placeholder || \"\";\n const isPlaceholder = !value && Boolean(placeholder);\n const valueClasses = multiline ? \"whitespace-pre-line\" : \"truncate\";\n return (\n <div\n className={`flex gap-3 px-4 py-3.5 ${multiline ? \"items-start\" : \"items-center\"} ${isLast ? \"\" : \"border-border border-b\"}`}\n >\n <div className=\"bg-muted text-muted-foreground flex size-9 shrink-0 items-center justify-center rounded-full\">\n <Icon className=\"size-4\" strokeWidth={2} />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-muted-foreground/75 text-xs font-bold tracking-widest uppercase\">\n {label}\n </div>\n <div\n className={`mt-0.5 ${valueClasses} text-sm font-medium ${isPlaceholder ? \"text-muted-foreground/55\" : \"text-foreground\"}`}\n >\n {display}\n </div>\n </div>\n </div>\n );\n}\n\nconst CARD_BRAND_LABEL: Record<string, string> = {\n amex: \"AMERICAN EXPRESS\",\n visa: \"VISA\",\n mastercard: \"MASTERCARD\",\n discover: \"DISCOVER\",\n diners: \"DINERS CLUB\",\n jcb: \"JCB\",\n unionpay: \"UNIONPAY\",\n};\n\nconst CARD_BRAND_BADGE: Record<string, string> = {\n amex: \"AMEX\",\n visa: \"VISA\",\n mastercard: \"MC\",\n discover: \"DISC\",\n diners: \"DC\",\n jcb: \"JCB\",\n unionpay: \"UPI\",\n};\n\nfunction PaymentCardVisual({\n method,\n onClick,\n}: {\n method: fluidPay.CustomerPaymentMethod;\n onClick: () => void;\n}): JSX.Element {\n const { t } = useProfileTranslation();\n const brand = (method.details.card_brand || \"\").toLowerCase();\n const brandLabel =\n CARD_BRAND_LABEL[brand] || (brand ? brand.toUpperCase() : \"CARD\");\n const badge = CARD_BRAND_BADGE[brand] || \"CARD\";\n const last4 = method.details.last_four ?? \"••••\";\n const expMonth = String(method.details.exp_month ?? \"\").padStart(2, \"0\");\n const expYear = String(method.details.exp_year ?? \"\").slice(-2);\n const exp = expMonth && expYear ? `${expMonth}/${expYear}` : \"\";\n const holder = method.billing_address?.name ?? \"\";\n const badgeBg =\n brand === \"visa\"\n ? \"bg-[#1A1F71]\"\n : brand === \"mastercard\"\n ? \"bg-[#EB001B]\"\n : \"bg-[#0064D2]\";\n\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"group bg-foreground text-background ring-foreground/10 relative flex aspect-[1.586/1] flex-col justify-between overflow-hidden rounded-xl p-4 text-left shadow-sm ring-1 transition-all duration-200 hover:-translate-y-0.5 hover:shadow-lg\"\n >\n <div\n aria-hidden\n className=\"absolute inset-0 bg-[repeating-linear-gradient(135deg,transparent_0px,transparent_22px,currentColor_22px,currentColor_24px)] opacity-[0.04]\"\n />\n <div className=\"relative flex items-start justify-between\">\n <div>\n <div className=\"text-background/50 text-xs font-semibold tracking-widest uppercase\">\n {brandLabel}\n </div>\n <div className=\"text-background mt-1 font-mono text-xl font-bold tracking-wider\">\n {last4}\n </div>\n </div>\n {method.default && (\n <span className=\"bg-background/10 text-background/80 rounded-md px-2 py-0.5 text-xs font-bold tracking-wider uppercase\">\n {t(\"default\")}\n </span>\n )}\n </div>\n <div className=\"relative flex items-end justify-between gap-2\">\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-background/40 text-xs font-semibold tracking-widest uppercase\">\n {t(\"cardholder\")}\n </div>\n <div className=\"text-background truncate text-xs font-semibold\">\n {holder || \" \"}\n </div>\n </div>\n <div>\n <div className=\"text-background/40 text-xs font-semibold tracking-widest uppercase\">\n {t(\"card_expires\")}\n </div>\n <div className=\"text-background font-mono text-xs font-semibold\">\n {exp}\n </div>\n </div>\n <div\n className={`shrink-0 rounded px-1.5 py-0.5 text-xs font-bold tracking-wider text-white ${badgeBg}`}\n >\n {badge}\n </div>\n </div>\n </button>\n );\n}\n\nfunction AddPaymentTile({ onClick }: { onClick: () => void }): JSX.Element {\n const { t } = useProfileTranslation();\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"group ring-dashed ring-border text-muted-foreground hover:bg-background hover:text-foreground flex aspect-[1.586/1] flex-col items-center justify-center gap-1.5 rounded-xl bg-transparent ring-1 transition-colors\"\n >\n <div className=\"ring-border flex size-9 items-center justify-center rounded-full bg-transparent ring-1\">\n <Plus className=\"size-4\" strokeWidth={2.25} />\n </div>\n <div className=\"text-foreground text-xs font-bold\">\n {t(\"add_payment_method\")}\n </div>\n <div className=\"text-muted-foreground/75 text-xs\">\n {t(\"accepted_cards\")}\n </div>\n </button>\n );\n}\n\nfunction AddressCard({\n address,\n onEdit,\n onDelete,\n}: {\n address: fluidPay.CustomerAddress;\n onEdit: () => void;\n onDelete?: () => void;\n}): JSX.Element {\n const { t } = useProfileTranslation();\n const label = address.name?.trim() || t(\"address\");\n const cityLine = [address.city, address.state, address.postal_code]\n .filter(Boolean)\n .join(\", \");\n return (\n <div className=\"ring-border hover:bg-muted focus-within:ring-foreground/40 relative flex flex-col rounded-2xl bg-transparent ring-1 transition-all duration-200 focus-within:ring-2 hover:ring-2\">\n <button\n type=\"button\"\n onClick={onEdit}\n className=\"flex w-full flex-col rounded-2xl p-4 pr-12 text-left focus-visible:outline-none\"\n >\n <div className=\"flex items-start justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <div className=\"bg-muted flex size-8 items-center justify-center rounded-full\">\n <MapPin\n className=\"text-muted-foreground size-4\"\n strokeWidth={2}\n />\n </div>\n <div className=\"text-foreground text-sm font-bold\">{label}</div>\n </div>\n {address.default && (\n <span className=\"bg-primary text-primary-foreground rounded-md px-2 py-0.5 text-xs font-bold tracking-wider uppercase\">\n {t(\"default\")}\n </span>\n )}\n </div>\n <div className=\"text-foreground mt-3 space-y-0.5 text-sm leading-snug\">\n {address.address1 && <div>{address.address1}</div>}\n {address.address2 && <div>{address.address2}</div>}\n {cityLine && <div>{cityLine}</div>}\n {address.country_code && (\n <div className=\"text-muted-foreground\">{address.country_code}</div>\n )}\n </div>\n </button>\n {onDelete && (\n <div className=\"absolute top-2 right-2 z-10\">\n <EllipsesDropdown\n onEdit={onEdit}\n onDelete={onDelete}\n editLabel={t(\"edit\")}\n deleteLabel={t(\"delete\")}\n />\n </div>\n )}\n </div>\n );\n}\n\nfunction AddAddressTile({ onClick }: { onClick: () => void }): JSX.Element {\n const { t } = useProfileTranslation();\n return (\n <button\n type=\"button\"\n onClick={onClick}\n className=\"group ring-dashed ring-border text-muted-foreground hover:bg-background hover:text-foreground flex min-h-37 flex-col items-center justify-center gap-1.5 rounded-2xl bg-transparent ring-1 transition-colors\"\n >\n <div className=\"ring-border flex size-9 items-center justify-center rounded-full bg-transparent ring-1\">\n <Plus className=\"size-4\" strokeWidth={2.25} />\n </div>\n <div className=\"text-foreground text-sm font-bold\">\n {t(\"add_an_address\")}\n </div>\n </button>\n );\n}\n\ntype SocialKey =\n | \"linkedin\"\n | \"facebook\"\n | \"x\"\n | \"instagram\"\n | \"youtube\"\n | \"pinterest\"\n | \"tiktok\";\n\ninterface SocialEntry {\n key: SocialKey;\n label: string;\n icon: ComponentType<{ className?: string; strokeWidth?: number }>;\n placeholder: string;\n}\n\nconst SOCIAL_ENTRIES: readonly SocialEntry[] = [\n {\n key: \"linkedin\",\n label: \"LinkedIn\",\n icon: Linkedin,\n placeholder: \"linkedin.com/in/username\",\n },\n {\n key: \"facebook\",\n label: \"Facebook\",\n icon: Facebook,\n placeholder: \"facebook.com/username\",\n },\n { key: \"x\", label: \"X\", icon: Twitter, placeholder: \"x.com/username\" },\n {\n key: \"instagram\",\n label: \"Instagram\",\n icon: Instagram,\n placeholder: \"instagram.com/username\",\n },\n {\n key: \"youtube\",\n label: \"YouTube\",\n icon: Youtube,\n placeholder: \"youtube.com/@channel\",\n },\n {\n key: \"pinterest\",\n label: \"Pinterest\",\n icon: Globe,\n placeholder: \"pinterest.com/username\",\n },\n {\n key: \"tiktok\",\n label: \"TikTok\",\n icon: Globe,\n placeholder: \"tiktok.com/@username\",\n },\n] as const;\n\nfunction SocialRow({\n entry,\n handle,\n isLast,\n onConnect,\n}: {\n entry: SocialEntry;\n handle: string;\n isLast: boolean;\n onConnect: () => void;\n}): JSX.Element {\n const { t } = useProfileTranslation();\n const Icon = entry.icon;\n return (\n <div\n className={`flex items-center gap-3 px-4 py-3.5 ${isLast ? \"\" : \"border-border border-b\"}`}\n >\n <div className=\"bg-muted text-foreground flex size-9 shrink-0 items-center justify-center rounded-full\">\n <Icon className=\"size-4\" strokeWidth={2} />\n </div>\n <div className=\"min-w-0 flex-1\">\n <div className=\"text-foreground text-sm font-bold\">{entry.label}</div>\n <div\n className={`truncate text-xs ${handle ? \"text-muted-foreground\" : \"text-muted-foreground/55\"}`}\n >\n {handle || entry.placeholder}\n </div>\n </div>\n <PillButton\n onClick={onConnect}\n icon={handle ? Pencil : Plus}\n label={handle ? t(\"edit\") : t(\"connect\")}\n />\n </div>\n );\n}\n\nexport type { SocialKey };\n","import { useCallback, useMemo, useState } from \"react\";\nimport { z } from \"zod\";\nimport { useMutation, useQuery, useQueryClient } from \"@tanstack/react-query\";\nimport {\n Button,\n Dialog,\n DialogContent,\n DialogFooter,\n DialogHeader,\n DialogTitle,\n Input,\n Label,\n useZodForm,\n} from \"@fluid-app/ui-primitives\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\nimport type { Language, PointsLedger } from \"@fluid-app/profile-core\";\nimport {\n AddressFormDialog,\n ConfirmActionDialog,\n CreditCardFormDialog,\n EditPaymentMethodDialog,\n UserInfoDialog,\n socialFields,\n} from \"@fluid-app/profile-ui\";\nimport type {\n UserFormData,\n EditPaymentMethodFormData,\n CreditCardFormSubmitData,\n} from \"@fluid-app/profile-ui\";\nimport {\n FluidPayCoreProvider,\n type fluidPay,\n type State,\n} from \"@fluid-app/fluid-pay-core\";\nimport type { PayAddress } from \"@fluid-app/portal-core/pay-types\";\nimport {\n createFluidPayApiAdapter,\n mapToFluidPayPaymentMethod,\n} from \"../adapters/fluid-pay-api-adapter\";\nimport type { AccountRep } from \"@fluid-app/portal-core/account-types\";\nimport { useAccountApi } from \"@fluid-app/portal-core/account-api-context\";\nimport { usePayApi } from \"@fluid-app/portal-core/pay-api-context\";\nimport { usePortalMySiteProfile } from \"@fluid-app/mysite-ui/portal/hooks/use-mysite-portal\";\nimport { useCountriesApi } from \"@fluid-app/store-core/countries-api-context\";\nimport { useLanguagesApi } from \"@fluid-app/store-core/languages-api-context\";\nimport { AddressAutocompleteInput } from \"@fluid-app/address-autocomplete/components/AddressAutocompleteInput\";\nimport { accountKeys, payKeys, storeKeys } from \"../account/query-keys\";\nimport { useAccount } from \"../hooks/use-account\";\nimport { deriveLastName } from \"./profile/derive-last-name\";\nimport { ProfileLayout, type SocialKey } from \"./profile/ProfileLayout\";\n\ninterface ProfileContentScreenProps {\n onToast: (message: string, type: \"success\" | \"error\" | \"warning\") => void;\n countryIso: string;\n}\n\nfunction mapAccountToCustomerAccount(\n raw: AccountRep,\n): fluidPay.CustomerAccount {\n return {\n fluid_pay_account: {\n id: raw.id,\n email: raw.email,\n address_count: 0,\n payment_methods_count: 0,\n language_iso: null,\n },\n customer: {\n id: raw.id,\n active: true,\n active_subscriptions_count: 0,\n display_total_spent: \"0\",\n email: raw.email,\n first_name: raw.first_name,\n full_name: `${raw.first_name} ${raw.last_name}`.trim(),\n inactive_subscriptions_count: 0,\n is_rep: raw.member_type === \"rep\",\n phone: raw.phone,\n orders_count: 0,\n },\n };\n}\n\nfunction composeAddressName(\n firstName: string,\n lastName: string,\n): string | null {\n const combined = `${firstName} ${lastName}`.trim();\n return combined.length > 0 ? combined : null;\n}\n\nfunction mapToFluidPayAddress(raw: PayAddress): fluidPay.CustomerAddress {\n return {\n id: raw.id,\n address1: raw.street1,\n address2: raw.street2,\n city: raw.city,\n country_code: raw.country,\n default: raw.default,\n name: raw.name,\n postal_code: raw.zip,\n state: raw.state,\n subdivision_code: null,\n };\n}\n\ntype SocialFieldKey = (typeof socialFields)[number][\"name\"];\n\nconst SOCIAL_KEY_TO_FIELD: Record<SocialKey, SocialFieldKey | null> = {\n linkedin: \"linkedin\" as SocialFieldKey,\n facebook: \"facebook\" as SocialFieldKey,\n x: \"twitter\" as SocialFieldKey,\n instagram: \"instagram\" as SocialFieldKey,\n youtube: \"youtube\" as SocialFieldKey,\n pinterest: null,\n tiktok: \"tiktok\" as SocialFieldKey,\n};\n\nconst SOCIAL_LABELS: Record<SocialKey, string> = {\n linkedin: \"LinkedIn\",\n facebook: \"Facebook\",\n x: \"X\",\n instagram: \"Instagram\",\n youtube: \"YouTube\",\n pinterest: \"Pinterest\",\n tiktok: \"TikTok\",\n};\n\nconst SOCIAL_PLACEHOLDERS: Record<SocialKey, string> = {\n linkedin: \"linkedin.com/in/username\",\n facebook: \"facebook.com/username\",\n x: \"x.com/username\",\n instagram: \"instagram.com/username\",\n youtube: \"youtube.com/@channel\",\n pinterest: \"pinterest.com/username\",\n tiktok: \"tiktok.com/@username\",\n};\n\nexport function ProfileContentScreen({\n onToast,\n countryIso,\n}: ProfileContentScreenProps): React.JSX.Element {\n const { t } = useProfileTranslation();\n const payApi = usePayApi();\n const accountApi = useAccountApi();\n const queryClient = useQueryClient();\n const fluidPayShim = useMemo(\n () => createFluidPayApiAdapter(payApi),\n [payApi],\n );\n\n const { data: mySiteProfile } = usePortalMySiteProfile();\n\n const mySiteUrl = mySiteProfile?.mysite_url ?? \"\";\n const mySiteDisplayUrl = mySiteUrl\n ? mySiteUrl.replace(/^https?:\\/\\//, \"\")\n : \"\";\n\n // Reuse the app-wide useAccount() cache entry shared with AppShell/PageRouter.\n const {\n data: accountRep,\n isLoading: isLoadingAccount,\n isError: isAccountError,\n } = useAccount();\n\n const accountData = useMemo(\n () => (accountRep ? mapAccountToCustomerAccount(accountRep) : undefined),\n [accountRep],\n );\n\n const { data: addressesData } = useQuery({\n queryKey: payKeys.addresses.list(),\n queryFn: async () => {\n const response = await payApi.fetchAddresses();\n return response.addresses.map(mapToFluidPayAddress);\n },\n enabled: true,\n });\n\n const { data: paymentMethodsData } = useQuery({\n queryKey: payKeys.paymentMethods.list(),\n queryFn: async () => {\n const response = await payApi.fetchPaymentMethods();\n return response.payment_methods.map(mapToFluidPayPaymentMethod);\n },\n enabled: true,\n });\n\n const countriesAdapter = useCountriesApi();\n const languagesAdapter = useLanguagesApi();\n\n const { data: countriesData } = useQuery({\n queryKey: storeKeys.countries(),\n queryFn: () => countriesAdapter.listCountries(),\n enabled: true,\n });\n\n const { data: languagesData } = useQuery({\n queryKey: storeKeys.languages(),\n queryFn: () => languagesAdapter.listLanguages(),\n enabled: true,\n });\n\n const { data: pointsLedgerData, isError: isPointsLedgerError } = useQuery({\n queryKey: payKeys.pointsLedgers.list(),\n queryFn: () => payApi.fetchPointsLedgers(),\n enabled: true,\n retry: (failureCount, error) => {\n if (\n error instanceof Error &&\n \"status\" in error &&\n (error as { status: number }).status === 403\n ) {\n return false;\n }\n return failureCount < 1;\n },\n });\n\n const rewardPointsEnabled = !isPointsLedgerError && pointsLedgerData != null;\n\n const adaptedPointsLedger: PointsLedger[] = useMemo(() => {\n return (pointsLedgerData?.points_ledgers ?? []).map((entry) => {\n const meta = entry.metadata as {\n transaction_type?: string | null;\n source?: {\n name: string;\n email?: string;\n reason?: string;\n user_id?: number;\n } | null;\n } | null;\n return {\n id: entry.id,\n amount: entry.amount,\n company_id: 0,\n created_at: entry.created_at,\n customer_id: 0,\n metadata: {\n transaction_type: meta?.transaction_type ?? undefined,\n source: meta?.source ?? undefined,\n },\n total_balance: entry.total_balance,\n updated_at: entry.created_at,\n };\n });\n }, [pointsLedgerData]);\n\n const updateCustomerMutation = useMutation({\n mutationFn: async (data: UserFormData) => {\n await accountApi.updateAccount({\n account: {\n first_name: data.first_name,\n last_name: data.last_name,\n phone: data.phone_number,\n bio: data.bio,\n },\n });\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: accountKeys.all });\n onToast(t(\"profile_updated\"), \"success\");\n },\n onError: () => {\n onToast(t(\"failed_to_update_profile\"), \"error\");\n },\n });\n\n const deletePaymentMethodMutation = useMutation({\n mutationFn: (paymentMethodId: number) =>\n payApi.deletePaymentMethod(paymentMethodId),\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: payKeys.paymentMethods.all,\n });\n },\n onError: () => {\n onToast(t(\"failed_to_delete_payment_method\"), \"error\");\n },\n });\n\n const updatePaymentMethodMutation = useMutation({\n mutationFn: ({\n paymentMethodId,\n data,\n }: {\n paymentMethodId: number;\n data: EditPaymentMethodFormData;\n }) =>\n payApi.updatePaymentMethod(paymentMethodId, {\n payment_method: {\n default: data.set_as_default,\n billing_address: {\n name: data.billing_address.name,\n street1: data.billing_address.address1,\n street2: data.billing_address.address2 ?? null,\n city: data.billing_address.city,\n state: data.billing_address.state,\n zip: data.billing_address.zip,\n country: data.billing_address.country_code,\n },\n },\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: payKeys.paymentMethods.all,\n });\n },\n onError: () => {\n onToast(t(\"failed_to_update_payment_method\"), \"error\");\n },\n });\n\n const createAddressMutation = useMutation({\n mutationFn: (body: fluidPay.CreateAddressBody) =>\n payApi.createAddress({\n address: {\n name: composeAddressName(\n body.address.first_name,\n body.address.last_name,\n ),\n street1: body.address.address1,\n street2: body.address.address2,\n city: body.address.city,\n state: body.address.state,\n zip: body.address.postal_code,\n country: body.address.country_code,\n default: body.address.default,\n },\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: payKeys.addresses.all });\n onToast(t(\"address_created\"), \"success\");\n },\n onError: () => {\n onToast(t(\"failed_to_create_address\"), \"error\");\n },\n });\n\n const updateAddressMutation = useMutation({\n mutationFn: ({\n addressId,\n body,\n }: {\n addressId: number;\n body: fluidPay.CreateAddressBody;\n }) =>\n payApi.updateAddress(addressId, {\n address: {\n name: composeAddressName(\n body.address.first_name,\n body.address.last_name,\n ),\n street1: body.address.address1,\n street2: body.address.address2,\n city: body.address.city,\n state: body.address.state,\n zip: body.address.postal_code,\n country: body.address.country_code,\n default: body.address.default,\n },\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: payKeys.addresses.all });\n onToast(t(\"address_updated\"), \"success\");\n },\n onError: () => {\n onToast(t(\"failed_to_update_address\"), \"error\");\n },\n });\n\n const deleteAddressMutation = useMutation({\n mutationFn: (addressId: number) => payApi.deleteAddress(addressId),\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: payKeys.addresses.all });\n onToast(t(\"address_deleted\"), \"success\");\n },\n onError: () => {\n onToast(t(\"failed_to_delete_address\"), \"error\");\n },\n });\n\n const addCreditCardMutation = useMutation({\n mutationFn: (data: CreditCardFormSubmitData) =>\n payApi.createPaymentMethod({\n payment_method: {\n type: \"card\",\n token: data.payment_method.token,\n default: data.set_as_default,\n },\n billing_address_id: data.billing_address_id,\n }),\n onSuccess: () => {\n queryClient.invalidateQueries({\n queryKey: payKeys.paymentMethods.all,\n });\n onToast(t(\"payment_method_added\"), \"success\");\n },\n onError: () => {\n onToast(t(\"failed_to_add_payment_method\"), \"error\");\n },\n });\n\n const addresses = addressesData ?? [];\n const paymentMethods = paymentMethodsData ?? [];\n\n const adaptedLanguages: Language[] = (languagesData?.languages ?? []).map(\n (l, i) => ({ id: i, name: l.name, iso: l.code }),\n );\n\n const countries = countriesData?.countries;\n\n const countryOptions = useMemo(\n () =>\n [...(countries ?? [])]\n .map((c) => ({ iso: c.code, name: c.name }))\n .sort((a, b) => a.name.localeCompare(b.name)),\n [countries],\n );\n\n const statesByCountry = useMemo(() => {\n const map = new Map<string, State[]>();\n for (const c of countries ?? []) {\n map.set(\n c.code,\n c.states.map((s) => ({ name: s.name, isoCode: s.code })),\n );\n }\n return map;\n }, [countries]);\n\n const fetchStatesFromCountries = useCallback(\n (countryCode: string): Promise<State[]> =>\n Promise.resolve(statesByCountry.get(countryCode) ?? []),\n [statesByCountry],\n );\n\n // Dialog open state\n const [isInfoDialogOpen, setIsInfoDialogOpen] = useState(false);\n const [addressDialog, setAddressDialog] = useState<{\n open: boolean;\n selected: fluidPay.CustomerAddress | null;\n }>({ open: false, selected: null });\n const [deletingAddress, setDeletingAddress] =\n useState<fluidPay.CustomerAddress | null>(null);\n const [isAddCardOpen, setIsAddCardOpen] = useState(false);\n const [editPaymentMethod, setEditPaymentMethod] =\n useState<fluidPay.CustomerPaymentMethod | null>(null);\n\n // User-info form (for the existing dialog)\n const userInfoLanguage = useMemo(() => {\n return (\n adaptedLanguages.find(\n (l) => l.iso === accountData?.fluid_pay_account.language_iso,\n )?.name ?? \"\"\n );\n }, [adaptedLanguages, accountData]);\n\n const derivedLastName = useMemo(() => {\n if (!accountData) return \"\";\n const { first_name, full_name } = accountData.customer;\n return deriveLastName(first_name, full_name);\n }, [accountData]);\n\n const userInfoSchema = useMemo(\n () =>\n z.object({\n first_name: z.string().min(1, t(\"first_name_is_required\")),\n last_name: z.string().min(1, t(\"last_name_is_required\")),\n phone_number: z.string().optional(),\n language: z.string().min(1, t(\"language_is_required\")),\n bio: z.string().optional(),\n }),\n [t],\n );\n\n const userInfoForm = useZodForm<UserFormData>(userInfoSchema, {\n defaultValues: {\n first_name: accountData?.customer.first_name ?? \"\",\n last_name: derivedLastName,\n phone_number: accountData?.customer.phone ?? \"\",\n language: userInfoLanguage,\n bio: accountRep?.bio ?? \"\",\n },\n });\n\n const handleOpenInfoDialog = useCallback(() => {\n userInfoForm.reset({\n first_name: accountData?.customer.first_name ?? \"\",\n last_name: derivedLastName,\n phone_number: accountData?.customer.phone ?? \"\",\n language: userInfoLanguage,\n bio: accountRep?.bio ?? \"\",\n });\n setIsInfoDialogOpen(true);\n }, [\n accountData,\n accountRep,\n derivedLastName,\n userInfoLanguage,\n userInfoForm,\n ]);\n\n const onSubmitUserInfo = userInfoForm.handleSubmit(async (data) => {\n try {\n await updateCustomerMutation.mutateAsync(data);\n setIsInfoDialogOpen(false);\n } catch {\n // toast surfaced via onError\n }\n });\n\n const socialLinks = useMemo<Partial<Record<SocialKey, string>>>(() => {\n const src: Partial<Record<SocialFieldKey, string>> =\n accountRep?.social_links ?? {};\n const result: Partial<Record<SocialKey, string>> = {};\n for (const [key, field] of Object.entries(SOCIAL_KEY_TO_FIELD) as [\n SocialKey,\n SocialFieldKey | null,\n ][]) {\n if (!field) continue;\n const v = src[field];\n if (typeof v === \"string\" && v.length > 0) {\n result[key] = v;\n }\n }\n return result;\n }, [accountRep]);\n\n const handleCopyMySiteLink = useCallback(async () => {\n if (!mySiteUrl) return;\n try {\n await navigator.clipboard.writeText(mySiteUrl);\n onToast(t(\"mysite_link_copied\"), \"success\");\n } catch {\n onToast(t(\"failed_to_copy_link\"), \"error\");\n }\n }, [mySiteUrl, onToast, t]);\n\n const [editingSocial, setEditingSocial] = useState<SocialKey | null>(null);\n const [socialDraft, setSocialDraft] = useState(\"\");\n\n const handleConnectSocial = useCallback(\n (key: SocialKey) => {\n const field = SOCIAL_KEY_TO_FIELD[key];\n if (!field) {\n onToast(t(\"platform_not_editable\"), \"warning\");\n return;\n }\n const current = accountRep?.social_links?.[field] ?? \"\";\n setSocialDraft(current);\n setEditingSocial(key);\n },\n [accountRep, onToast, t],\n );\n\n const updateSocialMutation = useMutation({\n mutationFn: async ({\n field,\n value,\n }: {\n field: SocialFieldKey;\n value: string;\n }) => {\n const current = accountRep?.social_links ?? {};\n await accountApi.updateAccount({\n account: {\n social_links: { ...current, [field]: value },\n },\n });\n },\n onSuccess: () => {\n queryClient.invalidateQueries({ queryKey: accountKeys.all });\n onToast(t(\"social_link_updated\"), \"success\");\n },\n onError: () => {\n onToast(t(\"failed_to_update_social_link\"), \"error\");\n },\n });\n\n const handleSubmitSocial = useCallback(async () => {\n if (!editingSocial) return;\n const field = SOCIAL_KEY_TO_FIELD[editingSocial];\n if (!field) return;\n await updateSocialMutation.mutateAsync({\n field,\n value: socialDraft.trim(),\n });\n setEditingSocial(null);\n }, [editingSocial, socialDraft, updateSocialMutation]);\n\n if (isAccountError && !isLoadingAccount) {\n return (\n <div className=\"px-4 py-8 sm:px-9\">\n <div className=\"text-muted-foreground text-center text-sm\">\n {t(\"unable_to_load_account\")}\n </div>\n </div>\n );\n }\n\n if (isLoadingAccount || !accountData || !accountRep) {\n return (\n <div className=\"px-4 pt-4 sm:px-9 md:pt-8\">\n <div className=\"space-y-4\">\n <div className=\"bg-muted h-16 animate-pulse rounded\" />\n <div className=\"bg-muted h-32 animate-pulse rounded\" />\n <div className=\"bg-muted h-32 animate-pulse rounded\" />\n </div>\n </div>\n );\n }\n\n const pointsBalance = rewardPointsEnabled\n ? (pointsLedgerData?.points_ledgers?.[0]?.total_balance ?? 0)\n : undefined;\n\n return (\n <FluidPayCoreProvider api={fluidPayShim}>\n <ProfileLayout\n account={accountRep}\n pointsBalance={pointsBalance}\n pointsLedger={adaptedPointsLedger}\n rewardsEnabled={rewardPointsEnabled}\n addresses={addresses}\n paymentMethods={paymentMethods}\n mySiteDisplayUrl={mySiteDisplayUrl}\n socialLinks={socialLinks}\n onEditPersonalInfo={handleOpenInfoDialog}\n onAddAddress={() => setAddressDialog({ open: true, selected: null })}\n onEditAddress={(address) =>\n setAddressDialog({ open: true, selected: address })\n }\n onDeleteAddress={(address) => setDeletingAddress(address)}\n onAddPaymentMethod={() => setIsAddCardOpen(true)}\n onEditPaymentMethod={(pm) => setEditPaymentMethod(pm)}\n onCopyMySiteLink={handleCopyMySiteLink}\n onConnectSocial={handleConnectSocial}\n />\n\n <UserInfoDialog\n control={userInfoForm.control}\n isOpen={isInfoDialogOpen}\n onSubmit={onSubmitUserInfo}\n handleClose={() => setIsInfoDialogOpen(false)}\n languageOptions={adaptedLanguages.map((l) => ({\n name: l.name,\n value: l.name,\n }))}\n errorMsg={undefined}\n isSubmitting={updateCustomerMutation.isPending}\n email={accountRep.email ?? \"\"}\n />\n\n <AddressFormDialog\n isOpen={addressDialog.open}\n onClose={() => setAddressDialog({ open: false, selected: null })}\n selectedAddress={addressDialog.selected}\n defaultCountry={\n addresses.find((a) => a.default)?.country_code ?? countryIso\n }\n t={(key: string) => t(key as never)}\n onSubmit={async (formData) => {\n if (addressDialog.selected) {\n await updateAddressMutation.mutateAsync({\n addressId: addressDialog.selected.id,\n body: formData,\n });\n } else {\n await createAddressMutation.mutateAsync(formData);\n }\n setAddressDialog({ open: false, selected: null });\n }}\n isSubmitting={\n createAddressMutation.isPending || updateAddressMutation.isPending\n }\n onDelete={\n addressDialog.selected && !addressDialog.selected.default\n ? async () => {\n if (!addressDialog.selected) return;\n try {\n await deleteAddressMutation.mutateAsync(\n addressDialog.selected.id,\n );\n setAddressDialog({ open: false, selected: null });\n } catch {\n // toast surfaced via onError\n }\n }\n : undefined\n }\n isDeleting={deleteAddressMutation.isPending}\n countries={countryOptions}\n fetchStates={fetchStatesFromCountries}\n renderAddressAutocomplete={({ control, setValue, countryCode }) => (\n <AddressAutocompleteInput\n control={control}\n setValue={setValue}\n countryIso={countryCode}\n addressLineField=\"address1\"\n cityField=\"city\"\n stateField=\"state\"\n postalCodeField=\"postal_code\"\n placeholder={t(\"address_line_1\")}\n />\n )}\n />\n\n <ConfirmActionDialog\n title={t(\"delete_address\")}\n description={t(\"delete_address_message\")}\n openDialog={deletingAddress !== null}\n setOpenDialog={(open) => {\n if (!open) setDeletingAddress(null);\n }}\n onAction={async () => {\n if (!deletingAddress) return;\n try {\n await deleteAddressMutation.mutateAsync(deletingAddress.id);\n setDeletingAddress(null);\n } catch {\n // toast surfaced via onError\n }\n }}\n isLoading={deleteAddressMutation.isPending}\n actionText={t(\"delete\")}\n />\n\n <CreditCardFormDialog\n isOpen={isAddCardOpen}\n onClose={() => setIsAddCardOpen(false)}\n t={(key: string) => t(key as never)}\n onSubmit={async (data) => {\n try {\n await addCreditCardMutation.mutateAsync(data);\n setIsAddCardOpen(false);\n } catch {\n // toast surfaced via onError\n }\n }}\n isSubmitting={addCreditCardMutation.isPending}\n jwt=\"\"\n savedAddresses={addresses}\n defaultBillingAddressId={addresses.find((a) => a.default)?.id}\n renderAddressFormDialog={({ isOpen, onClose, onAddressCreated }) => (\n <AddressFormDialog\n isOpen={isOpen}\n onClose={onClose}\n selectedAddress={null}\n onSubmit={async (data) => {\n try {\n const created = await createAddressMutation.mutateAsync(data);\n onAddressCreated(mapToFluidPayAddress(created));\n } catch {\n // toast surfaced via onError\n }\n }}\n isSubmitting={createAddressMutation.isPending}\n countries={countryOptions}\n fetchStates={fetchStatesFromCountries}\n t={(key: string) => t(key as never)}\n renderAddressAutocomplete={({ control, setValue, countryCode }) => (\n <AddressAutocompleteInput\n control={control}\n setValue={setValue}\n countryIso={countryCode}\n addressLineField=\"address1\"\n cityField=\"city\"\n stateField=\"state\"\n postalCodeField=\"postal_code\"\n placeholder={t(\"address_line_1\")}\n />\n )}\n />\n )}\n />\n\n {editPaymentMethod && (\n <EditPaymentMethodDialog\n isOpen\n onClose={() => setEditPaymentMethod(null)}\n paymentMethod={editPaymentMethod}\n billingAddress={editPaymentMethod.billing_address}\n countries={countryOptions}\n onSubmit={(data) => {\n updatePaymentMethodMutation.mutate(\n { paymentMethodId: editPaymentMethod.id, data },\n { onSuccess: () => setEditPaymentMethod(null) },\n );\n }}\n isSubmitting={updatePaymentMethodMutation.isPending}\n onDelete={() => {\n deletePaymentMethodMutation.mutate(editPaymentMethod.id, {\n onSuccess: () => setEditPaymentMethod(null),\n });\n }}\n isDeleting={deletePaymentMethodMutation.isPending}\n />\n )}\n\n <Dialog\n open={editingSocial !== null}\n onOpenChange={(open) => !open && setEditingSocial(null)}\n >\n <DialogContent className=\"max-w-sm md:max-w-md\">\n <DialogHeader>\n <DialogTitle>\n {editingSocial\n ? t(\"edit_platform_link\", {\n platform: SOCIAL_LABELS[editingSocial] ?? \"\",\n })\n : t(\"edit_social_link\")}\n </DialogTitle>\n </DialogHeader>\n <div className=\"space-y-2 pt-2\">\n <Label\n htmlFor=\"social-handle\"\n className=\"mb-1.5 block text-sm font-medium\"\n >\n {t(\"url\")}\n </Label>\n <Input\n id=\"social-handle\"\n value={socialDraft}\n onChange={(e) => setSocialDraft(e.target.value)}\n placeholder={\n editingSocial ? SOCIAL_PLACEHOLDERS[editingSocial] : \"\"\n }\n onKeyDown={(e) => {\n if (e.key === \"Enter\") {\n e.preventDefault();\n void handleSubmitSocial();\n }\n }}\n autoFocus\n />\n </div>\n <DialogFooter>\n <Button\n type=\"button\"\n variant=\"outline\"\n onClick={() => setEditingSocial(null)}\n disabled={updateSocialMutation.isPending}\n >\n {t(\"cancel\")}\n </Button>\n <Button\n type=\"button\"\n onClick={() => {\n void handleSubmitSocial();\n }}\n disabled={updateSocialMutation.isPending}\n >\n {updateSocialMutation.isPending ? t(\"saving\") : t(\"save\")}\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n </FluidPayCoreProvider>\n );\n}\n","import type { ComponentProps } from \"react\";\nimport {\n Breadcrumb,\n BreadcrumbList,\n BreadcrumbItem,\n BreadcrumbPage,\n fluidToast,\n} from \"@fluid-app/ui-primitives\";\nimport { ScreenHeaderBreadcrumbs } from \"@fluid-app/portal-react/shell/ScreenHeaderContext\";\nimport { useProfileTranslation } from \"@fluid-app/profile-core/translation-api-context\";\nimport type {\n BackgroundValue,\n BorderRadiusOptions,\n ColorOptions,\n PaddingOptions,\n} from \"../types\";\nimport type { WidgetPropertySchema } from \"../registries/property-schema-types\";\nimport { useFluidContext } from \"../providers/FluidProvider\";\nimport { ProfileTranslationBridge } from \"../providers/ProfileTranslationBridge\";\nimport { ProfileContentScreen } from \"./ProfileContentScreen\";\n\ntype ProfileScreenProps = ComponentProps<\"div\"> & {\n background?: BackgroundValue;\n textColor?: ColorOptions;\n accentColor?: ColorOptions;\n padding?: PaddingOptions;\n borderRadius?: BorderRadiusOptions;\n onToast?: (message: string, type: \"success\" | \"error\" | \"warning\") => void;\n};\n\nfunction defaultToast(message: string, type: \"success\" | \"error\" | \"warning\") {\n fluidToast({ title: message, type });\n}\n\nexport function ProfileScreen({\n onToast,\n /* eslint-disable @typescript-eslint/no-unused-vars -- destructured to exclude from divProps spread */\n background,\n textColor,\n accentColor,\n padding,\n borderRadius,\n /* eslint-enable @typescript-eslint/no-unused-vars */\n ...divProps\n}: ProfileScreenProps): React.JSX.Element {\n const { config } = useFluidContext();\n const effectiveToast = onToast ?? defaultToast;\n const countryIso = config.countryIso ?? \"US\";\n\n return (\n <ProfileTranslationBridge>\n <ProfileScreenContent\n onToast={effectiveToast}\n countryIso={countryIso}\n divProps={divProps}\n />\n </ProfileTranslationBridge>\n );\n}\n\nfunction ProfileScreenContent({\n onToast,\n countryIso,\n divProps,\n}: {\n onToast: (message: string, type: \"success\" | \"error\" | \"warning\") => void;\n countryIso: string;\n divProps: ComponentProps<\"div\">;\n}): React.JSX.Element {\n const { t } = useProfileTranslation();\n\n return (\n <>\n <ScreenHeaderBreadcrumbs>\n <Breadcrumb>\n <BreadcrumbList className=\"text-lg\">\n <BreadcrumbItem>\n <BreadcrumbPage className=\"font-semibold\">\n {t(\"breadcrumb\")}\n </BreadcrumbPage>\n </BreadcrumbItem>\n </BreadcrumbList>\n </Breadcrumb>\n </ScreenHeaderBreadcrumbs>\n <div {...divProps}>\n <ProfileContentScreen onToast={onToast} countryIso={countryIso} />\n </div>\n </>\n );\n}\n\nexport const profileScreenPropertySchema: WidgetPropertySchema = {\n widgetType: \"ProfileScreen\",\n displayName: \"Profile Screen\",\n tabsConfig: [{ id: \"styling\", label: \"Styling\" }],\n fields: [],\n} as const satisfies WidgetPropertySchema;\n"],"mappings":";;;;;;;;;;;;;;;AAAA,SAAgB,eAAe,WAAmB,UAA0B;AAC1E,KAAI,CAAC,UAAW,QAAO;CACvB,MAAM,SAAS,GAAG,UAAU;AAC5B,QAAO,SAAS,WA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