Skip to content

Commit 7290646

Browse files
simonhampclaude
andcommitted
Fix Stripe onboarding redirect by adding terms acceptance to Livewire view
The Livewire onboarding view was missing the accepted_plugin_terms form field, causing validation to silently fail and redirect back to the same page when clicking "Continue Onboarding". Added terms checkbox (or hidden field when already accepted) matching the traditional Blade view's pattern. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6d83708 commit 7290646

2 files changed

Lines changed: 74 additions & 3 deletions

File tree

resources/views/livewire/customer/developer/onboarding.blade.php

Lines changed: 59 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,67 @@
7777
</flux:callout>
7878
@endif
7979

80-
{{-- CTA Button --}}
80+
{{-- Developer Terms Agreement & CTA Button --}}
8181
<div class="mt-6">
82-
<form action="{{ route('customer.developer.onboarding.start') }}" method="POST">
82+
<form action="{{ route('customer.developer.onboarding.start') }}" method="POST" x-data="{ termsAccepted: {{ ($this->developerAccount?->hasAcceptedCurrentTerms()) ? 'true' : 'false' }} }">
8383
@csrf
84-
<flux:button type="submit" variant="primary" class="w-full">
84+
85+
@if ($this->developerAccount?->hasAcceptedCurrentTerms())
86+
<input type="hidden" name="accepted_plugin_terms" value="1" />
87+
88+
<flux:callout variant="success" icon="check-circle" class="mb-6">
89+
<flux:callout.text>
90+
You accepted the <a href="{{ route('developer-terms') }}" class="font-medium underline" target="_blank">Plugin Developer Terms and Conditions</a> on {{ $this->developerAccount->accepted_plugin_terms_at->format('F j, Y') }}.
91+
</flux:callout.text>
92+
</flux:callout>
93+
@else
94+
<div class="mb-6 rounded-lg border border-gray-200 bg-gray-50 p-6 dark:border-gray-700 dark:bg-gray-700/50">
95+
<flux:heading>Plugin Developer Terms and Conditions</flux:heading>
96+
<flux:text class="mt-2">
97+
Before you can sell plugins on the Marketplace, you must agree to the following key terms:
98+
</flux:text>
99+
100+
<ul class="mt-4 space-y-3 text-sm text-gray-600 dark:text-gray-400">
101+
<li class="flex items-start gap-3">
102+
<x-heroicon-o-currency-dollar class="mt-0.5 size-5 shrink-0 text-indigo-500" />
103+
<span><strong class="text-gray-900 dark:text-white">30% Platform Fee</strong> &mdash; NativePHP retains 30% of each sale to cover payment processing, hosting, and platform maintenance</span>
104+
</li>
105+
<li class="flex items-start gap-3">
106+
<x-heroicon-o-shield-check class="mt-0.5 size-5 shrink-0 text-indigo-500" />
107+
<span><strong class="text-gray-900 dark:text-white">Your Responsibility</strong> &mdash; You are solely responsible for your plugin's quality, performance, and customer support</span>
108+
</li>
109+
<li class="flex items-start gap-3">
110+
<x-heroicon-o-adjustments-horizontal class="mt-0.5 size-5 shrink-0 text-indigo-500" />
111+
<span><strong class="text-gray-900 dark:text-white">Listing Criteria</strong> &mdash; NativePHP sets and may change listing standards at any time, and may remove plugins at its discretion</span>
112+
</li>
113+
<li class="flex items-start gap-3">
114+
<x-heroicon-o-tag class="mt-0.5 size-5 shrink-0 text-indigo-500" />
115+
<span><strong class="text-gray-900 dark:text-white">Pricing & Discounts</strong> &mdash; NativePHP sets plugin prices and may offer discounts at its discretion</span>
116+
</li>
117+
</ul>
118+
119+
<div class="mt-6 border-t border-gray-200 pt-4 dark:border-gray-600">
120+
<label class="flex cursor-pointer items-start gap-3">
121+
<input
122+
type="checkbox"
123+
name="accepted_plugin_terms"
124+
value="1"
125+
x-model="termsAccepted"
126+
class="mt-0.5 size-4 rounded border-gray-300 text-indigo-600 focus:ring-indigo-500 dark:border-gray-600 dark:bg-gray-700"
127+
/>
128+
<span class="text-sm text-gray-700 dark:text-gray-300">
129+
I have read and agree to the
130+
<a href="{{ route('developer-terms') }}" class="font-medium text-indigo-600 underline hover:text-indigo-500 dark:text-indigo-400" target="_blank">Plugin Developer Terms and Conditions</a>
131+
</span>
132+
</label>
133+
@error('accepted_plugin_terms')
134+
<flux:text class="mt-2 text-red-600 dark:text-red-400">{{ $message }}</flux:text>
135+
@enderror
136+
</div>
137+
</div>
138+
@endif
139+
140+
<flux:button type="submit" variant="primary" class="w-full" x-bind:disabled="!termsAccepted">
85141
@if ($this->hasExistingAccount)
86142
Continue Onboarding
87143
@else

tests/Feature/Livewire/Customer/DeveloperPagesTest.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ public function test_onboarding_component_shows_start_selling_for_new_user(): vo
5252
->test(Onboarding::class)
5353
->assertSee('Start Selling Plugins')
5454
->assertSee('Connect with Stripe')
55+
->assertSee('Plugin Developer Terms and Conditions')
5556
->assertStatus(200);
5657
}
5758

@@ -65,6 +66,20 @@ public function test_onboarding_component_shows_continue_for_existing_account():
6566
->assertSee('Complete Your Onboarding')
6667
->assertSee('Continue Onboarding')
6768
->assertSee('Onboarding Incomplete')
69+
->assertSee('Plugin Developer Terms and Conditions')
70+
->assertStatus(200);
71+
}
72+
73+
public function test_onboarding_component_shows_terms_accepted_for_existing_account_with_terms(): void
74+
{
75+
$user = User::factory()->create();
76+
DeveloperAccount::factory()->pending()->withAcceptedTerms()->create(['user_id' => $user->id]);
77+
78+
Livewire::actingAs($user)
79+
->test(Onboarding::class)
80+
->assertSee('Continue Onboarding')
81+
->assertSee('You accepted the')
82+
->assertDontSee('I have read and agree to the')
6883
->assertStatus(200);
6984
}
7085

0 commit comments

Comments
 (0)