llms-metabox-product.min.js.map 32.4 KB
Newer Older
cyrille's avatar
cyrille committed
1
{"version":3,"sources":["llms-metabox-product.js"],"names":["$","window","llms","metabox_product","this","$plans","$save","temp_id","Math","floor","random","validation_class","init","skip_dep_checks","self","bind_visibility","$mb","length","bind","LLMS","Spinner","start","interval","counter","setInterval","html","l10n","translate","tinyMCE","clearInterval","stop","setTimeout","has_plan_limit_been_reached","toggle_create_button","get_current_plan_count","toggle_save_button","on","e","preventDefault","save_plans","controller_change","$plan_container","closest","$plan_redirect_forced","find","$plan_redirect_settings","val","prop","show","hide","toggle","off","datepicker","dateFormat","trigger","init_plan","sortable","handle","items","event","ui","addClass","removeClass","update_plan_orders","$input","$display","title","attr","text","data","checkValidity","type","reportValidity","cascade","original_event","$plan","selector","each","hasClass","stopPropagation","delete_plan","metaboxes","post_select","EditorManager","execCommand","$radios","$toggle","$cancel","slideDown","slideUp","$btn","plan_id","warning","confirm","Ajax","call","action","success","r","remove_plan_el","trigger_update_hook","message","alert","$el","id","$controls","is","operator","$c","$els","nodeName","equals","not_equals","removeAttr","get_plans_array","triggerSave","form","serializeArray","plans","i","name","indexOf","keys","replace","split","index","push","value","limit","product","access_plan_limit","$clone","clone","$existing_plans","$editor","appendTo","document","not","first","complete","error","jqXHR","textStatus","errorThrown","console","res","code","replaceWith","toggle_button","status","fadeOut","remove","$p","$order","editor_id","orig","curr","editor","get","esettings","settings","jQuery"],"mappings":"CASA,SAAYA,GAEXC,OAAOC,KAAOD,OAAOC,MAAQ,GAE7BD,OAAOC,KAAKC,gBAAkB,WAO7BC,KAAKC,OAAS,KAOdD,KAAKE,MAAQ,KAQbF,KAAKG,QAAUC,KAAKC,MAAyB,KAAhBD,KAAKE,SAAoB,KAOtDN,KAAKO,iBAAmB,eAUxBP,KAAKQ,KAAO,SAAUC,GAErB,IAAIC,EAAOV,KAEXU,EAAKT,OAASL,EAAG,sBACjBc,EAAKR,MAASN,EAAG,2BAEjBc,EAAKC,kBAEL,IAAIC,EAAMhB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GAE/B,IAAI7D,EAAOV,KAGXuE,EAAM2E,QAAS,KAGfvH,WAAW,WAEV4C,EAAM4E,SAGCzI,EAAKkB,+BACXlB,EAAKmB,qBAAsB,UAGvB,IAAMnB,EAAKoB,0BACfpB,EAAKqB,mBAAoB,YAGxB,MAWJ/B,KAAKgG,oBAAsB,WAE1BpG,EAAGwI,UAAWlF,QAAS,8BAexBlD,KAAK2D,mBAAqB,WAEzB/D,EAAG,wCAAyC6E,KAAM,WAEjD,IAAI2E,EAAYxJ,EAAGI,MAClBqJ,EAAYD,EAAG5G,KAAM,eAErB8G,EADYF,EAAG5G,KAAM,wCACDuB,KAAM,MAC1BwF,GAAYF,EAAO3G,MACnB8G,EAAYJ,EAAG3B,QACfgC,EAAYjI,QAAQuD,cAAc2E,IAAIJ,GACtCK,EAAYF,EAASA,EAAOG,SAAWpI,QAAQuD,cAAc6E,SAG9DD,EAAUnF,SAAW,IAAM8E,EAG3B9H,QAAQuD,cAAcC,YAAa,mBAAmB,EAAMsE,GAG5DF,EAAG5G,KAAM,2BAA4BiC,KAAM,WAE1C,IAAI2C,EAAOxH,EAAGI,MAAO+D,KAAM,QACtBqD,GACJxH,EAAGI,MAAO+D,KAAM,OAAQqD,EAAKG,QAASgC,EAAMC,MAQ9ChI,QAAQuD,cAAcvE,KAAMmJ,GAE5BN,EAAO3G,IAAK8G,MAOdxJ,KAAKQ,QAIE,IAAIX,OAAOC,KAAKC,gBA9wBzB,CAgxBK8J","file":"../../js/llms-metabox-product.min.js","sourcesContent":["/**\n * Product Options MetaBox\n * Displays on Course & Membership Post Types\n *\n * @since 3.0.0\n * @since 3.30.3 Unknown.\n * @since 3.36.3 Fixed conflicts with the Classic Editor block.\n * @version 3.36.3\n */\n( function( $ ) {\n\n\twindow.llms = window.llms || {};\n\n\twindow.llms.metabox_product = function() {\n\n\t\t/**\n\t\t * jQuery obj for the main $( '#llms-access-plans' ) element.\n\t\t *\n\t\t * @type obj\n\t\t */\n\t\tthis.$plans = null;\n\n\t\t/**\n\t\t * jQuery obj for the main $( '#llms-save-access-plans' ) save button element.\n\t\t *\n\t\t * @type obj\n\t\t */\n\t\tthis.$save = null;\n\n\t\t/**\n\t\t * A randomly generated temporary ID used for the tinyMCE editor's id\n\t\t * when a new plan is added\n\t\t *\n\t\t * @type int\n\t\t */\n\t\tthis.temp_id = Math.floor( ( Math.random() * 7777 ) + 777 );\n\n\t\t/**\n\t\t * CSS class name used to highlight validation errors for plan fields\n\t\t *\n\t\t * @type string\n\t\t */\n\t\tthis.validation_class = 'llms-invalid';\n\n\t\t/**\n\t\t * Initialize\n\t\t *\n\t\t * @param   bool skip_dep_checks if true, skips dependency checks.\n\t\t * @return  void\n\t\t * @since   3.0.0\n\t\t * @version 3.29.3\n\t\t */\n\t\tthis.init = function( skip_dep_checks ) {\n\n\t\t\tvar self = this;\n\n\t\t\tself.$plans = $( '#llms-access-plans' );\n\t\t\tself.$save  = $( '#llms-save-access-plans' );\n\n\t\t\tself.bind_visibility();\n\n\t\t\tvar $mb = $( '#lifterlms-product #llms-product-options-access-plans' );\n\n\t\t\tif ( ! $mb.length ) {\n\t\t\t\treturn;\n\t\t\t} else if ( skip_dep_checks ) {\n\t\t\t\tself.bind();\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tLLMS.Spinner.start( $mb );\n\n\t\t\t// we rely on TinyMCE but WordPress doesn't register TinyMCE\n\t\t\t// like every other admin script so we'll do a little dependency check here...\n\t\t\tvar counter = 0,\n\t\t\t\tinterval;\n\n\t\t\tinterval = setInterval( function() {\n\n\t\t\t\t// if we get to 30 seconds display an error message\n\t\t\t\tif ( counter >= 300 ) {\n\n\t\t\t\t\t$mb.html( LLMS.l10n.translate( 'There was an error loading the necessary resources. Please try again.' ) );\n\n\t\t\t\t}\n\t\t\t\t// if we can't access tinyMCE, increment and wait...\n\t\t\t\telse if ( 'undefined' === typeof tinyMCE ) {\n\n\t\t\t\t\tcounter++;\n\t\t\t\t\treturn;\n\n\t\t\t\t}\n\t\t\t\t// bind the events, we're good!\n\t\t\t\telse {\n\n\t\t\t\t\tself.bind();\n\n\t\t\t\t}\n\n\t\t\t\tclearInterval( interval );\n\t\t\t\tLLMS.Spinner.stop( $mb );\n\n\t\t\t}, 100 );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind DOM Events\n\t\t *\n\t\t * @since  3.0.0\n\t\t * @since  3.30.0 Add checkout redirect fields events.\n\t\t * @version 3.30.0\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.bind = function() {\n\n\t\t\tvar self = this;\n\n\t\t\tsetTimeout( function() {\n\t\t\t\tif ( self.has_plan_limit_been_reached() ) {\n\t\t\t\t\tself.toggle_create_button( 'disable' );\n\t\t\t\t}\n\t\t\t}, 500 );\n\n\t\t\tif ( 0 === self.get_current_plan_count() ) {\n\t\t\t\tself.toggle_save_button( 'disable' );\n\t\t\t}\n\n\t\t\t// save access plans button.\n\t\t\tself.$save.on( 'click', function( e ) {\n\t\t\t\te.preventDefault();\n\t\t\t\tself.save_plans();\n\t\t\t} );\n\n\t\t\t// bind change events to form element that controls another form element\n\t\t\tself.$plans.on( 'change', '[data-controller-id]', function() {\n\t\t\t\tself.controller_change( $( this ) );\n\t\t\t} );\n\n\t\t\t// @todo Replace this with multiple data-controller functionality in llms-metaboxes.js\n\t\t\tself.$plans.on( 'change', 'select[name$=\"[availability]\"]', function() {\n\t\t\t\tvar $plan_container         = $( this ).closest( '.llms-access-plan' ),\n\t\t\t\t\t$plan_redirect_forced   = $plan_container.find( 'input[name$=\"[checkout_redirect_forced]\"]' ),\n\t\t\t\t\t$plan_redirect_settings = $plan_container.find( '.llms-checkout-redirect-settings' );\n\n\t\t\t\tif ( 'members' === $( this ).val() ) {\n\t\t\t\t\tif ( ! $plan_redirect_forced.prop( 'checked' ) ) {\n\t\t\t\t\t\t$plan_redirect_settings.hide();\n\t\t\t\t\t} else {\n\t\t\t\t\t\t$plan_redirect_settings.show();\n\t\t\t\t\t}\n\n\t\t\t\t\t$plan_redirect_forced.on( 'change', function() {\n\t\t\t\t\t\t$plan_redirect_settings.toggle();\n\t\t\t\t\t} );\n\n\t\t\t\t} else {\n\t\t\t\t\t$plan_redirect_forced.off( 'change' );\n\t\t\t\t\t$plan_redirect_settings.show();\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\t$( '#llms-access-plans .llms-access-plan-datepicker' ).datepicker( {\n\t\t\t\tdateFormat: \"mm/dd/yy\"\n\t\t\t} );\n\n\t\t\t// trigger changes on load for all existing plans\n\t\t\t$( '#llms-access-plans [data-controller-id]' ).trigger( 'change' );\n\n\t\t\t// add a new empty plan interface on new plan button click.\n\t\t\t$( '#llms-new-access-plan' ).on( 'click', function() {\n\t\t\t\tself.init_plan();\n\t\t\t\tself.toggle_create_button( 'disable' );\n\t\t\t\tself.toggle_save_button( 'enable' );\n\t\t\t\tsetTimeout( function() {\n\t\t\t\t\tif ( ! self.has_plan_limit_been_reached() ) {\n\t\t\t\t\t\tself.toggle_create_button( 'enable' );\n\t\t\t\t\t}\n\t\t\t\t}, 500 );\n\t\t\t} );\n\n\t\t\tself.$plans.sortable( {\n\t\t\t\thandle: '.llms-drag-handle',\n\t\t\t\titems: '.llms-access-plan',\n\t\t\t\tstart: function( event, ui ) {\n\t\t\t\t\tself.$plans.addClass( 'dragging' );\n\t\t\t\t},\n\t\t\t\tstop: function( event, ui ) {\n\t\t\t\t\tself.$plans.removeClass( 'dragging' );\n\t\t\t\t\tself.update_plan_orders();\n\t\t\t\t},\n\t\t\t} );\n\n\t\t\t// bind text entered into the title to the displayed title for fancy fun\n\t\t\tself.$plans.on( 'keyup', 'input.llms-plan-title', function( ) {\n\n\t\t\t\tvar $input   = $( this ),\n\t\t\t\t\t$plan    = $input.closest( '.llms-access-plan' ),\n\t\t\t\t\t$display = $plan.find( 'span.llms-plan-title' ),\n\t\t\t\t\tval      = $input.val(),\n\t\t\t\t\ttitle    = ( val ) ? val : $display.attr( 'data-default' );\n\n\t\t\t\t$display.text( title );\n\n\t\t\t} );\n\n\t\t\t// Record that a field has been focused so we can tweak validation to only validate \"edited\" fields.\n\t\t\tself.$plans.on( 'focusin', 'input', function( e, data ) {\n\t\t\t\t$( this ).addClass( 'llms-has-been-focused' );\n\t\t\t} );\n\n\t\t\t// Validate a single input field\n\t\t\tself.$plans.on( 'keyup focusout llms-validate-plan-field', 'input', function( e, data ) {\n\n\t\t\t\tvar $input = $( this );\n\n\t\t\t\tif ( $input[0].checkValidity() ) {\n\t\t\t\t\t$input.removeClass( self.validation_class );\n\t\t\t\t} else {\n\t\t\t\t\t$input.addClass( self.validation_class );\n\t\t\t\t\tif ( 'keyup' === e.type ) {\n\t\t\t\t\t\t$input[0].reportValidity();\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif ( ! data || data.cascade ) {\n\t\t\t\t\t$input.closest( '.llms-access-plan' ).trigger( 'llms-validate-plan', { original_event: e.type } );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tself.$plans.on( 'llms-validate-plan', '.llms-access-plan', function( e, data ) {\n\n\t\t\t\tdata = data || {};\n\n\t\t\t\tvar $plan = $( this ),\n\t\t\t\t\t// only validate \"edited\" fields during cascading validation from input validations.\n\t\t\t\t\tselector = data.original_event ? 'input.llms-has-been-focused' : 'input';\n\n\t\t\t\t$plan.find( selector ).each( function() {\n\t\t\t\t\t$( this ).trigger( 'llms-validate-plan-field', { cascade: false } );\n\t\t\t\t} );\n\n\t\t\t\tif ( $plan.find( '.' + self.validation_class ).length ) {\n\t\t\t\t\t$plan.addClass( self.validation_class );\n\t\t\t\t} else {\n\t\t\t\t\t$plan.removeClass( self.validation_class );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tself.$plans.on( 'llms-collapsible-toggled', '.llms-access-plan', function() {\n\n\t\t\t\tvar $plan = $( this );\n\n\t\t\t\tif ( $plan.hasClass( 'opened' ) ) {\n\t\t\t\t\t// wait for animation to complete to prevent focusable errors in the console.\n\t\t\t\t\tsetTimeout( function() {\n\t\t\t\t\t\t$plan.find( 'input.llms-invalid' ).each( function() {\n\t\t\t\t\t\t\t$( this )[0].reportValidity();\n\t\t\t\t\t\t} );\n\t\t\t\t\t}, 500 );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t\tself.$plans.on( 'click', '.llms-plan-delete', function( e ) {\n\t\t\t\te.stopPropagation();\n\t\t\t\tself.delete_plan( $( this ) );\n\t\t\t} );\n\n\t\t\t// select2ify membership availability fields\n\t\t\twindow.llms.metaboxes.post_select( $( '#llms-access-plans .llms-availability-restrictions' ) );\n\n\t\t\t// select2ify redirection page fields\n\t\t\twindow.llms.metaboxes.post_select( $( '#llms-access-plans .llms-checkout-redirect-page' ) );\n\n\t\t\t// disable the textarea generated by the wp_editor function\n\t\t\t// can't figure out how to do this during initialization\n\t\t\t$( '#_llms_plans_content_llms-new-access-plan-model' ).attr( 'disabled', 'disabled' );\n\t\t\ttinyMCE.EditorManager.execCommand( 'mceRemoveEditor', true, '_llms_plans_content_llms-new-access-plan-model' );\n\n\t\t};\n\n\t\t/**\n\t\t * Bind DOM events for editing product visibility\n\t\t *\n\t\t * @return   void\n\t\t * @since    3.6.0\n\t\t * @version  3.6.0\n\t\t */\n\t\tthis.bind_visibility = function() {\n\n\t\t\tvar $radios = $( '#llms-catalog-visibility-select' ),\n\t\t\t\t$toggle = $( 'a.llms-edit-catalog-visibility' ),\n\t\t\t\t$save   = $( 'a.llms-save-catalog-visibility' ),\n\t\t\t\t$cancel = $( 'a.llms-cancel-catalog-visibility' );\n\n\t\t\t$toggle.on( 'click', function( e ) {\n\t\t\t\te.preventDefault();\n\t\t\t\t$radios.slideDown( 'fast' );\n\t\t\t\t$toggle.hide();\n\t\t\t} );\n\n\t\t\t$save.on( 'click', function( e ) {\n\t\t\t\te.preventDefault();\n\t\t\t\t$radios.slideUp( 'fast' );\n\t\t\t\t$toggle.show();\n\t\t\t\t$( '#llms-catalog-visibility-display' ).text( $( 'input[name=\"_llms_visibility\"]:checked' ).attr( 'data-label' ) );\n\t\t\t} );\n\n\t\t\t$cancel.on( 'click', function( e ) {\n\t\t\t\te.preventDefault();\n\t\t\t\t$radios.slideUp( 'fast' );\n\t\t\t\t$toggle.show();\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Handle physical deletion of a plan element\n\t\t * If the plan hasn't be persisted to the database it's removed from the dom\n\t\t * if it already exists in the database a confirm modal is displayed\n\t\t * upon confirmation AJAX call will be made to move the plan to the trash\n\t\t * and upon success the element will be removed from the dom\n\t\t *\n\t\t * @param  obj $btn jQuery selector of the \"X\" button clicked to initiate deletion\n\t\t * @return void\n\t\t * @since  3.0.0\n\t\t * @version 3.29.1\n\t\t */\n\t\tthis.delete_plan = function( $btn ) {\n\n\t\t\tvar self    = this,\n\t\t\t\t$plan   = $btn.closest( '.llms-access-plan' ),\n\t\t\t\tplan_id = $plan.attr( 'data-id' ),\n\t\t\t\twarning = LLMS.l10n.translate( 'After deleting this access plan, any students subscribed to this plan will still have access and will continue to make recurring payments according to the access plan\\'s settings. If you wish to terminate their plans you must do so manually. This action cannot be reversed.' );\n\n\t\t\t// if there's no ID just remove the element from the DOM\n\t\t\tif ( ! plan_id ) {\n\n\t\t\t\tself.remove_plan_el( $plan );\n\n\t\t\t\t// Throw a confirmation warning\n\t\t\t} else if ( window.confirm( warning ) ) {\n\n\t\t\t\tLLMS.Spinner.start( $plan );\n\t\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\t\tdata: {\n\t\t\t\t\t\taction: 'delete_access_plan',\n\t\t\t\t\t\tplan_id: plan_id,\n\t\t\t\t\t},\n\t\t\t\t\tsuccess: function( r ) {\n\t\t\t\t\t\tsetTimeout( function() {\n\t\t\t\t\t\t\tLLMS.Spinner.stop( $plan );\n\t\t\t\t\t\t}, 550 );\n\t\t\t\t\t\tif ( r.success ) {\n\t\t\t\t\t\t\tself.remove_plan_el( $plan );\n\t\t\t\t\t\t\tself.trigger_update_hook();\n\t\t\t\t\t\t\tsetTimeout( function() {\n\t\t\t\t\t\t\t\tself.update_plan_orders();\n\t\t\t\t\t\t\t}, 500 );\n\t\t\t\t\t\t} else if ( r.message ) {\n\t\t\t\t\t\t\talert( r.message );\n\t\t\t\t\t\t}\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 * Handle hiding & showing various pieces of an access plan form\n\t\t * This is bound to any form element with a \"data-controller-id\" property\n\t\t *\n\t\t * @param  obj  $el   jQuery selector for the changed form element\n\t\t * @return void\n\t\t * @since  3.0.0\n\t\t */\n\t\tthis.controller_change = function( $el ) {\n\n\t\t\tvar id        = $el.attr( 'data-controller-id' ),\n\t\t\t\tval       = $el.val(),\n\t\t\t\t$form     = $el.closest( '.llms-access-plan' ),\n\t\t\t\t$controls = $form.find( '[data-controller=\"' + id + '\"]' );\n\n\t\t\tif ( 'checkbox' === $el.attr( 'type' ) ) {\n\t\t\t\tval = ( $el.is( ':checked' ) ) ? val : 'no';\n\t\t\t}\n\n\t\t\t$controls.each( function() {\n\n\t\t\t\tvar $c         = $( this ),\n\t\t\t\t\t$els       = ( 'SELECT' === $c[0].nodeName || 'INPUT' === $c[0].nodeName || 'TEXTAREA' === $c[0].nodeName ) ? $c : $c.find( 'input, select, textarea' ),\n\t\t\t\t\tequals     = $c.attr( 'data-value-is' ),\n\t\t\t\t\tnot_equals = $c.attr( 'data-value-is-not' ),\n\t\t\t\t\taction, operator;\n\n\t\t\t\tif ( typeof equals !== typeof undefined && equals !== false ) {\n\n\t\t\t\t\toperator = '==';\n\n\t\t\t\t} else if ( typeof not_equals !== typeof undefined && not_equals !== false ) {\n\n\t\t\t\t\toperator = '!=';\n\n\t\t\t\t}\n\n\t\t\t\tswitch ( operator ) {\n\n\t\t\t\t\tcase '==':\n\n\t\t\t\t\t\tif ( val == equals ) {\n\t\t\t\t\t\t\taction = 'show';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\taction = 'hide';\n\t\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t\tcase '!=':\n\n\t\t\t\t\t\tif ( val != not_equals ) {\n\t\t\t\t\t\t\taction = 'show';\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\taction = 'hide';\n\t\t\t\t\t\t}\n\n\t\t\t\t\tbreak;\n\n\t\t\t\t}\n\n\t\t\t\tif ( 'show' === action ) {\n\t\t\t\t\t$c.show();\n\t\t\t\t\t$els.removeAttr( 'disabled' ).trigger( 'change' );\n\t\t\t\t} else if ( 'hide' === action ) {\n\t\t\t\t\t$c.hide();\n\t\t\t\t\t$els.attr( 'disabled', 'disabled' );\n\t\t\t\t}\n\n\t\t\t} );\n\n\t\t};\n\n\t\t/**\n\t\t * Retrieve the current number of access plans for the course / membership (saved or unsaved)\n\t\t *\n\t\t * @return  int\n\t\t * @since   3.29.0\n\t\t * @version 3.29.0\n\t\t */\n\t\tthis.get_current_plan_count = function() {\n\t\t\treturn this.$plans.find( '.llms-access-plan' ).length;\n\t\t}\n\n\t\t/**\n\t\t * Retrieve access plan data as an array of JSON built from the dom element field values.\n\t\t *\n\t\t * @return  array\n\t\t * @since   3.29.0\n\t\t * @version 3.29.0\n\t\t */\n\t\tthis.get_plans_array = function() {\n\n\t\t\t// ensure all content editors are saved properly.\n\t\t\ttinyMCE.triggerSave();\n\n\t\t\tvar self  = this,\n\t\t\t\tform  = self.$plans.closest( 'form' ).serializeArray(),\n\t\t\t\tplans = [];\n\n\t\t\tfor ( var i = 0; i < form.length; i++ ) {\n\n\t\t\t\t// Skip non plan data from the form.\n\t\t\t\tif ( -1 === form[ i ].name.indexOf( '_llms_plans' ) ) {\n\t\t\t\t\tcontinue;\n\t\t\t\t}\n\n\t\t\t\tvar keys  = form[ i ].name.replace( '_llms_plans[', '' ).split( '][' ),\n\t\t\t\t\tindex = ( keys[0] * 1 ) - 1,\n\t\t\t\t\tname  = keys[1].replace( ']', '' ),\n\t\t\t\t\ttype  = 3 === keys.length ? 'array' : 'single';\n\n\t\t\t\tif ( ! plans[ index ] ) {\n\t\t\t\t\tplans[ index ] = {};\n\t\t\t\t}\n\n\t\t\t\tif ( 'array' === type ) {\n\n\t\t\t\t\tif ( ! plans[ index ][ name ] ) {\n\t\t\t\t\t\tplans[ index ][ name ] = [];\n\t\t\t\t\t}\n\t\t\t\t\tplans[ index ][ name ].push( form[ i ].value );\n\n\t\t\t\t} else {\n\n\t\t\t\t\tplans[ index ][ name ] = form[ i ].value;\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t\treturn plans;\n\n\t\t};\n\n\t\t/**\n\t\t * Determine if the access plan limit has been reached\n\t\t *\n\t\t * @return Boolean\n\t\t * @since  3.0.0\n\t\t * @version  3.29.0\n\t\t */\n\t\tthis.has_plan_limit_been_reached = function() {\n\n\t\t\tvar limit = window.llms.product.access_plan_limit;\n\t\t\treturn this.get_current_plan_count() >= limit;\n\n\t\t};\n\n\t\t/**\n\t\t * Initializes a new plan and adds it to the list of plans in the DOM\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.30.0 Initialize select2 on checkout redirect fields.\n\t\t * @version 3.30.0\n\t\t *\n\t\t * @return   void\n\t\t */\n\t\tthis.init_plan = function() {\n\n\t\t\t// don't do anything if we've reached the plan limit\n\t\t\tif ( this.has_plan_limit_been_reached() ) {\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tvar $clone          = $( '#llms-new-access-plan-model' ).clone()\n\t\t\t\t$existing_plans = $( '#llms-access-plans .llms-access-plan' ),\n\t\t\t\t$editor         = $clone.find( '#_llms_plans_content_llms-new-access-plan-model' );\n\n\t\t\t// remove ID from the item\n\t\t\t$clone.removeAttr( 'id' );\n\n\t\t\t// give a temporary id to the editor element\n\t\t\t$editor.removeAttr( 'id' ).attr( 'id', '_llms_plans_content_' + this.temp_id );\n\t\t\tthis.temp_id++; // increment the temp_id ID so we don't use it again\n\n\t\t\t// activate all elements\n\t\t\t$clone.find( 'select, input, textarea' ).each( function() {\n\t\t\t\t$( this ).removeAttr( 'disabled' ); // enabled the field\n\t\t\t} );\n\n\t\t\t$clone.find( '.llms-access-plan-datepicker' ).datepicker( {\n\t\t\t\tdateFormat: \"mm/dd/yy\"\n\t\t\t} );\n\n\t\t\t$clone.appendTo( '#llms-access-plans' );\n\n\t\t\t// rewrite the order of all elements\n\t\t\tthis.update_plan_orders();\n\n\t\t\t$clone.find( '.llms-collapsible-header' ).trigger( 'click' );\n\n\t\t\t// check if the limit has been reached and toggle the button if it has\n\t\t\tif ( this.has_plan_limit_been_reached() ) {\n\t\t\t\tthis.toggle_create_button( 'disable' );\n\t\t\t}\n\n\t\t\t// select2ify membership availability field\n\t\t\twindow.llms.metaboxes.post_select( $clone.find( '.llms-availability-restrictions' ) );\n\n\t\t\t// select2ify redirection page fields\n\t\t\twindow.llms.metaboxes.post_select( $clone.find( '.llms-checkout-redirect-page' ) );\n\n\t\t\t$clone.find( '[data-controller-id]' ).trigger( 'change' );\n\t\t\t$( document ).trigger( 'llms-plan-init', $clone );\n\n\t\t};\n\n\t\t/**\n\t\t * Persist access plans to the DB if they pass validation\n\t\t *\n\t\t * @since 3.29.0\n\t\t * @since 3.30.3 Fixed typo in error message.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.save_plans = function() {\n\n\t\t\tvar self = this;\n\n\t\t\tself.$plans.find( '.llms-access-plan' ).not( '#llms-new-access-plan-model' ).each( function() {\n\t\t\t\t$( this ).trigger( 'llms-validate-plan' );\n\t\t\t} );\n\n\t\t\tif ( self.$plans.find( '.' + self.validation_class ).length ) {\n\t\t\t\tself.$plans.find( '.llms-access-plan.' + self.validation_class ).not( '.opened' ).first().find( '.llms-collapsible-header' ).trigger( 'click' );\n\t\t\t\t$( document ).trigger( 'llms-access-plan-validation-errors' );\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tLLMS.Spinner.start( self.$plans );\n\t\t\tself.$save.attr( 'disabled', 'disabled' );\n\t\t\twindow.LLMS.Ajax.call( {\n\t\t\t\tdata: {\n\t\t\t\t\taction: 'llms_update_access_plans',\n\t\t\t\t\tplans: self.get_plans_array(),\n\t\t\t\t},\n\t\t\t\tcomplete: function() {\n\t\t\t\t\tLLMS.Spinner.stop( self.$plans );\n\t\t\t\t\tself.$save.removeAttr( 'disabled' );\n\t\t\t\t},\n\t\t\t\terror: function( jqXHR, textStatus, errorThrown ) {\n\t\t\t\t\tconsole.error( 'llms access plan save error encounterd:', jqXHR );\n\t\t\t\t\talert( LLMS.l10n.translate( 'An error was encountered during the save attempt. Please try again.' ) + ' [' + textStatus + ': ' + errorThrown + ']' );\n\t\t\t\t},\n\t\t\t\tsuccess: function( res ) {\n\n\t\t\t\t\tif ( ! res.success && res.code && 'error' === res.code ) {\n\t\t\t\t\t\talert( res.message );\n\t\t\t\t\t} else if ( res.data && res.data.html ) {\n\n\t\t\t\t\t\t// replace the metabox with updated data from the server.\n\t\t\t\t\t\t$( '#llms-product-options-access-plans' ).replaceWith( res.data.html );\n\n\t\t\t\t\t\t// reinit.\n\t\t\t\t\t\tself.init( true );\n\t\t\t\t\t\twindow.llms.metaboxes.init();\n\t\t\t\t\t\tself.update_plan_orders();\n\n\t\t\t\t\t\t// notify the block editor\n\t\t\t\t\t\tself.trigger_update_hook();\n\n\t\t\t\t\t}\n\n\t\t\t\t},\n\n\t\t\t} );\n\t\t};\n\n\t\t/**\n\t\t * Toggle the status of a button\n\t\t *\n\t\t * @param   Object  $btn   jQuery selector of a button element\n\t\t * @param  string status enable or disable\n\t\t * @return  void\n\t\t * @since   3.29.0\n\t\t * @version 3.29.0\n\t\t */\n\t\tthis.toggle_button = function( $btn, status ) {\n\n\t\t\tif ( 'disable' === status ) {\n\t\t\t\t$btn.attr( 'disabled', 'disabled' );\n\t\t\t} else {\n\t\t\t\t$btn.removeAttr( 'disabled' );\n\t\t\t}\n\n\t\t};\n\n\t\t/**\n\t\t * Control the status of the \"New Access Plan\" Button\n\t\t *\n\t\t * @param  string status enable or disable\n\t\t * @return void\n\t\t * @since  3.0.0\n\t\t * @since  3.29.0\n\t\t */\n\t\tthis.toggle_create_button = function( status ) {\n\t\t\tthis.toggle_button( $( '#llms-new-access-plan' ), status );\n\t\t};\n\n\t\t/**\n\t\t * Control the status of the \"Save Access Plans\" Button\n\t\t *\n\t\t * @param  string status enable or disable\n\t\t * @return void\n\t\t * @since  3.0.0\n\t\t * @since  3.29.0\n\t\t */\n\t\tthis.toggle_save_button = function( status ) {\n\t\t\tthis.toggle_button( this.$save, status );\n\t\t}\n\n\t\t/**\n\t\t * Visually hide and then physically remove a plan element from the DOM\n\t\t * Additionally determines if the New Plan Button should be re-enabled\n\t\t * after deletion\n\t\t *\n\t\t * @param  obj   $plan jQuery selector of the plan element\n\t\t * @return void\n\t\t * @since 3.0.0\n\t\t * @version 3.29.0\n\t\t */\n\t\tthis.remove_plan_el = function( $plan ) {\n\n\t\t\tvar self = this;\n\n\t\t\t// fade out nicely\n\t\t\t$plan.fadeOut( 400 );\n\n\t\t\t// remove from dom after it's hidden visually\n\t\t\tsetTimeout(function() {\n\n\t\t\t\t$plan.remove();\n\n\t\t\t\t// check if we need to reenable the create button and hide the message\n\t\t\t\tif ( ! self.has_plan_limit_been_reached() ) {\n\t\t\t\t\tself.toggle_create_button( 'enable' );\n\t\t\t\t}\n\n\t\t\t\tif ( 0 === self.get_current_plan_count() ) {\n\t\t\t\t\tself.toggle_save_button( 'disable' );\n\t\t\t\t}\n\n\t\t\t}, 450 );\n\n\t\t};\n\n\t\t/**\n\t\t * Trigger WP Block Editor hook so the pricing table block can be re-rendered with new plan information.\n\t\t *\n\t\t * @return  void\n\t\t * @since   3.29.0\n\t\t * @version 3.29.0\n\t\t */\n\t\tthis.trigger_update_hook = function() {\n\n\t\t\t$( document ).trigger( 'llms-access-plans-updated' );\n\n\t\t};\n\n\t\t/**\n\t\t * Reorder the array indexes and the menu order hidden inputs.\n\t\t * Called by jQuery UI Sortable on sort completion.\n\t\t * Also called after adding a new plan to the DOM so the newest item is always\n\t\t * persisted as the last in the database if no UX reorders the item.\n\t\t *\n\t\t * @since 3.0.0\n\t\t * @since 3.36.3 Fixed conflicts with the classic editor block.\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tthis.update_plan_orders = function() {\n\n\t\t\t$( '#llms-access-plans .llms-access-plan' ).each( function() {\n\n\t\t\t\tvar $p        = $( this ),\n\t\t\t\t\t$order    = $p.find( '.plan-order' ),\n\t\t\t\t\t$editor   = $p.find( 'textarea[id^=\"_llms_plans_content_\"]' ),\n\t\t\t\t\teditor_id = $editor.attr( 'id' ),\n\t\t\t\t\torig      = $order.val() * 1,\n\t\t\t\t\tcurr      = $p.index(),\n\t\t\t\t\teditor    = tinyMCE.EditorManager.get(editor_id),\n\t\t\t\t\tesettings = editor ? editor.settings : tinyMCE.EditorManager.settings;\n\n\t\t\t\t// make sure the editor settings have the right selector.\n\t\t\t\tesettings.selector = '#' + editor_id;\n\n\t\t\t\t// de-init tinyMCE from the editor.\n\t\t\t\ttinyMCE.EditorManager.execCommand( 'mceRemoveEditor', true, editor_id );\n\n\t\t\t\t// update the order of each field in the plan.\n\t\t\t\t$p.find( 'select, input, textarea' ).each( function() {\n\n\t\t\t\t\tvar name = $( this ).attr( 'name' );\n\t\t\t\t\tif ( name ) {\n\t\t\t\t\t\t$( this ).attr( 'name', name.replace( orig, curr ) );\n\t\t\t\t\t}\n\n\t\t\t\t} );\n\n\t\t\t\t// re-init tinyMCE on the editor.\n\t\t\t\t// We used:\ttinyMCE.EditorManager.execCommand( 'mceAddEditor', true, editor_id );\n\t\t\t\t// but it turned out to create conflicts with the Classic Editor block.\n\t\t\t\ttinyMCE.EditorManager.init( esettings );\n\n\t\t\t\t$order.val( curr );\n\n\t\t\t} );\n\n\t\t};\n\n\t\t// go\n\t\tthis.init();\n\n\t};\n\n\tvar a = new window.llms.metabox_product();\n\n} )( jQuery );\n"],"sourceRoot":"../../js"}