UNPKG

@point-api/js-sdk

Version:

Javascript SDK for Point API

30 lines 1.03 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const INITIAL_SNIPPETS = [ { id_: '1', content: "Hi there, it's great to hear from you!", name: 'hello', labels: [] }, { id_: '2', content: "Thank you for reaching out. We're currently all set, but I will make sure to ping you should our needs change.", name: 'thanks', labels: [] } ]; class SuggestionsStore { constructor() { this.snippets = INITIAL_SNIPPETS.slice(); } addSnippet(name, content, labels, addToBottom) { const snippet = { id_: (this.snippets.length + 1).toString(), name, content, labels }; if (addToBottom) { this.snippets.push(snippet); } else { this.snippets.unshift(snippet); } } snippetNameExists(name) { return this.snippets.filter(snippet => snippet.name === name).length > 0; } } exports.default = SuggestionsStore; //# sourceMappingURL=suggestionsStore.js.map