SFRA Extensions
The SFRA extensions are included in the int_dqe_sfra cartridge and provide integration with Salesforce B2C Commerce Cloud's SFRA framework.
These extensions improve the user experience by enabling the following features:
- Address Suggestions: available on checkout shipping and billing address forms, and 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 Business Manager, including the corresponding site preferences and DQE code validation mappings.
Impacted Pages in SFCC SFRA
The solution affects the following pages and forms:
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: validate address fields.
- Profile Edit form: validates email and phone inputs.
| Controller | Start node | Description |
|---|---|---|
Account.js |
EditProfile |
Extends the pipeline dictionary (pdict) object with DQE configuration details for proper template rendering. |
Address.js |
AddAddress, EditAddress |
Extends the pipeline dictionary (pdict) object with DQE configuration details for proper template rendering. |
Address.js |
SaveAddress |
Extended to perform address validation with DQE when applicable, based on the current setup. |
Checkout.js |
Begin |
Extends the pipeline dictionary (pdict) object with DQE configuration details for proper template rendering. |
CheckoutServices.js |
SubmitPayment |
Extended to perform billing address validation with DQE when applicable, based on the current setup. |
CheckoutShippingServices.js |
SubmitShipping |
Extended to perform shipping address validation with DQE when applicable, based on the current setup. |
ContactUs.js |
Landing |
Extends the pipeline dictionary (pdict) object with DQE configuration details for proper template rendering. |
DQE.js |
ValidateEmail, ValidatePhone, AddressSuggestions, CompleteAddress |
New controller that implements endpoints for the AJAX calls used on the storefront. |
Home.js |
Show |
Extends the pipeline dictionary (pdict) object with DQE configuration details for proper template rendering. |
Login.js |
Show |
Extends the pipeline dictionary (pdict) object with DQE configuration details for proper template rendering. |
Middleware
The DQE middleware enhances SFRA controllers by integrating DQE-specific configuration details. It passes validation and suggestion settings 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 whether address suggestions are enabled.dqeAddressCompleteEnabled: specifies whether DQE address completion is enabled.addressValidationEnabled: indicates whether address validation is active.phoneEnabled: specifies whether phone number validation is enabled.emailEnabled: indicates whether email validation is enabled.addressValidationMode: defines the configured address validation mode.
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, address validation, and phone validation logic. Based on the SFRA template structure, it is extended separately for the following locales: default, en_GB, fr_FR, it_IT, and ja_JP. |
checkout/billing/billingAddress.isml |
Added elements, custom classes, and attributes for address suggestions and validation. Based on the SFRA template structure, it is extended separately for the following locales: default, en_GB, fr_FR, it_IT, and 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, address validation, and phone validation logic. Based on the SFRA template structure, it is extended separately for the following locales: default, en_GB, fr_FR, it_IT, and ja_JP. |
Example of template changes for shippingAddress.isml:
Client-Side JavaScript
The SFRA client-side JavaScript extension includes logic for displaying address suggestions and validating email and phone fields through AJAX requests to the 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 the
|
/js/login.js |
Extends login page logic with DQE email and phone validation. |
/js/profile.js |
Extends edit profile page logic with DQE email and phone validation. |
/js/contactUs.js |
Extends Contact Us page logic with DQE email validation. |
/js/checkout.js |
Extends checkout page logic with DQE address logic, phone validation, and email validation. |
/js/addressBook.js |
Extends My Account address page logic with DQE address logic. |
/js/addressBook/addressBook.js |
Extends My Account address-saving logic with DQE address validation and validation result display. |
/js/checkout/checkout.js |
Extends billing form address logic with DQE address validation and validation result display. |
/js/checkout/shipping.js |
Extends shipping form address logic with DQE address validation and validation result display. |
Related to