@bigbinary/neeto-molecules 3.16.1-beta → 3.16.2

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,10 +1,8 @@
1
- import { isPresent, noop, slugify } from '@bigbinary/neeto-cist';
2
- import { Link as Link$1, useLocation, useHistory, useRouteMatch, Switch, Route } from 'react-router-dom';
1
+ import { isPresent, slugify, noop } from '@bigbinary/neeto-cist';
2
+ import { omit } from 'ramda';
3
3
  import classnames from 'classnames';
4
4
  import Typography from '@bigbinary/neetoui/Typography';
5
- import { omit } from 'ramda';
6
- import { useTranslation } from 'react-i18next';
7
- import Container from './Container.js';
5
+ import { useTranslation, Trans } from 'react-i18next';
8
6
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
9
7
  import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
10
8
  import React__default, { useRef, useCallback, useEffect, useState, createElement } from 'react';
@@ -21,9 +19,6 @@ import Facebook from '@bigbinary/neeto-icons/Facebook';
21
19
  import Linkedin from '@bigbinary/neeto-icons/Linkedin';
22
20
  import Twitter from '@bigbinary/neeto-icons/Twitter';
23
21
  import * as yup from 'yup';
24
- import _defineProperty from '@babel/runtime/helpers/defineProperty';
25
- import _asyncToGenerator from '@babel/runtime/helpers/asyncToGenerator';
26
- import _regeneratorRuntime from '@babel/runtime/regenerator';
27
22
  import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils/general';
28
23
  import { n } from './inject-css-DmrvuTKK.js';
29
24
  import { dayjs } from '@bigbinary/neeto-commons-frontend/utils';
@@ -32,28 +27,15 @@ import Modal from '@bigbinary/neetoui/Modal';
32
27
  import Input$1 from '@bigbinary/neetoui/Input';
33
28
  import Select from '@bigbinary/neetoui/Select';
34
29
  import DatePicker from '@bigbinary/neetoui/DatePicker';
35
- import Share from '@bigbinary/neeto-icons/Share';
36
- import QrCode from '@bigbinary/neeto-icons/QrCode';
37
- import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
38
- import LeftArrow from '@bigbinary/neeto-icons/LeftArrow';
39
- import CardLayout from './CardLayout.js';
40
- import Header$1 from './Header.js';
41
- import './index-DAYCJu79.js';
42
- import './_commonjsHelpers-BFTU3MAI.js';
30
+ import _defineProperty from '@babel/runtime/helpers/defineProperty';
31
+ import { Link as Link$1 } from 'react-router-dom';
32
+ import '@babel/runtime/helpers/objectWithoutProperties';
43
33
  import '@bigbinary/neeto-icons/Copy';
44
34
  import '@bigbinary/neeto-icons/Check';
45
35
  import '@bigbinary/neeto-icons/MenuHorizontal';
46
36
  import '@bigbinary/neeto-icons/MenuVertical';
47
37
  import '@bigbinary/neetoui/Dropdown';
48
38
  import '@bigbinary/neetoui/Tooltip';
49
- import './Breadcrumbs.js';
50
- import './HelpPopover.js';
51
- import '@bigbinary/neetoui/Popover';
52
- import './Search.js';
53
- import '@bigbinary/neeto-commons-frontend/react-utils/useFuncDebounce';
54
- import '@bigbinary/neeto-commons-frontend/react-utils/useQueryParams';
55
- import '@bigbinary/neeto-commons-frontend/react-utils/useUpdateEffect';
56
- import '@bigbinary/neeto-icons/Search';
57
39
 
58
40
  var ExpiryNotice = function ExpiryNotice(_ref) {
59
41
  var expiryConfiguration = _ref.expiryConfiguration;
@@ -116,49 +98,6 @@ var downloadCanvas = function downloadCanvas(canvas) {
116
98
  element.click();
117
99
  element.remove();
118
100
  };
119
- var copyCanvasToClipboard = /*#__PURE__*/function () {
120
- var _ref4 = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime.mark(function _callee(canvas, handleDownloadQRCode) {
121
- var blob, clipboardItem;
122
- return _regeneratorRuntime.wrap(function _callee$(_context) {
123
- while (1) switch (_context.prev = _context.next) {
124
- case 0:
125
- if (canvas) {
126
- _context.next = 2;
127
- break;
128
- }
129
- return _context.abrupt("return");
130
- case 2:
131
- _context.prev = 2;
132
- _context.next = 5;
133
- return new Promise(function (resolve) {
134
- return canvas.toBlob(resolve);
135
- });
136
- case 5:
137
- blob = _context.sent;
138
- if (blob) {
139
- _context.next = 8;
140
- break;
141
- }
142
- return _context.abrupt("return");
143
- case 8:
144
- clipboardItem = new ClipboardItem(_defineProperty({}, blob.type, blob));
145
- navigator.clipboard.write([clipboardItem]);
146
- _context.next = 15;
147
- break;
148
- case 12:
149
- _context.prev = 12;
150
- _context.t0 = _context["catch"](2);
151
- handleDownloadQRCode();
152
- case 15:
153
- case "end":
154
- return _context.stop();
155
- }
156
- }, _callee, null, [[2, 12]]);
157
- }));
158
- return function copyCanvasToClipboard(_x, _x2) {
159
- return _ref4.apply(this, arguments);
160
- };
161
- }();
162
101
  var getPathname = function getPathname(url) {
163
102
  return new URL(url).pathname.slice(1);
164
103
  };
@@ -198,8 +137,8 @@ var PATH_VALIDATION_SCHEMA = yup.object().shape({
198
137
  path: yup.string().required(t("neetoMolecules.shareViaLink.editUrl.validationError")).matches(/^[A-Za-z0-9]([\w/-])*$/, t("neetoMolecules.shareViaLink.editUrl.validationError"))
199
138
  });
200
139
 
201
- 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}";
202
- n(css$1,{});
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,{});
203
142
 
204
143
  var Header = Pane.Header,
205
144
  Body = Pane.Body,
@@ -456,13 +395,13 @@ var Link = function Link(_ref) {
456
395
  "data-cy": "link-block",
457
396
  "data-testid": "link-block",
458
397
  children: /*#__PURE__*/jsxs("div", {
459
- className: "flex flex-col gap-2 sm:flex-row sm:items-center",
398
+ className: "flex flex-col gap-2 sm:flex-row sm:items-center sm:gap-1",
460
399
  children: [/*#__PURE__*/jsx("div", {
461
- className: "neeto-ui-rounded-md neeto-ui-border-gray-300 relative min-w-0 flex-grow truncate border p-2 leading-none",
400
+ className: "neeto-ui-rounded-md neeto-ui-border-gray-200 relative min-w-0 flex-grow truncate border p-2 leading-none",
462
401
  "data-cy": "nui-input-field",
463
402
  children: url
464
403
  }), /*#__PURE__*/jsxs("div", {
465
- className: "flex w-full flex-shrink-0 items-center gap-2 sm:w-auto",
404
+ className: "flex w-full flex-shrink-0 items-center gap-1 sm:w-auto",
466
405
  children: [/*#__PURE__*/jsx(CopyToClipboardButton, {
467
406
  "data-cy": "link-copy-button",
468
407
  "data-testid": "link-copy-button",
@@ -528,187 +467,6 @@ var Link = function Link(_ref) {
528
467
  });
529
468
  };
530
469
 
531
- var _excluded = ["title", "link", "description", "Icon", "onClick"];
532
- 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; }
533
- 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; }
534
- var Card = function Card(_ref) {
535
- var title = _ref.title,
536
- link = _ref.link,
537
- description = _ref.description,
538
- Icon = _ref.Icon,
539
- _ref$onClick = _ref.onClick,
540
- onClick = _ref$onClick === void 0 ? noop : _ref$onClick,
541
- otherProps = _objectWithoutProperties(_ref, _excluded);
542
- var Component = isPresent(link) ? Link$1 : "div";
543
- return /*#__PURE__*/jsxs(Component, _objectSpread(_objectSpread({
544
- onClick: onClick,
545
- 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",
546
- to: link
547
- }, otherProps), {}, {
548
- children: [/*#__PURE__*/jsxs("div", {
549
- className: "flex items-center gap-2",
550
- children: [Icon && /*#__PURE__*/jsx(Icon, {
551
- className: "neeto-ui-text-gray-500 flex-shrink-0",
552
- size: 24
553
- }), /*#__PURE__*/jsx(Typography, {
554
- className: "min-w-0 flex-grow break-words",
555
- style: "h5",
556
- children: title
557
- })]
558
- }), description && /*#__PURE__*/jsx(Typography, {
559
- className: "break-words",
560
- lineHeight: "normal",
561
- style: "body2",
562
- children: description
563
- })]
564
- }));
565
- };
566
-
567
- var ShareBlock = function ShareBlock(_ref) {
568
- var moreOptions = _ref.moreOptions,
569
- disableShareSocialMedia = _ref.disableShareSocialMedia,
570
- disableQRDownload = _ref.disableQRDownload,
571
- socialMediaProps = _ref.socialMediaProps,
572
- qrCodeProps = _ref.qrCodeProps,
573
- entity = _ref.entity;
574
- var location = useLocation();
575
- var history = useHistory();
576
- var _useTranslation = useTranslation(),
577
- t = _useTranslation.t;
578
- var handleNavigate = function handleNavigate(subPath) {
579
- // eslint-disable-next-line @bigbinary/neeto/use-common-routes
580
- history.push("".concat(location.pathname, "/").concat(subPath));
581
- };
582
- var hasMoreOptions = isPresent(moreOptions);
583
- return /*#__PURE__*/jsxs("div", {
584
- 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",
585
- children: [hasMoreOptions && moreOptions.map(function (_ref2) {
586
- var title = _ref2.title,
587
- link = _ref2.link,
588
- Icon = _ref2.icon,
589
- onClick = _ref2.onClick,
590
- dataCy = _ref2.dataCy,
591
- description = _ref2.description;
592
- return /*#__PURE__*/createElement(Card, {
593
- Icon: Icon,
594
- description: description,
595
- link: link,
596
- onClick: onClick,
597
- title: title,
598
- "data-cy": dataCy,
599
- "data-testid": dataCy,
600
- key: link
601
- });
602
- }), !disableShareSocialMedia && /*#__PURE__*/jsx(Card, {
603
- Icon: Share,
604
- "data-cy": "social-share-card",
605
- "data-testid": "social-share-card",
606
- description: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardDescription) || t("neetoMolecules.shareViaLink.socialMediaShare.description"),
607
- title: (socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.cardTitle) || t("neetoMolecules.shareViaLink.socialMediaShare.title"),
608
- onClick: function onClick() {
609
- return handleNavigate("social-media");
610
- }
611
- }), !disableQRDownload && entity && /*#__PURE__*/jsx(Card, {
612
- Icon: QrCode,
613
- "data-cy": "qr-code-card",
614
- "data-testid": "qr-code-card",
615
- description: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardDescription) || t("neetoMolecules.shareViaLink.qrCode.description"),
616
- title: (qrCodeProps === null || qrCodeProps === void 0 ? void 0 : qrCodeProps.cardTitle) || t("neetoMolecules.shareViaLink.qrCode.title"),
617
- onClick: function onClick() {
618
- return handleNavigate("qrcode");
619
- }
620
- })]
621
- });
622
- };
623
-
624
- var MainPanel = function MainPanel(_ref) {
625
- var title = _ref.title,
626
- description = _ref.description,
627
- qrCodeProps = _ref.qrCodeProps,
628
- socialMediaProps = _ref.socialMediaProps,
629
- _ref$isLoading = _ref.isLoading,
630
- isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
631
- _ref$enabledOptions = _ref.enabledOptions,
632
- enabledOptions = _ref$enabledOptions === void 0 ? {
633
- regenerate: false,
634
- edit: false
635
- } : _ref$enabledOptions,
636
- _ref$urls = _ref.urls,
637
- urls = _ref$urls === void 0 ? [] : _ref$urls,
638
- entity = _ref.entity,
639
- entityName = _ref.entityName,
640
- _ref$handleEdit = _ref.handleEdit,
641
- handleEdit = _ref$handleEdit === void 0 ? noop : _ref$handleEdit,
642
- _ref$handleRegenerate = _ref.handleRegenerate,
643
- handleRegenerate = _ref$handleRegenerate === void 0 ? noop : _ref$handleRegenerate,
644
- moreOptions = _ref.moreOptions,
645
- _ref$disableShareSoci = _ref.disableShareSocialMedia,
646
- disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
647
- _ref$disableQRDownloa = _ref.disableQRDownload,
648
- disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
649
- _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
650
- publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry;
651
- var _useTranslation = useTranslation(),
652
- t = _useTranslation.t;
653
- var shouldShowShareBlock = !disableQRDownload || !disableShareSocialMedia || isPresent(moreOptions);
654
- return /*#__PURE__*/jsx(Container, {
655
- className: "neeto-ui-bg-gray-100 neeto-molecule-share-landing-page",
656
- children: /*#__PURE__*/jsxs("div", {
657
- className: "mx-auto w-full max-w-5xl py-10",
658
- children: [/*#__PURE__*/jsx(Typography, {
659
- "data-cy": "share-your-meeting-heading",
660
- lineHeight: "tight",
661
- style: "h2",
662
- className: classnames({
663
- "mb-2": isPresent(description),
664
- "mb-6": !isPresent(description)
665
- }),
666
- children: title || t("neetoMolecules.shareViaLink.title", {
667
- productName: globalProps.appName
668
- })
669
- }), description && /*#__PURE__*/jsx(Typography, {
670
- className: "mb-6",
671
- "data-cy": "share-your-meeting-heading",
672
- lineHeight: "normal",
673
- style: "body1",
674
- children: description
675
- }), /*#__PURE__*/jsxs("div", {
676
- className: "neeto-ui-rounded-lg neeto-ui-bg-white p-6 sm:p-8",
677
- "data-testid": "share-via-link",
678
- children: [/*#__PURE__*/jsxs("div", {
679
- className: "space-y-1",
680
- children: [/*#__PURE__*/jsx("div", {
681
- className: "space-y-4",
682
- children: urls.map(function (urlOption) {
683
- return /*#__PURE__*/createElement(Link, {
684
- enabledOptions: enabledOptions,
685
- entityName: entityName,
686
- handleEdit: handleEdit,
687
- handleRegenerate: handleRegenerate,
688
- isLoading: isLoading,
689
- editUrlProps: omit(["url"], urlOption),
690
- key: urlOption.url,
691
- previewUrl: urlOption.previewUrl,
692
- url: urlOption.url
693
- });
694
- })
695
- }), isPresent(publicLinkExpiryConfiguration) && /*#__PURE__*/jsx(ExpiryNotice, {
696
- expiryConfiguration: publicLinkExpiryConfiguration
697
- })]
698
- }), shouldShowShareBlock && /*#__PURE__*/jsx(ShareBlock, {
699
- disableQRDownload: disableQRDownload,
700
- disableShareSocialMedia: disableShareSocialMedia,
701
- entity: entity,
702
- moreOptions: moreOptions,
703
- qrCodeProps: qrCodeProps,
704
- socialMediaProps: socialMediaProps,
705
- url: urls[0].url
706
- })]
707
- })]
708
- })
709
- });
710
- };
711
-
712
470
  var __defProp = Object.defineProperty;
713
471
  var __getOwnPropSymbols = Object.getOwnPropertySymbols;
714
472
  var __hasOwnProp = Object.prototype.hasOwnProperty;
@@ -1570,144 +1328,172 @@ var QRCode$1 = (props) => {
1570
1328
 
1571
1329
  var QRCode = function QRCode(_ref) {
1572
1330
  var entity = _ref.entity,
1573
- qrCodeProps = _ref.qrCodeProps,
1574
- url = _ref.url,
1575
- shareUrl = _ref.shareUrl;
1576
- var _useTranslation = useTranslation(),
1577
- t = _useTranslation.t;
1331
+ url = _ref.url;
1578
1332
  if (!entity) return null;
1579
1333
  var id = entity.id,
1580
1334
  name = entity.name;
1581
1335
  var canvasId = "qrcode-share-".concat(id);
1582
- var handleDownloadQRCode = function handleDownloadQRCode() {
1336
+ var handleDownload = function handleDownload() {
1583
1337
  var canvas = document.getElementById(canvasId);
1584
1338
  if (canvas) downloadCanvas(canvas, {
1585
1339
  name: slugify(name)
1586
1340
  });
1587
1341
  };
1588
- var handleCopyQRCode = function handleCopyQRCode() {
1589
- var canvas = document.getElementById(canvasId);
1590
- if (canvas) copyCanvasToClipboard(canvas, handleDownloadQRCode);
1591
- };
1592
- 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");
1593
- 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");
1594
- return /*#__PURE__*/jsxs(Container, {
1595
- className: "neeto-molecules-embed-qr-code-landing-page py-8",
1596
- children: [/*#__PURE__*/jsx(Button, {
1597
- className: "mb-4",
1598
- "data-cy": "back-button",
1599
- "data-testid": "back-button",
1600
- icon: LeftArrow,
1601
- iconPosition: "left",
1602
- label: t("neetoMolecules.productEmbed.backToShare"),
1603
- size: "small",
1604
- style: "link",
1605
- to: shareUrl
1606
- }), /*#__PURE__*/jsx(Header$1, {
1607
- className: "py-0",
1608
- title: t("neetoMolecules.shareViaLink.qrCode.title")
1609
- }), /*#__PURE__*/jsx(CardLayout, {
1610
- description: description,
1611
- title: title,
1612
- actionBlock: /*#__PURE__*/jsxs("div", {
1613
- className: "flex flex-wrap items-center gap-3",
1614
- children: [/*#__PURE__*/jsx(Button, {
1615
- "data-cy": "qr-code-download-button",
1616
- "data-testid": "qr-code-download-button",
1617
- label: t("neetoMolecules.shareViaLink.qrCode.download"),
1618
- style: "primary",
1619
- onClick: handleDownloadQRCode
1620
- }), /*#__PURE__*/jsx(CopyToClipboardButton, {
1621
- "data-cy": "qr-code-copy-button",
1622
- "data-testid": "qr-code-copy-button",
1623
- label: t("neetoMolecules.shareViaLink.qrCode.copy"),
1624
- style: "secondary",
1625
- onClick: handleCopyQRCode
1626
- })]
1627
- }),
1628
- children: /*#__PURE__*/jsx(QRCode$1, {
1629
- className: "mt-6 cursor-pointer",
1630
- "data-cy": "qr-code-image",
1631
- "data-testid": "qr-code-image",
1632
- id: canvasId,
1633
- size: 160,
1634
- style: {
1635
- width: 160,
1636
- height: 160
1637
- },
1638
- value: url,
1639
- onClick: handleDownloadQRCode
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
+ }
1640
1360
  })
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
1641
1373
  })]
1642
1374
  });
1643
1375
  };
1644
1376
 
1645
- 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}";
1646
- n(css,{});
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
+ };
1647
1400
 
1648
- var SocialMedia = function SocialMedia(_ref) {
1649
- var socialMediaProps = _ref.socialMediaProps,
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,
1650
1406
  url = _ref.url,
1651
- shareUrl = _ref.shareUrl;
1407
+ moreOptions = _ref.moreOptions,
1408
+ disableShareSocialMedia = _ref.disableShareSocialMedia,
1409
+ disableQRDownload = _ref.disableQRDownload;
1652
1410
  var _useTranslation = useTranslation(),
1653
1411
  t = _useTranslation.t;
1654
- 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");
1655
- 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");
1656
- return /*#__PURE__*/jsxs(Container, {
1657
- className: "neeto-molecules-social-share-landing-page py-8",
1658
- children: [/*#__PURE__*/jsx(Button, {
1659
- className: "mb-4",
1660
- "data-cy": "back-button",
1661
- "data-testid": "back-button",
1662
- icon: LeftArrow,
1663
- iconPosition: "left",
1664
- label: t("neetoMolecules.productEmbed.backToShare"),
1665
- size: "small",
1666
- style: "link",
1667
- to: shareUrl
1668
- }), /*#__PURE__*/jsx(Header$1, {
1669
- className: "py-0",
1670
- title: t("neetoMolecules.shareViaLink.socialMediaShare.title")
1671
- }), /*#__PURE__*/jsx(CardLayout, {
1672
- description: description,
1673
- title: title,
1674
- actionBlock: /*#__PURE__*/jsx("div", {
1675
- className: "flex flex-wrap items-center gap-3",
1676
- children: Object.entries(SOCIAL_MEDIA_OPTIONS).map(function (_ref2) {
1677
- var _ref3 = _slicedToArray(_ref2, 2),
1678
- key = _ref3[0],
1679
- _ref3$ = _ref3[1],
1680
- label = _ref3$.label,
1681
- Icon = _ref3$.icon,
1682
- generateShareUrl = _ref3$.generateShareUrl;
1683
- return /*#__PURE__*/createElement(Button, {
1684
- label: label,
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,
1685
1473
  "data-cy": "social-media-button-".concat(key),
1686
1474
  "data-testid": "social-media-button-".concat(key),
1687
- icon: Icon,
1688
- iconPosition: "right",
1689
- key: key,
1690
- rel: "noopener noreferrer",
1691
- style: "tertiary",
1692
- target: "_blank",
1693
1475
  href: generateShareUrl({
1694
1476
  url: url,
1695
- title: socialMediaProps === null || socialMediaProps === void 0 ? void 0 : socialMediaProps.postTitle
1477
+ title: postTitle
1478
+ }),
1479
+ rel: "noopener noreferrer",
1480
+ target: "_blank",
1481
+ title: label,
1482
+ children: /*#__PURE__*/jsx(Icon, {
1483
+ size: 24
1696
1484
  })
1697
- }, /*#__PURE__*/jsx(Icon, {
1698
- size: 24
1699
- }));
1485
+ }, key);
1700
1486
  })
1701
- })
1487
+ })]
1488
+ }), !disableQRDownload && /*#__PURE__*/jsx(QRCode, {
1489
+ entity: entity,
1490
+ url: url
1702
1491
  })]
1703
1492
  });
1704
1493
  };
1705
1494
 
1706
- /* eslint-disable @bigbinary/neeto/use-common-routes */
1707
1495
  var ShareViaLink = function ShareViaLink(_ref) {
1708
- var title = _ref.title,
1709
- description = _ref.description,
1710
- _ref$isLoading = _ref.isLoading,
1496
+ var _ref$isLoading = _ref.isLoading,
1711
1497
  isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
1712
1498
  _ref$enabledOptions = _ref.enabledOptions,
1713
1499
  enabledOptions = _ref$enabledOptions === void 0 ? {
@@ -1722,71 +1508,46 @@ var ShareViaLink = function ShareViaLink(_ref) {
1722
1508
  handleEdit = _ref$handleEdit === void 0 ? noop : _ref$handleEdit,
1723
1509
  _ref$handleRegenerate = _ref.handleRegenerate,
1724
1510
  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,
1725
1515
  _ref$disableShareSoci = _ref.disableShareSocialMedia,
1726
1516
  disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
1727
1517
  _ref$disableQRDownloa = _ref.disableQRDownload,
1728
1518
  disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
1729
- socialMediaProps = _ref.socialMediaProps,
1730
- qrCodeProps = _ref.qrCodeProps,
1731
- moreOptions = _ref.moreOptions,
1732
1519
  _ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
1733
1520
  publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry;
1734
- var _useRouteMatch = useRouteMatch(),
1735
- sharePath = _useRouteMatch.path,
1736
- shareUrl = _useRouteMatch.url;
1737
- return /*#__PURE__*/jsxs(Switch, {
1738
- children: [/*#__PURE__*/jsx(Route, {
1739
- exact: true,
1740
- path: sharePath,
1741
- render: function render() {
1742
- return /*#__PURE__*/jsx(MainPanel, {
1743
- description: description,
1744
- disableQRDownload: disableQRDownload,
1745
- disableShareSocialMedia: disableShareSocialMedia,
1746
- enabledOptions: enabledOptions,
1747
- entity: entity,
1748
- entityName: entityName,
1749
- handleEdit: handleEdit,
1750
- handleRegenerate: handleRegenerate,
1751
- isLoading: isLoading,
1752
- moreOptions: moreOptions,
1753
- publicLinkExpiryConfiguration: publicLinkExpiryConfiguration,
1754
- qrCodeProps: qrCodeProps,
1755
- socialMediaProps: socialMediaProps,
1756
- title: title,
1757
- urls: urls
1758
- });
1759
- }
1760
- }), /*#__PURE__*/jsx(Route, {
1761
- exact: true,
1762
- path: "".concat(sharePath, "/qrcode"),
1763
- render: function render() {
1764
- return /*#__PURE__*/jsx(QRCode, {
1765
- entity: entity,
1766
- qrCodeProps: qrCodeProps,
1767
- shareUrl: shareUrl,
1768
- url: urls[0].url
1769
- });
1770
- }
1771
- }), /*#__PURE__*/jsx(Route, {
1772
- exact: true,
1773
- path: "".concat(sharePath, "/social-media"),
1774
- render: function render() {
1775
- return /*#__PURE__*/jsx(SocialMedia, {
1776
- shareUrl: shareUrl,
1777
- socialMediaProps: socialMediaProps,
1778
- url: urls[0].url
1779
- });
1780
- }
1781
- }), isPresent(moreOptions) && moreOptions.map(function (_ref2) {
1782
- var link = _ref2.link,
1783
- element = _ref2.element;
1784
- if (!isPresent(link)) return null;
1785
- return /*#__PURE__*/jsx(Route, {
1786
- exact: true,
1787
- path: link,
1788
- children: element
1789
- }, link);
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
1790
1551
  })]
1791
1552
  });
1792
1553
  };