PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / trunk
Subscriptions for WooCommerce with Stripe Recurring Payments vtrunk
2.0.0 1.11.2 1.11.1 1.11.0 1.10.9 1.10.8 1.10.7 1.10.6 1.10.5 1.10.4 1.10.3 1.10.2 1.10.1 1.10.0 1.9.6 1.9.5 trunk 1.3.0 1.3.1 1.3.2 1.4.0 1.4.1 1.4.2 1.5.0 1.5.1 All 61 releases
subscription / includes / Admin / views / subscription-gsc.php

subscription-gsc.php in Subscriptions for WooCommerce with Stripe Recurring Payments trunk, at includes/Admin/views/subscription-gsc.php

239 lines 8.2 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Getting started card for the subscriptions list page.
4 * Shown only when no product has '_subscrpt_enabled' meta.
5 *
6 * @package SpringDevs\Subscription\Admin
7 */
8
9 if ( ! defined( 'ABSPATH' ) ) {
10 exit;
11 }
12
13 $transient_key = 'subscrpt_has_enabled_product';
14 $has_subscrpt_product = get_transient( $transient_key );
15
16 if ( false === $has_subscrpt_product ) {
17 $has_subscrpt_product = get_posts(
18 array(
19 'post_type' => 'product',
20 'post_status' => 'any',
21 'posts_per_page' => 1,
22 'fields' => 'ids',
23 'meta_query' => array( // phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query -- transient caches the result.
24 array(
25 'key' => '_subscrpt_enabled',
26 'compare' => 'EXISTS',
27 ),
28 ),
29 )
30 );
31 // Store as a non-empty array or an empty string ([] can't be distinguished from false).
32 set_transient( $transient_key, $has_subscrpt_product ? $has_subscrpt_product : 'none', DAY_IN_SECONDS );
33 }
34
35 if ( 'none' !== $has_subscrpt_product && ! empty( $has_subscrpt_product ) ) {
36 return;
37 }
38 ?>
39 <style>
40 /* Card shell */
41 .subscrpt-gsc {
42 background: #fff;
43 border: 1px solid var(--wpsubs-border);
44 border-radius: 12px;
45 padding: 24px 28px 22px;
46 margin-bottom: 24px;
47 }
48
49 /* Dismiss × */
50 .subscrpt-gsc__dismiss {
51 background: none;
52 border: none;
53 cursor: pointer;
54 color: var(--wpsubs-text-subtle);
55 font-size: 18px;
56 line-height: 1;
57 padding: 4px 6px;
58 transition: color 0.15s;
59 flex-shrink: 0;
60 font-family: inherit;
61 float: right;
62 margin: -8px -8px 0 0;
63 }
64 .subscrpt-gsc__dismiss:hover {
65 color: var(--wpsubs-text);
66 }
67
68 /* Heading — override WP admin h2 margin/font */
69 .subscrpt-gsc h2.subscrpt-gsc__heading {
70 font-size: 20px !important;
71 font-weight: 700 !important;
72 font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
73 color: #1f2937 !important;
74 margin: 0 0 8px !important;
75 padding: 0 !important;
76 line-height: 1.25 !important;
77 border: none !important;
78 }
79
80 /* Subtitle — override WP admin p margin */
81 .subscrpt-gsc p.subscrpt-gsc__desc {
82 font-size: 13.5px !important;
83 color: var(--wpsubs-text-muted) !important;
84 line-height: 1.6 !important;
85 margin: 0 0 20px !important;
86 max-width: 600px;
87 }
88
89 /* Three-column step grid */
90 .subscrpt-gsc__steps {
91 display: grid;
92 grid-template-columns: 1fr 1fr 1fr;
93 gap: 12px;
94 margin-bottom: 22px;
95 }
96 .subscrpt-gsc__step {
97 background: var(--wpsubs-surface-muted);
98 border: 1px solid var(--wpsubs-border);
99 border-radius: 8px;
100 padding: 14px 16px 16px;
101 }
102 .subscrpt-gsc__step-top {
103 display: flex;
104 align-items: flex-start;
105 justify-content: space-between;
106 margin-bottom: 12px;
107 }
108 .subscrpt-gsc__step-icon {
109 width: 32px;
110 height: 32px;
111 border-radius: 6px;
112 background: #fff;
113 border: 1px solid var(--wpsubs-border);
114 display: flex;
115 align-items: center;
116 justify-content: center;
117 color: var(--wpsubs-brand);
118 flex-shrink: 0;
119 }
120 /* Reset global span[class*="subscrpt-"] (status.css) background/padding. */
121 .subscrpt-gsc span.subscrpt-gsc__step-num {
122 background: none !important;
123 color: var(--wpsubs-text-subtle) !important;
124 font-size: 12px !important;
125 font-weight: 500 !important;
126 padding: 0 !important;
127 border-radius: 0 !important;
128 text-transform: none !important;
129 line-height: 1 !important;
130 }
131
132 /* Step title + desc — override WP admin p margin */
133 .subscrpt-gsc__step p.subscrpt-gsc__step-title {
134 font-size: 13.5px !important;
135 font-weight: 700 !important;
136 color: var(--wpsubs-text) !important;
137 margin: 0 0 4px !important;
138 line-height: 1.3 !important;
139 }
140 .subscrpt-gsc__step p.subscrpt-gsc__step-desc {
141 font-size: 12.5px !important;
142 color: var(--wpsubs-text-muted) !important;
143 line-height: 1.5 !important;
144 margin: 0 !important;
145 }
146
147 /* Footer */
148 .subscrpt-gsc__footer {
149 display: flex;
150 align-items: center;
151 justify-content: space-between;
152 gap: 16px;
153 }
154 .subscrpt-gsc__footer-left {
155 display: flex;
156 align-items: center;
157 gap: 14px;
158 }
159 .subscrpt-gsc__skip {
160 font-size: 13px !important;
161 color: var(--wpsubs-text-muted) !important;
162 background: none !important;
163 border: none !important;
164 cursor: pointer;
165 padding: 0 !important;
166 text-decoration: none !important;
167 box-shadow: none !important;
168 font-family: inherit !important;
169 line-height: 1 !important;
170 transition: color 0.15s;
171 }
172 .subscrpt-gsc__skip:hover {
173 color: var(--wpsubs-text) !important;
174 }
175 /* Reset global span[class*="subscrpt-"] (status.css) background/padding. */
176 .subscrpt-gsc span.subscrpt-gsc__progress {
177 background: none !important;
178 color: var(--wpsubs-text-subtle) !important;
179 font-size: 12.5px !important;
180 font-weight: 400 !important;
181 padding: 0 !important;
182 border-radius: 0 !important;
183 text-transform: none !important;
184 line-height: 1 !important;
185 }
186 </style>
187
188 <div class="subscrpt-gsc" id="subscrpt-gsc-card">
189 <button type="button" class="subscrpt-gsc__dismiss" aria-label="<?php esc_attr_e( 'Dismiss', 'subscription' ); ?>" onclick="document.getElementById('subscrpt-gsc-card').style.display='none';">&times;</button>
190
191 <h2 class="subscrpt-gsc__heading"><?php esc_html_e( 'Welcome to WPSubscription', 'subscription' ); ?></h2>
192 <p class="subscrpt-gsc__desc"><?php esc_html_e( "You're three short steps from your first recurring product. We'll walk you through creating it, setting the billing cadence, and going live.", 'subscription' ); ?></p>
193
194 <div class="subscrpt-gsc__steps">
195 <div class="subscrpt-gsc__step">
196 <div class="subscrpt-gsc__step-top">
197 <div class="subscrpt-gsc__step-icon">
198 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 16V8a2 2 0 0 0-1-1.73l-7-4a2 2 0 0 0-2 0l-7 4A2 2 0 0 0 3 8v8a2 2 0 0 0 1 1.73l7 4a2 2 0 0 0 2 0l7-4A2 2 0 0 0 21 16z"></path></svg>
199 </div>
200 <span class="subscrpt-gsc__step-num">01</span>
201 </div>
202 <p class="subscrpt-gsc__step-title"><?php esc_html_e( 'Create a product', 'subscription' ); ?></p>
203 <p class="subscrpt-gsc__step-desc"><?php esc_html_e( 'Start fresh or convert an existing product into a subscription.', 'subscription' ); ?></p>
204 </div>
205 <div class="subscrpt-gsc__step">
206 <div class="subscrpt-gsc__step-top">
207 <div class="subscrpt-gsc__step-icon">
208 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><circle cx="12" cy="12" r="5"></circle><line x1="12" y1="1" x2="12" y2="3"></line><line x1="12" y1="21" x2="12" y2="23"></line><line x1="4.22" y1="4.22" x2="5.64" y2="5.64"></line><line x1="18.36" y1="18.36" x2="19.78" y2="19.78"></line><line x1="1" y1="12" x2="3" y2="12"></line><line x1="21" y1="12" x2="23" y2="12"></line><line x1="4.22" y1="19.78" x2="5.64" y2="18.36"></line><line x1="18.36" y1="5.64" x2="19.78" y2="4.22"></line></svg>
209 </div>
210 <span class="subscrpt-gsc__step-num">02</span>
211 </div>
212 <p class="subscrpt-gsc__step-title"><?php esc_html_e( 'Set the cadence', 'subscription' ); ?></p>
213 <p class="subscrpt-gsc__step-desc"><?php esc_html_e( 'Choose billing period, length, free trial and any signup fee.', 'subscription' ); ?></p>
214 </div>
215 <div class="subscrpt-gsc__step">
216 <div class="subscrpt-gsc__step-top">
217 <div class="subscrpt-gsc__step-icon">
218 <svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><polyline points="20 6 9 17 4 12"></polyline></svg>
219 </div>
220 <span class="subscrpt-gsc__step-num">03</span>
221 </div>
222 <p class="subscrpt-gsc__step-title"><?php esc_html_e( 'Go live', 'subscription' ); ?></p>
223 <p class="subscrpt-gsc__step-desc"><?php esc_html_e( 'Publish and your subscription is ready for customers to buy.', 'subscription' ); ?></p>
224 </div>
225 </div>
226
227 <div class="subscrpt-gsc__footer">
228 <div class="subscrpt-gsc__footer-left">
229 <a href="<?php echo esc_url( admin_url( 'admin.php?page=wp-subscription-onboarding' ) ); ?>" class="wpsubs-btn wpsubs-btn--primary">
230 <?php esc_html_e( 'Create my first subscription', 'subscription' ); ?> &rsaquo;
231 </a>
232 <button type="button" class="subscrpt-gsc__skip" onclick="document.getElementById('subscrpt-gsc-card').style.display='none';">
233 <?php esc_html_e( 'Skip for now', 'subscription' ); ?>
234 </button>
235 </div>
236 <span class="subscrpt-gsc__progress"><?php esc_html_e( 'about 2 min', 'subscription' ); ?></span>
237 </div>
238 </div>
239