HomeWiki
HomeWiki
  1. Components
  • Back to home
  • 1. Themes
  • Layout
    • New Layout
    • Legacy Layout
  • Components
    • Announcement
    • Banner Carousel
    • Banner With Products Carousel
    • Blog Category List
    • Blog List
    • Brand List
    • Brands Carousel
    • Breadcrumb
    • Call To Action
    • Cart
    • Categories List
    • Change Password
    • Checkout
    • Cookie Manager
    • Filter list
    • Footer
    • Forgot Password
    • Form
    • Hero Carousel
    • Icon Block
    • Invitation
    • Last Visited Products
    • Layout
    • Login
    • Map
    • Nav Bar
    • Offer
    • Product Attachments
    • Product Attributes
    • Product Documentation
    • Product Expected
    • Product Modal
    • Products Block
    • Products Carousel
    • Product Single
    • Profile
    • Quote
    • Register
    • Related Products
    • Search
    • Stores
    • Subscribe Newsletter
    • Text with Image
    • Top Bar
    • Video
  • Reusables
    • Getting Started
  • Assets
    • Getting Started
  • SDK
    • Products
      • _findProductsByCategory
      • _findProductsByIds
      • _findProductsByTitle
      • _findProductsByFilter
      • _findProductsByCriteria
      • _findProductsAndCalculate
      • _findProductsThenCalculate
      • _getProductAttributeSet
      • _setLastVisited
    • Categories
      • _findCategoryTreeById
      • _findCategoriesByIds
      • _findCategoryByAlias
      • _findCategoryTreeByAlias
      • _getCategoryContent
    • Collections
      • _getCollectionContent
      • _findCollectionsByIds
      • _findCollectionsByIdsThenCalculate
    • Brands
      • _getBrandContent
      • _findBrandsByIds
    • Cart
      • _addToCartMulti
      • _addToCart
      • _setCart
      • _clearCart
      • _setCartListener
      • _removeFromCart
      • _calculateCart
    • Checkout
      • _startCheckout
      • _updateCheckout
      • _completeCheckout
    • Shopping Lists
      • _getShoppingLists
      • _updateShoppingList
      • _createShoppingList
      • _deleteShoppingList
      • _getShoppingListByAlias
    • Navigation
      • _getFooterMenu
      • _getHeaderMenu
    • Users
      • _getUserById
    • Utils
      • _calculateCurrency
      • _getCurrencySymbol
      • _getCulture
      • _subscribeToNewsletter
      • _findUnitsByIds
  • Vs Code
    • Getting Started
  1. Components

Subscribe Newsletter

Subscribe To Newsletter Component Documentation#

Overview#

The Subscribe To Newsletter component is designed for user subscription to a newsletter. It provides an interface for users to enter their email addresses and subscribe to updates. The component includes a header, subheader, email input field, and a submit button. It also handles email validation and displays appropriate messages based on the subscription status.

Model Documentation#

Model Structure#

The Subscribe To Newsletter component relies on a data model that includes:
header: The main heading displayed above the subscription form.
subHeader: An optional subheading that appears below the main heading.
buttonText: The text displayed on the subscription button.
email: The email address entered by the user.
emailIsValid: A boolean indicating whether the entered email address is valid.
showEmailValidMessage: A boolean controlling the display of the success message after a successful subscription.
isLoading: A boolean indicating whether the subscription request is being processed.

Example Model#

Here’s a sample model configuration:

Component Structure#

The Subscribe To Newsletter component includes:
1.
HTML Template: Defines the structure and layout of the subscription form.
2.
JavaScript: Contains the logic for handling email input, validation, and subscription.
3.
Methods: Functions for subscribing to the newsletter and validating email addresses.
4.
Computed Properties: Reactive calculations or state derived from the component's data.

HTML Template#

The HTML template defines the layout of the subscription section, including the header, subheader, email input field, and subscription button. It also handles displaying error and success messages.

JavaScript#

The JavaScript part of the Subscribe To Newsletter component handles email input, validation, and subscription.

Component Definition#

Explanation#

Props: The component accepts a model object that includes configuration details like header text, subheader, and button text.
Data: Manages internal state including email input, email validity, and loading status.
Methods:
subscribeEmail: Handles the email subscription process, including validating the email and triggering a subscription request.
validEmail: Validates the email address format using a regular expression.
getAlignmentClass: Returns the appropriate alignment class based on the alignment value from the model.
Computed Properties: Not used in this component, but can be added if needed for dynamic calculations.
Previous
Stores
Next
Text with Image
Built with