diff --git a/hellotext.php b/hellotext.php index 6f6b9c5..0d79ead 100644 --- a/hellotext.php +++ b/hellotext.php @@ -6,13 +6,15 @@ * * @wordpress-plugin * Plugin Name: Hellotext - * Plugin URI: https://hellotext.com + * Plugin URI: https://github.com/hellotext/hellotext-wordpress * Description: Integrates Hellotext tracking to WooCommerce. * Version: 1.1.2 - * Author: Hellotext Team - * Author URI: https://github.com/hellotext + * Author: Hellotext + * Author URI: https://www.hellotext.com * License: GPL v2 * License URI: http://www.gnu.org/licenses/gpl-2.0.txt + * Text Domain: hellotext + * Domain Path: /languages */ // TODO: Refactor this to use the APP_ENV variable @@ -81,3 +83,8 @@ function version_check() { } } add_action( 'admin_notices', 'version_check' ); + +function hellotext_load_textdomain() { + load_plugin_textdomain( 'hellotext', false, dirname( plugin_basename( __FILE__ ) ) . '/languages/' ); +} +add_action( 'plugins_loaded', 'hellotext_load_textdomain' ); diff --git a/languages/hellotext-en_US.mo b/languages/hellotext-en_US.mo new file mode 100644 index 0000000..364be78 Binary files /dev/null and b/languages/hellotext-en_US.mo differ diff --git a/languages/hellotext-en_US.po b/languages/hellotext-en_US.po new file mode 100644 index 0000000..538b0f0 --- /dev/null +++ b/languages/hellotext-en_US.po @@ -0,0 +1,75 @@ +# Copyright (C) 2025 Hellotext +# This file is distributed under the GPL v2. +msgid "" +msgstr "" +"Project-Id-Version: Hellotext 1.1.2\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hellotext-wordpress\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2025-01-10T14:15:22+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.11.0\n" +"X-Domain: hellotext\n" + +#. Plugin Name of the plugin +#. Author of the plugin +#: hellotext.php +msgid "Hellotext" +msgstr "" + +#. Plugin URI of the plugin +#: hellotext.php +msgid "https://www.hellotext.com" +msgstr "" + +#. Description of the plugin +#: hellotext.php +msgid "Integrates Hellotext tracking to WooCommerce." +msgstr "" + +#. Author URI of the plugin +#: hellotext.php +msgid "https://github.com/hellotext" +msgstr "" + +msgid "settings.title" +msgstr "Settings" + +msgid "settings.business_id" +msgstr "Business ID" + +msgid "settings.access_token" +msgstr "Access Token" + +msgid "settings.webchat_id" +msgstr "Webchat ID" + +msgid "webchat_unavailable" +msgstr "No active Webchat found." + +msgid "settings.webchat_placement" +msgstr "Webchat Placement" + +msgid "settings.webchat_placement_bottom-right" +msgstr "Bottom Right" + +msgid "settings.webchat_placement_bottom-left" +msgstr "Bottom Left" + +msgid "settings.webchat_placement_top-right" +msgstr "Top Right" + +msgid "settings.webchat_placement_top-left" +msgstr "Top Left" + +msgid "settings.webchat_behaviour" +msgstr "Webchat Behaviour" + +msgid "description.paragraphs.one" +msgstr "You can find your Business ID on the Hellotext business settings." + +msgid "description.paragraphs.two" +msgstr "You can create a new Access Token on the Hellotext business settings > Authorizations." diff --git a/languages/hellotext-es_ES.mo b/languages/hellotext-es_ES.mo new file mode 100644 index 0000000..fce43c9 Binary files /dev/null and b/languages/hellotext-es_ES.mo differ diff --git a/languages/hellotext-es_ES.po b/languages/hellotext-es_ES.po new file mode 100644 index 0000000..5053363 --- /dev/null +++ b/languages/hellotext-es_ES.po @@ -0,0 +1,75 @@ +# Copyright (C) 2025 Hellotext +# This file is distributed under the GPL v2. +msgid "" +msgstr "" +"Project-Id-Version: Hellotext 1.1.2\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hellotext-wordpress\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2025-01-10T14:15:22+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.11.0\n" +"X-Domain: hellotext\n" + +#. Plugin Name of the plugin +#. Author of the plugin +#: hellotext.php +msgid "Hellotext" +msgstr "" + +#. Plugin URI of the plugin +#: hellotext.php +msgid "https://www.hellotext.com" +msgstr "" + +#. Description of the plugin +#: hellotext.php +msgid "Integrates Hellotext tracking to WooCommerce." +msgstr "Integra el seguimiento de Hellotext en WooCommerce." + +#. Author URI of the plugin +#: hellotext.php +msgid "https://github.com/hellotext/hellotext-wordpress" +msgstr "" + +msgid "settings.title" +msgstr "Configuración" + +msgid "settings.business_id" +msgstr "ID del negiocio" + +msgid "settings.access_token" +msgstr "Token de acceso" + +msgid "settings.webchat_id" +msgstr "ID del Webchat" + +msgid "webchat_unavailable" +msgstr "No se encontró ningún Webchat activo." + +msgid "settings.webchat_placement" +msgstr "Ubicación del Webchat" + +msgid "settings.webchat_placement_bottom-right" +msgstr "Abajo a la derecha" + +msgid "settings.webchat_placement_bottom-left" +msgstr "Abajo a la izquierda" + +msgid "settings.webchat_placement_top-right" +msgstr "Arriba a la derecha" + +msgid "settings.webchat_placement_top-left" +msgstr "Arriba a la izquierda" + +msgid "settings.webchat_behaviour" +msgstr "Comportamiento del Webchat" + +msgid "description.paragraphs.one" +msgstr "Puedes encontrar tu ID de negocio en la configuración de negocios de Hellotext." + +msgid "description.paragraphs.two" +msgstr "Puedes crear un nuevo Token de Acceso en la configuración de negocios de Hellotext > Autorizaciones." diff --git a/languages/hellotext.pot b/languages/hellotext.pot new file mode 100644 index 0000000..8488279 --- /dev/null +++ b/languages/hellotext.pot @@ -0,0 +1,75 @@ +# Copyright (C) 2025 Hellotext +# This file is distributed under the GPL v2. +msgid "" +msgstr "" +"Project-Id-Version: Hellotext 1.1.2\n" +"Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/hellotext-wordpress\n" +"Last-Translator: FULL NAME \n" +"Language-Team: LANGUAGE \n" +"MIME-Version: 1.0\n" +"Content-Type: text/plain; charset=UTF-8\n" +"Content-Transfer-Encoding: 8bit\n" +"POT-Creation-Date: 2025-01-10T14:15:22+00:00\n" +"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" +"X-Generator: WP-CLI 2.11.0\n" +"X-Domain: hellotext\n" + +#. Plugin Name of the plugin +#. Author of the plugin +#: hellotext.php +msgid "Hellotext" +msgstr "" + +#. Plugin URI of the plugin +#: hellotext.php +msgid "https://www.hellotext.com" +msgstr "" + +#. Description of the plugin +#: hellotext.php +msgid "Integrates Hellotext tracking to WooCommerce." +msgstr "" + +#. Author URI of the plugin +#: hellotext.php +msgid "https://github.com/hellotext/hellotext-wordpress" +msgstr "" + +msgid "settings.title" +msgstr "" + +msgid "settings.business_id" +msgstr "" + +msgid "settings.access_token" +msgstr "" + +msgid "settings.webchat_id" +msgstr "" + +msgid "webchat_unavailable" +msgstr "" + +msgid "settings.webchat_placement" +msgstr "" + +msgid "settings.webchat_placement_bottom-right" +msgstr "" + +msgid "settings.webchat_placement_bottom-left" +msgstr "" + +msgid "settings.webchat_placement_top-right" +msgstr "" + +msgid "settings.webchat_placement_top-left" +msgstr "" + +msgid "settings.webchat_behaviour" +msgstr "" + +msgid "description.paragraphs.one" +msgstr "" + +msgid "description.paragraphs.two" +msgstr "" diff --git a/src/Api/Webchat.php b/src/Api/Webchat.php new file mode 100644 index 0000000..eeda2e8 --- /dev/null +++ b/src/Api/Webchat.php @@ -0,0 +1,18 @@ +get('/v1/wordpress/webchats'); + return is_array($body['body']) && isset($body['body']['ids']) ? $body['body']['ids'] : []; + } +} diff --git a/src/Misc/Scripts.php b/src/Misc/Scripts.php index 996fd6f..3bde4a8 100644 --- a/src/Misc/Scripts.php +++ b/src/Misc/Scripts.php @@ -6,10 +6,26 @@ function hellotext_script () { global $HELLOTEXT_API_URL; - ?> - - + config.webChat = { + id: '', + placement: '', + behaviour: '', + }; + + + Hellotext.initialize('', config); + + -

You can find your Business ID on the Hellotext business settings.

-

You can create a new Access Token on the Hellotext business settings > Authorizations.

- ' . wp_kses( __( 'description.paragraphs.one', 'hellotext' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'style' => array() ) ) ) . '

'; + } + + if ($access_token) { + echo '

' . wp_kses( __( 'description.paragraphs.two', 'hellotext' ), array( 'a' => array( 'href' => array(), 'target' => array(), 'style' => array() ) ) ) . '

'; + } } -function hellotext_business_id_field () { - ?> - - + + - - + + ' . __('webchat_unavailable', 'hellotext') . '

'; + return; + } + + ?> + + + + + +