Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[3.x] GraphQL checkout #503

Merged
merged 218 commits into from
Oct 23, 2024
Merged
Show file tree
Hide file tree
Changes from 179 commits
Commits
Show all changes
218 commits
Select commit Hold shift + click to select a range
623e0ba
Button with href tag fix
royduin Nov 1, 2023
2330199
Minicart better v-cloak position
royduin Nov 1, 2023
34c8118
WIP - GraphQL Cart
royduin Nov 3, 2023
d680d7d
Global cart store
royduin Nov 14, 2023
31d747a
Removed old todo
royduin Nov 14, 2023
a7174ef
Add products to the cart with GraphQL + improvements
royduin Nov 15, 2023
60bc78d
Add products with options to the cart with GraphQL
royduin Nov 16, 2023
39c2c02
Logged in users support
royduin Nov 16, 2023
778f260
Link guest to user on login with assignCustomerToGuestCart
royduin Nov 16, 2023
beb26d3
Notify users on expired cart or expired login
indykoning Nov 21, 2023
e4511dc
Uniform v-slot without destructing
royduin Nov 21, 2023
8dfcf79
Extracted the add to cart button
royduin Nov 21, 2023
2e89b96
Grouped products info from PHP instead of Vue
royduin Nov 21, 2023
ed3ccef
Extracted the product quantity select
royduin Nov 21, 2023
68230bd
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Nov 22, 2023
98f6f46
Set min, max and step if compadre is installed
indykoning Nov 24, 2023
9ebc30e
Apply fixes from Duster
indykoning Nov 24, 2023
9fbe688
Fix typo
indykoning Nov 24, 2023
6523fe9
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Nov 24, 2023
d9c9ce8
Apply fixes from Duster
indykoning Nov 24, 2023
0e0f103
Fix some errors
indykoning Nov 28, 2023
dce2eec
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Nov 28, 2023
c898886
Cleanup
royduin Nov 29, 2023
2bb7984
Add configurable products with their selected options
royduin Nov 29, 2023
d3e34e9
Removed unused mutation variable
royduin Nov 29, 2023
1b9ec51
Merge branch 'graphql-checkout' into tmp
royduin Nov 30, 2023
e721070
Merge pull request #389 from rapidez/tmp
royduin Nov 30, 2023
939ce03
Access custom attribute options in the cart
indykoning Nov 30, 2023
7b2c95b
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Nov 30, 2023
dee57cf
Migrating from Axios to Fetch
royduin Nov 30, 2023
28966f5
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
royduin Nov 30, 2023
078a09c
Migrating from Axios to Fetch
royduin Dec 1, 2023
99d4c49
Migrating from Axios to Fetch
royduin Dec 1, 2023
ef42d40
Feedback
indykoning Dec 1, 2023
72e5b28
Migrating from Axios to Fetch
royduin Dec 1, 2023
a925d0d
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
royduin Dec 1, 2023
981641d
Finish link user to cart
indykoning Dec 4, 2023
ca8a013
Remove getCart mixin
indykoning Dec 4, 2023
e9c1d5c
Update linters
indykoning Dec 4, 2023
eb13946
Apply fixes from Prettier
indykoning Dec 4, 2023
549fffc
Merge branch 'master' of github.com:rapidez/core into graphql-checkout
indykoning Dec 4, 2023
fac101c
Drop support for Laravel 9.x because of ComponentAttributeBag::hasAny
indykoning Dec 4, 2023
f1fee97
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Dec 4, 2023
ce05f04
Update matrix, fix duster error
indykoning Dec 4, 2023
6deb158
Apply fixes from Duster
indykoning Dec 4, 2023
e440527
Changed cart into a table
JimmyHoenderdaal Dec 5, 2023
88edf95
Remove 2.4.4 support as graphql is inconsistent there
indykoning Dec 5, 2023
fcce3da
Fix tests
indykoning Dec 5, 2023
66245fe
Wait longer for cart-content to show
indykoning Dec 5, 2023
b468da4
Fix order query when not using JWT
indykoning Dec 5, 2023
e2e9dfd
Apply fixes from Duster
indykoning Dec 5, 2023
768d722
Move autocomplete to fetch, login and logout to graphql
indykoning Dec 5, 2023
6018735
Apply fixes from Prettier
indykoning Dec 5, 2023
c2bd914
Apply suggestions from code review
royduin Dec 5, 2023
bbed909
Merge pull request #391 from JimmyHoenderdaal/feature/table-cart
royduin Dec 5, 2023
7a80060
Support file uploads in graphql (rapidez/magento2-compadre#1)
indykoning Dec 14, 2023
efeaf9d
Apply fixes from Duster
indykoning Dec 14, 2023
fec759c
[WIP] Raise test timeouts
indykoning Dec 15, 2023
3b8a8d1
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Dec 15, 2023
79e9982
[WIP] Lower timeout, expose ES
indykoning Dec 15, 2023
7126c41
[WIP] More logging
indykoning Dec 15, 2023
30c575e
Tests debugging
indykoning Dec 15, 2023
6d4020a
Temporarily remove v-cloak
indykoning Dec 15, 2023
2a08cde
Add more debugging
indykoning Dec 18, 2023
15de2da
Apply fixes from Duster
indykoning Dec 18, 2023
078d34f
Reduce tests to speed up debugging
indykoning Dec 18, 2023
c1db5b6
Get mask without window, update structure to be less dependent on get…
indykoning Dec 18, 2023
dcefe0e
Disable email communication
indykoning Dec 18, 2023
a405a3c
Link cart on overarching login
indykoning Dec 18, 2023
e70357a
Apply fixes from Prettier
indykoning Dec 18, 2023
7aad725
Merge branch 'master' of github.com:rapidez/core into graphql-checkout
indykoning Dec 18, 2023
a858de8
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Dec 18, 2023
a918837
Handle auth errors betteR
indykoning Dec 18, 2023
47f33e9
Apply fixes from Duster
indykoning Dec 18, 2023
ec80e57
Wait for checkout success
indykoning Dec 18, 2023
fea6d15
Apply fixes from Prettier
indykoning Dec 18, 2023
f72f8f8
Clearcart after refreshorder
indykoning Dec 18, 2023
d7202e6
run testbench path instead of artisan
indykoning Dec 18, 2023
d374ed3
Debug order on success
indykoning Dec 18, 2023
2e22a2f
Fix logged in, non-jwt, 404
indykoning Dec 18, 2023
15c3c0b
Transform expiration date into Date object
indykoning Dec 18, 2023
bc01ec3
Apply fixes from Prettier
indykoning Dec 18, 2023
e6aa76d
Wait until logout fully complete
indykoning Dec 18, 2023
698d48c
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Dec 18, 2023
dfd73ad
Always enter address
indykoning Dec 18, 2023
0c99f47
Remove debugging
indykoning Dec 19, 2023
e8748f2
Automatically match and fill custom attribute values
indykoning Jan 15, 2024
efac131
Apply fixes from Prettier
indykoning Jan 15, 2024
173049d
Merge branch 'master' of github.com:rapidez/core into graphql-checkout
indykoning Jan 30, 2024
59ab9bb
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Jan 30, 2024
2b3d85b
Merge branch 'master' of github.com:rapidez/core into graphql-checkout
indykoning Feb 14, 2024
9c5f077
Merge branch 'master' into graphql-checkout
royduin Feb 21, 2024
8597dd6
Pin compadre version
indykoning Feb 21, 2024
671ebd5
Drop support for Magento 2.4.4
indykoning Feb 21, 2024
e5eb2a2
GraphQL checkout WIP
royduin May 23, 2024
7887957
Apply fixes from Duster
royduin May 23, 2024
06b4383
Spaces
royduin May 23, 2024
4004590
Dev
royduin May 24, 2024
87d0fa2
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
royduin May 24, 2024
52e7589
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Jun 10, 2024
875aa36
Add functions to merge graphql queries, and automatically batch queries
indykoning Jun 11, 2024
5370d07
Apply fixes from Duster
indykoning Jun 11, 2024
1be98ea
Merge branch 'graphql-checkout' of github.com:rapidez/core into featu…
indykoning Jun 11, 2024
b2f3fea
Merge branch 'graphql-checkout' of github.com:rapidez/core into graph…
indykoning Jun 11, 2024
76fa318
Merge branch 'graphl-checkout' of github.com:rapidez/core into featur…
indykoning Jun 11, 2024
44eeea9
Fallback for missing name
indykoning Jun 11, 2024
15fa96a
Merge pull request #514 from indykoning/feature/combine-graphql-queries
royduin Jun 11, 2024
b475cdb
Implement login, register and submitting fieldset
indykoning Jun 13, 2024
e6e2047
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Jun 13, 2024
6d32485
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Jun 13, 2024
6ee93a1
Fix template
indykoning Jun 18, 2024
0bf46ec
Implement combining graphql
indykoning Jul 8, 2024
393217c
Apply fixes from Duster
indykoning Jul 8, 2024
f444ec5
Require fork allowing global variables
indykoning Jul 8, 2024
527cedd
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Jul 8, 2024
b582939
Use fragments for reusability
indykoning Jul 8, 2024
43c7ab2
Use fragments for reusability
indykoning Jul 8, 2024
f82c72d
Refactor to cookies for token & mask, implement server side login check
indykoning Jul 8, 2024
596a853
Apply fixes from Duster
indykoning Jul 8, 2024
91fb840
Fix version constraint
indykoning Jul 9, 2024
84e7642
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Jul 9, 2024
39491b7
Fix default selection of address and is same
indykoning Jul 9, 2024
67cdaa6
Apply fixes from Duster
indykoning Jul 9, 2024
27def2b
Prepare place order and checkout success
indykoning Jul 10, 2024
e30cc35
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Jul 10, 2024
64e3e2b
Apply fixes from Duster
indykoning Jul 10, 2024
7ca1f75
Prepare payment_method for custom psps
indykoning Jul 10, 2024
475e221
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Jul 10, 2024
f772f05
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Jul 16, 2024
6b8c7cd
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Jul 16, 2024
9d9b6fe
Set correct requirements
indykoning Jul 16, 2024
34c11b9
Update tests to composer.json versions
indykoning Jul 16, 2024
a7a39ea
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Jul 16, 2024
2475a88
L11 compatible phpunit env
indykoning Jul 16, 2024
a991849
Add todo
indykoning Jul 17, 2024
6c7b703
Remove meta refresh from templates
indykoning Jul 24, 2024
c10690c
Add todo for same as shipping
indykoning Jul 24, 2024
bd6982b
Clear order when leaving success page, accept nonexistent shipping ad…
indykoning Jul 24, 2024
6548ce0
Expect array instead of string
indykoning Jul 25, 2024
e018190
Add before place order hook
indykoning Jul 25, 2024
d347585
Bundle gql functions for ~100kb savings
indykoning Jul 25, 2024
fe01dd7
Fix selecting updated query
indykoning Jul 30, 2024
8ee2b48
Fix grouped product errors, redirect magento success to rapidez success
indykoning Aug 7, 2024
fba4338
Update order fragment for account centre
indykoning Aug 7, 2024
ff02d97
Add current order status
indykoning Aug 7, 2024
1e7c8ce
Add dusk selectors, fully qualified eventy path
indykoning Aug 8, 2024
8776aae
Synchronize add to cart functions
indykoning Aug 8, 2024
f7ad87f
Implement fetchCart
indykoning Aug 8, 2024
857f145
Drop support for <2.4.7 as middlename,prefix,suffix do not exist befo…
indykoning Aug 8, 2024
5c195cb
Remove mask cookie as well
indykoning Aug 8, 2024
e5c1a62
Apply fixes from Duster
indykoning Aug 8, 2024
a155559
Add dusk selector on pages
indykoning Aug 8, 2024
6509414
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Aug 8, 2024
f3c5f9d
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Aug 8, 2024
661dd8f
Only click the continue button
indykoning Aug 8, 2024
7f6a449
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Sep 10, 2024
8695efa
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Sep 18, 2024
974b7ff
Hide shipping address, shipping method, and same_as_shipping if cart …
indykoning Sep 19, 2024
26781d6
Add deprecation notices
indykoning Sep 19, 2024
4b50b1b
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Sep 19, 2024
3c8d68d
Show messages if order not successfully created
indykoning Sep 19, 2024
54faa0d
Update upload-artifact action
indykoning Sep 23, 2024
187d7a7
Improve tests, add onestepcheckout test
indykoning Sep 23, 2024
caa455f
Apply fixes from Duster
indykoning Sep 23, 2024
74674a0
Enter password before pressing continue
indykoning Sep 24, 2024
efb4baf
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Sep 24, 2024
8fc5e07
Separate checkout steps into functions
indykoning Sep 24, 2024
76cfb81
Apply fixes from Duster
indykoning Sep 24, 2024
2b6cb91
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Sep 24, 2024
6a629b2
Reorder setup
indykoning Sep 24, 2024
1db3da0
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Sep 24, 2024
272de28
Add missing slash
indykoning Sep 24, 2024
d24c1fc
Fix config
indykoning Sep 24, 2024
15c15f0
Reset original file during teardown
indykoning Sep 24, 2024
ea37857
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Sep 25, 2024
94c57ca
Remove L10 drop <2.4.6 support
indykoning Sep 25, 2024
edd6e68
Add exclusions for graphql files with blade
indykoning Sep 25, 2024
99a5ea1
Add missing exclusions
indykoning Sep 25, 2024
685a85a
Apply fixes from Prettier
indykoning Sep 25, 2024
4a97f2e
Migrated and re-added the progressbar
royduin Oct 2, 2024
12f2c07
Apply fixes from Duster
royduin Oct 2, 2024
90f2a18
Styling
royduin Oct 3, 2024
113e4a2
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
royduin Oct 3, 2024
17efdd0
Add events for GTM
indykoning Oct 4, 2024
37588f1
Apply fixes from Prettier
indykoning Oct 4, 2024
82523f4
Add samesite strict
indykoning Oct 14, 2024
8fb1f2d
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Oct 14, 2024
79a7d47
Move fragments, remove interactswithuser
indykoning Oct 14, 2024
2e54320
Apply fixes from Duster
indykoning Oct 14, 2024
8e23295
Drop support for Magento 2.4.5 (#589)
Jade-GG Oct 15, 2024
f4dc972
Update configComposer, automatically set street array length
indykoning Oct 15, 2024
1c78568
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Oct 15, 2024
cda3822
-p3 container is not available yet
indykoning Oct 15, 2024
d4f8925
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Oct 15, 2024
5257fc0
Apply fixes from Duster
indykoning Oct 15, 2024
8082689
Apply fixes from Prettier
rapidez-actions Oct 15, 2024
dcce582
Place submitfieldsets steps on separate lines
indykoning Oct 15, 2024
b0c8d6c
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Oct 15, 2024
2ca42b2
Remove commented out fields
indykoning Oct 15, 2024
c2bef41
Pass lines directly
indykoning Oct 15, 2024
e7a2613
Apply fixes from Prettier
indykoning Oct 15, 2024
7ca6813
Default street lines is actually 2
indykoning Oct 15, 2024
dd30c58
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Oct 15, 2024
f636ebb
Frontend - Graphql checkout fixes (#594)
Roene-JustBetter Oct 16, 2024
33be012
Support awaiting cart & customer refresh properly
indykoning Oct 16, 2024
e67071a
Apply fixes from Prettier
indykoning Oct 16, 2024
eb26815
Remove window function
indykoning Oct 16, 2024
70f4ffb
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Oct 16, 2024
0d9bcc0
Fix useCart
indykoning Oct 16, 2024
eaefe1f
Correct error message when placing an order fails (#599)
indykoning Oct 17, 2024
da3b81c
Update CHANGELOG
royduin Oct 17, 2024
938c5fa
Add checkoutagreements, add updateOrder callback
indykoning Oct 21, 2024
8b59608
Apply fixes from Duster
indykoning Oct 21, 2024
609b2f5
Merge branch '2.x' of github.com:rapidez/core into graphl-checkout
indykoning Oct 21, 2024
e0c4b39
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Oct 21, 2024
cf9c1eb
Apply fixes from Prettier
rapidez-actions Oct 21, 2024
b5c1f17
Merge branch 'graphl-checkout' of github.com:rapidez/core into graphl…
indykoning Oct 21, 2024
b1f98b8
Merge branch 'master' of github.com:rapidez/core into graphl-checkout
indykoning Oct 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 1 addition & 9 deletions .github/workflows/dusk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,6 @@ jobs:
fail-fast: false
matrix:
include:
- magento-version: 2.4.5-p9
magento-php-version: php81-fpm
rapidez-php-version: 8.2

- magento-version: 2.4.6-p7
magento-php-version: php82-fpm
rapidez-php-version: 8.2

- magento-version: 2.4.7-p2
magento-php-version: php82-fpm
rapidez-php-version: 8.2
Expand All @@ -37,7 +29,7 @@ jobs:
env:
URL: http://localhost:1234/
FLAT_TABLES: true
CUSTOM_ENTRYPOINT_COMMAND: "php bin/magento encryption:key:change -k 5AM3SD5SkwT8iwIxL6L1q8XQhzK3wk51; magerun2 config:store:set system/smtp/disable 1; magerun2 config:store:set checkout/options/enable_guest_checkout_login 1f"
CUSTOM_ENTRYPOINT_COMMAND: "php bin/magento encryption:key:change -k 5AM3SD5SkwT8iwIxL6L1q8XQhzK3wk51; magerun2 config:store:set system/smtp/disable 1; magerun2 config:store:set checkout/options/enable_guest_checkout_login 1"
ports:
- 3307:3306
- 9200:9200
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/phpunit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,12 @@ jobs:
strategy:
fail-fast: false
matrix:
php: [8.1, 8.2, 8.3]
laravel: [10.*, 11.*]
php: [8.2, 8.3]
laravel: [11.*]
stability: [prefer-lowest, prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*
exclude:
- laravel: 11.*
php: 8.1

services:
mysql:
Expand Down
15 changes: 15 additions & 0 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@
**/*.php
!**/*.blade.php
/resources/views/cart/queries/cart.graphql
/resources/views/cart/queries/fragments/cart.graphql
/resources/views/cart/queries/fragments/product.graphql
/resources/views/cart/queries/partials/customizable_options.graphql
/resources/views/checkout/queries/fragments/item.graphql
/resources/views/checkout/queries/fragments/order.graphql
/resources/views/checkout/queries/fragments/orderV2.graphql
/resources/views/checkout/queries/placeOrder.graphql
/resources/views/checkout/queries/setBillingAddressOnCart.graphql
/resources/views/checkout/queries/setExistingBillingAddressOnCart.graphql
/resources/views/checkout/queries/setExistingShippingAddressesOnCart.graphql
/resources/views/checkout/queries/setGuestEmailOnCart.graphql
/resources/views/checkout/queries/setNewBillingAddressOnCart.graphql
/resources/views/checkout/queries/setNewShippingAddressesOnCart.graphql
/resources/views/checkout/queries/setPaymentMethodOnCart.graphql
/resources/views/checkout/queries/setShippingMethodsOnCart.graphql
/resources/views/customer/queries/customer.graphql
indykoning marked this conversation as resolved.
Show resolved Hide resolved
composer.lock
CHANGELOG.md
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@
"php": "^8.1|^8.2|^8.3",
"blade-ui-kit/blade-heroicons": "^2.4",
"mailerlite/laravel-elasticsearch": "^11.1",
"illuminate/database": "^10.0|^11.0",
"illuminate/events": "^10.0|^11.0",
"illuminate/queue": "^10.0|^11.0",
"illuminate/support": "^10.0|^11.0",
"illuminate/database": "^11.0",
"illuminate/events": "^11.0",
"illuminate/queue": "^11.0",
"illuminate/support": "^11.0",
"lcobucci/clock": "^2.0|^3.2",
"lcobucci/jwt": "^4.0|^5.3",
"rapidez/blade-directives": "^0.6",
Expand Down
3 changes: 2 additions & 1 deletion config/rapidez/frontend.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@
// add different steps for different stores. Keep
// them lowercase and do not include any spaces.
'checkout_steps' => [
'default' => ['cart', 'login', 'credentials', 'payment', 'success'],
// 'default' => ['onestep'],
'default' => ['login', 'credentials', 'payment'],
],

'autocomplete' => [
Expand Down
11 changes: 8 additions & 3 deletions config/rapidez/routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,14 @@

// The fully qualified class names of the controllers.
'controllers' => [
'page' => Rapidez\Core\Http\Controllers\PageController::class,
'product' => Rapidez\Core\Http\Controllers\ProductController::class,
'category' => Rapidez\Core\Http\Controllers\CategoryController::class,
'category' => Rapidez\Core\Http\Controllers\CategoryController::class,
'checkout' => Rapidez\Core\Http\Controllers\CheckoutController::class,
'checkout-success' => Rapidez\Core\Http\Controllers\CheckoutSuccessController::class,
'fallback' => Rapidez\Core\Http\Controllers\FallbackController::class,
'healthcheck' => Rapidez\Core\Http\Controllers\HealthcheckController::class,
'page' => Rapidez\Core\Http\Controllers\PageController::class,
'product' => Rapidez\Core\Http\Controllers\ProductController::class,
'search' => Rapidez\Core\Http\Controllers\SearchController::class,
],

'fallback' => [
Expand Down
5 changes: 5 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
"@tailwindcss/typography": "^0.5.9",
"@vitejs/plugin-vue2": "^2.2.0",
"@vueuse/core": "^9.12.0",
"@vueuse/integrations": "^10.11.0",
"autoprefixer": "^10.4.15",
"cross-env": "^7.0.3",
"graphql": "^16.8.1",
"graphql-combine-query": "indykoning/graphql-combine-query#feature/add-allowed-duplicates",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this "ok" for now? Most likely it will never be merged, do we want to create and support our own package?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What are we going to do with this?

"graphql-tag": "^2.12.6",
"laravel-vite-plugin": "^0.7.3",
"postcss": "^8.4.29",
"postcss-import": "^15.1.0",
Expand All @@ -23,6 +27,7 @@
"rollup-plugin-visualizer": "^5.9.0",
"tailwind-scrollbar-hide": "^1.1.7",
"tailwindcss": "^3.3.3",
"universal-cookie": "^7.1.4",
"vite": "^4.0.4",
"vue": "^2.7",
"vue-clickaway": "^2.2.2",
Expand Down
4 changes: 4 additions & 0 deletions phpunit.dusk.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,15 @@
<env name="CRYPT_KEY" value="5AM3SD5SkwT8iwIxL6L1q8XQhzK3wk51"/>
<env name="APP_DEBUG" value="true"/>
<env name="VITE_DEBUG" value="true"/>
<env name="APP_MAINTENANCE_STORE" value="file"/>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3307"/>
<env name="DB_DATABASE" value="magento"/>
<env name="DB_USERNAME" value="magento"/>
<env name="DB_PASSWORD" value="password"/>
<env name="CACHE_STORE" value="file"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="file"/>
</php>
</phpunit>
4 changes: 4 additions & 0 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,15 @@
</coverage>
<php>
<env name="APP_ENV" value="testing"/>
<env name="APP_MAINTENANCE_STORE" value="file"/>
<env name="DB_CONNECTION" value="mysql"/>
<env name="DB_HOST" value="127.0.0.1"/>
<env name="DB_PORT" value="3307"/>
<env name="DB_DATABASE" value="magento-test"/>
<env name="DB_USERNAME" value="magento"/>
<env name="DB_PASSWORD" value="password"/>
<env name="CACHE_STORE" value="file"/>
<env name="QUEUE_CONNECTION" value="sync"/>
<env name="SESSION_DRIVER" value="file"/>
</php>
</phpunit>
106 changes: 106 additions & 0 deletions resources/js/callbacks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import { cart, clear as clearCart, getAttributeValues } from './stores/useCart'
import { fillFromGraphqlResponse as updateOrder, order } from './stores/useOrder'
import { runAfterPlaceOrderHandlers, runBeforePaymentMethodHandlers, runBeforePlaceOrderHandlers } from './stores/usePaymentHandlers'
import { refresh as refreshUser, token } from './stores/useUser'

Vue.prototype.scrollToElement = (selector) => {
Expand All @@ -13,7 +15,91 @@ Vue.prototype.getCheckoutStep = (stepName) => {
return (config.checkout_steps[config.store_code] ?? config.checkout_steps['default'])?.indexOf(stepName)
}

Vue.prototype.submitFieldsets = async function (form) {
let promises = []
form.querySelectorAll('[data-function]').forEach((fieldset) => {
if (!fieldset?.dataset?.function || !fieldset?.__vue__) {
return
}

promises.push(
fieldset.__vue__[fieldset?.dataset?.function]().then((result) => {
if (result === false) {
throw new Error()
}
}),
)
})

return await Promise.all(promises)
}

Vue.prototype.updateCart = async function (variables, response) {
cart.value = 'cart' in Object.values(response.data)[0] ? Object.values(response.data)[0].cart : Object.values(response.data)[0]

getAttributeValues().then((response) => {
if (!response?.data?.customAttributeMetadata?.items) {
return
}

const mapping = Object.fromEntries(
response.data.customAttributeMetadata.items.map((attribute) => [
attribute.attribute_code,
Object.fromEntries(attribute.attribute_options.map((value) => [value.value, value.label])),
]),
)

cart.value.items = cart.value.items.map((cartItem) => {
cartItem.product.attribute_values = {}

for (const key in mapping) {
cartItem.product.attribute_values[key] = cartItem.product[key]
if (cartItem.product.attribute_values[key] === null) {
continue
}

if (typeof cartItem.product.attribute_values[key] === 'string') {
cartItem.product.attribute_values[key] = cartItem.product.attribute_values[key].split(',')
}

if (typeof cartItem.product.attribute_values[key] !== 'object') {
cartItem.product.attribute_values[key] = [cartItem.product.attribute_values[key]]
}

cartItem.product.attribute_values[key] = cartItem.product.attribute_values[key].map((value) => mapping[key][value] || value)
}

return cartItem
})
})

return response.data
}

Vue.prototype.checkResponseForExpiredCart = async function (variables, response) {
if (
response?.errors?.some(
(error) =>
error.extensions.category === 'graphql-no-such-entity' &&
// Untested, but something like this is maybe a better idea as
// we're using a lot of different mutations in the checkout.
error.path.some((path) => path.toLowerCase().includes('cart')),
)
) {
Notify(window.config.translations.errors.cart_expired, 'error')
clearCart()
if (token.value !== undefined) {
// If the cart has expired, check if the session is not expired
refreshUser()
}

return true
}

return false
}

Vue.prototype.updateCart = async function (data, response) {
if (!response?.data) {
return response?.data
}
Expand Down Expand Up @@ -52,3 +138,23 @@ Vue.prototype.checkResponseForExpiredCart = async function (variables, response)

return false
}

Vue.prototype.handleBeforePaymentMethodHandlers = runBeforePaymentMethodHandlers
Vue.prototype.handleBeforePlaceOrderHandlers = runBeforePlaceOrderHandlers

Vue.prototype.handlePlaceOrder = async function (data, response) {
if (!response?.data) {
return response?.data
}

if (!response?.data?.placeOrder?.orderV2 && response?.data?.placeOrder?.errors) {
const message = response.data.placeOrder.errors.find(() => true).message
Notify(message, 'error')
throw new Error(message)
}

await updateOrder(data, response)
await runAfterPlaceOrderHandlers(response, this)

return response.data
}
Loading
Loading