Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into feature/js-minifi…
Browse files Browse the repository at this point in the history
…cations
  • Loading branch information
Jade-GG committed Dec 3, 2024
2 parents b639247 + 7baec26 commit b65572e
Show file tree
Hide file tree
Showing 96 changed files with 632 additions and 529 deletions.
42 changes: 42 additions & 0 deletions .github/workflows/analyse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: analyse

on:
push:
branches:
- master
- '*.x'
pull_request:

jobs:
analyse:
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
php: [8.3]
stability: [prefer-stable]
include:
- laravel: 10.*
testbench: 8.*
- laravel: 11.*
testbench: 9.*

steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.head_ref }}
token: ${{ secrets.RAPIDEZ_ACTIONS_ACCOUNT_PAT }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
extensions: dom, curl, libxml, mbstring, zip, pdo, sqlite, pdo_sqlite, bcmath, soap, intl, gd, exif, iconv, imagick, fileinfo
coverage: none

- name: Install dependencies
run: |
composer require "laravel/framework:${{ matrix.laravel }}" "orchestra/testbench:${{ matrix.testbench }}" --no-interaction --no-update
composer update --${{ matrix.stability }} --prefer-dist --no-interaction
- name: Analyse
run: composer analyse
9 changes: 2 additions & 7 deletions .prettierignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@
.git
**/*.php
!**/*.blade.php
/resources/views/cart/queries/*.graphql
/resources/views/cart/queries/**/*.graphql
/resources/views/checkout/queries/*.graphql
/resources/views/checkout/queries/**/*.graphql
/resources/views/customer/queries/*.graphql
/resources/views/customer/queries/**/*.graphql
composer.lock
/resources/views/*.graphql
/resources/views/**/*.graphql
CHANGELOG.md
59 changes: 58 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,63 @@
# Changelog

[Unreleased changes](https://github.com/rapidez/core/compare/2.14.0...2.14.0)
[Unreleased changes](https://github.com/rapidez/core/compare/2.18.2...2.18.2)
## [2.18.2](https://github.com/rapidez/core/releases/tag/2.18.2) - 2024-11-27

### Fixed

- Improved Vue/Turbo loading speed fix (#662)

## [2.18.1](https://github.com/rapidez/core/releases/tag/2.18.1) - 2024-11-27

### Fixed

- Typo (#658)

## [2.18.0](https://github.com/rapidez/core/releases/tag/2.18.0) - 2024-11-26

### Changed

- Improved Vue/Turbo loading speed (#653)

## [2.17.1](https://github.com/rapidez/core/releases/tag/2.17.1) - 2024-11-26

### Fixed

- Reduce forced reflow with the slider (#609)
- Clone address to remove reactivity (#656)

## [2.17.0](https://github.com/rapidez/core/releases/tag/2.17.0) - 2024-11-20

### Added

- Disable checkout button and add notice if not in stock (#627)

### Changed

- Apply middlewares from fallback routes (#643)

## [2.16.0](https://github.com/rapidez/core/releases/tag/2.16.0) - 2024-11-19

### Changed

- Resize path helper (#633, #648)
- Extracted login to a loginByToken function (#637)

### Fixed

- Image switching length fix (#641)
- Fix error of undefined when extensions is not set (#634)

## [2.15.0](https://github.com/rapidez/core/releases/tag/2.15.0) - 2024-10-23

### Added

- VAT change event (#606)

### Fixed

- Use correct object structure in PostCSS config (#611)

## [2.14.0](https://github.com/rapidez/core/releases/tag/2.14.0) - 2024-10-17

### Changed
Expand Down
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ Just run `./vendor/bin/phpunit`

### Browser tests

- Make sure you've got a Magento install running
- Prepare Laravel Dusk with `composer run dusk:prepare`
- Compile the assets with: `composer run dusk:assets` and re-run this when the assets are changed
- Tests can be started with: `composer run dusk:test`
- Make sure you've got a Magento install running
- Prepare Laravel Dusk with `composer run dusk:prepare`
- Compile the assets with: `composer run dusk:assets` and re-run this when the assets are changed
- Tests can be started with: `composer run dusk:test`

## License

Expand Down
9 changes: 7 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,20 +18,24 @@
"require": {
"php": "^8.1|^8.2|^8.3",
"blade-ui-kit/blade-heroicons": "^2.4",
"mailerlite/laravel-elasticsearch": "^11.1",
"illuminate/database": "^11.0",
"illuminate/events": "^11.0",
"illuminate/queue": "^11.0",
"illuminate/support": "^11.0",
"justbetter/laravel-http3earlyhints": "*",
"lcobucci/clock": "^2.0|^3.2",
"lcobucci/jwt": "^4.0|^5.3",
"rapidez/blade-directives": "^0.6",
"mailerlite/laravel-elasticsearch": "^11.1",
"rapidez/blade-components": "^1.0",
"rapidez/blade-directives": "^1.0",
"tormjens/eventy": "^0.8"
},
"require-dev": {
"larastan/larastan": "^2.9",
"laravel/dusk": "^8.2",
"orchestra/testbench": "^9.4",
"orchestra/testbench-dusk": "^9.7",
"phpstan/phpstan": "^1.12",
"phpunit/phpunit": "^10.5.34|^11.3.5"
},
"autoload": {
Expand Down Expand Up @@ -61,6 +65,7 @@
}
},
"scripts": {
"analyse": "phpstan --memory-limit=256M",
"dusk:prepare": [
"./vendor/bin/dusk-updater detect --auto-update",
"@php -r \"file_exists('phpunit.dusk.xml') || copy('phpunit.dusk.xml.dist', 'phpunit.dusk.xml'); \""
Expand Down
1 change: 1 addition & 0 deletions config/rapidez/models.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'attribute' => Rapidez\Core\Models\Attribute::class,
'product' => Rapidez\Core\Models\Product::class,
'category' => Rapidez\Core\Models\Category::class,
'customer_group' => Rapidez\Core\Models\CustomerGroup::class,
'category_product' => Rapidez\Core\Models\CategoryProduct::class,
'customer' => Rapidez\Core\Models\Customer::class,
'config' => Rapidez\Core\Models\Config::class,
Expand Down
5 changes: 5 additions & 0 deletions config/rapidez/routing.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,9 @@
// This does not cache the response, it caches the controller used for that page.
'cache_duration' => 3600,
],

// See: https://docs.rapidez.io/3.x/configuration.html#early-hints
'earlyhints' => [
'enabled' => env('EARLY_HINTS_ENABLED', true),
],
];
4 changes: 3 additions & 1 deletion lang/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@
"Shipping method": "Verzendmethode",
"Shipping": "Verzending",
"Show cart": "Bekijk winkelwagen",
"This product is out of stock, remove it to continue your order.": "Dit product is niet op voorraad, verwijder het om verder te gaan met je bestelling.",
"Out of stock": "Niet op voorraad",
"Show results": "Bekijk resultaten",
"Sign up for our newsletter to stay up to date.": "Meld je aan voor onze nieuwsbrief om op de hoogte te blijven.",
"Sorry! No image": "Sorry! Geen afbeelding",
Expand All @@ -97,7 +99,7 @@
"We will send a confirmation of your order to": "Wij zullen een confirmatie sturen naar",
"Wishlist": "Wensenlijst",
"Yes": "Ja",
"You don't have anything in your cart.": "Deze winkelwagen is leeg.",
"You don't have anything in your cart.": "Je hebt geen producten in je winkelwagen.",
"You have filtered for:": "Je hebt gefilterd op:",
"Your order is currently:": "Je bestelling is op dit moment:"
}
13 changes: 13 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
includes:
- ./vendor/larastan/larastan/extension.neon

parameters:
paths:
- src/
- tests/
- routes/
ignoreErrors:
- '#^Result of static method TorMorten\\Eventy\\Events::#'
- "#Access to an undefined property#"
- "#::waitUntilIdle#"
level: 1
6 changes: 4 additions & 2 deletions resources/css/app.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@import 'components/vue-slider';
@import 'components/price-slider';
@import './theme-variables.css';
@import './components/pagination.css';
@import 'components/pagination';

@tailwind base;
@tailwind components;
Expand All @@ -10,12 +9,15 @@
[v-cloak] {
display: none;
}

[v-blur] {
@apply animate-pulse blur;
}

* {
-webkit-tap-highlight-color: transparant;
}

listing {
/* Reset browser added styling causing unexpected behavior */
display: contents;
Expand Down
2 changes: 1 addition & 1 deletion resources/css/components/pagination.css
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
}

.pagination-button {
@apply !font-semibold !font-sans !border !border-border !rounded !bg-white !text-neutral !shadow;
@apply !font-semibold !font-sans !border !border-border !rounded !bg-white !text !shadow;
}

.pagination-button.active {
Expand Down
8 changes: 4 additions & 4 deletions resources/css/components/price-slider.css
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,23 @@ div.vue-slider {

div.vue-slider-process,
div.vue-slider-rail {
@apply h-2 bg-neutral !important;
@apply h-2 bg !important;
}

div.vue-slider-rail {
@apply bg-highlight !important;
@apply bg-emphasis !important;
}

div.vue-slider .vue-slider-dot {
@apply size-6 !important;
}

div.vue-slider-dot-tooltip-inner {
@apply bg-white text-neutral border-border border px-1.5 !important;
@apply bg-white text border border-default px-1.5 !important;
}

span.vue-slider-dot-tooltip-text {
@apply font-medium font-sans text-neutral;
@apply font-medium font-sans text;
}

div.vue-slider-dot-tooltip::before {
Expand Down
10 changes: 0 additions & 10 deletions resources/css/theme-variables.css

This file was deleted.

77 changes: 2 additions & 75 deletions resources/js/callbacks.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { cart, clear as clearCart, getAttributeValues } from './stores/useCart'
import { cart, clear as clearCart } 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'
Expand Down Expand Up @@ -35,53 +35,11 @@ Vue.prototype.submitPartials = async function (form) {
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' &&
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')),
Expand Down Expand Up @@ -115,37 +73,6 @@ Vue.prototype.updateOrder = async function (data, response) {
return response.data
}

Vue.prototype.checkResponseForExpiredCart = async function (variables, response) {
if (
response?.errors?.some(
(error) =>
error.extensions.category === 'graphql-no-such-entity' &&
error.path.some((path) =>
[
'cart',
'customerCart',
'assignCustomerToGuestCart',
'mergeCarts',
'addProductsToCart',
'removeItemFromCart',
'updateCartItems',
].includes(path),
),
)
) {
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.handleBeforePaymentMethodHandlers = runBeforePaymentMethodHandlers
Vue.prototype.handleBeforePlaceOrderHandlers = runBeforePlaceOrderHandlers

Expand Down
Loading

0 comments on commit b65572e

Please sign in to comment.