@bigbinary/neeto-molecules 3.16.8 → 3.16.9

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.
@@ -1,11 +1,15 @@
1
- import { isPresent, slugify, noop } from '@bigbinary/neeto-cist';
2
- import { omit } from 'ramda';
1
+ import { isPresent, noop, slugify } from '@bigbinary/neeto-cist';
2
+ import { Link as Link$1, useLocation, useHistory, useRouteMatch, Switch, Route } from 'react-router-dom';
3
+ import ErrorPage from './ErrorPage.js';
3
4
  import classnames from 'classnames';
4
5
  import Typography from '@bigbinary/neetoui/Typography';
5
- import { useTranslation, Trans } from 'react-i18next';
6
+ import { omit } from 'ramda';
7
+ import { useTranslation } from 'react-i18next';
8
+ import Container from './Container.js';
6
9
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
7
10
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
8
11
  import React__default, { useRef, useCallback, useEffect, useState, createElement } from 'react';
12
+ import useBreakpoints from '@bigbinary/neeto-commons-frontend/react-utils/useBreakpoints';
9
13
  import ExternalLink from '@bigbinary/neeto-icons/ExternalLink';
10
14
  import Button from '@bigbinary/neetoui/Button';
11
15
  import CopyToClipboardButton from './CopyToClipboardButton.js';
@@ -19,6 +23,9 @@ import Facebook from '@bigbinary/neeto-icons/Facebook';
19
23
  import Linkedin from '@bigbinary/neeto-icons/Linkedin';
20
24
  import Twitter from '@bigbinary/neeto-icons/Twitter';
21
25
  import * as yup from 'yup';
26
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
27
+ import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
28
+ import _regeneratorRuntime from '@babel/runtime/regenerator';
22
29
  import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils/general';
23
30
  import { n } from './inject-css-DmrvuTKK.js';
24
31
  import { dayjs } from '@bigbinary/neeto-commons-frontend/utils';
@@ -27,15 +34,31 @@ import Modal from '@bigbinary/neetoui/Modal';
27
34
  import Input$1 from '@bigbinary/neetoui/Input';
28
35
  import Select from '@bigbinary/neetoui/Select';
29
36
  import DatePicker from '@bigbinary/neetoui/DatePicker';
30
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
31
- import { Link as Link$1 } from 'react-router-dom';
32
- import '@babel/runtime/helpers/objectWithoutProperties';
37
+ import Share from '@bigbinary/neeto-icons/Share';
38
+ import QrCode from '@bigbinary/neeto-icons/QrCode';
39
+ import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
40
+ import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
41
+ import CardLayout from './CardLayout.js';
42
+ import Header$1 from './Header.js';
43
+ import 'zustand/shallow';
44
+ import '@bigbinary/neeto-commons-frontend/react-utils/useDisplayErrorPage';
45
+ import 'react-helmet';
46
+ import './index-DAYCJu79.js';
47
+ import './_commonjsHelpers-BFTU3MAI.js';
33
48
  import '@bigbinary/neeto-icons/Copy';
34
49
  import '@bigbinary/neeto-icons/Check';
35
50
  import '@bigbinary/neeto-icons/MenuHorizontal';
36
51
  import '@bigbinary/neeto-icons/MenuVertical';
37
52
  import '@bigbinary/neetoui/Dropdown';
38
53
  import '@bigbinary/neetoui/Tooltip';
54
+ import './Breadcrumbs.js';
55
+ import './HelpPopover.js';
56
+ import '@bigbinary/neetoui/Popover';
57
+ import './Search.js';
58
+ import '@bigbinary/neeto-commons-frontend/react-utils/useFuncDebounce';
59
+ import '@bigbinary/neeto-commons-frontend/react-utils/useQueryParams';
60
+ import '@bigbinary/neeto-commons-frontend/react-utils/useUpdateEffect';
61
+ import '@bigbinary/neeto-icons/Search';
39
62
 
40
63
  var ExpiryNotice = function ExpiryNotice(_ref) {
41
64
  var expiryConfiguration = _ref.expiryConfiguration;
@@ -98,6 +121,49 @@ var downloadCanvas = function downloadCanvas(canvas) {
98
121
  element.click();
99
122
  element.remove();
100
123
  };
124
+ var copyCanvasToClipboard = /*#__PURE__*/function () {
125
+ var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(canvas, handleDownloadQRCode) {
126
+ var blob, clipboardItem;
127
+ return _regeneratorRuntime.wrap(function _callee$(_context) {
128
+ while (1) switch (_context.prev = _context.next) {
129
+ case 0:
130
+ if (canvas) {
131
+ _context.next = 2;
132
+ break;
133
+ }
134
+ return _context.abrupt("return");
135
+ case 2:
136
+ _context.prev = 2;
137
+ _context.next = 5;
138
+ return new Promise(function (resolve) {
139
+ return canvas.toBlob(resolve);
140
+ });
141
+ case 5:
142
+ blob = _context.sent;
143
+ if (blob) {
144
+ _context.next = 8;
145
+ break;
146
+ }
147
+ return _context.abrupt("return");
148
+ case 8:
149
+ clipboardItem = new ClipboardItem(_defineProperty({}, blob.type, blob));
150
+ navigator.clipboard.write([clipboardItem]);
151
+ _context.next = 15;
152
+ break;
153
+ case 12:
154
+ _context.prev = 12;
155
+ _context.t0 = _context["catch"](2);
156
+ handleDownloadQRCode();
157
+ case 15:
158
+ case "end":
159
+ return _context.stop();
160
+ }
161
+ }, _callee, null, [[2, 12]]);
162
+ }));
163
+ return function copyCanvasToClipboard(_x, _x2) {
164
+ return _ref4.apply(this, arguments);
165
+ };
166
+ }();
101
167
  var getPathname = function getPathname(url) {
102
168
  return new URL(url).pathname.slice(1);
103
169
  };
@@ -137,8 +203,8 @@ var PATH_VALIDATION_SCHEMA = yup.object().shape({
137
203
  path: yup.string().required(t("neetoMolecules.shareViaLink.editUrl.validationError")).matches(/^[A-Za-z0-9]([\w/-])*$/, t("neetoMolecules.shareViaLink.editUrl.validationError"))
138
204
  });
139
205
 
140
- var css = ".no-padding .neeto-ui-input.neeto-ui-input--medium input{padding:0}.no-padding .neeto-ui-input__prefix{color:rgb(var(--neeto-ui-gray-600))!important}";
141
- n(css,{});
206
+ var css$1 = ".no-padding .neeto-ui-input.neeto-ui-input--medium input{padding:0}.no-padding .neeto-ui-input__prefix{color:rgb(var(--neeto-ui-gray-600))!important}";
207
+ n(css$1,{});
142
208
 
143
209
  var Header = Pane.Header,
144
210
  Body = Pane.Body,
@@ -389,25 +455,32 @@ var Link = function Link(_ref) {
389
455
  setIsEditURLModalOpen = _useState4[1];
390
456
  var _useTranslation = useTranslation(),
391
457
  t = _useTranslation.t;
458
+ var _useBreakpoints = useBreakpoints(),
459
+ isSize = _useBreakpoints.isSize;
460
+ var isMobile = isSize("mobile");
392
461
  var isDropdownEnabled = enabledOptions.regenerate || enabledOptions.edit;
393
462
  return /*#__PURE__*/jsx("div", {
394
463
  className: "space-y-4",
395
464
  "data-cy": "link-block",
396
465
  "data-testid": "link-block",
397
466
  children: /*#__PURE__*/jsxs("div", {
398
- className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-1",
399
- children: [/*#__PURE__*/jsx("div", {
400
- className: "neeto-ui-rounded-md neeto-ui-border-gray-200 relative min-w-0 flex-grow truncate border p-2 leading-none",
467
+ className: "flex items-center gap-1 sm:gap-2",
468
+ children: [/*#__PURE__*/jsxs("div", {
469
+ className: "neeto-ui-rounded-md neeto-ui-border-gray-300 neeto-ui-bg-gray-50 relative flex min-w-0 flex-grow items-center truncate border leading-none",
401
470
  "data-cy": "nui-input-field",
402
- children: url
403
- }), /*#__PURE__*/jsxs("div", {
404
- className: "flex w-full flex-shrink-0 items-center gap-1 sm:w-auto",
405
- children: [/*#__PURE__*/jsx(CopyToClipboardButton, {
471
+ children: [/*#__PURE__*/jsx("div", {
472
+ className: "relative min-w-0 flex-grow truncate p-2 leading-none",
473
+ children: url
474
+ }), /*#__PURE__*/jsx(CopyToClipboardButton, {
475
+ className: "rounded-l-none",
406
476
  "data-cy": "link-copy-button",
407
477
  "data-testid": "link-copy-button",
408
- label: t("neetoMolecules.shareViaLink.copyLink"),
478
+ label: !isMobile ? t("neetoMolecules.shareViaLink.copyLink") : null,
409
479
  value: url
410
- }), /*#__PURE__*/jsx(Button, {
480
+ })]
481
+ }), /*#__PURE__*/jsxs("div", {
482
+ className: "flex flex-shrink-0 items-center gap-1 sm:gap-2",
483
+ children: [/*#__PURE__*/jsx(Button, {
411
484
  "data-cy": "preview-button",
412
485
  "data-testid": "preview-button",
413
486
  href: previewUrl || url,
@@ -467,6 +540,189 @@ var Link = function Link(_ref) {
467
540
  });
468
541
  };
469
542
 
543
+ var _excluded = ["title", "link", "description", "Icon", "onClick"];
544
+ function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
545
+ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
546
+ var Card = function Card(_ref) {
547
+ var title = _ref.title,
548
+ link = _ref.link,
549
+ description = _ref.description,
550
+ Icon = _ref.Icon,
551
+ _ref$onClick = _ref.onClick,
552
+ onClick = _ref$onClick === void 0 ? noop : _ref$onClick,
553
+ otherProps = _objectWithoutProperties(_ref, _excluded);
554
+ var Component = isPresent(link) ? Link$1 : "div";
555
+ return /*#__PURE__*/jsxs(Component, _objectSpread(_objectSpread({
556
+ onClick: onClick,
557
+ className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-molecules-share-landing__card flex cursor-pointer flex-col gap-3 border p-3",
558
+ to: link
559
+ }, otherProps), {}, {
560
+ children: [/*#__PURE__*/jsxs("div", {
561
+ className: "flex items-center gap-2",
562
+ children: [Icon && /*#__PURE__*/jsx(Icon, {
563
+ className: "neeto-ui-text-gray-500 flex-shrink-0",
564
+ size: 24
565
+ }), /*#__PURE__*/jsx(Typography, {
566
+ className: "min-w-0 flex-grow break-words",
567
+ style: "h4",
568
+ children: title
569
+ })]
570
+ }), description && /*#__PURE__*/jsx(Typography, {
571
+ className: "break-words",
572
+ lineHeight: "normal",
573
+ style: "body2",
574
+ children: description
575
+ })]
576
+ }));
577
+ };
578
+
579
+ var ShareBlock = function ShareBlock(_ref) {
580
+ var moreOptions = _ref.moreOptions,
581
+ disableShareSocialMedia = _ref.disableShareSocialMedia,
582
+ disableQRDownload = _ref.disableQRDownload,
583
+ socialMediaProps = _ref.socialMediaProps,
584
+ qrCodeProps = _ref.qrCodeProps,
585
+ entity = _ref.entity;
586
+ var location = useLocation();
587
+ var history = useHistory();
588
+ var _useTranslation = useTranslation(),
589
+ t = _useTranslation.t;
590
+ var handleNavigate = function handleNavigate(subPath) {
591
+ // eslint-disable-next-line @bigbinary/neeto/use-common-routes
592
+ history.push("".concat(location.pathname, "/").concat(subPath));
593
+ };
594
+ var hasMoreOptions = isPresent(moreOptions);
595
+ return /*#__PURE__*/jsxs("div", {
596
+ className: "neeto-ui-border-gray-200 mt-8 grid grid-cols-1 gap-4 border-t pt-8 sm:grid-cols-2 md:grid-cols-3 lg:grid-cols-4",
597
+ children: [hasMoreOptions && moreOptions.map(function (_ref2) {
598
+ var title = _ref2.title,
599
+ link = _ref2.link,
600
+ Icon = _ref2.icon,
601
+ onClick = _ref2.onClick,
602
+ dataCy = _ref2.dataCy,
603
+ description = _ref2.description;
604
+ return /*#__PURE__*/createElement(Card, {
605
+ Icon: Icon,
606
+ description: description,
607
+ link: link,
608
+ onClick: onClick,
609
+ title: title,
610
+ "data-cy": dataCy,
611
+ "data-testid": dataCy,
612
+ key: link
613
+ });
614
+ }), !disableShareSocialMedia && /*#__PURE__*/jsx(Card, {
615
+ Icon: Share,
616
+ "data-cy": "social-share-card",
617
+ "data-testid": "social-share-card",
618
+ description: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardDescription) || t("neetoMolecules.shareViaLink.socialMediaShare.description"),
619
+ title: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardTitle) || t("neetoMolecules.shareViaLink.socialMediaShare.title"),
620
+ onClick: function onClick() {
621
+ return handleNavigate("social-media");
622
+ }
623
+ }), !disableQRDownload && entity && /*#__PURE__*/jsx(Card, {
624
+ Icon: QrCode,
625
+ "data-cy": "qr-code-card",
626
+ "data-testid": "qr-code-card",
627
+ description: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardDescription) || t("neetoMolecules.shareViaLink.qrCode.description"),
628
+ title: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardTitle) || t("neetoMolecules.shareViaLink.qrCode.title"),
629
+ onClick: function onClick() {
630
+ return handleNavigate("qrcode");
631
+ }
632
+ })]
633
+ });
634
+ };
635
+
636
+ var MainPanel = function MainPanel(_ref) {
637
+ var title = _ref.title,
638
+ description = _ref.description,
639
+ qrCodeProps = _ref.qrCodeProps,
640
+ socialMediaProps = _ref.socialMediaProps,
641
+ _ref$isLoading = _ref.isLoading,
642
+ isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
643
+ _ref$enabledOptions = _ref.enabledOptions,
644
+ enabledOptions = _ref$enabledOptions === void 0 ? {
645
+ regenerate: false,
646
+ edit: false
647
+ } : _ref$enabledOptions,
648
+ _ref$urls = _ref.urls,
649
+ urls = _ref$urls === void 0 ? [] : _ref$urls,
650
+ entity = _ref.entity,
651
+ entityName = _ref.entityName,
652
+ _ref$handleEdit = _ref.handleEdit,
653
+ handleEdit = _ref$handleEdit === void 0 ? noop : _ref$handleEdit,
654
+ _ref$handleRegenerate = _ref.handleRegenerate,
655
+ handleRegenerate = _ref$handleRegenerate === void 0 ? noop : _ref$handleRegenerate,
656
+ moreOptions = _ref.moreOptions,
657
+ _ref$disableShareSoci = _ref.disableShareSocialMedia,
658
+ disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
659
+ _ref$disableQRDownloa = _ref.disableQRDownload,
660
+ disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
661
+ _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
662
+ publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry,
663
+ customTopContent = _ref.customTopContent,
664
+ customBottomContent = _ref.customBottomContent;
665
+ var _useTranslation = useTranslation(),
666
+ t = _useTranslation.t;
667
+ var shouldShowShareBlock = !disableQRDownload || !disableShareSocialMedia || isPresent(moreOptions);
668
+ return /*#__PURE__*/jsx(Container, {
669
+ className: "neeto-ui-bg-gray-100 neeto-molecule-share-landing-page",
670
+ children: /*#__PURE__*/jsxs("div", {
671
+ className: "mx-auto w-full max-w-5xl py-10",
672
+ children: [customTopContent, /*#__PURE__*/jsx(Typography, {
673
+ "data-cy": "share-your-meeting-heading",
674
+ lineHeight: "tight",
675
+ style: "h2",
676
+ className: classnames({
677
+ "mb-2": isPresent(description),
678
+ "mb-6": !isPresent(description)
679
+ }),
680
+ children: title || t("neetoMolecules.shareViaLink.title", {
681
+ productName: globalProps.appName
682
+ })
683
+ }), description && /*#__PURE__*/jsx(Typography, {
684
+ className: "mb-6",
685
+ "data-cy": "share-your-meeting-heading",
686
+ lineHeight: "normal",
687
+ style: "body1",
688
+ children: description
689
+ }), /*#__PURE__*/jsxs("div", {
690
+ className: "neeto-ui-rounded-lg neeto-ui-bg-white p-6 sm:p-8",
691
+ "data-testid": "share-via-link",
692
+ children: [/*#__PURE__*/jsxs("div", {
693
+ className: "space-y-1",
694
+ children: [/*#__PURE__*/jsx("div", {
695
+ className: "inline-flex max-w-full flex-col space-y-4",
696
+ children: urls.map(function (urlOption) {
697
+ return /*#__PURE__*/createElement(Link, {
698
+ enabledOptions: enabledOptions,
699
+ entityName: entityName,
700
+ handleEdit: handleEdit,
701
+ handleRegenerate: handleRegenerate,
702
+ isLoading: isLoading,
703
+ editUrlProps: omit(["url"], urlOption),
704
+ key: urlOption.url,
705
+ previewUrl: urlOption.previewUrl,
706
+ url: urlOption.url
707
+ });
708
+ })
709
+ }), isPresent(publicLinkExpiryConfiguration) && /*#__PURE__*/jsx(ExpiryNotice, {
710
+ expiryConfiguration: publicLinkExpiryConfiguration
711
+ })]
712
+ }), shouldShowShareBlock && /*#__PURE__*/jsx(ShareBlock, {
713
+ disableQRDownload: disableQRDownload,
714
+ disableShareSocialMedia: disableShareSocialMedia,
715
+ entity: entity,
716
+ moreOptions: moreOptions,
717
+ qrCodeProps: qrCodeProps,
718
+ socialMediaProps: socialMediaProps,
719
+ url: urls[0].url
720
+ })]
721
+ }), customBottomContent]
722
+ })
723
+ });
724
+ };
725
+
470
726
  var __defProp = Object.defineProperty;
471
727
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
472
728
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1328,172 +1584,144 @@ var QRCode$1 = (props) => {
1328
1584
 
1329
1585
  var QRCode = function QRCode(_ref) {
1330
1586
  var entity = _ref.entity,
1331
- url = _ref.url;
1587
+ qrCodeProps = _ref.qrCodeProps,
1588
+ url = _ref.url,
1589
+ shareUrl = _ref.shareUrl;
1590
+ var _useTranslation = useTranslation(),
1591
+ t = _useTranslation.t;
1332
1592
  if (!entity) return null;
1333
1593
  var id = entity.id,
1334
1594
  name = entity.name;
1335
1595
  var canvasId = "qrcode-share-".concat(id);
1336
- var handleDownload = function handleDownload() {
1596
+ var handleDownloadQRCode = function handleDownloadQRCode() {
1337
1597
  var canvas = document.getElementById(canvasId);
1338
1598
  if (canvas) downloadCanvas(canvas, {
1339
1599
  name: slugify(name)
1340
1600
  });
1341
1601
  };
1342
- return /*#__PURE__*/jsxs("div", {
1343
- className: "neeto-ui-border-gray-200 flex flex-col justify-start space-y-2 border-t py-3 pl-8 sm:space-y-4 sm:border-l sm:py-2 sm:pl-6",
1344
- "data-cy": "qr-download-block",
1345
- "data-testid": "qr-download-block",
1346
- children: [/*#__PURE__*/jsx(Typography, {
1347
- lineHeight: "normal",
1348
- style: "body2",
1349
- weight: "medium",
1350
- children: /*#__PURE__*/jsx(Trans, {
1351
- i18nKey: "neetoMolecules.shareViaLink.socialMediaShare.qrCodeInfo",
1352
- components: {
1353
- button: /*#__PURE__*/jsx(Button, {
1354
- "data-cy": "qr-code-download-button",
1355
- "data-testid": "qr-code-download-button",
1356
- style: "link",
1357
- onClick: handleDownload
1358
- })
1359
- }
1602
+ var handleCopyQRCode = function handleCopyQRCode() {
1603
+ var canvas = document.getElementById(canvasId);
1604
+ if (canvas) copyCanvasToClipboard(canvas, handleDownloadQRCode);
1605
+ };
1606
+ var title = (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.pageTitle) || (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardTitle) || t("neetoMolecules.shareViaLink.qrCode.title");
1607
+ var description = (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.pageDescription) || (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardDescription) || t("neetoMolecules.shareViaLink.qrCode.description");
1608
+ return /*#__PURE__*/jsxs(Container, {
1609
+ className: "neeto-molecules-embed-qr-code-landing-page py-8",
1610
+ children: [/*#__PURE__*/jsx(Button, {
1611
+ className: "mb-4",
1612
+ "data-cy": "back-button",
1613
+ "data-testid": "back-button",
1614
+ icon: LeftArrow,
1615
+ iconPosition: "left",
1616
+ label: t("neetoMolecules.productEmbed.backToShare"),
1617
+ size: "small",
1618
+ style: "link",
1619
+ to: shareUrl
1620
+ }), /*#__PURE__*/jsx(Header$1, {
1621
+ className: "py-0",
1622
+ title: t("neetoMolecules.shareViaLink.qrCode.title")
1623
+ }), /*#__PURE__*/jsx(CardLayout, {
1624
+ description: description,
1625
+ title: title,
1626
+ actionBlock: /*#__PURE__*/jsxs("div", {
1627
+ className: "flex flex-wrap items-center gap-3",
1628
+ children: [/*#__PURE__*/jsx(Button, {
1629
+ "data-cy": "qr-code-download-button",
1630
+ "data-testid": "qr-code-download-button",
1631
+ label: t("neetoMolecules.shareViaLink.qrCode.download"),
1632
+ style: "primary",
1633
+ onClick: handleDownloadQRCode
1634
+ }), /*#__PURE__*/jsx(CopyToClipboardButton, {
1635
+ "data-cy": "qr-code-copy-button",
1636
+ "data-testid": "qr-code-copy-button",
1637
+ label: t("neetoMolecules.shareViaLink.qrCode.copy"),
1638
+ style: "secondary",
1639
+ onClick: handleCopyQRCode
1640
+ })]
1641
+ }),
1642
+ children: /*#__PURE__*/jsx(QRCode$1, {
1643
+ className: "mt-6 cursor-pointer",
1644
+ "data-cy": "qr-code-image",
1645
+ "data-testid": "qr-code-image",
1646
+ id: canvasId,
1647
+ size: 160,
1648
+ style: {
1649
+ width: 160,
1650
+ height: 160
1651
+ },
1652
+ value: url,
1653
+ onClick: handleDownloadQRCode
1360
1654
  })
1361
- }), /*#__PURE__*/jsx(QRCode$1, {
1362
- className: "cursor-pointer",
1363
- "data-cy": "qr-code-image",
1364
- "data-testid": canvasId,
1365
- id: canvasId,
1366
- size: 256,
1367
- style: {
1368
- width: 80,
1369
- height: 80
1370
- },
1371
- value: url,
1372
- onClick: handleDownload
1373
1655
  })]
1374
1656
  });
1375
1657
  };
1376
1658
 
1377
- var Subtitle = function Subtitle(_ref) {
1378
- var link = _ref.link,
1379
- dataCy = _ref.dataCy,
1380
- _onClick = _ref.onClick,
1381
- subtitle = _ref.subtitle;
1382
- var Component = isPresent(link) ? Link$1 : "div";
1383
- return /*#__PURE__*/jsx(Component, {
1384
- "data-cy": dataCy,
1385
- to: link,
1386
- onClick: function onClick(event) {
1387
- event.preventDefault();
1388
- _onClick === null || _onClick === void 0 || _onClick(event);
1389
- },
1390
- children: /*#__PURE__*/jsx(Typography, {
1391
- style: "body3",
1392
- weight: "medium",
1393
- className: classnames("break-words", {
1394
- "neeto-ui-text-accent-800": isPresent(_onClick) || isPresent(link)
1395
- }),
1396
- children: subtitle
1397
- })
1398
- });
1399
- };
1659
+ var css = ".neeto-molecules-share-landing__card{outline:1px solid rgb(var(--neeto-ui-white))!important;transition:all .3s!important}.neeto-molecules-share-landing__card:hover{border-color:rgb(var(--neeto-ui-primary-500))!important;outline:1px solid rgb(var(--neeto-ui-primary-500))!important}";
1660
+ n(css,{});
1400
1661
 
1401
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
1402
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
1403
- var ShareBlock = function ShareBlock(_ref) {
1404
- var entity = _ref.entity,
1405
- postTitle = _ref.postTitle,
1662
+ var SocialMedia = function SocialMedia(_ref) {
1663
+ var socialMediaProps = _ref.socialMediaProps,
1406
1664
  url = _ref.url,
1407
- moreOptions = _ref.moreOptions,
1408
- disableShareSocialMedia = _ref.disableShareSocialMedia,
1409
- disableQRDownload = _ref.disableQRDownload;
1665
+ shareUrl = _ref.shareUrl;
1410
1666
  var _useTranslation = useTranslation(),
1411
1667
  t = _useTranslation.t;
1412
- var socialMediaButtonClasses = "neeto-ui-bg-gray-200 hover:neeto-ui-bg-gray-300 flex h-10 w-10 cursor-pointer items-center justify-center neeto-ui-rounded-md transition-colors duration-300 ease-in-out";
1413
- var hasMoreOptions = isPresent(moreOptions);
1414
- return /*#__PURE__*/jsxs("div", {
1415
- className: "flex flex-col divide-y sm:flex-row sm:gap-6 sm:divide-x sm:divide-y-0",
1416
- children: [hasMoreOptions && /*#__PURE__*/jsx("div", {
1417
- className: "max-w-md divide-y",
1418
- children: moreOptions.map(function (_ref2, index) {
1419
- var title = _ref2.title,
1420
- link = _ref2.link,
1421
- Icon = _ref2.icon,
1422
- onClick = _ref2.onClick,
1423
- dataCy = _ref2.dataCy,
1424
- subtitleProps = _ref2.subtitleProps;
1425
- var Component = isPresent(link) ? Link$1 : "div";
1426
- return /*#__PURE__*/createElement(Component, {
1427
- onClick: onClick,
1428
- "data-cy": dataCy,
1429
- key: link,
1430
- to: link,
1431
- className: classnames("neeto-ui-border-gray-200 flex cursor-pointer items-center gap-x-2 border-t py-3", {
1432
- "border-none": index === 0
1433
- })
1434
- }, /*#__PURE__*/jsxs("div", {
1435
- className: "flex flex-row gap-2",
1436
- children: [/*#__PURE__*/jsx(Icon, {
1437
- className: "neeto-ui-text-gray-500 flex-shrink-0",
1438
- size: 24
1439
- }), /*#__PURE__*/jsxs("div", {
1440
- className: "flex flex-col gap-1",
1441
- children: [/*#__PURE__*/jsx(Typography, {
1442
- className: "group-hover:underline",
1443
- style: "body2",
1444
- weight: "medium",
1445
- children: title
1446
- }), subtitleProps && /*#__PURE__*/jsx(Subtitle, _objectSpread({}, subtitleProps))]
1447
- })]
1448
- }));
1449
- })
1450
- }), !disableShareSocialMedia && /*#__PURE__*/jsxs("div", {
1451
- "data-cy": "social-media-block",
1452
- "data-testid": "social-media-block",
1453
- className: classnames("neeto-ui-border-gray-200 space-y-2 border-t py-3 sm:space-y-4 sm:border-l sm:py-2", {
1454
- "pl-8 sm:pl-6": hasMoreOptions
1455
- }),
1456
- children: [/*#__PURE__*/jsx(Typography, {
1457
- className: "neeto-ui-text-gray-800",
1458
- lineHeight: "normal",
1459
- style: "body2",
1460
- weight: "medium",
1461
- children: t("neetoMolecules.shareViaLink.socialMediaShare.title")
1462
- }), /*#__PURE__*/jsx("div", {
1463
- className: "flex gap-4",
1464
- children: Object.entries(SOCIAL_MEDIA_OPTIONS).map(function (_ref3) {
1465
- var _ref4 = _slicedToArray(_ref3, 2),
1466
- key = _ref4[0],
1467
- _ref4$ = _ref4[1],
1468
- label = _ref4$.label,
1469
- Icon = _ref4$.icon,
1470
- generateShareUrl = _ref4$.generateShareUrl;
1471
- return /*#__PURE__*/jsx("a", {
1472
- className: socialMediaButtonClasses,
1668
+ var title = (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.pageTitle) || (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardTitle) || t("neetoMolecules.shareViaLink.socialMediaShare.title");
1669
+ var description = (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.pageDescription) || (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardDescription) || t("neetoMolecules.shareViaLink.socialMediaShare.description");
1670
+ return /*#__PURE__*/jsxs(Container, {
1671
+ className: "neeto-molecules-social-share-landing-page py-8",
1672
+ children: [/*#__PURE__*/jsx(Button, {
1673
+ className: "mb-4",
1674
+ "data-cy": "back-button",
1675
+ "data-testid": "back-button",
1676
+ icon: LeftArrow,
1677
+ iconPosition: "left",
1678
+ label: t("neetoMolecules.productEmbed.backToShare"),
1679
+ size: "small",
1680
+ style: "link",
1681
+ to: shareUrl
1682
+ }), /*#__PURE__*/jsx(Header$1, {
1683
+ className: "py-0",
1684
+ title: t("neetoMolecules.shareViaLink.socialMediaShare.title")
1685
+ }), /*#__PURE__*/jsx(CardLayout, {
1686
+ description: description,
1687
+ title: title,
1688
+ actionBlock: /*#__PURE__*/jsx("div", {
1689
+ className: "flex flex-wrap items-center gap-3",
1690
+ children: Object.entries(SOCIAL_MEDIA_OPTIONS).map(function (_ref2) {
1691
+ var _ref3 = _slicedToArray(_ref2, 2),
1692
+ key = _ref3[0],
1693
+ _ref3$ = _ref3[1],
1694
+ label = _ref3$.label,
1695
+ Icon = _ref3$.icon,
1696
+ generateShareUrl = _ref3$.generateShareUrl;
1697
+ return /*#__PURE__*/createElement(Button, {
1698
+ label: label,
1473
1699
  "data-cy": "social-media-button-".concat(key),
1474
1700
  "data-testid": "social-media-button-".concat(key),
1475
- href: generateShareUrl({
1476
- url: url,
1477
- title: postTitle
1478
- }),
1701
+ icon: Icon,
1702
+ iconPosition: "right",
1703
+ key: key,
1479
1704
  rel: "noopener noreferrer",
1705
+ style: "tertiary",
1480
1706
  target: "_blank",
1481
- title: label,
1482
- children: /*#__PURE__*/jsx(Icon, {
1483
- size: 24
1707
+ href: generateShareUrl({
1708
+ url: url,
1709
+ title: socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.postTitle
1484
1710
  })
1485
- }, key);
1711
+ }, /*#__PURE__*/jsx(Icon, {
1712
+ size: 24
1713
+ }));
1486
1714
  })
1487
- })]
1488
- }), !disableQRDownload && /*#__PURE__*/jsx(QRCode, {
1489
- entity: entity,
1490
- url: url
1715
+ })
1491
1716
  })]
1492
1717
  });
1493
1718
  };
1494
1719
 
1720
+ /* eslint-disable @bigbinary/neeto/use-common-routes */
1495
1721
  var ShareViaLink = function ShareViaLink(_ref) {
1496
- var _ref$isLoading = _ref.isLoading,
1722
+ var title = _ref.title,
1723
+ description = _ref.description,
1724
+ _ref$isLoading = _ref.isLoading,
1497
1725
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
1498
1726
  _ref$enabledOptions = _ref.enabledOptions,
1499
1727
  enabledOptions = _ref$enabledOptions === void 0 ? {
@@ -1508,46 +1736,79 @@ var ShareViaLink = function ShareViaLink(_ref) {
1508
1736
  handleEdit = _ref$handleEdit === void 0 ? noop : _ref$handleEdit,
1509
1737
  _ref$handleRegenerate = _ref.handleRegenerate,
1510
1738
  handleRegenerate = _ref$handleRegenerate === void 0 ? noop : _ref$handleRegenerate,
1511
- socialMediaPostTitle = _ref.socialMediaPostTitle,
1512
- moreOptions = _ref.moreOptions,
1513
- _ref$isOtherShareOpti = _ref.isOtherShareOptionsEnabled,
1514
- isOtherShareOptionsEnabled = _ref$isOtherShareOpti === void 0 ? true : _ref$isOtherShareOpti,
1515
1739
  _ref$disableShareSoci = _ref.disableShareSocialMedia,
1516
1740
  disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
1517
1741
  _ref$disableQRDownloa = _ref.disableQRDownload,
1518
1742
  disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
1743
+ socialMediaProps = _ref.socialMediaProps,
1744
+ qrCodeProps = _ref.qrCodeProps,
1745
+ moreOptions = _ref.moreOptions,
1519
1746
  _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
1520
- publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry;
1521
- return /*#__PURE__*/jsxs("div", {
1522
- className: "neeto-ui-border-gray-300 neeto-ui-rounded-lg neeto-ui-bg-white col-span-2 space-y-4 border p-6 sm:p-8",
1523
- "data-testid": "share-via-link",
1524
- children: [/*#__PURE__*/jsxs("div", {
1525
- className: "space-y-1",
1526
- children: [/*#__PURE__*/jsx("div", {
1527
- className: "space-y-4",
1528
- children: urls.map(function (urlOption) {
1529
- return /*#__PURE__*/createElement(Link, {
1530
- enabledOptions: enabledOptions,
1531
- entityName: entityName,
1532
- handleEdit: handleEdit,
1533
- handleRegenerate: handleRegenerate,
1534
- isLoading: isLoading,
1535
- editUrlProps: omit(["url"], urlOption),
1536
- key: urlOption.url,
1537
- previewUrl: urlOption.previewUrl,
1538
- url: urlOption.url
1539
- });
1540
- })
1541
- }), isPresent(publicLinkExpiryConfiguration) && /*#__PURE__*/jsx(ExpiryNotice, {
1542
- expiryConfiguration: publicLinkExpiryConfiguration
1543
- })]
1544
- }), isOtherShareOptionsEnabled && /*#__PURE__*/jsx(ShareBlock, {
1545
- disableQRDownload: disableQRDownload,
1546
- disableShareSocialMedia: disableShareSocialMedia,
1547
- entity: entity,
1548
- moreOptions: moreOptions,
1549
- postTitle: socialMediaPostTitle,
1550
- url: urls[0].url
1747
+ publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry,
1748
+ customTopContent = _ref.customTopContent,
1749
+ customBottomContent = _ref.customBottomContent;
1750
+ var _useRouteMatch = useRouteMatch(),
1751
+ sharePath = _useRouteMatch.path,
1752
+ shareUrl = _useRouteMatch.url;
1753
+ return /*#__PURE__*/jsxs(Switch, {
1754
+ children: [/*#__PURE__*/jsx(Route, {
1755
+ exact: true,
1756
+ path: sharePath,
1757
+ render: function render() {
1758
+ return /*#__PURE__*/jsx(MainPanel, {
1759
+ customBottomContent: customBottomContent,
1760
+ customTopContent: customTopContent,
1761
+ description: description,
1762
+ disableQRDownload: disableQRDownload,
1763
+ disableShareSocialMedia: disableShareSocialMedia,
1764
+ enabledOptions: enabledOptions,
1765
+ entity: entity,
1766
+ entityName: entityName,
1767
+ handleEdit: handleEdit,
1768
+ handleRegenerate: handleRegenerate,
1769
+ isLoading: isLoading,
1770
+ moreOptions: moreOptions,
1771
+ publicLinkExpiryConfiguration: publicLinkExpiryConfiguration,
1772
+ qrCodeProps: qrCodeProps,
1773
+ socialMediaProps: socialMediaProps,
1774
+ title: title,
1775
+ urls: urls
1776
+ });
1777
+ }
1778
+ }), /*#__PURE__*/jsx(Route, {
1779
+ exact: true,
1780
+ path: "".concat(sharePath, "/qrcode"),
1781
+ render: function render() {
1782
+ return /*#__PURE__*/jsx(QRCode, {
1783
+ entity: entity,
1784
+ qrCodeProps: qrCodeProps,
1785
+ shareUrl: shareUrl,
1786
+ url: urls[0].url
1787
+ });
1788
+ }
1789
+ }), /*#__PURE__*/jsx(Route, {
1790
+ exact: true,
1791
+ path: "".concat(sharePath, "/social-media"),
1792
+ render: function render() {
1793
+ return /*#__PURE__*/jsx(SocialMedia, {
1794
+ shareUrl: shareUrl,
1795
+ socialMediaProps: socialMediaProps,
1796
+ url: urls[0].url
1797
+ });
1798
+ }
1799
+ }), isPresent(moreOptions) && moreOptions.map(function (_ref2) {
1800
+ var link = _ref2.link,
1801
+ element = _ref2.element,
1802
+ path = _ref2.path;
1803
+ if (!link && !path) return null;
1804
+ return /*#__PURE__*/jsx(Route, {
1805
+ exact: true,
1806
+ path: path || link,
1807
+ children: element
1808
+ }, link);
1809
+ }), /*#__PURE__*/jsx(Route, {
1810
+ component: ErrorPage,
1811
+ path: "*"
1551
1812
  })]
1552
1813
  });
1553
1814
  };