@bigbinary/neeto-molecules 3.16.2-beta-2 → 3.16.3
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.
- package/dist/CardLayout.js +3 -3
- package/dist/CardLayout.js.map +1 -1
- package/dist/Container.js +1 -1
- package/dist/CopyToClipboardButton.js +2 -3
- package/dist/CopyToClipboardButton.js.map +1 -1
- package/dist/ProductEmbed.js +302 -985
- package/dist/ProductEmbed.js.map +1 -1
- package/dist/Settings.js +5 -1
- package/dist/Settings.js.map +1 -1
- package/dist/ShareViaLink.js +183 -429
- package/dist/ShareViaLink.js.map +1 -1
- package/dist/cjs/CardLayout.js +3 -3
- package/dist/cjs/CardLayout.js.map +1 -1
- package/dist/cjs/Container.js +1 -1
- package/dist/cjs/CopyToClipboardButton.js +2 -3
- package/dist/cjs/CopyToClipboardButton.js.map +1 -1
- package/dist/cjs/ProductEmbed.js +301 -984
- package/dist/cjs/ProductEmbed.js.map +1 -1
- package/dist/cjs/Settings.js +5 -1
- package/dist/cjs/Settings.js.map +1 -1
- package/dist/cjs/ShareViaLink.js +181 -427
- package/dist/cjs/ShareViaLink.js.map +1 -1
- package/package.json +1 -1
- package/src/translations/en.json +40 -48
- package/types/ProductEmbed.d.ts +0 -1
- package/types/ShareViaLink.d.ts +28 -28
package/dist/ShareViaLink.js
CHANGED
|
@@ -1,10 +1,8 @@
|
|
|
1
|
-
import { isPresent,
|
|
2
|
-
import {
|
|
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 {
|
|
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
|
|
36
|
-
import
|
|
37
|
-
import
|
|
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
|
|
202
|
-
n(css
|
|
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-
|
|
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-
|
|
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,189 +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
|
-
customTopContent = _ref.customTopContent,
|
|
652
|
-
customBottomContent = _ref.customBottomContent;
|
|
653
|
-
var _useTranslation = useTranslation(),
|
|
654
|
-
t = _useTranslation.t;
|
|
655
|
-
var shouldShowShareBlock = !disableQRDownload || !disableShareSocialMedia || isPresent(moreOptions);
|
|
656
|
-
return /*#__PURE__*/jsx(Container, {
|
|
657
|
-
className: "neeto-ui-bg-gray-100 neeto-molecule-share-landing-page",
|
|
658
|
-
children: /*#__PURE__*/jsxs("div", {
|
|
659
|
-
className: "mx-auto w-full max-w-5xl py-10",
|
|
660
|
-
children: [customTopContent, /*#__PURE__*/jsx(Typography, {
|
|
661
|
-
"data-cy": "share-your-meeting-heading",
|
|
662
|
-
lineHeight: "tight",
|
|
663
|
-
style: "h2",
|
|
664
|
-
className: classnames({
|
|
665
|
-
"mb-2": isPresent(description),
|
|
666
|
-
"mb-6": !isPresent(description)
|
|
667
|
-
}),
|
|
668
|
-
children: title || t("neetoMolecules.shareViaLink.title", {
|
|
669
|
-
productName: globalProps.appName
|
|
670
|
-
})
|
|
671
|
-
}), description && /*#__PURE__*/jsx(Typography, {
|
|
672
|
-
className: "mb-6",
|
|
673
|
-
"data-cy": "share-your-meeting-heading",
|
|
674
|
-
lineHeight: "normal",
|
|
675
|
-
style: "body1",
|
|
676
|
-
children: description
|
|
677
|
-
}), /*#__PURE__*/jsxs("div", {
|
|
678
|
-
className: "neeto-ui-rounded-lg neeto-ui-bg-white p-6 sm:p-8",
|
|
679
|
-
"data-testid": "share-via-link",
|
|
680
|
-
children: [/*#__PURE__*/jsxs("div", {
|
|
681
|
-
className: "space-y-1",
|
|
682
|
-
children: [/*#__PURE__*/jsx("div", {
|
|
683
|
-
className: "space-y-4",
|
|
684
|
-
children: urls.map(function (urlOption) {
|
|
685
|
-
return /*#__PURE__*/createElement(Link, {
|
|
686
|
-
enabledOptions: enabledOptions,
|
|
687
|
-
entityName: entityName,
|
|
688
|
-
handleEdit: handleEdit,
|
|
689
|
-
handleRegenerate: handleRegenerate,
|
|
690
|
-
isLoading: isLoading,
|
|
691
|
-
editUrlProps: omit(["url"], urlOption),
|
|
692
|
-
key: urlOption.url,
|
|
693
|
-
previewUrl: urlOption.previewUrl,
|
|
694
|
-
url: urlOption.url
|
|
695
|
-
});
|
|
696
|
-
})
|
|
697
|
-
}), isPresent(publicLinkExpiryConfiguration) && /*#__PURE__*/jsx(ExpiryNotice, {
|
|
698
|
-
expiryConfiguration: publicLinkExpiryConfiguration
|
|
699
|
-
})]
|
|
700
|
-
}), shouldShowShareBlock && /*#__PURE__*/jsx(ShareBlock, {
|
|
701
|
-
disableQRDownload: disableQRDownload,
|
|
702
|
-
disableShareSocialMedia: disableShareSocialMedia,
|
|
703
|
-
entity: entity,
|
|
704
|
-
moreOptions: moreOptions,
|
|
705
|
-
qrCodeProps: qrCodeProps,
|
|
706
|
-
socialMediaProps: socialMediaProps,
|
|
707
|
-
url: urls[0].url
|
|
708
|
-
})]
|
|
709
|
-
}), customBottomContent]
|
|
710
|
-
})
|
|
711
|
-
});
|
|
712
|
-
};
|
|
713
|
-
|
|
714
470
|
var __defProp = Object.defineProperty;
|
|
715
471
|
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
716
472
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
@@ -1572,144 +1328,172 @@ var QRCode$1 = (props) => {
|
|
|
1572
1328
|
|
|
1573
1329
|
var QRCode = function QRCode(_ref) {
|
|
1574
1330
|
var entity = _ref.entity,
|
|
1575
|
-
|
|
1576
|
-
url = _ref.url,
|
|
1577
|
-
shareUrl = _ref.shareUrl;
|
|
1578
|
-
var _useTranslation = useTranslation(),
|
|
1579
|
-
t = _useTranslation.t;
|
|
1331
|
+
url = _ref.url;
|
|
1580
1332
|
if (!entity) return null;
|
|
1581
1333
|
var id = entity.id,
|
|
1582
1334
|
name = entity.name;
|
|
1583
1335
|
var canvasId = "qrcode-share-".concat(id);
|
|
1584
|
-
var
|
|
1336
|
+
var handleDownload = function handleDownload() {
|
|
1585
1337
|
var canvas = document.getElementById(canvasId);
|
|
1586
1338
|
if (canvas) downloadCanvas(canvas, {
|
|
1587
1339
|
name: slugify(name)
|
|
1588
1340
|
});
|
|
1589
1341
|
};
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1602
|
-
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
|
|
1606
|
-
|
|
1607
|
-
|
|
1608
|
-
}), /*#__PURE__*/jsx(Header$1, {
|
|
1609
|
-
className: "py-0",
|
|
1610
|
-
title: t("neetoMolecules.shareViaLink.qrCode.title")
|
|
1611
|
-
}), /*#__PURE__*/jsx(CardLayout, {
|
|
1612
|
-
description: description,
|
|
1613
|
-
title: title,
|
|
1614
|
-
actionBlock: /*#__PURE__*/jsxs("div", {
|
|
1615
|
-
className: "flex flex-wrap items-center gap-3",
|
|
1616
|
-
children: [/*#__PURE__*/jsx(Button, {
|
|
1617
|
-
"data-cy": "qr-code-download-button",
|
|
1618
|
-
"data-testid": "qr-code-download-button",
|
|
1619
|
-
label: t("neetoMolecules.shareViaLink.qrCode.download"),
|
|
1620
|
-
style: "primary",
|
|
1621
|
-
onClick: handleDownloadQRCode
|
|
1622
|
-
}), /*#__PURE__*/jsx(CopyToClipboardButton, {
|
|
1623
|
-
"data-cy": "qr-code-copy-button",
|
|
1624
|
-
"data-testid": "qr-code-copy-button",
|
|
1625
|
-
label: t("neetoMolecules.shareViaLink.qrCode.copy"),
|
|
1626
|
-
style: "secondary",
|
|
1627
|
-
onClick: handleCopyQRCode
|
|
1628
|
-
})]
|
|
1629
|
-
}),
|
|
1630
|
-
children: /*#__PURE__*/jsx(QRCode$1, {
|
|
1631
|
-
className: "mt-6 cursor-pointer",
|
|
1632
|
-
"data-cy": "qr-code-image",
|
|
1633
|
-
"data-testid": "qr-code-image",
|
|
1634
|
-
id: canvasId,
|
|
1635
|
-
size: 160,
|
|
1636
|
-
style: {
|
|
1637
|
-
width: 160,
|
|
1638
|
-
height: 160
|
|
1639
|
-
},
|
|
1640
|
-
value: url,
|
|
1641
|
-
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
|
+
}
|
|
1642
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
|
|
1643
1373
|
})]
|
|
1644
1374
|
});
|
|
1645
1375
|
};
|
|
1646
1376
|
|
|
1647
|
-
var
|
|
1648
|
-
|
|
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
|
+
};
|
|
1649
1400
|
|
|
1650
|
-
var
|
|
1651
|
-
|
|
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,
|
|
1652
1406
|
url = _ref.url,
|
|
1653
|
-
|
|
1407
|
+
moreOptions = _ref.moreOptions,
|
|
1408
|
+
disableShareSocialMedia = _ref.disableShareSocialMedia,
|
|
1409
|
+
disableQRDownload = _ref.disableQRDownload;
|
|
1654
1410
|
var _useTranslation = useTranslation(),
|
|
1655
1411
|
t = _useTranslation.t;
|
|
1656
|
-
var
|
|
1657
|
-
var
|
|
1658
|
-
return /*#__PURE__*/jsxs(
|
|
1659
|
-
className: "
|
|
1660
|
-
children: [/*#__PURE__*/jsx(
|
|
1661
|
-
className: "
|
|
1662
|
-
|
|
1663
|
-
|
|
1664
|
-
|
|
1665
|
-
|
|
1666
|
-
|
|
1667
|
-
|
|
1668
|
-
|
|
1669
|
-
|
|
1670
|
-
|
|
1671
|
-
|
|
1672
|
-
|
|
1673
|
-
|
|
1674
|
-
|
|
1675
|
-
|
|
1676
|
-
|
|
1677
|
-
|
|
1678
|
-
|
|
1679
|
-
|
|
1680
|
-
|
|
1681
|
-
|
|
1682
|
-
|
|
1683
|
-
|
|
1684
|
-
|
|
1685
|
-
|
|
1686
|
-
|
|
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,
|
|
1687
1473
|
"data-cy": "social-media-button-".concat(key),
|
|
1688
1474
|
"data-testid": "social-media-button-".concat(key),
|
|
1689
|
-
icon: Icon,
|
|
1690
|
-
iconPosition: "right",
|
|
1691
|
-
key: key,
|
|
1692
|
-
rel: "noopener noreferrer",
|
|
1693
|
-
style: "tertiary",
|
|
1694
|
-
target: "_blank",
|
|
1695
1475
|
href: generateShareUrl({
|
|
1696
1476
|
url: url,
|
|
1697
|
-
title:
|
|
1477
|
+
title: postTitle
|
|
1478
|
+
}),
|
|
1479
|
+
rel: "noopener noreferrer",
|
|
1480
|
+
target: "_blank",
|
|
1481
|
+
title: label,
|
|
1482
|
+
children: /*#__PURE__*/jsx(Icon, {
|
|
1483
|
+
size: 24
|
|
1698
1484
|
})
|
|
1699
|
-
},
|
|
1700
|
-
size: 24
|
|
1701
|
-
}));
|
|
1485
|
+
}, key);
|
|
1702
1486
|
})
|
|
1703
|
-
})
|
|
1487
|
+
})]
|
|
1488
|
+
}), !disableQRDownload && /*#__PURE__*/jsx(QRCode, {
|
|
1489
|
+
entity: entity,
|
|
1490
|
+
url: url
|
|
1704
1491
|
})]
|
|
1705
1492
|
});
|
|
1706
1493
|
};
|
|
1707
1494
|
|
|
1708
|
-
/* eslint-disable @bigbinary/neeto/use-common-routes */
|
|
1709
1495
|
var ShareViaLink = function ShareViaLink(_ref) {
|
|
1710
|
-
var
|
|
1711
|
-
description = _ref.description,
|
|
1712
|
-
_ref$isLoading = _ref.isLoading,
|
|
1496
|
+
var _ref$isLoading = _ref.isLoading,
|
|
1713
1497
|
isLoading = _ref$isLoading === void 0 ? false : _ref$isLoading,
|
|
1714
1498
|
_ref$enabledOptions = _ref.enabledOptions,
|
|
1715
1499
|
enabledOptions = _ref$enabledOptions === void 0 ? {
|
|
@@ -1724,76 +1508,46 @@ var ShareViaLink = function ShareViaLink(_ref) {
|
|
|
1724
1508
|
handleEdit = _ref$handleEdit === void 0 ? noop : _ref$handleEdit,
|
|
1725
1509
|
_ref$handleRegenerate = _ref.handleRegenerate,
|
|
1726
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,
|
|
1727
1515
|
_ref$disableShareSoci = _ref.disableShareSocialMedia,
|
|
1728
1516
|
disableShareSocialMedia = _ref$disableShareSoci === void 0 ? false : _ref$disableShareSoci,
|
|
1729
1517
|
_ref$disableQRDownloa = _ref.disableQRDownload,
|
|
1730
1518
|
disableQRDownload = _ref$disableQRDownloa === void 0 ? false : _ref$disableQRDownloa,
|
|
1731
|
-
socialMediaProps = _ref.socialMediaProps,
|
|
1732
|
-
qrCodeProps = _ref.qrCodeProps,
|
|
1733
|
-
moreOptions = _ref.moreOptions,
|
|
1734
1519
|
_ref$publicLinkExpiry = _ref.publicLinkExpiryConfiguration,
|
|
1735
|
-
publicLinkExpiryConfiguration = _ref$publicLinkExpiry === void 0 ? {} : _ref$publicLinkExpiry
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
|
|
1745
|
-
|
|
1746
|
-
|
|
1747
|
-
|
|
1748
|
-
|
|
1749
|
-
|
|
1750
|
-
|
|
1751
|
-
|
|
1752
|
-
|
|
1753
|
-
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
|
|
1760
|
-
|
|
1761
|
-
|
|
1762
|
-
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
}), /*#__PURE__*/jsx(Route, {
|
|
1767
|
-
exact: true,
|
|
1768
|
-
path: "".concat(sharePath, "/qrcode"),
|
|
1769
|
-
render: function render() {
|
|
1770
|
-
return /*#__PURE__*/jsx(QRCode, {
|
|
1771
|
-
entity: entity,
|
|
1772
|
-
qrCodeProps: qrCodeProps,
|
|
1773
|
-
shareUrl: shareUrl,
|
|
1774
|
-
url: urls[0].url
|
|
1775
|
-
});
|
|
1776
|
-
}
|
|
1777
|
-
}), /*#__PURE__*/jsx(Route, {
|
|
1778
|
-
exact: true,
|
|
1779
|
-
path: "".concat(sharePath, "/social-media"),
|
|
1780
|
-
render: function render() {
|
|
1781
|
-
return /*#__PURE__*/jsx(SocialMedia, {
|
|
1782
|
-
shareUrl: shareUrl,
|
|
1783
|
-
socialMediaProps: socialMediaProps,
|
|
1784
|
-
url: urls[0].url
|
|
1785
|
-
});
|
|
1786
|
-
}
|
|
1787
|
-
}), isPresent(moreOptions) && moreOptions.map(function (_ref2) {
|
|
1788
|
-
var link = _ref2.link,
|
|
1789
|
-
element = _ref2.element,
|
|
1790
|
-
path = _ref2.path;
|
|
1791
|
-
if (!link && !path) return null;
|
|
1792
|
-
return /*#__PURE__*/jsx(Route, {
|
|
1793
|
-
exact: true,
|
|
1794
|
-
path: path || link,
|
|
1795
|
-
children: element
|
|
1796
|
-
}, link);
|
|
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
|
|
1797
1551
|
})]
|
|
1798
1552
|
});
|
|
1799
1553
|
};
|