@bigbinary/neeto-integrations-frontend 4.0.24 → 4.0.25
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/.ready +1 -1
- package/dist/Form-Bm37EVs6.js +189 -0
- package/dist/Form-Bm37EVs6.js.map +1 -0
- package/dist/Form-DbbEVp56.js +166 -0
- package/dist/Form-DbbEVp56.js.map +1 -0
- package/dist/cjs/v2/Connect.js +86 -0
- package/dist/cjs/v2/Connect.js.map +1 -0
- package/dist/cjs/v2/Daily.js +144 -0
- package/dist/cjs/v2/Daily.js.map +1 -0
- package/dist/cjs/v2/DailyForm.js +29 -0
- package/dist/cjs/v2/DailyForm.js.map +1 -0
- package/dist/cjs/v2/Demo.js +76 -0
- package/dist/cjs/v2/Demo.js.map +1 -0
- package/dist/cjs/v2/DisconnectAlert.js +40 -0
- package/dist/cjs/v2/DisconnectAlert.js.map +1 -0
- package/dist/cjs/v2/DisconnectedIntegrationsRibbon.js +109 -0
- package/dist/cjs/v2/DisconnectedIntegrationsRibbon.js.map +1 -0
- package/dist/cjs/v2/Finish.js +96 -0
- package/dist/cjs/v2/Finish.js.map +1 -0
- package/dist/cjs/v2/GoogleCalendar.js +112 -0
- package/dist/cjs/v2/GoogleCalendar.js.map +1 -0
- package/dist/cjs/v2/Manage.js +170 -0
- package/dist/cjs/v2/Manage.js.map +1 -0
- package/dist/cjs/v2/Modal.js +87 -0
- package/dist/cjs/v2/Modal.js.map +1 -0
- package/dist/cjs/v2/Telnyx.js +237 -0
- package/dist/cjs/v2/Telnyx.js.map +1 -0
- package/dist/cjs/v2/Twilio.js +309 -0
- package/dist/cjs/v2/Twilio.js.map +1 -0
- package/dist/cjs/v2/WalkthroughModal.js +51 -0
- package/dist/cjs/v2/WalkthroughModal.js.map +1 -0
- package/dist/cjs/v2/ZapierForm.js +316 -0
- package/dist/cjs/v2/ZapierForm.js.map +1 -0
- package/dist/cjs/v2/Zoom.js +125 -0
- package/dist/cjs/v2/Zoom.js.map +1 -0
- package/dist/query-BADHOzBP.js +21 -0
- package/dist/query-BADHOzBP.js.map +1 -0
- package/dist/query-BijkeV_r.js +31 -0
- package/dist/query-BijkeV_r.js.map +1 -0
- package/dist/v2/Connect.js +84 -0
- package/dist/v2/Connect.js.map +1 -0
- package/dist/v2/Daily.js +142 -0
- package/dist/v2/Daily.js.map +1 -0
- package/dist/v2/DailyForm.js +23 -0
- package/dist/v2/DailyForm.js.map +1 -0
- package/dist/v2/Demo.js +74 -0
- package/dist/v2/Demo.js.map +1 -0
- package/dist/v2/DisconnectAlert.js +38 -0
- package/dist/v2/DisconnectAlert.js.map +1 -0
- package/dist/v2/DisconnectedIntegrationsRibbon.js +107 -0
- package/dist/v2/DisconnectedIntegrationsRibbon.js.map +1 -0
- package/dist/v2/Finish.js +75 -0
- package/dist/v2/Finish.js.map +1 -0
- package/dist/v2/GoogleCalendar.js +110 -0
- package/dist/v2/GoogleCalendar.js.map +1 -0
- package/dist/v2/Manage.js +168 -0
- package/dist/v2/Manage.js.map +1 -0
- package/dist/v2/Modal.js +85 -0
- package/dist/v2/Modal.js.map +1 -0
- package/dist/v2/Telnyx.js +216 -0
- package/dist/v2/Telnyx.js.map +1 -0
- package/dist/v2/Twilio.js +288 -0
- package/dist/v2/Twilio.js.map +1 -0
- package/dist/v2/WalkthroughModal.js +49 -0
- package/dist/v2/WalkthroughModal.js.map +1 -0
- package/dist/v2/ZapierForm.js +295 -0
- package/dist/v2/ZapierForm.js.map +1 -0
- package/dist/v2/Zoom.js +123 -0
- package/dist/v2/Zoom.js.map +1 -0
- package/package.json +19 -9
- package/typeTemplates-v2/index.d.ts +180 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import { Typography, Button } from '@bigbinary/neeto-atoms';
|
|
3
|
+
import { humanize, noop } from '@bigbinary/neeto-cist';
|
|
4
|
+
import { withT } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
5
|
+
import CardLayout from '@bigbinary/neeto-molecules/v2/CardLayout';
|
|
6
|
+
import { P as PropTypes } from '../index-MS1ts-9f.js';
|
|
7
|
+
import { Trans } from 'react-i18next';
|
|
8
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
9
|
+
|
|
10
|
+
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; }
|
|
11
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).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; }
|
|
12
|
+
var Connect = withT(function (_ref) {
|
|
13
|
+
var t = _ref.t,
|
|
14
|
+
Icon = _ref.Icon,
|
|
15
|
+
_ref$title = _ref.title,
|
|
16
|
+
title = _ref$title === void 0 ? "" : _ref$title,
|
|
17
|
+
_ref$description = _ref.description,
|
|
18
|
+
description = _ref$description === void 0 ? "" : _ref$description,
|
|
19
|
+
_ref$integration = _ref.integration,
|
|
20
|
+
integration = _ref$integration === void 0 ? "" : _ref$integration,
|
|
21
|
+
_ref$integrationName = _ref.integrationName,
|
|
22
|
+
integrationName = _ref$integrationName === void 0 ? "" : _ref$integrationName,
|
|
23
|
+
_ref$helpDocUrl = _ref.helpDocUrl,
|
|
24
|
+
helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
|
|
25
|
+
_ref$buttonProps = _ref.buttonProps,
|
|
26
|
+
buttonProps = _ref$buttonProps === void 0 ? {} : _ref$buttonProps,
|
|
27
|
+
_ref$onConnect = _ref.onConnect,
|
|
28
|
+
onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
|
|
29
|
+
children = _ref.children,
|
|
30
|
+
secondaryButtonProps = _ref.secondaryButtonProps;
|
|
31
|
+
return /*#__PURE__*/jsxs(CardLayout, {
|
|
32
|
+
actionBlock: /*#__PURE__*/jsxs("div", {
|
|
33
|
+
className: "flex w-full flex-wrap items-center gap-2",
|
|
34
|
+
children: [/*#__PURE__*/jsx(Button, _objectSpread({
|
|
35
|
+
label: t("neetoIntegrations.common.connect"),
|
|
36
|
+
onClick: onConnect
|
|
37
|
+
}, buttonProps)), secondaryButtonProps && /*#__PURE__*/jsx(Button, _objectSpread({
|
|
38
|
+
variant: "secondary"
|
|
39
|
+
}, secondaryButtonProps))]
|
|
40
|
+
}),
|
|
41
|
+
children: [/*#__PURE__*/jsxs("div", {
|
|
42
|
+
className: "flex flex-col gap-y-2",
|
|
43
|
+
children: [/*#__PURE__*/jsx(Icon, {
|
|
44
|
+
size: 48
|
|
45
|
+
}), /*#__PURE__*/jsxs("div", {
|
|
46
|
+
className: "flex flex-col gap-y-1",
|
|
47
|
+
children: [/*#__PURE__*/jsx(Typography, {
|
|
48
|
+
variant: "h2",
|
|
49
|
+
children: title
|
|
50
|
+
}), /*#__PURE__*/jsx(Typography, {
|
|
51
|
+
variant: "body2",
|
|
52
|
+
children: description
|
|
53
|
+
})]
|
|
54
|
+
})]
|
|
55
|
+
}), helpDocUrl && /*#__PURE__*/jsx("div", {
|
|
56
|
+
className: "w-full",
|
|
57
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
58
|
+
i18nKey: "neetoIntegrations.common.helpDocUrl",
|
|
59
|
+
components: {
|
|
60
|
+
helpLink: /*#__PURE__*/jsx(Button, {
|
|
61
|
+
className: "text-xs",
|
|
62
|
+
href: helpDocUrl,
|
|
63
|
+
size: "sm",
|
|
64
|
+
target: "_blank",
|
|
65
|
+
variant: "link"
|
|
66
|
+
})
|
|
67
|
+
},
|
|
68
|
+
values: {
|
|
69
|
+
integration: integrationName || humanize(integration)
|
|
70
|
+
}
|
|
71
|
+
})
|
|
72
|
+
}), children]
|
|
73
|
+
});
|
|
74
|
+
});
|
|
75
|
+
Connect.prototypes = {
|
|
76
|
+
Icon: PropTypes.node,
|
|
77
|
+
title: PropTypes.string,
|
|
78
|
+
description: PropTypes.string,
|
|
79
|
+
buttonProps: PropTypes.object,
|
|
80
|
+
onConnect: PropTypes.func
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export { Connect as default };
|
|
84
|
+
//# sourceMappingURL=Connect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Connect.js","sources":["../../app/javascript/src/components/v2/Steps/Connect.jsx"],"sourcesContent":["import { Typography, Button } from \"@bigbinary/neeto-atoms\";\nimport { humanize, noop } from \"neetocist\";\nimport { withT } from \"neetocommons/react-utils\";\nimport CardLayout from \"neetomolecules/v2/CardLayout\";\nimport PropTypes from \"prop-types\";\nimport { Trans } from \"react-i18next\";\n\nconst Connect = withT(\n ({\n t,\n Icon,\n title = \"\",\n description = \"\",\n integration = \"\",\n integrationName = \"\",\n helpDocUrl = \"\",\n buttonProps = {},\n onConnect = noop,\n children,\n secondaryButtonProps,\n }) => (\n <CardLayout\n actionBlock={\n <div className=\"flex w-full flex-wrap items-center gap-2\">\n <Button\n label={t(\"neetoIntegrations.common.connect\")}\n onClick={onConnect}\n {...buttonProps}\n />\n {secondaryButtonProps && (\n <Button variant=\"secondary\" {...secondaryButtonProps} />\n )}\n </div>\n }\n >\n <div className=\"flex flex-col gap-y-2\">\n <Icon size={48} />\n <div className=\"flex flex-col gap-y-1\">\n <Typography variant=\"h2\">{title}</Typography>\n <Typography variant=\"body2\">{description}</Typography>\n </div>\n </div>\n {helpDocUrl && (\n <div className=\"w-full\">\n <Trans\n i18nKey=\"neetoIntegrations.common.helpDocUrl\"\n components={{\n helpLink: (\n <Button\n className=\"text-xs\"\n href={helpDocUrl}\n size=\"sm\"\n target=\"_blank\"\n variant=\"link\"\n />\n ),\n }}\n values={{\n integration: integrationName || humanize(integration),\n }}\n />\n </div>\n )}\n {children}\n </CardLayout>\n )\n);\n\nConnect.prototypes = {\n Icon: PropTypes.node,\n title: PropTypes.string,\n description: PropTypes.string,\n buttonProps: PropTypes.object,\n onConnect: PropTypes.func,\n};\n\nexport default Connect;\n"],"names":["Connect","withT","_ref","t","Icon","_ref$title","title","_ref$description","description","_ref$integration","integration","_ref$integrationName","integrationName","_ref$helpDocUrl","helpDocUrl","_ref$buttonProps","buttonProps","_ref$onConnect","onConnect","noop","children","secondaryButtonProps","_jsxs","CardLayout","actionBlock","className","_jsx","Button","_objectSpread","label","onClick","variant","size","Typography","Trans","i18nKey","components","helpLink","href","target","values","humanize","prototypes","PropTypes","node","string","object","func"],"mappings":";;;;;;;;;;;AAOA,IAAMA,OAAO,GAAGC,KAAK,CACnB,UAAAC,IAAA,EAAA;AAAA,EAAA,IACEC,CAAC,GAAAD,IAAA,CAADC,CAAC;IACDC,IAAI,GAAAF,IAAA,CAAJE,IAAI;IAAAC,UAAA,GAAAH,IAAA,CACJI,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IAAAE,gBAAA,GAAAL,IAAA,CACVM,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,gBAAA;IAAAE,gBAAA,GAAAP,IAAA,CAChBQ,WAAW;AAAXA,IAAAA,WAAW,GAAAD,gBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,gBAAA;IAAAE,oBAAA,GAAAT,IAAA,CAChBU,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,oBAAA;IAAAE,eAAA,GAAAX,IAAA,CACpBY,UAAU;AAAVA,IAAAA,UAAU,GAAAD,eAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,eAAA;IAAAE,gBAAA,GAAAb,IAA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AAC;AAAA,KACH,CAAC,EACLM,UAAU,iBACTY,GAAA,CAAA,KAAA,EAAA;AAAKD,MAAAA,SAAS,EAAC,QAAQ;MAAAL,QAAA,eACrBM,GAAA,CAACQ,KAAK,EAAA;AACJC,QAAAA,OAAO,EAAC,qCAAqC;AAC7CC,QAAAA,UAAU,EAAE;UACVC,QAAQ,eACNX,GAAA,CAACC,MAAM,EAAA;AACLF,YAAAA,SAAS,EAAC,SAAS;AACnBa,YAAAA,IAAI,EAAExB,UAAW;AACjBkB,YAAAA,IAAI,EAAC,IAAI;AACTO,YAAAA,MAAM,EAAC,QAAQ;AACfR,YAAAA,OAAO,EAAC;WACT;SAEH;AACFS,QAAAA,MAAM,EAAE;AACN9B,UAAAA,WAAW,EAAEE,eAAe,IAAI6B,QAAQ,CAAC/B,WAAW;AACtD;OACD;KACE,CACN,EACAU,QAAQ;AAAA,GACC,CAAC;AAAA,CAEjB;AAEApB,OAAO,CAAC0C,UAAU,GAAG;EACnBtC,IAAI,EAAEuC,SAAS,CAACC,IAAI;EACpBtC,KAAK,EAAEqC,SAAS,CAACE,MAAM;EACvBrC,WAAW,EAAEmC,SAAS,CAACE,MAAM;EAC7B7B,WAAW,EAAE2B,SAAS,CAACG,MAAM;EAC7B5B,SAAS,EAAEyB,SAAS,CAACI;AACvB,CAAC;;;;"}
|
package/dist/v2/Daily.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import i18next from 'i18next';
|
|
2
|
+
import { isPresent, noop } from '@bigbinary/neeto-cist';
|
|
3
|
+
import { withTitle, useQueryParams } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
4
|
+
import { u as useFetchDaily, a as useDestroyDaily, F as Form } from '../Form-DbbEVp56.js';
|
|
5
|
+
import _slicedToArray from '@babel/runtime/helpers/slicedToArray';
|
|
6
|
+
import { useState } from 'react';
|
|
7
|
+
import { Spinner } from '@bigbinary/neeto-atoms';
|
|
8
|
+
import { buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
9
|
+
import DailyIcon from '@bigbinary/neeto-icons/misc/Daily';
|
|
10
|
+
import CopyToClipboardButton from '@bigbinary/neeto-molecules/v2/CopyToClipboardButton';
|
|
11
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
12
|
+
import Manage$1 from './Manage.js';
|
|
13
|
+
import { jsx } from 'react/jsx-runtime';
|
|
14
|
+
import '@bigbinary/neeto-atoms/formik';
|
|
15
|
+
import '@bigbinary/neeto-molecules/v2/CardLayout';
|
|
16
|
+
import '@bigbinary/neeto-molecules/v2/Container';
|
|
17
|
+
import '@bigbinary/neeto-molecules/v2/Header';
|
|
18
|
+
import 'react-router-dom';
|
|
19
|
+
import 'yup';
|
|
20
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
21
|
+
import '@tanstack/react-query';
|
|
22
|
+
import '@bigbinary/neeto-commons-frontend/constants';
|
|
23
|
+
import 'axios';
|
|
24
|
+
import '../query-BADHOzBP.js';
|
|
25
|
+
import './WalkthroughModal.js';
|
|
26
|
+
import '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
27
|
+
import 'lucide-react';
|
|
28
|
+
import './DisconnectAlert.js';
|
|
29
|
+
import '@babel/runtime/helpers/objectWithoutProperties';
|
|
30
|
+
|
|
31
|
+
var Manage = function Manage(_ref) {
|
|
32
|
+
var description = _ref.description,
|
|
33
|
+
onDisconnect = _ref.onDisconnect;
|
|
34
|
+
var _useState = useState(false),
|
|
35
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
36
|
+
isDisconnectAlertOpen = _useState2[0],
|
|
37
|
+
setIsDisconnectAlertOpen = _useState2[1];
|
|
38
|
+
var _useFetchDaily = useFetchDaily(),
|
|
39
|
+
_useFetchDaily$data = _useFetchDaily.data,
|
|
40
|
+
_useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
|
|
41
|
+
_useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
|
|
42
|
+
metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$,
|
|
43
|
+
isFetching = _useFetchDaily.isFetching;
|
|
44
|
+
var _ref2 = metadata || {},
|
|
45
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
46
|
+
apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
|
|
47
|
+
var _useTranslation = useTranslation(),
|
|
48
|
+
t = _useTranslation.t;
|
|
49
|
+
var _useDestroyDaily = useDestroyDaily({
|
|
50
|
+
onSuccess: function onSuccess() {
|
|
51
|
+
setIsDisconnectAlertOpen(false);
|
|
52
|
+
onDisconnect === null || onDisconnect === void 0 || onDisconnect();
|
|
53
|
+
}
|
|
54
|
+
}),
|
|
55
|
+
destroyIntegration = _useDestroyDaily.mutate,
|
|
56
|
+
isDisconnecting = _useDestroyDaily.isPending;
|
|
57
|
+
var isConnected = isPresent(apiKey);
|
|
58
|
+
var handleDisconnect = function handleDisconnect() {
|
|
59
|
+
return destroyIntegration("daily");
|
|
60
|
+
};
|
|
61
|
+
if (isFetching || isDisconnecting) {
|
|
62
|
+
return /*#__PURE__*/jsx("div", {
|
|
63
|
+
className: "flex h-full w-full items-center justify-center",
|
|
64
|
+
children: /*#__PURE__*/jsx(Spinner, {})
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
return /*#__PURE__*/jsx(Manage$1, {
|
|
68
|
+
isConnected: isConnected,
|
|
69
|
+
isDisconnectAlertOpen: isDisconnectAlertOpen,
|
|
70
|
+
isDisconnecting: isDisconnecting,
|
|
71
|
+
setIsDisconnectAlertOpen: setIsDisconnectAlertOpen,
|
|
72
|
+
Icon: DailyIcon,
|
|
73
|
+
connectPath: buildUrl(window.location.pathname, {
|
|
74
|
+
connect: true
|
|
75
|
+
}),
|
|
76
|
+
integration: "daily",
|
|
77
|
+
description: isConnected ? /*#__PURE__*/jsx(Trans, {
|
|
78
|
+
i18nKey: "neetoIntegrations.daily.yourApiKey",
|
|
79
|
+
values: {
|
|
80
|
+
apiKey: apiKey
|
|
81
|
+
},
|
|
82
|
+
components: {
|
|
83
|
+
wrapper: /*#__PURE__*/jsx("div", {
|
|
84
|
+
className: "neeto-ui-rounded-md mt-2 flex items-center justify-between gap-x-3 border border-border px-3 py-2"
|
|
85
|
+
}),
|
|
86
|
+
span: /*#__PURE__*/jsx("span", {
|
|
87
|
+
className: "break-all text-sm"
|
|
88
|
+
}),
|
|
89
|
+
copy: /*#__PURE__*/jsx(CopyToClipboardButton, {
|
|
90
|
+
className: "shrink-0 self-start",
|
|
91
|
+
style: "text",
|
|
92
|
+
value: apiKey
|
|
93
|
+
})
|
|
94
|
+
}
|
|
95
|
+
}) : description,
|
|
96
|
+
title: isConnected ? t("neetoIntegrations.daily.connected") : t("neetoIntegrations.daily.connect.account"),
|
|
97
|
+
onClose: function onClose() {
|
|
98
|
+
return setIsDisconnectAlertOpen(false);
|
|
99
|
+
},
|
|
100
|
+
onDisconnect: handleDisconnect
|
|
101
|
+
});
|
|
102
|
+
};
|
|
103
|
+
|
|
104
|
+
var Daily = function Daily(_ref) {
|
|
105
|
+
var _ref$isOnboarding = _ref.isOnboarding,
|
|
106
|
+
isOnboarding = _ref$isOnboarding === void 0 ? false : _ref$isOnboarding,
|
|
107
|
+
_ref$helpDocUrl = _ref.helpDocUrl,
|
|
108
|
+
helpDocUrl = _ref$helpDocUrl === void 0 ? "" : _ref$helpDocUrl,
|
|
109
|
+
_ref$videoUrl = _ref.videoUrl,
|
|
110
|
+
videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
|
|
111
|
+
_ref$description = _ref.description,
|
|
112
|
+
description = _ref$description === void 0 ? "" : _ref$description,
|
|
113
|
+
_ref$onConnect = _ref.onConnect,
|
|
114
|
+
onConnect = _ref$onConnect === void 0 ? noop : _ref$onConnect,
|
|
115
|
+
_ref$onDisconnect = _ref.onDisconnect,
|
|
116
|
+
onDisconnect = _ref$onDisconnect === void 0 ? noop : _ref$onDisconnect;
|
|
117
|
+
var _useQueryParams = useQueryParams(),
|
|
118
|
+
connect = _useQueryParams.connect;
|
|
119
|
+
var _useFetchDaily = useFetchDaily(),
|
|
120
|
+
_useFetchDaily$data = _useFetchDaily.data,
|
|
121
|
+
_useFetchDaily$data2 = _useFetchDaily$data === void 0 ? {} : _useFetchDaily$data,
|
|
122
|
+
_useFetchDaily$data2$ = _useFetchDaily$data2.metadata,
|
|
123
|
+
metadata = _useFetchDaily$data2$ === void 0 ? {} : _useFetchDaily$data2$;
|
|
124
|
+
var _ref2 = metadata || {},
|
|
125
|
+
_ref2$apiKey = _ref2.apiKey,
|
|
126
|
+
apiKey = _ref2$apiKey === void 0 ? null : _ref2$apiKey;
|
|
127
|
+
if (isPresent(apiKey) && !isOnboarding || !connect) {
|
|
128
|
+
return /*#__PURE__*/jsx(Manage, {
|
|
129
|
+
description: description,
|
|
130
|
+
onDisconnect: onDisconnect
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
return /*#__PURE__*/jsx(Form, {
|
|
134
|
+
helpDocUrl: helpDocUrl,
|
|
135
|
+
onConnect: onConnect,
|
|
136
|
+
videoUrl: videoUrl
|
|
137
|
+
});
|
|
138
|
+
};
|
|
139
|
+
var index = withTitle(Daily, i18next.t("neetoIntegrations.browserTitles.integrations.dailyco"));
|
|
140
|
+
|
|
141
|
+
export { index as default };
|
|
142
|
+
//# sourceMappingURL=Daily.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Daily.js","sources":["../../app/javascript/src/components/v2/Integrations/Daily/Manage.jsx","../../app/javascript/src/components/v2/Integrations/Daily/index.jsx"],"sourcesContent":["import { useState } from \"react\";\n\nimport { Spinner } from \"@bigbinary/neeto-atoms\";\nimport { isPresent } from \"neetocist\";\nimport { buildUrl } from \"neetocommons/utils\";\nimport { Daily as DailyIcon } from \"neetoicons/misc\";\nimport CopyToClipboardButton from \"neetomolecules/v2/CopyToClipboardButton\";\nimport { Trans, useTranslation } from \"react-i18next\";\n\nimport ManageIntegrations from \"../../commons/Manage\";\nimport {\n useDestroyDaily,\n useFetchDaily,\n} from \"../../hooks/reactQuery/useDailiesApi\";\n\nconst Manage = ({ description, onDisconnect }) => {\n const [isDisconnectAlertOpen, setIsDisconnectAlertOpen] = useState(false);\n\n const { data: { metadata = {} } = {}, isFetching } = useFetchDaily();\n const { apiKey = null } = metadata || {};\n\n const { t } = useTranslation();\n\n const { mutate: destroyIntegration, isPending: isDisconnecting } =\n useDestroyDaily({\n onSuccess: () => {\n setIsDisconnectAlertOpen(false);\n onDisconnect?.();\n },\n });\n\n const isConnected = isPresent(apiKey);\n\n const handleDisconnect = () => destroyIntegration(\"daily\");\n\n if (isFetching || isDisconnecting) {\n return (\n <div className=\"flex h-full w-full items-center justify-center\">\n <Spinner />\n </div>\n );\n }\n\n return (\n <ManageIntegrations\n {...{\n isConnected,\n isDisconnectAlertOpen,\n isDisconnecting,\n setIsDisconnectAlertOpen,\n }}\n Icon={DailyIcon}\n connectPath={buildUrl(window.location.pathname, { connect: true })}\n integration=\"daily\"\n description={\n isConnected ? (\n <Trans\n i18nKey=\"neetoIntegrations.daily.yourApiKey\"\n values={{ apiKey }}\n components={{\n wrapper: (\n <div className=\"neeto-ui-rounded-md mt-2 flex items-center justify-between gap-x-3 border border-border px-3 py-2\" />\n ),\n span: <span className=\"break-all text-sm\" />,\n copy: (\n <CopyToClipboardButton\n className=\"shrink-0 self-start\"\n style=\"text\"\n value={apiKey}\n />\n ),\n }}\n />\n ) : (\n description\n )\n }\n title={\n isConnected\n ? t(\"neetoIntegrations.daily.connected\")\n : t(\"neetoIntegrations.daily.connect.account\")\n }\n onClose={() => setIsDisconnectAlertOpen(false)}\n onDisconnect={handleDisconnect}\n />\n );\n};\n\nexport default Manage;\n","import i18next from \"i18next\";\nimport { isPresent, noop } from \"neetocist\";\nimport { useQueryParams, withTitle } from \"neetocommons/react-utils\";\n\nimport Form from \"./Form\";\nimport Manage from \"./Manage\";\n\nimport { useFetchDaily } from \"../../hooks/reactQuery/useDailiesApi\";\n\nconst Daily = ({\n isOnboarding = false,\n helpDocUrl = \"\",\n videoUrl = \"\",\n description = \"\",\n onConnect = noop,\n onDisconnect = noop,\n}) => {\n const { connect } = useQueryParams();\n\n const { data: { metadata = {} } = {} } = useFetchDaily();\n const { apiKey = null } = metadata || {};\n\n if ((isPresent(apiKey) && !isOnboarding) || !connect) {\n return <Manage {...{ description, onDisconnect }} />;\n }\n\n return <Form {...{ helpDocUrl, onConnect, videoUrl }} />;\n};\n\nexport default withTitle(\n Daily,\n i18next.t(\"neetoIntegrations.browserTitles.integrations.dailyco\")\n);\n"],"names":["Manage","_ref","description","onDisconnect","_useState","useState","_useState2","_slicedToArray","isDisconnectAlertOpen","setIsDisconnectAlertOpen","_useFetchDaily","useFetchDaily","_useFetchDaily$data","data","_useFetchDaily$data2","_useFetchDaily$data2$","metadata","isFetching","_ref2","_ref2$apiKey","apiKey","_useTranslation","useTranslation","t","_useDestroyDaily","useDestroyDaily","onSuccess","destroyIntegration","mutate","isDisconnecting","isPending","isConnected","isPresent","handleDisconnect","_jsx","className","children","Spinner","ManageIntegrations","Icon","DailyIcon","connectPath","buildUrl","window","location","pathname","connect","integration","Trans","i18nKey","values","components","wrapper","span","copy","CopyToClipboardButton","style","value","title","onClose","Daily","_ref$isOnboarding","isOnboarding","_ref$helpDocUrl","helpDocUrl","_ref$videoUrl","videoUrl","_ref$description","_ref$onConnect","onConnect","noop","_ref$onDisconnect","_useQueryParams","useQueryParams","Form","withTitle","i18next"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAeA,IAAMA,MAAM,GAAG,SAATA,MAAMA,CAAAC,IAAA,EAAsC;AAAA,EAAA,IAAhCC,WAAW,GAAAD,IAAA,CAAXC,WAAW;IAAEC,YAAY,GAAAF,IAAA,CAAZE,YAAY;AACzC,EAAA,IAAAC,SAAA,GAA0DC,QAAQ,CAAC,KAAK,CAAC;IAAAC,UAAA,GAAAC,cAAA,CAAAH,SAAA,EAAA,CAAA,CAAA;AAAlEI,IAAAA,qBAAqB,G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BF,QAAQ,IAAI,EAAE;IAAAG,YAAA,GAAAD,KAAA,CAAhCE,MAAM;AAANA,IAAAA,MAAM,GAAAD,YAAA,KAAA,MAAA,GAAG,IAAI,GAAAA,YAAA;EAErB,IAAKa,SAAS,CAACZ,MAAM,CAAC,IAAI,CAAC0C,YAAY,IAAK,CAAChB,OAAO,EAAE;IACpD,oBAAOZ,GAAA,CAAClC,MAAM,EAAA;AAAOE,MAAAA,WAAW,EAAXA,WAAW;AAAEC,MAAAA,YAAY,EAAZA;AAAY,KAAK,CAAC;AACtD,EAAA;EAEA,oBAAO+B,GAAA,CAACwC,IAAI,EAAA;AAAOV,IAAAA,UAAU,EAAVA,UAAU;AAAEK,IAAAA,SAAS,EAATA,SAAS;AAAEH,IAAAA,QAAQ,EAARA;AAAQ,GAAK,CAAC;AAC1D,CAAC;AAED,YAAeS,SAAS,CACtBf,KAAK,EACLgB,OAAO,CAACrD,CAAC,CAAC,sDAAsD,CAClE,CAAC;;;;"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import '@babel/runtime/helpers/slicedToArray';
|
|
2
|
+
import 'react';
|
|
3
|
+
import '@bigbinary/neeto-atoms';
|
|
4
|
+
import '@bigbinary/neeto-atoms/formik';
|
|
5
|
+
import 'i18next';
|
|
6
|
+
import '@bigbinary/neeto-commons-frontend/react-utils';
|
|
7
|
+
import '@bigbinary/neeto-molecules/v2/CardLayout';
|
|
8
|
+
import '@bigbinary/neeto-molecules/v2/Container';
|
|
9
|
+
import '@bigbinary/neeto-molecules/v2/Header';
|
|
10
|
+
import 'react-i18next';
|
|
11
|
+
import 'react-router-dom';
|
|
12
|
+
export { F as default } from '../Form-DbbEVp56.js';
|
|
13
|
+
import './WalkthroughModal.js';
|
|
14
|
+
import 'react/jsx-runtime';
|
|
15
|
+
import 'yup';
|
|
16
|
+
import '@babel/runtime/helpers/defineProperty';
|
|
17
|
+
import '@tanstack/react-query';
|
|
18
|
+
import '@bigbinary/neeto-commons-frontend/constants';
|
|
19
|
+
import 'axios';
|
|
20
|
+
import '../query-BADHOzBP.js';
|
|
21
|
+
import '@bigbinary/neeto-cist';
|
|
22
|
+
import '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
23
|
+
//# sourceMappingURL=DailyForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DailyForm.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;"}
|
package/dist/v2/Demo.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Button } from '@bigbinary/neeto-atoms';
|
|
2
|
+
import { noop } from '@bigbinary/neeto-cist';
|
|
3
|
+
import CardLayout from '@bigbinary/neeto-molecules/v2/CardLayout';
|
|
4
|
+
import { P as PropTypes } from '../index-MS1ts-9f.js';
|
|
5
|
+
import { useTranslation } from 'react-i18next';
|
|
6
|
+
import { isEmpty } from 'ramda';
|
|
7
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
8
|
+
|
|
9
|
+
var isYouTubeLink = function isYouTubeLink(videoUrl) {
|
|
10
|
+
var youtubeRegex = /^(https?:\/\/)?(www\.)?(youtube\.com|youtu\.be)\//;
|
|
11
|
+
return youtubeRegex.test(videoUrl);
|
|
12
|
+
};
|
|
13
|
+
var renderText = function renderText(text, fallbackTranslation) {
|
|
14
|
+
return isEmpty(text) ? fallbackTranslation : text;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
var Demo = function Demo(_ref) {
|
|
18
|
+
var _ref$title = _ref.title,
|
|
19
|
+
title = _ref$title === void 0 ? "" : _ref$title,
|
|
20
|
+
_ref$subtitle = _ref.subtitle,
|
|
21
|
+
subtitle = _ref$subtitle === void 0 ? "" : _ref$subtitle,
|
|
22
|
+
_ref$iframeTitle = _ref.iframeTitle,
|
|
23
|
+
iframeTitle = _ref$iframeTitle === void 0 ? "" : _ref$iframeTitle,
|
|
24
|
+
_ref$onClose = _ref.onClose,
|
|
25
|
+
onClose = _ref$onClose === void 0 ? noop : _ref$onClose,
|
|
26
|
+
_ref$videoUrl = _ref.videoUrl,
|
|
27
|
+
videoUrl = _ref$videoUrl === void 0 ? "" : _ref$videoUrl,
|
|
28
|
+
children = _ref.children;
|
|
29
|
+
var _useTranslation = useTranslation(),
|
|
30
|
+
t = _useTranslation.t;
|
|
31
|
+
var renderVideo = function renderVideo(videoUrl) {
|
|
32
|
+
return isYouTubeLink(videoUrl) ? /*#__PURE__*/jsx("iframe", {
|
|
33
|
+
allowFullScreen: true,
|
|
34
|
+
className: "aspect-video w-full max-w-3xl border-none",
|
|
35
|
+
frameBorder: "0",
|
|
36
|
+
id: "ytplayer",
|
|
37
|
+
src: videoUrl,
|
|
38
|
+
title: renderText(iframeTitle, t("neetoIntegrations.demo.iFrameTitle")),
|
|
39
|
+
type: "text/html"
|
|
40
|
+
}) : /*#__PURE__*/jsx("video", {
|
|
41
|
+
autoPlay: true,
|
|
42
|
+
controls: true,
|
|
43
|
+
muted: true,
|
|
44
|
+
className: "neeto-ui-rounded-xl aspect-video w-full max-w-3xl cursor-pointer",
|
|
45
|
+
id: "walkthrough-video",
|
|
46
|
+
children: /*#__PURE__*/jsx("source", {
|
|
47
|
+
src: videoUrl
|
|
48
|
+
})
|
|
49
|
+
});
|
|
50
|
+
};
|
|
51
|
+
return /*#__PURE__*/jsxs(CardLayout, {
|
|
52
|
+
description: renderText(subtitle, t("neetoIntegrations.demo.subtitle")),
|
|
53
|
+
title: renderText(title, t("neetoIntegrations.demo.title")),
|
|
54
|
+
actionBlock: /*#__PURE__*/jsx(Button, {
|
|
55
|
+
"data-testid": "neeto-integrations-demo-finish-button",
|
|
56
|
+
label: t("neetoIntegrations.common.finish"),
|
|
57
|
+
onClick: onClose
|
|
58
|
+
}),
|
|
59
|
+
children: [children, videoUrl && /*#__PURE__*/jsx("div", {
|
|
60
|
+
className: "w-full",
|
|
61
|
+
children: renderVideo(videoUrl)
|
|
62
|
+
})]
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
Demo.prototypes = {
|
|
66
|
+
onClose: PropTypes.func,
|
|
67
|
+
videoUrl: PropTypes.string,
|
|
68
|
+
title: PropTypes.string,
|
|
69
|
+
subtitle: PropTypes.string,
|
|
70
|
+
iframeTitle: PropTypes.string
|
|
71
|
+
};
|
|
72
|
+
|
|
73
|
+
export { Demo as default };
|
|
74
|
+
//# sourceMappingURL=Demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Demo.js","sources":["../../app/javascript/src/components/v2/Steps/utils.js","../../app/javascript/src/components/v2/Steps/Demo.jsx"],"sourcesContent":["import { isEmpty } from \"ramda\";\n\nexport const isYouTubeLink = videoUrl => {\n const youtubeRegex = /^(https?:\\/\\/)?(www\\.)?(youtube\\.com|youtu\\.be)\\//;\n\n return youtubeRegex.test(videoUrl);\n};\n\nexport const renderText = (text, fallbackTranslation) =>\n isEmpty(text) ? fallbackTranslation : text;\n","import { Button } from \"@bigbinary/neeto-atoms\";\nimport { noop } from \"neetocist\";\nimport CardLayout from \"neetomolecules/v2/CardLayout\";\nimport PropTypes from \"prop-types\";\nimport { useTranslation } from \"react-i18next\";\n\nimport { isYouTubeLink, renderText } from \"./utils\";\n\nconst Demo = ({\n title = \"\",\n subtitle = \"\",\n iframeTitle = \"\",\n onClose = noop,\n videoUrl = \"\",\n children,\n}) => {\n const { t } = useTranslation();\n\n const renderVideo = videoUrl =>\n isYouTubeLink(videoUrl) ? (\n <iframe\n allowFullScreen\n className=\"aspect-video w-full max-w-3xl border-none\"\n frameBorder=\"0\"\n id=\"ytplayer\"\n src={videoUrl}\n title={renderText(iframeTitle, t(\"neetoIntegrations.demo.iFrameTitle\"))}\n type=\"text/html\"\n />\n ) : (\n <video\n autoPlay\n controls\n muted\n className=\"neeto-ui-rounded-xl aspect-video w-full max-w-3xl cursor-pointer\"\n id=\"walkthrough-video\"\n >\n <source src={videoUrl} />\n </video>\n );\n\n return (\n <CardLayout\n description={renderText(subtitle, t(\"neetoIntegrations.demo.subtitle\"))}\n title={renderText(title, t(\"neetoIntegrations.demo.title\"))}\n actionBlock={\n <Button\n data-testid=\"neeto-integrations-demo-finish-button\"\n label={t(\"neetoIntegrations.common.finish\")}\n onClick={onClose}\n />\n }\n >\n {children}\n {videoUrl && <div className=\"w-full\">{renderVideo(videoUrl)}</div>}\n </CardLayout>\n );\n};\n\nDemo.prototypes = {\n onClose: PropTypes.func,\n videoUrl: PropTypes.string,\n title: PropTypes.string,\n subtitle: PropTypes.string,\n iframeTitle: PropTypes.string,\n};\n\nexport default Demo;\n"],"names":["isYouTubeLink","videoUrl","youtubeRegex","test","renderText","text","fallbackTranslation","isEmpty","Demo","_ref","_ref$title","title","_ref$subtitle","subtitle","_ref$iframeTitle","iframeTitle","_ref$onClose","onClose","noop","_ref$videoUrl","children","_useTranslation","useTranslation","t","renderVideo","_jsx","allowFullScreen","className","frameBorder","id","src","type","autoPlay","controls","muted","_jsxs","CardLayout","description","actionBlock","Button","label","onClick","prototypes","PropTypes","func","string"],"mappings":";;;;;;;;AAEO,IAAMA,aAAa,GAAG,SAAhBA,aAAaA,CAAGC,QAAQ,EAAI;EACvC,IAAMC,YAAY,GAAG,mDAAmD;AAExE,EAAA,OAAOA,YAAY,CAACC,IAAI,CAACF,QAAQ,CAAC;AACpC,CAAC;AAEM,IAAMG,UAAU,GAAG,SAAbA,UAAUA,CAAIC,IAAI,EAAEC,mBAAmB,EAAA;AAAA,EAAA,OAClDC,OAAO,CAACF,IAAI,CAAC,GAAGC,mBAAmB,GAAGD,IAAI;AAAA,CAAA;;ACD5C,IAAMG,IAAI,GAAG,SAAPA,IAAIA,CAAAC,IAAA,EAOJ;AAAA,EAAA,IAAAC,UAAA,GAAAD,IAAA,CANJE,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IAAAE,aAAA,GAAAH,IAAA,CACVI,QAAQ;AAARA,IAAAA,QAAQ,GAAAD,aAAA,KAAA,MA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,UAAU,EAAA;IACTC,WAAW,EAAEjC,UAAU,CAACS,QAAQ,EAAEU,CAAC,CAAC,iCAAiC,CAAC,CAAE;IACxEZ,KAAK,EAAEP,UAAU,CAACO,KAAK,EAAEY,CAAC,CAAC,8BAA8B,CAAC,CAAE;IAC5De,WAAW,eACTb,GAAA,CAACc,MAAM,EAAA;AACL,MAAA,aAAA,EAAY,uCAAuC;AACnDC,MAAAA,KAAK,EAAEjB,CAAC,CAAC,iCAAiC,CAAE;AAC5CkB,MAAAA,OAAO,EAAExB;AAAQ,KAClB,CACF;AAAAG,IAAAA,QAAA,EAAA,CAEAA,QAAQ,EACRnB,QAAQ,iBAAIwB,GAAA,CAAA,KAAA,EAAA;AAAKE,MAAAA,SAAS,EAAC,QAAQ;MAAAP,QAAA,EAAEI,WAAW,CAACvB,QAAQ;AAAC,KAAM,CAAC;AAAA,GACxD,CAAC;AAEjB;AAEAO,IAAI,CAACkC,UAAU,GAAG;EAChBzB,OAAO,EAAE0B,SAAS,CAACC,IAAI;EACvB3C,QAAQ,EAAE0C,SAAS,CAACE,MAAM;EAC1BlC,KAAK,EAAEgC,SAAS,CAACE,MAAM;EACvBhC,QAAQ,EAAE8B,SAAS,CAACE,MAAM;EAC1B9B,WAAW,EAAE4B,SAAS,CAACE;AACzB,CAAC;;;;"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import _defineProperty from '@babel/runtime/helpers/defineProperty';
|
|
2
|
+
import _objectWithoutProperties from '@babel/runtime/helpers/objectWithoutProperties';
|
|
3
|
+
import { Alert } from '@bigbinary/neeto-atoms';
|
|
4
|
+
import { noop } from '@bigbinary/neeto-cist';
|
|
5
|
+
import withT from '@bigbinary/neeto-commons-frontend/react-utils/withT';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
var _excluded = ["t", "isOpen", "isDisconnecting", "title", "message", "onClose", "onDisconnect"];
|
|
9
|
+
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; }
|
|
10
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), true).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; }
|
|
11
|
+
var DisconnectAlert = withT(function (_ref) {
|
|
12
|
+
var t = _ref.t,
|
|
13
|
+
_ref$isOpen = _ref.isOpen,
|
|
14
|
+
isOpen = _ref$isOpen === void 0 ? false : _ref$isOpen,
|
|
15
|
+
_ref$isDisconnecting = _ref.isDisconnecting,
|
|
16
|
+
isDisconnecting = _ref$isDisconnecting === void 0 ? false : _ref$isDisconnecting,
|
|
17
|
+
_ref$title = _ref.title,
|
|
18
|
+
title = _ref$title === void 0 ? "" : _ref$title,
|
|
19
|
+
_ref$message = _ref.message,
|
|
20
|
+
message = _ref$message === void 0 ? "" : _ref$message,
|
|
21
|
+
_ref$onClose = _ref.onClose,
|
|
22
|
+
onClose = _ref$onClose === void 0 ? noop : _ref$onClose,
|
|
23
|
+
_ref$onDisconnect = _ref.onDisconnect,
|
|
24
|
+
onDisconnect = _ref$onDisconnect === void 0 ? noop : _ref$onDisconnect,
|
|
25
|
+
otherProps = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
return /*#__PURE__*/jsx(Alert, _objectSpread({
|
|
27
|
+
isOpen: isOpen,
|
|
28
|
+
message: message,
|
|
29
|
+
onClose: onClose,
|
|
30
|
+
title: title,
|
|
31
|
+
isSubmitting: isDisconnecting,
|
|
32
|
+
submitButtonLabel: t("neetoIntegrations.common.disconnect"),
|
|
33
|
+
onSubmit: onDisconnect
|
|
34
|
+
}, otherProps));
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
export { DisconnectAlert as default };
|
|
38
|
+
//# sourceMappingURL=DisconnectAlert.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisconnectAlert.js","sources":["../../app/javascript/src/components/v2/DisconnectAlert/index.jsx"],"sourcesContent":["import { Alert } from \"@bigbinary/neeto-atoms\";\nimport { noop } from \"neetocist\";\nimport withT from \"neetocommons/react-utils/withT\";\n\nconst DisconnectAlert = withT(\n ({\n t,\n isOpen = false,\n isDisconnecting = false,\n title = \"\",\n message = \"\",\n onClose = noop,\n onDisconnect = noop,\n ...otherProps\n }) => (\n <Alert\n {...{ isOpen, message, onClose, title }}\n isSubmitting={isDisconnecting}\n submitButtonLabel={t(\"neetoIntegrations.common.disconnect\")}\n onSubmit={onDisconnect}\n {...otherProps}\n />\n )\n);\n\nexport default DisconnectAlert;\n"],"names":["DisconnectAlert","withT","_ref","t","_ref$isOpen","isOpen","_ref$isDisconnecting","isDisconnecting","_ref$title","title","_ref$message","message","_ref$onClose","onClose","noop","_ref$onDisconnect","onDisconnect","otherProps","_objectWithoutProperties","_excluded","_jsx","Alert","_objectSpread","isSubmitting","submitButtonLabel","onSubmit"],"mappings":";;;;;;;;;;AAIA,IAAMA,eAAe,GAAGC,KAAK,CAC3B,UAAAC,IAAA,EAAA;AAAA,EAAA,IACEC,CAAC,GAAAD,IAAA,CAADC,CAAC;IAAAC,WAAA,GAAAF,IAAA,CACDG,MAAM;AAANA,IAAAA,MAAM,GAAAD,WAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,WAAA;IAAAE,oBAAA,GAAAJ,IAAA,CACdK,eAAe;AAAfA,IAAAA,eAAe,GAAAD,oBAAA,KAAA,MAAA,GAAG,KAAK,GAAAA,oBAAA;IAAAE,UAAA,GAAAN,IAAA,CACvBO,KAAK;AAALA,IAAAA,KAAK,GAAAD,UAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,UAAA;IAAAE,YAAA,GAAAR,IAAA,CACVS,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAG,EAAE,GAAAA,YAAA;IAAAE,YAAA,GAAAV,IAAA,CACZW,OAAO;AAAPA,IAAAA,OAAO,GAAAD,YAAA,KAAA,MAAA,GAAGE,IAAI,GAAAF,YAAA;IAAAG,iBAAA,GAAAb,IAAA,CACdc,YAAY;AAAZA,IAAAA,YAAY,GAAAD,iBAAA,KAAA,MAAA,GAAGD,IAAI,GAAAC,iBAAA;AAChBE,IAAAA,UAAU,GAAAC,wBAAA,CAAAhB,IAAA,EAAAiB,SAAA,CAAA;AAAA,EAAA,oBAEbC,GAAA,CAACC,KAAK,EAAAC,aAAA,CAAA;AACEjB,IAAAA,MAAM,EAANA,MAAM;AAAEM,IAAAA,OAAO,EAAPA,OAAO;AAAEE,IAAAA,OAAO,EAAPA,OAAO;AAAEJ,IAAAA,KAAK,EAALA,KAAK;AACrCc,IAAAA,YAAY,EAAEhB,eAAgB;AAC9BiB,IAAAA,iBAAiB,EAAErB,CAAC,CAAC,qCAAqC,CAAE;AAC5DsB,IAAAA,QAAQ,EAAET;GAAa,EACnBC,UAAU,CACf,CAAC;AAAA,CAEN;;;;"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { Badge } from '@bigbinary/neeto-atoms';
|
|
2
|
+
import { isEmpty } from 'ramda';
|
|
3
|
+
import { useTranslation, Trans } from 'react-i18next';
|
|
4
|
+
import { Link } from 'react-router-dom';
|
|
5
|
+
import { useQuery } from '@tanstack/react-query';
|
|
6
|
+
import { DEFAULT_STALE_TIME } from '@bigbinary/neeto-commons-frontend/constants';
|
|
7
|
+
import { useMutationWithInvalidation } from '@bigbinary/neeto-commons-frontend/react-utils';
|
|
8
|
+
import axios from 'axios';
|
|
9
|
+
import { D as DISCONNECTION_ALERTS_URL, e as disconnectionAlertsQueryKey } from '../query-BADHOzBP.js';
|
|
10
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
11
|
+
|
|
12
|
+
// eslint-disable-next-line @bigbinary/neeto/no-axios-import-outside-apis
|
|
13
|
+
var fetch = function fetch() {
|
|
14
|
+
return axios.get(DISCONNECTION_ALERTS_URL);
|
|
15
|
+
};
|
|
16
|
+
var destroyAll = function destroyAll(ids) {
|
|
17
|
+
return axios["delete"]("".concat(DISCONNECTION_ALERTS_URL, "/destroy_all"), {
|
|
18
|
+
params: {
|
|
19
|
+
ids: ids
|
|
20
|
+
}
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
var disconnectionAlertsApi = {
|
|
24
|
+
fetch: fetch,
|
|
25
|
+
destroyAll: destroyAll
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
var useFetchDisconnectionAlerts = function useFetchDisconnectionAlerts() {
|
|
29
|
+
return useQuery({
|
|
30
|
+
queryKey: disconnectionAlertsQueryKey,
|
|
31
|
+
queryFn: disconnectionAlertsApi.fetch,
|
|
32
|
+
staleTime: DEFAULT_STALE_TIME,
|
|
33
|
+
refetchOnWindowFocus: "always"
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
var useDismissDisconnectionAlerts = function useDismissDisconnectionAlerts() {
|
|
37
|
+
var _ref = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {},
|
|
38
|
+
_onSuccess = _ref.onSuccess;
|
|
39
|
+
return useMutationWithInvalidation(disconnectionAlertsApi.destroyAll, {
|
|
40
|
+
keysToInvalidate: [disconnectionAlertsQueryKey],
|
|
41
|
+
onSuccess: function onSuccess() {
|
|
42
|
+
return _onSuccess === null || _onSuccess === void 0 ? void 0 : _onSuccess();
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
var IntegrationLinks = function IntegrationLinks(_ref) {
|
|
48
|
+
var alerts = _ref.alerts,
|
|
49
|
+
integrationRouteMap = _ref.integrationRouteMap;
|
|
50
|
+
return alerts.map(function (alert, index) {
|
|
51
|
+
var _integrationRouteMap$ = integrationRouteMap[alert.serviceName],
|
|
52
|
+
label = _integrationRouteMap$.label,
|
|
53
|
+
path = _integrationRouteMap$.path;
|
|
54
|
+
var linkPath = alert.redirectPath || path;
|
|
55
|
+
return /*#__PURE__*/jsxs("span", {
|
|
56
|
+
children: [index > 0 && ", ", /*#__PURE__*/jsx(Link, {
|
|
57
|
+
className: "font-semibold underline",
|
|
58
|
+
to: linkPath,
|
|
59
|
+
children: label
|
|
60
|
+
})]
|
|
61
|
+
}, alert.id);
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
var DisconnectedIntegrationsRibbon = function DisconnectedIntegrationsRibbon(_ref2) {
|
|
65
|
+
var _ref2$integrationRout = _ref2.integrationRouteMap,
|
|
66
|
+
integrationRouteMap = _ref2$integrationRout === void 0 ? {} : _ref2$integrationRout;
|
|
67
|
+
useTranslation();
|
|
68
|
+
var _useFetchDisconnectio = useFetchDisconnectionAlerts(),
|
|
69
|
+
_useFetchDisconnectio2 = _useFetchDisconnectio.data,
|
|
70
|
+
_useFetchDisconnectio3 = _useFetchDisconnectio2 === void 0 ? {} : _useFetchDisconnectio2,
|
|
71
|
+
_useFetchDisconnectio4 = _useFetchDisconnectio3.disconnectionAlerts,
|
|
72
|
+
alerts = _useFetchDisconnectio4 === void 0 ? [] : _useFetchDisconnectio4;
|
|
73
|
+
var _useDismissDisconnect = useDismissDisconnectionAlerts(),
|
|
74
|
+
dismissAlerts = _useDismissDisconnect.mutate;
|
|
75
|
+
var knownAlerts = alerts.filter(function (alert) {
|
|
76
|
+
return integrationRouteMap[alert.serviceName];
|
|
77
|
+
});
|
|
78
|
+
if (isEmpty(knownAlerts)) return null;
|
|
79
|
+
return /*#__PURE__*/jsx(Badge, {
|
|
80
|
+
className: "sticky top-0 z-50 w-full p-2.5 text-center",
|
|
81
|
+
"data-testid": "disconnected-integrations-ribbon",
|
|
82
|
+
size: "lg",
|
|
83
|
+
variant: "amber",
|
|
84
|
+
onDismiss: function onDismiss() {
|
|
85
|
+
return dismissAlerts(knownAlerts.map(function (alert) {
|
|
86
|
+
return alert.id;
|
|
87
|
+
}));
|
|
88
|
+
},
|
|
89
|
+
children: /*#__PURE__*/jsx("span", {
|
|
90
|
+
className: "w-full",
|
|
91
|
+
children: /*#__PURE__*/jsx(Trans, {
|
|
92
|
+
count: knownAlerts.length,
|
|
93
|
+
defaults: "Your <integrations /> integration has been disconnected due to a permission issue. Connect it now.",
|
|
94
|
+
i18nKey: "neetoIntegrations.disconnectionRibbon.message",
|
|
95
|
+
components: {
|
|
96
|
+
integrations: /*#__PURE__*/jsx(IntegrationLinks, {
|
|
97
|
+
integrationRouteMap: integrationRouteMap,
|
|
98
|
+
alerts: knownAlerts
|
|
99
|
+
})
|
|
100
|
+
}
|
|
101
|
+
})
|
|
102
|
+
})
|
|
103
|
+
});
|
|
104
|
+
};
|
|
105
|
+
|
|
106
|
+
export { DisconnectedIntegrationsRibbon as default };
|
|
107
|
+
//# sourceMappingURL=DisconnectedIntegrationsRibbon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DisconnectedIntegrationsRibbon.js","sources":["../../app/javascript/src/components/v2/apis/disconnection_alerts.js","../../app/javascript/src/components/v2/hooks/reactQuery/useDisconnectionAlertsApi.js","../../app/javascript/src/components/v2/DisconnectedIntegrationsRibbon/index.jsx"],"sourcesContent":["// eslint-disable-next-line @bigbinary/neeto/no-axios-import-outside-apis\nimport axios from \"axios\";\n\nimport { DISCONNECTION_ALERTS_URL } from \"../constants/urls\";\n\nconst fetch = () => axios.get(DISCONNECTION_ALERTS_URL);\n\nconst destroyAll = ids =>\n axios.delete(`${DISCONNECTION_ALERTS_URL}/destroy_all`, { params: { ids } });\n\nconst disconnectionAlertsApi = { fetch, destroyAll };\n\nexport default disconnectionAlertsApi;\n","import { useQuery } from \"@tanstack/react-query\";\nimport { DEFAULT_STALE_TIME } from \"neetocommons/constants\";\nimport { useMutationWithInvalidation } from \"neetocommons/react-utils\";\n\nimport disconnectionAlertsApi from \"../../apis/disconnection_alerts\";\nimport { disconnectionAlertsQueryKey } from \"../../constants/query\";\n\nexport const useFetchDisconnectionAlerts = () =>\n useQuery({\n queryKey: disconnectionAlertsQueryKey,\n queryFn: disconnectionAlertsApi.fetch,\n staleTime: DEFAULT_STALE_TIME,\n refetchOnWindowFocus: \"always\",\n });\n\nexport const useDismissDisconnectionAlerts = ({ onSuccess } = {}) =>\n useMutationWithInvalidation(disconnectionAlertsApi.destroyAll, {\n keysToInvalidate: [disconnectionAlertsQueryKey],\n onSuccess: () => onSuccess?.(),\n });\n","import { Badge } from \"@bigbinary/neeto-atoms\";\nimport { isEmpty } from \"ramda\";\nimport { Trans, useTranslation } from \"react-i18next\";\nimport { Link } from \"react-router-dom\";\n\nimport {\n useFetchDisconnectionAlerts,\n useDismissDisconnectionAlerts,\n} from \"../hooks/reactQuery/useDisconnectionAlertsApi\";\n\nconst IntegrationLinks = ({ alerts, integrationRouteMap }) =>\n alerts.map((alert, index) => {\n const { label, path } = integrationRouteMap[alert.serviceName];\n const linkPath = alert.redirectPath || path;\n\n return (\n <span key={alert.id}>\n {index > 0 && \", \"}\n <Link className=\"font-semibold underline\" to={linkPath}>\n {label}\n </Link>\n </span>\n );\n });\n\nconst DisconnectedIntegrationsRibbon = ({ integrationRouteMap = {} }) => {\n useTranslation();\n\n const { data: { disconnectionAlerts: alerts = [] } = {} } =\n useFetchDisconnectionAlerts();\n\n const { mutate: dismissAlerts } = useDismissDisconnectionAlerts();\n\n const knownAlerts = alerts.filter(\n alert => integrationRouteMap[alert.serviceName]\n );\n\n if (isEmpty(knownAlerts)) return null;\n\n return (\n <Badge\n className=\"sticky top-0 z-50 w-full p-2.5 text-center\"\n data-testid=\"disconnected-integrations-ribbon\"\n size=\"lg\"\n variant=\"amber\"\n onDismiss={() => dismissAlerts(knownAlerts.map(alert => alert.id))}\n >\n <span className=\"w-full\">\n <Trans\n count={knownAlerts.length}\n defaults=\"Your <integrations /> integration has been disconnected due to a permission issue. Connect it now.\"\n i18nKey=\"neetoIntegrations.disconnectionRibbon.message\"\n components={{\n integrations: (\n <IntegrationLinks\n {...{ integrationRouteMap }}\n alerts={knownAlerts}\n />\n ),\n }}\n />\n </span>\n </Badge>\n );\n};\n\nexport default DisconnectedIntegrationsRibbon;\n"],"names":["fetch","axios","get","DISCONNECTION_ALERTS_URL","destroyAll","ids","concat","params","disconnectionAlertsApi","useFetchDisconnectionAlerts","useQuery","queryKey","disconnectionAlertsQueryKey","queryFn","staleTime","DEFAULT_STALE_TIME","refetchOnWindowFocus","useDismissDisconnectionAlerts","_ref","arguments","length","undefined","onSuccess","useMutationWithInvalidation","keysToInvalidate","IntegrationLinks","alerts","integrationRouteMap","map","alert","index","_integrationRouteMap$","serviceName","label","path","linkPath","redirectPath","_jsxs","children","_jsx","Link","className","to","id","DisconnectedIntegrationsRibbon","_ref2","_ref2$integrationRout","useTranslation","_useFetchDisconnectio","_useFetchDisconnectio2","data","_useFetchDisconnectio3","_useFetchDisconnectio4","disconnectionAlerts","_useDismissDisconnect","dismissAlerts","mutate","knownAlerts","filter","isEmpty","Badge","size","variant","onDismiss","Trans","count","defaults","i18nKey","components","integrations"],"mappings":";;;;;;;;;;;AAAA;AAKA,IAAMA,KAAK,GAAG,SAARA,KAAKA,GAAA;AAAA,EAAA,OAASC,KAAK,CAACC,GAAG,CAACC,wBAAwB,CAAC;AAAA,CAAA;AAEvD,IAAMC,UAAU,GAAG,SAAbA,UAAUA,CAAGC,GAAG,EAAA;AAAA,EAAA,OACpBJ,KAAK,CAAA,QAAA,CAAO,CAAA,EAAA,CAAAK,MAAA,CAAIH,wBAAwB,EAAA,cAAA,CAAA,EAAgB;AAAEI,IAAAA,MAAM,EAAE;AAAEF,MAAAA,GAAG,EAAHA;AAAI;AAAE,GAAC,CAAC;AAAA,CAAA;AAE9E,IAAMG,sBAAsB,GAAG;AAAER,EAAAA,KAAK,EAALA,KAAK;AAAEI,EAAAA,UAAU,EAAVA;AAAW,CAAC;;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