Merge pull request #8367 from turbo124/preview

Preview
This commit is contained in:
David Bomba 2023-03-12 20:06:05 +11:00 committed by GitHub
commit 9f2ec3f22a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 125 additions and 29 deletions

View File

@ -179,9 +179,9 @@ class PreviewController extends BaseController
public function design(DesignPreviewRequest $request)
{
if (Ninja::isHosted() && !in_array($request->getHost(), ['preview.invoicing.co','staging.invoicing.co'])) {
return response()->json(['message' => 'This server cannot handle this request.'], 400);
}
// if (Ninja::isHosted() && !in_array($request->getHost(), ['preview.invoicing.co','staging.invoicing.co'])) {
// return response()->json(['message' => 'This server cannot handle this request.'], 400);
// }
$pdf = (new PdfMock($request->all(), auth()->user()->company()))->build()->getPdf();

53
composer.lock generated
View File

@ -380,16 +380,16 @@
},
{
"name": "aws/aws-sdk-php",
"version": "3.261.8",
"version": "3.261.9",
"source": {
"type": "git",
"url": "https://github.com/aws/aws-sdk-php.git",
"reference": "9c38c82b7d3fb2b15957e71cae3957450e131ed8"
"reference": "d91e6f89a6c41e8df859b0d313150386cfee6f6a"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/9c38c82b7d3fb2b15957e71cae3957450e131ed8",
"reference": "9c38c82b7d3fb2b15957e71cae3957450e131ed8",
"url": "https://api.github.com/repos/aws/aws-sdk-php/zipball/d91e6f89a6c41e8df859b0d313150386cfee6f6a",
"reference": "d91e6f89a6c41e8df859b0d313150386cfee6f6a",
"shasum": ""
},
"require": {
@ -468,9 +468,9 @@
"support": {
"forum": "https://forums.aws.amazon.com/forum.jspa?forumID=80",
"issues": "https://github.com/aws/aws-sdk-php/issues",
"source": "https://github.com/aws/aws-sdk-php/tree/3.261.8"
"source": "https://github.com/aws/aws-sdk-php/tree/3.261.9"
},
"time": "2023-03-09T19:23:27+00:00"
"time": "2023-03-10T19:25:08+00:00"
},
{
"name": "bacon/bacon-qr-code",
@ -4432,34 +4432,37 @@
},
{
"name": "league/csv",
"version": "9.8.0",
"version": "9.9.0",
"source": {
"type": "git",
"url": "https://github.com/thephpleague/csv.git",
"reference": "9d2e0265c5d90f5dd601bc65ff717e05cec19b47"
"reference": "b4418ede47fbd88facc34e40a16c8ce9153b961b"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/9d2e0265c5d90f5dd601bc65ff717e05cec19b47",
"reference": "9d2e0265c5d90f5dd601bc65ff717e05cec19b47",
"url": "https://api.github.com/repos/thephpleague/csv/zipball/b4418ede47fbd88facc34e40a16c8ce9153b961b",
"reference": "b4418ede47fbd88facc34e40a16c8ce9153b961b",
"shasum": ""
},
"require": {
"ext-json": "*",
"ext-mbstring": "*",
"php": "^7.4 || ^8.0"
"php": "^8.1.2"
},
"require-dev": {
"ext-curl": "*",
"doctrine/collections": "^2.1.2",
"ext-dom": "*",
"friendsofphp/php-cs-fixer": "^v3.4.0",
"phpstan/phpstan": "^1.3.0",
"phpstan/phpstan-phpunit": "^1.0.0",
"phpstan/phpstan-strict-rules": "^1.1.0",
"phpunit/phpunit": "^9.5.11"
"ext-xdebug": "*",
"friendsofphp/php-cs-fixer": "^v3.14.3",
"phpbench/phpbench": "^1.2.8",
"phpstan/phpstan": "^1.10.4",
"phpstan/phpstan-deprecation-rules": "^1.1.2",
"phpstan/phpstan-phpunit": "^1.3.10",
"phpstan/phpstan-strict-rules": "^1.5.0",
"phpunit/phpunit": "^10.0.14"
},
"suggest": {
"ext-dom": "Required to use the XMLConverter and or the HTMLConverter classes",
"ext-dom": "Required to use the XMLConverter and the HTMLConverter classes",
"ext-iconv": "Needed to ease transcoding CSV using iconv stream filters"
},
"type": "library",
@ -4512,7 +4515,7 @@
"type": "github"
}
],
"time": "2022-01-04T00:13:07+00:00"
"time": "2023-03-11T15:57:12+00:00"
},
{
"name": "league/flysystem",
@ -5064,16 +5067,16 @@
},
{
"name": "mollie/mollie-api-php",
"version": "v2.50.0",
"version": "v2.50.1",
"source": {
"type": "git",
"url": "https://github.com/mollie/mollie-api-php.git",
"reference": "2291b114ec636392e3e48b73d33199b3b4a790d5"
"reference": "b2739c31a8a037d6fa1bf204e071c9dd4f465f38"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/2291b114ec636392e3e48b73d33199b3b4a790d5",
"reference": "2291b114ec636392e3e48b73d33199b3b4a790d5",
"url": "https://api.github.com/repos/mollie/mollie-api-php/zipball/b2739c31a8a037d6fa1bf204e071c9dd4f465f38",
"reference": "b2739c31a8a037d6fa1bf204e071c9dd4f465f38",
"shasum": ""
},
"require": {
@ -5150,9 +5153,9 @@
],
"support": {
"issues": "https://github.com/mollie/mollie-api-php/issues",
"source": "https://github.com/mollie/mollie-api-php/tree/v2.50.0"
"source": "https://github.com/mollie/mollie-api-php/tree/v2.50.1"
},
"time": "2023-01-02T08:49:24+00:00"
"time": "2023-03-10T12:15:10+00:00"
},
{
"name": "moneyphp/money",

74
config/purchase.php Normal file
View File

@ -0,0 +1,74 @@
<?php
use Imdhemy\Purchases\Events\AppStore\Cancel;
use Imdhemy\Purchases\Events\AppStore\Refund;
use Imdhemy\Purchases\Events\AppStore\Revoke;
use Imdhemy\Purchases\Events\AppStore\DidRenew;
use Imdhemy\Purchases\Events\AppStore\DidRecover;
use Imdhemy\Purchases\Events\AppStore\InitialBuy;
use Imdhemy\Purchases\Events\AppStore\DidFailToRenew;
use App\Listeners\Subscription\AppStoreRenewSubscription;
use Imdhemy\Purchases\Events\AppStore\InteractiveRenewal;
use App\Listeners\Subscription\PlayStoreRenewSubscription;
use Imdhemy\Purchases\Events\AppStore\DidChangeRenewalPref;
use Imdhemy\Purchases\Events\AppStore\PriceIncreaseConsent;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionOnHold;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPaused;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionExpired;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRenewed;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRevoked;
use Imdhemy\Purchases\Events\AppStore\DidChangeRenewalStatus;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionCanceled;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionDeferred;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPurchased;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRecovered;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionRestarted;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionInGracePeriod;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPauseScheduleChanged;
use Imdhemy\Purchases\Events\GooglePlay\SubscriptionPriceChangeConfirmed;
return [
'routing' => [],
'google_play_package_name' => env('GOOGLE_PLAY_PACKAGE_NAME', 'com.invoiceninja.app'),
'appstore_password' => env('APPSTORE_PASSWORD', ''),
'eventListeners' => [
/**
* --------------------------------------------------------
* Google Play Events
* --------------------------------------------------------
*/
SubscriptionPurchased::class => [],
SubscriptionRenewed::class => [PlayStoreRenewSubscription::class],
SubscriptionInGracePeriod::class => [],
SubscriptionExpired::class => [],
SubscriptionCanceled::class => [],
SubscriptionPaused::class => [],
SubscriptionRestarted::class => [],
SubscriptionDeferred::class => [],
SubscriptionRevoked::class => [],
SubscriptionOnHold::class => [],
SubscriptionRecovered::class => [],
SubscriptionPauseScheduleChanged::class => [],
SubscriptionPriceChangeConfirmed::class => [],
/**
* --------------------------------------------------------
* Appstore Events
* --------------------------------------------------------
*/
Cancel::class => [],
DidChangeRenewalPref::class => [],
DidChangeRenewalStatus::class => [],
DidFailToRenew::class => [],
DidRecover::class => [],
DidRenew::class => [AppStoreRenewSubscription::class],
InitialBuy::class => [],
InteractiveRenewal::class => [],
PriceIncreaseConsent::class => [],
Refund::class => [],
Revoke::class => [],
],
];

View File

@ -12,6 +12,8 @@ class Preloader
private array $fileMap;
private array $exclude_paths;
public function __construct(string ...$paths)
{
$this->paths = $paths;
@ -62,6 +64,10 @@ class Preloader
// If the current path is a directory,
// we'll load all files in it
if (is_dir($path)) {
if (in_array($path, $this->exclude_paths)) {
return;
}
$this->loadDir($path);
return;
@ -105,7 +111,14 @@ class Preloader
self::$count++;
echo "[Preloader] Preloaded `{$class}`" . PHP_EOL;
// echo "[Preloader] Preloaded `{$class}`" . PHP_EOL;
}
public function excludePaths(array $exclude_paths): Preloader
{
$this->exclude_paths = $exclude_paths;
return $this;
}
private function shouldIgnore(?string $name): bool
@ -126,6 +139,12 @@ class Preloader
(new Preloader())
->paths(__DIR__ . '/vendor/laravel')
->excludePaths([
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Support/Testing',
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Http/Testing',
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Testing',
__DIR__ . '/vendor/laravel/framework/src/Illuminate/Foundation/Testing',
])
->ignore(
\Illuminate\Filesystem\Cache::class,
\Illuminate\Log\LogManager::class,