FLUENT_COMMUNITY_PLUGIN_URL . 'Modules/Course/js/lesson-video-gate.js', 'deps' => [] ]; if (!isset($data['js_vars'])) { $data['js_vars'] = []; } $data['js_vars']['fcomLessonVideoGate'] = [ 'rest_url' => rest_url('fluent-community/v2'), 'nonce' => wp_create_nonce('wp_rest'), 'default_threshold' => LessonVideoGateService::getDefaultThreshold(), 'auto_complete_delay' => LessonVideoGateService::getAutoCompleteDelay(), 'i18n' => [ /* translators: %d is the watched percentage required to complete the lesson */ 'watch_notice' => __('Watch at least %d%% of this video to be able to complete this lesson.', 'fluent-community'), 'watch_to_end' => __('Watch this video to the end to be able to complete this lesson.', 'fluent-community'), 'watched_done' => __('Video watched — you can now complete this lesson.', 'fluent-community'), 'watch_failed' => __('Could not record your watch progress. Please reload the page and try again.', 'fluent-community') ] ]; return $data; } public function resetWatchedRecords($course, $userId) { LessonVideoGateService::resetWatchedForCourse($course->id, $userId); } public function resetLessonWatchedRecord($lesson, $userId) { if (!LessonVideoGateService::isGatedLesson($lesson)) { return; } LessonVideoGateService::resetWatchedForLesson($lesson, $userId); } public function deleteLessonWatchedRecords($lesson) { LessonVideoGateService::deleteWatchedForLesson($lesson->id); } }