SFRA Extensions
The SFRA extensions are included in the int_dqe_sfra
cartridge, providing seamless integration with Salesforce B2C Commerce Cloud's SFRA framework. These extensions enhance user experience by enabling the following functionalities:
Key Features:
- Address Suggestions:
- Available on checkout shipping and billing address forms.
- Integrated into address forms under "My Account."
- Address Validation:
- Validates submitted addresses across all forms.
- Email Validation:
- Automatically validates email fields on forms where an email address is required.
- Phone Validation:
- Verifies phone number inputs across forms containing phone fields.
All validation operations rely on the DQE configuration and setup within the Business Manager, including corresponding site preferences and DQE code validation mappings.
Impacted Pages in SFCC SFRA
Here is a list of pages and forms affected by the solution:
Home Page:
- Subscription Block: Validates email input.
Login Page:
- "Create Account" Tab: Validates email and phone inputs.
- "Forgot Your Password" Popup: Validates email input.
- "Check Order" Block: Validates email input.
Contact Us Page:
- "Contact Us" Form: Validates email input.
Checkout Pages:
- Guest User Form: Validates email, address, and phone inputs.
- "Shipping" Form: Validates address and phone inputs.
- "Billing" Form: Validates address, phone, and email inputs.
Account Pages:
- Add/Edit Address Forms: Validates address fields.
- Profile Edit Form: Validates email and phone inputs.
Controller | Start node | Description |
Account.js | EditProfile | Extend pipeline dictionary (pdict) object with DQE config details for proper templates rendering |
Address.js |
AddAddress, EditAddress |
Extend pipeline dictionary (pdict) object with DQE config details for proper templates rendering |
Address.js | SaveAddress | Extended to conduct address validation with DQE if applicable based on current setup |
Checkout.js | Begin | Extend pipeline dictionary (pdict) object with DQE config details for proper templates rendering |
CheckoutServices.js | SubmitPayment | Extended to conduct billing address validation with DQE if applicable based on current setup |
CheckoutShippingServices.js | SubmitShipping | Extended to conduct shipping address validation with DQE if applicable based on current setup |
ContactUs.js | Landing | Extend pipeline dictionary (pdict) object with DQE config details for proper templates rendering |
DQE.js |
ValidateEmail, ValidatePhone, AddressSuggestions, CompleteAddress |
New controller that implements endpoints for appropriate ajax calls to be used on storefront |
Home.js | Show | Extend pipeline dictionary (pdict) object with DQE config details for proper templates rendering |
Login.js | Show | Extend pipeline dictionary (pdict) object with DQE config details for proper templates rendering |
Middleware
The DQE middleware is designed to enhance any SFRA controller by integrating DQE-specific configuration details. This middleware ensures that necessary validation and suggestion settings are seamlessly passed to the pipeline dictionary (pdict
) object for use in the application.
File Location:
The middleware file is located at:cartridges/int_dqe_sfra/cartridge/scripts/middleware/dqe.js
Functionality:
The middleware adds a property object, dqeConfigs
, to the pdict
object. This property contains DQE-related configuration details derived from the current site preferences setup. These details include:
addressSuggestionsEnabled
: Indicates if address suggestions are enabled.dqeAddressCompleteEnabled
: Specifies whether DQE address completion is enabled.addressValidationEnabled
: Indicates if address validation is active.phoneEnabled
: Specifies if phone number validation is enabled.emailEnabled
: Indicates if email validation is enabled.addressValidationMode
: Defines the mode of address validation configured.
Example of usage:
Templates
Template | Description |
account/components/registerForm.isml | Added classes and attributes for email and phone validation logic |
account/editProfileForm.isml | Added classes and attributes for email and phone validation logic |
checkout/customer/customerCard.isml | Added classes and attributes for email validation logic |
account/components/trackOrderForm.isml |
Added classes and attributes for email validation logic
|
account/password/passwordResetForm.isml | Added classes and attributes for email validation logic |
home/homePage.isml | Added classes and attributes for email validation logic |
contactUs/contactUs.isml | Added classes and attributes for email validation logic |
checkout/shipping/shippingAddress.isml |
Added elements, custom classes and attributes for address suggestions and validation and phone validation logic. Based on SFRA template's structure extended separately for locales: default, en_GB, fr_FR, it_IT, ja_JP. |
checkout/billing/billingAddress.isml |
Added elements, custom classes and attributes for address suggestions and validation. Based on SFRA template's structure extended separately for locales: default, en_GB, fr_FR, it_IT, ja_JP. |
checkout/billing/billing.isml | Added classes and attributes for phone validation logic |
account/addressForm.isml |
Added elements, custom classes and attributes for address suggestions and validation and phone validation logic. Based on SFRA template's structure extended separately for locales: default, en_GB, fr_FR, it_IT, ja_JP. |
Example of template changes for shippingAddress.isml:
Client side JS
Extension of client side js logic for SFRA includes logic for displaying address suggestion and validation of email and phone with ajax request to appropriate DQE controllers.
File | Description |
Js/dqe/dqeAddress.js, Js/dqe/dqeEmail.js, Js/dqe/dqePhone.js, Js/dqe/dqeFieldValidation.js, js/dqe/index.js |
All new DQE specific logic is located under js/dqe folder.
dqeAddress.js - contains all logic related to address suggestions and validation. dqeEmail.js - logic of email validation. dqePhone.js - logic of phone validation. dqeFieldValidation.js - generic dqe logic for handling form field validation result. Index.js - includes all DQE specific logic |
/js/login.js | Extension of login page logic with DQE email and phone validation |
/js/profile.js |
Extension of edit profile page logic with DQE email and phone validation
|
/js/contactUs.js | Extension of contact us page logic with DQE email validation |
/js/checkout.js | Extension of checkout page logic with DQE address logic, phone and email validation |
/js/addressBook.js | Extension of my account address page logic with DQE address logic |
/js/addressBook/addressBook.js | Extension of my account saving address with DQE address validation and displaying validation result |
/js/checkout/checkout.js | Extension of billing form address with DQE address validation and displaying validation result |
/js/checkout/shipping.js |
Extension of shipping form address with DQE address validation and displaying validation result |
Related to