PluginProbe
Subscriptions for WooCommerce with Stripe Recurring Payments / 2.4.0
Subscriptions for WooCommerce with Stripe Recurring Payments v2.4.0
2.4.0 2.3.0 2.2.0 2.1.0 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 All 65 releases
← All changes | includes/Admin/views/reports-preview.php +117 -27 1.10.4 → 2.4.0 View file →
@@ -137,42 +137,83 @@
137 137 function subscrpt_preview_format_price( float $amount ): string {
138 138 return function_exists( 'wc_price' ) ? wc_price( $amount ) : esc_html( '$' . number_format( $amount, 2 ) );
139 139 }
140 140 }
141 +
142 +// Sample cancellation reasons, shaped exactly like Pro's real query result so
143 +// the preview and the real report render from the same structure.
144 +$dummy_cancellation_reasons = array(
145 + 'reasons' => array(
146 + array(
147 + 'reason' => __( 'Too expensive', 'subscription' ),
148 + 'count' => 14,
149 + 'percent' => 38.9,
150 + ),
151 + array(
152 + 'reason' => __( 'Missing features I need', 'subscription' ),
153 + 'count' => 9,
154 + 'percent' => 25.0,
155 + ),
156 + array(
157 + 'reason' => __( 'Found a better alternative', 'subscription' ),
158 + 'count' => 7,
159 + 'percent' => 19.4,
160 + ),
161 + array(
162 + 'reason' => __( 'No longer needed', 'subscription' ),
163 + 'count' => 4,
164 + 'percent' => 11.1,
165 + ),
166 + array(
167 + 'reason' => __( 'Technical issues', 'subscription' ),
168 + 'count' => 2,
169 + 'percent' => 5.6,
170 + ),
171 + ),
172 + 'total' => 36,
173 +);
141 174 ?>
142 175
143 -<!-- Disclaimer banner -->
144 -<div style="max-width:1240px;margin:20px auto 0;padding:0;">
145 - <div style="background:#fffbeb;border:1px solid #fcd34d;border-radius:8px;padding:12px 16px;display:flex;align-items:flex-start;gap:10px;">
146 - <svg width="18" height="18" fill="none" viewBox="0 0 24 24" stroke="#d97706" style="flex-shrink:0;margin-top:1px;" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
147 - <p style="margin:0;font-size:13px;color:#92400e;line-height:1.5;">
148 - <strong><?php esc_html_e( 'Preview with sample data.', 'subscription' ); ?></strong>
149 - <?php esc_html_e( 'This page shows example data to illustrate the feature.', 'subscription' ); ?>
150 - <a href="<?php echo esc_url( $upgrade_url ); ?>" target="_blank" rel="noreferrer noopener" style="color:#b45309;font-weight:600;text-decoration:underline;"><?php esc_html_e( 'Upgrade to Pro', 'subscription' ); ?></a>
151 - <?php esc_html_e( 'to unlock real subscription analytics.', 'subscription' ); ?>
152 - </p>
176 +<!-- Page content -->
177 +<div class="wp-subscription-admin-content list-page">
178 +
179 + <!-- Disclaimer banner -->
180 + <div style="max-width:1240px;margin:20px auto 0;padding:0;">
181 + <div style="background:#fffbeb;border:1px solid #fcd34d;border-radius:8px;padding:12px 16px;display:flex;align-items:flex-start;gap:10px;">
182 + <svg width="18" height="18" fill="none" viewBox="0 0 24 24" stroke="#d97706" style="flex-shrink:0;margin-top:1px;" aria-hidden="true"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M13 16h-1v-4h-1m1-4h.01M21 12a9 9 0 11-18 0 9 9 0 0118 0z"/></svg>
183 + <p style="margin:0;font-size:13px;color:#92400e;line-height:1.5;">
184 + <strong><?php esc_html_e( 'Preview with sample data.', 'subscription' ); ?></strong>
185 + <?php esc_html_e( 'This page shows example data to illustrate the feature.', 'subscription' ); ?>
186 + <a href="<?php echo esc_url( $upgrade_url ); ?>" target="_blank" rel="noreferrer noopener" style="color:#b45309;font-weight:600;text-decoration:underline;"><?php esc_html_e( 'Upgrade to Pro', 'subscription' ); ?></a>
187 + <?php esc_html_e( 'to unlock real subscription analytics.', 'subscription' ); ?>
188 + </p>
189 + </div>
153 190 </div>
154 -</div>
155 191
156 -<!-- Page header -->
157 -<div style="max-width:1240px;margin:20px auto 0;padding:0 0 20px;">
158 - <div style="display:flex;align-items:flex-start;justify-content:space-between;gap:16px;margin-bottom:12px;">
159 - <div>
160 - <h1 style="font-size:1.375rem;font-weight:700;color:var(--wpsubs-text);margin:0 0 6px;line-height:1.2;"><?php esc_html_e( 'Subscription Reports', 'subscription' ); ?></h1>
161 - <p style="font-size:13px;color:var(--wpsubs-text-muted);margin:0;line-height:1.5;"><?php esc_html_e( 'Data-driven insights for your subscription business.', 'subscription' ); ?></p>
162 - </div>
163 - <div style="display:flex;align-items:center;gap:8px;flex-shrink:0;padding-top:4px;">
164 - <button type="button" class="wpsubs-btn wpsubs-btn--outline" style="height:28px;padding:0 10px;font-size:12px;cursor:not-allowed;opacity:0.6;" disabled>
165 - <svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true" style="flex-shrink:0;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" /></svg>
166 - <?php esc_html_e( 'Refresh', 'subscription' ); ?>
192 + <!-- Page header -->
193 + <div style="max-width:1240px;margin:20px auto 0;">
194 + <?php
195 + wpsubs_render_page_header(
196 + array(
197 + 'title' => __( 'Subscription Reports', 'subscription' ),
198 + 'description' => __( 'Data-driven insights for your subscription business.', 'subscription' ),
199 + 'actions' => '<button type="button" class="wpsubs-btn wpsubs-btn--outline" style="height:28px;padding:0 10px;font-size:12px;cursor:not-allowed;opacity:0.6;" disabled><svg xmlns="http://www.w3.org/2000/svg" width="12" height="12" fill="none" viewBox="0 0 24 24" stroke="currentColor" aria-hidden="true" style="flex-shrink:0;"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 4v5h.582m15.356 2A8.001 8.001 0 004.582 9m0 0H9m11 11v-5h-.581m0 0a8.003 8.003 0 01-15.357-2m15.357 2H15" /></svg>' . esc_html__( 'Refresh', 'subscription' ) . '</button>',
200 + )
201 + );
202 + ?>
203 + </div>
204 +
205 + <div class="wpsubs-tabs" data-tabs-query="report" style="max-width:1240px;margin:0 auto;">
206 + <div class="wpsubs-tabs__list" role="tablist">
207 + <button class="wpsubs-tabs__tab" role="tab" id="subscrpt-report-tab-overview" data-tab-key="overview" aria-controls="subscrpt-report-panel-overview" aria-selected="true">
208 + <?php esc_html_e( 'Overview', 'subscription' ); ?>
167 209 </button>
210 + <button class="wpsubs-tabs__tab" role="tab" id="subscrpt-report-tab-cancellation" data-tab-key="cancellation" aria-controls="subscrpt-report-panel-cancellation" aria-selected="false">
211 + <?php esc_html_e( 'Cancellation', 'subscription' ); ?>
212 + </button>
168 213 </div>
169 - </div>
170 - <div style="border-top:1px dashed #d0d3d7;"></div>
171 -</div>
172 214
173 -<!-- Page content -->
174 -<div class="wp-subscription-admin-content list-page subscrpt-subs-list" style="margin-top:0;">
215 + <div class="wpsubs-tab-panel" role="tabpanel" id="subscrpt-report-panel-overview" aria-labelledby="subscrpt-report-tab-overview">
175 216
176 217 <!-- KPI stat cards -->
177 218 <div style="display:grid;grid-template-columns:repeat(5,1fr);gap:16px;margin-bottom:16px;">
178 219
@@ -410,8 +451,57 @@
410 451 <div style="padding:20px;">
411 452 <canvas id="subscrpt-preview-detailed-chart" style="width:100%;height:360px;"></canvas>
412 453 </div>
413 454 </div>
455 +
456 + </div><!-- /overview panel -->
457 +
458 + <div class="wpsubs-tab-panel" role="tabpanel" id="subscrpt-report-panel-cancellation" aria-labelledby="subscrpt-report-tab-cancellation" hidden>
459 +
460 + <div class="wpsubs-table-card">
461 + <div style="padding:16px 20px;border-bottom:1px solid var(--wpsubs-border);">
462 + <h2 style="font-size:13px;font-weight:600;color:var(--wpsubs-text-muted);text-transform:uppercase;letter-spacing:0.07em;margin:0;"><?php esc_html_e( 'Cancellation Reasons', 'subscription' ); ?></h2>
463 + <p style="font-size:12px;color:var(--wpsubs-text-muted);margin:4px 0 0;"><?php esc_html_e( 'Why customers cancelled, based on submitted feedback.', 'subscription' ); ?></p>
464 + </div>
465 + <div style="padding:10px 20px 14px;">
466 + <?php
467 + foreach ( $dummy_cancellation_reasons['reasons'] as $subscrpt_reason_row ) :
468 + $subscrpt_reason_fill = max( 2, min( 100, (float) $subscrpt_reason_row['percent'] ) );
469 + ?>
470 + <div style="display:flex;align-items:baseline;justify-content:space-between;gap:12px;padding:11px 14px;margin-bottom:6px;border-radius:8px;border:1px solid var(--wpsubs-border);background:linear-gradient(to left, var(--wpsubs-brand-light) 0, var(--wpsubs-brand-light) calc(<?php echo esc_attr( $subscrpt_reason_fill ); ?>% - 2px), var(--wpsubs-brand) calc(<?php echo esc_attr( $subscrpt_reason_fill ); ?>% - 2px), var(--wpsubs-brand) <?php echo esc_attr( $subscrpt_reason_fill ); ?>%, transparent <?php echo esc_attr( $subscrpt_reason_fill ); ?>%);">
471 + <span style="font-size:13px;font-weight:600;color:var(--wpsubs-text);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;"><?php echo esc_html( $subscrpt_reason_row['reason'] ); ?></span>
472 + <span style="flex-shrink:0;">
473 + <span style="font-size:14px;font-weight:700;color:var(--wpsubs-text);"><?php echo esc_html( $subscrpt_reason_row['percent'] ); ?>%</span>
474 + <span style="font-size:12px;color:var(--wpsubs-text-muted);margin-left:4px;">
475 + <?php
476 + printf(
477 + /* translators: %s: number of subscriptions. */
478 + esc_html__( '%s subs', 'subscription' ),
479 + esc_html( number_format_i18n( $subscrpt_reason_row['count'] ) )
480 + );
481 + ?>
482 + </span>
483 + </span>
484 + </div>
485 + <?php endforeach; ?>
486 + </div>
487 + <div style="padding:12px 20px;border-top:1px solid var(--wpsubs-border);font-size:12px;color:var(--wpsubs-text-muted);">
488 + <?php
489 + printf(
490 + /* translators: %s: total number of cancellations with feedback. */
491 + esc_html__( 'Total cancellations with feedback: %s', 'subscription' ),
492 + esc_html( number_format_i18n( $dummy_cancellation_reasons['total'] ) )
493 + );
494 + ?>
495 + </div>
496 + </div>
497 +
498 + <p style="margin:14px 0 0;font-size:13px;color:var(--wpsubs-text-muted);text-align:center;">
499 + <?php esc_html_e( 'Sample data. Pro reports the reasons your own customers gave.', 'subscription' ); ?>
500 + </p>
501 +
502 + </div><!-- /cancellation panel -->
503 + </div><!-- /tabs -->
414 504
415 505 </div>
416 506
417 507 <script>