diff --git a/composer.lock b/composer.lock
index a2ca54a3c..630535825 100644
--- a/composer.lock
+++ b/composer.lock
@@ -70,16 +70,16 @@
},
{
"name": "codeinwp/themeisle-sdk",
- "version": "3.3.20",
+ "version": "3.3.22",
"source": {
"type": "git",
"url": "https://github.com/Codeinwp/themeisle-sdk.git",
- "reference": "d1b92f3ab74f1b3f0afad7e23ddb1c058d66c03c"
+ "reference": "1754febc3c25c4c884424e72801c4d3f2ec7097e"
},
"dist": {
"type": "zip",
- "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/d1b92f3ab74f1b3f0afad7e23ddb1c058d66c03c",
- "reference": "d1b92f3ab74f1b3f0afad7e23ddb1c058d66c03c",
+ "url": "https://api.github.com/repos/Codeinwp/themeisle-sdk/zipball/1754febc3c25c4c884424e72801c4d3f2ec7097e",
+ "reference": "1754febc3c25c4c884424e72801c4d3f2ec7097e",
"shasum": ""
},
"require-dev": {
@@ -104,9 +104,9 @@
],
"support": {
"issues": "https://github.com/Codeinwp/themeisle-sdk/issues",
- "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.20"
+ "source": "https://github.com/Codeinwp/themeisle-sdk/tree/v3.3.22"
},
- "time": "2024-04-16T12:27:32+00:00"
+ "time": "2024-05-17T15:04:51+00:00"
},
{
"name": "composer/ca-bundle",
diff --git a/includes/admin/class-rop-admin.php b/includes/admin/class-rop-admin.php
index 31d0a4d68..e1ebbf29b 100644
--- a/includes/admin/class-rop-admin.php
+++ b/includes/admin/class-rop-admin.php
@@ -303,11 +303,11 @@ public function enqueue_scripts() {
wp_register_script( $this->plugin_name . '-dashboard', ROP_LITE_URL . 'assets/js/build/dashboard.js', array(), ( ROP_DEBUG ) ? time() : $this->version, false );
wp_register_script( $this->plugin_name . '-exclude', ROP_LITE_URL . 'assets/js/build/exclude.js', array(), ( ROP_DEBUG ) ? time() : $this->version, false );
- $array_nonce = array(
+ $rop_api_settings = array(
'root' => esc_url_raw( rest_url( '/tweet-old-post/v8/api/' ) ),
);
if ( current_user_can( 'manage_options' ) ) {
- $array_nonce = array(
+ $rop_api_settings = array(
'root' => esc_url_raw( rest_url( '/tweet-old-post/v8/api/' ) ),
'nonce' => wp_create_nonce( 'wp_rest' ),
);
@@ -336,32 +336,32 @@ public function enqueue_scripts() {
$global_settings = new Rop_Global_Settings();
$settings = new Rop_Settings_Model();
- $array_nonce['license_type'] = $global_settings->license_type();
- $array_nonce['fb_domain_toast_display'] = $this->facebook_exception_toast_display();
- $array_nonce['labels'] = Rop_I18n::get_labels();
- $array_nonce['upsell_link'] = Rop_I18n::UPSELL_LINK;
- $array_nonce['pro_installed'] = ( defined( 'ROP_PRO_VERSION' ) ) ? true : false;
- $array_nonce['staging'] = $this->rop_site_is_staging();
- $array_nonce['show_li_app_btn'] = $li_service->rop_show_li_app_btn();
- $array_nonce['show_tmblr_app_btn'] = $tmblr_service->rop_show_tmblr_app_btn();
- $array_nonce['rop_get_wpml_active_status'] = $this->rop_get_wpml_active_status();
- $array_nonce['rop_get_yoast_seo_active_status'] = $this->rop_get_yoast_seo_active_status();
- $array_nonce['rop_is_edit_post_screen'] = $this->rop_is_edit_post_screen();
- $array_nonce['rop_get_wpml_languages'] = $this->rop_get_wpml_languages();
- $array_nonce['hide_own_app_option'] = $this->rop_hide_add_own_app_option();
- $array_nonce['debug'] = ( ( ROP_DEBUG ) ? 'yes' : 'no' );
- $array_nonce['tax_apply_limit'] = $this->limit_tax_dropdown_list();
- $array_nonce['remote_cron_type_limit'] = $this->limit_remote_cron_system();
- $array_nonce['exclude_apply_limit'] = $this->limit_exclude_list();
- $array_nonce['publish_now'] = array(
+ $rop_api_settings['license_type'] = $global_settings->license_type();
+ $rop_api_settings['fb_domain_toast_display'] = $this->facebook_exception_toast_display();
+ $rop_api_settings['labels'] = Rop_I18n::get_labels();
+ $rop_api_settings['upsell_link'] = Rop_I18n::UPSELL_LINK;
+ $rop_api_settings['pro_installed'] = ( defined( 'ROP_PRO_VERSION' ) ) ? true : false;
+ $rop_api_settings['show_li_app_btn'] = $li_service->rop_show_li_app_btn();
+ $rop_api_settings['show_tmblr_app_btn'] = $tmblr_service->rop_show_tmblr_app_btn();
+ $rop_api_settings['staging'] = $this->rop_site_is_staging();
+ $rop_api_settings['rop_get_wpml_active_status'] = $this->rop_get_wpml_active_status();
+ $rop_api_settings['rop_get_yoast_seo_active_status'] = $this->rop_get_yoast_seo_active_status();
+ $rop_api_settings['rop_is_edit_post_screen'] = $this->rop_is_edit_post_screen();
+ $rop_api_settings['rop_get_wpml_languages'] = $this->rop_get_wpml_languages();
+ $rop_api_settings['hide_own_app_option'] = $this->rop_hide_add_own_app_option();
+ $rop_api_settings['debug'] = ( ( ROP_DEBUG ) ? 'yes' : 'no' );
+ $rop_api_settings['tax_apply_limit'] = $this->limit_tax_dropdown_list();
+ $rop_api_settings['remote_cron_type_limit'] = $this->limit_remote_cron_system();
+ $rop_api_settings['exclude_apply_limit'] = $this->limit_exclude_list();
+ $rop_api_settings['publish_now'] = array(
'instant_share_enabled' => $settings->get_instant_sharing(),
'instant_share_by_default' => $settings->get_instant_sharing_by_default(),
'choose_accounts_manually' => $settings->get_instant_share_choose_accounts_manually(),
'accounts' => $active_accounts,
);
- $array_nonce['added_networks'] = $added_networks;
- $array_nonce['rop_cron_remote'] = filter_var( get_option( 'rop_use_remote_cron', false ), FILTER_VALIDATE_BOOLEAN );
- $array_nonce['rop_cron_remote_agreement'] = filter_var( get_option( 'rop_remote_cron_terms_agree', false ), FILTER_VALIDATE_BOOLEAN );
+ $rop_api_settings['added_networks'] = $added_networks;
+ $rop_api_settings['rop_cron_remote'] = filter_var( get_option( 'rop_use_remote_cron', false ), FILTER_VALIDATE_BOOLEAN );
+ $rop_api_settings['rop_cron_remote_agreement'] = filter_var( get_option( 'rop_remote_cron_terms_agree', false ), FILTER_VALIDATE_BOOLEAN );
$admin_url = get_admin_url( get_current_blog_id(), 'admin.php?page=TweetOldPost' );
$token = get_option( ROP_INSTALL_TOKEN_OPTION );
@@ -383,11 +383,14 @@ public function enqueue_scripts() {
);
if ( 'publish_now' === $page ) {
- $array_nonce['publish_now'] = apply_filters( 'rop_publish_now_attributes', $array_nonce['publish_now'] );
+ $rop_api_settings['publish_now'] = apply_filters( 'rop_publish_now_attributes', $rop_api_settings['publish_now'] );
wp_register_script( $this->plugin_name . '-publish_now', ROP_LITE_URL . 'assets/js/build/publish_now.js', array(), ( ROP_DEBUG ) ? time() : $this->version, false );
}
- wp_localize_script( $this->plugin_name . '-' . $page, 'ropApiSettings', $array_nonce );
+ $rop_api_settings['tracking'] = 'yes' === get_option( 'tweet_old_post_logger_flag', 'no' );
+ $rop_api_settings['tracking_info_link'] = sanitize_url( 'https://docs.revive.social/article/2008-revive-old-posts-usage-tracking' );
+
+ wp_localize_script( $this->plugin_name . '-' . $page, 'ropApiSettings', $rop_api_settings );
wp_localize_script( $this->plugin_name . '-' . $page, 'ROP_ASSETS_URL', array( ROP_LITE_URL . 'assets/' ) );
wp_localize_script( $this->plugin_name . '-' . $page, 'ropAuthAppData', $rop_auth_app_data );
wp_enqueue_script( $this->plugin_name . '-' . $page );
diff --git a/includes/admin/class-rop-rest-api.php b/includes/admin/class-rop-rest-api.php
index 13a50e01c..517c56ada 100644
--- a/includes/admin/class-rop-rest-api.php
+++ b/includes/admin/class-rop-rest-api.php
@@ -1293,4 +1293,29 @@ private function add_account_vk( $data ) {
return $this->response->to_array();
}
+ /**
+ * API method called to toggle tracking.
+ *
+ * @SuppressWarnings(PHPMD.UnusedPrivateMethod) As it is called dynamically.
+ *
+ * @param array $data The data from request.
+ * @return array The response.
+ */
+ private function toggle_tracking( $data ) {
+ if ( ! isset( $data['tracking'] ) ) {
+ $this->response->set_code( '400' )
+ ->set_message( 'Tracking data not found' )
+ ->set_data( array() );
+
+ return $this->response->to_array();
+ }
+
+ $tracking = filter_var( $data['tracking'], FILTER_VALIDATE_BOOLEAN );
+ update_option( 'tweet_old_post_logger_flag', $tracking ? 'yes' : 'no' );
+
+ return $this->response->set_code( '200' )
+ ->set_message( 'OK' )
+ ->set_data( array( 'tracking' => $tracking ) )
+ ->to_array();
+ }
}
diff --git a/includes/class-rop-i18n.php b/includes/class-rop-i18n.php
index 3e5c108e9..b7bb19912 100644
--- a/includes/class-rop-i18n.php
+++ b/includes/class-rop-i18n.php
@@ -343,6 +343,8 @@ public static function get_labels( $key = '' ) {
'to' => __( 'to', 'tweet-old-post' ),
'by' => __( 'by', 'tweet-old-post' ),
'review_it' => __( 'Leave a review', 'tweet-old-post' ),
+ 'tracking' => __( 'Send anonymous data to help us understand how you use the plugin.', 'tweet-old-post' ),
+ 'tracking_info' => __( 'What do we track?', 'tweet-old-post' ), 'global_settings_header' => __( 'Global Settings', 'tweet-old-post' ),
'in' => __( 'in', 'tweet-old-post' ),
'start' => __( 'Start', 'tweet-old-post' ),
'stop' => __( 'Stop', 'tweet-old-post' ),
diff --git a/tweet-old-post.php b/tweet-old-post.php
index 3f1a12506..8ea8a4adf 100644
--- a/tweet-old-post.php
+++ b/tweet-old-post.php
@@ -226,6 +226,8 @@ function() {
}
);
+ add_filter( 'themeisle_sdk_enable_telemetry', '__return_true' );
+
$plugin = new Rop();
$plugin->run();
diff --git a/vue/src/models/rop_store.js b/vue/src/models/rop_store.js
index 52002e385..0e5e9d548 100644
--- a/vue/src/models/rop_store.js
+++ b/vue/src/models/rop_store.js
@@ -107,6 +107,7 @@ export default new Vuex.Store({
*/
rop_cron_remote: ropApiSettings.rop_cron_remote,
dom_updated: false,
+ tracking: Boolean( ropApiSettings.tracking ),
},
mutations: {
@@ -249,6 +250,7 @@ export default new Vuex.Store({
case 'toggle_account':
case 'exclude_post':
case 'exclude_post_batch':
+ case 'toggle_tracking':
break
default:
diff --git a/vue/src/vue-elements/accounts-selector-panel.vue b/vue/src/vue-elements/accounts-selector-panel.vue
index 6d31db929..1b235fc3b 100644
--- a/vue/src/vue-elements/accounts-selector-panel.vue
+++ b/vue/src/vue-elements/accounts-selector-panel.vue
@@ -251,20 +251,57 @@
return;
}
this.is_loading = true;
+ const savedSettings = {
+ service: this.active_accounts[this.selected_account].service,
+ account_id: this.selected_account,
+ data: this.active_data[this.selected_account]
+ };
+
this.$store.dispatch('fetchAJAXPromise', {
req: 'save_' + this.action,
- data: {
- service: this.active_accounts[this.selected_account].service,
- account_id: this.selected_account,
- data: this.active_data[this.selected_account]
- }
- }).then(response => {
+ data: savedSettings
+ }).then(() => {
this.is_loading = false;
+
+ const trackingPayload = {
+ service: savedSettings.service,
+ };
+
+ const ignoredKeys = ['shortener_credentials'];
+
+ for( const [key, value] of Object.entries(savedSettings.data) ){
+ if ( value === undefined || value === null || value === '' ) {
+ continue;
+ }
+
+ if ( ignoredKeys.includes(key) ) {
+ continue;
+ }
+
+ if ( 'interval_f' === key && 'fixed' === savedSettings.data?.type ) {
+ trackingPayload['interval_f_time'] = value?.time?.join(',');
+ trackingPayload['interval_f_weekdays'] = value?.week_days?.join(',');
+ }
+
+ if( Array.isArray(value) || typeof value === 'object' ){
+ continue;
+ }
+ trackingPayload[key] = value;
+ }
+
+ window?.tiTrk?.with('tweet')?.add({
+ feature: 'post-format',
+ featureComponent: 'saved-settings',
+ featureData: trackingPayload,
+ groupId: this.selected_account,
+ });
+
+ window?.tiTrk?.uploadEvents();
}, error => {
this.is_loading = false;
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
- })
+ });
},
getIcon(account) {
diff --git a/vue/src/vue-elements/main-page-panel.vue b/vue/src/vue-elements/main-page-panel.vue
index 448549e77..e9834980f 100644
--- a/vue/src/vue-elements/main-page-panel.vue
+++ b/vue/src/vue-elements/main-page-panel.vue
@@ -185,6 +185,29 @@
target="_blank"
class="btn rop-sidebar-action-btns"
>{{ labels.review_it }}
+
+
{{ labels.global_settings_header }}
+
+
@@ -226,7 +249,9 @@
staging: ropApiSettings.staging,
is_loading: false,
is_loading_logs: false,
- status_is_error_display: false
+ status_is_error_display: false,
+ tracking: this.$store.state.tracking,
+ tracking_info_link: ropApiSettings.tracking_info_link
}
},
computed: {
@@ -453,6 +478,23 @@
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
this.is_loading_logs = false;
})
+ },
+
+ /**
+ * Toggle tracking from SDK (via tiTrk).
+ */
+ toggle_tracking() {
+ this.$log.info('Toggling tracking');
+ this.$store.dispatch('fetchAJAXPromise', {
+ req: 'toggle_tracking',
+ data: { tracking: Boolean( this.tracking) }
+ }).then(response => {
+ // Update tracking state.
+ this.$store.commit('updateState', {stateData: {tracking: Boolean( response?.tracking)}, requestName: 'toggle_tracking'});
+ this.$log.info('Succesfully toggled tracking.');
+ }, error => {
+ Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
+ })
}
}
}
@@ -477,4 +519,14 @@
#rop_core .badge.badge-logs {
padding-right: 10px;
}
+
+ .rop-tracking-box {
+ display: flex;
+ flex-direction: column;
+ gap: 8px;
+
+ padding: 0.25rem 0.4rem;
+ border: 0.05rem solid #042440;
+ border-radius: 0.1rem;
+ }
diff --git a/vue/src/vue-elements/settings-tab-panel.vue b/vue/src/vue-elements/settings-tab-panel.vue
index 8b45d4b68..6c28bb460 100644
--- a/vue/src/vue-elements/settings-tab-panel.vue
+++ b/vue/src/vue-elements/settings-tab-panel.vue
@@ -792,33 +792,72 @@
let postsSelected = this.generalSettings.selected_posts
this.is_loading = true;
this.$log.info('Sending request for saving general settings..');
+
+ const savedSettings = {
+ available_taxonomies: this.generalSettings.available_taxonomies,
+ default_interval: this.generalSettings.default_interval,
+ minimum_post_age: this.generalSettings.minimum_post_age,
+ maximum_post_age: this.generalSettings.maximum_post_age,
+ number_of_posts: this.generalSettings.number_of_posts,
+ more_than_once: this.generalSettings.more_than_once,
+ selected_post_types: postTypesSelected,
+ selected_taxonomies: taxonomiesSelected,
+ exclude_taxonomies: excludeTaxonomies,
+ update_post_published_date: this.generalSettings.update_post_published_date,
+ ga_tracking: this.generalSettings.ga_tracking,
+ custom_messages: this.generalSettings.custom_messages,
+ custom_messages_share_order: this.generalSettings.custom_messages_share_order,
+ instant_share: this.generalSettings.instant_share,
+ true_instant_share: this.generalSettings.true_instant_share,
+ instant_share_default: this.generalSettings.instant_share_default,
+ instant_share_future_scheduled: this.generalSettings.instant_share_future_scheduled,
+ instant_share_choose_accounts_manually: this.generalSettings.instant_share_choose_accounts_manually,
+ housekeeping: this.generalSettings.housekeeping,
+ };
+
this.$store.dispatch('fetchAJAXPromise', {
req: 'save_general_settings',
updateState: false,
- data: {
- available_taxonomies: this.generalSettings.available_taxonomies,
- default_interval: this.generalSettings.default_interval,
- minimum_post_age: this.generalSettings.minimum_post_age,
- maximum_post_age: this.generalSettings.maximum_post_age,
- number_of_posts: this.generalSettings.number_of_posts,
- more_than_once: this.generalSettings.more_than_once,
- selected_post_types: postTypesSelected,
- selected_taxonomies: taxonomiesSelected,
- exclude_taxonomies: excludeTaxonomies,
- update_post_published_date: this.generalSettings.update_post_published_date,
- ga_tracking: this.generalSettings.ga_tracking,
- custom_messages: this.generalSettings.custom_messages,
- custom_messages_share_order: this.generalSettings.custom_messages_share_order,
- instant_share: this.generalSettings.instant_share,
- true_instant_share: this.generalSettings.true_instant_share,
- instant_share_default: this.generalSettings.instant_share_default,
- instant_share_future_scheduled: this.generalSettings.instant_share_future_scheduled,
- instant_share_choose_accounts_manually: this.generalSettings.instant_share_choose_accounts_manually,
- housekeeping: this.generalSettings.housekeeping,
- }
+ data: savedSettings
}).then(response => {
this.is_loading = false;
this.$log.info('Successfully saved general settings.');
+
+ const ignoredKeys = [
+ 'available_post_types',
+ 'available_taxonomies',
+ 'selected_posts',
+ 'exclude_taxonomies',
+ 'selected_taxonomies',
+ ];
+
+ const trackingPayload = Object.entries(savedSettings)
+ .map(([key, value]) => {
+ if( 'selected_post_types' === key ) {
+ value = value.map( postType => postType.value ).join( ',' );
+ }
+
+ return [key, value];
+ })
+ .filter(
+ ([key, value]) => (
+ !ignoredKeys.includes(key) &&
+ ! ( value === undefined || value === null || value === '' ) &&
+ ! Array.isArray(value) &&
+ typeof value !== 'object'
+ ) )
+ .reduce((acc, [key, value]) => {
+ acc[key] = value;
+ return acc;
+ }, {});
+
+ window?.tiTrk?.with('tweet').add({
+ feature: 'general-settings',
+ featureComponent: 'saved-settings',
+ featureData: trackingPayload,
+ });
+
+ window?.tiTrk?.uploadEvents();
}, error => {
this.$log.error('Successfully saved general settings.');
diff --git a/vue/src/vue-elements/sign-in-btn.vue b/vue/src/vue-elements/sign-in-btn.vue
index 54f3fe385..b4675c1c1 100644
--- a/vue/src/vue-elements/sign-in-btn.vue
+++ b/vue/src/vue-elements/sign-in-btn.vue
@@ -570,12 +570,7 @@ export default {
updateState: false,
data: data
}).then(response => {
- try {
- window.removeEventListener("message", event => this.getChildWindowMessage(event));
- this.authPopupWindow.close();
- } finally {
- window.location.reload();
- }
+ window.removeEventListener("message", event => this.getChildWindowMessage(event));
}, error => {
this.is_loading = false;
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
@@ -591,15 +586,8 @@ export default {
req: 'add_account_tw',
updateState: false,
data: data
- }).then(response => {
- try {
- window.removeEventListener("message", event => this.getChildWindowMessage(event));
- this.authPopupWindow.close(); // Sometimes this throws an error because of cross-origin frame.
- } catch(e) {
- // nothing to do
- } finally {
- window.location.reload();
- }
+ }).then(() => {
+ window.removeEventListener("message", this.getChildWindowMessage );
}, error => {
this.is_loading = false;
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
@@ -615,15 +603,8 @@ export default {
req: 'add_account_li',
updateState: false,
data: data
- }).then(response => {
- try {
- window.removeEventListener("message", event => this.getChildWindowMessage(event));
- this.authPopupWindow.close();
- } catch(e) {
- // nothing to do
- } finally {
- window.location.reload();
- }
+ }).then(() => {
+ window.removeEventListener("message", this.getChildWindowMessage );
}, error => {
this.is_loading = false;
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
@@ -639,15 +620,8 @@ export default {
req: 'add_account_tumblr',
updateState: false,
data: data
- }).then(response => {
- try {
- window.removeEventListener("message", event => this.getChildWindowMessage(event));
- this.authPopupWindow.close();
- } catch(e) {
- // nothing to do
- } finally {
- window.location.reload();
- }
+ }).then(() => {
+ window.removeEventListener("message", this.getChildWindowMessage );
}, error => {
this.is_loading = false;
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
@@ -663,15 +637,8 @@ export default {
req: 'add_account_gmb',
updateState: false,
data: data
- }).then(response => {
- try {
- window.removeEventListener("message", event => this.getChildWindowMessage(event));
- this.authPopupWindow.close();
- } catch(e) {
- // nothing to do
- } finally {
- window.location.reload();
- }
+ }).then(() => {
+ window.removeEventListener("message", this.getChildWindowMessage );
}, error => {
this.is_loading = false;
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
@@ -687,41 +654,51 @@ export default {
req: 'add_account_vk',
updateState: false,
data: data
- }).then(response => {
- try {
- window.removeEventListener("message", event => this.getChildWindowMessage(event));
- this.authPopupWindow.close();
- } catch(e) {
- // nothing to do
- } finally {
- window.location.reload();
- }
+ }).then(() => {
+ window.removeEventListener("message", this.getChildWindowMessage );
}, error => {
this.is_loading = false;
Vue.$log.error('Got nothing from server. Prompt user to check internet connection and try again', error)
});
},
- getChildWindowMessage: function (event) {
-
- if (~event.origin.indexOf(this.appOrigin)) {
-
- if ('Twitter' === this.modal.serviceName) {
- this.addAccountTW(JSON.parse(event.data));
- } else if ('Facebook' === this.modal.serviceName) {
- this.addAccountFB(JSON.parse(event.data));
- } else if ('LinkedIn' === this.modal.serviceName) {
- this.addAccountLI(JSON.parse(event.data));
- } else if ('Tumblr' === this.modal.serviceName) {
- this.addAccountTumblr(JSON.parse(event.data));
- } else if ('Gmb' === this.modal.serviceName) {
- this.addAccountGmb(JSON.parse(event.data));
- } else if ('Vk' === this.modal.serviceName) {
- this.addAccountVk(JSON.parse(event.data));
- }
+ /**
+ * Get message from child window.
+ * @param {MessageEvent} event Event.
+ */
+ getChildWindowMessage: async function (event) {
- } else {
+ if ( ! event.origin.includes( this.appOrigin ) ) {
return;
}
+
+ const accountData = JSON.parse(event.data);
+
+ if ('Twitter' === this.modal.serviceName) {
+ this.addAccountTW( accountData );
+ } else if ('Facebook' === this.modal.serviceName) {
+ this.addAccountFB( accountData );
+ } else if ('LinkedIn' === this.modal.serviceName) {
+ this.addAccountLI( accountData );
+ } else if ('Tumblr' === this.modal.serviceName) {
+ this.addAccountTumblr( accountData );
+ } else if ('Gmb' === this.modal.serviceName) {
+ this.addAccountGmb( accountData );
+ } else if ('Vk' === this.modal.serviceName) {
+ this.addAccountVk( accountData );
+ }
+
+ try {
+ window?.tiTrk?.with('tweet')?.add({
+ feature: 'add-account',
+ featureComponent: 'sign-in-btn',
+ featureValue: this.modal.serviceName?.toLowerCase(),
+ });
+ await window?.tiTrk?.uploadEvents();
+ } catch (e) {
+ console.warn( e );
+ }
+
+ window.location.reload();
},
openPopupFB: function () {
let loginUrl = this.appOrigin + this.appPathFB + '?callback_url=' + this.siteAdminUrl + '&token=' + this.appUniqueId + '&signature=' + this.appSignature + '&data=' + this.appAdminEmail;
@@ -733,7 +710,7 @@ export default {
this.authPopupWindow = window.open(loginUrl, 'authFB', this.windowParameters);
this.cancelModal();
}
- window.addEventListener("message", event => this.getChildWindowMessage(event));
+ window.addEventListener("message", this.getChildWindowMessage );
},
openPopupTW: function () { // Open the popup specific for Twitter
let loginUrl = this.appOrigin + this.appPathTW + '?callback_url=' + this.siteAdminUrl + '&token=' + this.appUniqueId + '&signature=' + this.appSignature + '&data=' + this.appAdminEmail + '&plugin_version=' + this.pluginVersion;
@@ -746,7 +723,7 @@ export default {
this.authPopupWindow = window.open(loginUrl, 'authTW', this.windowParameters);
this.cancelModal();
}
- window.addEventListener("message", event => this.getChildWindowMessage(event));
+ window.addEventListener("message", this.getChildWindowMessage );
},
openPopupLI: function () { // Open the popup specific for LinkedIn
let loginUrl = this.appOrigin + this.appPathLI + '?callback_url=' + this.siteAdminUrl + '&token=' + this.appUniqueId + '&signature=' + this.appSignature + '&data=' + this.appAdminEmail;
@@ -758,7 +735,7 @@ export default {
this.authPopupWindow = window.open(loginUrl, 'authLI', this.windowParameters);
this.cancelModal();
}
- window.addEventListener("message", event => this.getChildWindowMessage(event));
+ window.addEventListener("message", this.getChildWindowMessage );
},
openPopupTumblr: function () { // Open the popup specific for Tumblr
let loginUrl = this.appOrigin + this.appPathTumblr + '?callback_url=' + this.siteAdminUrl + '&token=' + this.appUniqueId + '&signature=' + this.appSignature + '&data=' + this.appAdminEmail;
@@ -770,7 +747,7 @@ export default {
this.authPopupWindow = window.open(loginUrl, 'authTmblr', this.windowParameters);
this.cancelModal();
}
- window.addEventListener("message", event => this.getChildWindowMessage(event));
+ window.addEventListener("message", this.getChildWindowMessage );
},
openPopupGmb: function () { // Open the popup specific for Google My Business
let loginUrl = this.appOrigin + this.appPathGmb + '?callback_url=' + this.siteAdminUrl + '&token=' + this.appUniqueId + '&signature=' + this.appSignature + '&data=' + this.appAdminEmail;
@@ -782,7 +759,7 @@ export default {
this.authPopupWindow = window.open(loginUrl, 'authGmb', this.windowParameters);
this.cancelModal();
}
- window.addEventListener("message", event => this.getChildWindowMessage(event));
+ window.addEventListener("message", this.getChildWindowMessage );
},
openPopupVk: function () { // Open the popup specific for VK
let loginUrl = this.appOrigin + this.appPathVk + '?callback_url=' + this.siteAdminUrl + '&token=' + this.appUniqueId + '&signature=' + this.appSignature + '&data=' + this.appAdminEmail;
@@ -794,7 +771,7 @@ export default {
this.authPopupWindow = window.open(loginUrl, 'authVk', this.windowParameters);
this.cancelModal();
}
- window.addEventListener("message", event => this.getChildWindowMessage(event));
+ window.addEventListener("message", this.getChildWindowMessage );
},
}
}