Plugin Directory

Changeset 2758243


Ignore:
Timestamp:
07/19/2022 12:02:31 AM (3 years ago)
Author:
thomasplevy
Message:

Release v7.0.0-alpha.4

Location:
lifterlms
Files:
16 edited
1 copied

Legend:

Unmodified
Added
Removed
  • lifterlms/tags/7.0.0-alpha.4/assets/js/llms-spinner.asset.php

    r2757452 r2758243  
    1 <?php return array('dependencies' => array('wp-i18n', 'wp-polyfill'), 'version' => 'c8c84c4118bca5f0d275b240a164f419');
     1<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill'), 'version' => '5269616cd5155bce694d623de2968c12');
  • lifterlms/tags/7.0.0-alpha.4/assets/maps/js/llms-form-checkout.min.js.map

    r2757452 r2758243  
    1 {"version":3,"file":"../../js/llms-form-checkout.min.js","sources":["llms-form-checkout.js"],"sourcesContent":["/**\n * LifterLMS Checkout Screen related events and interactions\n *\n * @package LifterLMS/Scripts\n *\n * @since 3.0.0\n * @version 7.0.0-alpha.3\n */\n\n( function( $ ) {\n\n\tvar llms_checkout = function() {\n\n\t\t/**\n\t\t * Array of validation functions to call on form submission\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar before_submit = [];\n\n\t\t/**\n\t\t * Array of gateways to be automatically bound when needed\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar gateways = [];\n\n\t\tthis.$checkout_form = $( '#llms-product-purchase-form' );\n\t\tthis.$confirm_form  = $( '#llms-product-purchase-confirm-form' );\n\t\tthis.$form_sections = false;\n\t\tthis.form_action    = false;\n\n\t\t/**\n\t\t * Initialize checkout JS & bind if on the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 Make sure we bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *               even if there's no llms product purchase form.\n\t\t * @since 7.0.0-alpha.3 Disable smooth scroll-behavior on checkout.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.init = function() {\n\n\t\t\tvar self = this;\n\n\t\t\tif ( $( '.llms-checkout-wrapper' ).length ) {\n\t\t\t\tthis.bind_login();\n\t\t\t}\n\n\t\t\tif ( this.$checkout_form.length ) {\n\n\t\t\t\tthis.form_action    = 'checkout';\n\t\t\t\tthis.$form_sections = this.$checkout_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$checkout_form.on( 'submit', this, this.submit );\n\n\t\t\t\t/**\n\t\t\t\t * Fix `HTMLFormElement.reportValidity()` when `scroll-behavior: smooth`.\n\t\t\t\t * \n\t\t\t\t * @see {@link https://github.com/gocodebox/lifterlms/issues/2206}\n\t\t\t\t */\n\t\t\t\tdocument.querySelector( 'html' ).style.scrollBehavior = 'auto';\n\n\t\t\t\t// add before submit event for password strength meter if one's found\n\t\t\t\tif ( $( '.llms-password-strength-meter' ).length ) {\n\t\t\t\t\tthis.add_before_submit_event( {\n\t\t\t\t\t\tdata: LLMS.PasswordStrength,\n\t\t\t\t\t\thandler: LLMS.PasswordStrength.checkout,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tthis.bind_coupon();\n\n\t\t\t\tthis.bind_gateways();\n\n\t\t\t} else if ( this.$confirm_form.length ) {\n\n\t\t\t\tthis.form_action    = 'confirm';\n\t\t\t\tthis.$form_sections = this.$confirm_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$confirm_form.on( 'submit', function() {\n\t\t\t\t\tself.processing( 'start' );\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * before submit events to llms checkout private \"before_submit\" array\n\t\t *\n\t\t * @param    object  obj  object of data to push to the array\n\t\t *                        requires at least a \"handler\" key which should pass a callable function\n\t\t *                        \"data\" can be anything, will be passed as the first parameter to the handler function\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_before_submit_event = function( obj ) {\n\n\t\t\tif ( ! obj.handler || 'function' !== typeof obj.handler ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! obj.data ) {\n\t\t\t\tobj.data = null;\n\t\t\t}\n\n\t\t\tbefore_submit.push( obj );\n\n\t\t};\n\n\t\t/**\n\t\t * Add an error message\n\t\t *\n\t\t * @param    string     message  error message string\n\t\t * @param    mixed      data     optional error data to output on the console\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.add_error = function( message, data ) {\n\n\t\t\tvar id   = 'llms-checkout-errors';\n\t\t\t\t$err = $( '#' + id );\n\n\t\t\tif ( ! $err.length ) {\n\t\t\t\t$err = $( '<ul class=\"llms-notice llms-error\" id=\"' + id + '\" />' );\n\t\t\t\t$( '.llms-checkout-wrapper' ).prepend( $err );\n\t\t\t}\n\n\t\t\t$err.append( '<li>' + message + '</li>' );\n\n\t\t\tif ( data ) {\n\t\t\t\tconsole.error( data );\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * gateways classes that should be bound by this class\n\t\t *\n\t\t * @param    obj   gateway_class  callable class object\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_gateway = function( gateway_class ) {\n\n\t\t\tgateways.push( gateway_class );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind coupon add & remove button events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_coupon = function() {\n\n\t\t\tvar self = this;\n\n\t\t\t// show & hide the coupon field & button\n\t\t\t$( 'a[href=\"#llms-coupon-toggle\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( '.llms-coupon-entry' ).slideToggle( 400 );\n\n\t\t\t} );\n\n\t\t\t// apply coupon click\n\t\t\t$( '#llms-apply-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_apply( $( this ) );\n\n\t\t\t} );\n\n\t\t\t// remove coupon click\n\t\t\t$( '#llms-remove-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_remove( $( this ) );\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind gateway section events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_gateways = function() {\n\n\t\t\tthis.load_gateways();\n\n\t\t\tif ( ! $( 'input[name=\"llms_payment_gateway\"]' ).length ) {\n\t\t\t\t$( '#llms_create_pending_order' ).removeAttr( 'disabled' );\n\t\t\t}\n\n\t\t\t// add class and trigger watchable event when gateway selection changes\n\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).on( 'change', function() {\n\n\t\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).each( function() {\n\n\t\t\t\t\tvar $el          = $( this ),\n\t\t\t\t\t\t$parent      = $el.closest( '.llms-payment-gateway' ),\n\t\t\t\t\t\t$fields      = $parent.find( '.llms-gateway-fields' ).find( 'input, textarea, select' ),\n\t\t\t\t\t\tchecked      = $el.is( ':checked' ),\n\t\t\t\t\t\tdisplay_func = ( checked ) ? 'addClass' : 'removeClass';\n\n\t\t\t\t\t$parent[ display_func ]( 'is-selected' );\n\n\t\t\t\t\tif ( checked ) {\n\n\t\t\t\t\t\t// enable fields\n\t\t\t\t\t\t$fields.removeAttr( 'disabled' );\n\n\t\t\t\t\t\t// emit a watchable event for extensions to hook onto\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).trigger( 'llms-gateway-selected', {\n\t\t\t\t\t\t\tid: $el.val(),\n\t\t\t\t\t\t\t$selector: $parent,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// disable fields\n\t\t\t\t\t\t$fields.attr( 'disabled', 'disabled' );\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t} );\n\n\t\t\t// enable / disable buttons depending on field validation status\n\t\t\t$( '.llms-payment-gateways' ).on( 'llms-gateway-selected', function( e, data ) {\n\n\t\t\t\tvar $submit = $( '#llms_create_pending_order' );\n\n\t\t\t\tif ( data.$selector && data.$selector.find( '.llms-gateway-fields .invalid' ).length ) {\n\t\t\t\t\t$submit.attr( 'disabled', 'disabled' );\n\t\t\t\t} else {\n\t\t\t\t\t$submit.removeAttr( 'disabled' );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 When showing the login form area make sure we slide up the `.llms-notice` link's parent too.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.bind_login = function() {\n\n\t\t\t$( 'a[href=\"#llms-show-login\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( this ).closest( '.llms-info,.llms-notice' ).slideUp( 400 );\n\t\t\t\t$( 'form.llms-login' ).slideDown( 400 );\n\n\t\t\t} );\n\t\t};\n\n\t\t/**\n\t\t * Clear error messages\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.clear_errors = function() {\n\t\t\t$( '#llms-checkout-errors' ).remove();\n\t\t};\n\n\t\t/**\n\t\t * Triggered by clicking the \"Apply Coupon\" Button\n\t\t * Validates the coupon via JS and adds error / success messages\n\t\t * On success it will replace partials on the checkout screen with updated\n\t\t * prices and a \"remove coupon\" button\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Apply button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_apply = function ( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$code      = $( '#llms_coupon_code' ),\n\t\t\t\tcode       = $code.val(),\n\t\t\t\t$messages  = $( '.llms-coupon-messages' ),\n\t\t\t\t$errors    = $messages.find( '.llms-error' ),\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'validate_coupon_code',\n\t\t\t\t\tcode: code,\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tbeforeSend: function() {\n\n\t\t\t\t\t$errors.hide();\n\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( 'error' === r.code ) {\n\n\t\t\t\t\t\tvar $message = $( '<li>' + r.message + '</li>' );\n\n\t\t\t\t\t\tif ( ! $errors.length ) {\n\n\t\t\t\t\t\t\t$errors = $( '<ul class=\"llms-notice llms-error\" />' );\n\t\t\t\t\t\t\t$messages.append( $errors );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$errors.empty();\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$message.appendTo( $errors );\n\t\t\t\t\t\t$errors.show();\n\n\t\t\t\t\t} else if ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Called by clicking the \"Remove Coupon\" button\n\t\t * Removes the coupon via AJAX and unsets related session data\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Remove button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_remove = function( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'remove_coupon_code',\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Scroll error messages into view\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.focus_errors = function() {\n\t\t\t$( 'html, body' ).animate( {\n\t\t\t\tscrollTop: $( '#llms-checkout-errors' ).offset().top - 50,\n\t\t\t}, 200 );\n\t\t};\n\n\t\t/**\n\t\t * Bind external gateway JS\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.load_gateways = function() {\n\n\t\t\tfor ( var i = 0; i <= gateways.length; i++ ) {\n\t\t\t\tvar g = gateways[i];\n\t\t\t\tif ( typeof g === 'object' && g !== null ) {\n\t\t\t\t\tif ( g.bind !== undefined && 'function' === typeof g.bind  ) {\n\t\t\t\t\t\tg.bind();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * Start or stop processing events on the checkout form\n\t\t *\n\t\t * @param    string   action  whether to start or stop processing [start|stop]\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.24.1\n\t\t */\n\t\tthis.processing = function( action ) {\n\n\t\t\tvar func, $form;\n\n\t\t\tswitch ( action ) {\n\n\t\t\t\tcase 'stop':\n\t\t\t\t\tfunc = 'removeClass';\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'start':\n\t\t\t\tdefault:\n\t\t\t\t\tfunc = 'addClass';\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( 'checkout' === this.form_action ) {\n\t\t\t\t$form = this.$checkout_form;\n\t\t\t} else if ( 'confirm' === this.form_action ) {\n\t\t\t\t$form = this.$confirm_form;\n\t\t\t}\n\n\t\t\t$form[ func ]( 'llms-is-processing' );\n\t\t\tLLMS.Spinner[ action ]( this.$form_sections );\n\n\t\t};\n\n\t\t/**\n\t\t * Handles form submission\n\t\t * Calls all validation events in `before_submit[]`\n\t\t * waits for call backs and either displays returned errors\n\t\t * or submits the form when all are successful\n\t\t *\n\t\t * @param    obj   e  JS event object\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.submit = function( e ) {\n\n\t\t\tvar self       = e.data,\n\t\t\t\tnum        = before_submit.length,\n\t\t\t\tchecks     = 0,\n\t\t\t\tmax_checks = 60000,\n\t\t\t\terrors     = [],\n\t\t\t\tfinishes   = 0,\n\t\t\t\tsuccesses  = 0,\n\t\t\t\tinterval;\n\n\t\t\te.preventDefault();\n\n\t\t\t// add spinners\n\t\t\tself.processing( 'start' );\n\n\t\t\t// remove errors to prevent duplicates\n\t\t\tself.clear_errors();\n\n\t\t\t// start running all the events\n\t\t\tfor ( var i = 0; i < before_submit.length; i++ ) {\n\n\t\t\t\tvar obj = before_submit[ i ];\n\n\t\t\t\tobj.handler( obj.data, function( r ) {\n\n\t\t\t\t\tfinishes++;\n\t\t\t\t\tif ( true === r ) {\n\t\t\t\t\t\tsuccesses++;\n\t\t\t\t\t} else if ( 'string' === typeof r ) {\n\t\t\t\t\t\terrors.push( r );\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\t// run an interval to wait for finishes\n\t\t\tinterval = setInterval( function() {\n\n\t\t\t\tvar clear = false,\n\t\t\t\t\tstop  = false;\n\n\t\t\t\t// timeout...\n\t\t\t\tif ( checks >= max_checks ) {\n\n\t\t\t\t\tclear = true;\n\t\t\t\t\tstop  = true;\n\n\t\t\t\t} else if ( num === finishes ) {\n\t\t\t\t\t// everything has finished\n\n\t\t\t\t\t// all were successful, submit the form\n\t\t\t\t\tif ( num === successes ) {\n\n\t\t\t\t\t\tclear = true;\n\n\t\t\t\t\t\tself.$checkout_form.off( 'submit', self.submit );\n\t\t\t\t\t\tself.$checkout_form.trigger( 'submit' );\n\n\t\t\t\t\t} else if ( errors.length ) {\n\n\t\t\t\t\t\tclear = true;\n\t\t\t\t\t\tstop  = true;\n\n\t\t\t\t\t\tfor ( var i = 0; i < errors.length; i++ ) {\n\t\t\t\t\t\t\tself.add_error( errors[ i ] );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tself.focus_errors();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( clear ) {\n\t\t\t\t\tclearInterval( interval );\n\t\t\t\t}\n\n\t\t\t\tif ( stop ) {\n\t\t\t\t\tself.processing( 'stop' );\n\t\t\t\t}\n\n\t\t\t\tchecks++;\n\n\t\t\t}, 100 );\n\n\t\t};\n\n\t\t// initialize\n\t\tthis.init();\n\n\t\treturn this;\n\n\t};\n\n\twindow.llms          = window.llms || {};\n\twindow.llms.checkout = new llms_checkout();\n\n} )( jQuery );\n"],"names":["$","window","llms","checkout","before_submit","gateways","this","$checkout_form","$confirm_form","$form_sections","form_action","init","self","length","bind_login","find","on","submit","document","querySelector","style","scrollBehavior","add_before_submit_event","data","LLMS","PasswordStrength","handler","bind_coupon","bind_gateways","processing","obj","push","add_error","message","id","$err","prepend","append","console","error","add_gateway","gateway_class","e","preventDefault","slideToggle","coupon_apply","coupon_remove","load_gateways","removeAttr","each","$el","$parent","closest","$fields","checked","is","trigger","val","$selector","attr","$submit","slideUp","slideDown","clear_errors","remove","$btn","code","$messages","$errors","$container","Spinner","start","Ajax","call","action","plan_id","beforeSend","hide","success","r","$message","stop","empty","appendTo","show","replaceWith","coupon_html","gateways_html","summary_html","focus_errors","animate","scrollTop","offset","top","i","g","undefined","bind","$form","func","interval","num","checks","errors","finishes","successes","setInterval","clear","off","clearInterval","jQuery"],"mappings":"CASA,SAAYA,GA4jBXC,OAAOC,KAAgBD,OAAOC,MAAQ,GACtCD,OAAOC,KAAKC,SAAW,IA3jBH,WASnB,IAAIC,EAAgB,GAShBC,EAAW,GAoiBf,OAliBAC,KAAKC,eAAiBP,EAAG,+BACzBM,KAAKE,cAAiBR,EAAG,uCACzBM,KAAKG,gBAAiB,EACtBH,KAAKI,aAAiB,EAYtBJ,KAAKK,KAAO,WAEX,IAAIC,EAAON,KAENN,EAAG,0BAA2Ba,QAClCP,KAAKQ,aAGDR,KAAKC,eAAeM,QAExBP,KAAKI,YAAiB,WACtBJ,KAAKG,eAAiBH,KAAKC,eAAeQ,KAAM,0BAEhDT,KAAKC,eAAeS,GAAI,SAAUV,KAAMA,KAAKW,QAO7CC,SAASC,cAAe,QAASC,MAAMC,eAAiB,OAGnDrB,EAAG,iCAAkCa,QACzCP,KAAKgB,wBAAyB,CAC7BC,KAAMC,KAAKC,iBACXC,QAASF,KAAKC,iBAAiBtB,WAIjCG,KAAKqB,cAELrB,KAAKsB,iBAEMtB,KAAKE,cAAcK,SAE9BP,KAAKI,YAAiB,UACtBJ,KAAKG,eAAiBH,KAAKE,cAAcO,KAAM,0BAE/CT,KAAKE,cAAcQ,GAAI,SAAU,WAChCJ,EAAKiB,WAAY,aAiBpBvB,KAAKgB,wBAA0B,SAAUQ,GAEjCA,EAAIJ,SAAW,mBAAsBI,EAAIJ,UAIzCI,EAAIP,OACVO,EAAIP,KAAO,MAGZnB,EAAc2B,KAAMD,KAar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,EAAWM,YAAa,WAEvB,IAAIC,GAAQ,EACX1B,GAAQ,EAGT,GAvCa,KAuCRqB,EAGJrB,EADA0B,GAAQ,OAGF,GAAKN,IAAQG,EAInB,GAAKH,IAAQI,EAEZE,GAAQ,EAER/F,EAAKL,eAAeqG,IAAK,SAAUhG,EAAKK,QACxCL,EAAKL,eAAeiD,QAAS,eAEvB,GAAK+C,EAAO1F,OAAS,CAK3B,IAAM,IAHN8F,GAAQ,EACR1B,GAAQ,EAEEa,EAAI,EAAGA,EAAIS,EAAO1F,OAAQiF,IACnClF,EAAKoB,UAAWuE,EAAQT,IAGzBlF,EAAK6E,eAMFkB,GACJE,cAAeT,GAGXnB,GACJrE,EAAKiB,WAAY,QAGlByE,KAEE,MAKJhG,KAAKK,OAEEL,MAxjBT,CA+jBKwG","sourceRoot":"../../js"}
     1{"version":3,"file":"../../js/llms-form-checkout.min.js","sources":["llms-form-checkout.js"],"sourcesContent":["/**\n * LifterLMS Checkout Screen related events and interactions\n *\n * @package LifterLMS/Scripts\n *\n * @since 3.0.0\n * @version 7.0.0-alpha.4\n */\n\n( function( $ ) {\n\n\tvar llms_checkout = function() {\n\n\t\t/**\n\t\t * Array of validation functions to call on form submission\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar before_submit = [];\n\n\t\t/**\n\t\t * Array of gateways to be automatically bound when needed\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar gateways = [];\n\n\t\tthis.$checkout_form = $( '#llms-product-purchase-form' );\n\t\tthis.$confirm_form  = $( '#llms-product-purchase-confirm-form' );\n\t\tthis.$form_sections = false;\n\t\tthis.form_action    = false;\n\n\t\t/**\n\t\t * Initialize checkout JS & bind if on the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 Make sure we bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *               even if there's no llms product purchase form.\n\t\t * @since 7.0.0-alpha.4 Disable smooth scroll-behavior on checkout.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.init = function() {\n\n\t\t\tvar self = this;\n\n\t\t\tif ( $( '.llms-checkout-wrapper' ).length ) {\n\t\t\t\tthis.bind_login();\n\t\t\t}\n\n\t\t\tif ( this.$checkout_form.length ) {\n\n\t\t\t\tthis.form_action    = 'checkout';\n\t\t\t\tthis.$form_sections = this.$checkout_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$checkout_form.on( 'submit', this, this.submit );\n\n\t\t\t\t/**\n\t\t\t\t * Fix `HTMLFormElement.reportValidity()` when `scroll-behavior: smooth`.\n\t\t\t\t * \n\t\t\t\t * @see {@link https://github.com/gocodebox/lifterlms/issues/2206}\n\t\t\t\t */\n\t\t\t\tdocument.querySelector( 'html' ).style.scrollBehavior = 'auto';\n\n\t\t\t\t// add before submit event for password strength meter if one's found\n\t\t\t\tif ( $( '.llms-password-strength-meter' ).length ) {\n\t\t\t\t\tthis.add_before_submit_event( {\n\t\t\t\t\t\tdata: LLMS.PasswordStrength,\n\t\t\t\t\t\thandler: LLMS.PasswordStrength.checkout,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tthis.bind_coupon();\n\n\t\t\t\tthis.bind_gateways();\n\n\t\t\t} else if ( this.$confirm_form.length ) {\n\n\t\t\t\tthis.form_action    = 'confirm';\n\t\t\t\tthis.$form_sections = this.$confirm_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$confirm_form.on( 'submit', function() {\n\t\t\t\t\tself.processing( 'start' );\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * before submit events to llms checkout private \"before_submit\" array\n\t\t *\n\t\t * @param    object  obj  object of data to push to the array\n\t\t *                        requires at least a \"handler\" key which should pass a callable function\n\t\t *                        \"data\" can be anything, will be passed as the first parameter to the handler function\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_before_submit_event = function( obj ) {\n\n\t\t\tif ( ! obj.handler || 'function' !== typeof obj.handler ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! obj.data ) {\n\t\t\t\tobj.data = null;\n\t\t\t}\n\n\t\t\tbefore_submit.push( obj );\n\n\t\t};\n\n\t\t/**\n\t\t * Add an error message\n\t\t *\n\t\t * @param    string     message  error message string\n\t\t * @param    mixed      data     optional error data to output on the console\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.add_error = function( message, data ) {\n\n\t\t\tvar id   = 'llms-checkout-errors';\n\t\t\t\t$err = $( '#' + id );\n\n\t\t\tif ( ! $err.length ) {\n\t\t\t\t$err = $( '<ul class=\"llms-notice llms-error\" id=\"' + id + '\" />' );\n\t\t\t\t$( '.llms-checkout-wrapper' ).prepend( $err );\n\t\t\t}\n\n\t\t\t$err.append( '<li>' + message + '</li>' );\n\n\t\t\tif ( data ) {\n\t\t\t\tconsole.error( data );\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * gateways classes that should be bound by this class\n\t\t *\n\t\t * @param    obj   gateway_class  callable class object\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_gateway = function( gateway_class ) {\n\n\t\t\tgateways.push( gateway_class );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind coupon add & remove button events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_coupon = function() {\n\n\t\t\tvar self = this;\n\n\t\t\t// show & hide the coupon field & button\n\t\t\t$( 'a[href=\"#llms-coupon-toggle\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( '.llms-coupon-entry' ).slideToggle( 400 );\n\n\t\t\t} );\n\n\t\t\t// apply coupon click\n\t\t\t$( '#llms-apply-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_apply( $( this ) );\n\n\t\t\t} );\n\n\t\t\t// remove coupon click\n\t\t\t$( '#llms-remove-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_remove( $( this ) );\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind gateway section events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_gateways = function() {\n\n\t\t\tthis.load_gateways();\n\n\t\t\tif ( ! $( 'input[name=\"llms_payment_gateway\"]' ).length ) {\n\t\t\t\t$( '#llms_create_pending_order' ).removeAttr( 'disabled' );\n\t\t\t}\n\n\t\t\t// add class and trigger watchable event when gateway selection changes\n\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).on( 'change', function() {\n\n\t\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).each( function() {\n\n\t\t\t\t\tvar $el          = $( this ),\n\t\t\t\t\t\t$parent      = $el.closest( '.llms-payment-gateway' ),\n\t\t\t\t\t\t$fields      = $parent.find( '.llms-gateway-fields' ).find( 'input, textarea, select' ),\n\t\t\t\t\t\tchecked      = $el.is( ':checked' ),\n\t\t\t\t\t\tdisplay_func = ( checked ) ? 'addClass' : 'removeClass';\n\n\t\t\t\t\t$parent[ display_func ]( 'is-selected' );\n\n\t\t\t\t\tif ( checked ) {\n\n\t\t\t\t\t\t// enable fields\n\t\t\t\t\t\t$fields.removeAttr( 'disabled' );\n\n\t\t\t\t\t\t// emit a watchable event for extensions to hook onto\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).trigger( 'llms-gateway-selected', {\n\t\t\t\t\t\t\tid: $el.val(),\n\t\t\t\t\t\t\t$selector: $parent,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// disable fields\n\t\t\t\t\t\t$fields.attr( 'disabled', 'disabled' );\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t} );\n\n\t\t\t// enable / disable buttons depending on field validation status\n\t\t\t$( '.llms-payment-gateways' ).on( 'llms-gateway-selected', function( e, data ) {\n\n\t\t\t\tvar $submit = $( '#llms_create_pending_order' );\n\n\t\t\t\tif ( data.$selector && data.$selector.find( '.llms-gateway-fields .invalid' ).length ) {\n\t\t\t\t\t$submit.attr( 'disabled', 'disabled' );\n\t\t\t\t} else {\n\t\t\t\t\t$submit.removeAttr( 'disabled' );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 When showing the login form area make sure we slide up the `.llms-notice` link's parent too.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.bind_login = function() {\n\n\t\t\t$( 'a[href=\"#llms-show-login\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( this ).closest( '.llms-info,.llms-notice' ).slideUp( 400 );\n\t\t\t\t$( 'form.llms-login' ).slideDown( 400 );\n\n\t\t\t} );\n\t\t};\n\n\t\t/**\n\t\t * Clear error messages\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.clear_errors = function() {\n\t\t\t$( '#llms-checkout-errors' ).remove();\n\t\t};\n\n\t\t/**\n\t\t * Triggered by clicking the \"Apply Coupon\" Button\n\t\t * Validates the coupon via JS and adds error / success messages\n\t\t * On success it will replace partials on the checkout screen with updated\n\t\t * prices and a \"remove coupon\" button\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Apply button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_apply = function ( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$code      = $( '#llms_coupon_code' ),\n\t\t\t\tcode       = $code.val(),\n\t\t\t\t$messages  = $( '.llms-coupon-messages' ),\n\t\t\t\t$errors    = $messages.find( '.llms-error' ),\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'validate_coupon_code',\n\t\t\t\t\tcode: code,\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tbeforeSend: function() {\n\n\t\t\t\t\t$errors.hide();\n\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( 'error' === r.code ) {\n\n\t\t\t\t\t\tvar $message = $( '<li>' + r.message + '</li>' );\n\n\t\t\t\t\t\tif ( ! $errors.length ) {\n\n\t\t\t\t\t\t\t$errors = $( '<ul class=\"llms-notice llms-error\" />' );\n\t\t\t\t\t\t\t$messages.append( $errors );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$errors.empty();\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$message.appendTo( $errors );\n\t\t\t\t\t\t$errors.show();\n\n\t\t\t\t\t} else if ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Called by clicking the \"Remove Coupon\" button\n\t\t * Removes the coupon via AJAX and unsets related session data\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Remove button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_remove = function( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'remove_coupon_code',\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Scroll error messages into view\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.focus_errors = function() {\n\t\t\t$( 'html, body' ).animate( {\n\t\t\t\tscrollTop: $( '#llms-checkout-errors' ).offset().top - 50,\n\t\t\t}, 200 );\n\t\t};\n\n\t\t/**\n\t\t * Bind external gateway JS\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.load_gateways = function() {\n\n\t\t\tfor ( var i = 0; i <= gateways.length; i++ ) {\n\t\t\t\tvar g = gateways[i];\n\t\t\t\tif ( typeof g === 'object' && g !== null ) {\n\t\t\t\t\tif ( g.bind !== undefined && 'function' === typeof g.bind  ) {\n\t\t\t\t\t\tg.bind();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * Start or stop processing events on the checkout form\n\t\t *\n\t\t * @param    string   action  whether to start or stop processing [start|stop]\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.24.1\n\t\t */\n\t\tthis.processing = function( action ) {\n\n\t\t\tvar func, $form;\n\n\t\t\tswitch ( action ) {\n\n\t\t\t\tcase 'stop':\n\t\t\t\t\tfunc = 'removeClass';\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'start':\n\t\t\t\tdefault:\n\t\t\t\t\tfunc = 'addClass';\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( 'checkout' === this.form_action ) {\n\t\t\t\t$form = this.$checkout_form;\n\t\t\t} else if ( 'confirm' === this.form_action ) {\n\t\t\t\t$form = this.$confirm_form;\n\t\t\t}\n\n\t\t\t$form[ func ]( 'llms-is-processing' );\n\t\t\tLLMS.Spinner[ action ]( this.$form_sections );\n\n\t\t};\n\n\t\t/**\n\t\t * Handles form submission\n\t\t * Calls all validation events in `before_submit[]`\n\t\t * waits for call backs and either displays returned errors\n\t\t * or submits the form when all are successful\n\t\t *\n\t\t * @param    obj   e  JS event object\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.submit = function( e ) {\n\n\t\t\tvar self       = e.data,\n\t\t\t\tnum        = before_submit.length,\n\t\t\t\tchecks     = 0,\n\t\t\t\tmax_checks = 60000,\n\t\t\t\terrors     = [],\n\t\t\t\tfinishes   = 0,\n\t\t\t\tsuccesses  = 0,\n\t\t\t\tinterval;\n\n\t\t\te.preventDefault();\n\n\t\t\t// add spinners\n\t\t\tself.processing( 'start' );\n\n\t\t\t// remove errors to prevent duplicates\n\t\t\tself.clear_errors();\n\n\t\t\t// start running all the events\n\t\t\tfor ( var i = 0; i < before_submit.length; i++ ) {\n\n\t\t\t\tvar obj = before_submit[ i ];\n\n\t\t\t\tobj.handler( obj.data, function( r ) {\n\n\t\t\t\t\tfinishes++;\n\t\t\t\t\tif ( true === r ) {\n\t\t\t\t\t\tsuccesses++;\n\t\t\t\t\t} else if ( 'string' === typeof r ) {\n\t\t\t\t\t\terrors.push( r );\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\t// run an interval to wait for finishes\n\t\t\tinterval = setInterval( function() {\n\n\t\t\t\tvar clear = false,\n\t\t\t\t\tstop  = false;\n\n\t\t\t\t// timeout...\n\t\t\t\tif ( checks >= max_checks ) {\n\n\t\t\t\t\tclear = true;\n\t\t\t\t\tstop  = true;\n\n\t\t\t\t} else if ( num === finishes ) {\n\t\t\t\t\t// everything has finished\n\n\t\t\t\t\t// all were successful, submit the form\n\t\t\t\t\tif ( num === successes ) {\n\n\t\t\t\t\t\tclear = true;\n\n\t\t\t\t\t\tself.$checkout_form.off( 'submit', self.submit );\n\t\t\t\t\t\tself.$checkout_form.trigger( 'submit' );\n\n\t\t\t\t\t} else if ( errors.length ) {\n\n\t\t\t\t\t\tclear = true;\n\t\t\t\t\t\tstop  = true;\n\n\t\t\t\t\t\tfor ( var i = 0; i < errors.length; i++ ) {\n\t\t\t\t\t\t\tself.add_error( errors[ i ] );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tself.focus_errors();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( clear ) {\n\t\t\t\t\tclearInterval( interval );\n\t\t\t\t}\n\n\t\t\t\tif ( stop ) {\n\t\t\t\t\tself.processing( 'stop' );\n\t\t\t\t}\n\n\t\t\t\tchecks++;\n\n\t\t\t}, 100 );\n\n\t\t};\n\n\t\t// initialize\n\t\tthis.init();\n\n\t\treturn this;\n\n\t};\n\n\twindow.llms          = window.llms || {};\n\twindow.llms.checkout = new llms_checkout();\n\n} )( jQuery );\n"],"names":["$","window","llms","checkout","before_submit","gateways","this","$checkout_form","$confirm_form","$form_sections","form_action","init","self","length","bind_login","find","on","submit","document","querySelector","style","scrollBehavior","add_before_submit_event","data","LLMS","PasswordStrength","handler","bind_coupon","bind_gateways","processing","obj","push","add_error","message","id","$err","prepend","append","console","error","add_gateway","gateway_class","e","preventDefault","slideToggle","coupon_apply","coupon_remove","load_gateways","removeAttr","each","$el","$parent","closest","$fields","checked","is","trigger","val","$selector","attr","$submit","slideUp","slideDown","clear_errors","remove","$btn","code","$messages","$errors","$container","Spinner","start","Ajax","call","action","plan_id","beforeSend","hide","success","r","$message","stop","empty","appendTo","show","replaceWith","coupon_html","gateways_html","summary_html","focus_errors","animate","scrollTop","offset","top","i","g","undefined","bind","$form","func","interval","num","checks","errors","finishes","successes","setInterval","clear","off","clearInterval","jQuery"],"mappings":"CASA,SAAYA,GA4jBXC,OAAOC,KAAgBD,OAAOC,MAAQ,GACtCD,OAAOC,KAAKC,SAAW,IA3jBH,WASnB,IAAIC,EAAgB,GAShBC,EAAW,GAoiBf,OAliBAC,KAAKC,eAAiBP,EAAG,+BACzBM,KAAKE,cAAiBR,EAAG,uCACzBM,KAAKG,gBAAiB,EACtBH,KAAKI,aAAiB,EAYtBJ,KAAKK,KAAO,WAEX,IAAIC,EAAON,KAENN,EAAG,0BAA2Ba,QAClCP,KAAKQ,aAGDR,KAAKC,eAAeM,QAExBP,KAAKI,YAAiB,WACtBJ,KAAKG,eAAiBH,KAAKC,eAAeQ,KAAM,0BAEhDT,KAAKC,eAAeS,GAAI,SAAUV,KAAMA,KAAKW,QAO7CC,SAASC,cAAe,QAASC,MAAMC,eAAiB,OAGnDrB,EAAG,iCAAkCa,QACzCP,KAAKgB,wBAAyB,CAC7BC,KAAMC,KAAKC,iBACXC,QAASF,KAAKC,iBAAiBtB,WAIjCG,KAAKqB,cAELrB,KAAKsB,iBAEMtB,KAAKE,cAAcK,SAE9BP,KAAKI,YAAiB,UACtBJ,KAAKG,eAAiBH,KAAKE,cAAcO,KAAM,0BAE/CT,KAAKE,cAAcQ,GAAI,SAAU,WAChCJ,EAAKiB,WAAY,aAiBpBvB,KAAKgB,wBAA0B,SAAUQ,GAEjCA,EAAIJ,S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AUwD,GAEhCyB,KACK,IAASzB,EACb0B,IACW,iBAAoB1B,GAC/BwB,EAAOxE,KAAMgD,KAQhBqB,EAAWM,YAAa,WAEvB,IAAIC,GAAQ,EACX1B,GAAQ,EAGT,GAvCa,KAuCRqB,EAGJrB,EADA0B,GAAQ,OAGF,GAAKN,IAAQG,EAInB,GAAKH,IAAQI,EAEZE,GAAQ,EAER/F,EAAKL,eAAeqG,IAAK,SAAUhG,EAAKK,QACxCL,EAAKL,eAAeiD,QAAS,eAEvB,GAAK+C,EAAO1F,OAAS,CAK3B,IAAM,IAHN8F,GAAQ,EACR1B,GAAQ,EAEEa,EAAI,EAAGA,EAAIS,EAAO1F,OAAQiF,IACnClF,EAAKoB,UAAWuE,EAAQT,IAGzBlF,EAAK6E,eAMFkB,GACJE,cAAeT,GAGXnB,GACJrE,EAAKiB,WAAY,QAGlByE,KAEE,MAKJhG,KAAKK,OAEEL,MAxjBT,CA+jBKwG","sourceRoot":"../../js"}
  • lifterlms/tags/7.0.0-alpha.4/class-lifterlms.php

    r2757452 r2758243  
    3535     * @var string
    3636     */
    37     public $version = '7.0.0-alpha.3';
     37    public $version = '7.0.0-alpha.4';
    3838
    3939    /**
  • lifterlms/tags/7.0.0-alpha.4/includes/class-llms-order-generator.php

    r2757452 r2758243  
    393393        // Try to lookup using the order key if it was supplied.
    394394        if ( $key ) {
    395             $order_id = llms_get_order_by_key( $key, 'id' );
     395            $order_id = $this->sanitize_retrieved_order_id( llms_get_order_by_key( $key, 'id' ) );
    396396        }
    397397
     
    400400
    401401            $user_id  = $this->find_user_id( $email );
    402             $order_id = $user_id ? llms_locate_order_for_user_and_plan( $user_id, $plan_id ) : $order_id;
     402            $order_id = $user_id ? $this->sanitize_retrieved_order_id( llms_locate_order_for_user_and_plan( $user_id, $plan_id ) ) : null;
    403403
    404404        }
     
    406406        // Lookup by email address.
    407407        if ( ! $order_id && $email ) {
    408             $order_id = llms_locate_order_for_email_and_plan( $email, $plan_id );
     408            $order_id = $this->sanitize_retrieved_order_id( llms_locate_order_for_email_and_plan( $email, $plan_id ) );
    409409        }
    410410
     
    490490
    491491    /**
     492     * Sanitizes the order_id retrieved by {@see LLMS_Order_Generator::get_order_id()} to ensure it can be resumed or confirmed during checkout.
     493     *
     494     * Only orders with the `llms-pending` status can be resumed or confirmed.
     495     *
     496     * @since [version]
     497     *
     498     * @param null|int $order_id The order ID or `null` if the lookup didn't yield a result.
     499     * @return int|null Returns the submitted order ID if it's valid or `null`.
     500     */
     501    private function sanitize_retrieved_order_id( $order_id ) {
     502        return $order_id && 'llms-pending' === get_post_status( $order_id ) ? $order_id : null;
     503    }
     504
     505    /**
    492506     * Performs all required data validations necessary to create the order.
    493507     *
  • lifterlms/tags/7.0.0-alpha.4/includes/models/model.llms.order.php

    r2757452 r2758243  
    17091709        }
    17101710
    1711         $datetime = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) + $current_rule['delay'] );
    1712 
    1713         $this->set_date( 'next_payment', date( 'Y-m-d H:i:s', $datetime ) );
     1711        $timestamp = current_time( 'timestamp' ) + $current_rule['delay'];
     1712
     1713        $this->set_date( 'next_payment', date_i18n( 'Y-m-d H:i:s', $timestamp ) );
    17141714        $this->set_status( $current_rule['status'] );
    17151715        $this->set( 'last_retry_rule', $current_rule_index );
     
    17191719                // Translators: %s = next attempt date.
    17201720                esc_html__( 'Automatic retry attempt scheduled for %s', 'lifterlms' ),
    1721                 date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $datetime ) )
     1721                date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $timestamp )
    17221722            )
    17231723        );
  • lifterlms/tags/7.0.0-alpha.4/languages/lifterlms.pot

    r2757452 r2758243  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: LifterLMS 7.0.0-alpha.3\n"
     5"Project-Id-Version: LifterLMS 7.0.0-alpha.4\n"
    66"Report-Msgid-Bugs-To: https://lifterlms.com/my-account/my-tickets\n"
    77"Last-Translator: Team LifterLMS <[email protected]>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-07-16T13:29:37-07:00\n"
     12"POT-Creation-Date: 2022-07-18T17:48:21-06:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: llms/dev 0.0.5\n"
     
    54445444#. Translators: %s = The user-submitted coupon code.
    54455445#. Translators: %s = coupon code.
    5446 #: includes/class-llms-order-generator.php:568
     5446#: includes/class-llms-order-generator.php:582
    54475447#: includes/class.llms.ajax.handler.php:1085
    54485448#: includes/functions/llms.functions.order.php:358
     
    54505450msgstr ""
    54515451
    5452 #: includes/class-llms-order-generator.php:605
     5452#: includes/class-llms-order-generator.php:619
    54535453#: includes/functions/llms.functions.order.php:375
    54545454msgid "No payment method selected."
    54555455msgstr ""
    54565456
    5457 #: includes/class-llms-order-generator.php:635
    5458 #: includes/class-llms-order-generator.php:643
     5457#: includes/class-llms-order-generator.php:649
     5458#: includes/class-llms-order-generator.php:657
    54595459#: includes/controllers/class-llms-controller-checkout.php:106
    54605460#: includes/controllers/class-llms-controller-checkout.php:112
     
    54635463msgstr ""
    54645464
    5465 #: includes/class-llms-order-generator.php:665
     5465#: includes/class-llms-order-generator.php:679
    54665466msgid "Missing access plan ID."
    54675467msgstr ""
    54685468
    5469 #: includes/class-llms-order-generator.php:670
     5469#: includes/class-llms-order-generator.php:684
    54705470msgid "Access plan not found."
    54715471msgstr ""
    54725472
    54735473#. Translators: %s = The title of the site's LifterLMS Terms and Conditions page.
    5474 #: includes/class-llms-order-generator.php:692
     5474#: includes/class-llms-order-generator.php:706
    54755475msgid "You must agree to the %s."
    54765476msgstr ""
    54775477
    54785478#. Translators: %s = The title of the course or membership.
    5479 #: includes/class-llms-order-generator.php:724
     5479#: includes/class-llms-order-generator.php:738
    54805480msgid "You already have access to %s."
    54815481msgstr ""
  • lifterlms/tags/7.0.0-alpha.4/lifterlms.php

    r2757452 r2758243  
    1111 * Plugin URI: https://lifterlms.com/
    1212 * Description: LifterLMS is a powerful WordPress learning management system plugin that makes it easy to create, sell, and protect engaging online courses and training based membership websites.
    13  * Version: 7.0.0-alpha.3
     13 * Version: 7.0.0-alpha.4
    1414 * Author: LifterLMS
    1515 * Author URI: https://lifterlms.com/
  • lifterlms/tags/7.0.0-alpha.4/vendor/composer/installed.php

    r2757452 r2758243  
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'b68b7b2bab5be4b719c0b355347446f89c612d3f',
     8        'reference' => '7a8ad49db6571485a30278f248f96f27283363a8',
    99        'name' => 'gocodebox/lifterlms',
    1010        'dev' => false,
     
    3535            'install_path' => __DIR__ . '/../../',
    3636            'aliases' => array(),
    37             'reference' => 'b68b7b2bab5be4b719c0b355347446f89c612d3f',
     37            'reference' => '7a8ad49db6571485a30278f248f96f27283363a8',
    3838            'dev_requirement' => false,
    3939        ),
  • lifterlms/trunk/assets/js/llms-spinner.asset.php

    r2757452 r2758243  
    1 <?php return array('dependencies' => array('wp-i18n', 'wp-polyfill'), 'version' => 'c8c84c4118bca5f0d275b240a164f419');
     1<?php return array('dependencies' => array('wp-i18n', 'wp-polyfill'), 'version' => '5269616cd5155bce694d623de2968c12');
  • lifterlms/trunk/assets/maps/js/llms-form-checkout.min.js.map

    r2757452 r2758243  
    1 {"version":3,"file":"../../js/llms-form-checkout.min.js","sources":["llms-form-checkout.js"],"sourcesContent":["/**\n * LifterLMS Checkout Screen related events and interactions\n *\n * @package LifterLMS/Scripts\n *\n * @since 3.0.0\n * @version 7.0.0-alpha.3\n */\n\n( function( $ ) {\n\n\tvar llms_checkout = function() {\n\n\t\t/**\n\t\t * Array of validation functions to call on form submission\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar before_submit = [];\n\n\t\t/**\n\t\t * Array of gateways to be automatically bound when needed\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar gateways = [];\n\n\t\tthis.$checkout_form = $( '#llms-product-purchase-form' );\n\t\tthis.$confirm_form  = $( '#llms-product-purchase-confirm-form' );\n\t\tthis.$form_sections = false;\n\t\tthis.form_action    = false;\n\n\t\t/**\n\t\t * Initialize checkout JS & bind if on the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 Make sure we bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *               even if there's no llms product purchase form.\n\t\t * @since 7.0.0-alpha.3 Disable smooth scroll-behavior on checkout.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.init = function() {\n\n\t\t\tvar self = this;\n\n\t\t\tif ( $( '.llms-checkout-wrapper' ).length ) {\n\t\t\t\tthis.bind_login();\n\t\t\t}\n\n\t\t\tif ( this.$checkout_form.length ) {\n\n\t\t\t\tthis.form_action    = 'checkout';\n\t\t\t\tthis.$form_sections = this.$checkout_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$checkout_form.on( 'submit', this, this.submit );\n\n\t\t\t\t/**\n\t\t\t\t * Fix `HTMLFormElement.reportValidity()` when `scroll-behavior: smooth`.\n\t\t\t\t * \n\t\t\t\t * @see {@link https://github.com/gocodebox/lifterlms/issues/2206}\n\t\t\t\t */\n\t\t\t\tdocument.querySelector( 'html' ).style.scrollBehavior = 'auto';\n\n\t\t\t\t// add before submit event for password strength meter if one's found\n\t\t\t\tif ( $( '.llms-password-strength-meter' ).length ) {\n\t\t\t\t\tthis.add_before_submit_event( {\n\t\t\t\t\t\tdata: LLMS.PasswordStrength,\n\t\t\t\t\t\thandler: LLMS.PasswordStrength.checkout,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tthis.bind_coupon();\n\n\t\t\t\tthis.bind_gateways();\n\n\t\t\t} else if ( this.$confirm_form.length ) {\n\n\t\t\t\tthis.form_action    = 'confirm';\n\t\t\t\tthis.$form_sections = this.$confirm_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$confirm_form.on( 'submit', function() {\n\t\t\t\t\tself.processing( 'start' );\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * before submit events to llms checkout private \"before_submit\" array\n\t\t *\n\t\t * @param    object  obj  object of data to push to the array\n\t\t *                        requires at least a \"handler\" key which should pass a callable function\n\t\t *                        \"data\" can be anything, will be passed as the first parameter to the handler function\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_before_submit_event = function( obj ) {\n\n\t\t\tif ( ! obj.handler || 'function' !== typeof obj.handler ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! obj.data ) {\n\t\t\t\tobj.data = null;\n\t\t\t}\n\n\t\t\tbefore_submit.push( obj );\n\n\t\t};\n\n\t\t/**\n\t\t * Add an error message\n\t\t *\n\t\t * @param    string     message  error message string\n\t\t * @param    mixed      data     optional error data to output on the console\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.add_error = function( message, data ) {\n\n\t\t\tvar id   = 'llms-checkout-errors';\n\t\t\t\t$err = $( '#' + id );\n\n\t\t\tif ( ! $err.length ) {\n\t\t\t\t$err = $( '<ul class=\"llms-notice llms-error\" id=\"' + id + '\" />' );\n\t\t\t\t$( '.llms-checkout-wrapper' ).prepend( $err );\n\t\t\t}\n\n\t\t\t$err.append( '<li>' + message + '</li>' );\n\n\t\t\tif ( data ) {\n\t\t\t\tconsole.error( data );\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * gateways classes that should be bound by this class\n\t\t *\n\t\t * @param    obj   gateway_class  callable class object\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_gateway = function( gateway_class ) {\n\n\t\t\tgateways.push( gateway_class );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind coupon add & remove button events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_coupon = function() {\n\n\t\t\tvar self = this;\n\n\t\t\t// show & hide the coupon field & button\n\t\t\t$( 'a[href=\"#llms-coupon-toggle\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( '.llms-coupon-entry' ).slideToggle( 400 );\n\n\t\t\t} );\n\n\t\t\t// apply coupon click\n\t\t\t$( '#llms-apply-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_apply( $( this ) );\n\n\t\t\t} );\n\n\t\t\t// remove coupon click\n\t\t\t$( '#llms-remove-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_remove( $( this ) );\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind gateway section events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_gateways = function() {\n\n\t\t\tthis.load_gateways();\n\n\t\t\tif ( ! $( 'input[name=\"llms_payment_gateway\"]' ).length ) {\n\t\t\t\t$( '#llms_create_pending_order' ).removeAttr( 'disabled' );\n\t\t\t}\n\n\t\t\t// add class and trigger watchable event when gateway selection changes\n\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).on( 'change', function() {\n\n\t\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).each( function() {\n\n\t\t\t\t\tvar $el          = $( this ),\n\t\t\t\t\t\t$parent      = $el.closest( '.llms-payment-gateway' ),\n\t\t\t\t\t\t$fields      = $parent.find( '.llms-gateway-fields' ).find( 'input, textarea, select' ),\n\t\t\t\t\t\tchecked      = $el.is( ':checked' ),\n\t\t\t\t\t\tdisplay_func = ( checked ) ? 'addClass' : 'removeClass';\n\n\t\t\t\t\t$parent[ display_func ]( 'is-selected' );\n\n\t\t\t\t\tif ( checked ) {\n\n\t\t\t\t\t\t// enable fields\n\t\t\t\t\t\t$fields.removeAttr( 'disabled' );\n\n\t\t\t\t\t\t// emit a watchable event for extensions to hook onto\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).trigger( 'llms-gateway-selected', {\n\t\t\t\t\t\t\tid: $el.val(),\n\t\t\t\t\t\t\t$selector: $parent,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// disable fields\n\t\t\t\t\t\t$fields.attr( 'disabled', 'disabled' );\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t} );\n\n\t\t\t// enable / disable buttons depending on field validation status\n\t\t\t$( '.llms-payment-gateways' ).on( 'llms-gateway-selected', function( e, data ) {\n\n\t\t\t\tvar $submit = $( '#llms_create_pending_order' );\n\n\t\t\t\tif ( data.$selector && data.$selector.find( '.llms-gateway-fields .invalid' ).length ) {\n\t\t\t\t\t$submit.attr( 'disabled', 'disabled' );\n\t\t\t\t} else {\n\t\t\t\t\t$submit.removeAttr( 'disabled' );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 When showing the login form area make sure we slide up the `.llms-notice` link's parent too.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.bind_login = function() {\n\n\t\t\t$( 'a[href=\"#llms-show-login\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( this ).closest( '.llms-info,.llms-notice' ).slideUp( 400 );\n\t\t\t\t$( 'form.llms-login' ).slideDown( 400 );\n\n\t\t\t} );\n\t\t};\n\n\t\t/**\n\t\t * Clear error messages\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.clear_errors = function() {\n\t\t\t$( '#llms-checkout-errors' ).remove();\n\t\t};\n\n\t\t/**\n\t\t * Triggered by clicking the \"Apply Coupon\" Button\n\t\t * Validates the coupon via JS and adds error / success messages\n\t\t * On success it will replace partials on the checkout screen with updated\n\t\t * prices and a \"remove coupon\" button\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Apply button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_apply = function ( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$code      = $( '#llms_coupon_code' ),\n\t\t\t\tcode       = $code.val(),\n\t\t\t\t$messages  = $( '.llms-coupon-messages' ),\n\t\t\t\t$errors    = $messages.find( '.llms-error' ),\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'validate_coupon_code',\n\t\t\t\t\tcode: code,\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tbeforeSend: function() {\n\n\t\t\t\t\t$errors.hide();\n\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( 'error' === r.code ) {\n\n\t\t\t\t\t\tvar $message = $( '<li>' + r.message + '</li>' );\n\n\t\t\t\t\t\tif ( ! $errors.length ) {\n\n\t\t\t\t\t\t\t$errors = $( '<ul class=\"llms-notice llms-error\" />' );\n\t\t\t\t\t\t\t$messages.append( $errors );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$errors.empty();\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$message.appendTo( $errors );\n\t\t\t\t\t\t$errors.show();\n\n\t\t\t\t\t} else if ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Called by clicking the \"Remove Coupon\" button\n\t\t * Removes the coupon via AJAX and unsets related session data\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Remove button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_remove = function( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'remove_coupon_code',\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Scroll error messages into view\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.focus_errors = function() {\n\t\t\t$( 'html, body' ).animate( {\n\t\t\t\tscrollTop: $( '#llms-checkout-errors' ).offset().top - 50,\n\t\t\t}, 200 );\n\t\t};\n\n\t\t/**\n\t\t * Bind external gateway JS\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.load_gateways = function() {\n\n\t\t\tfor ( var i = 0; i <= gateways.length; i++ ) {\n\t\t\t\tvar g = gateways[i];\n\t\t\t\tif ( typeof g === 'object' && g !== null ) {\n\t\t\t\t\tif ( g.bind !== undefined && 'function' === typeof g.bind  ) {\n\t\t\t\t\t\tg.bind();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * Start or stop processing events on the checkout form\n\t\t *\n\t\t * @param    string   action  whether to start or stop processing [start|stop]\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.24.1\n\t\t */\n\t\tthis.processing = function( action ) {\n\n\t\t\tvar func, $form;\n\n\t\t\tswitch ( action ) {\n\n\t\t\t\tcase 'stop':\n\t\t\t\t\tfunc = 'removeClass';\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'start':\n\t\t\t\tdefault:\n\t\t\t\t\tfunc = 'addClass';\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( 'checkout' === this.form_action ) {\n\t\t\t\t$form = this.$checkout_form;\n\t\t\t} else if ( 'confirm' === this.form_action ) {\n\t\t\t\t$form = this.$confirm_form;\n\t\t\t}\n\n\t\t\t$form[ func ]( 'llms-is-processing' );\n\t\t\tLLMS.Spinner[ action ]( this.$form_sections );\n\n\t\t};\n\n\t\t/**\n\t\t * Handles form submission\n\t\t * Calls all validation events in `before_submit[]`\n\t\t * waits for call backs and either displays returned errors\n\t\t * or submits the form when all are successful\n\t\t *\n\t\t * @param    obj   e  JS event object\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.submit = function( e ) {\n\n\t\t\tvar self       = e.data,\n\t\t\t\tnum        = before_submit.length,\n\t\t\t\tchecks     = 0,\n\t\t\t\tmax_checks = 60000,\n\t\t\t\terrors     = [],\n\t\t\t\tfinishes   = 0,\n\t\t\t\tsuccesses  = 0,\n\t\t\t\tinterval;\n\n\t\t\te.preventDefault();\n\n\t\t\t// add spinners\n\t\t\tself.processing( 'start' );\n\n\t\t\t// remove errors to prevent duplicates\n\t\t\tself.clear_errors();\n\n\t\t\t// start running all the events\n\t\t\tfor ( var i = 0; i < before_submit.length; i++ ) {\n\n\t\t\t\tvar obj = before_submit[ i ];\n\n\t\t\t\tobj.handler( obj.data, function( r ) {\n\n\t\t\t\t\tfinishes++;\n\t\t\t\t\tif ( true === r ) {\n\t\t\t\t\t\tsuccesses++;\n\t\t\t\t\t} else if ( 'string' === typeof r ) {\n\t\t\t\t\t\terrors.push( r );\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\t// run an interval to wait for finishes\n\t\t\tinterval = setInterval( function() {\n\n\t\t\t\tvar clear = false,\n\t\t\t\t\tstop  = false;\n\n\t\t\t\t// timeout...\n\t\t\t\tif ( checks >= max_checks ) {\n\n\t\t\t\t\tclear = true;\n\t\t\t\t\tstop  = true;\n\n\t\t\t\t} else if ( num === finishes ) {\n\t\t\t\t\t// everything has finished\n\n\t\t\t\t\t// all were successful, submit the form\n\t\t\t\t\tif ( num === successes ) {\n\n\t\t\t\t\t\tclear = true;\n\n\t\t\t\t\t\tself.$checkout_form.off( 'submit', self.submit );\n\t\t\t\t\t\tself.$checkout_form.trigger( 'submit' );\n\n\t\t\t\t\t} else if ( errors.length ) {\n\n\t\t\t\t\t\tclear = true;\n\t\t\t\t\t\tstop  = true;\n\n\t\t\t\t\t\tfor ( var i = 0; i < errors.length; i++ ) {\n\t\t\t\t\t\t\tself.add_error( errors[ i ] );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tself.focus_errors();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( clear ) {\n\t\t\t\t\tclearInterval( interval );\n\t\t\t\t}\n\n\t\t\t\tif ( stop ) {\n\t\t\t\t\tself.processing( 'stop' );\n\t\t\t\t}\n\n\t\t\t\tchecks++;\n\n\t\t\t}, 100 );\n\n\t\t};\n\n\t\t// initialize\n\t\tthis.init();\n\n\t\treturn this;\n\n\t};\n\n\twindow.llms          = window.llms || {};\n\twindow.llms.checkout = new llms_checkout();\n\n} )( jQuery );\n"],"names":["$","window","llms","checkout","before_submit","gateways","this","$checkout_form","$confirm_form","$form_sections","form_action","init","self","length","bind_login","find","on","submit","document","querySelector","style","scrollBehavior","add_before_submit_event","data","LLMS","PasswordStrength","handler","bind_coupon","bind_gateways","processing","obj","push","add_error","message","id","$err","prepend","append","console","error","add_gateway","gateway_class","e","preventDefault","slideToggle","coupon_apply","coupon_remove","load_gateways","removeAttr","each","$el","$parent","closest","$fields","checked","is","trigger","val","$selector","attr","$submit","slideUp","slideDown","clear_errors","remove","$btn","code","$messages","$errors","$container","Spinner","start","Ajax","call","action","plan_id","beforeSend","hide","success","r","$message","stop","empty","appendTo","show","replaceWith","coupon_html","gateways_html","summary_html","focus_errors","animate","scrollTop","offset","top","i","g","undefined","bind","$form","func","interval","num","checks","errors","finishes","successes","setInterval","clear","off","clearInterval","jQuery"],"mappings":"CASA,SAAYA,GA4jBXC,OAAOC,KAAgBD,OAAOC,MAAQ,GACtCD,OAAOC,KAAKC,SAAW,IA3jBH,WASnB,IAAIC,EAAgB,GAShBC,EAAW,GAoiBf,OAliBAC,KAAKC,eAAiBP,EAAG,+BACzBM,KAAKE,cAAiBR,EAAG,uCACzBM,KAAKG,gBAAiB,EACtBH,KAAKI,aAAiB,EAYtBJ,KAAKK,KAAO,WAEX,IAAIC,EAAON,KAENN,EAAG,0BAA2Ba,QAClCP,KAAKQ,aAGDR,KAAKC,eAAeM,QAExBP,KAAKI,YAAiB,WACtBJ,KAAKG,eAAiBH,KAAKC,eAAeQ,KAAM,0BA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,cAC9BwF,EAAQ5F,KAAKE,eAGd0F,EAAOC,GAAQ,sBACf3E,KAAK8C,QAASI,GAAUpE,KAAKG,iBAe9BH,KAAKW,OAAS,SAAUyB,GAEvB,IAOC0D,EAPGxF,EAAa8B,EAAEnB,KAClB8E,EAAajG,EAAcS,OAC3ByF,EAAa,EAEbC,EAAa,GACbC,EAAa,EACbC,EAAa,EAGd/D,EAAEC,iBAGF/B,EAAKiB,WAAY,SAGjBjB,EAAKmD,eAGL,IAAM,IAAI+B,EAAI,EAAGA,EAAI1F,EAAcS,OAAQiF,IAAM,CAEhD,IAAIhE,EAAM1B,EAAe0F,GAEzBhE,EAAIJ,QAASI,EAAIP,KAAM,SAAUwD,GAEhCyB,KACK,IAASzB,EACb0B,IACW,iBAAoB1B,GAC/BwB,EAAOxE,KAAMgD,KAQhBqB,EAAWM,YAAa,WAEvB,IAAIC,GAAQ,EACX1B,GAAQ,EAGT,GAvCa,KAuCRqB,EAGJrB,EADA0B,GAAQ,OAGF,GAAKN,IAAQG,EAInB,GAAKH,IAAQI,EAEZE,GAAQ,EAER/F,EAAKL,eAAeqG,IAAK,SAAUhG,EAAKK,QACxCL,EAAKL,eAAeiD,QAAS,eAEvB,GAAK+C,EAAO1F,OAAS,CAK3B,IAAM,IAHN8F,GAAQ,EACR1B,GAAQ,EAEEa,EAAI,EAAGA,EAAIS,EAAO1F,OAAQiF,IACnClF,EAAKoB,UAAWuE,EAAQT,IAGzBlF,EAAK6E,eAMFkB,GACJE,cAAeT,GAGXnB,GACJrE,EAAKiB,WAAY,QAGlByE,KAEE,MAKJhG,KAAKK,OAEEL,MAxjBT,CA+jBKwG","sourceRoot":"../../js"}
     1{"version":3,"file":"../../js/llms-form-checkout.min.js","sources":["llms-form-checkout.js"],"sourcesContent":["/**\n * LifterLMS Checkout Screen related events and interactions\n *\n * @package LifterLMS/Scripts\n *\n * @since 3.0.0\n * @version 7.0.0-alpha.4\n */\n\n( function( $ ) {\n\n\tvar llms_checkout = function() {\n\n\t\t/**\n\t\t * Array of validation functions to call on form submission\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar before_submit = [];\n\n\t\t/**\n\t\t * Array of gateways to be automatically bound when needed\n\t\t *\n\t\t * @type    array\n\t\t * @since   3.0.0\n\t\t * @version 3.0.0\n\t\t */\n\t\tvar gateways = [];\n\n\t\tthis.$checkout_form = $( '#llms-product-purchase-form' );\n\t\tthis.$confirm_form  = $( '#llms-product-purchase-confirm-form' );\n\t\tthis.$form_sections = false;\n\t\tthis.form_action    = false;\n\n\t\t/**\n\t\t * Initialize checkout JS & bind if on the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 Make sure we bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *               even if there's no llms product purchase form.\n\t\t * @since 7.0.0-alpha.4 Disable smooth scroll-behavior on checkout.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.init = function() {\n\n\t\t\tvar self = this;\n\n\t\t\tif ( $( '.llms-checkout-wrapper' ).length ) {\n\t\t\t\tthis.bind_login();\n\t\t\t}\n\n\t\t\tif ( this.$checkout_form.length ) {\n\n\t\t\t\tthis.form_action    = 'checkout';\n\t\t\t\tthis.$form_sections = this.$checkout_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$checkout_form.on( 'submit', this, this.submit );\n\n\t\t\t\t/**\n\t\t\t\t * Fix `HTMLFormElement.reportValidity()` when `scroll-behavior: smooth`.\n\t\t\t\t * \n\t\t\t\t * @see {@link https://github.com/gocodebox/lifterlms/issues/2206}\n\t\t\t\t */\n\t\t\t\tdocument.querySelector( 'html' ).style.scrollBehavior = 'auto';\n\n\t\t\t\t// add before submit event for password strength meter if one's found\n\t\t\t\tif ( $( '.llms-password-strength-meter' ).length ) {\n\t\t\t\t\tthis.add_before_submit_event( {\n\t\t\t\t\t\tdata: LLMS.PasswordStrength,\n\t\t\t\t\t\thandler: LLMS.PasswordStrength.checkout,\n\t\t\t\t\t} );\n\t\t\t\t}\n\n\t\t\t\tthis.bind_coupon();\n\n\t\t\t\tthis.bind_gateways();\n\n\t\t\t} else if ( this.$confirm_form.length ) {\n\n\t\t\t\tthis.form_action    = 'confirm';\n\t\t\t\tthis.$form_sections = this.$confirm_form.find( '.llms-checkout-section' );\n\n\t\t\t\tthis.$confirm_form.on( 'submit', function() {\n\t\t\t\t\tself.processing( 'start' );\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * before submit events to llms checkout private \"before_submit\" array\n\t\t *\n\t\t * @param    object  obj  object of data to push to the array\n\t\t *                        requires at least a \"handler\" key which should pass a callable function\n\t\t *                        \"data\" can be anything, will be passed as the first parameter to the handler function\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_before_submit_event = function( obj ) {\n\n\t\t\tif ( ! obj.handler || 'function' !== typeof obj.handler ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif ( ! obj.data ) {\n\t\t\t\tobj.data = null;\n\t\t\t}\n\n\t\t\tbefore_submit.push( obj );\n\n\t\t};\n\n\t\t/**\n\t\t * Add an error message\n\t\t *\n\t\t * @param    string     message  error message string\n\t\t * @param    mixed      data     optional error data to output on the console\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.add_error = function( message, data ) {\n\n\t\t\tvar id   = 'llms-checkout-errors';\n\t\t\t\t$err = $( '#' + id );\n\n\t\t\tif ( ! $err.length ) {\n\t\t\t\t$err = $( '<ul class=\"llms-notice llms-error\" id=\"' + id + '\" />' );\n\t\t\t\t$( '.llms-checkout-wrapper' ).prepend( $err );\n\t\t\t}\n\n\t\t\t$err.append( '<li>' + message + '</li>' );\n\n\t\t\tif ( data ) {\n\t\t\t\tconsole.error( data );\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Public function which allows other classes or extensions to add\n\t\t * gateways classes that should be bound by this class\n\t\t *\n\t\t * @param    obj   gateway_class  callable class object\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.add_gateway = function( gateway_class ) {\n\n\t\t\tgateways.push( gateway_class );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind coupon add & remove button events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_coupon = function() {\n\n\t\t\tvar self = this;\n\n\t\t\t// show & hide the coupon field & button\n\t\t\t$( 'a[href=\"#llms-coupon-toggle\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( '.llms-coupon-entry' ).slideToggle( 400 );\n\n\t\t\t} );\n\n\t\t\t// apply coupon click\n\t\t\t$( '#llms-apply-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_apply( $( this ) );\n\n\t\t\t} );\n\n\t\t\t// remove coupon click\n\t\t\t$( '#llms-remove-coupon' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\tself.coupon_remove( $( this ) );\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind gateway section events\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.bind_gateways = function() {\n\n\t\t\tthis.load_gateways();\n\n\t\t\tif ( ! $( 'input[name=\"llms_payment_gateway\"]' ).length ) {\n\t\t\t\t$( '#llms_create_pending_order' ).removeAttr( 'disabled' );\n\t\t\t}\n\n\t\t\t// add class and trigger watchable event when gateway selection changes\n\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).on( 'change', function() {\n\n\t\t\t\t$( 'input[name=\"llms_payment_gateway\"]' ).each( function() {\n\n\t\t\t\t\tvar $el          = $( this ),\n\t\t\t\t\t\t$parent      = $el.closest( '.llms-payment-gateway' ),\n\t\t\t\t\t\t$fields      = $parent.find( '.llms-gateway-fields' ).find( 'input, textarea, select' ),\n\t\t\t\t\t\tchecked      = $el.is( ':checked' ),\n\t\t\t\t\t\tdisplay_func = ( checked ) ? 'addClass' : 'removeClass';\n\n\t\t\t\t\t$parent[ display_func ]( 'is-selected' );\n\n\t\t\t\t\tif ( checked ) {\n\n\t\t\t\t\t\t// enable fields\n\t\t\t\t\t\t$fields.removeAttr( 'disabled' );\n\n\t\t\t\t\t\t// emit a watchable event for extensions to hook onto\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).trigger( 'llms-gateway-selected', {\n\t\t\t\t\t\t\tid: $el.val(),\n\t\t\t\t\t\t\t$selector: $parent,\n\t\t\t\t\t\t} );\n\n\t\t\t\t\t} else {\n\n\t\t\t\t\t\t// disable fields\n\t\t\t\t\t\t$fields.attr( 'disabled', 'disabled' );\n\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t} );\n\n\t\t\t// enable / disable buttons depending on field validation status\n\t\t\t$( '.llms-payment-gateways' ).on( 'llms-gateway-selected', function( e, data ) {\n\n\t\t\t\tvar $submit = $( '#llms_create_pending_order' );\n\n\t\t\t\tif ( data.$selector && data.$selector.find( '.llms-gateway-fields .invalid' ).length ) {\n\t\t\t\t\t$submit.attr( 'disabled', 'disabled' );\n\t\t\t\t} else {\n\t\t\t\t\t$submit.removeAttr( 'disabled' );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind click events for the Show / Hide login area at the top of the checkout screen\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.34.5 When showing the login form area make sure we slide up the `.llms-notice` link's parent too.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.bind_login = function() {\n\n\t\t\t$( 'a[href=\"#llms-show-login\"]' ).on( 'click', function( e ) {\n\n\t\t\t\te.preventDefault();\n\t\t\t\t$( this ).closest( '.llms-info,.llms-notice' ).slideUp( 400 );\n\t\t\t\t$( 'form.llms-login' ).slideDown( 400 );\n\n\t\t\t} );\n\t\t};\n\n\t\t/**\n\t\t * Clear error messages\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.clear_errors = function() {\n\t\t\t$( '#llms-checkout-errors' ).remove();\n\t\t};\n\n\t\t/**\n\t\t * Triggered by clicking the \"Apply Coupon\" Button\n\t\t * Validates the coupon via JS and adds error / success messages\n\t\t * On success it will replace partials on the checkout screen with updated\n\t\t * prices and a \"remove coupon\" button\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Apply button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_apply = function ( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$code      = $( '#llms_coupon_code' ),\n\t\t\t\tcode       = $code.val(),\n\t\t\t\t$messages  = $( '.llms-coupon-messages' ),\n\t\t\t\t$errors    = $messages.find( '.llms-error' ),\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'validate_coupon_code',\n\t\t\t\t\tcode: code,\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tbeforeSend: function() {\n\n\t\t\t\t\t$errors.hide();\n\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( 'error' === r.code ) {\n\n\t\t\t\t\t\tvar $message = $( '<li>' + r.message + '</li>' );\n\n\t\t\t\t\t\tif ( ! $errors.length ) {\n\n\t\t\t\t\t\t\t$errors = $( '<ul class=\"llms-notice llms-error\" />' );\n\t\t\t\t\t\t\t$messages.append( $errors );\n\n\t\t\t\t\t\t} else {\n\n\t\t\t\t\t\t\t$errors.empty();\n\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t$message.appendTo( $errors );\n\t\t\t\t\t\t$errors.show();\n\n\t\t\t\t\t} else if ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Called by clicking the \"Remove Coupon\" button\n\t\t * Removes the coupon via AJAX and unsets related session data\n\t\t *\n\t\t * @param    obj   $btn  jQuery selector of the Remove button\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.coupon_remove = function( $btn ) {\n\n\t\t\tvar self       = this,\n\t\t\t\t$container = $( 'form.llms-checkout' );\n\n\t\t\tLLMS.Spinner.start( $container );\n\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'remove_coupon_code',\n\t\t\t\t\tplan_id: $( '#llms-plan-id' ).val(),\n\t\t\t\t},\n\t\t\t\tsuccess: function( r ) {\n\n\t\t\t\t\tLLMS.Spinner.stop( $container );\n\n\t\t\t\t\tif ( r.success ) {\n\n\t\t\t\t\t\t$( '.llms-coupon-wrapper' ).replaceWith( r.data.coupon_html );\n\t\t\t\t\t\tself.bind_coupon();\n\n\t\t\t\t\t\t$( '.llms-order-summary' ).replaceWith( r.data.summary_html );\n\n\t\t\t\t\t\t$( '.llms-payment-gateways' ).replaceWith( r.data.gateways_html );\n\t\t\t\t\t\tself.bind_gateways();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Scroll error messages into view\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.27.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.focus_errors = function() {\n\t\t\t$( 'html, body' ).animate( {\n\t\t\t\tscrollTop: $( '#llms-checkout-errors' ).offset().top - 50,\n\t\t\t}, 200 );\n\t\t};\n\n\t\t/**\n\t\t * Bind external gateway JS\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.0.0\n\t\t */\n\t\tthis.load_gateways = function() {\n\n\t\t\tfor ( var i = 0; i <= gateways.length; i++ ) {\n\t\t\t\tvar g = gateways[i];\n\t\t\t\tif ( typeof g === 'object' && g !== null ) {\n\t\t\t\t\tif ( g.bind !== undefined && 'function' === typeof g.bind  ) {\n\t\t\t\t\t\tg.bind();\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\t/**\n\t\t * Start or stop processing events on the checkout form\n\t\t *\n\t\t * @param    string   action  whether to start or stop processing [start|stop]\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.24.1\n\t\t */\n\t\tthis.processing = function( action ) {\n\n\t\t\tvar func, $form;\n\n\t\t\tswitch ( action ) {\n\n\t\t\t\tcase 'stop':\n\t\t\t\t\tfunc = 'removeClass';\n\t\t\t\tbreak;\n\n\t\t\t\tcase 'start':\n\t\t\t\tdefault:\n\t\t\t\t\tfunc = 'addClass';\n\t\t\t\tbreak;\n\n\t\t\t}\n\n\t\t\tif ( 'checkout' === this.form_action ) {\n\t\t\t\t$form = this.$checkout_form;\n\t\t\t} else if ( 'confirm' === this.form_action ) {\n\t\t\t\t$form = this.$confirm_form;\n\t\t\t}\n\n\t\t\t$form[ func ]( 'llms-is-processing' );\n\t\t\tLLMS.Spinner[ action ]( this.$form_sections );\n\n\t\t};\n\n\t\t/**\n\t\t * Handles form submission\n\t\t * Calls all validation events in `before_submit[]`\n\t\t * waits for call backs and either displays returned errors\n\t\t * or submits the form when all are successful\n\t\t *\n\t\t * @param    obj   e  JS event object\n\t\t * @return   void\n\t\t * @since    3.0.0\n\t\t * @version  3.27.0\n\t\t */\n\t\tthis.submit = function( e ) {\n\n\t\t\tvar self       = e.data,\n\t\t\t\tnum        = before_submit.length,\n\t\t\t\tchecks     = 0,\n\t\t\t\tmax_checks = 60000,\n\t\t\t\terrors     = [],\n\t\t\t\tfinishes   = 0,\n\t\t\t\tsuccesses  = 0,\n\t\t\t\tinterval;\n\n\t\t\te.preventDefault();\n\n\t\t\t// add spinners\n\t\t\tself.processing( 'start' );\n\n\t\t\t// remove errors to prevent duplicates\n\t\t\tself.clear_errors();\n\n\t\t\t// start running all the events\n\t\t\tfor ( var i = 0; i < before_submit.length; i++ ) {\n\n\t\t\t\tvar obj = before_submit[ i ];\n\n\t\t\t\tobj.handler( obj.data, function( r ) {\n\n\t\t\t\t\tfinishes++;\n\t\t\t\t\tif ( true === r ) {\n\t\t\t\t\t\tsuccesses++;\n\t\t\t\t\t} else if ( 'string' === typeof r ) {\n\t\t\t\t\t\terrors.push( r );\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t}\n\n\t\t\t// run an interval to wait for finishes\n\t\t\tinterval = setInterval( function() {\n\n\t\t\t\tvar clear = false,\n\t\t\t\t\tstop  = false;\n\n\t\t\t\t// timeout...\n\t\t\t\tif ( checks >= max_checks ) {\n\n\t\t\t\t\tclear = true;\n\t\t\t\t\tstop  = true;\n\n\t\t\t\t} else if ( num === finishes ) {\n\t\t\t\t\t// everything has finished\n\n\t\t\t\t\t// all were successful, submit the form\n\t\t\t\t\tif ( num === successes ) {\n\n\t\t\t\t\t\tclear = true;\n\n\t\t\t\t\t\tself.$checkout_form.off( 'submit', self.submit );\n\t\t\t\t\t\tself.$checkout_form.trigger( 'submit' );\n\n\t\t\t\t\t} else if ( errors.length ) {\n\n\t\t\t\t\t\tclear = true;\n\t\t\t\t\t\tstop  = true;\n\n\t\t\t\t\t\tfor ( var i = 0; i < errors.length; i++ ) {\n\t\t\t\t\t\t\tself.add_error( errors[ i ] );\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tself.focus_errors();\n\n\t\t\t\t\t}\n\n\t\t\t\t}\n\n\t\t\t\tif ( clear ) {\n\t\t\t\t\tclearInterval( interval );\n\t\t\t\t}\n\n\t\t\t\tif ( stop ) {\n\t\t\t\t\tself.processing( 'stop' );\n\t\t\t\t}\n\n\t\t\t\tchecks++;\n\n\t\t\t}, 100 );\n\n\t\t};\n\n\t\t// initialize\n\t\tthis.init();\n\n\t\treturn this;\n\n\t};\n\n\twindow.llms          = window.llms || {};\n\twindow.llms.checkout = new llms_checkout();\n\n} )( jQuery );\n"],"names":["$","window","llms","checkout","before_submit","gateways","this","$checkout_form","$confirm_form","$form_sections","form_action","init","self","length","bind_login","find","on","submit","document","querySelector","style","scrollBehavior","add_before_submit_event","data","LLMS","PasswordStrength","handler","bind_coupon","bind_gateways","processing","obj","push","add_error","message","id","$err","prepend","append","console","error","add_gateway","gateway_class","e","preventDefault","slideToggle","coupon_apply","coupon_remove","load_gateways","removeAttr","each","$el","$parent","closest","$fields","checked","is","trigger","val","$selector","attr","$submit","slideUp","slideDown","clear_errors","remove","$btn","code","$messages","$errors","$container","Spinner","start","Ajax","call","action","plan_id","beforeSend","hide","success","r","$message","stop","empty","appendTo","show","replaceWith","coupon_html","gateways_html","summary_html","focus_errors","animate","scrollTop","offset","top","i","g","undefined","bind","$form","func","interval","num","checks","errors","finishes","successes","setInterval","clear","off","clearInterval","jQuery"],"mappings":"CASA,SAAYA,GA4jBXC,OAAOC,KAAgBD,OAAOC,MAAQ,GACtCD,OAAOC,KAAKC,SAAW,IA3jBH,WASnB,IAAIC,EAAgB,GAShBC,EAAW,GAoiBf,OAliBAC,KAAKC,eAAiBP,EAAG,+BACzBM,KAAKE,cAAiBR,EAAG,uCACzBM,KAAKG,gBAAiB,EACtBH,KAAKI,aAAiB,EAYtBJ,KAAKK,KAAO,WAEX,IAAIC,EAAON,KAENN,EAAG,0BAA2Ba,QAClCP,KAAKQ,aAGDR,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SAFGzB,EAGA,cAKA,WAKJ,aAAepE,KAAKI,YACxBwF,EAAQ5F,KAAKC,eACF,YAAcD,KAAKI,cAC9BwF,EAAQ5F,KAAKE,eAGd0F,EAAOC,GAAQ,sBACf3E,KAAK8C,QAASI,GAAUpE,KAAKG,iBAe9BH,KAAKW,OAAS,SAAUyB,GAEvB,IAOC0D,EAPGxF,EAAa8B,EAAEnB,KAClB8E,EAAajG,EAAcS,OAC3ByF,EAAa,EAEbC,EAAa,GACbC,EAAa,EACbC,EAAa,EAGd/D,EAAEC,iBAGF/B,EAAKiB,WAAY,SAGjBjB,EAAKmD,eAGL,IAAM,IAAI+B,EAAI,EAAGA,EAAI1F,EAAcS,OAAQiF,IAAM,CAEhD,IAAIhE,EAAM1B,EAAe0F,GAEzBhE,EAAIJ,QAASI,EAAIP,KAAM,SAAUwD,GAEhCyB,KACK,IAASzB,EACb0B,IACW,iBAAoB1B,GAC/BwB,EAAOxE,KAAMgD,KAQhBqB,EAAWM,YAAa,WAEvB,IAAIC,GAAQ,EACX1B,GAAQ,EAGT,GAvCa,KAuCRqB,EAGJrB,EADA0B,GAAQ,OAGF,GAAKN,IAAQG,EAInB,GAAKH,IAAQI,EAEZE,GAAQ,EAER/F,EAAKL,eAAeqG,IAAK,SAAUhG,EAAKK,QACxCL,EAAKL,eAAeiD,QAAS,eAEvB,GAAK+C,EAAO1F,OAAS,CAK3B,IAAM,IAHN8F,GAAQ,EACR1B,GAAQ,EAEEa,EAAI,EAAGA,EAAIS,EAAO1F,OAAQiF,IACnClF,EAAKoB,UAAWuE,EAAQT,IAGzBlF,EAAK6E,eAMFkB,GACJE,cAAeT,GAGXnB,GACJrE,EAAKiB,WAAY,QAGlByE,KAEE,MAKJhG,KAAKK,OAEEL,MAxjBT,CA+jBKwG","sourceRoot":"../../js"}
  • lifterlms/trunk/class-lifterlms.php

    r2757452 r2758243  
    3535     * @var string
    3636     */
    37     public $version = '7.0.0-alpha.3';
     37    public $version = '7.0.0-alpha.4';
    3838
    3939    /**
  • lifterlms/trunk/includes/class-llms-order-generator.php

    r2757452 r2758243  
    393393        // Try to lookup using the order key if it was supplied.
    394394        if ( $key ) {
    395             $order_id = llms_get_order_by_key( $key, 'id' );
     395            $order_id = $this->sanitize_retrieved_order_id( llms_get_order_by_key( $key, 'id' ) );
    396396        }
    397397
     
    400400
    401401            $user_id  = $this->find_user_id( $email );
    402             $order_id = $user_id ? llms_locate_order_for_user_and_plan( $user_id, $plan_id ) : $order_id;
     402            $order_id = $user_id ? $this->sanitize_retrieved_order_id( llms_locate_order_for_user_and_plan( $user_id, $plan_id ) ) : null;
    403403
    404404        }
     
    406406        // Lookup by email address.
    407407        if ( ! $order_id && $email ) {
    408             $order_id = llms_locate_order_for_email_and_plan( $email, $plan_id );
     408            $order_id = $this->sanitize_retrieved_order_id( llms_locate_order_for_email_and_plan( $email, $plan_id ) );
    409409        }
    410410
     
    490490
    491491    /**
     492     * Sanitizes the order_id retrieved by {@see LLMS_Order_Generator::get_order_id()} to ensure it can be resumed or confirmed during checkout.
     493     *
     494     * Only orders with the `llms-pending` status can be resumed or confirmed.
     495     *
     496     * @since [version]
     497     *
     498     * @param null|int $order_id The order ID or `null` if the lookup didn't yield a result.
     499     * @return int|null Returns the submitted order ID if it's valid or `null`.
     500     */
     501    private function sanitize_retrieved_order_id( $order_id ) {
     502        return $order_id && 'llms-pending' === get_post_status( $order_id ) ? $order_id : null;
     503    }
     504
     505    /**
    492506     * Performs all required data validations necessary to create the order.
    493507     *
  • lifterlms/trunk/includes/models/model.llms.order.php

    r2757452 r2758243  
    17091709        }
    17101710
    1711         $datetime = date_i18n( 'Y-m-d H:i:s', current_time( 'timestamp' ) + $current_rule['delay'] );
    1712 
    1713         $this->set_date( 'next_payment', date( 'Y-m-d H:i:s', $datetime ) );
     1711        $timestamp = current_time( 'timestamp' ) + $current_rule['delay'];
     1712
     1713        $this->set_date( 'next_payment', date_i18n( 'Y-m-d H:i:s', $timestamp ) );
    17141714        $this->set_status( $current_rule['status'] );
    17151715        $this->set( 'last_retry_rule', $current_rule_index );
     
    17191719                // Translators: %s = next attempt date.
    17201720                esc_html__( 'Automatic retry attempt scheduled for %s', 'lifterlms' ),
    1721                 date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), strtotime( $datetime ) )
     1721                date( get_option( 'date_format' ) . ' ' . get_option( 'time_format' ), $timestamp )
    17221722            )
    17231723        );
  • lifterlms/trunk/languages/lifterlms.pot

    r2757452 r2758243  
    33msgid ""
    44msgstr ""
    5 "Project-Id-Version: LifterLMS 7.0.0-alpha.3\n"
     5"Project-Id-Version: LifterLMS 7.0.0-alpha.4\n"
    66"Report-Msgid-Bugs-To: https://lifterlms.com/my-account/my-tickets\n"
    77"Last-Translator: Team LifterLMS <[email protected]>\n"
     
    1010"Content-Type: text/plain; charset=UTF-8\n"
    1111"Content-Transfer-Encoding: 8bit\n"
    12 "POT-Creation-Date: 2022-07-16T13:29:37-07:00\n"
     12"POT-Creation-Date: 2022-07-18T17:48:21-06:00\n"
    1313"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
    1414"X-Generator: llms/dev 0.0.5\n"
     
    54445444#. Translators: %s = The user-submitted coupon code.
    54455445#. Translators: %s = coupon code.
    5446 #: includes/class-llms-order-generator.php:568
     5446#: includes/class-llms-order-generator.php:582
    54475447#: includes/class.llms.ajax.handler.php:1085
    54485448#: includes/functions/llms.functions.order.php:358
     
    54505450msgstr ""
    54515451
    5452 #: includes/class-llms-order-generator.php:605
     5452#: includes/class-llms-order-generator.php:619
    54535453#: includes/functions/llms.functions.order.php:375
    54545454msgid "No payment method selected."
    54555455msgstr ""
    54565456
    5457 #: includes/class-llms-order-generator.php:635
    5458 #: includes/class-llms-order-generator.php:643
     5457#: includes/class-llms-order-generator.php:649
     5458#: includes/class-llms-order-generator.php:657
    54595459#: includes/controllers/class-llms-controller-checkout.php:106
    54605460#: includes/controllers/class-llms-controller-checkout.php:112
     
    54635463msgstr ""
    54645464
    5465 #: includes/class-llms-order-generator.php:665
     5465#: includes/class-llms-order-generator.php:679
    54665466msgid "Missing access plan ID."
    54675467msgstr ""
    54685468
    5469 #: includes/class-llms-order-generator.php:670
     5469#: includes/class-llms-order-generator.php:684
    54705470msgid "Access plan not found."
    54715471msgstr ""
    54725472
    54735473#. Translators: %s = The title of the site's LifterLMS Terms and Conditions page.
    5474 #: includes/class-llms-order-generator.php:692
     5474#: includes/class-llms-order-generator.php:706
    54755475msgid "You must agree to the %s."
    54765476msgstr ""
    54775477
    54785478#. Translators: %s = The title of the course or membership.
    5479 #: includes/class-llms-order-generator.php:724
     5479#: includes/class-llms-order-generator.php:738
    54805480msgid "You already have access to %s."
    54815481msgstr ""
  • lifterlms/trunk/lifterlms.php

    r2757452 r2758243  
    1111 * Plugin URI: https://lifterlms.com/
    1212 * Description: LifterLMS is a powerful WordPress learning management system plugin that makes it easy to create, sell, and protect engaging online courses and training based membership websites.
    13  * Version: 7.0.0-alpha.3
     13 * Version: 7.0.0-alpha.4
    1414 * Author: LifterLMS
    1515 * Author URI: https://lifterlms.com/
  • lifterlms/trunk/vendor/composer/installed.php

    r2757452 r2758243  
    66        'install_path' => __DIR__ . '/../../',
    77        'aliases' => array(),
    8         'reference' => 'b68b7b2bab5be4b719c0b355347446f89c612d3f',
     8        'reference' => '7a8ad49db6571485a30278f248f96f27283363a8',
    99        'name' => 'gocodebox/lifterlms',
    1010        'dev' => false,
     
    3535            'install_path' => __DIR__ . '/../../',
    3636            'aliases' => array(),
    37             'reference' => 'b68b7b2bab5be4b719c0b355347446f89c612d3f',
     37            'reference' => '7a8ad49db6571485a30278f248f96f27283363a8',
    3838            'dev_requirement' => false,
    3939        ),
Note: See TracChangeset for help on using the changeset viewer.