@zohodesk/dot 1.0.0-temp-203.1 → 1.0.0-temp-203.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.
Files changed (27) hide show
  1. package/.cli/PropLessFiles.html +1 -1
  2. package/.cli/UnValidatedFiles.html +1 -1
  3. package/es/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +1 -1
  4. package/lib/version2/notification/DesktopNotificationHeader/DesktopNotificationHeader.js +1 -1
  5. package/package.json +4 -4
  6. package/es/services/context/AttachmentViewerContext.js +0 -37
  7. package/es/services/context/ToastNotificationContext.js +0 -49
  8. package/es/services/helpers/getAttributeValues.js +0 -19
  9. package/es/services/helpers/handleGloabeService.js +0 -16
  10. package/es/services/hoc/WithAttachmentViewer.js +0 -16
  11. package/es/services/hoc/WithEventPopup.js +0 -49
  12. package/es/services/hoc/WithToastNotification.js +0 -16
  13. package/es/services/hooks/useAttachmentViewerService.js +0 -8
  14. package/es/services/hooks/useEventService.js +0 -49
  15. package/es/services/hooks/useGlobalService.js +0 -13
  16. package/es/services/hooks/useToastNotificationService.js +0 -8
  17. package/lib/services/context/AttachmentViewerContext.js +0 -86
  18. package/lib/services/context/ToastNotificationContext.js +0 -112
  19. package/lib/services/helpers/getAttributeValues.js +0 -41
  20. package/lib/services/helpers/handleGloabeService.js +0 -28
  21. package/lib/services/hoc/WithAttachmentViewer.js +0 -35
  22. package/lib/services/hoc/WithEventPopup.js +0 -72
  23. package/lib/services/hoc/WithToastNotification.js +0 -35
  24. package/lib/services/hooks/useAttachmentViewerService.js +0 -19
  25. package/lib/services/hooks/useEventService.js +0 -62
  26. package/lib/services/hooks/useGlobalService.js +0 -22
  27. package/lib/services/hooks/useToastNotificationService.js +0 -19
@@ -45,7 +45,7 @@
45
45
  <body>
46
46
  <div id="table-container"></div>
47
47
  <script>
48
- const jsonData = {"LinkContext":{"filePath":"src/Link/LinkContext.js"},"Loader":{"filePath":"src/v1/Loader/Loader.js"},"MessageNew":{"filePath":"src/v1/Message/Message.js"},"DOTAttachmentService":{"filePath":"src/services/context/DOTAttachmentService.js"},"DOTToastNotificationService":{"filePath":"src/services/context/DOTToastNotificationService.js"},"WithAttachmentViewer":{"filePath":"src/services/hoc/WithAttachmentViewer.js"},"WithToastNotification":{"filePath":"src/services/hoc/WithToastNotification.js"},"GlobalNotificationNew":{"filePath":"src/version2/GlobalNotification/GlobalNotification.js"},"DesktopNotification":{"filePath":"src/version2/notification/DesktopNotification/DesktopNotification.js"}}
48
+ const jsonData = {"LinkContext":{"filePath":"src/Link/LinkContext.js"},"Loader":{"filePath":"src/v1/Loader/Loader.js"},"MessageNew":{"filePath":"src/v1/Message/Message.js"},"DOTAttachmentService":{"filePath":"src/services/context/DOTAttachmentService.js"},"DOTToastNotificationService":{"filePath":"src/services/context/DOTToastNotificationService.js"},"GlobalNotificationNew":{"filePath":"src/version2/GlobalNotification/GlobalNotification.js"},"DesktopNotification":{"filePath":"src/version2/notification/DesktopNotification/DesktopNotification.js"}}
49
49
  const tableContainer = document.getElementById('table-container');
50
50
  const table = document.createElement('table');
51
51
  const thead = document.createElement('thead');
@@ -45,7 +45,7 @@
45
45
  <body>
46
46
  <div id="table-container"></div>
47
47
  <script>
48
- const jsonData = {"DotProvider":{"filePath":"src/DotProvider/DotProvider.js"},"AttachmentViewer":{"filePath":"src/services/components/Attachment/AttachmentViewer.js"},"AttachmentViewerContext":{"filePath":"src/services/context/AttachmentViewerContext.js"},"ToastNotificationContext":{"filePath":"src/services/context/ToastNotificationContext.js"}}
48
+ const jsonData = {"DotProvider":{"filePath":"src/DotProvider/DotProvider.js"},"AttachmentViewer":{"filePath":"src/services/components/Attachment/AttachmentViewer.js"}}
49
49
  const tableContainer = document.getElementById('table-container');
50
50
  const table = document.createElement('table');
51
51
  const thead = document.createElement('thead');
@@ -5,7 +5,7 @@ import { Container, Box } from '@zohodesk/components/lib/Layout';
5
5
  import AlertClose from '../../AlertClose/AlertClose';
6
6
  import AlertIcons from '../../alertIcons/AlertIcons';
7
7
  import { ResponsiveReceiver } from '@zohodesk/components/lib/Responsive/CustomResponsive';
8
- import Typography from '@zohodesk/components/es/Typography/Typography';
8
+ import Typography from '@zohodesk/components/es/v1/Typography/Typography';
9
9
  import style from './DesktopNotificationHeader.module.css';
10
10
  export default class DesktopNotificationHeader extends Component {
11
11
  constructor(props) {
@@ -21,7 +21,7 @@ var _AlertIcons = _interopRequireDefault(require("../../alertIcons/AlertIcons"))
21
21
 
22
22
  var _CustomResponsive = require("@zohodesk/components/lib/Responsive/CustomResponsive");
23
23
 
24
- var _Typography = _interopRequireDefault(require("@zohodesk/components/es/Typography/Typography"));
24
+ var _Typography = _interopRequireDefault(require("@zohodesk/components/es/v1/Typography/Typography"));
25
25
 
26
26
  var _DesktopNotificationHeaderModule = _interopRequireDefault(require("./DesktopNotificationHeader.module.css"));
27
27
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zohodesk/dot",
3
- "version": "1.0.0-temp-203.1",
3
+ "version": "1.0.0-temp-203.2",
4
4
  "main": "lib/index",
5
5
  "module": "es/index.js",
6
6
  "private": false,
@@ -64,9 +64,9 @@
64
64
  "@zohodesk-private/react-prop-validator": "1.2.3",
65
65
  "@zohodesk/a11y": "2.2.6",
66
66
  "@zohodesk/components": "1.2.53",
67
- "@zohodesk/dotkit": "1.0.0-temp-0.1",
67
+ "@zohodesk/dotkit": "1.0.0-temp-0.2",
68
68
  "@zohodesk/hooks": "2.0.5",
69
- "@zohodesk/icons": "1.0.69",
69
+ "@zohodesk/icons": "1.0.70",
70
70
  "@zohodesk/svg": "1.1.22",
71
71
  "@zohodesk/utils": "1.3.14",
72
72
  "@zohodesk/variables": "1.0.0",
@@ -79,7 +79,7 @@
79
79
  "velocity-react": "1.4.3",
80
80
  "@zohodesk/variables": "1.0.0",
81
81
  "@zohodesk/components": "1.2.53",
82
- "@zohodesk/icons": "1.0.69",
82
+ "@zohodesk/icons": "1.0.70",
83
83
  "@zohodesk/svg": "1.1.22",
84
84
  "@zohodesk/virtualizer": "1.0.3",
85
85
  "react-sortable-hoc": "^0.8.3",
@@ -1,37 +0,0 @@
1
- import React, { createContext, useState, useCallback, useMemo } from 'react';
2
- import AttachmentViewer from '../components/Attachment/AttachmentViewer';
3
- import useGlobalService from '../hooks/useGlobalService';
4
- export const AttachmentViewerContext = /*#__PURE__*/createContext();
5
- export const AttachmentViewerProvider = props => {
6
- const {
7
- children
8
- } = props;
9
- const modifiedProps = { ...props
10
- };
11
- delete modifiedProps.children;
12
- const [attachment, setAttachment] = useState({});
13
- const showAttachmentViewer = useCallback(attachment => {
14
- setAttachment(attachment);
15
- }, []);
16
- const hideAttachmentViewer = useCallback(() => {
17
- setAttachment({});
18
- }, []);
19
- const contextValue = useMemo(() => ({
20
- attachment,
21
- showAttachmentViewer,
22
- hideAttachmentViewer
23
- }), [attachment]);
24
- useGlobalService('attachmentViewer', {
25
- showAttachmentViewer,
26
- hideAttachmentViewer
27
- });
28
- return /*#__PURE__*/React.createElement(AttachmentViewerContext.Provider, {
29
- value: contextValue
30
- }, children, /*#__PURE__*/React.createElement(AttachmentViewer, {
31
- attachment: attachment,
32
- hideAttachmentViewer: hideAttachmentViewer,
33
- ...modifiedProps
34
- }));
35
- };
36
- export const AttachmentViewerConsumer = AttachmentViewerContext.Consumer;
37
- export default AttachmentViewerContext;
@@ -1,49 +0,0 @@
1
- import React, { createContext, useState, useRef, useCallback, useMemo } from 'react';
2
- import ToastNotification from '../components/ToastNotification/ToastNotification';
3
- import useGlobalService from '../hooks/useGlobalService';
4
- export const ToastNotificationContext = /*#__PURE__*/createContext();
5
- export const ToastNotificationProvider = props => {
6
- const {
7
- children
8
- } = props;
9
- const modifiedProps = { ...props
10
- };
11
- delete modifiedProps.children;
12
- const [toastMessages, setToastMessages] = useState([]);
13
- const toastIdCounter = useRef(0);
14
- const showToastNotification = useCallback(message => {
15
- const id = `toast${toastIdCounter.current++}`;
16
- const toastMessage = {
17
- id,
18
- data: message
19
- };
20
- setToastMessages(prevMessages => [...prevMessages, toastMessage]);
21
- }, []);
22
- const hideToastNotification = useCallback(id => {
23
- setToastMessages(prevMessages => prevMessages.filter(message => message.id !== id));
24
- }, []);
25
- const clearToastNotifications = useCallback(() => {
26
- setToastMessages([]);
27
- }, []);
28
- const contextValue = useMemo(() => ({
29
- toastMessages,
30
- showToastNotification,
31
- hideToastNotification,
32
- clearToastNotifications
33
- }), [toastMessages]);
34
- useGlobalService('toastNotification', {
35
- showToastNotification,
36
- hideToastNotification,
37
- clearToastNotifications
38
- });
39
- return /*#__PURE__*/React.createElement(ToastNotificationContext.Provider, {
40
- value: contextValue
41
- }, children, /*#__PURE__*/React.createElement(ToastNotification, {
42
- messages: toastMessages,
43
- hideToastNotification: hideToastNotification,
44
- clearToastNotifications: clearToastNotifications,
45
- ...modifiedProps
46
- }));
47
- };
48
- export const ToastNotificationConsumer = ToastNotificationContext.Consumer;
49
- export default ToastNotificationContext;
@@ -1,19 +0,0 @@
1
- export default function getAttributeValues(_ref) {
2
- let {
3
- element,
4
- attributes
5
- } = _ref;
6
- const values = {};
7
-
8
- for (let attr of attributes) {
9
- const value = element.getAttribute(attr);
10
- const key = attr.replace('data-', '');
11
-
12
- if (value) {
13
- values[key] = value;
14
- }
15
- }
16
-
17
- return values;
18
- }
19
- ;
@@ -1,16 +0,0 @@
1
- export const setGlobalService = (serviceName, serviceFunctions) => {
2
- if (!global.DOTServices) {
3
- global.DOTServices = {};
4
- }
5
-
6
- global.DOTServices[serviceName] = serviceFunctions;
7
- };
8
- export const removeGlobalService = serviceName => {
9
- if (global.DOTServices && global.DOTServices[serviceName]) {
10
- delete global.DOTServices[serviceName];
11
- }
12
-
13
- if (global.DOTServices && Object.keys(global.DOTServices).length === 0) {
14
- delete global.DOTServices;
15
- }
16
- };
@@ -1,16 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import useAttachmentViewerService from '../hooks/useAttachmentViewerService';
3
-
4
- const WithAttachmentViewer = Component => {
5
- const WrappedComponent = /*#__PURE__*/forwardRef((props, ref) => {
6
- const attachmentViewerProperties = useAttachmentViewerService();
7
- return /*#__PURE__*/React.createElement(Component, { ...props,
8
- ref: ref,
9
- attachmentViewerProperties: attachmentViewerProperties
10
- });
11
- });
12
- WrappedComponent.displayName = `WithAttachmentViewer(${Component.displayName || Component.name || 'Component'})`;
13
- return WrappedComponent;
14
- };
15
-
16
- export default WithAttachmentViewer;
@@ -1,49 +0,0 @@
1
- import React, { useCallback, forwardRef, useMemo } from 'react';
2
- import { Popup } from '@zohodesk/components';
3
- import { cancelBubblingEffect } from '@zohodesk/components/es/utils/Common';
4
- import useEventService from '../hooks/useEventService';
5
-
6
- const WithEventPopup = function (Component) {
7
- let properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
8
- const {
9
- onClick
10
- } = properties;
11
- const WrappedComponent = /*#__PURE__*/forwardRef((props, ref) => {
12
- const {
13
- isPopupOpen,
14
- getTargetRef,
15
- togglePopup,
16
- attributes = [],
17
- keyAttribute
18
- } = props;
19
-
20
- const _togglePopup = useCallback(event => {
21
- cancelBubblingEffect(event);
22
-
23
- if (typeof onClick === 'function') {
24
- onClick(event);
25
- }
26
-
27
- getTargetRef(event.target);
28
- togglePopup(event);
29
- }, [getTargetRef, togglePopup]);
30
-
31
- const {
32
- attributeValues
33
- } = useEventService({
34
- attributes,
35
- keyAttribute,
36
- isRendered: isPopupOpen,
37
- onClick: _togglePopup
38
- });
39
- const memoizedAttributeValues = useMemo(() => attributeValues, [attributeValues]);
40
- return isPopupOpen ? /*#__PURE__*/React.createElement(Component, { ...props,
41
- ref: ref,
42
- attributeValues: memoizedAttributeValues
43
- }) : null;
44
- });
45
- WrappedComponent.displayName = `WithEventPopup(${Component.displayName || Component.name || 'Component'})`;
46
- return WrappedComponent;
47
- };
48
-
49
- export default (Component => Popup(WithEventPopup(Component)));
@@ -1,16 +0,0 @@
1
- import React, { forwardRef } from 'react';
2
- import useToastNotificationService from '../hooks/useToastNotificationService';
3
-
4
- const WithToastNotification = Component => {
5
- const WrappedComponent = /*#__PURE__*/forwardRef((props, ref) => {
6
- const toastProperties = useToastNotificationService();
7
- return /*#__PURE__*/React.createElement(Component, { ...props,
8
- ref: ref,
9
- toastProperties: toastProperties
10
- });
11
- });
12
- WrappedComponent.displayName = `WithToastNotification(${Component.displayName || Component.name || 'Component'})`;
13
- return WrappedComponent;
14
- };
15
-
16
- export default WithToastNotification;
@@ -1,8 +0,0 @@
1
- import { useContext } from 'react';
2
- import AttachmentViewerContext from '../context/AttachmentViewerContext';
3
-
4
- const useAttachmentViewerService = () => {
5
- return useContext(AttachmentViewerContext);
6
- };
7
-
8
- export default useAttachmentViewerService;
@@ -1,49 +0,0 @@
1
- import { useCallback, useEffect, useMemo, useRef } from 'react';
2
- import { cancelBubblingEffect } from '@zohodesk/components/es/utils/Common';
3
- import getAttributeValues from '../helpers/getAttributeValues';
4
-
5
- const useEventService = properties => {
6
- const {
7
- attributes = [],
8
- keyAttribute,
9
- isRendered,
10
- onClick
11
- } = properties;
12
- const attributesValue = useRef({});
13
- useEffect(() => {
14
- if (!isRendered) {
15
- attributesValue.current = {};
16
- }
17
- }, [isRendered]);
18
- const handleClick = useCallback(event => {
19
- cancelBubblingEffect(event);
20
- const target = event.target.getAttribute(keyAttribute) || event.target.closest(`[${keyAttribute}]`);
21
-
22
- if (target) {
23
- const attributeData = getAttributeValues({
24
- element: event.target,
25
- attributes
26
- });
27
-
28
- if (Object.keys(attributeData).length > 0) {
29
- attributesValue.current = attributeData;
30
- }
31
-
32
- if (typeof onClick === 'function') {
33
- onClick(event);
34
- }
35
- }
36
- }, [attributes, keyAttribute, onClick]);
37
- useEffect(() => {
38
- document.addEventListener('click', handleClick);
39
- return () => {
40
- document.removeEventListener('click', handleClick);
41
- };
42
- }, [handleClick]);
43
- const attributeValues = useMemo(() => attributesValue.current, [attributesValue.current]);
44
- return {
45
- attributeValues
46
- };
47
- };
48
-
49
- export default useEventService;
@@ -1,13 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { removeGlobalService, setGlobalService } from "../helpers/handleGloabeService";
3
-
4
- const useGlobalService = (serviceName, serviceFunctions) => {
5
- useEffect(() => {
6
- setGlobalService(serviceName, serviceFunctions);
7
- return () => {
8
- removeGlobalService(serviceName);
9
- };
10
- }, [serviceName, serviceFunctions]);
11
- };
12
-
13
- export default useGlobalService;
@@ -1,8 +0,0 @@
1
- import { useContext } from 'react';
2
- import ToastNotificationContext from '../context/ToastNotificationContext';
3
-
4
- const useToastNotificationService = () => {
5
- return useContext(ToastNotificationContext);
6
- };
7
-
8
- export default useToastNotificationService;
@@ -1,86 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = exports.AttachmentViewerProvider = exports.AttachmentViewerContext = exports.AttachmentViewerConsumer = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _AttachmentViewer = _interopRequireDefault(require("../components/Attachment/AttachmentViewer"));
13
-
14
- var _useGlobalService = _interopRequireDefault(require("../hooks/useGlobalService"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
-
24
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
25
-
26
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27
-
28
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
29
-
30
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
31
-
32
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
33
-
34
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
-
36
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
37
-
38
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
39
-
40
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
41
-
42
- var AttachmentViewerContext = /*#__PURE__*/(0, _react.createContext)();
43
- exports.AttachmentViewerContext = AttachmentViewerContext;
44
-
45
- var AttachmentViewerProvider = function AttachmentViewerProvider(props) {
46
- var children = props.children;
47
-
48
- var modifiedProps = _objectSpread({}, props);
49
-
50
- delete modifiedProps.children;
51
-
52
- var _useState = (0, _react.useState)({}),
53
- _useState2 = _slicedToArray(_useState, 2),
54
- attachment = _useState2[0],
55
- setAttachment = _useState2[1];
56
-
57
- var showAttachmentViewer = (0, _react.useCallback)(function (attachment) {
58
- setAttachment(attachment);
59
- }, []);
60
- var hideAttachmentViewer = (0, _react.useCallback)(function () {
61
- setAttachment({});
62
- }, []);
63
- var contextValue = (0, _react.useMemo)(function () {
64
- return {
65
- attachment: attachment,
66
- showAttachmentViewer: showAttachmentViewer,
67
- hideAttachmentViewer: hideAttachmentViewer
68
- };
69
- }, [attachment]);
70
- (0, _useGlobalService["default"])('attachmentViewer', {
71
- showAttachmentViewer: showAttachmentViewer,
72
- hideAttachmentViewer: hideAttachmentViewer
73
- });
74
- return /*#__PURE__*/_react["default"].createElement(AttachmentViewerContext.Provider, {
75
- value: contextValue
76
- }, children, /*#__PURE__*/_react["default"].createElement(_AttachmentViewer["default"], _extends({
77
- attachment: attachment,
78
- hideAttachmentViewer: hideAttachmentViewer
79
- }, modifiedProps)));
80
- };
81
-
82
- exports.AttachmentViewerProvider = AttachmentViewerProvider;
83
- var AttachmentViewerConsumer = AttachmentViewerContext.Consumer;
84
- exports.AttachmentViewerConsumer = AttachmentViewerConsumer;
85
- var _default = AttachmentViewerContext;
86
- exports["default"] = _default;
@@ -1,112 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = exports.ToastNotificationProvider = exports.ToastNotificationContext = exports.ToastNotificationConsumer = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _ToastNotification = _interopRequireDefault(require("../components/ToastNotification/ToastNotification"));
13
-
14
- var _useGlobalService = _interopRequireDefault(require("../hooks/useGlobalService"));
15
-
16
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
17
-
18
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
19
-
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
21
-
22
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
23
-
24
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
25
-
26
- function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
27
-
28
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
29
-
30
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
31
-
32
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
33
-
34
- function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
35
-
36
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
37
-
38
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
39
-
40
- function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
41
-
42
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
43
-
44
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
45
-
46
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
47
-
48
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
49
-
50
- var ToastNotificationContext = /*#__PURE__*/(0, _react.createContext)();
51
- exports.ToastNotificationContext = ToastNotificationContext;
52
-
53
- var ToastNotificationProvider = function ToastNotificationProvider(props) {
54
- var children = props.children;
55
-
56
- var modifiedProps = _objectSpread({}, props);
57
-
58
- delete modifiedProps.children;
59
-
60
- var _useState = (0, _react.useState)([]),
61
- _useState2 = _slicedToArray(_useState, 2),
62
- toastMessages = _useState2[0],
63
- setToastMessages = _useState2[1];
64
-
65
- var toastIdCounter = (0, _react.useRef)(0);
66
- var showToastNotification = (0, _react.useCallback)(function (message) {
67
- var id = "toast".concat(toastIdCounter.current++);
68
- var toastMessage = {
69
- id: id,
70
- data: message
71
- };
72
- setToastMessages(function (prevMessages) {
73
- return [].concat(_toConsumableArray(prevMessages), [toastMessage]);
74
- });
75
- }, []);
76
- var hideToastNotification = (0, _react.useCallback)(function (id) {
77
- setToastMessages(function (prevMessages) {
78
- return prevMessages.filter(function (message) {
79
- return message.id !== id;
80
- });
81
- });
82
- }, []);
83
- var clearToastNotifications = (0, _react.useCallback)(function () {
84
- setToastMessages([]);
85
- }, []);
86
- var contextValue = (0, _react.useMemo)(function () {
87
- return {
88
- toastMessages: toastMessages,
89
- showToastNotification: showToastNotification,
90
- hideToastNotification: hideToastNotification,
91
- clearToastNotifications: clearToastNotifications
92
- };
93
- }, [toastMessages]);
94
- (0, _useGlobalService["default"])('toastNotification', {
95
- showToastNotification: showToastNotification,
96
- hideToastNotification: hideToastNotification,
97
- clearToastNotifications: clearToastNotifications
98
- });
99
- return /*#__PURE__*/_react["default"].createElement(ToastNotificationContext.Provider, {
100
- value: contextValue
101
- }, children, /*#__PURE__*/_react["default"].createElement(_ToastNotification["default"], _extends({
102
- messages: toastMessages,
103
- hideToastNotification: hideToastNotification,
104
- clearToastNotifications: clearToastNotifications
105
- }, modifiedProps)));
106
- };
107
-
108
- exports.ToastNotificationProvider = ToastNotificationProvider;
109
- var ToastNotificationConsumer = ToastNotificationContext.Consumer;
110
- exports.ToastNotificationConsumer = ToastNotificationConsumer;
111
- var _default = ToastNotificationContext;
112
- exports["default"] = _default;
@@ -1,41 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = getAttributeValues;
7
-
8
- function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof Symbol !== "undefined" && o[Symbol.iterator] || o["@@iterator"]; if (!it) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
9
-
10
- function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
11
-
12
- function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
13
-
14
- function getAttributeValues(_ref) {
15
- var element = _ref.element,
16
- attributes = _ref.attributes;
17
- var values = {};
18
-
19
- var _iterator = _createForOfIteratorHelper(attributes),
20
- _step;
21
-
22
- try {
23
- for (_iterator.s(); !(_step = _iterator.n()).done;) {
24
- var attr = _step.value;
25
- var value = element.getAttribute(attr);
26
- var key = attr.replace('data-', '');
27
-
28
- if (value) {
29
- values[key] = value;
30
- }
31
- }
32
- } catch (err) {
33
- _iterator.e(err);
34
- } finally {
35
- _iterator.f();
36
- }
37
-
38
- return values;
39
- }
40
-
41
- ;
@@ -1,28 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.setGlobalService = exports.removeGlobalService = void 0;
7
-
8
- var setGlobalService = function setGlobalService(serviceName, serviceFunctions) {
9
- if (!global.DOTServices) {
10
- global.DOTServices = {};
11
- }
12
-
13
- global.DOTServices[serviceName] = serviceFunctions;
14
- };
15
-
16
- exports.setGlobalService = setGlobalService;
17
-
18
- var removeGlobalService = function removeGlobalService(serviceName) {
19
- if (global.DOTServices && global.DOTServices[serviceName]) {
20
- delete global.DOTServices[serviceName];
21
- }
22
-
23
- if (global.DOTServices && Object.keys(global.DOTServices).length === 0) {
24
- delete global.DOTServices;
25
- }
26
- };
27
-
28
- exports.removeGlobalService = removeGlobalService;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _useAttachmentViewerService = _interopRequireDefault(require("../hooks/useAttachmentViewerService"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
-
22
- var WithAttachmentViewer = function WithAttachmentViewer(Component) {
23
- var WrappedComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
24
- var attachmentViewerProperties = (0, _useAttachmentViewerService["default"])();
25
- return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, props, {
26
- ref: ref,
27
- attachmentViewerProperties: attachmentViewerProperties
28
- }));
29
- });
30
- WrappedComponent.displayName = "WithAttachmentViewer(".concat(Component.displayName || Component.name || 'Component', ")");
31
- return WrappedComponent;
32
- };
33
-
34
- var _default = WithAttachmentViewer;
35
- exports["default"] = _default;
@@ -1,72 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _components = require("@zohodesk/components");
13
-
14
- var _Common = require("@zohodesk/components/es/utils/Common");
15
-
16
- var _useEventService2 = _interopRequireDefault(require("../hooks/useEventService"));
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
19
-
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
-
22
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
23
-
24
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
25
-
26
- var WithEventPopup = function WithEventPopup(Component) {
27
- var properties = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
28
- var onClick = properties.onClick;
29
- var WrappedComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
30
- var isPopupOpen = props.isPopupOpen,
31
- getTargetRef = props.getTargetRef,
32
- togglePopup = props.togglePopup,
33
- _props$attributes = props.attributes,
34
- attributes = _props$attributes === void 0 ? [] : _props$attributes,
35
- keyAttribute = props.keyAttribute;
36
-
37
- var _togglePopup = (0, _react.useCallback)(function (event) {
38
- (0, _Common.cancelBubblingEffect)(event);
39
-
40
- if (typeof onClick === 'function') {
41
- onClick(event);
42
- }
43
-
44
- getTargetRef(event.target);
45
- togglePopup(event);
46
- }, [getTargetRef, togglePopup]);
47
-
48
- var _useEventService = (0, _useEventService2["default"])({
49
- attributes: attributes,
50
- keyAttribute: keyAttribute,
51
- isRendered: isPopupOpen,
52
- onClick: _togglePopup
53
- }),
54
- attributeValues = _useEventService.attributeValues;
55
-
56
- var memoizedAttributeValues = (0, _react.useMemo)(function () {
57
- return attributeValues;
58
- }, [attributeValues]);
59
- return isPopupOpen ? /*#__PURE__*/_react["default"].createElement(Component, _extends({}, props, {
60
- ref: ref,
61
- attributeValues: memoizedAttributeValues
62
- })) : null;
63
- });
64
- WrappedComponent.displayName = "WithEventPopup(".concat(Component.displayName || Component.name || 'Component', ")");
65
- return WrappedComponent;
66
- };
67
-
68
- var _default = function _default(Component) {
69
- return (0, _components.Popup)(WithEventPopup(Component));
70
- };
71
-
72
- exports["default"] = _default;
@@ -1,35 +0,0 @@
1
- "use strict";
2
-
3
- function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
4
-
5
- Object.defineProperty(exports, "__esModule", {
6
- value: true
7
- });
8
- exports["default"] = void 0;
9
-
10
- var _react = _interopRequireWildcard(require("react"));
11
-
12
- var _useToastNotificationService = _interopRequireDefault(require("../hooks/useToastNotificationService"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
17
-
18
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
-
20
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
21
-
22
- var WithToastNotification = function WithToastNotification(Component) {
23
- var WrappedComponent = /*#__PURE__*/(0, _react.forwardRef)(function (props, ref) {
24
- var toastProperties = (0, _useToastNotificationService["default"])();
25
- return /*#__PURE__*/_react["default"].createElement(Component, _extends({}, props, {
26
- ref: ref,
27
- toastProperties: toastProperties
28
- }));
29
- });
30
- WrappedComponent.displayName = "WithToastNotification(".concat(Component.displayName || Component.name || 'Component', ")");
31
- return WrappedComponent;
32
- };
33
-
34
- var _default = WithToastNotification;
35
- exports["default"] = _default;
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var _AttachmentViewerContext = _interopRequireDefault(require("../context/AttachmentViewerContext"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- var useAttachmentViewerService = function useAttachmentViewerService() {
15
- return (0, _react.useContext)(_AttachmentViewerContext["default"]);
16
- };
17
-
18
- var _default = useAttachmentViewerService;
19
- exports["default"] = _default;
@@ -1,62 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var _Common = require("@zohodesk/components/es/utils/Common");
11
-
12
- var _getAttributeValues = _interopRequireDefault(require("../helpers/getAttributeValues"));
13
-
14
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
15
-
16
- var useEventService = function useEventService(properties) {
17
- var _properties$attribute = properties.attributes,
18
- attributes = _properties$attribute === void 0 ? [] : _properties$attribute,
19
- keyAttribute = properties.keyAttribute,
20
- isRendered = properties.isRendered,
21
- onClick = properties.onClick;
22
- var attributesValue = (0, _react.useRef)({});
23
- (0, _react.useEffect)(function () {
24
- if (!isRendered) {
25
- attributesValue.current = {};
26
- }
27
- }, [isRendered]);
28
- var handleClick = (0, _react.useCallback)(function (event) {
29
- (0, _Common.cancelBubblingEffect)(event);
30
- var target = event.target.getAttribute(keyAttribute) || event.target.closest("[".concat(keyAttribute, "]"));
31
-
32
- if (target) {
33
- var attributeData = (0, _getAttributeValues["default"])({
34
- element: event.target,
35
- attributes: attributes
36
- });
37
-
38
- if (Object.keys(attributeData).length > 0) {
39
- attributesValue.current = attributeData;
40
- }
41
-
42
- if (typeof onClick === 'function') {
43
- onClick(event);
44
- }
45
- }
46
- }, [attributes, keyAttribute, onClick]);
47
- (0, _react.useEffect)(function () {
48
- document.addEventListener('click', handleClick);
49
- return function () {
50
- document.removeEventListener('click', handleClick);
51
- };
52
- }, [handleClick]);
53
- var attributeValues = (0, _react.useMemo)(function () {
54
- return attributesValue.current;
55
- }, [attributesValue.current]);
56
- return {
57
- attributeValues: attributeValues
58
- };
59
- };
60
-
61
- var _default = useEventService;
62
- exports["default"] = _default;
@@ -1,22 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var _handleGloabeService = require("../helpers/handleGloabeService");
11
-
12
- var useGlobalService = function useGlobalService(serviceName, serviceFunctions) {
13
- (0, _react.useEffect)(function () {
14
- (0, _handleGloabeService.setGlobalService)(serviceName, serviceFunctions);
15
- return function () {
16
- (0, _handleGloabeService.removeGlobalService)(serviceName);
17
- };
18
- }, [serviceName, serviceFunctions]);
19
- };
20
-
21
- var _default = useGlobalService;
22
- exports["default"] = _default;
@@ -1,19 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports["default"] = void 0;
7
-
8
- var _react = require("react");
9
-
10
- var _ToastNotificationContext = _interopRequireDefault(require("../context/ToastNotificationContext"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
13
-
14
- var useToastNotificationService = function useToastNotificationService() {
15
- return (0, _react.useContext)(_ToastNotificationContext["default"]);
16
- };
17
-
18
- var _default = useToastNotificationService;
19
- exports["default"] = _default;