diff --git a/packages/mint-components/.changeset/puny-brooms-call.md b/packages/mint-components/.changeset/puny-brooms-call.md new file mode 100644 index 000000000..663781c7d --- /dev/null +++ b/packages/mint-components/.changeset/puny-brooms-call.md @@ -0,0 +1,5 @@ +--- +"@saasquatch/mint-components": minor +--- + +Partner info modal now shows firstName and lastName inputs when either is missing from the user diff --git a/packages/mint-components/src/components/sqm-partner-info-modal/PartnerInfoModal.stories.tsx b/packages/mint-components/src/components/sqm-partner-info-modal/PartnerInfoModal.stories.tsx index 96c14a0c2..de13fbd03 100644 --- a/packages/mint-components/src/components/sqm-partner-info-modal/PartnerInfoModal.stories.tsx +++ b/packages/mint-components/src/components/sqm-partner-info-modal/PartnerInfoModal.stories.tsx @@ -27,6 +27,8 @@ const demoCurrencies = [ ]; const noopCallbacks = { + onFirstNameChange: (e: any) => console.log("First name changed:", e), + onLastNameChange: (e: any) => console.log("Last name changed:", e), onCountryChange: (e: any) => console.log("Country changed:", e), onCurrencyChange: (e: any) => console.log("Currency changed:", e), onCheckboxChange: (e: any) => console.log("Checkbox changed:", e), @@ -66,6 +68,9 @@ const defaultProps: PartnerInfoModalViewProps = { loading: false, submitting: false, isExistingPartner: false, + shouldDisplayNameFields: false, + firstName: "", + lastName: "", countryCode: "", currency: "", error: "", @@ -208,3 +213,39 @@ export const SQMComponentNewPartner = () => { > ); }; + +export const PartnerHasFirstAndLastName = () => { + const props: PartnerInfoModalViewProps = { + ...defaultProps, + states: { + ...defaultProps.states, + firstName: "John", + lastName: "Doe", + }, + }; + return ; +}; + +export const PartnerHasFirstNameOnly = () => { + const props: PartnerInfoModalViewProps = { + ...defaultProps, + states: { + ...defaultProps.states, + firstName: "John", + lastName: "", + shouldDisplayNameFields: true, + }, + }; + return ; +}; + +export const Loading = () => { + const props: PartnerInfoModalViewProps = { + ...defaultProps, + states: { + ...defaultProps.states, + loading: true, + }, + }; + return ; +}; diff --git a/packages/mint-components/src/components/sqm-partner-info-modal/readme.md b/packages/mint-components/src/components/sqm-partner-info-modal/readme.md index 100a57fff..1b1dc1617 100644 --- a/packages/mint-components/src/components/sqm-partner-info-modal/readme.md +++ b/packages/mint-components/src/components/sqm-partner-info-modal/readme.md @@ -7,28 +7,28 @@ ## Properties -| Property | Attribute | Description | Type | Default | -| ----------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| `allowBankingCollection` | `allow-banking-collection` | Edit the property called terms and conditions text to change what's displayed for {termsAndConditionsLink}. | `string` | `"I have read the {termsAndConditionsLink} and allow impact.com to collect my tax and banking information."` | -| `confirmButtonLabel` | `confirm-button-label` | | `string` | `"Confirm"` | -| `countryLabel` | `country-label` | | `string` | `"Country"` | -| `currencyLabel` | `currency-label` | | `string` | `"Currency"` | -| `demoData` | -- | | `{ states?: { open: boolean; loading: boolean; submitting: boolean; isExistingPartner: boolean; countryCode: string; currency: string; error: string; success: boolean; filteredCountries: { countryCode: string; displayName: string; }[]; filteredCurrencies: { currencyCode: string; displayName: string; }[]; allowBankingCollection: boolean; disabled: boolean; }; }` | `undefined` | -| `descriptionExistingPartner` | `description-existing-partner` | Description for existing partner confirmation | `string` | `"We found an account with this email on our referral program provider, impact.com. Please confirm your country and currency now to get your future rewards faster."` | -| `descriptionNewPartner` | `description-new-partner` | Description for new partner setup | `string` | `"Confirm your country and currency now to get your future rewards faster."` | -| `inModal` | `in-modal` | Used to render in another modal. | `boolean` | `false` | -| `missingFieldsErrorText` | `missing-fields-error-text` | | `string` | `"Please fill out all fields."` | -| `modalHeader` | `modal-header` | Header text when user has no existing partner | `string` | `"Let's get you ready for rewards"` | -| `modalHeaderExistingPartner` | `modal-header-existing-partner` | Header text when user has an existing partner | `string` | `"We found an existing account"` | -| `networkErrorText` | `network-error-text` | | `string` | `"An error occurred. Please try again."` | -| `searchCountryPlaceholder` | `search-country-placeholder` | | `string` | `"Search for a country"` | -| `searchCurrencyPlaceholder` | `search-currency-placeholder` | | `string` | `"Search for a currency"` | -| `stateController` | `state-controller` | | `string` | `'{"sqm-partner-info-modal":{"states":{"open":false}}}'` | -| `submitButtonLabel` | `submit-button-label` | | `string` | `"Submit"` | -| `supportDescriptionExistingPartner` | `support-description-existing-partner` | Support description for existing partner confirmation | `string` | `"If this is a mistake, please contact {supportLink} or sign up for this referral program with a different email."` | -| `supportLink` | `support-link` | Support description for existing partner confirmation | `string` | `"Support"` | -| `termsAndConditionsLabel` | `terms-and-conditions-label` | The link text that appears in the terms and conditions checkbox | `string` | `"terms and conditions"` | -| `termsAndConditionsLink` | `terms-and-conditions-link` | The link that appears in the terms and conditions checkbox | `string` | `"https://terms.advocate.impact.com/PayoutTermsAndConditions.html"` | +| Property | Attribute | Description | Type | Default | +| ----------------------------------- | -------------------------------------- | ----------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| `allowBankingCollection` | `allow-banking-collection` | Edit the property called terms and conditions text to change what's displayed for {termsAndConditionsLink}. | `string` | `"I have read the {termsAndConditionsLink} and allow impact.com to collect my tax and banking information."` | +| `confirmButtonLabel` | `confirm-button-label` | | `string` | `"Confirm"` | +| `countryLabel` | `country-label` | | `string` | `"Country"` | +| `currencyLabel` | `currency-label` | | `string` | `"Currency"` | +| `demoData` | -- | | `{ states?: { open: boolean; loading: boolean; submitting: boolean; isExistingPartner: boolean; shouldDisplayNameFields: boolean; firstName: string; lastName: string; countryCode: string; currency: string; error: string; success: boolean; filteredCountries: { countryCode: string; displayName: string; }[]; filteredCurrencies: { currencyCode: string; displayName: string; }[]; allowBankingCollection: boolean; disabled: boolean; }; }` | `undefined` | +| `descriptionExistingPartner` | `description-existing-partner` | Description for existing partner confirmation | `string` | `"We found an account with this email on our referral program provider, impact.com. Please confirm your country and currency now to get your future rewards faster."` | +| `descriptionNewPartner` | `description-new-partner` | Description for new partner setup | `string` | `"Confirm your country and currency now to get your future rewards faster."` | +| `inModal` | `in-modal` | Used to render in another modal. | `boolean` | `false` | +| `missingFieldsErrorText` | `missing-fields-error-text` | | `string` | `"Please fill out all fields."` | +| `modalHeader` | `modal-header` | Header text when user has no existing partner | `string` | `"Let's get you ready for rewards"` | +| `modalHeaderExistingPartner` | `modal-header-existing-partner` | Header text when user has an existing partner | `string` | `"We found an existing account"` | +| `networkErrorText` | `network-error-text` | | `string` | `"An error occurred. Please try again."` | +| `searchCountryPlaceholder` | `search-country-placeholder` | | `string` | `"Search for a country"` | +| `searchCurrencyPlaceholder` | `search-currency-placeholder` | | `string` | `"Search for a currency"` | +| `stateController` | `state-controller` | | `string` | `'{"sqm-partner-info-modal":{"states":{"open":false}}}'` | +| `submitButtonLabel` | `submit-button-label` | | `string` | `"Submit"` | +| `supportDescriptionExistingPartner` | `support-description-existing-partner` | Support description for existing partner confirmation | `string` | `"If this is a mistake, please contact {supportLink} or sign up for this referral program with a different email."` | +| `supportLink` | `support-link` | Support description for existing partner confirmation | `string` | `"Support"` | +| `termsAndConditionsLabel` | `terms-and-conditions-label` | The link text that appears in the terms and conditions checkbox | `string` | `"terms and conditions"` | +| `termsAndConditionsLink` | `terms-and-conditions-link` | The link that appears in the terms and conditions checkbox | `string` | `"https://terms.advocate.impact.com/PayoutTermsAndConditions.html"` | ## Dependencies diff --git a/packages/mint-components/src/components/sqm-partner-info-modal/sqm-partner-info-modal-view.tsx b/packages/mint-components/src/components/sqm-partner-info-modal/sqm-partner-info-modal-view.tsx index ca6046dc9..c3a883a26 100644 --- a/packages/mint-components/src/components/sqm-partner-info-modal/sqm-partner-info-modal-view.tsx +++ b/packages/mint-components/src/components/sqm-partner-info-modal/sqm-partner-info-modal-view.tsx @@ -1,4 +1,4 @@ -import { h } from "@stencil/core"; +import { Fragment, h } from "@stencil/core"; import { createStyleSheet } from "../../styling/JSS"; import { intl } from "../../global/global"; @@ -8,6 +8,9 @@ export interface PartnerInfoModalViewProps { loading: boolean; submitting: boolean; isExistingPartner: boolean; + shouldDisplayNameFields: boolean; + firstName: string; + lastName: string; countryCode: string; currency: string; error: string; @@ -18,6 +21,8 @@ export interface PartnerInfoModalViewProps { disabled: boolean; }; callbacks: { + onFirstNameChange: (e: any) => void; + onLastNameChange: (e: any) => void; onCountryChange: (e: any) => void; onCurrencyChange: (e: any) => void; onCheckboxChange: (e: any) => void; @@ -72,6 +77,12 @@ const style = { gap: "var(--sl-spacing-medium)", marginTop: "var(--sl-spacing-large)", }, + NameInput: { + "&::part(label)": { + fontWeight: "var(--sl-font-weight-normal)", + fontSize: "var(--sl-input-label-font-size-medium)", + }, + }, ErrorMessage: { marginTop: "var(--sl-spacing-x-small)", }, @@ -132,7 +143,7 @@ export function PartnerInfoModalContentView(props: PartnerInfoModalViewProps) { {text.supportLink} ), - }, + } ); const description = states.isExistingPartner ? ( @@ -161,14 +172,36 @@ export function PartnerInfoModalContentView(props: PartnerInfoModalViewProps) { {text.termsAndConditionsLabel} ), - }, + } ); return (
- +
{description} + {states.shouldDisplayNameFields && ( + + + + + )}