| @@ -47,21 +47,23 @@ | ||
| 47 | 47 | ]; |
| 48 | 48 | } |
| 49 | 49 | |
| 50 | 50 | public function pricing(){ |
| 51 | - $data = get_transient( "templately_subscriptions" ); | |
| 51 | + $data = get_transient( "templately_subscriptions_v2" ); | |
| 52 | 52 | |
| 53 | 53 | if( is_array( $data ) && ! empty( $data ) ) { |
| 54 | 54 | return $data; |
| 55 | 55 | } |
| 56 | 56 | |
| 57 | - $query = 'id, price, name, discounted_price, type, sites, coupon'; | |
| 57 | + // Field set drives the Subscription screen's plan comparison grid, so it | |
| 58 | + // carries the per-plan limits too, not just price/sites. | |
| 59 | + $query = 'id, price, name, slug, discounted_price, type, sites, coupon, my_cloud_items, pro_items, workspace, fsi_limit, ai_credit, description'; | |
| 58 | 60 | $response = $this->http()->query( |
| 59 | 61 | 'subscriptionPlans', |
| 60 | 62 | $query |
| 61 | 63 | )->post(); |
| 62 | 64 | |
| 63 | - set_transient( "templately_subscriptions", $response, WEEK_IN_SECONDS ); | |
| 65 | + set_transient( "templately_subscriptions_v2", $response, WEEK_IN_SECONDS ); | |
| 64 | 66 | |
| 65 | 67 | return $response; |
| 66 | 68 | } |
| 67 | 69 | |
| @@ -105,9 +107,13 @@ | ||
| 105 | 107 | if ( ! empty( $errors ) ) { |
| 106 | 108 | return $this->error( 'login_error', $errors, 'login', 400 ); |
| 107 | 109 | } |
| 108 | 110 | |
| 109 | - $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, is_company_user, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice, reviews{ type, type_id, rating }, subscription { id, name, sites } }'; | |
| 111 | + // `ends_at`, `plan_type` and `cancel_at_period_end` drive the Subscription | |
| 112 | + // screen's renewal line. They are asked for instead of leaning on | |
| 113 | + // `plan_expire_at`, which the API resolves with `empty($subscription->ends_at) | |
| 114 | + // ?? …` — a boolean that never falls through, so it never carries a date. | |
| 115 | + $query = 'status, message, user{ id, name, first_name, last_name, display_name, email, profile_photo, joined, is_verified, is_company_user, is_restricted_company_user, api_key, plan, plan_expire_at, my_cloud{ limit, usages, last_pushed }, favourites{ id, type }, show_notice, reviews{ type, type_id, rating }, subscription { id, name, sites, subscription_plan_id, ends_at, plan_type, cancel_at_period_end } }'; | |
| 110 | 116 | |
| 111 | 117 | $response = $this->http()->mutation( |
| 112 | 118 | $viaAPI ? 'connectWithApiKey' : 'connect', |
| 113 | 119 | $query, |