@lokalise/harmony 1.33.1 → 1.33.3-exp-louis-27.1.1.1

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 (147) hide show
  1. package/dist/harmony100.cjs +99 -21
  2. package/dist/harmony100.cjs.map +1 -1
  3. package/dist/harmony100.mjs +81 -20
  4. package/dist/harmony100.mjs.map +1 -1
  5. package/dist/harmony101.cjs +18 -6
  6. package/dist/harmony101.cjs.map +1 -1
  7. package/dist/harmony101.mjs +18 -6
  8. package/dist/harmony101.mjs.map +1 -1
  9. package/dist/harmony102.cjs +12 -130
  10. package/dist/harmony102.cjs.map +1 -1
  11. package/dist/harmony102.mjs +12 -130
  12. package/dist/harmony102.mjs.map +1 -1
  13. package/dist/harmony103.cjs +18 -9
  14. package/dist/harmony103.cjs.map +1 -1
  15. package/dist/harmony103.mjs +18 -9
  16. package/dist/harmony103.mjs.map +1 -1
  17. package/dist/harmony104.cjs +6 -5
  18. package/dist/harmony104.cjs.map +1 -1
  19. package/dist/harmony104.mjs +6 -5
  20. package/dist/harmony104.mjs.map +1 -1
  21. package/dist/harmony105.cjs +129 -37
  22. package/dist/harmony105.cjs.map +1 -1
  23. package/dist/harmony105.mjs +129 -37
  24. package/dist/harmony105.mjs.map +1 -1
  25. package/dist/harmony106.cjs +12 -60
  26. package/dist/harmony106.cjs.map +1 -1
  27. package/dist/harmony106.mjs +11 -59
  28. package/dist/harmony106.mjs.map +1 -1
  29. package/dist/harmony107.cjs +5 -7
  30. package/dist/harmony107.cjs.map +1 -1
  31. package/dist/harmony107.mjs +5 -7
  32. package/dist/harmony107.mjs.map +1 -1
  33. package/dist/harmony108.cjs +36 -95
  34. package/dist/harmony108.cjs.map +1 -1
  35. package/dist/harmony108.mjs +36 -78
  36. package/dist/harmony108.mjs.map +1 -1
  37. package/dist/harmony109.cjs +60 -18
  38. package/dist/harmony109.cjs.map +1 -1
  39. package/dist/harmony109.mjs +60 -18
  40. package/dist/harmony109.mjs.map +1 -1
  41. package/dist/harmony110.cjs +6 -13
  42. package/dist/harmony110.cjs.map +1 -1
  43. package/dist/harmony110.mjs +6 -13
  44. package/dist/harmony110.mjs.map +1 -1
  45. package/dist/harmony112.cjs +6 -63
  46. package/dist/harmony112.cjs.map +1 -1
  47. package/dist/harmony112.mjs +5 -62
  48. package/dist/harmony112.mjs.map +1 -1
  49. package/dist/harmony113.cjs +6 -89
  50. package/dist/harmony113.cjs.map +1 -1
  51. package/dist/harmony113.mjs +5 -88
  52. package/dist/harmony113.mjs.map +1 -1
  53. package/dist/harmony114.cjs +63 -19
  54. package/dist/harmony114.cjs.map +1 -1
  55. package/dist/harmony114.mjs +62 -18
  56. package/dist/harmony114.mjs.map +1 -1
  57. package/dist/harmony115.cjs +89 -6
  58. package/dist/harmony115.cjs.map +1 -1
  59. package/dist/harmony115.mjs +88 -5
  60. package/dist/harmony115.mjs.map +1 -1
  61. package/dist/harmony116.cjs +18 -5
  62. package/dist/harmony116.cjs.map +1 -1
  63. package/dist/harmony116.mjs +18 -5
  64. package/dist/harmony116.mjs.map +1 -1
  65. package/dist/harmony119.cjs +1 -1
  66. package/dist/harmony119.mjs +1 -1
  67. package/dist/harmony120.cjs +2 -2
  68. package/dist/harmony120.mjs +2 -2
  69. package/dist/harmony122.cjs +13 -7
  70. package/dist/harmony122.cjs.map +1 -1
  71. package/dist/harmony122.mjs +13 -7
  72. package/dist/harmony122.mjs.map +1 -1
  73. package/dist/harmony123.cjs +15 -57
  74. package/dist/harmony123.cjs.map +1 -1
  75. package/dist/harmony123.mjs +15 -57
  76. package/dist/harmony123.mjs.map +1 -1
  77. package/dist/harmony124.cjs +15 -59
  78. package/dist/harmony124.cjs.map +1 -1
  79. package/dist/harmony124.mjs +15 -59
  80. package/dist/harmony124.mjs.map +1 -1
  81. package/dist/harmony125.cjs +7 -18
  82. package/dist/harmony125.cjs.map +1 -1
  83. package/dist/harmony125.mjs +6 -17
  84. package/dist/harmony125.mjs.map +1 -1
  85. package/dist/harmony126.cjs +57 -13
  86. package/dist/harmony126.cjs.map +1 -1
  87. package/dist/harmony126.mjs +57 -13
  88. package/dist/harmony126.mjs.map +1 -1
  89. package/dist/harmony127.cjs +59 -14
  90. package/dist/harmony127.cjs.map +1 -1
  91. package/dist/harmony127.mjs +59 -14
  92. package/dist/harmony127.mjs.map +1 -1
  93. package/dist/harmony128.cjs +19 -17
  94. package/dist/harmony128.cjs.map +1 -1
  95. package/dist/harmony128.mjs +18 -16
  96. package/dist/harmony128.mjs.map +1 -1
  97. package/dist/harmony129.cjs +1 -1
  98. package/dist/harmony129.mjs +1 -1
  99. package/dist/harmony131.cjs +3 -3
  100. package/dist/harmony131.mjs +3 -3
  101. package/dist/harmony133.cjs +6 -46
  102. package/dist/harmony133.cjs.map +1 -1
  103. package/dist/harmony133.mjs +6 -46
  104. package/dist/harmony133.mjs.map +1 -1
  105. package/dist/harmony134.cjs +13 -13
  106. package/dist/harmony134.cjs.map +1 -1
  107. package/dist/harmony134.mjs +12 -12
  108. package/dist/harmony134.mjs.map +1 -1
  109. package/dist/harmony135.cjs +31 -5
  110. package/dist/harmony135.cjs.map +1 -1
  111. package/dist/harmony135.mjs +31 -5
  112. package/dist/harmony135.mjs.map +1 -1
  113. package/dist/harmony136.cjs +13 -11
  114. package/dist/harmony136.cjs.map +1 -1
  115. package/dist/harmony136.mjs +13 -11
  116. package/dist/harmony136.mjs.map +1 -1
  117. package/dist/harmony137.cjs +45 -31
  118. package/dist/harmony137.cjs.map +1 -1
  119. package/dist/harmony137.mjs +45 -31
  120. package/dist/harmony137.mjs.map +1 -1
  121. package/dist/harmony138.cjs +13 -15
  122. package/dist/harmony138.cjs.map +1 -1
  123. package/dist/harmony138.mjs +12 -14
  124. package/dist/harmony138.mjs.map +1 -1
  125. package/dist/harmony16.cjs +1 -1
  126. package/dist/harmony16.mjs +1 -1
  127. package/dist/harmony23.cjs +1 -1
  128. package/dist/harmony23.mjs +1 -1
  129. package/dist/harmony24.cjs +1 -1
  130. package/dist/harmony24.mjs +1 -1
  131. package/dist/harmony39.cjs +1 -0
  132. package/dist/harmony39.cjs.map +1 -1
  133. package/dist/harmony39.mjs +1 -0
  134. package/dist/harmony39.mjs.map +1 -1
  135. package/dist/harmony65.cjs.map +1 -1
  136. package/dist/harmony65.mjs.map +1 -1
  137. package/dist/harmony69.cjs +1 -1
  138. package/dist/harmony69.mjs +1 -1
  139. package/dist/harmony79.cjs +6 -6
  140. package/dist/harmony79.mjs +6 -6
  141. package/dist/harmony88.cjs +1 -1
  142. package/dist/harmony88.mjs +1 -1
  143. package/dist/harmony89.cjs +1 -1
  144. package/dist/harmony89.mjs +1 -1
  145. package/dist/types/src/features/publicApi/hooks/useListTeamUsersQuery.d.ts +0 -1
  146. package/dist/types/src/features/publicApi/types/teamUserTypes.d.ts +1 -1
  147. package/package.json +2 -2
@@ -1,102 +1,43 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const React = require("react");
4
- const debounce = require("./harmony115.cjs");
5
- const throttle = require("./harmony116.cjs");
6
- function _interopNamespaceDefault(e) {
7
- const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
8
- if (e) {
9
- for (const k in e) {
10
- if (k !== "default") {
11
- const d = Object.getOwnPropertyDescriptor(e, k);
12
- Object.defineProperty(n, k, d.get ? d : {
13
- enumerable: true,
14
- get: () => e[k]
15
- });
16
- }
17
- }
18
- }
19
- n.default = e;
20
- return Object.freeze(n);
21
- }
22
- const React__namespace = /* @__PURE__ */ _interopNamespaceDefault(React);
23
- const patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {
24
- switch (refreshMode) {
25
- case "debounce":
26
- return debounce.default(resizeCallback, refreshRate, refreshOptions);
27
- case "throttle":
28
- return throttle.default(resizeCallback, refreshRate, refreshOptions);
29
- default:
30
- return resizeCallback;
31
- }
32
- };
33
- const useCallbackRef = (
34
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
35
- (callback) => {
36
- const callbackRef = React__namespace.useRef(callback);
37
- React__namespace.useEffect(() => {
38
- callbackRef.current = callback;
39
- });
40
- return React__namespace.useMemo(() => (...args) => {
41
- var _a;
42
- return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args);
43
- }, []);
44
- }
45
- );
46
- const useRefProxy = (
47
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
48
- (targetRef) => {
49
- const [refElement, setRefElement] = React__namespace.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);
50
- if (targetRef) {
51
- setTimeout(() => {
52
- if (targetRef.current !== refElement) {
53
- setRefElement(targetRef.current);
54
- }
55
- }, 0);
56
- }
57
- const refProxy = React__namespace.useMemo(() => new Proxy((node) => {
58
- if (node !== refElement) {
59
- setRefElement(node);
60
- }
61
- }, {
62
- get(target, prop) {
63
- if (prop === "current") {
64
- return refElement;
65
- }
66
- return target[prop];
67
- },
68
- set(target, prop, value) {
69
- if (prop === "current") {
70
- setRefElement(value);
71
- } else {
72
- target[prop] = value;
73
- }
74
- return true;
75
- }
76
- }), [refElement]);
77
- return { refProxy, refElement, setRefElement };
78
- }
79
- );
80
- const getDimensions = (entry, box) => {
81
- if (box === "border-box") {
82
- return {
83
- width: entry.borderBoxSize[0].inlineSize,
84
- height: entry.borderBoxSize[0].blockSize
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const louis = require("@lokalise/louis");
5
+ const useEffectOnce = require("./harmony12.cjs");
6
+ const TaskOverview = require("./harmony115.cjs");
7
+ const TasksContext = require("./harmony107.cjs");
8
+ const taskEvents = require("./harmony110.cjs");
9
+ const TasksPopover_module = require("./harmony116.cjs");
10
+ const TasksPopover = () => {
11
+ const { tasks, onTasksWidgetOpen, loadingTasks, fetchTasks } = TasksContext.useTasks();
12
+ useEffectOnce.useEffectOnce(() => {
13
+ const handleTaskPopoverOpen = async () => {
14
+ const contextTasks = await fetchTasks();
15
+ onTasksWidgetOpen == null ? void 0 : onTasksWidgetOpen({ tasks: contextTasks });
85
16
  };
86
- }
87
- if (box === "content-box") {
88
- return {
89
- width: entry.contentBoxSize[0].inlineSize,
90
- height: entry.contentBoxSize[0].blockSize
17
+ handleTaskPopoverOpen();
18
+ document.addEventListener(taskEvents.TaskEvents.TaskCompleted, fetchTasks);
19
+ document.addEventListener(taskEvents.TaskEvents.TaskClosed, fetchTasks);
20
+ document.addEventListener(taskEvents.TaskEvents.Refresh, fetchTasks);
21
+ return () => {
22
+ document.removeEventListener(taskEvents.TaskEvents.TaskCompleted, fetchTasks);
23
+ document.removeEventListener(taskEvents.TaskEvents.TaskClosed, fetchTasks);
24
+ document.removeEventListener(taskEvents.TaskEvents.Refresh, fetchTasks);
91
25
  };
26
+ });
27
+ if (loadingTasks) {
28
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "sidebar-tasks-loading-popover", className: TasksPopover_module.default.loadingContainer, children: /* @__PURE__ */ jsxRuntime.jsx(louis.Loading, {}) });
29
+ }
30
+ if (tasks.length === 0) {
31
+ return /* @__PURE__ */ jsxRuntime.jsxs("div", { "data-testid": "sidebar-no-tasks-popover", className: TasksPopover_module.default.noTasksContainer, children: [
32
+ /* @__PURE__ */ jsxRuntime.jsx("h3", { className: TasksPopover_module.default.noTasksHeading, children: "No tasks" }),
33
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: TasksPopover_module.default.noTasksText, children: [
34
+ "Your incoming tasks will appear here.",
35
+ /* @__PURE__ */ jsxRuntime.jsx("br", {}),
36
+ /* @__PURE__ */ jsxRuntime.jsx(louis.Link, { href: "https://docs.lokalise.com/translation-workflow/tasks", target: "_new", children: "Learn more" })
37
+ ] })
38
+ ] });
92
39
  }
93
- return {
94
- width: entry.contentRect.width,
95
- height: entry.contentRect.height
96
- };
40
+ return /* @__PURE__ */ jsxRuntime.jsx("div", { "data-testid": "sidebar-tasks-popover", className: TasksPopover_module.default.tasksContainer, children: tasks.map((task) => /* @__PURE__ */ jsxRuntime.jsx(TaskOverview.TaskOverview, { task }, task.id)) });
97
41
  };
98
- exports.getDimensions = getDimensions;
99
- exports.patchResizeCallback = patchResizeCallback;
100
- exports.useCallbackRef = useCallbackRef;
101
- exports.useRefProxy = useRefProxy;
42
+ exports.TasksPopover = TasksPopover;
102
43
  //# sourceMappingURL=harmony108.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony108.cjs","sources":["../node_modules/react-resize-detector/build/utils.js"],"sourcesContent":["import * as React from 'react';\nimport debounce from 'lodash/debounce.js';\nimport throttle from 'lodash/throttle.js';\n\n/**\n * Wraps the resize callback with a lodash debounce / throttle based on the refresh mode\n */\nconst patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {\n switch (refreshMode) {\n case 'debounce':\n return debounce(resizeCallback, refreshRate, refreshOptions);\n case 'throttle':\n return throttle(resizeCallback, refreshRate, refreshOptions);\n default:\n return resizeCallback;\n }\n};\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nconst useCallbackRef = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(callback) => {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => ((...args) => { var _a; return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args); }), []);\n};\n/** `useRef` hook doesn't handle conditional rendering or dynamic ref changes.\n * This hook creates a proxy that ensures that `refElement` is updated whenever the ref is changed. */\nconst useRefProxy = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(targetRef) => {\n // we are going to use this ref to store the last element that was passed to the hook\n const [refElement, setRefElement] = React.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);\n // if targetRef is passed, we need to update the refElement\n // we have to use setTimeout because ref get assigned after the hook is called\n // in the future releases we are going to remove targetRef and force users to use ref returned by the hook\n if (targetRef) {\n setTimeout(() => {\n if (targetRef.current !== refElement) {\n setRefElement(targetRef.current);\n }\n }, 0);\n }\n // this is a memo that will be called every time the ref is changed\n // This proxy will properly call setState either when the ref is called as a function or when `.current` is set\n // we call setState inside to trigger rerender\n const refProxy = React.useMemo(() => new Proxy((node) => {\n if (node !== refElement) {\n setRefElement(node);\n }\n }, {\n get(target, prop) {\n if (prop === 'current') {\n return refElement;\n }\n return target[prop];\n },\n set(target, prop, value) {\n if (prop === 'current') {\n setRefElement(value);\n }\n else {\n target[prop] = value;\n }\n return true;\n },\n }), [refElement]);\n return { refProxy, refElement, setRefElement };\n};\n/** Calculates the dimensions of the element based on the current box model.\n * @see https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model\n */\nconst getDimensions = (entry, box) => {\n // Value\t Border\t Padding\t Inner Content\n // ---------------------------------------------------\n // 'border-box'\t Yes\t Yes\t Yes\n // 'content-box'\t No\t No\t Yes\n // undefined No\t No?\t Yes\n if (box === 'border-box') {\n return {\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize,\n };\n }\n if (box === 'content-box') {\n return {\n width: entry.contentBoxSize[0].inlineSize,\n height: entry.contentBoxSize[0].blockSize,\n };\n }\n return {\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n };\n};\n\nexport { getDimensions, patchResizeCallback, useCallbackRef, useRefProxy };\n//# sourceMappingURL=utils.js.map\n"],"names":["debounce","throttle","React"],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAOK,MAAC,sBAAsB,CAAC,gBAAgB,aAAa,aAAa,mBAAmB;AACtF,UAAQ,aAAW;AAAA,IACf,KAAK;AACD,aAAOA,iBAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D,KAAK;AACD,aAAOC,iBAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D;AACI,aAAO;AAAA,EACnB;AACA;AAKK,MAAC;AAAA;AAAA,EAEN,CAAC,aAAa;AACV,UAAM,cAAcC,iBAAM,OAAO,QAAQ;AACzCA,qBAAM,UAAU,MAAM;AAClB,kBAAY,UAAU;AAAA,IAC9B,CAAK;AACD,WAAOA,iBAAM,QAAQ,MAAO,IAAI,SAAS;AAAE,UAAI;AAAI,cAAQ,KAAK,YAAY,aAAa,QAAQ,OAAO,SAAS,SAAS,GAAG,KAAK,aAAa,GAAG,IAAI;AAAA,IAAI,GAAG,CAAA,CAAE;AAAA,EACnK;AAAA;AAGK,MAAC;AAAA;AAAA,EAEN,CAAC,cAAc;AAEX,UAAM,CAAC,YAAY,aAAa,IAAIA,iBAAM,UAAU,cAAc,QAAQ,cAAc,SAAS,SAAS,UAAU,YAAY,IAAI;AAIpI,QAAI,WAAW;AACX,iBAAW,MAAM;AACb,YAAI,UAAU,YAAY,YAAY;AAClC,wBAAc,UAAU,OAAO;AAAA,QAC/C;AAAA,MACS,GAAE,CAAC;AAAA,IACZ;AAII,UAAM,WAAWA,iBAAM,QAAQ,MAAM,IAAI,MAAM,CAAC,SAAS;AACrD,UAAI,SAAS,YAAY;AACrB,sBAAc,IAAI;AAAA,MAC9B;AAAA,IACA,GAAO;AAAA,MACC,IAAI,QAAQ,MAAM;AACd,YAAI,SAAS,WAAW;AACpB,iBAAO;AAAA,QACvB;AACY,eAAO,OAAO,IAAI;AAAA,MACrB;AAAA,MACD,IAAI,QAAQ,MAAM,OAAO;AACrB,YAAI,SAAS,WAAW;AACpB,wBAAc,KAAK;AAAA,QACnC,OACiB;AACD,iBAAO,IAAI,IAAI;AAAA,QAC/B;AACY,eAAO;AAAA,MACV;AAAA,IACT,CAAK,GAAG,CAAC,UAAU,CAAC;AAChB,WAAO,EAAE,UAAU,YAAY,cAAe;AAAA,EAClD;AAAA;AAIK,MAAC,gBAAgB,CAAC,OAAO,QAAQ;AAMlC,MAAI,QAAQ,cAAc;AACtB,WAAO;AAAA,MACH,OAAO,MAAM,cAAc,CAAC,EAAE;AAAA,MAC9B,QAAQ,MAAM,cAAc,CAAC,EAAE;AAAA,IAClC;AAAA,EACT;AACI,MAAI,QAAQ,eAAe;AACvB,WAAO;AAAA,MACH,OAAO,MAAM,eAAe,CAAC,EAAE;AAAA,MAC/B,QAAQ,MAAM,eAAe,CAAC,EAAE;AAAA,IACnC;AAAA,EACT;AACI,SAAO;AAAA,IACH,OAAO,MAAM,YAAY;AAAA,IACzB,QAAQ,MAAM,YAAY;AAAA,EAC7B;AACL;;;;;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"harmony108.cjs","sources":["../src/components/Sidebar/Widgets/Tasks/TasksPopover/TasksPopover.tsx"],"sourcesContent":["import { Link, Loading } from '@lokalise/louis'\nimport { useEffectOnce } from '@utils'\nimport { TaskOverview } from '../TaskOverview/TaskOverview'\nimport { useTasks } from '../TasksContext'\nimport type { SidebarTask } from '../types'\nimport { TaskEvents } from '../utils/taskEvents'\nimport styles from './TasksPopover.module.css'\n\nexport const TasksPopover = () => {\n\tconst { tasks, onTasksWidgetOpen, loadingTasks, fetchTasks } = useTasks()\n\n\tuseEffectOnce(() => {\n\t\tconst handleTaskPopoverOpen = async () => {\n\t\t\tconst contextTasks = await fetchTasks()\n\t\t\tonTasksWidgetOpen?.({ tasks: contextTasks })\n\t\t}\n\n\t\thandleTaskPopoverOpen()\n\n\t\tdocument.addEventListener(TaskEvents.TaskCompleted, fetchTasks)\n\t\tdocument.addEventListener(TaskEvents.TaskClosed, fetchTasks)\n\t\tdocument.addEventListener(TaskEvents.Refresh, fetchTasks)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(TaskEvents.TaskCompleted, fetchTasks)\n\t\t\tdocument.removeEventListener(TaskEvents.TaskClosed, fetchTasks)\n\t\t\tdocument.removeEventListener(TaskEvents.Refresh, fetchTasks)\n\t\t}\n\t})\n\n\tif (loadingTasks) {\n\t\treturn (\n\t\t\t<div data-testid=\"sidebar-tasks-loading-popover\" className={styles.loadingContainer}>\n\t\t\t\t<Loading />\n\t\t\t</div>\n\t\t)\n\t}\n\n\tif (tasks.length === 0) {\n\t\treturn (\n\t\t\t<div data-testid=\"sidebar-no-tasks-popover\" className={styles.noTasksContainer}>\n\t\t\t\t<h3 className={styles.noTasksHeading}>No tasks</h3>\n\t\t\t\t<div className={styles.noTasksText}>\n\t\t\t\t\tYour incoming tasks will appear here.\n\t\t\t\t\t<br />\n\t\t\t\t\t<Link href=\"https://docs.lokalise.com/translation-workflow/tasks\" target=\"_new\">\n\t\t\t\t\t\tLearn more\n\t\t\t\t\t</Link>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<div data-testid=\"sidebar-tasks-popover\" className={styles.tasksContainer}>\n\t\t\t{tasks.map((task: SidebarTask) => (\n\t\t\t\t<TaskOverview key={task.id} task={task} />\n\t\t\t))}\n\t\t</div>\n\t)\n}\n"],"names":["useTasks","useEffectOnce","TaskEvents","jsx","styles","Loading","jsxs","Link","TaskOverview"],"mappings":";;;;;;;;;AAQO,MAAM,eAAe,MAAM;AACjC,QAAM,EAAE,OAAO,mBAAmB,cAAc,WAAA,IAAeA,aAAAA,SAAS;AAExEC,gBAAAA,cAAc,MAAM;AACnB,UAAM,wBAAwB,YAAY;AACnC,YAAA,eAAe,MAAM,WAAW;AAClB,6DAAA,EAAE,OAAO;IAC9B;AAEsB,0BAAA;AAEb,aAAA,iBAAiBC,sBAAW,eAAe,UAAU;AACrD,aAAA,iBAAiBA,sBAAW,YAAY,UAAU;AAClD,aAAA,iBAAiBA,sBAAW,SAAS,UAAU;AAExD,WAAO,MAAM;AACH,eAAA,oBAAoBA,sBAAW,eAAe,UAAU;AACxD,eAAA,oBAAoBA,sBAAW,YAAY,UAAU;AACrD,eAAA,oBAAoBA,sBAAW,SAAS,UAAU;AAAA,IAC5D;AAAA,EAAA,CACA;AAED,MAAI,cAAc;AAEhB,WAAAC,2BAAA,IAAC,SAAI,eAAY,iCAAgC,WAAWC,4BAAO,kBAClE,UAACD,2BAAAA,IAAAE,MAAAA,SAAA,CAAA,CAAQ,EACV,CAAA;AAAA,EAAA;AAIE,MAAA,MAAM,WAAW,GAAG;AACvB,2CACE,OAAI,EAAA,eAAY,4BAA2B,WAAWD,oBAAAA,QAAO,kBAC7D,UAAA;AAAA,MAAAD,2BAAA,IAAC,MAAG,EAAA,WAAWC,oBAAO,QAAA,gBAAgB,UAAQ,YAAA;AAAA,MAC7CE,2BAAA,KAAA,OAAA,EAAI,WAAWF,oBAAAA,QAAO,aAAa,UAAA;AAAA,QAAA;AAAA,uCAElC,MAAG,EAAA;AAAA,uCACHG,MAAAA,MAAK,EAAA,MAAK,wDAAuD,QAAO,QAAO,UAEhF,aAAA,CAAA;AAAA,MAAA,EACD,CAAA;AAAA,IAAA,GACD;AAAA,EAAA;AAIF,wCACE,OAAI,EAAA,eAAY,yBAAwB,WAAWH,oBAAAA,QAAO,gBACzD,UAAA,MAAM,IAAI,CAAC,SACVD,2BAAA,IAAAK,2BAAA,EAA2B,QAAT,KAAK,EAAgB,CACxC,GACF;AAEF;;"}
@@ -1,85 +1,43 @@
1
- import * as React from "react";
2
- import debounce from "./harmony115.mjs";
3
- import throttle from "./harmony116.mjs";
4
- const patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {
5
- switch (refreshMode) {
6
- case "debounce":
7
- return debounce(resizeCallback, refreshRate, refreshOptions);
8
- case "throttle":
9
- return throttle(resizeCallback, refreshRate, refreshOptions);
10
- default:
11
- return resizeCallback;
12
- }
13
- };
14
- const useCallbackRef = (
15
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
16
- (callback) => {
17
- const callbackRef = React.useRef(callback);
18
- React.useEffect(() => {
19
- callbackRef.current = callback;
20
- });
21
- return React.useMemo(() => (...args) => {
22
- var _a;
23
- return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args);
24
- }, []);
25
- }
26
- );
27
- const useRefProxy = (
28
- // eslint-disable-next-line @typescript-eslint/no-explicit-any
29
- (targetRef) => {
30
- const [refElement, setRefElement] = React.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);
31
- if (targetRef) {
32
- setTimeout(() => {
33
- if (targetRef.current !== refElement) {
34
- setRefElement(targetRef.current);
35
- }
36
- }, 0);
37
- }
38
- const refProxy = React.useMemo(() => new Proxy((node) => {
39
- if (node !== refElement) {
40
- setRefElement(node);
41
- }
42
- }, {
43
- get(target, prop) {
44
- if (prop === "current") {
45
- return refElement;
46
- }
47
- return target[prop];
48
- },
49
- set(target, prop, value) {
50
- if (prop === "current") {
51
- setRefElement(value);
52
- } else {
53
- target[prop] = value;
54
- }
55
- return true;
56
- }
57
- }), [refElement]);
58
- return { refProxy, refElement, setRefElement };
59
- }
60
- );
61
- const getDimensions = (entry, box) => {
62
- if (box === "border-box") {
63
- return {
64
- width: entry.borderBoxSize[0].inlineSize,
65
- height: entry.borderBoxSize[0].blockSize
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { Loading, Link } from "@lokalise/louis";
3
+ import { useEffectOnce } from "./harmony12.mjs";
4
+ import { TaskOverview } from "./harmony115.mjs";
5
+ import { useTasks } from "./harmony107.mjs";
6
+ import { TaskEvents } from "./harmony110.mjs";
7
+ import styles from "./harmony116.mjs";
8
+ const TasksPopover = () => {
9
+ const { tasks, onTasksWidgetOpen, loadingTasks, fetchTasks } = useTasks();
10
+ useEffectOnce(() => {
11
+ const handleTaskPopoverOpen = async () => {
12
+ const contextTasks = await fetchTasks();
13
+ onTasksWidgetOpen == null ? void 0 : onTasksWidgetOpen({ tasks: contextTasks });
66
14
  };
67
- }
68
- if (box === "content-box") {
69
- return {
70
- width: entry.contentBoxSize[0].inlineSize,
71
- height: entry.contentBoxSize[0].blockSize
15
+ handleTaskPopoverOpen();
16
+ document.addEventListener(TaskEvents.TaskCompleted, fetchTasks);
17
+ document.addEventListener(TaskEvents.TaskClosed, fetchTasks);
18
+ document.addEventListener(TaskEvents.Refresh, fetchTasks);
19
+ return () => {
20
+ document.removeEventListener(TaskEvents.TaskCompleted, fetchTasks);
21
+ document.removeEventListener(TaskEvents.TaskClosed, fetchTasks);
22
+ document.removeEventListener(TaskEvents.Refresh, fetchTasks);
72
23
  };
24
+ });
25
+ if (loadingTasks) {
26
+ return /* @__PURE__ */ jsx("div", { "data-testid": "sidebar-tasks-loading-popover", className: styles.loadingContainer, children: /* @__PURE__ */ jsx(Loading, {}) });
27
+ }
28
+ if (tasks.length === 0) {
29
+ return /* @__PURE__ */ jsxs("div", { "data-testid": "sidebar-no-tasks-popover", className: styles.noTasksContainer, children: [
30
+ /* @__PURE__ */ jsx("h3", { className: styles.noTasksHeading, children: "No tasks" }),
31
+ /* @__PURE__ */ jsxs("div", { className: styles.noTasksText, children: [
32
+ "Your incoming tasks will appear here.",
33
+ /* @__PURE__ */ jsx("br", {}),
34
+ /* @__PURE__ */ jsx(Link, { href: "https://docs.lokalise.com/translation-workflow/tasks", target: "_new", children: "Learn more" })
35
+ ] })
36
+ ] });
73
37
  }
74
- return {
75
- width: entry.contentRect.width,
76
- height: entry.contentRect.height
77
- };
38
+ return /* @__PURE__ */ jsx("div", { "data-testid": "sidebar-tasks-popover", className: styles.tasksContainer, children: tasks.map((task) => /* @__PURE__ */ jsx(TaskOverview, { task }, task.id)) });
78
39
  };
79
40
  export {
80
- getDimensions,
81
- patchResizeCallback,
82
- useCallbackRef,
83
- useRefProxy
41
+ TasksPopover
84
42
  };
85
43
  //# sourceMappingURL=harmony108.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony108.mjs","sources":["../node_modules/react-resize-detector/build/utils.js"],"sourcesContent":["import * as React from 'react';\nimport debounce from 'lodash/debounce.js';\nimport throttle from 'lodash/throttle.js';\n\n/**\n * Wraps the resize callback with a lodash debounce / throttle based on the refresh mode\n */\nconst patchResizeCallback = (resizeCallback, refreshMode, refreshRate, refreshOptions) => {\n switch (refreshMode) {\n case 'debounce':\n return debounce(resizeCallback, refreshRate, refreshOptions);\n case 'throttle':\n return throttle(resizeCallback, refreshRate, refreshOptions);\n default:\n return resizeCallback;\n }\n};\n/**\n * A custom hook that converts a callback to a ref to avoid triggering re-renders when passed as a\n * prop or avoid re-executing effects when passed as a dependency\n */\nconst useCallbackRef = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(callback) => {\n const callbackRef = React.useRef(callback);\n React.useEffect(() => {\n callbackRef.current = callback;\n });\n return React.useMemo(() => ((...args) => { var _a; return (_a = callbackRef.current) === null || _a === void 0 ? void 0 : _a.call(callbackRef, ...args); }), []);\n};\n/** `useRef` hook doesn't handle conditional rendering or dynamic ref changes.\n * This hook creates a proxy that ensures that `refElement` is updated whenever the ref is changed. */\nconst useRefProxy = \n// eslint-disable-next-line @typescript-eslint/no-explicit-any\n(targetRef) => {\n // we are going to use this ref to store the last element that was passed to the hook\n const [refElement, setRefElement] = React.useState((targetRef === null || targetRef === void 0 ? void 0 : targetRef.current) || null);\n // if targetRef is passed, we need to update the refElement\n // we have to use setTimeout because ref get assigned after the hook is called\n // in the future releases we are going to remove targetRef and force users to use ref returned by the hook\n if (targetRef) {\n setTimeout(() => {\n if (targetRef.current !== refElement) {\n setRefElement(targetRef.current);\n }\n }, 0);\n }\n // this is a memo that will be called every time the ref is changed\n // This proxy will properly call setState either when the ref is called as a function or when `.current` is set\n // we call setState inside to trigger rerender\n const refProxy = React.useMemo(() => new Proxy((node) => {\n if (node !== refElement) {\n setRefElement(node);\n }\n }, {\n get(target, prop) {\n if (prop === 'current') {\n return refElement;\n }\n return target[prop];\n },\n set(target, prop, value) {\n if (prop === 'current') {\n setRefElement(value);\n }\n else {\n target[prop] = value;\n }\n return true;\n },\n }), [refElement]);\n return { refProxy, refElement, setRefElement };\n};\n/** Calculates the dimensions of the element based on the current box model.\n * @see https://developer.mozilla.org/en-US/docs/Learn/CSS/Building_blocks/The_box_model\n */\nconst getDimensions = (entry, box) => {\n // Value\t Border\t Padding\t Inner Content\n // ---------------------------------------------------\n // 'border-box'\t Yes\t Yes\t Yes\n // 'content-box'\t No\t No\t Yes\n // undefined No\t No?\t Yes\n if (box === 'border-box') {\n return {\n width: entry.borderBoxSize[0].inlineSize,\n height: entry.borderBoxSize[0].blockSize,\n };\n }\n if (box === 'content-box') {\n return {\n width: entry.contentBoxSize[0].inlineSize,\n height: entry.contentBoxSize[0].blockSize,\n };\n }\n return {\n width: entry.contentRect.width,\n height: entry.contentRect.height,\n };\n};\n\nexport { getDimensions, patchResizeCallback, useCallbackRef, useRefProxy };\n//# sourceMappingURL=utils.js.map\n"],"names":[],"mappings":";;;AAOK,MAAC,sBAAsB,CAAC,gBAAgB,aAAa,aAAa,mBAAmB;AACtF,UAAQ,aAAW;AAAA,IACf,KAAK;AACD,aAAO,SAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D,KAAK;AACD,aAAO,SAAS,gBAAgB,aAAa,cAAc;AAAA,IAC/D;AACI,aAAO;AAAA,EACnB;AACA;AAKK,MAAC;AAAA;AAAA,EAEN,CAAC,aAAa;AACV,UAAM,cAAc,MAAM,OAAO,QAAQ;AACzC,UAAM,UAAU,MAAM;AAClB,kBAAY,UAAU;AAAA,IAC9B,CAAK;AACD,WAAO,MAAM,QAAQ,MAAO,IAAI,SAAS;AAAE,UAAI;AAAI,cAAQ,KAAK,YAAY,aAAa,QAAQ,OAAO,SAAS,SAAS,GAAG,KAAK,aAAa,GAAG,IAAI;AAAA,IAAI,GAAG,CAAA,CAAE;AAAA,EACnK;AAAA;AAGK,MAAC;AAAA;AAAA,EAEN,CAAC,cAAc;AAEX,UAAM,CAAC,YAAY,aAAa,IAAI,MAAM,UAAU,cAAc,QAAQ,cAAc,SAAS,SAAS,UAAU,YAAY,IAAI;AAIpI,QAAI,WAAW;AACX,iBAAW,MAAM;AACb,YAAI,UAAU,YAAY,YAAY;AAClC,wBAAc,UAAU,OAAO;AAAA,QAC/C;AAAA,MACS,GAAE,CAAC;AAAA,IACZ;AAII,UAAM,WAAW,MAAM,QAAQ,MAAM,IAAI,MAAM,CAAC,SAAS;AACrD,UAAI,SAAS,YAAY;AACrB,sBAAc,IAAI;AAAA,MAC9B;AAAA,IACA,GAAO;AAAA,MACC,IAAI,QAAQ,MAAM;AACd,YAAI,SAAS,WAAW;AACpB,iBAAO;AAAA,QACvB;AACY,eAAO,OAAO,IAAI;AAAA,MACrB;AAAA,MACD,IAAI,QAAQ,MAAM,OAAO;AACrB,YAAI,SAAS,WAAW;AACpB,wBAAc,KAAK;AAAA,QACnC,OACiB;AACD,iBAAO,IAAI,IAAI;AAAA,QAC/B;AACY,eAAO;AAAA,MACV;AAAA,IACT,CAAK,GAAG,CAAC,UAAU,CAAC;AAChB,WAAO,EAAE,UAAU,YAAY,cAAe;AAAA,EAClD;AAAA;AAIK,MAAC,gBAAgB,CAAC,OAAO,QAAQ;AAMlC,MAAI,QAAQ,cAAc;AACtB,WAAO;AAAA,MACH,OAAO,MAAM,cAAc,CAAC,EAAE;AAAA,MAC9B,QAAQ,MAAM,cAAc,CAAC,EAAE;AAAA,IAClC;AAAA,EACT;AACI,MAAI,QAAQ,eAAe;AACvB,WAAO;AAAA,MACH,OAAO,MAAM,eAAe,CAAC,EAAE;AAAA,MAC/B,QAAQ,MAAM,eAAe,CAAC,EAAE;AAAA,IACnC;AAAA,EACT;AACI,SAAO;AAAA,IACH,OAAO,MAAM,YAAY;AAAA,IACzB,QAAQ,MAAM,YAAY;AAAA,EAC7B;AACL;","x_google_ignoreList":[0]}
1
+ {"version":3,"file":"harmony108.mjs","sources":["../src/components/Sidebar/Widgets/Tasks/TasksPopover/TasksPopover.tsx"],"sourcesContent":["import { Link, Loading } from '@lokalise/louis'\nimport { useEffectOnce } from '@utils'\nimport { TaskOverview } from '../TaskOverview/TaskOverview'\nimport { useTasks } from '../TasksContext'\nimport type { SidebarTask } from '../types'\nimport { TaskEvents } from '../utils/taskEvents'\nimport styles from './TasksPopover.module.css'\n\nexport const TasksPopover = () => {\n\tconst { tasks, onTasksWidgetOpen, loadingTasks, fetchTasks } = useTasks()\n\n\tuseEffectOnce(() => {\n\t\tconst handleTaskPopoverOpen = async () => {\n\t\t\tconst contextTasks = await fetchTasks()\n\t\t\tonTasksWidgetOpen?.({ tasks: contextTasks })\n\t\t}\n\n\t\thandleTaskPopoverOpen()\n\n\t\tdocument.addEventListener(TaskEvents.TaskCompleted, fetchTasks)\n\t\tdocument.addEventListener(TaskEvents.TaskClosed, fetchTasks)\n\t\tdocument.addEventListener(TaskEvents.Refresh, fetchTasks)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(TaskEvents.TaskCompleted, fetchTasks)\n\t\t\tdocument.removeEventListener(TaskEvents.TaskClosed, fetchTasks)\n\t\t\tdocument.removeEventListener(TaskEvents.Refresh, fetchTasks)\n\t\t}\n\t})\n\n\tif (loadingTasks) {\n\t\treturn (\n\t\t\t<div data-testid=\"sidebar-tasks-loading-popover\" className={styles.loadingContainer}>\n\t\t\t\t<Loading />\n\t\t\t</div>\n\t\t)\n\t}\n\n\tif (tasks.length === 0) {\n\t\treturn (\n\t\t\t<div data-testid=\"sidebar-no-tasks-popover\" className={styles.noTasksContainer}>\n\t\t\t\t<h3 className={styles.noTasksHeading}>No tasks</h3>\n\t\t\t\t<div className={styles.noTasksText}>\n\t\t\t\t\tYour incoming tasks will appear here.\n\t\t\t\t\t<br />\n\t\t\t\t\t<Link href=\"https://docs.lokalise.com/translation-workflow/tasks\" target=\"_new\">\n\t\t\t\t\t\tLearn more\n\t\t\t\t\t</Link>\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t)\n\t}\n\n\treturn (\n\t\t<div data-testid=\"sidebar-tasks-popover\" className={styles.tasksContainer}>\n\t\t\t{tasks.map((task: SidebarTask) => (\n\t\t\t\t<TaskOverview key={task.id} task={task} />\n\t\t\t))}\n\t\t</div>\n\t)\n}\n"],"names":[],"mappings":";;;;;;;AAQO,MAAM,eAAe,MAAM;AACjC,QAAM,EAAE,OAAO,mBAAmB,cAAc,WAAA,IAAe,SAAS;AAExE,gBAAc,MAAM;AACnB,UAAM,wBAAwB,YAAY;AACnC,YAAA,eAAe,MAAM,WAAW;AAClB,6DAAA,EAAE,OAAO;IAC9B;AAEsB,0BAAA;AAEb,aAAA,iBAAiB,WAAW,eAAe,UAAU;AACrD,aAAA,iBAAiB,WAAW,YAAY,UAAU;AAClD,aAAA,iBAAiB,WAAW,SAAS,UAAU;AAExD,WAAO,MAAM;AACH,eAAA,oBAAoB,WAAW,eAAe,UAAU;AACxD,eAAA,oBAAoB,WAAW,YAAY,UAAU;AACrD,eAAA,oBAAoB,WAAW,SAAS,UAAU;AAAA,IAC5D;AAAA,EAAA,CACA;AAED,MAAI,cAAc;AAEhB,WAAA,oBAAC,SAAI,eAAY,iCAAgC,WAAW,OAAO,kBAClE,UAAC,oBAAA,SAAA,CAAA,CAAQ,EACV,CAAA;AAAA,EAAA;AAIE,MAAA,MAAM,WAAW,GAAG;AACvB,gCACE,OAAI,EAAA,eAAY,4BAA2B,WAAW,OAAO,kBAC7D,UAAA;AAAA,MAAA,oBAAC,MAAG,EAAA,WAAW,OAAO,gBAAgB,UAAQ,YAAA;AAAA,MAC7C,qBAAA,OAAA,EAAI,WAAW,OAAO,aAAa,UAAA;AAAA,QAAA;AAAA,4BAElC,MAAG,EAAA;AAAA,4BACH,MAAK,EAAA,MAAK,wDAAuD,QAAO,QAAO,UAEhF,aAAA,CAAA;AAAA,MAAA,EACD,CAAA;AAAA,IAAA,GACD;AAAA,EAAA;AAIF,6BACE,OAAI,EAAA,eAAY,yBAAwB,WAAW,OAAO,gBACzD,UAAA,MAAM,IAAI,CAAC,SACV,oBAAA,cAAA,EAA2B,QAAT,KAAK,EAAgB,CACxC,GACF;AAEF;"}
@@ -1,21 +1,63 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const zod = require("zod");
4
- const teamRoleTypes = require("./harmony63.cjs");
5
- const JWT_TOKEN_PAYLOAD_SCHEMA = zod.z.object({
6
- userId: zod.z.number(),
7
- userUuid: zod.z.string().uuid(),
8
- teamId: zod.z.number(),
9
- teamUuid: zod.z.string().uuid(),
10
- userTeamRole: teamRoleTypes.TEAM_ROLE_SCHEMA,
11
- userEmail: zod.z.string().email(),
12
- userName: zod.z.string(),
13
- userCurrentTeamId: zod.z.number(),
14
- planId: zod.z.number(),
15
- planName: zod.z.string(),
16
- isProviderAlpha: zod.z.boolean(),
17
- isFullyAuthenticated: zod.z.boolean(),
18
- exp: zod.z.number()
19
- });
20
- exports.JWT_TOKEN_PAYLOAD_SCHEMA = JWT_TOKEN_PAYLOAD_SCHEMA;
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const useEffectOnce = require("./harmony12.cjs");
5
+ const React = require("react");
6
+ const TasksContext = require("./harmony107.cjs");
7
+ const taskEvents = require("./harmony110.cjs");
8
+ const TasksProvider = ({ children, config }) => {
9
+ const [tasks, setTasks] = React.useState([]);
10
+ const [loadingTasks, setLoadingTasks] = React.useState(true);
11
+ const [tasksCount, setTaskCount] = React.useState(0);
12
+ const {
13
+ getProjectUrl,
14
+ onLanguageCompleteConfirm,
15
+ onTasksWidgetOpen,
16
+ langNameOnClick,
17
+ langProgressOnClick,
18
+ taskTitleOnClick
19
+ } = config;
20
+ const { getTasks, getTasksCount } = config;
21
+ const fetchTasks = async () => {
22
+ setLoadingTasks(true);
23
+ const result = await getTasks();
24
+ setTasks(result);
25
+ setLoadingTasks(false);
26
+ return result;
27
+ };
28
+ const fetchTaskCount = async () => {
29
+ const result = await getTasksCount();
30
+ setTaskCount(result);
31
+ };
32
+ useEffectOnce.useEffectOnce(() => {
33
+ fetchTaskCount();
34
+ document.addEventListener(taskEvents.TaskEvents.TaskCompleted, fetchTaskCount);
35
+ document.addEventListener(taskEvents.TaskEvents.TaskClosed, fetchTaskCount);
36
+ document.addEventListener(taskEvents.TaskEvents.Refresh, fetchTaskCount);
37
+ return () => {
38
+ document.removeEventListener(taskEvents.TaskEvents.TaskCompleted, fetchTaskCount);
39
+ document.removeEventListener(taskEvents.TaskEvents.TaskClosed, fetchTaskCount);
40
+ document.removeEventListener(taskEvents.TaskEvents.Refresh, fetchTaskCount);
41
+ };
42
+ });
43
+ const providerValue = {
44
+ fetchTasks,
45
+ tasks,
46
+ tasksCount,
47
+ loadingTasks,
48
+ getProjectUrl,
49
+ onLanguageCompleteConfirm,
50
+ onTasksWidgetOpen,
51
+ langNameOnClick,
52
+ langProgressOnClick,
53
+ taskTitleOnClick
54
+ };
55
+ return /* @__PURE__ */ jsxRuntime.jsx(TasksContext.TasksContext.Provider, { value: providerValue, children });
56
+ };
57
+ const withTasksContext = (WrappedComponent) => function withTasksContextFn(props) {
58
+ const { config, ...rest } = props;
59
+ return /* @__PURE__ */ jsxRuntime.jsx(TasksProvider, { config, children: /* @__PURE__ */ jsxRuntime.jsx(WrappedComponent, { ...rest }) });
60
+ };
61
+ exports.TasksProvider = TasksProvider;
62
+ exports.withTasksContext = withTasksContext;
21
63
  //# sourceMappingURL=harmony109.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony109.cjs","sources":["../src/features/auth/core/types/jwtTokenPayload.ts"],"sourcesContent":["import { z } from 'zod'\nimport { TEAM_ROLE_SCHEMA } from '../../../publicApi/types/teamRoleTypes'\n\nexport const JWT_TOKEN_PAYLOAD_SCHEMA = z.object({\n\tuserId: z.number(),\n\tuserUuid: z.string().uuid(),\n\tteamId: z.number(),\n\tteamUuid: z.string().uuid(),\n\tuserTeamRole: TEAM_ROLE_SCHEMA,\n\tuserEmail: z.string().email(),\n\tuserName: z.string(),\n\tuserCurrentTeamId: z.number(),\n\tplanId: z.number(),\n\tplanName: z.string(),\n\tisProviderAlpha: z.boolean(),\n\tisFullyAuthenticated: z.boolean(),\n\texp: z.number(),\n})\nexport type JwtTokenPayload = z.infer<typeof JWT_TOKEN_PAYLOAD_SCHEMA>\n"],"names":["z","TEAM_ROLE_SCHEMA"],"mappings":";;;;AAGa,MAAA,2BAA2BA,MAAE,OAAO;AAAA,EAChD,QAAQA,MAAE,OAAO;AAAA,EACjB,UAAUA,IAAA,EAAE,OAAO,EAAE,KAAK;AAAA,EAC1B,QAAQA,MAAE,OAAO;AAAA,EACjB,UAAUA,IAAA,EAAE,OAAO,EAAE,KAAK;AAAA,EAC1B,cAAcC,cAAA;AAAA,EACd,WAAWD,IAAA,EAAE,OAAO,EAAE,MAAM;AAAA,EAC5B,UAAUA,MAAE,OAAO;AAAA,EACnB,mBAAmBA,MAAE,OAAO;AAAA,EAC5B,QAAQA,MAAE,OAAO;AAAA,EACjB,UAAUA,MAAE,OAAO;AAAA,EACnB,iBAAiBA,MAAE,QAAQ;AAAA,EAC3B,sBAAsBA,MAAE,QAAQ;AAAA,EAChC,KAAKA,MAAE,OAAO;AACf,CAAC;;"}
1
+ {"version":3,"file":"harmony109.cjs","sources":["../src/components/Sidebar/Widgets/Tasks/TasksProvider.tsx"],"sourcesContent":["import { useEffectOnce } from '@utils'\nimport { type FC, type PropsWithChildren, useState } from 'react'\nimport { TasksContext } from './TasksContext'\nimport type { SidebarTask, SidebarTasksConfig, SidebarTasksContextProps } from './types'\nimport { TaskEvents } from './utils/taskEvents'\n\ntype TasksProviderProps = PropsWithChildren<{\n\tconfig: SidebarTasksConfig\n}>\n\nexport const TasksProvider = ({ children, config }: TasksProviderProps) => {\n\tconst [tasks, setTasks] = useState<SidebarTask[]>([])\n\tconst [loadingTasks, setLoadingTasks] = useState(true)\n\n\tconst [tasksCount, setTaskCount] = useState(0)\n\n\tconst {\n\t\tgetProjectUrl,\n\t\tonLanguageCompleteConfirm,\n\t\tonTasksWidgetOpen,\n\t\tlangNameOnClick,\n\t\tlangProgressOnClick,\n\t\ttaskTitleOnClick,\n\t} = config\n\n\tconst { getTasks, getTasksCount } = config\n\n\tconst fetchTasks = async () => {\n\t\tsetLoadingTasks(true)\n\t\tconst result = await getTasks()\n\t\tsetTasks(result)\n\t\tsetLoadingTasks(false)\n\t\treturn result\n\t}\n\n\tconst fetchTaskCount = async () => {\n\t\tconst result = await getTasksCount()\n\t\tsetTaskCount(result)\n\t}\n\n\tuseEffectOnce(() => {\n\t\tfetchTaskCount()\n\n\t\tdocument.addEventListener(TaskEvents.TaskCompleted, fetchTaskCount)\n\t\tdocument.addEventListener(TaskEvents.TaskClosed, fetchTaskCount)\n\t\tdocument.addEventListener(TaskEvents.Refresh, fetchTaskCount)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(TaskEvents.TaskCompleted, fetchTaskCount)\n\t\t\tdocument.removeEventListener(TaskEvents.TaskClosed, fetchTaskCount)\n\t\t\tdocument.removeEventListener(TaskEvents.Refresh, fetchTaskCount)\n\t\t}\n\t})\n\n\tconst providerValue: SidebarTasksContextProps = {\n\t\tfetchTasks,\n\t\ttasks,\n\t\ttasksCount,\n\t\tloadingTasks,\n\t\tgetProjectUrl,\n\t\tonLanguageCompleteConfirm,\n\t\tonTasksWidgetOpen,\n\t\tlangNameOnClick,\n\t\tlangProgressOnClick,\n\t\ttaskTitleOnClick,\n\t}\n\n\treturn <TasksContext.Provider value={providerValue}>{children}</TasksContext.Provider>\n}\n\nexport const withTasksContext = <P extends { config: SidebarTasksConfig }>(\n\tWrappedComponent: FC<Omit<P, 'config'>>,\n) =>\n\tfunction withTasksContextFn(props: P) {\n\t\tconst { config, ...rest } = props\n\n\t\treturn (\n\t\t\t<TasksProvider config={config}>\n\t\t\t\t<WrappedComponent {...rest} />\n\t\t\t</TasksProvider>\n\t\t)\n\t}\n"],"names":["useState","useEffectOnce","TaskEvents","TasksContext"],"mappings":";;;;;;;AAUO,MAAM,gBAAgB,CAAC,EAAE,UAAU,aAAiC;AAC1E,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAwB,CAAA,CAAE;AACpD,QAAM,CAAC,cAAc,eAAe,IAAIA,MAAAA,SAAS,IAAI;AAErD,QAAM,CAAC,YAAY,YAAY,IAAIA,MAAAA,SAAS,CAAC;AAEvC,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEE,QAAA,EAAE,UAAU,cAAA,IAAkB;AAEpC,QAAM,aAAa,YAAY;AAC9B,oBAAgB,IAAI;AACd,UAAA,SAAS,MAAM,SAAS;AAC9B,aAAS,MAAM;AACf,oBAAgB,KAAK;AACd,WAAA;AAAA,EACR;AAEA,QAAM,iBAAiB,YAAY;AAC5B,UAAA,SAAS,MAAM,cAAc;AACnC,iBAAa,MAAM;AAAA,EACpB;AAEAC,gBAAAA,cAAc,MAAM;AACJ,mBAAA;AAEN,aAAA,iBAAiBC,sBAAW,eAAe,cAAc;AACzD,aAAA,iBAAiBA,sBAAW,YAAY,cAAc;AACtD,aAAA,iBAAiBA,sBAAW,SAAS,cAAc;AAE5D,WAAO,MAAM;AACH,eAAA,oBAAoBA,sBAAW,eAAe,cAAc;AAC5D,eAAA,oBAAoBA,sBAAW,YAAY,cAAc;AACzD,eAAA,oBAAoBA,sBAAW,SAAS,cAAc;AAAA,IAChE;AAAA,EAAA,CACA;AAED,QAAM,gBAA0C;AAAA,IAC/C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,wCAAQC,aAAAA,aAAa,UAAb,EAAsB,OAAO,eAAgB,UAAS;AAC/D;AAEO,MAAM,mBAAmB,CAC/B,qBAEA,SAAS,mBAAmB,OAAU;AACrC,QAAM,EAAE,QAAQ,GAAG,KAAA,IAAS;AAE5B,wCACE,eAAc,EAAA,QACd,yCAAC,kBAAkB,EAAA,GAAG,KAAM,CAAA,GAC7B;AAEF;;;"}
@@ -1,21 +1,63 @@
1
- import { z } from "zod";
2
- import { TEAM_ROLE_SCHEMA } from "./harmony63.mjs";
3
- const JWT_TOKEN_PAYLOAD_SCHEMA = z.object({
4
- userId: z.number(),
5
- userUuid: z.string().uuid(),
6
- teamId: z.number(),
7
- teamUuid: z.string().uuid(),
8
- userTeamRole: TEAM_ROLE_SCHEMA,
9
- userEmail: z.string().email(),
10
- userName: z.string(),
11
- userCurrentTeamId: z.number(),
12
- planId: z.number(),
13
- planName: z.string(),
14
- isProviderAlpha: z.boolean(),
15
- isFullyAuthenticated: z.boolean(),
16
- exp: z.number()
17
- });
1
+ import { jsx } from "react/jsx-runtime";
2
+ import { useEffectOnce } from "./harmony12.mjs";
3
+ import { useState } from "react";
4
+ import { TasksContext } from "./harmony107.mjs";
5
+ import { TaskEvents } from "./harmony110.mjs";
6
+ const TasksProvider = ({ children, config }) => {
7
+ const [tasks, setTasks] = useState([]);
8
+ const [loadingTasks, setLoadingTasks] = useState(true);
9
+ const [tasksCount, setTaskCount] = useState(0);
10
+ const {
11
+ getProjectUrl,
12
+ onLanguageCompleteConfirm,
13
+ onTasksWidgetOpen,
14
+ langNameOnClick,
15
+ langProgressOnClick,
16
+ taskTitleOnClick
17
+ } = config;
18
+ const { getTasks, getTasksCount } = config;
19
+ const fetchTasks = async () => {
20
+ setLoadingTasks(true);
21
+ const result = await getTasks();
22
+ setTasks(result);
23
+ setLoadingTasks(false);
24
+ return result;
25
+ };
26
+ const fetchTaskCount = async () => {
27
+ const result = await getTasksCount();
28
+ setTaskCount(result);
29
+ };
30
+ useEffectOnce(() => {
31
+ fetchTaskCount();
32
+ document.addEventListener(TaskEvents.TaskCompleted, fetchTaskCount);
33
+ document.addEventListener(TaskEvents.TaskClosed, fetchTaskCount);
34
+ document.addEventListener(TaskEvents.Refresh, fetchTaskCount);
35
+ return () => {
36
+ document.removeEventListener(TaskEvents.TaskCompleted, fetchTaskCount);
37
+ document.removeEventListener(TaskEvents.TaskClosed, fetchTaskCount);
38
+ document.removeEventListener(TaskEvents.Refresh, fetchTaskCount);
39
+ };
40
+ });
41
+ const providerValue = {
42
+ fetchTasks,
43
+ tasks,
44
+ tasksCount,
45
+ loadingTasks,
46
+ getProjectUrl,
47
+ onLanguageCompleteConfirm,
48
+ onTasksWidgetOpen,
49
+ langNameOnClick,
50
+ langProgressOnClick,
51
+ taskTitleOnClick
52
+ };
53
+ return /* @__PURE__ */ jsx(TasksContext.Provider, { value: providerValue, children });
54
+ };
55
+ const withTasksContext = (WrappedComponent) => function withTasksContextFn(props) {
56
+ const { config, ...rest } = props;
57
+ return /* @__PURE__ */ jsx(TasksProvider, { config, children: /* @__PURE__ */ jsx(WrappedComponent, { ...rest }) });
58
+ };
18
59
  export {
19
- JWT_TOKEN_PAYLOAD_SCHEMA
60
+ TasksProvider,
61
+ withTasksContext
20
62
  };
21
63
  //# sourceMappingURL=harmony109.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony109.mjs","sources":["../src/features/auth/core/types/jwtTokenPayload.ts"],"sourcesContent":["import { z } from 'zod'\nimport { TEAM_ROLE_SCHEMA } from '../../../publicApi/types/teamRoleTypes'\n\nexport const JWT_TOKEN_PAYLOAD_SCHEMA = z.object({\n\tuserId: z.number(),\n\tuserUuid: z.string().uuid(),\n\tteamId: z.number(),\n\tteamUuid: z.string().uuid(),\n\tuserTeamRole: TEAM_ROLE_SCHEMA,\n\tuserEmail: z.string().email(),\n\tuserName: z.string(),\n\tuserCurrentTeamId: z.number(),\n\tplanId: z.number(),\n\tplanName: z.string(),\n\tisProviderAlpha: z.boolean(),\n\tisFullyAuthenticated: z.boolean(),\n\texp: z.number(),\n})\nexport type JwtTokenPayload = z.infer<typeof JWT_TOKEN_PAYLOAD_SCHEMA>\n"],"names":[],"mappings":";;AAGa,MAAA,2BAA2B,EAAE,OAAO;AAAA,EAChD,QAAQ,EAAE,OAAO;AAAA,EACjB,UAAU,EAAE,OAAO,EAAE,KAAK;AAAA,EAC1B,QAAQ,EAAE,OAAO;AAAA,EACjB,UAAU,EAAE,OAAO,EAAE,KAAK;AAAA,EAC1B,cAAc;AAAA,EACd,WAAW,EAAE,OAAO,EAAE,MAAM;AAAA,EAC5B,UAAU,EAAE,OAAO;AAAA,EACnB,mBAAmB,EAAE,OAAO;AAAA,EAC5B,QAAQ,EAAE,OAAO;AAAA,EACjB,UAAU,EAAE,OAAO;AAAA,EACnB,iBAAiB,EAAE,QAAQ;AAAA,EAC3B,sBAAsB,EAAE,QAAQ;AAAA,EAChC,KAAK,EAAE,OAAO;AACf,CAAC;"}
1
+ {"version":3,"file":"harmony109.mjs","sources":["../src/components/Sidebar/Widgets/Tasks/TasksProvider.tsx"],"sourcesContent":["import { useEffectOnce } from '@utils'\nimport { type FC, type PropsWithChildren, useState } from 'react'\nimport { TasksContext } from './TasksContext'\nimport type { SidebarTask, SidebarTasksConfig, SidebarTasksContextProps } from './types'\nimport { TaskEvents } from './utils/taskEvents'\n\ntype TasksProviderProps = PropsWithChildren<{\n\tconfig: SidebarTasksConfig\n}>\n\nexport const TasksProvider = ({ children, config }: TasksProviderProps) => {\n\tconst [tasks, setTasks] = useState<SidebarTask[]>([])\n\tconst [loadingTasks, setLoadingTasks] = useState(true)\n\n\tconst [tasksCount, setTaskCount] = useState(0)\n\n\tconst {\n\t\tgetProjectUrl,\n\t\tonLanguageCompleteConfirm,\n\t\tonTasksWidgetOpen,\n\t\tlangNameOnClick,\n\t\tlangProgressOnClick,\n\t\ttaskTitleOnClick,\n\t} = config\n\n\tconst { getTasks, getTasksCount } = config\n\n\tconst fetchTasks = async () => {\n\t\tsetLoadingTasks(true)\n\t\tconst result = await getTasks()\n\t\tsetTasks(result)\n\t\tsetLoadingTasks(false)\n\t\treturn result\n\t}\n\n\tconst fetchTaskCount = async () => {\n\t\tconst result = await getTasksCount()\n\t\tsetTaskCount(result)\n\t}\n\n\tuseEffectOnce(() => {\n\t\tfetchTaskCount()\n\n\t\tdocument.addEventListener(TaskEvents.TaskCompleted, fetchTaskCount)\n\t\tdocument.addEventListener(TaskEvents.TaskClosed, fetchTaskCount)\n\t\tdocument.addEventListener(TaskEvents.Refresh, fetchTaskCount)\n\n\t\treturn () => {\n\t\t\tdocument.removeEventListener(TaskEvents.TaskCompleted, fetchTaskCount)\n\t\t\tdocument.removeEventListener(TaskEvents.TaskClosed, fetchTaskCount)\n\t\t\tdocument.removeEventListener(TaskEvents.Refresh, fetchTaskCount)\n\t\t}\n\t})\n\n\tconst providerValue: SidebarTasksContextProps = {\n\t\tfetchTasks,\n\t\ttasks,\n\t\ttasksCount,\n\t\tloadingTasks,\n\t\tgetProjectUrl,\n\t\tonLanguageCompleteConfirm,\n\t\tonTasksWidgetOpen,\n\t\tlangNameOnClick,\n\t\tlangProgressOnClick,\n\t\ttaskTitleOnClick,\n\t}\n\n\treturn <TasksContext.Provider value={providerValue}>{children}</TasksContext.Provider>\n}\n\nexport const withTasksContext = <P extends { config: SidebarTasksConfig }>(\n\tWrappedComponent: FC<Omit<P, 'config'>>,\n) =>\n\tfunction withTasksContextFn(props: P) {\n\t\tconst { config, ...rest } = props\n\n\t\treturn (\n\t\t\t<TasksProvider config={config}>\n\t\t\t\t<WrappedComponent {...rest} />\n\t\t\t</TasksProvider>\n\t\t)\n\t}\n"],"names":[],"mappings":";;;;;AAUO,MAAM,gBAAgB,CAAC,EAAE,UAAU,aAAiC;AAC1E,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAwB,CAAA,CAAE;AACpD,QAAM,CAAC,cAAc,eAAe,IAAI,SAAS,IAAI;AAErD,QAAM,CAAC,YAAY,YAAY,IAAI,SAAS,CAAC;AAEvC,QAAA;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,IACG;AAEE,QAAA,EAAE,UAAU,cAAA,IAAkB;AAEpC,QAAM,aAAa,YAAY;AAC9B,oBAAgB,IAAI;AACd,UAAA,SAAS,MAAM,SAAS;AAC9B,aAAS,MAAM;AACf,oBAAgB,KAAK;AACd,WAAA;AAAA,EACR;AAEA,QAAM,iBAAiB,YAAY;AAC5B,UAAA,SAAS,MAAM,cAAc;AACnC,iBAAa,MAAM;AAAA,EACpB;AAEA,gBAAc,MAAM;AACJ,mBAAA;AAEN,aAAA,iBAAiB,WAAW,eAAe,cAAc;AACzD,aAAA,iBAAiB,WAAW,YAAY,cAAc;AACtD,aAAA,iBAAiB,WAAW,SAAS,cAAc;AAE5D,WAAO,MAAM;AACH,eAAA,oBAAoB,WAAW,eAAe,cAAc;AAC5D,eAAA,oBAAoB,WAAW,YAAY,cAAc;AACzD,eAAA,oBAAoB,WAAW,SAAS,cAAc;AAAA,IAChE;AAAA,EAAA,CACA;AAED,QAAM,gBAA0C;AAAA,IAC/C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACD;AAEA,6BAAQ,aAAa,UAAb,EAAsB,OAAO,eAAgB,UAAS;AAC/D;AAEO,MAAM,mBAAmB,CAC/B,qBAEA,SAAS,mBAAmB,OAAU;AACrC,QAAM,EAAE,QAAQ,GAAG,KAAA,IAAS;AAE5B,6BACE,eAAc,EAAA,QACd,8BAAC,kBAAkB,EAAA,GAAG,KAAM,CAAA,GAC7B;AAEF;"}
@@ -1,17 +1,10 @@
1
1
  "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
- const jwtTokenPayload = require("./harmony16.cjs");
7
- const _NewJwtIssuedEvent = class _NewJwtIssuedEvent extends CustomEvent {
8
- constructor(token) {
9
- super(_NewJwtIssuedEvent.eventName, {
10
- detail: { token, payload: jwtTokenPayload.parseJwtTokenPayload(token.accessToken) }
11
- });
12
- }
3
+ const TaskEvents = {
4
+ TaskCompleted: "task_completed",
5
+ TaskClosed: "task_closed",
6
+ Refresh: "refresh",
7
+ ShowDialog: "show_dialog"
13
8
  };
14
- __publicField(_NewJwtIssuedEvent, "eventName", "new-jwt-issued");
15
- let NewJwtIssuedEvent = _NewJwtIssuedEvent;
16
- exports.NewJwtIssuedEvent = NewJwtIssuedEvent;
9
+ exports.TaskEvents = TaskEvents;
17
10
  //# sourceMappingURL=harmony110.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony110.cjs","sources":["../src/features/auth/frontend/events/NewJwtIssuedEvent.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { parseJwtTokenPayload } from '@features/auth/core/utils/jwtTokenPayload'\nimport type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\ntype NewJwtIssuedEventDetail = {\n\ttoken: JwtToken\n\tpayload: JwtTokenPayload | undefined\n}\n\n/**\n * This event is emitted when a new JWT token is issued or refreshed.\n */\nexport class NewJwtIssuedEvent extends CustomEvent<NewJwtIssuedEventDetail> {\n\tstatic readonly eventName = 'new-jwt-issued' as const\n\n\tconstructor(token: JwtToken) {\n\t\tsuper(NewJwtIssuedEvent.eventName, {\n\t\t\tdetail: { token, payload: parseJwtTokenPayload(token.accessToken) },\n\t\t})\n\t}\n}\n\nexport const isNewJwtIssuedEvent = (event: Event): event is NewJwtIssuedEvent =>\n\tevent.type === NewJwtIssuedEvent.eventName\n\ndeclare global {\n\tinterface WindowEventMap {\n\t\t[NewJwtIssuedEvent.eventName]: NewJwtIssuedEvent\n\t}\n}\n"],"names":["parseJwtTokenPayload"],"mappings":";;;;;;AAYO,MAAM,qBAAN,MAAM,2BAA0B,YAAqC;AAAA,EAG3E,YAAY,OAAiB;AAC5B,UAAM,mBAAkB,WAAW;AAAA,MAClC,QAAQ,EAAE,OAAO,SAASA,gBAAAA,qBAAqB,MAAM,WAAW,EAAE;AAAA,IAAA,CAClE;AAAA,EAAA;AAEH;AAPC,cADY,oBACI,aAAY;AADtB,IAAM,oBAAN;;"}
1
+ {"version":3,"file":"harmony110.cjs","sources":["../src/components/Sidebar/Widgets/Tasks/utils/taskEvents.ts"],"sourcesContent":["import type { TypesFromMap } from '@utils'\n\nexport const TaskEvents = {\n\tTaskCompleted: 'task_completed',\n\tTaskClosed: 'task_closed',\n\tRefresh: 'refresh',\n\tShowDialog: 'show_dialog',\n} as const\n\nexport type TaskEvent = TypesFromMap<typeof TaskEvents>\n\ntype SingleTaskPayload = {\n\ttaskId: string | number\n}\n\ntype DispatchTaskEventPayload =\n\t| {\n\t\t\tname: typeof TaskEvents.TaskCompleted\n\t\t\tdetail: SingleTaskPayload\n\t }\n\t| {\n\t\t\tname: typeof TaskEvents.TaskClosed\n\t\t\tdetail: SingleTaskPayload\n\t }\n\t| {\n\t\t\tname: typeof TaskEvents.Refresh\n\t }\n\t| {\n\t\t\tname: typeof TaskEvents.ShowDialog\n\t }\n\nexport const dispatchTaskEvent = (props: DispatchTaskEventPayload) => {\n\tconst { name } = props\n\tdocument.dispatchEvent(new CustomEvent(name, { detail: 'detail' in props ? props.detail : {} }))\n}\n"],"names":[],"mappings":";;AAEO,MAAM,aAAa;AAAA,EACzB,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,YAAY;AACb;;"}
@@ -1,17 +1,10 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { parseJwtTokenPayload } from "./harmony16.mjs";
5
- const _NewJwtIssuedEvent = class _NewJwtIssuedEvent extends CustomEvent {
6
- constructor(token) {
7
- super(_NewJwtIssuedEvent.eventName, {
8
- detail: { token, payload: parseJwtTokenPayload(token.accessToken) }
9
- });
10
- }
1
+ const TaskEvents = {
2
+ TaskCompleted: "task_completed",
3
+ TaskClosed: "task_closed",
4
+ Refresh: "refresh",
5
+ ShowDialog: "show_dialog"
11
6
  };
12
- __publicField(_NewJwtIssuedEvent, "eventName", "new-jwt-issued");
13
- let NewJwtIssuedEvent = _NewJwtIssuedEvent;
14
7
  export {
15
- NewJwtIssuedEvent
8
+ TaskEvents
16
9
  };
17
10
  //# sourceMappingURL=harmony110.mjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"harmony110.mjs","sources":["../src/features/auth/frontend/events/NewJwtIssuedEvent.ts"],"sourcesContent":["import type { JwtTokenPayload } from '@features/auth/core/types/jwtTokenPayload'\nimport { parseJwtTokenPayload } from '@features/auth/core/utils/jwtTokenPayload'\nimport type { JwtToken } from '@features/publicApi/types/userTokenTypes'\n\ntype NewJwtIssuedEventDetail = {\n\ttoken: JwtToken\n\tpayload: JwtTokenPayload | undefined\n}\n\n/**\n * This event is emitted when a new JWT token is issued or refreshed.\n */\nexport class NewJwtIssuedEvent extends CustomEvent<NewJwtIssuedEventDetail> {\n\tstatic readonly eventName = 'new-jwt-issued' as const\n\n\tconstructor(token: JwtToken) {\n\t\tsuper(NewJwtIssuedEvent.eventName, {\n\t\t\tdetail: { token, payload: parseJwtTokenPayload(token.accessToken) },\n\t\t})\n\t}\n}\n\nexport const isNewJwtIssuedEvent = (event: Event): event is NewJwtIssuedEvent =>\n\tevent.type === NewJwtIssuedEvent.eventName\n\ndeclare global {\n\tinterface WindowEventMap {\n\t\t[NewJwtIssuedEvent.eventName]: NewJwtIssuedEvent\n\t}\n}\n"],"names":[],"mappings":";;;;AAYO,MAAM,qBAAN,MAAM,2BAA0B,YAAqC;AAAA,EAG3E,YAAY,OAAiB;AAC5B,UAAM,mBAAkB,WAAW;AAAA,MAClC,QAAQ,EAAE,OAAO,SAAS,qBAAqB,MAAM,WAAW,EAAE;AAAA,IAAA,CAClE;AAAA,EAAA;AAEH;AAPC,cADY,oBACI,aAAY;AADtB,IAAM,oBAAN;"}
1
+ {"version":3,"file":"harmony110.mjs","sources":["../src/components/Sidebar/Widgets/Tasks/utils/taskEvents.ts"],"sourcesContent":["import type { TypesFromMap } from '@utils'\n\nexport const TaskEvents = {\n\tTaskCompleted: 'task_completed',\n\tTaskClosed: 'task_closed',\n\tRefresh: 'refresh',\n\tShowDialog: 'show_dialog',\n} as const\n\nexport type TaskEvent = TypesFromMap<typeof TaskEvents>\n\ntype SingleTaskPayload = {\n\ttaskId: string | number\n}\n\ntype DispatchTaskEventPayload =\n\t| {\n\t\t\tname: typeof TaskEvents.TaskCompleted\n\t\t\tdetail: SingleTaskPayload\n\t }\n\t| {\n\t\t\tname: typeof TaskEvents.TaskClosed\n\t\t\tdetail: SingleTaskPayload\n\t }\n\t| {\n\t\t\tname: typeof TaskEvents.Refresh\n\t }\n\t| {\n\t\t\tname: typeof TaskEvents.ShowDialog\n\t }\n\nexport const dispatchTaskEvent = (props: DispatchTaskEventPayload) => {\n\tconst { name } = props\n\tdocument.dispatchEvent(new CustomEvent(name, { detail: 'detail' in props ? props.detail : {} }))\n}\n"],"names":[],"mappings":"AAEO,MAAM,aAAa;AAAA,EACzB,eAAe;AAAA,EACf,YAAY;AAAA,EACZ,SAAS;AAAA,EACT,YAAY;AACb;"}