├── .browserslistrc ├── .eslintrc.js ├── .github ├── CONTRIBUTING.md ├── FUNDING.yml └── ISSUE_TEMPLATE │ ├── Bug_report.md │ ├── Custom.md │ └── Feature_request.md ├── .gitignore ├── ChangeLog.md ├── README.md ├── RoadMap.md ├── babel.config.js ├── deploy.sh ├── docs └── mutation.md ├── laravel-backend ├── .editorconfig ├── .env.example ├── .gitattributes ├── .gitignore ├── README.md ├── app │ ├── Console │ │ └── Kernel.php │ ├── Exceptions │ │ └── Handler.php │ ├── Http │ │ ├── Controllers │ │ │ └── Controller.php │ │ ├── Kernel.php │ │ └── Middleware │ │ │ ├── Authenticate.php │ │ │ ├── EncryptCookies.php │ │ │ ├── PreventRequestsDuringMaintenance.php │ │ │ ├── RedirectIfAuthenticated.php │ │ │ ├── TrimStrings.php │ │ │ ├── TrustHosts.php │ │ │ ├── TrustProxies.php │ │ │ ├── ValidateSignature.php │ │ │ └── VerifyCsrfToken.php │ ├── Models │ │ └── User.php │ └── Providers │ │ ├── AppServiceProvider.php │ │ ├── AuthServiceProvider.php │ │ ├── BroadcastServiceProvider.php │ │ ├── EventServiceProvider.php │ │ └── RouteServiceProvider.php ├── artisan ├── bootstrap │ ├── app.php │ └── cache │ │ └── .gitignore ├── composer.json ├── composer.lock ├── config │ ├── app.php │ ├── auth.php │ ├── avored.php │ ├── broadcasting.php │ ├── cache.php │ ├── cors.php │ ├── database.php │ ├── filesystems.php │ ├── hashing.php │ ├── logging.php │ ├── mail.php │ ├── queue.php │ ├── sanctum.php │ ├── services.php │ ├── session.php │ └── view.php ├── database │ ├── .gitignore │ ├── factories │ │ └── UserFactory.php │ ├── migrations │ │ ├── 2014_10_12_000000_create_users_table.php │ │ ├── 2014_10_12_100000_create_password_resets_table.php │ │ ├── 2019_08_19_000000_create_failed_jobs_table.php │ │ └── 2019_12_14_000001_create_personal_access_tokens_table.php │ └── seeders │ │ └── DatabaseSeeder.php ├── lang │ └── en │ │ ├── auth.php │ │ ├── pagination.php │ │ ├── passwords.php │ │ └── validation.php ├── modules │ └── avored │ │ ├── cash-on-delivery │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── composer.json │ │ ├── dist │ │ │ ├── js │ │ │ │ └── cash-on-delivery.js │ │ │ ├── mix-manifest.json │ │ │ └── vendor │ │ │ │ └── avored │ │ │ │ └── js │ │ │ │ └── cash-on-delivery.js │ │ ├── package.json │ │ ├── readme.md │ │ ├── register.yml │ │ ├── resources │ │ │ ├── components │ │ │ │ ├── AvoRedCashOnDelivery.vue │ │ │ │ └── CashOnDeliveryConfig.vue │ │ │ ├── js │ │ │ │ └── cash-on-delivery.js │ │ │ ├── lang │ │ │ │ └── en │ │ │ │ │ └── cash-on-delivery.php │ │ │ └── views │ │ │ │ ├── index.blade.php │ │ │ │ └── system │ │ │ │ └── configuration │ │ │ │ └── payment-card.blade.php │ │ ├── src │ │ │ ├── CashOnDelivery.php │ │ │ └── Module.php │ │ ├── webpack.mix.js │ │ └── yarn.lock │ │ ├── dummy-data │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── README.md │ │ ├── assets │ │ │ └── uploads │ │ │ │ └── catalog │ │ │ │ ├── avored-bunk-bed.jpg │ │ │ │ ├── avored-double-bed.jpg │ │ │ │ ├── avored-queen-bed.jpg │ │ │ │ ├── avored-single-bed.jpg │ │ │ │ ├── avored-sofa-set.jpg │ │ │ │ ├── blue-attribute.png │ │ │ │ ├── laravel-bedside-table.jpg │ │ │ │ ├── laravel-sofa-set.jpg │ │ │ │ ├── php-single-mattress.jpg │ │ │ │ ├── php-sofa-set.jpg │ │ │ │ ├── red-attribute.jpg │ │ │ │ └── yellow-attribute.png │ │ ├── composer.json │ │ ├── database │ │ │ └── migrations │ │ │ │ └── 2017_03_29_000000_avored_demo_data_schema.php │ │ ├── register.yml │ │ └── src │ │ │ └── Module.php │ │ └── pickup │ │ ├── .gitignore │ │ ├── LICENSE │ │ ├── composer.json │ │ ├── package.json │ │ ├── readme.md │ │ ├── register.yml │ │ ├── resources │ │ ├── lang │ │ │ └── en │ │ │ │ └── pickup.php │ │ └── views │ │ │ ├── pickup.blade.php │ │ │ └── system │ │ │ └── configuration │ │ │ └── pickup.blade.php │ │ ├── src │ │ ├── Module.php │ │ └── Pickup.php │ │ └── webpack.mix.js ├── package.json ├── phpunit.xml ├── public │ ├── .htaccess │ ├── favicon.ico │ ├── index.php │ ├── mix-manifest.json │ ├── robots.txt │ └── vendor │ │ └── avored │ │ ├── css │ │ └── app.css │ │ ├── images │ │ ├── avored_logo.ico │ │ └── logo_only.svg │ │ └── js │ │ ├── app.js │ │ └── app.js.LICENSE.txt ├── resources │ ├── css │ │ └── app.css │ ├── js │ │ ├── app.js │ │ └── bootstrap.js │ └── views │ │ └── welcome.blade.php ├── routes │ ├── api.php │ ├── channels.php │ ├── console.php │ └── web.php ├── storage │ ├── app │ │ ├── .gitignore │ │ └── public │ │ │ └── .gitignore │ ├── framework │ │ ├── .gitignore │ │ ├── cache │ │ │ ├── .gitignore │ │ │ └── data │ │ │ │ └── .gitignore │ │ ├── sessions │ │ │ └── .gitignore │ │ ├── testing │ │ │ └── .gitignore │ │ └── views │ │ │ └── .gitignore │ └── logs │ │ └── .gitignore ├── tests │ ├── CreatesApplication.php │ ├── Feature │ │ └── ExampleTest.php │ ├── TestCase.php │ └── Unit │ │ └── ExampleTest.php └── vite.config.js ├── package-lock.json ├── package.json ├── postcss.config.js ├── public ├── avored_logo.ico └── index.html ├── react-frontend ├── .env.example ├── .gitignore ├── .graphqlrc.yml ├── README.md ├── package-lock.json ├── package.json ├── postcss.config.js ├── public │ ├── favicon.ico │ ├── index.html │ ├── logo192.png │ ├── logo512.png │ ├── manifest.json │ └── robots.txt ├── src │ ├── App.tsx │ ├── app │ │ ├── hooks.ts │ │ └── store.ts │ ├── codegen.ts │ ├── components │ │ ├── DebugGraphqlErrorMessage.tsx │ │ ├── Form │ │ │ ├── FormButton.test.tsx │ │ │ ├── FormButton.tsx │ │ │ ├── FormInput.tsx │ │ │ ├── FormLabel.tsx │ │ │ ├── FormLink.tsx │ │ │ └── FormSelect.tsx │ │ ├── Header.tsx │ │ ├── Layout │ │ │ ├── AvoRedApp.tsx │ │ │ ├── Card.tsx │ │ │ ├── CardContent.tsx │ │ │ ├── CardTitle.tsx │ │ │ └── FlashMessage.tsx │ │ └── ProductCard.tsx │ ├── features │ │ ├── cart │ │ │ └── cartSlice.ts │ │ ├── checkout │ │ │ └── checkoutSlice.ts │ │ ├── counter │ │ │ ├── Counter.module.css │ │ │ ├── Counter.tsx │ │ │ ├── counterAPI.ts │ │ │ └── counterSlice.ts │ │ ├── flash │ │ │ └── flashSlice.ts │ │ └── userLogin │ │ │ └── userLoginSlice.ts │ ├── graphql │ │ └── mutation │ │ │ └── auth │ │ │ └── Login.graphql │ ├── index.css │ ├── index.tsx │ ├── lang │ │ ├── en.json │ │ └── fr.json │ ├── logo.svg │ ├── pages │ │ ├── Index.tsx │ │ ├── Product.tsx │ │ ├── auth │ │ │ ├── ForgotPasswordlPage.tsx │ │ │ ├── LoginPage.tsx │ │ │ └── RegisterPage.tsx │ │ ├── cart │ │ │ └── CartShow.tsx │ │ ├── category │ │ │ └── CategoryShow.tsx │ │ ├── checkout │ │ │ ├── CheckoutPaymentShow.tsx │ │ │ ├── CheckoutShippingAddressShow.tsx │ │ │ ├── CheckoutShippingShow.tsx │ │ │ ├── CheckoutShow.tsx │ │ │ └── CheckoutSummaryShow.tsx │ │ ├── product │ │ │ └── ProductShow.tsx │ │ └── user │ │ │ ├── EditAddress.tsx │ │ │ ├── EditProfile.tsx │ │ │ ├── Profile.tsx │ │ │ ├── UserAddresseCreate.tsx │ │ │ ├── UserAddresses.tsx │ │ │ ├── UserLogout.tsx │ │ │ ├── UserOrders.tsx │ │ │ └── UserSidebar.tsx │ ├── react-app-env.d.ts │ ├── routes │ │ └── PrivateRoute.tsx │ ├── setupTests.ts │ └── types │ │ └── ProductType.tsx ├── tailwind.config.js └── tsconfig.json ├── src ├── App.vue ├── assets │ ├── logo_only.svg │ ├── styles │ │ └── main.css │ └── tailwind.css ├── components │ ├── Pagination.vue │ ├── account │ │ └── AccountSideNav.vue │ ├── catalog │ │ └── AddToCart.vue │ ├── forms │ │ └── AvoRedInput.vue │ └── layouts │ │ ├── Footer.vue │ │ └── Header.vue ├── constants │ └── index.ts ├── graphql │ ├── AddToCartMutation.ts │ ├── AddressAllQuery.ts │ ├── AddressCreate.ts │ ├── AddressQuery.ts │ ├── CartItemAllQuery.ts │ ├── CategoryAllQuery.ts │ ├── CountryOptionsQuery.ts │ ├── CreateAddressMutation.ts │ ├── CreateSubscriberMutation.ts │ ├── CustomerEditMutation.ts │ ├── CustomerLoginMutation.ts │ ├── CustomerRegister.ts │ ├── DeleteCartMutation.ts │ ├── ForgotPasswordMutation.ts │ ├── GetCategory.ts │ ├── GetCustomerQuery.ts │ ├── LatestProductQuery.ts │ ├── LoginMutation.ts │ ├── OrderAllQuery.ts │ ├── OrderQuery.ts │ ├── PaymentQuery.ts │ ├── PlaceOrder.ts │ ├── ProductQuery.ts │ ├── ResetPasswordMutation.ts │ ├── ShippingQuery.ts │ ├── UpdateAddressMutation.ts │ └── UpdateCartMutation.ts ├── i18n.ts ├── layouts │ ├── App.vue │ └── Guest.vue ├── locales │ ├── el.json │ ├── en.json │ └── pt-br.json ├── main.ts ├── middleware │ ├── auth.ts │ └── guest.ts ├── router │ └── index.ts ├── shims-vue.d.ts ├── store │ └── index.ts └── views │ ├── Account.vue │ ├── AccountEdit.vue │ ├── Address.vue │ ├── Cart.vue │ ├── Category.vue │ ├── Checkout.vue │ ├── CreateAddress.vue │ ├── Home.vue │ ├── OrderShow.vue │ ├── Orders.vue │ ├── Product.vue │ ├── Success.vue │ ├── UpdateAddress.vue │ └── auth │ ├── ForgotPassword.vue │ ├── Login.vue │ ├── Logout.vue │ ├── Register.vue │ └── ResetPassword.vue ├── tailwind.config.js ├── tsconfig.json └── vue.config.js /.browserslistrc: -------------------------------------------------------------------------------- 1 | > 1% 2 | last 2 versions 3 | not dead 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | env: { 4 | node: true 5 | }, 6 | 'extends': [ 7 | 'plugin:vue/vue3-essential', 8 | 'eslint:recommended', 9 | '@vue/typescript/recommended' 10 | ], 11 | parserOptions: { 12 | ecmaVersion: 2020 13 | }, 14 | rules: { 15 | 'no-console': process.env.NODE_ENV === 'production' ? 'warn' : 'off', 16 | 'no-debugger': process.env.NODE_ENV === 'production' ? 'warn' : 'off' 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | # These are supported funding model platforms 2 | 3 | open_collective: laravel-ecommerce 4 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | 5 | --- 6 | 7 | **Ideally we would expect you to raise a bug on AvoRed Official Website ** 8 | https://avored.com/discussion/category/general 9 | 10 | **Describe the bug** 11 | A clear and concise description of what the bug is. 12 | 13 | **To Reproduce** 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | **Screenshots** 21 | If applicable, add screenshots to help explain your problem. 22 | 23 | **Additional context** 24 | Add any other context about the problem here. 25 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Custom.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Discussion 3 | about: If you want to discuss about any topic. 4 | 5 | --- 6 | 7 | **Ideally we would expect you to raise a discussion on AvoRed Official Website ** 8 | https://avored.com/discussion/category/general 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/Feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | 5 | --- 6 | 7 | **Ideally we would expect you to raise a feature request on AvoRed Official Website ** 8 | https://avored.com/discussion/category/feature 9 | 10 | **Is your feature request related to a problem? Please describe.** 11 | A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] 12 | 13 | **Describe the solution you'd like** 14 | A clear and concise description of what you want to happen. 15 | 16 | **Describe alternatives you've considered** 17 | A clear and concise description of any alternative solutions or features you've considered. 18 | 19 | **Additional context** 20 | Add any other context or screenshots about the feature request here. 21 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | /dist 4 | 5 | 6 | # local env files 7 | .env 8 | .env.*.local 9 | .env.production 10 | 11 | # Log files 12 | npm-debug.log* 13 | yarn-debug.log* 14 | yarn-error.log* 15 | pnpm-debug.log* 16 | 17 | # Editor directories and files 18 | .idea 19 | .vscode 20 | *.suo 21 | *.ntvs* 22 | *.njsproj 23 | *.sln 24 | *.sw? 25 | -------------------------------------------------------------------------------- /ChangeLog.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | # Change Log AvoRed E commerce 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | # AvoRed an laravel headless e commerce 4 | 5 | A headless e commerce GraphQL API which uses Laravel as a backend. 6 | 7 | ## Installation 8 | 9 | ##### Backend APP setup 10 | 11 | First thing first we will install laravel backend api service. First thing first we will install the laravel app. 12 | 13 | composer create-project laravel/laravel avored-backend 14 | cd avored-backend 15 | composer require avored/framework 16 | composer require avored/dummy-data 17 | composer require avored/cash-on-delivery 18 | composer require avored/pickup 19 | 20 | Set up your .env values and CORS 21 | 22 | To fixed the CORS in your laravel8 app. You can open `config/cors.php` and replace the code like below in the file. 23 | 24 | 'allowed_origins' => ['http://localhost:8080'], 25 | 26 | 27 | Once the .env setup is done then we can install the AvoRed E commerce 28 | 29 | php artisan avored:install 30 | php artisan vendor:publish --provider="AvoRed\Framework\AvoRedServiceProvider" 31 | yoursite.com/graphiql 32 | 33 | Once the avored/framework has been installed after that we will make sure we setup the CORS to allow access of an graphql api via any frontend. 34 | 35 | ##### Frontend APP Setup 36 | 37 | git clone https://github.com/avored/laravel-ecommerce avored-frontend 38 | cd avored-frontend 39 | npm install 40 | npm run serve 41 | 42 | 43 | #### Installation via Docker 44 | 45 | Execute the below command: 46 | 47 | git clone https://github.com/avored/docker-dev.git 48 | cd docker-dev 49 | 50 | git clone https://github.com/avored/laravel-ecommerce ./src/frontend 51 | docker-compose up -d 52 | docker-compose run --rm composer create-project laravel/laravel:8.6 ./ 53 | docker-compose run --rm composer require avored/framework 54 | docker-compose run --rm composer require avored/dummy-data avored/cash-on-delivery avored/pickup 55 | 56 | Now setup `.env` file. Open a avored app .env file which is located at `./src/backend/.env` then setup your database and any other env as per your docker-compose.yml file 57 | 58 | DB_HOST=mysql 59 | DB_DATABASE=homestead 60 | DB_USERNAME=homestead 61 | DB_PASSWORD=secret 62 | 63 | Now we just have to install the AvoRed and create an avored admin user account 64 | 65 | docker-compose run --rm artisan avored:install 66 | docker-compose run --rm artisan vendor:publish --provider="AvoRed\Framework\AvoRedServiceProvider" 67 | 68 | Now we need to setup CORS so frontend application can receive api call from backnd. 69 | Open `./src/backend/config/cors.php` then replace the below line 70 | 71 | 'paths' => ['/graphql', 'sanctum/csrf-cookie'], 72 | 'allowed_origins' => ['http://localhost:8060'], 73 | 74 | That's It. Now you can visit `http://localhost:8060` for frontend and for backend you can visit `http://localhost:8050/admin` 75 | -------------------------------------------------------------------------------- /RoadMap.md: -------------------------------------------------------------------------------- 1 |

2 | 3 | # AvoRed E commerce Road Map 4 | 5 | -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: [ 3 | '@vue/cli-plugin-babel/preset' 4 | ] 5 | } 6 | -------------------------------------------------------------------------------- /deploy.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | # abort on errors 3 | set -e 4 | # build 5 | npm run build 6 | # navigate into the build output directory 7 | cd dist 8 | # if you are deploying to a custom domain 9 | # echo 'www.example.com' > CNAME 10 | git init 11 | git add -A 12 | git commit -m 'deploy' 13 | git remote add origin git@github.com:avored/laravel-ecommerce.git 14 | git push -u -f origin master:gh-pages 15 | -------------------------------------------------------------------------------- /docs/mutation.md: -------------------------------------------------------------------------------- 1 | # AvoRed GraphQL API mutations 2 | 3 | AvoRed GraphQL API mutation is one way of modifying or creating the avored GraphQL server-side data and in return, it will send the success information or created or newly updated server data. 4 | 5 | #### Login Mutation 6 | 7 | Login mutation is used to login a customer to a server and so in response you will get the token to validate the user. 8 | 9 | Query Request: 10 | 11 | mutation VisitorLogin ( 12 | $password: String! 13 | $email: String! 14 | ){ 15 | login ( 16 | email: $email 17 | password: $password 18 | ){ 19 | token_type 20 | access_token 21 | expires_in 22 | refresh_token 23 | } 24 | } 25 | 26 | Query Response: 27 | 28 | { 29 | "data": { 30 | "login": { 31 | "token_type": "Bearer", 32 | "access_token": "eyJ0eXAi********", 33 | "expires_in": 31536000, 34 | "refresh_token": "25847f285271*********" 35 | } 36 | } 37 | } 38 | 39 | #### Register Mutation 40 | 41 | Register mutation is used to register a customer to a server and so in response you will get the token to validate the user. 42 | 43 | Query Request: 44 | 45 | mutation CustomerRegistration ( 46 | $email: String! 47 | $password: String! 48 | $first_name: String! 49 | $last_name: String! 50 | ) { 51 | register ( 52 | first_name: $first_name, 53 | last_name: $last_name, 54 | email: $email, 55 | password: $password 56 | ) { 57 | access_token 58 | } 59 | } 60 | 61 | Query Response: 62 | 63 | { 64 | "data": { 65 | "register": { 66 | "token_type": "Bearer", 67 | "access_token": "eyJ0eXAiOiJKV1QiLCJh*********", 68 | "expires_in": 31536000, 69 | "refresh_token": "def50200aff4577346c64f7eaabdfbdda9b3ae7d641f48a*****" 70 | } 71 | } 72 | } -------------------------------------------------------------------------------- /laravel-backend/.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | end_of_line = lf 6 | indent_size = 4 7 | indent_style = space 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | 14 | [*.{yml,yaml}] 15 | indent_size = 2 16 | 17 | [docker-compose.yml] 18 | indent_size = 4 19 | -------------------------------------------------------------------------------- /laravel-backend/.env.example: -------------------------------------------------------------------------------- 1 | APP_NAME=Laravel 2 | APP_ENV=local 3 | APP_KEY= 4 | APP_DEBUG=true 5 | APP_URL=http://localhost 6 | 7 | LOG_CHANNEL=stack 8 | LOG_DEPRECATIONS_CHANNEL=null 9 | LOG_LEVEL=debug 10 | 11 | DB_CONNECTION=mysql 12 | DB_HOST=127.0.0.1 13 | DB_PORT=3306 14 | DB_DATABASE=laravel 15 | DB_USERNAME=root 16 | DB_PASSWORD= 17 | 18 | BROADCAST_DRIVER=log 19 | CACHE_DRIVER=file 20 | FILESYSTEM_DISK=local 21 | QUEUE_CONNECTION=sync 22 | SESSION_DRIVER=file 23 | SESSION_LIFETIME=120 24 | 25 | MEMCACHED_HOST=127.0.0.1 26 | 27 | REDIS_HOST=127.0.0.1 28 | REDIS_PASSWORD=null 29 | REDIS_PORT=6379 30 | 31 | MAIL_MAILER=smtp 32 | MAIL_HOST=mailhog 33 | MAIL_PORT=1025 34 | MAIL_USERNAME=null 35 | MAIL_PASSWORD=null 36 | MAIL_ENCRYPTION=null 37 | MAIL_FROM_ADDRESS="hello@example.com" 38 | MAIL_FROM_NAME="${APP_NAME}" 39 | 40 | AWS_ACCESS_KEY_ID= 41 | AWS_SECRET_ACCESS_KEY= 42 | AWS_DEFAULT_REGION=us-east-1 43 | AWS_BUCKET= 44 | AWS_USE_PATH_STYLE_ENDPOINT=false 45 | 46 | PUSHER_APP_ID= 47 | PUSHER_APP_KEY= 48 | PUSHER_APP_SECRET= 49 | PUSHER_HOST= 50 | PUSHER_PORT=443 51 | PUSHER_SCHEME=https 52 | PUSHER_APP_CLUSTER=mt1 53 | 54 | VITE_PUSHER_APP_KEY="${PUSHER_APP_KEY}" 55 | VITE_PUSHER_HOST="${PUSHER_HOST}" 56 | VITE_PUSHER_PORT="${PUSHER_PORT}" 57 | VITE_PUSHER_SCHEME="${PUSHER_SCHEME}" 58 | VITE_PUSHER_APP_CLUSTER="${PUSHER_APP_CLUSTER}" 59 | -------------------------------------------------------------------------------- /laravel-backend/.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | 3 | *.blade.php diff=html 4 | *.css diff=css 5 | *.html diff=html 6 | *.md diff=markdown 7 | *.php diff=php 8 | 9 | /.github export-ignore 10 | CHANGELOG.md export-ignore 11 | .styleci.yml export-ignore 12 | -------------------------------------------------------------------------------- /laravel-backend/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /public/build 3 | /public/hot 4 | /public/storage 5 | /storage/*.key 6 | /vendor 7 | .env 8 | .env.backup 9 | .env.production 10 | .phpunit.result.cache 11 | Homestead.json 12 | Homestead.yaml 13 | auth.json 14 | npm-debug.log 15 | yarn-error.log 16 | /.fleet 17 | /.idea 18 | /.vscode 19 | -------------------------------------------------------------------------------- /laravel-backend/app/Console/Kernel.php: -------------------------------------------------------------------------------- 1 | command('inspire')->hourly(); 19 | } 20 | 21 | /** 22 | * Register the commands for the application. 23 | * 24 | * @return void 25 | */ 26 | protected function commands() 27 | { 28 | $this->load(__DIR__.'/Commands'); 29 | 30 | require base_path('routes/console.php'); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /laravel-backend/app/Exceptions/Handler.php: -------------------------------------------------------------------------------- 1 | , \Psr\Log\LogLevel::*> 14 | */ 15 | protected $levels = [ 16 | // 17 | ]; 18 | 19 | /** 20 | * A list of the exception types that are not reported. 21 | * 22 | * @var array> 23 | */ 24 | protected $dontReport = [ 25 | // 26 | ]; 27 | 28 | /** 29 | * A list of the inputs that are never flashed to the session on validation exceptions. 30 | * 31 | * @var array 32 | */ 33 | protected $dontFlash = [ 34 | 'current_password', 35 | 'password', 36 | 'password_confirmation', 37 | ]; 38 | 39 | /** 40 | * Register the exception handling callbacks for the application. 41 | * 42 | * @return void 43 | */ 44 | public function register() 45 | { 46 | $this->reportable(function (Throwable $e) { 47 | // 48 | }); 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Controllers/Controller.php: -------------------------------------------------------------------------------- 1 | 15 | */ 16 | protected $middleware = [ 17 | // \App\Http\Middleware\TrustHosts::class, 18 | \App\Http\Middleware\TrustProxies::class, 19 | \Illuminate\Http\Middleware\HandleCors::class, 20 | \App\Http\Middleware\PreventRequestsDuringMaintenance::class, 21 | \Illuminate\Foundation\Http\Middleware\ValidatePostSize::class, 22 | \App\Http\Middleware\TrimStrings::class, 23 | \Illuminate\Foundation\Http\Middleware\ConvertEmptyStringsToNull::class, 24 | ]; 25 | 26 | /** 27 | * The application's route middleware groups. 28 | * 29 | * @var array> 30 | */ 31 | protected $middlewareGroups = [ 32 | 'web' => [ 33 | \App\Http\Middleware\EncryptCookies::class, 34 | \Illuminate\Cookie\Middleware\AddQueuedCookiesToResponse::class, 35 | \Illuminate\Session\Middleware\StartSession::class, 36 | \Illuminate\View\Middleware\ShareErrorsFromSession::class, 37 | \App\Http\Middleware\VerifyCsrfToken::class, 38 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 39 | ], 40 | 41 | 'api' => [ 42 | // \Laravel\Sanctum\Http\Middleware\EnsureFrontendRequestsAreStateful::class, 43 | 'throttle:api', 44 | \Illuminate\Routing\Middleware\SubstituteBindings::class, 45 | ], 46 | ]; 47 | 48 | /** 49 | * The application's route middleware. 50 | * 51 | * These middleware may be assigned to groups or used individually. 52 | * 53 | * @var array 54 | */ 55 | protected $routeMiddleware = [ 56 | 'auth' => \App\Http\Middleware\Authenticate::class, 57 | 'auth.basic' => \Illuminate\Auth\Middleware\AuthenticateWithBasicAuth::class, 58 | 'auth.session' => \Illuminate\Session\Middleware\AuthenticateSession::class, 59 | 'cache.headers' => \Illuminate\Http\Middleware\SetCacheHeaders::class, 60 | 'can' => \Illuminate\Auth\Middleware\Authorize::class, 61 | 'guest' => \App\Http\Middleware\RedirectIfAuthenticated::class, 62 | 'password.confirm' => \Illuminate\Auth\Middleware\RequirePassword::class, 63 | 'signed' => \App\Http\Middleware\ValidateSignature::class, 64 | 'throttle' => \Illuminate\Routing\Middleware\ThrottleRequests::class, 65 | 'verified' => \Illuminate\Auth\Middleware\EnsureEmailIsVerified::class, 66 | ]; 67 | } 68 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/Authenticate.php: -------------------------------------------------------------------------------- 1 | expectsJson()) { 18 | return route('login'); 19 | } 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/EncryptCookies.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/PreventRequestsDuringMaintenance.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/RedirectIfAuthenticated.php: -------------------------------------------------------------------------------- 1 | check()) { 26 | return redirect(RouteServiceProvider::HOME); 27 | } 28 | } 29 | 30 | return $next($request); 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/TrimStrings.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | 'current_password', 16 | 'password', 17 | 'password_confirmation', 18 | ]; 19 | } 20 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/TrustHosts.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | public function hosts() 15 | { 16 | return [ 17 | $this->allSubdomainsOfApplicationUrl(), 18 | ]; 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/TrustProxies.php: -------------------------------------------------------------------------------- 1 | |string|null 14 | */ 15 | protected $proxies; 16 | 17 | /** 18 | * The headers that should be used to detect proxies. 19 | * 20 | * @var int 21 | */ 22 | protected $headers = 23 | Request::HEADER_X_FORWARDED_FOR | 24 | Request::HEADER_X_FORWARDED_HOST | 25 | Request::HEADER_X_FORWARDED_PORT | 26 | Request::HEADER_X_FORWARDED_PROTO | 27 | Request::HEADER_X_FORWARDED_AWS_ELB; 28 | } 29 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/ValidateSignature.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 'fbclid', 16 | // 'utm_campaign', 17 | // 'utm_content', 18 | // 'utm_medium', 19 | // 'utm_source', 20 | // 'utm_term', 21 | ]; 22 | } 23 | -------------------------------------------------------------------------------- /laravel-backend/app/Http/Middleware/VerifyCsrfToken.php: -------------------------------------------------------------------------------- 1 | 13 | */ 14 | protected $except = [ 15 | // 16 | ]; 17 | } 18 | -------------------------------------------------------------------------------- /laravel-backend/app/Models/User.php: -------------------------------------------------------------------------------- 1 | 19 | */ 20 | protected $fillable = [ 21 | 'name', 22 | 'email', 23 | 'password', 24 | ]; 25 | 26 | /** 27 | * The attributes that should be hidden for serialization. 28 | * 29 | * @var array 30 | */ 31 | protected $hidden = [ 32 | 'password', 33 | 'remember_token', 34 | ]; 35 | 36 | /** 37 | * The attributes that should be cast. 38 | * 39 | * @var array 40 | */ 41 | protected $casts = [ 42 | 'email_verified_at' => 'datetime', 43 | ]; 44 | } 45 | -------------------------------------------------------------------------------- /laravel-backend/app/Providers/AppServiceProvider.php: -------------------------------------------------------------------------------- 1 | 14 | */ 15 | protected $policies = [ 16 | // 'App\Models\Model' => 'App\Policies\ModelPolicy', 17 | ]; 18 | 19 | /** 20 | * Register any authentication / authorization services. 21 | * 22 | * @return void 23 | */ 24 | public function boot() 25 | { 26 | $this->registerPolicies(); 27 | 28 | // 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /laravel-backend/app/Providers/BroadcastServiceProvider.php: -------------------------------------------------------------------------------- 1 | > 16 | */ 17 | protected $listen = [ 18 | Registered::class => [ 19 | SendEmailVerificationNotification::class, 20 | ], 21 | ]; 22 | 23 | /** 24 | * Register any events for your application. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | // 31 | } 32 | 33 | /** 34 | * Determine if events and listeners should be automatically discovered. 35 | * 36 | * @return bool 37 | */ 38 | public function shouldDiscoverEvents() 39 | { 40 | return false; 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /laravel-backend/app/Providers/RouteServiceProvider.php: -------------------------------------------------------------------------------- 1 | configureRateLimiting(); 30 | 31 | $this->routes(function () { 32 | Route::middleware('api') 33 | ->prefix('api') 34 | ->group(base_path('routes/api.php')); 35 | 36 | Route::middleware('web') 37 | ->group(base_path('routes/web.php')); 38 | }); 39 | } 40 | 41 | /** 42 | * Configure the rate limiters for the application. 43 | * 44 | * @return void 45 | */ 46 | protected function configureRateLimiting() 47 | { 48 | RateLimiter::for('api', function (Request $request) { 49 | return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); 50 | }); 51 | } 52 | } 53 | -------------------------------------------------------------------------------- /laravel-backend/artisan: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env php 2 | make(Illuminate\Contracts\Console\Kernel::class); 34 | 35 | $status = $kernel->handle( 36 | $input = new Symfony\Component\Console\Input\ArgvInput, 37 | new Symfony\Component\Console\Output\ConsoleOutput 38 | ); 39 | 40 | /* 41 | |-------------------------------------------------------------------------- 42 | | Shutdown The Application 43 | |-------------------------------------------------------------------------- 44 | | 45 | | Once Artisan has finished running, we will fire off the shutdown events 46 | | so that any final work may be done by the application before we shut 47 | | down the process. This is the last thing to happen to the request. 48 | | 49 | */ 50 | 51 | $kernel->terminate($input, $status); 52 | 53 | exit($status); 54 | -------------------------------------------------------------------------------- /laravel-backend/bootstrap/app.php: -------------------------------------------------------------------------------- 1 | singleton( 30 | Illuminate\Contracts\Http\Kernel::class, 31 | App\Http\Kernel::class 32 | ); 33 | 34 | $app->singleton( 35 | Illuminate\Contracts\Console\Kernel::class, 36 | App\Console\Kernel::class 37 | ); 38 | 39 | $app->singleton( 40 | Illuminate\Contracts\Debug\ExceptionHandler::class, 41 | App\Exceptions\Handler::class 42 | ); 43 | 44 | /* 45 | |-------------------------------------------------------------------------- 46 | | Return The Application 47 | |-------------------------------------------------------------------------- 48 | | 49 | | This script returns the application instance. The instance is given to 50 | | the calling script so we can separate the building of the instances 51 | | from the actual running of the application and sending responses. 52 | | 53 | */ 54 | return $app; 55 | -------------------------------------------------------------------------------- /laravel-backend/bootstrap/cache/.gitignore: -------------------------------------------------------------------------------- 1 | * 2 | !.gitignore 3 | -------------------------------------------------------------------------------- /laravel-backend/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel/laravel", 3 | "type": "project", 4 | "description": "The Laravel Framework.", 5 | "keywords": ["framework", "laravel"], 6 | "license": "MIT", 7 | "require": { 8 | "php": "^8.0.2", 9 | "avored/cash-on-delivery": "^5.0", 10 | "avored/dummy-data": "^5.0", 11 | "avored/framework": "^5.0", 12 | "avored/pickup": "^5.0", 13 | "guzzlehttp/guzzle": "^7.2", 14 | "laravel/framework": "^9.19", 15 | "laravel/sanctum": "^3.0", 16 | "laravel/tinker": "^2.7" 17 | }, 18 | "require-dev": { 19 | "fakerphp/faker": "^1.9.1", 20 | "laravel/pint": "^1.0", 21 | "laravel/sail": "^1.0.1", 22 | "mockery/mockery": "^1.4.4", 23 | "nunomaduro/collision": "^6.1", 24 | "phpunit/phpunit": "^9.5.10", 25 | "spatie/laravel-ignition": "^1.0" 26 | }, 27 | "autoload": { 28 | "psr-4": { 29 | "App\\": "app/", 30 | "Database\\Factories\\": "database/factories/", 31 | "Database\\Seeders\\": "database/seeders/" 32 | } 33 | }, 34 | "autoload-dev": { 35 | "psr-4": { 36 | "Tests\\": "tests/" 37 | } 38 | }, 39 | "scripts": { 40 | "post-autoload-dump": [ 41 | "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump", 42 | "@php artisan package:discover --ansi" 43 | ], 44 | "post-update-cmd": [ 45 | "@php artisan vendor:publish --tag=laravel-assets --ansi --force" 46 | ], 47 | "post-root-package-install": [ 48 | "@php -r \"file_exists('.env') || copy('.env.example', '.env');\"" 49 | ], 50 | "post-create-project-cmd": [ 51 | "@php artisan key:generate --ansi" 52 | ] 53 | }, 54 | "extra": { 55 | "laravel": { 56 | "dont-discover": [] 57 | } 58 | }, 59 | "config": { 60 | "optimize-autoloader": true, 61 | "preferred-install": "dist", 62 | "sort-packages": true, 63 | "allow-plugins": { 64 | "pestphp/pest-plugin": true, 65 | "composer/installers": true, 66 | "avored/module-installer": true 67 | } 68 | }, 69 | "minimum-stability": "dev", 70 | "prefer-stable": true 71 | } 72 | -------------------------------------------------------------------------------- /laravel-backend/config/broadcasting.php: -------------------------------------------------------------------------------- 1 | env('BROADCAST_DRIVER', 'null'), 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Broadcast Connections 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may define all of the broadcast connections that will be used 26 | | to broadcast events to other systems or over websockets. Samples of 27 | | each available type of connection are provided inside this array. 28 | | 29 | */ 30 | 31 | 'connections' => [ 32 | 33 | 'pusher' => [ 34 | 'driver' => 'pusher', 35 | 'key' => env('PUSHER_APP_KEY'), 36 | 'secret' => env('PUSHER_APP_SECRET'), 37 | 'app_id' => env('PUSHER_APP_ID'), 38 | 'options' => [ 39 | 'host' => env('PUSHER_HOST') ?: 'api-'.env('PUSHER_APP_CLUSTER', 'mt1').'.pusher.com', 40 | 'port' => env('PUSHER_PORT', 443), 41 | 'scheme' => env('PUSHER_SCHEME', 'https'), 42 | 'encrypted' => true, 43 | 'useTLS' => env('PUSHER_SCHEME', 'https') === 'https', 44 | ], 45 | 'client_options' => [ 46 | // Guzzle client options: https://docs.guzzlephp.org/en/stable/request-options.html 47 | ], 48 | ], 49 | 50 | 'ably' => [ 51 | 'driver' => 'ably', 52 | 'key' => env('ABLY_KEY'), 53 | ], 54 | 55 | 'redis' => [ 56 | 'driver' => 'redis', 57 | 'connection' => 'default', 58 | ], 59 | 60 | 'log' => [ 61 | 'driver' => 'log', 62 | ], 63 | 64 | 'null' => [ 65 | 'driver' => 'null', 66 | ], 67 | 68 | ], 69 | 70 | ]; 71 | -------------------------------------------------------------------------------- /laravel-backend/config/cors.php: -------------------------------------------------------------------------------- 1 | ['/graphql'], 19 | 20 | 'allowed_methods' => ['*'], 21 | 22 | 'allowed_origins' => ['*'], 23 | 24 | 'allowed_origins_patterns' => [], 25 | 26 | 'allowed_headers' => ['Origin', 'Content-Type', 'authorization'], 27 | 28 | 'exposed_headers' => [], 29 | 30 | 'max_age' => 0, 31 | 32 | 'supports_credentials' => true, 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /laravel-backend/config/filesystems.php: -------------------------------------------------------------------------------- 1 | env('FILESYSTEM_DISK', 'local'), 17 | 18 | /* 19 | |-------------------------------------------------------------------------- 20 | | Filesystem Disks 21 | |-------------------------------------------------------------------------- 22 | | 23 | | Here you may configure as many filesystem "disks" as you wish, and you 24 | | may even configure multiple disks of the same driver. Defaults have 25 | | been set up for each driver as an example of the required values. 26 | | 27 | | Supported Drivers: "local", "ftp", "sftp", "s3" 28 | | 29 | */ 30 | 31 | 'disks' => [ 32 | 33 | 'local' => [ 34 | 'driver' => 'local', 35 | 'root' => storage_path('app'), 36 | 'throw' => false, 37 | ], 38 | 39 | 'public' => [ 40 | 'driver' => 'local', 41 | 'root' => storage_path('app/public'), 42 | 'url' => env('APP_URL').'/storage', 43 | 'visibility' => 'public', 44 | 'throw' => false, 45 | ], 46 | 47 | 's3' => [ 48 | 'driver' => 's3', 49 | 'key' => env('AWS_ACCESS_KEY_ID'), 50 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 51 | 'region' => env('AWS_DEFAULT_REGION'), 52 | 'bucket' => env('AWS_BUCKET'), 53 | 'url' => env('AWS_URL'), 54 | 'endpoint' => env('AWS_ENDPOINT'), 55 | 'use_path_style_endpoint' => env('AWS_USE_PATH_STYLE_ENDPOINT', false), 56 | 'throw' => false, 57 | ], 58 | 59 | ], 60 | 61 | /* 62 | |-------------------------------------------------------------------------- 63 | | Symbolic Links 64 | |-------------------------------------------------------------------------- 65 | | 66 | | Here you may configure the symbolic links that will be created when the 67 | | `storage:link` Artisan command is executed. The array keys should be 68 | | the locations of the links and the values should be their targets. 69 | | 70 | */ 71 | 72 | 'links' => [ 73 | public_path('storage') => storage_path('app/public'), 74 | ], 75 | 76 | ]; 77 | -------------------------------------------------------------------------------- /laravel-backend/config/hashing.php: -------------------------------------------------------------------------------- 1 | 'bcrypt', 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Bcrypt Options 23 | |-------------------------------------------------------------------------- 24 | | 25 | | Here you may specify the configuration options that should be used when 26 | | passwords are hashed using the Bcrypt algorithm. This will allow you 27 | | to control the amount of time it takes to hash the given password. 28 | | 29 | */ 30 | 31 | 'bcrypt' => [ 32 | 'rounds' => env('BCRYPT_ROUNDS', 10), 33 | ], 34 | 35 | /* 36 | |-------------------------------------------------------------------------- 37 | | Argon Options 38 | |-------------------------------------------------------------------------- 39 | | 40 | | Here you may specify the configuration options that should be used when 41 | | passwords are hashed using the Argon algorithm. These will allow you 42 | | to control the amount of time it takes to hash the given password. 43 | | 44 | */ 45 | 46 | 'argon' => [ 47 | 'memory' => 65536, 48 | 'threads' => 1, 49 | 'time' => 4, 50 | ], 51 | 52 | ]; 53 | -------------------------------------------------------------------------------- /laravel-backend/config/sanctum.php: -------------------------------------------------------------------------------- 1 | explode(',', env('SANCTUM_STATEFUL_DOMAINS', sprintf( 19 | '%s%s', 20 | 'localhost,localhost:3000,127.0.0.1,127.0.0.1:8000,::1', 21 | Sanctum::currentApplicationUrlWithPort() 22 | ))), 23 | 24 | /* 25 | |-------------------------------------------------------------------------- 26 | | Sanctum Guards 27 | |-------------------------------------------------------------------------- 28 | | 29 | | This array contains the authentication guards that will be checked when 30 | | Sanctum is trying to authenticate a request. If none of these guards 31 | | are able to authenticate the request, Sanctum will use the bearer 32 | | token that's present on an incoming request for authentication. 33 | | 34 | */ 35 | 36 | 'guard' => ['web'], 37 | 38 | /* 39 | |-------------------------------------------------------------------------- 40 | | Expiration Minutes 41 | |-------------------------------------------------------------------------- 42 | | 43 | | This value controls the number of minutes until an issued token will be 44 | | considered expired. If this value is null, personal access tokens do 45 | | not expire. This won't tweak the lifetime of first-party sessions. 46 | | 47 | */ 48 | 49 | 'expiration' => null, 50 | 51 | /* 52 | |-------------------------------------------------------------------------- 53 | | Sanctum Middleware 54 | |-------------------------------------------------------------------------- 55 | | 56 | | When authenticating your first-party SPA with Sanctum you may need to 57 | | customize some of the middleware Sanctum uses while processing the 58 | | request. You may change the middleware listed below as required. 59 | | 60 | */ 61 | 62 | 'middleware' => [ 63 | 'verify_csrf_token' => App\Http\Middleware\VerifyCsrfToken::class, 64 | 'encrypt_cookies' => App\Http\Middleware\EncryptCookies::class, 65 | ], 66 | 67 | ]; 68 | -------------------------------------------------------------------------------- /laravel-backend/config/services.php: -------------------------------------------------------------------------------- 1 | [ 18 | 'domain' => env('MAILGUN_DOMAIN'), 19 | 'secret' => env('MAILGUN_SECRET'), 20 | 'endpoint' => env('MAILGUN_ENDPOINT', 'api.mailgun.net'), 21 | 'scheme' => 'https', 22 | ], 23 | 24 | 'postmark' => [ 25 | 'token' => env('POSTMARK_TOKEN'), 26 | ], 27 | 28 | 'ses' => [ 29 | 'key' => env('AWS_ACCESS_KEY_ID'), 30 | 'secret' => env('AWS_SECRET_ACCESS_KEY'), 31 | 'region' => env('AWS_DEFAULT_REGION', 'us-east-1'), 32 | ], 33 | 34 | ]; 35 | -------------------------------------------------------------------------------- /laravel-backend/config/view.php: -------------------------------------------------------------------------------- 1 | [ 17 | resource_path('views'), 18 | ], 19 | 20 | /* 21 | |-------------------------------------------------------------------------- 22 | | Compiled View Path 23 | |-------------------------------------------------------------------------- 24 | | 25 | | This option determines where all the compiled Blade templates will be 26 | | stored for your application. Typically, this is within the storage 27 | | directory. However, as usual, you are free to change this value. 28 | | 29 | */ 30 | 31 | 'compiled' => env( 32 | 'VIEW_COMPILED_PATH', 33 | realpath(storage_path('framework/views')) 34 | ), 35 | 36 | ]; 37 | -------------------------------------------------------------------------------- /laravel-backend/database/.gitignore: -------------------------------------------------------------------------------- 1 | *.sqlite* 2 | -------------------------------------------------------------------------------- /laravel-backend/database/factories/UserFactory.php: -------------------------------------------------------------------------------- 1 | 10 | */ 11 | class UserFactory extends Factory 12 | { 13 | /** 14 | * Define the model's default state. 15 | * 16 | * @return array 17 | */ 18 | public function definition() 19 | { 20 | return [ 21 | 'name' => fake()->name(), 22 | 'email' => fake()->unique()->safeEmail(), 23 | 'email_verified_at' => now(), 24 | 'password' => '$2y$10$92IXUNpkjO0rOQ5byMi.Ye4oKoEa3Ro9llC/.og/at2.uheWG/igi', // password 25 | 'remember_token' => Str::random(10), 26 | ]; 27 | } 28 | 29 | /** 30 | * Indicate that the model's email address should be unverified. 31 | * 32 | * @return static 33 | */ 34 | public function unverified() 35 | { 36 | return $this->state(fn (array $attributes) => [ 37 | 'email_verified_at' => null, 38 | ]); 39 | } 40 | } 41 | -------------------------------------------------------------------------------- /laravel-backend/database/migrations/2014_10_12_000000_create_users_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('name'); 19 | $table->string('email')->unique(); 20 | $table->timestamp('email_verified_at')->nullable(); 21 | $table->string('password'); 22 | $table->rememberToken(); 23 | $table->timestamps(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('users'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /laravel-backend/database/migrations/2014_10_12_100000_create_password_resets_table.php: -------------------------------------------------------------------------------- 1 | string('email')->index(); 18 | $table->string('token'); 19 | $table->timestamp('created_at')->nullable(); 20 | }); 21 | } 22 | 23 | /** 24 | * Reverse the migrations. 25 | * 26 | * @return void 27 | */ 28 | public function down() 29 | { 30 | Schema::dropIfExists('password_resets'); 31 | } 32 | }; 33 | -------------------------------------------------------------------------------- /laravel-backend/database/migrations/2019_08_19_000000_create_failed_jobs_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->string('uuid')->unique(); 19 | $table->text('connection'); 20 | $table->text('queue'); 21 | $table->longText('payload'); 22 | $table->longText('exception'); 23 | $table->timestamp('failed_at')->useCurrent(); 24 | }); 25 | } 26 | 27 | /** 28 | * Reverse the migrations. 29 | * 30 | * @return void 31 | */ 32 | public function down() 33 | { 34 | Schema::dropIfExists('failed_jobs'); 35 | } 36 | }; 37 | -------------------------------------------------------------------------------- /laravel-backend/database/migrations/2019_12_14_000001_create_personal_access_tokens_table.php: -------------------------------------------------------------------------------- 1 | id(); 18 | $table->morphs('tokenable'); 19 | $table->string('name'); 20 | $table->string('token', 64)->unique(); 21 | $table->text('abilities')->nullable(); 22 | $table->timestamp('last_used_at')->nullable(); 23 | $table->timestamp('expires_at')->nullable(); 24 | $table->timestamps(); 25 | }); 26 | } 27 | 28 | /** 29 | * Reverse the migrations. 30 | * 31 | * @return void 32 | */ 33 | public function down() 34 | { 35 | Schema::dropIfExists('personal_access_tokens'); 36 | } 37 | }; 38 | -------------------------------------------------------------------------------- /laravel-backend/database/seeders/DatabaseSeeder.php: -------------------------------------------------------------------------------- 1 | create(); 18 | 19 | // \App\Models\User::factory()->create([ 20 | // 'name' => 'Test User', 21 | // 'email' => 'test@example.com', 22 | // ]); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /laravel-backend/lang/en/auth.php: -------------------------------------------------------------------------------- 1 | 'These credentials do not match our records.', 17 | 'password' => 'The provided password is incorrect.', 18 | 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', 19 | 20 | ]; 21 | -------------------------------------------------------------------------------- /laravel-backend/lang/en/pagination.php: -------------------------------------------------------------------------------- 1 | '« Previous', 17 | 'next' => 'Next »', 18 | 19 | ]; 20 | -------------------------------------------------------------------------------- /laravel-backend/lang/en/passwords.php: -------------------------------------------------------------------------------- 1 | 'Your password has been reset!', 17 | 'sent' => 'We have emailed your password reset link!', 18 | 'throttled' => 'Please wait before retrying.', 19 | 'token' => 'This password reset token is invalid.', 20 | 'user' => "We can't find a user with that email address.", 21 | 22 | ]; 23 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /node_modules 3 | package-lock.json 4 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 AvoRed E commerce 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "avored/cash-on-delivery", 3 | "description" : "AvoRed Laravel E commerce - Cash On Delivery Module", 4 | "keywords" : [ 5 | "framework", 6 | "banner", 7 | "cart", 8 | "laravel", 9 | "e commerce", 10 | "laravel5", 11 | "shop", 12 | "shopping-cart", 13 | "e-commerce", 14 | "shopping cart", 15 | "e commerce" 16 | ], 17 | "license" : "MIT", 18 | "authors" : [{ 19 | "name" : "Purvesh ", 20 | "email" : "ind.purvesh@gmail.com" 21 | } 22 | ], 23 | "type" : "avored-module", 24 | "require" : { 25 | "php": ">=7.1.3", 26 | "avored/module-installer" : "1.*" 27 | }, 28 | "autoload" : { 29 | "psr-4" : { 30 | "AvoRed\\CashOnDelivery\\" : "src/" 31 | } 32 | }, 33 | "homepage" : "https://avored.com", 34 | "support" : { 35 | "email" : "ind.purvesh@gmail.com", 36 | "issues" : "https://avored.com/discussion", 37 | "forum" : "https://avored.com/discussion", 38 | "wiki" : "https://avored.com/docs", 39 | "source" : "https://github.com/avored/banner" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/dist/js/cash-on-delivery.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=1)}([function(e,t,n){"use strict";function o(e,t,n,o,r,i,a,s){var u,l="function"==typeof e?e.options:e;if(t&&(l.render=t,l.staticRenderFns=n,l._compiled=!0),o&&(l.functional=!0),i&&(l._scopeId="data-v-"+i),a?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},l._ssrRegister=u):r&&(u=s?function(){r.call(this,(l.functional?this.parent:this).$root.$options.shadowRoot)}:r),u)if(l.functional){l._injectStyles=u;var c=l.render;l.render=function(e,t){return u.call(t),c(e,t)}}else{var d=l.beforeCreate;l.beforeCreate=d?[].concat(d,u):[u]}return{exports:e,options:l}}n.d(t,"a",(function(){return o}))},function(e,t,n){e.exports=n(2)},function(e,t,n){AvoRed.initialize((function(e){e.component("avored-cash-on-delivery",n(3).default),e.component("cash-on-delivery-config",n(4).default)}))},function(e,t,n){"use strict";n.r(t);var o={name:"avored-cash-on-delivery",props:[],data:function(){return{selectedCashOnDeliveryPaymentOption:!1}},methods:{handlePaymentChange:function(e,t){this.selectedCashOnDeliveryPaymentOption=!!e,window.EventBus.$emit("selectedPaymentIdentifier",t)}},mounted:function(){var e=this,t=window.EventBus;t.$on("placeOrderBefore",(function(){e.selectedCashOnDeliveryPaymentOption&&t.$emit("placeOrderAfter")}))}},r=n(0),i=Object(r.a)(o,(function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("avored-toggle",{attrs:{"label-text":"Cash On Delivery","field-name":"payment_option","toggle-on-value":"a-cash-on-delivery"}})],1)}),[],!1,null,null,null);t.default=i.exports},function(e,t,n){"use strict";n.r(t);var o={name:"cash-on-delivery-config",props:["data","options"],data:function(){return{status:!1}},methods:{},mounted:function(){}},r=n(0),i=Object(r.a)(o,(function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("avored-select",{attrs:{"field-name":"a_cash_on_delivery_status",options:this.options,"init-value":this.data.a_cash_on_delivery_status}})],1)}),[],!1,null,null,null);t.default=i.exports}]); -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/dist/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/vendor/avored/js/cash-on-delivery.js": "/vendor/avored/js/cash-on-delivery.js" 3 | } 4 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/dist/vendor/avored/js/cash-on-delivery.js: -------------------------------------------------------------------------------- 1 | !function(e){var t={};function n(o){if(t[o])return t[o].exports;var r=t[o]={i:o,l:!1,exports:{}};return e[o].call(r.exports,r,r.exports,n),r.l=!0,r.exports}n.m=e,n.c=t,n.d=function(e,t,o){n.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},n.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},n.t=function(e,t){if(1&t&&(e=n(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var r in e)n.d(o,r,function(t){return e[t]}.bind(null,r));return o},n.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return n.d(t,"a",t),t},n.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},n.p="/",n(n.s=1)}([function(e,t,n){"use strict";function o(e,t,n,o,r,i,a,s){var u,c="function"==typeof e?e.options:e;if(t&&(c.render=t,c.staticRenderFns=n,c._compiled=!0),o&&(c.functional=!0),i&&(c._scopeId="data-v-"+i),a?(u=function(e){(e=e||this.$vnode&&this.$vnode.ssrContext||this.parent&&this.parent.$vnode&&this.parent.$vnode.ssrContext)||"undefined"==typeof __VUE_SSR_CONTEXT__||(e=__VUE_SSR_CONTEXT__),r&&r.call(this,e),e&&e._registeredComponents&&e._registeredComponents.add(a)},c._ssrRegister=u):r&&(u=s?function(){r.call(this,(c.functional?this.parent:this).$root.$options.shadowRoot)}:r),u)if(c.functional){c._injectStyles=u;var l=c.render;c.render=function(e,t){return u.call(t),l(e,t)}}else{var d=c.beforeCreate;c.beforeCreate=d?[].concat(d,u):[u]}return{exports:e,options:c}}n.d(t,"a",(function(){return o}))},function(e,t,n){e.exports=n(2)},function(e,t,n){AvoRed.initialize((function(e){e.component("avored-cash-on-delivery",n(4).default),e.component("cash-on-delivery-config",n(3).default)}))},function(e,t,n){"use strict";n.r(t);var o={name:"cash-on-delivery-config",props:["data","options"],data:function(){return{status:!1}},methods:{},mounted:function(){}},r=n(0),i=Object(r.a)(o,(function(){var e=this.$createElement,t=this._self._c||e;return t("div",[t("avored-select",{attrs:{"field-name":"a_cash_on_delivery_status",options:this.options,"init-value":this.data.a_cash_on_delivery_status}})],1)}),[],!1,null,null,null);t.default=i.exports},function(e,t,n){"use strict";n.r(t);var o={name:"avored-cash-on-delivery",props:[],data:function(){return{selectedCashOnDeliveryPaymentOption:!1}},methods:{handlePaymentChange:function(e,t){this.selectedCashOnDeliveryPaymentOption=!!e,window.EventBus.$emit("selectedPaymentIdentifier",t)}},mounted:function(){var e=this,t=window.EventBus;t.$on("placeOrderBefore",(function(){e.selectedCashOnDeliveryPaymentOption&&t.$emit("placeOrderAfter")}))}},r=n(0),i=Object(r.a)(o,void 0,void 0,!1,null,null,null);t.default=i.exports}]); -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --https --key ~/.config/valet/Certificates/laravel-ecommerce.test.key --cert ~/.config/valet/Certificates/laravel-ecommerce.test.crt --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "dependencies": { 13 | "cross-env": "^6.0.0", 14 | "laravel-mix": "^4.1.4", 15 | "vue": "^2.5.17" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/readme.md: -------------------------------------------------------------------------------- 1 | # AvoRed Cash On Delivery Payment Module 2 | 3 | ### Installation 4 | 5 | composer require avored/cash-on-delivery 6 | 7 | php artisan migrate 8 | 9 | ### How to Use 10 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/register.yml: -------------------------------------------------------------------------------- 1 | name: avored cash-on-delivery 2 | identifier: avored-cash-on-delivery 3 | status: active 4 | description: avored cash-on-delivery Module 5 | namespace: AvoRed\CashOnDelivery\ 6 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/resources/components/AvoRedCashOnDelivery.vue: -------------------------------------------------------------------------------- 1 | 32 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/resources/components/CashOnDeliveryConfig.vue: -------------------------------------------------------------------------------- 1 | 11 | 12 | 29 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/resources/js/cash-on-delivery.js: -------------------------------------------------------------------------------- 1 | AvoRed.initialize((Vue) => { 2 | Vue.component('avored-cash-on-delivery', require('../components/AvoRedCashOnDelivery.vue').default) 3 | Vue.component('cash-on-delivery-config', require('../components/CashOnDeliveryConfig.vue').default) 4 | }) 5 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/resources/lang/en/cash-on-delivery.php: -------------------------------------------------------------------------------- 1 | 'Cash On Delivery', 5 | 'enabled' => 'Enabled', 6 | 'disabled' => 'Disabled', 7 | 'status' => 'Status' 8 | ]; 9 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/resources/views/index.blade.php: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/resources/views/system/configuration/payment-card.blade.php: -------------------------------------------------------------------------------- 1 | @php 2 | $data = collect(); 3 | $data->put('a_cash_on_delivery_status', $repository->getValueByCode('a_cash_on_delivery_status')); 4 | 5 | $options = collect(); 6 | $options->put('ENABLED', 'Enabled'); 7 | $options->put('DISABLED', 'Disabled'); 8 | @endphp 9 | 10 | 14 | 15 | @push('scripts') 16 | 17 | @endpush 18 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/src/CashOnDelivery.php: -------------------------------------------------------------------------------- 1 | identifier; 38 | } 39 | 40 | public function enable() 41 | { 42 | return true; 43 | } 44 | 45 | public function process() 46 | { 47 | // 48 | } 49 | 50 | /** 51 | * Get Title for this Payment Option. 52 | * 53 | * return boolean 54 | */ 55 | public function name() 56 | { 57 | return $this->name; 58 | } 59 | 60 | /** 61 | * Payment Option View Path. 62 | * return String 63 | */ 64 | public function view() 65 | { 66 | return $this->view; 67 | } 68 | 69 | /** 70 | * Render Payment Option 71 | * return String 72 | */ 73 | public function render() 74 | { 75 | return view($this->view())->with($this->with()); 76 | } 77 | 78 | 79 | /** 80 | * Payment Option View Data. 81 | * 82 | * return Array 83 | */ 84 | public function with() 85 | { 86 | return ['payment' => $this]; 87 | } 88 | } 89 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/src/Module.php: -------------------------------------------------------------------------------- 1 | registerResources(); 20 | $this->registerPaymentOption(); 21 | $this->registerTab(); 22 | $this->publishFiles(); 23 | } 24 | 25 | /** 26 | * Register any application services. 27 | * 28 | * @return void 29 | */ 30 | public function register() 31 | { 32 | // 33 | } 34 | 35 | /** 36 | * Registering avored cash-on-delivery Resource 37 | * e.g. Route, View, Database & Translation Path 38 | * 39 | * @return void 40 | */ 41 | protected function registerResources() 42 | { 43 | //$this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); 44 | $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'a-cash-on-delivery'); 45 | $this->loadViewsFrom(__DIR__ . '/../resources/views', 'a-cash-on-delivery'); 46 | } 47 | 48 | /** 49 | * Register Shippiong Option for App. 50 | * 51 | * @return void 52 | */ 53 | protected function registerPaymentOption() 54 | { 55 | $payment = new CashOnDelivery(); 56 | Payment::put($payment); 57 | } 58 | 59 | /** 60 | * Publish Files for AvoRed Banner Modules. 61 | * @return void 62 | */ 63 | public function publishFiles() 64 | { 65 | $this->publishes([ 66 | __DIR__ . '/../dist/js' => public_path('vendor/avored/js'), 67 | ]); 68 | } 69 | 70 | public function registerTab() 71 | { 72 | // Tab::put('system.configuration', function (TabItem $tab) { 73 | // $tab->key('system.configuration.cash-on-delivery') 74 | // ->label('a-cash-on-delivery::cash-on-delivery.config-title') 75 | // ->view('a-cash-on-delivery::system.configuration.payment-card'); 76 | // }); 77 | } 78 | } 79 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/cash-on-delivery/webpack.mix.js: -------------------------------------------------------------------------------- 1 | let mix = require('laravel-mix') 2 | 3 | // let publicPath = 'dist' 4 | let publicPath = '../../../public' 5 | 6 | mix.setPublicPath(publicPath) 7 | .js('resources/js/cash-on-delivery.js', 'vendor/avored/js/cash-on-delivery.js') 8 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .DS_Store 3 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 AvoRed E commerce 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/README.md: -------------------------------------------------------------------------------- 1 | # AvoRed E commerce Dummy Data 2 | 3 | AvoRed E commerce Dummy Data 4 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-bunk-bed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-bunk-bed.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-double-bed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-double-bed.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-queen-bed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-queen-bed.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-single-bed.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-single-bed.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-sofa-set.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/avored-sofa-set.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/blue-attribute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/blue-attribute.png -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/laravel-bedside-table.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/laravel-bedside-table.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/laravel-sofa-set.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/laravel-sofa-set.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/php-single-mattress.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/php-single-mattress.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/php-sofa-set.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/php-sofa-set.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/red-attribute.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/red-attribute.jpg -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/yellow-attribute.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/modules/avored/dummy-data/assets/uploads/catalog/yellow-attribute.png -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "avored/dummy-data", 3 | "type" : "avored-module", 4 | "description" : "AvoRed Laravel 5 E commerce Dummy Data", 5 | "keywords" : [ 6 | "framework", 7 | "install", 8 | "cart", 9 | "laravel", 10 | "e commerce", 11 | "laravel5", 12 | "shop", 13 | "shopping-cart", 14 | "e-commerce", 15 | "shopping cart", 16 | "e commerce" 17 | ], 18 | "license" : "MIT", 19 | "authors" : [{ 20 | "name" : "Purvesh ", 21 | "email" : "ind.purvesh@gmail.com" 22 | } 23 | ], 24 | "require" : { 25 | "php" : ">=7.1.3", 26 | "avored/module-installer" : "1.*" 27 | }, 28 | "autoload" : { 29 | "psr-4" : { 30 | "AvoRed\\DummyData\\" : "src" 31 | } 32 | }, 33 | "homepage" : "https://www.avored.com/", 34 | "support" : { 35 | "email" : "ind.purvesh@gmail.com", 36 | "issues" : "https://www.avored.com/discussion", 37 | "forum" : "https://www.avored.com/discussion", 38 | "wiki" : "https://www.avored.com/docs", 39 | "source" : "https://www.github.com/avored/dummy-data" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/register.yml: -------------------------------------------------------------------------------- 1 | name: AvoRed Dummy Data 2 | identifier: avored-dummy-data 3 | description: AvoRed Dummy Data Module 4 | namespace: AvoRed\DummyData\ 5 | status: active 6 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/dummy-data/src/Module.php: -------------------------------------------------------------------------------- 1 | 5 | * @copyright 2017-2018 AvoRed 6 | * @license https://opensource.org/licenses/MIT MIT 7 | * @link https://www.avored.com 8 | */ 9 | 10 | namespace AvoRed\DummyData; 11 | 12 | use Illuminate\Support\ServiceProvider; 13 | 14 | class Module extends ServiceProvider 15 | { 16 | /** 17 | * Indicates if loading of the provider is deferred. 18 | * 19 | * @var bool 20 | */ 21 | ///protected $defer = true; 22 | 23 | /** 24 | * Bootstrap any application services. 25 | * 26 | * @return void 27 | */ 28 | public function boot() 29 | { 30 | $this->publishFiles(); 31 | } 32 | 33 | /** 34 | * Register any application services. 35 | * 36 | * @return void 37 | */ 38 | public function register() 39 | { 40 | } 41 | 42 | public function publishFiles() 43 | { 44 | $this->publishes([__DIR__ . '/../assets' => storage_path('app/public')], 'public'); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/.gitignore: -------------------------------------------------------------------------------- 1 | 2 | /node_modules 3 | package-lock.json 4 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2018 AvoRed E commerce 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/composer.json: -------------------------------------------------------------------------------- 1 | { 2 | "name" : "avored/pickup", 3 | "description" : "AvoRed Laravel E commerce - Pickup Module", 4 | "keywords" : [ 5 | "framework", 6 | "banner", 7 | "cart", 8 | "laravel", 9 | "e commerce", 10 | "laravel5", 11 | "shop", 12 | "shopping-cart", 13 | "e-commerce", 14 | "shopping cart", 15 | "e commerce" 16 | ], 17 | "license" : "MIT", 18 | "authors" : [{ 19 | "name" : "Purvesh ", 20 | "email" : "ind.purvesh@gmail.com" 21 | } 22 | ], 23 | "type" : "avored-module", 24 | "require" : { 25 | "php" : ">=7.1.3", 26 | "avored/module-installer" : "1.*" 27 | }, 28 | "autoload" : { 29 | "psr-4" : { 30 | "AvoRed\\CashOnDelivery\\" : "src/" 31 | } 32 | }, 33 | "homepage" : "https://avored.com", 34 | "support" : { 35 | "email" : "ind.purvesh@gmail.com", 36 | "issues" : "https://avored.com/discussion", 37 | "forum" : "https://avored.com/discussion", 38 | "wiki" : "https://avored.com/docs", 39 | "source" : "https://github.com/avored/banner" 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "npm run development", 5 | "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 6 | "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js", 7 | "watch-poll": "npm run watch -- --watch-poll", 8 | "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --https --key ~/.config/valet/Certificates/laravel-ecommerce.test.key --cert ~/.config/valet/Certificates/laravel-ecommerce.test.crt --config=node_modules/laravel-mix/setup/webpack.config.js", 9 | "prod": "npm run production", 10 | "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js" 11 | }, 12 | "dependencies": { 13 | "cross-env": "^6.0.0", 14 | "laravel-mix": "^4.1.4", 15 | "vue": "^2.5.17" 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/readme.md: -------------------------------------------------------------------------------- 1 | # AvoRed Cash On Delivery Payment Module 2 | 3 | ### Installation 4 | 5 | composer require avored/pickup 6 | 7 | php artisan migrate 8 | 9 | ### How to Use 10 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/register.yml: -------------------------------------------------------------------------------- 1 | name: AvoRed Pickup 2 | identifier: avored-pickup 3 | status: active 4 | description: AvoRed Pickup Module 5 | namespace: AvoRed\Pickup\ 6 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/resources/lang/en/pickup.php: -------------------------------------------------------------------------------- 1 | 'Pickup', 5 | 'status-field' => 'Pickup Status' 6 | ]; 7 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/resources/views/pickup.blade.php: -------------------------------------------------------------------------------- 1 | 11 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/resources/views/system/configuration/pickup.blade.php: -------------------------------------------------------------------------------- 1 | @php 2 | $value = $repository->getValueByCode('a_pickup_status'); 3 | 4 | $options = collect(); 5 | $options->put('ENABLED', 'Enabled'); 6 | $options->put('DISABLED', 'Disabled'); 7 | 8 | @endphp 9 | 10 | 16 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/src/Module.php: -------------------------------------------------------------------------------- 1 | registerResources(); 20 | $this->registerShippingOption(); 21 | $this->registerTab(); 22 | } 23 | 24 | /** 25 | * Register any application services. 26 | * 27 | * @return void 28 | */ 29 | public function register() 30 | { 31 | // 32 | } 33 | 34 | /** 35 | * Registering AvoRed Pickup Resource 36 | * e.g. Route, View, Database & Translation Path 37 | * 38 | * @return void 39 | */ 40 | protected function registerResources() 41 | { 42 | //$this->loadRoutesFrom(__DIR__ . '/../routes/web.php'); 43 | $this->loadTranslationsFrom(__DIR__ . '/../resources/lang', 'avored-pickup'); 44 | $this->loadViewsFrom(__DIR__ . '/../resources/views', 'avored-pickup'); 45 | } 46 | 47 | /** 48 | * Register Shippiong Option for App. 49 | * @return void 50 | */ 51 | protected function registerShippingOption() 52 | { 53 | $shipping = new Pickup(); 54 | Shipping::put($shipping); 55 | } 56 | 57 | public function registerTab() 58 | { 59 | // Tab::put('system.configuration', function (TabItem $tab) { 60 | // $tab->key('system.configuration.pickup') 61 | // ->label('avored-pickup::pickup.config-title') 62 | // ->view('avored-pickup::system.configuration.pickup'); 63 | // }); 64 | } 65 | } 66 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/src/Pickup.php: -------------------------------------------------------------------------------- 1 | identifier; 38 | } 39 | 40 | public function enable() 41 | { 42 | return true; 43 | } 44 | 45 | /** 46 | * Get Title for this Payment Option. 47 | * 48 | * return boolean 49 | */ 50 | public function name() 51 | { 52 | return $this->name; 53 | } 54 | 55 | /** 56 | * Payment Option View Path. 57 | * 58 | * return String 59 | */ 60 | public function view() 61 | { 62 | return $this->view; 63 | } 64 | 65 | /** 66 | * Payment Option View Data. 67 | * 68 | * return Array 69 | */ 70 | public function with() 71 | { 72 | return []; 73 | } 74 | } 75 | -------------------------------------------------------------------------------- /laravel-backend/modules/avored/pickup/webpack.mix.js: -------------------------------------------------------------------------------- 1 | let mix = require('laravel-mix') 2 | 3 | // let publicPath = 'dist' 4 | let publicPath = '../../../public' 5 | 6 | mix.setPublicPath(publicPath) 7 | .js('resources/js/cash-on-delivery.js', 'vendor/avored/js/cash-on-delivery.js') 8 | -------------------------------------------------------------------------------- /laravel-backend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "private": true, 3 | "scripts": { 4 | "dev": "vite", 5 | "build": "vite build" 6 | }, 7 | "devDependencies": { 8 | "axios": "^1.1.2", 9 | "laravel-vite-plugin": "^0.6.0", 10 | "lodash": "^4.17.19", 11 | "postcss": "^8.1.14", 12 | "vite": "^3.0.0" 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /laravel-backend/phpunit.xml: -------------------------------------------------------------------------------- 1 | 2 | 7 | 8 | 9 | ./tests/Unit 10 | 11 | 12 | ./tests/Feature 13 | 14 | 15 | 16 | 17 | ./app 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /laravel-backend/public/.htaccess: -------------------------------------------------------------------------------- 1 | 2 | 3 | Options -MultiViews -Indexes 4 | 5 | 6 | RewriteEngine On 7 | 8 | # Handle Authorization Header 9 | RewriteCond %{HTTP:Authorization} . 10 | RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] 11 | 12 | # Redirect Trailing Slashes If Not A Folder... 13 | RewriteCond %{REQUEST_FILENAME} !-d 14 | RewriteCond %{REQUEST_URI} (.+)/$ 15 | RewriteRule ^ %1 [L,R=301] 16 | 17 | # Send Requests To Front Controller... 18 | RewriteCond %{REQUEST_FILENAME} !-d 19 | RewriteCond %{REQUEST_FILENAME} !-f 20 | RewriteRule ^ index.php [L] 21 | 22 | -------------------------------------------------------------------------------- /laravel-backend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/public/favicon.ico -------------------------------------------------------------------------------- /laravel-backend/public/index.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class); 49 | 50 | $response = $kernel->handle( 51 | $request = Request::capture() 52 | )->send(); 53 | 54 | 55 | $kernel->terminate($request, $response); 56 | -------------------------------------------------------------------------------- /laravel-backend/public/mix-manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "/vendor/avored/js/app.js": "/vendor/avored/js/app.js", 3 | "/vendor/avored/css/app.css": "/vendor/avored/css/app.css", 4 | "/vendor/avored/images/avored_logo.ico": "/vendor/avored/images/avored_logo.ico", 5 | "/vendor/avored/images/logo_only.svg": "/vendor/avored/images/logo_only.svg" 6 | } 7 | -------------------------------------------------------------------------------- /laravel-backend/public/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: 3 | -------------------------------------------------------------------------------- /laravel-backend/public/vendor/avored/images/avored_logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/public/vendor/avored/images/avored_logo.ico -------------------------------------------------------------------------------- /laravel-backend/resources/css/app.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/laravel-backend/resources/css/app.css -------------------------------------------------------------------------------- /laravel-backend/resources/js/app.js: -------------------------------------------------------------------------------- 1 | import './bootstrap'; 2 | -------------------------------------------------------------------------------- /laravel-backend/resources/js/bootstrap.js: -------------------------------------------------------------------------------- 1 | import _ from 'lodash'; 2 | window._ = _; 3 | 4 | /** 5 | * We'll load the axios HTTP library which allows us to easily issue requests 6 | * to our Laravel back-end. This library automatically handles sending the 7 | * CSRF token as a header based on the value of the "XSRF" token cookie. 8 | */ 9 | 10 | import axios from 'axios'; 11 | window.axios = axios; 12 | 13 | window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest'; 14 | 15 | /** 16 | * Echo exposes an expressive API for subscribing to channels and listening 17 | * for events that are broadcast by Laravel. Echo and event broadcasting 18 | * allows your team to easily build robust real-time web applications. 19 | */ 20 | 21 | // import Echo from 'laravel-echo'; 22 | 23 | // import Pusher from 'pusher-js'; 24 | // window.Pusher = Pusher; 25 | 26 | // window.Echo = new Echo({ 27 | // broadcaster: 'pusher', 28 | // key: import.meta.env.VITE_PUSHER_APP_KEY, 29 | // wsHost: import.meta.env.VITE_PUSHER_HOST ? import.meta.env.VITE_PUSHER_HOST : `ws-${import.meta.env.VITE_PUSHER_APP_CLUSTER}.pusher.com`, 30 | // wsPort: import.meta.env.VITE_PUSHER_PORT ?? 80, 31 | // wssPort: import.meta.env.VITE_PUSHER_PORT ?? 443, 32 | // forceTLS: (import.meta.env.VITE_PUSHER_SCHEME ?? 'https') === 'https', 33 | // enabledTransports: ['ws', 'wss'], 34 | // }); 35 | -------------------------------------------------------------------------------- /laravel-backend/routes/api.php: -------------------------------------------------------------------------------- 1 | get('/user', function (Request $request) { 18 | return $request->user(); 19 | }); 20 | -------------------------------------------------------------------------------- /laravel-backend/routes/channels.php: -------------------------------------------------------------------------------- 1 | id === (int) $id; 18 | }); 19 | -------------------------------------------------------------------------------- /laravel-backend/routes/console.php: -------------------------------------------------------------------------------- 1 | comment(Inspiring::quote()); 19 | })->purpose('Display an inspiring quote'); 20 | -------------------------------------------------------------------------------- /laravel-backend/routes/web.php: -------------------------------------------------------------------------------- 1 | make(Kernel::class)->bootstrap(); 19 | 20 | return $app; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /laravel-backend/tests/Feature/ExampleTest.php: -------------------------------------------------------------------------------- 1 | get('/'); 18 | 19 | $response->assertStatus(200); 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /laravel-backend/tests/TestCase.php: -------------------------------------------------------------------------------- 1 | assertTrue(true); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /laravel-backend/vite.config.js: -------------------------------------------------------------------------------- 1 | import { defineConfig } from 'vite'; 2 | import laravel from 'laravel-vite-plugin'; 3 | 4 | export default defineConfig({ 5 | plugins: [ 6 | laravel({ 7 | input: ['resources/css/app.css', 'resources/js/app.js'], 8 | refresh: true, 9 | }), 10 | ], 11 | }); 12 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "laravel-ecommerce", 3 | "version": "0.1.0", 4 | "private": true, 5 | "scripts": { 6 | "serve": "vue-cli-service serve", 7 | "build": "vue-cli-service build", 8 | "lint": "vue-cli-service lint", 9 | "deploy": "sh deploy.sh" 10 | }, 11 | "dependencies": { 12 | "@urql/vue": "^0.6.0", 13 | "core-js": "^3.6.5", 14 | "feather-icons": "^4.28.0", 15 | "graphql": "^15.7.2", 16 | "graphql-tag": "^2.12.6", 17 | "lodash": "^4.17.21", 18 | "vue": "^3.2.20", 19 | "vue-class-component": "^8.0.0-0", 20 | "vue-content-loader": "^2.0.1", 21 | "vue-feather": "^2.0.0-rc.1", 22 | "vue-i18n": "^9.1.9", 23 | "vue-router": "^4.0.0-0", 24 | "vuex": "^4.0.0-0" 25 | }, 26 | "devDependencies": { 27 | "@tailwindcss/postcss7-compat": "^2.2.17", 28 | "@types/lodash": "^4.14.176", 29 | "@typescript-eslint/eslint-plugin": "^4.18.0", 30 | "@typescript-eslint/parser": "^4.18.0", 31 | "@vue/cli-plugin-babel": "~5.0.8", 32 | "@vue/cli-plugin-eslint": "~5.0.8", 33 | "@vue/cli-plugin-router": "~5.0.8", 34 | "@vue/cli-plugin-typescript": "~5.0.8", 35 | "@vue/cli-plugin-vuex": "~5.0.8", 36 | "@vue/cli-service": "~5.0.8", 37 | "@vue/compiler-sfc": "^3.0.0", 38 | "@vue/eslint-config-typescript": "^7.0.0", 39 | "cssnano": "^5.1.13", 40 | "eslint": "^6.7.2", 41 | "eslint-plugin-vue": "^7.0.0", 42 | "typescript": "^4.5.5" 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | '@tailwindcss/postcss7-compat': {}, 4 | autoprefixer: {}, 5 | cssnano: {} 6 | }, 7 | } -------------------------------------------------------------------------------- /public/avored_logo.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/public/avored_logo.ico -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | <%= htmlWebpackPlugin.options.title %> 9 | 10 | 11 | 14 |
15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /react-frontend/.env.example: -------------------------------------------------------------------------------- 1 | REACT_APP_GRAPHQL_URL="http://localhost:8000/graphql" -------------------------------------------------------------------------------- /react-frontend/.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | /.fleet 16 | .DS_Store 17 | .env.local 18 | .env.development.local 19 | .env.test.local 20 | .env.production.local 21 | 22 | npm-debug.log* 23 | yarn-debug.log* 24 | yarn-error.log* 25 | -------------------------------------------------------------------------------- /react-frontend/.graphqlrc.yml: -------------------------------------------------------------------------------- 1 | schema: https://laravel-backend.test/graphql/ 2 | -------------------------------------------------------------------------------- /react-frontend/README.md: -------------------------------------------------------------------------------- 1 | # Getting Started with Create React App 2 | 3 | This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app), using the [Redux](https://redux.js.org/) and [Redux Toolkit](https://redux-toolkit.js.org/) TS template. 4 | 5 | ## Available Scripts 6 | 7 | In the project directory, you can run: 8 | 9 | ### `npm start` 10 | 11 | Runs the app in the development mode.\ 12 | Open [http://localhost:3000](http://localhost:3000) to view it in the browser. 13 | 14 | The page will reload if you make edits.\ 15 | You will also see any lint errors in the console. 16 | 17 | ### `npm test` 18 | 19 | Launches the test runner in the interactive watch mode.\ 20 | See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information. 21 | 22 | ### `npm run build` 23 | 24 | Builds the app for production to the `build` folder.\ 25 | It correctly bundles React in production mode and optimizes the build for the best performance. 26 | 27 | The build is minified and the filenames include the hashes.\ 28 | Your app is ready to be deployed! 29 | 30 | See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information. 31 | 32 | ### `npm run eject` 33 | 34 | **Note: this is a one-way operation. Once you `eject`, you can’t go back!** 35 | 36 | If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project. 37 | 38 | Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own. 39 | 40 | You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it. 41 | 42 | ## Learn More 43 | 44 | You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started). 45 | 46 | To learn React, check out the [React documentation](https://reactjs.org/). 47 | -------------------------------------------------------------------------------- /react-frontend/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "my-app", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "@headlessui/react": "^1.7.4", 7 | "@heroicons/react": "^2.0.13", 8 | "@reduxjs/toolkit": "^1.9.0", 9 | "@testing-library/jest-dom": "^5.16.5", 10 | "@testing-library/react": "^13.4.0", 11 | "@testing-library/user-event": "^14.4.3", 12 | "@types/jest": "^27.5.2", 13 | "@types/lodash": "^4.14.190", 14 | "@types/node": "^17.0.45", 15 | "@types/react": "^18.0.25", 16 | "@types/react-dom": "^18.0.8", 17 | "@types/react-router-dom": "^5.3.3", 18 | "@urql/exchange-multipart-fetch": "^1.0.1", 19 | "graphql": "^16.8.1", 20 | "lodash": "^4.17.21", 21 | "react": "^18.2.0", 22 | "react-dom": "^18.2.0", 23 | "react-intl": "^6.2.5", 24 | "react-redux": "^8.0.5", 25 | "react-router-dom": "^6.4.3", 26 | "react-scripts": "5.0.1", 27 | "urql": "^3.0.3", 28 | "web-vitals": "^2.1.4" 29 | }, 30 | "scripts": { 31 | "start": "react-scripts start", 32 | "build": "react-scripts build", 33 | "test": "react-scripts test", 34 | "eject": "react-scripts eject", 35 | "codegen": "graphql-codegen" 36 | }, 37 | "eslintConfig": { 38 | "extends": [ 39 | "react-app", 40 | "react-app/jest" 41 | ] 42 | }, 43 | "browserslist": { 44 | "production": [ 45 | ">0.2%", 46 | "not dead", 47 | "not op_mini all" 48 | ], 49 | "development": [ 50 | "last 1 chrome version", 51 | "last 1 firefox version", 52 | "last 1 safari version" 53 | ] 54 | }, 55 | "devDependencies": { 56 | "@graphql-codegen/cli": "^2.13.12", 57 | "@graphql-codegen/client-preset": "^1.1.3", 58 | "@graphql-codegen/typescript-urql": "^3.7.3", 59 | "@tailwindcss/forms": "^0.5.3", 60 | "@types/query-string": "^6.3.0", 61 | "autoprefixer": "^10.4.13", 62 | "graphql.macro": "^1.4.2", 63 | "jest": "^27.5.1", 64 | "postcss": "^8.4.19", 65 | "tailwindcss": "^3.2.4", 66 | "typescript": "^4.8.4" 67 | } 68 | } 69 | -------------------------------------------------------------------------------- /react-frontend/postcss.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | plugins: { 3 | tailwindcss: {}, 4 | autoprefixer: {}, 5 | }, 6 | } 7 | -------------------------------------------------------------------------------- /react-frontend/public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/react-frontend/public/favicon.ico -------------------------------------------------------------------------------- /react-frontend/public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 17 | 18 | 27 | AvoRed a headless ecommerce for Laravel 28 | 29 | 30 | 31 |
32 | 42 | 43 | 44 | -------------------------------------------------------------------------------- /react-frontend/public/logo192.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/react-frontend/public/logo192.png -------------------------------------------------------------------------------- /react-frontend/public/logo512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/avored/laravel-ecommerce/9e58310553e15273a433c80f96ee1264978593f8/react-frontend/public/logo512.png -------------------------------------------------------------------------------- /react-frontend/public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | }, 10 | { 11 | "src": "logo192.png", 12 | "type": "image/png", 13 | "sizes": "192x192" 14 | }, 15 | { 16 | "src": "logo512.png", 17 | "type": "image/png", 18 | "sizes": "512x512" 19 | } 20 | ], 21 | "start_url": ".", 22 | "display": "standalone", 23 | "theme_color": "#000000", 24 | "background_color": "#ffffff" 25 | } 26 | -------------------------------------------------------------------------------- /react-frontend/public/robots.txt: -------------------------------------------------------------------------------- 1 | # https://www.robotstxt.org/robotstxt.html 2 | User-agent: * 3 | Disallow: 4 | -------------------------------------------------------------------------------- /react-frontend/src/app/hooks.ts: -------------------------------------------------------------------------------- 1 | import { TypedUseSelectorHook, useDispatch, useSelector } from 'react-redux'; 2 | import type { RootState, AppDispatch } from './store'; 3 | 4 | // Use throughout your app instead of plain `useDispatch` and `useSelector` 5 | export const useAppDispatch = () => useDispatch(); 6 | export const useAppSelector: TypedUseSelectorHook = useSelector; 7 | -------------------------------------------------------------------------------- /react-frontend/src/app/store.ts: -------------------------------------------------------------------------------- 1 | import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit'; 2 | import counterReducer from '../features/counter/counterSlice'; 3 | import userLoginReducer from '../features/userLogin/userLoginSlice'; 4 | import cartReducer from '../features/cart/cartSlice'; 5 | import checkoutReducer from '../features/checkout/checkoutSlice'; 6 | import flashSlice from '../features/flash/flashSlice'; 7 | 8 | export const store = configureStore({ 9 | reducer: { 10 | counter: counterReducer, 11 | userLogin: userLoginReducer, 12 | cart: cartReducer, 13 | checkout: checkoutReducer, 14 | flash: flashSlice 15 | }, 16 | }); 17 | 18 | export type AppDispatch = typeof store.dispatch; 19 | export type RootState = ReturnType; 20 | export type AppThunk = ThunkAction< 21 | ReturnType, 22 | RootState, 23 | unknown, 24 | Action 25 | >; 26 | -------------------------------------------------------------------------------- /react-frontend/src/codegen.ts: -------------------------------------------------------------------------------- 1 | import { CodegenConfig } from '@graphql-codegen/cli'; 2 | 3 | const config: CodegenConfig = { 4 | schema: 'http://localhost:8000/graphql', 5 | documents: ['src/**/*.tsx'], 6 | ignoreNoDocuments: true, // for better experience with the watcher 7 | generates: { 8 | './src/gql/': { 9 | preset: 'client', 10 | plugins: [], 11 | }, 12 | }, 13 | }; 14 | 15 | export default config; -------------------------------------------------------------------------------- /react-frontend/src/components/DebugGraphqlErrorMessage.tsx: -------------------------------------------------------------------------------- 1 | import { isEmpty } from 'lodash' 2 | import React from 'react' 3 | 4 | 5 | interface DebugGraphqlErrorMessageProps { 6 | message: string 7 | } 8 | 9 | 10 | export const DebugGraphqlErrorMessage = (props: DebugGraphqlErrorMessageProps) => { 11 | return( 12 | <> 13 | {(!isEmpty(props.message)) ? 14 | ( 15 |
16 |
17 | {props.message} 18 |
19 |
20 | ) 21 | : '' 22 | } 23 | 24 | ) 25 | } 26 | -------------------------------------------------------------------------------- /react-frontend/src/components/Form/FormButton.test.tsx: -------------------------------------------------------------------------------- 1 | import { render, fireEvent, screen } from "@testing-library/react"; 2 | import { FormButton } from "./FormButton"; 3 | 4 | test("testing form button type attribute", () => { 5 | render( 6 | 7 | Test Button 8 | 9 | ); 10 | expect(screen.getByRole('button').getAttribute('type')).toContain('submit') 11 | }); 12 | 13 | test("testing form button component in the document", () => { 14 | render( 15 | 16 | Test Button 17 | 18 | ); 19 | expect(screen.getByRole('button')).toBeInTheDocument() 20 | }); 21 | -------------------------------------------------------------------------------- /react-frontend/src/components/Form/FormButton.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Link } from 'react-router-dom' 3 | 4 | 5 | interface FormButtonProps { 6 | children: React.ReactNode 7 | type: "button" | "submit" | 'reset' 8 | } 9 | 10 | export const FormButton = (props: FormButtonProps) => { 11 | 12 | return ( 13 | 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /react-frontend/src/components/Form/FormInput.tsx: -------------------------------------------------------------------------------- 1 | import { get } from 'lodash' 2 | import React, { ReactHTML, ReactHTMLElement } from 'react' 3 | 4 | interface FormInputProps { 5 | id: string 6 | type?: string 7 | autofocus?: boolean 8 | placeholder?: string 9 | disabled? : boolean 10 | value: string|number 11 | errorMessages?: Array 12 | setOnChange?: (e: React.ChangeEvent) => void 13 | } 14 | 15 | export const FormInput = (props: FormInputProps) => { 16 | 17 | const handleChange = (e: React.ChangeEvent) => { 18 | const onChangeValue = props.setOnChange 19 | 20 | if (onChangeValue instanceof Function) return onChangeValue(e) 21 | } 22 | return ( 23 | <> 24 | handleChange(e)} 33 | className="block w-full rounded border shadow-sm border-gray-300 px-3 py-2 text-gray-900 focus:z-10 focus:border-red-500 focus:outline-none focus:ring-red-500 sm:text-sm disabled:bg-slate-50 disabled:text-slate-500 disabled:opacity-70" 34 | /> 35 | 36 | {(props.errorMessages && props.errorMessages.length > 0) ? 37 | props.errorMessages.map((errorMessage) => { 38 | 39 | {errorMessage} 40 | 41 | } ) 42 | : 43 | '' 44 | } 45 | 46 | ) 47 | } 48 | 49 | -------------------------------------------------------------------------------- /react-frontend/src/components/Form/FormLabel.tsx: -------------------------------------------------------------------------------- 1 | import { get } from 'lodash' 2 | import React from 'react' 3 | 4 | interface FormLabelProps { 5 | forId: string 6 | labelText: string 7 | } 8 | export const FormLabel = (props: FormLabelProps) => { 9 | return ( 10 | 13 | ) 14 | } 15 | 16 | -------------------------------------------------------------------------------- /react-frontend/src/components/Form/FormLink.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Link } from 'react-router-dom' 3 | 4 | 5 | interface FormLinkProps { 6 | children: React.ReactNode 7 | path: string 8 | } 9 | 10 | export const FormLink = (props: FormLinkProps) => { 11 | 12 | return ( 13 | 17 | {props.children} 18 | 19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /react-frontend/src/components/Layout/AvoRedApp.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { Header } from '../Header' 3 | import { FlashMessage } from './FlashMessage' 4 | 5 | 6 | interface AvoRedAppProps { 7 | children: React.ReactNode 8 | } 9 | 10 | 11 | 12 | export const AvoRedApp = (props: AvoRedAppProps) => { 13 | return ( 14 |
15 |
16 | 17 | {props.children} 18 |
19 | ) 20 | } 21 | -------------------------------------------------------------------------------- /react-frontend/src/components/Layout/Card.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { CardContent } from './CardContent' 3 | import { CardTitle } from './CardTitle' 4 | 5 | interface CardProps { 6 | children: React.ReactNode 7 | } 8 | export const Card = (props: CardProps) => { 9 | return ( 10 | <> 11 |
12 | {props.children} 13 |
14 | 15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /react-frontend/src/components/Layout/CardContent.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | 4 | 5 | interface CardContentProps { 6 | children: React.ReactNode 7 | } 8 | 9 | export const CardContent = (props: CardContentProps) => { 10 | return ( 11 |
12 | {props.children} 13 |
14 | ) 15 | } 16 | -------------------------------------------------------------------------------- /react-frontend/src/components/Layout/CardTitle.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | 3 | interface CardTitleProps { 4 | children: React.ReactNode 5 | } 6 | 7 | 8 | export const CardTitle = (props: CardTitleProps) => { 9 | return ( 10 |
11 |
12 | {props.children} 13 |
14 |
15 | ) 16 | } 17 | -------------------------------------------------------------------------------- /react-frontend/src/components/ProductCard.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Link } from "react-router-dom"; 3 | import { Product } from "../types/ProductType"; 4 | 5 | type ProductProp = { 6 | product: Product 7 | } 8 | 9 | export const ProductCard = ({product}: ProductProp ) => { 10 | 11 | return ( 12 |
13 |
14 | 15 | Front of men's Basic Tee in black. 20 | 21 |
22 |
23 |
24 |

25 | 26 | 27 | {product.name} 28 | 29 |

30 |
31 |

${product.price}

32 |
33 |
34 | ); 35 | }; 36 | -------------------------------------------------------------------------------- /react-frontend/src/features/cart/cartSlice.ts: -------------------------------------------------------------------------------- 1 | import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit'; 2 | import { RootState } from '../../app/store'; 3 | 4 | export interface CartState { 5 | visitor_id: string 6 | } 7 | 8 | const initialState: CartState = { 9 | visitor_id: '' 10 | }; 11 | 12 | export const cartSlice = createSlice({ 13 | name: 'cart', 14 | initialState, 15 | reducers: { 16 | setVisitorId: (state, action: PayloadAction) => { 17 | state.visitor_id = action.payload; 18 | }, 19 | 20 | }, 21 | 22 | }); 23 | 24 | export const { setVisitorId } = cartSlice.actions; 25 | 26 | export const visitorId = (state: RootState) => state.cart.visitor_id; 27 | 28 | 29 | export default cartSlice.reducer; 30 | -------------------------------------------------------------------------------- /react-frontend/src/features/checkout/checkoutSlice.ts: -------------------------------------------------------------------------------- 1 | import { createAsyncThunk, createSlice, PayloadAction } from '@reduxjs/toolkit'; 2 | import { RootState } from '../../app/store'; 3 | 4 | export interface CheckoutState { 5 | customer_id: string 6 | shipping_address_id: string 7 | billing_address_id: string 8 | shipping_option: string 9 | payment_option: string 10 | } 11 | 12 | const initialState: CheckoutState = { 13 | customer_id: '', 14 | shipping_address_id: '', 15 | billing_address_id: '', 16 | shipping_option: '', 17 | payment_option: '' 18 | }; 19 | 20 | export const checkoutSlice = createSlice({ 21 | name: 'checkout', 22 | initialState, 23 | reducers: { 24 | setCustomerId: (state, action: PayloadAction) => { 25 | state.customer_id = action.payload; 26 | }, 27 | setShippingAddressId: (state, action: PayloadAction) => { 28 | state.shipping_address_id = action.payload; 29 | }, 30 | setBillingAddressId: (state, action: PayloadAction) => { 31 | state.billing_address_id = action.payload; 32 | }, 33 | setShippingOption: (state, action: PayloadAction) => { 34 | state.shipping_option = action.payload; 35 | }, 36 | setPaymentOption: (state, action: PayloadAction) => { 37 | state.payment_option = action.payload; 38 | }, 39 | }, 40 | 41 | }); 42 | 43 | export const { 44 | setCustomerId, 45 | setShippingAddressId, 46 | setBillingAddressId, 47 | setShippingOption, 48 | setPaymentOption 49 | } = checkoutSlice.actions; 50 | 51 | export const getCheckoutInformation = (state: RootState) => state.checkout; 52 | export const getCheckoutCustomerId = (state: RootState) => state.checkout.customer_id; 53 | export const getCheckoutShippingAddressId = (state: RootState) => state.checkout.shipping_address_id; 54 | export const getCheckoutBillingAddressId = (state: RootState) => state.checkout.billing_address_id; 55 | export const getCheckoutShippingOption = (state: RootState) => state.checkout.shipping_option; 56 | export const getCheckoutPaymentOption = (state: RootState) => state.checkout.payment_option; 57 | 58 | 59 | export default checkoutSlice.reducer; 60 | -------------------------------------------------------------------------------- /react-frontend/src/features/counter/Counter.module.css: -------------------------------------------------------------------------------- 1 | .row { 2 | display: flex; 3 | align-items: center; 4 | justify-content: center; 5 | } 6 | 7 | .row > button { 8 | margin-left: 4px; 9 | margin-right: 8px; 10 | } 11 | 12 | .row:not(:last-child) { 13 | margin-bottom: 16px; 14 | } 15 | 16 | .value { 17 | font-size: 78px; 18 | padding-left: 16px; 19 | padding-right: 16px; 20 | margin-top: 2px; 21 | font-family: 'Courier New', Courier, monospace; 22 | } 23 | 24 | .button { 25 | appearance: none; 26 | background: none; 27 | font-size: 32px; 28 | padding-left: 12px; 29 | padding-right: 12px; 30 | outline: none; 31 | border: 2px solid transparent; 32 | color: rgb(112, 76, 182); 33 | padding-bottom: 4px; 34 | cursor: pointer; 35 | background-color: rgba(112, 76, 182, 0.1); 36 | border-radius: 2px; 37 | transition: all 0.15s; 38 | } 39 | 40 | .textbox { 41 | font-size: 32px; 42 | padding: 2px; 43 | width: 64px; 44 | text-align: center; 45 | margin-right: 4px; 46 | } 47 | 48 | .button:hover, 49 | .button:focus { 50 | border: 2px solid rgba(112, 76, 182, 0.4); 51 | } 52 | 53 | .button:active { 54 | background-color: rgba(112, 76, 182, 0.2); 55 | } 56 | 57 | .asyncButton { 58 | composes: button; 59 | position: relative; 60 | } 61 | 62 | .asyncButton:after { 63 | content: ''; 64 | background-color: rgba(112, 76, 182, 0.15); 65 | display: block; 66 | position: absolute; 67 | width: 100%; 68 | height: 100%; 69 | left: 0; 70 | top: 0; 71 | opacity: 0; 72 | transition: width 1s linear, opacity 0.5s ease 1s; 73 | } 74 | 75 | .asyncButton:active:after { 76 | width: 0%; 77 | opacity: 1; 78 | transition: 0s; 79 | } 80 | -------------------------------------------------------------------------------- /react-frontend/src/features/counter/Counter.tsx: -------------------------------------------------------------------------------- 1 | import React, { useState } from 'react'; 2 | 3 | import { useAppSelector, useAppDispatch } from '../../app/hooks'; 4 | import { 5 | decrement, 6 | increment, 7 | incrementByAmount, 8 | incrementAsync, 9 | incrementIfOdd, 10 | selectCount, 11 | } from './counterSlice'; 12 | import styles from './Counter.module.css'; 13 | 14 | export function Counter() { 15 | const count = useAppSelector(selectCount); 16 | const dispatch = useAppDispatch(); 17 | const [incrementAmount, setIncrementAmount] = useState('2'); 18 | 19 | const incrementValue = Number(incrementAmount) || 0; 20 | 21 | return ( 22 |
23 |
24 | 31 | {count} 32 | 39 |
40 |
41 | setIncrementAmount(e.target.value)} 46 | /> 47 | 53 | 59 | 65 |
66 |
67 | ); 68 | } 69 | -------------------------------------------------------------------------------- /react-frontend/src/features/counter/counterAPI.ts: -------------------------------------------------------------------------------- 1 | // A mock function to mimic making an async request for data 2 | export function fetchCount(amount = 1) { 3 | return new Promise<{ data: number }>((resolve) => 4 | setTimeout(() => resolve({ data: amount }), 500) 5 | ); 6 | } 7 | -------------------------------------------------------------------------------- /react-frontend/src/features/flash/flashSlice.ts: -------------------------------------------------------------------------------- 1 | import { createSlice, PayloadAction } from '@reduxjs/toolkit'; 2 | import { RootState } from '../../app/store'; 3 | import { findLast } from 'lodash'; 4 | 5 | export interface FlashState { 6 | messages: Array 7 | } 8 | 9 | export interface FlashMessageState { 10 | message: string 11 | } 12 | 13 | const initialState: FlashState = { 14 | messages: [] 15 | }; 16 | 17 | export const flashSlice = createSlice({ 18 | name: 'flash', 19 | initialState, 20 | reducers: { 21 | setMessage: (state, action: PayloadAction) => { 22 | state.messages.push({message: action.payload}); 23 | }, 24 | removeLast: (state) => { 25 | state.messages = [] 26 | }, 27 | }, 28 | 29 | }); 30 | 31 | export const { setMessage, removeLast } = flashSlice.actions; 32 | 33 | export const lastFlashMessage = (state: RootState) => { 34 | if (state.flash.messages.length > 0) { 35 | return findLast(state.flash.messages) 36 | } 37 | 38 | return 39 | } 40 | 41 | 42 | export default flashSlice.reducer; 43 | -------------------------------------------------------------------------------- /react-frontend/src/graphql/mutation/auth/Login.graphql: -------------------------------------------------------------------------------- 1 | mutation CustomerLogin ( 2 | $password: String! 3 | $email: String 4 | ) { 5 | login ( 6 | email: $email 7 | password: $password 8 | ) { 9 | first_name 10 | last_name 11 | email 12 | image_path_url 13 | id 14 | created_at 15 | updated_at 16 | addresses { 17 | id 18 | type 19 | customer_id 20 | first_name 21 | last_name 22 | company_name 23 | address1 24 | address2 25 | postcode 26 | city 27 | state 28 | country_id 29 | phone 30 | created_at 31 | updated_at 32 | } 33 | token_info { 34 | token_type 35 | access_token 36 | expires_in 37 | refresh_token 38 | } 39 | } 40 | } -------------------------------------------------------------------------------- /react-frontend/src/index.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | @tailwind components; 3 | @tailwind utilities; -------------------------------------------------------------------------------- /react-frontend/src/index.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { createRoot } from "react-dom/client"; 3 | import { Provider } from "react-redux"; 4 | import { store } from "./app/store"; 5 | import App from "./App"; 6 | import "./index.css"; 7 | import { BrowserRouter } from "react-router-dom"; 8 | import { cacheExchange, createClient, dedupExchange, Provider as GraphqlProvider } from 'urql'; 9 | 10 | import {IntlProvider} from 'react-intl'; 11 | import French from './lang/fr.json'; 12 | import English from './lang/en.json'; 13 | import { useAppSelector } from "./app/hooks"; 14 | import { getAuthUserInfo } from "./features/userLogin/userLoginSlice"; 15 | import { get } from "lodash"; 16 | import { multipartFetchExchange } from "@urql/exchange-multipart-fetch"; 17 | 18 | const locale:string = "en"; 19 | 20 | let lang; 21 | if (locale === "en") { 22 | lang = English; 23 | } 24 | if (locale === "fr") { 25 | lang = French; 26 | } 27 | 28 | 29 | const graphQLUrl: string = process.env.REACT_APP_GRAPHQL_URL ?? 'http://localhost:8000/graphql' 30 | 31 | 32 | const client = createClient({ 33 | url: graphQLUrl, 34 | exchanges: [ 35 | dedupExchange, 36 | cacheExchange, 37 | multipartFetchExchange, 38 | ], 39 | fetchOptions: () => { 40 | const token = getToken() 41 | return { 42 | headers: { authorization: token ? `Bearer ${token}` : '' }, 43 | 44 | }; 45 | }, 46 | 47 | }); 48 | 49 | 50 | function getToken (): string|null { 51 | return localStorage.getItem('access_token') 52 | } 53 | 54 | 55 | const container = document.getElementById("root")!; 56 | const root = createRoot(container); 57 | 58 | root.render( 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | 70 | ); 71 | -------------------------------------------------------------------------------- /react-frontend/src/lang/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "avored_ecommerce_title": "Avored is a headless ecommerce for Laravel", 3 | "home_page" : "Home Page", 4 | "reset_password": "Reset password", 5 | "email_address": "Email Address", 6 | "edit_profile": "Edit Profile", 7 | "orders": "Orders", 8 | "addresses": "Addresses", 9 | "logout": "Logout", 10 | "first_name": "First Name", 11 | "last_name": "Last Name", 12 | "password": "Password", 13 | "user_addresses": "User Addresses", 14 | "create": "Create", 15 | "user_address_create": "Create User Address", 16 | "company_name": "Company Name", 17 | "phone": "Phone", 18 | "country_id": "Country", 19 | "postcode": "Postcode", 20 | "address1": "Address1", 21 | "address2": "Address2", 22 | "city": "City", 23 | "state": "State", 24 | "register_for_avored_account": "Register for avored account", 25 | "confirm_password": "Confirm Password", 26 | "sign_into_your_account": "Sign in to your account", 27 | "forgot_your_password": "Forgot your password?", 28 | "sign_in": "Sign in" 29 | 30 | } 31 | -------------------------------------------------------------------------------- /react-frontend/src/lang/fr.json: -------------------------------------------------------------------------------- 1 | { 2 | "home_page" : "French Home Page" 3 | } 4 | -------------------------------------------------------------------------------- /react-frontend/src/pages/Product.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { useQuery } from 'urql'; 3 | 4 | const AllCategories = ` 5 | query GetAllCategories { 6 | allCategory { 7 | id 8 | name 9 | slug 10 | } 11 | } 12 | `; 13 | interface Category { 14 | id: string, 15 | name: string, 16 | slug: string 17 | } 18 | 19 | export const Product = () => { 20 | const [result, reexecuteQuery] = useQuery({ 21 | query: AllCategories, 22 | }); 23 | 24 | const { data, fetching, error } = result; 25 | 26 | if (fetching) return

Loading...

; 27 | if (error) return

Oh no... {error.message}

; 28 | 29 | return ( 30 |
    31 | {data.allCategory.map((todo: Category) => ( 32 |
  • {todo.name}
  • 33 | ))} 34 |
35 | ); 36 | }; 37 | 38 | -------------------------------------------------------------------------------- /react-frontend/src/pages/user/Profile.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { FormattedMessage } from 'react-intl' 3 | import { Link } from 'react-router-dom' 4 | import { useAppSelector } from '../../app/hooks' 5 | import { getAuthUserInfo } from '../../features/userLogin/userLoginSlice' 6 | import { UserSidebar } from './UserSidebar' 7 | import { AvoRedApp } from '../../components/Layout/AvoRedApp' 8 | 9 | export const Profile = () => { 10 | 11 | const currentUserInfo = useAppSelector(getAuthUserInfo); 12 | 13 | return ( 14 | 15 |
16 |
17 |

18 | User Profile Page 19 |

20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 | Login Page 29 |
30 |
31 |
32 |
33 | 34 |
35 |
36 | {currentUserInfo.first_name} 37 |
38 |
39 |
40 |
41 | 42 |
43 |
44 | {currentUserInfo.last_name} 45 |
46 |
47 |
48 |
49 | 50 |
51 |
52 | {currentUserInfo.email} 53 |
54 |
55 | 56 |
57 |
58 |
59 |
60 |
61 |
62 | 63 | ) 64 | } 65 | -------------------------------------------------------------------------------- /react-frontend/src/pages/user/UserLogout.tsx: -------------------------------------------------------------------------------- 1 | import React, { useEffect } from 'react' 2 | import { useNavigate } from 'react-router-dom' 3 | import { useAppDispatch } from '../../app/hooks'; 4 | import { performUserLogout } from '../../features/userLogin/userLoginSlice'; 5 | 6 | export const UserLogout = () => { 7 | 8 | const navigate = useNavigate(); 9 | const dispatch = useAppDispatch(); 10 | 11 | useEffect(() => { 12 | dispatch(performUserLogout(true)) 13 | navigate("/login"); 14 | }, []); 15 | 16 | 17 | return (<>) 18 | } 19 | -------------------------------------------------------------------------------- /react-frontend/src/pages/user/UserOrders.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react' 2 | import { useAppSelector } from '../../app/hooks'; 3 | import { Header } from '../../components/Header' 4 | import { getAuthUserInfo } from '../../features/userLogin/userLoginSlice'; 5 | import { UserSidebar } from './UserSidebar' 6 | import { AvoRedApp } from '../../components/Layout/AvoRedApp'; 7 | 8 | export const UserOrders = () => { 9 | const currentUserInfo = useAppSelector(getAuthUserInfo); 10 | return ( 11 | 12 |
13 |
14 |

15 | User Orders 16 |

17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | 25 |
26 |
27 | User Orders 28 |
29 | 30 |
31 |
32 |
33 |
34 |
35 | ) 36 | } 37 | -------------------------------------------------------------------------------- /react-frontend/src/pages/user/UserSidebar.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Link } from "react-router-dom"; 3 | import { AuthUserState } from "../../features/userLogin/userLoginSlice"; 4 | 5 | interface UserSideBarProp { 6 | user: AuthUserState; 7 | } 8 | 9 | export const UserSidebar = (props: UserSideBarProp) => { 10 | return ( 11 | 12 |
13 |
14 | {`${props.user.first_name} 19 |
20 | 21 |
22 | Edit Profile 23 |
24 |
25 | Orders 26 |
27 |
28 | Addresses 29 |
30 | 31 |
32 | Logout 33 |
34 |
35 | ); 36 | }; 37 | -------------------------------------------------------------------------------- /react-frontend/src/react-app-env.d.ts: -------------------------------------------------------------------------------- 1 | /// 2 | -------------------------------------------------------------------------------- /react-frontend/src/routes/PrivateRoute.tsx: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import { Navigate, Outlet } from "react-router-dom"; 3 | import { useAppSelector } from "../app/hooks"; 4 | import { isAuth } from "../features/userLogin/userLoginSlice"; 5 | 6 | export const PrivateRoute = () => { 7 | // @todo change this and check the localstorage for auth token 8 | const auth: boolean = useAppSelector(isAuth); 9 | return auth ? : ; 10 | }; 11 | -------------------------------------------------------------------------------- /react-frontend/src/setupTests.ts: -------------------------------------------------------------------------------- 1 | // jest-dom adds custom jest matchers for asserting on DOM nodes. 2 | // allows you to do things like: 3 | // expect(element).toHaveTextContent(/react/i) 4 | // learn more: https://github.com/testing-library/jest-dom 5 | import '@testing-library/jest-dom/extend-expect'; 6 | -------------------------------------------------------------------------------- /react-frontend/src/types/ProductType.tsx: -------------------------------------------------------------------------------- 1 | export type Product = { 2 | name: string 3 | id: string 4 | __typename: string 5 | price: number 6 | main_image_url: string 7 | slug: string 8 | } 9 | -------------------------------------------------------------------------------- /react-frontend/tailwind.config.js: -------------------------------------------------------------------------------- 1 | /** @type {import('tailwindcss').Config} */ 2 | module.exports = { 3 | content: [ 4 | "./src/**/*.{js,jsx,ts,tsx}", 5 | ], 6 | theme: { 7 | extend: {}, 8 | }, 9 | plugins: [ 10 | require('@tailwindcss/forms'), 11 | ], 12 | } 13 | -------------------------------------------------------------------------------- /react-frontend/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "es5", 4 | "lib": [ 5 | "dom", 6 | "dom.iterable", 7 | "esnext" 8 | ], 9 | "allowJs": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "strict": true, 14 | "forceConsistentCasingInFileNames": true, 15 | "noFallthroughCasesInSwitch": true, 16 | "module": "esnext", 17 | "moduleResolution": "node", 18 | "resolveJsonModule": true, 19 | "isolatedModules": true, 20 | "noEmit": true, 21 | "jsx": "react-jsx" 22 | }, 23 | "include": [ 24 | "src" 25 | ] 26 | } 27 | -------------------------------------------------------------------------------- /src/App.vue: -------------------------------------------------------------------------------- 1 | 6 | 7 | 26 | -------------------------------------------------------------------------------- /src/assets/styles/main.css: -------------------------------------------------------------------------------- 1 | /** 2 | * This injects Tailwind's base styles, which is a combination of 3 | * Normalize.css and some additional base styles. 4 | * 5 | * You can see the styles here: 6 | * https://github.com/tailwindcss/tailwindcss/blob/master/css/preflight.css 7 | * 8 | * If using `postcss-import`, use this import instead: 9 | * 10 | * @import "tailwindcss/preflight"; 11 | */ 12 | @tailwind preflight; 13 | 14 | /** 15 | * This injects any component classes registered by plugins. 16 | * 17 | * If using `postcss-import`, use this import instead: 18 | * 19 | * @import "tailwindcss/components"; 20 | */ 21 | @tailwind components; 22 | 23 | /** 24 | * Here you would add any of your custom component classes; stuff that you'd 25 | * want loaded *before* the utilities so that the utilities could still 26 | * override them. 27 | * 28 | * Example: 29 | * 30 | * .btn { ... } 31 | * .form-input { ... } 32 | * 33 | * Or if using a preprocessor or `postcss-import`: 34 | * 35 | * @import "components/buttons"; 36 | * @import "components/forms"; 37 | */ 38 | 39 | /** 40 | * This injects all of Tailwind's utility classes, generated based on your 41 | * config file. 42 | * 43 | * If using `postcss-import`, use this import instead: 44 | * 45 | * @import "tailwindcss/utilities"; 46 | */ 47 | @tailwind utilities; 48 | 49 | /** 50 | * Here you would add any custom utilities you need that don't come out of the 51 | * box with Tailwind. 52 | * 53 | * Example : 54 | * 55 | * .bg-pattern-graph-paper { ... } 56 | * .skew-45 { ... } 57 | * 58 | * Or if using a preprocessor or `postcss-import`: 59 | * 60 | * @import "utilities/background-patterns"; 61 | * @import "utilities/skew-transforms"; 62 | */ 63 | -------------------------------------------------------------------------------- /src/assets/tailwind.css: -------------------------------------------------------------------------------- 1 | @tailwind base; 2 | 3 | @tailwind components; 4 | 5 | @tailwind utilities; 6 | 7 | 8 | .avored-input { 9 | @apply w-full px-3 py-2 ring-gray-300 ring-1 rounded shadow-sm appearance-none text-gray-700; 10 | } 11 | 12 | .avored-input:hover, .avored-input:active, .avored-input:focus { 13 | @apply ring-red-500 outline-none; 14 | } 15 | 16 | .lds-ellipsis { 17 | display: inline-block; 18 | position: relative; 19 | width: 100%; 20 | min-height: 20px; 21 | } 22 | 23 | .lds-ellipsis div { 24 | position: absolute; 25 | top: 0px; 26 | width: 15px; 27 | height: 15px; 28 | border-radius: 50%; 29 | background: #333; 30 | animation-timing-function: cubic-bezier(0, 1, 1, 0); 31 | } 32 | 33 | .lds-ellipsis div:nth-child(1) { 34 | left: 8px; 35 | animation: lds-ellipsis1 0.6s infinite; 36 | } 37 | 38 | .lds-ellipsis div:nth-child(2) { 39 | left: 8px; 40 | animation: lds-ellipsis2 0.6s infinite; 41 | } 42 | 43 | .lds-ellipsis div:nth-child(3) { 44 | left: 32px; 45 | animation: lds-ellipsis2 0.6s infinite; 46 | } 47 | 48 | .lds-ellipsis div:nth-child(4) { 49 | left: 56px; 50 | animation: lds-ellipsis3 0.6s infinite; 51 | } 52 | 53 | @keyframes lds-ellipsis1 { 54 | 0% { 55 | transform: scale(0); 56 | } 57 | 58 | 100% { 59 | transform: scale(1); 60 | } 61 | } 62 | 63 | @keyframes lds-ellipsis3 { 64 | 0% { 65 | transform: scale(1); 66 | } 67 | 68 | 100% { 69 | transform: scale(0); 70 | } 71 | } 72 | 73 | @keyframes lds-ellipsis2 { 74 | 0% { 75 | transform: translate(0, 0); 76 | } 77 | 78 | 100% { 79 | transform: translate(24px, 0); 80 | } 81 | } 82 | -------------------------------------------------------------------------------- /src/components/Pagination.vue: -------------------------------------------------------------------------------- 1 | 25 | 26 | 71 | -------------------------------------------------------------------------------- /src/components/account/AccountSideNav.vue: -------------------------------------------------------------------------------- 1 | 26 | -------------------------------------------------------------------------------- /src/components/catalog/AddToCart.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 74 | -------------------------------------------------------------------------------- /src/components/forms/AvoRedInput.vue: -------------------------------------------------------------------------------- 1 | 20 | 21 | 97 | -------------------------------------------------------------------------------- /src/components/layouts/Header.vue: -------------------------------------------------------------------------------- 1 | 47 | 48 | 69 | -------------------------------------------------------------------------------- /src/constants/index.ts: -------------------------------------------------------------------------------- 1 | export const AUTH_TOKEN = "access_token" 2 | export const CUSTOMER_LOGGED_IN = "customer_logged_in" 3 | export const CART_ITEM = "avored-cart-items" 4 | export const CART_TOKEN = "avored-cart-tokens" 5 | export const AUTH_TEST = "test" 6 | -------------------------------------------------------------------------------- /src/graphql/AddToCartMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const AddToCart = gql` 4 | mutation AddToCart( 5 | $slug: String! 6 | $qty: Float! 7 | $visitor_id: String 8 | ) { 9 | addToCart( 10 | slug: $slug 11 | qty: $qty 12 | visitor_id: $visitor_id 13 | ) { 14 | visitor_id 15 | product_id 16 | qty 17 | } 18 | } 19 | ` 20 | export default AddToCart 21 | -------------------------------------------------------------------------------- /src/graphql/AddressAllQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const AddressAllQuery = gql` 4 | query AddressAllQuery { 5 | allAddress { 6 | id 7 | type 8 | first_name 9 | last_name 10 | company_name 11 | phone 12 | address1 13 | address2 14 | city 15 | state 16 | postcode 17 | country_id 18 | created_at 19 | updated_at 20 | } 21 | } 22 | ` 23 | export default AddressAllQuery 24 | -------------------------------------------------------------------------------- /src/graphql/AddressCreate.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CreateAddress = gql` 4 | mutation CreateAddressMutation ( 5 | $type : String! 6 | $first_name: String! 7 | $last_name: String! 8 | $company_name: String 9 | $address1: String! 10 | $address2: String! 11 | $phone: String 12 | $city: String! 13 | $state: String! 14 | $postcode: String! 15 | $country_id: String! 16 | ) { 17 | createAddress ( 18 | type: $type 19 | first_name:$first_name 20 | last_name: $last_name 21 | company_name: $company_name 22 | address1: $address1 23 | phone: $phone 24 | address2: $address2 25 | postcode: $postcode 26 | city: $city 27 | state: $state 28 | country_id: $country_id 29 | ) { 30 | id 31 | customer_id 32 | type 33 | } 34 | } 35 | ` 36 | export default CreateAddress 37 | -------------------------------------------------------------------------------- /src/graphql/AddressQuery.ts: -------------------------------------------------------------------------------- 1 | 2 | 3 | import gql from 'graphql-tag' 4 | 5 | const AddressQuery = gql` 6 | query AddressQuery ( 7 | $addressId : String! 8 | ){ 9 | addressQuery( 10 | id: $addressId 11 | ) { 12 | id 13 | type 14 | first_name 15 | last_name 16 | company_name 17 | phone 18 | address1 19 | address2 20 | state 21 | city 22 | postcode 23 | country_id 24 | created_at 25 | updated_at 26 | } 27 | } 28 | 29 | ` 30 | export default AddressQuery 31 | -------------------------------------------------------------------------------- /src/graphql/CartItemAllQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CartItemAllQuery = gql` 4 | query CartItemAllQuery ( 5 | $visitor_id: String! 6 | ) { 7 | cartItems ( 8 | visitor_id: $visitor_id 9 | ) { 10 | visitor_id 11 | product_id 12 | product { 13 | id 14 | name 15 | slug 16 | price 17 | main_image_url 18 | } 19 | qty 20 | } 21 | } 22 | ` 23 | export default CartItemAllQuery 24 | -------------------------------------------------------------------------------- /src/graphql/CategoryAllQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CategoryAllQuery = gql` 4 | query CategoryAllQuery { 5 | allCategory { 6 | name 7 | slug 8 | } 9 | } 10 | ` 11 | export default CategoryAllQuery 12 | -------------------------------------------------------------------------------- /src/graphql/CountryOptionsQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CountryOptionsQuery = gql` 4 | query { 5 | countryOptions { 6 | label 7 | value 8 | } 9 | } 10 | ` 11 | export default CountryOptionsQuery 12 | -------------------------------------------------------------------------------- /src/graphql/CreateAddressMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CreateAddressMutation = gql` 4 | mutation CreateAddressMutation ( 5 | $type : String! 6 | $first_name: String! 7 | $last_name: String! 8 | $company_name: String 9 | $address1: String! 10 | $address2: String! 11 | $phone: String 12 | $city: String! 13 | $state: String! 14 | $postcode: String! 15 | $country_id: String! 16 | ) { 17 | createAddress ( 18 | type: $type 19 | first_name:$first_name 20 | last_name: $last_name 21 | company_name: $company_name 22 | address1: $address1 23 | phone: $phone 24 | address2: $address2 25 | postcode: $postcode 26 | city: $city 27 | state: $state 28 | country_id: $country_id 29 | ) { 30 | 31 | id 32 | customer_id 33 | type 34 | } 35 | } 36 | ` 37 | export default CreateAddressMutation 38 | -------------------------------------------------------------------------------- /src/graphql/CreateSubscriberMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CreateAddress = gql` 4 | mutation CreateSubscriberMutation ( 5 | $email: String! 6 | ) { 7 | CreateSubscriberMutation ( 8 | email: $email 9 | ) { 10 | 11 | id 12 | customer_id 13 | email 14 | status 15 | created_at 16 | updated_at 17 | } 18 | } 19 | ` 20 | export default CreateAddress 21 | -------------------------------------------------------------------------------- /src/graphql/CustomerEditMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CustomerEditMutation = gql` 4 | mutation CustomerEditMutation( 5 | $first_name: String!, 6 | $last_name: String!, 7 | ) { 8 | customerUpdate( 9 | first_name: $first_name, 10 | last_name: $last_name 11 | ) { 12 | first_name 13 | last_name 14 | } 15 | } 16 | ` 17 | export default CustomerEditMutation 18 | -------------------------------------------------------------------------------- /src/graphql/CustomerLoginMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CustomerLoginMutation = gql` 4 | mutation CustomerLogin ( 5 | $password: String! 6 | $email: String! 7 | ) { 8 | login ( 9 | email: $email 10 | password: $password 11 | ) { 12 | token_type 13 | access_token 14 | expires_in 15 | refresh_token 16 | } 17 | } 18 | ` 19 | export default CustomerLoginMutation 20 | -------------------------------------------------------------------------------- /src/graphql/CustomerRegister.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const CustomerRegister = gql` 4 | mutation CustomerRegistration ( 5 | $email: String! 6 | $password: String! 7 | $first_name: String! 8 | $last_name: String! 9 | $password_confirmation: String! 10 | ) { 11 | register ( 12 | first_name: $first_name, 13 | last_name: $last_name, 14 | email: $email, 15 | password: $password 16 | password_confirmation: $password_confirmation 17 | ) { 18 | access_token 19 | id 20 | } 21 | } 22 | ` 23 | export default CustomerRegister 24 | -------------------------------------------------------------------------------- /src/graphql/DeleteCartMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const DeleteCartMutation = gql` 4 | mutation DeleteCartMutation ( 5 | $slug: String! 6 | $visitor_id: String! 7 | ) { 8 | deleteCart( 9 | slug: $slug 10 | visitor_id: $visitor_id 11 | ) { 12 | visitor_id 13 | } 14 | } 15 | ` 16 | export default DeleteCartMutation 17 | -------------------------------------------------------------------------------- /src/graphql/ForgotPasswordMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const ForgotPasswordMutation = gql` 4 | mutation ForgotPasswordMutation ( 5 | $email: String! 6 | ){ 7 | forgotPassword ( 8 | email: $email 9 | ){ 10 | success 11 | message 12 | } 13 | } 14 | ` 15 | export default ForgotPasswordMutation 16 | -------------------------------------------------------------------------------- /src/graphql/GetCategory.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const GetCategoryQuery = gql` 4 | query GetCategoryQuery( 5 | $slug: String! 6 | $page : Int 7 | ) { 8 | category( 9 | slug: $slug 10 | page: $page 11 | ) { 12 | id 13 | name 14 | products { 15 | total 16 | per_page 17 | current_page 18 | from 19 | to 20 | last_page 21 | has_more_pages 22 | data { 23 | id 24 | slug 25 | name 26 | price 27 | main_image_url 28 | } 29 | } 30 | } 31 | } 32 | ` 33 | export default GetCategoryQuery 34 | -------------------------------------------------------------------------------- /src/graphql/GetCustomerQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const GetCustomerQuery = gql` 4 | query GetCustomer{ 5 | customerQuery { 6 | id 7 | first_name 8 | last_name 9 | email 10 | created_at 11 | updated_at 12 | addresses { 13 | id 14 | type 15 | first_name 16 | last_name 17 | company_name 18 | phone 19 | address1 20 | address2 21 | city 22 | state 23 | postcode 24 | country_id 25 | country_name 26 | created_at 27 | updated_at 28 | } 29 | } 30 | } 31 | ` 32 | export default GetCustomerQuery 33 | -------------------------------------------------------------------------------- /src/graphql/LatestProductQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const LatestProductQuery = gql` 4 | query LatestProductQuery { 5 | latestProductQuery { 6 | name 7 | slug 8 | main_image_url 9 | price 10 | } 11 | } 12 | ` 13 | export default LatestProductQuery 14 | -------------------------------------------------------------------------------- /src/graphql/LoginMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const LoginMutation = gql` 4 | mutation VisitorLogin{ 5 | login { 6 | token_type 7 | access_token 8 | expires_in 9 | refresh_token 10 | } 11 | } 12 | ` 13 | export default LoginMutation 14 | -------------------------------------------------------------------------------- /src/graphql/OrderAllQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const OrderAllQuery = gql` 4 | query AllOrders{ 5 | allOrders { 6 | id 7 | shipping_option 8 | payment_option 9 | order_status_name 10 | created_at 11 | updated_at 12 | } 13 | } 14 | ` 15 | export default OrderAllQuery 16 | -------------------------------------------------------------------------------- /src/graphql/OrderQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const OrderQuery = gql` 4 | query OrderQuery ($order_id : String!){ 5 | order ( 6 | id: $order_id 7 | ) { 8 | id 9 | shipping_option 10 | payment_option 11 | order_status_name 12 | created_at 13 | updated_at 14 | } 15 | } 16 | ` 17 | export default OrderQuery 18 | -------------------------------------------------------------------------------- /src/graphql/PaymentQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const PaymentQuery = gql` 4 | query PaymentQuery{ 5 | paymentQuery { 6 | name 7 | identifier 8 | view 9 | } 10 | } 11 | ` 12 | export default PaymentQuery 13 | -------------------------------------------------------------------------------- /src/graphql/PlaceOrder.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const PlaceOrder = gql` 4 | mutation PlaceOrderMutation ( 5 | $shipping_option: String! 6 | $payment_option: String! 7 | $shipping_address_id: String! 8 | $billing_address_id: String! 9 | ) { 10 | placeOrder ( 11 | shipping_option: $shipping_option 12 | payment_option: $payment_option 13 | shipping_address_id: $shipping_address_id 14 | billing_address_id: $billing_address_id 15 | ) { 16 | id 17 | shipping_option 18 | payment_option 19 | shipping_address_id 20 | billing_address_id 21 | track_code 22 | created_at 23 | updated_at 24 | } 25 | } 26 | ` 27 | export default PlaceOrder 28 | -------------------------------------------------------------------------------- /src/graphql/ProductQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const ProductQuery = gql` 4 | query ProductQuery ($slug: String!) { 5 | product(slug: $slug) { 6 | id 7 | name 8 | slug 9 | price 10 | description 11 | } 12 | } 13 | ` 14 | export default ProductQuery 15 | -------------------------------------------------------------------------------- /src/graphql/ResetPasswordMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const ResetPasswordMutation = gql` 4 | mutation ResetPassword( 5 | $token: String! 6 | $email: String! 7 | $password: String! 8 | $password_confirmation: String! 9 | ) { 10 | resetPassword( 11 | token: $token 12 | email: $email 13 | password: $password 14 | password_confirmation: $password_confirmation 15 | ) { 16 | success 17 | message 18 | } 19 | } 20 | ` 21 | export default ResetPasswordMutation 22 | -------------------------------------------------------------------------------- /src/graphql/ShippingQuery.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const ShippingQuery = gql` 4 | query ShippingQuery{ 5 | shippingQuery { 6 | name 7 | identifier 8 | view 9 | } 10 | } 11 | ` 12 | export default ShippingQuery 13 | -------------------------------------------------------------------------------- /src/graphql/UpdateAddressMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const UpdateAddressMutation = gql` 4 | mutation UpdateAddressMutation ( 5 | $id: String! 6 | $type : String! 7 | $first_name: String! 8 | $last_name: String! 9 | $company_name: String 10 | $address1: String! 11 | $address2: String! 12 | $phone: String 13 | $city: String! 14 | $state: String! 15 | $postcode: String! 16 | $country_id: String! 17 | ) { 18 | updateAddress ( 19 | id: $id 20 | type: $type 21 | first_name:$first_name 22 | last_name: $last_name 23 | company_name: $company_name 24 | address1: $address1 25 | phone: $phone 26 | address2: $address2 27 | postcode: $postcode 28 | city: $city 29 | state: $state 30 | country_id: $country_id 31 | ) { 32 | 33 | id 34 | customer_id 35 | type 36 | } 37 | } 38 | ` 39 | export default UpdateAddressMutation 40 | -------------------------------------------------------------------------------- /src/graphql/UpdateCartMutation.ts: -------------------------------------------------------------------------------- 1 | import gql from 'graphql-tag' 2 | 3 | const UpdateCartMutation = gql` 4 | mutation UpdateCartMutation ( 5 | $slug: String! 6 | $visitor_id: String! 7 | $qty: Float! 8 | ) { 9 | updateCart( 10 | slug: $slug 11 | visitor_id: $visitor_id 12 | qty: $qty 13 | ) { 14 | visitor_id 15 | product_id 16 | qty 17 | } 18 | } 19 | ` 20 | export default UpdateCartMutation 21 | -------------------------------------------------------------------------------- /src/i18n.ts: -------------------------------------------------------------------------------- 1 | import { createI18n } from 'vue-i18n' 2 | 3 | function loadLocaleMessages() { 4 | const locales = require.context('./locales', true, /[A-Za-z0-9-_,\s]+\.json$/i) 5 | const messages: any = {} 6 | locales.keys().forEach(key => { 7 | const matched = key.match(/([A-Za-z0-9-_]+)\./i) 8 | if (matched && matched.length > 1) { 9 | const locale = matched[1] 10 | messages[locale] = locales(key) 11 | } 12 | }) 13 | return messages 14 | } 15 | const i18n = createI18n({ 16 | legacy: false, 17 | locale: process.env.VUE_APP_I18N_LOCALE || 'en', 18 | fallbackLocale: process.env.VUE_APP_I18N_FALLBACK_LOCALE || 'en', 19 | messages: loadLocaleMessages() 20 | }) 21 | 22 | export default i18n 23 | -------------------------------------------------------------------------------- /src/layouts/App.vue: -------------------------------------------------------------------------------- 1 | 8 | 21 | -------------------------------------------------------------------------------- /src/layouts/Guest.vue: -------------------------------------------------------------------------------- 1 | 6 | 12 | -------------------------------------------------------------------------------- /src/locales/el.json: -------------------------------------------------------------------------------- 1 | { 2 | "avored": "AvoRed", 3 | "avored_tagline": "AvoRed μια ανοιχτού κώδικα υλοποίηση ηλεκτρονικού εμπορίου σε laravel", 4 | "categories": "Κατηγορίες", 5 | "signup_for_our_newsletter" : "Εγγραφείτε στο ενημερωτικό μας δελτίο", 6 | "enter_your_email_address": "Πληκτρολογήστε την διεύθυνση email σας", 7 | "notify_me": "Ειδοποιήστε με", 8 | "checkout_page": "Σελίδα Ολοκλήρωσης Αγοράς", 9 | "personal_information": "Προσωπικές Πληροφορίες", 10 | "first_name": "Όνομα", 11 | "last_name": "Επώνυμο", 12 | "email": "Διεύθυνση Email", 13 | "password": "Κωδικός Πρόσβασης", 14 | "password_confirmation": "Επιβεβαίωση Κωδικού Πρόσβασης", 15 | "shipping_information": "Πληροφορίες Αποστολής", 16 | "company_name": "Επωνυμία Εταιρείας", 17 | "address1": "Διεύθυνση 1", 18 | "address2": "Διεύθυνση 2", 19 | "country": "Χώρα", 20 | "state": "Πολιτεία", 21 | "postcode": "Ταχ. Κώδικας", 22 | "city": "Πόλη", 23 | "shipping_address": "Διεύθυνση Αποστολής", 24 | "billing_address": "Διεύθυνση Χρέωσης", 25 | "delivery_method": "Τρόπος Αποστολής", 26 | "payment_method": "Τρόπος Πληρωμής", 27 | "cart_items": "Αντικείμενα Καλαθιού", 28 | "place_order": "Τοποθετήστε την Παραγγελία", 29 | "order_summary": "Σύψοψη Παραγγελίας", 30 | "items": "αντικείμενα", 31 | "shopping_cart": "Καλάθι Αγορών", 32 | "product_details": "Πληροφορίες Προϊόντος", 33 | "quantity": "Ποσότητα", 34 | "total": "Σύνολο", 35 | "continue_shopping": "Συνεχίστε τις αγορές σας", 36 | "price": "Τιμή", 37 | "checkout": "Ολοκλήρωση αγοράς", 38 | "edit": "Επεξεργασία", 39 | "update_profile": "Ενημέρωση Προφίλ", 40 | "login": "Σύνδεση", 41 | "forgot_your_password": "Ξεχάσατε τον κωδικό σας;", 42 | "dont_have_account_with_us": "Δεν έχετε λογαριασμό;", 43 | "register": "Εγγραφείτε", 44 | "already_have_account_with_us": "Έχετε ήδη λογαριασμό;", 45 | "address_information": "Πληροφορίες Διεύθυνσης", 46 | "create": "Δημιουργία", 47 | "save_address_information": "Αποθήκευση Πληροφοριών Διεύθυνσης", 48 | "address_type": "Τύπος Διεύθυνσης", 49 | "shipping": "Αποστολή", 50 | "billing": "Τιμολόγηση", 51 | "save_address": "Αποθήκευση Διεύθυνσης", 52 | "phone": "Τηλέφωνο", 53 | "reset_password": "Επαναφορά Κωδικού Πρόσβασης", 54 | "new_password": "Νέος Κωδικός Πρόσβασης", 55 | "submit": "Υποβολή", 56 | "remove": "Αφαίρεση", 57 | "add_to_cart": "ΠροσθήκηΣτοΚαλάθι", 58 | "shipping_option": "Επιλογή Αποστολής", 59 | "payment_option": "Επιλογή Πληρωμής", 60 | "created_at": "Δημιουργήθηκε την", 61 | "previous": "Προηγούμενο", 62 | "next": "Επόμενο", 63 | "pagination_result_text": "Εμφανίζονται {from} έως {to} από {total} αποτελέσματα", 64 | "checkout_success_page": "Επιτυχής Ολοκλήρωση Αγοράς", 65 | "success_order_placed_message": "Η Παραγγελία σας έχει καταχωρηθεί. Ο αριθμός παραγγελίας σας είναι: {order_id}" 66 | } 67 | -------------------------------------------------------------------------------- /src/locales/en.json: -------------------------------------------------------------------------------- 1 | { 2 | "avored": "AvoRed", 3 | "avored_tagline": "AvoRed an open source laravel e-commerce", 4 | "categories": "Categories", 5 | "signup_for_our_newsletter" : "Signup for our newsletter", 6 | "enter_your_email_address": "Enter your email address", 7 | "notify_me": "Notify me", 8 | "checkout_page": "Checkout Page", 9 | "personal_information": "Personal Information", 10 | "first_name": "First Name", 11 | "last_name": "Last Name", 12 | "email": "Email Address", 13 | "password": "Password", 14 | "password_confirmation": "Password Confirmation", 15 | "shipping_information": "Shipping Information", 16 | "company_name": "Company Name", 17 | "address1": "Address 1", 18 | "address2": "Address 2", 19 | "country": "Country", 20 | "state": "State", 21 | "postcode": "Postcode", 22 | "city": "City", 23 | "shipping_address": "Shipping Address", 24 | "billing_address": "Billing Address", 25 | "delivery_method": "Delivery method", 26 | "payment_method": "Payment method", 27 | "cart_items": "Cart Items", 28 | "place_order": "Place Order", 29 | "order_summary": "Order Summary", 30 | "items": "items", 31 | "shopping_cart": "Shopping cart", 32 | "product_details": "Product details", 33 | "quantity": "Quantity", 34 | "total": "Total", 35 | "continue_shopping": "Continue Shopping", 36 | "price": "Price", 37 | "checkout": "Checkout", 38 | "edit": "Edit", 39 | "update_profile": "Update Profile", 40 | "login": "Login", 41 | "forgot_your_password": "Forgot your password?", 42 | "dont_have_account_with_us": "Don't have an account with us?", 43 | "register": "Register", 44 | "already_have_account_with_us": "Already have an account with us?", 45 | "address_information": "Address Information", 46 | "create": "Create", 47 | "save_address_information": "Save Address Information", 48 | "address_type": "Address Type", 49 | "shipping": "Shipping", 50 | "billing": "Billing", 51 | "save_address": "Save Address", 52 | "phone": "Phone", 53 | "reset_password": "Reset Password", 54 | "new_password": "New Password", 55 | "submit": "Submit", 56 | "remove": "Remove", 57 | "add_to_cart": "AddToCart", 58 | "shipping_option": "Shipping Option", 59 | "payment_option": "Payment Option", 60 | "created_at": "Created at", 61 | "previous": "Previous", 62 | "next": "Next", 63 | "pagination_result_text": "Showing {from} to {to} of {total} results", 64 | "checkout_success_page": "Checkout Success", 65 | "success_order_placed_message": "Your Order has been placed. Your order no: {order_id}" 66 | } 67 | -------------------------------------------------------------------------------- /src/locales/pt-br.json: -------------------------------------------------------------------------------- 1 | { 2 | "avored": "AvoRed", 3 | "avored_tagline": "AvoRed é um E-Commerce open source em Laravel", 4 | "categories": "Categorias", 5 | "signup_for_our_newsletter" : "Se inscreva para nossa newsletter", 6 | "enter_your_email_address": "Insira seu endereço de E-Mail", 7 | "notify_me": "Notifique-me", 8 | "checkout_page": "Página de Check-Out", 9 | "personal_information": "Informação pessoal", 10 | "first_name": "Primeiro nome", 11 | "last_name": "Último nome", 12 | "email": "Endereço de E-Mail", 13 | "password": "Senha", 14 | "password_confirmation": "Confirmação de senha", 15 | "shipping_information": "Informação para envio", 16 | "company_name": "Nome da companhia", 17 | "address1": "Endereço 1", 18 | "address2": "Endereço 2", 19 | "country": "País", 20 | "state": "Estado", 21 | "postcode": "Código Postal", 22 | "city": "Cidade", 23 | "shipping_address": "Endereço de entrega", 24 | "billing_address": "Endereço de cobrança", 25 | "delivery_method": "Método de envio", 26 | "payment_method": "Método de pagamento", 27 | "cart_items": "Itens do carrinho", 28 | "place_order": "Finalizar pedido", 29 | "order_summary": "Resumo do pedido", 30 | "items": "itens", 31 | "shopping_cart": "Carrinho de compra", 32 | "product_details": "Detalhes do produto", 33 | "quantity": "Quantidade", 34 | "total": "Total", 35 | "continue_shopping": "Continue comprando", 36 | "price": "Preço", 37 | "checkout": "Check-Out", 38 | "edit": "Editar", 39 | "update_profile": "Atualizar perfil", 40 | "login": "Login", 41 | "forgot_your_password": "Esqueceu sua senha?", 42 | "dont_have_account_with_us": "Ainda não tem uma conta?", 43 | "register": "Registrar", 44 | "already_have_account_with_us": "Já possui uma conta?", 45 | "address_information": "Informação de endereço", 46 | "create": "Criar", 47 | "save_address_information": "Salvar informação de endereço", 48 | "address_type": "Tipo de endereço", 49 | "shipping": "Envio", 50 | "billing": "Cobrança", 51 | "save_address": "Salvar endereço", 52 | "phone": "Telefone", 53 | "reset_password": "Trocar senha", 54 | "new_password": "Nova senha", 55 | "submit": "Finalizar", 56 | "remove": "Remover", 57 | "add_to_cart": "Adicionar ao carrinho", 58 | "shipping_option": "Opção de envio", 59 | "payment_option": "Opção de pagamento", 60 | "created_at": "Criado a", 61 | "previous": "Anterior", 62 | "next": "Próximo", 63 | "pagination_result_text": "Mostrando {from} até {to} de {total} resultados", 64 | "checkout_success_page": "Check-Out finalizado", 65 | "success_order_placed_message": "Seu pedido foi realizado. Número de pedido: {order_id}" 66 | } 67 | -------------------------------------------------------------------------------- /src/main.ts: -------------------------------------------------------------------------------- 1 | import { createApp } from 'vue' 2 | import App from './App.vue' 3 | import router from './router' 4 | import store from './store' 5 | import i18n from './i18n' 6 | 7 | import './assets/tailwind.css' 8 | 9 | 10 | import urql from '@urql/vue' 11 | 12 | 13 | // import auth from './middleware/auth' 14 | 15 | const app = createApp(App) 16 | 17 | declare global { 18 | interface Window { x: any; } 19 | } 20 | 21 | 22 | 23 | app.use(store) 24 | app.use(router) 25 | app.use(i18n) 26 | app.use(urql, { 27 | url: process.env.VUE_APP_GRAPHQL_API_ENDPOINT || 'https://api.avored.com/graphql', 28 | fetchOptions: () => { 29 | // return auth.getToken().then((res) => { 30 | // //@todo fixed this 31 | // return res ? { headers: { Authorization: `Bearer ${res}` } } : {} 32 | // }) 33 | 34 | const token = localStorage.getItem('access_token') 35 | // while (token === null) { 36 | // setTimeout(() => { 37 | // auth.getToken() 38 | // }, 500); 39 | // } 40 | // const myToken = await auth.getToken() 41 | 42 | // console.info("ignore" + myToken) 43 | // const token = myToken// process.env.VUE_APP_ACCESS_TOKEN 44 | // console 45 | return token ? { headers: { Authorization: `Bearer ${token}` } } : {} 46 | }, 47 | }) 48 | 49 | app.mount('#app') 50 | -------------------------------------------------------------------------------- /src/middleware/auth.ts: -------------------------------------------------------------------------------- 1 | import { AUTH_TOKEN, CUSTOMER_LOGGED_IN } from '../constants/index' 2 | import isNil from 'lodash/isNil' 3 | import { useMutation, gql, useQuery } from "@urql/vue" 4 | import { NoUndefinedVariablesRule } from 'graphql' 5 | import GetCustomerQuery from "@/graphql/GetCustomerQuery" 6 | 7 | const TOKEN_IN_PROGRESS = 'token_in_progress' 8 | 9 | const isAuth = () : boolean => { 10 | const accessToken = localStorage.getItem(AUTH_TOKEN) 11 | 12 | return !isNil(accessToken) 13 | } 14 | const isCustomer = (): boolean => { 15 | 16 | const customerLoggedIn = localStorage.getItem(CUSTOMER_LOGGED_IN) 17 | 18 | return !isNil(customerLoggedIn) 19 | } 20 | const getToken = () => { 21 | // const tokenInProgress = localStorage.getItem(TOKEN_IN_PROGRESS) 22 | // localStorage.setItem(TOKEN_IN_PROGRESS, 'true') 23 | 24 | return localStorage.getItem('access_token') 25 | // if (tokenInProgress === null) { 26 | // const loginMutation = gql `mutation { 27 | // login { 28 | // token_type 29 | // access_token 30 | // expires_in 31 | // refresh_token 32 | // } 33 | // }` 34 | // const loginMutationRef = useMutation(loginMutation) 35 | // const myTestToken = await loginMutationRef.executeMutation({}).then((result) => { 36 | // console.log('auth', result) 37 | 38 | // return result.data.login.access_token 39 | // }) 40 | 41 | // console.log(myTestToken) 42 | // localStorage.setItem('access_token', myTestToken) 43 | // return myTestToken 44 | // const result = await loginMutationRef.executeMutation({}) 45 | // localStorage.removeItem(TOKEN_IN_PROGRESS) 46 | // } 47 | // 48 | // console.log(process.env.VUE_APP_ACCESS_TOKEN) 49 | //@todo fix this later on 50 | // return process.env.VUE_APP_ACCESS_TOKEN 51 | } 52 | 53 | export default { 54 | isAuth, 55 | getToken, 56 | isCustomer 57 | } 58 | -------------------------------------------------------------------------------- /src/middleware/guest.ts: -------------------------------------------------------------------------------- 1 | import { AUTH_TOKEN } from '../constants/index' 2 | import isNill from 'lodash/isNil' 3 | 4 | export default function() : boolean { 5 | const accessToken = localStorage.getItem(AUTH_TOKEN); 6 | 7 | return isNill(accessToken); 8 | } -------------------------------------------------------------------------------- /src/shims-vue.d.ts: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | declare module '*.vue' { 3 | import type { DefineComponent } from 'vue' 4 | const component: DefineComponent<{}, {}, any> 5 | export default component 6 | } 7 | -------------------------------------------------------------------------------- /src/store/index.ts: -------------------------------------------------------------------------------- 1 | import { createStore } from 'vuex' 2 | 3 | export default createStore({ 4 | state: { 5 | }, 6 | mutations: { 7 | }, 8 | actions: { 9 | }, 10 | modules: { 11 | } 12 | }) 13 | -------------------------------------------------------------------------------- /src/views/Home.vue: -------------------------------------------------------------------------------- 1 | 35 | 36 | 58 | -------------------------------------------------------------------------------- /src/views/OrderShow.vue: -------------------------------------------------------------------------------- 1 | 54 | 55 | 84 | -------------------------------------------------------------------------------- /src/views/Product.vue: -------------------------------------------------------------------------------- 1 | 38 | 39 | 75 | -------------------------------------------------------------------------------- /src/views/Success.vue: -------------------------------------------------------------------------------- 1 | 14 | 15 | 30 | -------------------------------------------------------------------------------- /src/views/auth/ForgotPassword.vue: -------------------------------------------------------------------------------- 1 | 52 | 53 | 54 | 94 | -------------------------------------------------------------------------------- /src/views/auth/Logout.vue: -------------------------------------------------------------------------------- 1 | 4 | -------------------------------------------------------------------------------- /tailwind.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | content: [], 3 | purge:["./src/**/*.vue"], 4 | theme: { 5 | extend: {}, 6 | }, 7 | plugins: [], 8 | } 9 | -------------------------------------------------------------------------------- /tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "compilerOptions": { 3 | "target": "esnext", 4 | "module": "esnext", 5 | "strict": true, 6 | "jsx": "preserve", 7 | "importHelpers": true, 8 | "moduleResolution": "node", 9 | "experimentalDecorators": true, 10 | "skipLibCheck": true, 11 | "esModuleInterop": true, 12 | "allowSyntheticDefaultImports": true, 13 | "sourceMap": true, 14 | "baseUrl": ".", 15 | "types": [ 16 | "webpack-env" 17 | ], 18 | "paths": { 19 | "@/*": [ 20 | "src/*" 21 | ] 22 | }, 23 | "lib": [ 24 | "esnext", 25 | "dom", 26 | "dom.iterable", 27 | "scripthost" 28 | ] 29 | }, 30 | "include": [ 31 | "src/**/*.ts", 32 | "src/**/*.tsx", 33 | "src/**/*.vue", 34 | "tests/**/*.ts", 35 | "tests/**/*.tsx" 36 | ], 37 | "exclude": [ 38 | "node_modules" 39 | ] 40 | } 41 | -------------------------------------------------------------------------------- /vue.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | publicPath: process.env.NODE_ENV === 'production' 3 | ? '/laravel-ecommerce/' 4 | : '/' 5 | } 6 | --------------------------------------------------------------------------------