@bigbinary/neeto-webhooks-frontend 1.6.26 → 1.7.0-beta1
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/index.cjs.js +583 -458
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +568 -458
- package/dist/index.js.map +1 -1
- package/package.json +17 -14
package/dist/index.cjs.js
CHANGED
|
@@ -11,20 +11,34 @@ var Container = require('@bigbinary/neeto-molecules/Container');
|
|
|
11
11
|
var Header$2 = require('@bigbinary/neeto-molecules/Header');
|
|
12
12
|
var PageLoader = require('@bigbinary/neeto-molecules/PageLoader');
|
|
13
13
|
var TableWrapper = require('@bigbinary/neeto-molecules/TableWrapper');
|
|
14
|
-
var
|
|
14
|
+
var NoData = require('@bigbinary/neetoui/NoData');
|
|
15
|
+
var Table = require('@bigbinary/neetoui/Table');
|
|
15
16
|
var reactI18next = require('react-i18next');
|
|
16
|
-
var reactQuery = require('react-query');
|
|
17
|
-
var
|
|
17
|
+
var reactQuery = require('@tanstack/react-query');
|
|
18
|
+
var reactQueryDevtools = require('@tanstack/react-query-devtools');
|
|
19
|
+
var jsxRuntime = require('react/jsx-runtime');
|
|
18
20
|
var axios = require('axios');
|
|
19
21
|
var DateFormat = require('@bigbinary/neeto-molecules/DateFormat');
|
|
22
|
+
var Button = require('@bigbinary/neetoui/Button');
|
|
23
|
+
var Pane = require('@bigbinary/neetoui/Pane');
|
|
24
|
+
var Typography = require('@bigbinary/neetoui/Typography');
|
|
25
|
+
var Tab = require('@bigbinary/neetoui/Tab');
|
|
26
|
+
var Tag = require('@bigbinary/neetoui/Tag');
|
|
20
27
|
var i18next = require('i18next');
|
|
21
28
|
var ramda = require('ramda');
|
|
29
|
+
var Alert = require('@bigbinary/neetoui/Alert');
|
|
30
|
+
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
22
31
|
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
23
32
|
var HelpPopover = require('@bigbinary/neeto-molecules/HelpPopover');
|
|
24
33
|
var MoreDropdown = require('@bigbinary/neeto-molecules/MoreDropdown');
|
|
25
|
-
var
|
|
34
|
+
var Spinner = require('@bigbinary/neetoui/Spinner');
|
|
35
|
+
var Input = require('@bigbinary/neetoui/formik/Input');
|
|
36
|
+
var Form = require('@bigbinary/neetoui/formik/Form');
|
|
37
|
+
var ActionBlock = require('@bigbinary/neetoui/formik/ActionBlock');
|
|
38
|
+
var Select = require('@bigbinary/neetoui/formik/Select');
|
|
39
|
+
var Switch = require('@bigbinary/neetoui/formik/Switch');
|
|
40
|
+
var Textarea = require('@bigbinary/neetoui/formik/Textarea');
|
|
26
41
|
var yup = require('yup');
|
|
27
|
-
var reactUtils = require('@bigbinary/neeto-commons-frontend/react-utils');
|
|
28
42
|
|
|
29
43
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
30
44
|
|
|
@@ -51,10 +65,25 @@ var Container__default = /*#__PURE__*/_interopDefaultLegacy(Container);
|
|
|
51
65
|
var Header__default = /*#__PURE__*/_interopDefaultLegacy(Header$2);
|
|
52
66
|
var PageLoader__default = /*#__PURE__*/_interopDefaultLegacy(PageLoader);
|
|
53
67
|
var TableWrapper__default = /*#__PURE__*/_interopDefaultLegacy(TableWrapper);
|
|
68
|
+
var NoData__default = /*#__PURE__*/_interopDefaultLegacy(NoData);
|
|
69
|
+
var Table__default = /*#__PURE__*/_interopDefaultLegacy(Table);
|
|
54
70
|
var axios__default = /*#__PURE__*/_interopDefaultLegacy(axios);
|
|
55
71
|
var DateFormat__default = /*#__PURE__*/_interopDefaultLegacy(DateFormat);
|
|
72
|
+
var Button__default = /*#__PURE__*/_interopDefaultLegacy(Button);
|
|
73
|
+
var Pane__default = /*#__PURE__*/_interopDefaultLegacy(Pane);
|
|
74
|
+
var Typography__default = /*#__PURE__*/_interopDefaultLegacy(Typography);
|
|
75
|
+
var Tab__default = /*#__PURE__*/_interopDefaultLegacy(Tab);
|
|
76
|
+
var Tag__default = /*#__PURE__*/_interopDefaultLegacy(Tag);
|
|
77
|
+
var Alert__default = /*#__PURE__*/_interopDefaultLegacy(Alert);
|
|
56
78
|
var HelpPopover__default = /*#__PURE__*/_interopDefaultLegacy(HelpPopover);
|
|
57
79
|
var MoreDropdown__default = /*#__PURE__*/_interopDefaultLegacy(MoreDropdown);
|
|
80
|
+
var Spinner__default = /*#__PURE__*/_interopDefaultLegacy(Spinner);
|
|
81
|
+
var Input__default = /*#__PURE__*/_interopDefaultLegacy(Input);
|
|
82
|
+
var Form__default = /*#__PURE__*/_interopDefaultLegacy(Form);
|
|
83
|
+
var ActionBlock__default = /*#__PURE__*/_interopDefaultLegacy(ActionBlock);
|
|
84
|
+
var Select__default = /*#__PURE__*/_interopDefaultLegacy(Select);
|
|
85
|
+
var Switch__default = /*#__PURE__*/_interopDefaultLegacy(Switch);
|
|
86
|
+
var Textarea__default = /*#__PURE__*/_interopDefaultLegacy(Textarea);
|
|
58
87
|
var yup__namespace = /*#__PURE__*/_interopNamespace(yup);
|
|
59
88
|
|
|
60
89
|
var getDeliveriesPath = function getDeliveriesPath(webhooksPath) {
|
|
@@ -135,6 +164,47 @@ function _slicedToArray(arr, i) {
|
|
|
135
164
|
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
|
136
165
|
}
|
|
137
166
|
|
|
167
|
+
function _typeof$1(o) {
|
|
168
|
+
"@babel/helpers - typeof";
|
|
169
|
+
|
|
170
|
+
return _typeof$1 = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
171
|
+
return typeof o;
|
|
172
|
+
} : function (o) {
|
|
173
|
+
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
174
|
+
}, _typeof$1(o);
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
function _toPrimitive(input, hint) {
|
|
178
|
+
if (_typeof$1(input) !== "object" || input === null) return input;
|
|
179
|
+
var prim = input[Symbol.toPrimitive];
|
|
180
|
+
if (prim !== undefined) {
|
|
181
|
+
var res = prim.call(input, hint || "default");
|
|
182
|
+
if (_typeof$1(res) !== "object") return res;
|
|
183
|
+
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
184
|
+
}
|
|
185
|
+
return (hint === "string" ? String : Number)(input);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
function _toPropertyKey(arg) {
|
|
189
|
+
var key = _toPrimitive(arg, "string");
|
|
190
|
+
return _typeof$1(key) === "symbol" ? key : String(key);
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
function _defineProperty(obj, key, value) {
|
|
194
|
+
key = _toPropertyKey(key);
|
|
195
|
+
if (key in obj) {
|
|
196
|
+
Object.defineProperty(obj, key, {
|
|
197
|
+
value: value,
|
|
198
|
+
enumerable: true,
|
|
199
|
+
configurable: true,
|
|
200
|
+
writable: true
|
|
201
|
+
});
|
|
202
|
+
} else {
|
|
203
|
+
obj[key] = value;
|
|
204
|
+
}
|
|
205
|
+
return obj;
|
|
206
|
+
}
|
|
207
|
+
|
|
138
208
|
var queryClient = new reactQuery.QueryClient({
|
|
139
209
|
queryCache: new reactQuery.QueryCache(),
|
|
140
210
|
defaultOptions: {
|
|
@@ -144,15 +214,17 @@ var queryClient = new reactQuery.QueryClient({
|
|
|
144
214
|
}
|
|
145
215
|
});
|
|
146
216
|
|
|
147
|
-
|
|
217
|
+
function ownKeys$2(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
218
|
+
function _objectSpread$2(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys$2(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys$2(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
148
219
|
var withReactQuery = function withReactQuery(Component) {
|
|
149
220
|
var QueryWrapper = function QueryWrapper(props) {
|
|
150
|
-
return /*#__PURE__*/
|
|
151
|
-
client: queryClient
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
221
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactQuery.QueryClientProvider, {
|
|
222
|
+
client: queryClient,
|
|
223
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Component, _objectSpread$2({}, props)), /*#__PURE__*/jsxRuntime.jsx(reactQueryDevtools.ReactQueryDevtools, {
|
|
224
|
+
initialIsOpen: false,
|
|
225
|
+
position: "bottom"
|
|
226
|
+
})]
|
|
227
|
+
});
|
|
156
228
|
};
|
|
157
229
|
return QueryWrapper;
|
|
158
230
|
};
|
|
@@ -187,28 +259,35 @@ var WEBHOOK_STALE_TIME = 3200000; // 1 hour
|
|
|
187
259
|
var POST_REDELIVERY_ON_SUCCESS_TIMEOUT = 5000; // 5 seconds
|
|
188
260
|
|
|
189
261
|
var useFetchDeliveries = function useFetchDeliveries(webhookId, params) {
|
|
190
|
-
return reactQuery.useQuery(
|
|
191
|
-
|
|
192
|
-
|
|
262
|
+
return reactQuery.useQuery({
|
|
263
|
+
queryKey: [QUERY_KEYS.DELIVERY_LIST, webhookId, params],
|
|
264
|
+
queryFn: function queryFn() {
|
|
265
|
+
return deliveriesApi.fetch(webhookId, params);
|
|
266
|
+
},
|
|
193
267
|
staleTime: DELIVERY_STALE_TIME
|
|
194
268
|
});
|
|
195
269
|
};
|
|
196
270
|
var useShowDelivery = function useShowDelivery(id, webhookId) {
|
|
197
|
-
return reactQuery.useQuery(
|
|
198
|
-
|
|
199
|
-
|
|
271
|
+
return reactQuery.useQuery({
|
|
272
|
+
queryKey: [QUERY_KEYS.DELIVERY_DETAILS, id, webhookId],
|
|
273
|
+
queryFn: function queryFn() {
|
|
274
|
+
return deliveriesApi.show(id, webhookId);
|
|
275
|
+
},
|
|
200
276
|
staleTime: DELIVERY_STALE_TIME,
|
|
201
277
|
enabled: !!id
|
|
202
278
|
});
|
|
203
279
|
};
|
|
204
280
|
var useRedeliverWebhook = function useRedeliverWebhook(deliveryId, webhookSid) {
|
|
205
281
|
var queryClient = reactQuery.useQueryClient();
|
|
206
|
-
return reactQuery.useMutation(
|
|
207
|
-
|
|
208
|
-
|
|
282
|
+
return reactQuery.useMutation({
|
|
283
|
+
mutationFn: function mutationFn() {
|
|
284
|
+
return deliveriesApi.redeliver(deliveryId, webhookSid);
|
|
285
|
+
},
|
|
209
286
|
onSuccess: function onSuccess() {
|
|
210
287
|
setTimeout(function () {
|
|
211
|
-
return queryClient.invalidateQueries(
|
|
288
|
+
return queryClient.invalidateQueries({
|
|
289
|
+
queryKey: [QUERY_KEYS.DELIVERY_LIST]
|
|
290
|
+
});
|
|
212
291
|
}, POST_REDELIVERY_ON_SUCCESS_TIMEOUT);
|
|
213
292
|
}
|
|
214
293
|
});
|
|
@@ -251,9 +330,9 @@ function getDefaultExportFromCjs (x) {
|
|
|
251
330
|
|
|
252
331
|
var regeneratorRuntime$1 = {exports: {}};
|
|
253
332
|
|
|
254
|
-
var _typeof
|
|
333
|
+
var _typeof = {exports: {}};
|
|
255
334
|
|
|
256
|
-
_typeof
|
|
335
|
+
_typeof.exports;
|
|
257
336
|
|
|
258
337
|
(function (module) {
|
|
259
338
|
function _typeof(o) {
|
|
@@ -266,9 +345,9 @@ _typeof$1.exports;
|
|
|
266
345
|
}, module.exports.__esModule = true, module.exports["default"] = module.exports), _typeof(o);
|
|
267
346
|
}
|
|
268
347
|
module.exports = _typeof, module.exports.__esModule = true, module.exports["default"] = module.exports;
|
|
269
|
-
} (_typeof
|
|
348
|
+
} (_typeof));
|
|
270
349
|
|
|
271
|
-
var _typeofExports = _typeof
|
|
350
|
+
var _typeofExports = _typeof.exports;
|
|
272
351
|
|
|
273
352
|
regeneratorRuntime$1.exports;
|
|
274
353
|
|
|
@@ -607,10 +686,11 @@ var Snippet = function Snippet(_ref) {
|
|
|
607
686
|
var children = _ref.children,
|
|
608
687
|
_ref$dataCy = _ref.dataCy,
|
|
609
688
|
dataCy = _ref$dataCy === void 0 ? "" : _ref$dataCy;
|
|
610
|
-
return /*#__PURE__*/
|
|
689
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
611
690
|
className: "neeto-ui-rounded neeto-ui-border-gray-300 neeto-ui-bg-gray-100 my-2 whitespace-pre-wrap break-all border p-4",
|
|
612
|
-
"data-cy": dataCy
|
|
613
|
-
|
|
691
|
+
"data-cy": dataCy,
|
|
692
|
+
children: children
|
|
693
|
+
});
|
|
614
694
|
};
|
|
615
695
|
|
|
616
696
|
var TransactionDetails = function TransactionDetails(_ref) {
|
|
@@ -631,57 +711,89 @@ var TransactionDetails = function TransactionDetails(_ref) {
|
|
|
631
711
|
return "";
|
|
632
712
|
}
|
|
633
713
|
};
|
|
634
|
-
return /*#__PURE__*/
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
714
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
715
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
716
|
+
className: "neeto-ui-bg-white sticky top-0 mb-2 flex w-full flex-col",
|
|
717
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
718
|
+
className: "flex w-full flex-col space-y-2 pb-4",
|
|
719
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
720
|
+
className: "flex items-center space-x-1",
|
|
721
|
+
children: [t("neetoWebhooks.delivery.identifier"), ":", /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
722
|
+
className: "px-2 font-bold",
|
|
723
|
+
"data-cy": "delivery-identifier",
|
|
724
|
+
style: "body2",
|
|
725
|
+
children: identifier
|
|
726
|
+
})]
|
|
727
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
728
|
+
className: "flex items-center",
|
|
729
|
+
children: [t("neetoWebhooks.common.responseStatus"), ":", /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
730
|
+
className: "px-2 font-bold",
|
|
731
|
+
"data-cy": "delivery-response-code",
|
|
732
|
+
style: "body2",
|
|
733
|
+
children: responseStatusCode
|
|
734
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
|
|
735
|
+
style: status === "success" ? "success" : "warning",
|
|
736
|
+
children: status
|
|
737
|
+
})]
|
|
738
|
+
})]
|
|
739
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Tab__default["default"], {
|
|
740
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Tab__default["default"].Item, {
|
|
741
|
+
active: activeHeader === DELIVERY_TAB.request,
|
|
742
|
+
onClick: function onClick() {
|
|
743
|
+
return setActiveHeader(DELIVERY_TAB.request);
|
|
744
|
+
},
|
|
745
|
+
children: t("neetoWebhooks.delivery.request")
|
|
746
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Tab__default["default"].Item, {
|
|
747
|
+
active: activeHeader === DELIVERY_TAB.response,
|
|
748
|
+
onClick: function onClick() {
|
|
749
|
+
return setActiveHeader(DELIVERY_TAB.response);
|
|
750
|
+
},
|
|
751
|
+
children: t("neetoWebhooks.delivery.response")
|
|
752
|
+
})]
|
|
753
|
+
})]
|
|
754
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
755
|
+
className: "mt-2 w-full",
|
|
756
|
+
children: activeHeader === DELIVERY_TAB.request ? /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
757
|
+
className: "space-y-4",
|
|
758
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
759
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
760
|
+
style: "h5",
|
|
761
|
+
children: t("neetoWebhooks.delivery.header")
|
|
762
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Snippet, {
|
|
763
|
+
dataCy: "delivery-request-header",
|
|
764
|
+
children: delivery.requestHeader
|
|
765
|
+
})]
|
|
766
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
767
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
768
|
+
style: "h5",
|
|
769
|
+
children: t("neetoWebhooks.delivery.payload")
|
|
770
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Snippet, {
|
|
771
|
+
dataCy: "delivery-request-payload",
|
|
772
|
+
children: renderPayload()
|
|
773
|
+
})]
|
|
774
|
+
})]
|
|
775
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
776
|
+
className: "space-y-4",
|
|
777
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
778
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
779
|
+
style: "h5",
|
|
780
|
+
children: t("neetoWebhooks.delivery.header")
|
|
781
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Snippet, {
|
|
782
|
+
dataCy: "delivery-response-header",
|
|
783
|
+
children: delivery.responseHeader
|
|
784
|
+
})]
|
|
785
|
+
}), /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
786
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
787
|
+
style: "h5",
|
|
788
|
+
children: t("neetoWebhooks.delivery.body")
|
|
789
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Snippet, {
|
|
790
|
+
dataCy: "delivery-response-body",
|
|
791
|
+
children: delivery.responseBody
|
|
792
|
+
})]
|
|
793
|
+
})]
|
|
794
|
+
})
|
|
795
|
+
})]
|
|
796
|
+
});
|
|
685
797
|
};
|
|
686
798
|
|
|
687
799
|
var Details = function Details(_ref) {
|
|
@@ -691,7 +803,7 @@ var Details = function Details(_ref) {
|
|
|
691
803
|
var _useTranslation = reactI18next.useTranslation(),
|
|
692
804
|
t = _useTranslation.t;
|
|
693
805
|
var _useRedeliverWebhook = useRedeliverWebhook(deliveryId, webhookSid),
|
|
694
|
-
isRedelivering = _useRedeliverWebhook.
|
|
806
|
+
isRedelivering = _useRedeliverWebhook.isPending,
|
|
695
807
|
redeliverWebhook = _useRedeliverWebhook.mutateAsync;
|
|
696
808
|
var _useShowDelivery = useShowDelivery(deliveryId, webhookSid),
|
|
697
809
|
isLoading = _useShowDelivery.isLoading,
|
|
@@ -718,43 +830,57 @@ var Details = function Details(_ref) {
|
|
|
718
830
|
if (neetoCist.isNotPresent(delivery)) {
|
|
719
831
|
return null;
|
|
720
832
|
}
|
|
721
|
-
return /*#__PURE__*/
|
|
833
|
+
return /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"], {
|
|
722
834
|
onClose: onClose,
|
|
723
835
|
isOpen: neetoCist.isPresent(deliveryId),
|
|
724
|
-
size: "large"
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
836
|
+
size: "large",
|
|
837
|
+
children: /*#__PURE__*/jsxRuntime.jsx(jsxRuntime.Fragment, {
|
|
838
|
+
children: isLoading ? /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
839
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Header, {
|
|
840
|
+
children: /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
841
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(DateFormat__default["default"].Date, {
|
|
842
|
+
date: delivery.createdAt,
|
|
843
|
+
tooltipProps: {
|
|
844
|
+
disabled: true
|
|
845
|
+
},
|
|
846
|
+
typographyProps: {
|
|
847
|
+
style: "h2",
|
|
848
|
+
weight: "semibold"
|
|
849
|
+
}
|
|
850
|
+
}), /*#__PURE__*/jsxRuntime.jsx("span", {
|
|
851
|
+
children: " \u2022 "
|
|
852
|
+
}), /*#__PURE__*/jsxRuntime.jsx(DateFormat__default["default"].Time, {
|
|
853
|
+
date: delivery.createdAt,
|
|
854
|
+
tooltipProps: {
|
|
855
|
+
disabled: true
|
|
856
|
+
},
|
|
857
|
+
typographyProps: {
|
|
858
|
+
style: "h2",
|
|
859
|
+
weight: "normal"
|
|
860
|
+
}
|
|
861
|
+
})]
|
|
862
|
+
})
|
|
863
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Body, {
|
|
864
|
+
children: neetoCist.isPresent(delivery) && /*#__PURE__*/jsxRuntime.jsx(TransactionDetails, {
|
|
865
|
+
delivery: delivery
|
|
866
|
+
})
|
|
867
|
+
}), /*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Footer, {
|
|
868
|
+
className: "gap-x-2",
|
|
869
|
+
children: [event && /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
870
|
+
disabled: isRedelivering,
|
|
871
|
+
label: t("neetoWebhooks.delivery.redeliver"),
|
|
872
|
+
loading: isRedelivering,
|
|
873
|
+
style: "primary",
|
|
874
|
+
onClick: handleRedeliverClick
|
|
875
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
876
|
+
label: t("neetoWebhooks.buttons.cancel"),
|
|
877
|
+
style: "text",
|
|
878
|
+
onClick: onClose
|
|
879
|
+
})]
|
|
880
|
+
})]
|
|
881
|
+
})
|
|
882
|
+
})
|
|
883
|
+
});
|
|
758
884
|
};
|
|
759
885
|
|
|
760
886
|
var buildColumns$1 = function buildColumns(_ref) {
|
|
@@ -765,17 +891,20 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
765
891
|
dataIndex: "identifier",
|
|
766
892
|
width: 390,
|
|
767
893
|
render: function render(_, delivery) {
|
|
768
|
-
return /*#__PURE__*/
|
|
769
|
-
className: "flex items-center gap-x-3"
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
894
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
895
|
+
className: "flex items-center gap-x-3",
|
|
896
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
897
|
+
style: "link",
|
|
898
|
+
weight: "semibold",
|
|
899
|
+
onClick: function onClick() {
|
|
900
|
+
return handleDetailsClick(delivery.sid);
|
|
901
|
+
},
|
|
902
|
+
children: delivery.identifier
|
|
903
|
+
}), delivery.redelivery && /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
|
|
904
|
+
style: "info",
|
|
905
|
+
children: i18next.t("neetoWebhooks.delivery.redelivery")
|
|
906
|
+
})]
|
|
907
|
+
});
|
|
779
908
|
}
|
|
780
909
|
}, {
|
|
781
910
|
title: i18next.t("neetoWebhooks.tableHeaders.createdAt"),
|
|
@@ -783,11 +912,14 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
783
912
|
dataIndex: "createdAt",
|
|
784
913
|
width: 280,
|
|
785
914
|
render: function render(createdAt) {
|
|
786
|
-
return /*#__PURE__*/
|
|
787
|
-
className: "flex items-center justify-between space-x-1"
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
915
|
+
return /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
916
|
+
className: "flex items-center justify-between space-x-1",
|
|
917
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
918
|
+
children: /*#__PURE__*/jsxRuntime.jsx(DateFormat__default["default"].DateTime, {
|
|
919
|
+
date: createdAt
|
|
920
|
+
})
|
|
921
|
+
})
|
|
922
|
+
});
|
|
791
923
|
}
|
|
792
924
|
}, {
|
|
793
925
|
title: i18next.t("neetoWebhooks.common.responseStatus"),
|
|
@@ -796,14 +928,17 @@ var buildColumns$1 = function buildColumns(_ref) {
|
|
|
796
928
|
render: function render(_ref2) {
|
|
797
929
|
var responseStatusCode = _ref2.responseStatusCode,
|
|
798
930
|
status = _ref2.status;
|
|
799
|
-
return /*#__PURE__*/
|
|
800
|
-
className: "flex items-center"
|
|
801
|
-
|
|
802
|
-
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
|
|
806
|
-
|
|
931
|
+
return /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
932
|
+
className: "flex items-center",
|
|
933
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
934
|
+
className: "px-2",
|
|
935
|
+
style: "body2",
|
|
936
|
+
children: responseStatusCode
|
|
937
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Tag__default["default"], {
|
|
938
|
+
style: status === "success" ? "success" : "warning",
|
|
939
|
+
children: status
|
|
940
|
+
})]
|
|
941
|
+
});
|
|
807
942
|
}
|
|
808
943
|
}, {
|
|
809
944
|
title: i18next.t("neetoWebhooks.common.event", constants.SINGULAR),
|
|
@@ -863,35 +998,38 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
863
998
|
webhookId: webhookId
|
|
864
999
|
}));
|
|
865
1000
|
};
|
|
866
|
-
if (isLoading) return /*#__PURE__*/
|
|
867
|
-
return /*#__PURE__*/
|
|
868
|
-
className: "w-full"
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
1001
|
+
if (isLoading) return /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {});
|
|
1002
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Container__default["default"], {
|
|
1003
|
+
className: "w-full",
|
|
1004
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Header__default["default"], {
|
|
1005
|
+
breadcrumbs: breadcrumbs,
|
|
1006
|
+
title: t("neetoWebhooks.delivery.title")
|
|
1007
|
+
}), neetoCist.isNotEmpty(deliveries) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper__default["default"], {
|
|
1008
|
+
hasPagination: totalCount > constants.DEFAULT_PAGE_SIZE,
|
|
1009
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
|
|
1010
|
+
totalCount: totalCount,
|
|
1011
|
+
fixedHeight: true,
|
|
1012
|
+
columnData: buildColumns$1({
|
|
1013
|
+
handleDetailsClick: handleDetailsClick
|
|
1014
|
+
}),
|
|
1015
|
+
currentPageNumber: pageNumber,
|
|
1016
|
+
defaultPageSize: constants.DEFAULT_PAGE_SIZE,
|
|
1017
|
+
handlePageChange: setPageNumber,
|
|
1018
|
+
loading: isFetching,
|
|
1019
|
+
rowData: deliveries
|
|
1020
|
+
})
|
|
1021
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1022
|
+
className: "flex h-full w-full items-center justify-center",
|
|
1023
|
+
children: /*#__PURE__*/jsxRuntime.jsx(NoData__default["default"], {
|
|
1024
|
+
description: t("neetoWebhooks.delivery.empty.description"),
|
|
1025
|
+
title: t("neetoWebhooks.delivery.empty.title")
|
|
1026
|
+
})
|
|
1027
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Details, {
|
|
1028
|
+
deliveryId: deliveryId,
|
|
1029
|
+
webhookSid: webhookId,
|
|
1030
|
+
onClose: handleClose
|
|
1031
|
+
})]
|
|
1032
|
+
});
|
|
895
1033
|
};
|
|
896
1034
|
var Deliveries$1 = withReactQuery(Deliveries);
|
|
897
1035
|
|
|
@@ -926,52 +1064,51 @@ var webhooksApi = {
|
|
|
926
1064
|
};
|
|
927
1065
|
|
|
928
1066
|
var useFetchWebhooks = function useFetchWebhooks(params) {
|
|
929
|
-
return reactQuery.useQuery(
|
|
930
|
-
|
|
931
|
-
|
|
1067
|
+
return reactQuery.useQuery({
|
|
1068
|
+
queryKey: [QUERY_KEYS.WEBHOOK_LIST, params],
|
|
1069
|
+
queryFn: function queryFn() {
|
|
1070
|
+
return webhooksApi.fetch(params);
|
|
1071
|
+
},
|
|
932
1072
|
staleTime: WEBHOOK_STALE_TIME
|
|
933
1073
|
});
|
|
934
1074
|
};
|
|
935
1075
|
var useCreateWebhook = function useCreateWebhook(options) {
|
|
936
|
-
|
|
937
|
-
|
|
1076
|
+
return reactUtils.useMutationWithInvalidation(webhooksApi.create, {
|
|
1077
|
+
keysToInvalidate: [QUERY_KEYS.WEBHOOK_LIST],
|
|
938
1078
|
onSuccess: function onSuccess() {
|
|
939
1079
|
var _options$onSuccess;
|
|
940
|
-
queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
|
|
941
1080
|
options === null || options === void 0 || (_options$onSuccess = options.onSuccess) === null || _options$onSuccess === void 0 || _options$onSuccess.call(options);
|
|
942
1081
|
}
|
|
943
1082
|
});
|
|
944
1083
|
};
|
|
945
1084
|
var useShowWebhook = function useShowWebhook(id) {
|
|
946
|
-
return reactQuery.useQuery(
|
|
947
|
-
|
|
948
|
-
|
|
1085
|
+
return reactQuery.useQuery({
|
|
1086
|
+
queryKey: [QUERY_KEYS.WEBHOOK_DETAILS, id],
|
|
1087
|
+
queryFn: function queryFn() {
|
|
1088
|
+
return webhooksApi.show(id);
|
|
1089
|
+
},
|
|
949
1090
|
enabled: !!id,
|
|
950
1091
|
staleTime: WEBHOOK_STALE_TIME
|
|
951
1092
|
});
|
|
952
1093
|
};
|
|
953
1094
|
var useUpdateWebhook = function useUpdateWebhook(id, options) {
|
|
954
|
-
|
|
955
|
-
return reactQuery.useMutation(function (_ref) {
|
|
1095
|
+
return reactUtils.useMutationWithInvalidation(function (_ref) {
|
|
956
1096
|
var id = _ref.id,
|
|
957
1097
|
payload = _ref.payload;
|
|
958
1098
|
return webhooksApi.update(id, payload);
|
|
959
1099
|
}, {
|
|
1100
|
+
keysToInvalidate: [[QUERY_KEYS.WEBHOOK_LIST], [QUERY_KEYS.WEBHOOK_DETAILS, id], [QUERY_KEYS.DELIVERY_LIST, id]],
|
|
960
1101
|
onSuccess: function onSuccess() {
|
|
961
1102
|
var _options$onSuccess2;
|
|
962
|
-
queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
|
|
963
|
-
queryClient.invalidateQueries([QUERY_KEYS.WEBHOOK_DETAILS, id]);
|
|
964
|
-
queryClient.invalidateQueries([QUERY_KEYS.DELIVERY_LIST, id]);
|
|
965
1103
|
options === null || options === void 0 || (_options$onSuccess2 = options.onSuccess) === null || _options$onSuccess2 === void 0 || _options$onSuccess2.call(options);
|
|
966
1104
|
}
|
|
967
1105
|
});
|
|
968
1106
|
};
|
|
969
1107
|
var useDestroyWebhook = function useDestroyWebhook(options) {
|
|
970
|
-
|
|
971
|
-
|
|
1108
|
+
return reactUtils.useMutationWithInvalidation(webhooksApi.destroy, {
|
|
1109
|
+
keysToInvalidate: [QUERY_KEYS.WEBHOOK_LIST],
|
|
972
1110
|
onSuccess: function onSuccess() {
|
|
973
1111
|
var _options$onSuccess3;
|
|
974
|
-
queryClient.invalidateQueries(QUERY_KEYS.WEBHOOK_LIST);
|
|
975
1112
|
options === null || options === void 0 || (_options$onSuccess3 = options.onSuccess) === null || _options$onSuccess3 === void 0 || _options$onSuccess3.call(options);
|
|
976
1113
|
}
|
|
977
1114
|
});
|
|
@@ -980,47 +1117,6 @@ var useDestroyWebhook = function useDestroyWebhook(options) {
|
|
|
980
1117
|
var WEBHOOK_HELP_URL = "https://neetocalhelp.neetokb.com/p/a-4bb6c2a2";
|
|
981
1118
|
var WEBHOOK_SECRETS_HELP_URL = "https://neetocalhelp.neetokb.com/p/a-80de90bd";
|
|
982
1119
|
|
|
983
|
-
function _typeof(o) {
|
|
984
|
-
"@babel/helpers - typeof";
|
|
985
|
-
|
|
986
|
-
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
987
|
-
return typeof o;
|
|
988
|
-
} : function (o) {
|
|
989
|
-
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
990
|
-
}, _typeof(o);
|
|
991
|
-
}
|
|
992
|
-
|
|
993
|
-
function _toPrimitive(input, hint) {
|
|
994
|
-
if (_typeof(input) !== "object" || input === null) return input;
|
|
995
|
-
var prim = input[Symbol.toPrimitive];
|
|
996
|
-
if (prim !== undefined) {
|
|
997
|
-
var res = prim.call(input, hint || "default");
|
|
998
|
-
if (_typeof(res) !== "object") return res;
|
|
999
|
-
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
1000
|
-
}
|
|
1001
|
-
return (hint === "string" ? String : Number)(input);
|
|
1002
|
-
}
|
|
1003
|
-
|
|
1004
|
-
function _toPropertyKey(arg) {
|
|
1005
|
-
var key = _toPrimitive(arg, "string");
|
|
1006
|
-
return _typeof(key) === "symbol" ? key : String(key);
|
|
1007
|
-
}
|
|
1008
|
-
|
|
1009
|
-
function _defineProperty(obj, key, value) {
|
|
1010
|
-
key = _toPropertyKey(key);
|
|
1011
|
-
if (key in obj) {
|
|
1012
|
-
Object.defineProperty(obj, key, {
|
|
1013
|
-
value: value,
|
|
1014
|
-
enumerable: true,
|
|
1015
|
-
configurable: true,
|
|
1016
|
-
writable: true
|
|
1017
|
-
});
|
|
1018
|
-
} else {
|
|
1019
|
-
obj[key] = value;
|
|
1020
|
-
}
|
|
1021
|
-
return obj;
|
|
1022
|
-
}
|
|
1023
|
-
|
|
1024
1120
|
var baseUrl = "/webhooks/events/all";
|
|
1025
1121
|
var all = function all() {
|
|
1026
1122
|
return axios__default["default"].get(baseUrl);
|
|
@@ -1030,7 +1126,9 @@ var eventsApi = {
|
|
|
1030
1126
|
};
|
|
1031
1127
|
|
|
1032
1128
|
var useFetchEvents = function useFetchEvents() {
|
|
1033
|
-
return reactQuery.useQuery(
|
|
1129
|
+
return reactQuery.useQuery({
|
|
1130
|
+
queryKey: [QUERY_KEYS.EVENTS_LIST],
|
|
1131
|
+
queryFn: eventsApi.all,
|
|
1034
1132
|
staleTime: WEBHOOK_STALE_TIME
|
|
1035
1133
|
});
|
|
1036
1134
|
};
|
|
@@ -1169,26 +1267,28 @@ var buildColumns = function buildColumns(_ref6) {
|
|
|
1169
1267
|
dataIndex: "endpoint",
|
|
1170
1268
|
width: 830,
|
|
1171
1269
|
render: function render(endpoint, webhook) {
|
|
1172
|
-
return /*#__PURE__*/
|
|
1173
|
-
className: "flex items-center justify-between space-x-3"
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
menuItems: getMenuItems({
|
|
1184
|
-
onEdit: function onEdit() {
|
|
1185
|
-
return handleEdit(webhook.id);
|
|
1270
|
+
return /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1271
|
+
className: "flex items-center justify-between space-x-3",
|
|
1272
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1273
|
+
style: "link",
|
|
1274
|
+
to: utils.buildUrl(deliveriesPath, {
|
|
1275
|
+
webhookId: webhook.sid
|
|
1276
|
+
}),
|
|
1277
|
+
children: endpoint
|
|
1278
|
+
}), /*#__PURE__*/jsxRuntime.jsx(MoreDropdown__default["default"], {
|
|
1279
|
+
dropdownProps: {
|
|
1280
|
+
strategy: "fixed"
|
|
1186
1281
|
},
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1282
|
+
menuItems: getMenuItems({
|
|
1283
|
+
onEdit: function onEdit() {
|
|
1284
|
+
return handleEdit(webhook.id);
|
|
1285
|
+
},
|
|
1286
|
+
onDelete: function onDelete() {
|
|
1287
|
+
return handleDelete(webhook.id);
|
|
1288
|
+
}
|
|
1289
|
+
})
|
|
1290
|
+
})]
|
|
1291
|
+
});
|
|
1192
1292
|
}
|
|
1193
1293
|
}, {
|
|
1194
1294
|
title: i18next.t("neetoWebhooks.webhook.active"),
|
|
@@ -1287,134 +1387,153 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
1287
1387
|
setIsSecretInputFieldVisible(true);
|
|
1288
1388
|
}
|
|
1289
1389
|
}, [webhook]);
|
|
1290
|
-
return /*#__PURE__*/
|
|
1390
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"], {
|
|
1291
1391
|
isOpen: isOpen,
|
|
1292
1392
|
onClose: onClose,
|
|
1293
|
-
initialFocusRef: endpointRef
|
|
1294
|
-
|
|
1295
|
-
|
|
1296
|
-
|
|
1297
|
-
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
href: WEBHOOK_HELP_URL
|
|
1304
|
-
},
|
|
1305
|
-
title: t("neetoWebhooks.webhook.title")
|
|
1306
|
-
})), /*#__PURE__*/React__default["default"].createElement(formik.Form, {
|
|
1307
|
-
formikProps: {
|
|
1308
|
-
enableReinitialize: true,
|
|
1309
|
-
validationSchema: getValidationSchema(webhooks),
|
|
1310
|
-
initialValues: initialValues,
|
|
1311
|
-
onSubmit: function onSubmit(values) {
|
|
1312
|
-
return handleSubmit(getValidationSchema().cast(values));
|
|
1313
|
-
}
|
|
1314
|
-
}
|
|
1315
|
-
}, function (_ref2) {
|
|
1316
|
-
var setFieldValue = _ref2.setFieldValue;
|
|
1317
|
-
return isLoading ? /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1318
|
-
className: "flex items-center justify-center"
|
|
1319
|
-
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Spinner, null)) : /*#__PURE__*/React__default["default"].createElement(React__default["default"].Fragment, null, /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Body, null, /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1320
|
-
className: "w-full space-y-4"
|
|
1321
|
-
}, /*#__PURE__*/React__default["default"].createElement(formik.Textarea, {
|
|
1322
|
-
required: true,
|
|
1323
|
-
"data-cy": "endpoint-input-field",
|
|
1324
|
-
label: t("neetoWebhooks.webhook.endpoint"),
|
|
1325
|
-
name: "endpoint",
|
|
1326
|
-
placeholder: t("neetoWebhooks.webhook.endpointPlaceholder"),
|
|
1327
|
-
ref: endpointRef,
|
|
1328
|
-
rows: 1
|
|
1329
|
-
}), !isLoading && /*#__PURE__*/React__default["default"].createElement(formik.Select, {
|
|
1330
|
-
isMulti: true,
|
|
1331
|
-
required: true,
|
|
1332
|
-
getOptionLabel: ramda.prop("label"),
|
|
1333
|
-
getOptionValue: ramda.prop("identifier"),
|
|
1334
|
-
label: t("neetoWebhooks.common.event", constants.PLURAL),
|
|
1335
|
-
name: "events",
|
|
1336
|
-
options: events,
|
|
1337
|
-
placeholder: t("neetoWebhooks.webhook.eventPlaceholder")
|
|
1338
|
-
}), isSecretInputFieldVisible && /*#__PURE__*/React__default["default"].createElement("div", {
|
|
1339
|
-
className: "flex items-center justify-between space-x-3"
|
|
1340
|
-
}, /*#__PURE__*/React__default["default"].createElement(formik.Input, {
|
|
1341
|
-
"data-cy": "secret-key-input-field",
|
|
1342
|
-
name: "secret",
|
|
1343
|
-
label: /*#__PURE__*/React__default["default"].createElement("span", {
|
|
1344
|
-
className: "flex items-center gap-x-2"
|
|
1345
|
-
}, t("neetoWebhooks.webhook.secret"), /*#__PURE__*/React__default["default"].createElement(HelpPopover__default["default"], {
|
|
1393
|
+
initialFocusRef: endpointRef,
|
|
1394
|
+
children: [/*#__PURE__*/jsxRuntime.jsxs(Pane__default["default"].Header, {
|
|
1395
|
+
className: "flex items-center gap-x-2",
|
|
1396
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1397
|
+
"data-cy": "add-new-webhook-pane-header",
|
|
1398
|
+
style: "h2",
|
|
1399
|
+
weight: "semibold",
|
|
1400
|
+
children: editingWebhookId ? t("neetoWebhooks.webhook.edit") : t("neetoWebhooks.webhook.add")
|
|
1401
|
+
}), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
|
|
1402
|
+
description: t("neetoWebhooks.webhook.helpDescription"),
|
|
1346
1403
|
helpLinkProps: {
|
|
1347
|
-
href:
|
|
1404
|
+
href: WEBHOOK_HELP_URL
|
|
1348
1405
|
},
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
|
|
1353
|
-
|
|
1354
|
-
|
|
1355
|
-
|
|
1356
|
-
|
|
1357
|
-
|
|
1358
|
-
label: t("neetoWebhooks.buttons.regenerate"),
|
|
1359
|
-
"data-cy": "regenerate-secret",
|
|
1360
|
-
onClick: function onClick() {
|
|
1361
|
-
return handleRegenerate(setFieldValue);
|
|
1406
|
+
title: t("neetoWebhooks.webhook.title")
|
|
1407
|
+
})]
|
|
1408
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Form__default["default"], {
|
|
1409
|
+
formikProps: {
|
|
1410
|
+
enableReinitialize: true,
|
|
1411
|
+
validationSchema: getValidationSchema(webhooks),
|
|
1412
|
+
initialValues: initialValues,
|
|
1413
|
+
onSubmit: function onSubmit(values) {
|
|
1414
|
+
return handleSubmit(getValidationSchema().cast(values));
|
|
1362
1415
|
}
|
|
1363
|
-
},
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
|
|
1369
|
-
}
|
|
1370
|
-
|
|
1371
|
-
|
|
1372
|
-
|
|
1373
|
-
|
|
1374
|
-
|
|
1375
|
-
|
|
1376
|
-
|
|
1377
|
-
|
|
1378
|
-
|
|
1379
|
-
|
|
1380
|
-
|
|
1381
|
-
|
|
1382
|
-
|
|
1383
|
-
|
|
1384
|
-
|
|
1416
|
+
},
|
|
1417
|
+
children: function children(_ref2) {
|
|
1418
|
+
var setFieldValue = _ref2.setFieldValue;
|
|
1419
|
+
return isLoading ? /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1420
|
+
className: "flex items-center justify-center",
|
|
1421
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Spinner__default["default"], {})
|
|
1422
|
+
}) : /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1423
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Body, {
|
|
1424
|
+
children: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1425
|
+
className: "w-full space-y-4",
|
|
1426
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Textarea__default["default"], {
|
|
1427
|
+
required: true,
|
|
1428
|
+
"data-cy": "endpoint-input-field",
|
|
1429
|
+
label: t("neetoWebhooks.webhook.endpoint"),
|
|
1430
|
+
name: "endpoint",
|
|
1431
|
+
placeholder: t("neetoWebhooks.webhook.endpointPlaceholder"),
|
|
1432
|
+
ref: endpointRef,
|
|
1433
|
+
rows: 1
|
|
1434
|
+
}), !isLoading && /*#__PURE__*/jsxRuntime.jsx(Select__default["default"], {
|
|
1435
|
+
isMulti: true,
|
|
1436
|
+
required: true,
|
|
1437
|
+
getOptionLabel: ramda.prop("label"),
|
|
1438
|
+
getOptionValue: ramda.prop("identifier"),
|
|
1439
|
+
label: t("neetoWebhooks.common.event", constants.PLURAL),
|
|
1440
|
+
name: "events",
|
|
1441
|
+
options: events,
|
|
1442
|
+
placeholder: t("neetoWebhooks.webhook.eventPlaceholder")
|
|
1443
|
+
}), isSecretInputFieldVisible && /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1444
|
+
className: "flex items-center justify-between space-x-3",
|
|
1445
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Input__default["default"], {
|
|
1446
|
+
"data-cy": "secret-key-input-field",
|
|
1447
|
+
name: "secret",
|
|
1448
|
+
label: /*#__PURE__*/jsxRuntime.jsxs("span", {
|
|
1449
|
+
className: "flex items-center gap-x-2",
|
|
1450
|
+
children: [t("neetoWebhooks.webhook.secret"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
|
|
1451
|
+
helpLinkProps: {
|
|
1452
|
+
href: WEBHOOK_SECRETS_HELP_URL
|
|
1453
|
+
},
|
|
1454
|
+
description: t("neetoWebhooks.webhook.secretkeyHelpDescription"),
|
|
1455
|
+
title: t("neetoWebhooks.webhook.secretkeyHelpTitle")
|
|
1456
|
+
})]
|
|
1457
|
+
}),
|
|
1458
|
+
placeholder: t("neetoWebhooks.webhook.secretPlaceholder")
|
|
1459
|
+
}), /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1460
|
+
className: "mt-6",
|
|
1461
|
+
children: /*#__PURE__*/jsxRuntime.jsx(MoreDropdown__default["default"], {
|
|
1462
|
+
menuItems: [{
|
|
1463
|
+
key: "regenerate-secret",
|
|
1464
|
+
label: t("neetoWebhooks.buttons.regenerate"),
|
|
1465
|
+
"data-cy": "regenerate-secret",
|
|
1466
|
+
onClick: function onClick() {
|
|
1467
|
+
return handleRegenerate(setFieldValue);
|
|
1468
|
+
}
|
|
1469
|
+
}, {
|
|
1470
|
+
key: "delete-secret",
|
|
1471
|
+
label: t("neetoWebhooks.buttons.delete"),
|
|
1472
|
+
"data-cy": "delete-secret",
|
|
1473
|
+
onClick: function onClick() {
|
|
1474
|
+
return handleDelete(setFieldValue);
|
|
1475
|
+
}
|
|
1476
|
+
}]
|
|
1477
|
+
})
|
|
1478
|
+
})]
|
|
1479
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Switch__default["default"], {
|
|
1480
|
+
label: t("neetoWebhooks.webhook.active"),
|
|
1481
|
+
name: "isActive"
|
|
1482
|
+
}), !isSecretInputFieldVisible && /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1483
|
+
"data-cy": "add-secret-key",
|
|
1484
|
+
icon: neetoIcons.Plus,
|
|
1485
|
+
label: t("neetoWebhooks.buttons.addSecretKey"),
|
|
1486
|
+
style: "text",
|
|
1487
|
+
onClick: function onClick() {
|
|
1488
|
+
return handleClick(setFieldValue);
|
|
1489
|
+
}
|
|
1490
|
+
})]
|
|
1491
|
+
})
|
|
1492
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Pane__default["default"].Footer, {
|
|
1493
|
+
children: /*#__PURE__*/jsxRuntime.jsx(ActionBlock__default["default"], {
|
|
1494
|
+
cancelButtonProps: {
|
|
1495
|
+
onClick: onClose
|
|
1496
|
+
}
|
|
1497
|
+
})
|
|
1498
|
+
})]
|
|
1499
|
+
});
|
|
1385
1500
|
}
|
|
1386
|
-
})
|
|
1387
|
-
})
|
|
1501
|
+
})]
|
|
1502
|
+
});
|
|
1388
1503
|
};
|
|
1389
1504
|
|
|
1390
1505
|
var Header = reactUtils.withT(function (_ref) {
|
|
1391
1506
|
var t = _ref.t,
|
|
1392
1507
|
breadcrumbs = _ref.breadcrumbs,
|
|
1393
1508
|
setIsAddWebhookPaneOpen = _ref.setIsAddWebhookPaneOpen;
|
|
1394
|
-
return /*#__PURE__*/
|
|
1395
|
-
|
|
1396
|
-
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1509
|
+
return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
|
|
1510
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Header__default["default"], {
|
|
1511
|
+
breadcrumbs: breadcrumbs,
|
|
1512
|
+
actionBlock: /*#__PURE__*/jsxRuntime.jsx(Button__default["default"], {
|
|
1513
|
+
"data-cy": "add-new-webhook-button",
|
|
1514
|
+
label: t("neetoWebhooks.webhook.add"),
|
|
1515
|
+
onClick: function onClick() {
|
|
1516
|
+
return setIsAddWebhookPaneOpen(true);
|
|
1517
|
+
}
|
|
1518
|
+
}),
|
|
1519
|
+
title: /*#__PURE__*/jsxRuntime.jsxs("div", {
|
|
1520
|
+
className: "flex items-center gap-x-2",
|
|
1521
|
+
children: [t("neetoWebhooks.webhook.title"), /*#__PURE__*/jsxRuntime.jsx(HelpPopover__default["default"], {
|
|
1522
|
+
description: t("neetoWebhooks.webhook.helpDescription"),
|
|
1523
|
+
helpLinkProps: {
|
|
1524
|
+
href: WEBHOOK_HELP_URL
|
|
1525
|
+
},
|
|
1526
|
+
title: t("neetoWebhooks.webhook.title")
|
|
1527
|
+
})]
|
|
1528
|
+
})
|
|
1529
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Typography__default["default"], {
|
|
1530
|
+
className: "mb-3",
|
|
1531
|
+
"data-cy": "webhook-description-header",
|
|
1532
|
+
style: "h5",
|
|
1533
|
+
weight: "normal",
|
|
1534
|
+
children: t("neetoWebhooks.webhook.description")
|
|
1535
|
+
})]
|
|
1536
|
+
});
|
|
1418
1537
|
});
|
|
1419
1538
|
var Header$1 = /*#__PURE__*/React__default["default"].memo(Header);
|
|
1420
1539
|
|
|
@@ -1466,7 +1585,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1466
1585
|
onDelete === null || onDelete === void 0 || onDelete();
|
|
1467
1586
|
}
|
|
1468
1587
|
}),
|
|
1469
|
-
isDeleting = _useDestroyWebhook.
|
|
1588
|
+
isDeleting = _useDestroyWebhook.isPending,
|
|
1470
1589
|
destroyWebhook = _useDestroyWebhook.mutate;
|
|
1471
1590
|
var handlePaneClose = function handlePaneClose() {
|
|
1472
1591
|
setEditingWebhookId(null);
|
|
@@ -1481,71 +1600,75 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
1481
1600
|
setIsDeleteAlertOpen(true);
|
|
1482
1601
|
}, []);
|
|
1483
1602
|
if (isLoading) {
|
|
1484
|
-
return /*#__PURE__*/
|
|
1603
|
+
return /*#__PURE__*/jsxRuntime.jsx(PageLoader__default["default"], {});
|
|
1485
1604
|
}
|
|
1486
|
-
return /*#__PURE__*/
|
|
1487
|
-
className: "w-full"
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
|
|
1505
|
-
|
|
1506
|
-
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
|
|
1516
|
-
|
|
1517
|
-
|
|
1518
|
-
|
|
1519
|
-
|
|
1605
|
+
return /*#__PURE__*/jsxRuntime.jsxs(Container__default["default"], {
|
|
1606
|
+
className: "w-full",
|
|
1607
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(Header$1, {
|
|
1608
|
+
breadcrumbs: breadcrumbs,
|
|
1609
|
+
setIsAddWebhookPaneOpen: setIsAddWebhookPaneOpen
|
|
1610
|
+
}), neetoCist.isNotEmpty(webhooks) ? /*#__PURE__*/jsxRuntime.jsx(TableWrapper__default["default"], {
|
|
1611
|
+
hasPagination: totalCount > constants.DEFAULT_PAGE_SIZE,
|
|
1612
|
+
children: /*#__PURE__*/jsxRuntime.jsx(Table__default["default"], {
|
|
1613
|
+
totalCount: totalCount,
|
|
1614
|
+
fixedHeight: true,
|
|
1615
|
+
currentPageNumber: pageNumber,
|
|
1616
|
+
defaultPageSize: constants.DEFAULT_PAGE_SIZE,
|
|
1617
|
+
handlePageChange: setPageNumber,
|
|
1618
|
+
loading: isFetching,
|
|
1619
|
+
rowData: webhooks,
|
|
1620
|
+
columnData: buildColumns({
|
|
1621
|
+
handleDelete: handleDelete,
|
|
1622
|
+
handleEdit: handleEdit,
|
|
1623
|
+
deliveriesPath: deliveriesPath
|
|
1624
|
+
})
|
|
1625
|
+
})
|
|
1626
|
+
}) : /*#__PURE__*/jsxRuntime.jsx("div", {
|
|
1627
|
+
className: "flex h-full w-full items-center justify-center",
|
|
1628
|
+
children: /*#__PURE__*/jsxRuntime.jsx(NoData__default["default"], {
|
|
1629
|
+
title: t("neetoWebhooks.webhook.empty"),
|
|
1630
|
+
helpText: /*#__PURE__*/jsxRuntime.jsx("a", {
|
|
1631
|
+
className: "neeto-ui-text-primary-800 hover:neeto-ui-text-primary-800 visited:neeto-ui-text-primary-600 font-medium",
|
|
1632
|
+
href: WEBHOOK_HELP_URL,
|
|
1633
|
+
rel: "noreferrer",
|
|
1634
|
+
target: "_blank",
|
|
1635
|
+
children: t("neetoWebhooks.webhook.emptyHelpText")
|
|
1636
|
+
}),
|
|
1637
|
+
primaryButtonProps: {
|
|
1638
|
+
label: t("neetoWebhooks.webhook.add"),
|
|
1639
|
+
onClick: function onClick() {
|
|
1640
|
+
return setIsAddWebhookPaneOpen(true);
|
|
1641
|
+
}
|
|
1642
|
+
}
|
|
1643
|
+
})
|
|
1644
|
+
}), /*#__PURE__*/jsxRuntime.jsx(AddWebhookPane, {
|
|
1645
|
+
editingWebhookId: editingWebhookId,
|
|
1646
|
+
entityId: entityId,
|
|
1647
|
+
entityType: entityType,
|
|
1648
|
+
onCreate: onCreate,
|
|
1649
|
+
webhooks: webhooks,
|
|
1650
|
+
isOpen: isAddWebhookPaneOpen,
|
|
1651
|
+
onClose: handlePaneClose
|
|
1652
|
+
}), /*#__PURE__*/jsxRuntime.jsx(Alert__default["default"], {
|
|
1653
|
+
isOpen: isDeleteAlertOpen,
|
|
1654
|
+
isSubmitting: isDeleting,
|
|
1655
|
+
submitButtonLabel: t("neetoWebhooks.buttons.delete"),
|
|
1656
|
+
message: t("neetoWebhooks.alert.delete.message", {
|
|
1657
|
+
entity: t("neetoWebhooks.entity.webhook")
|
|
1658
|
+
}),
|
|
1659
|
+
title: t("neetoWebhooks.alert.delete.title", {
|
|
1660
|
+
entity: t("neetoWebhooks.entity.webhook")
|
|
1661
|
+
}),
|
|
1662
|
+
onClose: function onClose() {
|
|
1663
|
+
return setIsDeleteAlertOpen(false);
|
|
1664
|
+
},
|
|
1665
|
+
onSubmit: function onSubmit() {
|
|
1666
|
+
return destroyWebhook(deletingWebhookId, {
|
|
1667
|
+
entityId: entityId
|
|
1668
|
+
});
|
|
1520
1669
|
}
|
|
1521
|
-
}
|
|
1522
|
-
})
|
|
1523
|
-
editingWebhookId: editingWebhookId,
|
|
1524
|
-
entityId: entityId,
|
|
1525
|
-
entityType: entityType,
|
|
1526
|
-
onCreate: onCreate,
|
|
1527
|
-
webhooks: webhooks,
|
|
1528
|
-
isOpen: isAddWebhookPaneOpen,
|
|
1529
|
-
onClose: handlePaneClose
|
|
1530
|
-
}), /*#__PURE__*/React__default["default"].createElement(neetoui.Alert, {
|
|
1531
|
-
isOpen: isDeleteAlertOpen,
|
|
1532
|
-
isSubmitting: isDeleting,
|
|
1533
|
-
submitButtonLabel: t("neetoWebhooks.buttons.delete"),
|
|
1534
|
-
message: t("neetoWebhooks.alert.delete.message", {
|
|
1535
|
-
entity: t("neetoWebhooks.entity.webhook")
|
|
1536
|
-
}),
|
|
1537
|
-
title: t("neetoWebhooks.alert.delete.title", {
|
|
1538
|
-
entity: t("neetoWebhooks.entity.webhook")
|
|
1539
|
-
}),
|
|
1540
|
-
onClose: function onClose() {
|
|
1541
|
-
return setIsDeleteAlertOpen(false);
|
|
1542
|
-
},
|
|
1543
|
-
onSubmit: function onSubmit() {
|
|
1544
|
-
return destroyWebhook(deletingWebhookId, {
|
|
1545
|
-
entityId: entityId
|
|
1546
|
-
});
|
|
1547
|
-
}
|
|
1548
|
-
}));
|
|
1670
|
+
})]
|
|
1671
|
+
});
|
|
1549
1672
|
};
|
|
1550
1673
|
var Webhooks$1 = withReactQuery(Webhooks);
|
|
1551
1674
|
|
|
@@ -1561,37 +1684,39 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
1561
1684
|
webhooksUrl = _useRouteMatch.url;
|
|
1562
1685
|
var deliveriesPath = getDeliveriesPath(webhooksUrl);
|
|
1563
1686
|
var deliveryDetailsPath = getDeliveryDetailsPath(deliveriesPath);
|
|
1564
|
-
return /*#__PURE__*/
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1577
|
-
|
|
1578
|
-
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
|
|
1585
|
-
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1687
|
+
return /*#__PURE__*/jsxRuntime.jsxs(reactRouterDom.Switch, {
|
|
1688
|
+
children: [/*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1689
|
+
exact: true,
|
|
1690
|
+
path: webhooksPath,
|
|
1691
|
+
component: function component() {
|
|
1692
|
+
return /*#__PURE__*/jsxRuntime.jsx(Webhooks$1, {
|
|
1693
|
+
breadcrumbs: breadcrumbs,
|
|
1694
|
+
deliveriesPath: deliveriesPath,
|
|
1695
|
+
entityId: entityId,
|
|
1696
|
+
entityType: entityType,
|
|
1697
|
+
onCreate: onCreate,
|
|
1698
|
+
onDelete: onDelete
|
|
1699
|
+
});
|
|
1700
|
+
}
|
|
1701
|
+
}), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1702
|
+
exact: true,
|
|
1703
|
+
path: deliveryDetailsPath,
|
|
1704
|
+
render: function render() {
|
|
1705
|
+
return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
|
|
1706
|
+
breadcrumbs: breadcrumbs,
|
|
1707
|
+
webhooksUrl: webhooksUrl
|
|
1708
|
+
});
|
|
1709
|
+
}
|
|
1710
|
+
}), /*#__PURE__*/jsxRuntime.jsx(reactRouterDom.Route, {
|
|
1711
|
+
component: function component() {
|
|
1712
|
+
return /*#__PURE__*/jsxRuntime.jsx(Deliveries$1, {
|
|
1713
|
+
breadcrumbs: breadcrumbs,
|
|
1714
|
+
webhooksUrl: webhooksUrl
|
|
1715
|
+
});
|
|
1716
|
+
},
|
|
1717
|
+
path: deliveriesPath
|
|
1718
|
+
})]
|
|
1719
|
+
});
|
|
1595
1720
|
};
|
|
1596
1721
|
|
|
1597
1722
|
var e=[],t=[];function n(n,r){if(n&&"undefined"!=typeof document){var a,s=!0===r.prepend?"prepend":"append",d=!0===r.singleTag,i="string"==typeof r.container?document.querySelector(r.container):document.getElementsByTagName("head")[0];if(d){var u=e.indexOf(i);-1===u&&(u=e.push(i)-1,t[u]={}),a=t[u]&&t[u][s]?t[u][s]:t[u][s]=c();}else a=c();65279===n.charCodeAt(0)&&(n=n.substring(1)),a.styleSheet?a.styleSheet.cssText+=n:a.appendChild(document.createTextNode(n));}function c(){var e=document.createElement("style");if(e.setAttribute("type","text/css"),r.attributes)for(var t=Object.keys(r.attributes),n=0;n<t.length;n++)e.setAttribute(t[n],r.attributes[t[n]]);var a="prepend"===s?"afterbegin":"beforeend";return i.insertAdjacentElement(a,e),e}}
|