Kyon147 / laravel-shopify

A full-featured Laravel package for aiding in Shopify App development
MIT License
336 stars 99 forks source link

Added Event Listener system #212

Closed nahid closed 8 months ago

nahid commented 10 months ago

As I mentioned in @gnikyt PR 1220, I just added some events in the various cases for this package. These features help developers add more control over this package. Now developers can do anything based on the triggered event by registering their own listener/s, e.g.: send email/SMS/notification, run job, update DB, or anything else. Also, this PR includes some refactoring with performance improvements.

By adding this feature will open up the opportunity to add more new features in the future

Events

Backward compatibility: YES Breaking change: NO Deprecation: YES (AfterAuthenticationJob feature will be removed in the next major release) Doc: Need to update the WIKI after merging this PR with the migration guide

Kyon147 commented 10 months ago

Hi @nahid

Thanks for submitting the PR - can you please look at the actions as your PR is failing.

I've also taken a quick look at the code changes, but I don't see any new tests. Can you make sure these changes are going to be covered by codecov.

Also, you've made some changes to the installShop and the authentication, can you outline in your PR what those changes are for.

Thanks!

nahid commented 10 months ago

@Kyon147 thanks for your quick reply and queries. I just added all possible tests with this PR.

nahid commented 10 months ago

Hey @Kyon147, is there any suggestions from?

nahid commented 9 months ago

Hello @Kyon147, I hope everything is going well. It's been a while since this PR was submitted, what are your thoughts on it? Is there anything else that needs to be changed or improved?

Kyon147 commented 9 months ago

Hey @nahid

I just need to check the event system in a blank app, so I can QA it to make sure as it is a big PR.

nahid commented 9 months ago

Hi @Kyon147 ,

I understand the need for a thorough test on this significant PR. It'll be great if you test before merge. Feel free to reach out if you encounter any issues or have questions.

Your feedback is much appreciated.

nahid commented 8 months ago

Hello @Kyon147, I hope you're doing well. I understand you're very busy and finding it difficult to spare time. I'm a power user of this package, and this PR is very important to me. I hope it will also make life easier for others. If you have the time to test the PR in your free time and have any suggestions, or if everything looks good, merging it would be very helpful.

Thank you for your excellent work on this package and for your contributions to the community.

Kyon147 commented 8 months ago

Hey @nahid

Thanks for the ping to remind me, I'll take a look at this later today and if it looks good will merge it into master and set up a new release for it.

Thank you for taking the time to work on the PR - I'm sure it will be super helpful for the rest of the community.

nahid commented 8 months ago

Hey @Kyon147 , Sorry for disturbing you. Any updates regarding this PR?

Kyon147 commented 8 months ago

Hey @Kyon147 , Sorry for disturbing you. Any updates regarding this PR?

Hey @nahid I've got this on my local and just running some QA on it. Should be done shortly.

nahid commented 8 months ago

Hey @Kyon147 Thanks for your time 🙂

nahid commented 8 months ago

Awesome, sure! I'll get started on creating that wiki article ASAP and will keep you posted once it's done, @Kyon147

nahid commented 8 months ago

BTW @Kyon147, how can I contribute to this project's wiki?

Kyon147 commented 8 months ago

Hi @nahid

You should just be able to edit the wiki but I have created a page for you here to start off. https://github.com/Kyon147/laravel-shopify/wiki/Event-System

nahid commented 8 months ago

@Kyon147, Thanks for your support, but unfortunately I can't edit this page in any way ☚ī¸

Kyon147 commented 8 months ago

@Kyon147, Thanks for your support, but unfortunately I can't edit this page in any way ☚ī¸

Can you try again now @nahid had to change a setting in the repo.

nahid commented 8 months ago

Great, now it works fine @Kyon147

nahid commented 8 months ago

Hello @Kyon147, Hope you're doing well. I've just finished the Event Listener wiki. Kindly review it, and please don't hesitate to share any feedback or suggest changes if necessary.

wiki: https://github.com/Kyon147/laravel-shopify/wiki/Event-Listener-System

Kyon147 commented 8 months ago

Hello @Kyon147, Hope you're doing well. I've just finished the Event Listener wiki. Kindly review it, and please don't hesitate to share any feedback or suggest changes if necessary.

wiki: https://github.com/Kyon147/laravel-shopify/wiki/Event-Listener-System

Amazing, thanks for taking the time to sort the PR and the wiki, its appreciated. I'll merge in the work and get a new release out this week 👍

faridmovsumov commented 7 months ago

Hello @nahid, this is a great feature. Thanks a lot for adding this. 🙏 I noticed a small problem.

Context: This happens after uninstalling and installing the app again when the shop is in soft delete mode.

In this case, ShopAuthenticatedEvent is being fired when a shop is installed, not when authenticated and this is causing some problems.

This is how I defined the listener.

image

And this is the code inside my listener.

image

After uninstalling and installing the shop again, it is being fired before I actually see the permission screen on Shopify. So, at this point, my user has been soft-deleted from the DB.

And this is the log I see in the terminal.

image

cc: @Kyon147

nahid commented 6 months ago

Could you please share the $shop model dump with me @faridmovsumov

faridmovsumov commented 6 months ago

@nahid using the AppInstalled event solved my problem. I made the wrong assumption by naming.