Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| UserSettingResource | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| toArray | |
0.00% |
0 / 17 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | |
| 3 | namespace App\Http\Resources\v1; |
| 4 | |
| 5 | use Illuminate\Http\Request; |
| 6 | use Illuminate\Http\Resources\Json\JsonResource; |
| 7 | |
| 8 | /** |
| 9 | * TypeScript documentation resource for the merged user settings response. |
| 10 | * |
| 11 | * NOTE: This resource is NOT used in the response pipeline. The GET /user/setting |
| 12 | * endpoint returns a raw merged array for backward compatibility. This resource |
| 13 | * exists solely to document the response shape for frontend TypeScript generation. |
| 14 | * |
| 15 | * @property string $id The setting document ID |
| 16 | * @property string $user_id The user ID |
| 17 | * @property float $wage_per_hour Computed hourly wage (may come from user, company, or default) |
| 18 | * @property int $words_per_minute Computed typing speed (may come from user, company, or default) |
| 19 | * @property string $typing_style The typing style setting ('word', 'letter', or 'all') |
| 20 | * @property int|null $typing_speed The typing speed value (20-60) |
| 21 | * @property string $fly_rewrite FlyRewrite feature status ('enabled' or 'disabled') |
| 22 | * @property string $fly_grammar FlyGrammar feature status ('enabled' or 'disabled') |
| 23 | * @property string|null $fly_grammar_default_language Default language code for FlyGrammar |
| 24 | * @property bool $remove_grammar_on_lose_focus Whether to remove grammar on focus loss |
| 25 | * @property int|null $shortcut_timeout Shortcut activation timeout in milliseconds |
| 26 | * @property array<string>|null $blocked_domains Array of blocked domain URLs |
| 27 | * @property array<string>|null $fly_rewrite_blocked_domains Domains where FlyRewrite is disabled |
| 28 | * @property array<string>|null $fly_grammar_blocked_domains Domains where FlyGrammar is disabled |
| 29 | * @property array<string, bool> $features Feature flags (flyCuts, flyGrammar, gmailPlugin, linkedinPlugin, flyPosts, flyEngage, outlookPlugin, developer_mode, flySentenceRewrite, flyParagraphRewrite) |
| 30 | * @property array<string, array{title: string, link: string, description: string}> $playlists Playlist configurations keyed by identifier |
| 31 | * @property array<string>|null $ignoredInputTypes Array of HTML input types to ignore |
| 32 | * @property array<string>|null $blackListClasses Array of CSS classes to blacklist |
| 33 | * @property array<string>|null $blackListIds Array of element IDs to blacklist |
| 34 | * @property array<array{name: string, value: string}>|null $blackListAttributes Array of attribute name/value pairs to blacklist |
| 35 | * @property array<array{domain: string, blackListClasses: array, blackListIds: array, blackListAttributes: array}>|null $blackListDomainRules Domain-specific blacklist rules |
| 36 | * @property array<string>|null $user_dictionary The user's custom dictionary words |
| 37 | * @property bool $show_rewrite Whether sentence rewrite is enabled |
| 38 | * @property bool $show_upgrade_button Whether to show the upgrade button |
| 39 | * @property bool $show_write_upgrade_button Whether to show the write upgrade button |
| 40 | * @property string $flyperksJwt The FlyPerks JWT (empty string) |
| 41 | * @property int|null $upgrade_coupon_order_displayed Order index of upgrade coupon display |
| 42 | * @property array<string>|null $custom_prompts_order_flyengage Custom ordering of FlyEngage AI prompts |
| 43 | * @property array<string>|null $custom_prompts_order_flypost Custom ordering of FlyPost AI prompts |
| 44 | * @property array<string>|null $custom_fly_write_order Custom ordering of FlyWrite options |
| 45 | * @property string|null $csv_split_separator Single-character separator string for CSV exports (e.g., ",", ";", "|") |
| 46 | * @property array<array{wage_per_hour: float, date: string}>|null $wage_per_hour_history Historical wage per hour entries |
| 47 | * @property array<string, mixed>|null $company Company settings (only present for company users) |
| 48 | */ |
| 49 | class UserSettingResource extends JsonResource |
| 50 | { |
| 51 | /** |
| 52 | * Transform the resource into an array. |
| 53 | * |
| 54 | * @return array<string, mixed> |
| 55 | */ |
| 56 | public function toArray(Request $request): array |
| 57 | { |
| 58 | return [ |
| 59 | 'id' => $this->_id, |
| 60 | 'user_id' => $this->user_id, |
| 61 | 'wage_per_hour' => $this->wage_per_hour, |
| 62 | 'words_per_minute' => $this->words_per_minute, |
| 63 | 'typing_style' => $this->typing_style, |
| 64 | 'typing_speed' => $this->typing_speed, |
| 65 | 'fly_rewrite' => $this->fly_rewrite, |
| 66 | 'fly_grammar' => $this->fly_grammar, |
| 67 | 'fly_grammar_default_language' => $this->fly_grammar_default_language, |
| 68 | 'remove_grammar_on_lose_focus' => $this->remove_grammar_on_lose_focus, |
| 69 | 'features' => $this->features, |
| 70 | 'show_rewrite' => $this->show_rewrite, |
| 71 | 'show_upgrade_button' => $this->show_upgrade_button, |
| 72 | 'show_write_upgrade_button' => $this->show_write_upgrade_button, |
| 73 | 'csv_split_separator' => $this->csv_split_separator, |
| 74 | ]; |
| 75 | } |
| 76 | } |