[IMP] tour_genius: automatic update
Auto-generated commit based on local changes.
This commit is contained in:
parent
c99b324c9b
commit
40ab27d1b7
|
|
@ -120,7 +120,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
var tourId = $(ev.currentTarget).data('tour-id');
|
var tourId = $(ev.currentTarget).data('tour-id');
|
||||||
var tourName = 'genius_tour_' + tourId;
|
var tourName = 'genius_tour_' + tourId;
|
||||||
|
|
||||||
console.log('[Tour Genius] Running tour:', tourName);
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// PHASE 1: Complete cleanup of ALL tour state
|
// PHASE 1: Complete cleanup of ALL tour state
|
||||||
|
|
@ -140,7 +139,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('[Tour Genius] Error cleaning tooltip:', e);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
tour.active_tooltips = {};
|
tour.active_tooltips = {};
|
||||||
|
|
@ -183,7 +181,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[Tour Genius] Cleanup complete, removed', keysToRemove.length, 'localStorage items');
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// PHASE 2: Activate the requested tour with forced reload
|
// PHASE 2: Activate the requested tour with forced reload
|
||||||
|
|
@ -230,7 +227,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
activateTour();
|
activateTour();
|
||||||
} else {
|
} else {
|
||||||
// Tour not found - try reloading tour definitions
|
// Tour not found - try reloading tour definitions
|
||||||
console.log('[Tour Genius] Tour not found, reloading definitions...');
|
|
||||||
|
|
||||||
var tourLoader = require('tour_genius.tour_loader');
|
var tourLoader = require('tour_genius.tour_loader');
|
||||||
if (tourLoader && tourLoader.registerAllTours) {
|
if (tourLoader && tourLoader.registerAllTours) {
|
||||||
|
|
@ -393,7 +389,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
// Find tour data
|
// Find tour data
|
||||||
var tour = this.tours.find(function(t) { return t.id === tourId; });
|
var tour = this.tours.find(function(t) { return t.id === tourId; });
|
||||||
if (!tour || !tour.quiz_id) {
|
if (!tour || !tour.quiz_id) {
|
||||||
console.warn('[Tour Genius] No quiz found for tour:', tourId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -409,7 +404,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
});
|
});
|
||||||
|
|
||||||
popup.appendTo(document.body).then(function() {
|
popup.appendTo(document.body).then(function() {
|
||||||
console.log('[Tour Genius] Quiz popup opened for tour:', tour.name);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -426,7 +420,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
// Find tour data
|
// Find tour data
|
||||||
var tour = this.tours.find(function(t) { return t.id === tourId; });
|
var tour = this.tours.find(function(t) { return t.id === tourId; });
|
||||||
if (!tour || !tour.quiz_id) {
|
if (!tour || !tour.quiz_id) {
|
||||||
console.warn('[Tour Genius] No quiz found for tour:', tourId);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -442,7 +435,6 @@ odoo.define('tour_genius.Dashboard', function (require) {
|
||||||
});
|
});
|
||||||
|
|
||||||
popup.appendTo(document.body).then(function() {
|
popup.appendTo(document.body).then(function() {
|
||||||
console.log('[Tour Genius] Certificate view opened for tour:', tour.name);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -141,7 +141,6 @@ odoo.define('tour_genius.GeniusCelebration', function (require) {
|
||||||
// Open PDF in new tab
|
// Open PDF in new tab
|
||||||
window.open('/tour_genius/certificate/view/' + data.attempt_id, '_blank');
|
window.open('/tour_genius/certificate/view/' + data.attempt_id, '_blank');
|
||||||
} else {
|
} else {
|
||||||
console.warn('[GeniusCelebration] No certificate found');
|
|
||||||
}
|
}
|
||||||
// Close the celebration
|
// Close the celebration
|
||||||
self.destroy();
|
self.destroy();
|
||||||
|
|
|
||||||
|
|
@ -81,18 +81,13 @@ odoo.define('tour_genius.GeniusQuizPopup', function (require) {
|
||||||
|
|
||||||
start: function () {
|
start: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
console.log('[GeniusQuizPopup] Start called. Template:', this.template);
|
|
||||||
console.log('[GeniusQuizPopup] $el:', this.$el);
|
|
||||||
|
|
||||||
return this._super.apply(this, arguments).then(function () {
|
return this._super.apply(this, arguments).then(function () {
|
||||||
console.log('🚀 ANTIGRAVITY: GeniusQuizPopup Loaded v2 - Ghost Code Exorcised');
|
|
||||||
if (self.showCertificate) {
|
if (self.showCertificate) {
|
||||||
// console.log('[GeniusQuizPopup] Showing certificate');
|
|
||||||
// self._renderCertificate(); // REMOVED: Ghost code causing legacy UI
|
// self._renderCertificate(); // REMOVED: Ghost code causing legacy UI
|
||||||
// Fallback to results if certificate requested but method missing
|
// Fallback to results if certificate requested but method missing
|
||||||
self._renderResults();
|
self._renderResults();
|
||||||
} else {
|
} else {
|
||||||
console.log('[GeniusQuizPopup] Rendering Question');
|
|
||||||
self._renderQuestion();
|
self._renderQuestion();
|
||||||
self._startTimer();
|
self._startTimer();
|
||||||
}
|
}
|
||||||
|
|
@ -835,7 +830,6 @@ odoo.define('tour_genius.GeniusQuizPopup', function (require) {
|
||||||
var quizId = recordData.id;
|
var quizId = recordData.id;
|
||||||
var quizName = recordData.name;
|
var quizName = recordData.name;
|
||||||
|
|
||||||
console.log('[GeniusButton] Starting Test Mode for Quiz:', quizId);
|
|
||||||
|
|
||||||
// Instantiate Popup directly
|
// Instantiate Popup directly
|
||||||
var popup = new GeniusQuizPopup(self, {
|
var popup = new GeniusQuizPopup(self, {
|
||||||
|
|
@ -845,7 +839,6 @@ odoo.define('tour_genius.GeniusQuizPopup', function (require) {
|
||||||
});
|
});
|
||||||
|
|
||||||
popup.appendTo(document.body).then(function() {
|
popup.appendTo(document.body).then(function() {
|
||||||
console.log('[GeniusButton] Popup opened successfully');
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -330,7 +330,6 @@ var GeniusTip = Tip.extend({
|
||||||
}
|
}
|
||||||
|
|
||||||
// Hand remains visible - point stored for cleanup by next step
|
// Hand remains visible - point stored for cleanup by next step
|
||||||
console.log('[GeniusTip] UI hidden, hand remains. Waiting for user action on target.');
|
|
||||||
},
|
},
|
||||||
|
|
||||||
_onSkipTour: function (ev) {
|
_onSkipTour: function (ev) {
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
this.dragOffsetX = 0;
|
this.dragOffsetX = 0;
|
||||||
this.dragOffsetY = 0;
|
this.dragOffsetY = 0;
|
||||||
|
|
||||||
console.log('[Recorder] Init - isNewTour:', this.isNewTour, 'topicId:', this.topicId);
|
|
||||||
},
|
},
|
||||||
|
|
||||||
start: function () {
|
start: function () {
|
||||||
|
|
@ -72,7 +71,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
self._loadModulesDropdown();
|
self._loadModulesDropdown();
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[Recorder] Started - isNewTour:', self.isNewTour);
|
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
@ -115,10 +113,8 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
var selectedText = $(this).val();
|
var selectedText = $(this).val();
|
||||||
var moduleId = self._moduleMap[selectedText] || '';
|
var moduleId = self._moduleMap[selectedText] || '';
|
||||||
$hiddenSelect.val(moduleId);
|
$hiddenSelect.val(moduleId);
|
||||||
console.log('[Recorder] Module input:', selectedText, '-> ID:', moduleId);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('[Recorder] Loaded', modules.length, 'modules for search');
|
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
console.error('[Recorder] Module load error:', err);
|
console.error('[Recorder] Module load error:', err);
|
||||||
});
|
});
|
||||||
|
|
@ -190,7 +186,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
},
|
},
|
||||||
|
|
||||||
_startTracking: function () {
|
_startTracking: function () {
|
||||||
console.log('[Recorder] Start Tracking');
|
|
||||||
this.isTracking = true;
|
this.isTracking = true;
|
||||||
this.$('.btn-track-on').addClass('active').html('<i class="fa fa-stop"></i> Stop Tracking');
|
this.$('.btn-track-on').addClass('active').html('<i class="fa fa-stop"></i> Stop Tracking');
|
||||||
|
|
||||||
|
|
@ -213,7 +208,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
},
|
},
|
||||||
|
|
||||||
_stopTracking: function () {
|
_stopTracking: function () {
|
||||||
console.log('[Recorder] Stop Tracking');
|
|
||||||
this.isTracking = false;
|
this.isTracking = false;
|
||||||
this.$('.btn-track-on').removeClass('active').html('<i class="fa fa-crosshairs"></i> Track On');
|
this.$('.btn-track-on').removeClass('active').html('<i class="fa fa-crosshairs"></i> Track On');
|
||||||
|
|
||||||
|
|
@ -265,7 +259,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[Recorder] Element Clicked:', target);
|
|
||||||
|
|
||||||
// Stop event!
|
// Stop event!
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
|
|
@ -273,7 +266,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
|
|
||||||
// Generate CSS selector
|
// Generate CSS selector
|
||||||
var selector = this._generateCSSSelector(target);
|
var selector = this._generateCSSSelector(target);
|
||||||
console.log('[Recorder] Generated Selector:', selector);
|
|
||||||
|
|
||||||
// Update current step
|
// Update current step
|
||||||
this.currentStep.css_selector = selector;
|
this.currentStep.css_selector = selector;
|
||||||
|
|
@ -545,7 +537,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
|
|
||||||
_onSaveStep: function () {
|
_onSaveStep: function () {
|
||||||
var self = this;
|
var self = this;
|
||||||
console.log('[Recorder] Save Step Clicked');
|
|
||||||
|
|
||||||
// Validate via UI values, NOT stored values (to allow manual edits)
|
// Validate via UI values, NOT stored values (to allow manual edits)
|
||||||
var selector = this.$('.css-selector-input').val() || '';
|
var selector = this.$('.css-selector-input').val() || '';
|
||||||
|
|
@ -581,8 +572,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
var moduleId = this.$('.tour-module-select').val();
|
var moduleId = this.$('.tour-module-select').val();
|
||||||
|
|
||||||
// DEBUG: Log module selection details
|
// DEBUG: Log module selection details
|
||||||
console.log('[Recorder] Tour Name:', tourName);
|
|
||||||
console.log('[Recorder] Module ID retrieved:', moduleId);
|
|
||||||
|
|
||||||
// Validate Tour Name
|
// Validate Tour Name
|
||||||
if (!tourName || tourName.trim() === '') {
|
if (!tourName || tourName.trim() === '') {
|
||||||
|
|
@ -600,12 +589,9 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
// Only add module_id if it's a valid number
|
// Only add module_id if it's a valid number
|
||||||
if (moduleId && moduleId !== '' && !isNaN(parseInt(moduleId))) {
|
if (moduleId && moduleId !== '' && !isNaN(parseInt(moduleId))) {
|
||||||
tourVals.module_id = parseInt(moduleId);
|
tourVals.module_id = parseInt(moduleId);
|
||||||
console.log('[Recorder] Module ID added to vals:', tourVals.module_id);
|
|
||||||
} else {
|
} else {
|
||||||
console.log('[Recorder] No valid module_id to add');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[Recorder] Creating Tour with vals:', JSON.stringify(tourVals));
|
|
||||||
|
|
||||||
createTourPromise = ajax.jsonRpc('/web/dataset/call_kw/genius.topic/create', 'call', {
|
createTourPromise = ajax.jsonRpc('/web/dataset/call_kw/genius.topic/create', 'call', {
|
||||||
model: 'genius.topic',
|
model: 'genius.topic',
|
||||||
|
|
@ -613,7 +599,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
args: [tourVals],
|
args: [tourVals],
|
||||||
kwargs: { context: session.user_context }
|
kwargs: { context: session.user_context }
|
||||||
}).then(function (newTopicId) {
|
}).then(function (newTopicId) {
|
||||||
console.log('[Recorder] Tour Created:', newTopicId);
|
|
||||||
self.topicId = newTopicId;
|
self.topicId = newTopicId;
|
||||||
self.topicName = tourName.trim();
|
self.topicName = tourName.trim();
|
||||||
self.isNewTour = false; // No longer new
|
self.isNewTour = false; // No longer new
|
||||||
|
|
@ -644,7 +629,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
sequence: (self.steps.length + 1) * 10,
|
sequence: (self.steps.length + 1) * 10,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.log('[Recorder] Saving Step:', stepData);
|
|
||||||
|
|
||||||
return ajax.jsonRpc('/web/dataset/call_kw/genius.topic.step/create', 'call', {
|
return ajax.jsonRpc('/web/dataset/call_kw/genius.topic.step/create', 'call', {
|
||||||
model: 'genius.topic.step',
|
model: 'genius.topic.step',
|
||||||
|
|
@ -652,7 +636,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
args: [stepData],
|
args: [stepData],
|
||||||
kwargs: { context: session.user_context }
|
kwargs: { context: session.user_context }
|
||||||
}).then(function (stepId) {
|
}).then(function (stepId) {
|
||||||
console.log('[Recorder] Step Saved ID:', stepId);
|
|
||||||
|
|
||||||
// Update local steps array
|
// Update local steps array
|
||||||
stepData.id = stepId;
|
stepData.id = stepId;
|
||||||
|
|
@ -691,7 +674,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[Recorder] Captured starting_url:', relativeUrl);
|
|
||||||
|
|
||||||
var modelName = '';
|
var modelName = '';
|
||||||
|
|
||||||
|
|
@ -730,7 +712,6 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e) { console.warn('[Recorder] Context detection failed', e); }
|
|
||||||
|
|
||||||
var updateVals = { 'starting_url': relativeUrl };
|
var updateVals = { 'starting_url': relativeUrl };
|
||||||
if (modelName) {
|
if (modelName) {
|
||||||
|
|
@ -745,8 +726,8 @@ odoo.define('tour_genius.RecorderPanel', function (require) {
|
||||||
args: [[parseInt(self.topicId)], updateVals],
|
args: [[parseInt(self.topicId)], updateVals],
|
||||||
kwargs: { context: session.user_context }
|
kwargs: { context: session.user_context }
|
||||||
}).then(function() {
|
}).then(function() {
|
||||||
console.log('[Recorder] Topic updated with starting_url:', relativeUrl);
|
|
||||||
});
|
});
|
||||||
|
} catch(e) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
self._updateStepCounter();
|
self._updateStepCounter();
|
||||||
|
|
|
||||||
|
|
@ -83,7 +83,6 @@ odoo.define('tour_genius.smart_systray', function (require) {
|
||||||
self.badge_count = result.new_count || 0;
|
self.badge_count = result.new_count || 0;
|
||||||
self._updateBadge();
|
self._updateBadge();
|
||||||
}).catch(function (err) {
|
}).catch(function (err) {
|
||||||
// console.warn('[Tour Genius] Failed to fetch contextual training', err);
|
|
||||||
self.tours = [];
|
self.tours = [];
|
||||||
self.badge_count = 0;
|
self.badge_count = 0;
|
||||||
self._updateBadge();
|
self._updateBadge();
|
||||||
|
|
|
||||||
|
|
@ -22,7 +22,6 @@ odoo.define('tour_genius.client_action', function (require) {
|
||||||
return Promise.reject('No tour_name provided');
|
return Promise.reject('No tour_name provided');
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('[Tour Genius] Running tour via client action:', tourName);
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// COMPREHENSIVE CLEANUP
|
// COMPREHENSIVE CLEANUP
|
||||||
|
|
@ -85,7 +84,6 @@ odoo.define('tour_genius.client_action', function (require) {
|
||||||
|
|
||||||
if (testMode && tourData && tourData.steps) {
|
if (testMode && tourData && tourData.steps) {
|
||||||
// Dynamic registration for test mode (draft tours)
|
// Dynamic registration for test mode (draft tours)
|
||||||
console.log('[Tour Genius] Test Mode: Storing tour data for post-redirect registration:', tourName);
|
|
||||||
|
|
||||||
// Store tour data in localStorage for post-redirect registration
|
// Store tour data in localStorage for post-redirect registration
|
||||||
// This is needed because draft tours aren't in get_tours_for_registration()
|
// This is needed because draft tours aren't in get_tours_for_registration()
|
||||||
|
|
@ -102,7 +100,6 @@ odoo.define('tour_genius.client_action', function (require) {
|
||||||
wait_for: Promise.resolve(),
|
wait_for: Promise.resolve(),
|
||||||
}, tourData.steps);
|
}, tourData.steps);
|
||||||
|
|
||||||
console.log('[Tour Genius] Tour registered dynamically:', tourName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var targetTour = tour.tours && tour.tours[tourName];
|
var targetTour = tour.tours && tour.tours[tourName];
|
||||||
|
|
@ -130,7 +127,6 @@ odoo.define('tour_genius.client_action', function (require) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
} else {
|
} else {
|
||||||
console.error('[Tour Genius] Tour not found or has no steps:', tourName);
|
console.error('[Tour Genius] Tour not found or has no steps:', tourName);
|
||||||
console.log('[Tour Genius] Available tours:', Object.keys(tour.tours || {}));
|
|
||||||
return Promise.reject('Tour not found: ' + tourName);
|
return Promise.reject('Tour not found: ' + tourName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -33,7 +33,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
var geniusToursData = {};
|
var geniusToursData = {};
|
||||||
|
|
||||||
function registerAllTours() {
|
function registerAllTours() {
|
||||||
console.log('[Tour Genius] Starting tour registration...');
|
|
||||||
|
|
||||||
// GENIUS FIX: Pre-emptive check for pending genius tours to prevent overlap
|
// GENIUS FIX: Pre-emptive check for pending genius tours to prevent overlap
|
||||||
// This prevents standard tours from flashing while we fetch our tours
|
// This prevents standard tours from flashing while we fetch our tours
|
||||||
|
|
@ -52,13 +51,11 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGeniusPending) {
|
if (isGeniusPending) {
|
||||||
console.log('[Tour Genius] Pending genius tour detected. Aggressively clearing others.');
|
|
||||||
deactivateNonGeniusTours();
|
deactivateNonGeniusTours();
|
||||||
// Repeat deactivation every 100ms until RPC returns to catch any stragglers
|
// Repeat deactivation every 100ms until RPC returns to catch any stragglers
|
||||||
antiFlashInterval = setInterval(deactivateNonGeniusTours, 100);
|
antiFlashInterval = setInterval(deactivateNonGeniusTours, 100);
|
||||||
}
|
}
|
||||||
} catch(e) {
|
} catch(e) {
|
||||||
console.warn('[Tour Genius] Pre-emptive check failed:', e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rpc.query({
|
rpc.query({
|
||||||
|
|
@ -66,7 +63,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
method: 'get_tours_for_registration',
|
method: 'get_tours_for_registration',
|
||||||
args: [],
|
args: [],
|
||||||
}).catch(function(err) {
|
}).catch(function(err) {
|
||||||
console.warn('[Tour Genius] Failed to fetch tours (likely public page/access denied):', err);
|
|
||||||
return []; // Return empty array to allow chain to continue (e.g. for test tours)
|
return []; // Return empty array to allow chain to continue (e.g. for test tours)
|
||||||
}).then(function(topics) {
|
}).then(function(topics) {
|
||||||
// Stop the aggressive clearing once we have data
|
// Stop the aggressive clearing once we have data
|
||||||
|
|
@ -84,17 +80,13 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
var storedData = window.localStorage.getItem(key);
|
var storedData = window.localStorage.getItem(key);
|
||||||
if (storedData) {
|
if (storedData) {
|
||||||
var testTourData = JSON.parse(storedData);
|
var testTourData = JSON.parse(storedData);
|
||||||
console.log('[Tour Genius] Found stored test tour data:', tourName);
|
|
||||||
|
|
||||||
// Register the test tour dynamically
|
// Register the test tour dynamically
|
||||||
if (testTourData.steps && testTourData.steps.length > 0) {
|
if (testTourData.steps && testTourData.steps.length > 0) {
|
||||||
console.log('[Tour Genius] Registering test tour with steps:', testTourData.steps);
|
|
||||||
console.log('[Tour Genius] Step 0 Content CHECK:', testTourData.steps[0].content);
|
|
||||||
tour.register(tourName, {
|
tour.register(tourName, {
|
||||||
url: testTourData.url || '/web',
|
url: testTourData.url || '/web',
|
||||||
wait_for: Promise.resolve(),
|
wait_for: Promise.resolve(),
|
||||||
}, testTourData.steps);
|
}, testTourData.steps);
|
||||||
console.log('[Tour Genius] Registered test tour from localStorage:', tourName);
|
|
||||||
|
|
||||||
// CRITICAL: Add to registeredTours so it goes through activation!
|
// CRITICAL: Add to registeredTours so it goes through activation!
|
||||||
registeredTours.push(tourName);
|
registeredTours.push(tourName);
|
||||||
|
|
@ -108,15 +100,7 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('[Tour Genius] Error processing stored test tour data:', e);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!topics || !topics.length) {
|
|
||||||
console.log('[Tour Genius] No published tours to register (test tours may still work)');
|
|
||||||
} else {
|
|
||||||
console.log('[Tour Genius] Registering', topics.length, 'tours');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Safely iterate over topics (may be empty array or null)
|
// Safely iterate over topics (may be empty array or null)
|
||||||
(topics || []).forEach(function(topic) {
|
(topics || []).forEach(function(topic) {
|
||||||
var tourName = 'genius_tour_' + topic.id;
|
var tourName = 'genius_tour_' + topic.id;
|
||||||
|
|
@ -126,7 +110,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
|
|
||||||
// Skip if already registered (e.g. by test mode loader above)
|
// Skip if already registered (e.g. by test mode loader above)
|
||||||
if (tour.tours && tour.tours[tourName]) {
|
if (tour.tours && tour.tours[tourName]) {
|
||||||
console.log('[Tour Genius] Tour already registered (likely test mode):', tourName);
|
|
||||||
// Only add to registeredTours if NOT already there to prevent double activation
|
// Only add to registeredTours if NOT already there to prevent double activation
|
||||||
if (registeredTours.indexOf(tourName) === -1) {
|
if (registeredTours.indexOf(tourName) === -1) {
|
||||||
registeredTours.push(tourName);
|
registeredTours.push(tourName);
|
||||||
|
|
@ -136,7 +119,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
|
|
||||||
// Skip if no steps
|
// Skip if no steps
|
||||||
if (!topic.steps || !topic.steps.length) {
|
if (!topic.steps || !topic.steps.length) {
|
||||||
console.log('[Tour Genius] Skipping tour with no steps:', tourName);
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -152,7 +134,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
// Check if showAppsMenuItem is not already the first step (avoid dupes)
|
// Check if showAppsMenuItem is not already the first step (avoid dupes)
|
||||||
var firstStepIsApps = firstStep && firstStep.content === "Home Menu"; // Odoo standard name
|
var firstStepIsApps = firstStep && firstStep.content === "Home Menu"; // Odoo standard name
|
||||||
if (!firstStepIsApps) {
|
if (!firstStepIsApps) {
|
||||||
console.log('[Tour Genius] Injecting showAppsMenuItem for tour:', tourName);
|
|
||||||
stepsToRegister.unshift(tour.stepUtils.showAppsMenuItem());
|
stepsToRegister.unshift(tour.stepUtils.showAppsMenuItem());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -168,7 +149,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
|
|
||||||
registeredTours.push(tourName);
|
registeredTours.push(tourName);
|
||||||
|
|
||||||
console.log('[Tour Genius] Registered tour:', tourName, 'with', topic.steps.length, 'steps');
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// CRITICAL FIX: For tours with debugging flags, we need to properly call _register()
|
// CRITICAL FIX: For tours with debugging flags, we need to properly call _register()
|
||||||
|
|
@ -188,11 +168,9 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
var debuggingKey = 'debugging_tour_' + tourName;
|
var debuggingKey = 'debugging_tour_' + tourName;
|
||||||
var isDebugging = localStorage.getItem(debuggingKey);
|
var isDebugging = localStorage.getItem(debuggingKey);
|
||||||
|
|
||||||
console.log('[Tour Genius] Checking activation for:', tourName, 'debugging:', !!isDebugging);
|
|
||||||
|
|
||||||
if (isDebugging) {
|
if (isDebugging) {
|
||||||
// Tour was started via reset() - call _register to properly initialize it
|
// Tour was started via reset() - call _register to properly initialize it
|
||||||
console.log('[Tour Genius] Activating tour from debugging flag:', tourName);
|
|
||||||
|
|
||||||
// ============================================================
|
// ============================================================
|
||||||
// DEEP CLEANUP: Force Fresh Start
|
// DEEP CLEANUP: Force Fresh Start
|
||||||
|
|
@ -209,7 +187,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
consumed.splice(idx, 1);
|
consumed.splice(idx, 1);
|
||||||
window.localStorage.setItem(consumedKey, JSON.stringify(consumed));
|
window.localStorage.setItem(consumedKey, JSON.stringify(consumed));
|
||||||
console.log('[Tour Genius] Removed from localStorage consumed list:', tourName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch(e) {}
|
} catch(e) {}
|
||||||
|
|
@ -218,7 +195,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
var idx = tour.consumed_tours.indexOf(tourName);
|
var idx = tour.consumed_tours.indexOf(tourName);
|
||||||
if (idx > -1) {
|
if (idx > -1) {
|
||||||
tour.consumed_tours.splice(idx, 1);
|
tour.consumed_tours.splice(idx, 1);
|
||||||
console.log('[Tour Genius] Removed from memory consumed list:', tourName);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -229,7 +205,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
var stepKey = 'tour_' + tourName + '_current_step';
|
var stepKey = 'tour_' + tourName + '_current_step';
|
||||||
if (window.localStorage.getItem(stepKey) !== null) {
|
if (window.localStorage.getItem(stepKey) !== null) {
|
||||||
window.localStorage.removeItem(stepKey);
|
window.localStorage.removeItem(stepKey);
|
||||||
console.log('[Tour Genius] Wiped step persistence key:', stepKey);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Also clean any other patterns just in case
|
// Also clean any other patterns just in case
|
||||||
|
|
@ -244,14 +219,12 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
if (key === tourName ||
|
if (key === tourName ||
|
||||||
key.indexOf(tourName) >= 0 && (key.indexOf('step') >= 0 || key.indexOf('current') >= 0)) {
|
key.indexOf(tourName) >= 0 && (key.indexOf('step') >= 0 || key.indexOf('current') >= 0)) {
|
||||||
window.localStorage.removeItem(key);
|
window.localStorage.removeItem(key);
|
||||||
console.log('[Tour Genius] Wiped additional persistence key:', key);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Destroy Zombie Tooltips
|
// 2. Destroy Zombie Tooltips
|
||||||
// If a tooltip exists from a previous page load, it might be detached. Kill it.
|
// If a tooltip exists from a previous page load, it might be detached. Kill it.
|
||||||
if (tour.active_tooltips[tourName]) {
|
if (tour.active_tooltips[tourName]) {
|
||||||
console.log('[Tour Genius] Destroying zombie tooltip before activation');
|
|
||||||
try {
|
try {
|
||||||
if (tour.active_tooltips[tourName].destroy)
|
if (tour.active_tooltips[tourName].destroy)
|
||||||
tour.active_tooltips[tourName].destroy();
|
tour.active_tooltips[tourName].destroy();
|
||||||
|
|
@ -271,7 +244,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
// Call _register with do_update=true
|
// Call _register with do_update=true
|
||||||
// This will check the debugging flag and call _to_next_step
|
// This will check the debugging flag and call _to_next_step
|
||||||
tour._register(true, registeredTour, tourName).then(function() {
|
tour._register(true, registeredTour, tourName).then(function() {
|
||||||
console.log('[Tour Genius] Tour registered promise resolved:', tourName);
|
|
||||||
|
|
||||||
// CRITICAL: Deactivate ALL non-genius tours
|
// CRITICAL: Deactivate ALL non-genius tours
|
||||||
deactivateNonGeniusTours();
|
deactivateNonGeniusTours();
|
||||||
|
|
@ -287,31 +259,25 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
method: 'action_track_start',
|
method: 'action_track_start',
|
||||||
args: [[tourId]],
|
args: [[tourId]],
|
||||||
}).catch(function(e) {
|
}).catch(function(e) {
|
||||||
console.warn('[Tour Genius] Failed to track start time:', e);
|
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
console.log('[Tour Genius] Test mode - skipping progress tracking start');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// FORCE ACTIVATION CHECK
|
// FORCE ACTIVATION CHECK
|
||||||
// Sometimes Odoo's _register doesn't trigger _to_next_step if timing is off
|
// Sometimes Odoo's _register doesn't trigger _to_next_step if timing is off
|
||||||
if (!tour.active_tooltips[tourName]) {
|
if (!tour.active_tooltips[tourName]) {
|
||||||
console.warn('[Tour Genius] Tooltip missing after register. Forcing activation of Step 0.');
|
|
||||||
|
|
||||||
if (tour.tours[tourName]) {
|
if (tour.tours[tourName]) {
|
||||||
tour.tours[tourName].current_step = 0;
|
tour.tours[tourName].current_step = 0;
|
||||||
// Manually trigger internal method to stage the first tooltip
|
// Manually trigger internal method to stage the first tooltip
|
||||||
if (tour._to_next_step) {
|
if (tour._to_next_step) {
|
||||||
tour._to_next_step(tourName, 0);
|
tour._to_next_step(tourName, 0);
|
||||||
console.log('[Tour Genius] Forced _to_next_step(0) success.');
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// After registration, call update to display the tooltip
|
// After registration, call update to display the tooltip
|
||||||
setTimeout(function() {
|
setTimeout(function() {
|
||||||
console.log('[Tour Genius] Calling tour.update() for:', tourName);
|
|
||||||
console.log('[Tour Genius] Active Tooltip State:', tour.active_tooltips[tourName]);
|
|
||||||
tour.update(tourName);
|
tour.update(tourName);
|
||||||
}, 500);
|
}, 500);
|
||||||
});
|
});
|
||||||
|
|
@ -319,7 +285,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
// For non-debugging tours, do nothing - they don't need activation
|
// For non-debugging tours, do nothing - they don't need activation
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('[Tour Genius] All tours registered and activation checks initiated');
|
|
||||||
|
|
||||||
// CRITICAL: Override Odoo's _consume_tour to show our GeniusCelebration
|
// CRITICAL: Override Odoo's _consume_tour to show our GeniusCelebration
|
||||||
patchConsumeTour(registeredTours);
|
patchConsumeTour(registeredTours);
|
||||||
|
|
@ -366,7 +331,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
isTestMode = window.localStorage.getItem('genius_test_mode_' + tour_name) === 'true';
|
isTestMode = window.localStorage.getItem('genius_test_mode_' + tour_name) === 'true';
|
||||||
|
|
||||||
if (isTestMode) {
|
if (isTestMode) {
|
||||||
console.log('[Tour Genius] Test mode - performing manual cleanup to skip Odoo effects');
|
|
||||||
|
|
||||||
// 1. UNCONDITIONAL DELETE: This is critical.
|
// 1. UNCONDITIONAL DELETE: This is critical.
|
||||||
// _to_next_step sets the value to undefined but keeps the key.
|
// _to_next_step sets the value to undefined but keeps the key.
|
||||||
|
|
@ -420,7 +384,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
// Show quiz button if quiz has a valid ID
|
// Show quiz button if quiz has a valid ID
|
||||||
var hasQuiz = geniusQuiz && geniusQuiz.id && geniusQuiz.id !== false;
|
var hasQuiz = geniusQuiz && geniusQuiz.id && geniusQuiz.id !== false;
|
||||||
|
|
||||||
console.log('[Tour Genius] Completed tour:', tourId, 'Has Quiz:', hasQuiz);
|
|
||||||
|
|
||||||
// Mark as consumed
|
// Mark as consumed
|
||||||
rpc.query({
|
rpc.query({
|
||||||
|
|
@ -453,7 +416,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
};
|
};
|
||||||
|
|
||||||
tour._consume_tour_patched = true;
|
tour._consume_tour_patched = true;
|
||||||
console.log('[Tour Genius] Patched _consume_tour for GeniusCelebration');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -470,7 +432,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
try {
|
try {
|
||||||
GeniusTip = require('tour_genius.GeniusTip');
|
GeniusTip = require('tour_genius.GeniusTip');
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('[Tour Genius] GeniusTip not available, using standard tooltips');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tour._activate_tip = function(tip, tour_name, $anchor, $alt_trigger) {
|
tour._activate_tip = function(tip, tour_name, $anchor, $alt_trigger) {
|
||||||
|
|
@ -519,7 +480,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
|
|
||||||
// Handle genius_skip_tour event
|
// Handle genius_skip_tour event
|
||||||
tip.widget.on('genius_skip_tour', this, function(data) {
|
tip.widget.on('genius_skip_tour', this, function(data) {
|
||||||
console.log('[Tour Genius] Skip tour triggered:', data.tourName);
|
|
||||||
this._deactivate_tip(tip);
|
this._deactivate_tip(tip);
|
||||||
this._consume_tour(data.tourName);
|
this._consume_tour(data.tourName);
|
||||||
});
|
});
|
||||||
|
|
@ -529,11 +489,9 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
this._to_next_running_step.bind(this, tip, tour_name)
|
this._to_next_running_step.bind(this, tip, tour_name)
|
||||||
);
|
);
|
||||||
|
|
||||||
console.log('[Tour Genius] Activated GeniusTip for step', stepIndex + 1, 'of', totalSteps);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
tour._activate_tip_patched = true;
|
tour._activate_tip_patched = true;
|
||||||
console.log('[Tour Genius] Patched _activate_tip for GeniusTip');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -541,7 +499,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
* Called when a genius tour is being activated
|
* Called when a genius tour is being activated
|
||||||
*/
|
*/
|
||||||
function deactivateNonGeniusTours() {
|
function deactivateNonGeniusTours() {
|
||||||
console.log('[Tour Genius] Deactivating non-genius tours...');
|
|
||||||
|
|
||||||
if (!tour.active_tooltips) return;
|
if (!tour.active_tooltips) return;
|
||||||
|
|
||||||
|
|
@ -558,7 +515,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
try {
|
try {
|
||||||
tip.widget.destroy();
|
tip.widget.destroy();
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('[Tour Genius] Error destroying tip widget:', e);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -566,10 +522,8 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
delete tour.active_tooltips[tourName];
|
delete tour.active_tooltips[tourName];
|
||||||
deactivatedCount++;
|
deactivatedCount++;
|
||||||
|
|
||||||
console.log('[Tour Genius] Deactivated tour:', tourName);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
console.log('[Tour Genius] Deactivated', deactivatedCount, 'non-genius tours');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -601,7 +555,6 @@ odoo.define('tour_genius.tour_loader', function (require) {
|
||||||
// NOTE: Tour completion/skip handling is done in patchConsumeTour
|
// NOTE: Tour completion/skip handling is done in patchConsumeTour
|
||||||
// - Completion shows GeniusCelebration and marks consumed
|
// - Completion shows GeniusCelebration and marks consumed
|
||||||
// - Skip just marks as skipped (no celebration)
|
// - Skip just marks as skipped (no celebration)
|
||||||
console.log('[Tour Genius] Tour consumed (completion listener):', tourName);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Track that debugging is active
|
// Track that debugging is active
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue