From 31b471451e417c97bb6d13f191a661957033e991 Mon Sep 17 00:00:00 2001 From: Joely Date: Sat, 14 Nov 2026 01:58:59 -0500 Subject: [PATCH] components 0.7.2 (unpublished): Form.EmailPassword can show a line under the email; the profile and email-change snackbars say what happened MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - Form.EmailPassword takes `emailHelperText` (optional, localized by the host): Paper's HelperText under the email, in its section, as FormBusinessInfo places its own. CustomerApp's profile says there why an email that came with a social sign-in cannot be changed (owner 2026-11-13). Without the prop the form is what it was. - `snackbar.emailUpdated` and `snackbar.profileUpdated` were crossed in es.json, and `profileUpdated` was Spanish in en.json. Now in the owner's words (2026-11-13): «Te enviamos un enlace a %{email}. Tu correo cambia cuando lo abras.» / "We sent a link to %{email}. Your email changes when you open it."; «Perfil actualizado.» / "Profile updated." `emailUpdated` takes the address. - A story and a test for the line. Tests: Form/__tests__/FormEmailPassword.test.js 2/2, Localization/__tests__/parity.test.js 6/6. Co-Authored-By: Claude Opus 5.5 --- packages/components/package-lock.json | 4 +- packages/components/package.json | 2 +- packages/components/src/Form/Form.stories.js | 11 ++++ .../components/src/Form/FormEmailPassword.js | 5 +- .../Form/__tests__/FormEmailPassword.test.js | 57 +++++++++++++++++++ .../src/Localization/Translations/en.json | 4 +- .../src/Localization/Translations/es.json | 4 +- 7 files changed, 79 insertions(+), 8 deletions(-) create mode 100644 packages/components/src/Form/__tests__/FormEmailPassword.test.js diff --git a/packages/components/package-lock.json b/packages/components/package-lock.json index a9bfd2e0..546c5a8e 100644 --- a/packages/components/package-lock.json +++ b/packages/components/package-lock.json @@ -1,12 +1,12 @@ { "name": "@jmstechnologiesinc/react-native-components", - "version": "0.7.1", + "version": "0.7.2", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@jmstechnologiesinc/react-native-components", - "version": "0.7.1", + "version": "0.7.2", "license": "ISC", "devDependencies": { "@jmstechnologiesinc/partner": "0.2.54", diff --git a/packages/components/package.json b/packages/components/package.json index f27a14ff..b68aca8d 100644 --- a/packages/components/package.json +++ b/packages/components/package.json @@ -1,6 +1,6 @@ { "name": "@jmstechnologiesinc/react-native-components", - "version": "0.7.1", + "version": "0.7.2", "description": "Biblioteca de componentes de interfaz compartida por las aplicaciones de Daxir.", "author": "yerloveraaa ", "homepage": "https://github.com/jmstechnologiesinc/react-native-components#readme", diff --git a/packages/components/src/Form/Form.stories.js b/packages/components/src/Form/Form.stories.js index 1f3848ee..d34e46a3 100644 --- a/packages/components/src/Form/Form.stories.js +++ b/packages/components/src/Form/Form.stories.js @@ -66,6 +66,17 @@ export const AuthFormEmailPasswordDisabled = () => ( /> ); +export const AuthFormEmailHelperText = () => ( + {}} + showPasswordInput={false} + showConfirmPasswordInput={false} + isEmailDisabled={true} + emailHelperText="This email comes from your Google account and can't be changed here." + /> +); + export const AuthFormPersonInfo = () => ( inputActionHandler('email', email)} disabled={isEmailDisabled} /> + {emailHelperText ? {emailHelperText} : null} {showPasswordInput ? ( diff --git a/packages/components/src/Form/__tests__/FormEmailPassword.test.js b/packages/components/src/Form/__tests__/FormEmailPassword.test.js new file mode 100644 index 00000000..e3482b79 --- /dev/null +++ b/packages/components/src/Form/__tests__/FormEmailPassword.test.js @@ -0,0 +1,57 @@ +// Form.EmailPassword places the host's line under the email (the app's profile says why a social sign-in's address +// cannot be changed there), inside the email's own section, as the business form places its helper texts. +jest.mock('react-native-localize', () => ({ + findBestLanguageTag: jest.fn(() => ({ languageTag: 'en', isRTL: false })), +})); +// The section frame alone: the package's ScreenWrapper entry also loads the camera's native modules. +jest.mock('../../ScreenWrapper', () => ({ __esModule: true, default: { Section: 'ScreenWrapper.Section' } })); + +import React from 'react'; +import renderer, { act } from 'react-test-renderer'; + +import { HelperText, MD3LightTheme, Provider, TextInput } from '@jmstechnologiesinc/react-native-paper'; + +import FormEmailPassword from '../FormEmailPassword'; + +// Paper's HelperText animates its entrance: its timers run inside the test, as the inputs' own suite runs them. +jest.useFakeTimers(); + +const LINE = "This email comes from your Google account and can't be changed here."; + +const emailSectionOf = (props) => { + let tree; + act(() => { + tree = renderer.create( + + {}} + {...props} + /> + + ); + }); + const [section] = tree.root.findAllByType('ScreenWrapper.Section'); + const helperTexts = section.findAllByType(HelperText).map((helperText) => helperText.props.children); + const { disabled } = section.findByType(TextInput).props; + act(() => { + tree.unmount(); + jest.runOnlyPendingTimers(); + }); + return { helperTexts, disabled }; +}; + +describe('Form.EmailPassword', () => { + it('shows no line under the email by default', () => { + expect(emailSectionOf().helperTexts).toEqual([]); + }); + + it('shows the host’s line under the email, in its section', () => { + const { helperTexts, disabled } = emailSectionOf({ isEmailDisabled: true, emailHelperText: LINE }); + + expect(helperTexts).toEqual([LINE]); + expect(disabled).toBe(true); + }); +}); diff --git a/packages/components/src/Localization/Translations/en.json b/packages/components/src/Localization/Translations/en.json index d0982667..b846929a 100644 --- a/packages/components/src/Localization/Translations/en.json +++ b/packages/components/src/Localization/Translations/en.json @@ -608,8 +608,8 @@ "storeDetailsUpdated": "Store details updated successfully.", "fulfillmentMethodsUpdated": "Fulfillment Methods updated successfully.", "preferencesUpdated": "Preferences updated successfully successfully.", - "emailUpdated": "Your changes have been saved. If you updated your email address, confirm it with the link we sent you.", - "profileUpdated": "Perfil actualizada con éxito.", + "emailUpdated": "We sent a link to %{email}. Your email changes when you open it.", + "profileUpdated": "Profile updated.", "submissionStatus": "Request received. We are reviewing your submission.", "paymentMethodUpdated": "Your payment method was updated successfully.", "partnerReviewed": "The application was reviewed successfully.", diff --git a/packages/components/src/Localization/Translations/es.json b/packages/components/src/Localization/Translations/es.json index 548b69d5..22f5da81 100644 --- a/packages/components/src/Localization/Translations/es.json +++ b/packages/components/src/Localization/Translations/es.json @@ -608,8 +608,8 @@ "storeDetailsUpdated": "Detalles de la tienda actualizados con éxito.", "fulfillmentMethodsUpdated": "Métodos de cumplimiento actualizados con éxito.", "preferencesUpdated": "¡Preferencias actualizadas con éxito.", - "profileUpdated": "Tus cambios han sido guardados. Si actualizaste tu correo, confírmalo con el enlace que te enviamos.", - "emailUpdated": "Perfil actualizada con éxito.", + "profileUpdated": "Perfil actualizado.", + "emailUpdated": "Te enviamos un enlace a %{email}. Tu correo cambia cuando lo abras.", "submissionStatus": "Solicitud recibida. Estamos revisando tu envío.", "paymentMethodUpdated": "Su método de pago se actualizó con éxito.", "partnerReviewed": "La solicitud se revisó correctamente.",