Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add address element for shipping and billing address #816

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aritro2002
Copy link
Contributor

@aritro2002 aritro2002 commented Dec 3, 2024

Type of Change

  • Bugfix
  • New feature
  • Enhancement
  • Refactoring
  • Dependency updates
  • Documentation
  • CI/CD

Description

I have added address elements for shipping and billing addresses.
Two new elements have been created: ShippingAddressElement and BillingAddressElement.
These elements include a method called getAddress, which is used to fetch the entered details.

By default, all fields are required, but optional fields can also be specified.

Option Supported:
Full name: full_name
Address Line 1: line1
Address Line 2: line2
City: city
State: state
Country: country
Postal Code: postal_code
Phone Number: phone
Email: email

Screenshot 2024-12-03 at 4 11 59 PM Screenshot 2024-12-03 at 4 12 23 PM Screenshot 2024-12-03 at 4 13 19 PM Screenshot 2024-12-03 at 4 14 11 PM Screenshot 2024-12-03 at 4 14 44 PM Screenshot 2024-12-04 at 2 50 26 PM

How did you test it?

Clone the repo and then set script src to http://localhost:9050/HyperLoader.js in index.html and the widget name as shippingAddressElement or billingAddressElement in script.js. To make any field optional we need to feed list in the options

const unifiedCheckoutOptions = {
    optional: ["phone", "email", "city", "full_name"],
  };
  const unifiedCheckout = widgets.create(
    "shippingAddressElement",
    unifiedCheckoutOptions
  );

Checklist

  • I ran npm run re:build
  • I reviewed submitted code
  • I added unit tests for my changes where possible

@aritro2002 aritro2002 added Enhancement / Refactoring New feature or request or any refactoring Ready for Review PR with label Ready for Review should only be reviewed. labels Dec 3, 2024
Copy link

Review changes with  SemanticDiff

@aritro2002 aritro2002 linked an issue Dec 3, 2024 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement / Refactoring New feature or request or any refactoring Ready for Review PR with label Ready for Review should only be reviewed.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Address Element v1(Web)
1 participant