@financial-times/qanda-ui 0.0.1-beta.29 → 0.0.1-beta.30

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -6,12 +6,6 @@ const tracking_1 = require("../../utils/tracking");
6
6
  function formatDateForIcs(date) {
7
7
  return date.replace(/-|:|\.\d+/g, '');
8
8
  }
9
- function createIcsFile(title, startDateTime, endDateTime, url) {
10
- const icsContent = `
11
- BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nSUMMARY:${title}\nDESCRIPTION:${description(url)}\nDTSTART:${formatDateForIcs(startDateTime)}\nDTEND:${formatDateForIcs(endDateTime)}\nLOCATION:${url}\nEND:VEVENT\nEND:VCALENDAR
12
- `.trim();
13
- return URL.createObjectURL(new Blob([icsContent], { type: 'title/calendar' }));
14
- }
15
9
  const CalendarLink = ({ href, children, }) => {
16
10
  return ((0, jsx_runtime_1.jsx)("a", { href: href, target: "_blank", rel: "noopener noreferrer", role: "menuitem", "data-trackable": (0, tracking_1.trackingNS)('calendar-link'), className: "live-qa-calendar-list__item__link", children: children }));
17
11
  };
@@ -30,23 +24,17 @@ const apps = [
30
24
  icon: ((0, jsx_runtime_1.jsx)("svg", { className: "live-qa-calendar-icon", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M21.9979 8.49306V17.3819C22.0068 17.5304 21.987 17.6792 21.9399 17.8185C21.8927 17.9578 21.8194 18.0842 21.7247 18.1894C21.63 18.2946 21.5162 18.3761 21.3909 18.4285C21.2656 18.4809 21.1316 18.5029 20.9981 18.4931H13.9988V22.9375L2 20.9375V4.9375L13.9988 2.9375V7.38194H20.9981C21.1316 7.37212 21.2656 7.39413 21.3909 7.4465C21.5162 7.49886 21.63 7.58037 21.7247 7.68558C21.8194 7.79078 21.8927 7.91724 21.9399 8.0565C21.987 8.19576 22.0068 8.3446 21.9979 8.49306ZM20.9981 8.60417L16.9985 11.1597L13.9988 9.27083V11.0486L16.9985 12.9375L20.9981 10.3819V8.60417ZM7.91939 8.60417C5.81961 8.52639 4.78971 10.5819 4.78971 13.0486C4.78971 15.5153 5.8596 17.4931 7.91939 17.4931C9.7892 17.4931 10.9991 15.6153 10.9991 13.1708C10.9991 10.7264 10.1292 8.72639 7.91939 8.6375M7.60943 10.3819C8.44934 10.3819 9.19926 11.2042 9.19926 12.8819C9.19926 14.5597 8.44934 15.5042 7.60943 15.5042C6.76951 15.5042 6.09958 14.2708 6.09958 12.9375C6.09958 11.6042 6.77951 10.3819 7.60943 10.3819Z", fill: "black" }) })),
31
25
  getLink: ({ title, startDateTime, endDateTime, url }) => `https://outlook.live.com/calendar/0/deeplink/compose?subject=${encodeURIComponent(title)}&startdt=${startDateTime}&enddt=${endDateTime}&body=${encodeURIComponent(description(url))}&location=${encodeURIComponent(url)}`,
32
26
  },
33
- {
34
- name: 'Apple',
35
- icon: ((0, jsx_runtime_1.jsx)("svg", { className: "live-qa-calendar-icon", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M19.8023 9.75502C19.6851 9.84618 17.5884 11.002 17.5884 13.5675C17.5884 16.5367 20.2548 17.5851 20.3362 17.6111C20.3232 17.6762 19.9097 19.0501 18.9297 20.4501C18.0507 21.684 17.1358 22.9115 15.7424 22.9115C14.3522 22.9115 13.994 22.1236 12.3857 22.1236C10.8197 22.1236 10.263 22.9375 8.98671 22.9375C7.71371 22.9375 6.8249 21.798 5.80259 20.398C4.62076 18.7539 3.66357 16.1981 3.66357 13.7759C3.66357 9.88525 6.25189 7.82436 8.80113 7.82436C10.1523 7.82436 11.282 8.69365 12.1317 8.69365C12.9392 8.69365 14.2024 7.77227 15.7424 7.77227C16.3251 7.77227 18.4218 7.82436 19.8023 9.75502ZM15.0098 6.12487C15.6479 5.38907 16.0972 4.36351 16.0972 3.33796C16.0972 3.19796 16.0842 3.05471 16.0582 2.9375C15.0228 2.97657 13.7889 3.61144 13.0466 4.45467C12.4638 5.10257 11.9169 6.12487 11.9169 7.16345C11.9169 7.31972 11.9462 7.476 11.9559 7.52483C12.0243 7.53786 12.1285 7.55088 12.2359 7.55088C13.1671 7.55088 14.3359 6.94531 15.0098 6.12487Z", fill: "black" }) })),
36
- getLink: ({ title, startDateTime, endDateTime, url }) => createIcsFile(title, startDateTime, endDateTime, url),
37
- isDownload: true,
38
- },
39
27
  {
40
28
  name: 'Yahoo',
41
29
  icon: ((0, jsx_runtime_1.jsx)("svg", { className: "live-qa-calendar-icon", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", children: (0, jsx_runtime_1.jsx)("path", { d: "M15.3929 13.7528C15.3614 13.7513 15.3247 13.7506 15.2879 13.7506C13.8674 13.7506 12.7109 14.8793 12.6659 16.2886V16.2931C12.7049 17.6536 13.8172 18.7411 15.1837 18.7411C15.2182 18.7411 15.2519 18.7403 15.2857 18.7388H15.2812C15.3194 18.7411 15.3637 18.7418 15.4087 18.7418C16.8217 18.7418 17.9737 17.6228 18.0269 16.2226V16.2181C18.0037 14.8501 16.8892 13.7498 15.5174 13.7498C15.4739 13.7498 15.4304 13.7513 15.3869 13.7528H15.3929ZM0.75293 7.97933L5.57993 18.8138L3.84593 22.7221H8.09168L14.5214 7.97933H10.3042L7.67993 14.2868L5.08343 7.97933H0.75368H0.75293ZM18.4297 3.15308L14.1277 12.8161H18.9359L23.2469 3.15308H18.4297Z", fill: "black" }) })),
42
30
  getLink: ({ title, startDateTime, endDateTime, url }) => `https://calendar.yahoo.com/?v=60&title=${encodeURIComponent(title)}&st=${formatDateForIcs(startDateTime)}&et=${formatDateForIcs(endDateTime)}&desc=${encodeURIComponent(description(url))}&in_loc=${encodeURIComponent(url)}`,
43
31
  },
44
32
  ];
45
- exports.default = apps.map(({ name, icon, getLink, isDownload }) => ({
33
+ exports.default = apps.map(({ name, icon, getLink }) => ({
46
34
  name,
47
35
  icon,
48
36
  link: ({ title, startDateTime, endDateTime, url, }) => {
49
37
  const href = getLink({ title, startDateTime, endDateTime, url });
50
- return isDownload ? ((0, jsx_runtime_1.jsx)("a", { href: href, download: "event.ics", role: "menuitem", "data-trackable": (0, tracking_1.trackingNS)('calendar-link-download'), className: "live-qa-calendar-list__item__link", children: itemChildren(name, icon) })) : ((0, jsx_runtime_1.jsx)(CalendarLink, { href: href, children: itemChildren(name, icon) }));
38
+ return (0, jsx_runtime_1.jsx)(CalendarLink, { href: href, children: itemChildren(name, icon) });
51
39
  },
52
40
  }));
@@ -4,12 +4,6 @@ import { trackingNS } from '../../utils/tracking';
4
4
  function formatDateForIcs(date) {
5
5
  return date.replace(/-|:|\.\d+/g, '');
6
6
  }
7
- function createIcsFile(title, startDateTime, endDateTime, url) {
8
- const icsContent = `
9
- BEGIN:VCALENDAR\nVERSION:2.0\nBEGIN:VEVENT\nSUMMARY:${title}\nDESCRIPTION:${description(url)}\nDTSTART:${formatDateForIcs(startDateTime)}\nDTEND:${formatDateForIcs(endDateTime)}\nLOCATION:${url}\nEND:VEVENT\nEND:VCALENDAR
10
- `.trim();
11
- return URL.createObjectURL(new Blob([icsContent], { type: 'title/calendar' }));
12
- }
13
7
  const CalendarLink = ({ href, children, }) => {
14
8
  return (_jsx("a", { href: href, target: "_blank", rel: "noopener noreferrer", role: "menuitem", "data-trackable": trackingNS('calendar-link'), className: "live-qa-calendar-list__item__link", children: children }));
15
9
  };
@@ -28,23 +22,17 @@ const apps = [
28
22
  icon: (_jsx("svg", { className: "live-qa-calendar-icon", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", children: _jsx("path", { d: "M21.9979 8.49306V17.3819C22.0068 17.5304 21.987 17.6792 21.9399 17.8185C21.8927 17.9578 21.8194 18.0842 21.7247 18.1894C21.63 18.2946 21.5162 18.3761 21.3909 18.4285C21.2656 18.4809 21.1316 18.5029 20.9981 18.4931H13.9988V22.9375L2 20.9375V4.9375L13.9988 2.9375V7.38194H20.9981C21.1316 7.37212 21.2656 7.39413 21.3909 7.4465C21.5162 7.49886 21.63 7.58037 21.7247 7.68558C21.8194 7.79078 21.8927 7.91724 21.9399 8.0565C21.987 8.19576 22.0068 8.3446 21.9979 8.49306ZM20.9981 8.60417L16.9985 11.1597L13.9988 9.27083V11.0486L16.9985 12.9375L20.9981 10.3819V8.60417ZM7.91939 8.60417C5.81961 8.52639 4.78971 10.5819 4.78971 13.0486C4.78971 15.5153 5.8596 17.4931 7.91939 17.4931C9.7892 17.4931 10.9991 15.6153 10.9991 13.1708C10.9991 10.7264 10.1292 8.72639 7.91939 8.6375M7.60943 10.3819C8.44934 10.3819 9.19926 11.2042 9.19926 12.8819C9.19926 14.5597 8.44934 15.5042 7.60943 15.5042C6.76951 15.5042 6.09958 14.2708 6.09958 12.9375C6.09958 11.6042 6.77951 10.3819 7.60943 10.3819Z", fill: "black" }) })),
29
23
  getLink: ({ title, startDateTime, endDateTime, url }) => `https://outlook.live.com/calendar/0/deeplink/compose?subject=${encodeURIComponent(title)}&startdt=${startDateTime}&enddt=${endDateTime}&body=${encodeURIComponent(description(url))}&location=${encodeURIComponent(url)}`,
30
24
  },
31
- {
32
- name: 'Apple',
33
- icon: (_jsx("svg", { className: "live-qa-calendar-icon", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", children: _jsx("path", { d: "M19.8023 9.75502C19.6851 9.84618 17.5884 11.002 17.5884 13.5675C17.5884 16.5367 20.2548 17.5851 20.3362 17.6111C20.3232 17.6762 19.9097 19.0501 18.9297 20.4501C18.0507 21.684 17.1358 22.9115 15.7424 22.9115C14.3522 22.9115 13.994 22.1236 12.3857 22.1236C10.8197 22.1236 10.263 22.9375 8.98671 22.9375C7.71371 22.9375 6.8249 21.798 5.80259 20.398C4.62076 18.7539 3.66357 16.1981 3.66357 13.7759C3.66357 9.88525 6.25189 7.82436 8.80113 7.82436C10.1523 7.82436 11.282 8.69365 12.1317 8.69365C12.9392 8.69365 14.2024 7.77227 15.7424 7.77227C16.3251 7.77227 18.4218 7.82436 19.8023 9.75502ZM15.0098 6.12487C15.6479 5.38907 16.0972 4.36351 16.0972 3.33796C16.0972 3.19796 16.0842 3.05471 16.0582 2.9375C15.0228 2.97657 13.7889 3.61144 13.0466 4.45467C12.4638 5.10257 11.9169 6.12487 11.9169 7.16345C11.9169 7.31972 11.9462 7.476 11.9559 7.52483C12.0243 7.53786 12.1285 7.55088 12.2359 7.55088C13.1671 7.55088 14.3359 6.94531 15.0098 6.12487Z", fill: "black" }) })),
34
- getLink: ({ title, startDateTime, endDateTime, url }) => createIcsFile(title, startDateTime, endDateTime, url),
35
- isDownload: true,
36
- },
37
25
  {
38
26
  name: 'Yahoo',
39
27
  icon: (_jsx("svg", { className: "live-qa-calendar-icon", xmlns: "http://www.w3.org/2000/svg", width: "24", height: "25", viewBox: "0 0 24 25", fill: "none", children: _jsx("path", { d: "M15.3929 13.7528C15.3614 13.7513 15.3247 13.7506 15.2879 13.7506C13.8674 13.7506 12.7109 14.8793 12.6659 16.2886V16.2931C12.7049 17.6536 13.8172 18.7411 15.1837 18.7411C15.2182 18.7411 15.2519 18.7403 15.2857 18.7388H15.2812C15.3194 18.7411 15.3637 18.7418 15.4087 18.7418C16.8217 18.7418 17.9737 17.6228 18.0269 16.2226V16.2181C18.0037 14.8501 16.8892 13.7498 15.5174 13.7498C15.4739 13.7498 15.4304 13.7513 15.3869 13.7528H15.3929ZM0.75293 7.97933L5.57993 18.8138L3.84593 22.7221H8.09168L14.5214 7.97933H10.3042L7.67993 14.2868L5.08343 7.97933H0.75368H0.75293ZM18.4297 3.15308L14.1277 12.8161H18.9359L23.2469 3.15308H18.4297Z", fill: "black" }) })),
40
28
  getLink: ({ title, startDateTime, endDateTime, url }) => `https://calendar.yahoo.com/?v=60&title=${encodeURIComponent(title)}&st=${formatDateForIcs(startDateTime)}&et=${formatDateForIcs(endDateTime)}&desc=${encodeURIComponent(description(url))}&in_loc=${encodeURIComponent(url)}`,
41
29
  },
42
30
  ];
43
- export default apps.map(({ name, icon, getLink, isDownload }) => ({
31
+ export default apps.map(({ name, icon, getLink }) => ({
44
32
  name,
45
33
  icon,
46
34
  link: ({ title, startDateTime, endDateTime, url, }) => {
47
35
  const href = getLink({ title, startDateTime, endDateTime, url });
48
- return isDownload ? (_jsx("a", { href: href, download: "event.ics", role: "menuitem", "data-trackable": trackingNS('calendar-link-download'), className: "live-qa-calendar-list__item__link", children: itemChildren(name, icon) })) : (_jsx(CalendarLink, { href: href, children: itemChildren(name, icon) }));
36
+ return _jsx(CalendarLink, { href: href, children: itemChildren(name, icon) });
49
37
  },
50
38
  }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@financial-times/qanda-ui",
3
- "version": "0.0.1-beta.29",
3
+ "version": "0.0.1-beta.30",
4
4
  "description": "Components for the Live Q&A (AKA Ask an Expert) UI",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/esm/index.js",