<commit_before>import { Injectable } from '@angular/core';
import { Utilities, HostType, Storage } from '@microsoft/office-js-helpers';
import { Observable } from 'rxjs/Observable';
import * as jsyaml from 'js-yaml';
import * as PlaygroundHelpers from '../helpers';
import { Request, ResponseTypes, GitHubService } from '../services';
import { Action } from '@ngrx/store';
import { Snippet, UI } from '../actions';
import { Effect, Actions } from '@ngrx/effects';
import * as _ from 'lodash';
import cuid = require('cuid');
import { Environment } from '../../environment';

@Injectable()
export class SnippetEffects {
    private _store = new Storage<ISnippet>(`playground_${Utilities.host.toLowerCase()}_snippets`);
    private _defaults = <ISnippet>{
        id: '',
        gist: '',
        source: Utilities.host,
        author: '',
        name: 'New Snippet',
        description: '',
        script: { content: '', language: 'typescript' },
        style: { content: '', language: 'css' },
        template: { content: '', language: 'html' },
        libraries: ''
    };
    private samplesRepoUrl = 'https://raw.githubusercontent.com/WrathOfZombies/samples/deployment';

    constructor(
        private actions$: Actions,
        private _request: Request,
        private _github: GitHubService
    ) {
        this._defaults.author = this._github.profile ? this._github.profile.login : '';
    }

    @Effect()
    import$: Observable<Action> = this.actions$
        .ofType(Snippet.SnippetActionTypes.IMPORT)
        .map((action: Snippet.ImportAction) => ({ data: action.payload, suffix: action.params }))
        .mergeMap(({ data, suffix }) => {
            let observable: Observable<ISnippet>;
            let importType = this._determineImportType(data);
            let info = '';

            switch (importType) {
                case 'DEFAULT':
                    info = Utilities.host.toLowerCase();<commit_msg>minor update to storage changes<commit_after>import { Injectable } from '@angular/core';
import { Utilities, HostType, Storage } from '@microsoft/office-js-helpers';
import { Observable } from 'rxjs/Observable';
import * as jsyaml from 'js-yaml';
import * as PlaygroundHelpers from '../helpers';
import { Request, ResponseTypes, GitHubService } from '../services';
import { Action } from '@ngrx/store';
import { Snippet, UI } from '../actions';
import { Effect, Actions } from '@ngrx/effects';
import * as _ from 'lodash';
import cuid = require('cuid');
import { Environment } from '../../environment';
import { Store } from '@ngrx/store';
import * as fromRoot from '../reducers';

@Injectable()
export class SnippetEffects {
    private _store = new Storage<ISnippet>(`playground_${Utilities.host.toLowerCase()}_snippets`);
    private _defaults = <ISnippet>{
        id: '',
        gist: '',
        source: Utilities.host,
        author: '',
        name: 'New Snippet',
        description: '',
        script: { content: '', language: 'typescript' },
        style: { content: '', language: 'css' },
        template: { content: '', language: 'html' },
        libraries: ''
    };
    private samplesRepoUrl = 'https://raw.githubusercontent.com/WrathOfZombies/samples/deployment';

    constructor(
        private actions$: Actions,
        private _request: Request,
        private _github: GitHubService,
        reduxStore: Store<fromRoot.State>,
    ) {
        this._defaults.author = this._github.profile ? this._github.profile.login : '';
        this._store.notify = (event) => reduxStore.dispatch(new Snippet.LoadSnippetsAction());
    }

    @Effect()
    import$: Observable<Action> = this.actions$
        .ofType(Snippet.SnippetActionTypes.IMPORT)
        .map((action: Snippet.ImportAction) => ({ data: action.payload, suffix: action.params }))
        .mergeMap(({ data, suffix }) => {
            let observable: Observable<ISnippet>;
            let importType = this._determineImportType(data);
            let info = '';

            switch (importType) {
                case 'DEFAULT':
                    info = Utilities.host.toLowerCase();
{'fraction_non_alphanumeric': 0.14497689126733154, 'fraction_numerical': 0.0, 'mean_word_length': 2.901328273244782, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 17, 'https://': 2, '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': '2854211', 'n_tokens_mistral': 1144, 'n_tokens_neox': 1145, 'n_words': 282}