62 Commits
Author SHA1 Message Date
elvira b522d60954 multilingual content, change in how we show header categories and homepage hero products 2026-09-28 19:42:35 +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 d43b615297 Feat: Moving Email Updates to Core 2026-09-25 15:37:34 +03:00
arvanitakis 7f6c1e6307 Chore: Moving Recovery Consent to Core 2026-09-25 14:13:15 +03:00
arvanitakis 5bbf0aabcd Fix: Updating Account Controller to Handle tax_identifier correctly 2026-09-25 14:03:37 +03:00
arvanitakis fa172860db Chore: Claiming Guest Orders Moved to Core 2026-09-25 13:58:13 +03:00
arvanitakis a51e9456d6 Feat: Moving File Handling To Core 2026-09-25 13:47:58 +03:00
elvira 540da1af24 reviews photos clickable and contact form functionality 2026-09-24 21:03:59 +03:00
elvira e28faea546 3dealer favicon 2026-09-24 19:31:36 +03:00
elvira 8055c003ac reverted a migration and some 3dealer functionality that should be in core 2026-09-24 19:22:40 +03:00
elvira 94803bfb67 terms acceptance during login, checkout connection to user account and login process 2026-09-24 19:08:13 +03:00
elvira cf3681260b account pages: login, order history, order details, account details, wishlist 2026-09-24 17:27:58 +03:00
elvira 580adac33a product custom fields 2026-09-23 17:53:23 +03:00
elvira a4240b6474 composer 2026-09-23 14:46:20 +03:00
arvanitakis 326e1fac54 Updating search.php for indexing 2026-09-23 09:48:25 +03:00
elvira e3a6267059 fix in product page links and tabs, fixes in email template, minor change in reviews theming 2026-09-22 19:18:55 +03:00
elvira 24851184c4 temp emails, reviews theming and form, minor change in checkout module, validation translations seeder 2026-09-22 19:00:34 +03:00
elvira a107184010 product options layout and add to cart button in homepage 2026-09-21 18:53:45 +03:00
elvira af0245de43 ux fix on product increase 2026-09-17 21:56:58 +03:00
elvira afa1993c53 stock check, variants in cart, variant buttons in product page 2026-09-17 21:52:39 +03:00
arvanitakis 78c8165c04 Feat: Box now tests 2026-09-17 19:55:39 +03:00
arvanitakis fe55cb5f33 Fix: Removing Duplicate Event Dispatching for UserCreated model 2026-09-16 23:22:32 +03:00
arvanitakis 038ea05d56 Feature: translations on regions and countries on payment methods 2026-09-15 23:53:59 +03:00
elvira ba6d68c5b9 payment fix 2026-09-15 19:20:59 +03:00
elvira 1598f053ee payment fix 2026-09-15 15:04:40 +03:00
arvanitakis 279339a095 Feat: Updating config for boboko order updates 2026-09-14 20:17:34 +03:00
elvira df9374a070 autosave issue in checkout - pt1 2026-09-14 20:13:40 +03:00
elvira 97c12efdb1 removed resetShippingManifest() workaround from CheckoutController 2026-09-14 16:30:45 +03:00
elvira 2cac70c53a payment beginning (stripe) 2026-09-09 19:16:20 +03:00
elvira 46b3f29674 marketing consent to recovery consent and connection with core 2026-09-09 14:42:23 +03:00
elvira 7a8b9cf4c0 marketing consent 2026-09-09 14:09:59 +03:00
elvira 0fb606ff3f checkout and shipping part 2026-09-09 13:51:00 +03:00
elvira 2d85591a43 checkout process - start 2026-09-08 20:41:49 +03:00
elvira 7577426f49 cart drawer and general structure 2026-09-04 19:39:37 +03:00
elvira c5f7b28aa0 Merge branch 'elv' into cart-temp 2026-09-04 13:21:58 +03:00
elvira 9abe45c5f7 minor changes in comments 2026-09-04 13:19:24 +03:00
elvira e57bfe3d42 minor change in contact page 2026-09-04 13:09:10 +03:00
arvanitakis 72b9abf92f Feat: Updating Product Cards, Listing Pages and SearchController 2026-09-04 13:07:57 +03:00
elvira 6c7d11ca78 minor change in contact page 2026-09-04 12:58:09 +03:00
elvira 1f0612861b general products page and small rewrite of search and category controllers etc 2026-09-03 21:32:40 +03:00
arvanitakis c7bd1efdaa Feature: Adding Meilisearch to 3dealer 2026-08-05 23:12:22 +03:00
157 changed files with 6338 additions and 1125 deletions
+22 -1
View File
@@ -31,7 +31,7 @@ DB_DATABASE=boboko
DB_USERNAME=root
DB_PASSWORD=dev
SESSION_DRIVER=database
SESSION_DRIVER=redis
SESSION_LIFETIME=120
SESSION_ENCRYPT=false
SESSION_PATH=/
@@ -58,8 +58,12 @@ MAIL_PORT=1025
MAIL_USERNAME=null
MAIL_PASSWORD=null
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}"
HCAPTCHA_SITEKEY=
HCAPTCHA_SECRET=
AWS_ACCESS_KEY_ID=
AWS_SECRET_ACCESS_KEY=
AWS_DEFAULT_REGION=us-east-1
@@ -84,6 +88,9 @@ SCOUT_QUEUE=true
MEILISEARCH_KEY=dev-meilisearch-key-change-me
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
APP_PORT=8090
STOIC_PORT=2727
@@ -92,3 +99,17 @@ POSTGRES_HOST_PORT=5436
MAILPIT_PORT=8025
VITE_PORT=5173
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
+13 -4
View File
@@ -10,11 +10,19 @@ RUN composer install \
--optimize-autoloader \
--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
# 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
COPY package*.json ./
RUN npm ci --ignore-scripts
COPY docker/entrypoint-vite.sh /entrypoint-vite.sh
RUN chmod +x /entrypoint-vite.sh
ENTRYPOINT ["/entrypoint-vite.sh"]
# ── Stage 2b: Node / Vite build ──────────────────────────────────────────────
FROM node:22-alpine AS node-build
@@ -94,7 +102,8 @@ RUN php artisan package:discover --ansi \
&& php artisan filament:assets --ansi
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
ENTRYPOINT ["/entrypoint.sh"]
+2 -8
View File
@@ -19,7 +19,6 @@
pull
docker_build
docker_up
migrate
artisan_optimize
restart_workers
stoic_generate_thumbs
@@ -45,12 +44,6 @@
{{ $compose }} up -d --remove-orphans
@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'])
echo ">>> Optimizing..."
cd {{ $path }}
@@ -61,9 +54,10 @@
@endtask
@task('restart_workers', ['on' => 'web'])
echo ">>> Restarting queue workers..."
echo ">>> Restarting queue workers and scheduler..."
cd {{ $path }}
{{ $compose }} restart queue
{{ $compose }} restart scheduler
@endtask
@task('password_protect', ['on' => 'web'])
+29
View File
@@ -0,0 +1,29 @@
# 3dealer
Storefront for 3dealer.gr: Laravel 12 + Lunar PHP (headless), on top of `boboko/core`. Front-end conventions are in [CLAUDE.md](CLAUDE.md).
## Scheduled jobs
These run in the `scheduler` container (`php artisan schedule:work`).
| Command | When | What it does |
|---|---|---|
| `custom-fields:prune-uploads` | Daily, 04:00 | Deletes custom-field photo uploads older than 24 h that no cart line or order line references. |
| `lunar:search:index` | Daily, 03:00 | Full product reindex. Registered by `boboko/core`. |
## Product custom fields
Admins can add custom fields to a product in the Lunar admin (the product's **Custom Fields** section, from `boboko/core`). The customer fills them in on the product page before adding the product to the cart. The answers are stored on the cart line (`meta.custom_fields`) and carried over to the order line.
| Field type | Storefront input | Limit |
|---|---|---|
| Short text | text input | 255 characters |
| Long text | textarea | 2,000 characters |
| File upload | photo upload | JPG, PNG, WEBP, HEIC/HEIF, up to 10 MB |
- **Photos upload as soon as they're picked.** They go to `POST /{locale}/custom-field-uploads`, which is limited to 20 per minute per client. They're stored on the private `local` disk under `storage/app/private/custom-field-uploads/`. Only an encrypted reference is sent with add-to-cart. The allowed types and size are set in `App\Http\Controllers\CustomFieldUploadController`.
- **Photos are never public.** The cart drawer, checkout summary and order confirmation link to a photo through a signed URL that expires after 2 hours.
- **Emails show text answers only**, never photos.
- **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.
- Field labels are entered once in the admin and aren't translated, so they appear as entered in both `/el` and `/en`.
+27 -9
View File
@@ -3,19 +3,23 @@
namespace App\Catalog;
/**
* Presentation shaping — how a product listing/grid card is built from
* ProductService's localized array shape (list()/getById()/random() all
* return it). Deliberately not in boboko-core: `href` depends on this
* storefront's own routes, and another app built on the same core package
* could want an entirely different card shape. Kept in one place so
* HomeController/CategoryController don't each hand-write the same
* name/price/image/href mapping.
* Presentation shaping — how a storefront product listing/grid card is built:
* name, price, image, href. Deliberately not in boboko-core: `href` depends on
* this storefront's own routes, and another app on the same core package could
* want an entirely different card shape. One place, so HomeController /
* CategoryController / ProductController / SearchController don't each
* hand-write the same name/price/image/href mapping.
*
* One source: a localized index array — ProductService::list()/getById()/
* random(), and now ProductSearchService::search() too, all return the exact
* same document shape (see ProductListingResult), so this is the only mapping
* every storefront listing page needs.
*/
final class ProductCard
{
/**
* @param array $product One item from ProductService's localized array shape.
* @return array{name: ?string, price: ?float, image: ?string, href: string}
* @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, soldOut: bool}
*/
public static function fromIndexed(array $product): array
{
@@ -24,6 +28,20 @@ public static function fromIndexed(array $product): array
'price' => $product['price'],
'image' => $product['media'][0]['url'] ?? null,
'href' => route('product.show', ['id' => $product['id']]),
// The card's quick "Add to cart" always adds this variant, same
// default Modules\Core\Catalog\Services\ProductService::
// variantSummaries() and product/show.blade.php both use — no
// picker at listing-grid scope, unlike the product page's own
// color swatches.
'variantId' => $product['variants'][0]['id'] ?? null,
// A product with custom fields (photo upload, engraving text…)
// can't be quick-added from a card — the card links to the
// product page instead, even when every field is optional.
'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),
];
}
}
@@ -7,15 +7,16 @@
use Modules\Core\Catalog\Enums\ProductSort;
/**
* The parsed state of a category listing request. The query string is the single
* source of truth for sort / filters / page — build one of these from the
* request, read the applied values off it, and use query() to build links (sort
* options, pagination, "clear filter") that carry the rest of the state along.
* The parsed filter/sort/page state of a product-listing request — used by the
* category page (scoped to a collection) and the all-products page. The query
* string is the single source of truth; build one of these from the request,
* read the applied values off it, and use query() to build links (sort options,
* pagination, "clear filter") that carry the rest of the state along.
*
* A param is only ever emitted when it differs from its default, so a pristine
* listing is just `/category/{id}` with no query string.
* listing has no query string at all.
*/
final class CategoryListing
final class ProductListing
{
private function __construct(
public readonly ?ProductSort $sort,
@@ -36,7 +37,10 @@ public static function fromRequest(Request $request): self
);
}
public function filters(int $collectionId): ProductFilters
/**
* @param ?int $collectionId scope to a collection (category page); null = every product
*/
public function filters(?int $collectionId = null): ProductFilters
{
return new ProductFilters(
collectionId: $collectionId,
@@ -48,8 +52,7 @@ public function filters(int $collectionId): ProductFilters
/**
* The applied params as a clean array (defaults omitted), with `$overrides`
* merged on top — pass `['key' => null]` to drop one. Feeds straight into
* route('category.show', ['id' => $id] + $listing->query([...])).
* merged on top — pass `['key' => null]` to drop one.
*
* @param array<string, string|int|null> $overrides
* @return array<string, string|int>
@@ -68,7 +71,7 @@ public function query(array $overrides = []): array
/**
* Whether the listing is reordered/narrowed enough that it shouldn't be
* indexed as its own page (the canonical still points at the bare category
* indexed as its own page (the canonical still points at the bare listing
* URL either way). A plain in-stock toggle is left indexable.
*/
public function isRefined(): bool
+90
View File
@@ -0,0 +1,90 @@
<?php
namespace App\Catalog;
use Closure;
use Modules\Core\Catalog\Enums\ProductSort;
use Modules\Core\Catalog\Services\ProductSearchService;
use Modules\Core\Catalog\Services\ProductService;
/**
* Assembles the data the shared shop listing body (shop/partials/listing.blade.php)
* needs — the product page, price-slider bounds, sort links and the "clear price"
* link. Used by the category page (scoped to a collection), the all-products
* page, and the search page (scoped to a query — see $query below); the `$url`
* closure turns a query-param array into a URL for whichever page is calling,
* so this class never has to know the route.
*/
final class ProductListingPage
{
private const PER_PAGE = 40;
/** Category pages rarely have enough products to fill a page, so this
* ceiling is high enough to act as "no pagination" in practice — the
* pagination component self-hides via hasPages() when everything fits.
* If a category ever exceeds it, pagination reappears as a safety net
* rather than silently truncating results. */
private const CATEGORY_PER_PAGE = 200;
public function __construct(
private readonly ProductService $products,
private readonly ProductSearchService $search,
) {}
/**
* @param Closure(array<string, string|int>): string $url
* @param ?int $collectionId scope to a collection, or null for every product
* @param ?string $query scope to a text search — when given, calls
* @return array<string, mixed>
*/
public function build(ProductListing $listing, Closure $url, ?int $collectionId = null, ?string $query = null): array
{
$filters = $listing->filters($collectionId);
$perPage = $collectionId !== null ? self::CATEGORY_PER_PAGE : self::PER_PAGE;
// Listing reads from the Meilisearch index via ProductService/
// ProductSearchService, not Eloquent. Both return a
// ProductListingResult — the product page plus the price-slider
// bounds (and available tags) from one call; the controller no
// longer stitches list()/search() + priceRange() together itself.
// Sort/filter/page all come from $listing (the query string).
$result = $query !== null
? $this->search->search(
query: $query,
filters: $filters,
sort: $listing->sort,
perPage: $perPage,
page: $listing->page,
)
: $this->products->list(
filters: $filters,
perPage: $perPage,
page: $listing->page,
sort: $listing->sort,
);
$products = $result->products
->through(ProductCard::fromIndexed(...))
->appends($listing->query(['page' => null]));
// Slider bounds — the price span of everything matching the *other*
// filters, rounded to whole euros, plus whether the current price params
// actually narrow that span. All computed in core
$priceBounds = $result->priceBounds;
return [
'listing' => $listing,
'products' => $products,
'listingAction' => $url([]),
'priceFloor' => $priceBounds->floor,
'priceCeil' => $priceBounds->ceil,
'clearPriceUrl' => $priceBounds->filtered
? $url($listing->query(['price_min' => null, 'price_max' => null, 'page' => null]))
: null,
'sortOptions' => ProductSortOptions::build(
$listing->sort,
fn (?ProductSort $sort) => $url($listing->query(['sort' => $sort?->value, 'page' => null])),
),
];
}
}
+40
View File
@@ -0,0 +1,40 @@
<?php
namespace App\Catalog;
use Closure;
use Modules\Core\Catalog\Enums\ProductSort;
/**
* Builds the option list for the shared <x-shop.sort> dropdown, so the label
* map and "the default sort has no URL param" rule live in one place. Each page
* supplies a `$url` closure that turns a sort (or null = default/relevance)
* into the right href for that page — category vs. search build their URLs
* differently.
*/
final class ProductSortOptions
{
/**
* @param Closure(?ProductSort): string $url
* @return array<int, array{label: string, href: string, current: bool}>
*/
public static function build(?ProductSort $current, Closure $url): array
{
$sorts = [
null => 'storefront.shop.sort_popularity',
ProductSort::PriceAsc->value => 'storefront.shop.sort_price_asc',
ProductSort::PriceDesc->value => 'storefront.shop.sort_price_desc',
ProductSort::Newest->value => 'storefront.shop.sort_newest',
];
return array_map(function (string $key, string $label) use ($current, $url) {
$sort = $key === '' ? null : ProductSort::from($key);
return [
'label' => __($label),
'href' => $url($sort),
'current' => $sort === $current,
];
}, array_keys($sorts), array_values($sorts));
}
}
@@ -0,0 +1,156 @@
<?php
namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Validation\Rule;
use Illuminate\View\View;
use Lunar\Models\Country;
use Lunar\Models\State;
use Modules\Core\Cart\Services\CartService;
use Modules\Core\Checkout\Services\CheckoutService;
use Modules\Core\Customer\Services\CustomerAccountService;
use Modules\Core\Privacy\Services\PrivacyService;
/**
* The profile page: name, invoice details, the one address, and account
* deletion. The customer keeps a single address, flagged as both the
* shipping and billing default, so allowing several later is a UI change
* only (the data is already Lunar's own addresses table).
*/
class AccountController extends Controller
{
// Single-country store, same as CheckoutController::STORE_COUNTRY_ISO3.
private const STORE_COUNTRY_ISO3 = 'GRC';
private const ADDRESS_FIELDS = ['line_one', 'city', 'postcode', 'state', 'contact_phone'];
public function __construct(
private readonly CustomerAccountService $account,
) {}
public function show(string $locale, Request $request): View
{
$user = $request->user();
$customer = $this->account->customer($user);
return view('account.show', [
'user' => $user,
'customer' => $customer,
'address' => $this->defaultAddress($user),
'regions' => State::where('country_id', $this->storeCountry()->id)->orderBy('name')->get(['id', 'name']),
]);
}
public function update(string $locale, Request $request): RedirectResponse
{
$user = $request->user();
$country = $this->storeCountry();
// The address is all-or-nothing: typing any part of it makes the rest
// (and the name, which Lunar requires on every address) required.
$anyAddressField = implode(',', self::ADDRESS_FIELDS);
$data = $request->validate([
'first_name' => ['nullable', 'string', 'max:255', 'required_with:'.$anyAddressField],
'last_name' => ['nullable', 'string', 'max:255', 'required_with:'.$anyAddressField],
'invoice' => ['boolean'],
'company_name' => ['nullable', 'string', 'max:255', 'required_if_accepted:invoice'],
'tax_identifier' => ['nullable', 'digits:9', 'required_if_accepted:invoice'],
'line_one' => ['nullable', 'string', 'max:255', 'required_with:'.$anyAddressField],
'city' => ['nullable', 'string', 'max:255', 'required_with:'.$anyAddressField],
'postcode' => ['nullable', 'regex:/^\d{3}\s?\d{2}$/', 'required_with:'.$anyAddressField],
'state' => [
'nullable',
'string',
'required_with:'.$anyAddressField,
Rule::exists((new State)->getTable(), 'name')->where('country_id', $country->id),
],
'contact_phone' => ['nullable', 'string', 'max:30'],
'recovery_consent' => ['boolean'],
]);
$invoice = $request->boolean('invoice');
$this->account->updateProfile($user, [
'first_name' => $data['first_name'] ?? null,
'last_name' => $data['last_name'] ?? null,
'company_name' => $invoice ? $data['company_name'] : null,
'tax_identifier' => $invoice ? $data['tax_identifier'] : null,
]);
if (filled($data['line_one'] ?? null)) {
$addressData = [
...collect($data)->only(self::ADDRESS_FIELDS)->all(),
'first_name' => $data['first_name'],
'last_name' => $data['last_name'],
'country_id' => $country->id,
'contact_email' => $user->email,
'shipping_default' => true,
'billing_default' => true,
];
$existing = $this->defaultAddress($user);
$existing
? $this->account->updateAddress($user, $existing->id, $addressData)
: $this->account->createAddress($user, $addressData);
}
$this->updateRecoveryConsent($user, $request->boolean('recovery_consent'));
return redirect()->route('account')->with('status', __('storefront.account.saved'));
}
/**
* "Email me a reminder if I don't finish my order", as a standing
* choice — stored on the customer via boboko-core's
* CustomerAccountService::setRecoveryConsent(), and applied to the
* current cart too, so opting out stops reminders for it right away.
*/
private function updateRecoveryConsent($user, bool $consent): void
{
$this->account->setRecoveryConsent($user, $consent);
// Only an existing cart; never create one just to record this.
$cart = app(CartService::class)->current();
if ($cart && (bool) data_get($cart, 'meta.recovery_consent') !== $consent) {
app(CheckoutService::class)->setRecoveryConsent($consent);
}
}
/**
* Self-service deletion: opens core's 30-day grace-period erasure request
* (which blocks the login right away) and logs out. Logging back in within
* the grace period cancels it; see core's docs/privacy.md.
*/
public function destroy(string $locale, Request $request, PrivacyService $privacy): RedirectResponse
{
$user = $request->user();
$privacy->requestErasureForUser($user, $user);
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('login')->with('status', __('storefront.account.deletion_requested'));
}
private function defaultAddress($user)
{
$addresses = collect($this->account->addresses($user));
return $addresses->firstWhere('shipping_default', true) ?? $addresses->first();
}
private function storeCountry(): Country
{
return Country::where('iso3', self::STORE_COUNTRY_ISO3)->firstOrFail();
}
}
@@ -0,0 +1,123 @@
<?php
namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Str;
use Illuminate\Validation\Rule;
use Illuminate\View\View;
use Modules\Core\Auth\Exceptions\OtpThrottledException;
use Modules\Core\Customer\Exceptions\EmailAlreadyTakenException;
use Modules\Core\Customer\Exceptions\InvalidEmailChangeCodeException;
use Modules\Core\Customer\Services\CustomerEmailChangeService;
/**
* Changing the login email — a thin wrapper over boboko-core's
* Customer\Services\CustomerEmailChangeService, which owns the actual
* request/confirm mechanics, throttling, pending-change storage, and
* mailables. This controller's own job is just the storefront's session-
* scoped "which email did I just ask to switch to" UI state (so the
* .code/.resend pages know which address to show/resend to) and
* translating the service's exceptions into the flash-message flow the
* views expect.
*/
class EmailController extends Controller
{
private const SESSION_KEY = 'pending_email_change';
public function edit(string $locale, Request $request): View
{
return view('account.email', ['user' => $request->user()]);
}
public function send(string $locale, Request $request, CustomerEmailChangeService $emailChange): RedirectResponse
{
$user = $request->user();
$request->merge(['email' => Str::lower(trim((string) $request->input('email')))]);
$validated = $request->validate([
'email' => [
'required',
'email',
'max:255',
Rule::notIn([$user->email]),
],
], [
'email.not_in' => __('storefront.account.email_same'),
]);
try {
$emailChange->request($user, $validated['email']);
} catch (EmailAlreadyTakenException) {
return back()->withInput()->withErrors(['email' => __('storefront.account.email_taken')]);
} catch (OtpThrottledException) {
return back()->withInput()->withErrors(['email' => __('storefront.auth.too_many_codes')]);
}
$request->session()->put(self::SESSION_KEY, $validated['email']);
return redirect()->route('account.email.code');
}
public function code(string $locale, Request $request): View|RedirectResponse
{
$pendingEmail = $request->session()->get(self::SESSION_KEY);
if (! $pendingEmail) {
return redirect()->route('account.email.edit');
}
return view('account.email-code', ['email' => $pendingEmail]);
}
public function resend(string $locale, Request $request, CustomerEmailChangeService $emailChange): RedirectResponse
{
$pendingEmail = $request->session()->get(self::SESSION_KEY);
if (! $pendingEmail) {
return redirect()->route('account.email.edit');
}
try {
$emailChange->request($request->user(), $pendingEmail);
} catch (EmailAlreadyTakenException) {
$request->session()->forget(self::SESSION_KEY);
return redirect()->route('account.email.edit')
->withErrors(['email' => __('storefront.account.email_taken')]);
} catch (OtpThrottledException) {
return back()->withErrors(['code' => __('storefront.auth.too_many_codes')]);
}
return back()->with('status', __('storefront.auth.code_resent'));
}
public function verify(string $locale, Request $request, CustomerEmailChangeService $emailChange): RedirectResponse
{
$pendingEmail = $request->session()->get(self::SESSION_KEY);
if (! $pendingEmail) {
return redirect()->route('account.email.edit');
}
$validated = $request->validate(['code' => ['required', 'digits:6']]);
try {
$emailChange->confirm($request->user(), $validated['code']);
} catch (EmailAlreadyTakenException) {
$request->session()->forget(self::SESSION_KEY);
return redirect()->route('account.email.edit')
->withErrors(['email' => __('storefront.account.email_taken')]);
} catch (InvalidEmailChangeCodeException) {
return back()->withErrors(['code' => __('storefront.auth.invalid_code')]);
}
$request->session()->forget(self::SESSION_KEY);
return redirect()->route('account')->with('status', __('storefront.account.email_changed'));
}
}
@@ -0,0 +1,50 @@
<?php
namespace App\Http\Controllers\Account;
use App\Http\Controllers\Controller;
use Illuminate\Http\Request;
use Illuminate\View\View;
use Modules\Core\Payment\Models\PaymentMethod;
use Modules\Core\Customer\Exceptions\OrderNotFoundException;
use Modules\Core\Customer\Services\CustomerAccountService;
/**
* Order history. Every lookup goes through CustomerAccountService, which only
* ever returns the logged-in user's own placed orders, so an order id from
* the URL can't reach someone else's order.
*/
class OrderController extends Controller
{
public function __construct(
private readonly CustomerAccountService $account,
) {}
public function index(string $locale, Request $request): View
{
return view('account.orders.index', [
'orders' => $this->account->orders($request->user(), 15),
]);
}
public function show(string $locale, Request $request, int $orderId): View
{
try {
$order = $this->account->order($request->user(), $orderId);
} catch (OrderNotFoundException) {
abort(404);
}
// By type, like the checkout confirmation: the method may since have
// been disabled, but the order still shows what was used.
$paymentMethodName = PaymentMethod::where('type', $order->meta['payment_method'] ?? null)
->first()
?->translate('name');
return view('account.orders.show', [
'order' => $order,
'paymentMethodName' => $paymentMethodName,
'shipments' => $order->shipments->whereNull('cancelled_at')->whereNotNull('tracking_reference'),
]);
}
}
@@ -0,0 +1,135 @@
<?php
namespace App\Http\Controllers\Auth;
use App\Http\Controllers\Controller;
use App\Rules\HCaptcha;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Auth;
use Illuminate\Support\Str;
use Illuminate\View\View;
use Modules\Core\Auth\Exceptions\OtpThrottledException;
use Modules\Core\Auth\Services\UserOtpService;
/**
* Passwordless customer login: email → emailed 6-digit code → logged in.
* Login and registration are the same flow — UserOtpService::generateAndSend()
* find-or-creates the user (and its Customer).
*
* All the security lives in UserOtpService: per-email code-request throttling
* (OtpThrottledException), wrong-guess lockout, the Auth::login() itself (which
* also regenerates the session and merges the guest cart via Lunar's Login
* listener) and the session-registry record. This controller only moves the
* shopper between the two steps, carrying the email in the session rather
* than the URL.
*/
class LoginController extends Controller
{
/**
* `?redirect=/el/checkout` (e.g. from the checkout's login tab) becomes the
* intended URL that verify() returns to. Only a same-site path is accepted:
* no scheme, no protocol-relative `//host`, so it can't redirect off-site.
*/
public function create(string $locale, Request $request): View
{
$redirect = (string) $request->query('redirect', '');
if (preg_match('#^/(?![/\\\\])#', $redirect)) {
$request->session()->put('url.intended', url($redirect));
}
return view('auth.login');
}
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([
'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']));
try {
$otp->generateAndSend($email);
} catch (OtpThrottledException) {
return back()->withInput()->withErrors([
'email' => __('storefront.auth.too_many_codes'),
]);
}
$request->session()->put('login.email', $email);
return redirect()->route('login.code');
}
public function code(string $locale, Request $request): View|RedirectResponse
{
$email = $request->session()->get('login.email');
if (! $email) {
return redirect()->route('login');
}
return view('auth.login-code', ['email' => $email]);
}
public function resend(string $locale, Request $request, UserOtpService $otp): RedirectResponse
{
$email = $request->session()->get('login.email');
if (! $email) {
return redirect()->route('login');
}
try {
$otp->generateAndSend($email);
} catch (OtpThrottledException) {
return back()->withErrors([
'code' => __('storefront.auth.too_many_codes'),
]);
}
return back()->with('status', __('storefront.auth.code_resent'));
}
public function verify(string $locale, Request $request, UserOtpService $otp): RedirectResponse
{
$email = $request->session()->get('login.email');
if (! $email) {
return redirect()->route('login');
}
$validated = $request->validate([
'code' => ['required', 'digits:6'],
]);
// Wrong, expired, or locked out after too many guesses — core doesn't
// say which, so neither do we; the page offers "resend code" for all three.
if (! $otp->validate($email, $validated['code'], $request)) {
return back()->withErrors([
'code' => __('storefront.auth.invalid_code'),
]);
}
$request->session()->forget('login.email');
return redirect()->intended(route('home'));
}
public function destroy(string $locale, Request $request): RedirectResponse
{
Auth::logout();
$request->session()->invalidate();
$request->session()->regenerateToken();
return redirect()->route('home');
}
}
+9 -29
View File
@@ -2,16 +2,15 @@
namespace App\Http\Controllers;
use App\Catalog\CategoryListing;
use App\Catalog\ProductCard;
use App\Catalog\ProductListing;
use App\Catalog\ProductListingPage;
use Illuminate\Http\Response;
use Modules\Core\Catalog\Services\CollectionService;
use Modules\Core\Catalog\Services\ProductService;
class CategoryController extends Controller
{
public function __construct(
private readonly ProductService $products,
private readonly ProductListingPage $listingPage,
private readonly CollectionService $collections,
) {}
@@ -20,33 +19,14 @@ public function show(string $locale, int $collection)
$collectionData = $this->collections->getById($collection);
abort_if($collectionData === null, Response::HTTP_NOT_FOUND);
$listing = CategoryListing::fromRequest(request());
$filters = $listing->filters($collectionData['id']);
$perPage = 12;
$listing = ProductListing::fromRequest(request());
// One call for both the product page and the price slider's bounds —
// see ProductService::list()'s own docblock for why a controller no
// longer orchestrates list() + priceSliderBounds() itself.
$listingResult = $this->products->list(
filters: $filters,
perPage: $perPage,
page: $listing->page,
sort: $listing->sort,
$data = $this->listingPage->build(
$listing,
fn (array $query) => route('category.show', ['id' => $collectionData['id']] + $query),
$collectionData['id'],
);
$products = $listingResult->products
->through(fn (array $product) => ProductCard::fromIndexed($product))
->appends($listing->query(['page' => null]));
$priceBounds = $listingResult->priceBounds;
return view('category.show', [
'collection' => $collectionData,
'products' => $products,
'listing' => $listing,
'priceFloor' => $priceBounds->floor,
'priceCeil' => $priceBounds->ceil,
'priceFiltered' => $priceBounds->filtered,
]);
return view('category.show', [...$data, 'collection' => $collectionData]);
}
}
+74 -2
View File
@@ -2,10 +2,82 @@
namespace App\Http\Controllers;
use App\Http\Requests\ContactRequest;
use App\Mail\ContactConfirmationMail;
use App\Mail\ContactMessageMail;
use App\Models\StoicPage;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Facades\Log;
use Illuminate\Support\Facades\Mail;
use Illuminate\Support\Facades\RateLimiter;
use Illuminate\View\View;
use Modules\Core\Store\Services\StoreDetailsService;
use Throwable;
/**
* Contact form. Nothing is stored: the message is emailed to the store
* (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.
*
* Limited per IP in here rather than with throttle middleware, so the limit
* shows as a message on the form instead of a bare 429 page.
*/
class ContactController extends Controller
{
public function index(string $locale)
private const SEND_LIMIT = 3;
private const SEND_DECAY_SECONDS = 600;
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
{
$key = 'contact:'.$request->ip();
if (RateLimiter::tooManyAttempts($key, self::SEND_LIMIT)) {
return back()->withInput()->with('contact_error', __('storefront.contact.too_many'));
}
RateLimiter::hit($key, self::SEND_DECAY_SECONDS);
$data = $request->validated();
$to = app(StoreDetailsService::class)->current()->contact_email;
try {
if (blank($to)) {
throw new \RuntimeException('Store Details has no contact email.');
}
Mail::to($to)->send(new ContactMessageMail(
$data['name'],
$data['email'],
$data['message'],
$locale,
));
} catch (Throwable $e) {
Log::error('Contact form: store email failed', ['exception' => $e]);
return back()->withInput()->with('contact_error', __('storefront.contact.send_failed'));
}
// The store already has the message, so a failed confirmation is only logged.
try {
Mail::to($data['email'])->locale($locale)->send(new ContactConfirmationMail);
} catch (Throwable $e) {
Log::warning('Contact form: confirmation email failed', ['exception' => $e]);
}
return redirect()->route('contact')->with('status', __('storefront.contact.sent'));
}
}
@@ -0,0 +1,62 @@
<?php
namespace App\Http\Controllers;
use Illuminate\Http\Request;
use Modules\Core\File\Http\Controllers\UploadFileController;
/**
* Stores the shopper's photo for a product custom field of type `file` (see
* boboko-core's Product::$custom_fields) the moment it's picked on the product
* page — before add-to-cart, see custom-field-upload-controller.js.
*
* Which files are acceptable (extensions, size) is a per-site decision — this
* site: photographs — so it lives here as this app's own policy, extending
* boboko-core's Modules\Core\File\Http\Controllers\UploadFileController for
* the actual store()/validate()/respond() mechanics. The module's add-to-cart
* endpoint only ever receives the stored File row's own `id` — FileService is
* the single source of truth for disk/path/name/mime, never duplicated into
* cart/order line meta (see Checkout\CartController::customFieldsMeta()). A
* shopper can't point a cart line at someone else's file: CartController only
* accepts an id that is both unowned and tagged with this exact PURPOSE.
*
* Stored on the private `local` disk: these are customers' personal photos,
* never reachable by a public URL except through FileService's own signed
* download route. Uploads nobody adds to a cart are removed by core's
* `boboko:file:prune-unowned custom-field-upload` command.
*/
class CustomFieldUploadController extends UploadFileController
{
public const PURPOSE = 'custom-field-upload';
public const MAX_KILOBYTES = 10240;
public const EXTENSIONS = ['jpg', 'jpeg', 'png', 'webp', 'heic', 'heif'];
/**
* For the file input's `accept` attribute — same list the server enforces.
*/
public static function accept(): string
{
return '.'.implode(',.', self::EXTENSIONS);
}
protected function purpose(): string
{
return self::PURPOSE;
}
protected function validationRules(Request $request): array
{
return [
'file' => ['required', 'file', 'mimes:'.implode(',', self::EXTENSIONS), 'max:'.self::MAX_KILOBYTES],
];
}
// `label` is the admin-authored field label, only used as the
// :attribute in the validation message shown next to that field.
protected function validationAttributes(Request $request): array
{
return ['file' => (string) $request->input('label', 'file')];
}
}
+51 -6
View File
@@ -4,27 +4,72 @@
use App\Catalog\ProductCard;
use App\Models\StoicPage;
use Modules\Core\Catalog\DTOs\ProductFilters;
use Modules\Core\Catalog\Services\CollectionService;
use Modules\Core\Catalog\Services\ProductService;
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)
{
$page = StoicPage::firstWhere('slug', 'home');
$page = StoicPage::localized('home');
if (! $page) {
abort(404);
}
$products = collect($this->products->random(13))
->map(fn (array $product) => ProductCard::fromIndexed($product));
// Random pool for the classics carousel, and for the hero too when the
// 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', [
'page' => $page,
'heroProducts' => $products->take(5)->values(),
'classicsProducts' => $products->slice(5)->values(),
'heroProducts' => $hero->map(fn (array $product) => ProductCard::fromIndexed($product))->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();
}
}
+39 -2
View File
@@ -3,9 +3,28 @@
namespace App\Http\Controllers;
use App\Models\StoicPage;
use Modules\Core\Store\Services\StoreDetailsService;
class LegalPageController extends Controller
{
/**
* {placeholder} => StoreDetails column, usable in the Stoic legal page
* markdown.
*/
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,
) {}
public function terms(string $locale)
{
return $this->show('terms-and-conditions');
@@ -28,12 +47,30 @@ public function cookies(string $locale)
private function show(string $slug)
{
$page = StoicPage::firstWhere('slug', $slug);
$page = StoicPage::localized($slug);
if (! $page) {
abort(404);
}
return view('legal', ['page' => $page]);
return view('legal', [
'page' => $page,
'content' => $this->fillPlaceholders($page->content ?? ''),
]);
}
/**
* 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.
*/
private function fillPlaceholders(string $content): string
{
$details = $this->storeDetails->current();
return strtr($content, array_map(
fn (string $column) => e((string) ($details->translate($column) ?? '')),
self::PLACEHOLDERS,
));
}
}
+225 -7
View File
@@ -2,30 +2,248 @@
namespace App\Http\Controllers;
use App\Catalog\ProductListing;
use App\Catalog\ProductListingPage;
use Illuminate\Http\JsonResponse;
use Illuminate\Http\RedirectResponse;
use Illuminate\Http\Request;
use Illuminate\Http\Response;
use Illuminate\Support\Facades\Validator;
use Lunar\Models\Product;
use Lunar\Models\ProductVariant;
use Modules\Core\Catalog\Services\ProductService;
use Modules\Core\Review\Models\ProductReview;
class ProductController extends Controller
{
public function __construct(private readonly ProductService $products) {}
public function __construct(
private readonly ProductService $products,
private readonly ProductListingPage $listingPage,
) {}
/**
* All products — the category page without a collection scope. Filters,
* sort, pagination and the shared listing body all work identically.
*/
public function index(string $locale)
{
$listing = ProductListing::fromRequest(request());
$data = $this->listingPage->build(
$listing,
fn (array $query) => route('products', $query),
);
return view('products.index', $data);
}
public function show(string $locale, int $id)
{
$product = $this->products->getById($id);
abort_if($product === null, Response::HTTP_NOT_FOUND);
$product = $this->mergeJustSubmittedReview($product);
$collection = $product['collections'][0] ?? null;
$variantsData = $this->products->variantSummaries($product);
$firstVariant = $product['variants'][0] ?? null;
$option = $firstVariant['options'][0]['option'] ?? null;
// dd($product);
[$productOptions, $variantsData] = $this->buildOptionPicker($id);
return view('product.show', [
'collection' => $collection,
'product' => $product,
'option' => $option,
'productOptions' => $productOptions,
'variantsData' => $variantsData,
]);
}
/**
* One button/swatch group per product option (a product can have several
* — e.g. a custom-photo product with size + style + person-count, each
* combination resolved client-side to one exact ProductVariant, see
* product-form-controller.js) plus the per-variant data the picker
* resolves a selection against.
*
* Reads live Eloquent rather than the Meilisearch-indexed $product array
* the rest of the page uses (same reasoning as checkStock() below): the
* index has no concept of option/value display order (Lunar's
* `position` column) or a stable value id, both of which the picker
* needs — to render values in the merchant's intended order, and to
* match a combination back to one exact variant without relying on
* translated label strings staying unique.
*
* @return array{0: array, 1: array}
*/
private function buildOptionPicker(int $productId): array
{
$variants = ProductVariant::query()
->where('product_id', $productId)
->with(['values.option', 'prices', 'images'])
->get();
$productOptions = $variants
->flatMap(fn (ProductVariant $variant) => $variant->values)
->unique('id')
->groupBy(fn ($value) => $value->option->handle)
->map(function ($values, $handle) {
$sorted = $values->sortBy([['position', 'asc'], ['id', 'asc']]);
return [
'handle' => $handle,
'label' => $sorted->first()->option->translate('name'),
// The "Color" option type is the only one that writes a
// hex code into meta (see boboko/core's ColorOptionType)
// — its presence is how we tell a color option (swatches)
// from any other option (buttons).
'isColor' => $sorted->contains(fn ($v) => !empty($v->meta['hex'] ?? null)),
'values' => $sorted->map(fn ($v) => [
'id' => $v->id,
'label' => $v->translate('name'),
'hex' => $v->meta['hex'] ?? null,
])->values()->all(),
];
})
->values()
->all();
$variantsData = $variants->map(fn (ProductVariant $variant) => [
'id' => $variant->id,
'price' => $variant->prices->first()?->price?->decimal(),
'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
// selections back to this variant — see selectVariant() in
// product-form-controller.js.
'options' => $variant->values->mapWithKeys(fn ($v) => [$v->option->handle => $v->id])->all(),
])->values()->all();
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
* product page's "Add to cart" calls this first and only submits to the
* checkout module's own add-to-cart endpoint once this says `ok`. Reads
* the live Eloquent ProductVariant directly (not the Meilisearch index
* ProductService otherwise reads from, which can lag behind an actual
* sale until the next reindex) via the SAME method Lunar's own
* CartLineStock validator calls, so this can never disagree with what
* the module's own server-side check would decide.
*/
public function checkStock(string $locale, Request $request): JsonResponse
{
$data = $request->validate([
'variant' => ['required', 'integer'],
'quantity' => ['nullable', 'integer', 'min:1'],
]);
$variant = ProductVariant::find($data['variant']);
$quantity = $data['quantity'] ?? 1;
if ($variant === null) {
return response()->json(['ok' => true]);
}
return response()->json([
'ok' => $variant->canBeFulfilledAtQuantity($quantity),
'stock' => $variant->purchasable === 'always' ? null : $variant->getTotalInventory(),
]);
}
/**
* boboko/core's product_reviews table has no moderation/status column, so
* this goes live immediately — no approval queue to land in.
*/
public function storeReview(string $locale, Request $request, Product $product): RedirectResponse
{
$reviewsUrl = route('product.show', [
'locale' => $locale,
'id' => $product->id,
'tab' => 'reviews',
]).'#product-tabs';
$validator = Validator::make($request->all(), [
'rating' => ['required', 'integer', 'between:1,5'],
'content' => ['required', 'string'],
'name' => ['nullable', 'string', 'max:255'],
'email' => ['required', 'email'],
]);
if ($validator->fails()) {
return redirect($reviewsUrl)->withErrors($validator)->withInput();
}
$data = $validator->validated();
// Not $product->reviews()->create(...): that relation only exists via a
// Product::macro() registered in CorePlugin::register(Panel $panel), which
// Filament calls solely when the /boboko admin panel boots — never on a
// plain storefront request, where the macro is simply undefined.
$review = ProductReview::create([
'product_id' => $product->id,
'rating' => $data['rating'],
'body' => $data['content'],
'reviewer_name' => $data['name'] ?? null,
'reviewer_email' => $data['email'],
'reviewed_at' => now(),
'source' => 'storefront',
]);
// ReviewServiceProvider also reindexes on the model's `created` event, but
// queued (SCOUT_QUEUE=true) — it wouldn't land before this redirect's page
// load. Syncing here skips our queue too, but Meilisearch's own write API
// is itself async on top of that (see mergeJustSubmittedReview()), so this
// alone still isn't a guarantee — it's the flash below that actually is.
$product->searchableSync();
return redirect($reviewsUrl)
->with('reviewSubmitted', true)
->with('justSubmittedReview', [
'id' => $review->id,
'product_id' => $review->product_id,
'title' => $review->title,
'body' => $review->body,
'rating' => $review->rating,
'reviewed_at' => $review->reviewed_at?->timestamp,
'reviewer_name' => $review->reviewer_name,
'reply' => null,
'replied_at' => null,
'media' => [],
]);
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Controllers;
use App\Catalog\ProductListing;
use App\Catalog\ProductListingPage;
class SearchController extends Controller
{
public function __construct(private readonly ProductListingPage $listingPage) {}
public function show(string $locale)
{
$query = trim((string) request()->query('q', ''));
if ($query === '') {
return redirect()->route('products');
}
$listing = ProductListing::fromRequest(request());
$data = $this->listingPage->build(
$listing,
fn (array $overrides) => route('search', ['q' => $query] + $overrides),
collectionId: null,
query: $query,
);
return view('search.index', [...$data, 'query' => $query]);
}
}
@@ -0,0 +1,56 @@
<?php
namespace App\Http\Controllers;
use App\Catalog\ProductCard;
use Illuminate\Http\RedirectResponse;
use Illuminate\Support\Collection;
use Illuminate\View\View;
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
{
public function __construct(
private readonly WishlistService $wishlist,
) {}
/**
* The account's wishlist page.
*/
public function index(string $locale, ProductService $products): View
{
return view('account.wishlist', ['products' => $this->products($products)]);
}
/**
* The same list for a guest, from their cookie. Logged-in users are sent
* to the account version.
*/
public function guest(string $locale, ProductService $products): View|RedirectResponse
{
if (auth()->check()) {
return redirect()->route('account.wishlist');
}
return view('wishlist.guest', ['products' => $this->products($products)]);
}
/**
* Product cards for the current wishlist, newest first. Products no longer
* in the search index (deleted, unpublished) are simply skipped.
*/
private function products(ProductService $products): Collection
{
return collect($this->wishlist->ids())
->map(fn (int $id) => $products->getById($id))
->filter()
->map(fn (array $product) => ['id' => $product['id'], ...ProductCard::fromIndexed($product)])
->values();
}
}
+31
View File
@@ -0,0 +1,31 @@
<?php
namespace App\Http\Requests;
use App\Rules\HCaptcha;
use Illuminate\Foundation\Http\FormRequest;
class ContactRequest extends FormRequest
{
public function authorize(): bool
{
return true;
}
public function rules(): array
{
return [
'name' => ['required', 'string', 'max:100'],
'email' => ['required', 'email', 'max:255'],
'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'),
];
}
}
@@ -0,0 +1,57 @@
<?php
namespace App\Listeners;
use Lunar\Models\Order;
use Modules\Core\Checkout\Events\OrderPlaced;
use Modules\Core\Customer\Services\CustomerAccountService;
/**
* When a logged-in shopper places an order and their account has no saved
* address yet, the order's shipping address (and their name, if the profile
* has none) becomes the account's. Never overwrites anything already saved.
*
* Uses the order's own user, not Auth: OrderPlaced can fire from a payment
* webhook, where nobody is logged in. Picked up by listener discovery.
*/
class SaveAddressFromFirstOrder
{
public function __construct(
private readonly CustomerAccountService $account,
) {}
public function handle(OrderPlaced $event): void
{
$order = $event->order;
$user = $order->user;
$shipping = $order->shippingAddress;
if (! $user || ! $shipping || ! $shipping->line_one) {
return;
}
$customer = $this->account->customer($user);
if (! $customer) {
return;
}
if (! $customer->first_name && ! $customer->last_name) {
$this->account->updateProfile($user, [
'first_name' => $shipping->first_name,
'last_name' => $shipping->last_name,
]);
}
if (collect($this->account->addresses($user))->isNotEmpty()) {
return;
}
$this->account->createAddress($user, [
...$shipping->only(['first_name', 'last_name', 'line_one', 'city', 'state', 'postcode', 'country_id', 'contact_phone']),
'contact_email' => $user->email,
'shipping_default' => true,
'billing_default' => true,
]);
}
}
+25
View File
@@ -0,0 +1,25 @@
<?php
namespace App\Mail;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
/**
* Sent to whoever submitted the contact form. Deliberately generic: it never
* repeats what they wrote, so the form can't be used to deliver arbitrary text
* to someone else's inbox.
*/
class ContactConfirmationMail extends Mailable
{
public function envelope(): Envelope
{
return new Envelope(subject: __('storefront.contact.confirmation_subject'));
}
public function content(): Content
{
return new Content(view: 'emails.contact-confirmation');
}
}
+35
View File
@@ -0,0 +1,35 @@
<?php
namespace App\Mail;
use Illuminate\Mail\Mailable;
use Illuminate\Mail\Mailables\Address;
use Illuminate\Mail\Mailables\Content;
use Illuminate\Mail\Mailables\Envelope;
/**
* A contact-form message, sent to Store Details' contact email. Reply-To is the
* sender, so replying from the inbox goes straight to them.
*/
class ContactMessageMail extends Mailable
{
public function __construct(
public readonly string $senderName,
public readonly string $senderEmail,
public readonly string $body,
public readonly string $senderLocale,
) {}
public function envelope(): Envelope
{
return new Envelope(
replyTo: [new Address($this->senderEmail, $this->senderName)],
subject: "Νέο μήνυμα επικοινωνίας από {$this->senderName}",
);
}
public function content(): Content
{
return new Content(view: 'emails.contact-message');
}
}
+17 -1
View File
@@ -2,16 +2,32 @@
namespace App\Models;
use App\Services\Stoic;
use Illuminate\Database\Eloquent\Model;
use JacobJoergensen\LaravelPaper\Attributes\ContentPath;
use JacobJoergensen\LaravelPaper\Attributes\Driver;
use JacobJoergensen\LaravelPaper\Attributes\Timestamps;
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")]
#[ContentPath("resources/stoic/content/pages")]
#[ContentPath("resources/stoic/content/el/pages")]
#[Timestamps]
class StoicPage extends Model
{
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"));
}
}
-4
View File
@@ -18,10 +18,6 @@ class User extends Authenticatable implements LunarUserInterface
/** @use HasFactory<UserFactory> */
use HasFactory, Notifiable;
protected $dispatchesEvents = [
'created' => UserCreated::class,
];
/**
* The attributes that are mass assignable.
*
+51 -5
View File
@@ -4,34 +4,80 @@
use App\Models\Customer;
use App\Models\Staff;
use App\Services\StoicSettings;
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\View;
use Illuminate\Support\ServiceProvider;
use Illuminate\View\View as ViewInstance;
use Lunar\Facades\ModelManifest;
use Lunar\Facades\Telemetry;
use Lunar\Models\CollectionGroup;
use Modules\Core\Catalog\DTOs\CollectionFilters;
use Modules\Core\Catalog\Enums\CollectionSort;
use Modules\Core\Catalog\Services\CollectionService;
use Modules\Core\Store\Services\StoreDetailsService;
use Symfony\Component\Mime\Address;
class AppServiceProvider extends ServiceProvider
{
public function register(): void
{
$this->app->scoped(StoicSettings::class);
}
public function boot(): void
{
Telemetry::optOut();
// header.blade.php's category dropdown — root collections only, resolved
// per-request so the composer runs after `locale` middleware has already
// set App::getLocale(), which CollectionService's name resolution depends on.
// header.blade.php's category dropdown — root collections of the catalog
// group only, so merchandising groups (e.g. "Homepage") stay out of the
// 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->with('categories', app(CollectionService::class)->list(
filters: new CollectionFilters(rootOnly: true),
$groupId = CollectionGroup::where('handle', 'shopify')->value('id');
$view->with('categories', $groupId === null ? [] : app(CollectionService::class)->list(
filters: new CollectionFilters(groupId: $groupId, rootOnly: true),
perPage: 100,
sort: CollectionSort::Position,
)->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')) {
URL::forceScheme('https');
}
+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'));
}
}
}
+37
View File
@@ -4,6 +4,7 @@
use Illuminate\Database\Eloquent\Model;
use Illuminate\Support\Facades\Storage;
use Spatie\YamlFrontMatter\YamlFrontMatter;
use Symfony\Component\Yaml\Yaml;
class Stoic
@@ -29,6 +30,42 @@ public static function presets(): array
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.
public static function image(string $filename, string $preset): string
{
+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() : [];
}
}
+12 -1
View File
@@ -11,7 +11,18 @@
health: '/up',
)
->withMiddleware(function (Middleware $middleware): void {
//
// Laravel's priority list would otherwise run `auth` before core's
// `locale` middleware, so the redirects below would build URLs before
// URL::defaults(['locale' => …]) is set, throwing a missing-parameter error.
$middleware->prependToPriorityList(
before: \Illuminate\Contracts\Auth\Middleware\AuthenticatesRequests::class,
prepend: \Modules\Core\Localization\Middleware\LocaleMiddleware::class,
);
// Both resolve inside the {locale} group, after the `locale` middleware
// has set URL::defaults(['locale' => …]), so route() needs no locale arg.
$middleware->redirectGuestsTo(fn () => route('login'));
$middleware->redirectUsersTo(fn () => route('home'));
})
->withExceptions(function (Exceptions $exceptions): void {
//
Generated
+441 -478
View File
File diff suppressed because it is too large Load Diff
+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,
],
];
+44
View File
@@ -0,0 +1,44 @@
<?php
/*
* Per-site settings for the cart + checkout module (see
* Modules\Core\Providers\CheckoutModuleServiceProvider). Publishable —
* artisan vendor:publish --tag=core-config.
*/
return [
/*
* 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
* login page must send the shopper back there afterwards. null: no login
* offered in checkout at all.
*/
'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,
/*
|--------------------------------------------------------------------------
| 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,
],
],
];
+94 -7
View File
@@ -58,11 +58,23 @@
| make sense for the store you're building.
|
*/
'draft_status' => 'awaiting-payment',
'draft_status' => 'awaiting_payment',
// Two sequences — carrier and store-pickup — see Modules\Core\Order\
// Services\OrderStatusFlow, the single source of truth for which
// transitions are actually offered from a given status. Payment
// timing (prepaid vs. cash-on-delivery) does not affect this
// sequence at all — see Order::paid/paid_at instead, an entirely
// independent field with no status value of its own.
//
// 'favourite' controls whether a status gets its own tab in the order
// list topbar (Lunar\Admin\...\ListOrders::getDefaultTabs()) — set
// only on the main-journey statuses so the topbar isn't cluttered
// with every branch/exception value; every status (favourite or not)
// remains reachable via the table's own status filter/search.
'statuses' => [
'awaiting-payment' => [
'awaiting_payment' => [
'label' => 'Awaiting Payment',
'color' => '#848a8c',
'mailers' => [],
@@ -70,17 +82,25 @@
'favourite' => true,
],
'payment-offline' => [
'label' => 'Payment Offline',
'processing' => [
'label' => 'Processing',
'color' => '#0A81D7',
'mailers' => [],
'notifications' => [],
'favourite' => true,
],
'payment-received' => [
'label' => 'Payment Received',
'color' => '#6a67ce',
'ready_for_dispatch' => [
'label' => 'Ready for Dispatch',
'color' => '#c98a2e',
'mailers' => [],
'notifications' => [],
'favourite' => true,
],
'ready_for_pickup' => [
'label' => 'Ready for Pickup',
'color' => '#c98a2e',
'mailers' => [],
'notifications' => [],
'favourite' => true,
@@ -88,11 +108,78 @@
'dispatched' => [
'label' => 'Dispatched',
'color' => '#0A81D7',
'mailers' => [],
'notifications' => [],
'favourite' => true,
],
'delivery_failed' => [
'label' => 'Delivery Failed',
'color' => '#c0392b',
'mailers' => [],
'notifications' => [],
'favourite' => false,
],
'picked_up' => [
'label' => 'Picked Up',
'color' => '#3f7a5c',
'mailers' => [],
'notifications' => [],
'favourite' => true,
],
// The parcel arriving and the return window opening are the same
// moment — one status value covers both.
'delivered' => [
'label' => 'Delivered',
'color' => '#c98a2e',
'mailers' => [],
'notifications' => [],
'favourite' => true,
],
'completed' => [
'label' => 'Completed',
'color' => '#3f7a5c',
'mailers' => [],
'notifications' => [],
'favourite' => true,
],
'return_requested' => [
'label' => 'Return Requested',
'color' => '#c98a2e',
'mailers' => [],
'notifications' => [],
'favourite' => false,
],
'returned' => [
'label' => 'Returned',
'color' => '#c0392b',
'mailers' => [],
'notifications' => [],
'favourite' => false,
],
'partially_refunded' => [
'label' => 'Partially Refunded',
'color' => '#c98a2e',
'mailers' => [],
'notifications' => [],
'favourite' => false,
],
'refunded' => [
'label' => 'Refunded',
'color' => '#c0392b',
'mailers' => [],
'notifications' => [],
'favourite' => false,
],
],
/*
+1 -1
View File
@@ -46,6 +46,6 @@
| to include in the count below.
|
*/
'order_count_statuses' => ['payment-received'],
'order_count_statuses' => ['processing'],
];
+26 -2
View File
@@ -20,7 +20,17 @@
Lunar\Models\Collection::class,
Lunar\Models\Customer::class,
Lunar\Models\Order::class,
Lunar\Models\Product::class,
// Modules\Core\Catalog\Models\Product, not Lunar\Models\Product —
// both share the same underlying Meilisearch index name, so
// listing the base class here too would make every reindex
// (this default list is always merged in, even when a specific
// model is passed on the CLI — see Lunar\Console\Commands\
// ScoutIndexerCommand::handle()) run the base class's indexing a
// second time right after the subclass's, silently overwriting
// every document with one missing custom_fields/order_count
// (the whole reason Modules\Core\Catalog\Models\Product exists —
// see its own docblock). Caught in practice.
Modules\Core\Catalog\Models\Product::class,
Lunar\Models\ProductOption::class,
/*
@@ -49,8 +59,22 @@
Lunar\Models\Collection::class => Modules\Core\Catalog\Services\CollectionIndexer::class,
Lunar\Models\Customer::class => Lunar\Search\CustomerIndexer::class,
Lunar\Models\Order::class => Lunar\Search\OrderIndexer::class,
// Lunar\Models\Product::class, NOT Modules\Core\Catalog\Models\
// Product::class — Lunar\Base\Traits\Searchable::indexer() (and
// getFilterableAttributes()/getSortableAttributes(), same trait)
// reads `$config[self::class]`, and `self::class` inside a TRAIT
// METHOD is a compile-time literal bound to whichever class first
// `use`s the trait — Lunar\Models\Product, since the subclass
// never re-declares indexer() itself — regardless of which
// instance actually calls the method at runtime. Keying this by
// the subclass here made the lookup miss entirely, silently
// falling back to Lunar\Search\ScoutIndexer's own near-empty
// filterable/sortable field list — confirmed live: it wiped every
// real filterable/sortable attribute the index had (including
// ones that already worked, like collection_ids), not just the
// new order_count one. Caught in practice, reverted.
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
],
];
+22
View File
@@ -35,9 +35,31 @@
],
],
// Bot check on guest forms (login, contact), verified by App\Rules\HCaptcha. For
// local dev use hCaptcha's test keys, the real ones reject localhost:
// sitekey 10000000-ffff-ffff-ffff-000000000001,
// secret 0x0000000000000000000000000000000000000000.
'hcaptcha' => [
'sitekey' => env('HCAPTCHA_SITEKEY'),
'secret' => env('HCAPTCHA_SECRET'),
],
'stoic' => [
'sso_secret' => env('STOIC_SSO_SECRET'),
'host' => env('STOIC_HOST'),
],
// Keys read by lunarphp/stripe + Modules\Core\Payment\Drivers\StripePaymentDriver.
// `key` is the SECRET key (this ecosystem's convention — StripeManager calls
// Stripe::setApiKey(config('services.stripe.key'))); `public_key` is the
// publishable key for Stripe.js; `webhooks.lunar` is the signing secret the
// webhook route verifies against.
'stripe' => [
'key' => env('STRIPE_SECRET'),
'public_key' => env('STRIPE_PUBLIC_KEY'),
'webhooks' => [
'lunar' => env('STRIPE_WEBHOOK_SECRET'),
],
],
];
+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),
];
+4
View File
@@ -10,3 +10,7 @@ services:
scheduler:
volumes:
- ../boboko-core:/var/www/boboko-core
vite:
volumes:
- ../boboko-core:/boboko-core
+2
View File
@@ -47,6 +47,7 @@ services:
queue:
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
entrypoint: ["/entrypoint-worker.sh"]
command: php artisan queue:work --tries=3 --max-jobs=500 --memory=256
restart: unless-stopped
env_file: .env
@@ -68,6 +69,7 @@ services:
scheduler:
image: ${COMPOSE_PROJECT_NAME:-boboko-starter}-app
entrypoint: ["/entrypoint-worker.sh"]
command: php artisan schedule:work
restart: unless-stopped
env_file: .env
+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 "$@"
+10
View File
@@ -79,6 +79,16 @@ echo "[entrypoint] Touched migrated file"
echo "[entrypoint] Trying Lunar install"
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
# 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
# in production too — a deploy that changed an indexer's field list needs this
+8
View File
@@ -9,6 +9,14 @@ content_path: /content
media_path: /media
thumbs_path: /var/www/html/storage/app/public/stoic/
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:
- code: large
mode: resize
+22 -62
View File
@@ -1,15 +1,15 @@
{
"name": "boboko-starter",
"name": "app",
"lockfileVersion": 3,
"requires": true,
"packages": {
"": {
"dependencies": {
"@boboko/core": "git+https://code.radical-elements.com/boboko/core.git#semver:0.x",
"@hotwired/stimulus": "^3.2.2",
"@hotwired/turbo": "^8.0.23",
"@phosphor-icons/web": "^2.1.2",
"axios": "^1.15.2",
"flatpickr": "^4.6.13"
"leaflet": "^1.9.4"
},
"devDependencies": {
"@tailwindcss/vite": "^4.0.0",
@@ -19,11 +19,21 @@
"vite": "^8.0.0"
}
},
"node_modules/@boboko/core": {
"version": "0.26.5",
"resolved": "git+https://code.radical-elements.com/boboko/core.git#5f0dbbb734f10f0957eb53554743bd71d6db22e1",
"dependencies": {
"@hotwired/stimulus": "^3.2.2",
"leaflet": "^1.9.4"
},
"peerDependencies": {
"vite": "^8.0.0"
}
},
"node_modules/@emnapi/core": {
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@emnapi/core/-/core-1.11.1.tgz",
"integrity": "sha512-RSvbQmHzdKzNsLYa/wHrbc3KN4sYLKAdPZxqiM2HATqv/SBk2/ENSHpvXGaLOMcsAyz0poEGqkmmKYG3OWiJEQ==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -35,7 +45,6 @@
"version": "1.11.1",
"resolved": "https://registry.npmjs.org/@emnapi/runtime/-/runtime-1.11.1.tgz",
"integrity": "sha512-vgj7R3y3Wgx24IQaGPA/R6YFXLHVMOZ0uVEyIQPaWs+rd1AzfEMXlAC22FYwO1XkKR6NPsq7mUandH8oIRdZFw==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -46,7 +55,6 @@
"version": "1.2.2",
"resolved": "https://registry.npmjs.org/@emnapi/wasi-threads/-/wasi-threads-1.2.2.tgz",
"integrity": "sha512-c95qOXkHdydNKhscBTebqEC1CVAZpyqOfVfBzQ1qgzyl3gfeldUjIggDbIZgDKsHLgnsM+igH7TJ/eAasaVuMA==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -122,7 +130,6 @@
"version": "1.1.6",
"resolved": "https://registry.npmjs.org/@napi-rs/wasm-runtime/-/wasm-runtime-1.1.6.tgz",
"integrity": "sha512-ZLv/JdUfkvOy9eCnnBaGfiO+XimbjebAeO+MRQqD/B+FR1tnRN0tpKSJHRbE8sFfS6aqsXZ67TQjfwfsxULVbg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -141,18 +148,11 @@
"version": "0.138.0",
"resolved": "https://registry.npmjs.org/@oxc-project/types/-/types-0.138.0.tgz",
"integrity": "sha512-1a7ZKmrRTCoN1XMZ4L0PyyqrMnrNlLyPuOkdSX2MZg7IiIGRUyurNhAm73ptDOraoBcIordsIGKNPKUzy3ZmfA==",
"dev": true,
"license": "MIT",
"funding": {
"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": {
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/@rolldown/binding-android-arm64/-/binding-android-arm64-1.1.4.tgz",
@@ -160,7 +160,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -177,7 +176,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -194,7 +192,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -211,7 +208,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -228,7 +224,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -245,7 +240,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -262,7 +256,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -279,7 +272,6 @@
"cpu": [
"ppc64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -296,7 +288,6 @@
"cpu": [
"s390x"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -313,7 +304,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -330,7 +320,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -347,7 +336,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -364,7 +352,6 @@
"cpu": [
"wasm32"
],
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -383,7 +370,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -400,7 +386,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MIT",
"optional": true,
"os": [
@@ -414,7 +399,6 @@
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/@rolldown/pluginutils/-/pluginutils-1.0.1.tgz",
"integrity": "sha512-2j9bGt5Jh8hj+vPtgzPtl72j0yRxHAyumoo6TNfAjsLB04UtpSvPbPcDcBMxz7n+9CYB0c1GxQFxYRg2jimqGw==",
"dev": true,
"license": "MIT"
},
"node_modules/@tailwindcss/node": {
@@ -693,7 +677,6 @@
"version": "0.10.3",
"resolved": "https://registry.npmjs.org/@tybys/wasm-util/-/wasm-util-0.10.3.tgz",
"integrity": "sha512-F3fo1MYrRJYL3zER0OUOmkutjr1Vp23m7OsSgp7nq4SP6OqX6C/56XFIPAl5bt3zaBRjmW7SGz3u/6LwFpYcOg==",
"dev": true,
"license": "MIT",
"optional": true,
"dependencies": {
@@ -901,7 +884,6 @@
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/detect-libc/-/detect-libc-2.1.2.tgz",
"integrity": "sha512-Btj2BOOO83o3WyH59e8MgXsxEQVcarkUOpEYrubB0urwnN10yQ364rsiByU11nZlqWYZm05i/of7io4mzihBtQ==",
"dev": true,
"license": "Apache-2.0",
"engines": {
"node": ">=8"
@@ -1001,7 +983,6 @@
"version": "6.5.0",
"resolved": "https://registry.npmjs.org/fdir/-/fdir-6.5.0.tgz",
"integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==",
"dev": true,
"license": "MIT",
"engines": {
"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": {
"version": "1.16.0",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.16.0.tgz",
@@ -1061,7 +1036,6 @@
"version": "2.3.3",
"resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.3.tgz",
"integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==",
"dev": true,
"hasInstallScript": true,
"license": "MIT",
"optional": true,
@@ -1223,7 +1197,7 @@
"version": "2.7.0",
"resolved": "https://registry.npmjs.org/jiti/-/jiti-2.7.0.tgz",
"integrity": "sha512-AC/7JofJvZGrrneWNaEnJeOLUx+JlGt7tNa0wZiRPT4MY1wmfKjt2+6O2p2uz2+skll8OZZmJMNqeke7kKbNgQ==",
"dev": true,
"devOptional": true,
"license": "MIT",
"bin": {
"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": {
"version": "1.32.0",
"resolved": "https://registry.npmjs.org/lightningcss/-/lightningcss-1.32.0.tgz",
"integrity": "sha512-NXYBzinNrblfraPGyrbPoD19C1h9lfI/1mzgWYvXUTe414Gz/X1FD2XBZSZM7rRTrMA8JL3OtAaGifrIKhQ5yQ==",
"dev": true,
"license": "MPL-2.0",
"dependencies": {
"detect-libc": "^2.0.3"
@@ -1293,7 +1272,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1314,7 +1292,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1335,7 +1312,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1356,7 +1332,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1377,7 +1352,6 @@
"cpu": [
"arm"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1398,7 +1372,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1419,7 +1392,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1440,7 +1412,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1461,7 +1432,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1482,7 +1452,6 @@
"cpu": [
"arm64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1503,7 +1472,6 @@
"cpu": [
"x64"
],
"dev": true,
"license": "MPL-2.0",
"optional": true,
"os": [
@@ -1567,7 +1535,6 @@
"version": "3.3.15",
"resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.15.tgz",
"integrity": "sha512-y7Wygv/7mEOvxTuEQDB8StXdMRBWf1kR/tlhAzBRUFkB2jfcLOAxO/SHmOO2zgz1pVgK29/kyupn059/bCHdjA==",
"dev": true,
"funding": [
{
"type": "github",
@@ -1586,14 +1553,12 @@
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/picocolors/-/picocolors-1.1.1.tgz",
"integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==",
"dev": true,
"license": "ISC"
},
"node_modules/picomatch": {
"version": "4.0.5",
"resolved": "https://registry.npmjs.org/picomatch/-/picomatch-4.0.5.tgz",
"integrity": "sha512-RvwwcruNjI1ncT5xRakeyS9Lf8lcItv34KD+aif+VH9kduAyfYBipGh12274xtenIPZ119/R9BdTBa8gAwSh0A==",
"dev": true,
"license": "MIT",
"engines": {
"node": ">=12"
@@ -1606,7 +1571,6 @@
"version": "8.5.16",
"resolved": "https://registry.npmjs.org/postcss/-/postcss-8.5.16.tgz",
"integrity": "sha512-vuwillviilfKZsg0VGj5R/YwwcHx4SLsIOI/7K6mQkWx+l5cUHTjj5g0AasTBcyXsbfTgrwsUNmVUb5xVwyPwg==",
"dev": true,
"funding": [
{
"type": "opencollective",
@@ -1654,7 +1618,6 @@
"version": "1.1.4",
"resolved": "https://registry.npmjs.org/rolldown/-/rolldown-1.1.4.tgz",
"integrity": "sha512-IjZYiLxZwpnhwhdBH2ugdTGVSdhCQUmLxLoqyjiL0JxYjyRst+5a0P3xfrTxJ5F638j4Mvvw5FAX5XE6eHpXbA==",
"dev": true,
"license": "MIT",
"dependencies": {
"@oxc-project/types": "=0.138.0",
@@ -1711,7 +1674,6 @@
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/source-map-js/-/source-map-js-1.2.1.tgz",
"integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==",
"dev": true,
"license": "BSD-3-Clause",
"engines": {
"node": ">=0.10.0"
@@ -1786,7 +1748,6 @@
"version": "0.2.17",
"resolved": "https://registry.npmjs.org/tinyglobby/-/tinyglobby-0.2.17.tgz",
"integrity": "sha512-wXR/dYpcqKmfWpEdZjiKJOwCNFndD0DMnrW/cYjVGttEkBfVgcLFHoNrlj47mjOVic9yyNu65alsgF4NQyTa2g==",
"dev": true,
"license": "MIT",
"dependencies": {
"fdir": "^6.5.0",
@@ -1813,14 +1774,13 @@
"version": "2.8.1",
"resolved": "https://registry.npmjs.org/tslib/-/tslib-2.8.1.tgz",
"integrity": "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w==",
"dev": true,
"devOptional": true,
"license": "0BSD"
},
"node_modules/vite": {
"version": "8.1.3",
"resolved": "https://registry.npmjs.org/vite/-/vite-8.1.3.tgz",
"integrity": "sha512-Ds+gBRbj0lwRO2Y5hwnUBdxSwlAve9LeRyU4sNnAr0ewW0gWF0n5bgXgUzbgZ49MV9BVUAQUFYVcDUcilUExMA==",
"dev": true,
"license": "MIT",
"dependencies": {
"lightningcss": "^1.32.0",
+7 -1
View File
@@ -14,8 +14,14 @@
"vite": "^8.0.0"
},
"dependencies": {
"@boboko/core": "git+https://code.radical-elements.com/boboko/core.git#semver:0.x",
"@hotwired/stimulus": "^3.2.2",
"@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"
}
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File
Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 0 B

After

Width:  |  Height:  |  Size: 15 KiB

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 116 KiB

View File
+21
View File
@@ -0,0 +1,21 @@
{
"name": "3dealer",
"short_name": "3dealer",
"icons": [
{
"src": "/web-app-manifest-192x192.png",
"sizes": "192x192",
"type": "image/png",
"purpose": "maskable"
},
{
"src": "/web-app-manifest-512x512.png",
"sizes": "512x512",
"type": "image/png",
"purpose": "maskable"
}
],
"theme_color": "#ffffff",
"background_color": "#ffffff",
"display": "standalone"
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

+29 -1
View File
@@ -1,6 +1,12 @@
@import "tailwindcss";
@import "./fonts.css";
@import "./dropdown.css";
/* Note for anyone theming the checkout module (resources/css/checkout.css,
.bbk-* classes): it's deliberately plain, unlayered CSS, not inside any
@layer — so override it with plain rules here too, not from inside
@layer components/utilities, which would lose to it. See checkout.css's
file-level comment for why. */
@source '../../vendor/laravel/framework/src/Illuminate/Pagination/resources/views/*.blade.php';
@source '../../storage/framework/views/*.php';
@source '../**/*.blade.php';
@@ -213,6 +219,28 @@ @layer components {
}
}
/* ── Search overlay (popover) — opacity fade over the header ──── */
#search-overlay {
/* Fallback height until the `nav-search` controller measures the real
header on open; the header has no fixed height below `lg`. */
--search-overlay-h: 6.5rem;
opacity: 0;
transition:
opacity 0.2s ease,
display 0.2s allow-discrete,
overlay 0.2s allow-discrete;
}
#search-overlay:popover-open {
opacity: 1;
}
@starting-style {
#search-overlay:popover-open {
opacity: 0;
}
}
/* ── Shared underline-slide animation ────────────────────────── */
.underline-slide {
background-image: linear-gradient(currentColor, currentColor);
@@ -303,7 +331,7 @@ @layer components {
transition: transform 0.35s cubic-bezier(0.2, 0.78, 0.12, 0.86);
}
.btn-primary:hover::after {
.btn-primary:not(:disabled):hover::after {
transform: translate(0, 0);
}
+7
View File
@@ -10,8 +10,15 @@ window.Turbo.session.drive = false;
import { Application } from "@hotwired/stimulus";
import { registerControllers } from "./stimulus/index";
import { registerCheckout, registerWishlist } from "@boboko/core";
const application = Application.start();
application.debug = false;
registerControllers(application);
// Portable cart + checkout + wishlist modules, installed as a real npm
// dependency (see package.json). Each owns its own Stimulus controllers;
// these are the only wiring lines they need here.
registerCheckout(application);
registerWishlist(application);
@@ -0,0 +1,31 @@
import { Controller } from '@hotwired/stimulus'
// 3dealer-side glue for the checkout module. The module owns the cart and emits
// `bbk-cart:updated` {count, total} on window after every change; this reflects
// the line count on the header bag icon. How (or whether) that count is shown
// is the host's call — hence this lives here, not in the module.
export default class extends Controller {
static targets = ['badge']
connect() {
this.onUpdate = (event) => this.render(event.detail?.count ?? 0)
window.addEventListener('bbk-cart:updated', this.onUpdate)
}
disconnect() {
window.removeEventListener('bbk-cart:updated', this.onUpdate)
}
// Header cart icon click — there's no separate cart page, the drawer IS
// the cart. `bbk-cart:open` is the module's own event, already listened
// for by bbk-cart-controller.
open() {
window.dispatchEvent(new CustomEvent('bbk-cart:open'))
}
render(count) {
if (!this.hasBadgeTarget) return
this.badgeTarget.textContent = String(count)
this.badgeTarget.hidden = count < 1
}
}
@@ -0,0 +1,108 @@
import { Controller } from '@hotwired/stimulus'
// One product custom field of type `file` (see x-product-custom-fields).
// Uploads the photo to the storefront's own endpoint (CustomFieldUploadController)
// as soon as it's picked, then writes the returned File row's id (boboko-core's
// Modules\Core\File\Models\File) into the hidden input the add-to-cart form
// actually submits — the checkout module never receives the file itself.
//
// While uploading, the file input is marked invalid via setCustomValidity(),
// so the browser's own form validation blocks add-to-cart until the id is in
// place. A failed upload clears the input, so `required` blocks it too.
export default class extends Controller {
static targets = ['file', 'reference', 'preview', 'error']
static values = {
url: String,
label: String,
uploadingMessage: String,
failedMessage: String,
}
disconnect() {
this.abortController?.abort()
this.revokePreview()
}
async upload() {
this.reset()
const file = this.fileTarget.files[0]
if (!file) return
const abortController = new AbortController()
this.abortController = abortController
this.fileTarget.setCustomValidity(this.uploadingMessageValue)
this.fileTarget.setAttribute('aria-busy', 'true')
const body = new FormData()
body.append('file', file)
body.append('label', this.labelValue)
try {
const response = await fetch(this.urlValue, {
method: 'POST',
headers: {
'X-CSRF-TOKEN': document.querySelector('meta[name="csrf-token"]')?.content ?? '',
'X-Requested-With': 'XMLHttpRequest',
Accept: 'application/json',
},
body,
signal: abortController.signal,
})
const data = await response.json().catch(() => null)
if (!response.ok || !data?.file_id) {
this.fail(data?.error)
return
}
this.referenceTarget.value = data.file_id
this.showPreview(file)
} catch (error) {
// A newer pick superseded this upload — reset() already handled it.
if (error.name === 'AbortError') return
this.fail()
} finally {
if (!abortController.signal.aborted) this.markIdle()
}
}
reset() {
this.abortController?.abort()
this.referenceTarget.value = ''
this.errorTarget.hidden = true
this.markIdle()
this.revokePreview()
}
fail(message) {
this.fileTarget.value = ''
this.errorTarget.textContent = message || this.failedMessageValue
this.errorTarget.hidden = false
}
markIdle() {
this.fileTarget.setCustomValidity('')
this.fileTarget.removeAttribute('aria-busy')
}
showPreview(file) {
this.previewUrl = URL.createObjectURL(file)
this.previewTarget.src = this.previewUrl
this.previewTarget.hidden = false
}
// Formats the browser can't render (HEIC outside Safari) — the file
// input's own filename is enough there.
hidePreview() {
this.previewTarget.hidden = true
}
revokePreview() {
if (this.previewUrl) URL.revokeObjectURL(this.previewUrl)
this.previewUrl = null
this.previewTarget.removeAttribute('src')
this.previewTarget.hidden = true
}
}
@@ -0,0 +1,24 @@
import { Controller } from '@hotwired/stimulus'
// Turbo doesn't scroll for <turbo-frame> navigations, so after the frame swaps
// its contents (a sort, filter, or pagination link) this brings the top of the
// frame back into view — otherwise clicking pagination at the bottom of the
// list leaves you stranded down there. The frame's own scroll-margin-top keeps
// it clear of the sticky header.
//
// `turbo:frame-render` fires only on a content swap, not on the initial page
// render, and the frame element itself persists across swaps — so the listener
// is bound once in connect().
export default class extends Controller {
connect() {
this.element.addEventListener('turbo:frame-render', this.#toTop)
}
disconnect() {
this.element.removeEventListener('turbo:frame-render', this.#toTop)
}
#toTop = () => {
this.element.scrollIntoView({ block: 'start', behavior: 'smooth' })
}
}
+10
View File
@@ -6,25 +6,35 @@
import AppearController from './appear-controller'
import AutoSubmitController from './auto-submit-controller'
import BackToTopController from './back-to-top-controller'
import CartCountController from './cart-count-controller'
import CarouselController from './carousel-controller'
import CustomFieldUploadController from './custom-field-upload-controller'
import DropdownController from './dropdown-controller'
import FrameScrollController from './frame-scroll-controller'
import NavSearchController from './nav-search-controller'
import ProductFormController from './product-form-controller'
import ProductGalleryController from './product-gallery-controller'
import QuantityController from './quantity-controller'
import RangeSliderController from './range-slider-controller'
import StarRatingController from './star-rating-controller'
import TabLinkController from './tab-link-controller'
import TabsController from './tabs-controller'
export function registerControllers(application) {
application.register('appear', AppearController)
application.register('auto-submit', AutoSubmitController)
application.register('back-to-top', BackToTopController)
application.register('cart-count', CartCountController)
application.register('carousel', CarouselController)
application.register('custom-field-upload', CustomFieldUploadController)
application.register('dropdown', DropdownController)
application.register('frame-scroll', FrameScrollController)
application.register('nav-search', NavSearchController)
application.register('product-form', ProductFormController)
application.register('product-gallery', ProductGalleryController)
application.register('quantity', QuantityController)
application.register('range-slider', RangeSliderController)
application.register('star-rating', StarRatingController)
application.register('tab-link', TabLinkController)
application.register('tabs', TabsController)
}
@@ -0,0 +1,28 @@
import { Controller } from '@hotwired/stimulus'
// The search overlay is a [popover] that must sit exactly over the header. The
// header has no fixed height below `lg`, so on open we copy its current height
// onto --search-overlay-h and move focus into the field. Escape / click-away
// close come from the Popover API; the fade is CSS (#search-overlay).
export default class extends Controller {
static targets = ['input']
connect() {
this.element.addEventListener('toggle', this.#onToggle)
}
disconnect() {
this.element.removeEventListener('toggle', this.#onToggle)
}
#onToggle = (event) => {
if (event.newState !== 'open') return
const header = this.element.closest('header')
if (header) {
this.element.style.setProperty('--search-overlay-h', `${header.offsetHeight}px`)
}
requestAnimationFrame(() => this.inputTarget.focus())
}
}
+143 -14
View File
@@ -2,25 +2,138 @@ import { Controller } from '@hotwired/stimulus'
import { formatPrice } from '../utils/format-price'
export default class extends Controller {
static targets = ['price', 'image', 'swatch', 'colorName']
static values = { variants: Array, selected: Number }
static targets = ['price', 'image', 'swatch', 'colorName', 'stockError', 'submit']
static values = {
variants: Array,
selected: Number,
stockCheckUrl: String,
// Two pre-rendered translated templates (see product/show.blade.php)
// rather than one — this controller doesn't reimplement Laravel's
// pluralization rules, it just picks whichever of these two the
// count actually needs and fills in the number.
stockErrorOne: String,
stockErrorMany: String,
}
connect() {
const params = new URLSearchParams(window.location.search)
const urlId = parseInt(params.get('variant'))
const defaultId = this.variantsValue[0]?.id
const params = new URLSearchParams(window.location.search)
const urlId = parseInt(params.get('variant'))
const urlVariant = this.variantsValue.find(v => v.id === urlId)
const initial = urlVariant ?? this.variantsValue[0]
this.selectedValue = urlId && this.variantsValue.find(v => v.id === urlId)
? urlId
: defaultId
// A product can have several independent options (e.g. size + style
// + person-count) — this tracks the currently-picked value id per
// option handle, and selectVariant() below resolves the full
// combination back to one exact variant on every change.
this.selections = { ...initial?.options }
this.selectedValue = initial?.id
// Capture phase, on this controller's own root element (an ancestor
// of the checkout module's add-to-cart <form>) — runs BEFORE that
// form's own bubble-phase submit handler (bbk-add-to-cart#add), so a
// failed check can stop it from ever reaching the module at all. The
// module itself is never touched or modified for this: it keeps
// validating server-side regardless, this is purely an up-front,
// storefront-owned check (see [[project_checkout_module]] for why
// that split matters — stock UX is a catalog concern, not something
// the portable checkout module should own) — and a REAL, live check
// against the backend (ProductController::checkStock(), reading the
// Eloquent model directly), not page-load data that can go stale.
this.onSubmitCapture = this.checkStock.bind(this)
this.element.addEventListener('submit', this.onSubmitCapture, true)
}
disconnect() {
this.element.removeEventListener('submit', this.onSubmitCapture, true)
}
checkStock(event) {
const form = event.target
if (!form.matches('.bbk-add-to-cart')) return
// The re-submit this itself triggers below, once the backend has
// confirmed the quantity is fine — let that one through to the
// module's own submit handler instead of checking a second time.
if (form.dataset.bbkStockChecked) {
delete form.dataset.bbkStockChecked
return
}
event.preventDefault()
event.stopPropagation()
this.verifyStock(form)
}
async verifyStock(form) {
this.clearStockError()
const submit = form.querySelector('[type="submit"]')
if (submit) submit.disabled = true
const purchasableId = form.querySelector('[data-bbk-purchasable-input]')?.value
const quantity = form.querySelector('[name="quantity"]')?.value || '1'
try {
const url = new URL(this.stockCheckUrlValue, window.location.origin)
url.searchParams.set('variant', purchasableId)
url.searchParams.set('quantity', quantity)
const response = await fetch(url, { headers: { Accept: 'application/json' } })
const data = await response.json()
if (!data.ok) {
this.showStockError(data.stock)
return
}
} catch {
// Network hiccup — fall through and let the checkout module's
// own server-side check have the final word rather than
// silently blocking the shopper here.
} finally {
if (submit) submit.disabled = !this.selectedVariant?.inStock
}
form.dataset.bbkStockChecked = 'true'
form.requestSubmit()
}
showStockError(available) {
if (!this.hasStockErrorTarget) return
this.stockErrorTarget.textContent = available === 1
? this.stockErrorOneValue
: this.stockErrorManyValue.replace(':count', String(available))
this.stockErrorTarget.hidden = false
}
clearStockError() {
if (!this.hasStockErrorTarget) return
this.stockErrorTarget.hidden = true
}
get selectedVariant() {
return this.variantsValue.find(v => v.id === this.selectedValue)
}
selectVariant(event) {
const id = parseInt(event.currentTarget.dataset.variantId)
this.selectedValue = id
const option = event.currentTarget.dataset.option
const valueId = parseInt(event.currentTarget.dataset.valueId)
this.selections = { ...this.selections, [option]: valueId }
const match = this.variantsValue.find(variant =>
Object.keys(this.selections).every(key => variant.options?.[key] === this.selections[key])
)
// No variant exists for this combination (e.g. an option value that
// isn't offered together with another currently-selected value) —
// leave the previous selection in place rather than pointing the
// add-to-cart form at nothing.
if (!match) return
this.selectedValue = match.id
const url = new URL(window.location)
url.searchParams.set('variant', id)
url.searchParams.set('variant', match.id)
window.history.pushState({}, '', url)
}
@@ -30,6 +143,8 @@ export default class extends Controller {
const variant = this.variantsValue.find(v => v.id === id)
if (!variant) return
this.clearStockError()
if (this.hasPriceTarget && variant.price !== null) {
this.priceTarget.textContent = formatPrice(variant.price)
}
@@ -38,13 +153,27 @@ export default class extends Controller {
this.imageTarget.src = variant.image
}
// Keep the checkout module's add-to-cart form pointed at the chosen
// variant. [data-bbk-purchasable-input] is that module's documented
// hook (see resources/views/checkout/components/add-to-cart.blade.php);
// this is the one place the two touch.
const purchasableInput = this.element.querySelector('[data-bbk-purchasable-input]')
if (purchasableInput) purchasableInput.value = id
// Out-of-stock variant (as of page load) can't be added at all.
if (this.hasSubmitTarget) this.submitTarget.disabled = !variant.inStock
this.swatchTargets.forEach(swatch => {
const isSelected = parseInt(swatch.dataset.variantId) === id
const isSelected = this.selections[swatch.dataset.option] === parseInt(swatch.dataset.valueId)
swatch.classList.toggle('is-selected', isSelected)
swatch.setAttribute('aria-pressed', String(isSelected))
if (isSelected && this.hasColorNameTarget) {
this.colorNameTarget.textContent = swatch.getAttribute('aria-label')
if (isSelected) {
// Each color-option group has its own colorName echo (see
// x-ui.color-swatch) — matched by option handle so a swatch
// in one group never overwrites another group's label.
const colorName = this.colorNameTargets.find(target => target.dataset.option === swatch.dataset.option)
if (colorName) colorName.textContent = swatch.getAttribute('aria-label')
}
})
}
@@ -1,9 +1,25 @@
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
static targets = ['star', 'input']
static targets = ['star', 'input', 'error']
static values = { rating: { type: Number, default: 0 } }
connect() {
this.#fill(this.ratingValue)
}
// Bound to the form's submit event (this controller sits on the <form>
// itself, not just the star widget) — a plain `required` on the hidden
// rating input would never surface: browsers exclude type="hidden" from
// constraint validation entirely, so there'd be nothing to see or hear.
validate(event) {
if (this.ratingValue < 1) {
event.preventDefault()
this.errorTarget.hidden = false
this.starTargets[0]?.focus()
}
}
hover(event) {
this.#fill(parseInt(event.currentTarget.dataset.value))
}
@@ -16,6 +32,7 @@ export default class extends Controller {
const val = parseInt(event.currentTarget.dataset.value)
this.ratingValue = val
this.inputTarget.value = val
this.errorTarget.hidden = true
this.starTargets.forEach(star => {
star.setAttribute('aria-pressed', String(parseInt(star.dataset.value) === val))
@@ -0,0 +1,15 @@
import { Controller } from '@hotwired/stimulus'
// Jumps to a tab panel from an element outside the tabs' own markup — the
// review count and the "read more" link both sit elsewhere in the DOM, too
// far apart from the tabs for a plain data-action, hence the outlet.
export default class extends Controller {
static outlets = ['tabs']
static values = { panel: String }
activate(event) {
event?.preventDefault()
this.tabsOutlet.activate(this.panelValue)
this.tabsOutlet.element.scrollIntoView({ block: 'start', behavior: 'smooth' })
}
}
+2 -2
View File
@@ -4,10 +4,10 @@ export default class extends Controller {
static targets = ['button', 'panel']
show(event) {
this.#activate(event.currentTarget.dataset.panel)
this.activate(event.currentTarget.dataset.panel)
}
#activate(panelId) {
activate(panelId) {
this.buttonTargets.forEach(btn => {
const active = btn.dataset.panel === panelId
btn.classList.toggle('is-active', active)
@@ -0,0 +1,13 @@
---
name: "Επικοινωνία"
slug: "contact"
meta_title: "Επικοινωνία"
meta_description: "Επικοινώνησε μαζί μας για οποιαδήποτε απορία ή ιδέα έχεις και θα σου απαντήσουμε το συντομότερο δυνατό."
og_image: ""
heading_first: "Επικοινώνησε"
heading_second: "μαζί μας"
heading_highlight: "άμεσα"
intro: "Έχεις απορία, ιδέα ή θες να μας πεις κάτι; Γράψε μας το μήνυμά σου και θα σου απαντήσουμε το συντομότερο δυνατό."
---
@@ -18,12 +18,12 @@ ## 1. Υπεύθυνος επεξεργασίας
Υπεύθυνος επεξεργασίας των προσωπικών δεδομένων που συλλέγονται μέσω του ηλεκτρονικού καταστήματος είναι:
**3DEALER**
**{store_legal_name}**
Πάρου 31, Κυψέλη, ΤΚ 11255, Αθήνα
ΑΦΜ: @TODO
ΓΕΜΗ: @TODO
Email: [print@3dealer.gr](mailto:print@3dealer.gr)
Τηλέφωνο: 6976 443140
ΑΦΜ: {store_tax_identifier}
ΓΕΜΗ: {store_registration_number}
Email: [{store_contact_email}](mailto:{store_contact_email})
Τηλέφωνο: {store_phone}
Η 3DEALER καθορίζει τους σκοπούς και τα μέσα επεξεργασίας των προσωπικών δεδομένων των πελατών και χρηστών του ηλεκτρονικού καταστήματος.
@@ -81,7 +81,7 @@ ## 6. Newsletter και εμπορική επικοινωνία
Η εγγραφή στο newsletter πραγματοποιείται με τη συγκατάθεσή σας.
Μπορείτε να ανακαλέσετε τη συγκατάθεσή σας οποιαδήποτε στιγμή, χρησιμοποιώντας τον σύνδεσμο απεγγραφής που περιλαμβάνεται στα emails ή επικοινωνώντας μαζί μας στο [print@3dealer.gr](mailto:print@3dealer.gr).
Μπορείτε να ανακαλέσετε τη συγκατάθεσή σας οποιαδήποτε στιγμή, χρησιμοποιώντας τον σύνδεσμο απεγγραφής που περιλαμβάνεται στα emails ή επικοινωνώντας μαζί μας στο [{store_contact_email}](mailto:{store_contact_email}).
Η ανάκληση της συγκατάθεσης δεν επηρεάζει τη νομιμότητα της επεξεργασίας που πραγματοποιήθηκε πριν από αυτήν.
@@ -186,8 +186,8 @@ ## 16. Τα δικαιώματά σας
Για την άσκηση των δικαιωμάτων σας μπορείτε να επικοινωνήσετε μαζί μας:
**Email:** [print@3dealer.gr](mailto:print@3dealer.gr)
**Τηλέφωνο:** 6976 443140
**Email:** [{store_contact_email}](mailto:{store_contact_email})
**Τηλέφωνο:** {store_phone}
Θα απαντήσουμε στο αίτημά σας χωρίς αδικαιολόγητη καθυστέρηση και, κατά κανόνα, εντός ενός (1) μήνα από την παραλαβή του.
@@ -45,7 +45,7 @@ ## 3. Χρόνος παράδοσης
Η 3DEALER δεν ευθύνεται για καθυστερήσεις που οφείλονται αποκλειστικά στην εταιρεία μεταφοράς, σε ακραία καιρικά φαινόμενα, απεργίες, προβλήματα στο δίκτυο μεταφορών ή άλλες περιστάσεις που βρίσκονται εκτός του εύλογου ελέγχου της.
Σε περίπτωση καθυστέρησης, μπορείτε να επικοινωνήσετε μαζί μας στο [print@3dealer.gr](mailto:print@3dealer.gr).
Σε περίπτωση καθυστέρησης, μπορείτε να επικοινωνήσετε μαζί μας στο [{store_contact_email}](mailto:{store_contact_email}).
## 4. Παραλαβή παραγγελίας
@@ -55,7 +55,7 @@ ## 4. Παραλαβή παραγγελίας
## 5. Προϊόν που παραδόθηκε κατεστραμμένο
Σε περίπτωση που το προϊόν παραδοθεί εμφανώς κατεστραμμένο, παρακαλούμε να επικοινωνήσετε μαζί μας το συντομότερο δυνατό στο [print@3dealer.gr](mailto:print@3dealer.gr) και να μας αποστείλετε φωτογραφίες του προϊόντος και της συσκευασίας.
Σε περίπτωση που το προϊόν παραδοθεί εμφανώς κατεστραμμένο, παρακαλούμε να επικοινωνήσετε μαζί μας το συντομότερο δυνατό στο [{store_contact_email}](mailto:{store_contact_email}) και να μας αποστείλετε φωτογραφίες του προϊόντος και της συσκευασίας.
Η 3DEALER θα εξετάσει το περιστατικό και, εφόσον διαπιστωθεί ζημιά που προέκυψε κατά τη μεταφορά ή άλλη έλλειψη συμμόρφωσης, θα προχωρήσει στην κατάλληλη λύση σύμφωνα με την ισχύουσα νομοθεσία.
@@ -63,7 +63,7 @@ ## 6. Δικαίωμα υπαναχώρησης
Για τις αγορές που εμπίπτουν στο πεδίο εφαρμογής του δικαιώματος υπαναχώρησης, ο καταναλωτής μπορεί να υπαναχωρήσει από τη σύμβαση εντός δεκατεσσάρων (14) ημερολογιακών ημερών από την ημέρα παραλαβής του προϊόντος.
Για την άσκηση του δικαιώματος υπαναχώρησης, ο πελάτης πρέπει να ενημερώσει την 3DEALER με σαφή δήλωση στο [print@3dealer.gr](mailto:print@3dealer.gr).
Για την άσκηση του δικαιώματος υπαναχώρησης, ο πελάτης πρέπει να ενημερώσει την 3DEALER με σαφή δήλωση στο [{store_contact_email}](mailto:{store_contact_email}).
Το προϊόν πρέπει να επιστραφεί χωρίς αδικαιολόγητη καθυστέρηση και, σε κάθε περίπτωση, εντός δεκατεσσάρων (14) ημερών από την ημέρα κατά την οποία ο πελάτης ενημέρωσε την 3DEALER για την απόφασή του να υπαναχωρήσει.
@@ -101,4 +101,4 @@ ## 10. Ελαττωματικά ή μη συμμορφούμενα προϊόν
Η ύπαρξη μικρών αισθητικών χαρακτηριστικών που είναι φυσιολογικά για την τρισδιάστατη εκτύπωση, όπως γραμμές στρώσεων ή μικρές διαφοροποιήσεις, δεν αποτελεί από μόνη της ελάττωμα.
Για οποιοδήποτε πρόβλημα με προϊόν, επικοινωνήστε μαζί μας στο [print@3dealer.gr](mailto:print@3dealer.gr), αναφέροντας τον αριθμό παραγγελίας και, όπου είναι δυνατόν, επισυνάπτοντας φωτογραφίες.
Για οποιοδήποτε πρόβλημα με προϊόν, επικοινωνήστε μαζί μας στο [{store_contact_email}](mailto:{store_contact_email}), αναφέροντας τον αριθμό παραγγελίας και, όπου είναι δυνατόν, επισυνάπτοντας φωτογραφίες.
@@ -1,25 +1,23 @@
---
name: "Όροι & Προϋποθέσεις"
name: "Όροι & Προϋποθέσεις Terms"
slug: "terms-and-conditions"
meta_title: ""
meta_description: ""
og_image: ""
noindex: true
---
## 1. Γενικά
Το ηλεκτρονικό κατάστημα 3DEALER (εφεξής «το Κατάστημα» ή «3DEALER») λειτουργεί από την επιχείρηση 3DEALER, με έδρα στην Πάρου 31, Κυψέλη, ΤΚ 11255, Αθήνα.
Το ηλεκτρονικό κατάστημα 3DEALER (εφεξής «το Κατάστημα» ή «3DEALER») λειτουργεί από την επιχείρηση {store_legal_name}, με έδρα στην Πάρου 31, Κυψέλη, ΤΚ 11255, Αθήνα.
**ΑΦΜ:** @TODO
**ΓΕΜΗ:** @TODO
**ΑΦΜ:** {store_tax_identifier}\
**ΓΕΜΗ:** {store_registration_number}
Για οποιαδήποτε πληροφορία ή επικοινωνία σχετικά με παραγγελίες, προϊόντα ή τη λειτουργία του Καταστήματος, μπορείτε να επικοινωνείτε μαζί μας:
**Email:** [print@3dealer.gr](mailto:print@3dealer.gr)
**Τηλέφωνο:** 6976 443140
**Email:** [{store_contact_email}](mailto:{store_contact_email})\
**Τηλέφωνο:** {store_phone}
Η χρήση του Καταστήματος και η πραγματοποίηση αγορών μέσω αυτού προϋποθέτουν την αποδοχή των παρόντων Όρων & Προϋποθέσεων.
+7
View File
@@ -0,0 +1,7 @@
---
meta_description: ""
og_image: ""
facebook_url: "https://www.facebook.com/3Dealer.gr/"
instagram_url: "https://www.instagram.com/3dealer.gr/"
tiktok_url: "https://www.tiktok.com/@3dealer.gr"
---
@@ -0,0 +1,9 @@
---
name: "Contact"
meta_title: "Contact"
meta_description: "Get in touch with any question or idea you have and we'll get back to you as soon as we can."
heading_first: "Contact"
heading_second: "us"
heading_highlight: "today"
intro: "Got a question, an idea or something to tell us? Send us your message and we'll get back to you as soon as we can."
---
@@ -0,0 +1,132 @@
---
name: "Cookie Policy"
meta_title: ""
meta_description: ""
---
This Cookie Policy explains how 3DEALER uses cookies and similar technologies when you visit the online store.
## 1. What cookies are
Cookies are small text files stored on your device when you visit a website. They are used to make the website work properly, store preferences, collect statistics and, where permitted, show or measure advertising.
Besides cookies, we may also use similar technologies, such as pixels and tags.
## 2. Which cookies we use
3DEALER uses different categories of cookies, depending on their purpose.
### Essential cookies
Essential cookies are those required for the online store to work correctly and securely.
They can be used, among other things, for:
* running the shopping cart,
* keeping your session,
* signing in to your account,
* completing checkout,
* keeping the website secure,
* storing your cookie choices.
These cookies cannot be turned off through the consent tool, because without them some basic functions of the online store would not be available.
### Functionality cookies
Functionality cookies are used to store choices and preferences that improve your experience of the online store.
**@TODO: List the specific functionality cookies used by Boboko/3DEALER.**
### Analytics cookies
Analytics cookies are used to understand how visitors use the online store.
3DEALER uses services such as **Google Analytics** and may use **Google Tag Manager** to manage the related tags.
The information collected may include details such as:
* which pages you visit,
* how long you stay on the website,
* which page you came from,
* the device and browser you use,
* general information about how you interact with the website.
These cookies are only activated in line with your consent choices, where required by applicable law.
### Advertising and marketing cookies
3DEALER uses advertising measurement and marketing technologies, such as:
* **Meta Pixel**
* **TikTok Pixel**
These technologies can be used to measure how effective advertising is, to understand interactions with ads and, where supported and permitted, to show more relevant ads.
The related cookies and pixels are only activated in line with your consent choices, where required.
**@TODO: Confirm the exact Meta/TikTok cookies and events used in production.**
## 3. Cookie table
The table below should be updated based on the cookies actually used in the production environment.
| Cookie / Technology | Provider | Category | Purpose | Duration |
| ------------------- | ---------------- | --------- | ------------------------------------------- | -------- |
| @TODO | Boboko / 3DEALER | Essential | Store operation | @TODO |
| @TODO | Boboko / 3DEALER | Essential | Cart / checkout | @TODO |
| @TODO | Google | Analytics | Usage statistics | @TODO |
| @TODO | Meta | Marketing | Advertising measurement | @TODO |
| @TODO | TikTok | Marketing | Advertising measurement | @TODO |
| @TODO | hCaptcha | Security | Protection against automated/malicious use | @TODO |
**@TODO: The table must be completed after checking the production site, ideally with a cookie scan.**
## 4. Consent to the use of cookies
On your first visit to the online store, a cookie consent tool is shown, where you can choose which categories of non-essential cookies you allow.
You can:
* accept all cookies,
* reject non-essential cookies,
* choose specific categories of cookies.
Essential cookies stay active, as they are needed for the online store to work.
Your choice is saved and applied on your future visits.
## 5. Withdrawing or changing your consent
You can change or withdraw your consent to the use of non-essential cookies at any time.
**@TODO: Add how Boboko's cookie preference centre is reopened, e.g. through a "Cookie settings" link in the footer.**
Withdrawing consent does not affect the lawfulness of processing carried out before the withdrawal.
## 6. Third-party cookies
Some of the services we use are provided by third parties, such as Google, Meta, TikTok and hCaptcha.
These third-party providers may process information collected through cookies or similar technologies in accordance with their own policies and terms.
Using third-party services may also involve transferring data outside the European Economic Area. Where required, the safeguards provided by law for such transfers are applied.
## 7. Cookies and personal data
Some cookies or similar technologies may lead to the processing of information that counts as personal data.
For more information on how 3DEALER collects and processes personal data, see the **Privacy Policy**.
## 8. Browser settings
You can also limit or delete cookies through your browser settings.
However, turning off some cookies may affect how the online store works or prevent some services from working properly.
## 9. Changes to this Cookie Policy
This Cookie Policy may be changed when the technologies we use, the services of the online store or the relevant legislation change.
The latest version will always be available on the 3DEALER website.
**Last updated:** @TODO
+7
View File
@@ -0,0 +1,7 @@
---
name: "Home"
meta_title: "3dealer: Whatever you imagine, printed in 3D"
meta_description: "Gaming figures, skulls, key holders and the craziest things you can dream up. Designed and 3D printed, one by one."
trivia_body: "Gaming figures, skulls, key holders, dark humor and the craziest things you can dream up, all designed and printed right here in Greece."
classics_title: "Legendary & unbeatable"
---
@@ -0,0 +1,196 @@
---
name: "Privacy Policy"
meta_title: ""
meta_description: ""
---
3DEALER ("3DEALER", "we", "us") respects the privacy of its visitors and customers and protects their personal data in accordance with applicable law, including the General Data Protection Regulation (EU) 2016/679 ("GDPR") and the related Greek legislation.
This Privacy Policy explains what personal data we collect, what we use it for, who we may share it with and what rights you have.
## 1. Data controller
The controller of the personal data collected through the online store is:
**{store_legal_name}**
Parou 31, Kypseli, 11255 Athens, Greece
Tax ID (ΑΦΜ): {store_tax_identifier}
Company registration number (ΓΕΜΗ): {store_registration_number}
Email: [{store_contact_email}](mailto:{store_contact_email})
Phone: {store_phone}
3DEALER determines the purposes and means of processing the personal data of the online store's customers and users.
## 2. What data we collect
Depending on how you use the online store, we may collect:
* your full name,
* your email address,
* your phone number,
* your shipping and billing address,
* order and product details,
* payment-related details,
* contact details and the content of messages you send us,
* user account details,
* reviews you choose to publish,
* technical data about your use of the website,
* data collected through cookies and similar technologies, as described in the Cookie Policy.
We do not store your full credit or debit card details on 3DEALER's servers. Electronic payments are made through external payment providers.
## 3. Creating an account
You can create an account in the online store to manage your orders and details.
To create and run your account, we may process details such as your name, email and login details.
This processing is necessary to provide the account service.
The online store also supports guest checkout. With guest checkout, no user account is created. The details you provide are used only to the extent necessary to process and complete the order and for the related legal obligations.
## 4. Orders and purchases
When you place an order, we process the details needed to:
* record and fulfil the order,
* process the payment,
* ship and deliver the products,
* contact you about the order,
* issue the necessary invoices and receipts,
* meet our tax and accounting obligations,
* handle any returns, cancellations or complaints.
The legal basis for this processing is, as the case may be, the performance of the contract, compliance with a legal obligation and 3DEALER's legitimate interest in the proper operation and protection of its business.
## 5. Contacting us
If you contact us by email, phone or through the contact form, we process the details you give us in order to respond to your request.
The legal basis is, depending on the case, taking steps at your request before entering into a contract, the performance of a contract, or our legitimate interest in serving our users and customers.
## 6. Newsletter and marketing communication
If you choose to subscribe to the 3DEALER newsletter, we use your email address to send you updates, offers and other marketing content.
Subscribing to the newsletter is based on your consent.
You can withdraw your consent at any time by using the unsubscribe link included in the emails or by contacting us at [{store_contact_email}](mailto:{store_contact_email}).
Withdrawing consent does not affect the lawfulness of processing carried out before the withdrawal.
## 7. Product reviews
If you choose to submit a product review, we may publish your name or another identifier you chose to display with the review.
Please do not include your own or other people's personal data in a public review unless it is necessary.
## 8. Payment providers
To complete payments we may use third-party providers such as Stripe and PayPal, as well as banks for payments by bank transfer or IRIS.
The data required to complete a payment may be passed to the relevant payment provider.
**@TODO: Confirm the exact payment providers/banks that will be used in production and add them to the final version.**
These providers process data in accordance with their own privacy policies and applicable terms.
## 9. Shipping and delivery companies
To ship your orders we use shipping and delivery services, including ELTA Courier and BOX NOW.
To deliver an order, details such as your full name, address, phone number and other details needed for delivery may be passed to the relevant provider.
## 10. Accounting and tax services
Order details and the necessary customer details may be passed to the Epsilon system that 3DEALER uses to issue and manage invoices and receipts and to meet its tax and accounting obligations.
## 11. Security and abuse protection
We use technical and organizational measures to protect personal data against loss, unauthorized access, alteration or unlawful processing.
To protect the website against malicious or automated use, we may use the hCaptcha service. Using this service may involve processing technical data in accordance with the relevant provider's privacy policy.
## 12. Analytics and advertising services
3DEALER uses traffic analytics and advertising measurement services, such as:
* Google Analytics
* Google Tag Manager
* Meta Pixel
* TikTok Pixel
These technologies may use cookies or similar technologies to collect information about how the website is used and how effective advertising is.
Non-essential technologies are only activated in line with the consent choices you make through the cookie management tool.
More information is available in the Cookie Policy.
**@TODO: Confirm the exact tools, accounts and services that will be active in production.**
## 13. Who may have access to your data
3DEALER does not sell or rent your personal data.
To the extent necessary to provide the relevant services, the following may have access to personal data:
* payment providers,
* courier companies,
* hosting and technical support providers,
* email/newsletter service providers,
* analytics and advertising providers,
* accounting and tax services,
* public authorities and bodies, where required by law.
Third-party providers that process data on behalf of 3DEALER are used in accordance with the requirements of applicable data protection law.
## 14. Transfers outside the European Economic Area
Some of the providers we use may process data outside the European Economic Area.
In these cases, 3DEALER takes appropriate measures to ensure the transfer complies with the GDPR and that personal data receives the required level of protection.
**@TODO: Check the exact processing countries and transfer mechanisms for Stripe, PayPal, Google, Meta, TikTok, hCaptcha and the newsletter provider.**
## 15. Retention period
We keep personal data only for as long as necessary for the purpose it was collected for.
Data relating to orders and transactions is kept for as long as required by tax, accounting and commercial law.
Account data is kept for as long as the account remains active, unless there is a legal reason to keep it longer.
Data used for the newsletter is kept until you withdraw your consent or unsubscribe, unless there is another legal reason to keep it.
Contact data is kept for as long as necessary to handle your request and, where required, to protect our legitimate interests.
## 16. Your rights
Under the GDPR, and subject to the conditions set out in the law, you have the right to:
* access your personal data,
* correct inaccurate or incomplete data,
* have your data erased,
* restrict processing,
* data portability,
* object to certain types of processing,
* withdraw your consent, where processing is based on consent.
Exercising a right does not mean it can be applied in every case. For example, we may be required to keep certain data because of a tax or other legal obligation.
To exercise your rights, you can contact us:
**Email:** [{store_contact_email}](mailto:{store_contact_email})
**Phone:** {store_phone}
We will respond to your request without undue delay and, as a rule, within one (1) month of receiving it.
## 17. Right to lodge a complaint
If you believe the processing of your personal data breaches applicable law, you have the right to lodge a complaint with the Hellenic Data Protection Authority.
## 18. Changes to this Privacy Policy
This Privacy Policy may be changed when necessary, for example due to changes in legislation, in the services we use or in the way the online store operates.
The latest version will always be available on our website.
@@ -0,0 +1,99 @@
---
name: "Shipping & Returns"
meta_title: ""
meta_description: ""
---
## 1. Order preparation
All 3DEALER products are printed and prepared to order.
The usual preparation time for an order is **2 to 7 business days**.
Preparation time does not include the courier's transit time.
During periods of high demand there may be delays. In the event of a significant delay, 3DEALER will inform the customer.
## 2. Shipping
Orders are shipped via:
* ELTA Courier
* BOX NOW
We ship to the regions supported by the online store:
* Greece
* Cyprus
The available shipping options and costs are shown at checkout.
**Shipping costs:** @TODO — shipping rates are set dynamically in the Store's settings.
Free shipping is not offered.
Cash on delivery is not supported.
## 3. Delivery time
Delivery time depends on the courier and the destination.
3DEALER is not responsible for delays caused solely by the carrier, extreme weather, strikes, problems in the transport network or other circumstances beyond its reasonable control.
In case of a delay, you can contact us at [{store_contact_email}](mailto:{store_contact_email}).
## 4. Receiving your order
The customer is responsible for the accuracy of the delivery details entered when placing the order.
If the address is incorrect or incomplete, delivery may be delayed or a new shipment may be required. Any additional costs arising from incorrect delivery details may be charged to the customer.
## 5. Product delivered damaged
If the product arrives visibly damaged, please contact us as soon as possible at [{store_contact_email}](mailto:{store_contact_email}) and send us photos of the product and the packaging.
3DEALER will look into the case and, if damage that occurred in transit or another non-conformity is found, will provide an appropriate remedy in accordance with applicable law.
## 6. Right of withdrawal
For purchases that fall within the scope of the right of withdrawal, the consumer may withdraw from the contract within fourteen (14) calendar days of the day the product was received.
To exercise the right of withdrawal, the customer must inform 3DEALER with a clear statement at [{store_contact_email}](mailto:{store_contact_email}).
The product must be returned without undue delay and, in any case, within fourteen (14) days of the day the customer informed 3DEALER of their decision to withdraw.
The customer bears the direct cost of returning the product, unless otherwise agreed or 3DEALER did not inform them of this beforehand.
The customer is responsible for any reduction in the product's value resulting from handling beyond what is necessary to establish its nature, characteristics and functioning.
## 7. Exceptions to the right of withdrawal
The right of withdrawal does not apply in the cases excluded by applicable law.
In particular, it may not apply to products made to the customer's specifications or clearly personalized.
**@TODO: Confirm which 3DEALER products are considered personalized/custom and whether any products are not subject to the right of withdrawal.**
The fact that a product is produced after the order is placed does not in itself exclude it from the right of withdrawal.
## 8. Refunds
In the case of a valid withdrawal, 3DEALER refunds the money received from the customer for the purchase, including, where required by law, the standard delivery costs.
The refund is made using the same payment method as the original transaction, unless otherwise agreed.
3DEALER may withhold the refund until it has received the returned product or until the customer has provided proof of having sent it, whichever comes first.
## 9. Product exchanges
**@TODO: Confirm whether 3DEALER offers product/size exchanges or whether exchanges are handled only through a return and a new order.**
Where exchanges are offered, the procedure and any shipping costs will be communicated to the customer before the exchange is completed.
## 10. Defective or non-conforming products
If a product is defective or does not conform to the contract, the customer has the rights provided by applicable legislation on the sale of goods and consumer protection.
Minor cosmetic characteristics that are normal for 3D printing, such as layer lines or small variations, do not in themselves constitute a defect.
For any problem with a product, contact us at [{store_contact_email}](mailto:{store_contact_email}), stating your order number and, where possible, attaching photos.
@@ -0,0 +1,115 @@
---
name: "Terms & Conditions"
meta_title: ""
meta_description: ""
---
## 1. General
The online store 3DEALER (hereinafter "the Store" or "3DEALER") is operated by the business {store_legal_name}, registered at Parou 31, Kypseli, 11255 Athens, Greece.
**Tax ID (ΑΦΜ):** {store_tax_identifier}\
**Company registration number (ΓΕΜΗ):** {store_registration_number}
For any information or questions about orders, products or the operation of the Store, you can contact us:
**Email:** [{store_contact_email}](mailto:{store_contact_email})\
**Phone:** {store_phone}
Using the Store and making purchases through it requires acceptance of these Terms & Conditions.
These terms govern purchases made through the online store and are supplemented by the Privacy Policy and the Shipping & Returns Policy.
## 2. Products
The products offered through the Store are described and pictured as accurately as possible.
3DEALER products are made by 3D printing. Due to the nature of the production process, they may show layer lines, seams, small variations or other minor cosmetic imperfections. These characteristics are a normal result of the 3D printing process and are not in themselves considered a product defect.
All products are printed and prepared to order. The usual preparation time is 2 to 7 business days.
Unless otherwise stated in the description of a specific product, products are intended for decorative use or for use within reasonable and realistic limits. Use with excessive force, at very high temperatures or in a way other than intended may damage the product.
## 3. Prices
All product prices are shown in euros (€) and include the applicable VAT.
Shipping costs are calculated at checkout and shown before the purchase is confirmed.
**Shipping costs:** @TODO — the exact cost is calculated dynamically based on the Store's shipping settings.
## 4. Orders
Customers can make a purchase either by creating an account in the Store or by using guest checkout, without creating an account.
Completing an order requires the details necessary for processing, payment and delivery.
Before finalizing the order, the customer can review the order details and the total cost, including any shipping charges.
Once the order is completed, a confirmation is sent to the email address provided by the customer.
**@TODO: Confirm whether the order is considered final once payment is completed or once the order confirmation is sent.**
## 5. Payment methods
The Store supports the following payment methods:
* Credit or debit card
* PayPal
* Stripe
* IRIS
* Bank transfer
Electronic payments may use third-party payment services. Card details or other sensitive payment details are not stored by 3DEALER, but are processed by the relevant payment provider in accordance with its own terms and privacy policy.
## 6. Order cancellations
**@TODO: Confirm the cancellation policy.**
As a general rule, customers who wish to cancel an order can contact 3DEALER as soon as possible after placing it.
If preparation of the order has not yet started, 3DEALER can cancel it and refund the amount paid.
If production has already started, the terms of the Shipping & Returns Policy apply, together with the statutory right of withdrawal where applicable.
## 7. Right of withdrawal and returns
Where provided for by applicable law, consumers have the right to withdraw from a distance contract within fourteen (14) calendar days of receiving the product, without having to give a reason.
Exceptions to the right of withdrawal apply in the cases provided for by applicable law, including for products made to the consumer's specifications or clearly personalized.
The returns procedure and terms are described in detail in the Shipping & Returns Policy.
## 8. Legal guarantee and defective products
3DEALER is responsible for the conformity of products with the contract and for the consumer's statutory rights in the event of non-conformity or a defect, in accordance with applicable law.
Normal characteristics of 3D printing, such as layer lines or small cosmetic variations that are expected from this production process, do not in themselves constitute non-conformity.
## 9. Availability
3DEALER makes every effort to keep product availability information accurate.
In exceptional cases where a product cannot be produced or shipped, 3DEALER will contact the customer and explain the available options.
## 10. Intellectual property
The content of the Store, including but not limited to designs, photographs, texts, graphics, logos and other material, is the property of 3DEALER or is lawfully used by it, and is protected by applicable intellectual and industrial property law.
Copying, reproducing, modifying, distributing or commercially exploiting the content without prior written permission is not allowed.
## 11. Personal data
Customers' personal data is processed in accordance with the 3DEALER Privacy Policy.
## 12. Changes to these Terms
3DEALER reserves the right to change these Terms & Conditions when necessary, in particular due to changes in legislation, services or the way the Store operates.
The terms that apply to each order are those that were available at the time that order was placed.
## 13. Governing law
These Terms & Conditions are governed by Greek law.
Any dispute relating to the use of the Store or the purchase of products is subject to the applicable Greek and European consumer protection legislation.
+3
View File
@@ -0,0 +1,3 @@
---
meta_description: "Your local 3Dealer of 3D printed, high-quality products. Geek culture, decoration, fun and skulls, and custom orders."
---
+8
View File
@@ -9,6 +9,14 @@ content_path: /content
media_path: /media
thumbs_path: /storage/app/public/stoic/
repository_path: /repository
# 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:
- code: large
mode: resize
+83 -1
View File
@@ -2,6 +2,7 @@ schemas:
- name: pages
label: Pages
type: files
translatable: true
files:
- name: home
label: Home Page
@@ -10,15 +11,18 @@ schemas:
- name: name
label: Name
ui: string
translatable: true
- name: slug
label: Slug
ui: slug
- name: meta_title
label: Meta Title
ui: string
translatable: true
- name: meta_description
label: Meta Description
ui: string
translatable: true
- name: og_image
label: Og Image
ui: image
@@ -27,10 +31,50 @@ schemas:
ui: image
- name: trivia_body
label: "Trivia Body (intro paragraph under the hero)"
ui: markdown
ui: text
translatable: true
- name: classics_title
label: "Classics Section Title (favorites carousel heading)"
ui: string
translatable: true
- name: contact
label: Contact Page
file: pages/contact.md
fields:
- name: name
label: Name
ui: string
translatable: true
- name: slug
label: Slug
ui: slug
- name: meta_title
label: Meta Title
ui: string
translatable: true
- name: meta_description
label: Meta Description
ui: string
translatable: true
- name: og_image
label: Og Image
ui: image
- name: heading_first
label: "Heading, first line (animated)"
ui: string
translatable: true
- name: heading_second
label: "Heading, second line"
ui: string
translatable: true
- name: heading_highlight
label: "Heading, last word(s) of the second line (animated)"
ui: string
translatable: true
- name: intro
label: "Intro (paragraph above the form)"
ui: text
translatable: true
- name: terms-and-conditions
label: "Terms & Conditions Page"
file: pages/terms-and-conditions.md
@@ -38,15 +82,18 @@ schemas:
- name: name
label: Name
ui: string
translatable: true
- name: slug
label: Slug
ui: slug
- name: meta_title
label: Meta Title
ui: string
translatable: true
- name: meta_description
label: Meta Description
ui: string
translatable: true
- name: og_image
label: Og Image
ui: image
@@ -56,6 +103,7 @@ schemas:
- name: body
label: Body
ui: markdown
translatable: true
- name: shipping-returns
label: "Shipping & Returns Page"
file: pages/shipping-returns.md
@@ -63,15 +111,18 @@ schemas:
- name: name
label: Name
ui: string
translatable: true
- name: slug
label: Slug
ui: slug
- name: meta_title
label: Meta Title
ui: string
translatable: true
- name: meta_description
label: Meta Description
ui: string
translatable: true
- name: og_image
label: Og Image
ui: image
@@ -81,6 +132,7 @@ schemas:
- name: body
label: Body
ui: markdown
translatable: true
- name: privacy-policy
label: "Privacy Policy Page"
file: pages/privacy-policy.md
@@ -88,15 +140,18 @@ schemas:
- name: name
label: Name
ui: string
translatable: true
- name: slug
label: Slug
ui: slug
- name: meta_title
label: Meta Title
ui: string
translatable: true
- name: meta_description
label: Meta Description
ui: string
translatable: true
- name: og_image
label: Og Image
ui: image
@@ -106,6 +161,7 @@ schemas:
- name: body
label: Body
ui: markdown
translatable: true
- name: cookies-policy
label: "Cookies Policy Page"
file: pages/cookies-policy.md
@@ -113,15 +169,18 @@ schemas:
- name: name
label: Name
ui: string
translatable: true
- name: slug
label: Slug
ui: slug
- name: meta_title
label: Meta Title
ui: string
translatable: true
- name: meta_description
label: Meta Description
ui: string
translatable: true
- name: og_image
label: Og Image
ui: image
@@ -131,3 +190,26 @@ schemas:
- name: body
label: Body
ui: markdown
translatable: true
- name: settings
label: Settings
type: singleton
file: settings.md
translatable: true
fields:
- name: meta_description
label: "Default Meta Description (used when a page has none)"
ui: text
translatable: true
- name: og_image
label: "Default Og Image (used when a page has none, ideally 1200×630)"
ui: image
- name: facebook_url
label: Facebook URL
ui: string
- name: instagram_url
label: Instagram URL
ui: string
- name: tiktok_url
label: TikTok URL
ui: string
@@ -0,0 +1,65 @@
@extends('layouts.account')
@section('title', __('storefront.auth.enter_code'))
@section('account')
<div class="flex max-w-2xl flex-col gap-12">
<div class="flex flex-col gap-6">
<h1 class="font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.auth.enter_code') }}
</h1>
<p>
{{ __('storefront.auth.code_sent_to') }} <strong class="break-all">{{ $email }}</strong>
</p>
<x-ui.status />
</div>
<form method="POST" action="{{ route('account.email.verify') }}" class="flex flex-col gap-8">
@csrf
<x-ui.field
:label="__('storefront.auth.code')"
for="account-email-code"
:required="true"
:error="$errors->first('code')"
>
<x-ui.input
id="account-email-code"
name="code"
inputmode="numeric"
autocomplete="one-time-code"
pattern="[0-9]{6}"
maxlength="6"
:required="true"
autofocus
class="text-2xl font-bold tracking-[0.5em]"
:aria-invalid="$errors->has('code') ? 'true' : null"
:aria-describedby="$errors->has('code') ? 'account-email-code-error' : null"
/>
</x-ui.field>
<div>
<x-ui.button type="submit">{{ __('storefront.account.email_confirm') }}</x-ui.button>
</div>
</form>
<div class="flex flex-wrap items-center gap-x-8 gap-y-4 text-sm">
<form method="POST" action="{{ route('account.email.resend') }}">
@csrf
<button type="submit" class="cursor-pointer underline hover:no-underline">
{{ __('storefront.auth.resend_code') }}
</button>
</form>
<a href="{{ route('account.email.edit') }}" class="underline hover:no-underline">
{{ __('storefront.auth.change_email') }}
</a>
</div>
</div>
@endsection
+53
View File
@@ -0,0 +1,53 @@
@extends('layouts.account')
@section('title', __('storefront.account.email_change_heading'))
@section('account')
<div class="flex max-w-2xl flex-col gap-12">
<div class="flex flex-col gap-6">
<h1 class="font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.account.email_change_heading') }}
</h1>
<p>
{{ __('storefront.account.email_current') }} <strong class="break-all">{{ $user->email }}</strong>
</p>
</div>
<form method="POST" action="{{ route('account.email.send') }}" class="flex flex-col gap-8">
@csrf
<x-ui.field
:label="__('storefront.account.email_new')"
for="account-new-email"
:required="true"
:description="__('storefront.account.email_new_hint')"
:error="$errors->first('email')"
>
<x-ui.input
id="account-new-email"
name="email"
type="email"
autocomplete="email"
:value="old('email')"
:required="true"
autofocus
:aria-invalid="$errors->has('email') ? 'true' : null"
:aria-describedby="$errors->has('email') ? 'account-new-email-error' : 'account-new-email-description'"
/>
</x-ui.field>
<div class="flex flex-wrap items-center gap-8">
<x-ui.button type="submit">{{ __('storefront.auth.send_code') }}</x-ui.button>
<a href="{{ route('account') }}" class="text-sm underline hover:no-underline">
{{ __('storefront.account.delete_cancel') }}
</a>
</div>
</form>
</div>
@endsection
@@ -0,0 +1,70 @@
@extends('layouts.account')
@section('title', __('storefront.account.nav_orders'))
@section('account')
<div class="flex max-w-4xl flex-col gap-12">
<h1 class="font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.account.nav_orders') }}
</h1>
@if ($orders->isEmpty())
<div class="flex flex-col items-start gap-8">
<p>{{ __('storefront.orders.empty') }}</p>
<x-ui.button :href="route('products')" size="md">{{ __('storefront.orders.shop_now') }}</x-ui.button>
</div>
@else
{{-- A list, not a table, so each order can stack on mobile. The column
headings are visual only; each cell carries its own sr-only label. --}}
<div>
<div class="hidden grid-cols-[1fr_1fr_1.5fr_1fr_auto] gap-6 border-b border-black pb-3 text-sm uppercase font-display font-extrabold sm:grid" aria-hidden="true">
<span>{{ __('storefront.orders.date') }}</span>
<span>{{ __('storefront.orders.number') }}</span>
<span>{{ __('storefront.orders.status') }}</span>
<span>{{ __('storefront.orders.total') }}</span>
<span class="w-24"></span>
</div>
<ul>
@foreach ($orders as $order)
@php
$orderReference = \Modules\Core\Order\Support\OrderReferenceDisplay::resolve($order);
@endphp
<li class="grid grid-cols-2 gap-x-6 gap-y-2 border-b border-black py-5 sm:grid-cols-[1fr_1fr_1.5fr_1fr_auto] sm:items-center">
<span>
<span class="sr-only">{{ __('storefront.orders.date') }}:</span>
{{ $order->placed_at->format('d/m/Y') }}
</span>
<span class="text-right font-bold sm:text-left">
<span class="sr-only">{{ __('storefront.orders.number') }}:</span>
#{{ $orderReference }}
</span>
<span>
<span class="sr-only">{{ __('storefront.orders.status') }}:</span>
<x-order-status :status="$order->status" />
</span>
<span class="text-right sm:text-left">
<span class="sr-only">{{ __('storefront.orders.total') }}:</span>
{{ $order->total?->formatted() }}
</span>
<a
href="{{ route('account.orders.show', ['orderId' => $order->id]) }}"
class="col-span-2 mt-2 inline-flex w-24 items-center gap-2 font-bold underline hover:no-underline sm:col-span-1 sm:mt-0"
aria-label="{{ __('storefront.orders.view_order', ['number' => $orderReference]) }}"
>
{{ __('storefront.orders.view') }}
<x-ui.icon name="arrow-right" :size="16" />
</a>
</li>
@endforeach
</ul>
</div>
<x-ui.pagination :paginator="$orders" />
@endif
</div>
@endsection
@@ -0,0 +1,162 @@
@extends('layouts.account')
@php
$orderReference = \Modules\Core\Order\Support\OrderReferenceDisplay::resolve($order);
@endphp
@section('title', __('storefront.orders.order_title', ['number' => $orderReference]))
@php
$productLines = $order->lines->where('type', '!=', 'shipping');
$shippingLine = $order->lines->firstWhere('type', 'shipping');
@endphp
@section('account')
<div class="flex max-w-4xl flex-col gap-12">
<div class="flex flex-col gap-6">
<a href="{{ route('account.orders') }}" class="inline-flex items-center gap-2 self-start text-sm underline hover:no-underline">
<x-ui.icon name="arrow-left" :size="16" />
{{ __('storefront.orders.back') }}
</a>
<h1 class="font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.orders.order_title', ['number' => $orderReference]) }}
</h1>
</div>
{{-- Summary --}}
<dl class="grid grid-cols-1 gap-6 border-y border-black py-6 sm:grid-cols-2 lg:grid-cols-4">
<div class="flex flex-col gap-1">
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.date') }}</dt>
<dd>{{ $order->placed_at->format('d/m/Y') }}</dd>
</div>
<div class="flex flex-col gap-1">
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.status') }}</dt>
<dd class="font-bold"><x-order-status :status="$order->status" /></dd>
</div>
@if ($paymentMethodName)
<div class="flex flex-col gap-1">
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.payment') }}</dt>
<dd>{{ $paymentMethodName }}</dd>
</div>
@endif
@if ($shippingLine)
<div class="flex flex-col gap-1">
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.shipping_method') }}</dt>
<dd>{{ $shippingLine->description }}</dd>
</div>
@endif
@foreach ($shipments as $shipment)
<div class="flex flex-col gap-1">
<dt class="text-sm text-neutral-500">{{ __('storefront.orders.tracking') }}</dt>
<dd class="break-all">{{ $shipment->tracking_reference }}</dd>
</div>
@endforeach
</dl>
{{-- Items + totals --}}
<section class="flex flex-col gap-6" aria-labelledby="order-items-heading">
<h2 id="order-items-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.orders.items') }}</h2>
<ul>
@foreach ($productLines as $line)
<li class="flex gap-4 border-b border-black py-5 sm:gap-6">
<div class="size-18 shrink-0 bg-neutral-300 sm:size-24">
@if ($thumb = $line->purchasable?->getThumbnailImage())
<img src="{{ $thumb }}" alt="" aria-hidden="true" width="96" height="96" loading="lazy" class="size-full object-cover">
@endif
</div>
<div class="flex min-w-0 flex-1 flex-col gap-1">
{{-- Linked only while the product still exists and is published;
otherwise the name stays plain text (the order keeps it). --}}
@php($lineProduct = $line->purchasable?->product)
<p class="font-bold">
@if ($lineProduct?->status === 'published')
<a href="{{ route('product.show', ['id' => $lineProduct->id]) }}" class="underline hover:no-underline">{{ $line->description }}</a>
@else
{{ $line->description }}
@endif
<span class="font-normal">&times; {{ $line->quantity }}</span>
</p>
@if ($line->option)
<p class="text-sm text-neutral-500">{{ $line->option }}</p>
@endif
@include('checkout::partials.line-custom-fields', ['line' => $line])
</div>
<p class="shrink-0 font-bold">{{ $line->sub_total?->formatted() }}</p>
</li>
@endforeach
</ul>
<dl class="ml-auto flex w-full max-w-sm flex-col gap-2">
<div class="flex justify-between gap-6">
<dt>{{ __('storefront.orders.subtotal') }}</dt>
<dd>{{ $order->sub_total?->formatted() }}</dd>
</div>
@if ($order->discount_total?->value > 0)
<div class="flex justify-between gap-6">
<dt>{{ __('storefront.orders.discount') }}</dt>
<dd>&minus;{{ $order->discount_total->formatted() }}</dd>
</div>
@endif
<div class="flex justify-between gap-6">
<dt>{{ __('storefront.orders.shipping') }}</dt>
<dd>{{ $order->shipping_total?->formatted() }}</dd>
</div>
@if ($order->tax_total?->value > 0)
<div class="flex justify-between gap-6 text-sm text-neutral-500">
<dt>{{ __('storefront.orders.tax') }}</dt>
<dd>{{ $order->tax_total->formatted() }}</dd>
</div>
@endif
<div class="flex justify-between gap-6 border-t border-black pt-3 font-display text-h4 font-extrabold">
<dt>{{ __('storefront.orders.total') }}</dt>
<dd>{{ $order->total?->formatted() }}</dd>
</div>
</dl>
</section>
{{-- Addresses --}}
<div class="grid grid-cols-1 gap-12 sm:grid-cols-2">
@foreach ([
'shipping_to' => $order->shippingAddress,
'billing' => $order->billingAddress,
] as $heading => $address)
@if ($address)
<section class="flex flex-col gap-4" aria-labelledby="order-{{ $heading }}-heading">
<h2 id="order-{{ $heading }}-heading" class="font-display text-h4 font-extrabold">{{ __("storefront.orders.{$heading}") }}</h2>
<address class="flex flex-col not-italic">
<span>{{ trim($address->first_name.' '.$address->last_name) }}</span>
@if ($address->company_name)<span>{{ $address->company_name }}</span>@endif
@if ($address->tax_identifier)<span>{{ __('storefront.account.tax_identifier') }}: {{ $address->tax_identifier }}</span>@endif
<span>{{ $address->line_one }}</span>
@if ($address->line_two)<span>{{ $address->line_two }}</span>@endif
<span>{{ trim($address->postcode.' '.$address->city) }}</span>
@if ($address->state)
<span>{{ Lang::has("core::states.{$address->state}") ? __("core::states.{$address->state}") : $address->state }}</span>
@endif
@if ($address->contact_phone)<span>{{ $address->contact_phone }}</span>@endif
</address>
</section>
@endif
@endforeach
</div>
</div>
@endsection
+204
View File
@@ -0,0 +1,204 @@
@extends('layouts.account')
@section('title', __('storefront.account.nav_profile'))
@php
$wantsInvoice = (bool) old('invoice', filled($customer?->company_name) || filled($customer?->tax_identifier));
$regionOptions = $regions->map(fn ($region) => [
'value' => $region->name,
'label' => Lang::has("core::states.{$region->name}") ? __("core::states.{$region->name}") : $region->name,
])->all();
@endphp
@section('account')
<div class="flex max-w-2xl flex-col gap-16">
<div class="flex flex-col gap-6">
<h1 class="font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.account.nav_profile') }}
</h1>
<x-ui.status />
</div>
{{-- Email: the login itself, so it's changed through its own verified flow --}}
<section class="flex flex-col gap-6" aria-labelledby="account-email-heading">
<h2 id="account-email-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.account.email_heading') }}</h2>
<div class="flex flex-wrap items-center justify-between gap-x-8 gap-y-2 border-b border-black py-2">
<span class="break-all">{{ $user->email }}</span>
<a href="{{ route('account.email.edit') }}" class="text-sm underline hover:no-underline">
{{ __('storefront.account.email_change') }}
</a>
</div>
</section>
<form method="POST" action="{{ route('account.update') }}" class="flex flex-col gap-16">
@csrf
@method('PUT')
{{-- Details --}}
<section class="flex flex-col gap-8" aria-labelledby="account-details-heading">
<h2 id="account-details-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.account.details_heading') }}</h2>
<div class="grid grid-cols-1 gap-8 sm:grid-cols-2">
<x-ui.field :label="__('storefront.account.first_name')" for="account-first-name" :error="$errors->first('first_name')">
<x-ui.input id="account-first-name" name="first_name" autocomplete="given-name"
:value="old('first_name', $customer?->first_name)"
:aria-invalid="$errors->has('first_name') ? 'true' : null" :aria-describedby="$errors->has('first_name') ? 'account-first-name-error' : null" />
</x-ui.field>
<x-ui.field :label="__('storefront.account.last_name')" for="account-last-name" :error="$errors->first('last_name')">
<x-ui.input id="account-last-name" name="last_name" autocomplete="family-name"
:value="old('last_name', $customer?->last_name)"
:aria-invalid="$errors->has('last_name') ? 'true' : null" :aria-describedby="$errors->has('last_name') ? 'account-last-name-error' : null" />
</x-ui.field>
</div>
{{-- Invoice details, revealed by the checkbox (CSS :has(), no JS). Not
`required` in HTML: a hidden required field would block submit, so
the server requires them only when the box is ticked. --}}
<div class="group/invoice flex flex-col gap-8">
<input type="hidden" name="invoice" value="0">
<x-ui.checkbox
id="account-invoice"
name="invoice"
:checked="$wantsInvoice"
:label="__('storefront.account.invoice')"
aria-controls="account-invoice-fields"
/>
<div id="account-invoice-fields" class="hidden grid-cols-1 gap-8 sm:grid-cols-2 group-has-[#account-invoice:checked]/invoice:grid">
<x-ui.field :label="__('storefront.account.company_name')" for="account-company" :error="$errors->first('company_name')">
<x-ui.input id="account-company" name="company_name" autocomplete="organization"
:value="old('company_name', $customer?->company_name)"
:aria-invalid="$errors->has('company_name') ? 'true' : null" :aria-describedby="$errors->has('company_name') ? 'account-company-error' : null" />
</x-ui.field>
<x-ui.field :label="__('storefront.account.tax_identifier')" for="account-tax-id" :error="$errors->first('tax_identifier')">
<x-ui.input id="account-tax-id" name="tax_identifier" inputmode="numeric" maxlength="9" pattern="[0-9]{9}"
:value="old('tax_identifier', $customer?->tax_identifier)"
:aria-invalid="$errors->has('tax_identifier') ? 'true' : null" :aria-describedby="$errors->has('tax_identifier') ? 'account-tax-id-error' : null" />
</x-ui.field>
</div>
</div>
</section>
{{-- Address: one, used as both shipping and billing default --}}
<section class="flex flex-col gap-8" aria-labelledby="account-address-heading">
<h2 id="account-address-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.account.address_heading') }}</h2>
<x-ui.field :label="__('storefront.account.line_one')" for="account-line-one" :error="$errors->first('line_one')">
<x-ui.input id="account-line-one" name="line_one" autocomplete="address-line1"
:value="old('line_one', $address?->line_one)"
:aria-invalid="$errors->has('line_one') ? 'true' : null" :aria-describedby="$errors->has('line_one') ? 'account-line-one-error' : null" />
</x-ui.field>
<div class="grid grid-cols-1 gap-8 sm:grid-cols-2">
<x-ui.field :label="__('storefront.account.city')" for="account-city" :error="$errors->first('city')">
<x-ui.input id="account-city" name="city" autocomplete="address-level2"
:value="old('city', $address?->city)"
:aria-invalid="$errors->has('city') ? 'true' : null" :aria-describedby="$errors->has('city') ? 'account-city-error' : null" />
</x-ui.field>
<x-ui.field :label="__('storefront.account.postcode')" for="account-postcode" :error="$errors->first('postcode')">
<x-ui.input id="account-postcode" name="postcode" autocomplete="postal-code" inputmode="numeric"
:value="old('postcode', $address?->postcode)"
:aria-invalid="$errors->has('postcode') ? 'true' : null" :aria-describedby="$errors->has('postcode') ? 'account-postcode-error' : null" />
</x-ui.field>
</div>
<div class="grid grid-cols-1 gap-8 sm:grid-cols-2">
<x-ui.field :label="__('storefront.account.state')" for="account-state" :error="$errors->first('state')">
<x-ui.select
id="account-state"
name="state"
:block="true"
:options="$regionOptions"
:value="old('state', $address?->state)"
:placeholder="__('storefront.account.state_placeholder')"
:aria-invalid="$errors->has('state') ? 'true' : null"
:aria-describedby="$errors->has('state') ? 'account-state-error' : null"
/>
</x-ui.field>
<x-ui.field :label="__('storefront.account.phone')" for="account-phone" :error="$errors->first('contact_phone')">
<x-ui.input id="account-phone" name="contact_phone" type="tel" autocomplete="tel"
:value="old('contact_phone', $address?->contact_phone)"
:aria-invalid="$errors->has('contact_phone') ? 'true' : null" :aria-describedby="$errors->has('contact_phone') ? 'account-phone-error' : null" />
</x-ui.field>
</div>
</section>
{{-- Standing opt-in for abandoned-cart reminders (explicit, off by
default); checkout starts from it and can change it again. --}}
<section class="flex flex-col gap-8" aria-labelledby="account-emails-heading">
<h2 id="account-emails-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.account.emails_heading') }}</h2>
<div>
<input type="hidden" name="recovery_consent" value="0">
<x-ui.checkbox
id="account-recovery-consent"
name="recovery_consent"
:checked="(bool) old('recovery_consent', data_get($customer, 'meta.recovery_consent'))"
:label="__('storefront.account.recovery_consent')"
/>
</div>
</section>
<div>
<x-ui.button type="submit">{{ __('storefront.account.save') }}</x-ui.button>
</div>
</form>
{{-- Delete account --}}
<section class="flex flex-col gap-6 border-t border-black pt-12" aria-labelledby="account-delete-heading">
<h2 id="account-delete-heading" class="font-display text-h4 font-extrabold">{{ __('storefront.account.delete_heading') }}</h2>
<p>{{ __('storefront.account.delete_text') }}</p>
<div>
<x-ui.button
variant="secondary"
size="md"
popovertarget="account-delete-dialog"
aria-haspopup="dialog"
>{{ __('storefront.account.delete') }}</x-ui.button>
</div>
<div
id="account-delete-dialog"
popover
role="dialog"
aria-modal="true"
aria-labelledby="account-delete-dialog-heading"
class="m-auto w-[calc(100%-2rem)] max-w-lg border border-black bg-neutral-200 p-8 backdrop:bg-black/50"
>
<h3 id="account-delete-dialog-heading" class="mb-4 font-display text-h4 font-extrabold">
{{ __('storefront.account.delete_confirm_heading') }}
</h3>
<p class="mb-8">{{ __('storefront.account.delete_confirm_text') }}</p>
<form method="POST" action="{{ route('account.destroy') }}" class="flex flex-wrap gap-4">
@csrf
@method('DELETE')
<x-ui.button type="submit" size="md">{{ __('storefront.account.delete_confirm') }}</x-ui.button>
<x-ui.button
variant="secondary"
size="md"
popovertarget="account-delete-dialog"
popovertargetaction="hide"
>{{ __('storefront.account.delete_cancel') }}</x-ui.button>
</form>
</div>
</section>
</div>
@endsection
@@ -0,0 +1,17 @@
@extends('layouts.account')
@section('title', __('storefront.account.nav_wishlist'))
@section('account')
<div class="flex flex-col gap-12">
<h1 class="font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.account.nav_wishlist') }}
</h1>
@include('wishlist.list')
</div>
@endsection
+67
View File
@@ -0,0 +1,67 @@
@extends('layouts.app')
@section('title', __('storefront.auth.enter_code'))
@push('seo')
<meta name="robots" content="noindex, nofollow">
@endpush
@section('content')
<section class="mx-auto max-w-2xl px-4 py-20 sm:px-8 sm:py-32">
<h1 class="mb-6 font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.auth.enter_code') }}
</h1>
<p class="mb-12">
{{ __('storefront.auth.code_sent_to') }} <strong class="break-all">{{ $email }}</strong>
</p>
<x-ui.status class="mb-8" />
<form method="POST" action="{{ route('login.verify') }}" class="flex flex-col gap-8">
@csrf
<x-ui.field
:label="__('storefront.auth.code')"
for="login-code"
:required="true"
:error="$errors->first('code')"
>
<x-ui.input
id="login-code"
name="code"
inputmode="numeric"
autocomplete="one-time-code"
pattern="[0-9]{6}"
maxlength="6"
:required="true"
autofocus
class="text-2xl font-bold tracking-[0.5em]"
:aria-invalid="$errors->has('code') ? 'true' : null"
:aria-describedby="$errors->has('code') ? 'login-code-error' : null"
/>
</x-ui.field>
<div>
<x-ui.button type="submit">{{ __('storefront.auth.login') }}</x-ui.button>
</div>
</form>
<div class="mt-12 flex flex-wrap items-center gap-x-8 gap-y-4 text-sm">
<form method="POST" action="{{ route('login.resend') }}">
@csrf
<button type="submit" class="cursor-pointer underline hover:no-underline">
{{ __('storefront.auth.resend_code') }}
</button>
</form>
<a href="{{ route('login') }}" class="underline hover:no-underline">
{{ __('storefront.auth.change_email') }}
</a>
</div>
</section>
@endsection
+79
View File
@@ -0,0 +1,79 @@
@extends('layouts.app')
@section('title', __('storefront.auth.login'))
@push('seo')
<meta name="robots" content="noindex, follow">
@endpush
{{-- Only on pages with a captcha, not in the global layout. --}}
@push('scripts')
<script src="https://js.hcaptcha.com/1/api.js?hl={{ app()->getLocale() }}" async defer></script>
@endpush
@section('content')
<section class="mx-auto max-w-2xl px-4 py-20 sm:px-8 sm:py-32">
<h1 class="mb-6 font-display text-h3 font-black tracking-tight sm:text-h2">
{{ __('storefront.auth.login') }}
</h1>
{{-- Unescaped: the label holds a <br /> (edited in Filament › Language Lines, staff only). --}}
<p class="mb-12">{!! __('storefront.auth.login_intro') !!}</p>
{{-- e.g. "account deletion scheduled", after AccountController::destroy() --}}
<x-ui.status class="mb-12" />
<form method="POST" action="{{ route('login.send') }}" class="flex flex-col gap-8">
@csrf
<x-ui.field
:label="__('storefront.auth.email')"
for="login-email"
:required="true"
:error="$errors->first('email')"
>
<x-ui.input
id="login-email"
name="email"
type="email"
autocomplete="email"
:value="old('email')"
:required="true"
autofocus
:aria-invalid="$errors->has('email') ? 'true' : null"
:aria-describedby="$errors->has('email') ? 'login-email-error' : null"
/>
</x-ui.field>
{{-- Shown to everyone. Recording acceptance for new accounts is a
boboko-core task (UserOtpService). Unescaped: the label holds the
two links (Language Lines, staff only). --}}
<p class="text-sm text-neutral-500 [&_a]:underline [&_a:hover]:no-underline">
{!! __('storefront.auth.terms_notice', [
'terms' => route('legal.terms'),
'privacy' => route('legal.privacy'),
]) !!}
</p>
{{-- hCaptcha checkbox, verified by App\Rules\HCaptcha. The widget adds
the `h-captcha-response` field itself. Fixed height reserves the
iframe's space so the button doesn't jump when it loads. --}}
<x-ui.field for="login-captcha" :error="$errors->first('h-captcha-response')">
<div
id="login-captcha"
class="h-captcha min-h-[78px]"
data-sitekey="{{ config('services.hcaptcha.sitekey') }}"
@if ($errors->has('h-captcha-response')) aria-describedby="login-captcha-error" @endif
></div>
</x-ui.field>
<div>
<x-ui.button type="submit">{{ __('storefront.auth.send_code') }}</x-ui.button>
</div>
</form>
</section>
@endsection
+9 -3
View File
@@ -14,7 +14,8 @@
@endpush
@section('content')
<div class="max-w-5xl mx-auto pt-26 pb-12">
{{-- <div class="max-w-5xl mx-auto pt-26 pb-12"> --}}
<div class="max-w-7xl mx-auto px-4 sm:px-8 pt-26 pb-12">
<div class="flex items-end justify-between gap-6 flex-wrap mb-16">
<h1 class="font-medium text-h2">{{ $collection['name'] }}</h1>
@@ -32,8 +33,13 @@
refresh or bookmark reproduces the exact same view. With no JS the
frame is just a block and the links do full-page navigations to the
same URLs. --}}
<turbo-frame id="category-listing" data-turbo-action="advance">
@include('category.partials.listing')
<turbo-frame
id="category-listing"
data-turbo-action="advance"
data-controller="frame-scroll"
class="scroll-mt-28"
>
@include('shop.partials.listing')
</turbo-frame>
</div>
@@ -0,0 +1,44 @@
{{--
Store address, phone and email from Lunar's Store Details
(Modules\Core\Store). Each line is left out when its value is empty.
--}}
@props([
'store' => null,
])
@php
$address = $store?->translate('address');
$phone = $store?->phone;
$email = $store?->contact_email;
@endphp
@if (filled($address) || filled($phone) || filled($email))
<address {{ $attributes->merge(['class' => 'not-italic']) }}>
<dl class="flex flex-col gap-10">
@if (filled($address))
<div class="flex flex-col gap-1">
<dt class="font-display text-sm font-semibold uppercase">{{ __('storefront.contact.address') }}</dt>
<dd class="font-display text-h4 font-semibold leading-tight">{{ $address }}</dd>
</div>
@endif
@if (filled($phone))
<div class="flex flex-col gap-1">
<dt class="font-display text-sm font-semibold uppercase">{{ __('storefront.contact.phone') }}</dt>
<dd class="font-display text-h4 font-semibold leading-tight">
<a href="tel:{{ preg_replace('/[^\d+]/', '', $phone) }}" class="underline-slide [--slide-h:1px] pb-0">{{ $phone }}</a>
</dd>
</div>
@endif
@if (filled($email))
<div class="flex flex-col gap-1">
<dt class="font-display text-sm font-semibold uppercase">Email</dt>
<dd class="font-display text-h4 font-semibold leading-tight break-all">
<a href="mailto:{{ $email }}" class="underline-slide [--slide-h:1px] pb-0">{{ $email }}</a>
</dd>
</div>
@endif
</dl>
</address>
@endif
+14 -23
View File
@@ -26,29 +26,20 @@
</div>
</div>
{{-- Social media --}}
<nav aria-label="Social media">
<ul class="flex items-center gap-4">
<li>
<a href="#" aria-label="Facebook" class="hover:text-brand">
<x-ui.icon name="facebook" :size="22" color="text-neutral-300" />
{{-- <span class="leading-none text-[22px] font-extrabold italic group-hover:underline">FB.</span> --}}
</a>
</li>
<li>
<a href="#" aria-label="Instagram" class="hover:text-brand">
<x-ui.icon name="instagram" :size="22" />
{{-- <span class="leading-none text-[22px] font-extrabold italic group-hover:underline">IG.</span> --}}
</a>
</li>
<li>
<a href="#" aria-label="TikTok" class="hover:text-brand">
<x-ui.icon name="tiktok" :size="22" />
{{-- <span class="leading-none text-[22px] font-extrabold italic group-hover:underline">TT.</span> --}}
</a>
</li>
</ul>
</nav>
{{-- Social media — URLs from Stoic (settings.md); empty ones are hidden. --}}
@if ($stoicSettings->socialLinks())
<nav aria-label="Social media">
<ul class="flex items-center gap-4">
@foreach ($stoicSettings->socialLinks() as $social)
<li>
<a href="{{ $social['url'] }}" aria-label="{{ $social['label'] }}" class="hover:text-brand">
<x-ui.icon :name="$social['icon']" :size="22" />
</a>
</li>
@endforeach
</ul>
</nav>
@endif
{{-- Copyright --}}
<div class="flex items-center gap-2">
+44 -5
View File
@@ -11,7 +11,7 @@
{{-- Products (CSS-only hover dropdown) --}}
<div class="group relative h-full flex items-center">
<a href="{{ url('/'.app()->getLocale().'/products') }}" class="nav-link uppercase inline-flex items-center gap-1 relative font-display font-extrabold italic text-black no-underline py-8">
<a href="{{ route('products') }}" class="nav-link uppercase inline-flex items-center gap-1 relative font-display font-extrabold italic text-black no-underline py-8">
<span>{{ __('storefront.nav.products') }}</span>
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 20 20" fill="currentColor" class="size-4 not-italic transition-transform group-hover:rotate-180">
<path fill-rule="evenodd" d="M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z" clip-rule="evenodd" />
@@ -41,16 +41,55 @@
</a>
@endforeach
{{-- Cart --}}
<a href="{{ url('/'.app()->getLocale().'/cart') }}" class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity" aria-label="Cart">
<x-ui.icon name="bag" :size="40" />
{{-- Wishlist — the account page, or the cookie-based guest page --}}
<a
href="{{ auth()->check() ? route('account.wishlist') : route('wishlist') }}"
class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
aria-label="{{ __('storefront.account.nav_wishlist') }}"
@if (request()->routeIs('account.wishlist', 'wishlist')) aria-current="page" @endif
>
<x-ui.icon name="heart" :size="40" />
</a>
{{-- Account — the account page, or login for guests --}}
<a
href="{{ auth()->check() ? route('account') : route('login') }}"
class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
aria-label="{{ auth()->check() ? __('storefront.nav.account') : __('storefront.auth.login') }}"
>
<x-ui.icon name="user" :size="40" />
</a>
{{-- Cart — opens the checkout module's drawer, no separate cart page --}}
<button
type="button"
class="relative flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
aria-label="Cart"
aria-haspopup="dialog"
data-controller="cart-count"
data-action="cart-count#open"
>
<x-ui.icon name="bag" :size="40" />
<span
data-cart-count-target="badge"
class="absolute -top-1 -right-1 min-w-5 h-5 px-1 rounded-full bg-black text-neutral-200 text-xs font-bold flex items-center justify-center"
hidden
>0</span>
</button>
{{-- Search --}}
<button type="button" class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity" aria-label="Search">
<button
type="button"
popovertarget="search-overlay"
popovertargetaction="toggle"
class="flex items-center justify-center w-10 h-10 hover:opacity-70 transition-opacity"
aria-label="{{ __('storefront.shop.search_label') }}"
>
<x-ui.icon name="search" :size="40" />
</button>
</div>
</div>
<x-search-overlay />
</header>
@@ -3,10 +3,10 @@
])
<section {{ $attributes }}>
<div class="max-w-6xl mx-auto grid grid-cols-1 lg:grid-cols-2 border border-black">
<div class="flex flex-col justify-center gap-8 px-8 py-16 lg:px-16">
<div class="grid grid-cols-1 lg:grid-cols-2">
<div class="flex flex-col justify-center gap-8 px-8 py-16 lg:px-16 items-center">
<h2
class="text-h2 leading-tight"
class="text-h1 leading-[1.3] max-w-xl text-center"
aria-label="Γράψου στο newsletter μας"
data-controller="appear"
data-appear-visible-class="is-visible"
@@ -17,13 +17,13 @@ class="text-h2 leading-tight"
μας
</h2>
<p class="max-w-md text-neutral-600">
<p class="max-w-xl text-neutral-600 text-center">
Γίνε μέλος της λίστας μας και κέρδισε <span class="font-bold">5% έκπτωση</span> στην πρώτη σου παραγγελία, μαζί με αποκλειστικές προσφορές και νέα.
</p>
<form method="POST" action="#" class="flex flex-col gap-6 max-w-md">
<form method="POST" action="#" class="flex flex-col gap-6 max-w-xl items-center">
@csrf
<div class="relative">
<div class="relative max-w-xs w-full">
<x-ui.input
name="email"
type="email"
@@ -44,7 +44,7 @@ class="absolute right-0 bottom-2 cursor-pointer"
</div>
<x-ui.checkbox name="gdpr_consent" :required="true" id="newsletter_split_gdpr_consent" class="after:mix-blend-multiply">
<span class="text-sm text-left">Επιθυμώ διακαώς 🔥 να εγγραφώ στη λίστα αποστολής ενημερωτικού υλικού</span>
<span class="text-sm">Επιθυμώ διακαώς 🔥 να εγγραφώ στη λίστα αποστολής ενημερωτικού υλικού</span>
</x-ui.checkbox>
</form>
</div>
@@ -0,0 +1,13 @@
{{--
An order status as text, e.g. "Σε επεξεργασία". Translated through
storefront.order_status.{status}, falling back to Lunar's own (English)
label from config('lunar.orders.statuses') when that key doesn't exist.
--}}
@props(['status'])
@php
$key = "storefront.order_status.{$status}";
$label = Lang::has($key) ? __($key) : config("lunar.orders.statuses.{$status}.label", $status);
@endphp
<span {{ $attributes }}>{{ $label }}</span>
@@ -0,0 +1,88 @@
{{--
<x-product-custom-fields :fields="$product['custom_fields']" />
The product's custom fields (boboko-core's Product::$custom_fields), rendered
inside the add-to-cart <form> so their values travel with it as
custom_fields[key]. text → input, textarea → textarea, file → photo upload.
The label is styled like the product option labels (option-buttons /
color-swatch); the optional help_text shows under it. Help text is
product-page only; the cart/checkout line meta only snapshots the label.
A photo is uploaded as soon as it's picked (custom-field-upload-controller.js)
and only the resulting File row's id (boboko-core's Modules\Core\File\
Models\File) is submitted with the form — the file input itself has no
name. It still carries `required`, so the browser's own validation blocks
add-to-cart until a photo is picked, and the controller marks it invalid
(setCustomValidity) while the upload is in flight.
--}}
@props(['fields' => []])
@use('App\Http\Controllers\CustomFieldUploadController')
<div class="flex flex-col gap-6">
@foreach ($fields as $field)
@php
$id = 'custom-field-'.$field['key'];
$name = 'custom_fields['.$field['key'].']';
$required = (bool) ($field['required'] ?? false);
$hint = filled($field['help_text'] ?? null) ? $field['help_text'] : null;
// mb-1 on top of the field's gap-2 matches the option labels' mb-3;
// with a hint, the label + hint group carries that spacing instead.
$labelClass = 'font-bold text-sm uppercase tracking-wide'.($hint ? '' : ' mb-1');
$hintId = $hint ? $id.'-hint' : null;
@endphp
@switch($field['type'])
@case('textarea')
<x-ui.field :label="$field['label']" :label-class="$labelClass" :hint="$hint" :for="$id" :required="$required">
<x-ui.textarea :id="$id" :name="$name" :required="$required" :rows="4" maxlength="2000" :aria-describedby="$hintId" />
</x-ui.field>
@break
@case('file')
<x-ui.field
:label="$field['label']"
:label-class="$labelClass"
:hint="$hint"
:for="$id"
:required="$required"
:description="__('storefront.product.custom_field_photo_hint', ['size' => CustomFieldUploadController::MAX_KILOBYTES / 1024])"
data-controller="custom-field-upload"
data-custom-field-upload-url-value="{{ route('custom-field-upload.store') }}"
data-custom-field-upload-label-value="{{ $field['label'] }}"
data-custom-field-upload-uploading-message-value="{{ __('storefront.product.custom_field_uploading') }}"
data-custom-field-upload-failed-message-value="{{ __('storefront.product.custom_field_upload_failed') }}"
>
<input type="hidden" name="{{ $name }}" data-custom-field-upload-target="reference">
<x-ui.file-input
:id="$id"
:accept="CustomFieldUploadController::accept()"
:required="$required"
aria-describedby="{{ $hintId ? $hintId.' ' : '' }}{{ $id }}-description {{ $id }}-error"
data-custom-field-upload-target="file"
data-action="change->custom-field-upload#upload"
/>
<img
alt=""
width="96"
height="96"
hidden
class="w-24 h-24 object-cover border border-black"
data-custom-field-upload-target="preview"
data-action="error->custom-field-upload#hidePreview"
>
<p id="{{ $id }}-error" class="text-sm text-red-600" role="alert" hidden data-custom-field-upload-target="error"></p>
</x-ui.field>
@break
@default
<x-ui.field :label="$field['label']" :label-class="$labelClass" :hint="$hint" :for="$id" :required="$required">
<x-ui.input :id="$id" :name="$name" :required="$required" maxlength="255" :aria-describedby="$hintId" />
</x-ui.field>
@endswitch
@endforeach
</div>
@@ -24,6 +24,9 @@
:price="$product['price'] ?? null"
:image="$product['image'] ?? null"
:href="$product['href'] ?? '#'"
:variant-id="$product['variantId'] ?? null"
:has-custom-fields="$product['hasCustomFields'] ?? false"
:sold-out="$product['soldOut'] ?? false"
/>
@endforeach
</div>

Some files were not shown because too many files have changed in this diff Show More