' . esc_html__( "Your settings have been successfully saved.", "aion-assists" ) . "

"; delete_option("aionassists_last_action_status"); } } function aionassists_fetch_sessions_data_callback() { $user_status = get_option("aionassists_plan_name", "free"); if ($user_status === "advanced") { wp_send_json_success(["status" => "advanced"]); } elseif ($user_status === "enterprise") { wp_send_json_success(["status" => "enterprise"]); } else { wp_send_json_success(["status" => "free"]); } wp_die(); } function aionassists_save_preferences() { $courierCompany = sanitize_text_field($_POST["courierCompany"]); $returnConditions = sanitize_text_field($_POST["returnConditions"]); $warrantyTerms = sanitize_text_field($_POST["warrantyTerms"]); $dispatchDuration = sanitize_text_field($_POST["dispatchDuration"]); $phoneNumber = sanitize_text_field($_POST["phoneNumber"]); $emailAddress = sanitize_text_field($_POST["emailAddress"]); $freeShippingThreshold = sanitize_text_field( $_POST["freeShippingThreshold"] ); $refundDuration = sanitize_text_field($_POST["refundDuration"]); update_option("aionassists_courierCompany", $courierCompany); update_option("aionassists_returnConditions", $returnConditions); update_option("aionassists_warrantyTerms", $warrantyTerms); update_option("aionassists_dispatchDuration", $dispatchDuration); update_option("aionassists_phoneNumber", $phoneNumber); update_option("aionassists_emailAddress", $emailAddress); update_option("aionassists_freeShippingThreshold", $freeShippingThreshold); update_option("aionassists_refundDuration", $refundDuration); update_option("aionassists_last_action_status", "success"); wp_send_json_success("Preferences saved successfully"); wp_die(); } function aionassists_save_main_settings() { $welcomeHeader = sanitize_text_field($_POST["welcomeHeader"]); $welcomeMessageText = sanitize_text_field($_POST["welcomeMessageText"]); $chatbotHeader = sanitize_text_field($_POST["chatbotHeader"]); $faqHref = sanitize_text_field($_POST["faqHref"]); $firstMessage = sanitize_text_field($_POST["firstMessage"]); $firstMessageHref = sanitize_text_field($_POST["firstMessageHref"]); $selectedTheme = sanitize_text_field($_POST["selectedTheme"]); update_option("aionassists_welcomeHeader", $welcomeHeader); update_option("aionassists_welcomeMessageText", $welcomeMessageText); update_option("aionassists_chatbotHeader", $chatbotHeader); update_option("aionassists_faqHref", $faqHref); update_option("aionassists_firstMessage", $firstMessage); update_option("aionassists_firstMessageHref", $firstMessageHref); update_option("aionassists_selectedTheme", $selectedTheme); update_option("aionassists_last_action_status", "success"); wp_send_json_success("Main settings saved successfully"); wp_die(); } function save_company_details() { global $wpdb; $token = sanitize_text_field($_POST["token"]); $license_option = sanitize_text_field($_POST["license_option"]); $license_id = sanitize_text_field($_POST["license_id"]); $license_key = sanitize_text_field($_POST["license_key"]); $company_name = sanitize_text_field($_POST["company_name"]); $openai_key = sanitize_text_field($_POST["openai_key"]); $plan_name = sanitize_text_field($_POST["plan_name"]); update_option("aionassists_token", $token); update_option("aionassists_license_key", $license_key); update_option("aionassists_license_id", $license_id); update_option("aionassists_company_name", $company_name); update_option("aionassists_license_option", $license_option); update_option("aionassists_openai_key", $openai_key); update_option("aionassists_plan_name", $plan_name); update_option("aionassists_last_action_status", "success"); wp_send_json_success("Company details saved successfully"); wp_die(); } function aionassists_save_settings() { $settings = [ "retrieve_an_order_status" => sanitize_text_field( $_POST["retrieve_an_order_status"] ), "retrieve_billing_address" => sanitize_text_field( $_POST["retrieve_billing_address"] ), "retrieve_shipping_address" => sanitize_text_field( $_POST["retrieve_shipping_address"] ), "retrieve_an_order_create_date" => sanitize_text_field( $_POST["retrieve_an_order_create_date"] ), "retrieve_an_order_items" => sanitize_text_field( $_POST["retrieve_an_order_items"] ), "retrieve_order_refunds" => sanitize_text_field( $_POST["retrieve_order_refunds"] ), "list_all_payment_gateways" => sanitize_text_field( $_POST["list_all_payment_gateways"] ), "list_all_shipping_zones" => sanitize_text_field( $_POST["list_all_shipping_zones"] ), "update_an_order_note" => sanitize_text_field( $_POST["update_an_order_note"] ), "update_shipping_address" => sanitize_text_field( $_POST["update_shipping_address"] ), "describe_product_marketing_style" => sanitize_text_field( $_POST["describe_product_marketing_style"] ), "retrieve_product_stock" => sanitize_text_field( $_POST["retrieve_product_stock"] ), ]; foreach ($settings as $key => $value) { update_option("aionassists_" . $key, $value); } update_option("aionassists_last_action_status", "success"); wp_send_json_success("Settings saved successfully"); wp_die(); } function aionassists_add_admin_menu() { add_menu_page( "Aion Assists", "Aion Assists", "manage_options", "aionassists_dashboard", "aionassists_dashboard_page", "dashicons-format-status", "7" ); add_submenu_page( "aionassists_dashboard", __("Dashboard", "aion-assists"), __("Dashboard", "aion-assists"), "manage_options", "aionassists_dashboard", "aionassists_dashboard_page" ); add_submenu_page( "aionassists_dashboard", __("Settings", "aion-assists"), __("Settings", "aion-assists"), "manage_options", "aionassists_settings", "aionassists_settings_page" ); add_submenu_page( "aionassists_dashboard", __("Preferences", "aion-assists"), __("Preferences", "aion-assists"), "manage_options", "aionassists_preferences", "aionassists_preferences_page" ); add_submenu_page( "aionassists_dashboard", __("Customize", "aion-assists"), __("Customize", "aion-assists"), "manage_options", "aionassists_customize", "aionassists_customize_page" ); add_submenu_page( "aionassists_dashboard", __("Setup Wizard", "aion-assists"), __("Setup Wizard", "aion-assists"), "manage_options", "aionassists_setup_wizard", "aionassists_setup_wizard_page" ); } add_action("admin_menu", "aionassists_add_admin_menu"); function aionassists_dashboard_page() { ?>

" alt="Sessions" class="metric-icon">
-
Conversions
-
Leads
-
[ "option" => get_option("aionassists_retrieve_an_order_status", ""), "label" => __("Allow to view order status.", "aion-assists"), "description" => __("A tool where the customer can view the order status by entering the order number.", "aion-assists"), ], "retrieve_billing_address" => [ "option" => get_option("aionassists_retrieve_billing_address", ""), "label" => __("Allow to view the billing address.", "aion-assists"), "description" => __("A tool where the customer can view their billing address by entering their order number and email address.", "aion-assists"), ], "retrieve_shipping_address" => [ "option" => get_option("aionassists_retrieve_shipping_address", ""), "label" => __("Allow to view the shipping address.", "aion-assists"), "description" => __("A tool where the customer can view their shipping address by entering their order number and email address.", "aion-assists"), ], "retrieve_an_order_create_date" => [ "option" => get_option("aionassists_retrieve_an_order_create_date", ""), "label" => __("Allow to view the creation date of the order.", "aion-assists"), "description" => __("A tool where the customer can view the creation date of the order by entering the order number.", "aion-assists"), ], "retrieve_an_order_items" => [ "option" => get_option("aionassists_retrieve_an_order_items", ""), "label" => __("Allow to view order items.", "aion-assists"), "description" => __("A tool where the customer can enter their order number and email address to view the items of the order.", "aion-assists"), ], "retrieve_order_refunds" => [ "option" => get_option("aionassists_retrieve_order_refunds", ""), "label" => __("Allow to view an order return status.", "aion-assists"), "description" => __("A tool where the customer can enter the order number and e-mail address to view the return status of the order.", "aion-assists"), ], "list_all_payment_gateways" => [ "option" => get_option("aionassists_list_all_payment_gateways", ""), "label" => __("Allow to view which payment gateways are used.", "aion-assists"), "description" => __("A tool that can display which payment methods your store allows for customers.", "aion-assists"), ], "list_all_shipping_zones" => [ "option" => get_option("aionassists_list_all_shipping_zones", ""), "label" => __("Allow to view which zones are shipping to.", "aion-assists"), "description" => __("A tool that allows a user to view information about which regions your store ships to.", "aion-assists"), ], "update_an_order_note" => [ "option" => get_option("aionassists_update_an_order_note", ""), "label" => __("Allow adding and updating notes to the order.", "aion-assists"), "description" => __("A tool that allows the customer to add or update a note to their order by entering their order number and email address.", "aion-assists"), ], "update_shipping_address" => [ "option" => get_option("aionassists_update_shipping_address", ""), "label" => __("Allow updating the shipping address.", "aion-assists"), "description" => __("A tool that allows the customer to update the delivery address by entering the order number and email address.", "aion-assists"), ], "describe_product_marketing_style" => [ "option" => get_option("aionassists_describe_product_marketing_style", ""), "label" => __("Allow product description with sales talk.", "aion-assists"), "description" => __("A tool that provides customers with product descriptions in the event of a product inquiry. If there is an existing description for the product, it will be displayed. If not, a response will be crafted by GPT, taking the product title as a reference and responding in the tone of a marketer.", "aion-assists"), ], "retrieve_product_stock" => [ "option" => get_option("aionassists_retrieve_product_stock", ""), "label" => __("Allow to view stock status.", "aion-assists"), "description" => __("A tool where the customer can find out the stock status of a product.", "aion-assists"), ], ]; echo '
'; echo '
'; echo "

" . esc_html__("Chatbot Settings", "aion-assists") . "

"; ?>
" . esc_html__( "Select the operations you want the Customer Care service to perform.", "aion-assists" ) . "

"; echo '
'; wp_nonce_field('aionassists_save_settings_nonce', 'aionassists_settings_nonce'); foreach ($settings as $setting => $details) { $disabled = $is_free || (!$is_enterprise && !in_array($setting, [ "retrieve_an_order_status", "retrieve_billing_address", "retrieve_shipping_address", "retrieve_an_order_items", "retrieve_an_order_create_date", "retrieve_order_refunds", "list_all_payment_gateways", "list_all_shipping_zones", ])); echo '
'; printf( /* translators: %s: Feature label */ '', esc_html($details["label"]) ); printf( /* translators: %s: Feature description */ '

%s

', esc_html($details["description"]) ); echo '"; echo '"; echo "
"; } echo '"; echo "
"; echo "
"; } function aionassists_preferences_page() { $plan_name = get_option("aionassists_plan_name", "free"); $is_advanced = $plan_name === "advanced"; $is_enterprise = $plan_name === "enterprise"; $is_free = $plan_name === "free" || $plan_name === ""; ?>

" value="" required> " value="" required> " value="" required> " value="" required> " value="" required> " value="" required> " value="" required> " value="" required>


"linear-gradient(135deg, #CE9FFC 10%, #938aed 100%)", "theme2" => "linear-gradient(135deg, #FF9D6C 10%, #dd6d95 100%)", "theme3" => "linear-gradient( 135deg, #3C8CE7 50%, #00EAFF 130%)", "theme4" => "linear-gradient(-225deg, #7085B6 0%, #87A7D9 50%, #a2bec5 100%)", "theme5" => "linear-gradient( 109.6deg, rgba(61,131,97,1) 11.2%, rgba(28,103,88,1) 91.1% )", "theme6" => "radial-gradient(circle at 18.7% 37.8%, rgb(239 239 239) 0%, rgb(219 219 219) 90%)", ]; foreach ($themes as $theme => $gradient) { ?>
>

" maxlength="35" value="">

" maxlength="250" value="">

" maxlength="25" value="">

" maxlength="255" value="">

" maxlength="150" value=""> ">
"Aion Assists - Customer Service", "scope" => "read_write", "user_id" => urlencode($license_id), // Lisans id olarak kullanılacak "return_url" => urlencode( admin_url( "admin.php?page=aionassists_settings&tab=setup_wizard" ) ), "callback_url" => urlencode( "https://aionassistsapp.azurewebsites.net/auth/callback-endpoint" ), ]; $query_string = http_build_query($params); $auth_url = $website_url . $endpoint . "?" . $query_string; echo ""; exit(); } ?>

" value="" required>

" required> " value="" required> " value="" required>