@qoretechnologies/reqraft 0.10.27-pr.74.gc5f6ca3 → 0.10.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/form/engine/CompactRow.d.ts.map +1 -1
- package/dist/components/form/engine/CompactRow.js +8 -1
- package/dist/components/form/engine/CompactRow.js.map +1 -1
- package/dist/components/searchFilterBar/SearchFilterBar.d.ts +33 -0
- package/dist/components/searchFilterBar/SearchFilterBar.d.ts.map +1 -0
- package/dist/components/searchFilterBar/SearchFilterBar.js +76 -0
- package/dist/components/searchFilterBar/SearchFilterBar.js.map +1 -0
- package/dist/components/searchFilterBar/index.d.ts +2 -0
- package/dist/components/searchFilterBar/index.d.ts.map +1 -0
- package/dist/components/searchFilterBar/index.js +18 -0
- package/dist/components/searchFilterBar/index.js.map +1 -0
- package/dist/components/supportTicket/InterfaceReferenceTags.d.ts +9 -1
- package/dist/components/supportTicket/InterfaceReferenceTags.d.ts.map +1 -1
- package/dist/components/supportTicket/InterfaceReferenceTags.js +2 -2
- package/dist/components/supportTicket/InterfaceReferenceTags.js.map +1 -1
- package/dist/components/supportTicket/ReferencePicker.d.ts +52 -6
- package/dist/components/supportTicket/ReferencePicker.d.ts.map +1 -1
- package/dist/components/supportTicket/ReferencePicker.js +240 -31
- package/dist/components/supportTicket/ReferencePicker.js.map +1 -1
- package/dist/components/supportTicket/attachmentAccess.d.ts +37 -0
- package/dist/components/supportTicket/attachmentAccess.d.ts.map +1 -0
- package/dist/components/supportTicket/attachmentAccess.js +132 -0
- package/dist/components/supportTicket/attachmentAccess.js.map +1 -0
- package/dist/components/supportTicket/index.d.ts +2 -0
- package/dist/components/supportTicket/index.d.ts.map +1 -1
- package/dist/components/supportTicket/index.js +2 -0
- package/dist/components/supportTicket/index.js.map +1 -1
- package/dist/components/supportTicket/meta.d.ts +8 -0
- package/dist/components/supportTicket/meta.d.ts.map +1 -1
- package/dist/components/supportTicket/meta.js +37 -1
- package/dist/components/supportTicket/meta.js.map +1 -1
- package/dist/components/supportTicket/ticketModel.d.ts +102 -0
- package/dist/components/supportTicket/ticketModel.d.ts.map +1 -0
- package/dist/components/supportTicket/ticketModel.js +3 -0
- package/dist/components/supportTicket/ticketModel.js.map +1 -0
- package/dist/components/ticketReferences/TicketReferences.d.ts.map +1 -1
- package/dist/components/ticketReferences/TicketReferences.js +109 -78
- package/dist/components/ticketReferences/TicketReferences.js.map +1 -1
- package/dist/components/ticketThread/TicketThread.d.ts.map +1 -1
- package/dist/components/ticketThread/TicketThread.js +19 -2
- package/dist/components/ticketThread/TicketThread.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/form/engine/CompactRow.tsx +7 -0
- package/src/components/form/engine/FormEngine.stories.tsx +90 -0
- package/src/components/searchFilterBar/SearchFilterBar.tsx +131 -0
- package/src/components/searchFilterBar/index.ts +1 -0
- package/src/components/supportTicket/InterfaceReferenceTags.stories.tsx +37 -0
- package/src/components/supportTicket/InterfaceReferenceTags.tsx +11 -0
- package/src/components/supportTicket/ReferencePicker.stories.tsx +257 -34
- package/src/components/supportTicket/ReferencePicker.tsx +421 -95
- package/src/components/supportTicket/TicketConversation.stories.tsx +0 -1
- package/src/components/supportTicket/TicketReplyBox.stories.tsx +0 -4
- package/src/components/supportTicket/attachmentAccess.ts +97 -0
- package/src/components/supportTicket/index.ts +2 -0
- package/src/components/supportTicket/meta.ts +40 -0
- package/src/components/supportTicket/ticketModel.ts +131 -0
- package/src/components/ticketReferences/TicketReferences.tsx +124 -145
- package/src/components/ticketThread/TicketThread.stories.tsx +24 -2
- package/src/components/ticketThread/TicketThread.tsx +23 -3
- package/src/index.tsx +3 -1
|
@@ -3,6 +3,17 @@ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cook
|
|
|
3
3
|
if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
|
|
4
4
|
return cooked;
|
|
5
5
|
};
|
|
6
|
+
var __assign = (this && this.__assign) || function () {
|
|
7
|
+
__assign = Object.assign || function(t) {
|
|
8
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
9
|
+
s = arguments[i];
|
|
10
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
11
|
+
t[p] = s[p];
|
|
12
|
+
}
|
|
13
|
+
return t;
|
|
14
|
+
};
|
|
15
|
+
return __assign.apply(this, arguments);
|
|
16
|
+
};
|
|
6
17
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
7
18
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
8
19
|
};
|
|
@@ -15,32 +26,81 @@ var styled_components_1 = __importDefault(require("styled-components"));
|
|
|
15
26
|
var scrollbar_1 = require("../../helpers/scrollbar");
|
|
16
27
|
var meta_1 = require("./meta");
|
|
17
28
|
/*
|
|
18
|
-
* The
|
|
19
|
-
*
|
|
20
|
-
*
|
|
29
|
+
* The interface browser: kinds on one side, the selected kind's interfaces on the
|
|
30
|
+
* other, and one search field that scopes both. Sits above a ticket composer, toggled
|
|
31
|
+
* by the composer's "Reference interfaces" action.
|
|
21
32
|
*
|
|
22
33
|
* The host owns the data. Which kinds exist and what lives under one are questions only
|
|
23
34
|
* the surrounding app can answer — the IDE lists them off the customer's live instance,
|
|
24
35
|
* a story hands over fixtures — so this component takes `kinds` and the selected kind's
|
|
25
36
|
* `items` and does the rest: selection, search, and turning a click into a reference.
|
|
37
|
+
* Nothing here fetches; `kind` is the only contract, and the host maps it onto whatever
|
|
38
|
+
* transport it has.
|
|
39
|
+
*
|
|
40
|
+
* Three rules the layout follows, in order of how often they bite:
|
|
41
|
+
*
|
|
42
|
+
* - Search filters the kind list down to what matches, and keeps ONE extra row: the
|
|
43
|
+
* selected kind, dimmed, when the query doesn't match it. That row is what stops the
|
|
44
|
+
* right-hand results outliving the kind they belong to — without it you'd see three
|
|
45
|
+
* interfaces and no way to tell what they were. Everything else goes, because a match
|
|
46
|
+
* that survives only by scrolling past nine dimmed rows isn't a match the user found.
|
|
47
|
+
* - A picked interface STAYS in the list, selected. Dropping it on pick was a
|
|
48
|
+
* disappearing act with no undo inside the picker; now the row toggles.
|
|
49
|
+
* - Below `STACK_BREAKPOINT` of its OWN width — not the viewport's, since this thing
|
|
50
|
+
* lives inside composers and drawers — the two panes collapse into one column and the
|
|
51
|
+
* selected kind's interfaces render directly beneath it. On a phone it goes further
|
|
52
|
+
* and lifts into a modal, because inline it would own the whole screen.
|
|
26
53
|
*/
|
|
27
|
-
/** How
|
|
28
|
-
var
|
|
54
|
+
/** How tall the panes get before they scroll: side by side, stacked, and in the modal. */
|
|
55
|
+
var COLUMNS_MAX_HEIGHT = '220px';
|
|
56
|
+
var STACKED_MAX_HEIGHT = '280px';
|
|
57
|
+
var MODAL_MAX_HEIGHT = '60vh';
|
|
29
58
|
var KIND_PANE_WIDTH = 150;
|
|
59
|
+
/** Container width (not viewport) below which the panes stack into one column. */
|
|
60
|
+
var STACK_BREAKPOINT = 420;
|
|
61
|
+
var BORDER = 'rgba(123, 104, 238, 0.25)';
|
|
62
|
+
/*
|
|
63
|
+
* Marks the selected kind when the search doesn't match it — it's only still on the
|
|
64
|
+
* list to say what the interfaces on the right are. Quiet, but pickable.
|
|
65
|
+
*/
|
|
66
|
+
var DIMMED_CLASS = 'reqore-reference-picker-dimmed';
|
|
67
|
+
/*
|
|
68
|
+
* Marks an already-referenced row. Reqore paints `selected` purely through styled
|
|
69
|
+
* props — no class, no aria state — so "is this row picked" is unobservable from the
|
|
70
|
+
* outside without a marker of our own. Stable, so a host can style on it too.
|
|
71
|
+
*/
|
|
72
|
+
var PICKED_CLASS = 'reqore-reference-picker-picked';
|
|
30
73
|
/*
|
|
31
74
|
* A scroll pane with the thin, unobtrusive scrollbar the Qonsole surfaces use
|
|
32
75
|
* (transparent track, translucent rounded thumb) rather than the raw browser one.
|
|
33
76
|
* webkit-only, like those surfaces: setting `scrollbar-width` as well would let
|
|
34
77
|
* Chromium override this custom 6px with its own, wider, "thin".
|
|
35
78
|
*/
|
|
36
|
-
var Pane = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n max-height: ", "
|
|
79
|
+
var Pane = styled_components_1.default.div(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n max-height: ", ";\n overflow-y: auto;\n padding: 4px;\n\n ", "\n"], ["\n ", "\n max-height: ", ";\n overflow-y: auto;\n padding: 4px;\n\n ", "\n"])), function (_a) {
|
|
37
80
|
var $right = _a.$right;
|
|
38
81
|
return $right
|
|
39
82
|
? 'flex: 1; min-width: 0;'
|
|
40
|
-
: "width: ".concat(KIND_PANE_WIDTH, "px; flex: none; border-right: 1px solid
|
|
41
|
-
},
|
|
42
|
-
var
|
|
43
|
-
|
|
83
|
+
: "width: ".concat(KIND_PANE_WIDTH, "px; flex: none; border-right: 1px solid ").concat(BORDER, ";");
|
|
84
|
+
}, function (_a) {
|
|
85
|
+
var $maxHeight = _a.$maxHeight;
|
|
86
|
+
return $maxHeight;
|
|
87
|
+
}, scrollbar_1.thinScrollbar);
|
|
88
|
+
/** The stacked counterpart of `Pane` — one column, so one scroll region. */
|
|
89
|
+
var Stack = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n max-height: ", ";\n overflow-y: auto;\n padding: 4px;\n\n ", "\n"], ["\n max-height: ", ";\n overflow-y: auto;\n padding: 4px;\n\n ", "\n"])), function (_a) {
|
|
90
|
+
var $maxHeight = _a.$maxHeight;
|
|
91
|
+
return $maxHeight;
|
|
92
|
+
}, scrollbar_1.thinScrollbar);
|
|
93
|
+
/*
|
|
94
|
+
* The selected kind's interfaces once the panes have collapsed. The indent and the
|
|
95
|
+
* rule are the only things left saying "these belong to the row above" — in the
|
|
96
|
+
* two-pane layout the divider between the panes says it.
|
|
97
|
+
*/
|
|
98
|
+
var Nested = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n margin: 2px 0 4px 10px;\n padding-left: 8px;\n border-left: 1px solid ", ";\n"], ["\n margin: 2px 0 4px 10px;\n padding-left: 8px;\n border-left: 1px solid ", ";\n"])), BORDER);
|
|
99
|
+
var Frame = styled_components_1.default.div(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n ", "\n overflow: hidden;\n\n /* Rows the search doesn't match. Set here rather than per row so the rule is\n stated once, and on the row itself (not a wrapper) so it can't disturb the\n menu's own flex layout. */\n .", " {\n opacity: 0.35;\n }\n"], ["\n ", "\n overflow: hidden;\n\n /* Rows the search doesn't match. Set here rather than per row so the rule is\n stated once, and on the row itself (not a wrapper) so it can't disturb the\n menu's own flex layout. */\n .", " {\n opacity: 0.35;\n }\n"])), function (_a) {
|
|
100
|
+
var $bare = _a.$bare;
|
|
101
|
+
return ($bare ? '' : "border: 1px solid ".concat(BORDER, "; border-radius: 8px;"));
|
|
102
|
+
}, DIMMED_CLASS);
|
|
103
|
+
var Panes = styled_components_1.default.div(templateObject_5 || (templateObject_5 = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
44
104
|
/*
|
|
45
105
|
* An underline search field. The input itself is borderless (`flat transparent`) and
|
|
46
106
|
* this wrapper carries the single bottom border, so the search reads as a line rather
|
|
@@ -48,39 +108,188 @@ var Panes = styled_components_1.default.div(templateObject_3 || (templateObject_
|
|
|
48
108
|
* around the whole control. Suppressing that outline and brightening the underline
|
|
49
109
|
* instead keeps a focus cue without the box. The selector is scoped under this wrapper,
|
|
50
110
|
* so it outranks Reqore's without `!important`.
|
|
111
|
+
*
|
|
112
|
+
* `$active` (the field has a query) holds the underline at full accent, so a filtered
|
|
113
|
+
* list is legible as filtered at a glance — the same signal `intent='info'` carries on
|
|
114
|
+
* a plain filter control, spoken in this surface's own accent.
|
|
51
115
|
*/
|
|
52
|
-
var Search = styled_components_1.default.div(
|
|
53
|
-
var $accent = _a.$accent;
|
|
54
|
-
return "".concat($accent, "80");
|
|
116
|
+
var Search = styled_components_1.default.div(templateObject_6 || (templateObject_6 = __makeTemplateObject(["\n padding: 6px 4px 4px;\n border-bottom: 1px solid\n ", ";\n transition: border-color 0.15s ease-out;\n\n .reqore-control-wrapper:focus-within {\n outline: none;\n }\n &:focus-within {\n border-bottom-color: ", ";\n }\n"], ["\n padding: 6px 4px 4px;\n border-bottom: 1px solid\n ", ";\n transition: border-color 0.15s ease-out;\n\n .reqore-control-wrapper:focus-within {\n outline: none;\n }\n &:focus-within {\n border-bottom-color: ", ";\n }\n"])), function (_a) {
|
|
117
|
+
var $accent = _a.$accent, $active = _a.$active;
|
|
118
|
+
return ($active ? $accent : "".concat($accent, "80"));
|
|
55
119
|
}, function (_a) {
|
|
56
120
|
var $accent = _a.$accent;
|
|
57
121
|
return $accent;
|
|
58
122
|
});
|
|
59
|
-
var Note = styled_components_1.default.div(
|
|
123
|
+
var Note = styled_components_1.default.div(templateObject_7 || (templateObject_7 = __makeTemplateObject(["\n opacity: 0.4;\n padding: 8px 6px;\n font-size: 12px;\n"], ["\n opacity: 0.4;\n padding: 8px 6px;\n font-size: 12px;\n"])));
|
|
60
124
|
var DEFAULT_ACCENT = '#762f7e';
|
|
125
|
+
/*
|
|
126
|
+
* How a picked row reads: `info`, tinted rather than filled.
|
|
127
|
+
*
|
|
128
|
+
* Two Reqore details make this less obvious than `selected` + `intent`:
|
|
129
|
+
*
|
|
130
|
+
* - `selected` becomes `active` on the button, and the active branch paints a solid
|
|
131
|
+
* background from the intent while ignoring `minimal` and `transparent` outright.
|
|
132
|
+
* So `selected` can't be softened — it has to go, and `minimal` carries the state.
|
|
133
|
+
* - `ReqoreMenuItem` sets `transparent` on every row, and `transparent` short-circuits
|
|
134
|
+
* `minimal`'s tint to nothing. Turning it off for picked rows is what lets the tint
|
|
135
|
+
* land, and it's only spread when the row IS picked — a `transparent: undefined` on
|
|
136
|
+
* the others would override the menu item's own default and flatten them all.
|
|
137
|
+
*
|
|
138
|
+
* The point of the tint: a solid blue bar is too much weight for "this one's already
|
|
139
|
+
* in your list". The rows still up for choosing are what the user is reading, and they
|
|
140
|
+
* should stay the loudest thing in the pane.
|
|
141
|
+
*/
|
|
142
|
+
var pickedItemProps = function (isPicked) {
|
|
143
|
+
return isPicked ? { intent: 'info', minimal: true, transparent: false } : {};
|
|
144
|
+
};
|
|
145
|
+
/**
|
|
146
|
+
* Watches an element's own width, because the viewport's is the wrong question for
|
|
147
|
+
* anything that lives inside a composer, a drawer or a side panel — those stay narrow
|
|
148
|
+
* on a 2560px screen. A callback ref rather than `useRef` so the observer attaches the
|
|
149
|
+
* moment the node mounts; a ref that never gets attached silently reports "wide"
|
|
150
|
+
* forever, which is exactly the bug this is meant to catch.
|
|
151
|
+
*/
|
|
152
|
+
var useIsNarrow = function (enabled) {
|
|
153
|
+
var _a = (0, react_1.useState)(null), node = _a[0], setNode = _a[1];
|
|
154
|
+
var _b = (0, react_1.useState)(false), narrow = _b[0], setNarrow = _b[1];
|
|
155
|
+
(0, react_1.useEffect)(function () {
|
|
156
|
+
if (!enabled || !node || typeof ResizeObserver === 'undefined') {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
var observer = new ResizeObserver(function (_a) {
|
|
160
|
+
var entry = _a[0];
|
|
161
|
+
setNarrow(entry.contentRect.width < STACK_BREAKPOINT);
|
|
162
|
+
});
|
|
163
|
+
observer.observe(node);
|
|
164
|
+
return function () { return observer.disconnect(); };
|
|
165
|
+
}, [enabled, node]);
|
|
166
|
+
return [setNode, narrow];
|
|
167
|
+
};
|
|
168
|
+
/** Phone-sized viewport. Its own media query rather than reqore's `isMobile`, which
|
|
169
|
+
* is pinned to `false` under NODE_ENV=test and so never fires in a story run. */
|
|
170
|
+
var usePhoneViewport = function (enabled) {
|
|
171
|
+
var _a = (0, react_1.useState)(false), phone = _a[0], setPhone = _a[1];
|
|
172
|
+
(0, react_1.useEffect)(function () {
|
|
173
|
+
if (!enabled || typeof window === 'undefined' || !window.matchMedia) {
|
|
174
|
+
return undefined;
|
|
175
|
+
}
|
|
176
|
+
var query = window.matchMedia('(max-width: 480px)');
|
|
177
|
+
var sync = function () { return setPhone(query.matches); };
|
|
178
|
+
sync();
|
|
179
|
+
query.addEventListener('change', sync);
|
|
180
|
+
return function () { return query.removeEventListener('change', sync); };
|
|
181
|
+
}, [enabled]);
|
|
182
|
+
return phone;
|
|
183
|
+
};
|
|
61
184
|
var ReferencePicker = function (_a) {
|
|
62
|
-
var kinds = _a.kinds, kind = _a.kind, onKindChange = _a.onKindChange, items = _a.items, loading = _a.loading, error = _a.error, onRetry = _a.onRetry, picked = _a.picked, onAdd = _a.onAdd, disabled = _a.disabled, _b = _a.resolveInterfaceIcon, resolveInterfaceIcon = _b === void 0 ? meta_1.defaultInterfaceIcon : _b, _c = _a.accent, accent =
|
|
63
|
-
var
|
|
185
|
+
var kinds = _a.kinds, kind = _a.kind, onKindChange = _a.onKindChange, items = _a.items, loading = _a.loading, error = _a.error, onRetry = _a.onRetry, picked = _a.picked, onAdd = _a.onAdd, onRemove = _a.onRemove, disabled = _a.disabled, _b = _a.resolveInterfaceIcon, resolveInterfaceIcon = _b === void 0 ? meta_1.defaultInterfaceIcon : _b, _c = _a.resolveKindLabel, resolveKindLabel = _c === void 0 ? meta_1.defaultInterfaceKindLabel : _c, _d = _a.accent, accent = _d === void 0 ? DEFAULT_ACCENT : _d, header = _a.header, onClose = _a.onClose, _e = _a.title, title = _e === void 0 ? 'Reference interfaces' : _e, _f = _a.layout, layout = _f === void 0 ? 'auto' : _f, _g = _a.presentation, presentation = _g === void 0 ? 'auto' : _g;
|
|
186
|
+
var _h = (0, react_1.useState)(''), query = _h[0], setQuery = _h[1];
|
|
64
187
|
var needle = query.trim().toLowerCase();
|
|
65
|
-
var
|
|
188
|
+
var _j = useIsNarrow(layout === 'auto'), frameRef = _j[0], narrow = _j[1];
|
|
189
|
+
var phone = usePhoneViewport(presentation === 'auto');
|
|
190
|
+
var asModal = presentation === 'modal' || (presentation === 'auto' && phone && !!onClose);
|
|
191
|
+
var stacked = layout === 'stacked' || (layout === 'auto' && narrow);
|
|
192
|
+
var label = resolveKindLabel(kind);
|
|
193
|
+
/* A kind matches on its id or its reading name, so "value map" and `value-map`
|
|
194
|
+
* both find it. */
|
|
195
|
+
var matchesKind = (0, react_1.useCallback)(function (candidate) {
|
|
196
|
+
return !needle ||
|
|
197
|
+
candidate.toLowerCase().includes(needle) ||
|
|
198
|
+
resolveKindLabel(candidate).toLowerCase().includes(needle);
|
|
199
|
+
}, [needle, resolveKindLabel]);
|
|
200
|
+
/* The matches, plus the selected kind whether or not it matched — it keeps its
|
|
201
|
+
* natural position rather than jumping to the top, so the list a user is reading
|
|
202
|
+
* doesn't reorder under them mid-keystroke. */
|
|
203
|
+
var visibleKinds = (0, react_1.useMemo)(function () { return kinds.filter(function (candidate) { return candidate === kind || matchesKind(candidate); }); }, [kinds, kind, matchesKind]);
|
|
204
|
+
var pickedNames = (0, react_1.useMemo)(function () {
|
|
205
|
+
return new Set((picked !== null && picked !== void 0 ? picked : [])
|
|
206
|
+
.filter(function (reference) { return reference.interface_kind === kind; })
|
|
207
|
+
.map(function (reference) { return reference.interface_name; }));
|
|
208
|
+
}, [picked, kind]);
|
|
209
|
+
/** One shape from here down, whichever of the two the host passed. */
|
|
210
|
+
var normalizedItems = (0, react_1.useMemo)(function () { return items.map(function (item) { return (typeof item === 'string' ? { name: item } : item); }); }, [items]);
|
|
66
211
|
/*
|
|
67
|
-
* The
|
|
68
|
-
*
|
|
69
|
-
*
|
|
212
|
+
* The interfaces the search leaves standing. When the KIND itself matches
|
|
213
|
+
* ("workflow"), its interfaces all stay — you searched for the kind, so you want to
|
|
214
|
+
* see what's in it. Otherwise the name and the description are both fair game,
|
|
215
|
+
* because both are text the user can see.
|
|
70
216
|
*/
|
|
71
217
|
var visibleItems = (0, react_1.useMemo)(function () {
|
|
72
|
-
var
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
218
|
+
var kindMatches = matchesKind(kind);
|
|
219
|
+
return normalizedItems.filter(function (item) {
|
|
220
|
+
var _a;
|
|
221
|
+
return !needle ||
|
|
222
|
+
kindMatches ||
|
|
223
|
+
item.name.toLowerCase().includes(needle) ||
|
|
224
|
+
!!((_a = item.description) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes(needle));
|
|
78
225
|
});
|
|
79
|
-
}, [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
226
|
+
}, [normalizedItems, kind, needle, matchesKind]);
|
|
227
|
+
/* Drives the "…but other types do" hint: with the kind list now always on screen,
|
|
228
|
+
* an empty result is only puzzling when the answer is sitting in another row. */
|
|
229
|
+
var otherKindsMatch = (0, react_1.useMemo)(function () { return !!needle && kinds.some(function (candidate) { return candidate !== kind && matchesKind(candidate); }); }, [kinds, kind, needle, matchesKind]);
|
|
230
|
+
var toggle = function (name) {
|
|
231
|
+
var reference = { interface_kind: kind, interface_name: name };
|
|
232
|
+
if (pickedNames.has(name)) {
|
|
233
|
+
onRemove === null || onRemove === void 0 ? void 0 : onRemove(reference);
|
|
234
|
+
}
|
|
235
|
+
else {
|
|
236
|
+
onAdd(reference);
|
|
237
|
+
}
|
|
238
|
+
};
|
|
239
|
+
var emptyNote = function () {
|
|
240
|
+
if (!needle) {
|
|
241
|
+
return "No ".concat(label.toLowerCase(), " on this instance");
|
|
242
|
+
}
|
|
243
|
+
return otherKindsMatch
|
|
244
|
+
? "No ".concat(label.toLowerCase(), " match \u201C").concat(query.trim(), "\u201D \u2014 other types do")
|
|
245
|
+
: "Nothing matches \u201C".concat(query.trim(), "\u201D");
|
|
246
|
+
};
|
|
247
|
+
/* Both panes are `ReqoreMenu`s of `ReqoreMenuItem`s — a vertical selectable list is
|
|
248
|
+
exactly what Menu is, so the selection (`selected`), the left-icon + right-icon,
|
|
249
|
+
and the item chrome come from reqore rather than hand-styled buttons. The wrappers
|
|
250
|
+
still own the scroll and the layout; the menus render transparent inside them.
|
|
251
|
+
Only menu items go inside a `ReqoreMenu`: it clones every child with its own props,
|
|
252
|
+
so a spinner or a note nested in one would be handed props it can't take. */
|
|
253
|
+
var kindItems = visibleKinds.map(function (option) { return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenuItem, { className: matchesKind(option) ? undefined : DIMMED_CLASS, icon: resolveInterfaceIcon(option), label: resolveKindLabel(option), selected: option === kind, disabled: disabled, onClick: function () { return onKindChange(option); } }, option)); });
|
|
254
|
+
var interfaces = (function () {
|
|
255
|
+
if (error) {
|
|
256
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenu, { transparent: true, flat: true, padded: false, width: '100%', size: 'small', children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenuItem, { icon: 'ErrorWarningLine', rightIcon: onRetry ? 'RefreshLine' : undefined, intent: 'danger', label: "Couldn't load ".concat(label.toLowerCase()),
|
|
257
|
+
/* the specific failure is the tooltip — the pane states the outcome */
|
|
258
|
+
tooltip: error, onClick: onRetry }) }));
|
|
259
|
+
}
|
|
260
|
+
if (loading) {
|
|
261
|
+
return ((0, jsx_runtime_1.jsxs)(reqore_1.ReqoreSpinner, { iconColor: 'info', size: 'small', centered: true, children: ["Loading ", label.toLowerCase(), "\u2026"] }));
|
|
262
|
+
}
|
|
263
|
+
if (!visibleItems.length) {
|
|
264
|
+
return (0, jsx_runtime_1.jsx)(Note, { children: emptyNote() });
|
|
265
|
+
}
|
|
266
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenu, { transparent: true, flat: true, padded: false, width: '100%', size: 'small', children: visibleItems.map(function (_a) {
|
|
267
|
+
var name = _a.name, description = _a.description, badge = _a.badge;
|
|
268
|
+
var isPicked = pickedNames.has(name);
|
|
269
|
+
var removable = isPicked && !!onRemove;
|
|
270
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenuItem, __assign({ className: isPicked ? PICKED_CLASS : undefined, icon: resolveInterfaceIcon(kind), rightIcon: isPicked ? 'CheckLine' : 'AddLine', label: name, description: description, badge: badge, disabled: disabled, tooltip: isPicked
|
|
271
|
+
? removable
|
|
272
|
+
? "Remove \u201C".concat(name, "\u201D")
|
|
273
|
+
: "\u201C".concat(name, "\u201D is already referenced")
|
|
274
|
+
: "Reference \u201C".concat(name, "\u201D"), onClick: !isPicked || removable ? function () { return toggle(name); } : undefined }, pickedItemProps(isPicked)), name));
|
|
275
|
+
}) }));
|
|
276
|
+
})();
|
|
277
|
+
var maxHeight = asModal
|
|
278
|
+
? MODAL_MAX_HEIGHT
|
|
279
|
+
: stacked
|
|
280
|
+
? STACKED_MAX_HEIGHT
|
|
281
|
+
: COLUMNS_MAX_HEIGHT;
|
|
282
|
+
/* Stacked: one column, with the selected kind's interfaces spliced in directly
|
|
283
|
+
under its row. A kind the host hasn't listed puts them at the end rather than
|
|
284
|
+
dropping them. */
|
|
285
|
+
var selectedIndex = visibleKinds.indexOf(kind);
|
|
286
|
+
var splitAt = selectedIndex === -1 ? visibleKinds.length : selectedIndex + 1;
|
|
287
|
+
var body = ((0, jsx_runtime_1.jsxs)(Frame, { ref: frameRef, "$bare": asModal, children: [header, (0, jsx_runtime_1.jsx)(Search, { "$accent": accent, "$active": !!needle, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreInput, { value: query, onChange: function (event) { return setQuery(event.target.value); }, placeholder: 'Search types and interfaces\u2026', icon: 'SearchLine', minimal: true, flat: true, transparent: true, fluid: true, disabled: disabled, onClearClick: query ? function () { return setQuery(''); } : undefined }) }), stacked ? ((0, jsx_runtime_1.jsxs)(Stack, { "$maxHeight": maxHeight, children: [(0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenu, { transparent: true, flat: true, padded: false, width: '100%', size: 'small', children: kindItems.slice(0, splitAt) }), (0, jsx_runtime_1.jsx)(Nested, { children: interfaces }), splitAt < kindItems.length ? ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenu, { transparent: true, flat: true, padded: false, width: '100%', size: 'small', children: kindItems.slice(splitAt) })) : null] })) : ((0, jsx_runtime_1.jsxs)(Panes, { children: [(0, jsx_runtime_1.jsx)(Pane, { "$maxHeight": maxHeight, children: (0, jsx_runtime_1.jsx)(reqore_1.ReqoreMenu, { transparent: true, flat: true, padded: false, width: '100%', size: 'small', children: kindItems }) }), (0, jsx_runtime_1.jsx)(Pane, { "$right": true, "$maxHeight": maxHeight, children: interfaces })] }))] }));
|
|
288
|
+
if (!asModal) {
|
|
289
|
+
return body;
|
|
290
|
+
}
|
|
291
|
+
return ((0, jsx_runtime_1.jsx)(reqore_1.ReqoreModal, { isOpen: true, icon: 'LinksLine', label: title, width: '100%', blur: 3, onClose: onClose, children: body }));
|
|
83
292
|
};
|
|
84
293
|
exports.ReferencePicker = ReferencePicker;
|
|
85
|
-
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5;
|
|
294
|
+
var templateObject_1, templateObject_2, templateObject_3, templateObject_4, templateObject_5, templateObject_6, templateObject_7;
|
|
86
295
|
//# sourceMappingURL=ReferencePicker.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ReferencePicker.js","sourceRoot":"","sources":["../../../src/components/supportTicket/ReferencePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;AAAA,mDAAkG;AAElG,+BAAqD;AACrD,wEAAuC;AACvC,qDAAwD;AACxD,+BAAmE;AAEnE;;;;;;;;;GASG;AAEH,kEAAkE;AAClE,IAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,IAAM,eAAe,GAAG,GAAG,CAAC;AAE5B;;;;;GAKG;AACH,IAAM,IAAI,GAAG,2BAAM,CAAC,GAAG,sJAAsB,MACzC,EAGiG,kBACrF,EAAe,iDAI3B,EAAa,IAChB,KATG,UAAC,EAAU;QAAR,MAAM,YAAA;IACT,OAAA,MAAM;QACJ,CAAC,CAAC,wBAAwB;QAC1B,CAAC,CAAC,iBAAU,eAAe,uEAAoE;AAFjG,CAEiG,EACrF,eAAe,EAI3B,yBAAa,CAChB,CAA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,CAAC,YAAY,CAAC,MAAM,CAAC,CAAC,CAAC,CACxB,uBAAC,mBAAU,IAAC,WAAW,QAAC,IAAI,QAAC,MAAM,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,YAClE,YAAY,CAAC,GAAG,CAAC,UAAC,IAAI,IAAK,OAAA,CAC1B,uBAAC,uBAAc,IAEb,IAAI,EAAE,oBAAoB,CAAC,IAAI,CAAC,EAChC,SAAS,EAAC,SAAS,EACnB,KAAK,EAAE,IAAI,EACX,QAAQ,EAAE,QAAQ,EAClB,OAAO,EAAE,oBAAa,IAAI,cAAI,IAAI,CAAE,EACpC,OAAO,EAAE,cAAM,OAAA,KAAK,CAAC,EAAE,cAAc,EAAE,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,EAArD,CAAqD,IAN/D,IAAI,CAOT,CACH,EAV2B,CAU3B,CAAC,GACS,CACd,CAAC,CAAC,CAAC,CACF,wBAAC,IAAI,+BAAc,IAAI,IAAQ,CAChC,GACI,IACD,IACF,CACT,CAAC;AACJ,CAAC,CAAC;AAxHW,QAAA,eAAe,mBAwH1B"}
|
|
1
|
+
{"version":3,"file":"ReferencePicker.js","sourceRoot":"","sources":["../../../src/components/supportTicket/ReferencePicker.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;AAAA,mDAMkC;AAGlC,+BAA6E;AAC7E,wEAAuC;AACvC,qDAAwD;AACxD,+BAIgB;AAEhB;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,0FAA0F;AAC1F,IAAM,kBAAkB,GAAG,OAAO,CAAC;AACnC,IAAM,kBAAkB,GAAG,OAAO,CAAC;AACnC,IAAM,gBAAgB,GAAG,MAAM,CAAC;AAChC,IAAM,eAAe,GAAG,GAAG,CAAC;AAC5B,kFAAkF;AAClF,IAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,IAAM,MAAM,GAAG,2BAA2B,CAAC;AAC3C;;;GAGG;AACH,I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,KAAK,EAAE,KAAK,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,YAClE,SAAS,GACC,GACR,EACP,uBAAC,IAAI,kCAAoB,SAAS,YAC/B,UAAU,GACN,IACD,CACT,IACK,CACT,CAAC;IAEF,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,uBAAC,oBAAW,IAAC,MAAM,QAAC,IAAI,EAAC,WAAW,EAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,EAAC,IAAI,EAAE,CAAC,EAAE,OAAO,EAAE,OAAO,YACtF,IAAI,GACO,CACf,CAAC;AACJ,CAAC,CAAC;AA9PW,QAAA,eAAe,mBA8P1B"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export interface ITicketAttachmentAccessConfig {
|
|
2
|
+
/** Absolute URL for one attachment's bytes. */
|
|
3
|
+
attachmentUrl: (ticketId: string, attachmentId: string) => string;
|
|
4
|
+
/**
|
|
5
|
+
* Headers for the byte request — typically auth. A function rather than a
|
|
6
|
+
* value because tokens are resolved per request, not at wire-up time.
|
|
7
|
+
*/
|
|
8
|
+
headers?: () => Record<string, string>;
|
|
9
|
+
/**
|
|
10
|
+
* Error to throw on a non-OK response. Defaults to a plain `Error`; apps with
|
|
11
|
+
* their own API error type (carrying the status) pass a factory.
|
|
12
|
+
*/
|
|
13
|
+
onError?: (message: string, status: number) => Error;
|
|
14
|
+
}
|
|
15
|
+
export interface ITicketAttachmentAccess {
|
|
16
|
+
/** Raw bytes. `failure` is the message used if the response isn't OK. */
|
|
17
|
+
fetchBlob: (ticketId: string, attachmentId: string, failure?: string) => Promise<Blob>;
|
|
18
|
+
/**
|
|
19
|
+
* An object URL for the bytes — for inline thumbnails and the lightbox.
|
|
20
|
+
*
|
|
21
|
+
* The caller owns the returned URL and must `URL.revokeObjectURL` it when the
|
|
22
|
+
* element goes away; this cannot do it for them without breaking the img.
|
|
23
|
+
*/
|
|
24
|
+
fetchBlobUrl: (ticketId: string, attachmentId: string) => Promise<string>;
|
|
25
|
+
/** Save the attachment to disk under its original filename. */
|
|
26
|
+
download: (ticketId: string, attachmentId: string, filename: string) => Promise<void>;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Save a blob to disk under `filename`, via a temporary anchor.
|
|
30
|
+
*
|
|
31
|
+
* Exported because it is the half of `download` that has nothing to do with
|
|
32
|
+
* tickets — a surface that already holds the bytes shouldn't have to re-fetch
|
|
33
|
+
* them just to reuse the save behaviour.
|
|
34
|
+
*/
|
|
35
|
+
export declare const saveBlobAs: (blob: Blob, filename: string) => void;
|
|
36
|
+
export declare const createTicketAttachmentAccess: ({ attachmentUrl, headers, onError, }: ITicketAttachmentAccessConfig) => ITicketAttachmentAccess;
|
|
37
|
+
//# sourceMappingURL=attachmentAccess.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentAccess.d.ts","sourceRoot":"","sources":["../../../src/components/supportTicket/attachmentAccess.ts"],"names":[],"mappings":"AAeA,MAAM,WAAW,6BAA6B;IAC5C,+CAA+C;IAC/C,aAAa,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,MAAM,CAAC;IAClE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACvC;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,KAAK,KAAK,CAAC;CACtD;AAED,MAAM,WAAW,uBAAuB;IACtC,yEAAyE;IACzE,SAAS,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACvF;;;;;OAKG;IACH,YAAY,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IAC1E,+DAA+D;IAC/D,QAAQ,EAAE,CAAC,QAAQ,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CACvF;AAKD;;;;;;GAMG;AACH,eAAO,MAAM,UAAU,SAAU,IAAI,YAAY,MAAM,KAAG,IAYzD,CAAC;AAEF,eAAO,MAAM,4BAA4B,yCAItC,6BAA6B,KAAG,uBAwBlC,CAAC"}
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Authed attachment byte-fetching, shared by every ticket surface.
|
|
4
|
+
*
|
|
5
|
+
* Attachment bytes can't go through the JSON fetch helpers, so each app grew its
|
|
6
|
+
* own raw-`fetch` copy: qorus-ide in `views/support/api.ts`, admin-portal in
|
|
7
|
+
* `pages/SupportTickets/helpers.ts`. The two were the same function down to the
|
|
8
|
+
* error text ("Could not download the attachment") and the anchor-click dance —
|
|
9
|
+
* they differed only in how the URL is built, which auth header is sent, and
|
|
10
|
+
* which Error subclass is thrown.
|
|
11
|
+
*
|
|
12
|
+
* Those three differences are the parameters below. Everything else — the
|
|
13
|
+
* non-OK check, `URL.createObjectURL`, the temporary anchor, revoking the object
|
|
14
|
+
* URL — lives here once.
|
|
15
|
+
*/
|
|
16
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
17
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
18
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
19
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
20
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
21
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
22
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
23
|
+
});
|
|
24
|
+
};
|
|
25
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
26
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
27
|
+
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
28
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
29
|
+
function step(op) {
|
|
30
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
31
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
32
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
33
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
34
|
+
switch (op[0]) {
|
|
35
|
+
case 0: case 1: t = op; break;
|
|
36
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
37
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
38
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
39
|
+
default:
|
|
40
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
41
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
42
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
43
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
44
|
+
if (t[2]) _.ops.pop();
|
|
45
|
+
_.trys.pop(); continue;
|
|
46
|
+
}
|
|
47
|
+
op = body.call(thisArg, _);
|
|
48
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
49
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
53
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
54
|
+
if (ar || !(i in from)) {
|
|
55
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
56
|
+
ar[i] = from[i];
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
60
|
+
};
|
|
61
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
62
|
+
exports.createTicketAttachmentAccess = exports.saveBlobAs = void 0;
|
|
63
|
+
var DEFAULT_DOWNLOAD_FAILURE = 'Could not download the attachment';
|
|
64
|
+
var DEFAULT_LOAD_FAILURE = 'Could not load the attachment';
|
|
65
|
+
/**
|
|
66
|
+
* Save a blob to disk under `filename`, via a temporary anchor.
|
|
67
|
+
*
|
|
68
|
+
* Exported because it is the half of `download` that has nothing to do with
|
|
69
|
+
* tickets — a surface that already holds the bytes shouldn't have to re-fetch
|
|
70
|
+
* them just to reuse the save behaviour.
|
|
71
|
+
*/
|
|
72
|
+
var saveBlobAs = function (blob, filename) {
|
|
73
|
+
var url = URL.createObjectURL(blob);
|
|
74
|
+
var anchor = document.createElement('a');
|
|
75
|
+
anchor.href = url;
|
|
76
|
+
anchor.download = filename;
|
|
77
|
+
document.body.appendChild(anchor);
|
|
78
|
+
anchor.click();
|
|
79
|
+
anchor.remove();
|
|
80
|
+
// Safari needs the URL alive until the click is processed; a task boundary is
|
|
81
|
+
// enough and avoids leaking the blob for the life of the document.
|
|
82
|
+
setTimeout(function () { return URL.revokeObjectURL(url); }, 0);
|
|
83
|
+
};
|
|
84
|
+
exports.saveBlobAs = saveBlobAs;
|
|
85
|
+
var createTicketAttachmentAccess = function (_a) {
|
|
86
|
+
var attachmentUrl = _a.attachmentUrl, headers = _a.headers, onError = _a.onError;
|
|
87
|
+
var fetchBlob = function (ticketId_1, attachmentId_1) {
|
|
88
|
+
var args_1 = [];
|
|
89
|
+
for (var _i = 2; _i < arguments.length; _i++) {
|
|
90
|
+
args_1[_i - 2] = arguments[_i];
|
|
91
|
+
}
|
|
92
|
+
return __awaiter(void 0, __spreadArray([ticketId_1, attachmentId_1], args_1, true), void 0, function (ticketId, attachmentId, failure) {
|
|
93
|
+
var response;
|
|
94
|
+
var _a;
|
|
95
|
+
if (failure === void 0) { failure = DEFAULT_LOAD_FAILURE; }
|
|
96
|
+
return __generator(this, function (_b) {
|
|
97
|
+
switch (_b.label) {
|
|
98
|
+
case 0: return [4 /*yield*/, fetch(attachmentUrl(ticketId, attachmentId), {
|
|
99
|
+
headers: (_a = headers === null || headers === void 0 ? void 0 : headers()) !== null && _a !== void 0 ? _a : {},
|
|
100
|
+
})];
|
|
101
|
+
case 1:
|
|
102
|
+
response = _b.sent();
|
|
103
|
+
if (!response.ok) {
|
|
104
|
+
throw onError ? onError(failure, response.status) : new Error(failure);
|
|
105
|
+
}
|
|
106
|
+
return [2 /*return*/, response.blob()];
|
|
107
|
+
}
|
|
108
|
+
});
|
|
109
|
+
});
|
|
110
|
+
};
|
|
111
|
+
return {
|
|
112
|
+
fetchBlob: fetchBlob,
|
|
113
|
+
fetchBlobUrl: function (ticketId, attachmentId) { return __awaiter(void 0, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) {
|
|
114
|
+
switch (_c.label) {
|
|
115
|
+
case 0:
|
|
116
|
+
_b = (_a = URL).createObjectURL;
|
|
117
|
+
return [4 /*yield*/, fetchBlob(ticketId, attachmentId, DEFAULT_LOAD_FAILURE)];
|
|
118
|
+
case 1: return [2 /*return*/, _b.apply(_a, [_c.sent()])];
|
|
119
|
+
}
|
|
120
|
+
}); }); },
|
|
121
|
+
download: function (ticketId, attachmentId, filename) { return __awaiter(void 0, void 0, void 0, function () { var _a; return __generator(this, function (_b) {
|
|
122
|
+
switch (_b.label) {
|
|
123
|
+
case 0:
|
|
124
|
+
_a = exports.saveBlobAs;
|
|
125
|
+
return [4 /*yield*/, fetchBlob(ticketId, attachmentId, DEFAULT_DOWNLOAD_FAILURE)];
|
|
126
|
+
case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), filename])];
|
|
127
|
+
}
|
|
128
|
+
}); }); },
|
|
129
|
+
};
|
|
130
|
+
};
|
|
131
|
+
exports.createTicketAttachmentAccess = createTicketAttachmentAccess;
|
|
132
|
+
//# sourceMappingURL=attachmentAccess.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"attachmentAccess.js","sourceRoot":"","sources":["../../../src/components/supportTicket/attachmentAccess.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;GAaG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+BH,IAAM,wBAAwB,GAAG,mCAAmC,CAAC;AACrE,IAAM,oBAAoB,GAAG,+BAA+B,CAAC;AAE7D;;;;;;GAMG;AACI,IAAM,UAAU,GAAG,UAAC,IAAU,EAAE,QAAgB;IACrD,IAAM,GAAG,GAAG,GAAG,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,IAAM,MAAM,GAAG,QAAQ,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC;IAE3C,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC;IAClB,MAAM,CAAC,QAAQ,GAAG,QAAQ,CAAC;IAC3B,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAClC,MAAM,CAAC,KAAK,EAAE,CAAC;IACf,MAAM,CAAC,MAAM,EAAE,CAAC;IAChB,8EAA8E;IAC9E,mEAAmE;IACnE,UAAU,CAAC,cAAM,OAAA,GAAG,CAAC,eAAe,CAAC,GAAG,CAAC,EAAxB,CAAwB,EAAE,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC;AAZW,QAAA,UAAU,cAYrB;AAEK,IAAM,4BAA4B,GAA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":"","sources":["../../../src/components/supportTicket/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/supportTicket/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,0BAA0B,CAAC;AACzC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC"}
|
|
@@ -15,6 +15,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
15
15
|
};
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./meta"), exports);
|
|
18
|
+
__exportStar(require("./ticketModel"), exports);
|
|
19
|
+
__exportStar(require("./attachmentAccess"), exports);
|
|
18
20
|
__exportStar(require("./AttachmentChips"), exports);
|
|
19
21
|
__exportStar(require("./TicketMetaTags"), exports);
|
|
20
22
|
__exportStar(require("./TicketHeader"), exports);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/supportTicket/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,oDAAkC;AAClC,mDAAiC;AACjC,iDAA+B;AAC/B,2DAAyC;AACzC,oDAAkC;AAClC,qDAAmC;AACnC,mDAAiC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/supportTicket/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,yCAAuB;AACvB,gDAA8B;AAC9B,qDAAmC;AACnC,oDAAkC;AAClC,mDAAiC;AACjC,iDAA+B;AAC/B,2DAAyC;AACzC,oDAAkC;AAClC,qDAAmC;AACnC,mDAAiC"}
|
|
@@ -60,4 +60,12 @@ export interface IInterfaceReference {
|
|
|
60
60
|
}
|
|
61
61
|
/** Default per-kind icon for a referenced interface, with a generic fallback. */
|
|
62
62
|
export declare const defaultInterfaceIcon: (kind: string) => IReqoreIconName;
|
|
63
|
+
/**
|
|
64
|
+
* Default reading name for an interface kind — "Value maps" for `value-map`. An
|
|
65
|
+
* unknown kind is humanised generically (separators to spaces, sentence case, a
|
|
66
|
+
* plural `s`) so a kind this map hasn't caught up with still reads as a word
|
|
67
|
+
* rather than an identifier. Consumers with their own vocabulary override the
|
|
68
|
+
* whole thing via the picker's `resolveKindLabel`.
|
|
69
|
+
*/
|
|
70
|
+
export declare const defaultInterfaceKindLabel: (kind: string) => string;
|
|
63
71
|
//# sourceMappingURL=meta.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"meta.d.ts","sourceRoot":"","sources":["../../../src/components/supportTicket/meta.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,+CAA+C,CAAC;AAC9E,OAAO,EAAE,eAAe,EAAE,MAAM,2CAA2C,CAAC;AAW5E,MAAM,MAAM,aAAa,GAAG,KAAK,GAAG,MAAM,GAAG,mBAAmB,GAAG,UAAU,GAAG,QAAQ,CAAC;AACzF,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAC;AACnE,MAAM,MAAM,eAAe,GAAG,KAAK,GAAG,UAAU,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AACnF,MAAM,MAAM,kBAAkB,GAAG,SAAS,GAAG,OAAO,GAAG,gBAAgB,GAAG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