@vtex/faststore 0.0.3 → 0.0.5
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.
- package/CHANGELOG.md +41 -0
- package/README.md +7 -3
- package/dist/catalog.json +337 -1
- package/dist/components.d.ts +5 -1
- package/dist/components.js +8 -4
- package/dist/content-types.json +73 -0
- package/dist/docs/account-access-gate.md +153 -0
- package/dist/docs/account-entry-point.md +1 -2
- package/dist/docs/account-menu.md +164 -0
- package/dist/docs/buy-button.md +1 -1
- package/dist/docs/cart.md +1 -1
- package/dist/docs/my-account-profile.md +208 -0
- package/dist/docs/session.md +1 -1
- package/dist/docs/sign-in-redirect.md +1 -1
- package/dist/matter/account-access-gate/account-access-gate.d.ts +86 -0
- package/dist/matter/account-access-gate/account-access-gate.js +283 -0
- package/dist/matter/account-access-gate/account-access-gate.js.map +1 -0
- package/dist/matter/account-access-gate/sign-out-intent.d.ts +17 -0
- package/dist/matter/account-access-gate/sign-out-intent.js +62 -0
- package/dist/matter/account-access-gate/sign-out-intent.js.map +1 -0
- package/dist/matter/account-entry-point/account-entry-point.js +2 -2
- package/dist/matter/account-entry-point/account-entry-point.js.map +1 -1
- package/dist/matter/account-menu/account-menu.d.ts +88 -0
- package/dist/matter/account-menu/account-menu.js +246 -0
- package/dist/matter/account-menu/account-menu.js.map +1 -0
- package/dist/matter/cart/cart.d.ts +1 -1
- package/dist/matter/cart/cart.js +2 -2
- package/dist/matter/cart/cart.js.map +1 -1
- package/dist/matter/delivery-options/delivery-options.js.map +1 -1
- package/dist/matter/my-account-profile/my-account-profile.d.ts +291 -0
- package/dist/matter/my-account-profile/my-account-profile.js +856 -0
- package/dist/matter/my-account-profile/my-account-profile.js.map +1 -0
- package/dist/matter/shipping-address/shipping-address.js +2 -2
- package/dist/matter/shipping-address/shipping-address.js.map +1 -1
- package/dist/matter/shipping-simulator/shipping-simulator.js.map +1 -1
- package/dist/particles/footer-social/footer-social.js +1 -1
- package/dist/particles/incentives/incentives.js +1 -1
- package/dist/sdk/actions/cart-action-provider.d.ts +1 -1
- package/dist/sdk/actions/cart-action-provider.js +1 -1
- package/dist/sdk/actions/cart-action-provider.js.map +1 -1
- package/dist/sdk/actions/session-action-provider.d.ts +1 -1
- package/dist/sdk/actions/session-action-provider.js +1 -1
- package/dist/sdk/actions/session-action-provider.js.map +1 -1
- package/dist/sdk/actions/shipping-action-provider.d.ts +1 -1
- package/dist/sdk/actions/shipping-action-provider.js +1 -1
- package/dist/sdk/actions/shipping-action-provider.js.map +1 -1
- package/dist/sdk/cache/storefront-cache.js +1 -1
- package/dist/sdk/cache/storefront-cache.js.map +1 -1
- package/dist/sdk/cart/operations.d.ts +4 -4
- package/dist/sdk/cart/operations.js +1 -1
- package/dist/sdk/cart/operations.js.map +1 -1
- package/dist/sdk/cart/optimistic.js +1 -1
- package/dist/sdk/cart/optimistic.js.map +1 -1
- package/dist/sdk/cart/use-cart-actions.d.ts +1 -1
- package/dist/sdk/cart/use-cart-actions.js +3 -3
- package/dist/sdk/cart/use-cart-actions.js.map +1 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js +1 -1
- package/dist/sdk/cart/use-cart-validate-on-open.js.map +1 -1
- package/dist/sdk/cart/write-gate.js +1 -1
- package/dist/sdk/cart/write-gate.js.map +1 -1
- package/dist/sdk/data/page-reactive-data-root.d.ts +2 -2
- package/dist/sdk/data/page-reactive-data-root.js.map +1 -1
- package/dist/sdk/data/reactive-data-provider.d.ts +1 -1
- package/dist/sdk/data/reactive-data-provider.js +1 -1
- package/dist/sdk/data/reactive-data-provider.js.map +1 -1
- package/dist/sdk/data/reactive-list-item-data-provider.d.ts +1 -1
- package/dist/sdk/data/reactive-list-item-data-provider.js +1 -1
- package/dist/sdk/data/reactive-list-item-data-provider.js.map +1 -1
- package/dist/sdk/data/use-reactive-entity.js +1 -1
- package/dist/sdk/data/use-reactive-entity.js.map +1 -1
- package/dist/sdk/generated/gql.js +2 -1
- package/dist/sdk/generated/gql.js.map +1 -1
- package/dist/sdk/generated/graphql.js +85 -1
- package/dist/sdk/generated/graphql.js.map +1 -1
- package/dist/sdk/identity/operations.js.map +1 -1
- package/dist/sdk/identity/use-identity-actions.d.ts +1 -1
- package/dist/sdk/identity/use-identity-actions.js.map +1 -1
- package/dist/sdk/session/auth-operations.d.ts +1 -1
- package/dist/sdk/session/auth-operations.js.map +1 -1
- package/dist/sdk/session/use-session-actions.d.ts +1 -1
- package/dist/sdk/session/use-session-actions.js.map +1 -1
- package/dist/sdk/session/use-session-revalidation.js +65 -0
- package/dist/sdk/session/use-session-revalidation.js.map +1 -0
- package/dist/sdk/shipping/option-select-operations.d.ts +1 -1
- package/dist/sdk/shipping/option-select-operations.js.map +1 -1
- package/dist/sdk/shipping/request-timeout.js +1 -1
- package/dist/sdk/shipping/request-timeout.js.map +1 -1
- package/dist/sdk/shipping/shipping-operations.d.ts +1 -1
- package/dist/sdk/shipping/shipping-operations.js.map +1 -1
- package/dist/sdk/shipping/use-shipping-actions.d.ts +2 -2
- package/dist/sdk/shipping/use-shipping-actions.js.map +1 -1
- package/dist/sdk/state/cart.d.ts +3 -4
- package/dist/sdk/state/cart.js +6 -7
- package/dist/sdk/state/cart.js.map +1 -1
- package/dist/utils/safe-href.js +3 -3
- package/dist/utils/safe-href.js.map +1 -1
- package/package.json +1 -18
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"my-account-profile.js","names":[],"sources":["../../../src/matter/my-account-profile/my-account-profile.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport {\n type ChangeEvent,\n type ComponentPropsWithRef,\n createContext,\n type ReactNode,\n type SyntheticEvent,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport {\n DocumentField,\n isSupportedDocumentType,\n isValidDocument,\n maskDocumentValue,\n} from '../../particles/document-field/document-field.js';\nimport { Field } from '../../particles/field/field.js';\nimport { Input } from '../../particles/input/input.js';\nimport {\n applyPhoneMask,\n type PhoneCountry,\n PhoneField,\n toE164,\n validatePhoneNumber,\n} from '../../particles/phone-field/phone-field.js';\nimport { Select } from '../../particles/select/select.js';\nimport { useToast } from '../../particles/toast/toast.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport type { CustomerProfileUserError } from '../../sdk/identity/operations.js';\nimport { useSession } from '../session/session.js';\n\n/**\n * The `my-account-profile` compound (see my-account-profile.md; spec archived at the specs-archive tag) — the data root\n * plus form mechanics for the shopper's persistent account profile. `Root` owns the saved profile,\n * the draft, the view↔edit toggle, and the single batched Save; it publishes a context whose\n * registration API is the seam every field Control attaches to.\n *\n * Unlike `ClientProfileFormRoot`, the Root does not enumerate the field set: a Control registers\n * its key plus an optional validator and normalizer, and the Root derives which fields to validate,\n * which to send, and which to focus from the live registry only. A field absent from the\n * composition is absent from the payload by construction (Decision 1).\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL fragment — raw literal, outside codegen (Decision 8)\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment MyAccountProfileData on Query {\n customerProfile {\n __typename\n id\n firstName\n lastName\n email\n homePhone\n mobilePhone\n document\n documentType\n birthDate\n gender\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * The `$data` slice forwarded by the reactive runtime — the `customerProfile` entity itself, not the\n * `Query` shape the fragment above is authored against. The compiler derives an entity fragment `on\n * CustomerProfile` from the root-field selection for the reactive path (rfc-data-layer.md §\"Entity\n * fragments and schema introspection\"), and `ReactiveDataProvider` publishes that entity data\n * directly — the same convention `SessionRoot` reads `$data.loggedIn` under, not `$data.session`.\n */\nexport type MyAccountProfileData = {\n id?: string | null;\n firstName?: string | null;\n lastName?: string | null;\n email?: string | null;\n homePhone?: string | null;\n mobilePhone?: string | null;\n document?: string | null;\n documentType?: string | null;\n birthDate?: string | null;\n gender?: string | null;\n} | null;\n\n/**\n * The shopper-editable keys. `email` is absent (login identifier) and `documentType` is absent\n * (read for the tax-ID control's active type; not writable in V0).\n */\nexport type MyAccountProfileFieldKey =\n | 'firstName'\n | 'lastName'\n | 'homePhone'\n | 'mobilePhone'\n | 'document'\n | 'birthDate'\n | 'gender';\n\nconst FIELD_KEYS: readonly MyAccountProfileFieldKey[] = [\n 'firstName',\n 'lastName',\n 'homePhone',\n 'mobilePhone',\n 'document',\n 'birthDate',\n 'gender',\n];\n\nexport type MyAccountProfileMode = 'view' | 'edit';\n\n/** Every editable key, always a string — a `null` upstream value is seeded as `''`. */\nexport type MyAccountProfileValues = Readonly<Record<MyAccountProfileFieldKey, string>>;\n\n/**\n * What a Control hands the Root. `validate` returns a message when the value is unacceptable and\n * `null` when it is fine — requiredness is expressed as a validator that rejects `''`. `normalize`\n * is applied on Save, to dirty values only.\n */\nexport type MyAccountProfileFieldRegistration = Readonly<{\n key: MyAccountProfileFieldKey;\n validate?: (value: string) => string | null;\n normalize?: (value: string) => string;\n}>;\n\nexport type MyAccountProfileFieldErrors = Readonly<Partial<Record<MyAccountProfileFieldKey, string>>>;\n\nexport type MyAccountProfileContextValue = Readonly<{\n mode: MyAccountProfileMode;\n savedValues: MyAccountProfileValues;\n draft: MyAccountProfileValues;\n fieldErrors: MyAccountProfileFieldErrors;\n email: string;\n activeDocumentType: string | undefined;\n pending: boolean;\n registerField: (registration: MyAccountProfileFieldRegistration) => () => void;\n setField: (key: MyAccountProfileFieldKey, value: string) => void;\n edit: () => void;\n cancel: () => void;\n}>;\n\nexport type MyAccountProfileRootProps = Readonly<{\n /** Store-configured tax-ID type fallback, used when the saved `documentType` is not registered. */\n documentType?: string;\n saveFailedMessage?: string;\n savedMessage?: string;\n className?: string;\n children?: ReactNode;\n $data?: MyAccountProfileData;\n /** Compiler-injected action surface; carries `identity.customerProfileUpdate`. */\n $actions?: ComponentActions;\n}>;\n\nexport type MyAccountProfileEditButtonProps = Readonly<{ label?: string; className?: string; children?: ReactNode }>;\nexport type MyAccountProfileSaveButtonProps = Readonly<{ label?: string; className?: string; children?: ReactNode }>;\nexport type MyAccountProfileCancelButtonProps = Readonly<{\n label?: string;\n className?: string;\n children?: ReactNode;\n}>;\nexport type MyAccountProfileEmailProps = Readonly<{ className?: string }>;\n\nconst DEFAULT_SAVE_FAILED_MESSAGE = 'Unable to save your profile. Please try again.';\nconst DEFAULT_SAVED_MESSAGE = 'Your profile has been saved.';\n\nfunction buildSavedValues($data: MyAccountProfileData | undefined): MyAccountProfileValues {\n return {\n firstName: $data?.firstName ?? '',\n lastName: $data?.lastName ?? '',\n homePhone: $data?.homePhone ?? '',\n mobilePhone: $data?.mobilePhone ?? '',\n document: $data?.document ?? '',\n birthDate: $data?.birthDate ?? '',\n gender: $data?.gender ?? '',\n };\n}\n\n/**\n * Native `<input type=\"date\">` values and the profile's stored `birthDate` are both `yyyy-mm-dd`.\n * `toNativeDate` stays defensive against a `yyyy-mm-ddTHH:mm:ss...` upstream value slipping through\n * unnormalized — the resolver already strips the time component, this is a second line of defense —\n * since the native input rejects anything but the date-only form outright.\n */\nfunction toNativeDate(stored: string): string {\n const [datePart] = stored.split('T');\n return datePart ?? '';\n}\nfunction toStoredDate(native: string): string {\n return native;\n}\n\nconst DEFAULT_GENDER_OPTIONS: readonly MyAccountProfileGenderOption[] = [\n { value: 'female', label: 'Female' },\n { value: 'male', label: 'Male' },\n { value: 'other', label: 'Other' },\n { value: 'prefer_not_to_say', label: 'Prefer not to say' },\n];\n\n// ---------------------------------------------------------------------------\n// Context — Root publishes the draft + registration API to its Controls\n// ---------------------------------------------------------------------------\n\nconst MY_ACCOUNT_PROFILE_UNSET = Symbol('MyAccountProfileContextUnset');\n\nconst MyAccountProfileContext = createContext<MyAccountProfileContextValue | typeof MY_ACCOUNT_PROFILE_UNSET>(\n MY_ACCOUNT_PROFILE_UNSET,\n);\n\n/** Throws when used outside `MyAccountProfileRoot`, per ADR-0009. */\nexport function useMyAccountProfile(): MyAccountProfileContextValue {\n const ctx = useContext(MyAccountProfileContext);\n if (ctx === MY_ACCOUNT_PROFILE_UNSET) {\n throw new Error('MyAccountProfile components must be used inside MyAccountProfileRoot.');\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Root\n// ---------------------------------------------------------------------------\n\nexport const MyAccountProfileRootDefinition = defineComponent<MyAccountProfileRootProps>({\n name: 'MyAccountProfileRoot',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileRoot,\n fragment,\n fetchStrategy: 'reactive',\n requiresContext: 'session',\n providesContext: 'my-account-profile',\n actions: { identity: ['customerProfileUpdate'] },\n skeleton: MyAccountProfileSkeleton,\n editor: { label: 'My Account Profile Root', category: 'identity' },\n schema: {\n documentType: { type: 'string', label: 'Default document type (e.g. CPF)' },\n saveFailedMessage: {\n type: 'string',\n default: DEFAULT_SAVE_FAILED_MESSAGE,\n label: 'Save failure message',\n },\n savedMessage: {\n type: 'string',\n default: DEFAULT_SAVED_MESSAGE,\n label: 'Save success message',\n },\n },\n guideline:\n 'Data root + form mechanics for the persistent My Account profile: owns the saved profile, the draft, the view/edit toggle, and the single batched Save (dispatches only dirty, registered fields; an empty string erases, an omitted field is untouched). Self-gates on the authenticated (loggedIn) session; requires a SessionRoot ancestor and a mounted ToastProvider ancestor — Save success/failure surface as a toast, not an inline part. Field Controls register their key plus an optional validator and normalizer through useMyAccountProfile() — the field set is a merchant composition decision, never enumerated here. Compose EditButton (view state), SaveButton/CancelButton (edit state), and Email as children in any order. See my-account-profile.md.',\n});\n\nexport function MyAccountProfileRoot({\n $data: $dataProp,\n $actions: $actionsProp,\n documentType: documentTypeProp,\n saveFailedMessage = DEFAULT_SAVE_FAILED_MESSAGE,\n savedMessage = DEFAULT_SAVED_MESSAGE,\n className,\n children,\n}: MyAccountProfileRootProps) {\n // Enforces the SessionRoot ancestor: useSession() throws when rendered outside one.\n const { state } = useSession();\n // Enforces the ToastProvider ancestor: useToast() throws when rendered outside one (Decision 10).\n const toast = useToast();\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n const resolved = $data != null;\n\n const savedValues = useMemo(() => buildSavedValues($data), [$data]);\n const savedEmail = $data?.email ?? '';\n const savedDocumentType = $data?.documentType?.toUpperCase();\n const activeDocumentType =\n savedDocumentType && isSupportedDocumentType(savedDocumentType) ? savedDocumentType : documentTypeProp;\n\n const [mode, setMode] = useState<MyAccountProfileMode>('view');\n const [draft, setDraft] = useState<MyAccountProfileValues>(savedValues);\n const [fieldErrors, setFieldErrors] = useState<MyAccountProfileFieldErrors>({});\n const [pending, setPending] = useState(false);\n const [registry, setRegistry] = useState<ReadonlyMap<MyAccountProfileFieldKey, MyAccountProfileFieldRegistration>>(\n () => new Map(),\n );\n\n const formRef = useRef<HTMLFormElement>(null);\n\n // Re-seed pristine fields when the saved profile changes underneath an open edit; a field the\n // shopper has touched (draft no longer equals the previous saved value) is never clobbered. Runs\n // during render (previous-saved in state, not a ref) so the re-seed lands in the same commit.\n const [prevSaved, setPrevSaved] = useState(savedValues);\n const changedKeys = FIELD_KEYS.filter((key) => prevSaved[key] !== savedValues[key]);\n if (changedKeys.length > 0) {\n setPrevSaved(savedValues);\n setDraft((prevDraft) => {\n let next = prevDraft;\n for (const key of changedKeys) {\n if (prevDraft[key] !== prevSaved[key]) continue;\n if (next === prevDraft) next = { ...prevDraft };\n (next as Record<MyAccountProfileFieldKey, string>)[key] = savedValues[key];\n }\n return next;\n });\n }\n\n const registerField = useCallback((registration: MyAccountProfileFieldRegistration) => {\n setRegistry((prev) => {\n const next = new Map(prev);\n next.set(registration.key, registration);\n return next;\n });\n return () => {\n setRegistry((prev) => {\n if (!prev.has(registration.key)) return prev;\n const next = new Map(prev);\n next.delete(registration.key);\n return next;\n });\n };\n }, []);\n\n const setField = useCallback((key: MyAccountProfileFieldKey, value: string) => {\n setDraft((prev) => ({ ...prev, [key]: value }));\n setFieldErrors((prev) => {\n if (!prev[key]) return prev;\n const next = { ...prev };\n delete next[key];\n return next;\n });\n }, []);\n\n // Opening an edit always starts from the latest truth, so a value the server normalized (e.g. a\n // reformatted phone) on a previous save is what the shopper sees, not their own stale keystrokes.\n const edit = useCallback(() => {\n setDraft(savedValues);\n setFieldErrors({});\n setMode('edit');\n }, [savedValues]);\n\n const cancel = useCallback(() => {\n setDraft(savedValues);\n setFieldErrors({});\n setMode('view');\n }, [savedValues]);\n\n function focusFirstInvalid(errors: MyAccountProfileFieldErrors) {\n const wrappers = formRef.current?.querySelectorAll<HTMLElement>('[data-fs-my-account-profile-field]');\n if (!wrappers) return;\n for (const wrapper of wrappers) {\n const key = wrapper.dataset.fsMyAccountProfileField as MyAccountProfileFieldKey | undefined;\n if (key && errors[key]) {\n const target = wrapper.querySelector<HTMLElement>('input, select, textarea') ?? wrapper;\n target.focus();\n return;\n }\n }\n }\n\n async function handleSubmit(event: SyntheticEvent<HTMLFormElement>) {\n event.preventDefault();\n if (pending) return;\n\n const dirtyKeys = Array.from(registry.keys()).filter((key) => draft[key] !== savedValues[key]);\n if (dirtyKeys.length === 0) {\n setFieldErrors({});\n setMode('view');\n toast.add({ title: savedMessage, type: 'success' });\n return;\n }\n\n // Validate only the fields the shopper actually changed (Decision 9, product-confirmed): a\n // stale invalid value the shopper never touched must not block an unrelated field's save.\n const errors: Record<string, string> = {};\n for (const key of dirtyKeys) {\n const registration = registry.get(key);\n const message = registration?.validate?.(draft[key]);\n if (message) errors[key] = message;\n }\n if (Object.keys(errors).length > 0) {\n setFieldErrors(errors as MyAccountProfileFieldErrors);\n focusFirstInvalid(errors as MyAccountProfileFieldErrors);\n return;\n }\n setFieldErrors({});\n\n const identity = $actions?.identity;\n if (!identity?.customerProfileUpdate) {\n // A composition/platform gap (the provider chain never delivered customerProfileUpdate) is\n // otherwise indistinguishable from a dead button — surface it the same way a rejected write\n // would, rather than returning silently.\n toast.add({ title: saveFailedMessage, type: 'error' });\n return;\n }\n\n const payload: Partial<Record<MyAccountProfileFieldKey, string>> = {};\n for (const key of dirtyKeys) {\n const registration = registry.get(key);\n const rawValue = draft[key];\n payload[key] = registration?.normalize ? registration.normalize(rawValue) : rawValue;\n }\n\n setPending(true);\n try {\n const userErrors: readonly CustomerProfileUserError[] = await identity.customerProfileUpdate(payload);\n if (userErrors.length > 0) {\n toast.add({ title: userErrors[0]?.message ?? saveFailedMessage, type: 'error' });\n return;\n }\n setMode('view');\n toast.add({ title: savedMessage, type: 'success' });\n } catch (error) {\n // Log only the error name — the message can echo a submitted profile value (PII).\n console.error(\n '[MyAccountProfileRoot] customerProfileUpdate failed',\n error instanceof Error ? error.name : 'UnknownError',\n );\n toast.add({ title: saveFailedMessage, type: 'error' });\n } finally {\n setPending(false);\n }\n }\n\n const contextValue = useMemo<MyAccountProfileContextValue>(\n () => ({\n mode,\n savedValues,\n draft,\n fieldErrors,\n email: savedEmail,\n activeDocumentType,\n pending,\n registerField,\n setField,\n edit,\n cancel,\n }),\n [\n mode,\n savedValues,\n draft,\n fieldErrors,\n savedEmail,\n activeDocumentType,\n pending,\n registerField,\n setField,\n edit,\n cancel,\n ],\n );\n\n // Self-gate: an anonymous or identified-but-not-authenticated session never reaches the DOM,\n // even if the topology's SessionGuard is missing (US-5).\n if (state !== 'loggedIn') return null;\n\n // Empty is a post-resolution state — the skeleton renders while $data is unresolved, never an\n // empty summary.\n if (!resolved) return <MyAccountProfileSkeleton className={className} />;\n\n return (\n <MyAccountProfileContext value={contextValue}>\n <form\n ref={formRef}\n onSubmit={handleSubmit}\n className={className}\n data-fs-my-account-profile=\"\"\n data-fs-my-account-profile-mode={mode}\n {...(pending ? { 'data-fs-my-account-profile-pending': '' } : {})}\n >\n {children}\n </form>\n </MyAccountProfileContext>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Frame parts\n// ---------------------------------------------------------------------------\n\nexport const MyAccountProfileEditButtonDefinition = defineComponent<MyAccountProfileEditButtonProps>({\n name: 'MyAccountProfileEditButton',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileEditButton,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Edit Button', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'Edit', label: 'Button label' },\n },\n guideline:\n 'Switches MyAccountProfileRoot from the view state to the edit state. Renders only in the view state. Must be a descendant of MyAccountProfileRoot.',\n});\n\nexport function MyAccountProfileEditButton({ label = 'Edit', className, children }: MyAccountProfileEditButtonProps) {\n const { mode, edit } = useMyAccountProfile();\n if (mode !== 'view') return null;\n return (\n <button type=\"button\" onClick={edit} className={className} data-fs-my-account-profile-edit=\"\">\n {children ?? label}\n </button>\n );\n}\n\nexport const MyAccountProfileSaveButtonDefinition = defineComponent<MyAccountProfileSaveButtonProps>({\n name: 'MyAccountProfileSaveButton',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileSaveButton,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Save Button', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'Save', label: 'Button label' },\n },\n guideline:\n \"Submits MyAccountProfileRoot's batched Save. Renders only in the edit state; disabled while the write is pending. Must be a descendant of MyAccountProfileRoot.\",\n});\n\nexport function MyAccountProfileSaveButton({ label = 'Save', className, children }: MyAccountProfileSaveButtonProps) {\n const { mode, pending } = useMyAccountProfile();\n if (mode !== 'edit') return null;\n return (\n <button type=\"submit\" disabled={pending} className={className} data-fs-my-account-profile-save=\"\">\n {children ?? label}\n </button>\n );\n}\n\nexport const MyAccountProfileCancelButtonDefinition = defineComponent<MyAccountProfileCancelButtonProps>({\n name: 'MyAccountProfileCancelButton',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileCancelButton,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Cancel Button', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'Cancel', label: 'Button label' },\n },\n guideline:\n 'Reverts every field to its last saved value and returns MyAccountProfileRoot to the view state, without persisting. Renders only in the edit state; disabled while the write is pending. Must be a descendant of MyAccountProfileRoot.',\n});\n\nexport function MyAccountProfileCancelButton({\n label = 'Cancel',\n className,\n children,\n}: MyAccountProfileCancelButtonProps) {\n const { mode, pending, cancel } = useMyAccountProfile();\n if (mode !== 'edit') return null;\n return (\n <button\n type=\"button\"\n disabled={pending}\n onClick={cancel}\n className={className}\n data-fs-my-account-profile-cancel=\"\"\n >\n {children ?? label}\n </button>\n );\n}\n\nexport const MyAccountProfileEmailDefinition = defineComponent<MyAccountProfileEmailProps>({\n name: 'MyAccountProfileEmail',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileEmail,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Email', category: 'identity' },\n schema: {},\n guideline:\n \"The shopper's read-only login identifier, or nothing when absent. Never editable — no edit-state rendering exists for it. Must be a descendant of MyAccountProfileRoot.\",\n});\n\nexport function MyAccountProfileEmail({ className }: MyAccountProfileEmailProps) {\n const { email } = useMyAccountProfile();\n if (!email) return null;\n return (\n <p className={className} data-fs-my-account-profile-email=\"\">\n {email}\n </p>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Skeleton — no context: it is rendered directly by the Root before any Provider exists\n// (mirrors ProductShelfSkeleton / PricingSkeleton; see spec deviation note).\n// ---------------------------------------------------------------------------\n\nexport const MyAccountProfileSkeletonDefinition = defineComponent<ComponentPropsWithRef<'div'>>({\n name: 'MyAccountProfileSkeleton',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileSkeleton,\n editor: { label: 'My Account Profile Skeleton', category: 'identity' },\n schema: {},\n guideline:\n 'Loading placeholder rendered by MyAccountProfileRoot while $data is unresolved. Declares no context requirement — it renders before the Root has anything to provide.',\n});\n\nexport function MyAccountProfileSkeleton({ className, ...props }: ComponentPropsWithRef<'div'>) {\n return (\n <div {...props} className={className} data-fs-my-account-profile-skeleton=\"\" aria-hidden=\"true\">\n <span data-fs-my-account-profile-skeleton-line=\"\" />\n <span data-fs-my-account-profile-skeleton-line=\"\" />\n <span data-fs-my-account-profile-skeleton-line=\"\" />\n </div>\n );\n}\n\nMyAccountProfileRoot.Skeleton = MyAccountProfileSkeleton;\n\n// ---------------------------------------------------------------------------\n// Field Controls\n//\n// Each Control is a thin binding over an existing presentational particle: it registers with the\n// Root's registration seam in an effect, reads its value off `mode` (savedValues in view, draft in\n// edit), writes through `setField`, and wraps its input in an element carrying\n// `data-fs-my-account-profile-field` — the Root's DOM-order focus seam. None persists on its own.\n// ---------------------------------------------------------------------------\n\nexport type MyAccountProfileFirstNameControlProps = Readonly<{\n label?: string;\n requiredMessage?: string;\n className?: string;\n}>;\n\nexport const MyAccountProfileFirstNameControlDefinition = defineComponent<MyAccountProfileFirstNameControlProps>({\n name: 'MyAccountProfileFirstNameControl',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileFirstNameControl,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile First Name Control', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'First name', label: 'Label' },\n requiredMessage: { type: 'string', default: 'First name is required.', label: 'Required message' },\n },\n guideline:\n 'Draft-bound, required first-name field. Blocks Save with an inline message and focus when left empty. Must be a descendant of MyAccountProfileRoot.',\n});\n\nexport function MyAccountProfileFirstNameControl({\n label = 'First name',\n requiredMessage = 'First name is required.',\n className,\n}: MyAccountProfileFirstNameControlProps) {\n const { mode, draft, savedValues, fieldErrors, pending, registerField, setField } = useMyAccountProfile();\n\n useEffect(() => {\n return registerField({ key: 'firstName', validate: (value) => (value.trim() ? null : requiredMessage) });\n }, [requiredMessage, registerField]);\n\n const error = fieldErrors.firstName;\n\n if (mode === 'view') {\n return (\n <p className={className} data-fs-my-account-profile-first-name=\"\" data-fs-my-account-profile-field=\"firstName\">\n {savedValues.firstName}\n </p>\n );\n }\n\n return (\n <Field.Root\n className={className}\n invalid={!!error}\n disabled={pending}\n data-fs-my-account-profile-first-name=\"\"\n data-fs-my-account-profile-field=\"firstName\"\n >\n <Field.Label>{label}</Field.Label>\n <Field.Control\n value={draft.firstName}\n onChange={(event) => setField('firstName', event.target.value)}\n disabled={pending}\n />\n {error ? <Field.Error match>{error}</Field.Error> : null}\n </Field.Root>\n );\n}\n\nexport type MyAccountProfileLastNameControlProps = Readonly<{\n label?: string;\n requiredMessage?: string;\n className?: string;\n}>;\n\nexport const MyAccountProfileLastNameControlDefinition = defineComponent<MyAccountProfileLastNameControlProps>({\n name: 'MyAccountProfileLastNameControl',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileLastNameControl,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Last Name Control', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'Last name', label: 'Label' },\n requiredMessage: { type: 'string', default: 'Last name is required.', label: 'Required message' },\n },\n guideline:\n 'Draft-bound, required last-name field. Blocks Save with an inline message and focus when left empty. Must be a descendant of MyAccountProfileRoot.',\n});\n\nexport function MyAccountProfileLastNameControl({\n label = 'Last name',\n requiredMessage = 'Last name is required.',\n className,\n}: MyAccountProfileLastNameControlProps) {\n const { mode, draft, savedValues, fieldErrors, pending, registerField, setField } = useMyAccountProfile();\n\n useEffect(() => {\n return registerField({ key: 'lastName', validate: (value) => (value.trim() ? null : requiredMessage) });\n }, [requiredMessage, registerField]);\n\n const error = fieldErrors.lastName;\n\n if (mode === 'view') {\n return (\n <p className={className} data-fs-my-account-profile-last-name=\"\" data-fs-my-account-profile-field=\"lastName\">\n {savedValues.lastName}\n </p>\n );\n }\n\n return (\n <Field.Root\n className={className}\n invalid={!!error}\n disabled={pending}\n data-fs-my-account-profile-last-name=\"\"\n data-fs-my-account-profile-field=\"lastName\"\n >\n <Field.Label>{label}</Field.Label>\n <Field.Control\n value={draft.lastName}\n onChange={(event) => setField('lastName', event.target.value)}\n disabled={pending}\n />\n {error ? <Field.Error match>{error}</Field.Error> : null}\n </Field.Root>\n );\n}\n\nexport type MyAccountProfilePhoneControlProps = Readonly<{\n label?: string;\n /** Which draft key this instance binds. Compose the Control twice to expose both numbers. */\n field?: 'homePhone' | 'mobilePhone';\n country?: PhoneCountry;\n invalidMessage?: string;\n className?: string;\n}>;\n\nexport const MyAccountProfilePhoneControlDefinition = defineComponent<MyAccountProfilePhoneControlProps>({\n name: 'MyAccountProfilePhoneControl',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfilePhoneControl,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Phone Control', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'Phone', label: 'Label' },\n field: { type: ['homePhone', 'mobilePhone'] as const, default: 'mobilePhone', label: 'Bound field' },\n country: { type: ['US', 'BR'] as const, default: 'US', label: 'Country' },\n invalidMessage: { type: 'string', default: 'Invalid phone number', label: 'Invalid message' },\n },\n guideline:\n \"Draft-bound, optional phone field bound to either homePhone or mobilePhone via the field prop (Decision 1) — compose it twice to expose both numbers. Normalizes to E.164 on the Root's Save. Absent from the composition means absent from the payload. Must be a descendant of MyAccountProfileRoot.\",\n});\n\nexport function MyAccountProfilePhoneControl({\n label = 'Phone',\n field = 'mobilePhone',\n country = 'US',\n invalidMessage = 'Invalid phone number',\n className,\n}: MyAccountProfilePhoneControlProps) {\n const { mode, draft, savedValues, fieldErrors, pending, registerField, setField } = useMyAccountProfile();\n\n useEffect(() => {\n return registerField({\n key: field,\n validate: (value) => (value.trim() && !validatePhoneNumber(value, country) ? invalidMessage : null),\n normalize: (value) => (value.trim() ? toE164(value, country) : value),\n });\n }, [field, country, invalidMessage, registerField]);\n\n const error = fieldErrors[field];\n\n if (mode === 'view') {\n return (\n <p className={className} data-fs-my-account-profile-phone={field} data-fs-my-account-profile-field={field}>\n {savedValues[field] ? applyPhoneMask(savedValues[field], country) : ''}\n </p>\n );\n }\n\n return (\n <div data-fs-my-account-profile-field={field}>\n <PhoneField\n className={className}\n label={label}\n country={country}\n requirement=\"optional\"\n value={draft[field]}\n onValueChange={(value) => setField(field, value)}\n invalid={!!error}\n error={error ?? undefined}\n errorInvalid={invalidMessage}\n isDisabled={pending}\n data-fs-my-account-profile-phone={field}\n />\n </div>\n );\n}\n\nexport type MyAccountProfileTaxIdControlProps = Readonly<{\n label?: string;\n invalidMessage?: string;\n /** Inline reason shown beside the locked saved CPF. */\n lockedReason?: string;\n className?: string;\n}>;\n\nexport const MyAccountProfileTaxIdControlDefinition = defineComponent<MyAccountProfileTaxIdControlProps>({\n name: 'MyAccountProfileTaxIdControl',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileTaxIdControl,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Tax ID Control', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'National tax ID', label: 'Label' },\n invalidMessage: { type: 'string', default: 'Invalid document number.', label: 'Invalid message' },\n lockedReason: { type: 'string', default: \"Your document ID can't be edited.\", label: 'Locked reason' },\n },\n guideline:\n \"Draft-bound, optional national tax-ID field (CPF in V0). Self-gates on the Root's active document type. A saved value renders as a disabled, locked input in the edit state rather than disappearing (Decision 4); an unsaved value renders as an editable field. Must be a descendant of MyAccountProfileRoot.\",\n});\n\nexport function MyAccountProfileTaxIdControl({\n label = 'National tax ID',\n invalidMessage = 'Invalid document number.',\n lockedReason = \"Your document ID can't be edited.\",\n className,\n}: MyAccountProfileTaxIdControlProps) {\n const { mode, draft, savedValues, fieldErrors, pending, activeDocumentType, registerField, setField } =\n useMyAccountProfile();\n const documentType =\n activeDocumentType && isSupportedDocumentType(activeDocumentType) ? activeDocumentType : undefined;\n const hasSavedDocument = savedValues.document.trim() !== '';\n\n useEffect(() => {\n if (!documentType || hasSavedDocument) return;\n return registerField({\n key: 'document',\n validate: (value) => (value.trim() && !isValidDocument(value, documentType) ? invalidMessage : null),\n // DocumentField reports back the masked value (e.g. `111.444.777-35`); strip the punctuation\n // before it reaches the API, matching the checkout form's `stripNonDigits`.\n normalize: (value) => value.replaceAll(/\\D/g, ''),\n });\n }, [documentType, hasSavedDocument, invalidMessage, registerField]);\n\n if (!documentType) return null;\n\n const error = fieldErrors.document;\n\n if (mode === 'view') {\n return (\n <p className={className} data-fs-my-account-profile-tax-id=\"\" data-fs-my-account-profile-field=\"document\">\n {savedValues.document ? maskDocumentValue(savedValues.document, documentType) : ''}\n </p>\n );\n }\n\n if (hasSavedDocument) {\n return (\n <Field.Root\n className={className}\n data-fs-my-account-profile-tax-id=\"\"\n data-fs-my-account-profile-field=\"document\"\n >\n <Field.Label>{label}</Field.Label>\n <Field.Control\n readOnly\n aria-disabled=\"true\"\n title={lockedReason}\n value={maskDocumentValue(savedValues.document, documentType)}\n data-fs-my-account-profile-tax-id-readonly=\"\"\n />\n <Field.Description>{lockedReason}</Field.Description>\n </Field.Root>\n );\n }\n\n return (\n <DocumentField\n className={className}\n label={label}\n documentType={documentType}\n value={draft.document}\n onValueChange={(value) => setField('document', value)}\n invalid={!!error}\n errorMessage={error}\n disabled={pending}\n data-fs-my-account-profile-tax-id=\"\"\n data-fs-my-account-profile-field=\"document\"\n />\n );\n}\n\nexport type MyAccountProfileBirthDateControlProps = Readonly<{ label?: string; className?: string }>;\n\nexport const MyAccountProfileBirthDateControlDefinition = defineComponent<MyAccountProfileBirthDateControlProps>({\n name: 'MyAccountProfileBirthDateControl',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileBirthDateControl,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Birth Date Control', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'Birth date', label: 'Label' },\n },\n guideline:\n 'Draft-bound, optional birth-date field over a native date input. Maps the native yyyy-mm-dd value to the stored profile format on read and write. Must be a descendant of MyAccountProfileRoot.',\n});\n\nexport function MyAccountProfileBirthDateControl({\n label = 'Birth date',\n className,\n}: MyAccountProfileBirthDateControlProps) {\n const { mode, draft, savedValues, pending, registerField, setField } = useMyAccountProfile();\n\n useEffect(() => {\n return registerField({ key: 'birthDate', normalize: (value) => toStoredDate(value) });\n }, [registerField]);\n\n if (mode === 'view') {\n return (\n <p className={className} data-fs-my-account-profile-birth-date=\"\" data-fs-my-account-profile-field=\"birthDate\">\n {savedValues.birthDate}\n </p>\n );\n }\n\n function handleChange(event: ChangeEvent<HTMLInputElement>) {\n setField('birthDate', toStoredDate(event.target.value));\n }\n\n return (\n <Field.Root\n className={className}\n data-fs-my-account-profile-birth-date=\"\"\n data-fs-my-account-profile-field=\"birthDate\"\n >\n <Field.Label>{label}</Field.Label>\n <Input type=\"date\" value={toNativeDate(draft.birthDate)} onChange={handleChange} disabled={pending} />\n </Field.Root>\n );\n}\n\nexport type MyAccountProfileGenderOption = Readonly<{ value: string; label: string }>;\n\nexport type MyAccountProfileGenderControlProps = Readonly<{\n label?: string;\n placeholder?: string;\n clearLabel?: string;\n options?: readonly MyAccountProfileGenderOption[];\n className?: string;\n}>;\n\nexport const MyAccountProfileGenderControlDefinition = defineComponent<MyAccountProfileGenderControlProps>({\n name: 'MyAccountProfileGenderControl',\n importPath: '@vtex/faststore/components',\n component: MyAccountProfileGenderControl,\n requiresContext: 'my-account-profile',\n editor: { label: 'My Account Profile Gender Control', category: 'identity' },\n schema: {\n label: { type: 'string', default: 'Gender', label: 'Label' },\n placeholder: { type: 'string', default: 'Select', label: 'Placeholder' },\n clearLabel: { type: 'string', default: 'Clear', label: 'Clear button label' },\n },\n guideline:\n 'Draft-bound, optional gender field over a store-configurable set of options (the options prop). Free-string storage — no server-side enum. A Clear button erases a selected value back to empty, since the Select itself offers no such option. Must be a descendant of MyAccountProfileRoot.',\n});\n\nexport function MyAccountProfileGenderControl({\n label = 'Gender',\n placeholder = 'Select',\n clearLabel = 'Clear',\n options = DEFAULT_GENDER_OPTIONS,\n className,\n}: MyAccountProfileGenderControlProps) {\n const { mode, draft, savedValues, pending, registerField, setField } = useMyAccountProfile();\n\n useEffect(() => {\n return registerField({ key: 'gender' });\n }, [registerField]);\n\n if (mode === 'view') {\n const selected = options.find((option) => option.value === savedValues.gender);\n return (\n <p className={className} data-fs-my-account-profile-gender=\"\" data-fs-my-account-profile-field=\"gender\">\n {selected?.label ?? savedValues.gender}\n </p>\n );\n }\n\n return (\n <div className={className} data-fs-my-account-profile-gender=\"\" data-fs-my-account-profile-field=\"gender\">\n <Select.Root value={draft.gender} onValueChange={(value) => setField('gender', value ?? '')} disabled={pending}>\n <Select.Label>{label}</Select.Label>\n <Select.Trigger>\n <Select.Value placeholder={placeholder} />\n <Select.Icon />\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n <Select.List>\n {options.map((option) => (\n <Select.Item key={option.value} value={option.value}>\n <Select.ItemText>{option.label}</Select.ItemText>\n </Select.Item>\n ))}\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n {draft.gender ? (\n <button\n type=\"button\"\n onClick={() => setField('gender', '')}\n disabled={pending}\n data-fs-my-account-profile-gender-clear=\"\"\n >\n {clearLabel}\n </button>\n ) : null}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace export\n// ---------------------------------------------------------------------------\n\nexport const MyAccountProfile = {\n Root: MyAccountProfileRoot,\n RootDefinition: MyAccountProfileRootDefinition,\n EditButton: MyAccountProfileEditButton,\n EditButtonDefinition: MyAccountProfileEditButtonDefinition,\n SaveButton: MyAccountProfileSaveButton,\n SaveButtonDefinition: MyAccountProfileSaveButtonDefinition,\n CancelButton: MyAccountProfileCancelButton,\n CancelButtonDefinition: MyAccountProfileCancelButtonDefinition,\n Email: MyAccountProfileEmail,\n EmailDefinition: MyAccountProfileEmailDefinition,\n Skeleton: MyAccountProfileSkeleton,\n SkeletonDefinition: MyAccountProfileSkeletonDefinition,\n FirstNameControl: MyAccountProfileFirstNameControl,\n FirstNameControlDefinition: MyAccountProfileFirstNameControlDefinition,\n LastNameControl: MyAccountProfileLastNameControl,\n LastNameControlDefinition: MyAccountProfileLastNameControlDefinition,\n PhoneControl: MyAccountProfilePhoneControl,\n PhoneControlDefinition: MyAccountProfilePhoneControlDefinition,\n TaxIdControl: MyAccountProfileTaxIdControl,\n TaxIdControlDefinition: MyAccountProfileTaxIdControlDefinition,\n BirthDateControl: MyAccountProfileBirthDateControl,\n BirthDateControlDefinition: MyAccountProfileBirthDateControlDefinition,\n GenderControl: MyAccountProfileGenderControl,\n GenderControlDefinition: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U;GACV,2CAAwC;GAEvC,UAAA;EACK,CAAA,IACN,IACD;;AAET;AAMA,MAAa,mBAAmB;CAC9B,MAAM;CACN,gBAAgB;CAChB,YAAY;CACZ,sBAAsB;CACtB,YAAY;CACZ,sBAAsB;CACtB,cAAc;CACd,wBAAwB;CACxB,OAAO;CACP,iBAAiB;CACjB,UAAU;CACV,oBAAoB;CACpB,kBAAkB;CAClB,4BAA4B;CAC5B,iBAAiB;CACjB,2BAA2B;CAC3B,cAAc;CACd,wBAAwB;CACxB,cAAc;CACd,wBAAwB;CACxB,kBAAkB;CAClB,4BAA4B;CAC5B,eAAe;CACf,yBAAyB;AAC3B"}
|
|
@@ -4,8 +4,8 @@ import "../../core/dist/index.js";
|
|
|
4
4
|
import { Field } from "../../particles/field/field.js";
|
|
5
5
|
import { useActionsOverride } from "../../sdk/actions/actions-override-context.js";
|
|
6
6
|
import { useDataOverride } from "../../sdk/data/data-override-context.js";
|
|
7
|
-
import { AddressSummary, AddressSummaryRoot } from "../../particles/address-summary/address-summary.js";
|
|
8
7
|
import { Select } from "../../particles/select/select.js";
|
|
8
|
+
import { AddressSummary, AddressSummaryRoot } from "../../particles/address-summary/address-summary.js";
|
|
9
9
|
import "../../sdk/shipping/shipping-operations.js";
|
|
10
10
|
import { getAvailableCountries, getCountryDescriptor } from "./country-descriptors.js";
|
|
11
11
|
import { cloneElement, createContext, isValidElement, useCallback, useContext, useEffect, useMemo, useRef, useState } from "react";
|
|
@@ -14,7 +14,7 @@ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
/**
|
|
15
15
|
* Shipping address step (T2 — Enter and save the delivery address).
|
|
16
16
|
* Single-file matter per ADR-0001; batches form state and writes once via shipping.setAddress.
|
|
17
|
-
* Controls are thin context-bound components that read/write draft state (
|
|
17
|
+
* Controls are thin context-bound components that read/write draft state (docs/storefront-core/reference-cart.md § Delivery).
|
|
18
18
|
*/
|
|
19
19
|
const fragment = `
|
|
20
20
|
fragment ShippingAddressData on Query {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"shipping-address.js","names":[],"sources":["../../../src/matter/shipping-address/shipping-address.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { AddressSummary, AddressSummaryRoot } from '../../particles/address-summary/address-summary.js';\nimport type { DrawerRootProps } from '../../particles/drawer/drawer.js';\nimport { Field } from '../../particles/field/field.js';\nimport { Select } from '../../particles/select/select.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport {\n SHIPPING_NETWORK_ERROR_CODE,\n type ShippingAddressInput,\n type ShippingAddressUpdateErrorEntity,\n} from '../../sdk/shipping/shipping-operations.js';\nimport type { CountryDescriptor } from './country-descriptors.js';\nimport { getAvailableCountries, getCountryDescriptor } from './country-descriptors.js';\n\n/**\n * Shipping address step (T2 — Enter and save the delivery address).\n * Single-file matter per ADR-0001; batches form state and writes once via shipping.setAddress.\n * Controls are thin context-bound components that read/write draft state (specs/shipping-address-step.md).\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment ShippingAddressData on Query {\n shipping {\n __typename\n id\n address {\n __typename\n id\n recipientName\n postalCode\n country\n street\n number\n complement\n neighborhood\n city\n state\n }\n savedAddresses {\n __typename\n id\n recipientName\n postalCode\n country\n street\n number\n complement\n neighborhood\n city\n state\n }\n }\n clientProfile {\n __typename\n firstName\n lastName\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * The `$data` slice forwarded by the reactive runtime. `ShippingAddressData` selects two root\n * fields (`shipping`, `clientProfile`), so the compiler composes them via\n * `MultipleReactiveDataProvider`, which keys each entity's resolved slice by its own root field —\n * `$data` is `{ shipping: {...}, clientProfile: {...} }`, not a flat/unwrapped shape (that unwrapped\n * shape only applies to single-root-field fragments, e.g. CartTotalizerRoot's `$data.totalizers`).\n */\nexport type ShippingAddressData = {\n shipping?: {\n address?: {\n id?: string | null;\n recipientName?: string | null;\n postalCode?: string | null;\n country?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n } | null;\n savedAddresses?: Array<{\n id?: string | null;\n recipientName?: string | null;\n postalCode?: string | null;\n country?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n }>;\n } | null;\n clientProfile?: {\n firstName?: string | null;\n lastName?: string | null;\n } | null;\n} | null;\n\n/** The batched draft state, keyed by canonical field name (Decision 1). */\ntype AddressDraft = {\n recipientName: string;\n postalCode: string;\n country: string;\n street: string;\n number: string;\n complement: string;\n neighborhood: string;\n city: string;\n state: string;\n};\n\n/** Context value for child Controls to read/write the draft and access the descriptor. */\ntype ShippingAddressContextValue = {\n draft: AddressDraft;\n setDraftField: (field: keyof AddressDraft, value: string) => void;\n descriptor: CountryDescriptor | undefined;\n savedAddresses: Array<{ id: string; address: Partial<AddressDraft> }>;\n selectedSavedId: string | undefined;\n setSelectedSavedId: (id: string | undefined) => void;\n submitting: boolean;\n errors: readonly ShippingAddressUpdateErrorEntity[];\n upstreamError: boolean;\n handleSubmit: () => void;\n currentAddressId: string | undefined;\n /** Formatted current address fields; undefined when there is no current address yet. */\n currentAddress: Partial<AddressDraft> | undefined;\n /**\n * Increments once per successful `setAddress` call (main form submit or drawer submit).\n * Consumed by `ShippingAddressEditController` to switch back to view mode without\n * `ShippingAddressSubmit`/`ShippingAddressSavedAddressSubmit` needing to know about\n * view/edit mode — mirrors the `cartLastAddVar` pulse pattern in matter/cart/cart.tsx,\n * but scoped to this Root's own context since the signal originates and is consumed\n * entirely within this subtree (no cross-tree/global signal needed here).\n */\n submitSuccessSignal: number;\n isFormValid: boolean;\n /**\n * Throws away in-progress edits: re-seeds every field from the stored address and drops the touch marks.\n * Consumed by `ShippingAddressCancelButton`, which would otherwise leave the abandoned values in the\n * draft — the Root outlives the form, and touched fields are never re-seeded.\n */\n discardDraft: () => void;\n};\n\nconst SHIPPING_ADDRESS_CONTEXT_UNSET = Symbol('ShippingAddressContextUnset');\n\nconst ShippingAddressContext = createContext<ShippingAddressContextValue | typeof SHIPPING_ADDRESS_CONTEXT_UNSET>(\n SHIPPING_ADDRESS_CONTEXT_UNSET,\n);\n\nfunction useShippingAddressContext(): ShippingAddressContextValue {\n const ctx = useContext(ShippingAddressContext);\n if (ctx === SHIPPING_ADDRESS_CONTEXT_UNSET) {\n throw new Error('ShippingAddress components must be used inside ShippingAddressRoot.');\n }\n return ctx;\n}\n\n/**\n * Drawer flow state (US-8), kept in its own context separate from ShippingAddressContext so the\n * main data/actions context — read by every field Control — stays unaware of this one downstream\n * UI surface. Only ShippingAddressSavedAddressDrawerController and ShippingAddressSavedAddressSubmit\n * consume it.\n */\ntype ShippingAddressDrawerContextValue = {\n savedAddressDrawerOpen: boolean;\n setSavedAddressDrawerOpen: (open: boolean) => void;\n drawerSubmitting: boolean;\n handleDrawerSubmit: () => void;\n};\n\nconst SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET = Symbol('ShippingAddressDrawerContextUnset');\n\nconst ShippingAddressDrawerContext = createContext<\n ShippingAddressDrawerContextValue | typeof SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET\n>(SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET);\n\nfunction useShippingAddressDrawerContext(): ShippingAddressDrawerContextValue {\n const ctx = useContext(ShippingAddressDrawerContext);\n if (ctx === SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET) {\n throw new Error(\n 'ShippingAddressSavedAddressDrawerController and ShippingAddressSavedAddressSubmit must be used inside ShippingAddressRoot.',\n );\n }\n return ctx;\n}\n\n/**\n * View/edit mode state (view/edit toggle), kept in its own context — separate from\n * ShippingAddressContext and ShippingAddressDrawerContext — so neither of those needs to know\n * this UI surface exists. Consumed by ShippingAddressSummaryView, ShippingAddressEditForm,\n * ShippingAddressEditButton and ShippingAddressCancelButton; the last two are its only writers.\n */\n/** Internal: the section's two states never reach the schema, because each has its own component. */\ntype ShippingAddressSectionState = 'view' | 'edit';\n\ntype ShippingAddressSectionContextValue = {\n mode: ShippingAddressSectionState;\n setMode: (mode: ShippingAddressSectionState) => void;\n};\n\nconst SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET = Symbol('ShippingAddressSectionContextUnset');\n\nconst ShippingAddressSectionContext = createContext<\n ShippingAddressSectionContextValue | typeof SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET\n>(SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET);\n\nfunction useShippingAddressSectionContext(): ShippingAddressSectionContextValue {\n const ctx = useContext(ShippingAddressSectionContext);\n if (ctx === SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET) {\n throw new Error(\n 'ShippingAddressSummaryView, ShippingAddressEditForm, ShippingAddressEditButton and ShippingAddressCancelButton must be used inside ShippingAddressEditController.',\n );\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Props Types\n// ---------------------------------------------------------------------------\n\nexport type ShippingAddressRootProps = {\n /** Default country (ISO alpha-3) when no address exists. */\n defaultCountry?: string;\n className?: string;\n children?: ReactNode;\n /** `ShippingAddressData` forwarded by the reactive runtime. */\n $data?: ShippingAddressData;\n /** Compiler-injected action surface; carries `shipping.setAddress`. */\n $actions?: ComponentActions;\n};\n\nexport type ShippingAddressStreetControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressNumberControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressCityControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressStateControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressPostalCodeControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressComplementControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressNeighborhoodControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressCountryControlProps = {\n className?: string;\n label?: string;\n};\n\nexport type ShippingAddressRecipientNameControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressSavedListProps = {\n className?: string;\n};\n\nexport type ShippingAddressSavedOptionProps = {\n id: string;\n className?: string;\n};\n\nexport type ShippingAddressSubmitProps = {\n className?: string;\n label?: string;\n pendingLabel?: string;\n};\n\nexport type ShippingAddressErrorProps = {\n className?: string;\n};\n\nexport type ShippingAddressSavedAddressDrawerControllerProps = {\n children?: ReactNode;\n};\n\nexport type ShippingAddressSavedAddressSubmitProps = {\n className?: string;\n label?: string;\n pendingLabel?: string;\n};\n\nexport type ShippingAddressSelectedSummaryProps = {\n className?: string;\n /**\n * The lines to render, in order — typically the `AddressSummaryRecipient` / `Street` / `Locality`\n * leaves. Defaults to recipient, street, locality when omitted.\n */\n children?: ReactNode;\n};\n\nexport type ShippingAddressEditControllerProps = {\n children?: ReactNode;\n};\n\nexport type ShippingAddressSectionPanelProps = {\n children?: ReactNode;\n};\n\nexport type ShippingAddressEditButtonProps = {\n className?: string;\n label?: string;\n /** Compose custom button content (e.g. an Icon plus text); falls back to `label`. */\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// Root Definition\n// ---------------------------------------------------------------------------\n\nexport const ShippingAddressRootDefinition = defineComponent<ShippingAddressRootProps>({\n name: 'ShippingAddressRoot',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressRoot,\n fragment,\n fetchStrategy: 'reactive',\n providesContext: 'shipping-address',\n actions: { shipping: ['setAddress'] },\n editor: { label: 'Shipping Address Root', category: 'content' },\n schema: {\n defaultCountry: { type: 'string', default: 'BRA', label: 'Default country (ISO-3)' },\n },\n guideline:\n 'Country-adaptive single-address delivery form; batches all fields and writes once via shipping.setAddress. See shipping-address.md.',\n});\n\n// Control Definitions\nexport const ShippingAddressRecipientNameControlDefinition = defineComponent<ShippingAddressRecipientNameControlProps>({\n name: 'ShippingAddressRecipientNameControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressRecipientNameControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Recipient Name Control', category: 'action' },\n schema: {},\n guideline: 'Recipient-name input field; required for submit. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressStreetControlDefinition = defineComponent<ShippingAddressStreetControlProps>({\n name: 'ShippingAddressStreetControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressStreetControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Street Control', category: 'action' },\n schema: {},\n guideline: 'Street name input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressNumberControlDefinition = defineComponent<ShippingAddressNumberControlProps>({\n name: 'ShippingAddressNumberControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressNumberControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Number Control', category: 'action' },\n schema: {},\n guideline: 'Street number input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressCityControlDefinition = defineComponent<ShippingAddressCityControlProps>({\n name: 'ShippingAddressCityControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressCityControl,\n requiresContext: 'shipping-address',\n editor: { label: 'City Control', category: 'action' },\n schema: {},\n guideline: 'City name input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressStateControlDefinition = defineComponent<ShippingAddressStateControlProps>({\n name: 'ShippingAddressStateControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressStateControl,\n requiresContext: 'shipping-address',\n editor: { label: 'State Control', category: 'action' },\n schema: {},\n guideline: 'State/province input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressPostalCodeControlDefinition = defineComponent<ShippingAddressPostalCodeControlProps>({\n name: 'ShippingAddressPostalCodeControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressPostalCodeControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Postal Code Control', category: 'action' },\n schema: {},\n guideline: 'Postal code input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressComplementControlDefinition = defineComponent<ShippingAddressComplementControlProps>({\n name: 'ShippingAddressComplementControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressComplementControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Complement Control', category: 'action' },\n schema: {},\n guideline: 'Complement (apartment, suite, etc.) input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressNeighborhoodControlDefinition = defineComponent<ShippingAddressNeighborhoodControlProps>({\n name: 'ShippingAddressNeighborhoodControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressNeighborhoodControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Neighborhood Control', category: 'action' },\n schema: {},\n guideline:\n 'Neighborhood (bairro) input field; shown only for countries that have this field (BR in v1). Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressCountryControlDefinition = defineComponent<ShippingAddressCountryControlProps>({\n name: 'ShippingAddressCountryControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressCountryControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Country Control', category: 'action' },\n schema: {\n label: { type: 'string', default: 'país', label: 'Field label' },\n },\n guideline:\n 'Country selector; lists only countries with an implemented descriptor. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressSavedListDefinition = defineComponent<ShippingAddressSavedListProps>({\n name: 'ShippingAddressSavedList',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedList,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address List', category: 'commerce' },\n schema: {},\n guideline:\n 'List of saved addresses for logged-in shoppers; renders only if savedAddresses is non-empty. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressSavedOptionDefinition = defineComponent<ShippingAddressSavedOptionProps>({\n name: 'ShippingAddressSavedOption',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedOption,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address Option', category: 'commerce' },\n schema: { id: { type: 'string', label: 'Saved address ID' } },\n guideline:\n 'A single saved address option; renders its address via the same AddressSummary particle (through its own AddressSummaryRoot) used by ShippingAddressSelectedSummary, so both share one formatting implementation. Must be a descendant of ShippingAddressSavedList.',\n});\n\nexport const ShippingAddressSubmitDefinition = defineComponent<ShippingAddressSubmitProps>({\n name: 'ShippingAddressSubmit',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSubmit,\n requiresContext: 'shipping-address',\n editor: { label: 'Shipping Address Submit', category: 'action' },\n schema: {\n label: { type: 'string', default: 'salvar endereço', label: 'Button label' },\n pendingLabel: { type: 'string', default: 'salvando...', label: 'Pending label' },\n },\n guideline:\n 'Submit button; dispatches the batched address write. Disabled until recipient name is non-blank. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressErrorDefinition = defineComponent<ShippingAddressErrorProps>({\n name: 'ShippingAddressError',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressError,\n requiresContext: 'shipping-address',\n editor: { label: 'Shipping Address Error', category: 'commerce' },\n schema: {},\n guideline:\n 'Error banner; shows domain validation errors inline or a generic upstream-error state. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressSavedAddressDrawerControllerDefinition =\n defineComponent<ShippingAddressSavedAddressDrawerControllerProps>({\n name: 'ShippingAddressSavedAddressDrawerController',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedAddressDrawerController,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address Drawer Controller', category: 'action' },\n schema: {},\n guideline:\n 'Wraps a single DrawerRoot child (the saved-address selection drawer) and makes it controlled by the shipping-address drawer state: open state and blocked-dismissal-while-submitting are handled here, so do not set raw open/onOpenChange on the wrapped DrawerRoot. Compose as the parent of DrawerRoot, with the drawer trigger and popup as DrawerRoot descendants, same pattern as CartOpenOnAdd wrapping the mini-cart DrawerRoot. Must be inside ShippingAddressRoot.',\n });\n\nexport const ShippingAddressSavedAddressSubmitDefinition = defineComponent<ShippingAddressSavedAddressSubmitProps>({\n name: 'ShippingAddressSavedAddressSubmit',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedAddressSubmit,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address Submit', category: 'action' },\n schema: {\n label: { type: 'string', default: 'selecionar', label: 'Button label' },\n pendingLabel: { type: 'string', default: 'selecionando...', label: 'Pending label' },\n },\n guideline:\n \"The drawer's \\\"selecionar\\\" submit button; independent submitting state from the main form's Submit (Decision 7); no-ops when the selected saved address is already the current one (Decision 8). Must be inside the saved-address drawer's DrawerPopup and inside ShippingAddressRoot.\",\n});\n\nexport const ShippingAddressSelectedSummaryDefinition = defineComponent<ShippingAddressSelectedSummaryProps>({\n name: 'ShippingAddressSelectedSummary',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSelectedSummary,\n requiresContext: 'shipping-address',\n providesContext: 'address-summary',\n editor: { label: 'Selected Address Summary', category: 'commerce' },\n schema: {},\n guideline:\n 'Provides the current delivery address to the generic AddressSummary particle via AddressSummaryRoot context, and renders the default AddressSummary when composed with no children. Compose AddressSummaryRecipient / Street / Locality directly to choose the order or drop a line. Self-gates to null when there is no current address yet. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressEditControllerDefinition = defineComponent<ShippingAddressEditControllerProps>({\n name: 'ShippingAddressEditController',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressEditController,\n requiresContext: 'shipping-address',\n providesContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Edit Controller', category: 'commerce' },\n schema: {},\n guideline:\n \"Owns the view/edit toggle for the delivery address section: defaults to view when a current address exists, edit otherwise; switches back to view automatically whenever setAddress succeeds (main form submit or saved-address drawer submit), without ShippingAddressSubmit/ShippingAddressSavedAddressSubmit needing to know about this mode. Compose a ShippingAddressSummaryView holding SelectedSummary + EditButton and a ShippingAddressEditForm holding the form Controls/Submit/Error. Self-contained: it decides from its own data and the shopper's own presses, so no other section opens it and finishing it opens nothing. Must be inside ShippingAddressRoot.\",\n});\n\nexport const ShippingAddressSummaryViewDefinition = defineComponent<ShippingAddressSectionPanelProps>({\n name: 'ShippingAddressSummaryView',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSummaryView,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Summary View', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders its children only while the delivery section shows the saved-address summary, and nothing while it shows the form. Compose SelectedSummary and a ShippingAddressEditButton inside. Takes no props: which state it gates is which component it is. Must be inside a ShippingAddressEditController.',\n});\n\nexport const ShippingAddressEditFormDefinition = defineComponent<ShippingAddressSectionPanelProps>({\n name: 'ShippingAddressEditForm',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressEditForm,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Edit Form', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders its children only while the delivery section shows the address form, and nothing while it shows the summary. Compose the Controls, Submit and Error parts inside. Must be inside a ShippingAddressEditController.',\n});\n\nexport const ShippingAddressEditButtonDefinition = defineComponent<ShippingAddressEditButtonProps>({\n name: 'ShippingAddressEditButton',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressEditButton,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Edit Button', category: 'action' },\n schema: {\n label: { type: 'string', default: 'editar', label: 'Button label' },\n },\n guideline:\n 'CTA that switches the view/edit mode to edit. Typically placed inside a ShippingAddressSummaryView, next to SelectedSummary. Must be inside ShippingAddressEditController.',\n});\n\nexport const ShippingAddressCancelButtonDefinition = defineComponent<ShippingAddressEditButtonProps>({\n name: 'ShippingAddressCancelButton',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressCancelButton,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Cancel Button', category: 'action' },\n schema: {\n label: { type: 'string', default: 'cancelar', label: 'Button label' },\n },\n guideline:\n 'Returns the delivery section to its summary without saving. Place it inside a ShippingAddressEditForm so a shopper who opened the form has a way back that does not depend on a successful write. Must be inside ShippingAddressEditController.',\n});\n\n// ---------------------------------------------------------------------------\n// Root Component\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressRoot owns the batched form state, manages the current descriptor,\n * and provides context to child Controls. It handles submit dispatch and error tracking.\n */\nexport function ShippingAddressRoot({\n defaultCountry = 'BRA',\n className,\n children,\n $data: $dataProp,\n $actions: $actionsProp,\n}: Readonly<ShippingAddressRootProps>) {\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n\n // Current address and saved addresses from the fragment\n const currentAddress = $data?.shipping?.address;\n const savedAddresses = $data?.shipping?.savedAddresses ?? [];\n const clientProfile = $data?.clientProfile;\n\n // Joined shopper-profile name (US-4) — the single fallback for recipientName whenever an\n // address record (the current address, or a saved address picked from the drawer) has none.\n // Always applied as a real draft value, never just a placeholder hint, so the shopper never has\n // to retype a name the profile already has.\n const joinedProfileName = [clientProfile?.firstName, clientProfile?.lastName].filter(Boolean).join(' ');\n\n // Seeds the batched draft from the current address, falling back to empty. The recipient name defaults to\n // the joined profile name when the address has none (US-4): it must be a real pre-filled value, not just a\n // placeholder hint, so the shopper can submit without retyping it. Shared with `discardDraft` below so the\n // initial seed and the cancel path cannot drift apart.\n const seedDraft = useCallback(\n (): AddressDraft => ({\n recipientName: currentAddress?.recipientName ?? joinedProfileName,\n postalCode: currentAddress?.postalCode ?? '',\n country: currentAddress?.country ?? defaultCountry,\n street: currentAddress?.street ?? '',\n number: currentAddress?.number ?? '',\n complement: currentAddress?.complement ?? '',\n neighborhood: currentAddress?.neighborhood ?? '',\n city: currentAddress?.city ?? '',\n state: currentAddress?.state ?? '',\n }),\n [currentAddress, joinedProfileName, defaultCountry],\n );\n\n const [draft, setDraft] = useState<AddressDraft>(seedDraft);\n\n // Error tracking and submission state\n const [submitting, setSubmitting] = useState(false);\n const [errors, setErrors] = useState<readonly ShippingAddressUpdateErrorEntity[]>([]);\n const [upstreamError, setUpstreamError] = useState(false);\n const [selectedSavedId, setSelectedSavedId] = useState<string | undefined>();\n const [savedAddressDrawerOpen, setSavedAddressDrawerOpen] = useState(false);\n const [drawerSubmitting, setDrawerSubmitting] = useState(false);\n const [submitSuccessSignal, setSubmitSuccessSignal] = useState(0);\n\n // Per-field dirty tracking. `draft`'s initial state is set once (via useState's lazy\n // initializer) from whatever currentAddress holds on this component's first render — for a live\n // page, the reactive fragment often resolves asynchronously after that first render\n // (currentAddress starts undefined), so draft needs to catch up once it arrives. Tracked per\n // field, not as one global flag, so editing one field doesn't stop the others from picking up a\n // later currentAddress update (US-1, third criterion: \"untouched fields reflect the new values\").\n const [touchedFields, setTouchedFields] = useState<ReadonlySet<keyof AddressDraft>>(() => new Set());\n\n // Cancelling throws the edit away, and the marks have to go with the values. They are deliberately kept\n // after a successful write — a server that has not echoed the recipient back would otherwise re-seed the\n // profile name over what the shopper typed — but an abandoned edit has nothing worth preserving, and a\n // mark left behind would keep the stored value permanently out of reach of the re-seed effect below.\n const discardDraft = useCallback(() => {\n setTouchedFields(new Set());\n setDraft(seedDraft());\n setErrors([]);\n setUpstreamError(false);\n }, [seedDraft]);\n\n const currentAddressSnapshot = JSON.stringify(currentAddress ?? null);\n const clientProfileSnapshot = JSON.stringify(clientProfile ?? null);\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the stringified snapshots (currentAddressSnapshot/clientProfileSnapshot), not object identity, so the effect doesn't refire on every render when Apollo returns a new-but-equal object reference.\n useEffect(() => {\n setDraft((prev) => {\n return {\n recipientName: touchedFields.has('recipientName')\n ? prev.recipientName\n : (currentAddress?.recipientName ?? (joinedProfileName || prev.recipientName)),\n postalCode: touchedFields.has('postalCode') ? prev.postalCode : (currentAddress?.postalCode ?? prev.postalCode),\n country: touchedFields.has('country') ? prev.country : (currentAddress?.country ?? prev.country),\n street: touchedFields.has('street') ? prev.street : (currentAddress?.street ?? prev.street),\n number: touchedFields.has('number') ? prev.number : (currentAddress?.number ?? prev.number),\n complement: touchedFields.has('complement') ? prev.complement : (currentAddress?.complement ?? prev.complement),\n neighborhood: touchedFields.has('neighborhood')\n ? prev.neighborhood\n : (currentAddress?.neighborhood ?? prev.neighborhood),\n city: touchedFields.has('city') ? prev.city : (currentAddress?.city ?? prev.city),\n state: touchedFields.has('state') ? prev.state : (currentAddress?.state ?? prev.state),\n };\n });\n }, [currentAddressSnapshot, clientProfileSnapshot, touchedFields]);\n\n // Compute current address ID for comparison with saved addresses (Decision 8)\n const currentAddressId = currentAddress?.id ?? undefined;\n\n // Formatted current address for read-only display (ShippingAddressSelectedSummary);\n // undefined when there is no current address yet, so the summary can self-gate on it.\n const formattedCurrentAddress = useMemo(() => {\n if (!currentAddress) return undefined;\n return {\n recipientName: currentAddress.recipientName ?? '',\n postalCode: currentAddress.postalCode ?? '',\n country: currentAddress.country ?? '',\n street: currentAddress.street ?? '',\n number: currentAddress.number ?? '',\n complement: currentAddress.complement ?? '',\n neighborhood: currentAddress.neighborhood ?? '',\n city: currentAddress.city ?? '',\n state: currentAddress.state ?? '',\n } satisfies Partial<AddressDraft>;\n }, [currentAddress]);\n\n // Get the current descriptor based on draft country\n const descriptor = getCountryDescriptor(draft.country);\n\n // Map saved addresses with extracted address data\n const mappedSavedAddresses = useMemo(\n () =>\n savedAddresses.map((saved) => ({\n id: saved.id ?? '',\n address: {\n recipientName: saved.recipientName ?? '',\n postalCode: saved.postalCode ?? '',\n country: saved.country ?? '',\n street: saved.street ?? '',\n number: saved.number ?? '',\n complement: saved.complement ?? '',\n neighborhood: saved.neighborhood ?? '',\n city: saved.city ?? '',\n state: saved.state ?? '',\n } as Partial<AddressDraft>,\n })),\n [savedAddresses],\n );\n\n // Update a single draft field\n const setDraftField = useCallback((field: keyof AddressDraft, value: string) => {\n setTouchedFields((prev) => (prev.has(field) ? prev : new Set(prev).add(field)));\n setDraft((prev) => ({ ...prev, [field]: value }));\n }, []);\n\n // Handle saved option selection\n const selectSavedAddress = useCallback(\n (id: string | undefined) => {\n setSelectedSavedId(id);\n if (id) {\n const saved = mappedSavedAddresses.find((s) => s.id === id);\n if (saved?.address) {\n // Selecting a saved address replaces the whole draft with its fields, so mark every\n // field touched — otherwise a later currentAddress sync could clobber this selection.\n setTouchedFields((prev) => new Set([...prev, ...(Object.keys(saved.address) as Array<keyof AddressDraft>)]));\n // A saved address can legitimately have a blank recipientName (Decision 9); fall back to\n // the joined profile name here too, same as the no-address case (US-4), so the field shows\n // a real pre-filled value instead of an empty string masquerading behind a placeholder.\n setDraft((prev) => ({\n ...prev,\n ...saved.address,\n recipientName: saved.address.recipientName || joinedProfileName,\n }));\n }\n }\n },\n [mappedSavedAddresses, joinedProfileName],\n );\n\n // Client-side validation: non-blank recipientName required\n const isFormValid = draft.recipientName.trim().length > 0;\n\n // Submit handler: dispatch setAddress action\n const handleSubmit = useCallback(async () => {\n if (!isFormValid || submitting) return;\n\n if (!$actions?.shipping?.setAddress) return;\n\n setSubmitting(true);\n setErrors([]);\n setUpstreamError(false);\n\n try {\n // Build input, including savedAddressId only if one was selected (US-3, third acceptance criterion).\n // Only include a field the active country's descriptor actually declares (US-2, third/fourth\n // criteria) — otherwise a stale value from a previously-selected country (e.g. `neighborhood`\n // retained in the draft after switching BR -> USA) would leak into the submitted payload.\n const isFieldActive = (field: keyof AddressDraft) => descriptor?.fields.some((f) => f.name === field) ?? false;\n\n const addressFields = {\n recipientName: draft.recipientName.trim(),\n postalCode: draft.postalCode,\n country: draft.country,\n ...(isFieldActive('street') ? { street: draft.street } : {}),\n ...(isFieldActive('number') ? { number: draft.number } : {}),\n ...(isFieldActive('complement') ? { complement: draft.complement } : {}),\n ...(isFieldActive('neighborhood') ? { neighborhood: draft.neighborhood } : {}),\n ...(isFieldActive('city') ? { city: draft.city } : {}),\n ...(isFieldActive('state') ? { state: draft.state } : {}),\n };\n\n const input: ShippingAddressInput = selectedSavedId\n ? { savedAddressId: selectedSavedId, ...addressFields }\n : addressFields;\n\n const userErrors = await $actions.shipping.setAddress(input);\n if (userErrors.length === 0) {\n // Success: cache merge will reactively update the form (US-5, second criterion). The touched\n // marks stay: dropping them re-arms the seeding effect, which would overwrite a recipient the\n // shopper typed with the profile-name fallback whenever the stored address still carries none.\n setErrors([]);\n setSubmitSuccessSignal((n) => n + 1);\n } else if (userErrors.some((e) => e.code === SHIPPING_NETWORK_ERROR_CODE)) {\n // The action resolves (never throws) the synthetic upstream/network failure as a userError;\n // route it to the generic error state, not the inline domain list (US-6 2nd criterion,\n // Decision 5). Draft retained (US-6, third criterion).\n setErrors([]);\n setUpstreamError(true);\n } else {\n // Domain userErrors render inline; retain draft on error (US-6, third criterion)\n setErrors(userErrors);\n }\n } catch (error) {\n // Network/upstream error: surface as generic state (US-6, second criterion)\n console.error('[ShippingAddress] setAddress failed:', error);\n setUpstreamError(true);\n setErrors([]);\n } finally {\n setSubmitting(false);\n }\n }, [isFormValid, submitting, $actions?.shipping?.setAddress, draft, selectedSavedId, descriptor]);\n\n // Drawer submit handler: dispatch setAddress for the selected saved address (US-8, Decision 7)\n const handleDrawerSubmit = useCallback(async () => {\n // Guard: if nothing picked in the drawer, return immediately\n if (!selectedSavedId) return;\n\n // No-op guard (Decision 8): if the selected address is already current, just close and return\n if (currentAddressId !== undefined && selectedSavedId === currentAddressId) {\n setSavedAddressDrawerOpen(false);\n return;\n }\n\n const selectedAddress = mappedSavedAddresses.find((s) => s.id === selectedSavedId);\n if (!selectedAddress) return;\n\n // Incomplete saved address (missing the one client-enforced field, recipientName): an\n // auto-submit would only fail server-side with MISSING_RECIPIENT_NAME. selectSavedAddress\n // already populated the draft from this record when it was picked, so just close the drawer\n // and let the shopper review/complete it via the main form's own submit (Decision 9).\n if (!selectedAddress.address.recipientName?.trim()) {\n setSavedAddressDrawerOpen(false);\n return;\n }\n\n if (!$actions?.shipping?.setAddress) return;\n\n setDrawerSubmitting(true);\n setErrors([]);\n setUpstreamError(false);\n\n try {\n // Build input from the saved address's stored fields (Decision 6)\n const input: ShippingAddressInput = {\n savedAddressId: selectedSavedId,\n recipientName: selectedAddress.address.recipientName || '',\n postalCode: selectedAddress.address.postalCode || '',\n country: selectedAddress.address.country || '',\n street: selectedAddress.address.street || '',\n number: selectedAddress.address.number || '',\n complement: selectedAddress.address.complement || '',\n neighborhood: selectedAddress.address.neighborhood || '',\n city: selectedAddress.address.city || '',\n state: selectedAddress.address.state || '',\n };\n\n const userErrors = await $actions.shipping.setAddress(input);\n if (userErrors.length === 0) {\n // Success: close the drawer (7th acceptance criterion)\n setErrors([]);\n setSavedAddressDrawerOpen(false);\n setSubmitSuccessSignal((n) => n + 1);\n } else if (userErrors.some((e) => e.code === SHIPPING_NETWORK_ERROR_CODE)) {\n // Resolved synthetic upstream/network failure: generic error state (Decision 5).\n setErrors([]);\n setUpstreamError(true);\n } else {\n // Domain userErrors render inline; leave drawer open for retry (7th acceptance criterion)\n setErrors(userErrors);\n }\n } catch (error) {\n // Network/upstream error: surface as generic state and leave drawer open\n console.error('[ShippingAddress] drawer submit failed:', error);\n setUpstreamError(true);\n setErrors([]);\n } finally {\n setDrawerSubmitting(false);\n }\n }, [selectedSavedId, currentAddressId, mappedSavedAddresses, $actions?.shipping?.setAddress]);\n\n // Provide context to all children\n const contextValue: ShippingAddressContextValue = {\n draft,\n setDraftField,\n descriptor,\n savedAddresses: mappedSavedAddresses,\n selectedSavedId,\n setSelectedSavedId: selectSavedAddress,\n submitting,\n errors,\n upstreamError,\n handleSubmit,\n currentAddressId,\n currentAddress: formattedCurrentAddress,\n submitSuccessSignal,\n isFormValid,\n discardDraft,\n };\n\n const drawerContextValue: ShippingAddressDrawerContextValue = {\n savedAddressDrawerOpen,\n setSavedAddressDrawerOpen,\n drawerSubmitting,\n handleDrawerSubmit,\n };\n\n return (\n <ShippingAddressContext.Provider value={contextValue}>\n <ShippingAddressDrawerContext.Provider value={drawerContextValue}>\n <div className={className} data-fs-shipping-address=\"\">\n {children}\n </div>\n </ShippingAddressDrawerContext.Provider>\n </ShippingAddressContext.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Control Components (thin, context-bound, reuse particles)\n// ---------------------------------------------------------------------------\n\n/**\n * RecipientNameControl — the only client-validated field (US-4, US-6).\n * Pre-filled from clientProfile, editable, required.\n */\nexport function ShippingAddressRecipientNameControl({ className }: ShippingAddressRecipientNameControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const isRendered = descriptor?.fields.some((f) => f.name === 'recipientName');\n if (!isRendered) return null;\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'recipientName');\n const label = fieldDescriptor?.label ?? 'nome do destinatário';\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"recipient-name\" disabled={submitting}>\n <Field.Label>{label}</Field.Label>\n <Field.Control\n value={draft.recipientName}\n onChange={(e) => setDraftField('recipientName', e.currentTarget.value)}\n />\n </Field.Root>\n );\n}\n\n/** StreetControl */\nexport function ShippingAddressStreetControl({ className }: ShippingAddressStreetControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'street');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"street\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.street} onChange={(e) => setDraftField('street', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** NumberControl */\nexport function ShippingAddressNumberControl({ className }: ShippingAddressNumberControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'number');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"number\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.number} onChange={(e) => setDraftField('number', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** CityControl */\nexport function ShippingAddressCityControl({ className }: ShippingAddressCityControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'city');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"city\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.city} onChange={(e) => setDraftField('city', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** StateControl */\nexport function ShippingAddressStateControl({ className }: ShippingAddressStateControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'state');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"state\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.state} onChange={(e) => setDraftField('state', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** PostalCodeControl */\nexport function ShippingAddressPostalCodeControl({ className }: ShippingAddressPostalCodeControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'postalCode');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"postal-code\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.postalCode} onChange={(e) => setDraftField('postalCode', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** ComplementControl */\nexport function ShippingAddressComplementControl({ className }: ShippingAddressComplementControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'complement');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"complement\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.complement} onChange={(e) => setDraftField('complement', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** NeighborhoodControl (BR-specific in v1) */\nexport function ShippingAddressNeighborhoodControl({ className }: ShippingAddressNeighborhoodControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'neighborhood');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"neighborhood\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control\n value={draft.neighborhood}\n onChange={(e) => setDraftField('neighborhood', e.currentTarget.value)}\n />\n </Field.Root>\n );\n}\n\n/** CountryControl — lists only countries with a descriptor (US-2, first criterion) */\nexport function ShippingAddressCountryControl({ className, label = 'país' }: ShippingAddressCountryControlProps) {\n const { draft, setDraftField, setSelectedSavedId, submitting } = useShippingAddressContext();\n\n const availableCountries = getAvailableCountries();\n const countryOptions = availableCountries.map((iso) => {\n const desc = getCountryDescriptor(iso);\n return { value: iso, label: desc?.label ?? iso };\n });\n\n const handleCountryChange = (value: string | null) => {\n if (!value) return;\n const newDesc = getCountryDescriptor(value);\n if (newDesc) {\n setDraftField('country', value);\n setSelectedSavedId(undefined);\n }\n };\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"country\" disabled={submitting}>\n <Field.Label>{label}</Field.Label>\n <Select.Root value={draft.country} onValueChange={handleCountryChange} disabled={submitting}>\n <Select.Trigger>\n {/* Resolves the label directly from the country descriptor rather than relying on Base\n UI's automatic item-label lookup, which only reflects a mounted Select.Item (i.e.\n after the popup has been opened at least once) — otherwise the trigger would show\n the raw ISO code (e.g. \"BRA\") before the shopper ever opens the dropdown. */}\n <Select.Value>{(value) => (value ? (getCountryDescriptor(value)?.label ?? value) : value)}</Select.Value>\n <Select.Icon>▾</Select.Icon>\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n <Select.List>\n {countryOptions.map((option) => (\n <Select.Item key={option.value} value={option.value} label={option.label}>\n {option.label}\n </Select.Item>\n ))}\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n </Field.Root>\n );\n}\n\n// ---------------------------------------------------------------------------\n// SavedAddresses List and Option (US-3)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSavedList — renders only when savedAddresses is non-empty (logged-in signal).\n */\nexport function ShippingAddressSavedList({ className }: ShippingAddressSavedListProps) {\n const { savedAddresses } = useShippingAddressContext();\n\n if (savedAddresses.length === 0) return null;\n\n return (\n <div className={className} data-fs-shipping-address-saved-list=\"\">\n {savedAddresses.map((saved) => (\n <ShippingAddressSavedOption key={saved.id} id={saved.id} />\n ))}\n </div>\n );\n}\n\n/**\n * ShippingAddressSavedOption — selectable saved address; populates draft on selection.\n * Includes isCurrent visual variant to mark the address matching the current cart address (Decision 8).\n */\nexport function ShippingAddressSavedOption({ id, className }: ShippingAddressSavedOptionProps) {\n const { savedAddresses, selectedSavedId, setSelectedSavedId, currentAddressId } = useShippingAddressContext();\n\n const saved = savedAddresses.find((s) => s.id === id);\n if (!saved) return null;\n\n const isSelected = selectedSavedId === id;\n const isCurrent = currentAddressId !== undefined && currentAddressId === id;\n const hasAddressContent = Boolean(\n saved.address.recipientName || saved.address.street || saved.address.city || saved.address.neighborhood,\n );\n const inputId = `saved-address-${id}`;\n\n return (\n <div\n className={className}\n data-fs-shipping-address-saved-option=\"\"\n {...(isSelected ? { 'data-fs-shipping-address-saved-option-selected': '' } : {})}\n {...(isCurrent ? { 'data-fs-shipping-address-saved-option-current': '' } : {})}\n >\n <input\n id={inputId}\n type=\"radio\"\n name=\"saved-address\"\n value={id}\n checked={isSelected}\n onChange={() => setSelectedSavedId(id)}\n />\n <label htmlFor={inputId}>\n {hasAddressContent ? (\n <AddressSummaryRoot address={saved.address}>\n <AddressSummary />\n </AddressSummaryRoot>\n ) : (\n `Endereço ${id}`\n )}\n </label>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Submit Button (US-5)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSubmit — dispatches the batched submit; reflects pending state.\n */\nexport function ShippingAddressSubmit({\n className,\n label = 'salvar endereço',\n pendingLabel = 'salvando...',\n}: ShippingAddressSubmitProps) {\n const { submitting, handleSubmit, isFormValid } = useShippingAddressContext();\n\n return (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={submitting || !isFormValid}\n className={className}\n data-fs-shipping-address-submit=\"\"\n {...(submitting ? { 'data-fs-shipping-address-submit-pending': '' } : {})}\n >\n {submitting ? pendingLabel : label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Saved-Address Drawer Controller (US-8)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSavedAddressDrawerController — makes the wrapped DrawerRoot controlled by the\n * shipping-address context's savedAddressDrawerOpen state, and blocks dismissal (Escape, backdrop\n * click, close button) while drawerSubmitting is true by simply not forwarding the close request\n * to the setter. Mirrors CartOpenOnAdd's cloneElement mechanism. Expects a single DrawerRoot child.\n */\nexport function ShippingAddressSavedAddressDrawerController({\n children,\n}: ShippingAddressSavedAddressDrawerControllerProps) {\n const { savedAddressDrawerOpen, setSavedAddressDrawerOpen, drawerSubmitting } = useShippingAddressDrawerContext();\n\n if (!isValidElement<Pick<DrawerRootProps, 'open' | 'onOpenChange'>>(children)) {\n return children;\n }\n\n return cloneElement(children, {\n open: savedAddressDrawerOpen,\n onOpenChange: (next: boolean) => {\n if (!next && drawerSubmitting) return;\n setSavedAddressDrawerOpen(next);\n },\n });\n}\n\n// ---------------------------------------------------------------------------\n// Saved-Address Submit (US-8)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSavedAddressSubmit — the drawer's \"selecionar\" submit button; independent\n * submitting state from the main form's Submit (Decision 7); no-ops when the selected saved\n * address is already the current one (Decision 8).\n */\nexport function ShippingAddressSavedAddressSubmit({\n className,\n label = 'selecionar',\n pendingLabel = 'selecionando...',\n}: ShippingAddressSavedAddressSubmitProps) {\n const { selectedSavedId } = useShippingAddressContext();\n const { drawerSubmitting, handleDrawerSubmit } = useShippingAddressDrawerContext();\n\n return (\n <button\n type=\"button\"\n onClick={handleDrawerSubmit}\n disabled={drawerSubmitting || !selectedSavedId}\n className={className}\n data-fs-shipping-address-saved-address-submit=\"\"\n {...(drawerSubmitting ? { 'data-fs-shipping-address-saved-address-submit-pending': '' } : {})}\n >\n {drawerSubmitting ? pendingLabel : label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Selected Address Summary (read-only, self-gating)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSelectedSummary — provides the current delivery address via AddressSummaryRoot's\n * context and renders it through AddressSummary. Composed lines go through that same wrapper rather\n * than replacing it, because AddressSummaryRoot renders no DOM and `className` would have nowhere to\n * land. Self-gating on currentAddress: renders null when there is none yet, rather than an empty\n * provider with nothing meaningful to show.\n */\nexport function ShippingAddressSelectedSummary({ className, children }: ShippingAddressSelectedSummaryProps) {\n const { currentAddress } = useShippingAddressContext();\n\n if (!currentAddress) return null;\n\n return (\n <AddressSummaryRoot address={currentAddress}>\n <AddressSummary className={className}>{children}</AddressSummary>\n </AddressSummaryRoot>\n );\n}\n\n// ---------------------------------------------------------------------------\n// View/Edit Mode Toggle (composable — Free Particle Model)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressEditController — owns the view/edit mode. Defaults to 'view' when a current\n * address exists, 'edit' otherwise (derived reactively from currentAddressId, so it self-corrects\n * if the address arrives asynchronously after mount, same issue as the draft-sync effect above).\n * Once the shopper explicitly toggles (via ShippingAddressEditButton) or a submit succeeds, the\n * explicit mode takes over. Does not render any DOM itself; provides ShippingAddressSectionContext\n * to ShippingAddressSummaryView/ShippingAddressEditForm/ShippingAddressEditButton descendants.\n */\nexport function ShippingAddressEditController({ children }: ShippingAddressEditControllerProps) {\n const { currentAddressId, submitSuccessSignal } = useShippingAddressContext();\n const [explicitMode, setExplicitMode] = useState<ShippingAddressSectionState | undefined>(undefined);\n const lastHandledSignal = useRef(submitSuccessSignal);\n\n useEffect(() => {\n if (submitSuccessSignal !== lastHandledSignal.current) {\n lastHandledSignal.current = submitSuccessSignal;\n setExplicitMode('view');\n }\n }, [submitSuccessSignal]);\n\n // This section decides alone: the form when there is no address to show, the summary when there is, and\n // whatever the shopper last chose once they have chosen. It reports nothing to anything else, so finishing\n // it opens no other section.\n const mode: ShippingAddressSectionState = explicitMode ?? (currentAddressId !== undefined ? 'view' : 'edit');\n\n const modeContextValue = useMemo<ShippingAddressSectionContextValue>(\n () => ({ mode, setMode: setExplicitMode }),\n [mode],\n );\n\n return (\n <ShippingAddressSectionContext.Provider value={modeContextValue}>{children}</ShippingAddressSectionContext.Provider>\n );\n}\n\n/** Renders its children only while the section shows the saved-address summary. */\nexport function ShippingAddressSummaryView({ children }: ShippingAddressSectionPanelProps) {\n const { mode } = useShippingAddressSectionContext();\n if (mode !== 'view') return null;\n return <>{children}</>;\n}\n\n/** Renders its children only while the section shows the address form. */\nexport function ShippingAddressEditForm({ children }: ShippingAddressSectionPanelProps) {\n const { mode } = useShippingAddressSectionContext();\n if (mode !== 'edit') return null;\n return <>{children}</>;\n}\n\n/**\n * ShippingAddressEditButton — CTA that switches the mode to 'edit'. Has no knowledge of why the\n * mode might currently be 'view' (a current address, or a just-completed submit) — it only writes\n * the mode forward.\n */\nexport function ShippingAddressEditButton({ className, label = 'editar', children }: ShippingAddressEditButtonProps) {\n const { setMode } = useShippingAddressSectionContext();\n return (\n <button type=\"button\" onClick={() => setMode('edit')} className={className} data-fs-shipping-address-edit-button=\"\">\n {children ?? label}\n </button>\n );\n}\n\n/**\n * ShippingAddressCancelButton — returns the section to its summary without writing. Without it a\n * shopper who opens the form can only leave through a successful `setAddress`, and blanking the\n * recipient disables Submit, which leaves the section stuck open over the summary it replaced.\n */\nexport function ShippingAddressCancelButton({\n className,\n label = 'cancelar',\n children,\n}: ShippingAddressEditButtonProps) {\n const { setMode } = useShippingAddressSectionContext();\n const { discardDraft } = useShippingAddressContext();\n return (\n <button\n type=\"button\"\n onClick={() => {\n discardDraft();\n setMode('view');\n }}\n className={className}\n data-fs-shipping-address-cancel-button=\"\"\n >\n {children ?? label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Error Component (US-6)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressError — renders domain userErrors inline, or generic upstream error state.\n */\nexport function ShippingAddressError({ className }: ShippingAddressErrorProps) {\n const { errors, upstreamError } = useShippingAddressContext();\n\n if (errors.length === 0 && !upstreamError) return null;\n\n return (\n <div className={className} data-fs-shipping-address-error=\"\">\n {upstreamError ? (\n <div>Não foi possível salvar este endereço. Revise os dados e tente novamente.</div>\n ) : (\n <ul>\n {errors.map((error, idx) => (\n <li key={idx}>{error.message}</li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace Export\n// ---------------------------------------------------------------------------\n\nexport const ShippingAddress = {\n Root: ShippingAddressRoot,\n RootDefinition: ShippingAddressRootDefinition,\n RecipientNameControl: ShippingAddressRecipientNameControl,\n RecipientNameControlDefinition: ShippingAddressRecipientNameControlDefinition,\n StreetControl: ShippingAddressStreetControl,\n StreetControlDefinition: ShippingAddressStreetControlDefinition,\n NumberControl: ShippingAddressNumberControl,\n NumberControlDefinition: ShippingAddressNumberControlDefinition,\n CityControl: ShippingAddressCityControl,\n CityControlDefinition: ShippingAddressCityControlDefinition,\n StateControl: ShippingAddressStateControl,\n StateControlDefinition: ShippingAddressStateControlDefinition,\n PostalCodeControl: ShippingAddressPostalCodeControl,\n PostalCodeControlDefinition: ShippingAddressPostalCodeControlDefinition,\n ComplementControl: ShippingAddressComplementControl,\n ComplementControlDefinition: ShippingAddressComplementControlDefinition,\n NeighborhoodControl: ShippingAddressNeighborhoodControl,\n NeighborhoodControlDefinition: ShippingAddressNeighborhoodControlDefinition,\n CountryControl: ShippingAddressCountryControl,\n CountryControlDefinition: ShippingAddressCountryControlDefinition,\n SavedList: ShippingAddressSavedList,\n SavedListDefinition: ShippingAddressSavedListDefinition,\n SavedOption: ShippingAddressSavedOption,\n SavedOptionDefinition: ShippingAddressSavedOptionDefinition,\n Submit: ShippingAddressSubmit,\n SubmitDefinition: ShippingAddressSubmitDefinition,\n SavedAddressDrawerController: ShippingAddressSavedAddressDrawerController,\n SavedAddressDrawerControllerDefinition: ShippingAddressSavedAddressDrawerControllerDefinition,\n SavedAddressSubmit: ShippingAddressSavedAddressSubmit,\n SavedAddressSubmitDefinition: ShippingAddressSavedAddressSubmitDefinition,\n SelectedSummary: ShippingAddressSelectedSummary,\n SelectedSummaryDefinition: ShippingAddressSelectedSummaryDefinition,\n EditController: ShippingAddressEditController,\n EditControllerDefinition: ShippingAddressEditControllerDefinition,\n SummaryView: ShippingAddressSummaryView,\n SummaryViewDefinition: ShippingAddressSummaryViewDefinition,\n EditForm: ShippingAddressEditForm,\n EditFormDefinition: ShippingAddressEditFormDefinition,\n EditButton: ShippingAddressEditButton,\n EditButtonDefinition: ShippingAddressEditButtonDefinition,\n CancelButton: ShippingAddressCancelButton,\n CancelButtonDefinition: ShippingAddressCancelButtonDefinition,\n Error: ShippingAddressError,\n ErrorDefinition: ShippingAddressErrorDefinition,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,MAAM,WAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkI/B,MAAM,iCAAiC,OAAO,6BAA6B;AAE3E,MAAM,yBAAyB,cAC7B,8BACF;AAEA,SAAS,4BAAyD;CAChE,MAAM,MAAM,WAAW,sBAAsB;CAC7C,IAAI,QAAQ,gCACV,MAAM,IAAI,MAAM,qEAAqE;CAEvF,OAAO;AACT;AAeA,MAAM,wCAAwC,OAAO,mCAAmC;AAExF,MAAM,+BAA+B,cAEnC,qCAAqC;AAEvC,SAAS,kCAAqE;CAC5E,MAAM,MAAM,WAAW,4BAA4B;CACnD,IAAI,QAAQ,uCACV,MAAM,IAAI,MACR,4HACF;CAEF,OA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AW;CACX,qBAAqB;CACrB,aAAa;CACb,uBAAuB;CACvB,QAAQ;CACR,kBAAkB;CAClB,8BAA8B;CAC9B,wCAAwC;CACxC,oBAAoB;CACpB,8BAA8B;CAC9B,iBAAiB;CACjB,2BAA2B;CAC3B,gBAAgB;CAChB,0BAA0B;CAC1B,aAAa;CACb,uBAAuB;CACvB,UAAU;CACV,oBAAoB;CACpB,YAAY;CACZ,sBAAsB;CACtB,cAAc;CACd,wBAAwB;CACxB,OAAO;CACP,iBAAiB;AACnB"}
|
|
1
|
+
{"version":3,"file":"shipping-address.js","names":[],"sources":["../../../src/matter/shipping-address/shipping-address.tsx"],"sourcesContent":["'use client';\n\nimport { defineComponent } from '@vtex/fs-core';\nimport {\n cloneElement,\n createContext,\n isValidElement,\n type ReactNode,\n useCallback,\n useContext,\n useEffect,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { AddressSummary, AddressSummaryRoot } from '../../particles/address-summary/address-summary.js';\nimport type { DrawerRootProps } from '../../particles/drawer/drawer.js';\nimport { Field } from '../../particles/field/field.js';\nimport { Select } from '../../particles/select/select.js';\nimport { useActionsOverride } from '../../sdk/actions/actions-override-context.js';\nimport type { ComponentActions } from '../../sdk/actions/types.js';\nimport { useDataOverride } from '../../sdk/data/data-override-context.js';\nimport {\n SHIPPING_NETWORK_ERROR_CODE,\n type ShippingAddressInput,\n type ShippingAddressUpdateErrorEntity,\n} from '../../sdk/shipping/shipping-operations.js';\nimport type { CountryDescriptor } from './country-descriptors.js';\nimport { getAvailableCountries, getCountryDescriptor } from './country-descriptors.js';\n\n/**\n * Shipping address step (T2 — Enter and save the delivery address).\n * Single-file matter per ADR-0001; batches form state and writes once via shipping.setAddress.\n * Controls are thin context-bound components that read/write draft state (docs/storefront-core/reference-cart.md § Delivery).\n */\n\n// ---------------------------------------------------------------------------\n// GraphQL Fragment\n// ---------------------------------------------------------------------------\n\nconst fragment = /* GraphQL */ `\n fragment ShippingAddressData on Query {\n shipping {\n __typename\n id\n address {\n __typename\n id\n recipientName\n postalCode\n country\n street\n number\n complement\n neighborhood\n city\n state\n }\n savedAddresses {\n __typename\n id\n recipientName\n postalCode\n country\n street\n number\n complement\n neighborhood\n city\n state\n }\n }\n clientProfile {\n __typename\n firstName\n lastName\n }\n }\n`;\n\n// ---------------------------------------------------------------------------\n// Types\n// ---------------------------------------------------------------------------\n\n/**\n * The `$data` slice forwarded by the reactive runtime. `ShippingAddressData` selects two root\n * fields (`shipping`, `clientProfile`), so the compiler composes them via\n * `MultipleReactiveDataProvider`, which keys each entity's resolved slice by its own root field —\n * `$data` is `{ shipping: {...}, clientProfile: {...} }`, not a flat/unwrapped shape (that unwrapped\n * shape only applies to single-root-field fragments, e.g. CartTotalizerRoot's `$data.totalizers`).\n */\nexport type ShippingAddressData = {\n shipping?: {\n address?: {\n id?: string | null;\n recipientName?: string | null;\n postalCode?: string | null;\n country?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n } | null;\n savedAddresses?: Array<{\n id?: string | null;\n recipientName?: string | null;\n postalCode?: string | null;\n country?: string | null;\n street?: string | null;\n number?: string | null;\n complement?: string | null;\n neighborhood?: string | null;\n city?: string | null;\n state?: string | null;\n }>;\n } | null;\n clientProfile?: {\n firstName?: string | null;\n lastName?: string | null;\n } | null;\n} | null;\n\n/** The batched draft state, keyed by canonical field name (Decision 1). */\ntype AddressDraft = {\n recipientName: string;\n postalCode: string;\n country: string;\n street: string;\n number: string;\n complement: string;\n neighborhood: string;\n city: string;\n state: string;\n};\n\n/** Context value for child Controls to read/write the draft and access the descriptor. */\ntype ShippingAddressContextValue = {\n draft: AddressDraft;\n setDraftField: (field: keyof AddressDraft, value: string) => void;\n descriptor: CountryDescriptor | undefined;\n savedAddresses: Array<{ id: string; address: Partial<AddressDraft> }>;\n selectedSavedId: string | undefined;\n setSelectedSavedId: (id: string | undefined) => void;\n submitting: boolean;\n errors: readonly ShippingAddressUpdateErrorEntity[];\n upstreamError: boolean;\n handleSubmit: () => void;\n currentAddressId: string | undefined;\n /** Formatted current address fields; undefined when there is no current address yet. */\n currentAddress: Partial<AddressDraft> | undefined;\n /**\n * Increments once per successful `setAddress` call (main form submit or drawer submit).\n * Consumed by `ShippingAddressEditController` to switch back to view mode without\n * `ShippingAddressSubmit`/`ShippingAddressSavedAddressSubmit` needing to know about\n * view/edit mode — mirrors the `cartLastAddVar` pulse pattern in matter/cart/cart.tsx,\n * but scoped to this Root's own context since the signal originates and is consumed\n * entirely within this subtree (no cross-tree/global signal needed here).\n */\n submitSuccessSignal: number;\n isFormValid: boolean;\n /**\n * Throws away in-progress edits: re-seeds every field from the stored address and drops the touch marks.\n * Consumed by `ShippingAddressCancelButton`, which would otherwise leave the abandoned values in the\n * draft — the Root outlives the form, and touched fields are never re-seeded.\n */\n discardDraft: () => void;\n};\n\nconst SHIPPING_ADDRESS_CONTEXT_UNSET = Symbol('ShippingAddressContextUnset');\n\nconst ShippingAddressContext = createContext<ShippingAddressContextValue | typeof SHIPPING_ADDRESS_CONTEXT_UNSET>(\n SHIPPING_ADDRESS_CONTEXT_UNSET,\n);\n\nfunction useShippingAddressContext(): ShippingAddressContextValue {\n const ctx = useContext(ShippingAddressContext);\n if (ctx === SHIPPING_ADDRESS_CONTEXT_UNSET) {\n throw new Error('ShippingAddress components must be used inside ShippingAddressRoot.');\n }\n return ctx;\n}\n\n/**\n * Drawer flow state (US-8), kept in its own context separate from ShippingAddressContext so the\n * main data/actions context — read by every field Control — stays unaware of this one downstream\n * UI surface. Only ShippingAddressSavedAddressDrawerController and ShippingAddressSavedAddressSubmit\n * consume it.\n */\ntype ShippingAddressDrawerContextValue = {\n savedAddressDrawerOpen: boolean;\n setSavedAddressDrawerOpen: (open: boolean) => void;\n drawerSubmitting: boolean;\n handleDrawerSubmit: () => void;\n};\n\nconst SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET = Symbol('ShippingAddressDrawerContextUnset');\n\nconst ShippingAddressDrawerContext = createContext<\n ShippingAddressDrawerContextValue | typeof SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET\n>(SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET);\n\nfunction useShippingAddressDrawerContext(): ShippingAddressDrawerContextValue {\n const ctx = useContext(ShippingAddressDrawerContext);\n if (ctx === SHIPPING_ADDRESS_DRAWER_CONTEXT_UNSET) {\n throw new Error(\n 'ShippingAddressSavedAddressDrawerController and ShippingAddressSavedAddressSubmit must be used inside ShippingAddressRoot.',\n );\n }\n return ctx;\n}\n\n/**\n * View/edit mode state (view/edit toggle), kept in its own context — separate from\n * ShippingAddressContext and ShippingAddressDrawerContext — so neither of those needs to know\n * this UI surface exists. Consumed by ShippingAddressSummaryView, ShippingAddressEditForm,\n * ShippingAddressEditButton and ShippingAddressCancelButton; the last two are its only writers.\n */\n/** Internal: the section's two states never reach the schema, because each has its own component. */\ntype ShippingAddressSectionState = 'view' | 'edit';\n\ntype ShippingAddressSectionContextValue = {\n mode: ShippingAddressSectionState;\n setMode: (mode: ShippingAddressSectionState) => void;\n};\n\nconst SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET = Symbol('ShippingAddressSectionContextUnset');\n\nconst ShippingAddressSectionContext = createContext<\n ShippingAddressSectionContextValue | typeof SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET\n>(SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET);\n\nfunction useShippingAddressSectionContext(): ShippingAddressSectionContextValue {\n const ctx = useContext(ShippingAddressSectionContext);\n if (ctx === SHIPPING_ADDRESS_SECTION_CONTEXT_UNSET) {\n throw new Error(\n 'ShippingAddressSummaryView, ShippingAddressEditForm, ShippingAddressEditButton and ShippingAddressCancelButton must be used inside ShippingAddressEditController.',\n );\n }\n return ctx;\n}\n\n// ---------------------------------------------------------------------------\n// Props Types\n// ---------------------------------------------------------------------------\n\nexport type ShippingAddressRootProps = {\n /** Default country (ISO alpha-3) when no address exists. */\n defaultCountry?: string;\n className?: string;\n children?: ReactNode;\n /** `ShippingAddressData` forwarded by the reactive runtime. */\n $data?: ShippingAddressData;\n /** Compiler-injected action surface; carries `shipping.setAddress`. */\n $actions?: ComponentActions;\n};\n\nexport type ShippingAddressStreetControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressNumberControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressCityControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressStateControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressPostalCodeControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressComplementControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressNeighborhoodControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressCountryControlProps = {\n className?: string;\n label?: string;\n};\n\nexport type ShippingAddressRecipientNameControlProps = {\n className?: string;\n};\n\nexport type ShippingAddressSavedListProps = {\n className?: string;\n};\n\nexport type ShippingAddressSavedOptionProps = {\n id: string;\n className?: string;\n};\n\nexport type ShippingAddressSubmitProps = {\n className?: string;\n label?: string;\n pendingLabel?: string;\n};\n\nexport type ShippingAddressErrorProps = {\n className?: string;\n};\n\nexport type ShippingAddressSavedAddressDrawerControllerProps = {\n children?: ReactNode;\n};\n\nexport type ShippingAddressSavedAddressSubmitProps = {\n className?: string;\n label?: string;\n pendingLabel?: string;\n};\n\nexport type ShippingAddressSelectedSummaryProps = {\n className?: string;\n /**\n * The lines to render, in order — typically the `AddressSummaryRecipient` / `Street` / `Locality`\n * leaves. Defaults to recipient, street, locality when omitted.\n */\n children?: ReactNode;\n};\n\nexport type ShippingAddressEditControllerProps = {\n children?: ReactNode;\n};\n\nexport type ShippingAddressSectionPanelProps = {\n children?: ReactNode;\n};\n\nexport type ShippingAddressEditButtonProps = {\n className?: string;\n label?: string;\n /** Compose custom button content (e.g. an Icon plus text); falls back to `label`. */\n children?: ReactNode;\n};\n\n// ---------------------------------------------------------------------------\n// Root Definition\n// ---------------------------------------------------------------------------\n\nexport const ShippingAddressRootDefinition = defineComponent<ShippingAddressRootProps>({\n name: 'ShippingAddressRoot',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressRoot,\n fragment,\n fetchStrategy: 'reactive',\n providesContext: 'shipping-address',\n actions: { shipping: ['setAddress'] },\n editor: { label: 'Shipping Address Root', category: 'content' },\n schema: {\n defaultCountry: { type: 'string', default: 'BRA', label: 'Default country (ISO-3)' },\n },\n guideline:\n 'Country-adaptive single-address delivery form; batches all fields and writes once via shipping.setAddress. See shipping-address.md.',\n});\n\n// Control Definitions\nexport const ShippingAddressRecipientNameControlDefinition = defineComponent<ShippingAddressRecipientNameControlProps>({\n name: 'ShippingAddressRecipientNameControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressRecipientNameControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Recipient Name Control', category: 'action' },\n schema: {},\n guideline: 'Recipient-name input field; required for submit. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressStreetControlDefinition = defineComponent<ShippingAddressStreetControlProps>({\n name: 'ShippingAddressStreetControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressStreetControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Street Control', category: 'action' },\n schema: {},\n guideline: 'Street name input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressNumberControlDefinition = defineComponent<ShippingAddressNumberControlProps>({\n name: 'ShippingAddressNumberControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressNumberControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Number Control', category: 'action' },\n schema: {},\n guideline: 'Street number input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressCityControlDefinition = defineComponent<ShippingAddressCityControlProps>({\n name: 'ShippingAddressCityControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressCityControl,\n requiresContext: 'shipping-address',\n editor: { label: 'City Control', category: 'action' },\n schema: {},\n guideline: 'City name input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressStateControlDefinition = defineComponent<ShippingAddressStateControlProps>({\n name: 'ShippingAddressStateControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressStateControl,\n requiresContext: 'shipping-address',\n editor: { label: 'State Control', category: 'action' },\n schema: {},\n guideline: 'State/province input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressPostalCodeControlDefinition = defineComponent<ShippingAddressPostalCodeControlProps>({\n name: 'ShippingAddressPostalCodeControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressPostalCodeControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Postal Code Control', category: 'action' },\n schema: {},\n guideline: 'Postal code input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressComplementControlDefinition = defineComponent<ShippingAddressComplementControlProps>({\n name: 'ShippingAddressComplementControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressComplementControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Complement Control', category: 'action' },\n schema: {},\n guideline: 'Complement (apartment, suite, etc.) input field. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressNeighborhoodControlDefinition = defineComponent<ShippingAddressNeighborhoodControlProps>({\n name: 'ShippingAddressNeighborhoodControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressNeighborhoodControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Neighborhood Control', category: 'action' },\n schema: {},\n guideline:\n 'Neighborhood (bairro) input field; shown only for countries that have this field (BR in v1). Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressCountryControlDefinition = defineComponent<ShippingAddressCountryControlProps>({\n name: 'ShippingAddressCountryControl',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressCountryControl,\n requiresContext: 'shipping-address',\n editor: { label: 'Country Control', category: 'action' },\n schema: {\n label: { type: 'string', default: 'país', label: 'Field label' },\n },\n guideline:\n 'Country selector; lists only countries with an implemented descriptor. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressSavedListDefinition = defineComponent<ShippingAddressSavedListProps>({\n name: 'ShippingAddressSavedList',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedList,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address List', category: 'commerce' },\n schema: {},\n guideline:\n 'List of saved addresses for logged-in shoppers; renders only if savedAddresses is non-empty. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressSavedOptionDefinition = defineComponent<ShippingAddressSavedOptionProps>({\n name: 'ShippingAddressSavedOption',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedOption,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address Option', category: 'commerce' },\n schema: { id: { type: 'string', label: 'Saved address ID' } },\n guideline:\n 'A single saved address option; renders its address via the same AddressSummary particle (through its own AddressSummaryRoot) used by ShippingAddressSelectedSummary, so both share one formatting implementation. Must be a descendant of ShippingAddressSavedList.',\n});\n\nexport const ShippingAddressSubmitDefinition = defineComponent<ShippingAddressSubmitProps>({\n name: 'ShippingAddressSubmit',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSubmit,\n requiresContext: 'shipping-address',\n editor: { label: 'Shipping Address Submit', category: 'action' },\n schema: {\n label: { type: 'string', default: 'salvar endereço', label: 'Button label' },\n pendingLabel: { type: 'string', default: 'salvando...', label: 'Pending label' },\n },\n guideline:\n 'Submit button; dispatches the batched address write. Disabled until recipient name is non-blank. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressErrorDefinition = defineComponent<ShippingAddressErrorProps>({\n name: 'ShippingAddressError',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressError,\n requiresContext: 'shipping-address',\n editor: { label: 'Shipping Address Error', category: 'commerce' },\n schema: {},\n guideline:\n 'Error banner; shows domain validation errors inline or a generic upstream-error state. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressSavedAddressDrawerControllerDefinition =\n defineComponent<ShippingAddressSavedAddressDrawerControllerProps>({\n name: 'ShippingAddressSavedAddressDrawerController',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedAddressDrawerController,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address Drawer Controller', category: 'action' },\n schema: {},\n guideline:\n 'Wraps a single DrawerRoot child (the saved-address selection drawer) and makes it controlled by the shipping-address drawer state: open state and blocked-dismissal-while-submitting are handled here, so do not set raw open/onOpenChange on the wrapped DrawerRoot. Compose as the parent of DrawerRoot, with the drawer trigger and popup as DrawerRoot descendants, same pattern as CartOpenOnAdd wrapping the mini-cart DrawerRoot. Must be inside ShippingAddressRoot.',\n });\n\nexport const ShippingAddressSavedAddressSubmitDefinition = defineComponent<ShippingAddressSavedAddressSubmitProps>({\n name: 'ShippingAddressSavedAddressSubmit',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSavedAddressSubmit,\n requiresContext: 'shipping-address',\n editor: { label: 'Saved Address Submit', category: 'action' },\n schema: {\n label: { type: 'string', default: 'selecionar', label: 'Button label' },\n pendingLabel: { type: 'string', default: 'selecionando...', label: 'Pending label' },\n },\n guideline:\n \"The drawer's \\\"selecionar\\\" submit button; independent submitting state from the main form's Submit (Decision 7); no-ops when the selected saved address is already the current one (Decision 8). Must be inside the saved-address drawer's DrawerPopup and inside ShippingAddressRoot.\",\n});\n\nexport const ShippingAddressSelectedSummaryDefinition = defineComponent<ShippingAddressSelectedSummaryProps>({\n name: 'ShippingAddressSelectedSummary',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSelectedSummary,\n requiresContext: 'shipping-address',\n providesContext: 'address-summary',\n editor: { label: 'Selected Address Summary', category: 'commerce' },\n schema: {},\n guideline:\n 'Provides the current delivery address to the generic AddressSummary particle via AddressSummaryRoot context, and renders the default AddressSummary when composed with no children. Compose AddressSummaryRecipient / Street / Locality directly to choose the order or drop a line. Self-gates to null when there is no current address yet. Must be a descendant of ShippingAddressRoot.',\n});\n\nexport const ShippingAddressEditControllerDefinition = defineComponent<ShippingAddressEditControllerProps>({\n name: 'ShippingAddressEditController',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressEditController,\n requiresContext: 'shipping-address',\n providesContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Edit Controller', category: 'commerce' },\n schema: {},\n guideline:\n \"Owns the view/edit toggle for the delivery address section: defaults to view when a current address exists, edit otherwise; switches back to view automatically whenever setAddress succeeds (main form submit or saved-address drawer submit), without ShippingAddressSubmit/ShippingAddressSavedAddressSubmit needing to know about this mode. Compose a ShippingAddressSummaryView holding SelectedSummary + EditButton and a ShippingAddressEditForm holding the form Controls/Submit/Error. Self-contained: it decides from its own data and the shopper's own presses, so no other section opens it and finishing it opens nothing. Must be inside ShippingAddressRoot.\",\n});\n\nexport const ShippingAddressSummaryViewDefinition = defineComponent<ShippingAddressSectionPanelProps>({\n name: 'ShippingAddressSummaryView',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressSummaryView,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Summary View', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders its children only while the delivery section shows the saved-address summary, and nothing while it shows the form. Compose SelectedSummary and a ShippingAddressEditButton inside. Takes no props: which state it gates is which component it is. Must be inside a ShippingAddressEditController.',\n});\n\nexport const ShippingAddressEditFormDefinition = defineComponent<ShippingAddressSectionPanelProps>({\n name: 'ShippingAddressEditForm',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressEditForm,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Edit Form', category: 'commerce' },\n schema: {},\n guideline:\n 'Renders its children only while the delivery section shows the address form, and nothing while it shows the summary. Compose the Controls, Submit and Error parts inside. Must be inside a ShippingAddressEditController.',\n});\n\nexport const ShippingAddressEditButtonDefinition = defineComponent<ShippingAddressEditButtonProps>({\n name: 'ShippingAddressEditButton',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressEditButton,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Edit Button', category: 'action' },\n schema: {\n label: { type: 'string', default: 'editar', label: 'Button label' },\n },\n guideline:\n 'CTA that switches the view/edit mode to edit. Typically placed inside a ShippingAddressSummaryView, next to SelectedSummary. Must be inside ShippingAddressEditController.',\n});\n\nexport const ShippingAddressCancelButtonDefinition = defineComponent<ShippingAddressEditButtonProps>({\n name: 'ShippingAddressCancelButton',\n importPath: '@vtex/faststore/components',\n component: ShippingAddressCancelButton,\n requiresContext: 'shipping-address-section',\n editor: { label: 'Shipping Address Cancel Button', category: 'action' },\n schema: {\n label: { type: 'string', default: 'cancelar', label: 'Button label' },\n },\n guideline:\n 'Returns the delivery section to its summary without saving. Place it inside a ShippingAddressEditForm so a shopper who opened the form has a way back that does not depend on a successful write. Must be inside ShippingAddressEditController.',\n});\n\n// ---------------------------------------------------------------------------\n// Root Component\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressRoot owns the batched form state, manages the current descriptor,\n * and provides context to child Controls. It handles submit dispatch and error tracking.\n */\nexport function ShippingAddressRoot({\n defaultCountry = 'BRA',\n className,\n children,\n $data: $dataProp,\n $actions: $actionsProp,\n}: Readonly<ShippingAddressRootProps>) {\n const $data = useDataOverride($dataProp);\n const $actions = useActionsOverride($actionsProp);\n\n // Current address and saved addresses from the fragment\n const currentAddress = $data?.shipping?.address;\n const savedAddresses = $data?.shipping?.savedAddresses ?? [];\n const clientProfile = $data?.clientProfile;\n\n // Joined shopper-profile name (US-4) — the single fallback for recipientName whenever an\n // address record (the current address, or a saved address picked from the drawer) has none.\n // Always applied as a real draft value, never just a placeholder hint, so the shopper never has\n // to retype a name the profile already has.\n const joinedProfileName = [clientProfile?.firstName, clientProfile?.lastName].filter(Boolean).join(' ');\n\n // Seeds the batched draft from the current address, falling back to empty. The recipient name defaults to\n // the joined profile name when the address has none (US-4): it must be a real pre-filled value, not just a\n // placeholder hint, so the shopper can submit without retyping it. Shared with `discardDraft` below so the\n // initial seed and the cancel path cannot drift apart.\n const seedDraft = useCallback(\n (): AddressDraft => ({\n recipientName: currentAddress?.recipientName ?? joinedProfileName,\n postalCode: currentAddress?.postalCode ?? '',\n country: currentAddress?.country ?? defaultCountry,\n street: currentAddress?.street ?? '',\n number: currentAddress?.number ?? '',\n complement: currentAddress?.complement ?? '',\n neighborhood: currentAddress?.neighborhood ?? '',\n city: currentAddress?.city ?? '',\n state: currentAddress?.state ?? '',\n }),\n [currentAddress, joinedProfileName, defaultCountry],\n );\n\n const [draft, setDraft] = useState<AddressDraft>(seedDraft);\n\n // Error tracking and submission state\n const [submitting, setSubmitting] = useState(false);\n const [errors, setErrors] = useState<readonly ShippingAddressUpdateErrorEntity[]>([]);\n const [upstreamError, setUpstreamError] = useState(false);\n const [selectedSavedId, setSelectedSavedId] = useState<string | undefined>();\n const [savedAddressDrawerOpen, setSavedAddressDrawerOpen] = useState(false);\n const [drawerSubmitting, setDrawerSubmitting] = useState(false);\n const [submitSuccessSignal, setSubmitSuccessSignal] = useState(0);\n\n // Per-field dirty tracking. `draft`'s initial state is set once (via useState's lazy\n // initializer) from whatever currentAddress holds on this component's first render — for a live\n // page, the reactive fragment often resolves asynchronously after that first render\n // (currentAddress starts undefined), so draft needs to catch up once it arrives. Tracked per\n // field, not as one global flag, so editing one field doesn't stop the others from picking up a\n // later currentAddress update (US-1, third criterion: \"untouched fields reflect the new values\").\n const [touchedFields, setTouchedFields] = useState<ReadonlySet<keyof AddressDraft>>(() => new Set());\n\n // Cancelling throws the edit away, and the marks have to go with the values. They are deliberately kept\n // after a successful write — a server that has not echoed the recipient back would otherwise re-seed the\n // profile name over what the shopper typed — but an abandoned edit has nothing worth preserving, and a\n // mark left behind would keep the stored value permanently out of reach of the re-seed effect below.\n const discardDraft = useCallback(() => {\n setTouchedFields(new Set());\n setDraft(seedDraft());\n setErrors([]);\n setUpstreamError(false);\n }, [seedDraft]);\n\n const currentAddressSnapshot = JSON.stringify(currentAddress ?? null);\n const clientProfileSnapshot = JSON.stringify(clientProfile ?? null);\n // biome-ignore lint/correctness/useExhaustiveDependencies: keyed on the stringified snapshots (currentAddressSnapshot/clientProfileSnapshot), not object identity, so the effect doesn't refire on every render when Apollo returns a new-but-equal object reference.\n useEffect(() => {\n setDraft((prev) => {\n return {\n recipientName: touchedFields.has('recipientName')\n ? prev.recipientName\n : (currentAddress?.recipientName ?? (joinedProfileName || prev.recipientName)),\n postalCode: touchedFields.has('postalCode') ? prev.postalCode : (currentAddress?.postalCode ?? prev.postalCode),\n country: touchedFields.has('country') ? prev.country : (currentAddress?.country ?? prev.country),\n street: touchedFields.has('street') ? prev.street : (currentAddress?.street ?? prev.street),\n number: touchedFields.has('number') ? prev.number : (currentAddress?.number ?? prev.number),\n complement: touchedFields.has('complement') ? prev.complement : (currentAddress?.complement ?? prev.complement),\n neighborhood: touchedFields.has('neighborhood')\n ? prev.neighborhood\n : (currentAddress?.neighborhood ?? prev.neighborhood),\n city: touchedFields.has('city') ? prev.city : (currentAddress?.city ?? prev.city),\n state: touchedFields.has('state') ? prev.state : (currentAddress?.state ?? prev.state),\n };\n });\n }, [currentAddressSnapshot, clientProfileSnapshot, touchedFields]);\n\n // Compute current address ID for comparison with saved addresses (Decision 8)\n const currentAddressId = currentAddress?.id ?? undefined;\n\n // Formatted current address for read-only display (ShippingAddressSelectedSummary);\n // undefined when there is no current address yet, so the summary can self-gate on it.\n const formattedCurrentAddress = useMemo(() => {\n if (!currentAddress) return undefined;\n return {\n recipientName: currentAddress.recipientName ?? '',\n postalCode: currentAddress.postalCode ?? '',\n country: currentAddress.country ?? '',\n street: currentAddress.street ?? '',\n number: currentAddress.number ?? '',\n complement: currentAddress.complement ?? '',\n neighborhood: currentAddress.neighborhood ?? '',\n city: currentAddress.city ?? '',\n state: currentAddress.state ?? '',\n } satisfies Partial<AddressDraft>;\n }, [currentAddress]);\n\n // Get the current descriptor based on draft country\n const descriptor = getCountryDescriptor(draft.country);\n\n // Map saved addresses with extracted address data\n const mappedSavedAddresses = useMemo(\n () =>\n savedAddresses.map((saved) => ({\n id: saved.id ?? '',\n address: {\n recipientName: saved.recipientName ?? '',\n postalCode: saved.postalCode ?? '',\n country: saved.country ?? '',\n street: saved.street ?? '',\n number: saved.number ?? '',\n complement: saved.complement ?? '',\n neighborhood: saved.neighborhood ?? '',\n city: saved.city ?? '',\n state: saved.state ?? '',\n } as Partial<AddressDraft>,\n })),\n [savedAddresses],\n );\n\n // Update a single draft field\n const setDraftField = useCallback((field: keyof AddressDraft, value: string) => {\n setTouchedFields((prev) => (prev.has(field) ? prev : new Set(prev).add(field)));\n setDraft((prev) => ({ ...prev, [field]: value }));\n }, []);\n\n // Handle saved option selection\n const selectSavedAddress = useCallback(\n (id: string | undefined) => {\n setSelectedSavedId(id);\n if (id) {\n const saved = mappedSavedAddresses.find((s) => s.id === id);\n if (saved?.address) {\n // Selecting a saved address replaces the whole draft with its fields, so mark every\n // field touched — otherwise a later currentAddress sync could clobber this selection.\n setTouchedFields((prev) => new Set([...prev, ...(Object.keys(saved.address) as Array<keyof AddressDraft>)]));\n // A saved address can legitimately have a blank recipientName (Decision 9); fall back to\n // the joined profile name here too, same as the no-address case (US-4), so the field shows\n // a real pre-filled value instead of an empty string masquerading behind a placeholder.\n setDraft((prev) => ({\n ...prev,\n ...saved.address,\n recipientName: saved.address.recipientName || joinedProfileName,\n }));\n }\n }\n },\n [mappedSavedAddresses, joinedProfileName],\n );\n\n // Client-side validation: non-blank recipientName required\n const isFormValid = draft.recipientName.trim().length > 0;\n\n // Submit handler: dispatch setAddress action\n const handleSubmit = useCallback(async () => {\n if (!isFormValid || submitting) return;\n\n if (!$actions?.shipping?.setAddress) return;\n\n setSubmitting(true);\n setErrors([]);\n setUpstreamError(false);\n\n try {\n // Build input, including savedAddressId only if one was selected (US-3, third acceptance criterion).\n // Only include a field the active country's descriptor actually declares (US-2, third/fourth\n // criteria) — otherwise a stale value from a previously-selected country (e.g. `neighborhood`\n // retained in the draft after switching BR -> USA) would leak into the submitted payload.\n const isFieldActive = (field: keyof AddressDraft) => descriptor?.fields.some((f) => f.name === field) ?? false;\n\n const addressFields = {\n recipientName: draft.recipientName.trim(),\n postalCode: draft.postalCode,\n country: draft.country,\n ...(isFieldActive('street') ? { street: draft.street } : {}),\n ...(isFieldActive('number') ? { number: draft.number } : {}),\n ...(isFieldActive('complement') ? { complement: draft.complement } : {}),\n ...(isFieldActive('neighborhood') ? { neighborhood: draft.neighborhood } : {}),\n ...(isFieldActive('city') ? { city: draft.city } : {}),\n ...(isFieldActive('state') ? { state: draft.state } : {}),\n };\n\n const input: ShippingAddressInput = selectedSavedId\n ? { savedAddressId: selectedSavedId, ...addressFields }\n : addressFields;\n\n const userErrors = await $actions.shipping.setAddress(input);\n if (userErrors.length === 0) {\n // Success: cache merge will reactively update the form (US-5, second criterion). The touched\n // marks stay: dropping them re-arms the seeding effect, which would overwrite a recipient the\n // shopper typed with the profile-name fallback whenever the stored address still carries none.\n setErrors([]);\n setSubmitSuccessSignal((n) => n + 1);\n } else if (userErrors.some((e) => e.code === SHIPPING_NETWORK_ERROR_CODE)) {\n // The action resolves (never throws) the synthetic upstream/network failure as a userError;\n // route it to the generic error state, not the inline domain list (US-6 2nd criterion,\n // Decision 5). Draft retained (US-6, third criterion).\n setErrors([]);\n setUpstreamError(true);\n } else {\n // Domain userErrors render inline; retain draft on error (US-6, third criterion)\n setErrors(userErrors);\n }\n } catch (error) {\n // Network/upstream error: surface as generic state (US-6, second criterion)\n console.error('[ShippingAddress] setAddress failed:', error);\n setUpstreamError(true);\n setErrors([]);\n } finally {\n setSubmitting(false);\n }\n }, [isFormValid, submitting, $actions?.shipping?.setAddress, draft, selectedSavedId, descriptor]);\n\n // Drawer submit handler: dispatch setAddress for the selected saved address (US-8, Decision 7)\n const handleDrawerSubmit = useCallback(async () => {\n // Guard: if nothing picked in the drawer, return immediately\n if (!selectedSavedId) return;\n\n // No-op guard (Decision 8): if the selected address is already current, just close and return\n if (currentAddressId !== undefined && selectedSavedId === currentAddressId) {\n setSavedAddressDrawerOpen(false);\n return;\n }\n\n const selectedAddress = mappedSavedAddresses.find((s) => s.id === selectedSavedId);\n if (!selectedAddress) return;\n\n // Incomplete saved address (missing the one client-enforced field, recipientName): an\n // auto-submit would only fail server-side with MISSING_RECIPIENT_NAME. selectSavedAddress\n // already populated the draft from this record when it was picked, so just close the drawer\n // and let the shopper review/complete it via the main form's own submit (Decision 9).\n if (!selectedAddress.address.recipientName?.trim()) {\n setSavedAddressDrawerOpen(false);\n return;\n }\n\n if (!$actions?.shipping?.setAddress) return;\n\n setDrawerSubmitting(true);\n setErrors([]);\n setUpstreamError(false);\n\n try {\n // Build input from the saved address's stored fields (Decision 6)\n const input: ShippingAddressInput = {\n savedAddressId: selectedSavedId,\n recipientName: selectedAddress.address.recipientName || '',\n postalCode: selectedAddress.address.postalCode || '',\n country: selectedAddress.address.country || '',\n street: selectedAddress.address.street || '',\n number: selectedAddress.address.number || '',\n complement: selectedAddress.address.complement || '',\n neighborhood: selectedAddress.address.neighborhood || '',\n city: selectedAddress.address.city || '',\n state: selectedAddress.address.state || '',\n };\n\n const userErrors = await $actions.shipping.setAddress(input);\n if (userErrors.length === 0) {\n // Success: close the drawer (7th acceptance criterion)\n setErrors([]);\n setSavedAddressDrawerOpen(false);\n setSubmitSuccessSignal((n) => n + 1);\n } else if (userErrors.some((e) => e.code === SHIPPING_NETWORK_ERROR_CODE)) {\n // Resolved synthetic upstream/network failure: generic error state (Decision 5).\n setErrors([]);\n setUpstreamError(true);\n } else {\n // Domain userErrors render inline; leave drawer open for retry (7th acceptance criterion)\n setErrors(userErrors);\n }\n } catch (error) {\n // Network/upstream error: surface as generic state and leave drawer open\n console.error('[ShippingAddress] drawer submit failed:', error);\n setUpstreamError(true);\n setErrors([]);\n } finally {\n setDrawerSubmitting(false);\n }\n }, [selectedSavedId, currentAddressId, mappedSavedAddresses, $actions?.shipping?.setAddress]);\n\n // Provide context to all children\n const contextValue: ShippingAddressContextValue = {\n draft,\n setDraftField,\n descriptor,\n savedAddresses: mappedSavedAddresses,\n selectedSavedId,\n setSelectedSavedId: selectSavedAddress,\n submitting,\n errors,\n upstreamError,\n handleSubmit,\n currentAddressId,\n currentAddress: formattedCurrentAddress,\n submitSuccessSignal,\n isFormValid,\n discardDraft,\n };\n\n const drawerContextValue: ShippingAddressDrawerContextValue = {\n savedAddressDrawerOpen,\n setSavedAddressDrawerOpen,\n drawerSubmitting,\n handleDrawerSubmit,\n };\n\n return (\n <ShippingAddressContext.Provider value={contextValue}>\n <ShippingAddressDrawerContext.Provider value={drawerContextValue}>\n <div className={className} data-fs-shipping-address=\"\">\n {children}\n </div>\n </ShippingAddressDrawerContext.Provider>\n </ShippingAddressContext.Provider>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Control Components (thin, context-bound, reuse particles)\n// ---------------------------------------------------------------------------\n\n/**\n * RecipientNameControl — the only client-validated field (US-4, US-6).\n * Pre-filled from clientProfile, editable, required.\n */\nexport function ShippingAddressRecipientNameControl({ className }: ShippingAddressRecipientNameControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const isRendered = descriptor?.fields.some((f) => f.name === 'recipientName');\n if (!isRendered) return null;\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'recipientName');\n const label = fieldDescriptor?.label ?? 'nome do destinatário';\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"recipient-name\" disabled={submitting}>\n <Field.Label>{label}</Field.Label>\n <Field.Control\n value={draft.recipientName}\n onChange={(e) => setDraftField('recipientName', e.currentTarget.value)}\n />\n </Field.Root>\n );\n}\n\n/** StreetControl */\nexport function ShippingAddressStreetControl({ className }: ShippingAddressStreetControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'street');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"street\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.street} onChange={(e) => setDraftField('street', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** NumberControl */\nexport function ShippingAddressNumberControl({ className }: ShippingAddressNumberControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'number');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"number\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.number} onChange={(e) => setDraftField('number', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** CityControl */\nexport function ShippingAddressCityControl({ className }: ShippingAddressCityControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'city');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"city\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.city} onChange={(e) => setDraftField('city', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** StateControl */\nexport function ShippingAddressStateControl({ className }: ShippingAddressStateControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'state');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"state\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.state} onChange={(e) => setDraftField('state', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** PostalCodeControl */\nexport function ShippingAddressPostalCodeControl({ className }: ShippingAddressPostalCodeControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'postalCode');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"postal-code\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.postalCode} onChange={(e) => setDraftField('postalCode', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** ComplementControl */\nexport function ShippingAddressComplementControl({ className }: ShippingAddressComplementControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'complement');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"complement\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control value={draft.complement} onChange={(e) => setDraftField('complement', e.currentTarget.value)} />\n </Field.Root>\n );\n}\n\n/** NeighborhoodControl (BR-specific in v1) */\nexport function ShippingAddressNeighborhoodControl({ className }: ShippingAddressNeighborhoodControlProps) {\n const { draft, setDraftField, descriptor, submitting } = useShippingAddressContext();\n\n const fieldDescriptor = descriptor?.fields.find((f) => f.name === 'neighborhood');\n if (!fieldDescriptor) return null;\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"neighborhood\" disabled={submitting}>\n <Field.Label>{fieldDescriptor.label}</Field.Label>\n <Field.Control\n value={draft.neighborhood}\n onChange={(e) => setDraftField('neighborhood', e.currentTarget.value)}\n />\n </Field.Root>\n );\n}\n\n/** CountryControl — lists only countries with a descriptor (US-2, first criterion) */\nexport function ShippingAddressCountryControl({ className, label = 'país' }: ShippingAddressCountryControlProps) {\n const { draft, setDraftField, setSelectedSavedId, submitting } = useShippingAddressContext();\n\n const availableCountries = getAvailableCountries();\n const countryOptions = availableCountries.map((iso) => {\n const desc = getCountryDescriptor(iso);\n return { value: iso, label: desc?.label ?? iso };\n });\n\n const handleCountryChange = (value: string | null) => {\n if (!value) return;\n const newDesc = getCountryDescriptor(value);\n if (newDesc) {\n setDraftField('country', value);\n setSelectedSavedId(undefined);\n }\n };\n\n return (\n <Field.Root className={className} data-fs-shipping-address-field=\"country\" disabled={submitting}>\n <Field.Label>{label}</Field.Label>\n <Select.Root value={draft.country} onValueChange={handleCountryChange} disabled={submitting}>\n <Select.Trigger>\n {/* Resolves the label directly from the country descriptor rather than relying on Base\n UI's automatic item-label lookup, which only reflects a mounted Select.Item (i.e.\n after the popup has been opened at least once) — otherwise the trigger would show\n the raw ISO code (e.g. \"BRA\") before the shopper ever opens the dropdown. */}\n <Select.Value>{(value) => (value ? (getCountryDescriptor(value)?.label ?? value) : value)}</Select.Value>\n <Select.Icon>▾</Select.Icon>\n </Select.Trigger>\n <Select.Portal>\n <Select.Positioner>\n <Select.Popup>\n <Select.List>\n {countryOptions.map((option) => (\n <Select.Item key={option.value} value={option.value} label={option.label}>\n {option.label}\n </Select.Item>\n ))}\n </Select.List>\n </Select.Popup>\n </Select.Positioner>\n </Select.Portal>\n </Select.Root>\n </Field.Root>\n );\n}\n\n// ---------------------------------------------------------------------------\n// SavedAddresses List and Option (US-3)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSavedList — renders only when savedAddresses is non-empty (logged-in signal).\n */\nexport function ShippingAddressSavedList({ className }: ShippingAddressSavedListProps) {\n const { savedAddresses } = useShippingAddressContext();\n\n if (savedAddresses.length === 0) return null;\n\n return (\n <div className={className} data-fs-shipping-address-saved-list=\"\">\n {savedAddresses.map((saved) => (\n <ShippingAddressSavedOption key={saved.id} id={saved.id} />\n ))}\n </div>\n );\n}\n\n/**\n * ShippingAddressSavedOption — selectable saved address; populates draft on selection.\n * Includes isCurrent visual variant to mark the address matching the current cart address (Decision 8).\n */\nexport function ShippingAddressSavedOption({ id, className }: ShippingAddressSavedOptionProps) {\n const { savedAddresses, selectedSavedId, setSelectedSavedId, currentAddressId } = useShippingAddressContext();\n\n const saved = savedAddresses.find((s) => s.id === id);\n if (!saved) return null;\n\n const isSelected = selectedSavedId === id;\n const isCurrent = currentAddressId !== undefined && currentAddressId === id;\n const hasAddressContent = Boolean(\n saved.address.recipientName || saved.address.street || saved.address.city || saved.address.neighborhood,\n );\n const inputId = `saved-address-${id}`;\n\n return (\n <div\n className={className}\n data-fs-shipping-address-saved-option=\"\"\n {...(isSelected ? { 'data-fs-shipping-address-saved-option-selected': '' } : {})}\n {...(isCurrent ? { 'data-fs-shipping-address-saved-option-current': '' } : {})}\n >\n <input\n id={inputId}\n type=\"radio\"\n name=\"saved-address\"\n value={id}\n checked={isSelected}\n onChange={() => setSelectedSavedId(id)}\n />\n <label htmlFor={inputId}>\n {hasAddressContent ? (\n <AddressSummaryRoot address={saved.address}>\n <AddressSummary />\n </AddressSummaryRoot>\n ) : (\n `Endereço ${id}`\n )}\n </label>\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Submit Button (US-5)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSubmit — dispatches the batched submit; reflects pending state.\n */\nexport function ShippingAddressSubmit({\n className,\n label = 'salvar endereço',\n pendingLabel = 'salvando...',\n}: ShippingAddressSubmitProps) {\n const { submitting, handleSubmit, isFormValid } = useShippingAddressContext();\n\n return (\n <button\n type=\"button\"\n onClick={handleSubmit}\n disabled={submitting || !isFormValid}\n className={className}\n data-fs-shipping-address-submit=\"\"\n {...(submitting ? { 'data-fs-shipping-address-submit-pending': '' } : {})}\n >\n {submitting ? pendingLabel : label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Saved-Address Drawer Controller (US-8)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSavedAddressDrawerController — makes the wrapped DrawerRoot controlled by the\n * shipping-address context's savedAddressDrawerOpen state, and blocks dismissal (Escape, backdrop\n * click, close button) while drawerSubmitting is true by simply not forwarding the close request\n * to the setter. Mirrors CartOpenOnAdd's cloneElement mechanism. Expects a single DrawerRoot child.\n */\nexport function ShippingAddressSavedAddressDrawerController({\n children,\n}: ShippingAddressSavedAddressDrawerControllerProps) {\n const { savedAddressDrawerOpen, setSavedAddressDrawerOpen, drawerSubmitting } = useShippingAddressDrawerContext();\n\n if (!isValidElement<Pick<DrawerRootProps, 'open' | 'onOpenChange'>>(children)) {\n return children;\n }\n\n return cloneElement(children, {\n open: savedAddressDrawerOpen,\n onOpenChange: (next: boolean) => {\n if (!next && drawerSubmitting) return;\n setSavedAddressDrawerOpen(next);\n },\n });\n}\n\n// ---------------------------------------------------------------------------\n// Saved-Address Submit (US-8)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSavedAddressSubmit — the drawer's \"selecionar\" submit button; independent\n * submitting state from the main form's Submit (Decision 7); no-ops when the selected saved\n * address is already the current one (Decision 8).\n */\nexport function ShippingAddressSavedAddressSubmit({\n className,\n label = 'selecionar',\n pendingLabel = 'selecionando...',\n}: ShippingAddressSavedAddressSubmitProps) {\n const { selectedSavedId } = useShippingAddressContext();\n const { drawerSubmitting, handleDrawerSubmit } = useShippingAddressDrawerContext();\n\n return (\n <button\n type=\"button\"\n onClick={handleDrawerSubmit}\n disabled={drawerSubmitting || !selectedSavedId}\n className={className}\n data-fs-shipping-address-saved-address-submit=\"\"\n {...(drawerSubmitting ? { 'data-fs-shipping-address-saved-address-submit-pending': '' } : {})}\n >\n {drawerSubmitting ? pendingLabel : label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Selected Address Summary (read-only, self-gating)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressSelectedSummary — provides the current delivery address via AddressSummaryRoot's\n * context and renders it through AddressSummary. Composed lines go through that same wrapper rather\n * than replacing it, because AddressSummaryRoot renders no DOM and `className` would have nowhere to\n * land. Self-gating on currentAddress: renders null when there is none yet, rather than an empty\n * provider with nothing meaningful to show.\n */\nexport function ShippingAddressSelectedSummary({ className, children }: ShippingAddressSelectedSummaryProps) {\n const { currentAddress } = useShippingAddressContext();\n\n if (!currentAddress) return null;\n\n return (\n <AddressSummaryRoot address={currentAddress}>\n <AddressSummary className={className}>{children}</AddressSummary>\n </AddressSummaryRoot>\n );\n}\n\n// ---------------------------------------------------------------------------\n// View/Edit Mode Toggle (composable — Free Particle Model)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressEditController — owns the view/edit mode. Defaults to 'view' when a current\n * address exists, 'edit' otherwise (derived reactively from currentAddressId, so it self-corrects\n * if the address arrives asynchronously after mount, same issue as the draft-sync effect above).\n * Once the shopper explicitly toggles (via ShippingAddressEditButton) or a submit succeeds, the\n * explicit mode takes over. Does not render any DOM itself; provides ShippingAddressSectionContext\n * to ShippingAddressSummaryView/ShippingAddressEditForm/ShippingAddressEditButton descendants.\n */\nexport function ShippingAddressEditController({ children }: ShippingAddressEditControllerProps) {\n const { currentAddressId, submitSuccessSignal } = useShippingAddressContext();\n const [explicitMode, setExplicitMode] = useState<ShippingAddressSectionState | undefined>(undefined);\n const lastHandledSignal = useRef(submitSuccessSignal);\n\n useEffect(() => {\n if (submitSuccessSignal !== lastHandledSignal.current) {\n lastHandledSignal.current = submitSuccessSignal;\n setExplicitMode('view');\n }\n }, [submitSuccessSignal]);\n\n // This section decides alone: the form when there is no address to show, the summary when there is, and\n // whatever the shopper last chose once they have chosen. It reports nothing to anything else, so finishing\n // it opens no other section.\n const mode: ShippingAddressSectionState = explicitMode ?? (currentAddressId !== undefined ? 'view' : 'edit');\n\n const modeContextValue = useMemo<ShippingAddressSectionContextValue>(\n () => ({ mode, setMode: setExplicitMode }),\n [mode],\n );\n\n return (\n <ShippingAddressSectionContext.Provider value={modeContextValue}>{children}</ShippingAddressSectionContext.Provider>\n );\n}\n\n/** Renders its children only while the section shows the saved-address summary. */\nexport function ShippingAddressSummaryView({ children }: ShippingAddressSectionPanelProps) {\n const { mode } = useShippingAddressSectionContext();\n if (mode !== 'view') return null;\n return <>{children}</>;\n}\n\n/** Renders its children only while the section shows the address form. */\nexport function ShippingAddressEditForm({ children }: ShippingAddressSectionPanelProps) {\n const { mode } = useShippingAddressSectionContext();\n if (mode !== 'edit') return null;\n return <>{children}</>;\n}\n\n/**\n * ShippingAddressEditButton — CTA that switches the mode to 'edit'. Has no knowledge of why the\n * mode might currently be 'view' (a current address, or a just-completed submit) — it only writes\n * the mode forward.\n */\nexport function ShippingAddressEditButton({ className, label = 'editar', children }: ShippingAddressEditButtonProps) {\n const { setMode } = useShippingAddressSectionContext();\n return (\n <button type=\"button\" onClick={() => setMode('edit')} className={className} data-fs-shipping-address-edit-button=\"\">\n {children ?? label}\n </button>\n );\n}\n\n/**\n * ShippingAddressCancelButton — returns the section to its summary without writing. Without it a\n * shopper who opens the form can only leave through a successful `setAddress`, and blanking the\n * recipient disables Submit, which leaves the section stuck open over the summary it replaced.\n */\nexport function ShippingAddressCancelButton({\n className,\n label = 'cancelar',\n children,\n}: ShippingAddressEditButtonProps) {\n const { setMode } = useShippingAddressSectionContext();\n const { discardDraft } = useShippingAddressContext();\n return (\n <button\n type=\"button\"\n onClick={() => {\n discardDraft();\n setMode('view');\n }}\n className={className}\n data-fs-shipping-address-cancel-button=\"\"\n >\n {children ?? label}\n </button>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Error Component (US-6)\n// ---------------------------------------------------------------------------\n\n/**\n * ShippingAddressError — renders domain userErrors inline, or generic upstream error state.\n */\nexport function ShippingAddressError({ className }: ShippingAddressErrorProps) {\n const { errors, upstreamError } = useShippingAddressContext();\n\n if (errors.length === 0 && !upstreamError) return null;\n\n return (\n <div className={className} data-fs-shipping-address-error=\"\">\n {upstreamError ? (\n <div>Não foi possível salvar este endereço. Revise os dados e tente novamente.</div>\n ) : (\n <ul>\n {errors.map((error, idx) => (\n <li key={idx}>{error.message}</li>\n ))}\n </ul>\n )}\n </div>\n );\n}\n\n// ---------------------------------------------------------------------------\n// Namespace Export\n// ---------------------------------------------------------------------------\n\nexport const ShippingAddress = {\n Root: ShippingAddressRoot,\n RootDefinition: ShippingAddressRootDefinition,\n RecipientNameControl: ShippingAddressRecipientNameControl,\n RecipientNameControlDefinition: ShippingAddressRecipientNameControlDefinition,\n StreetControl: ShippingAddressStreetControl,\n StreetControlDefinition: ShippingAddressStreetControlDefinition,\n NumberControl: ShippingAddressNumberControl,\n NumberControlDefinition: ShippingAddressNumberControlDefinition,\n CityControl: ShippingAddressCityControl,\n CityControlDefinition: ShippingAddressCityControlDefinition,\n StateControl: ShippingAddressStateControl,\n StateControlDefinition: ShippingAddressStateControlDefinition,\n PostalCodeControl: ShippingAddressPostalCodeControl,\n PostalCodeControlDefinition: ShippingAddressPostalCodeControlDefinition,\n ComplementControl: ShippingAddressComplementControl,\n ComplementControlDefinition: ShippingAddressComplementControlDefinition,\n NeighborhoodControl: ShippingAddressNeighborhoodControl,\n NeighborhoodControlDefinition: ShippingAddressNeighborhoodControlDefinition,\n CountryControl: ShippingAddressCountryControl,\n CountryControlDefinition: ShippingAddressCountryControlDefinition,\n SavedList: ShippingAddressSavedList,\n SavedListDefinition: ShippingAddressSavedListDefinition,\n SavedOption: ShippingAddressSavedOption,\n SavedOptionDefinition: ShippingAddressSavedOptionDefinition,\n Submit: ShippingAddressSubmit,\n SubmitDefinition: ShippingAddressSubmitDefinition,\n SavedAddressDrawerController: ShippingAddressSavedAddressDrawerController,\n SavedAddressDrawerControllerDefinition: ShippingAddressSavedAddressDrawerControllerDefinition,\n SavedAddressSubmit: ShippingAddressSavedAddressSubmit,\n SavedAddressSubmitDefinition: ShippingAddressSavedAddressSubmitDefinition,\n SelectedSummary: ShippingAddressSelectedSummary,\n SelectedSummaryDefinition: ShippingAddressSelectedSummaryDefinition,\n EditController: ShippingAddressEditController,\n EditControllerDefinition: ShippingAddressEditControllerDefinition,\n SummaryView: ShippingAddressSummaryView,\n SummaryViewDefinition: ShippingAddressSummaryViewDefinition,\n EditForm: ShippingAddressEditForm,\n EditFormDefinition: ShippingAddressEditFormDefinition,\n EditButton: ShippingAddressEditButton,\n EditButtonDefinition: ShippingAddressEditButtonDefinition,\n CancelButton: ShippingAddressCancelButton,\n CancelButtonDefinition: ShippingAddressCancelButtonDefinition,\n Error: ShippingAddressError,\n ErrorDefinition: ShippingAddressErrorDefinition,\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAwCA,MAAM,WAAyB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkI/B,MAAM,iCAAiC,OAAO,6BAA6B;AAE3E,MAAM,yBAAyB,cAC7B,8BAC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