<commit_before>import { ng } from '../ng-start';
import { http } from '../http';

export let libraryPrompt = ng.directive('libraryPrompt', ['$timeout', function ($timeout) {
    return {
        restrict: 'E',
        scope: {
            'originModule': '=',
        },
        template: `
        <lightbox show="show.libraryprompt" on-close="ignore()">

            <a class="ignore" ng-click="ignore()"><i18n>library.prompt.ignore</i18n></a>
            <hr>
            <div class="reduce-block-eight">
                <div class="block-container">
                    <h1 class="centered-text">
                        <i18n>library.prompt.title</i18n>
                    </h1>
                    <hr>
                    <div class="apps">
                        <div class="container">
                            <i class="library-large"></i>
                        </div>
                        <p>
                            <i18n>library.prompt.content</i18n>
                        </p>
                    </div>
                </div>
                <hr>
                <div class="row">        
                    <button ng-click="seeLater()" class="cancel"><i18n>library.prompt.see.later</i18n></button>
                </div>
            </div>
        
        </lightbox>
        `,
        link: function(scope, element, attributes){

            scope.show = { libraryprompt: false };

            if (!scope.originModule) {
                return;
            }

            let state;

            http().get('/userbook/preference/libraryprompt').done(function(pref){
                let preferences;
                if(pref.preference){
                    try{
                        preferences = JSON.parse(pref.preference);
                    }<commit_msg>feat: #29931, updated library prompt directive<commit_after>import { ng } from '../ng-start';
import { http } from '../http';
import { idiom as lang } from '../idiom';

export let libraryPrompt = ng.directive('libraryPrompt', ['$timeout', '$sce', function ($timeout, $sce) {
    return {
        restrict: 'E',
        scope: {
            'originModule': '=',
        },
        template: `
        <lightbox show="show.libraryprompt" on-close="ignore()">

            <a class="ignore" ng-click="ignore()"><i18n>library.prompt.ignore</i18n></a>
            <hr>
            <div class="reduce-block-eight">
                <div class="block-container">
                    <h1 class="centered-text">
                        <i18n ng-if="step == 1">library.prompt.title1</i18n>
                        <i18n ng-if="step == 2">library.prompt.title2</i18n>
                    </h1>
                    <hr>
                    <div class="apps">
                        <div ng-if="step == 1" class="container">
                            <i class="library-large"></i>
                        </div>
                        <div>
                            <div ng-if="step == 1" class="content1" ng-bind-html="content1"></div>
                            <div ng-if="step == 2" class="content1 centered-text" ng-bind-html="content2"></div>
                            <div ng-if="step == 2">
                                <img skin-src="/img/illustrations/library-incentive.gif" />
                            </div>
                        </div>
                    </div>
                </div>
                <hr>
                <nav class="dots">
                    <ul>
                        <li class="dot" ng-click="step = 1" ng-class="{ active: step == 1 }"></li>
                        <li class="dot" ng-click="step = 2" ng-class="{ active: step == 2 }"></li>
                    </ul>
                </nav>
                <div class="row">        
                    <button ng-click="seeLater()" class="cancel"><i18n>library.prompt.see.later</i18n></button>
                    <button ng-show="step == 1" ng-click="step = 2" class="right-magnet"><i18n>library.prompt.how.to.publish</i18n></button>
                    <button ng-show="step == 2" ng-click="ignore()" class="right-magnet"><i18n>library.prompt.understood</i18n></button>
                </div>
            </div>
        
        </lightbox>
        `,
        link: function(scope, element, attributes){

            scope.show = { libraryprompt: false };

            if (!scope.originModule) {
                return;
            }

            let moduleTranslated = lang.translate(scope.originModule + '.library.prompt.title');
            scope.content1 = $sce.trustAsHtml(lang.translate('library.prompt.content1').replace('[[modules]]', moduleTranslated));
            scope.content2 = $sce.trustAsHtml(lang.translate('library.prompt.content2'));
            scope.step = 1;

            let state;

            http().get('/userbook/preference/libraryprompt').done(function(pref){
                let preferences;
                if(pref.preference){
                    try{
                        preferences = JSON.parse(pref.preference);
                    }
{'fraction_non_alphanumeric': 0.14974318451205057, 'fraction_numerical': 0.01442117740023706, 'mean_word_length': 1.294064340734028, 'pattern_counts': {'":': 0, '<': 92, '<?xml version=': 0, '>': 92, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6940970', 'n_tokens_mistral': 1446, 'n_tokens_neox': 1307, 'n_words': 235}