commercelayer / dashboard-apps

Commerce Layer's Dashboard applications.
https://dashboard.commercelayer.io
MIT License
0 stars 3 forks source link

Ability to choose a customer address from the order app #147

Closed osseonews closed 2 days ago

osseonews commented 5 days ago

Closes commercelayer/issues-app#252

What I did

When creating an order for a customer you currently need to type in a billing address and/or a shipping address. This is a big pain, as customers may have already existing addresses in the customer address book, which you can re-use. This pull request creates a button on the Address section on an order, which allows you to choose an Address from the customer address book to use a billing address or a shipping address.

Still do to: We were unsure how to actual handle a potential api error, with the apiError state. See the To Do in useCustomerAddressOverlay.tsx file

How to test

  1. Create an order for a customer
  2. Go to the address section, and choose the "Assign Address" button
  3. Choose an address to use for Billing or Shipping and that's it.

Checklist

netlify[bot] commented 5 days ago

Deploy Preview for commercelayer-dashboard-apps ready!

Name Link
Latest commit 5ef61bbf3d1184a7ae6535f9192e544cbf88d7e6
Latest deploy log https://app.netlify.com/sites/commercelayer-dashboard-apps/deploys/673609fe32b9600008d4cd17
Deploy Preview https://deploy-preview-147--commercelayer-dashboard-apps.netlify.app
Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

osseonews commented 5 days ago

BTW, I think the build broke here b/c #hooks/useCustomerDetails is missing from our repo in the orders app. It's available in the customers app. Not sure why this worked locally without that, but we can add that into the orders app to get it to publish. Let me know if we should do another pull request

osseonews commented 4 days ago

BTW, I am not sure this code will actually work in production because what I just discovered is that Orders app, has access to the Customer, but not the Customer Addresses in production. The code works in local, which for some reason doesn't have that kind of access, but in production, I am not sure how to give the Orders app access to Customer Addresses. It's not clear how the access actually works. It's strange that Orders can access Customers, but not Customer Addresses.

marcomontalbano commented 3 days ago

Thank you @osseonews for taking the time to open this PR! We really appreciated it! We just updated it by aligning it with the design. About the issue with the customer_addresses in production, we've already added the permission and it will be available with the next core API production release.

osseonews commented 3 days ago

@marcomontalbano thanks for the feedback and corrections. Will you be merging this into the main branch soon? Just wondering if we should wait and use the main app or continue customizations on a custom app?

marcomontalbano commented 3 days ago

Sure, we'll merge it as soon as the address permission is available.

marcomontalbano commented 2 days ago

Hi @osseonews, we just released this PR in production.