UNPKG

@ledgerhq/live-common

Version:
104 lines 3.82 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.addMockAnnouncement = void 0; const prando_1 = __importDefault(require("prando")); const live_env_1 = require("@ledgerhq/live-env"); const announcementsPool = [ { uuid: "announcement-id-a", level: "info", icon: "warning", content: { en: { title: "Incoming cosmos fork", text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc nibh felis, pom id...", link: { href: "https://ledger.com/there-is/an/incoming-cosmos-fork", label: "Click here for more information on upcoming fork", }, }, }, contextual: [], published_at: "2019-09-29T00:00:00.000Z", expired_at: "2021-03-06T00:00:00.000Z", utm_campaign: "promo_feb2021", currencies: ["cosmos"], }, { uuid: "announcement-id-b", level: "info", icon: "info", content: { en: { title: "Incoming cosmos fork", text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc nibh felis, pom id...", link: { href: "https://ledger.com/there-is/an/incoming-cosmos-fork", label: "Click here for more information on upcoming fork", }, }, }, contextual: [], languages: ["en"], published_at: "2019-10-31T00:00:00.000Z", expired_at: "2021-04-06T00:00:00.000Z", }, { uuid: "announcement-id-c", level: "warning", icon: "warning", content: { en: { title: "Incoming bitcoin fork", text: "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc nibh felis, pom id...", link: { href: "https://ledger.com/there-is/an/incoming-cosmos-fork", label: "Click here for more information on upcoming fork", }, }, fr: { title: "Fork bitcoin en approche", text: "Lorem ipsum mais en français dolor sit amet, consectetur adipiscing elit. Nunc nibh felis, pom id...", link: { href: "https://ledger.com/there-is/an/fork-bitcoin-en-approche", label: "Clique ici pour en savoir plus sur le fork bitcoin ;)", }, }, }, priority: 1, contextual: ["send"], published_at: "2019-10-31T00:00:00.000Z", expired_at: "2021-05-06T00:00:00.000Z", currencies: ["bitcoin"], }, ]; const announcements = [...announcementsPool]; const rng = new prando_1.default((0, live_env_1.getEnv)("MOCK")); const addMockAnnouncement = (params) => { const now = new Date(); const expiryDate = new Date(now.getTime() + 2 * 60 * 1000); const newAnnouncement = { ...rng.nextArrayItem(announcementsPool), uuid: rng.nextString(32), level: rng.nextArrayItem(["info", "warning"]), icon: rng.nextArrayItem(["info", "warning"]), currencies: undefined, contextual: undefined, published_at: now.toISOString(), expired_at: expiryDate.toISOString(), ...params, }; announcements.push(newAnnouncement); }; exports.addMockAnnouncement = addMockAnnouncement; async function fetchAnnouncements() { return Promise.resolve(announcements); } const api = { fetchAnnouncements, }; exports.default = api; //# sourceMappingURL=announcements.js.map