Compare commits

..

14 Commits

Author SHA1 Message Date
Younes ENNAJI c70c8ed229 Update CHANGELOG for v2.5.2 2026-04-05 11:57:00 +01:00
Younes ENNAJI 0524277171 Bump version to 2.5.2 2026-04-05 11:55:06 +01:00
Younes ENNAJI 1eb31b16fe compile assets 2026-04-05 11:53:43 +01:00
Younes ENNAJI 80ab5377d1 upgrade dependencies 2026-04-05 11:53:34 +01:00
Younes ENNAJI af482133e7 Update CHANGELOG with Amazon theme title fix 2026-04-05 11:49:20 +01:00
Younes ENNAJI 51150186ba Build Amazon theme assets 2026-04-05 11:48:35 +01:00
Younes ENNAJI 191982f156 Fix Amazon theme to use dynamic title from envelope
The Amazon theme was ignoring the envelope's title property and always
displaying static hardcoded titles. Now uses the provided title with
fallback to Amazon-specific defaults for backward compatibility.
2026-04-05 11:48:25 +01:00
Younes ENNAJI dce8ed72d8 Update package-lock.json to v2.5.1 and enable prefer-lowest 2026-03-29 23:23:54 +01:00
Younes ENNAJI 881468ac26 Fix documentation issues: outdated CDN versions, LICENSE years, and broken links
- Update CDN references from @2.2.0 to @2.5.1 in docs/pages/javascript.md
- Fix LICENSE badge link in README.md to point to correct repo (php-flasher/php-flasher)
- Update copyright year to 2024-present across all 16 LICENSE files
- Fix docs/package.json version from 2.1.0 to 2.5.1
- Update sub-package READMEs to reference PHPFlasher ^2.5.1
- Add docs/package.json to bin/bump update targets
- Remove commented-out dead code in ResponseExtension.php
2026-03-29 23:07:04 +01:00
Younes ENNAJI 2bf87f7ae9 Remove unused paragonie/random_compat dependency and fix version bump script
- Remove paragonie/random_compat from composer.json require (PHP 5 polyfill, unnecessary on PHP 8.2+)
- Fix bin/bump to also update root package.json version (was only updating src/ files)
- Fix root package.json version from 2.1.5 to 2.5.1
2026-03-29 22:56:57 +01:00
Younes ENNAJI 58123f259c Release v2.5.1 2026-03-28 02:08:46 +01:00
Younes ENNAJI d427132437 Upgrade Laravel demo to Laravel 13 for JSON session testing
- Update PHP requirement to ^8.3
- Upgrade laravel/framework to ^13.0 and laravel/tinker to ^3.0
- Upgrade pestphp/pest to ^4.0 and pest-plugin-laravel to ^4.0
- Update spatie/laravel-csp to ^3.23 and barryvdh/laravel-debugbar to ^4.1
- Add session serialization config option (defaults to 'json')
- Add FlasherSessionTest to verify flasher works with JSON sessions
2026-03-28 02:05:14 +01:00
Younes ENNAJI f372dcf70e Fix Laravel 13 JSON session serialization compatibility 2026-03-28 01:52:00 +01:00
Younes ENNAJI c4f1b059a3 upgrade dependencies 2026-03-28 01:50:03 +01:00
67 changed files with 1830 additions and 1410 deletions
+14 -2
View File
@@ -1,8 +1,20 @@
# CHANGELOG for 2.x
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.2.0...2.x)
## [Unreleased](https://github.com/php-flasher/php-flasher/compare/v2.5.2...2.x)
## [v2.5.0](https://github.com/php-flasher/php-flasher/compare/v2.1.4...v2.2.0) - 2026-03-07
## [v2.5.2](https://github.com/php-flasher/php-flasher/compare/v2.5.1...v2.5.2) - 2026-04-05
### Fixed
* fix [Theme] Fix Amazon theme ignoring dynamic title from envelope and always displaying static hardcoded titles
## [v2.5.1](https://github.com/php-flasher/php-flasher/compare/v2.5.0...v2.5.1) - 2026-03-28
### Fixed
* fix [Laravel] Fix Laravel 13 JSON session serialization compatibility - StorageManager now handles both array and object formats returned by session
## [v2.5.0](https://github.com/php-flasher/php-flasher/compare/v2.1.4...v2.5.0) - 2026-03-07
### Added
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -22,7 +22,7 @@
<a href="https://github.com/php-flasher/php-flasher"><img src="https://img.shields.io/github/stars/php-flasher/php-flasher.svg?style=flat-square&label=stars" alt="Stars"></a>
<a href="https://github.com/php-flasher/php-flasher/releases"><img src="https://img.shields.io/github/v/release/php-flasher/flasher.svg?style=flat-square" alt="Release"></a>
<a href="https://packagist.org/packages/php-flasher/flasher"><img src="https://img.shields.io/packagist/php-v/php-flasher/flasher.svg?style=flat-square" alt="PHP Version"></a>
<a href="https://github.com/php-flasher/flasher/blob/master/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="License"></a>
<a href="https://github.com/php-flasher/php-flasher/blob/2.x/LICENSE"><img src="https://img.shields.io/badge/license-MIT-brightgreen.svg?style=flat-square" alt="License"></a>
</p>
<p align="center">
+10
View File
@@ -172,6 +172,16 @@ update_version() {
update_package_file "$file" "$current_version" "$new_version"
done
# Update root package.json
if [ -f "package.json" ]; then
update_package_file "package.json" "$current_version" "$new_version"
fi
# Update docs package.json
if [ -f "docs/package.json" ]; then
update_package_file "docs/package.json" "$current_version" "$new_version"
fi
echo -e "\n ${SUCCESS} Version bump complete!\n"
}
-1
View File
@@ -27,7 +27,6 @@
"illuminate/support": "^11.0|^12.0|^13.0",
"laravel/octane": "^2.3",
"livewire/livewire": "^3.0",
"paragonie/random_compat": "^2.0",
"psr/container": "^1.1|^2.0",
"symfony/config": "^7.0|^8.0",
"symfony/console": "^7.0|^8.0",
Generated
+11 -11
View File
@@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "75c6ad2f4921d2b29ebfc9c3e2a067be",
"content-hash": "bae119fc55afe5c607e35e693f3e8c59",
"packages": [
{
"name": "brick/math",
@@ -1535,16 +1535,16 @@
},
{
"name": "league/commonmark",
"version": "2.7.0",
"version": "2.8.2",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/commonmark.git",
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405"
"reference": "59fb075d2101740c337c7216e3f32b36c204218b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/6fbb36d44824ed4091adbcf4c7d4a3923cdb3405",
"reference": "6fbb36d44824ed4091adbcf4c7d4a3923cdb3405",
"url": "https://api.github.com/repos/thephpleague/commonmark/zipball/59fb075d2101740c337c7216e3f32b36c204218b",
"reference": "59fb075d2101740c337c7216e3f32b36c204218b",
"shasum": ""
},
"require": {
@@ -1569,11 +1569,11 @@
"phpstan/phpstan": "^1.8.2",
"phpunit/phpunit": "^9.5.21 || ^10.5.9 || ^11.0.0",
"scrutinizer/ocular": "^1.8.1",
"symfony/finder": "^5.3 | ^6.0 | ^7.0",
"symfony/process": "^5.4 | ^6.0 | ^7.0",
"symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0",
"symfony/finder": "^5.3 | ^6.0 | ^7.0 || ^8.0",
"symfony/process": "^5.4 | ^6.0 | ^7.0 || ^8.0",
"symfony/yaml": "^2.3 | ^3.0 | ^4.0 | ^5.0 | ^6.0 | ^7.0 || ^8.0",
"unleashedtech/php-coding-standard": "^3.1.1",
"vimeo/psalm": "^4.24.0 || ^5.0.0"
"vimeo/psalm": "^4.24.0 || ^5.0.0 || ^6.0.0"
},
"suggest": {
"symfony/yaml": "v2.3+ required if using the Front Matter extension"
@@ -1581,7 +1581,7 @@
"type": "library",
"extra": {
"branch-alias": {
"dev-main": "2.8-dev"
"dev-main": "2.9-dev"
}
},
"autoload": {
@@ -1638,7 +1638,7 @@
"type": "tidelift"
}
],
"time": "2025-05-05T12:20:28+00:00"
"time": "2026-03-19T13:16:38+00:00"
},
{
"name": "league/config",
+1 -1
View File
@@ -1 +1 @@
8.2
8.3
+7 -7
View File
@@ -14,25 +14,25 @@
}
],
"require": {
"php": "^8.2",
"php": "^8.3",
"inertiajs/inertia-laravel": "^2.0",
"laravel/framework": "^12.0",
"laravel/tinker": "^2.10",
"laravel/framework": "^13.0",
"laravel/tinker": "^3.0",
"livewire/livewire": "^3.6",
"php-flasher/php-flasher": "@dev",
"spatie/laravel-csp": "^2.10",
"spatie/laravel-csp": "^3.23",
"spatie/laravel-ray": "^1.40"
},
"require-dev": {
"barryvdh/laravel-debugbar": "^3.15",
"barryvdh/laravel-debugbar": "^4.1",
"fakerphp/faker": "^1.24",
"larastan/larastan": "^3.2",
"laravel/pint": "^1.21",
"laravel/sail": "^1.41",
"mockery/mockery": "^1.6",
"nunomaduro/collision": "^8.7",
"pestphp/pest": "^3.7",
"pestphp/pest-plugin-laravel": "^3.1",
"pestphp/pest": "^4.0",
"pestphp/pest-plugin-laravel": "^4.0",
"spatie/laravel-ignition": "^2.9",
"spatie/ray": "^1.41"
},
+1163 -1015
View File
File diff suppressed because it is too large Load Diff
+13
View File
@@ -49,6 +49,19 @@ return [
'encrypt' => env('SESSION_ENCRYPT', false),
/*
|--------------------------------------------------------------------------
| Session Serialization
|--------------------------------------------------------------------------
|
| This option determines how session data is serialized before being stored.
| The "json" driver is more secure and performant but cannot serialize
| PHP objects. The "php" driver uses PHP's native serialization.
|
*/
'serialization' => env('SESSION_SERIALIZATION', 'json'),
/*
|--------------------------------------------------------------------------
| Session File Location
@@ -0,0 +1,41 @@
<?php
it('stores and retrieves flash notifications with json serialization', function () {
// Trigger a flash notification
$this->get('/');
flash()->success('Test notification', ['title' => 'Success']);
// Make another request to retrieve from session
$response = $this->get('/');
$response->assertStatus(200);
});
it('handles multiple flash notifications across requests', function () {
flash()->success('First message');
flash()->error('Second message');
flash()->warning('Third message');
$response = $this->get('/');
$response->assertStatus(200);
});
it('preserves notification properties through json session roundtrip', function () {
flash()
->options(['position' => 'top-right', 'timeout' => 5000])
->success('Test message');
$response = $this->get('/');
$response->assertStatus(200);
});
it('works with different notification types', function () {
flash()->success('Success message');
flash()->error('Error message');
flash()->warning('Warning message');
flash()->info('Info message');
$response = $this->get('/');
$response->assertStatus(200);
});
+1 -1
View File
@@ -1 +1 @@
8.2
8.4
+6 -6
View File
@@ -1,6 +1,6 @@
{
"name": "@flasher/docs",
"version": "2.1.0",
"version": "2.5.2",
"license": "MIT",
"scripts": {
"build": "cross-env NODE_ENV=production encore production --progress",
@@ -13,11 +13,11 @@
"deploy": "JEKYLL_ENV=production bundle exec jekyll build"
},
"dependencies": {
"@flasher/flasher": "file:../src/Prime/Resources",
"@flasher/flasher-noty": "file:../src/Noty/Prime/Resources",
"@flasher/flasher-notyf": "file:../src/Notyf/Prime/Resources",
"@flasher/flasher-sweetalert": "file:../src/SweetAlert/Prime/Resources",
"@flasher/flasher-toastr": "file:../src/Toastr/Prime/Resources",
"@flasher/flasher": "^2.5.2",
"@flasher/flasher-noty": "^2.5.2",
"@flasher/flasher-notyf": "^2.5.2",
"@flasher/flasher-sweetalert": "^2.5.2",
"@flasher/flasher-toastr": "^2.5.2",
"@hotwired/stimulus": "^3.2.2",
"@symfony/stimulus-bridge": "^3.2.3",
"@symfony/webpack-encore": "^5.1.0",
+4 -4
View File
@@ -26,7 +26,7 @@ To pull in the <strong><span class="text-indigo-900">PHP<span class="text-indigo
</span>
```html
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@2.2.0/dist/flasher.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@2.5.1/dist/flasher.min.js"></script>
```
---
@@ -55,7 +55,7 @@ flasher.info("Welcome back");
or if you are using a cdn like this:
```html
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@2.2.0/dist/flasher.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@2.5.1/dist/flasher.min.js"></script>
<script>
flasher.error("Oops! Something went wrong!");
flasher.warning("Are you sure you want to proceed ?");
@@ -72,8 +72,8 @@ First grab the CDN for any js library adapter supported by <strong><span class="
and then call the `create()` method on flasher object :
```html
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@2.2.0/dist/flasher.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher-toastr@2.2.0/dist/flasher-toastr.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher@2.5.1/dist/flasher.min.js"></script>
<script defer src="https://cdn.jsdelivr.net/npm/@flasher/flasher-toastr@2.5.1/dist/flasher-toastr.min.js"></script>
<script>
const factory = flasher.use('toastr');
factory.error("Oops! Something went wrong!");
+334 -282
View File
File diff suppressed because it is too large Load Diff
+10 -10
View File
@@ -1,7 +1,7 @@
{
"name": "@flasher/php-flasher",
"type": "module",
"version": "2.1.5",
"version": "2.5.2",
"description": "A powerful and flexible flash notification system for PHP applications",
"license": "MIT",
"author": "Younes ENNAJI <younes.ennaji.pro@gmail.com>",
@@ -56,7 +56,7 @@
"@vitest/coverage-v8": "^3.2.4",
"@vitest/ui": "^3.2.4",
"@babel/core": "^7.29.0",
"@babel/preset-env": "^7.29.0",
"@babel/preset-env": "^7.29.2",
"@rollup/plugin-babel": "^6.1.0",
"@rollup/plugin-commonjs": "^28.0.9",
"@rollup/plugin-eslint": "^9.2.0",
@@ -64,15 +64,15 @@
"@rollup/plugin-strip": "^3.0.4",
"@rollup/plugin-terser": "^0.4.4",
"@rollup/plugin-typescript": "^12.3.0",
"@types/node": "^22.19.13",
"@types/node": "^22.19.17",
"@typescript-eslint/eslint-plugin": "^7.18.0",
"@typescript-eslint/parser": "^7.18.0",
"all-contributors-cli": "^6.26.1",
"autoprefixer": "^10.4.27",
"browserslist": "^4.28.1",
"browserslist": "^4.28.2",
"cross-env": "^7.0.3",
"cssnano": "^7.1.2",
"cssnano-preset-advanced": "^7.0.10",
"cssnano": "^7.1.4",
"cssnano-preset-advanced": "^7.0.12",
"eslint": "^8.57.1",
"eslint-config-airbnb-typescript": "^18.0.0",
"eslint-config-prettier": "^9.1.2",
@@ -80,18 +80,18 @@
"eslint-plugin-babel": "^5.3.1",
"eslint-plugin-import": "^2.32.0",
"eslint-plugin-prettier": "^5.5.5",
"postcss": "^8.5.6",
"postcss-discard-comments": "^7.0.5",
"postcss": "^8.5.8",
"postcss-discard-comments": "^7.0.6",
"punycode": "^2.3.1",
"rimraf": "^6.1.3",
"rollup": "^4.59.0",
"rollup": "^4.60.1",
"rollup-plugin-cleanup": "^3.2.1",
"rollup-plugin-clear": "^2.0.7",
"rollup-plugin-copy": "^3.5.0",
"rollup-plugin-filesize": "^10.0.0",
"rollup-plugin-postcss": "^4.0.2",
"rollup-plugin-progress": "^1.1.2",
"sass": "^1.97.3",
"sass": "^1.99.0",
"ts-node": "^10.9.2",
"tslib": "^2.8.1",
"typescript": "^5.9.3",
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+19 -3
View File
@@ -25,10 +25,26 @@ final readonly class SessionBag implements BagInterface
{
$session = $this->getSession();
/** @var Envelope[] $envelopes */
$envelopes = $session->get(self::ENVELOPES_NAMESPACE, []);
return $envelopes;
if (!\is_array($envelopes)) {
return [];
}
$result = [];
foreach ($envelopes as $envelope) {
if ($envelope instanceof Envelope) {
$result[] = $envelope;
} elseif (\is_string($envelope)) {
$unserialized = @unserialize($envelope);
if ($unserialized instanceof Envelope) {
$result[] = $unserialized;
}
}
// Arrays and invalid data silently skipped (graceful degradation)
}
return $result;
}
public function set(array $envelopes): void
@@ -41,7 +57,7 @@ final readonly class SessionBag implements BagInterface
return;
}
$session->put(self::ENVELOPES_NAMESPACE, $envelopes);
$session->put(self::ENVELOPES_NAMESPACE, array_map(serialize(...), $envelopes));
}
private function getSession(): Session|FallbackSessionInterface
+1 -1
View File
@@ -29,7 +29,7 @@
"require": {
"php": ">=8.2",
"illuminate/support": "^11.0|^12.0|^13.0",
"php-flasher/flasher": "^2.5.0"
"php-flasher/flasher": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -28,8 +28,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-laravel": "^2.5.0",
"php-flasher/flasher-noty": "^2.5.0"
"php-flasher/flasher-laravel": "^2.5.2",
"php-flasher/flasher-noty": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -9,7 +9,7 @@ Noty adapter for PHPFlasher. Feature-rich notification library with queue suppor
## Requirements
- PHP >= 8.2
- PHPFlasher ^2.4.0
- PHPFlasher ^2.5.1
## Installation
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@flasher/flasher-noty",
"version": "2.5.0",
"version": "2.5.2",
"type": "module",
"license": "MIT",
"main": "dist/flasher-noty.cjs.js",
@@ -11,7 +11,7 @@
"ncu": "ncu -u"
},
"peerDependencies": {
"@flasher/flasher": "^2.5.0",
"@flasher/flasher": "^2.5.2",
"noty": "^3.2.0-beta-deprecated"
}
}
+1 -1
View File
@@ -33,7 +33,7 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher": "^2.5.0"
"php-flasher/flasher": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -28,8 +28,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-noty": "^2.5.0",
"php-flasher/flasher-symfony": "^2.5.0"
"php-flasher/flasher-noty": "^2.5.2",
"php-flasher/flasher-symfony": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -29,8 +29,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-laravel": "^2.5.0",
"php-flasher/flasher-notyf": "^2.5.0"
"php-flasher/flasher-laravel": "^2.5.2",
"php-flasher/flasher-notyf": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -9,7 +9,7 @@ Notyf adapter for PHPFlasher. Lightweight and modern toast notifications.
## Requirements
- PHP >= 8.2
- PHPFlasher ^2.4.0
- PHPFlasher ^2.5.1
## Installation
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@flasher/flasher-notyf",
"version": "2.5.0",
"version": "2.5.2",
"type": "module",
"license": "MIT",
"main": "dist/flasher-notyf.cjs.js",
@@ -11,7 +11,7 @@
"ncu": "ncu -u"
},
"peerDependencies": {
"@flasher/flasher": "^2.5.0",
"@flasher/flasher": "^2.5.2",
"notyf": "^3.10.0"
}
}
+1 -1
View File
@@ -33,7 +33,7 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher": "^2.5.0"
"php-flasher/flasher": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -29,8 +29,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-notyf": "^2.5.0",
"php-flasher/flasher-symfony": "^2.5.0"
"php-flasher/flasher-notyf": "^2.5.2",
"php-flasher/flasher-symfony": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -18,7 +18,7 @@ final readonly class Flasher implements FlasherInterface
{
use ForwardsCalls;
public const VERSION = '2.5.0';
public const VERSION = '2.5.2';
public function __construct(
private string $default,
-1
View File
@@ -64,7 +64,6 @@ final readonly class ResponseExtension implements ResponseExtensionInterface
$htmlResponse = \sprintf('options.push(%s);', $htmlResponse);
}
// $htmlResponse = "\n".str_replace("\n", '', (string) $htmlResponse)."\n";
$htmlResponse .= "\n";
$content = substr($content, 0, $insertPosition).$htmlResponse.substr($content, $insertPosition);
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
@@ -13,9 +13,9 @@ const AMAZON_TITLES: Record<string, string> = {
export const amazonTheme = {
render: (envelope: Envelope): string => {
const { type, message } = envelope
const { type, message, title } = envelope
const alertTitle = AMAZON_TITLES[type] || DEFAULT_TITLES[type] || 'Alert'
const alertTitle = title || AMAZON_TITLES[type] || DEFAULT_TITLES[type] || 'Alert'
return `
<div class="${CLASS_NAMES.theme('amazon')} ${CLASS_NAMES.type(type)}" ${getA11yString(type)}>
File diff suppressed because one or more lines are too long
+2 -2
View File
@@ -87,8 +87,8 @@ const AMAZON_TITLES = {
};
const amazonTheme = {
render: (envelope) => {
const { type, message } = envelope;
const alertTitle = AMAZON_TITLES[type] || DEFAULT_TITLES[type] || 'Alert';
const { type, message, title } = envelope;
const alertTitle = title || AMAZON_TITLES[type] || DEFAULT_TITLES[type] || 'Alert';
return `
<div class="${CLASS_NAMES.theme('amazon')} ${CLASS_NAMES.type(type)}" ${getA11yString(type)}>
<div class="fl-amazon-alert">
+2 -2
View File
@@ -91,8 +91,8 @@
};
const amazonTheme = {
render: (envelope) => {
const { type, message } = envelope;
const alertTitle = AMAZON_TITLES[type] || DEFAULT_TITLES[type] || 'Alert';
const { type, message, title } = envelope;
const alertTitle = title || AMAZON_TITLES[type] || DEFAULT_TITLES[type] || 'Alert';
return `
<div class="${CLASS_NAMES.theme('amazon')} ${CLASS_NAMES.type(type)}" ${getA11yString(type)}>
<div class="fl-amazon-alert">
+1 -1
View File
@@ -1 +1 @@
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("@flasher/flasher")):"function"==typeof define&&define.amd?define(["@flasher/flasher"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).flasher)}(this,(function(n){"use strict";const e={sm:16,md:20,lg:24},s={success:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",error:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",warning:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"};function r(n,r={}){const{size:i="md",className:t=""}=r,a="number"==typeof i?i:e[i],o=s[n];if(!o)return"";return`<svg${t?` class="${t}"`:""} viewBox="0 0 24 24" width="${a}" height="${a}" aria-hidden="true"><path fill="currentColor" d="${o}"/></svg>`}const i="fl-close",t=n=>`fl-${n}`,a=n=>`fl-${n}`,o={success:"Success",error:"Error",warning:"Warning",info:"Information"},l={success:"Success!",error:"Problem",warning:"Warning",info:"Information"},c={render:n=>{const{type:e,message:s}=n,c=l[e]||o[e]||"Alert";return`\n <div class="${a("amazon")} ${t(e)}" ${function(n){const e=function(n){const e="error"===n||"warning"===n;return{role:e?"alert":"status",ariaLive:e?"assertive":"polite",ariaAtomic:"true"}}(n);return`role="${e.role}" aria-live="${e.ariaLive}" aria-atomic="${e.ariaAtomic}"`}(e)}>\n <div class="fl-amazon-alert">\n <div class="fl-alert-content">\n <div class="fl-icon-container">\n ${function(n,e={}){return"success"===n||"error"===n||"warning"===n||"info"===n?r(n,e):""}(e,{size:"lg"})}\n </div>\n <div class="fl-text-content">\n <div class="fl-alert-title">${c}</div>\n <div class="fl-alert-message">${s}</div>\n </div>\n </div>\n <div class="fl-alert-actions">\n <button class="${i}" ${function(n){return`aria-label="Close ${n} message"`}(e)}>\n ${function(n={}){return r("close",Object.assign({size:"sm"},n))}()}\n </button>\n </div>\n </div>\n </div>`}};n.addTheme("amazon",c)}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("@flasher/flasher")):"function"==typeof define&&define.amd?define(["@flasher/flasher"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).flasher)}(this,(function(e){"use strict";const n={sm:16,md:20,lg:24},s={success:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",error:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",warning:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"};function r(e,r={}){const{size:i="md",className:t=""}=r,a="number"==typeof i?i:n[i],o=s[e];if(!o)return"";return`<svg${t?` class="${t}"`:""} viewBox="0 0 24 24" width="${a}" height="${a}" aria-hidden="true"><path fill="currentColor" d="${o}"/></svg>`}const i="fl-close",t=e=>`fl-${e}`,a=e=>`fl-${e}`,o={success:"Success",error:"Error",warning:"Warning",info:"Information"},l={success:"Success!",error:"Problem",warning:"Warning",info:"Information"},c={render:e=>{const{type:n,message:s,title:c}=e,f=c||l[n]||o[n]||"Alert";return`\n <div class="${a("amazon")} ${t(n)}" ${function(e){const n=function(e){const n="error"===e||"warning"===e;return{role:n?"alert":"status",ariaLive:n?"assertive":"polite",ariaAtomic:"true"}}(e);return`role="${n.role}" aria-live="${n.ariaLive}" aria-atomic="${n.ariaAtomic}"`}(n)}>\n <div class="fl-amazon-alert">\n <div class="fl-alert-content">\n <div class="fl-icon-container">\n ${function(e,n={}){return"success"===e||"error"===e||"warning"===e||"info"===e?r(e,n):""}(n,{size:"lg"})}\n </div>\n <div class="fl-text-content">\n <div class="fl-alert-title">${f}</div>\n <div class="fl-alert-message">${s}</div>\n </div>\n </div>\n <div class="fl-alert-actions">\n <button class="${i}" ${function(e){return`aria-label="Close ${e} message"`}(n)}>\n ${function(e={}){return r("close",Object.assign({size:"sm"},e))}()}\n </button>\n </div>\n </div>\n </div>`}};e.addTheme("amazon",c)}));
+1 -1
View File
@@ -1 +1 @@
.fl-jade{--jade-text-light:#5f6c7b;--jade-text-dark:#e2e8f0;--jade-shadow:0 8px 24px hsla(210,8%,62%,.1);--jade-shadow-dark:0 8px 24px rgba(0,0,0,.2);--jade-border-radius:4px;--jade-transition:0.3s cubic-bezier(0.4,0,0.2,1);--jade-success-bg:#f0fdf4;--jade-success-color:#16a34a;--jade-info-bg:#eff6ff;--jade-info-color:#3b82f6;--jade-warning-bg:#fffbeb;--jade-warning-color:#f59e0b;--jade-error-bg:#fef2f2;--jade-error-color:#dc2626;--jade-success-bg-dark:rgba(22,163,74,.15);--jade-info-bg-dark:rgba(59,130,246,.15);--jade-warning-bg-dark:rgba(245,158,11,.15);--jade-error-bg-dark:rgba(220,38,38,.15)}@keyframes jadeIn{0%{opacity:0;transform:translateY(-10px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}.fl-jade{animation:jadeIn .4s var(--jade-transition);border:1px solid transparent;border-radius:var(--jade-border-radius) var(--jade-border-radius) 0 0;box-shadow:var(--jade-shadow);font-family:var(--fl-font),serif;margin:.5rem 0;overflow:hidden;padding:1rem 1.25rem;position:relative;will-change:transform,opacity}.fl-jade .fl-content{align-items:center;display:flex}.fl-jade .fl-message{flex:1;font-size:.875rem;font-weight:500;line-height:1.5;padding-right:.75rem}.fl-jade .fl-close{align-items:center;background:none;border:none;border-radius:50%;cursor:pointer;display:flex;flex-shrink:0;font-size:1.125rem;height:1.875rem;justify-content:center;opacity:.6;padding:.375rem;transition:all var(--jade-transition);width:1.875rem}.fl-jade .fl-close:focus,.fl-jade .fl-close:hover{background-color:rgba(0,0,0,.05);opacity:1}.fl-jade .fl-progress-bar{border-radius:0 0 var(--jade-border-radius) var(--jade-border-radius);bottom:0;height:3px;left:0;opacity:.7;overflow:hidden;position:absolute;right:0}.fl-jade .fl-progress-bar .fl-progress{height:100%;width:100%}.fl-jade.fl-success{background-color:var(--jade-success-bg);border-color:rgba(22,163,74,.1)}.fl-jade.fl-success,.fl-jade.fl-success .fl-close{color:var(--jade-success-color)}.fl-jade.fl-success .fl-close:focus,.fl-jade.fl-success .fl-close:hover{background-color:rgba(22,163,74,.1)}.fl-jade.fl-success .fl-progress-bar .fl-progress{background-color:var(--jade-success-color)}.fl-jade.fl-info{background-color:var(--jade-info-bg);border-color:rgba(59,130,246,.1)}.fl-jade.fl-info,.fl-jade.fl-info .fl-close{color:var(--jade-info-color)}.fl-jade.fl-info .fl-close:focus,.fl-jade.fl-info .fl-close:hover{background-color:rgba(59,130,246,.1)}.fl-jade.fl-info .fl-progress-bar .fl-progress{background-color:var(--jade-info-color)}.fl-jade.fl-warning{background-color:var(--jade-warning-bg);border-color:rgba(245,158,11,.1)}.fl-jade.fl-warning,.fl-jade.fl-warning .fl-close{color:var(--jade-warning-color)}.fl-jade.fl-warning .fl-close:focus,.fl-jade.fl-warning .fl-close:hover{background-color:rgba(245,158,11,.1)}.fl-jade.fl-warning .fl-progress-bar .fl-progress{background-color:var(--jade-warning-color)}.fl-jade.fl-error{background-color:var(--jade-error-bg);border-color:rgba(220,38,38,.1)}.fl-jade.fl-error,.fl-jade.fl-error .fl-close{color:var(--jade-error-color)}.fl-jade.fl-error .fl-close:focus,.fl-jade.fl-error .fl-close:hover{background-color:rgba(220,38,38,.1)}.fl-jade.fl-error .fl-progress-bar .fl-progress{background-color:var(--jade-error-color)}.fl-jade.fl-rtl{direction:rtl}.fl-jade.fl-rtl .fl-message{padding-left:.75rem;padding-right:0}.fl-jade.fl-rtl .fl-progress .fl-progress{transform-origin:right center}@media (prefers-reduced-motion:reduce){.fl-jade{animation:none}}.fl-jade.fl-auto-dark,body.fl-dark .fl-jade,html.fl-dark .fl-jade{box-shadow:var(--jade-shadow-dark);color:var(--jade-text-dark)}.fl-jade.fl-auto-dark.fl-success,body.fl-dark .fl-jade.fl-success,html.fl-dark .fl-jade.fl-success{background-color:var(--jade-success-bg-dark);border-color:rgba(22,163,74,.2)}.fl-jade.fl-auto-dark.fl-info,body.fl-dark .fl-jade.fl-info,html.fl-dark .fl-jade.fl-info{background-color:var(--jade-info-bg-dark);border-color:rgba(59,130,246,.2)}.fl-jade.fl-auto-dark.fl-warning,body.fl-dark .fl-jade.fl-warning,html.fl-dark .fl-jade.fl-warning{background-color:var(--jade-warning-bg-dark);border-color:rgba(245,158,11,.2)}.fl-jade.fl-auto-dark.fl-error,body.fl-dark .fl-jade.fl-error,html.fl-dark .fl-jade.fl-error{background-color:var(--jade-error-bg-dark);border-color:rgba(220,38,38,.2)}.fl-jade.fl-auto-dark .fl-close:focus,.fl-jade.fl-auto-dark .fl-close:hover,body.fl-dark .fl-jade .fl-close:focus,body.fl-dark .fl-jade .fl-close:hover,html.fl-dark .fl-jade .fl-close:focus,html.fl-dark .fl-jade .fl-close:hover{background-color:hsla(0,0%,100%,.1)}
.fl-jade{--jade-text-light:#5f6c7b;--jade-text-dark:#e2e8f0;--jade-shadow:0 8px 24px rgba(149,157,165,.1);--jade-shadow-dark:0 8px 24px rgba(0,0,0,.2);--jade-border-radius:4px;--jade-transition:0.3s cubic-bezier(0.4,0,0.2,1);--jade-success-bg:#f0fdf4;--jade-success-color:#16a34a;--jade-info-bg:#eff6ff;--jade-info-color:#3b82f6;--jade-warning-bg:#fffbeb;--jade-warning-color:#f59e0b;--jade-error-bg:#fef2f2;--jade-error-color:#dc2626;--jade-success-bg-dark:rgba(22,163,74,.15);--jade-info-bg-dark:rgba(59,130,246,.15);--jade-warning-bg-dark:rgba(245,158,11,.15);--jade-error-bg-dark:rgba(220,38,38,.15)}@keyframes jadeIn{0%{opacity:0;transform:translateY(-10px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}.fl-jade{animation:jadeIn .4s var(--jade-transition);border:1px solid transparent;border-radius:var(--jade-border-radius) var(--jade-border-radius) 0 0;box-shadow:var(--jade-shadow);font-family:var(--fl-font),serif;margin:.5rem 0;overflow:hidden;padding:1rem 1.25rem;position:relative;will-change:transform,opacity}.fl-jade .fl-content{align-items:center;display:flex}.fl-jade .fl-message{flex:1;font-size:.875rem;font-weight:500;line-height:1.5;padding-right:.75rem}.fl-jade .fl-close{align-items:center;background:none;border:none;border-radius:50%;cursor:pointer;display:flex;flex-shrink:0;font-size:1.125rem;height:1.875rem;justify-content:center;opacity:.6;padding:.375rem;transition:all var(--jade-transition);width:1.875rem}.fl-jade .fl-close:focus,.fl-jade .fl-close:hover{background-color:rgba(0,0,0,.05);opacity:1}.fl-jade .fl-progress-bar{border-radius:0 0 var(--jade-border-radius) var(--jade-border-radius);bottom:0;height:3px;left:0;opacity:.7;overflow:hidden;position:absolute;right:0}.fl-jade .fl-progress-bar .fl-progress{height:100%;width:100%}.fl-jade.fl-success{background-color:var(--jade-success-bg);border-color:rgba(22,163,74,.1)}.fl-jade.fl-success,.fl-jade.fl-success .fl-close{color:var(--jade-success-color)}.fl-jade.fl-success .fl-close:focus,.fl-jade.fl-success .fl-close:hover{background-color:rgba(22,163,74,.1)}.fl-jade.fl-success .fl-progress-bar .fl-progress{background-color:var(--jade-success-color)}.fl-jade.fl-info{background-color:var(--jade-info-bg);border-color:rgba(59,130,246,.1)}.fl-jade.fl-info,.fl-jade.fl-info .fl-close{color:var(--jade-info-color)}.fl-jade.fl-info .fl-close:focus,.fl-jade.fl-info .fl-close:hover{background-color:rgba(59,130,246,.1)}.fl-jade.fl-info .fl-progress-bar .fl-progress{background-color:var(--jade-info-color)}.fl-jade.fl-warning{background-color:var(--jade-warning-bg);border-color:rgba(245,158,11,.1)}.fl-jade.fl-warning,.fl-jade.fl-warning .fl-close{color:var(--jade-warning-color)}.fl-jade.fl-warning .fl-close:focus,.fl-jade.fl-warning .fl-close:hover{background-color:rgba(245,158,11,.1)}.fl-jade.fl-warning .fl-progress-bar .fl-progress{background-color:var(--jade-warning-color)}.fl-jade.fl-error{background-color:var(--jade-error-bg);border-color:rgba(220,38,38,.1)}.fl-jade.fl-error,.fl-jade.fl-error .fl-close{color:var(--jade-error-color)}.fl-jade.fl-error .fl-close:focus,.fl-jade.fl-error .fl-close:hover{background-color:rgba(220,38,38,.1)}.fl-jade.fl-error .fl-progress-bar .fl-progress{background-color:var(--jade-error-color)}.fl-jade.fl-rtl{direction:rtl}.fl-jade.fl-rtl .fl-message{padding-left:.75rem;padding-right:0}.fl-jade.fl-rtl .fl-progress .fl-progress{transform-origin:right center}@media (prefers-reduced-motion:reduce){.fl-jade{animation:none}}.fl-jade.fl-auto-dark,body.fl-dark .fl-jade,html.fl-dark .fl-jade{box-shadow:var(--jade-shadow-dark);color:var(--jade-text-dark)}.fl-jade.fl-auto-dark.fl-success,body.fl-dark .fl-jade.fl-success,html.fl-dark .fl-jade.fl-success{background-color:var(--jade-success-bg-dark);border-color:rgba(22,163,74,.2)}.fl-jade.fl-auto-dark.fl-info,body.fl-dark .fl-jade.fl-info,html.fl-dark .fl-jade.fl-info{background-color:var(--jade-info-bg-dark);border-color:rgba(59,130,246,.2)}.fl-jade.fl-auto-dark.fl-warning,body.fl-dark .fl-jade.fl-warning,html.fl-dark .fl-jade.fl-warning{background-color:var(--jade-warning-bg-dark);border-color:rgba(245,158,11,.2)}.fl-jade.fl-auto-dark.fl-error,body.fl-dark .fl-jade.fl-error,html.fl-dark .fl-jade.fl-error{background-color:var(--jade-error-bg-dark);border-color:rgba(220,38,38,.2)}.fl-jade.fl-auto-dark .fl-close:focus,.fl-jade.fl-auto-dark .fl-close:hover,body.fl-dark .fl-jade .fl-close:focus,body.fl-dark .fl-jade .fl-close:hover,html.fl-dark .fl-jade .fl-close:focus,html.fl-dark .fl-jade .fl-close:hover{background-color:hsla(0,0%,100%,.1)}
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@flasher/flasher",
"version": "2.5.0",
"version": "2.5.2",
"type": "module",
"license": "MIT",
"main": "dist/flasher.cjs.js",
File diff suppressed because one or more lines are too long
+1 -1
View File
@@ -1 +1 @@
!function(n,e){"object"==typeof exports&&"undefined"!=typeof module?e(require("@flasher/flasher")):"function"==typeof define&&define.amd?define(["@flasher/flasher"],e):e((n="undefined"!=typeof globalThis?globalThis:n||self).flasher)}(this,(function(n){"use strict";const e={sm:16,md:20,lg:24},s={success:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",error:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",warning:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"};function r(n,r={}){const{size:i="md",className:t=""}=r,a="number"==typeof i?i:e[i],o=s[n];if(!o)return"";return`<svg${t?` class="${t}"`:""} viewBox="0 0 24 24" width="${a}" height="${a}" aria-hidden="true"><path fill="currentColor" d="${o}"/></svg>`}const i="fl-close",t=n=>`fl-${n}`,a=n=>`fl-${n}`,o={success:"Success",error:"Error",warning:"Warning",info:"Information"},l={success:"Success!",error:"Problem",warning:"Warning",info:"Information"},c={render:n=>{const{type:e,message:s}=n,c=l[e]||o[e]||"Alert";return`\n <div class="${a("amazon")} ${t(e)}" ${function(n){const e=function(n){const e="error"===n||"warning"===n;return{role:e?"alert":"status",ariaLive:e?"assertive":"polite",ariaAtomic:"true"}}(n);return`role="${e.role}" aria-live="${e.ariaLive}" aria-atomic="${e.ariaAtomic}"`}(e)}>\n <div class="fl-amazon-alert">\n <div class="fl-alert-content">\n <div class="fl-icon-container">\n ${function(n,e={}){return"success"===n||"error"===n||"warning"===n||"info"===n?r(n,e):""}(e,{size:"lg"})}\n </div>\n <div class="fl-text-content">\n <div class="fl-alert-title">${c}</div>\n <div class="fl-alert-message">${s}</div>\n </div>\n </div>\n <div class="fl-alert-actions">\n <button class="${i}" ${function(n){return`aria-label="Close ${n} message"`}(e)}>\n ${function(n={}){return r("close",Object.assign({size:"sm"},n))}()}\n </button>\n </div>\n </div>\n </div>`}};n.addTheme("amazon",c)}));
!function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(require("@flasher/flasher")):"function"==typeof define&&define.amd?define(["@flasher/flasher"],n):n((e="undefined"!=typeof globalThis?globalThis:e||self).flasher)}(this,(function(e){"use strict";const n={sm:16,md:20,lg:24},s={success:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15l-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z",error:"M12 2C6.47 2 2 6.47 2 12s4.47 10 10 10 10-4.47 10-10S17.53 2 12 2zm5 13.59L15.59 17 12 13.41 8.41 17 7 15.59 10.59 12 7 8.41 8.41 7 12 10.59 15.59 7 17 8.41 13.41 12 17 15.59z",warning:"M12 5.99L19.53 19H4.47L12 5.99M12 2L1 21h22L12 2zm1 14h-2v2h2v-2zm0-6h-2v4h2v-4z",info:"M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-6h2v6zm0-8h-2V7h2v2z",close:"M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z"};function r(e,r={}){const{size:i="md",className:t=""}=r,a="number"==typeof i?i:n[i],o=s[e];if(!o)return"";return`<svg${t?` class="${t}"`:""} viewBox="0 0 24 24" width="${a}" height="${a}" aria-hidden="true"><path fill="currentColor" d="${o}"/></svg>`}const i="fl-close",t=e=>`fl-${e}`,a=e=>`fl-${e}`,o={success:"Success",error:"Error",warning:"Warning",info:"Information"},l={success:"Success!",error:"Problem",warning:"Warning",info:"Information"},c={render:e=>{const{type:n,message:s,title:c}=e,f=c||l[n]||o[n]||"Alert";return`\n <div class="${a("amazon")} ${t(n)}" ${function(e){const n=function(e){const n="error"===e||"warning"===e;return{role:n?"alert":"status",ariaLive:n?"assertive":"polite",ariaAtomic:"true"}}(e);return`role="${n.role}" aria-live="${n.ariaLive}" aria-atomic="${n.ariaAtomic}"`}(n)}>\n <div class="fl-amazon-alert">\n <div class="fl-alert-content">\n <div class="fl-icon-container">\n ${function(e,n={}){return"success"===e||"error"===e||"warning"===e||"info"===e?r(e,n):""}(n,{size:"lg"})}\n </div>\n <div class="fl-text-content">\n <div class="fl-alert-title">${f}</div>\n <div class="fl-alert-message">${s}</div>\n </div>\n </div>\n <div class="fl-alert-actions">\n <button class="${i}" ${function(e){return`aria-label="Close ${e} message"`}(n)}>\n ${function(e={}){return r("close",Object.assign({size:"sm"},e))}()}\n </button>\n </div>\n </div>\n </div>`}};e.addTheme("amazon",c)}));
+1 -1
View File
@@ -1 +1 @@
.fl-jade{--jade-text-light:#5f6c7b;--jade-text-dark:#e2e8f0;--jade-shadow:0 8px 24px hsla(210,8%,62%,.1);--jade-shadow-dark:0 8px 24px rgba(0,0,0,.2);--jade-border-radius:4px;--jade-transition:0.3s cubic-bezier(0.4,0,0.2,1);--jade-success-bg:#f0fdf4;--jade-success-color:#16a34a;--jade-info-bg:#eff6ff;--jade-info-color:#3b82f6;--jade-warning-bg:#fffbeb;--jade-warning-color:#f59e0b;--jade-error-bg:#fef2f2;--jade-error-color:#dc2626;--jade-success-bg-dark:rgba(22,163,74,.15);--jade-info-bg-dark:rgba(59,130,246,.15);--jade-warning-bg-dark:rgba(245,158,11,.15);--jade-error-bg-dark:rgba(220,38,38,.15)}@keyframes jadeIn{0%{opacity:0;transform:translateY(-10px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}.fl-jade{animation:jadeIn .4s var(--jade-transition);border:1px solid transparent;border-radius:var(--jade-border-radius) var(--jade-border-radius) 0 0;box-shadow:var(--jade-shadow);font-family:var(--fl-font),serif;margin:.5rem 0;overflow:hidden;padding:1rem 1.25rem;position:relative;will-change:transform,opacity}.fl-jade .fl-content{align-items:center;display:flex}.fl-jade .fl-message{flex:1;font-size:.875rem;font-weight:500;line-height:1.5;padding-right:.75rem}.fl-jade .fl-close{align-items:center;background:none;border:none;border-radius:50%;cursor:pointer;display:flex;flex-shrink:0;font-size:1.125rem;height:1.875rem;justify-content:center;opacity:.6;padding:.375rem;transition:all var(--jade-transition);width:1.875rem}.fl-jade .fl-close:focus,.fl-jade .fl-close:hover{background-color:rgba(0,0,0,.05);opacity:1}.fl-jade .fl-progress-bar{border-radius:0 0 var(--jade-border-radius) var(--jade-border-radius);bottom:0;height:3px;left:0;opacity:.7;overflow:hidden;position:absolute;right:0}.fl-jade .fl-progress-bar .fl-progress{height:100%;width:100%}.fl-jade.fl-success{background-color:var(--jade-success-bg);border-color:rgba(22,163,74,.1)}.fl-jade.fl-success,.fl-jade.fl-success .fl-close{color:var(--jade-success-color)}.fl-jade.fl-success .fl-close:focus,.fl-jade.fl-success .fl-close:hover{background-color:rgba(22,163,74,.1)}.fl-jade.fl-success .fl-progress-bar .fl-progress{background-color:var(--jade-success-color)}.fl-jade.fl-info{background-color:var(--jade-info-bg);border-color:rgba(59,130,246,.1)}.fl-jade.fl-info,.fl-jade.fl-info .fl-close{color:var(--jade-info-color)}.fl-jade.fl-info .fl-close:focus,.fl-jade.fl-info .fl-close:hover{background-color:rgba(59,130,246,.1)}.fl-jade.fl-info .fl-progress-bar .fl-progress{background-color:var(--jade-info-color)}.fl-jade.fl-warning{background-color:var(--jade-warning-bg);border-color:rgba(245,158,11,.1)}.fl-jade.fl-warning,.fl-jade.fl-warning .fl-close{color:var(--jade-warning-color)}.fl-jade.fl-warning .fl-close:focus,.fl-jade.fl-warning .fl-close:hover{background-color:rgba(245,158,11,.1)}.fl-jade.fl-warning .fl-progress-bar .fl-progress{background-color:var(--jade-warning-color)}.fl-jade.fl-error{background-color:var(--jade-error-bg);border-color:rgba(220,38,38,.1)}.fl-jade.fl-error,.fl-jade.fl-error .fl-close{color:var(--jade-error-color)}.fl-jade.fl-error .fl-close:focus,.fl-jade.fl-error .fl-close:hover{background-color:rgba(220,38,38,.1)}.fl-jade.fl-error .fl-progress-bar .fl-progress{background-color:var(--jade-error-color)}.fl-jade.fl-rtl{direction:rtl}.fl-jade.fl-rtl .fl-message{padding-left:.75rem;padding-right:0}.fl-jade.fl-rtl .fl-progress .fl-progress{transform-origin:right center}@media (prefers-reduced-motion:reduce){.fl-jade{animation:none}}.fl-jade.fl-auto-dark,body.fl-dark .fl-jade,html.fl-dark .fl-jade{box-shadow:var(--jade-shadow-dark);color:var(--jade-text-dark)}.fl-jade.fl-auto-dark.fl-success,body.fl-dark .fl-jade.fl-success,html.fl-dark .fl-jade.fl-success{background-color:var(--jade-success-bg-dark);border-color:rgba(22,163,74,.2)}.fl-jade.fl-auto-dark.fl-info,body.fl-dark .fl-jade.fl-info,html.fl-dark .fl-jade.fl-info{background-color:var(--jade-info-bg-dark);border-color:rgba(59,130,246,.2)}.fl-jade.fl-auto-dark.fl-warning,body.fl-dark .fl-jade.fl-warning,html.fl-dark .fl-jade.fl-warning{background-color:var(--jade-warning-bg-dark);border-color:rgba(245,158,11,.2)}.fl-jade.fl-auto-dark.fl-error,body.fl-dark .fl-jade.fl-error,html.fl-dark .fl-jade.fl-error{background-color:var(--jade-error-bg-dark);border-color:rgba(220,38,38,.2)}.fl-jade.fl-auto-dark .fl-close:focus,.fl-jade.fl-auto-dark .fl-close:hover,body.fl-dark .fl-jade .fl-close:focus,body.fl-dark .fl-jade .fl-close:hover,html.fl-dark .fl-jade .fl-close:focus,html.fl-dark .fl-jade .fl-close:hover{background-color:hsla(0,0%,100%,.1)}
.fl-jade{--jade-text-light:#5f6c7b;--jade-text-dark:#e2e8f0;--jade-shadow:0 8px 24px rgba(149,157,165,.1);--jade-shadow-dark:0 8px 24px rgba(0,0,0,.2);--jade-border-radius:4px;--jade-transition:0.3s cubic-bezier(0.4,0,0.2,1);--jade-success-bg:#f0fdf4;--jade-success-color:#16a34a;--jade-info-bg:#eff6ff;--jade-info-color:#3b82f6;--jade-warning-bg:#fffbeb;--jade-warning-color:#f59e0b;--jade-error-bg:#fef2f2;--jade-error-color:#dc2626;--jade-success-bg-dark:rgba(22,163,74,.15);--jade-info-bg-dark:rgba(59,130,246,.15);--jade-warning-bg-dark:rgba(245,158,11,.15);--jade-error-bg-dark:rgba(220,38,38,.15)}@keyframes jadeIn{0%{opacity:0;transform:translateY(-10px) scale(.95)}to{opacity:1;transform:translateY(0) scale(1)}}.fl-jade{animation:jadeIn .4s var(--jade-transition);border:1px solid transparent;border-radius:var(--jade-border-radius) var(--jade-border-radius) 0 0;box-shadow:var(--jade-shadow);font-family:var(--fl-font),serif;margin:.5rem 0;overflow:hidden;padding:1rem 1.25rem;position:relative;will-change:transform,opacity}.fl-jade .fl-content{align-items:center;display:flex}.fl-jade .fl-message{flex:1;font-size:.875rem;font-weight:500;line-height:1.5;padding-right:.75rem}.fl-jade .fl-close{align-items:center;background:none;border:none;border-radius:50%;cursor:pointer;display:flex;flex-shrink:0;font-size:1.125rem;height:1.875rem;justify-content:center;opacity:.6;padding:.375rem;transition:all var(--jade-transition);width:1.875rem}.fl-jade .fl-close:focus,.fl-jade .fl-close:hover{background-color:rgba(0,0,0,.05);opacity:1}.fl-jade .fl-progress-bar{border-radius:0 0 var(--jade-border-radius) var(--jade-border-radius);bottom:0;height:3px;left:0;opacity:.7;overflow:hidden;position:absolute;right:0}.fl-jade .fl-progress-bar .fl-progress{height:100%;width:100%}.fl-jade.fl-success{background-color:var(--jade-success-bg);border-color:rgba(22,163,74,.1)}.fl-jade.fl-success,.fl-jade.fl-success .fl-close{color:var(--jade-success-color)}.fl-jade.fl-success .fl-close:focus,.fl-jade.fl-success .fl-close:hover{background-color:rgba(22,163,74,.1)}.fl-jade.fl-success .fl-progress-bar .fl-progress{background-color:var(--jade-success-color)}.fl-jade.fl-info{background-color:var(--jade-info-bg);border-color:rgba(59,130,246,.1)}.fl-jade.fl-info,.fl-jade.fl-info .fl-close{color:var(--jade-info-color)}.fl-jade.fl-info .fl-close:focus,.fl-jade.fl-info .fl-close:hover{background-color:rgba(59,130,246,.1)}.fl-jade.fl-info .fl-progress-bar .fl-progress{background-color:var(--jade-info-color)}.fl-jade.fl-warning{background-color:var(--jade-warning-bg);border-color:rgba(245,158,11,.1)}.fl-jade.fl-warning,.fl-jade.fl-warning .fl-close{color:var(--jade-warning-color)}.fl-jade.fl-warning .fl-close:focus,.fl-jade.fl-warning .fl-close:hover{background-color:rgba(245,158,11,.1)}.fl-jade.fl-warning .fl-progress-bar .fl-progress{background-color:var(--jade-warning-color)}.fl-jade.fl-error{background-color:var(--jade-error-bg);border-color:rgba(220,38,38,.1)}.fl-jade.fl-error,.fl-jade.fl-error .fl-close{color:var(--jade-error-color)}.fl-jade.fl-error .fl-close:focus,.fl-jade.fl-error .fl-close:hover{background-color:rgba(220,38,38,.1)}.fl-jade.fl-error .fl-progress-bar .fl-progress{background-color:var(--jade-error-color)}.fl-jade.fl-rtl{direction:rtl}.fl-jade.fl-rtl .fl-message{padding-left:.75rem;padding-right:0}.fl-jade.fl-rtl .fl-progress .fl-progress{transform-origin:right center}@media (prefers-reduced-motion:reduce){.fl-jade{animation:none}}.fl-jade.fl-auto-dark,body.fl-dark .fl-jade,html.fl-dark .fl-jade{box-shadow:var(--jade-shadow-dark);color:var(--jade-text-dark)}.fl-jade.fl-auto-dark.fl-success,body.fl-dark .fl-jade.fl-success,html.fl-dark .fl-jade.fl-success{background-color:var(--jade-success-bg-dark);border-color:rgba(22,163,74,.2)}.fl-jade.fl-auto-dark.fl-info,body.fl-dark .fl-jade.fl-info,html.fl-dark .fl-jade.fl-info{background-color:var(--jade-info-bg-dark);border-color:rgba(59,130,246,.2)}.fl-jade.fl-auto-dark.fl-warning,body.fl-dark .fl-jade.fl-warning,html.fl-dark .fl-jade.fl-warning{background-color:var(--jade-warning-bg-dark);border-color:rgba(245,158,11,.2)}.fl-jade.fl-auto-dark.fl-error,body.fl-dark .fl-jade.fl-error,html.fl-dark .fl-jade.fl-error{background-color:var(--jade-error-bg-dark);border-color:rgba(220,38,38,.2)}.fl-jade.fl-auto-dark .fl-close:focus,.fl-jade.fl-auto-dark .fl-close:hover,body.fl-dark .fl-jade .fl-close:focus,body.fl-dark .fl-jade .fl-close:hover,html.fl-dark .fl-jade .fl-close:focus,html.fl-dark .fl-jade .fl-close:hover{background-color:hsla(0,0%,100%,.1)}
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -30,8 +30,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-laravel": "^2.5.0",
"php-flasher/flasher-sweetalert": "^2.5.0"
"php-flasher/flasher-laravel": "^2.5.2",
"php-flasher/flasher-sweetalert": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -9,7 +9,7 @@ SweetAlert2 adapter for PHPFlasher. Beautiful alert dialogs with modal and toast
## Requirements
- PHP >= 8.2
- PHPFlasher ^2.4.0
- PHPFlasher ^2.5.1
## Installation
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@flasher/flasher-sweetalert",
"version": "2.5.0",
"version": "2.5.2",
"type": "module",
"license": "MIT",
"main": "dist/flasher-sweetalert.cjs.js",
@@ -11,7 +11,7 @@
"ncu": "ncu -u"
},
"peerDependencies": {
"@flasher/flasher": "^2.5.0",
"@flasher/flasher": "^2.5.2",
"sweetalert2": "^11.6.13"
}
}
+1 -1
View File
@@ -33,7 +33,7 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher": "^2.5.0"
"php-flasher/flasher": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -30,8 +30,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-sweetalert": "^2.5.0",
"php-flasher/flasher-symfony": "^2.5.0"
"php-flasher/flasher-sweetalert": "^2.5.2",
"php-flasher/flasher-symfony": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -28,7 +28,7 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher": "^2.5.0",
"php-flasher/flasher": "^2.5.2",
"symfony/config": "^7.0|^8.0",
"symfony/console": "^7.0|^8.0",
"symfony/dependency-injection": "^7.0|^8.0",
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -29,8 +29,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-laravel": "^2.5.0",
"php-flasher/flasher-toastr": "^2.5.0"
"php-flasher/flasher-laravel": "^2.5.2",
"php-flasher/flasher-toastr": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+1 -1
View File
@@ -9,7 +9,7 @@ Toastr adapter for PHPFlasher. Elegant toast notifications with full TypeScript
## Requirements
- PHP >= 8.2
- PHPFlasher ^2.4.0
- PHPFlasher ^2.5.1
## Installation
+2 -2
View File
@@ -1,6 +1,6 @@
{
"name": "@flasher/flasher-toastr",
"version": "2.5.0",
"version": "2.5.2",
"type": "module",
"license": "MIT",
"main": "dist/flasher-toastr.cjs.js",
@@ -11,7 +11,7 @@
"ncu": "ncu -u"
},
"peerDependencies": {
"@flasher/flasher": "^2.5.0",
"@flasher/flasher": "^2.5.2",
"toastr": "^2.1.4"
},
"devDependencies": {
+1 -1
View File
@@ -33,7 +33,7 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher": "^2.5.0"
"php-flasher/flasher": "^2.5.2"
},
"autoload": {
"psr-4": {
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2024 PHPFlasher
Copyright (c) 2024-present PHPFlasher
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
+2 -2
View File
@@ -29,8 +29,8 @@
"prefer-stable": true,
"require": {
"php": ">=8.2",
"php-flasher/flasher-symfony": "^2.5.0",
"php-flasher/flasher-toastr": "^2.5.0"
"php-flasher/flasher-symfony": "^2.5.2",
"php-flasher/flasher-toastr": "^2.5.2"
},
"autoload": {
"psr-4": {
+131 -1
View File
@@ -9,6 +9,8 @@ use Flasher\Laravel\Storage\FallbackSessionInterface;
use Flasher\Laravel\Storage\SessionBag;
use Flasher\Prime\Notification\Envelope;
use Flasher\Prime\Notification\Notification;
use Flasher\Prime\Stamp\DelayStamp;
use Flasher\Prime\Stamp\HopsStamp;
use Flasher\Prime\Stamp\IdStamp;
use Flasher\Tests\Laravel\TestCase;
use Illuminate\Session\SessionManager;
@@ -65,7 +67,7 @@ final class SessionBagTest extends TestCase
$sessionMock = \Mockery::mock(Store::class);
$sessionMock->allows()->isStarted()->andReturns(true);
$sessionMock->allows()->get(SessionBag::ENVELOPES_NAMESPACE, [])->andReturns($envelopes);
$sessionMock->expects()->put(SessionBag::ENVELOPES_NAMESPACE, $envelopes);
$sessionMock->expects()->put(SessionBag::ENVELOPES_NAMESPACE, array_map(serialize(...), $envelopes));
$this->sessionManagerMock->allows()->driver()->andReturns($sessionMock);
@@ -193,4 +195,132 @@ final class SessionBagTest extends TestCase
$this->assertSame($envelopes2, $this->sessionBag->get());
}
public function testEnvelopeSurvivesJsonSerializationRoundTrip(): void
{
$notification = new Notification();
$notification->setType('success');
$notification->setMessage('Operation completed');
$original = new Envelope($notification, [
new IdStamp('json-test-id'),
new HopsStamp(2),
new DelayStamp(500),
]);
$sessionMock = \Mockery::mock(Store::class);
$sessionMock->allows()->isStarted()->andReturns(true);
$captured = null;
$sessionMock->expects('put')->with(SessionBag::ENVELOPES_NAMESPACE, \Mockery::on(function ($value) use (&$captured) {
$captured = $value;
return true;
}));
$this->sessionManagerMock->allows()->driver()->andReturns($sessionMock);
$this->sessionBag->set([$original]);
$jsonEncoded = json_encode($captured, \JSON_THROW_ON_ERROR);
$jsonDecoded = json_decode($jsonEncoded, true, 512, \JSON_THROW_ON_ERROR);
$sessionMock->allows()->get(SessionBag::ENVELOPES_NAMESPACE, [])->andReturns($jsonDecoded);
$restored = $this->sessionBag->get();
$this->assertCount(1, $restored);
$this->assertInstanceOf(Envelope::class, $restored[0]);
$this->assertSame('success', $restored[0]->getType());
$this->assertSame('Operation completed', $restored[0]->getMessage());
$this->assertSame('json-test-id', $restored[0]->get(IdStamp::class)->getId());
$this->assertSame(2, $restored[0]->get(HopsStamp::class)->getAmount());
$this->assertSame(500, $restored[0]->get(DelayStamp::class)->getDelay());
}
public function testGetHandlesEnvelopeObjectsForBackwardCompatibility(): void
{
$envelopes = [
new Envelope(new Notification(), new IdStamp('legacy')),
];
$envelopes[0]->setType('info');
$envelopes[0]->setMessage('Old session');
$sessionMock = \Mockery::mock(Store::class);
$sessionMock->expects()->isStarted()->andReturns(true);
$sessionMock->expects()->get(SessionBag::ENVELOPES_NAMESPACE, [])->andReturns($envelopes);
$this->sessionManagerMock->expects()->driver()->andReturns($sessionMock);
$result = $this->sessionBag->get();
$this->assertSame($envelopes, $result);
}
public function testGetSkipsCorruptedArrayData(): void
{
$sessionMock = \Mockery::mock(Store::class);
$sessionMock->expects()->isStarted()->andReturns(true);
$sessionMock->expects()->get(SessionBag::ENVELOPES_NAMESPACE, [])->andReturns([
['title' => '', 'message' => '', 'type' => 'success', 'options' => [], 'metadata' => ['id' => 'corrupted']],
]);
$this->sessionManagerMock->expects()->driver()->andReturns($sessionMock);
$result = $this->sessionBag->get();
$this->assertSame([], $result);
}
public function testGetSkipsInvalidSerializedStrings(): void
{
$sessionMock = \Mockery::mock(Store::class);
$sessionMock->expects()->isStarted()->andReturns(true);
$sessionMock->expects()->get(SessionBag::ENVELOPES_NAMESPACE, [])->andReturns([
'invalid-not-serialized-data',
'O:8:"stdClass":0:{}', // Valid serialized object but wrong type
serialize(new Envelope(new Notification(), new IdStamp('valid'))),
]);
$this->sessionManagerMock->expects()->driver()->andReturns($sessionMock);
$result = $this->sessionBag->get();
$this->assertCount(1, $result);
$this->assertInstanceOf(Envelope::class, $result[0]);
$this->assertSame('valid', $result[0]->get(IdStamp::class)->getId());
}
public function testPreservesAllStampsAcrossRoundTrip(): void
{
$notification = new Notification();
$notification->setType('warning');
$notification->setMessage('Multi-stamp');
$original = new Envelope($notification, [
new IdStamp('stamp-test'),
new HopsStamp(3),
new DelayStamp(1000),
]);
$serialized = serialize($original);
$jsonEncoded = json_encode([$serialized], \JSON_THROW_ON_ERROR);
$jsonDecoded = json_decode($jsonEncoded, true, 512, \JSON_THROW_ON_ERROR);
$sessionMock = \Mockery::mock(Store::class);
$sessionMock->expects()->isStarted()->andReturns(true);
$sessionMock->expects()->get(SessionBag::ENVELOPES_NAMESPACE, [])->andReturns($jsonDecoded);
$this->sessionManagerMock->expects()->driver()->andReturns($sessionMock);
$restored = $this->sessionBag->get();
$this->assertCount(1, $restored);
$this->assertInstanceOf(Envelope::class, $restored[0]);
$this->assertSame('warning', $restored[0]->getType());
$this->assertSame('Multi-stamp', $restored[0]->getMessage());
$this->assertSame('stamp-test', $restored[0]->get(IdStamp::class)->getId());
$this->assertSame(3, $restored[0]->get(HopsStamp::class)->getAmount());
$this->assertSame(1000, $restored[0]->get(DelayStamp::class)->getDelay());
}
}