Changeset 3484915
- Timestamp:
- 03/17/2026 03:51:56 PM (2 weeks ago)
- Location:
- yps-bundle/trunk
- Files:
-
- 5 edited
-
includes/class-yps-admin.php (modified) (9 diffs)
-
includes/class-yps-api.php (modified) (2 diffs)
-
includes/class-yps-frontend.php (modified) (5 diffs)
-
readme.txt (modified) (11 diffs)
-
yps-bundle.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
yps-bundle/trunk/includes/class-yps-admin.php
r3484054 r3484915 68 68 if ( $connection['is_connected'] && ! empty( $connection['token'] ) ) { 69 69 foreach ( $embeddables as $widget_slug => $widget ) { 70 if ( 'slotflow' !== $widget_slug) {70 if ( ! $this->widget_requires_form_selection( $widget ) ) { 71 71 continue; 72 72 } … … 78 78 } 79 79 80 $forms_result = $this->api->get_ slotflow_forms( $connection['token'], $tenant['endpoint'] );80 $forms_result = $this->api->get_widget_forms( $connection['token'], $tenant['endpoint'] ); 81 81 82 82 if ( ! empty( $forms_result['success'] ) ) { … … 212 212 <code><?php echo esc_html( $widget['shortcode_label'] ); ?></code> 213 213 </div> 214 <?php if ( 'slotflow' === $widget_slug) : ?>214 <?php if ( $this->widget_requires_form_selection( $widget ) ) : ?> 215 215 <div class="yps-widget-meta"> 216 216 <span>Form slug</span> … … 272 272 <?php echo esc_html( $field['label'] ); ?> 273 273 </label> 274 <?php if ( ' slotflow' === $widget_slug && 'form_slug' === $field['key']) : ?>275 <?php $ slotflow_forms = $widget_forms[ $widget_slug ] ?? array(); ?>274 <?php if ( 'form_slug' === $field['key'] && $this->widget_requires_form_selection( $widget ) ) : ?> 275 <?php $available_forms = $widget_forms[ $widget_slug ] ?? array(); ?> 276 276 <select 277 277 id="yps-field-<?php echo esc_attr( $widget_slug . '-' . $field['key'] ); ?>" … … 281 281 > 282 282 <option value="">Select a form</option> 283 <?php foreach ( $ slotflow_forms as $form ) : ?>283 <?php foreach ( $available_forms as $form ) : ?> 284 284 <option value="<?php echo esc_attr( $form['slug'] ); ?>" <?php selected( $settings[ $field['key'] ] ?? '', $form['slug'] ); ?>> 285 285 <?php echo esc_html( $form['name'] . ' (' . $form['slug'] . ')' ); ?> … … 300 300 <p class="description"><?php echo esc_html( $field['description'] ); ?></p> 301 301 <?php endif; ?> 302 <?php if ( ' slotflow' === $widget_slug && 'form_slug' === $field['key'] && empty( $slotflow_forms ) ) : ?>303 <p class="description"> No Slotflow forms found yet. Create a form in the Slotflow dashboard first.</p>302 <?php if ( 'form_slug' === $field['key'] && $this->widget_requires_form_selection( $widget ) && empty( $available_forms ) ) : ?> 303 <p class="description"><?php echo esc_html( sprintf( 'No %s forms found yet. Create a form in the dashboard first.', $widget['name'] ) ); ?></p> 304 304 <?php endif; ?> 305 305 </div> … … 311 311 Insert <?php echo esc_html( $widget['shortcode_label'] ); ?> wherever you want the widget to appear. 312 312 </p> 313 <?php if ( 'slotflow' === $widget_slug) : ?>313 <?php if ( $this->widget_requires_form_selection( $widget ) ) : ?> 314 314 <p> 315 315 You can also override the configured form on a specific page with 316 <code>[ jinkosoft-slotflowform="your-form-slug"]</code>.316 <code>[<?php echo esc_html( $widget['shortcode_tag'] ); ?> form="your-form-slug"]</code>. 317 317 </p> 318 318 <?php endif; ?> … … 528 528 return $sanitized; 529 529 } 530 531 private function widget_requires_form_selection( $widget ) { 532 if ( empty( $widget['fields'] ) || ! is_array( $widget['fields'] ) ) { 533 return false; 534 } 535 536 foreach ( $widget['fields'] as $field ) { 537 if ( ! empty( $field['key'] ) && 'form_slug' === $field['key'] ) { 538 return true; 539 } 540 } 541 542 return false; 543 } 544 530 545 private function render_widget_icon( $icon ) { 531 546 if ( 'calendar' === $icon ) { … … 533 548 } 534 549 550 if ( 'lead' === $icon ) { 551 return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 3a5 5 0 0 1 5 5c0 1.43-.6 2.72-1.57 3.63A6 6 0 0 1 20 17v2a1 1 0 1 1-2 0v-2a4 4 0 0 0-4-4h-4a4 4 0 0 0-4 4v2a1 1 0 1 1-2 0v-2a6 6 0 0 1 4.57-5.82A4.98 4.98 0 0 1 7 8a5 5 0 0 1 5-5Zm0 2a3 3 0 1 0 0 6 3 3 0 0 0 0-6Z"/></svg>'; 552 } 553 535 554 return '<svg viewBox="0 0 24 24" aria-hidden="true"><path d="M12 2a7 7 0 0 1 7 7c0 4.3-4.74 10.34-6.24 12.13a1 1 0 0 1-1.52 0C9.74 19.34 5 13.3 5 9a7 7 0 0 1 7-7Zm0 9.5A2.5 2.5 0 1 0 12 6a2.5 2.5 0 0 0 0 5.5Z"/></svg>'; 536 555 } -
yps-bundle/trunk/includes/class-yps-api.php
r3484054 r3484915 161 161 } 162 162 163 public function get_ slotflow_forms( $token, $tenant_endpoint ) {163 public function get_widget_forms( $token, $tenant_endpoint ) { 164 164 $query = <<<'GRAPHQL' 165 query YpsBundle SlotflowForms {165 query YpsBundleWidgetForms { 166 166 customEntitiesPaginated(entityType: "form", first: 100, orderBy: { column: "created_at", order: DESC }) { 167 167 data { … … 196 196 return array( 197 197 'success' => false, 198 'error' => $this->parse_error_message( $data, 'Unable to load Slotflowforms.' ),198 'error' => $this->parse_error_message( $data, 'Unable to load forms.' ), 199 199 'code' => $code, 200 200 ); -
yps-bundle/trunk/includes/class-yps-frontend.php
r3484054 r3484915 45 45 $overrides = array(); 46 46 47 if ( 'slotflow' === $widget['slug']) {47 if ( $this->widget_supports_form_slug( $widget ) ) { 48 48 $form_slug = trim( (string) ( $atts['form'] ?: $atts['form_slug'] ) ); 49 49 … … 81 81 $api_url = yps_bundle_get_api_url() . '/' . $tenant['endpoint'] . '/graphql'; 82 82 83 if ( 'slotflow' === $widget_slug) {83 if ( $this->widget_supports_form_slug( $widget ) ) { 84 84 $form_slug = trim( (string) ( $overrides['form_slug'] ?? ( $settings['form_slug'] ?? '' ) ) ); 85 85 … … 89 89 90 90 return sprintf( 91 '<slotflow-booking api-url="%1$s" form-slug="%2$s"></slotflow-booking>', 91 '<%1$s api-url="%2$s" form-slug="%3$s"></%1$s>', 92 esc_attr( $widget['tag_name'] ), 92 93 esc_attr( $api_url ), 93 94 esc_attr( $form_slug ) … … 96 97 97 98 return sprintf( 98 '<locate-my-store api-url="%1$s"></locate-my-store>', 99 '<%1$s api-url="%2$s"></%1$s>', 100 esc_attr( $widget['tag_name'] ), 99 101 esc_attr( $api_url ) 100 102 ); … … 110 112 return null; 111 113 } 114 115 private function widget_supports_form_slug( $widget ) { 116 if ( empty( $widget['fields'] ) || ! is_array( $widget['fields'] ) ) { 117 return false; 118 } 119 120 foreach ( $widget['fields'] as $field ) { 121 if ( ! empty( $field['key'] ) && 'form_slug' === $field['key'] ) { 122 return true; 123 } 124 } 125 126 return false; 127 } 112 128 } -
yps-bundle/trunk/readme.txt
r3484054 r3484915 1 1 === Jinkosoft === 2 2 Contributors: jinkosoft 3 Tags: widgets, booking, store locator, embeddable, shortcode3 Tags: widgets, booking, store locator, lead capture, embeddable, shortcode 4 4 Requires at least: 5.0 5 5 Tested up to: 6.7 … … 9 9 License URI: https://www.gnu.org/licenses/gpl-2.0.html 10 10 11 Connect your Jinkosoft account and embed booking and store locator widgets in WordPress without adding heavy app logic to your site.11 Connect your Jinkosoft account and embed booking, lead capture, and store locator widgets in WordPress without adding heavy app logic to your site. 12 12 13 13 == Description == … … 20 20 21 21 * Slotflow: an embeddable booking widget for appointments and calls 22 * Lead Capture Widget: an embeddable popup widget for collecting leads and contact requests 22 23 * Locate My Store: an embeddable store locator that points visitors to the right location 23 24 … … 37 38 For more information, visit: 38 39 39 * `https://jinkosoft.com/en/embeddable-widgets/slotflow` 40 * [https://jinkosoft.com/en/embeddable-widgets/slotflow](https://jinkosoft.com/en/embeddable-widgets/slotflow) 41 42 = Lead Capture Widget = 43 44 Lead Capture Widget helps you collect leads directly from your website with a lightweight popup experience. 45 46 Visitors can: 47 48 * open or receive a popup form on the page 49 * submit contact details or a short message 50 * complete a lead capture flow without leaving the website 51 52 Lead Capture Widget is designed for contact requests, sales inquiries, newsletter interest, early-access lists, and similar lead generation flows. Depending on your Jinkosoft workspace setup, it can also support configurable popup timing, branding rules, field selection, and form-specific embed flows managed from the external Jinkosoft dashboard. 53 54 For more information, visit: 55 56 * [https://jinkosoft.com/en/embeddable-widgets/leadcapture](https://jinkosoft.com/en/embeddable-widgets/leadcapture) 40 57 41 58 = Locate My Store = … … 54 71 For more information, visit: 55 72 56 * `https://jinkosoft.com/en/embeddable-widgets/locatemystore`73 * [https://jinkosoft.com/en/embeddable-widgets/locatemystore](https://jinkosoft.com/en/embeddable-widgets/locatemystore) 57 74 58 75 = Why site owners use Jinkosoft = … … 61 78 * Enable the widgets you need from one plugin page 62 79 * Insert widgets with shortcode exactly where you want them 63 * Manage widget-specific settings such as the Slotflow form slug80 * Manage widget-specific settings such as form slug selection for Slotflow and Lead Capture Widget 64 81 * Open the related Jinkosoft dashboard directly from WordPress 65 82 … … 68 85 * Add a booking form to a sales page or contact page 69 86 * Use different Slotflow forms on different pages with shortcode attributes 70 * Show a store locator across the whole website71 * Restrict a widget to selected landing pages only87 * Add a popup lead capture form to landing pages or campaign pages 88 * Show a store locator on location or visit-us pages 72 89 73 90 == Screenshots == … … 84 101 5. Click `Try` or `Configure` on the widget you want to use 85 102 6. Copy the shortcode and place it in the page, post, or block where the widget should appear 86 7. For Slotflow , select the form you want to display103 7. For Slotflow and Lead Capture Widget, select the form you want to display 87 104 88 105 == Frequently Asked Questions == … … 99 116 * choose the exact page position where the widget should appear 100 117 101 For Slotflow , you can also use different forms on different pages with shortcode attributes such as:118 For Slotflow and Lead Capture Widget, you can also use different forms on different pages with shortcode attributes such as: 102 119 103 120 `[jinkosoft-slotflow form="demo-booking"]` 104 121 122 `[jinkosoft-lead-capture form="newsletter-popup"]` 123 105 124 = Will this plugin slow down my WordPress site? = 106 125 107 The plugin is designed to stay lightweight on the WordPress side. It does not ship a large internal booking or locator application inside WordPress. Instead, it relies on the external Jinkosoft services and only loads the required embeddable widget scripts when the widget is actually used.126 The plugin is designed to stay lightweight on the WordPress side. It does not ship a large internal booking, lead capture, or locator application inside WordPress. Instead, it relies on the external Jinkosoft services and only loads the required embeddable widget scripts when the widget is actually used. 108 127 109 128 = Does this plugin use third-party services? = … … 115 134 = Jinkosoft API = 116 135 117 The plugin communicates with the Jinkosoft API to register or log in administrators, load the list of active workspaces, create widget workspaces, and serve widget data toembeddable components.136 The plugin communicates with the Jinkosoft API to create or log in administrator accounts, load active workspaces, provision widget workspaces, and serve widget data to the embeddable components. 118 137 119 * Service URL: `https://server.jinkosoft.com` 120 * Used for: account creation, authentication, workspace provisioning, and widget data delivery 121 * Data sent: administrator name, email, password, and widget configuration requests; visitors may send booking or store locator data through the embeddable widgets 122 * Terms of Service: `https://jinkosoft.com/en/terms-and-conditions` 123 * Privacy Policy: `https://jinkosoft.com/en/privacy-policy` 138 * Service: [Jinkosoft API](https://server.jinkosoft.com) 139 * Data sent: administrator name, email, password, workspace configuration requests, and visitor-submitted booking, lead capture, or store locator data when the widgets are used 140 * Terms of Service: [https://jinkosoft.com/en/terms-and-conditions](https://jinkosoft.com/en/terms-and-conditions) 141 * Privacy Policy: [https://jinkosoft.com/en/privacy-policy](https://jinkosoft.com/en/privacy-policy) 124 142 125 143 = Jinkosoft Widget CDN = … … 127 145 The plugin loads the widget scripts from the Jinkosoft CDN when the widgets are used on the website. 128 146 129 * Service URL: `https://cdn-widgets.jinkosoft.com`147 * Service: [Jinkosoft Widget CDN](https://cdn-widgets.jinkosoft.com) 130 148 * Used for: delivering the embeddable widget scripts to visitors' browsers 131 * Services loaded: 132 ** `https://cdn-widgets.jinkosoft.com/widgets.iife.js` 133 * Terms of Service: `https://jinkosoft.com/en/terms-and-conditions` 134 * Privacy Policy: `https://jinkosoft.com/en/privacy-policy` 149 * Script loaded: [https://cdn-widgets.jinkosoft.com/widgets.iife.js](https://cdn-widgets.jinkosoft.com/widgets.iife.js) 150 * Terms of Service: [https://jinkosoft.com/en/terms-and-conditions](https://jinkosoft.com/en/terms-and-conditions) 151 * Privacy Policy: [https://jinkosoft.com/en/privacy-policy](https://jinkosoft.com/en/privacy-policy) 135 152 136 153 == Changelog == 137 154 155 = 1.0.1 = 156 Adding Lead Capture Widget 157 138 158 = 1.0.0 = 139 * Initial release 159 * Initial release: Locate My Store, Slotflow -
yps-bundle/trunk/yps-bundle.php
r3484054 r3484915 3 3 * Plugin Name: Jinkosoft 4 4 * Description: Connect your Jinkosoft account and configure embeddable widgets like Locate My Store and Slotflow. 5 * Version: 1. 0.05 * Version: 1.1.0 6 6 * Author: JinkoSoft 7 7 * Text Domain: yps-bundle … … 112 112 ), 113 113 ), 114 'leadcapture' => array( 115 'slug' => 'leadcapture', 116 'name' => 'Lead Capture Widget', 117 'tenant_type' => 'lead_capture', 118 'default_plan' => 'free', 119 'shortcode_tag' => 'jinkosoft-lead-capture', 120 'shortcode_label' => '[jinkosoft-lead-capture]', 121 'tag_name' => 'lead-capture-widget', 122 'script_name' => 'widgets.iife.js', 123 'description' => 'Capture leads with a popup-first widget managed from Jinkosoft.', 124 'icon' => 'lead', 125 'fields' => array( 126 array( 127 'key' => 'form_slug', 128 'label' => 'Form slug', 129 'type' => 'text', 130 'required' => true, 131 'description' => 'Choose the lead capture form you want to display in the popup widget.', 132 ), 133 ), 134 ), 114 135 ); 115 136
Note: See TracChangeset
for help on using the changeset viewer.