Author SHA1 Message Date
lexxandClaude Opus 5.5 f50ad504ff Chore: enable the boboko plugin and slim CLAUDE.md to 3dealer's own facts
The general front-end, localization and performance rules now live in
the boboko plugin's skills (re-skills marketplace). CLAUDE.md keeps the
Greek register, the design tokens, 3dealer specifics, and a map of
which skill covers what.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 18:58:40 +02:00
lexxandClaude Opus 5.5 81e70de70f Docs: bring CLAUDE.md, the transition roadmap and the README up to date
CLAUDE.md: localization now describes core's locale middleware,
$currentLocale/$altLocales and storefront.* Language Lines (there are
no lang/ files or SetLocale); the stack is Lunar 1.5, Postgres,
Meilisearch, Caddy, no Turbo; the design-reference section pointed at
files nobody has, and the component checklist was out of date.

CACHING-TRANSITION.md: records the 2026-11-06 changes (no Turbo, JSON
islands and writes, one bb_state cookie, prefetch instead of prerender),
a status table per task, the A4/A9 rework, and sources that the team
can actually reach.

README: known issues found while writing the boboko plugin.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 18:49:52 +02:00
lexxandClaude Opus 5.5 f9b2756456 Merge branch 'feature/core-mode-guard' into caching-transition
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 18:48:18 +02:00
lexx eed538964e Merge branch 'chore/claude-plugins' into caching-transition
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

# Conflicts:
#	package-lock.json
2026-11-06 18:48:18 +02:00
lexxandClaude Opus 5.5 5ea33a0857 Feature: block commits of boboko-core local-mode wiring
bin/check-core-mode runs as a pre-commit hook and refuses staged
composer.json, package.json or lockfiles that point at ../boboko-core,
which would break the build for everyone. bin/core-mode enables it via
core.hooksPath on first use, since git doesn't version hooks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 15:57:38 +02:00
lexxandClaude Opus 5.5 2d42d83851 Chore: enable re-skills Claude Code plugins at project scope
Shared project settings now only enable plugins from the re-skills
marketplace. Personal permissions belong in .claude/settings.local.json,
which is now gitignored.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-06 14:00:00 +02:00
elvira d5dc3290cf boboko core v 2026-11-03 21:29:05 +02:00
elvira efc2576c9e Merge branch 'master' into caching-transition 2026-11-03 21:26:34 +02:00
elviraandClaude Opus 5.5 4e4a02c4ed Checkout: theme cart and checkout to the v2 design
Restyles the boboko-core cart drawer, checkout and confirmation pages to
match the "cart - checkout v2" Pencil design (round radios, brand-green
selection, borders removed, larger notes and meta labels). strip-accents
now covers the module's uppercased buttons; vite.config.js comment fixed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 21:26:28 +02:00
elviraandClaude Opus 5.5 0e7fbaf504 Docs: caching transition roadmap (delete once the transition is done)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 21:24:09 +02:00
elviraandClaude Opus 5.5 0a516fa681 Deps: update composer packages, Filament assets and @boboko/core 0.31.3
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 21:24:03 +02:00
elviraandClaude Opus 5.5 f7e42f1056 Deps: update packages resolved by the dev entrypoint
docker/entrypoint.sh runs `composer update "boboko/*"
--with-all-dependencies` on boot; this is what it resolved, about 55
packages. boboko/core itself is unchanged. Mostly patch releases,
notably:
- laravel/framework v12.70.0 -> v12.70.2
- filament/* v4.15.2 -> v4.16.0 (published assets in public/ updated)
- livewire/livewire v3.8.10 -> v3.8.11
- stripe/stripe-php v16.6.0 -> v16.6.1
- spatie/laravel-medialibrary 11.23.10 -> 11.23.11
- symfony/* 7.4.x/8.1.x patch releases

Kept separate from the Caddy commit so it's easy to revert. Click
through the admin panel and a Stripe test checkout before deploying.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 01:53:45 +02:00
elviraandClaude Opus 5.5 6d88d53882 Infra: Caddy instead of nginx (plain swap, TLS stays in front)
Caddy 2.11.7 built with xcaddy, with caddy-ratelimit pinned to commit
5625512f (for M3/F7 later; its only tag is years old). Prod bakes
public/ and the config into the image (target caddy); dev uses the
caddy-base stage with docker/caddy and public/ bind-mounted.

It's a 1:1 swap for the host's TLS proxy: plain HTTP on
127.0.0.1:${APP_PORT:-8090}, auto_https off, and
trusted_proxies private_ranges so the proxy's X-Forwarded-* headers
still reach Laravel (checked: https + forwarded host in redirects, as
before). Narrow that range once it's known where TLS ends.

Carried over from nginx:
- php_fastcgi to app:9000, 300s read timeout, try_files to index.php
- /build, /static, /packages and /storage (from the storage volume)
  with Cache-Control "public, max-age=31536000, immutable"
- /sitemap.xml from storage/app, max-age=3600, application/xml
- X-Frame-Options SAMEORIGIN + X-Content-Type-Options nosniff
- 100 MiB upload limit (413 above, as before)
- dotfiles denied except /.well-known/
- /stoic/ proxied to stoic:2727, prefix stripped, cookie paths
  rewritten to /stoic/
- access log to stdout, favicon/robots not logged

Changed on purpose:
- FastCGI page cache dropped (and X-Cache-Status with it). The static
  page cache comes later (P2). It also replayed the first visitor's
  Set-Cookie (session + XSRF) to other guests, since it ignored
  Set-Cookie and keyed on URL only.
- New: zstd/gzip compression for text responses (nginx had none).
- Security headers now on every response; prod nginx dropped them on
  PHP responses and on 4xx/5xx.
- A missing file under the static paths is a plain 404 instead of
  Laravel's page with a 404 status.
- No Via or CGI Status header; one Content-Type on the sitemap (nginx
  sent two).
- Dropped as unneeded: open_file_cache, fastcgi buffers/keepalive,
  `charset utf-8` (Caddy's MIME types carry it where it matters).

Stoic's dev config called the app at http://nginx/validate; it's now
http://caddy/validate. bootstrap/app.php and .env.example comments
updated. docker/nginx/ is removed.

Not in this repo, not changed: boboko-test and the boboko starter
still use nginx.

Deploy note: the service is renamed nginx -> caddy; Envoy's
`up -d --remove-orphans` removes the old nginx container. Expect a few
seconds without a listener on 8090 while it swaps.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 01:01:13 +02:00
elviraandClaude Opus 5.5 f0a1b928dd Reviews: submit without a redirect, answered with Turbo Streams
The review form now submits through Turbo (data-turbo="true"; Drive
stays off) and storeReview answers with Turbo Streams instead of a
redirect with flashed data:
- success: the new review is prepended to the list (same Blade partial
  as the existing ones), the empty message is removed, the stars/count
  under the title and the tab label are updated (count and average from
  the DB, which is what the index builds them from), the form is removed
  and the thank-you goes into a live region and gets focus
- validation error: 422 + a stream that replaces the form with inline
  errors (aria-invalid/aria-describedby) and the entered values, focus on
  the first invalid field

Nothing on the product page reads the session any more: no
session('reviewSubmitted'), old() or $errors, and
mergeJustSubmittedReview and the justSubmittedReview flash are gone.
searchableSync() stays.

Without JS it's a plain POST that redirects back to ?tab=reviews,
without inline errors or the thank-you, and the new review shows once
Meilisearch catches up. The ?tab=reviews query parameter is noted in
the controller as a variant to handle once product pages are cached.

New: product/partials/review, product/partials/rating-summary,
product/streams/review-stored|review-invalid, and a small
focus-on-connect Stimulus controller that only appears on streamed
markup.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:09:58 +02:00
elviraandClaude Opus 5.5 c1acc0067c Layout: Speculation Rules, prerender on hover
A <script type="speculationrules"> in the layout prerenders same-origin
links with eagerness "moderate" (hover or press). Excluded:
- cart, checkout, account, login, logout, wishlist, contact and the
  future /islands, plus the admin (/boboko) and /stoic
- rel~=nofollow and [data-no-prerender]
- listing controls that load into a Turbo Frame (sort, filters,
  pagination): links inside a <turbo-frame> or pointing at one, unless
  they break out with data-turbo-frame="_top" like the product cards

Contact is excluded too, though the task didn't list it: it's a session
page with hCaptcha.

GA4 and a consent banner aren't in this repo, so no page-view delay on
document.prerendering is needed yet. Add one when they're added.

Watch production FPM after this deploy: until pages are cached, every
prerender is a full PHP render, and there are only 8 FPM workers.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:05:50 +02:00
elviraandClaude Opus 5.5 bad5a7db69 CSS: cross-document View Transitions
@view-transition { navigation: auto } inside prefers-reduced-motion:
no-preference, so page changes cross-fade in supporting browsers and
stay instant for visitors who ask for less motion. Turbo Frame listing
updates aren't document navigations and are unaffected.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:03:32 +02:00
elviraandClaude Opus 5.5 1ff55ac015 Deploy: turn view:cache back on
It was commented out by mistake. Same < /dev/null as its neighbours.
It compiles every view (vendor ones too) and runs cleanly locally, so no
views needed fixing.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:02:51 +02:00
elviraandClaude Opus 5.5 702609da1e Header: account and wishlist links no longer depend on login
Both links are now the same for every visitor, so the header can be
cached:
- Account always goes to route('account'); the auth middleware sends
  guests to login, and after login they land back on the account page
  (url.intended) instead of home.
- Wishlist always goes to route('wishlist'); WishlistController::guest
  already redirects logged-in users to account.wishlist.
- One neutral label, storefront.nav.account, on desktop and mobile.

header.blade.php no longer calls auth().

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:02:34 +02:00
elviraandClaude Opus 5.5 4fc7880187 Markup: stable island targets for wishlist, account link and CSRF meta
- x-wishlist-button gets data-wishlist-product on its form root; the
  server-rendered aria-pressed stays for now.
- Both header account links (desktop and mobile menu) share
  [data-account-link].
- The CSRF meta tag gets id="csrf-token".

No visible change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:01:42 +02:00
elviraandClaude Opus 5.5 6948c134e3 Header: give the cart badge a stable id for islands
The badge is absolute inside the fixed-size cart button, so showing it
or growing from 1 to 2 digits doesn't move the header. Adds #cart-badge
as a Turbo Stream target and records the rule that no island may change
the size of its container. cart-count-controller is unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 00:01:21 +02:00
elviraandClaude Opus 5.5 e4dccd0205 Contact: add privacy notice above the captcha
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:19:29 +02:00
elviraandClaude Opus 5.5 d31b423f2a Nav: move FAQ before Contact
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:19:29 +02:00
elviraandClaude Opus 5.5 87ff1c477f FAQ: animate answers open and closed
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:19:29 +02:00
elviraandClaude Opus 5.5 fb239a97cb Breadcrumbs: always start at Home, full category trail, BreadcrumbList JSON-LD
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:19:29 +02:00
elvira 9d7f92ebfc search console verification 2026-10-27 12:10:12 +02:00
elviraandClaude Opus 5.5 fff84f9a43 Send noindex, nofollow unless APP_INDEXABLE=true
Staging was crawlable. Opt-in flag rather than APP_ENV, since staging
runs with APP_ENV=production too. Set APP_INDEXABLE=true on the live
site only.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-27 12:07:20 +02:00
elvira b2f53ea952 improvements on faq page 2026-10-26 16:24:34 +02:00
elvira 1e4da2c8cc faq page 2026-10-26 16:06:55 +02:00
elvira 50ec0eebf2 temporary image handling and some responsive 2026-10-24 00:51:38 +03:00
elvira 0ae5f49bcf responsive design 2026-10-24 00:20:57 +03:00
elvira 9217960de0 Feat: Live search accessibility, no-results message and View all styling 2026-10-23 20:59:23 +03:00
arvanitakis d1d27a9ebd Chore: Bumping boboko/core to 0.31.1 2026-10-19 17:34:33 +03:00
arvanitakis 3bd8ce5aee Rebuilding css and js assets 2026-10-19 17:33:22 +03:00
arvanitakis 4f56edc4fc Feat: Adding Search prefixes to homepage search 2026-10-19 17:32:35 +03:00
arvanitakis 623851bd70 Adding elta-logo.png 2026-10-01 01:54:27 +03:00
arvanitakis 39eda9726d Chore: Bumping boboko/core to 0.31.0 2026-10-01 01:54:04 +03:00
arvanitakis f718ba57bc Chore: Bumping boboko/core to 0.30.0 2026-09-30 22:02:45 +03:00
arvanitakis 1de5668032 Chore: Bumping boboko/core to 0.29.3 2026-09-30 20:59:23 +03:00
arvanitakis 35bf421da8 Chore: Bumping boboko/core to 0.29.2 2026-09-30 19:51:59 +03:00
arvanitakis a7cdfbd1cb Feat: Order Controller updates 2026-09-30 19:50:03 +03:00
arvanitakis 92016256ce Feat: Adding core-mode and deploy scripts 2026-09-30 12:17:52 +03:00
arvanitakis b96fb2800f Chore: Bumping boboko/core to 0.28.0 2026-09-30 12:12:41 +03:00
arvanitakis d16ddd15eb Chore: Bumping boboko/core to 0.27.5 2026-09-30 11:39:09 +03:00
arvanitakis aff53371d9 Feat: Adding SESSION_SECURE_COOKIE for auth 2026-09-30 11:34:33 +03:00
arvanitakis 425510fb16 Fix: Updates on Middlewares, User hiding fields 2026-09-30 11:34:14 +03:00
arvanitakis e3f9b3deb1 Fix: Adding trust proxies, since file downloading cannot work, traffic in Laravel is plain HTTP, the file signed-route generation throws 401 2026-09-30 09:48:12 +03:00
elvira 72ff4e5c76 checkout css updates but still wip 2026-09-29 21:38:44 +03:00
elvira 5482ac07c6 removed repeated product text from view and added styling to trace it within product description 2026-09-29 19:23:40 +03:00
elvira 7e38f05650 product page: only show up down arrows when not all thumbnails are visible 2026-09-29 19:16:07 +03:00
arvanitakis df29429257 Fix: Adding new production nginx config 2026-09-29 17:34:08 +03:00
arvanitakis f6bcd31bd8 FIx: Reverting back root for stoic 2026-09-29 16:50:01 +03:00
arvanitakis 77c9117556 Fix: Removing root privileges from stoic, creating and giving 777 to stoic folder 2026-09-29 16:42:59 +03:00
arvanitakis 8fdb399386 Fix: Running stoic as root 2026-09-29 16:25:52 +03:00
elvira 47f250d27f Merge branch 'cart-temp' 2026-09-29 16:12:20 +03:00
arvanitakis 40c6b27ccb Bumping core to 0.27.2 2026-09-29 14:54:52 +03:00
arvanitakis db01151ca3 Bumping Core to 0.27.1 2026-09-29 14:35:42 +03:00
arvanitakis 9fcea8fb09 Feat: Adding php soap and favicon for boboko 2026-09-29 14:34:01 +03:00
arvanitakis 38e71927bc Bumping core version to 0.27.0 2026-09-29 01:15:00 +03:00
arvanitakis 70787ace44 Feat: Updating entrypoint and missing lunar translations! 2026-09-29 00:03:37 +03:00
arvanitakis 25021bdafb Fix: Correcting vector file name 2026-09-28 21:39:03 +03:00
arvanitakis 03b46e7bfb Fix: Removing publish from entrypoint 2026-09-28 20:55:22 +03:00
arvanitakis ec9ac92a95 Fix: un-gitignoring public assets 2026-09-28 20:53:46 +03:00
arvanitakis 8025bf2692 Feat: Adding vendor publish for nginx to be able to grab them 2026-09-28 20:38:46 +03:00
arvanitakis c48d3b1756 Fix: Publishing assets on prod 2026-09-28 20:10:41 +03:00
arvanitakis d053f57b10 Feat: Adding laravel envoy 2026-09-28 19:43:55 +03:00
elvira b522d60954 multilingual content, change in how we show header categories and homepage hero products 2026-09-28 19:42:35 +03:00
arvanitakis b38e190714 Feat: Removing OTEL collector files and adding victoria logs 2026-09-28 19:42:26 +03:00
arvanitakis d81adb4ddc Fix: Adding missing vector data 2026-09-28 19:35:03 +03:00
arvanitakis 094763fd86 Feat: Add vector image to boboko 2026-09-28 19:34:07 +03:00
arvanitakis a1a98c75c5 Adding cache store as redis on .env.example 2026-09-28 19:15:33 +03:00
arvanitakis fb5ec85c9f Feat: Adding vite build to dockerfile 2026-09-28 19:13:20 +03:00
arvanitakis e8054b2292 Feat: Adding Private Storage to dockerignore 2026-09-28 18:34:29 +03:00
elvira 60ae6cf7a6 Merge branch 'master' into cart-temp 2026-09-28 18:23:55 +03:00
elvira 296d6001cd lock files 2026-09-28 18:23:33 +03:00
elvira aa051525a1 stoic multilingual 2026-09-28 18:17:33 +03:00
arvanitakis b288513bb4 Feat: Adding stripe and boxnow variables to .env.example 2026-09-28 18:16:36 +03:00
arvanitakis 74930351f1 Commiting composer.lock and package-lock.json 2026-09-28 18:12:37 +03:00
arvanitakis 65d4603793 Merge branch 'cart-temp' 2026-09-28 18:09:29 +03:00
arvanitakis 023c11019c Fix: Aligning docker compose and Dockerfile with entrypoints 2026-09-28 18:04:23 +03:00
elvira 88d8ae0954 stoic settings and site meta and legal 2026-09-28 17:32:22 +03:00
elvira ca362f81c8 setup for stoic settings, changes in legal pages to use core's store details and contact page to show contact info next to form 2026-09-28 17:09:08 +03:00
arvanitakis 4634e14924 Feat: Moving seeders to core, updating entrypoint to auto seed the validation and checkout translations 2026-09-28 13:43:44 +03:00
arvanitakis 69486f65ee Feat: Adding Order reference to views 2026-09-28 13:31:29 +03:00
arvanitakis 060b6c647e Merge branch 'box-now-test-' into cart-temp 2026-09-28 10:11:26 +03:00
arvanitakis 36806cac5b Chore: Moving Wishlist from 3dealer to Core 2026-09-28 10:10:50 +03:00
arvanitakis b1162761de Fix: correct package.json for boboko/core npm integration 2026-09-28 08:54:09 +03:00
arvanitakis 8b362c9436 Feat: Correctly extracting boboko/core's js 2026-09-28 08:46:14 +03:00
arvanitakis cd45d8f578 Feat: Removing Controllers and Movong to core 2026-09-27 20:49:07 +03:00
elvira 8e186fc231 minor improvement in showing custom fields in product page and boboko-core sourced locally 2026-09-25 22:39:14 +03:00
arvanitakis a51ce78538 Merge branch 'cart-temp' into box-now-test- 2026-09-25 21:49:30 +03:00
elvira ab7e560a3d add to cart button disabled when 0 stock and newsletter form theming 2026-09-25 20:23:22 +03:00
arvanitakis 081893ef57 Feat: Removing Cart and Checkout from core 2026-09-25 20:22:38 +03:00
elvira e2d7bbb043 order emails theming, sold out product card, contact page hcaptcha 2026-09-25 17:44:42 +03:00
elvira 3347febb3c login hcaptcha 2026-09-25 16:19:56 +03:00
arvanitakis 78c8165c04 Feat: Box now tests 2026-09-17 19:55:39 +03:00
arvanitakis c7bd1efdaa Feature: Adding Meilisearch to 3dealer 2026-08-05 23:12:22 +03:00
309 changed files with 7554 additions and 6387 deletions

No files matched your search

+18
View File
@@ -0,0 +1,18 @@
{
"extraKnownMarketplaces": {
"re-skills": {
"source": {
"source": "git",
"url": "git@code.radical-elements.com:radical/re-skills.git"
},
"autoUpdate": true
}
},
"enabledPlugins": {
"design@re-skills": true,
"seo@re-skills": true,
"studio@re-skills": true,
"engineering@re-skills": true,
"boboko@re-skills": true
}
}
+1
View File
@@ -5,6 +5,7 @@ vendor
public/build public/build
public/hot public/hot
storage/app/public/* storage/app/public/*
storage/app/private/*
storage/framework/cache/* storage/framework/cache/*
storage/framework/sessions/* storage/framework/sessions/*
storage/framework/views/* storage/framework/views/*
+27 -9
View File
@@ -4,6 +4,8 @@ COMPOSE_PROJECT_NAME=3dealer
APP_NAME=Laravel APP_NAME=Laravel
APP_ENV=local APP_ENV=local
# Leave false everywhere except the live site (sends X-Robots-Tag: noindex, nofollow)
APP_INDEXABLE=false
APP_KEY= APP_KEY=
APP_DEBUG=true APP_DEBUG=true
APP_URL=http://localhost APP_URL=http://localhost
@@ -31,7 +33,7 @@ DB_DATABASE=boboko
DB_USERNAME=root DB_USERNAME=root
DB_PASSWORD=dev DB_PASSWORD=dev
SESSION_DRIVER=database SESSION_DRIVER=redis
SESSION_LIFETIME=120 SESSION_LIFETIME=120
SESSION_ENCRYPT=false SESSION_ENCRYPT=false
SESSION_PATH=/ SESSION_PATH=/
@@ -41,7 +43,7 @@ BROADCAST_CONNECTION=log
FILESYSTEM_DISK=local FILESYSTEM_DISK=local
QUEUE_CONNECTION=database QUEUE_CONNECTION=database
CACHE_STORE=database CACHE_STORE=redis
# CACHE_PREFIX= # CACHE_PREFIX=
MEMCACHED_HOST=127.0.0.1 MEMCACHED_HOST=127.0.0.1
@@ -58,8 +60,11 @@ MAIL_PORT=1025
MAIL_USERNAME=null MAIL_USERNAME=null
MAIL_PASSWORD=null MAIL_PASSWORD=null
MAIL_FROM_ADDRESS="hello@example.com" MAIL_FROM_ADDRESS="hello@example.com"
# Fallback only: the sender name comes from Store Details' "Mail from name" when set.
MAIL_FROM_NAME="${APP_NAME}" MAIL_FROM_NAME="${APP_NAME}"
CONTACT_EMAIL=
HCAPTCHA_SITEKEY=
HCAPTCHA_SECRET=
AWS_ACCESS_KEY_ID= AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY= AWS_SECRET_ACCESS_KEY=
@@ -69,13 +74,9 @@ AWS_USE_PATH_STYLE_ENDPOINT=false
VITE_APP_NAME="${APP_NAME}" VITE_APP_NAME="${APP_NAME}"
OTEL_SERVICE_NAME=boboko-starter SESSION_SECURE_COOKIE=true
OTEL_EXPORTER_OTLP_PROTOCOL=http/protobuf
OTEL_PROPAGATORS=baggage,tracecontext
OTEL_PHP_AUTOLOAD_ENABLED=true
OTEL_EXPORTER_OTLP_ENDPOINT=
# Stoic is the headless CMS, proxied at /stoic/ behind the app in prod (see docker/nginx/prod.conf) # Stoic is the headless CMS, proxied at /stoic/ behind the app (see docker/caddy/common.caddy)
STOIC_SECRET=dev-secret-change-me STOIC_SECRET=dev-secret-change-me
STOIC_SSO_SECRET=dev-sso-secret-change-me STOIC_SSO_SECRET=dev-sso-secret-change-me
STOIC_HOST=http://localhost:2727 STOIC_HOST=http://localhost:2727
@@ -85,6 +86,9 @@ SCOUT_QUEUE=true
MEILISEARCH_KEY=dev-meilisearch-key-change-me MEILISEARCH_KEY=dev-meilisearch-key-change-me
MEILISEARCH_HOST=http://meilisearch:7700 MEILISEARCH_HOST=http://meilisearch:7700
# Lunar sets all prices inclusive of tax with these values
LUNAR_STORE_INCLUSIVE_OF_TAX=true
# Host-side ports — change these if another project on this machine already uses the defaults # Host-side ports — change these if another project on this machine already uses the defaults
APP_PORT=8090 APP_PORT=8090
STOIC_PORT=2727 STOIC_PORT=2727
@@ -93,3 +97,17 @@ POSTGRES_HOST_PORT=5436
MAILPIT_PORT=8025 MAILPIT_PORT=8025
VITE_PORT=5173 VITE_PORT=5173
MEILISEARCH_PORT=7700 MEILISEARCH_PORT=7700
STRIPE_SECRET=secret
STRIPE_PUBLIC_KEY=public_key
STRIPE_WEBHOOK_SECRET=webhook_secret
BOXNOW_BASE_URL=https://api-stage.boxnow.gr/api/v1
BOXNOW_LOCATION_API_URL=https://locationapi-stage.boxnow.gr/api/v1
BOXNOW_CLIENT_ID=box-client-id
BOXNOW_CLIENT_SECRET=box-client-secret
BOXNOW_PARTNER_ID=box-partner-id
BOXNOW_ORIGIN_LOCATION_ID=box-location-id
BOXNOW_SENDER_NAME=test
BOXNOW_SENDER_EMAIL=test@test.com
BOXNOW_SENDER_PHONE=+306912345678
+2
View File
@@ -0,0 +1,2 @@
#!/bin/sh
exec bin/check-core-mode
+2 -4
View File
@@ -17,11 +17,7 @@
/public/build /public/build
/public/hot /public/hot
/public/sitemap.xml /public/sitemap.xml
/public/logos/core
/public/storage /public/storage
/public/css/filament
/public/js/filament
/public/fonts/filament
/storage/*.key /storage/*.key
/storage/framework/migrated /storage/framework/migrated
/storage/pail /storage/pail
@@ -31,3 +27,5 @@ Homestead.json
Homestead.yaml Homestead.yaml
Thumbs.db Thumbs.db
.exports .exports
.claude/settings.local.json
+329
View File
@@ -0,0 +1,329 @@
# Caching transition: context and first tasks (for Claude)
> **Temporary roadmap.** Delete this file once the caching transition is
> done; it's only needed while the work is in progress.
Written 2026-11-02 from a planning session in `boboko-research`, updated the
same day with the team's decisions. Read this before working on the tasks
below. Front-end conventions are still in [CLAUDE.md](CLAUDE.md), and that
file wins on style, Greek register, localization and performance rules.
Source documents (outside this repo, read-only for context):
- The research repo (`lexx/research` on code.radical-elements.com), `products/boboko/`:
- `caching-islands.md`: the target design (partly superseded, see "Changed on 2026-11-06")
- `tech-platform.md`: the platform plan
- `manifesto.md`: the principles decisions are checked against
- `tasks.md` (the full task list and **source of truth for task ids**) and `team-discussion.md`
(open items D7, D10) were written in the same planning session but aren't in the research
repo. Ask the team for them.
The rules that come out of this work are written up as skills in the **`boboko` Claude Code
plugin** (re-skills marketplace): `cacheable-pages` above all, plus `storefront-frontend`,
`storefront-performance` and `storefront-translations`.
Every task is also a card on the Planka board (3dealer.gr → Development,
label **Transition**). The task id (A1, W1…) is in each card's description.
**boboko-core is paused** (the backend developer is on leave). Only do the
tasks below that don't need core. A0 waits until core work resumes.
## Where we're going
**Every catalogue page becomes the same HTML for every visitor**, cached
(probably as static files Caddy serves without PHP). Anything personal (cart,
login state, wishlist, CSRF token) comes from **one small "islands" request**
that runs only when the visitor has a state cookie, and is answered with
**JSON** that Stimulus applies to elements already in the page.
- Cacheable routes (home, category, product, `/products`, FAQ, legal pages)
will run **without a session**: no cookies, no CSRF token, no `auth()`, no
flash, no `old()`, no `$errors`.
- Session routes (cart, checkout, account, login, contact, islands, writes)
stay in `web`.
- Writes (add to cart, wishlist toggle, review) are normal forms enhanced with
`fetch`, answered with JSON. New markup (e.g. a new review) is cloned from a
Blade-rendered `<template>` of the same component.
**Changed on 2026-11-06 (these replace the matching 2026-11-02 decisions below):**
- **No Turbo at all**: no Drive, Frames or Streams. Islands and writes answer with
**JSON**; Stimulus applies it as text and attributes on existing targets. New
markup comes from a Blade `<template>` of the same component, filled with
`textContent`, the same pattern as the Meilisearch search cards. Existing Turbo
code (listing/search Frames, the review Streams from A4) gets replaced.
- **One hint cookie, `bb_state=1`** (has a cart, a login or a wishlist item), with
no count in it. One `GET /{locale}/islands` when it's present, nothing otherwise.
- **Speculation Rules: `prefetch`, not `prerender`.** Prerender runs every analytics,
pixel and consent script on pages nobody may see. Revisit only once pages are
cached and the pilot shows analytics stay correct.
- **Where the standard storefront template lives** (core or starter) is decided once
3dealer is ready.
**Decided (2026-11-02):**
- ~~Turbo Streams for islands and writes~~ (replaced: JSON, see above); the cart
badge starts as a fixed-size placeholder.
- Laravel 13 (core C0, then A0 here), once core work resumes.
- **Page cache: static files** served by Caddy (later tasks P1–P3).
- **No Turbo Drive** (now: no Turbo at all). A normal multi-page site plus
Speculation Rules, View Transitions and back/forward cache (A7–A9 here).
- **Caddy** replaces nginx (W1, the last task in this file).
- **Search and filters will run in the browser against Meilisearch** through
Caddy on a subdomain, with the card as one Blade component reused through a
`<template>` (Meilisearch track M1–M6, not in this list).
- **URLs become id + slug** (`/el/products/123-blue-vase`), core C7 first,
then A10 here (not in this file).
- `view:cache` was commented out by mistake (A6).
## Where 3dealer is today (personal state found in catalogue pages)
| What | Where | Handled by |
|---|---|---|
| `auth()->check()` branching (4 places) | `resources/views/components/header.blade.php` | **A2** |
| Cart badge count | header, `data-cart-count-target="badge"`; primed from the drawer's server-rendered count | **A1** (placeholder), core C2/C3 (content) |
| Cart drawer body rendered on every page | `@include('checkout::drawer')` in `layouts/app.blade.php` (view lives in boboko-core) | core C3, **not here** |
| Wishlist heart state | `components/wishlist-button.blade.php` calls `WishlistService::has()` | **A3** (target only), core C3 (state) |
| Review flash, `old()`, `$errors`, `mergeJustSubmittedReview` | `product/show.blade.php`, `components/review-form.blade.php`, `ProductController` | **A4** |
| `@csrf` in forms + `<meta name="csrf-token">` | add-to-cart (core), wishlist, review, newsletter, layout | Later (CS1 in core, CS2 here, after Laravel 13 and core C2). **Leave as is** |
| Stoic staff embed (`@auth('staff')`) | `layouts/app.blade.php` | Core C2 (via islands), **not here**. Stoic itself may be dropped later |
Other facts worth knowing:
- Turbo is installed, but **Drive is off** (`window.Turbo.session.drive = false`
in `resources/js/app.js`). Frames drive the listing, search and sort. **The
direction is no Turbo at all**: don't add to it; Frames go away with the
Meilisearch track, and `@hotwired/turbo` is removed once nothing uses it.
- Catalogue data comes from Meilisearch via boboko-core's `ProductService`.
Listings use query-string filters. Don't change that in these tasks; the
browser-side rewrite is the M track.
- Product reviews have **no moderation**: they go live immediately. The index
update is async, which is why `mergeJustSubmittedReview` exists.
- URLs use numeric ids (`/products/{id}`). Don't change routes in these
tasks; that's A10, after core C7.
## Rules for this work
- **3dealer only.** Don't edit `vendor/boboko/core` or `../boboko-core`. If a
task turns out to need a core change, stop and write down what's needed
instead (core tasks are planned separately in `tasks.md`).
- **The site must keep working exactly as today** after each task. These
tasks prepare the page; they don't switch on caching.
- Only the tasks in this file (A1–A9, W1; A0 once core resumes). The other
decided work (page cache, Meilisearch in the browser, URLs) needs core
first and has its own tasks and order.
- Follow the `{locale}` controller rule in CLAUDE.md (`$locale` is the first
parameter).
- UI strings: reuse existing `storefront.*` keys where possible. New keys are
DB-backed Language Lines (the `storefront-translations` skill), never `lang/`
files, and they must reach core's seeder (`boboko:translations:pull`).
## Status (2026-11-06)
| Task | Status |
|---|---|
| A0 Laravel 13 | Waiting for core C0 |
| A1 Cart badge placeholder | Done (`6948c13`) |
| A2 Header without login checks | Done (`702609d`) |
| A3 Stable island targets | Done (`4fc7880`) |
| A4 Reviews without a redirect | Done with Turbo Streams (`f0a1b92`). **Rework to JSON** (see A4 below) |
| A5 Personal-state test | Not started |
| A6 `view:cache` in deploy | Done (`1ff55ac`) |
| A7 View Transitions | Done (`bad5a7d`) |
| A8 Back/forward cache | No commit yet |
| A9 Speculation Rules | Done with `prerender` (`c1acc00`). **Switch to `prefetch`** (see A9 below) |
| W1 Caddy | Done (`6d88d53`) |
## Tasks to work on now
### A0. Laravel 13 (S, waits for core C0: skip for now)
**Only once boboko-core has a tagged release that allows `laravel/framework
^13`.** Until then, skip it and do the others.
- Bump `laravel/framework` to `^13.0` and update `boboko/core` to that
release. Lunar stays on 1.5.0.
- Go through the Laravel 13 upgrade guide for app code (config, middleware in
`bootstrap/app.php`, anything deprecated), and note what changed around
CSRF (the `Sec-Fetch-Site` origin check) for later tasks CS1/CS2.
- Click through: home, category, product, search, cart drawer, checkout with
Stripe test mode, account, login/logout, the admin panel.
- **Done when:** `composer.lock` is on Laravel 13, the tests pass, and the
click-through shows nothing broken.
### A1. Cart badge as a fixed-size placeholder (S)
- The badge in `components/header.blade.php` (`data-cart-count-target="badge"`)
is `absolute` inside the button, so its appearance probably doesn't shift
the layout. **Verify** on mobile and desktop widths (CLS: no movement of the
header or icons when the count appears or changes, including 1 → 2 digits).
- Give it a stable `id` (e.g. `cart-badge`) so a Turbo Stream can target it.
- Keep `cart-count-controller.js` working as today (it listens for
`bbk-cart:updated`).
- **Rule to record in a comment:** no island may change the size of its
container.
- **Done when:** a stable id exists, behaviour is unchanged, and no layout
shift is measurable.
### A2. Header links that don't depend on login (S)
- The account icon always links to `route('account')`. The `auth` middleware
already redirects guests to login (`redirectGuestsTo` in
`bootstrap/app.php`).
- The wishlist icon always links to `route('wishlist')`. Make
`WishlistController::guest` redirect logged-in users to `account.wishlist`.
- One neutral aria-label for the account link (`storefront.nav.account`)
instead of switching to the login label.
- Both the desktop and mobile parts of the header (≈ lines 50–62 and 175–189).
- **Done when:** `header.blade.php` contains no `auth()` call, and guests and
logged-in users still end up on the right pages.
### A3. Stable island targets in the markup (S)
- `x-wishlist-button`: add `data-wishlist-product="{{ $productId }}"` on the
form root. **Keep** the current server-side `aria-pressed` state for now
(core will move it to islands later).
- The account link: a stable `id` (e.g. `header-account-link`) on both the
desktop and mobile versions, or one shared attribute selector.
- `<meta name="csrf-token">` in the layout: a stable `id` (e.g. `csrf-token`).
- **Done when:** each personal element has a stable selector, with no visible
change.
### A4. Review submission without a redirect (M)
Today `ProductController::storeReview` validates, creates a `ProductReview`,
calls `searchableSync()`, and redirects to `?tab=reviews#product-tabs` with
`withErrors`/`withInput` or a `reviewSubmitted` + `justSubmittedReview` flash.
Change it to (**updated 2026-11-06: JSON, no Turbo**; the first version used
Turbo Streams and needs reworking):
- A Stimulus controller that submits the form with `fetch` and
`Accept: application/json`. Remove `data-turbo="true"` and the stream views
(`product/streams/`).
- **Success:** a JSON response (the review, display-ready, plus count and
average). The controller clones a Blade-rendered `<template>` of the same
review component, fills its slots with `textContent`, prepends it to the
list, updates the count and average, and swaps the form for the thank-you.
- **Validation errors:** 422 with `{ "errors": { … } }` (what
`$request->validate()` already returns for a JSON request), filled into the
form's existing error slots, with `aria-invalid`. No session `old()`/`$errors`.
- Remove `session('reviewSubmitted')` from `product/show.blade.php`,
`old()`/`$errors` from `review-form.blade.php`, and
`mergeJustSubmittedReview` and the `justSubmittedReview` flash from the
controller.
- Keep `searchableSync()`.
- **No-JS fallback:** a plain POST may still redirect back to the product
page. That fallback may lose inline errors, which is acceptable.
- Accessibility: announce the result in a live region, and move focus to the
thank-you message or the first invalid field.
- Leave the `?tab=reviews` query parameter alone for now, but note it: it's a
query-string variant of the product page, which matters once pages are
cached.
- **Done when:** a submitted review appears immediately without a page load,
errors show inline, and nothing on the product page reads the session.
### A5. Test for personal state on catalogue pages (S)
- A feature test (in this repo's existing `tests/` setup) that renders home, a
category, a product, `/products`, FAQ and the legal pages **as a guest**, and
asserts the HTML has no per-visitor content.
- Start with assertions that pass after A2–A4 (no `auth()`-dependent markup,
no review flash/old input), and **mark the rest as expected failures/skipped
with a reason**: the drawer cart body and wishlist state (core C3), the CSRF
token (CS1/CS2), and the Stoic staff embed (core C2).
- It will need seeded catalogue data, or Meilisearch mocked through
`ProductService`. Check how the app can be booted in tests first, and say
so if that's harder than an S.
- **Done when:** the test runs in CI/locally, passes for what's done, and lists
what's still missing.
### A6. Turn `view:cache` back on in the deploy (S)
- In `Envoy.blade.php` (`artisan_optimize` task), uncomment the `view:cache`
line and give it the same `< /dev/null` as its neighbours.
- First run `php artisan view:cache` locally (in the app container). It
compiles **every** view, vendor ones included, so a broken view that is
never rendered would now fail the deploy. Fix or remove any that fail.
- **Done when:** `view:cache` runs cleanly locally and is in the deploy.
### A7. Cross-document View Transitions (S)
- Add `@view-transition { navigation: auto; }` to the CSS, inside
`@media (prefers-reduced-motion: no-preference)` so it's off for visitors
who ask for less motion.
- Check in Chrome that the header, the cart drawer and the cookie banner
don't flash or jump during a transition. If the default cross-fade looks
wrong on some element, give it a `view-transition-name` or exclude it;
keep it minimal.
- Browsers without support just navigate normally. Turbo Frame listing
updates aren't document navigations, so they're unaffected.
- **Done when:** page changes cross-fade in Chrome, nothing else changes
visibly, and reduced-motion turns it off.
### A8. Back/forward cache eligibility (S)
- In Chrome DevTools → Application → Back/forward cache, run the test on
home, a category, a product and `/products`, as a guest and logged in.
- Fix every blocker it reports that lives in 3dealer: `unload` listeners
(ours or a third-party script's), `Cache-Control: no-store` on catalogue
pages, open connections. Use `pagehide` instead of `unload` where something
needs to run on leave.
- Known gap, **not here**: a restored page shows the cart as it was. Core's
C2 refreshes on `pageshow` with `event.persisted`. Just note it.
- Write down any blocker that only core or a vendor script can fix.
- **Done when:** the DevTools test reports "restored from back/forward cache"
on those pages, or each remaining blocker is listed with its owner.
### A9. Speculation Rules (S)
> **Updated 2026-11-06:** use `prefetch`, not `prerender` (see "Changed on
> 2026-11-06"). The rest of this task stands; once Turbo Frames are gone, the
> Frame-link exclusions can go too.
- In the layout, a `<script type="speculationrules">` with `prerender`,
`eagerness: "moderate"` (hover or press), for same-origin links.
- **Exclude:** cart, checkout, account, login, logout (it's a POST, but
exclude the path anyway), wishlist, `/islands` (future), links with
`rel~=nofollow`, links inside the Turbo Frame listing controls (filters,
sort, pagination: those load into the frame, not as a new page), and
anything marked `data-no-prerender`. Use `where` with `href_matches` /
`selector_matches`.
- Check that GA4 and the consent banner count a page view **only when the
prerendered page is actually shown** (DevTools → Application → Speculative
loads lets you inspect a prerendered page). If one doesn't, delay it on
`document.prerendering` / `prerenderingchange`.
- Until pages are cached, each prerender is a full PHP render with 8 FPM
workers. Mention it in the commit message so production FPM is watched
after the deploy.
- **Done when:** hovering a product or category link in Chrome prerenders it
(visible in DevTools), excluded links don't, and analytics counts are
unchanged.
### W1. Caddy instead of nginx (M)
- Today: `docker/nginx/default.conf` (dev) and `prod.conf` (prod, with the
FastCGI cache block), `nginx` service in `docker-compose.yml`.
- A Caddy image built with `xcaddy`, including the `caddy-ratelimit` module
(needed later for the search subdomain M3 and rate limits F7). Pin the
Caddy and module versions.
- Caddyfile: `php_fastcgi` to the app container, static assets from
`public/` with the same long cache headers nginx sends, compression
(zstd/gzip), the same security headers, the same upload size limit, the
`/up` health check. Copy each rule over deliberately; list anything you
drop and why.
- **No page cache in Caddy** and no FastCGI-style cache: the static page
cache comes later (P2).
- **TLS:** find out first how it ends today (a host proxy, Cloudflare, or
the container). Don't switch on Caddy's automatic TLS until that's clear;
ask if it isn't findable in the repo or Envoy.
- Dev stays usable (`docker compose up` works, Vite still proxied as today).
- Remove the nginx files and service once Caddy works. boboko-test and the
starter are separate repos: note them, don't edit them.
- **Done when:** dev and a production-like local run serve every page,
asset, upload and the admin panel through Caddy, response headers match
today's (compare `curl -I` on a few URLs before and after), and no nginx
config is left in this repo.
## Suggested order
1. A1 → A3 → A2 (small header/markup work, one commit each).
2. A6, A7, A8, A9 (small, independent; one commit each).
3. A4, then A5 (the test confirms A2–A4).
4. W1.
5. A0 only once core C0 is tagged.
+40 -199
View File
@@ -1,215 +1,56 @@
# Front-end Guidelines # 3dealer
This is a Laravel 12 e-commerce project using Lunar PHP (headless). These guidelines apply to all front-end work. The storefront for 3dealer.gr: a boboko shop (Laravel + Lunar, on top of the shared
`boboko/core` package). It's also the **reference shop**: boboko's standard storefront is being
worked out here.
--- ## Shared rules: the `boboko` plugin
## Project Language Settings The rules for every boboko shop are in the **`boboko` Claude Code plugin** (re-skills
marketplace, enabled in `.claude/settings.json`). Its skills load when the work calls for them:
<!-- CHANGE THESE PER PROJECT --> | Skill | For |
- **Greek register:** `singular` — use the informal second person (εσύ/σου/σε). e.g. "Η κριτική σου", "Το όνομά σου", "Το email σου"
<!-- singular = informal (εσύ) | plural = formal (εσείς) -->
All UI text written for this project must follow the register above.
---
## Localization
Uses classic Laravel localization (https://laravel.com/docs/13.x/localization) — no third-party i18n routing package.
**Locales:** Greek (`el`) is primary/default, English (`en`) is secondary. Set in `config('app.available_locales')` (`config/app.php`).
**URL structure:** every route is prefixed with `{locale}`, including the default — `3dealer.gr/el/...` and `3dealer.gr/en/...`. Bare root (`/`) 301-redirects to `/el` (see `routes/web.php`). This avoids the ambiguity of an unprefixed default locale (see the reasoning in project memory / past conversation — prefixing every locale keeps hreflang symmetrical and scales cleanly to a third language later).
**URL slugs are the same across both locales, permanently** — e.g. `/el/products/{x}` and `/en/products/{x}`, not `/el/proionta/{x}` vs `/en/products/{x}`. This is a deliberate, standing decision for this project, not a placeholder to revisit later. Only the visible content is translated, not the slug. Do not introduce per-locale translated slugs (e.g. a `lang/{locale}/routes.php` segment map) unless the user explicitly asks for that to change.
**How it's wired:**
- All routes live inside `Route::prefix('{locale}')->where('locale', ...)->middleware('setlocale')` in `routes/web.php`.
- `App\Http\Middleware\SetLocale` validates the `{locale}` segment (404s if not in `available_locales`), calls `App::setLocale()`, and shares `$currentLocale`, `$altLocale`, and `$altLocaleUrl` (the same page in the other locale) to every view — this is what powers both the header's language switcher and the `<head>` hreflang tags in `resources/views/layouts/app.blade.php`. Don't recompute this logic elsewhere; read those shared variables instead.
- When adding a new route, put it inside that `{locale}` group and give it a route `name()` — the alt-locale URL generation in the middleware depends on the current route being named (falls back to the locale root if unnamed).
- When linking to a page in Blade, prefer `route('name', [...])` (locale is a normal route param, defaults to `app()->getLocale()` implicitly via the shared route group) over hand-built path strings, except for pages that don't have a controller/route yet (e.g. `/products`, `/contact`, `/cart` placeholders in the header currently use `url('/'.app()->getLocale().'/products')` — replace with `route()` once those pages exist).
- **Every controller action for a route inside the `{locale}` group must declare `$locale` as its first parameter, even if unused** — e.g. `show(string $locale, Product $product)`. Laravel's `ControllerDispatcher` ultimately calls the controller with `...array_values($parameters)`, i.e. **positionally**. If a route-bound model parameter (like `$product`) isn't preceded by a matching `$locale` parameter in the method signature, the resolved values shift out of position and the wrong value (the locale string) gets passed where the model was expected — a `TypeError` that's easy to misread as a binding failure. Closures with zero declared parameters are unaffected (PHP just ignores the extra positional arg), so this only bites real controller methods.
**Where translatable strings go:**
- Most UI copy is editable by the client/marketing team via **Stoic** (the headless CMS) — don't hardcode it here.
- Small strings that don't need client editing (nav labels, aria-labels, tab labels, pluralized counts) go in Laravel's own lang files at **`lang/{locale}/*.php`** (project root, per Laravel 12+ convention — not `resources/lang`). Current file: `lang/el/general.php` / `lang/en/general.php`. Use `__('general.key')` or `trans_choice('general.key', $count, [...])` for pluralized strings.
---
## Tech Stack
- **Laravel 12** + **Lunar PHP 1.3** (headless e-commerce)
- **Blade** for templating (`@extends`, `@section`, `@yield`, components)
- **Tailwind CSS v4** via `@tailwindcss/vite` — zero config, `@import 'tailwindcss'` only
- **Stimulus JS** for interactivity — controllers registered in `resources/js/stimulus/index.js`
- **Popover API** (native browser) for overlays — no JS overlay libraries
- SQLite database, `npm run dev` for local asset compilation
---
## Key File Locations
| What | Where |
|---|---| |---|---|
| CSS entry point | `resources/css/app.css` | | `boboko-platform` | How core, starter and the shops fit together; where new code goes; approved third-party scripts |
| Font definitions | `resources/css/fonts.css` | | `cacheable-pages` | Catalogue pages identical for every visitor; islands; JSON writes. **Read before touching catalogue pages, the header, the layout or any form** |
| JS entry point | `resources/js/app.js` | | `storefront-frontend` | Tailwind, tokens, components, Popover, Stimulus, ARIA, Greek capitals, forms |
| Stimulus controllers | `resources/js/stimulus/` | | `storefront-performance` | Core Web Vitals: bundling, fonts, LCP images, CLS, Speculation Rules, bfcache |
| JS utilities | `resources/js/utils/` | | `locale-routes` | `{locale}` routes, `$locale` first in controllers, same slugs, hreflang |
| Layout | `resources/views/layouts/app.blade.php` | | `storefront-translations` | `storefront.*` labels as Language Lines; getting keys into core |
| UI components (atomic) | `resources/views/components/ui/` | | `core-local-dev`, `releasing-core` | Working on core alongside this shop; releasing and `bin/deploy` |
| Section components | `resources/views/components/` |
| Page views | `resources/views/{page}/` |
| Public assets | `public/images/` |
--- If something below conflicts with a skill, this file wins for 3dealer. Say so, so the skill or
this file gets fixed.
## Design Reference **Work in progress:** [CACHING-TRANSITION.md](CACHING-TRANSITION.md) has the current transition's
decisions, task status and rules. Known problems: [README.md](README.md), "Known issues".
The Bluebeard template (`resources/css/bluebeard.css`) is used as a **reference only** for colors, spacing, typography, and effects. It is never imported or used directly. Everything is translated to Tailwind utilities or custom CSS where unavoidable. ## Greek register
The boboko project at `/Users/farenoubi/Projects/boboko-test` can be referenced for CSS architecture patterns. - **Greek register:** `singular`. Use the informal second person (εσύ/σου/σε), e.g.
"Η κριτική σου", "Το όνομά σου", "Το email σου".
--- All UI text written for this project follows it, including labels added in the admin.
## Tailwind vs. Custom CSS ## Design tokens
**Prefer Tailwind utilities by default.** Write custom CSS only when something genuinely cannot be expressed as a utility: In `@theme {}` in `resources/css/app.css`:
- Pseudo-elements (`::before`, `::after`) with dynamic transforms or transitions - `--font-sans`: **Manrope** (body text).
- Complex descendant/sibling selectors (e.g. `.group:hover .nav-dropdown`) - `--font-display`: **Manrope** (headings, nav, buttons). Kept separate from `--font-sans` in
- Keyframe animations case they diverge later.
- The underline-slide animation on nav links (background-size trick) - `--color-brand` / `--color-brand-light`: the brand greens.
- `--text-h1` … `--text-h4`: the heading sizes.
**Never** write inline CSS (`style="..."`). **Never** write custom CSS for something Tailwind already covers. Reuse these and the colours already in use (`neutral-200`, `black`) before adding anything.
The Manrope weights used above the fold are preloaded in `layouts/app.blade.php`; a new heavy
weight in a hero needs its own preload there.
When a component requires a CSS class (e.g. as a hook for a pseudo-element), still put all properties that can be Tailwind utilities as classes on the element in the component file. The CSS rule should contain only what genuinely cannot be a utility — pseudo-elements, complex selectors, keyframes. Do not default to putting all styles in the CSS class just because the class exists. ## 3dealer specifics
When custom CSS is needed, add it to `resources/css/app.css` inside `@layer components`. Keep the rule minimal — only what can't be a utility. - **Product custom fields** (text answers and photo uploads on the product page): how they work,
limits and clean-up are in [README.md](README.md). Products with custom fields can't be
--- quick-added from cards.
- **hCaptcha** protects the contact and login forms only.
## Design Tokens - **Stoic** provides the FAQ, legal pages and other client-edited copy (`App\Services\Stoic`,
`App\Models\Stoic*`).
Defined in `@theme {}` in `app.css`:
- `--font-sans`: Manrope (body text)
- `--font-display`: Manrope (headings, nav, buttons) — kept separate from `--font-sans` in case they diverge later
Reuse existing colors (`neutral-200`, `black`), font sizes, spacing, and border styles as components are built. Do not invent new values — check what's already in use first.
---
## Component Structure
### `resources/views/components/ui/` — atomic, reusable UI elements
Single-purpose, stateless or minimally stateful elements used across many contexts:
- `button.blade.php` ✓
- `input.blade.php`
- `input-group.blade.php`
- `icon.blade.php`
- `image.blade.php`
- `tabs.blade.php` / `tab.blade.php`
- `accordion.blade.php`
- `tooltip.blade.php`
- `badge.blade.php`
- etc.
### `resources/views/components/` — section-level or composite components
Larger reusable blocks made of several elements, often with real content:
- `header.blade.php` ✓
- `footer.blade.php`
- `cta.blade.php`
- `product-card.blade.php`
- `contact-section.blade.php`
- etc.
---
## Interactivity
### Popover API for overlays
For **tooltips, modals, dropdowns, and any overlay**: use the native [Popover API](https://developer.mozilla.org/en-US/docs/Web/API/Popover_API) with CSS — no JS, no libraries.
```html
<button popovertarget="my-popover">Open</button>
<div id="my-popover" popover>...</div>
```
Style open/closed states with `[popover]` and `:popover-open` selectors in CSS.
### Stimulus JS for behavior
Use Stimulus when JS is genuinely needed (form handling, cart updates, dynamic state, etc.).
- Keep controllers lean: manage state and coordinate the DOM, don't build UI inside them
- Use Stimulus values, targets, and outlets — avoid reading from the DOM imperatively
- **Never inject HTML strings or classes from inside a controller.** Instead, drive appearance via data attributes or CSS classes toggled on existing elements, and let CSS handle the visual result
- Never write inline JS (`onclick="..."`, etc.)
### Pure CSS for simple interactions
Hover dropdowns, focus states, active states — handle with CSS (`:hover`, `:focus-within`, `.group:hover`) before reaching for Stimulus.
---
## Accessibility (ARIA)
Always add ARIA attributes. This is not optional:
- Interactive elements: `aria-label`, `aria-expanded`, `aria-controls`, `aria-haspopup` as appropriate
- Images: meaningful `alt` text, or `alt=""` + `aria-hidden="true"` for decorative images
- Icons used as buttons: `aria-label` on the button, `aria-hidden="true"` on the SVG
- Form fields: always associated `<label>`, `aria-describedby` for hints/errors
- Dynamic content: `aria-live` regions where content updates without navigation
- When refactoring or adding interactivity, review ARIA impact — don't break existing roles
---
## Greek Typography
CSS `text-transform: uppercase` leaves Greek tonos accents in place (e.g. Ά instead of Α), which is incorrect. The utility at `resources/js/utils/strip-accents.js` handles this automatically for any element with the `uppercase` Tailwind class. **Always add the `uppercase` class to elements** rather than applying `text-transform: uppercase` in CSS — this keeps the strip-accents utility working without extra configuration.
---
## Performance & Core Web Vitals
Every frontend change should assume it will be measured by PageSpeed/Lighthouse. These rules exist because we hit each of these mistakes in production and had to fix them after the fact — bake them in up front instead.
### CSS bundling
- Before adding a CSS import to a shared/global entry point (e.g. `app.css`), ask whether every page actually needs it. Page- or component-specific styles (date pickers, legal-page typography, admin-only widgets) should not ship on pages that don't use them.
- Scope non-critical CSS to load only where it's used — either a dedicated build entry for that page, or import the `.css` file inside the same JS module that already lazy-loads that component (e.g. a Stimulus/JS controller), so the bundler emits it as a separate chunk fetched only when that component actually mounts.
- Exception: never defer CSS for anything the page shows immediately on load (above-the-fold content, or a component that renders as soon as its JS runs — an FAQ accordion, a cookie-consent banner). Even a well-scoped async CSS chunk arrives a beat after the JS that displays the element, causing a visible flash of unstyled/wrong-state content and a layout shift. Keep that CSS in the blocking bundle on purpose.
- Never import a full icon-font library (Phosphor, Font Awesome, etc.) — it ships every icon regardless of usage. Use inline SVGs for only the icons actually referenced; check the shared icon component for an existing icon before adding a new one.
- Only declare design tokens / CSS custom properties that are actually used somewhere in the codebase (Tailwind v4 already tree-shakes unused `@theme` tokens from output, so this is for keeping the source legible, not for bytes).
### Fonts
- `font-display: swap` means any text using a font weight will visibly reflow once that weight's file finishes downloading, if the fallback font's metrics differ. Preload every font weight used in above-the-fold text, not just the default body-copy weight — bold/black heading weights are usually the most visually prominent element on the page and cause the most visible reflow if not preloaded.
- When introducing a new heavy-weight text utility (e.g. a bold/black heading class) in a hero or above-the-fold component, confirm that weight has a matching `<link rel="preload" as="font">` in the layout `<head>`.
### Images
- Any image that could be the Largest Contentful Paint element (hero/banner images) must have: `fetchpriority="high"`, `loading="eager"`, explicit `width`/`height`, a responsive `srcset`/`sizes`, and a `<link rel="preload" as="image">` in `<head>` with matching `imagesrcset`/`imagesizes` — this lets the browser start the fetch as soon as it parses `<head>`, instead of waiting to discover the `<img>` tag in the body.
- Every other image: `loading="lazy"` with explicit `width`/`height` to reserve its layout space.
### Layout shift (CLS)
- Never animate `top`/`bottom`/`left`/`right`/`width`/`height`/`margin` on any element that appears or moves without direct user interaction (banners, toasts, slide-in modals, accordions). These are layout-affecting properties — the browser recalculates layout on every animation frame, and each frame's position delta counts toward CLS. Animate `transform` (translate/scale) and `opacity` instead — both are compositor-only and fully excluded from CLS scoring, no matter how far or long the animation runs.
- This applies to vendor/third-party CSS too (cookie-consent widgets, modal libraries) — check its default show/hide mechanism before shipping, and override it if it animates a layout property directly.
- Any element with a collapsed/expanded default state (accordions, dropdowns) needs its collapsed-state CSS in the blocking stylesheet, never a lazily-loaded chunk — otherwise it renders in its expanded/default state for a frame before the async CSS applies.
---
## Forms
Never add `novalidate` to forms. Always use the browser's default validation.
---
## Asking Questions
When the approach is unclear — layout structure, whether something should be a component, which Tailwind pattern fits — **ask before building**. A short question is cheaper than a refactor.
+32 -17
View File
@@ -10,14 +10,25 @@ RUN composer install \
--optimize-autoloader \ --optimize-autoloader \
--ignore-platform-reqs --ignore-platform-reqs
# ── Stage 2a: Vite dev (node_modules only, no build) ───────────────────────── # ── Stage 2a: Vite dev (node_modules only, no build) ──────────────────────────
FROM node:22-alpine AS vite-dev FROM node:22-alpine AS vite-dev
# git: needed for npm to install @boboko/core's git+https tagged-VCS form (see
# package.json's _dependencies and docker/entrypoint-vite.sh). No build-time
# `npm install` here — package.json's boboko/core path-repo form (../boboko-core)
# isn't visible in the build context, only once bind-mounted at container start,
# and entrypoint-vite.sh already runs npm install on every boot, so this would be
# redundant even if it could work.
RUN apk add --no-cache git
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY docker/entrypoint-vite.sh /entrypoint-vite.sh
RUN npm ci --ignore-scripts RUN chmod +x /entrypoint-vite.sh
ENTRYPOINT ["/entrypoint-vite.sh"]
# ── Stage 2b: Node / Vite build ────────────────────────────────────────────── # ── Stage 2b: Node / Vite build ──────────────────────────────────────────────
FROM node:22-alpine AS node-build FROM node:22-alpine AS node-build
# git: same reason as vite-dev above — npm needs it to resolve @boboko/core's
# git+https tagged-VCS form.
RUN apk add --no-cache git
WORKDIR /app WORKDIR /app
COPY package*.json ./ COPY package*.json ./
RUN npm ci --ignore-scripts RUN npm ci --ignore-scripts
@@ -53,6 +64,7 @@ RUN apt-get update \
php8.5-xml \ php8.5-xml \
php8.5-curl \ php8.5-curl \
php8.5-redis \ php8.5-redis \
php8.5-soap \
postgresql-client-18 \ postgresql-client-18 \
&& rm -rf /var/lib/apt/lists/* \ && rm -rf /var/lib/apt/lists/* \
&& mkdir -p /run/php \ && mkdir -p /run/php \
@@ -83,27 +95,30 @@ COPY . .
RUN chown -R www-data:www-data storage bootstrap/cache \ RUN chown -R www-data:www-data storage bootstrap/cache \
&& chmod -R 775 storage bootstrap/cache && chmod -R 775 storage bootstrap/cache
# Package discovery and asset publishing are fully determined by composer.lock + code,
# so they belong in the image, not in every container's entrypoint. Only asset-type
# tags are force-republished here — config tags (core-config, lunar) are a deliberate
# one-time `vendor:publish` step you run and commit by hand, since re-running them would
# silently overwrite any local edits to config/core.php or config/lunar/*.php.
RUN php artisan package:discover --ansi \
&& php artisan vendor:publish --tag=core-assets --force --ansi \
&& php artisan vendor:publish --tag=public --force --ansi \
&& php artisan filament:assets --ansi
COPY docker/entrypoint.sh /entrypoint.sh COPY docker/entrypoint.sh /entrypoint.sh
RUN chmod +x /entrypoint.sh COPY docker/entrypoint-worker.sh /entrypoint-worker.sh
RUN chmod +x /entrypoint.sh /entrypoint-worker.sh
EXPOSE 9000 EXPOSE 9000
ENTRYPOINT ["/entrypoint.sh"] ENTRYPOINT ["/entrypoint.sh"]
CMD ["php-fpm8.5", "-F"] CMD ["php-fpm8.5", "-F"]
# ── Stage 5: Nginx (public assets baked in from production) ────────────────── # ── Stage 5a: Caddy binary (xcaddy, pinned versions) ─────────────────────────
FROM nginx:alpine AS nginx # caddy-ratelimit isn't used yet: it's for the search subdomain (M3) and the
# PHP-route rate limits (F7). Its only tag (v0.1.0) is years old, so it's
# pinned to a commit.
FROM caddy:2.11.7-builder-alpine AS caddy-build
RUN xcaddy build v2.11.7 \
--with github.com/mholt/caddy-ratelimit@5625512f24f6f59d6f64fb3aafe5eecff0b286db
COPY docker/nginx/prod.conf /etc/nginx/conf.d/default.conf # Development uses this stage as is, with docker/caddy and public/ bind-mounted
# (docker-compose.dev.yml).
FROM caddy:2.11.7-alpine AS caddy-base
COPY --from=caddy-build /usr/bin/caddy /usr/bin/caddy
# ── Stage 5b: Caddy for production (config + public assets baked in) ─────────
FROM caddy-base AS caddy
COPY docker/caddy/global.caddy docker/caddy/common.caddy docker/caddy/Caddyfile /etc/caddy/
COPY --from=production /var/www/html/public /var/www/html/public COPY --from=production /var/www/html/public /var/www/html/public
# ── Stage 6: Development ────────────────────────────────────────────────────── # ── Stage 6: Development ──────────────────────────────────────────────────────
+3 -9
View File
@@ -19,7 +19,6 @@
pull pull
docker_build docker_build
docker_up docker_up
migrate
artisan_optimize artisan_optimize
restart_workers restart_workers
stoic_generate_thumbs stoic_generate_thumbs
@@ -45,25 +44,20 @@
{{ $compose }} up -d --remove-orphans {{ $compose }} up -d --remove-orphans
@endtask @endtask
@task('migrate', ['on' => 'web'])
echo ">>> Running migrations..."
cd {{ $path }}
{{ $compose }} exec -T app php artisan migrate --force < /dev/null
@endtask
@task('artisan_optimize', ['on' => 'web']) @task('artisan_optimize', ['on' => 'web'])
echo ">>> Optimizing..." echo ">>> Optimizing..."
cd {{ $path }} cd {{ $path }}
{{ $compose }} exec -T app php artisan config:cache < /dev/null {{ $compose }} exec -T app php artisan config:cache < /dev/null
{{ $compose }} exec -T app php artisan route:cache < /dev/null {{ $compose }} exec -T app php artisan route:cache < /dev/null
{{-- {{ $compose }} exec -T app php artisan view:cache --}} {{ $compose }} exec -T app php artisan view:cache < /dev/null
{{ $compose }} exec -T app php artisan event:cache < /dev/null {{ $compose }} exec -T app php artisan event:cache < /dev/null
@endtask @endtask
@task('restart_workers', ['on' => 'web']) @task('restart_workers', ['on' => 'web'])
echo ">>> Restarting queue workers..." echo ">>> Restarting queue workers and scheduler..."
cd {{ $path }} cd {{ $path }}
{{ $compose }} restart queue {{ $compose }} restart queue
{{ $compose }} restart scheduler
@endtask @endtask
@task('password_protect', ['on' => 'web']) @task('password_protect', ['on' => 'web'])
+18
View File
@@ -27,3 +27,21 @@ ## Product custom fields
- **Photos are cleaned up automatically.** Photos never added to a cart are deleted by `custom-fields:prune-uploads` (see above). A photo on a cart line is kept as long as that cart line exists, and a photo on an order is kept indefinitely. - **Photos are cleaned up automatically.** Photos never added to a cart are deleted by `custom-fields:prune-uploads` (see above). A photo on a cart line is kept as long as that cart line exists, and a photo on an order is kept indefinitely.
- **Products with custom fields can't be quick-added.** On product cards, the "add to cart" button becomes a link to the product page. - **Products with custom fields can't be quick-added.** On product cards, the "add to cart" button becomes a link to the product page.
- Field labels are entered once in the admin and aren't translated, so they appear as entered in both `/el` and `/en`. - Field labels are entered once in the admin and aren't translated, so they appear as entered in both `/el` and `/en`.
## Known issues
Found 2026-11-06 while setting up the `boboko` Claude Code plugin. Remove an entry once it's fixed.
- **Storefront labels aren't seeded on boot.** `docker/entrypoint.sh` runs the `checkout` and
`validation` translation seeders, but not `StorefrontTranslationsSeeder`, so new
`storefront.*` keys released in core never reach an environment by themselves. Fix: add it
next to the other two.
- **About 20 `storefront.*` keys exist only in this shop's database**, not in core's seeder:
all `footer.*` and `errors.*`, `nav.faq`, `nav.menu`, `search.no_results`,
`search.results_count`, `shop.filters`, `contact.privacy_notice`. A fresh environment shows
them as raw keys. Fix: `bin/core-mode local`, then
`bin/dc-core.sh exec app php artisan boboko:translations:pull`, then commit and release core.
- **Home hero carousel images (LCP).** In `resources/views/home.blade.php`, every slide gets
`loading="eager"` and `fetchpriority="high"` (only the first visible one should), the
`preload="…"` attribute on `<img>` does nothing (preloading is a `<link>` in `<head>`), and
there's no `srcset`/`sizes` or `<head>` image preload.
+47
View File
@@ -0,0 +1,47 @@
<?php
namespace App\Catalog;
use Modules\Core\Catalog\Services\CollectionService;
/**
* Breadcrumb items for a collection and its ancestors, root first, in the
* shape <x-breadcrumb> takes. Home is added by the component itself.
*
* Interim: the indexed `ancestors` field gives the right ids and order, but
* its names are translated once at index time (CollectionIndexer uses
* translateAttribute('name') with no locale), so they'd show in the wrong
* language on the other locale. Each ancestor is re-read via getById() for a
* current-locale name instead. Trees are shallow, so it's one or two extra
* index lookups. Drop the re-read once core indexes ancestor names per locale.
*/
final class CollectionTrail
{
public function __construct(
private readonly CollectionService $collections,
) {}
/**
* @param array<string, mixed> $collection a localized CollectionService document
* @param bool $linkLast false when the collection itself is the current page
* @return array<int, array{label: string, href?: string}>
*/
public function for(array $collection, bool $linkLast = true): array
{
$ancestors = collect($collection['ancestors'] ?? [])
->map(fn (array $ancestor) => [
// Untranslated collections resolve to a null name, so keep the
// index-time name as a fallback.
'label' => $this->collections->getById((int) $ancestor['id'])['name'] ?? $ancestor['name'],
'href' => route('category.show', ['id' => $ancestor['id']]),
]);
$self = ['label' => $collection['name'] ?? ''];
if ($linkLast) {
$self['href'] = route('category.show', ['id' => $collection['id']]);
}
return [...$ancestors->values()->all(), $self];
}
}
+5 -1
View File
@@ -19,7 +19,7 @@ final class ProductCard
{ {
/** /**
* @param array<string, mixed> $product one item from ProductService's localized array shape * @param array<string, mixed> $product one item from ProductService's localized array shape
* @return array{name: ?string, price: ?string, image: ?string, href: string, variantId: ?int, hasCustomFields: bool} * @return array{name: ?string, price: ?string, image: ?string, href: string, variantId: ?int, hasCustomFields: bool, soldOut: bool}
*/ */
public static function fromIndexed(array $product): array public static function fromIndexed(array $product): array
{ {
@@ -38,6 +38,10 @@ public static function fromIndexed(array $product): array
// can't be quick-added from a card — the card links to the // can't be quick-added from a card — the card links to the
// product page instead, even when every field is optional. // product page instead, even when every field is optional.
'hasCustomFields' => ! empty($product['custom_fields']), 'hasCustomFields' => ! empty($product['custom_fields']),
// Index-time stock (see boboko-core's ProductIndexer `in_stock`),
// so only as fresh as the last reindex. A document missing the
// field is treated as in stock rather than hiding its cart button.
'soldOut' => ! ($product['in_stock'] ?? true),
]; ];
} }
} }
+43
View File
@@ -0,0 +1,43 @@
<?php
namespace App\Catalog;
use Lunar\Base\StandardMediaDefinitions;
use Spatie\Image\Enums\Constraint;
use Spatie\MediaLibrary\HasMedia;
use Spatie\MediaLibrary\MediaCollections\MediaCollection;
use Spatie\MediaLibrary\MediaCollections\Models\Media;
/**
* INTERIM — belongs in boboko-core (see the core task in the image
* performance discussion). Delete this class and point
* config/lunar/media.php back at core's definitions once it lands there.
*
* Storefront product image sizes for srcset: WebP at fixed widths, the
* original's aspect ratio preserved and never upscaled. Replaces Lunar's
* square white-padded zoom/large/medium conversions (nothing reads them);
* the parent's `small` conversion stays for the admin panel.
*/
class ProductMediaDefinitions extends StandardMediaDefinitions
{
/** Conversion name => width in px. Named `w{width}` so the srcset can be built from the name. */
public const WIDTHS = [
'w160' => 160,
'w400' => 400,
'w800' => 800,
'w1200' => 1200,
'w1600' => 1600,
];
protected function registerCollectionConversions(MediaCollection $collection, HasMedia $model): void
{
$collection->registerMediaConversions(function (Media $media) use ($model) {
foreach (self::WIDTHS as $name => $width) {
$model->addMediaConversion($name)
->width($width, [Constraint::PreserveAspectRatio, Constraint::DoNotUpsize])
->format('webp')
->quality(80);
}
});
}
}
@@ -44,7 +44,11 @@ public function show(string $locale, Request $request, int $orderId): View
return view('account.orders.show', [ return view('account.orders.show', [
'order' => $order, 'order' => $order,
'paymentMethodName' => $paymentMethodName, 'paymentMethodName' => $paymentMethodName,
'shipments' => $order->shipments->whereNull('cancelled_at')->whereNotNull('tracking_reference'), // Active shipments with a number; return vouchers are the shop's
// business, not the customer's.
'shipments' => $order->shipments
->reject(fn ($shipment) => $shipment->isCancelled() || $shipment->isReturn() || blank($shipment->tracking_reference))
->values(),
]); ]);
} }
} }
@@ -3,6 +3,7 @@
namespace App\Http\Controllers\Auth; namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller; use App\Http\Controllers\Controller;
use App\Rules\HCaptcha;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request; use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
@@ -43,8 +44,13 @@ public function create(string $locale, Request $request): View
public function send(string $locale, Request $request, UserOtpService $otp): RedirectResponse public function send(string $locale, Request $request, UserOtpService $otp): RedirectResponse
{ {
// Captcha only here: verify() and resend() need the email this step
// puts in the session, so they can't be reached without passing it.
$validated = $request->validate([ $validated = $request->validate([
'email' => ['required', 'email', 'max:255'], 'email' => ['required', 'email', 'max:255'],
'h-captcha-response' => ['bail', 'required', new HCaptcha],
], [
'h-captcha-response.required' => __('storefront.auth.captcha_failed'),
]); ]);
$email = Str::lower(trim($validated['email'])); $email = Str::lower(trim($validated['email']));
+7 -1
View File
@@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Catalog\CollectionTrail;
use App\Catalog\ProductListing; use App\Catalog\ProductListing;
use App\Catalog\ProductListingPage; use App\Catalog\ProductListingPage;
use Illuminate\Http\Response; use Illuminate\Http\Response;
@@ -12,6 +13,7 @@ class CategoryController extends Controller
public function __construct( public function __construct(
private readonly ProductListingPage $listingPage, private readonly ProductListingPage $listingPage,
private readonly CollectionService $collections, private readonly CollectionService $collections,
private readonly CollectionTrail $trail,
) {} ) {}
public function show(string $locale, int $collection) public function show(string $locale, int $collection)
@@ -27,6 +29,10 @@ public function show(string $locale, int $collection)
$collectionData['id'], $collectionData['id'],
); );
return view('category.show', [...$data, 'collection' => $collectionData]); return view('category.show', [
...$data,
'collection' => $collectionData,
'breadcrumb' => $this->trail->for($collectionData, linkLast: false),
]);
} }
} }
@@ -1,253 +0,0 @@
<?php
namespace App\Http\Controllers\Checkout;
use App\Http\Controllers\Controller;
use App\Http\Controllers\CustomFieldUploadController;
use Closure;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\ValidationException;
use Illuminate\View\View;
use Lunar\Exceptions\Carts\CartException;
use Lunar\Models\CartLine;
use Lunar\Models\ProductVariant;
use Illuminate\Support\Facades\App;
use Modules\Core\Cart\Exceptions\InvalidCouponException;
use Modules\Core\Cart\Services\CartService;
use Modules\Core\File\Models\File;
use Modules\Core\File\Services\FileService;
use Modules\Core\Localization\Services\LanguageCache;
/**
* Thin storefront cart endpoints for the checkout module. Every action mutates
* the session cart via boboko-core's CartService and returns the same
* server-rendered `cart-body` partial — the drawer's Stimulus controller swaps
* that fragment in place (no JSON, no client-side templating). $cart / $lines
* for the partial come from the view composer in CheckoutModuleServiceProvider.
*/
class CartController extends Controller
{
public function __construct(
private readonly CartService $cart,
) {}
/**
* CartException here is Lunar's own add_to_cart validation pipeline
* (CartLineQuantity/CartLineStock) rejecting the line — most commonly
* "not enough stock at this quantity" for a tracked (purchasable =
* in_stock) variant. Its own message is an untranslated, hardcoded
* English string not meant for storefront display, so this returns our
* own translated one instead rather than passing it through — a
* storefront.* key rather than checkout.*, since this is a catalog/stock
* concern the storefront owns, not something specific to the portable
* checkout module.
*/
public function add(string $locale, Request $request): View|JsonResponse
{
$data = $request->validate([
'purchasable_id' => ['required', 'integer'],
'quantity' => ['nullable', 'integer', 'min:1'],
'custom_fields' => ['nullable', 'array'],
]);
$variant = ProductVariant::findOrFail($data['purchasable_id']);
try {
$meta = $this->customFieldsMeta($variant, $data['custom_fields'] ?? []);
} catch (ValidationException $e) {
return response()->json(['error' => collect($e->errors())->flatten()->first()], 422);
}
try {
$this->cart->addLine($variant, $data['quantity'] ?? 1, $meta);
} catch (CartException) {
return $this->stockError($variant);
}
return view('checkout::partials.cart-body');
}
/**
* The shopper's answers to the product's custom fields (boboko-core's
* Product::$custom_fields — {key, type: text|textarea|file, label,
* required}), as cart line meta. Lunar copies CartLine.meta onto the
* OrderLine at order creation, so this is also what the order keeps.
*
* Only keys the product actually defines are kept, nested under
* `custom_fields` — line meta also carries behavior flags (core's
* `saved_for_later` zeroes the line's price), so shopper input must never
* be merged into it directly. Label and type are snapshotted alongside
* each value so the cart/order still reads correctly if the product's
* fields are edited later.
*
* A `file` answer is the id of a File row the host's own upload endpoint
* (CustomFieldUploadController) already created via boboko-core's
* FileService — never the file's bytes, disk, or path, all of which
* FileService alone is the source of truth for. A shopper can't point
* this at someone else's file: the id must resolve to a File that is
* BOTH unowned (isFileAnswerValid()) and tagged with
* CustomFieldUploadController::PURPOSE, so an id belonging to an
* already-ordered file (owned, and/or a different purpose entirely) is
* rejected. Attaching the File to the real CartLine it belongs to
* happens afterward, in boboko-core's own Modules\Core\File\Listeners\
* AttachCustomFieldFileToCartLine (listening for Cart\Events\
* CartLineAdded) — not here, since this method only builds the meta
* $this->cart->addLine() is about to receive, before any CartLine
* actually exists to own anything.
*
* Two adds with identical answers merge into one line (Lunar matches
* existing lines on meta); different answers stay separate lines.
*/
private function customFieldsMeta(ProductVariant $variant, array $input): array
{
$fields = collect($variant->product?->custom_fields ?? [])
->keyBy('key')
->map(fn (array $field) => [...$field, 'label' => $this->resolveLabel($field['label'])]);
if ($fields->isEmpty()) {
return [];
}
$validated = Validator::make(
$input,
$fields->map(fn (array $field) => [
($field['required'] ?? false) ? 'required' : 'nullable',
...match ($field['type']) {
'textarea' => ['string', 'max:2000'],
'file' => [function (string $attribute, mixed $value, Closure $fail) {
if (! $this->isFileAnswerValid($value)) {
$fail('validation.uploaded')->translate();
}
}],
default => ['string', 'max:255'],
},
])->all(),
[],
$fields->map(fn (array $field) => $field['label'])->all(),
)->validate();
$answers = $fields
->filter(fn (array $field) => filled($validated[$field['key']] ?? null))
->map(fn (array $field) => [
'key' => $field['key'],
'label' => $field['label'],
'type' => $field['type'],
...($field['type'] === 'file'
? ['file_id' => (int) $validated[$field['key']]]
: ['value' => $validated[$field['key']]]),
])
->values()
->all();
return $answers === [] ? [] : ['custom_fields' => $answers];
}
/**
* Product::$custom_fields stores `label` as {locale: string} (see
* boboko-core's Catalog\Filament\Pages\ManageProductCustomFields) — this
* resolves it to the single current-locale string cart/order line meta
* actually needs, the same filled()-over-?? fallback boboko-core's
* ProductDocumentLocalizer uses for every other translated field (an
* empty string for the current locale still falls through to the
* store's default language, rather than showing blank). A product
* saved before labels became translatable still has a plain string
* here, returned as-is.
*/
private function resolveLabel(mixed $label): string
{
if (! is_array($label)) {
return (string) $label;
}
$locale = App::getLocale();
$fallbackLocale = app(LanguageCache::class)->defaultLocale();
return filled($label[$locale] ?? null)
? $label[$locale]
: ($label[$fallbackLocale] ?? '');
}
private function isFileAnswerValid(mixed $fileId): bool
{
$file = File::find($fileId);
return $file !== null
&& $file->purpose === CustomFieldUploadController::PURPOSE
&& $file->owner_id === null
&& app(FileService::class)->exists($file);
}
public function updateLine(string $locale, Request $request, int $line): View|JsonResponse
{
$quantity = (int) $request->validate([
'quantity' => ['required', 'integer', 'min:0'],
])['quantity'];
try {
$quantity === 0
? $this->cart->removeLine($line)
: $this->cart->updateLine($line, $quantity);
} catch (CartException) {
$variant = CartLine::find($line)?->purchasable;
return $this->stockError($variant instanceof ProductVariant ? $variant : null);
}
return view('checkout::partials.cart-body');
}
/**
* getTotalInventory() is the same number canBeFulfilledAtQuantity()
* checked against (stock, for a tracked in_stock variant) — telling the
* shopper how many are actually left beats a generic "not enough stock"
* they'd otherwise have to guess around by trial and error.
*/
private function stockError(?ProductVariant $variant): JsonResponse
{
$available = $variant?->getTotalInventory() ?? 0;
return response()->json([
'error' => trans_choice('storefront.product.add_to_cart_failed', $available, ['count' => $available]),
], 422);
}
public function remove(string $locale, int $line): View
{
$this->cart->removeLine($line);
return view('checkout::partials.cart-body');
}
/**
* A bad code is a normal, expected outcome here (typo, expired code), not
* an error state for the request — it re-renders the same cart-body
* partial with $couponError set, rather than a 4xx/redirect, so the fetch
* + swap in bbk-cart-controller stays the one code path for every cart
* mutation.
*/
public function applyCoupon(string $locale, Request $request): View
{
$code = $request->validate([
'code' => ['required', 'string'],
])['code'];
$couponError = false;
try {
$this->cart->applyCoupon($code);
} catch (InvalidCouponException) {
$couponError = true;
}
return view('checkout::partials.cart-body', ['couponError' => $couponError]);
}
public function removeCoupon(string $locale): View
{
$this->cart->removeCoupon();
return view('checkout::partials.cart-body');
}
}
@@ -1,676 +0,0 @@
<?php
namespace App\Http\Controllers\Checkout;
use App\Http\Controllers\Controller;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Collection;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Validator;
use Illuminate\Validation\Rule;
use Illuminate\View\View;
use Lunar\Exceptions\Carts\CartException;
use Lunar\Exceptions\FingerprintMismatchException;
use Lunar\Facades\CartSession;
use Lunar\Models\Cart;
use Lunar\Models\Country;
use Lunar\Models\Order;
use Lunar\Models\State;
use Modules\Core\Cart\Services\CartService;
use Modules\Core\Checkout\Exceptions\InvalidShippingOptionException;
use Modules\Core\Checkout\Exceptions\TermsNotAcceptedException;
use Modules\Core\Checkout\Exceptions\UnknownPaymentTypeException;
use Modules\Core\Checkout\Services\CheckoutService;
use Modules\Core\Customer\Services\CustomerAccountService;
use Modules\Core\Payment\Enums\PaymentResultStatus;
use Modules\Core\Payment\Models\PaymentMethod;
/**
* The checkout page — one page, sections (contact / billing / shipping /
* shipping method), reviewed against boboko-core's CheckoutService. Stops
* short of payment for this slice (see project memory).
*
* The address form and the shipping-method radios **autosave** — no submit
* buttons. `saveAddress()` / `selectShippingOption()` are called by
* bbk-checkout-form (debounced fetch) and return a JSON envelope of
* server-rendered fragments (shipping options + order summary) plus any
* field errors, rather than redirecting. Address validation is deliberately
* lenient — nothing is rejected mid-typing; required-field enforcement is the
* job of the (not-yet-built) "Continue to payment" gate.
*
* Guests type their email; the login tab links to the storefront's own
* `login` route and back. Logged in: the email is the account's (forced in
* saveAddress()), the first visit prefills addresses from the account
* (prefillFromAccount()), and Lunar's Login listener has already attached the
* cart, so the placed order lands in the account's history.
*
* Single-country store: STORE_COUNTRY_ISO3 fixes the country to Greece (hidden
* field, forced server-side). Set it to null for the full country picker (the
* portable path for a multi-country boboko store).
*/
class CheckoutController extends Controller
{
private const STORE_COUNTRY_ISO3 = 'GRC';
public function __construct(
private readonly CartService $cart,
private readonly CheckoutService $checkout,
private readonly CustomerAccountService $account,
) {}
public function show(string $locale): View
{
$cart = $this->cart->current();
$lines = $cart ? $this->cart->activeLines($cart) : collect();
$storeCountry = $this->storeCountry();
$shippingOptions = collect();
// Captured before prefillFromAccount(), which may recreate the address
// row (dropping its shipping_option) — same reason as in saveAddress().
$previousOption = $cart?->shippingAddress?->shipping_option;
if ($cart && Auth::check()) {
$cart = $this->prefillFromAccount($cart);
// Nothing chosen on this cart yet: carry over the account's standing
// opt-in (an explicit earlier choice, recorded with its own
// timestamp/policy version). Never opts anyone in by default.
if (! array_key_exists('recovery_consent', $cart->meta?->toArray() ?? [])
&& data_get($this->account->customer(Auth::user()), 'meta.recovery_consent')) {
$cart = $this->checkout->setRecoveryConsent(true);
}
}
if ($cart?->shippingAddress) {
$shippingOptions = $this->syncShipping($cart, $previousOption);
// Cart's CachesProperties::refresh() explicitly nulls total/
// subTotal/shippingTotal/etc. back to their defaults — every
// Lunar call site pairs it with recalculate() for exactly that
// reason. Bare refresh() here was leaving $cart->total null on
// reload, which fed a 0 amount straight into the Stripe Element.
$cart->refresh()->recalculate();
}
$paymentMethods = $this->checkout->getPaymentMethods();
// Nothing checked yet (fresh cart), or the shopper's earlier pick is
// no longer offered (method disabled/removed since) — auto-select
// the first one, same as a manual click would, so the payment
// section (and the Stripe Element mounting under it) isn't sitting
// inert behind an unchecked radio. A still-valid previous choice is
// left alone.
$firstMethod = $paymentMethods->first();
if ($cart && $firstMethod && ! $paymentMethods->contains('type', data_get($cart, 'meta.payment_method'))) {
$cart = $this->checkout->selectPaymentMethod($firstMethod->type);
}
return view('checkout::page', [
'cart' => $cart,
'lines' => $lines,
'billingAddress' => $cart?->billingAddress,
'shippingAddress' => $cart?->shippingAddress,
'shippingOptions' => $shippingOptions,
'paymentMethods' => $paymentMethods,
'shipToBilling' => (bool) data_get($cart, 'meta.ship_to_billing', true),
'wantsInvoice' => (bool) data_get($cart, 'meta.wants_invoice', false),
'storeCountry' => $storeCountry,
'countries' => $storeCountry
? collect()
: Country::orderBy('name')->get(['id', 'name']),
'regions' => $storeCountry
? State::where('country_id', $storeCountry->id)->orderBy('name')->get(['id', 'name'])
: collect(),
]);
}
public function saveAddress(string $locale, Request $request): JsonResponse
{
$storeCountry = $this->storeCountry();
$sameAsBilling = $request->boolean('same_as_billing');
// Only the fields shipping rates resolve against — if none of these
// changed (shopper edited their name, phone, email, …) there's no point
// re-quoting shipping or re-rendering the summary.
$addressBefore = $this->cart->current()?->shippingAddress;
$rateKeyBefore = $addressBefore?->only(['postcode', 'state', 'country_id']);
// setShippingAddress() below always deletes + recreates this row (see
// syncShipping()'s docblock) — capture what was selected NOW, before
// it's gone, so it can be carried forward onto the fresh row.
$previousOption = $addressBefore?->shipping_option;
$stateRule = $storeCountry
? ['nullable', 'string', Rule::exists((new State)->getTable(), 'name')->where('country_id', $storeCountry->id)]
: ['nullable', 'string', 'max:255'];
$countryRule = $storeCountry
? ['nullable']
: ['nullable', 'integer', 'exists:'.(new Country)->getTable().',id'];
// Lenient — only format checks. Anything that fails is simply left out
// of what gets persisted, and reported back for inline display.
$validator = Validator::make($request->all(), [
'contact_email' => ['nullable', 'email'],
'billing_first_name' => ['nullable', 'string', 'max:255'],
'billing_last_name' => ['nullable', 'string', 'max:255'],
'billing_company_name' => ['nullable', 'string', 'max:255'],
'billing_tax_identifier' => ['nullable', 'string', 'max:255'],
'billing_line_one' => ['nullable', 'string', 'max:255'],
'billing_city' => ['nullable', 'string', 'max:255'],
'billing_state' => $stateRule,
'billing_postcode' => ['nullable', 'string', 'max:20'],
'billing_country_id' => $countryRule,
'billing_contact_phone' => ['nullable', 'string', 'max:50'],
'shipping_first_name' => ['nullable', 'string', 'max:255'],
'shipping_last_name' => ['nullable', 'string', 'max:255'],
'shipping_line_one' => ['nullable', 'string', 'max:255'],
'shipping_city' => ['nullable', 'string', 'max:255'],
'shipping_state' => $stateRule,
'shipping_postcode' => ['nullable', 'string', 'max:20'],
'shipping_country_id' => $countryRule,
'shipping_contact_phone' => ['nullable', 'string', 'max:50'],
'shipping_delivery_instructions' => ['nullable', 'string', 'max:1000'],
]);
$errors = $validator->errors()->toArray();
$data = $validator->valid();
// Logged in: the order email is always the account's. It isn't a field
// on the page then, and a submitted value isn't trusted.
if ($user = Auth::user()) {
$data['contact_email'] = $user->email;
}
$billingCountryId = $storeCountry?->id ?? ($data['billing_country_id'] ?? null);
$shippingCountryId = $storeCountry?->id ?? ($data['shipping_country_id'] ?? $billingCountryId);
// Company/ΑΦΜ only count when "I want an invoice" is ticked; the fields
// stay in the DOM (just hidden) when it isn't, so ignore what they send.
$wantsInvoice = $request->boolean('wants_invoice');
$billing = [
'first_name' => $data['billing_first_name'] ?? null,
'last_name' => $data['billing_last_name'] ?? null,
'company_name' => $wantsInvoice ? ($data['billing_company_name'] ?? null) : null,
'tax_identifier' => $wantsInvoice ? ($data['billing_tax_identifier'] ?? null) : null,
'line_one' => $data['billing_line_one'] ?? null,
'city' => $data['billing_city'] ?? null,
'state' => $data['billing_state'] ?? null,
'postcode' => $data['billing_postcode'] ?? null,
'country_id' => $billingCountryId,
'contact_email' => $data['contact_email'] ?? null,
'contact_phone' => $data['billing_contact_phone'] ?? null,
];
$shipping = $sameAsBilling
? [
...array_diff_key($billing, ['company_name' => 1, 'tax_identifier' => 1]),
'delivery_instructions' => $data['shipping_delivery_instructions'] ?? null,
]
: [
'first_name' => $data['shipping_first_name'] ?? null,
'last_name' => $data['shipping_last_name'] ?? null,
'line_one' => $data['shipping_line_one'] ?? null,
'city' => $data['shipping_city'] ?? null,
'state' => $data['shipping_state'] ?? null,
'postcode' => $data['shipping_postcode'] ?? null,
'country_id' => $shippingCountryId,
'contact_email' => $data['contact_email'] ?? null,
'contact_phone' => $data['shipping_contact_phone'] ?? null,
'delivery_instructions' => $data['shipping_delivery_instructions'] ?? null,
];
$this->checkout->setBillingAddress($billing);
$cart = $this->checkout->setShippingAddress($shipping);
$cart->meta = [
...($cart->meta?->toArray() ?? []),
'ship_to_billing' => $sameAsBilling,
'wants_invoice' => $wantsInvoice,
];
$cart->save();
// Abandoned-cart-recovery opt-in — boboko-core owns the record (bool +
// timestamp + policy version on Cart::meta, RecoveryConsentSet event).
// Deliberately its own scope, not merged with any future newsletter opt-in.
$this->checkout->setRecoveryConsent($request->boolean('recovery_consent'));
if (Auth::check()) {
$this->account->setRecoveryConsent(Auth::user(), $request->boolean('recovery_consent'));
}
$rateKeyAfter = $cart->shippingAddress?->only(['postcode', 'state', 'country_id']);
$rateChanged = $rateKeyAfter != $rateKeyBefore;
// setShippingAddress() above always deletes and recreates the
// CartAddress row (Lunar's AddAddress action), which drops whatever
// shipping_option was previously selected — regardless of whether the
// rate-determining fields actually changed. So this always has to run
// to restore/re-validate it, even on a save that only touched e.g. the
// phone number. Only the fragment RE-RENDER is skippable when nothing
// rate-relevant moved — the re-select itself is not optional.
$options = $this->syncShipping($cart, $previousOption);
if (! $rateChanged) {
return $this->fragments($cart, null, $errors);
}
return $this->fragments($cart, $options, $errors);
}
public function selectShippingOption(string $locale, Request $request): JsonResponse
{
$identifier = (string) $request->input('shipping_option');
try {
$this->checkout->selectShippingOption($identifier);
} catch (InvalidShippingOptionException) {
// Re-render with whatever is currently valid; no hard error surfaced.
}
$cart = $this->cart->current();
$options = $cart?->shippingAddress
? $this->checkout->getShippingOptions()
: collect();
return $this->fragments($cart, $options);
}
/**
* Autosave-select a payment method (radio change). Persists it via
* CheckoutService (which also records it on Cart::meta and re-snapshots
* the fingerprint) so ApplyCashOnDeliveryFee etc. show in the summary.
*/
public function selectPaymentMethod(string $locale, Request $request): JsonResponse
{
$type = (string) $request->input('payment_type');
try {
$this->checkout->selectPaymentMethod($type);
} catch (UnknownPaymentTypeException) {
// Radio value out of sync with what's offered — ignore, the summary
// just won't reflect a method fee. place-order re-checks properly.
}
return response()->json([
'summaryHtml' => view('checkout::partials.cart-body')->render(),
]);
}
/**
* The real submit — the hard gate. Re-selects the payment method (fresh
* fingerprint), then hands off to CheckoutService::initiatePayment(), which
* creates the draft order, records terms acceptance, and charges the driver.
* Returns JSON the bbk-payment controller routes on:
* { redirect } — placed, go to confirmation
* { status: 'pending', clientSecret }— 3-D Secure; client does handleNextAction then polls
* { status: 'failed', message } — declined
* { status: 'invalid'|'stale', ... } — cart incomplete / changed since selection
*/
public function placeOrder(string $locale, Request $request): JsonResponse
{
if (! $request->boolean('terms_accepted')) {
return response()->json(['error' => __('checkout.page.terms_required')], 422);
}
try {
$this->checkout->selectPaymentMethod((string) $request->input('payment_type'));
} catch (UnknownPaymentTypeException) {
return response()->json(['error' => __('checkout.page.choose_payment_method')], 422);
}
$cart = $this->cart->current();
// Captured now, before initiatePayment() can place the order — Lunar's
// CartSessionManager::fetchOrCreate() silently swaps the session onto a
// BRAND NEW empty cart the moment the current one hasCompletedOrders()
// (i.e. has an order with placed_at set), which happens synchronously
// for an immediately-captured payment. Any later $this->cart->current()
// call in this same flow (here, or in a subsequent orderStatus() poll
// once the 3-D Secure webhook sets placed_at) would then resolve to
// that fresh, order-less cart instead of the one that was just placed.
// Storing the real cart id ourselves, under our own session key,
// sidesteps CartSession entirely for the rest of the placement flow.
session(['checkout.cart_id' => $cart?->id]);
// Lunar's own ValidateCartForOrderCreation (order_create validator)
// never checks for this — an empty cart with a valid billing address
// sails straight through it and would place a real, zero-line order.
// The disabled "place order" button is only the client-side half of
// this fix; this is the half that actually matters.
if ($cart === null || $this->cart->activeLines($cart)->isEmpty()) {
return response()->json([
'status' => 'invalid',
'message' => __('checkout.page.cart_empty'),
], 422);
}
// Lenient autosave never requires these; this is the gate.
if (data_get($cart, 'meta.wants_invoice')
&& (blank($cart->billingAddress?->company_name) || blank($cart->billingAddress?->tax_identifier))) {
return response()->json([
'status' => 'invalid',
'message' => __('checkout.page.invoice_required'),
], 422);
}
// Same check Lunar's own ValidateCartForOrderCreation runs inside
// initiatePayment() (a product unpublished/deleted after it was
// added to the cart) — checked here first so the shopper is told
// which product is the problem, rather than falling into the
// catch-all "complete your billing/shipping details" message below,
// which is what actually happened and is generic to every
// CartException reason, misleading when the real cause is a line,
// not an address.
$unavailableLines = $this->cart->activeLines($cart)->filter(
fn ($line) => ! $line->purchasable || ! $line->purchasable->isPurchasable(),
);
if ($unavailableLines->isNotEmpty()) {
$names = $unavailableLines
->map(fn ($line) => $line->purchasable?->product?->translateAttribute('name') ?? $line->purchasable?->getIdentifier())
->filter()
->implode(', ');
return response()->json([
'status' => 'invalid',
'message' => __('checkout.page.cart_line_unavailable', ['name' => $names]),
], 422);
}
// The one incomplete-cart case worth a specific message + pointing the
// shopper at the right section: a region resolving 2+ methods needs an
// explicit pick (no auto-select), easy to miss since nothing else on
// the page demands it. Everything else CartException catches below.
if ($cart?->shippingAddress && ! $cart->shippingAddress->shipping_option) {
return response()->json([
'status' => 'invalid',
'message' => __('checkout.page.shipping_method_required'),
'field' => 'shipping_option',
], 422);
}
$fingerprint = (string) ($cart?->meta['checkout_fingerprint'] ?? '');
$data = $request->filled('payment_method')
? ['payment_method' => (string) $request->input('payment_method')]
: [];
try {
$result = $this->checkout->initiatePayment(
$fingerprint,
termsAccepted: true,
policyVersion: (string) config('legal.terms_version'),
data: $data,
);
} catch (FingerprintMismatchException) {
return response()->json(['status' => 'stale', 'message' => __('checkout.page.payment_cart_changed')], 409);
} catch (CartException $e) {
return response()->json([
'status' => 'invalid',
'message' => __('checkout.page.payment_incomplete_details'),
'errors' => collect($e->errors()->toArray())->map(fn ($m) => is_array($m) ? ($m[0] ?? null) : $m)->all(),
], 422);
} catch (TermsNotAcceptedException) {
return response()->json(['error' => __('checkout.page.terms_required')], 422);
}
// Pending with no continuation (cash-on-delivery, or any other
// deferred/offline method) means CheckoutService::initiatePayment()
// already created the placed order — money just hasn't changed
// hands yet. Only a Pending WITH a continuation (Stripe's client
// secret) means the shopper still has something to do before the
// order exists as far as the storefront is concerned.
return match (true) {
$result->status === PaymentResultStatus::Succeeded => $this->orderPlacedResponse($locale),
$result->status === PaymentResultStatus::Pending && $result->continuation === null => $this->orderPlacedResponse($locale),
$result->status === PaymentResultStatus::Pending => response()->json([
'status' => 'pending',
'clientSecret' => $result->continuation?->value,
]),
default => response()->json([
'status' => 'failed',
'message' => $result->failureReason ?: __('checkout.page.payment_failed'),
'retriable' => $result->retriable,
], 422),
};
}
/**
* Poll target for the 3-D Secure path: has the webhook placed the order yet?
* boboko-core's StripeWebhookController -> handleCallback -> PaymentCaptured
* -> ApplyResolvedPaymentStatus sets placed_at.
*/
public function orderStatus(string $locale): JsonResponse
{
$order = $this->placedOrder();
if (! $order) {
return response()->json(['placed' => false]);
}
session(['checkout.order_id' => $order->id]);
CartSession::forget();
return response()->json(['placed' => true, 'redirect' => route('checkout.confirmation', $locale)]);
}
public function confirmation(string $locale): View|RedirectResponse
{
$orderId = session('checkout.order_id');
$order = $orderId
? Order::with(['lines.purchasable.product', 'shippingAddress', 'billingAddress'])->find($orderId)
: null;
if (! $order) {
return redirect()->route('products', $locale);
}
// Looked up by type rather than a stored relation — the method may since
// have been disabled/deleted, but the order still needs to show what was
// actually used at the time.
$paymentMethodName = PaymentMethod::where('type', $order->meta['payment_method'] ?? null)
->first()
?->translate('name');
return view('checkout::confirmation', [
'order' => $order,
'paymentMethodName' => $paymentMethodName,
]);
}
private function orderPlacedResponse(string $locale): JsonResponse
{
if ($order = $this->placedOrder()) {
session(['checkout.order_id' => $order->id]);
}
CartSession::forget();
return response()->json(['redirect' => route('checkout.confirmation', $locale)]);
}
private function placedOrder(): ?Order
{
$cartId = session('checkout.cart_id');
if ($cartId === null) {
return null;
}
return Order::where('cart_id', $cartId)
->whereNotNull('placed_at')
->latest('placed_at')
->first();
}
/**
* Re-resolve shipping options for the cart's current address and keep the
* selection sane: auto-select when exactly one resolves, or carry a
* previous pick forward when it's still among the resolved options.
*
* $previousOption must be captured by the CALLER before setShippingAddress()
* runs — Lunar's AddAddress action always deletes and recreates the
* CartAddress row on every save (see saveAddress()), so by the time this
* runs, $address->shipping_option is unconditionally null regardless of
* what was selected a moment ago. There is nothing meaningful left to read
* off $address itself; $previousOption is the only source of truth for
* "what was chosen before this save wiped the row." show() passes the
* address's own (not-just-wiped) current value, since nothing recreated
* anything in that path.
*
* Always (re-)applies the resolved target via selectShippingOption() rather
* than comparing against the (always-blank, post-recreation) current value
* — the fresh row needs the write regardless of whether the decision
* "which option" actually changed.
*
* @return Collection<int, \Lunar\DataTypes\ShippingOption>
*/
private function syncShipping(Cart $cart, ?string $previousOption): Collection
{
if (! $cart->shippingAddress) {
return collect();
}
$options = $this->checkout->getShippingOptions();
$target = match (true) {
$options->count() === 1 => $options->first()->identifier,
$previousOption !== null && $options->contains(fn ($option) => $option->identifier === $previousOption) => $previousOption,
default => null,
};
if ($target !== null) {
try {
$this->checkout->selectShippingOption($target);
} catch (InvalidShippingOptionException) {
// $target came from $options itself — shouldn't happen, stay defensive
}
}
return $options;
}
/**
* $options === null means "nothing money-relevant changed" — acknowledge the
* save (and any field errors) without re-rendering the shipping options or
* the order summary, so a plain name/phone edit is a cheap round-trip.
*/
private function fragments(?Cart $cart, ?Collection $options, array $errors = []): JsonResponse
{
return response()->json([
'errors' => collect($errors)
->map(fn ($messages) => is_array($messages) ? ($messages[0] ?? null) : $messages)
->all(),
'shippingOptionsHtml' => $options === null ? null : view('checkout::partials.shipping-options', [
'shippingAddress' => $cart?->shippingAddress,
'shippingOptions' => $options,
])->render(),
// Composer (CheckoutModuleServiceProvider) fills $cart / $lines.
'summaryHtml' => $options === null ? null : view('checkout::partials.cart-body')->render(),
]);
}
/**
* Logged-in shopper: fills any BLANK cart address field from the account
* (name, saved default address, phone, email), on every checkout load, so
* an account filled in after checkout started still shows up. Never
* overwrites anything already in the cart.
*
* Company/ΑΦΜ (and ticking "I want an invoice") only on the first pass
* (meta.account_prefilled): someone who then clears them or unticks the
* box for this order shouldn't get them back on the next reload.
*
* Writes only when something actually changes, so a normal reload costs
* nothing extra.
*/
private function prefillFromAccount(Cart $cart): Cart
{
$user = Auth::user();
$customer = $this->account->customer($user);
$addresses = collect($this->account->addresses($user));
$saved = $addresses->firstWhere('shipping_default', true) ?? $addresses->first();
$firstPass = ! data_get($cart, 'meta.account_prefilled');
$fromAccount = array_filter([
'first_name' => $customer?->first_name ?: $saved?->first_name,
'last_name' => $customer?->last_name ?: $saved?->last_name,
'line_one' => $saved?->line_one,
'city' => $saved?->city,
'state' => $saved?->state,
'postcode' => $saved?->postcode,
'country_id' => $this->storeCountry()?->id ?? $saved?->country_id,
'contact_email' => $user->email,
'contact_phone' => $saved?->contact_phone,
], 'filled');
$invoice = $firstPass
? array_filter([
'company_name' => $customer?->company_name,
'tax_identifier' => $customer?->tax_identifier,
], 'filled')
: [];
$fields = ['first_name', 'last_name', 'company_name', 'tax_identifier', 'line_one', 'city',
'state', 'postcode', 'country_id', 'contact_email', 'contact_phone'];
$fillBlanks = function (?array $current, array $values) {
$current ??= [];
foreach ($values as $key => $value) {
if (blank($current[$key] ?? null)) {
$current[$key] = $value;
}
}
return $current;
};
$billingBefore = $cart->billingAddress?->only($fields);
$billing = $fillBlanks($billingBefore, [...$fromAccount, ...$invoice]);
// Shipping has no company/ΑΦΜ (same shape saveAddress() writes).
$shipToBilling = (bool) data_get($cart, 'meta.ship_to_billing', true);
$shippingFields = [...array_diff($fields, ['company_name', 'tax_identifier']), 'delivery_instructions'];
$shippingBefore = $cart->shippingAddress?->only($shippingFields);
$shipping = $shipToBilling
? [
...array_diff_key($billing, ['company_name' => 1, 'tax_identifier' => 1]),
'delivery_instructions' => $shippingBefore['delivery_instructions'] ?? null,
]
: $fillBlanks($shippingBefore, $fromAccount);
if ($billing != ($billingBefore ?? []) || $shipping != ($shippingBefore ?? [])) {
$this->checkout->setBillingAddress($billing);
$cart = $this->checkout->setShippingAddress($shipping);
}
if ($firstPass) {
$cart->meta = [
...($cart->meta?->toArray() ?? []),
'account_prefilled' => true,
'wants_invoice' => (bool) data_get($cart, 'meta.wants_invoice') || $invoice !== [],
];
$cart->save();
}
return $cart;
}
private function storeCountry(): ?Country
{
if (self::STORE_COUNTRY_ISO3 === null) {
return null;
}
return Country::where('iso3', self::STORE_COUNTRY_ISO3)->first();
}
}
+15 -4
View File
@@ -5,16 +5,18 @@
use App\Http\Requests\ContactRequest; use App\Http\Requests\ContactRequest;
use App\Mail\ContactConfirmationMail; use App\Mail\ContactConfirmationMail;
use App\Mail\ContactMessageMail; use App\Mail\ContactMessageMail;
use App\Models\StoicPage;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Log; use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail; use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\RateLimiter;
use Illuminate\View\View; use Illuminate\View\View;
use Modules\Core\Store\Services\StoreDetailsService;
use Throwable; use Throwable;
/** /**
* Contact form. Nothing is stored: the message is emailed to the store * Contact form. Nothing is stored: the message is emailed to the store
* (CONTACT_EMAIL) and the sender gets a generic confirmation. Both are sent * (Store Details' contact email) and the sender gets a generic confirmation. Both are sent
* synchronously so a failed store email can be reported back on the form. * synchronously so a failed store email can be reported back on the form.
* *
* Limited per IP in here rather than with throttle middleware, so the limit * Limited per IP in here rather than with throttle middleware, so the limit
@@ -27,7 +29,16 @@ class ContactController extends Controller
public function index(string $locale): View public function index(string $locale): View
{ {
return view('contact'); $page = StoicPage::localized('contact');
if (! $page) {
abort(404);
}
return view('contact', [
'page' => $page,
'store' => app(StoreDetailsService::class)->current(),
]);
} }
public function send(string $locale, ContactRequest $request): RedirectResponse public function send(string $locale, ContactRequest $request): RedirectResponse
@@ -41,11 +52,11 @@ public function send(string $locale, ContactRequest $request): RedirectResponse
RateLimiter::hit($key, self::SEND_DECAY_SECONDS); RateLimiter::hit($key, self::SEND_DECAY_SECONDS);
$data = $request->validated(); $data = $request->validated();
$to = config('services.contact.email'); $to = app(StoreDetailsService::class)->current()->contact_email;
try { try {
if (blank($to)) { if (blank($to)) {
throw new \RuntimeException('CONTACT_EMAIL is not set.'); throw new \RuntimeException('Store Details has no contact email.');
} }
Mail::to($to)->send(new ContactMessageMail( Mail::to($to)->send(new ContactMessageMail(
+45
View File
@@ -0,0 +1,45 @@
<?php
namespace App\Http\Controllers;
use App\Models\StoicFaq;
use App\Models\StoicFaqSection;
use App\Models\StoicPage;
use App\Services\Stoic;
use App\Support\StorePlaceholders;
use Illuminate\Support\Str;
use Illuminate\View\View;
/**
* FAQ page: pages/faq.md lists the sections, each section lists its FAQs
* (both Stoic relations, so the order is the editor's). Answers are markdown
* and can use the same store placeholders as the legal pages.
*/
class FaqController extends Controller
{
public function index(string $locale, StorePlaceholders $placeholders): View
{
$page = StoicPage::localized('faq');
if (! $page) {
abort(404);
}
$sections = Stoic::localizedRelation(StoicFaqSection::class, $page->sections, 'faq-sections')
->map(function (StoicFaqSection $section) use ($placeholders) {
$section->items = Stoic::localizedRelation(StoicFaq::class, $section->faqs, 'faqs')
->map(fn (StoicFaq $faq) => $faq->forceFill([
'answer' => Str::markdown($placeholders->fill($faq->content ?? '')),
]));
return $section;
})
->filter(fn (StoicFaqSection $section) => $section->items->isNotEmpty())
->values();
return view('faq', [
'page' => $page,
'sections' => $sections,
]);
}
}
+51 -6
View File
@@ -4,27 +4,72 @@
use App\Catalog\ProductCard; use App\Catalog\ProductCard;
use App\Models\StoicPage; use App\Models\StoicPage;
use Modules\Core\Catalog\DTOs\ProductFilters;
use Modules\Core\Catalog\Services\CollectionService;
use Modules\Core\Catalog\Services\ProductService; use Modules\Core\Catalog\Services\ProductService;
class HomeController extends Controller class HomeController extends Controller
{ {
public function __construct(private readonly ProductService $products) {} /** Slug of the hero collection in the "Homepage" collection group. */
private const HERO_COLLECTION_SLUG = 'hero';
private const HERO_FALLBACK_COUNT = 5;
private const CLASSICS_COUNT = 8;
public function __construct(
private readonly ProductService $products,
private readonly CollectionService $collections,
) {}
public function index(string $locale) public function index(string $locale)
{ {
$page = StoicPage::firstWhere('slug', 'home'); $page = StoicPage::localized('home');
if (! $page) { if (! $page) {
abort(404); abort(404);
} }
$products = collect($this->products->random(13)) // Random pool for the classics carousel, and for the hero too when the
->map(fn (array $product) => ProductCard::fromIndexed($product)); // hero collection is missing or empty. Oversized so hero products can be
// excluded from it and still leave enough.
$random = collect($this->products->random(self::HERO_FALLBACK_COUNT + self::CLASSICS_COUNT));
$hero = collect($this->heroCollectionProducts());
if ($hero->isEmpty()) {
$hero = $random->take(self::HERO_FALLBACK_COUNT);
}
$heroIds = $hero->pluck('id')->all();
$classics = $random
->reject(fn (array $product) => in_array($product['id'], $heroIds))
->take(self::CLASSICS_COUNT);
return view('home', [ return view('home', [
'page' => $page, 'page' => $page,
'heroProducts' => $products->take(5)->values(), 'heroProducts' => $hero->map(fn (array $product) => ProductCard::fromIndexed($product))->values(),
'classicsProducts' => $products->slice(5)->values(), 'classicsProducts' => $classics->map(fn (array $product) => ProductCard::fromIndexed($product))->values(),
]); ]);
} }
/**
* Products the store owner picked for the hero, via the Lunar collection
* with slug "hero". Not in the owner's drag order yet: the product index
* doesn't carry per-collection position (pending a boboko-core task).
*/
private function heroCollectionProducts(): array
{
$collection = $this->collections->getBySlug(self::HERO_COLLECTION_SLUG);
if ($collection === null) {
return [];
}
return $this->products
->list(new ProductFilters(collectionId: $collection['id']))
->products
->items();
}
} }
+10 -2
View File
@@ -3,9 +3,14 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Models\StoicPage; use App\Models\StoicPage;
use App\Support\StorePlaceholders;
class LegalPageController extends Controller class LegalPageController extends Controller
{ {
public function __construct(
private readonly StorePlaceholders $placeholders,
) {}
public function terms(string $locale) public function terms(string $locale)
{ {
return $this->show('terms-and-conditions'); return $this->show('terms-and-conditions');
@@ -28,12 +33,15 @@ public function cookies(string $locale)
private function show(string $slug) private function show(string $slug)
{ {
$page = StoicPage::firstWhere('slug', $slug); $page = StoicPage::localized($slug);
if (! $page) { if (! $page) {
abort(404); abort(404);
} }
return view('legal', ['page' => $page]); return view('legal', [
'page' => $page,
'content' => $this->placeholders->fill($page->content ?? ''),
]);
} }
} }
+86 -55
View File
@@ -2,6 +2,7 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Catalog\CollectionTrail;
use App\Catalog\ProductListing; use App\Catalog\ProductListing;
use App\Catalog\ProductListingPage; use App\Catalog\ProductListingPage;
use Illuminate\Http\JsonResponse; use Illuminate\Http\JsonResponse;
@@ -11,6 +12,7 @@
use Illuminate\Support\Facades\Validator; use Illuminate\Support\Facades\Validator;
use Lunar\Models\Product; use Lunar\Models\Product;
use Lunar\Models\ProductVariant; use Lunar\Models\ProductVariant;
use Modules\Core\Catalog\Services\CollectionService;
use Modules\Core\Catalog\Services\ProductService; use Modules\Core\Catalog\Services\ProductService;
use Modules\Core\Review\Models\ProductReview; use Modules\Core\Review\Models\ProductReview;
@@ -19,6 +21,8 @@ class ProductController extends Controller
public function __construct( public function __construct(
private readonly ProductService $products, private readonly ProductService $products,
private readonly ProductListingPage $listingPage, private readonly ProductListingPage $listingPage,
private readonly CollectionService $collections,
private readonly CollectionTrail $trail,
) {} ) {}
/** /**
@@ -42,20 +46,40 @@ public function show(string $locale, int $id)
$product = $this->products->getById($id); $product = $this->products->getById($id);
abort_if($product === null, Response::HTTP_NOT_FOUND); abort_if($product === null, Response::HTTP_NOT_FOUND);
$product = $this->mergeJustSubmittedReview($product);
$collection = $product['collections'][0] ?? null;
// dd($product);
[$productOptions, $variantsData] = $this->buildOptionPicker($id); [$productOptions, $variantsData] = $this->buildOptionPicker($id);
return view('product.show', [ return view('product.show', [
'collection' => $collection, 'breadcrumb' => [...$this->collectionTrail($product), ['label' => $product['name']]],
'product' => $product, 'product' => $product,
'productOptions' => $productOptions, 'productOptions' => $productOptions,
'variantsData' => $variantsData, 'variantsData' => $variantsData,
]); ]);
} }
/**
* The product's first directly-assigned collection with its ancestors, or
* the all-products page when it has none. The product document's own
* `collections` entries carry neither ancestors nor a current-locale name,
* so the collection is re-read from the collection index.
*
* @return array<int, array{label: string, href?: string}>
*/
private function collectionTrail(array $product): array
{
$assigned = $product['collections'][0] ?? null;
$collection = $assigned !== null ? $this->collections->getById((int) $assigned['id']) : null;
if ($collection === null) {
return [['label' => __('storefront.nav.products'), 'href' => route('products')]];
}
// Untranslated collections resolve to a null name; the product's own
// index-time name is the fallback, same as CollectionTrail's ancestors.
$collection['name'] ??= $assigned['name'];
return $this->trail->for($collection);
}
/** /**
* One button/swatch group per product option (a product can have several * One button/swatch group per product option (a product can have several
* — e.g. a custom-photo product with size + style + person-count, each * — e.g. a custom-photo product with size + style + person-count, each
@@ -109,6 +133,9 @@ private function buildOptionPicker(int $productId): array
'id' => $variant->id, 'id' => $variant->id,
'price' => $variant->prices->first()?->price?->decimal(), 'price' => $variant->prices->first()?->price?->decimal(),
'image' => $variant->images->first()?->getUrl(), 'image' => $variant->images->first()?->getUrl(),
// Live from the DB (not the index's in_stock), with Lunar's own
// purchasability rule — drives the disabled add-to-cart button.
'inStock' => $variant->canBeFulfilledAtQuantity(1),
// handle => selected value id, for matching a combination of // handle => selected value id, for matching a combination of
// selections back to this variant — see selectVariant() in // selections back to this variant — see selectVariant() in
// product-form-controller.js. // product-form-controller.js.
@@ -118,40 +145,6 @@ private function buildOptionPicker(int $productId): array
return [$productOptions, $variantsData]; return [$productOptions, $variantsData];
} }
/**
* Meilisearch's own write API is itself async — addDocuments() enqueues an
* indexing task and returns immediately, and Laravel\Scout\Engines\
* MeilisearchEngine::update() never waits on that task, so even
* $product->searchableSync() (which only skips OUR queue) can still land
* the shopper back on this page before Meilisearch has actually processed
* the write. storeReview() flashes the review it just created for exactly
* this one next request; splice it in here rather than trust the index is
* already caught up. Guarded by id so a race the other way — the index
* DID catch up in time — doesn't show the same review twice.
*/
private function mergeJustSubmittedReview(array $product): array
{
$justSubmitted = session('justSubmittedReview');
if (! $justSubmitted || (string) ($justSubmitted['product_id'] ?? null) !== (string) $product['id']) {
return $product;
}
$items = $product['reviews']['items'] ?? [];
if (collect($items)->contains('id', $justSubmitted['id'])) {
return $product;
}
$items = [$justSubmitted, ...$items];
$product['reviews']['items'] = $items;
$product['reviews']['count'] = count($items);
$product['reviews']['average_rating'] = round(collect($items)->avg('rating'), 1);
return $product;
}
/** /**
* A storefront-owned, checkout-module-independent stock check — the * A storefront-owned, checkout-module-independent stock check — the
* product page's "Add to cart" calls this first and only submits to the * product page's "Add to cart" calls this first and only submits to the
@@ -185,14 +178,21 @@ public function checkStock(string $locale, Request $request): JsonResponse
/** /**
* boboko/core's product_reviews table has no moderation/status column, so * boboko/core's product_reviews table has no moderation/status column, so
* this goes live immediately — no approval queue to land in. * this goes live immediately — no approval queue to land in.
*
* The form submits through Turbo, so the answer is Turbo Streams: the new
* review into the list, the updated count and average, the thank-you in
* place of the form; or, on a validation error, the form again with inline
* errors (422). Nothing goes through the session, so the product page
* itself never reads one (it'll be cached). Without JS this is a plain
* POST that redirects back to the product page, losing the inline errors
* and the thank-you — accepted.
*
* The redirect's ?tab=reviews is a query-string variant of the product
* page: keep that in mind once product pages are cached.
*/ */
public function storeReview(string $locale, Request $request, Product $product): RedirectResponse public function storeReview(string $locale, Request $request, Product $product): RedirectResponse|Response
{ {
$reviewsUrl = route('product.show', [ $wantsStream = str_contains((string) $request->header('Accept'), 'text/vnd.turbo-stream.html');
'locale' => $locale,
'id' => $product->id,
'tab' => 'reviews',
]).'#product-tabs';
$validator = Validator::make($request->all(), [ $validator = Validator::make($request->all(), [
'rating' => ['required', 'integer', 'between:1,5'], 'rating' => ['required', 'integer', 'between:1,5'],
@@ -202,7 +202,13 @@ public function storeReview(string $locale, Request $request, Product $product):
]); ]);
if ($validator->fails()) { if ($validator->fails()) {
return redirect($reviewsUrl)->withErrors($validator)->withInput(); return $wantsStream
? $this->turboStream('product.streams.review-invalid', [
'productId' => $product->id,
'messages' => $validator->errors(),
'values' => $request->only('rating', 'content', 'name', 'email'),
], Response::HTTP_UNPROCESSABLE_ENTITY)
: redirect($this->reviewsUrl($locale, $product));
} }
$data = $validator->validated(); $data = $validator->validated();
@@ -222,17 +228,23 @@ public function storeReview(string $locale, Request $request, Product $product):
]); ]);
// ReviewServiceProvider also reindexes on the model's `created` event, but // ReviewServiceProvider also reindexes on the model's `created` event, but
// queued (SCOUT_QUEUE=true) — it wouldn't land before this redirect's page // queued (SCOUT_QUEUE=true). Syncing here skips our queue, so the next
// load. Syncing here skips our queue too, but Meilisearch's own write API // product page load has it as soon as Meilisearch (itself async) catches
// is itself async on top of that (see mergeJustSubmittedReview()), so this // up. The stream below doesn't wait for the index: it renders the new
// alone still isn't a guarantee — it's the flash below that actually is. // review and the count/average straight from the DB, which is exactly
// what ProductIndexer builds the index's `reviews` from.
$product->searchableSync(); $product->searchableSync();
return redirect($reviewsUrl) if (! $wantsStream) {
->with('reviewSubmitted', true) return redirect($this->reviewsUrl($locale, $product));
->with('justSubmittedReview', [ }
$reviews = ProductReview::where('product_id', $product->id);
return $this->turboStream('product.streams.review-stored', [
// Same shape as ProductIndexer::mapReview(), for the shared partial.
'review' => [
'id' => $review->id, 'id' => $review->id,
'product_id' => $review->product_id,
'title' => $review->title, 'title' => $review->title,
'body' => $review->body, 'body' => $review->body,
'rating' => $review->rating, 'rating' => $review->rating,
@@ -241,6 +253,25 @@ public function storeReview(string $locale, Request $request, Product $product):
'reply' => null, 'reply' => null,
'replied_at' => null, 'replied_at' => null,
'media' => [], 'media' => [],
]); ],
'count' => (clone $reviews)->count(),
'averageRating' => round((float) (clone $reviews)->avg('rating'), 1),
]);
}
private function reviewsUrl(string $locale, Product $product): string
{
return route('product.show', [
'locale' => $locale,
'id' => $product->id,
'tab' => 'reviews',
]).'#product-tabs';
}
private function turboStream(string $view, array $data, int $status = Response::HTTP_OK): Response
{
return response()
->view($view, $data, $status)
->header('Content-Type', 'text/vnd.turbo-stream.html');
} }
} }
+41 -1
View File
@@ -2,17 +2,34 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Catalog\ProductCard;
use App\Catalog\ProductListing; use App\Catalog\ProductListing;
use App\Catalog\ProductListingPage; use App\Catalog\ProductListingPage;
use Modules\Core\Catalog\Services\ProductSearchService;
class SearchController extends Controller class SearchController extends Controller
{ {
public function __construct(private readonly ProductListingPage $listingPage) {} /** Live search answers from this many characters on. */
public const LIVE_MIN_CHARS = 3;
/** How many products the live search dropdown lists. */
private const LIVE_LIMIT = 6;
public function __construct(
private readonly ProductListingPage $listingPage,
private readonly ProductSearchService $search,
) {}
public function show(string $locale) public function show(string $locale)
{ {
$query = trim((string) request()->query('q', '')); $query = trim((string) request()->query('q', ''));
// The search overlay's live results: the same endpoint, asked for by
// its <turbo-frame id="search-suggestions"> as the shopper types.
if (request()->header('Turbo-Frame') === 'search-suggestions') {
return $this->suggestions($query);
}
if ($query === '') { if ($query === '') {
return redirect()->route('products'); return redirect()->route('products');
} }
@@ -28,4 +45,27 @@ public function show(string $locale)
return view('search.index', [...$data, 'query' => $query]); return view('search.index', [...$data, 'query' => $query]);
} }
/**
* The first few matches and how many there are in all — the dropdown
* under the search overlay. Empty below LIVE_MIN_CHARS characters.
*/
private function suggestions(string $query)
{
$products = collect();
$total = 0;
if (mb_strlen($query) >= self::LIVE_MIN_CHARS) {
$result = $this->search->search($query, perPage: self::LIVE_LIMIT);
$products = collect($result->products->items())->map(ProductCard::fromIndexed(...));
$total = $result->products->total();
}
return view('search.suggestions', [
'query' => $query,
'products' => $products,
'total' => $total,
'searched' => mb_strlen($query) >= self::LIVE_MIN_CHARS,
]);
}
} }
+7 -23
View File
@@ -3,19 +3,21 @@
namespace App\Http\Controllers; namespace App\Http\Controllers;
use App\Catalog\ProductCard; use App\Catalog\ProductCard;
use App\Services\Wishlist;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse; use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Collection; use Illuminate\Support\Collection;
use Illuminate\View\View; use Illuminate\View\View;
use Lunar\Models\Product;
use Modules\Core\Catalog\Services\ProductService; use Modules\Core\Catalog\Services\ProductService;
use Modules\Core\Wishlist\Services\WishlistService;
/**
* Page rendering only — the toggle action itself lives in core
* (Modules\Core\Wishlist\Http\Controllers\WishlistController, route
* `wishlist.toggle`), since it needs no app-specific presentation.
*/
class WishlistController extends Controller class WishlistController extends Controller
{ {
public function __construct( public function __construct(
private readonly Wishlist $wishlist, private readonly WishlistService $wishlist,
) {} ) {}
/** /**
@@ -39,24 +41,6 @@ public function guest(string $locale, ProductService $products): View|RedirectRe
return view('wishlist.guest', ['products' => $this->products($products)]); return view('wishlist.guest', ['products' => $this->products($products)]);
} }
/**
* Adds or removes a product, for guests and logged-in shoppers alike. The
* heart button's Stimulus controller asks for JSON; without JS the form
* posts normally and comes back to the same page.
*/
public function toggle(string $locale, Request $request, int $productId): JsonResponse|RedirectResponse
{
abort_unless(Product::whereKey($productId)->exists(), 404);
$active = $this->wishlist->toggle($productId);
if ($request->expectsJson()) {
return response()->json(['active' => $active]);
}
return back();
}
/** /**
* Product cards for the current wishlist, newest first. Products no longer * Product cards for the current wishlist, newest first. Products no longer
* in the search index (deleted, unpublished) are simply skipped. * in the search index (deleted, unpublished) are simply skipped.
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Middleware;
use Closure;
use Illuminate\Http\Request;
use Symfony\Component\HttpFoundation\Response;
/**
* Sends `X-Robots-Tag: noindex, nofollow` on every Laravel response unless
* config('app.indexable') is on. Opt-in rather than tied to APP_ENV, since
* staging runs with APP_ENV=production too; only the live site sets
* APP_INDEXABLE=true.
*
* robots.txt deliberately still allows crawling: a Disallow would stop
* crawlers from fetching pages at all, so they'd never see this header and
* already-indexed URLs would stay in the index.
*/
class PreventIndexing
{
public function handle(Request $request, Closure $next): Response
{
$response = $next($request);
if (! config('app.indexable')) {
$response->headers->set('X-Robots-Tag', 'noindex, nofollow');
}
return $response;
}
}
+9
View File
@@ -2,6 +2,7 @@
namespace App\Http\Requests; namespace App\Http\Requests;
use App\Rules\HCaptcha;
use Illuminate\Foundation\Http\FormRequest; use Illuminate\Foundation\Http\FormRequest;
class ContactRequest extends FormRequest class ContactRequest extends FormRequest
@@ -17,6 +18,14 @@ public function rules(): array
'name' => ['required', 'string', 'max:100'], 'name' => ['required', 'string', 'max:100'],
'email' => ['required', 'email', 'max:255'], 'email' => ['required', 'email', 'max:255'],
'message' => ['required', 'string', 'max:5000'], 'message' => ['required', 'string', 'max:5000'],
'h-captcha-response' => ['bail', 'required', new HCaptcha],
];
}
public function messages(): array
{
return [
'h-captcha-response.required' => __('storefront.auth.captcha_failed'),
]; ];
} }
} }
@@ -1,23 +0,0 @@
<?php
namespace App\Listeners;
use App\Services\Wishlist;
use Modules\Core\Auth\Events\UserAuthenticated;
/**
* Picked up by Laravel's listener discovery (app/Listeners), no manual
* registration. Runs inside the login request, so it can read the guest
* wishlist cookie and queue its removal.
*/
class MergeGuestWishlistOnLogin
{
public function __construct(
private readonly Wishlist $wishlist,
) {}
public function handle(UserAuthenticated $event): void
{
$this->wishlist->mergeGuestInto($event->user);
}
}
+1 -1
View File
@@ -8,7 +8,7 @@
use Illuminate\Mail\Mailables\Envelope; use Illuminate\Mail\Mailables\Envelope;
/** /**
* A contact-form message, sent to the store's CONTACT_EMAIL. Reply-To is the * A contact-form message, sent to Store Details' contact email. Reply-To is the
* sender, so replying from the inbox goes straight to them. * sender, so replying from the inbox goes straight to them.
*/ */
class ContactMessageMail extends Mailable class ContactMessageMail extends Mailable
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
use JacobJoergensen\LaravelPaper\Attributes\Driver;
use JacobJoergensen\LaravelPaper\Paper;
// A question and its answer (markdown body), listed by an FAQ section.
// Default-locale entries, like StoicPage; Stoic::localizedRelation() layers
// the current locale's fields on top.
#[Driver("markdown")]
#[ContentPath("resources/stoic/content/el/faqs")]
class StoicFaq extends Model
{
use Paper;
}
+18
View File
@@ -0,0 +1,18 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
use JacobJoergensen\LaravelPaper\Attributes\Driver;
use JacobJoergensen\LaravelPaper\Paper;
// A titled group of FAQs on the FAQ page, ordered by its faqs relation.
// Default-locale entries, like StoicPage; Stoic::localizedRelation() layers
// the current locale's fields on top.
#[Driver("markdown")]
#[ContentPath("resources/stoic/content/el/faq-sections")]
class StoicFaqSection extends Model
{
use Paper;
}
+17 -1
View File
@@ -2,16 +2,32 @@
namespace App\Models; namespace App\Models;
use App\Services\Stoic;
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use JacobJoergensen\LaravelPaper\Attributes\ContentPath; use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
use JacobJoergensen\LaravelPaper\Attributes\Driver; use JacobJoergensen\LaravelPaper\Attributes\Driver;
use JacobJoergensen\LaravelPaper\Attributes\Timestamps; use JacobJoergensen\LaravelPaper\Attributes\Timestamps;
use JacobJoergensen\LaravelPaper\Paper; use JacobJoergensen\LaravelPaper\Paper;
// Points at the default locale (el), which Stoic writes every field to. Other
// locales hold only the translatable fields — use localized() to get a page
// with those layered on top for the current locale.
#[Driver("markdown")] #[Driver("markdown")]
#[ContentPath("resources/stoic/content/pages")] #[ContentPath("resources/stoic/content/el/pages")]
#[Timestamps] #[Timestamps]
class StoicPage extends Model class StoicPage extends Model
{ {
use Paper; use Paper;
/**
* The page in the current locale: the default-locale entry, with the
* current locale's non-empty fields (and body) swapped in. Untranslated
* fields fall back to the default locale.
*/
public static function localized(string $slug): ?static
{
$page = static::firstWhere('slug', $slug);
return $page?->forceFill(Stoic::localeOverrides("pages/{$slug}.md"));
}
} }
+16 -1
View File
@@ -29,12 +29,26 @@ class User extends Authenticatable implements LunarUserInterface
]; ];
/** /**
* The attributes that should be hidden for serialization. * The attributes that should be hidden for serialization. Every
* secret-bearing OTP/pending-email-change field is included here,
* not just remember_token — otp_code_hash and
* pending_email_code_hash are bcrypt hashes rather than the raw
* codes (see Modules\Core\Auth\Services\UserOtpService and
* Modules\Core\Customer\Services\CustomerEmailChangeService), but a
* hash is still not something any serialized response should leak,
* and otp_attempts/pending_email_attempts reveal in-progress guess
* counts.
* *
* @var list<string> * @var list<string>
*/ */
protected $hidden = [ protected $hidden = [
'remember_token', 'remember_token',
'otp_code_hash',
'otp_expires_at',
'otp_attempts',
'pending_email_code_hash',
'pending_email_expires_at',
'pending_email_attempts',
]; ];
/** /**
@@ -46,6 +60,7 @@ protected function casts(): array
{ {
return [ return [
'email_verified_at' => 'datetime', 'email_verified_at' => 'datetime',
'otp_code_hash' => 'hashed',
]; ];
} }
} }
-14
View File
@@ -1,14 +0,0 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
/**
* One product on a logged-in user's wishlist. Guests' wishlists live in a
* cookie instead — see App\Services\Wishlist.
*/
class WishlistItem extends Model
{
protected $fillable = ['user_id', 'product_id'];
}
+47 -8
View File
@@ -4,41 +4,80 @@
use App\Models\Customer; use App\Models\Customer;
use App\Models\Staff; use App\Models\Staff;
use App\Services\StoicSettings;
use Illuminate\Database\Eloquent\Relations\Relation; use Illuminate\Database\Eloquent\Relations\Relation;
use Illuminate\Mail\Events\MessageSending;
use Illuminate\Support\Facades\Event;
use Illuminate\Support\Facades\URL; use Illuminate\Support\Facades\URL;
use Illuminate\Support\Facades\View; use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider; use Illuminate\Support\ServiceProvider;
use Illuminate\View\View as ViewInstance; use Illuminate\View\View as ViewInstance;
use Lunar\Facades\ModelManifest; use Lunar\Facades\ModelManifest;
use Lunar\Facades\Telemetry; use Lunar\Facades\Telemetry;
use Lunar\Models\CollectionGroup;
use Modules\Core\Catalog\DTOs\CollectionFilters; use Modules\Core\Catalog\DTOs\CollectionFilters;
use Modules\Core\Catalog\Enums\CollectionSort; use Modules\Core\Catalog\Enums\CollectionSort;
use Modules\Core\Catalog\Services\CollectionService; use Modules\Core\Catalog\Services\CollectionService;
use Modules\Core\Store\Services\StoreDetailsService;
use Symfony\Component\Mime\Address;
class AppServiceProvider extends ServiceProvider class AppServiceProvider extends ServiceProvider
{ {
public function register(): void public function register(): void
{ {
// One instance per request: it caches the guest cookie's ids, so a $this->app->scoped(StoicSettings::class);
// toggle and a later has() in the same request agree.
$this->app->scoped(\App\Services\Wishlist::class);
} }
public function boot(): void public function boot(): void
{ {
Telemetry::optOut(); Telemetry::optOut();
// header.blade.php's category dropdown — root collections only, resolved // header.blade.php's category dropdown — root collections of the catalog
// per-request so the composer runs after `locale` middleware has already // group only, so merchandising groups (e.g. "Homepage") stay out of the
// set App::getLocale(), which CollectionService's name resolution depends on. // nav. Resolved per-request so the composer runs after `locale` middleware
// has already set App::getLocale(), which CollectionService's name
// resolution depends on. The group is looked up by handle, not id, since
// ids can differ between environments.
View::composer('components.header', function (ViewInstance $view) { View::composer('components.header', function (ViewInstance $view) {
$view->with('categories', app(CollectionService::class)->list( $groupId = CollectionGroup::where('handle', 'shopify')->value('id');
filters: new CollectionFilters(rootOnly: true),
$view->with('categories', $groupId === null ? [] : app(CollectionService::class)->list(
filters: new CollectionFilters(groupId: $groupId, rootOnly: true),
perPage: 100, perPage: 100,
sort: CollectionSort::Position, sort: CollectionSort::Position,
)->items()); )->items());
}); });
// Site-wide settings edited in Stoic (settings.md): default meta
// description, social links for the footer, emails and schema.org.
View::composer(
['layouts.app', 'components.footer', 'emails.layout', 'home'],
fn (ViewInstance $view) => $view->with('stoicSettings', app(StoicSettings::class)),
);
// INTERIM, belongs in boboko-core's Store module: the sender name on
// outgoing emails comes from Store Details' "Mail from name", with
// MAIL_FROM_NAME as the fallback when it's empty. Done per message
// rather than by setting config at boot, so a long-running queue
// worker picks up a changed name without a restart. Only the default
// from address is renamed; a mailable with its own from is left alone.
Event::listen(MessageSending::class, function (MessageSending $event) {
$name = app(StoreDetailsService::class)->current()->mail_from_name;
if (blank($name)) {
return;
}
$defaultAddress = config('mail.from.address');
$event->message->from(...array_map(
fn (Address $from) => $from->getAddress() === $defaultAddress
? new Address($from->getAddress(), $name)
: $from,
$event->message->getFrom(),
));
});
if ($this->app->environment('production')) { if ($this->app->environment('production')) {
URL::forceScheme('https'); URL::forceScheme('https');
} }
@@ -1,53 +0,0 @@
<?php
namespace App\Providers;
use Illuminate\Support\Facades\Blade;
use Illuminate\Support\Facades\Route;
use Illuminate\Support\Facades\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\View as ViewInstance;
use Modules\Core\Cart\Services\CartService;
/**
* The seam for the (currently in-repo) cart + checkout module.
*
* Everything the module needs to boot inside a host app lives here: its view /
* component namespaces, its routes, and the composer that feeds the
* always-present cart drawer. Strings (__('checkout.cart.*')) are NOT wired up
* here — same as storefront.* elsewhere in this app, they resolve through
* Lunar's DB-backed translation UI (spatie/laravel-translation-loader), added
* manually there rather than shipped as lang/ files. The module's own files
* (resources/views/checkout/**, resources/js/checkout/**, resources/css/checkout.css,
* routes/checkout.php, app/Http/Controllers/Checkout/**) contain nothing
* 3dealer-specific.
*
* When the module is extracted to boboko-core, this class is deleted and its
* body becomes the package's own ServiceProvider. The only other host wiring
* is the one registerCheckout() call in resources/js/app.js and the two lines
* in the layout (the checkout.css @vite entry and @include('checkout::drawer')).
*/
class CheckoutModuleServiceProvider extends ServiceProvider
{
public function boot(): void
{
$this->loadViewsFrom(resource_path('views/checkout'), 'checkout');
Blade::anonymousComponentNamespace('checkout::components', 'checkout');
Route::middleware('web')->group(base_path('routes/checkout.php'));
// The drawer is rendered on every page (from the layout) and its body
// partial is re-rendered on every cart mutation — both need the current
// cart without a controller in the loop.
View::composer(
['checkout::drawer', 'checkout::partials.cart-body'],
function (ViewInstance $view) {
$service = app(CartService::class);
$cart = $service->current();
$view->with('cart', $cart);
$view->with('lines', $cart ? $service->activeLines($cart) : collect());
},
);
}
}
+66
View File
@@ -0,0 +1,66 @@
<?php
namespace App\Rules;
use Closure;
use Illuminate\Contracts\Validation\ValidationRule;
use Illuminate\Http\Client\ConnectionException;
use Illuminate\Support\Facades\Http;
use Illuminate\Support\Facades\Log;
/**
* Verifies the `h-captcha-response` token the hCaptcha widget adds to a form.
* Use it as `'h-captcha-response' => ['required', new HCaptcha]`.
*
* Fails closed: if hCaptcha can't be reached the submission is rejected, since
* letting it through would reopen the hole this exists to close (bots making
* us send email to arbitrary addresses).
*/
class HCaptcha implements ValidationRule
{
public function validate(string $attribute, mixed $value, Closure $fail): void
{
if (! is_string($value) || $value === '') {
$fail(__('storefront.auth.captcha_failed'));
return;
}
try {
$response = Http::asForm()
->timeout(5)
->post('https://api.hcaptcha.com/siteverify', [
'secret' => config('services.hcaptcha.secret'),
'response' => $value,
// Rejects tokens solved against someone else's sitekey.
'sitekey' => config('services.hcaptcha.sitekey'),
'remoteip' => request()->ip(),
]);
} catch (ConnectionException $e) {
Log::warning('hCaptcha siteverify unreachable', ['error' => $e->getMessage()]);
$fail(__('storefront.auth.captcha_failed'));
return;
}
if (! $response->successful() || $response->json('success') !== true) {
// A bad/missing secret or sitekey would otherwise look like every
// shopper failing the captcha.
$configErrors = array_intersect((array) $response->json('error-codes'), [
'missing-input-secret',
'invalid-input-secret',
'sitekey-secret-mismatch',
'invalid-sitekey',
]);
if ($response->failed() || $configErrors) {
Log::warning('hCaptcha siteverify error', [
'status' => $response->status(),
'error-codes' => $response->json('error-codes'),
]);
}
$fail(__('storefront.auth.captcha_failed'));
}
}
}
+53
View File
@@ -4,6 +4,7 @@
use Illuminate\Database\Eloquent\Model; use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage; use Illuminate\Support\Facades\Storage;
use Spatie\YamlFrontMatter\YamlFrontMatter;
use Symfony\Component\Yaml\Yaml; use Symfony\Component\Yaml\Yaml;
class Stoic class Stoic
@@ -29,6 +30,42 @@ public static function presets(): array
return static::$presets; return static::$presets;
} }
// Stoic's default locale (first in i18n.locales), or null when i18n is off.
// Its content folder holds every field; other locales only translatable ones.
public static function defaultLocale(): ?string
{
static::loadConfig();
return static::$config["i18n"]["locales"][0]["code"] ?? null;
}
// The current locale's translated fields for a content file (path relative
// to a locale folder, e.g. "pages/home.md"), with the markdown body as
// `content`. Empty when the current locale is the default one (or i18n is
// off), the file doesn't exist, or a field is left blank — so layering this
// over the default-locale values falls back to them field by field.
public static function localeOverrides(string $file): array
{
$default = static::defaultLocale();
$locale = app()->getLocale();
if ($default === null || $locale === $default) {
return [];
}
$path = resource_path("stoic/content/{$locale}/{$file}");
if (!is_file($path)) {
return [];
}
$document = YamlFrontMatter::parse(file_get_contents($path));
return array_filter(
[...$document->matter(), "content" => trim($document->body())],
fn($value) => filled($value),
);
}
// Returns the public URL for a stoic image at a given preset. // Returns the public URL for a stoic image at a given preset.
public static function image(string $filename, string $preset): string public static function image(string $filename, string $preset): string
{ {
@@ -142,6 +179,22 @@ public static function hasMany(
)); ));
} }
// hasMany() with each entry's current-locale fields layered on top (see
// localeOverrides). $folder is both the relation prefix and the content
// folder, e.g. "faqs". Refs pointing at deleted entries are dropped.
public static function localizedRelation(
string $relation,
?array $slugs,
string $folder,
) {
return static::hasMany($relation, $slugs ?? [], $folder)
->filter()
->map(fn($entry) => $entry->forceFill(
static::localeOverrides("{$folder}/{$entry->slug}.md"),
))
->values();
}
public static function hasOne( public static function hasOne(
string $relation, string $relation,
string $slug, string $slug,
+96
View File
@@ -0,0 +1,96 @@
<?php
namespace App\Services;
use Spatie\YamlFrontMatter\YamlFrontMatter;
/**
* Site-wide, marketing-editable settings from Stoic's `settings` singleton
* (resources/stoic/content/{locale}/settings.md). Read directly rather than
* through a Paper model: Paper models map to a folder of entries, and this is
* one file per locale. Legal and transactional details (address, ΑΦΜ, phone)
* live in boboko-core's StoreDetails instead.
*
* Stoic writes every field to the default locale's file and only the
* translatable ones (e.g. meta_description) to the others, so the current
* locale's file is layered over the default one; empty values fall through.
*
* Bound as scoped in AppServiceProvider, so files are parsed at most once per
* locale per request (or queued job) and edits in Stoic show up on the next one.
* The locale is read per call, not at construction, so a mail rendered with
* ->locale() still gets its own locale's values.
*/
class StoicSettings
{
private const SOCIALS = [
'facebook' => 'Facebook',
'instagram' => 'Instagram',
'tiktok' => 'TikTok',
];
/** @var array<string, array<string, mixed>> keyed by locale */
private array $data = [];
public function get(string $key, mixed $default = null): mixed
{
$value = $this->data()[$key] ?? null;
return filled($value) ? $value : $default;
}
/**
* Absolute og:image URL for a Stoic image field value (the page's own, else
* the default from settings.md), or null. Image fields store a
* comma-separated list; only the first is used.
*/
public function ogImageUrl(?string $pageImage = null): ?string
{
$filename = trim(explode(',', $pageImage ?: (string) $this->get('og_image', ''))[0]);
return $filename === '' ? null : url(Stoic::image($filename, 'large'));
}
/**
* Only the networks that have a URL set, in display order.
*
* @return list<array{icon: string, label: string, url: string}>
*/
public function socialLinks(): array
{
$links = [];
foreach (self::SOCIALS as $icon => $label) {
if ($url = $this->get("{$icon}_url")) {
$links[] = ['icon' => $icon, 'label' => $label, 'url' => $url];
}
}
return $links;
}
private function data(): array
{
$locale = app()->getLocale();
return $this->data[$locale] ??= $this->load();
}
private function load(): array
{
$default = Stoic::defaultLocale();
if ($default === null) {
return $this->parse(resource_path('stoic/content/settings.md'));
}
return array_merge(
$this->parse(resource_path("stoic/content/{$default}/settings.md")),
Stoic::localeOverrides('settings.md'),
);
}
private function parse(string $path): array
{
return is_file($path) ? YamlFrontMatter::parse(file_get_contents($path))->matter() : [];
}
}
-126
View File
@@ -1,126 +0,0 @@
<?php
namespace App\Services;
use App\Models\WishlistItem;
use Illuminate\Contracts\Auth\Authenticatable;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Facades\Cookie;
/**
* The current shopper's wishlist, product ids only.
*
* Logged in: rows in wishlist_items. Guest: a 1-year cookie holding the ids
* (encrypted like every cookie, by the web group's EncryptCookies), so nothing
* is written to the database for anonymous visitors. On login the cookie is
* merged into the account and cleared (MergeGuestWishlistOnLogin).
*/
class Wishlist
{
public const COOKIE = 'wishlist';
private const COOKIE_MINUTES = 60 * 24 * 365;
// Keeps the cookie well under the 4KB browser limit.
private const GUEST_MAX = 100;
/** @var array<int>|null ids for this request, including a toggle just made */
private ?array $guestIds = null;
/** @return array<int> newest first */
public function ids(): array
{
if ($user = Auth::user()) {
return WishlistItem::where('user_id', $user->id)
->latest('id')
->pluck('product_id')
->all();
}
return $this->guestIds();
}
public function has(int $productId): bool
{
return in_array($productId, $this->ids(), true);
}
/**
* @return bool whether the product is on the wishlist afterwards
*/
public function toggle(int $productId): bool
{
if ($user = Auth::user()) {
$deleted = WishlistItem::where('user_id', $user->id)->where('product_id', $productId)->delete();
if ($deleted) {
return false;
}
WishlistItem::create(['user_id' => $user->id, 'product_id' => $productId]);
return true;
}
$ids = $this->guestIds();
if (in_array($productId, $ids, true)) {
$this->storeGuestIds(array_values(array_diff($ids, [$productId])));
return false;
}
$this->storeGuestIds(array_slice([$productId, ...$ids], 0, self::GUEST_MAX));
return true;
}
public function remove(int $productId): void
{
if ($this->has($productId)) {
$this->toggle($productId);
}
}
/**
* Moves the guest cookie's products onto $user's wishlist and clears it.
*/
public function mergeGuestInto(Authenticatable $user): void
{
$ids = $this->guestIds();
if ($ids === []) {
return;
}
// Oldest first, so the newest cookie item also ends up newest here.
foreach (array_reverse($ids) as $productId) {
WishlistItem::firstOrCreate(['user_id' => $user->id, 'product_id' => $productId]);
}
$this->guestIds = [];
Cookie::queue(Cookie::forget(self::COOKIE));
}
/** @return array<int> */
private function guestIds(): array
{
if ($this->guestIds !== null) {
return $this->guestIds;
}
$decoded = json_decode((string) request()->cookie(self::COOKIE), true);
return $this->guestIds = is_array($decoded)
? array_values(array_unique(array_filter(array_map('intval', $decoded))))
: [];
}
/** @param array<int> $ids */
private function storeGuestIds(array $ids): void
{
$this->guestIds = $ids;
Cookie::queue(self::COOKIE, json_encode($ids), self::COOKIE_MINUTES);
}
}
+74
View File
@@ -0,0 +1,74 @@
<?php
namespace App\Support;
use Illuminate\Support\HtmlString;
use Normalizer;
/**
* Underlines the words of a product name that a search query matched, for
* the live search dropdown: every word starting with one of the query's
* words ("click" → "Edamame _Clicker_"), ignoring case and accents the way
* Meilisearch does ("παπ" → "_Παπάκι_"). Typo matches aren't marked — the
* name is shown as is.
*/
final class SearchHighlight
{
public static function name(string $name, string $query, string $class = 'underline underline-offset-4'): HtmlString
{
$terms = array_values(array_filter(preg_split('/[^\p{L}\p{N}]+/u', self::fold($query)) ?: []));
$chars = mb_str_split($name);
if ($terms === [] || $chars === []) {
return new HtmlString(e($name));
}
// One folded character per original one, so positions line up.
$folded = array_map(self::fold(...), $chars);
$html = '';
$i = 0;
$count = count($chars);
while ($i < $count) {
if (! self::isWordChar($chars[$i])) {
$html .= e($chars[$i++]);
continue;
}
$end = $i;
while ($end < $count && self::isWordChar($chars[$end])) {
$end++;
}
$word = implode('', array_slice($chars, $i, $end - $i));
$foldedWord = implode('', array_slice($folded, $i, $end - $i));
$matched = collect($terms)->contains(fn (string $term) => str_starts_with($foldedWord, $term));
$html .= $matched ? '<span class="'.e($class).'">'.e($word).'</span>' : e($word);
$i = $end;
}
return new HtmlString($html);
}
/**
* Lower case, without accents; Greek final sigma as σ.
*/
private static function fold(string $text): string
{
if (class_exists(Normalizer::class)) {
$text = preg_replace('/\p{Mn}+/u', '', Normalizer::normalize($text, Normalizer::FORM_D) ?: $text);
}
return strtr(mb_strtolower($text), [
'ά' => 'α', 'έ' => 'ε', 'ή' => 'η', 'ί' => 'ι', 'ό' => 'ο', 'ύ' => 'υ', 'ώ' => 'ω',
'ϊ' => 'ι', 'ϋ' => 'υ', 'ΐ' => 'ι', 'ΰ' => 'υ', 'ς' => 'σ',
]);
}
private static function isWordChar(string $char): bool
{
return (bool) preg_match('/[\p{L}\p{N}]/u', $char);
}
}
+41
View File
@@ -0,0 +1,41 @@
<?php
namespace App\Support;
use Modules\Core\Store\Services\StoreDetailsService;
/**
* {placeholder} => StoreDetails column, usable in Stoic markdown (legal pages,
* FAQ answers).
*/
class StorePlaceholders
{
private const PLACEHOLDERS = [
'{store_name}' => 'name',
'{store_address}' => 'address',
'{store_phone}' => 'phone',
'{store_contact_email}' => 'contact_email',
'{store_legal_name}' => 'legal_name',
'{store_tax_identifier}' => 'tax_identifier',
'{store_registration_number}' => 'registration_number',
];
public function __construct(
private readonly StoreDetailsService $storeDetails,
) {}
/**
* Swapped in before the markdown is rendered, so values are escaped: the
* rendered markdown is printed unescaped. An empty field renders as
* nothing rather than leaving the raw placeholder on the page.
*/
public function fill(string $content): string
{
$details = $this->storeDetails->current();
return strtr($content, array_map(
fn (string $column) => e((string) ($details->translate($column) ?? '')),
self::PLACEHOLDERS,
));
}
}
+49
View File
@@ -0,0 +1,49 @@
#!/usr/bin/env bash
# Refuse to commit boboko-core "local mode" wiring (see bin/core-mode).
#
# Local mode points composer.json / package.json and both lockfiles at
# ../boboko-core, which doesn't exist on the server, so committing any of them
# breaks the build for everyone. Runs as the git pre-commit hook
# (.githooks/pre-commit) and only looks at what is staged: you can keep working
# in local mode and commit everything else — just leave these four unstaged.
set -euo pipefail
cd "$(git rev-parse --show-toplevel)"
staged=$(git diff --cached --name-only --diff-filter=ACMR)
is_staged() { printf '%s\n' "$staged" | grep -qx "$1"; }
show() { git show ":$1"; }
problems=()
# Same detection as bin/core-mode. The leading quote keeps "_repositories"
# (the parked block) out of the match.
if is_staged composer.json &&
show composer.json | sed -n '/"repositories": \[/,/"type"/p' | grep -q '"type": "path"'; then
problems+=("composer.json: \"repositories\" is the local path repo")
fi
if is_staged package.json &&
show package.json | sed -n '/"dependencies": {/,/}/p' | grep -q '"@boboko/core": "file:'; then
problems+=("package.json: @boboko/core is file:../boboko-core")
fi
if is_staged composer.lock &&
show composer.lock | grep -A14 '"name": "boboko/core"' | grep -q '"type": "path"'; then
problems+=("composer.lock: boboko/core is locked to the local path")
fi
if is_staged package-lock.json &&
show package-lock.json | grep -A6 '"node_modules/@boboko/core": {' | grep -q '"link": true'; then
problems+=("package-lock.json: @boboko/core is a link to ../boboko-core")
fi
[ ${#problems[@]} -eq 0 ] && exit 0
{
echo "!!! Commit blocked: boboko-core local-mode wiring is staged."
printf ' - %s\n' "${problems[@]}"
echo
echo " Unstage them and keep working in local mode:"
echo " git restore --staged composer.json composer.lock package.json package-lock.json"
echo " or switch back first:"
echo " bin/core-mode repo"
} >&2
exit 1
Executable
+158
View File
@@ -0,0 +1,158 @@
#!/usr/bin/env bash
# Switch how this app consumes boboko-core, then restart the dev stack so the
# entrypoints re-resolve it.
#
# bin/core-mode local ../boboko-core checkout (Composer path repo + npm file:)
# bin/core-mode repo tagged releases from the forge (Composer VCS repo + npm git+semver)
# bin/core-mode print the current mode
#
# Running it for the mode you're already in skips the file edits but still
# restarts the stack — that's how repo mode picks up a newly pushed tag.
#
# The toggle lives in composer.json ("repositories" <-> "_repositories") and
# package.json (@boboko/core in "dependencies" <-> "_dependencies"). The dev
# entrypoints run `composer update boboko/*` and `npm update @boboko/core` on
# every boot, which rewrites composer.lock / package-lock.json for the mode.
set -euo pipefail
cd "$(dirname "$0")/.."
fail() { echo "!!! $*" >&2; exit 1; }
# Escape a string for use as a sed regex / replacement with "|" as delimiter.
sed_pattern() { printf '%s' "$1" | sed 's/[][\.*^$|]/\\&/g'; }
sed_replacement() { printf '%s' "$1" | sed 's/[\&|]/\\&/g'; }
current_mode() {
local composer_type npm_dep composer_mode npm_mode
# The live block is "repositories" — the leading quote keeps "_repositories" out.
composer_type=$(sed -n '/"repositories": \[/,/"type"/p' composer.json | grep -o '"type": "[a-z]*"' | head -1)
npm_dep=$(sed -n '/"dependencies": {/,/}/p' package.json | grep -o '"@boboko/core": "[^"]*"' | head -1)
case "$composer_type" in
*'"path"') composer_mode=local ;;
*'"vcs"') composer_mode=repo ;;
*) fail "Can't tell the mode from composer.json's \"repositories\" block." ;;
esac
case "$npm_dep" in
*'"file:'*) npm_mode=local ;;
*'"git+'*) npm_mode=repo ;;
*) fail "Can't tell the mode from package.json's @boboko/core dependency." ;;
esac
[ "$composer_mode" = "$npm_mode" ] ||
fail "composer.json ($composer_mode) and package.json ($npm_mode) disagree — fix by hand first."
echo "$composer_mode"
}
swap_files() {
# composer.json: swap the key names, values stay where they are.
sed -i \
-e 's/"_repositories":/"__core_mode_swap__":/' \
-e 's/"repositories":/"_repositories":/' \
-e 's/"__core_mode_swap__":/"repositories":/' \
composer.json
# package.json: swap the two @boboko/core values (live and parked).
local a b
a=$(grep -o '"@boboko/core": "[^"]*"' package.json | sed -n 1p)
b=$(grep -o '"@boboko/core": "[^"]*"' package.json | sed -n 2p)
[ -n "$a" ] && [ -n "$b" ] || fail "Expected two @boboko/core entries in package.json."
sed -i \
-e "s|$(sed_pattern "$a")|__core_mode_swap__|" \
-e "s|$(sed_pattern "$b")|$(sed_replacement "$a")|" \
-e "s|__core_mode_swap__|$(sed_replacement "$b")|" \
package.json
}
wrapper_for() {
if [ "$1" = local ]; then echo bin/dc-core.sh; else echo bin/dc; fi
}
# The app healthcheck (php-fpm -t) passes before the entrypoint finishes, so
# wait on the entrypoints' own log lines instead: the app's composer block is
# done once it clears caches, the vite container's npm block once Vite is up.
wait_for_log() {
local dc=$1 service=$2 pattern=$3 label=$4 waited=0
printf '>>> Waiting for %s' "$label"
until $dc logs --no-color "$service" 2>&1 | grep -q "$pattern"; do
if [ -z "$($dc ps -q --status running "$service")" ]; then
echo
$dc logs --no-color --tail 40 "$service"
fail "$service stopped before finishing (logs above)."
fi
if [ "$waited" -ge 600 ]; then
echo
$dc logs --no-color --tail 40 "$service"
fail "Timed out after 600s waiting for $service (logs above)."
fi
printf '.'
sleep 3
waited=$((waited + 3))
done
echo " done"
}
mode=$(current_mode)
if [ $# -eq 0 ]; then
echo "$mode"
exit 0
fi
target=$1
[ "$target" = local ] || [ "$target" = repo ] || fail "Usage: bin/core-mode [local|repo]"
if [ "$target" = local ] && [ ! -d ../boboko-core ]; then
fail "../boboko-core not found — local mode needs the core checkout next to this repo."
fi
# Turn on the pre-commit guard (bin/check-core-mode) that stops local-mode
# wiring from being committed. Git doesn't version hooks, so it's enabled here,
# the first time anyone switches modes. Leaves a custom hooksPath alone.
hooks_path=$(git config --get core.hooksPath || true)
if [ -z "$hooks_path" ]; then
git config core.hooksPath .githooks
echo ">>> Enabled the pre-commit guard (git config core.hooksPath .githooks)"
elif [ "$hooks_path" != .githooks ]; then
echo "!!! core.hooksPath is '$hooks_path', so the pre-commit guard isn't active." >&2
echo " Call bin/check-core-mode from your own pre-commit hook." >&2
fi
old_dc=$(wrapper_for "$mode")
new_dc=$(wrapper_for "$target")
echo ">>> Stopping stack ($mode mode)..."
$old_dc down
if [ "$mode" != "$target" ]; then
echo ">>> Switching composer.json / package.json: $mode -> $target"
swap_files
[ "$(current_mode)" = "$target" ] || fail "Switch didn't take — check composer.json / package.json."
else
echo ">>> Already in $target mode, restarting to re-resolve boboko-core"
fi
# The entrypoints run `composer install` / `npm install` from the lockfiles
# BEFORE re-resolving core. Local-mode lockfiles point at ../boboko-core,
# which isn't mounted in repo mode, so the install fails. The committed
# lockfiles are always repo mode — restore those and let the entrypoints bump
# them to the newest tag.
if [ "$target" = repo ]; then
if grep -A14 '"name": "boboko/core"' composer.lock | grep -q '"type": "path"' ||
grep -A6 '"node_modules/@boboko/core": {' package-lock.json | grep -q '"link": true'; then
echo ">>> Lockfiles still point at ../boboko-core — restoring the committed ones"
git checkout HEAD -- composer.lock package-lock.json
fi
fi
echo ">>> Starting stack ($target mode)..."
if ! $new_dc up -d; then
$new_dc logs --no-color --tail 40 app
fail "Stack failed to start (app logs above)."
fi
wait_for_log "$new_dc" app '\[entrypoint\] Caches cleared' "composer to re-resolve boboko/core"
wait_for_log "$new_dc" vite 'ready in' "npm to re-resolve @boboko/core"
version=$(grep -A1 '"name": "boboko/core"' composer.lock | grep -o '"version": "[^"]*"' | cut -d'"' -f4)
echo ">>> Now in $target mode — boboko/core $version"
Executable
+120
View File
@@ -0,0 +1,120 @@
#!/usr/bin/env bash
# Deploy this app to production with the latest boboko-core tag.
#
# 1. Refuses to run with uncommitted work (the server deploys what's pushed,
# nothing else) — only the core wiring files are allowed to be dirty.
# 2. Pulls translation lines added in the Language Lines UI into core's
# seeders (boboko:translations:pull) — in local mode; if any are pulled,
# stops so you can release core first. In repo mode it only checks.
# 3. Switches to repo mode if you're on the local ../boboko-core checkout,
# and restarts the stack either way so the lockfiles pick up the newest
# tag (bin/core-mode repo).
# 4. Commits the lockfile bump, if any, asks for confirmation, pushes.
# 5. Runs `envoy run deploy` (see Envoy.blade.php) against .env.envoy's host.
#
# Leaves you in repo mode — run `bin/core-mode local` to go back.
set -euo pipefail
cd "$(dirname "$0")/.."
fail() { echo "!!! $*" >&2; exit 1; }
[ -f .env.envoy ] || fail ".env.envoy not found — copy .env.envoy.example and fill it in."
branch=$(grep -m1 '^DEPLOY_BRANCH=' .env.envoy | cut -d= -f2-)
host=$(grep -m1 '^DEPLOY_SSH_HOST=' .env.envoy | cut -d= -f2-)
branch=${branch:-master}
[ "$(git branch --show-current)" = "$branch" ] || fail "You're not on $branch (the branch Envoy deploys)."
# Anything tracked and modified other than the four core wiring files would be
# silently left out of the deploy — make that a hard stop instead.
dirty=$(git status --porcelain --untracked-files=no |
grep -vE '^.. (composer\.json|composer\.lock|package\.json|package-lock\.json)$' || true)
if [ -n "$dirty" ]; then
echo "$dirty"
fail "Commit or stash these first — the server only deploys what's pushed."
fi
echo ">>> Fetching origin..."
git fetch origin "$branch"
[ "$(git rev-list --count "HEAD..origin/$branch")" -eq 0 ] || fail "origin/$branch has commits you don't — pull first."
# Translation lines added through the Language Lines UI only reach other apps
# once they're in core's seeders. In local mode, pull them into
# ../boboko-core; in repo mode the command can only report them.
lines_in() { printf '%s\n' "$1" | sed -n 's/^\([0-9][0-9]*\) line(s).*/\1/p' | tail -1; }
if [ "$(bin/core-mode)" = local ]; then
echo ">>> Pulling UI-added translations into ../boboko-core's seeders..."
out=$(bin/dc-core.sh exec -T app php artisan boboko:translations:pull --no-ansi) ||
fail "boboko:translations:pull failed — is the stack running (bin/dc-core.sh up -d)?"
echo "$out"
pulled=$(lines_in "$out")
if [ "${pulled:-0}" -gt 0 ]; then
fail "Pulled $pulled translation line(s) into ../boboko-core. Review, commit, tag and push core, then rerun bin/deploy."
fi
else
echo ">>> Checking for UI-added translations missing from core's seeders..."
if out=$(bin/dc exec -T app php artisan boboko:translations:pull --dry-run --no-ansi 2>&1); then
missing=$(lines_in "$out")
if [ "${missing:-0}" -gt 0 ]; then
echo "$out"
fail "These lines are only in this database — run bin/core-mode local and rerun bin/deploy to pull them into core."
fi
echo " nothing missing"
else
echo " skipped — the installed boboko/core doesn't have boboko:translations:pull yet"
fi
fi
# Switch to repo mode (or just restart if already there) so both lockfiles
# resolve the newest boboko-core tag.
bin/core-mode repo
git diff --quiet HEAD -- composer.json package.json ||
fail "composer.json / package.json differ from HEAD in repo mode — they should only differ by the local/repo toggle."
if grep -A14 '"name": "boboko/core"' composer.lock | grep -q '"type": "path"'; then
fail "composer.lock still points boboko/core at the local path repo."
fi
if grep -A6 '"node_modules/@boboko/core": {' package-lock.json | grep -q '"link": true'; then
fail "package-lock.json still links @boboko/core to the local checkout."
fi
version=$(grep -A1 '"name": "boboko/core"' composer.lock | grep -o '"version": "[^"]*"' | cut -d'"' -f4)
# A tag you created in ../boboko-core but never pushed won't be resolved.
if [ -d ../boboko-core ]; then
latest=$(git -C ../boboko-core tag --sort=-v:refname | head -1)
if [ -n "$latest" ] && [ "$latest" != "v$version" ]; then
echo "!!! Warning: resolved boboko/core $version, but ../boboko-core's newest tag is $latest."
echo "!!! Did you push it? (git -C ../boboko-core push origin $latest)"
fi
fi
if ! git diff --quiet HEAD -- composer.lock package-lock.json; then
echo ">>> Committing lockfiles for boboko/core $version..."
git add composer.lock package-lock.json
git commit -m "Chore: Bumping boboko/core to $version"
fi
echo
echo ">>> Deploying $branch to $host with boboko/core $version."
pending=$(git log --oneline "origin/$branch..HEAD")
if [ -n "$pending" ]; then
echo ">>> Commits to push:"
echo "$pending"
else
echo ">>> Nothing new to push — this redeploys origin/$branch as-is."
fi
echo
read -r -p "Push and deploy? [y/N] " answer
[ "$answer" = y ] || [ "$answer" = Y ] || fail "Aborted."
if [ -n "$pending" ]; then
git push origin "$branch"
fi
vendor/bin/envoy run deploy
echo
echo ">>> Done. You're in repo mode — run bin/core-mode local to go back to your ../boboko-core checkout."
+30 -4
View File
@@ -6,11 +6,28 @@
return Application::configure(basePath: dirname(__DIR__)) return Application::configure(basePath: dirname(__DIR__))
->withRouting( ->withRouting(
web: __DIR__.'/../routes/web.php', web: __DIR__ . '/../routes/web.php',
commands: __DIR__.'/../routes/console.php', commands: __DIR__ . '/../routes/console.php',
health: '/up', health: '/up',
) )
->withMiddleware(function (Middleware $middleware): void { ->withMiddleware(function (Middleware $middleware): void {
// Caddy (docker/caddy) only listens on plain HTTP:80, behind the
// host's TLS proxy, and passes that proxy's X-Forwarded-* headers on
// (trusted_proxies in docker/caddy/global.caddy).
// Without trusting the X-Forwarded-Proto header, Laravel sees every
// request as http://, so url()/signed-route generation and
// verification (URL::hasValidSignature()) both use the wrong
// scheme — breaks any signed URL whose recipient hits it over
// https (e.g. Modules\Core\Shipping\Http\Controllers\
// DownloadShipmentLabelController's label links) with a 401.
// '*' trusts whatever's immediately upstream, since that's
// container-to-container inside the same deploy, not arbitrary
// public traffic.
$middleware->trustProxies(at: '*');
// Global, so error pages and non-`web` routes are covered too.
$middleware->append(\App\Http\Middleware\PreventIndexing::class);
// Laravel's priority list would otherwise run `auth` before core's // Laravel's priority list would otherwise run `auth` before core's
// `locale` middleware, so the redirects below would build URLs before // `locale` middleware, so the redirects below would build URLs before
// URL::defaults(['locale' => …]) is set, throwing a missing-parameter error. // URL::defaults(['locale' => …]) is set, throwing a missing-parameter error.
@@ -21,8 +38,17 @@
// Both resolve inside the {locale} group, after the `locale` middleware // Both resolve inside the {locale} group, after the `locale` middleware
// has set URL::defaults(['locale' => …]), so route() needs no locale arg. // has set URL::defaults(['locale' => …]), so route() needs no locale arg.
$middleware->redirectGuestsTo(fn () => route('login')); $middleware->redirectGuestsTo(fn() => route('login'));
$middleware->redirectUsersTo(fn () => route('home')); $middleware->redirectUsersTo(fn() => route('home'));
// Core's session registry (Modules\Core\Auth\Services\
// UserSessionService) is enforcement-optional by design — see
// EnsureSessionNotRevoked's own docblock — and this app never
// wired it in. Without this, revokeAllSessions() only flips a DB
// flag that nothing checks per-request: a leaked/stolen session
// cookie keeps working even after being "revoked". Appended to
// `web` (runs after `auth` resolves the user, which it needs).
$middleware->appendToGroup('web', \Modules\Core\Auth\Http\Middleware\EnsureSessionNotRevoked::class);
}) })
->withExceptions(function (Exceptions $exceptions): void { ->withExceptions(function (Exceptions $exceptions): void {
// //
-2
View File
@@ -1,11 +1,9 @@
<?php <?php
use App\Providers\AppServiceProvider; use App\Providers\AppServiceProvider;
use App\Providers\CheckoutModuleServiceProvider;
use App\Providers\PanelServiceProvider; use App\Providers\PanelServiceProvider;
return [ return [
AppServiceProvider::class, AppServiceProvider::class,
PanelServiceProvider::class, PanelServiceProvider::class,
CheckoutModuleServiceProvider::class,
]; ];
+4 -4
View File
@@ -12,9 +12,6 @@
"artesaos/seotools": "^1.4", "artesaos/seotools": "^1.4",
"boboko/core": "0.*", "boboko/core": "0.*",
"jacobjoergensen/laravel-paper": "^1.12", "jacobjoergensen/laravel-paper": "^1.12",
"open-telemetry/exporter-otlp": "^1.4",
"open-telemetry/opentelemetry-auto-laravel": "^1.7",
"open-telemetry/sdk": "^1.14",
"php-http/guzzle7-adapter": "^1.1", "php-http/guzzle7-adapter": "^1.1",
"spatie/laravel-sitemap": "^8.1", "spatie/laravel-sitemap": "^8.1",
"spatie/laravel-webhook-server": "^3.10", "spatie/laravel-webhook-server": "^3.10",
@@ -100,5 +97,8 @@
} }
}, },
"minimum-stability": "stable", "minimum-stability": "stable",
"prefer-stable": true "prefer-stable": true,
"require-dev": {
"laravel/envoy": "^2.12"
}
} }
Generated
+1161 -1268
View File
File diff suppressed because it is too large. Load diff
+13
View File
@@ -41,6 +41,19 @@
'debug' => (bool) env('APP_DEBUG', false), 'debug' => (bool) env('APP_DEBUG', false),
/*
|--------------------------------------------------------------------------
| Search Engine Indexing
|--------------------------------------------------------------------------
|
| Off by default, so every environment (local, staging, ...) sends
| `X-Robots-Tag: noindex, nofollow` (App\Http\Middleware\PreventIndexing).
| Set APP_INDEXABLE=true on the live site only.
|
*/
'indexable' => (bool) env('APP_INDEXABLE', false),
/* /*
|-------------------------------------------------------------------------- |--------------------------------------------------------------------------
| Application URL | Application URL
+25
View File
@@ -0,0 +1,25 @@
<?php
use Modules\Core\Catalog\Recommendations\RandomRule;
use Modules\Core\Catalog\Recommendations\SameCategoryRule;
return [
/*
|--------------------------------------------------------------------------
| Product recommendation rules
|--------------------------------------------------------------------------
|
| Tried in order by Modules\Core\Catalog\Services\RecommendationService —
| the first rule that returns at least one product wins. The order here IS
| the fallback chain: SameCategoryRule first, then RandomRule as a
| last-resort so a product page is never left with zero recommendations
| (as long as the store has more than one product). A consuming app can
| reorder, add, or remove rules freely — nothing about the chain shape is
| hardcoded in the service itself.
|
*/
'recommendation_rules' => [
SameCategoryRule::class,
RandomRule::class,
],
];
+30 -4
View File
@@ -2,17 +2,43 @@
/* /*
* Per-site settings for the cart + checkout module (see * Per-site settings for the cart + checkout module (see
* App\Providers\CheckoutModuleServiceProvider). Becomes the package's * Modules\Core\Providers\CheckoutModuleServiceProvider). Publishable —
* publishable config when the module moves to boboko-core. * artisan vendor:publish --tag=core-config.
*/ */
return [ return [
/* /*
* Name of the storefront's login route. The checkout's login tab and the * Name of the storefront's login route. The checkout's login tab and the
* confirmation page link to it with `?redirect=<checkout path>`, so the * confirmation page link to it with `?redirect=<checkout path>`, so the
* login page must send the shopper back there afterwards (3dealer's * login page must send the shopper back there afterwards. null: no login
* Auth\LoginController does). null: no login offered in checkout at all. * offered in checkout at all.
*/ */
'login_route' => 'login', 'login_route' => 'login',
/*
* Name of the storefront's product-listing route — where confirmation()
* redirects a visit with no placed order to look at (session expired,
* direct navigation, a bookmark). route($this, $locale) must resolve.
*/
'products_route' => 'products',
/*
* ISO 3166-1 alpha-3 code fixing checkout to a single country (a hidden
* field, forced server-side — no country picker shown at all). null (the
* default) gives the full country/region picker, for a multi-country
* store. 3dealer is Greece-only for now.
*/
'store_country_iso3' => 'GRC',
/*
* The `purpose` tag CartController expects a product custom field's
* `file` answer to already carry (see Modules\Core\File\Models\File) —
* matches whatever purpose string the host's own upload endpoint
* (extending Modules\Core\File\Http\Controllers\UploadFileController)
* tags its stored files with. This module never reaches into that
* host controller directly; this config value is the one shared
* source of truth between the two.
*/
'custom_field_upload_purpose' => 'custom-field-upload',
]; ];
+122
View File
@@ -16,4 +16,126 @@
'auto_create_customer_for_user' => true, 'auto_create_customer_for_user' => true,
/*
|--------------------------------------------------------------------------
| Privacy / GDPR data-subject requests
|--------------------------------------------------------------------------
|
| 'providers' lists every Modules\Core\Privacy\Contracts\PersonalDataProvider
| that should be consulted for right-of-access/right-of-erasure requests. A
| module never needs to be known to core in advance — it just adds its own
| provider class here, the same way config('lunar.search.indexers') maps a
| model to its indexer. See docs/privacy.md.
|
| 'grace_period_days' is how long an erasure request stays cancellable
| (account deactivated, not yet erased) before it's actually processed by
| the privacy:process-erasure-requests scheduled command.
|
*/
'privacy' => [
'providers' => [
// ActivityLogDataProvider MUST run before AddressDataProvider —
// it resolves which activity_log rows belong to this customer
// (including ones keyed by an Address id) before
// AddressDataProvider hard-deletes those Address rows. See that
// provider's own class docblock.
\Modules\Core\Logging\Privacy\ActivityLogDataProvider::class,
\Modules\Core\Customer\Privacy\CustomerDataProvider::class,
\Modules\Core\Customer\Privacy\AddressDataProvider::class,
\Modules\Core\Order\Privacy\OrderDataProvider::class,
\Modules\Core\Cart\Privacy\CartDataProvider::class,
\Modules\Core\Review\Privacy\ReviewDataProvider::class,
\Modules\Core\Payment\Privacy\PaymentDataProvider::class,
\Modules\Core\Auth\Privacy\UserSessionDataProvider::class,
],
'grace_period_days' => 30,
],
/*
|--------------------------------------------------------------------------
| Cart Abandonment Threshold
|--------------------------------------------------------------------------
|
| How long a cart (that hasn't converted to a placed order) can go without
| activity before Modules\Core\Cart\Filament\Resources\CartResource treats
| it as "Abandoned" rather than "Ongoing". Anything DateInterval::createFromDateString()
| accepts works, e.g. '1 hour', '30 minutes', '2 days'.
|
*/
'cart' => [
'abandoned_after' => '1 hour',
/*
|----------------------------------------------------------------------
| Unrecoverable Cap
|----------------------------------------------------------------------
|
| Beyond this age, a stale cart stops being treated as an active
| "Abandoned Cart"/"Abandoned Checkout" (Modules\Core\Cart\Services\
| CartLifecycleService) — too old to be a realistic recovery target
| (pricing/stock/tax likely stale by then). This is about the
| abandoned-cart pipeline only, not data retention — no rows are
| deleted or pruned based on this value.
|
*/
'unrecoverable_after' => '90 days',
],
/*
|--------------------------------------------------------------------------
| Order Return Window
|--------------------------------------------------------------------------
|
| How many days after a carrier order is delivered (Order::fulfillment_status
| becomes 'return_window_open') before Modules\Core\Order\Commands\
| CloseExpiredReturnWindows auto-completes it, if no return was requested.
| Store-pickup orders have no return-window step and are unaffected by
| this value (see Modules\Core\Order\Listeners\CompleteOrderOnPickedUp).
|
*/
'order' => [
'return_window_days' => 14,
],
/*
|--------------------------------------------------------------------------
| Storefront OTP Login
|--------------------------------------------------------------------------
|
| Modules\Core\Auth\Services\UserOtpService's passwordless login.
| max_attempts caps how many wrong codes a shopper can guess against ONE
| generated code before it's invalidated outright. generation_limit/
| generation_decay_minutes cap how often a NEW code can be requested for
| the same email — independent of max_attempts, since generating a fresh
| code also resets the guess count, so an attempt cap alone doesn't stop
| an attacker from just requesting a new code every few tries. This same
| limit is also what stands between a malicious/careless caller and
| mail-bombing one inbox.
|
*/
'auth' => [
'otp' => [
'max_attempts' => 5,
'generation_limit' => 3,
'generation_decay_minutes' => 10,
],
// Modules\Core\Customer\Services\CustomerEmailChangeService — same
// shape/reasoning as auth.otp above, independent limits since this
// is a separate flow (changing an existing account's login email,
// not logging in).
'email_change' => [
'max_attempts' => 5,
'generation_limit' => 3,
'generation_decay_minutes' => 10,
'expiry_minutes' => 10,
],
],
]; ];
+2 -1
View File
@@ -1,5 +1,6 @@
<?php <?php
use App\Catalog\ProductMediaDefinitions;
use Lunar\Base\StandardMediaDefinitions; use Lunar\Base\StandardMediaDefinitions;
return [ return [
@@ -8,7 +9,7 @@
'asset' => StandardMediaDefinitions::class, 'asset' => StandardMediaDefinitions::class,
'brand' => StandardMediaDefinitions::class, 'brand' => StandardMediaDefinitions::class,
'collection' => StandardMediaDefinitions::class, 'collection' => StandardMediaDefinitions::class,
'product' => StandardMediaDefinitions::class, 'product' => ProductMediaDefinitions::class,
'product-option' => StandardMediaDefinitions::class, 'product-option' => StandardMediaDefinitions::class,
'product-option-value' => StandardMediaDefinitions::class, 'product-option-value' => StandardMediaDefinitions::class,
], ],
+1 -1
View File
@@ -74,7 +74,7 @@
// ones that already worked, like collection_ids), not just the // ones that already worked, like collection_ids), not just the
// new order_count one. Caught in practice, reverted. // new order_count one. Caught in practice, reverted.
Lunar\Models\Product::class => Modules\Core\Catalog\Services\ProductIndexer::class, Lunar\Models\Product::class => Modules\Core\Catalog\Services\ProductIndexer::class,
Lunar\Models\ProductOption::class => Lunar\Search\ProductOptionIndexer::class, Lunar\Models\ProductOption::class => Lunar\Search\ProductOptionIndexer::class
], ],
]; ];
+7 -3
View File
@@ -35,9 +35,13 @@
], ],
], ],
// Where contact-form messages are sent (ContactController). // Bot check on guest forms (login, contact), verified by App\Rules\HCaptcha. For
'contact' => [ // local dev use hCaptcha's test keys, the real ones reject localhost:
'email' => env('CONTACT_EMAIL'), // sitekey 10000000-ffff-ffff-ffff-000000000001,
// secret 0x0000000000000000000000000000000000000000.
'hcaptcha' => [
'sitekey' => env('HCAPTCHA_SITEKEY'),
'secret' => env('HCAPTCHA_SECRET'),
], ],
'stoic' => [ 'stoic' => [
+50
View File
@@ -0,0 +1,50 @@
<?php
/*
|--------------------------------------------------------------------------
| ACS Courier credentials
|--------------------------------------------------------------------------
|
| ACS requires two credential mechanisms simultaneously: an AcsApiKey
| HTTP header (gates the REST gateway itself) and four account fields
| (Company_ID/Company_Password/User_ID/User_Password) sent in every
| request body. Both are supplied by ACS when your account is set up.
|
| Set these via environment variables — never commit real values.
|
| ACS_BASE_URL Root REST endpoint (unversioned, single URL for
| every ACSAlias call).
| ACS_API_KEY The AcsApiKey header value.
| ACS_COMPANY_ID Company_ID body field.
| ACS_COMPANY_PASSWORD Company_Password body field.
| ACS_USER_ID User_ID body field.
| ACS_USER_PASSWORD User_Password body field.
| ACS_BILLING_CODE Your ACS credit/billing code, used for price
| calculation and voucher creation.
| ACS_SENDER_* Static sender details reused on every voucher.
|
*/
return [
'base_url' => env('ACS_BASE_URL', 'https://webservices.acscourier.net/ACSRestServices/api/ACSAutoRest'),
'api_key' => env('ACS_API_KEY'),
'company_id' => env('ACS_COMPANY_ID'),
'company_password' => env('ACS_COMPANY_PASSWORD'),
'user_id' => env('ACS_USER_ID'),
'user_password' => env('ACS_USER_PASSWORD'),
'billing_code' => env('ACS_BILLING_CODE'),
'sender' => [
'name' => env('ACS_SENDER_NAME'),
'address' => env('ACS_SENDER_ADDRESS'),
'zip_code' => env('ACS_SENDER_ZIP'),
'phone' => env('ACS_SENDER_PHONE'),
],
'timeout' => env('ACS_HTTP_TIMEOUT', 10),
];
+61
View File
@@ -0,0 +1,61 @@
<?php
/*
|--------------------------------------------------------------------------
| Box Now credentials
|--------------------------------------------------------------------------
|
| Box Now uses OAuth2 client-credentials: exchange BOXNOW_CLIENT_ID /
| BOXNOW_CLIENT_SECRET for a Bearer access token (POST /auth-sessions,
| ~1hr expiry), then attach it as an Authorization header on every call.
| Unlike ACS, there is no separate per-request credential body — the
| token alone authorizes all calls once obtained.
|
| Set these via environment variables — never commit real values.
|
| Box Now has two environments (see their Partner API manual, section 2):
| Stage/Sandbox for testing, Production once live. Each has its own
| client_id/client_secret pair and its own base_url/location_api_url —
| there is no shared "switch an env var" flag, since stage credentials
| don't work against the production host or vice versa.
|
| BOXNOW_BASE_URL Root REST endpoint for delivery-requests/parcels.
| BOXNOW_LOCATION_API_URL Separate, faster endpoint for origins/destinations
| lookups (Box Now recommends this over the main
| base URL for those two calls specifically).
| BOXNOW_CLIENT_ID OAuth2 client id.
| BOXNOW_CLIENT_SECRET OAuth2 client secret.
| BOXNOW_PARTNER_ID Numeric partnerId Box Now issues alongside your
| credentials. NOT used for REST API authentication
| (BoxNowClient authenticates with client_id/
| client_secret alone) — this is only consumed by
| the client-side Destination Map widget config
| (_bn_map_widget_config.partnerId), confirmed
| against Box Now's own WooCommerce plugin source.
| BOXNOW_ORIGIN_LOCATION_ID Your warehouse's Box Now locationId, used as
| the pickup origin on every delivery request.
| BOXNOW_SENDER_* Static sender contact details reused on every
| delivery request.
|
*/
return [
'base_url' => env('BOXNOW_BASE_URL', 'https://api-production.boxnow.gr/api/v1'),
'location_api_url' => env('BOXNOW_LOCATION_API_URL', 'https://locationapi-production.boxnow.gr/api/v1'),
'client_id' => env('BOXNOW_CLIENT_ID'),
'client_secret' => env('BOXNOW_CLIENT_SECRET'),
'partner_id' => env('BOXNOW_PARTNER_ID'),
'origin_location_id' => env('BOXNOW_ORIGIN_LOCATION_ID'),
'sender' => [
'name' => env('BOXNOW_SENDER_NAME'),
'email' => env('BOXNOW_SENDER_EMAIL'),
'phone' => env('BOXNOW_SENDER_PHONE'),
],
'timeout' => env('BOXNOW_HTTP_TIMEOUT', 10),
];
@@ -1,25 +0,0 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
return new class extends Migration
{
public function up(): void
{
Schema::create('wishlist_items', function (Blueprint $table) {
$table->id();
$table->foreignId('user_id')->constrained()->cascadeOnDelete();
$table->foreignId('product_id')->constrained('lunar_products')->cascadeOnDelete();
$table->timestamps();
$table->unique(['user_id', 'product_id']);
});
}
public function down(): void
{
Schema::dropIfExists('wishlist_items');
}
};
@@ -1,183 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Core\Localization\Services\TranslationService;
use Spatie\TranslationLoader\LanguageLine;
/**
* Default `checkout` translation lines for the cart drawer and the checkout
* page (see the checkout module under resources/views/checkout).
*
* Additive and idempotent: a group/key that already exists is left untouched,
* so anything edited in the Filament Language Lines UI wins on a re-run. Runs
* explicitly — `php artisan db:seed --class=CheckoutTranslationsSeeder` — it is
* not wired into DatabaseSeeder.
*
* Greek copy uses the project's informal register (εσύ/σου). When the checkout
* module moves to boboko-core this becomes the module's own default-strings
* seeder.
*/
class CheckoutTranslationsSeeder extends Seeder
{
public function run(): void
{
$translations = app(TranslationService::class);
foreach ($this->lines() as $key => [$en, $el]) {
$exists = LanguageLine::query()
->where('group', 'checkout')
->where('key', $key)
->exists();
if ($exists) {
$this->command?->warn("checkout.{$key} already exists — skipped");
continue;
}
$translations->create('checkout', $key, ['en' => $en, 'el' => $el]);
$this->command?->info("checkout.{$key} added");
}
}
/**
* key => [English, Greek].
*
* @return array<string, array{0: string, 1: string}>
*/
private function lines(): array
{
return [
// ── Cart drawer + order summary ──────────────────────────────
'cart.title' => ['Your cart', 'Το καλάθι σου'],
'cart.close' => ['Close', 'Κλείσιμο'],
'cart.empty' => ['Your cart is empty', 'Το καλάθι σου είναι άδειο'],
'cart.quantity' => ['Quantity', 'Ποσότητα'],
'cart.increase' => ['Increase quantity', 'Αύξηση ποσότητας'],
'cart.decrease' => ['Decrease quantity', 'Μείωση ποσότητας'],
'cart.remove' => ['Remove', 'Αφαίρεση'],
'cart.subtotal' => ['Subtotal', 'Υποσύνολο'],
'cart.discount' => ['Discount', 'Έκπτωση'],
'cart.shipping' => ['Shipping', 'Μεταφορικά'],
'cart.shipping_pending' => ['Not selected yet', 'Δεν έχει επιλεγεί ακόμη'],
'cart.tax' => ['VAT', 'ΦΠΑ'],
'cart.total' => ['Total', 'Σύνολο'],
'cart.checkout' => ['Checkout', 'Ολοκλήρωση παραγγελίας'],
'cart.coupon_label' => ['Coupon code', 'Κωδικός κουπονιού'],
'cart.coupon_placeholder' => ['Coupon code', 'Κωδικός κουπονιού'],
'cart.coupon_apply' => ['Apply', 'Εφαρμογή'],
'cart.coupon_remove' => ['Remove', 'Αφαίρεση'],
'cart.coupon_invalid' => ["That coupon code isn't valid", 'Ο κωδικός κουπονιού δεν είναι έγκυρος'],
// ── Checkout page ────────────────────────────────────────────
'page.title' => ['Checkout', 'Ολοκλήρωση παραγγελίας'],
'page.contact_heading' => ['Contact', 'Στοιχεία επικοινωνίας'],
'page.guest_tab' => ['Guest', 'Ως επισκέπτης'],
'page.login_tab' => ['Log in', 'Σύνδεση'],
'page.email_label' => ['Email', 'Email'],
'page.recovery_consent' => [
"Email me a reminder if I don't finish my order",
'Στείλε μου μια υπενθύμιση αν δεν ολοκληρώσω την παραγγελία μου',
],
'page.login_email_label' => ['Email', 'Email'],
'page.send_code' => ['Send code', 'Αποστολή κωδικού'],
'page.login_coming_soon' => [
'Login is coming soon — continue as a guest for now.',
'Η σύνδεση θα είναι διαθέσιμη σύντομα — προς το παρόν συνέχισε ως επισκέπτης.',
],
'page.billing_heading' => ['Billing information', 'Στοιχεία τιμολόγησης'],
'page.shipping_heading' => ['Shipping information', 'Στοιχεία αποστολής'],
'page.same_as_billing' => ['Same as billing address', 'Ίδια με τη διεύθυνση τιμολόγησης'],
'page.first_name' => ['First name', 'Όνομα'],
'page.last_name' => ['Last name', 'Επώνυμο'],
'page.company_name' => ['Company name', 'Επωνυμία εταιρείας'],
'page.tax_identifier' => ['Tax ID', 'ΑΦΜ'],
'page.address_line_one' => ['Address', 'Διεύθυνση'],
'page.address_line_two' => ['Address line 2', 'Διεύθυνση (γραμμή 2)'],
'page.city' => ['City', 'Πόλη'],
'page.state' => ['Region / Prefecture', 'Νομός / Περιοχή'],
'page.state_placeholder' => ['Select a region', 'Επίλεξε νομό'],
'page.postcode' => ['Postcode', 'Ταχυδρομικός κώδικας'],
'page.country' => ['Country', 'Χώρα'],
'page.country_placeholder' => ['Select a country', 'Επίλεξε χώρα'],
'page.phone' => ['Phone', 'Τηλέφωνο'],
'page.delivery_instructions' => ['Delivery notes', 'Σχόλια για την παράδοση'],
'page.save_address' => ['Save and continue', 'Αποθήκευση και συνέχεια'],
'page.saving' => ['Saving…', 'Αποθήκευση…'],
'page.saved' => ['Saved', 'Αποθηκεύτηκε'],
'page.save_error' => ["Couldn't save — check your connection", 'Δεν αποθηκεύτηκε — έλεγξε τη σύνδεσή σου'],
'page.shipping_method_heading' => ['Shipping method', 'Τρόπος αποστολής'],
'page.shipping_method_empty' => [
'Add your shipping address to see delivery options.',
'Συμπλήρωσε τη διεύθυνση αποστολής για να δεις τις διαθέσιμες επιλογές.',
],
'page.shipping_method_none' => [
'No delivery options are available for this address.',
'Δεν υπάρχουν διαθέσιμες επιλογές αποστολής για αυτή τη διεύθυνση.',
],
'page.select_shipping_method' => ['Continue', 'Συνέχεια'],
'page.shipping_option_invalid' => [
'That shipping option is no longer available.',
'Αυτός ο τρόπος αποστολής δεν είναι πλέον διαθέσιμος.',
],
'page.continue_to_payment' => ['Continue to payment', 'Συνέχεια στην πληρωμή'],
'page.order_summary_heading' => ['Order summary', 'Σύνοψη παραγγελίας'],
// ── Payment step ────────────────────────────────────────────
'page.payment_heading' => ['Payment', 'Πληρωμή'],
'page.payment_method_none' => [
'No payment methods are available right now.',
'Δεν υπάρχουν διαθέσιμοι τρόποι πληρωμής αυτή τη στιγμή.',
],
'page.terms_accept' => [
"I accept the <a href=':terms' target='_blank'>Terms of Sale</a> and the <a href=':privacy' target='_blank'>Privacy Policy</a>",
"Αποδέχομαι τους <a href=':terms' target='_blank'>Όρους Πώλησης</a> και την <a href=':privacy' target='_blank'>Πολιτική Απορρήτου</a>",
],
'page.terms_required' => [
'You must accept the terms to place your order.',
'Πρέπει να αποδεχτείς τους όρους για να ολοκληρώσεις την παραγγελία.',
],
'page.withdrawal_notice' => [
"You have a 14-day right of withdrawal. <a href=':link' target='_blank'>See details</a>.",
"Έχεις δικαίωμα υπαναχώρησης εντός 14 ημερών. <a href=':link' target='_blank'>Δες λεπτομέρειες</a>.",
],
'page.place_order' => ['Place order — payment obligation', 'Παραγγελία με υποχρέωση πληρωμής'],
'page.choose_payment_method' => ['Choose a payment method.', 'Επίλεξε τρόπο πληρωμής.'],
'page.shipping_method_required' => [
'Choose a shipping method below to continue.',
'Επίλεξε τρόπο αποστολής παρακάτω για να συνεχίσεις.',
],
'page.payment_failed' => ['Payment failed. Please try again.', 'Η πληρωμή απέτυχε. Δοκίμασε ξανά.'],
'page.payment_incomplete_details' => [
'Complete your billing and shipping details above.',
'Συμπλήρωσε τα στοιχεία χρέωσης και αποστολής παραπάνω.',
],
'page.payment_cart_changed' => [
'Your cart changed. Refresh the page and place your order again.',
'Το καλάθι σου άλλαξε. Ανανέωσε τη σελίδα και ολοκλήρωσε ξανά.',
],
'page.payment_processing' => ['Confirming your payment…', 'Επιβεβαίωση πληρωμής…'],
'page.payment_processing_slow' => [
"Your payment is still processing. You'll get an email once it's confirmed.",
'Η πληρωμή σου επεξεργάζεται ακόμη. Θα λάβεις email μόλις επιβεβαιωθεί.',
],
// ── Confirmation page ──────────────────────────────────────
'page.confirmation_title' => ['Your order', 'Η παραγγελία σου'],
'page.confirmation_heading' => [
'Thank you! Your order is confirmed.',
'Ευχαριστούμε! Η παραγγελία σου καταχωρήθηκε.',
],
'page.confirmation_order_number' => ['Order number', 'Αριθμός παραγγελίας'],
'page.confirmation_email_note' => [
'A confirmation email will follow shortly.',
'Θα λάβεις email επιβεβαίωσης σύντομα.',
],
'page.confirmation_shipping_to' => ['Shipping to', 'Αποστολή σε'],
'page.confirmation_billing' => ['Billing', 'Χρέωση'],
'page.confirmation_continue' => ['Continue shopping', 'Συνέχεια αγορών'],
];
}
}
@@ -1,115 +0,0 @@
<?php
namespace Database\Seeders;
use Illuminate\Database\Seeder;
use Modules\Core\Localization\Services\TranslationService;
use Spatie\TranslationLoader\LanguageLine;
/**
* Default `validation` translation lines — Laravel's own error-message group
* (`validation.required`, `validation.email`, `validation.attributes.*`, …),
* resolved by every `Validator::make()`/`$request->validate()` call in the app
* (see CheckoutController::saveAddress(), CartController, ProductController),
* not just the checkout module.
*
* Spatie's DB loader (spatie/laravel-translation-loader, wired in boboko-core's
* LocalizationServiceProvider) merges this group over Laravel's file-based
* validation.php, which the project doesn't ship a `lang/` copy of — so without
* this, Greek requests fall back to Laravel's untranslated English defaults.
* Only the rule keys and field attributes actually in use are seeded; add more
* as new rules/fields show up.
*
* Additive and idempotent: a key that already exists is left untouched, so
* anything edited in the Filament Language Lines UI wins on a re-run. Runs
* explicitly — `php artisan db:seed --class=ValidationTranslationsSeeder` — it
* is not wired into DatabaseSeeder.
*
* Greek copy uses the project's informal register (εσύ/σου).
*/
class ValidationTranslationsSeeder extends Seeder
{
public function run(): void
{
$translations = app(TranslationService::class);
foreach ($this->lines() as $key => [$en, $el]) {
$exists = LanguageLine::query()
->where('group', 'validation')
->where('key', $key)
->exists();
if ($exists) {
$this->command?->warn("validation.{$key} already exists — skipped");
continue;
}
$translations->create('validation', $key, ['en' => $en, 'el' => $el]);
$this->command?->info("validation.{$key} added");
}
}
/**
* key => [English, Greek].
*
* @return array<string, array{0: string, 1: string}>
*/
private function lines(): array
{
return [
// ── Rule messages ─────────────────────────────────────────────
'required' => ['The :attribute field is required.', 'Το πεδίο :attribute είναι υποχρεωτικό.'],
'email' => ['The :attribute field must be a valid email address.', 'Το πεδίο :attribute πρέπει να είναι έγκυρη διεύθυνση email.'],
'string' => ['The :attribute field must be a string.', 'Το πεδίο :attribute πρέπει να είναι κείμενο.'],
'integer' => ['The :attribute field must be an integer.', 'Το πεδίο :attribute πρέπει να είναι ακέραιος αριθμός.'],
'boolean' => ['The :attribute field must be true or false.', 'Το πεδίο :attribute πρέπει να είναι true ή false.'],
'min.numeric' => ['The :attribute field must be at least :min.', 'Το πεδίο :attribute πρέπει να είναι τουλάχιστον :min.'],
'max.string' => ['The :attribute field must not be greater than :max characters.', 'Το πεδίο :attribute δεν πρέπει να ξεπερνά τους :max χαρακτήρες.'],
'between.numeric' => ['The :attribute field must be between :min and :max.', 'Το πεδίο :attribute πρέπει να είναι μεταξύ :min και :max.'],
'exists' => ['The selected :attribute is invalid.', 'Η επιλεγμένη τιμή για το πεδίο :attribute δεν είναι έγκυρη.'],
// Product custom-field photo uploads (CustomFieldUploadController, CartController).
'file' => ['The :attribute field must be a file.', 'Το πεδίο :attribute πρέπει να είναι αρχείο.'],
'mimes' => ['The :attribute field must be a file of type: :values.', 'Το πεδίο :attribute πρέπει να είναι αρχείο τύπου: :values.'],
'max.file' => ['The :attribute field must not be greater than :max kilobytes.', 'Το αρχείο στο πεδίο :attribute δεν πρέπει να ξεπερνά τα :max kilobytes.'],
'uploaded' => ['The :attribute failed to upload.', 'Η μεταφόρτωση στο πεδίο :attribute απέτυχε.'],
// ── Field names (checkout: billing/shipping address) ──────────
'attributes.contact_email' => ['email', 'email'],
'attributes.billing_first_name' => ['first name', 'όνομα'],
'attributes.billing_last_name' => ['last name', 'επώνυμο'],
'attributes.billing_company_name' => ['company name', 'επωνυμία εταιρείας'],
'attributes.billing_tax_identifier' => ['tax ID', 'ΑΦΜ'],
'attributes.billing_line_one' => ['address', 'διεύθυνση'],
'attributes.billing_line_two' => ['address line 2', 'διεύθυνση (γραμμή 2)'],
'attributes.billing_city' => ['city', 'πόλη'],
'attributes.billing_state' => ['region', 'νομό / περιοχή'],
'attributes.billing_postcode' => ['postcode', 'ταχυδρομικό κώδικα'],
'attributes.billing_country_id' => ['country', 'χώρα'],
'attributes.billing_contact_phone' => ['phone', 'τηλέφωνο'],
'attributes.shipping_first_name' => ['first name', 'όνομα'],
'attributes.shipping_last_name' => ['last name', 'επώνυμο'],
'attributes.shipping_company_name' => ['company name', 'επωνυμία εταιρείας'],
'attributes.shipping_line_one' => ['address', 'διεύθυνση'],
'attributes.shipping_line_two' => ['address line 2', 'διεύθυνση (γραμμή 2)'],
'attributes.shipping_city' => ['city', 'πόλη'],
'attributes.shipping_state' => ['region', 'νομό / περιοχή'],
'attributes.shipping_postcode' => ['postcode', 'ταχυδρομικό κώδικα'],
'attributes.shipping_country_id' => ['country', 'χώρα'],
'attributes.shipping_contact_phone' => ['phone', 'τηλέφωνο'],
'attributes.shipping_delivery_instructions' => ['delivery notes', 'σχόλια για την παράδοση'],
// ── Field names (cart) ─────────────────────────────────────────
'attributes.purchasable_id' => ['product', 'προϊόν'],
'attributes.quantity' => ['quantity', 'ποσότητα'],
'attributes.code' => ['coupon code', 'κωδικό κουπονιού'],
// ── Field names (product reviews / stock check) ────────────────
'attributes.variant' => ['variant', 'παραλλαγή'],
'attributes.rating' => ['rating', 'βαθμολογία'],
'attributes.content' => ['review text', 'κείμενο κριτικής'],
'attributes.name' => ['name', 'όνομα'],
'attributes.email' => ['email', 'email'],
];
}
}
+4
View File
@@ -10,3 +10,7 @@ services:
scheduler: scheduler:
volumes: volumes:
- ../boboko-core:/var/www/boboko-core - ../boboko-core:/var/www/boboko-core
vite:
volumes:
- ../boboko-core:/boboko-core
+7 -3
View File
@@ -31,12 +31,16 @@ services:
valkey: valkey:
condition: service_started condition: service_started
nginx: caddy:
image: nginx:alpine build:
context: .
target: caddy-base
image: boboko-caddy
command: caddy run --config /etc/caddy/Caddyfile.dev --adapter caddyfile
ports: ports:
- "${APP_PORT:-8080}:80" - "${APP_PORT:-8080}:80"
volumes: volumes:
- ./docker/nginx/default.conf:/etc/nginx/conf.d/default.conf:ro - ./docker/caddy:/etc/caddy:ro
- ./public:/var/www/html/public:ro - ./public:/var/www/html/public:ro
- ./storage/app/public:/var/www/html/storage/app/public:ro - ./storage/app/public:/var/www/html/storage/app/public:ro
depends_on: depends_on:
+32 -10
View File
@@ -32,10 +32,12 @@ services:
retries: 20 retries: 20
start_period: 60s start_period: 60s
nginx: # Caddy (docker/caddy/Caddyfile), plain HTTP on 127.0.0.1 behind the
# host's TLS proxy, same port nginx used.
caddy:
build: build:
context: . context: .
target: nginx target: caddy
restart: unless-stopped restart: unless-stopped
ports: ports:
- "127.0.0.1:${APP_PORT:-8090}:80" - "127.0.0.1:${APP_PORT:-8090}:80"
@@ -47,6 +49,7 @@ services:
queue: queue:
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
entrypoint: ["/entrypoint-worker.sh"]
command: php artisan queue:work --tries=3 --max-jobs=500 --memory=256 command: php artisan queue:work --tries=3 --max-jobs=500 --memory=256
restart: unless-stopped restart: unless-stopped
env_file: .env env_file: .env
@@ -68,6 +71,7 @@ services:
scheduler: scheduler:
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
entrypoint: ["/entrypoint-worker.sh"]
command: php artisan schedule:work command: php artisan schedule:work
restart: unless-stopped restart: unless-stopped
env_file: .env env_file: .env
@@ -129,16 +133,15 @@ services:
timeout: 5s timeout: 5s
retries: 10 retries: 10
otel-collector:
image: otel/opentelemetry-collector-contrib:latest
restart: unless-stopped
environment:
SIGNOZ_ENDPOINT: ${OTEL_EXPORTER_OTLP_ENDPOINT}
volumes:
- ./docker/otel/collector.yml:/etc/otelcol-contrib/config.yaml:ro
stoic: stoic:
image: ghcr.io/lexx27/stoic:latest image: ghcr.io/lexx27/stoic:latest
# Runs as root — the app container's entrypoint.sh chowns the whole
# storage/ tree to www-data on every boot (docker/entrypoint.sh),
# and Stoic's own image user isn't www-data or in its group, so it
# can't write thumbnails into storage/app/public/stoic/ otherwise
# (libvips reports this as "Failed to write VipsImage to file").
# Same fix already applied in docker-compose.dev.yml.
user: root
ports: ports:
- "127.0.0.1:${STOIC_PORT:-2727}:2727" - "127.0.0.1:${STOIC_PORT:-2727}:2727"
environment: environment:
@@ -153,6 +156,24 @@ services:
- storage:/var/www/html/storage/app - storage:/var/www/html/storage/app
restart: unless-stopped restart: unless-stopped
vector:
image: timberio/vector:latest-alpine
restart: unless-stopped
environment:
APP_ENV: ${APP_ENV:-production}
VICTORIALOGS_ENDPOINT: ${VICTORIALOGS_ENDPOINT:?VICTORIALOGS_ENDPOINT is required}
VICTORIALOGS_USER: ${VICTORIALOGS_USER:?VICTORIALOGS_USER is required}
VICTORIALOGS_PASSWORD: ${VICTORIALOGS_PASSWORD:?VICTORIALOGS_PASSWORD is required}
VECTOR_DANGEROUSLY_ALLOW_ENV_VAR_INTERPOLATION: "true"
volumes:
- ./docker/vector/vector.yaml:/etc/vector/vector.yaml:ro
- logs:/var/www/html/storage/logs:ro
- vector_data:/var/lib/vector
depends_on:
app:
condition: service_healthy
volumes: volumes:
pgdata: pgdata:
storage: storage:
@@ -160,3 +181,4 @@ volumes:
framework: framework:
valkeydata: valkeydata:
meilidata: meilidata:
vector_data:
+44
View File
@@ -0,0 +1,44 @@
# Production. public/ is baked into the image (Dockerfile, target caddy);
# storage/app is the shared `storage` volume, read-only.
# No page cache here: nginx's FastCGI cache is dropped on purpose, the
# static page cache comes later (P2).
{
import global.caddy
}
import common.caddy
:80 {
import site
route {
import deny_dotfiles
import stoic
# Content-hashed or versioned files: cache forever.
@immutable path /build/* /static/* /packages/*
handle @immutable {
header Cache-Control "public, max-age=31536000, immutable"
file_server
}
# User media, straight from the storage volume (no symlink needed).
handle_path /storage/* {
root * /var/www/html/storage/app/public
header Cache-Control "public, max-age=31536000, immutable"
file_server
}
# Generated by the app into storage/app.
handle /sitemap.xml {
root * /var/www/html/storage/app
header Cache-Control "public, max-age=3600"
header Content-Type "application/xml; charset=utf-8"
file_server
}
import laravel
}
import static_404
}
+19
View File
@@ -0,0 +1,19 @@
# Development. public/ and storage/app/public are bind-mounted
# (docker-compose.dev.yml); /storage/ goes through the public/storage symlink.
# No long cache headers in dev. Vite is reached directly on its own port
# (public/hot), not through Caddy.
{
import global.caddy
}
import common.caddy
:80 {
import site
route {
import deny_dotfiles
import stoic
import laravel
}
}
+76
View File
@@ -0,0 +1,76 @@
# Snippets shared by Caddyfile (prod) and Caddyfile.dev, imported right after
# their global options block (global.caddy).
# Site-level settings shared by both environments.
(site) {
root * /var/www/html/public
# New with Caddy: nginx compressed nothing. Caddy only compresses text
# types (HTML, CSS, JS, JSON, SVG…), never images or fonts.
encode zstd gzip
# Same upload limit as nginx's client_max_body_size (and php.ini).
request_body {
max_size 100MiB
}
# On every response. nginx only added these to static files and 2xx/3xx
# (prod's PHP location dropped them).
header {
X-Frame-Options "SAMEORIGIN"
X-Content-Type-Options "nosniff"
# Caddy's proxy adds Via; nginx sent none. A deletion is applied as
# the response goes out, so it also catches headers set later.
-Via
}
# Access log to stdout, as nginx did; favicon/robots skipped like nginx.
log
@quiet path /favicon.ico /robots.txt
log_skip @quiet
}
# Dotfiles (.env, .git…) are never served; /.well-known/ is allowed.
# Use inside a route block, first.
(deny_dotfiles) {
@dotfiles {
path */.*
not path /.well-known/*
}
respond @dotfiles 403
}
# Stoic (the headless CMS) under /stoic/, prefix stripped, cookies scoped to
# /stoic/ (nginx: proxy_cookie_path / /stoic/).
(stoic) {
handle_path /stoic/* {
reverse_proxy stoic:2727 {
header_up X-Real-IP {client_ip}
header_down Set-Cookie "(?i)(;\s*path=)/" "$1/stoic/"
}
}
}
# Laravel. php_fastcgi does the try_files (file, dir/index.php, index.php);
# file_server serves the files that exist in public/.
(laravel) {
php_fastcgi app:9000 {
read_timeout 300s
# PHP-FPM's CGI status line; nginx didn't pass it on either.
header_down -Status
}
file_server
}
# A missing file under one of prod's static paths (/build/, /storage/…): a
# plain 404, without the Cache-Control/Content-Type that path's handle already
# set.
# (nginx sent these to Laravel via `error_page 404 /index.php`, kept the 404
# status and showed Laravel's page; nobody sees that page for an asset.)
(static_404) {
handle_errors 404 {
header -Cache-Control
header Content-Type "text/plain; charset=utf-8"
respond "Not Found" 404
}
}
+16
View File
@@ -0,0 +1,16 @@
# Global options shared by Caddyfile (prod) and Caddyfile.dev, imported inside
# their global options block.
# TLS ends in front of this container (a proxy on the host talks to it on
# 127.0.0.1:8090), so Caddy serves plain HTTP and never tries to get
# certificates. Revisit once it's settled where TLS should end.
auto_https off
servers {
# Keep the X-Forwarded-For/-Proto/-Host the host proxy sends: it
# reaches the container from a private (docker) address. Without this
# Caddy replaces them with its own, so Laravel (trustProxies '*')
# would see every request as plain http. Narrow this to the proxy's
# actual address once it's known.
trusted_proxies static private_ranges
}
+26
View File
@@ -0,0 +1,26 @@
#!/bin/sh
set -e
# Mirrors entrypoint.sh's Composer block: node_modules is a named/anonymous
# volume, not the bind-mounted host directory, so this container needs its
# own live install on every boot rather than relying on whatever was baked in
# at image-build time.
echo "[entrypoint-vite] Installing npm dependencies..."
npm install
# Re-resolve @boboko/core specifically on every boot, whether it's a local
# path-repo checkout (file:../boboko-core, needs docker-compose.core-dev.yml's
# ../boboko-core:/boboko-core mount) or a tagged VCS install
# (git+https://...#vX.Y.Z) — the same manual toggle composer.json's
# repositories/_repositories block uses for the PHP side of this same
# package. A plain `npm install` above only installs what package-lock.json
# already pins; it won't notice a new commit on the path-repo checkout or a
# re-pushed tag. `npm update` re-resolves that one package against whatever
# package.json currently says and rewrites package-lock.json to pin it —
# exactly like `composer update boboko/* --with-all-dependencies` rewrites
# composer.lock, which is committed so prod picks up the resolved version via
# `npm install` alone (no `npm update` in prod's build).
echo "[entrypoint-vite] Re-resolving @boboko/core..."
npm update @boboko/core
exec "$@"
+23 -12
View File
@@ -41,19 +41,17 @@ echo "[entrypoint] Caches cleared"
php artisan storage:link --quiet 2>/dev/null || true php artisan storage:link --quiet 2>/dev/null || true
if [ "$APP_ENV" != "production" ]; then # Dev-only for the same reason as the composer step above — production's
# Dev-only for the same reason as the composer step above — production's # image already has these published at build time.
# image already has these published at build time. php artisan vendor:publish --tag=core-assets --force --ansi --quiet
php artisan vendor:publish --tag=core-assets --force --ansi --quiet php artisan vendor:publish --tag=public --force --ansi --quiet
php artisan vendor:publish --tag=public --force --ansi --quiet php artisan filament:assets --ansi --quiet
php artisan filament:assets --ansi --quiet
# No --force: core-views publishes editable Blade templates (order # No --force: core-views publishes editable Blade templates (order
# notification emails), meant to be hand-customized per app — unlike # notification emails), meant to be hand-customized per app — unlike
# core-assets above, republishing must not silently wipe local edits. # core-assets above, republishing must not silently wipe local edits.
# Only fills in the vendor/core views directory if it doesn't exist yet. # Only fills in the vendor/core views directory if it doesn't exist yet.
php artisan vendor:publish --tag=core-views --ansi --quiet php artisan vendor:publish --tag=core-views --ansi --quiet
fi
# Everything below is universal, in both dev and production: application STATE # Everything below is universal, in both dev and production: application STATE
# that must be current on every boot, not a build-time concern composer/assets # that must be current on every boot, not a build-time concern composer/assets
@@ -79,6 +77,19 @@ echo "[entrypoint] Touched migrated file"
echo "[entrypoint] Trying Lunar install" echo "[entrypoint] Trying Lunar install"
php artisan lunar:install --quiet || true php artisan lunar:install --quiet || true
# Same idempotent per-key upsert as lunar:install's own seeding above, just kept
# as separate seeder classes rather than folded into InstallLunarCommand — these
# are Spatie translation-loader `validation`/`checkout` groups, not Lunar store
# data, and each is safe to re-run on every boot.
echo "[entrypoint] Seeding validation translations..."
php artisan db:seed --class="Modules\Core\Localization\Database\Seeders\ValidationTranslationsSeeder" --force --quiet || true
echo "[entrypoint] Seeding checkout translations..."
php artisan db:seed --class="Modules\Core\Checkout\Database\Seeders\CheckoutTranslationsSeeder" --force --quiet || true
echo "[entrypoint] Seeding storefront translations..."
php artisan db:seed --class="Modules\Core\Localization\Database\Seeders\StorefrontTranslationsSeeder" --force --quiet || true
# Upserts by primary key (no --refresh), so this stays cheap and idempotent on # Upserts by primary key (no --refresh), so this stays cheap and idempotent on
# every boot rather than flushing and rebuilding the whole index each time. Runs # every boot rather than flushing and rebuilding the whole index each time. Runs
# in production too — a deploy that changed an indexer's field list needs this # in production too — a deploy that changed an indexer's field list needs this
-48
View File
@@ -1,48 +0,0 @@
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php;
client_max_body_size 100M;
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
charset utf-8;
location / {
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
resolver 127.0.0.11 valid=5s;
set $upstream app:9000;
fastcgi_pass $upstream;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_read_timeout 300;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
}
location /stoic/ {
proxy_pass http://stoic:2727/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cookie_path / /stoic/;
}
location ~ /\.(?!well-known).* {
deny all;
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
}
-110
View File
@@ -1,110 +0,0 @@
fastcgi_cache_path /tmp/fcgi_cache levels=1:2 keys_zone=app_cache:10m max_size=256m inactive=10m use_temp_path=off;
upstream php_fpm {
server app:9000;
keepalive 16;
}
server {
listen 80;
server_name _;
root /var/www/html/public;
index index.php;
client_max_body_size 100M;
charset utf-8;
open_file_cache max=5000 inactive=30s;
open_file_cache_valid 60s;
open_file_cache_min_uses 2;
open_file_cache_errors on;
# --- FastCGI cache bypass rules ---
set $skip_cache 0;
if ($request_method = POST) { set $skip_cache 1; }
if ($request_uri ~* "^/(boboko|up)") { set $skip_cache 1; }
if ($query_string) { set $skip_cache 1; }
# Vite build assets — content-hashed filenames, safe to cache forever
location /build/ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
location /static/ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
location /packages/ {
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
# User media — served directly from the storage volume (no symlink needed)
location /storage/ {
alias /var/www/html/storage/app/public/;
add_header Cache-Control "public, max-age=31536000, immutable";
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri =404;
}
location / {
add_header X-Frame-Options "SAMEORIGIN";
add_header X-Content-Type-Options "nosniff";
try_files $uri $uri/ /index.php?$query_string;
}
location ~ \.php$ {
fastcgi_pass php_fpm;
fastcgi_index index.php;
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $realpath_root$fastcgi_script_name;
fastcgi_param DOCUMENT_ROOT $realpath_root;
fastcgi_read_timeout 300;
fastcgi_buffers 16 16k;
fastcgi_buffer_size 32k;
fastcgi_keep_conn on;
fastcgi_cache app_cache;
fastcgi_cache_key "$scheme$request_method$host$request_uri";
fastcgi_cache_valid 200 10m;
fastcgi_cache_bypass $skip_cache;
fastcgi_no_cache $skip_cache;
fastcgi_ignore_headers Cache-Control Expires Set-Cookie;
add_header X-Cache-Status $upstream_cache_status;
}
location /stoic/ {
proxy_pass http://stoic:2727/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_cookie_path / /stoic/;
}
location ~ /\.(?!well-known).* {
deny all;
}
location = /sitemap.xml {
root /var/www/html/storage/app;
try_files /sitemap.xml =404;
add_header Cache-Control "public, max-age=3600";
add_header Content-Type "application/xml; charset=utf-8";
}
location = /favicon.ico { access_log off; log_not_found off; }
location = /robots.txt { access_log off; log_not_found off; }
error_page 404 /index.php;
}
-30
View File
@@ -1,30 +0,0 @@
receivers:
otlp:
protocols:
http:
endpoint: 0.0.0.0:4318
processors:
batch:
timeout: 5s
send_batch_size: 512
exporters:
otlphttp:
endpoint: ${env:SIGNOZ_ENDPOINT}
compression: gzip
service:
pipelines:
traces:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
metrics:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
logs:
receivers: [otlp]
processors: [batch]
exporters: [otlphttp]
+8
View File
@@ -9,6 +9,14 @@ content_path: /content
media_path: /media media_path: /media
thumbs_path: /var/www/html/storage/app/public/stoic/ thumbs_path: /var/www/html/storage/app/public/stoic/
repository_path: /app repository_path: /app
# First locale is Stoic's default: it holds every field, the others only the
# translatable ones (content/{locale}/...). Codes match app.available_locales.
i18n:
locales:
- code: el
label: Ελληνικά
- code: en
label: English
presets: presets:
- code: large - code: large
mode: resize mode: resize
+41
View File
@@ -0,0 +1,41 @@
sources:
laravel_logs:
type: file
include:
- /var/www/html/storage/logs/laravel.log
read_from: beginning
transforms:
laravel_json:
type: remap
inputs:
- laravel_logs
source: |
. = parse_json!(.message)
.service = "boboko-app"
.env = "${APP_ENV}"
sinks:
victorialogs:
type: http
inputs:
- laravel_json
uri: "${VICTORIALOGS_ENDPOINT}/insert/jsonline?_stream_fields=service,env,channel,level_name&_msg_field=message&_time_field=datetime"
encoding:
codec: json
framing:
method: newline_delimited
compression: gzip
auth:
strategy: basic
user: "${VICTORIALOGS_USER}"
password: "${VICTORIALOGS_PASSWORD}"
batch:
max_bytes: 1048576
timeout_secs: 5
buffer:
type: disk
max_size: 268435488
when_full: block
healthcheck:
enabled: false
+18
View File
@@ -0,0 +1,18 @@
<?php
/**
* lunarphp/table-rate-shipping v1.5.0 ships no Greek translations for this
* namespace at all (only 'en' and a handful of other locales — no 'el'
* directory exists in the package), so this override is the only source
* for these keys in Greek, not a merge over an existing package file.
* ManageShippingRates.php:58 calls the 'prices_inc_tax' key specifically
* (missing the 'l' the package's own English file uses — see the 'en'
* override's docblock), so that's the one included here.
*/
return [
'shipping_rates' => [
'notices' => [
'prices_inc_tax' => 'Όλες οι τιμές περιλαμβάνουν ΦΠΑ, το οποίο θα ληφθεί υπόψη στον υπολογισμό της ελάχιστης αξίας παραγγελίας.',
],
],
];
+19
View File
@@ -0,0 +1,19 @@
<?php
/**
* Override for lunarphp/table-rate-shipping v1.5.0's own relationmanagers.php
* (vendor/lunarphp/table-rate-shipping/resources/lang/en/relationmanagers.php)
* — that file defines 'prices_incl_tax', but ManageShippingRates.php:58 calls
* __('lunarpanel.shipping::relationmanagers.shipping_rates.notices.prices_inc_tax')
* (missing the 'l'), so the key is genuinely never found. Merged over the
* package's own file (array_replace_recursive, see Illuminate\Translation\
* FileLoader::loadNamespaceOverrides()), so only the broken key needs
* restating here — everything else in that file still applies.
*/
return [
'shipping_rates' => [
'notices' => [
'prices_inc_tax' => 'All prices include tax, which will be considered when calculating minimum spend.',
],
],
];
+22 -62
View File
@@ -1,15 +1,15 @@
{ {
"name": "boboko-starter", "name": "app",
"lockfileVersion": 3, "lockfileVersion": 3,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"dependencies": { "dependencies": {
"@boboko/core": "git+https://code.radical-elements.com/boboko/core.git#semver:0.x",
"@hotwired/stimulus": "^3.2.2", "@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo": "^8.0.23", "@hotwired/turbo": "^8.0.23",
"@phosphor-icons/web": "^2.1.2",
"axios": "^1.15.2", "axios": "^1.15.2",
"flatpickr": "^4.6.13" "leaflet": "^1.9.4"
}, },
"devDependencies": { "devDependencies": {
"@tailwindcss/vite": "^4.0.0", "@tailwindcss/vite": "^4.0.0",
@@ -19,11 +19,21 @@
"vite": "^8.0.0" "vite": "^8.0.0"
} }
}, },
"node_modules/@boboko/core": {
"version": "0.31.4",
"resolved": "git+https://code.radical-elements.com/boboko/core.git#5cce0e95d7b4c86d11ec0aaf3fa515f6e01e65bc",
"dependencies": {
"@hotwired/stimulus": "^3.2.2",
"leaflet": "^1.9.4"
},
"peerDependencies": {
"vite": "^8.0.0"
}
},
"node_modules/@emnapi/core": { "node_modules/@emnapi/core": {
"version": "1.11.1", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz", "resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz",
"integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==", "integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==",
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"dependencies": { "dependencies": {
@@ -35,7 +45,6 @@
"version": "1.11.1", "version": "1.11.1",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz", "resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz",
"integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==", "integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==",
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"dependencies": { "dependencies": {
@@ -46,7 +55,6 @@
"version": "1.2.2", "version": "1.2.2",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz", "resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==", "integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"dependencies": { "dependencies": {
@@ -122,7 +130,6 @@
"version": "1.1.6", "version": "1.1.6",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz", "resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
"integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==", "integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"dependencies": { "dependencies": {
@@ -141,18 +148,11 @@
"version": "0.138.0", "version": "0.138.0",
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.138.0.tgz", "resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.138.0.tgz",
"integrity": "sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==", "integrity": "sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==",
"dev": true,
"license": "MIT", "license": "MIT",
"funding": { "funding": {
"url": "https://github.com/sponsors/Boshen" "url": "https://github.com/sponsors/Boshen"
} }
}, },
"node_modules/@phosphor-icons/web": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/@phosphor-icons/web/-/web-2.1.2.tgz",
"integrity": "sha512-rPAR9o/bEcp4Cw4DEeZHXf+nlGCMNGkNDRizYHM47NLxz9vvEHp/Tt6FMK1NcWadzw/pFDPnRBGi/ofRya958A==",
"license": "MIT"
},
"node_modules/@rolldown/binding-android-arm64": { "node_modules/@rolldown/binding-android-arm64": {
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.4.tgz", "resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.4.tgz",
@@ -160,7 +160,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -177,7 +176,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -194,7 +192,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -211,7 +208,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -228,7 +224,6 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -245,7 +240,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -262,7 +256,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -279,7 +272,6 @@
"cpu": [ "cpu": [
"ppc64" "ppc64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -296,7 +288,6 @@
"cpu": [ "cpu": [
"s390x" "s390x"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -313,7 +304,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -330,7 +320,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -347,7 +336,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -364,7 +352,6 @@
"cpu": [ "cpu": [
"wasm32" "wasm32"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"dependencies": { "dependencies": {
@@ -383,7 +370,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -400,7 +386,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"os": [ "os": [
@@ -414,7 +399,6 @@
"version": "1.0.1", "version": "1.0.1",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz", "resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
"integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==", "integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
"dev": true,
"license": "MIT" "license": "MIT"
}, },
"node_modules/@tailwindcss/node": { "node_modules/@tailwindcss/node": {
@@ -693,7 +677,6 @@
"version": "0.10.3", "version": "0.10.3",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz", "resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
"integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==", "integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",
"dev": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
"dependencies": { "dependencies": {
@@ -901,7 +884,6 @@
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz", "resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==", "integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
"dev": true,
"license": "Apache-2.0", "license": "Apache-2.0",
"engines": { "engines": {
"node": ">=8" "node": ">=8"
@@ -1001,7 +983,6 @@
"version": "6.5.0", "version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz", "resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=12.0.0" "node": ">=12.0.0"
@@ -1015,12 +996,6 @@
} }
} }
}, },
"node_modules/flatpickr": {
"version": "4.6.13",
"resolved": "https://registry.npmjs.org/flatpickr/-/flatpickr-4.6.13.tgz",
"integrity": "sha512-97PMG/aywoYpB4IvbvUJi0RQi8vearvU0oov1WW3k0WZPBMrTQVqekSX5CjSG/M4Q3i6A/0FKXC7RyAoAUUSPw==",
"license": "MIT"
},
"node_modules/follow-redirects": { "node_modules/follow-redirects": {
"version": "1.16.0", "version": "1.16.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz", "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
@@ -1061,7 +1036,6 @@
"version": "2.3.3", "version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true, "hasInstallScript": true,
"license": "MIT", "license": "MIT",
"optional": true, "optional": true,
@@ -1223,7 +1197,7 @@
"version": "2.7.0", "version": "2.7.0",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz", "resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
"integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==", "integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
"dev": true, "devOptional": true,
"license": "MIT", "license": "MIT",
"bin": { "bin": {
"jiti": "lib/jiti-cli.mjs" "jiti": "lib/jiti-cli.mjs"
@@ -1256,11 +1230,16 @@
} }
} }
}, },
"node_modules/leaflet": {
"version": "1.9.4",
"resolved": "https://registry.npmjs.org/leaflet/-/leaflet-1.9.4.tgz",
"integrity": "sha512-nxS1ynzJOmOlHp+iL3FyWqK89GtNL8U8rvlMOsQdTTssxZwCXh8N2NB3GDQOL+YR3XnWyZAxwQixURb+FA74PA==",
"license": "BSD-2-Clause"
},
"node_modules/lightningcss": { "node_modules/lightningcss": {
"version": "1.32.0", "version": "1.32.0",
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz", "resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",
"integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==", "integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"dependencies": { "dependencies": {
"detect-libc": "^2.0.3" "detect-libc": "^2.0.3"
@@ -1293,7 +1272,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1314,7 +1292,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1335,7 +1312,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1356,7 +1332,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1377,7 +1352,6 @@
"cpu": [ "cpu": [
"arm" "arm"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1398,7 +1372,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1419,7 +1392,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1440,7 +1412,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1461,7 +1432,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1482,7 +1452,6 @@
"cpu": [ "cpu": [
"arm64" "arm64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1503,7 +1472,6 @@
"cpu": [ "cpu": [
"x64" "x64"
], ],
"dev": true,
"license": "MPL-2.0", "license": "MPL-2.0",
"optional": true, "optional": true,
"os": [ "os": [
@@ -1567,7 +1535,6 @@
"version": "3.3.15", "version": "3.3.15",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz", "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz",
"integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==", "integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==",
"dev": true,
"funding": [ "funding": [
{ {
"type": "github", "type": "github",
@@ -1586,14 +1553,12 @@
"version": "1.1.1", "version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz", "resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==", "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"dev": true,
"license": "ISC" "license": "ISC"
}, },
"node_modules/picomatch": { "node_modules/picomatch": {
"version": "4.0.5", "version": "4.0.5",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz", "resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==", "integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
"dev": true,
"license": "MIT", "license": "MIT",
"engines": { "engines": {
"node": ">=12" "node": ">=12"
@@ -1606,7 +1571,6 @@
"version": "8.5.16", "version": "8.5.16",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz", "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz",
"integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==", "integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==",
"dev": true,
"funding": [ "funding": [
{ {
"type": "opencollective", "type": "opencollective",
@@ -1654,7 +1618,6 @@
"version": "1.1.4", "version": "1.1.4",
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.4.tgz", "resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.4.tgz",
"integrity": "sha512-IjZYiLxZwpnhwhdBH2ugdTGVSdhCQUmLxLoqyjiL0JxYjyRst+5a0P3xfrTxJ5F638j4Mvvw5FAX5XE6eHpXbA==", "integrity": "sha512-IjZYiLxZwpnhwhdBH2ugdTGVSdhCQUmLxLoqyjiL0JxYjyRst+5a0P3xfrTxJ5F638j4Mvvw5FAX5XE6eHpXbA==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"@oxc-project/types": "=0.138.0", "@oxc-project/types": "=0.138.0",
@@ -1711,7 +1674,6 @@
"version": "1.2.1", "version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz", "resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==", "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"dev": true,
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"engines": { "engines": {
"node": ">=0.10.0" "node": ">=0.10.0"
@@ -1786,7 +1748,6 @@
"version": "0.2.17", "version": "0.2.17",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz", "resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==", "integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"fdir": "^6.5.0", "fdir": "^6.5.0",
@@ -1813,14 +1774,13 @@
"version": "2.8.1", "version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz", "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==", "integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true, "devOptional": true,
"license": "0BSD" "license": "0BSD"
}, },
"node_modules/vite": { "node_modules/vite": {
"version": "8.1.3", "version": "8.1.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-8.1.3.tgz", "resolved": "https://registry.npmjs.org/vite/-/vite-8.1.3.tgz",
"integrity": "sha512-Ds+gBRbj0lwRO2Y5hwnUBdxSwlAve9LeRyU4sNnAr0ewW0gWF0n5bgXgUzbgZ49MV9BVUAQUFYVcDUcilUExMA==", "integrity": "sha512-Ds+gBRbj0lwRO2Y5hwnUBdxSwlAve9LeRyU4sNnAr0ewW0gWF0n5bgXgUzbgZ49MV9BVUAQUFYVcDUcilUExMA==",
"dev": true,
"license": "MIT", "license": "MIT",
"dependencies": { "dependencies": {
"lightningcss": "^1.32.0", "lightningcss": "^1.32.0",
+7 -1
View File
@@ -14,8 +14,14 @@
"vite": "^8.0.0" "vite": "^8.0.0"
}, },
"dependencies": { "dependencies": {
"@boboko/core": "git+https://code.radical-elements.com/boboko/core.git#semver:0.x",
"@hotwired/stimulus": "^3.2.2", "@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo": "^8.0.23", "@hotwired/turbo": "^8.0.23",
"axios": "^1.15.2" "axios": "^1.15.2",
"leaflet": "^1.9.4"
},
"_comment_boboko_core": "Mirrors composer.json's repositories/_repositories toggle: swap @boboko/core above with the line in _dependencies below (and back) by hand to switch between the local path-repo checkout and a tagged VCS install. The #semver:0.x range mirrors composer.json's own \"boboko/core\": \"0.*\" constraint exactly — note ^0.23.0 would NOT be equivalent here, since npm's caret locks the minor version too below 1.0.0 (>=0.23.0 <0.24.0). 0.x matches any 0.y.z tag, same as Composer's 0.*. npm reads the repo's git tags, filters to valid semver ones, and resolves the best match, so `npm update @boboko/core` alone picks up a newly pushed tag within range, no manual edit here per release. See docker/entrypoint-vite.sh and CONTRIBUTE.md.",
"_dependencies": {
"@boboko/core": "file:../boboko-core"
} }
} }
+2
View File
@@ -0,0 +1,2 @@
/*! tailwindcss v4.3.0 | MIT License | https://tailwindcss.com */
@layer properties{@supports (((-webkit-hyphens:none)) and (not (margin-trim:inline))) or ((-moz-orient:inline) and (not (color:rgb(from red r g b)))){*,:before,:after,::backdrop{--tw-font-weight:initial;--tw-shadow:0 0 #0000;--tw-shadow-color:initial;--tw-shadow-alpha:100%;--tw-inset-shadow:0 0 #0000;--tw-inset-shadow-color:initial;--tw-inset-shadow-alpha:100%;--tw-ring-color:initial;--tw-ring-shadow:0 0 #0000;--tw-inset-ring-color:initial;--tw-inset-ring-shadow:0 0 #0000;--tw-ring-inset:initial;--tw-ring-offset-width:0px;--tw-ring-offset-color:#fff;--tw-ring-offset-shadow:0 0 #0000;--tw-tracking:initial;--tw-duration:initial;--tw-translate-x:0;--tw-translate-y:0;--tw-translate-z:0;--tw-divide-y-reverse:0;--tw-border-style:solid;--tw-leading:initial;--tw-outline-style:solid;--tw-scale-x:1;--tw-scale-y:1;--tw-scale-z:1;--tw-ease:initial;--tw-rotate-x:initial;--tw-rotate-y:initial;--tw-rotate-z:initial;--tw-skew-x:initial;--tw-skew-y:initial;--tw-space-y-reverse:0;--tw-divide-x-reverse:0;--tw-content:"";--tw-space-x-reverse:0;--tw-ordinal:initial;--tw-slashed-zero:initial;--tw-numeric-figure:initial;--tw-numeric-spacing:initial;--tw-numeric-fraction:initial}}}@layer theme{:root,:host{--font-mono:var(--font-family-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-sky-400:oklch(74.6% .16 232.661);--color-gray-100:var(--gray-100);--color-gray-200:var(--gray-200);--color-gray-300:var(--gray-300);--color-gray-400:var(--gray-400);--color-gray-500:var(--gray-500);--color-gray-600:var(--gray-600);--color-gray-700:var(--gray-700);--color-gray-900:var(--gray-900);--color-gray-950:var(--gray-950);--color-black:#000;--color-white:#fff;--spacing:.25rem;--breakpoint-sm:40rem;--breakpoint-md:48rem;--breakpoint-lg:64rem;--breakpoint-xl:80rem;--breakpoint-2xl:96rem;--container-3xs:16rem;--container-2xs:18rem;--container-xs:20rem;--container-sm:24rem;--container-md:28rem;--container-lg:32rem;--container-xl:36rem;--container-2xl:42rem;--container-3xl:48rem;--container-4xl:56rem;--container-5xl:64rem;--container-6xl:72rem;--container-7xl:80rem;--text-xs:.75rem;--text-xs--line-height:calc(1 / .75);--text-sm:.875rem;--text-sm--line-height:calc(1.25 / .875);--text-base:1rem;--text-base--line-height:calc(1.5 / 1);--text-lg:1.125rem;--text-lg--line-height:calc(1.75 / 1.125);--text-xl:1.25rem;--text-xl--line-height:calc(1.75 / 1.25);--text-2xl:1.5rem;--text-2xl--line-height:calc(2 / 1.5);--text-3xl:1.875rem;--text-3xl--line-height:calc(2.25 / 1.875);--font-weight-thin:100;--font-weight-extralight:200;--font-weight-light:300;--font-weight-normal:400;--font-weight-medium:500;--font-weight-semibold:600;--font-weight-bold:700;--font-weight-extrabold:800;--font-weight-black:900;--tracking-tighter:-.05em;--tracking-tight:-.025em;--leading-loose:2;--radius-sm:.25rem;--radius-md:.375rem;--radius-lg:.5rem;--radius-xl:.75rem;--ease-in:cubic-bezier(.4, 0, 1, 1);--ease-out:cubic-bezier(0, 0, .2, 1);--ease-in-out:cubic-bezier(.4, 0, .2, 1);--animate-spin:spin 1s linear infinite;--animate-pulse:pulse 2s cubic-bezier(.4, 0, .6, 1) infinite;--default-transition-duration:.15s;--default-transition-timing-function:cubic-bezier(.4, 0, .2, 1);--default-font-family:var(--font-family), ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji";--default-mono-font-family:var(--font-family-mono), ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;--color-primary-400:var(--primary-400);--color-primary-500:var(--primary-500);--color-primary-600:var(--primary-600)}}@layer base{*,:after,:before,::backdrop{box-sizing:border-box;border:0 solid;margin:0;padding:0}::file-selector-button{box-sizing:border-box;border:0 solid;margin:0;padding:0}html,:host{-webkit-text-size-adjust:100%;tab-size:4;line-height:1.5;font-family:var(--default-font-family,ui-sans-serif, system-ui, sans-serif, "Apple Color Emoji", "Segoe UI Emoji", "Segoe UI Symbol", "Noto Color Emoji");font-feature-settings:var(--default-font-feature-settings,normal);font-variation-settings:var(--default-font-variation-settings,normal);-webkit-tap-highlight-color:transparent}hr{height:0;color:inherit;border-top-width:1px}abbr:where([title]){-webkit-text-decoration:underline dotted;text-decoration:underline dotted}h1,h2,h3,h4,h5,h6{font-size:inherit;font-weight:inherit}a{color:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;-webkit-text-decoration:inherit;text-decoration:inherit}b,strong{font-weight:bolder}code,kbd,samp,pre{font-family:var(--default-mono-font-family,ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace);font-feature-settings:var(--default-mono-font-feature-settings,normal);font-variation-settings:var(--default-mono-font-variation-settings,normal);font-size:1em}small{font-size:80%}sub,sup{vertical-align:baseline;font-size:75%;line-height:0;position:relative}sub{Line truncated
View File
File mode changed.
@@ -0,0 +1 @@
@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-ext-wght-normal-SP7Z6XGK.woff2") format("woff2-variations");unicode-range:U+0460-052F,U+1C80-1C8A,U+20B4,U+2DE0-2DFF,U+A640-A69F,U+FE2E-FE2F}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-cyrillic-wght-normal-DR6K5BQD.woff2") format("woff2-variations");unicode-range:U+0301,U+0400-045F,U+0490-0491,U+04B0-04B1,U+2116}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-ext-wght-normal-A2J6H3EX.woff2") format("woff2-variations");unicode-range:U+1F00-1FFF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-greek-wght-normal-ZABHMKQG.woff2") format("woff2-variations");unicode-range:U+0370-0377,U+037A-037F,U+0384-038A,U+038C,U+038E-03A1,U+03A3-03FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-vietnamese-wght-normal-VWEHJHBA.woff2") format("woff2-variations");unicode-range:U+0102-0103,U+0110-0111,U+0128-0129,U+0168-0169,U+01A0-01A1,U+01AF-01B0,U+0300-0301,U+0303-0304,U+0308-0309,U+0323,U+0329,U+1EA0-1EF9,U+20AB}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-ext-wght-normal-ZIT2UBIY.woff2") format("woff2-variations");unicode-range:U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+0304,U+0308,U+0329,U+1D00-1DBF,U+1E00-1E9F,U+1EF2-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113,U+2C60-2C7F,U+A720-A7FF}@font-face{font-family:Inter Variable;font-style:normal;font-display:swap;font-weight:100 900;src:url("./inter-latin-wght-normal-DIHYUR35.woff2") format("woff2-variations");unicode-range:U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+0304,U+0308,U+0329,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD}
+1
View File
@@ -0,0 +1 @@
google-site-verification: googledd42b61d3393d4d5.html
View File
File mode changed.
+1
View File
@@ -0,0 +1 @@
(()=>{var o=({livewireId:n})=>({actionNestingIndex:null,isDestroyed:!1,shouldOverlayParentActions:!1,closedActionNestingIndexes:[],focusTargetsByNestingIndex:{},boundSyncActionModals:null,boundOnModalClosed:null,boundFocusTarget:null,boundFocusTargetFinished:null,pendingFocusTarget:null,restoringFocusTarget:null,init(){this.boundFocusTarget=t=>{if(t.detail.id!==n)return;this.pendingFocusTarget?.controller.abort(),this.restoringFocusTarget?.controller.abort();let e=new AbortController;this.pendingFocusTarget={controller:e,create:t.detail.createFocusTarget,restore:t.detail.createFocusTarget(e.signal)}},this.boundFocusTargetFinished=t=>{t.detail.id!==n||this.pendingFocusTarget?.create!==t.detail.createFocusTarget||(this.pendingFocusTarget.controller.abort(),this.pendingFocusTarget=null)},this.boundSyncActionModals=t=>{t.detail.id===n&&this.syncActionModals(t.detail.newActionNestingIndex,t.detail.shouldOverlayParentActions??!1)},this.boundOnModalClosed=t=>{let e=this.getActionNestingIndexFromModalId(t.detail.id);e!==null&&((this.shouldOverlayParentActions||e===0)&&this.restorePreviouslyFocusedElement(e-1),this.closedActionNestingIndexes.push(e))},window.addEventListener("sync-action-modals",this.boundSyncActionModals),window.addEventListener("modal-closed",this.boundOnModalClosed),window.addEventListener("action-modal-focus-target",this.boundFocusTarget),window.addEventListener("action-modal-focus-target-finished",this.boundFocusTargetFinished)},syncActionModals(t,e=!1){if(this.actionNestingIndex===t){this.actionNestingIndex!==null&&this.$nextTick(()=>this.openModal());return}let s=this.actionNestingIndex!==null&&t!==null&&t>this.actionNestingIndex,i=this.actionNestingIndex!==null&&t!==null&&t<this.actionNestingIndex,r=this.actionNestingIndex===null&&t!==null;if((s||r)&&(this.restoringFocusTarget?.controller.abort(),this.rememberPreviouslyFocusedElement()),this.actionNestingIndex!==null&&!(e&&s)&&this.closeModal(),this.actionNestingIndex=t,this.actionNestingIndex===null){this.restorePreviouslyFocusedElement(-1),this.closedActionNestingIndexes=[],this.focusTargetsByNestingIndex={},this.shouldOverlayParentActions=!1;return}if(this.shouldOverlayParentActions=e,this.closedActionNestingIndexes=this.closedActionNestingIndexes.filter(l=>l<=this.actionNestingIndex),!this.closedActionNestingIndexes.includes(this.actionNestingIndex)){if(!this.$el.querySelector(`#${this.generateModalId(t)}`)){this.$nextTick(()=>{this.openModal(),i&&this.restorePreviouslyFocusedElement()});return}this.openModal(),i&&this.restorePreviouslyFocusedElement()}},rememberPreviouslyFocusedElement(){if(this.pendingFocusTarget){this.focusTargetsByNestingIndex[this.actionNestingIndex??-1]=this.pendingFocusTarget,this.pendingFocusTarget=null;return}let t=this.$focus.focused();if(!t)return;if(this.actionNestingIndex===null){this.focusTargetsByNestingIndex[-1]=t;return}this.$el.querySelector(`#${this.generateModalId(this.actionNestingIndex)}`)?.contains(t)&&(this.focusTargetsByNestingIndex[this.actionNestingIndex]=t)},restorePreviouslyFocusedElement(t=this.actionNestingIndex){let e=this.focusTargetsByNestingIndex[t];for(let s in this.focusTargetsByNestingIndex)if(Number(s)>=t){let i=this.focusTargetsByNestingIndex[s];i!==e&&i.controller?.abort(),delete this.focusTargetsByNestingIndex[s]}this.restoringFocusTarget?.nestingIndex>t&&(this.restoringFocusTarget.controller.abort(),this.restoringFocusTarget=null),e&&(this.restoringFocusTarget?.controller.abort(),this.restoringFocusTarget=e.restore?e:null,this.restoringFocusTarget&&(this.restoringFocusTarget.nestingIndex=t),this.$nextTick(()=>requestAnimationFrame(()=>requestAnimationFrame(()=>this.$nextTick(async()=>{if(this.isDestroyed)return;if(!e.restore){e.focus({preventScroll:!0});return}let{controller:s}=e;if(!s.signal.aborted)try{await e.restore()}finally{s.abort(),this.restoringFocusTarget===e&&(this.restoringFocusTarget=null)}})))))},generateModalId(t){return`fi-${n}-action-`+t},getActionNestingIndexFromModalId(t){let e=`fi-${n}-action-`;if(!t?.startsWith(e))return null;let s=Number(t.slice(e.length));return Number.isInteger(s)?s:null},openModal(){if(this.isDestroyed)return;let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("open-modal",{bubbles:!0,composed:!0,detail:{id:t}}))},closeModal(){let t=this.generateModalId(this.actionNestingIndex);document.dispatchEvent(new CustomEvent("close-modal-quietly",{bubbles:!0,composed:!0,detail:{id:t}}))},destroy(){this.isDestroyed=!0,this.pendingFocusTarget?.controller.abort(),this.restoringFocusTarget?.controller.abort(),Object.values(this.focusTargetsByNestingIndex).forEach(t=>t.controller?.abort()),window.removeEventListener("action-modal-focus-target",this.boundFocusTarget),window.removeEventListener("action-modal-focus-target-finished",this.boundFocusTargetFinished),this.boundSyncActionModals&&(window.removeEventListener("sync-action-modals",this.boundSyncActionModals),this.boundSyncActionModals=null),this.boundOnModalLine truncated
+1
View File
@@ -0,0 +1 @@
(()=>{var le=Object.create,x=Object.defineProperty,ue=Object.getPrototypeOf,de=Object.prototype.hasOwnProperty,fe=Object.getOwnPropertyNames,ce=Object.getOwnPropertyDescriptor,he=e=>x(e,"__esModule",{value:!0}),pe=(e,n)=>()=>(n||(n={exports:{}},e(n.exports,n)),n.exports),me=(e,n,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of fe(n))!de.call(e,r)&&r!=="default"&&x(e,r,{get:()=>n[r],enumerable:!(t=ce(n,r))||t.enumerable});return e},ve=e=>me(he(x(e!=null?le(ue(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e),ge=pe((e,n)=>{(function(t,r,o){if(!t)return;for(var l={8:"backspace",9:"tab",13:"enter",16:"shift",17:"ctrl",18:"alt",20:"capslock",27:"esc",32:"space",33:"pageup",34:"pagedown",35:"end",36:"home",37:"left",38:"up",39:"right",40:"down",45:"ins",46:"del",91:"meta",93:"meta",224:"meta"},g={106:"*",107:"+",109:"-",110:".",111:"/",186:";",187:"=",188:",",189:"-",190:".",191:"/",192:"`",219:"[",220:"\\",221:"]",222:"'"},p={"~":"`","!":"1","@":"2","#":"3",$:"4","%":"5","^":"6","&":"7","*":"8","(":"9",")":"0",_:"-","+":"=",":":";",'"':"'","<":",",">":".","?":"/","|":"\\"},_={option:"alt",command:"meta",return:"enter",escape:"esc",plus:"+",mod:/Mac|iPod|iPhone|iPad/.test(navigator.platform)?"meta":"ctrl"},k,b=1;b<20;++b)l[111+b]="f"+b;for(b=0;b<=9;++b)l[b+96]=b.toString();function C(i,s,u){if(i.addEventListener){i.addEventListener(s,u,!1);return}i.attachEvent("on"+s,u)}function U(i){if(i.type=="keypress"){var s=String.fromCharCode(i.which);return i.shiftKey||(s=s.toLowerCase()),s}return l[i.which]?l[i.which]:g[i.which]?g[i.which]:String.fromCharCode(i.which).toLowerCase()}function X(i,s){return i.sort().join(",")===s.sort().join(",")}function Y(i){var s=[];return i.shiftKey&&s.push("shift"),i.altKey&&s.push("alt"),i.ctrlKey&&s.push("ctrl"),i.metaKey&&s.push("meta"),s}function Z(i){if(i.preventDefault){i.preventDefault();return}i.returnValue=!1}function ee(i){if(i.stopPropagation){i.stopPropagation();return}i.cancelBubble=!0}function L(i){return i=="shift"||i=="ctrl"||i=="alt"||i=="meta"}function te(){if(!k){k={};for(var i in l)i>95&&i<112||l.hasOwnProperty(i)&&(k[l[i]]=i)}return k}function ie(i,s,u){return u||(u=te()[i]?"keydown":"keypress"),u=="keypress"&&s.length&&(u="keydown"),u}function se(i){return i==="+"?["+"]:(i=i.replace(/\+{2}/g,"+plus"),i.split("+"))}function N(i,s){var u,v,M,D=[];for(u=se(i),M=0;M<u.length;++M)v=u[M],_[v]&&(v=_[v]),s&&s!="keypress"&&p[v]&&(v=p[v],D.push("shift")),L(v)&&D.push(v);return s=ie(v,D,s),{key:v,modifiers:D,action:s}}function I(i,s){return i===null||i===r?!1:i===s?!0:I(i.parentNode,s)}function y(i){var s=this;if(i=i||r,!(s instanceof y))return new y(i);s.target=i,s._callbacks={},s._directMap={};var u={},v,M=!1,D=!1,T=!1;function P(a){a=a||{};var f=!1,h;for(h in u){if(a[h]){f=!0;continue}u[h]=0}f||(T=!1)}function G(a,f,h,d,m,O){var c,w,E=[],S=h.type;if(!s._callbacks[a])return[];for(S=="keyup"&&L(a)&&(f=[a]),c=0;c<s._callbacks[a].length;++c)if(w=s._callbacks[a][c],!(!d&&w.seq&&u[w.seq]!=w.level)&&S==w.action&&(S=="keypress"&&!h.metaKey&&!h.ctrlKey||X(f,w.modifiers))){var ae=!d&&w.combo==m,oe=d&&w.seq==d&&w.level==O;(ae||oe)&&s._callbacks[a].splice(c,1),E.push(w)}return E}function $(a,f,h,d){s.stopCallback(f,f.target||f.srcElement,h,d)||a(f,h)===!1&&(Z(f),ee(f))}s._handleKey=function(a,f,h){var d=G(a,f,h),m,O={},c=0,w=!1;for(m=0;m<d.length;++m)d[m].seq&&(c=Math.max(c,d[m].level));for(m=0;m<d.length;++m){if(d[m].seq){if(d[m].level!=c)continue;w=!0,O[d[m].seq]=1,$(d[m].callback,h,d[m].combo,d[m].seq);continue}w||$(d[m].callback,h,d[m].combo)}var E=h.type=="keypress"&&D;h.type==T&&!L(a)&&!E&&P(O),D=w&&h.type=="keydown"};function q(a){typeof a.which!="number"&&(a.which=a.keyCode);var f=U(a);if(f){if(a.type=="keyup"&&M===f){M=!1;return}s.handleKey(f,Y(a),a)}}function re(){clearTimeout(v),v=setTimeout(P,1e3)}function ne(a,f,h,d){u[a]=0;function m(S){return function(){T=S,++u[a],re()}}function O(S){$(h,S,a),d!=="keyup"&&(M=U(S)),setTimeout(P,10)}for(var c=0;c<f.length;++c){var w=c+1===f.length,E=w?O:m(d||N(f[c+1]).action);Q(f[c],E,d,a,c)}}function Q(a,f,h,d,m){s._directMap[a+":"+h]=f,a=a.replace(/\s+/g," ");var O=a.split(" "),c;if(O.length>1){ne(a,O,f,h);return}c=N(a,h),s._callbacks[c.key]=s._callbacks[c.key]||[],G(c.key,c.modifiers,{type:c.action},d,a,m),s._callbacks[c.key][d?"unshift":"push"]({callback:f,modifiers:c.modifiers,action:c.action,seq:d,level:m,combo:a})}s._bindMultiple=function(a,f,h){for(var d=0;d<a.length;++d)Q(a[d],f,h)},C(i,"keypress",q),C(i,"keydown",q),C(i,"keyup",q)}y.prototype.bind=function(i,s,u){var v=this;return i=i instanceof Array?i:[i],v._bindMultiple.call(v,i,s,u),v},y.prototype.unbind=function(i,s){var u=this;return u.bind.call(u,i,function(){},s)},y.prototype.trigger=function(i,s){var u=this;return u._directMap[i+":"+s]&&u._directMap[i+":"+s]({},i),u},y.prototype.reset=function(){var i=this;return i._callbacks={},i._directMap={},i},y.prototype.stopCallback=function(i,s){var u=tLine truncated
Loaded 100 of 309 files, more files were not shown because too many files have changed in this diff. Show more