Chawkbazar Laravel

Contents

1. Can I get a Refund?

2. Email notification on order creation

3. Send love to our product

4. How Social Login Work?

5. React Hook Form

6. Item Support Policy

1. Can I get a Refund?

Unfortunately, we don't provide Refund except if you can have a detailed discussion with the support team and you can prove to them there is a bug that is stopping you from releasing or using our product. In order to consider for refund, the feature needs to be available in our product and there needs to be a genuine bug with valid proof that the bug is available. This is the only case which we may consider for a refund but it's very rare as most of the features you will use is very stable for years now and lots of users are using them on regular basis.  Also, any issue or bug that is only not working for your case but working on our site and other user's sites is not considered for a refund.

2. Email notification on order creation

For sending emails we have provided two events. Those events are commented right now. What you have to do is uncomment that code resides in OrderRepository.php file. 

uncomment below two lines

// event(new OrderCreated($order));
// event(new OrderReceived($order));

Now what you need to do is run the queue. As this event will run in the queue you have to make sure your queue is running. 

php artisan queue:work

The above command can be run to listen to the events. For details on this issue please check the below documentation from laravel. 

https://laravel.com/docs/8.x/queues

3. Send love to our product

Hope you have liked our product. Our engineering & technical support team puts great effort to create the best product in the market with continuous effort to improve it each day for our users. We will really appreciate it if you can show your appreciation for our product by sending us a 5-star rating at Envato. Good feedbacks encourage the whole team to improve the product better.  You can send us your feedback from this link https://codecanyon.net/downloads under the Download button here https://monosnap.com/file/IjKAVXsi5Ej9Xrx0zkQt9Cl1cc0R39.

4. How Social Login Work?

The necessary direction below will help you to integrate custom social providers as well.

How Social Login Works at Chawkbazar Laravel

For Social site authentication, we are using NextAuth https://next-auth.js.org/ for the client site shop (in the nextjs app) and  Laravel Socialite https://laravel.com/docs/8.x/socialite for the API server. 

The Social Login flow here is 

i) NextAuth will get the access token from the provider
ii) we will send a request to the API server with the access token
iii) API server will verify the access token using Laravel Socialite
iv) If verified then the user will be logged in.


So, the question: how can I organize the oAuth for these providers?

=> To organize provider you need to check the documentation of NextAuth from here https://next-auth.js.org/configuration/providers/oauth#built-in-providers and Laravel Socialite https://laravel.com/docs/8.x/socialite


I see i have a built-in Google/Facebook provider, but for Google, the process of creation of the oAuth creds is very complex. Maybe you have some kind of explanation/article/best practices on how to connect different providers? 

=> For starters, you can check our documentation for social login from here https://chawkbazar-laravel-doc.vercel.app/social-login. We have tried to show step by step procedure. If you want more explanation or best practices you can always check the NextAuth and Socialite documentation. For example for Google, NextAuth documentation has all the necessary information for documentation and configuration in here https://next-auth.js.org/providers/google


1) When the oAuth provider redirects the user back to the chawkbazar website, should it first go to the /social-login-token Laravel's serverside method? Or it first goes to some part of the next.js app ...

=> As mentioned in the Social login flow above, yes it will send the access token with /social-login-token request so that Laravel socialite can verify that. Once it's verified it will let the user logged in.

2) Where the accessToken usually stores by design of the Pick Bazar? Serverside/Database/Redis? Or the next js app? 

=> The accessToken is stored on session using NextAuth. You can check it from src/pages/api/auth/[...nextauth].ts file under the callback jwt and session function and to access the data from the session using the below code

import { useSession } from 'next-auth/client';
const [session, loading] = useSession();

3) I implemented the oAuth flow for vk.com provider, and it seems to be partially working....

=> To Implement vk.com, you need to check the vk.com docs for nextauth from here https://next-auth.js.org/providers/vk along with laravel socialite documentation for vk. Make sure to add necessary config similar to the one mentioned in our docs here https://chawkbazar-laravel-doc.vercel.app/social-login

In the API related part you do need to make some changes in the src/Http/Controllers/UserController.php file validateProvider function you need to add the provider name 

you need to check here if you are getting the accessToken in the social login function of UserController.php file and if it returns the user. If not then you need to go to the src/pages/api/auth/[...nextauth].ts file and check if you are getting the accessToken there.


Hope this information will help you to work with our social login feature

Thanks

5. React Hook Form

As you know already we are using react-hook-form. react-hook-form works a bit differently than other react form libraries. It has its own state management system to make it performant, preventing unnecessary rending and you don't have to manage the state by yourself. You can find more about this from their oficial docs here https://react-hook-form.com/

As they are doing the form fields stage management for you, you don't need to do the onChange here to handle the state or the field data like input field, select field etc. What you will need is access to that data during submission or at any given time. Submission data is already shown in our different forms example which you can check (you can check componets/product directory). Also to be fluent with React hook form you need to understand their docs, APIs from here https://react-hook-form.com/. Lots of examples can be found here https://github.com/react-hook-form/react-hook-form/tree/master/examples . React select example is available here https://codesandbox.io/s/react-hook-form-v7-controller-5h1q5. you can use their watch to access fields data at any given time https://react-hook-form.com/get-started. Hope these resources should be enough for you to understand the react-hook-form uses in our forms. 

6. Item Support Policy

We strictly follow Envato item support policy https://themeforest.net/page/item_support_policy

you can find what's not included in the support there