Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 3 additions & 11 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,9 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest]
php: [8.3, 8.4]
laravel: [11.*, 12.*]
php: [8.5]
dependency-version: [prefer-stable]
exclude:
- php: 8.1
laravel: 11.*
- php: 8.1
laravel: 12.*
- php: 8.4
laravel: 10.*
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }} - ubuntu-latest
name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
Expand All @@ -29,7 +21,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/.composer/cache/files
key: dependencies-laravel-${{ matrix.laravel }}-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
key: dependencies-php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
/composer.lock
/yarn.lock
/package-lock.json
/.phpunit.cache
/.phpunit.result.cache
12 changes: 4 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,25 +1,21 @@
{
"name": "transformstudios/front",
"require": {
"php": "^8.3",
"php": "^8.5",
"pixelfear/composer-dist-plugin": "^0.1.4",
"statamic/cms": "^5.0 || ^6.0",
"stillat/proteus": "^4.0"
"statamic/cms": "^6.0"
},
"require-dev": {
"mockery/mockery": "^1.3.1",
"nunomaduro/collision": "^8.1",
"orchestra/testbench": "^9.0 || ^10",
"orchestra/testbench": "^10.0",
"spatie/laravel-ray": "^1.24",
"pestphp/pest": "^4.1"
},
"autoload": {
"psr-4": {
"TransformStudios\\Front\\": "src"
},
"files": [
"src/helpers.php"
]
}
},
"autoload-dev": {
"psr-4": {
Expand Down
8 changes: 0 additions & 8 deletions config/front.php
Original file line number Diff line number Diff line change
@@ -1,18 +1,10 @@
<?php

return [
'api_token' => env('FRONT_API_TOKEN'),
'secret_key' => env('FRONT_SECRET_KEY'),
'chat' => [
'id' => env('FRONT_CHAT_ID'),
'show_on_control_panel' => env('FRONT_SHOW_ON_CONTROL_PANEL', true),
'show_on_front_end' => env('FRONT_SHOW_ON_FRONT_END', false),
],
'logging' => [
'conversation_id' => env('FRONT_CONVERSATION_ID'),
'level' => env('FRONT_LOGGING_LEVEL', 'error'),
],
'notifications' => [
'channel' => env('FRONT_CHANNEL'),
],
];
91 changes: 0 additions & 91 deletions src/Logging/LogHandler.php

This file was deleted.

14 changes: 0 additions & 14 deletions src/Logging/Logger.php

This file was deleted.

25 changes: 0 additions & 25 deletions src/Notifications/BaseNotification.php

This file was deleted.

50 changes: 0 additions & 50 deletions src/Notifications/Channel.php

This file was deleted.

10 changes: 0 additions & 10 deletions src/ServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,11 @@

namespace TransformStudios\Front;

use Illuminate\Notifications\ChannelManager;
use Illuminate\Support\Facades\Notification;
use Illuminate\Support\Facades\View;
use Statamic\Facades\User as UserFacade;
use Statamic\Providers\AddonServiceProvider;
use Statamic\Statamic;
use Statamic\Support\Arr;
use TransformStudios\Front\Notifications\Channel;

class ServiceProvider extends AddonServiceProvider
{
Expand Down Expand Up @@ -37,13 +34,6 @@ public function bootAddon()
// );
}

public function register()
{
Notification::resolved(
fn (ChannelManager $service) => $service->extend('front', fn ($app) => new Channel)
);
}

private function bootScript()
{
if (! config('front.chat.show_on_control_panel')) {
Expand Down
30 changes: 0 additions & 30 deletions src/UpdateScripts/AddToLoggingConfig.php

This file was deleted.

10 changes: 0 additions & 10 deletions src/helpers.php

This file was deleted.

36 changes: 36 additions & 0 deletions tests/Http/Controllers/ConfigControllerTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

use Statamic\Facades\User;

beforeEach(function () {
config()->set('front.secret_key', 'secret');
config()->set('front.chat.id', 'chat-id');
config()->set('front.chat.show_on_front_end', true);
});

it('returns user details when configured', function () {
$user = tap(User::make()->email('erin@transformstudios.com')->set('name', 'Erin'))->save();

$this->actingAs($user)
->getJson('/!/front/config')
->assertOk()
->assertExactJson([
'configured' => true,
'chatId' => 'chat-id',
'email' => 'erin@transformstudios.com',
'name' => 'Erin',
'hash' => hash_hmac('sha256', 'erin@transformstudios.com', 'secret'),
]);
});

it('returns nulls for a guest', function () {
$this->getJson('/!/front/config')
->assertOk()
->assertJson(['configured' => true, 'email' => null, 'name' => null, 'hash' => null]);
});

it('is not configured when hidden on the front end', function () {
config()->set('front.chat.show_on_front_end', false);

$this->getJson('/!/front/config')->assertOk()->assertJson(['configured' => false]);
});
Loading
Loading