@bigbinary/neeto-webhooks-frontend 1.5.4 → 1.5.5
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 +341 -34
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.js +343 -36
- package/dist/index.js.map +1 -1
- package/package.json +6 -5
package/dist/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import React, { createContext, useContext, useState, useRef, useEffect, useCallback } from 'react';
|
|
1
|
+
import React, { createElement, isValidElement, cloneElement, createContext, useContext, useState, useRef, useEffect, useCallback } from 'react';
|
|
2
2
|
import { useParams, Link, useRouteMatch, Switch, Route } from 'react-router-dom';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { removeBy, removeById } from '@bigbinary/neeto-commons-frontend/pure';
|
|
5
|
+
import { dateFormat, buildUrl } from '@bigbinary/neeto-commons-frontend/utils';
|
|
5
6
|
import { Close, Check, Info, MenuHorizontal } from '@bigbinary/neeto-icons';
|
|
6
7
|
import Header$2 from '@bigbinary/neeto-molecules/Header';
|
|
7
8
|
import PageLoader from '@bigbinary/neeto-molecules/PageLoader';
|
|
@@ -11,7 +12,6 @@ import { QueryClient, QueryCache, QueryClientProvider, useQuery, useQueryClient,
|
|
|
11
12
|
import { ReactQueryDevtools } from 'react-query/devtools';
|
|
12
13
|
import axios from 'axios';
|
|
13
14
|
import { Form, Input, ActionBlock } from '@bigbinary/neetoui/formik';
|
|
14
|
-
import { removeById } from '@bigbinary/neeto-commons-frontend/pure';
|
|
15
15
|
import * as yup from 'yup';
|
|
16
16
|
|
|
17
17
|
const consoleLogger = {
|
|
@@ -2277,7 +2277,7 @@ instance.reloadResources;
|
|
|
2277
2277
|
instance.use;
|
|
2278
2278
|
instance.changeLanguage;
|
|
2279
2279
|
instance.getFixedT;
|
|
2280
|
-
const t$
|
|
2280
|
+
const t$2 = instance.t;
|
|
2281
2281
|
instance.exists;
|
|
2282
2282
|
instance.setDefaultNamespace;
|
|
2283
2283
|
instance.hasLoadedNamespace;
|
|
@@ -2288,6 +2288,32 @@ function getDefaultExportFromCjs (x) {
|
|
|
2288
2288
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2289
2289
|
}
|
|
2290
2290
|
|
|
2291
|
+
/**
|
|
2292
|
+
* This file automatically generated from `pre-publish.js`.
|
|
2293
|
+
* Do not manually edit.
|
|
2294
|
+
*/
|
|
2295
|
+
|
|
2296
|
+
var voidElements = {
|
|
2297
|
+
"area": true,
|
|
2298
|
+
"base": true,
|
|
2299
|
+
"br": true,
|
|
2300
|
+
"col": true,
|
|
2301
|
+
"embed": true,
|
|
2302
|
+
"hr": true,
|
|
2303
|
+
"img": true,
|
|
2304
|
+
"input": true,
|
|
2305
|
+
"link": true,
|
|
2306
|
+
"meta": true,
|
|
2307
|
+
"param": true,
|
|
2308
|
+
"source": true,
|
|
2309
|
+
"track": true,
|
|
2310
|
+
"wbr": true
|
|
2311
|
+
};
|
|
2312
|
+
|
|
2313
|
+
var e$1 = /*@__PURE__*/getDefaultExportFromCjs(voidElements);
|
|
2314
|
+
|
|
2315
|
+
var t$1=/\s([^'"/\s><]+?)[\s/>]|([^\s=]+)=\s?(".*?"|'.*?')/g;function n$1(n){var r={type:"tag",name:"",voidElement:!1,attrs:{},children:[]},i=n.match(/<\/?([^\s]+?)[/\s>]/);if(i&&(r.name=i[1],(e$1[i[1]]||"/"===n.charAt(n.length-2))&&(r.voidElement=!0),r.name.startsWith("!--"))){var s=n.indexOf("--\x3e");return {type:"comment",comment:-1!==s?n.slice(4,s):""}}for(var a=new RegExp(t$1),c=null;null!==(c=a.exec(n));)if(c[0].trim())if(c[1]){var o=c[1].trim(),l=[o,""];o.indexOf("=")>-1&&(l=o.split("=")),r.attrs[l[0]]=l[1],a.lastIndex--;}else c[2]&&(r.attrs[c[2]]=c[3].trim().substring(1,c[3].length-1));return r}var r=/<[a-zA-Z0-9\-\!\/](?:"[^"]*"|'[^']*'|[^'">])*>/g,i=/^\s*$/,s=Object.create(null);function a(e,t){switch(t.type){case"text":return e+t.content;case"tag":return e+="<"+t.name+(t.attrs?function(e){var t=[];for(var n in e)t.push(n+'="'+e[n]+'"');return t.length?" "+t.join(" "):""}(t.attrs):"")+(t.voidElement?"/>":">"),t.voidElement?e:e+t.children.reduce(a,"")+"</"+t.name+">";case"comment":return e+"\x3c!--"+t.comment+"--\x3e"}}var c={parse:function(e,t){t||(t={}),t.components||(t.components=s);var a,c=[],o=[],l=-1,m=!1;if(0!==e.indexOf("<")){var u=e.indexOf("<");c.push({type:"text",content:-1===u?e:e.substring(0,u)});}return e.replace(r,function(r,s){if(m){if(r!=="</"+a.name+">")return;m=!1;}var u,f="/"!==r.charAt(1),h=r.startsWith("\x3c!--"),p=s+r.length,d=e.charAt(p);if(h){var v=n$1(r);return l<0?(c.push(v),c):((u=o[l]).children.push(v),c)}if(f&&(l++,"tag"===(a=n$1(r)).type&&t.components[a.name]&&(a.type="component",m=!0),a.voidElement||m||!d||"<"===d||a.children.push({type:"text",content:e.slice(p,e.indexOf("<",p))}),0===l&&c.push(a),(u=o[l-1])&&u.children.push(a),o[l]=a),(!f||a.voidElement)&&(l>-1&&(a.voidElement||a.name===r.slice(2,-1))&&(l--,a=-1===l?c:o[l]),!m&&"<"!==d&&d)){u=-1===l?c:o[l].children;var x=e.indexOf("<",p),g=e.slice(p,-1===x?void 0:x);i.test(g)&&(g=" "),(x>-1&&l+u.length>=0||" "!==g)&&u.push({type:"text",content:g});}}),c},stringify:function(e){return e.reduce(function(e,t){return e+a("",t)},"")}};
|
|
2316
|
+
|
|
2291
2317
|
function warn() {
|
|
2292
2318
|
if (console && console.warn) {
|
|
2293
2319
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2418,6 +2444,244 @@ function getI18n() {
|
|
|
2418
2444
|
return i18nInstance;
|
|
2419
2445
|
}
|
|
2420
2446
|
|
|
2447
|
+
function hasChildren(node, checkLength) {
|
|
2448
|
+
if (!node) return false;
|
|
2449
|
+
const base = node.props ? node.props.children : node.children;
|
|
2450
|
+
if (checkLength) return base.length > 0;
|
|
2451
|
+
return !!base;
|
|
2452
|
+
}
|
|
2453
|
+
function getChildren(node) {
|
|
2454
|
+
if (!node) return [];
|
|
2455
|
+
return node.props ? node.props.children : node.children;
|
|
2456
|
+
}
|
|
2457
|
+
function hasValidReactChildren(children) {
|
|
2458
|
+
if (Object.prototype.toString.call(children) !== '[object Array]') return false;
|
|
2459
|
+
return children.every(child => isValidElement(child));
|
|
2460
|
+
}
|
|
2461
|
+
function getAsArray(data) {
|
|
2462
|
+
return Array.isArray(data) ? data : [data];
|
|
2463
|
+
}
|
|
2464
|
+
function mergeProps(source, target) {
|
|
2465
|
+
const newTarget = {
|
|
2466
|
+
...target
|
|
2467
|
+
};
|
|
2468
|
+
newTarget.props = Object.assign(source.props, target.props);
|
|
2469
|
+
return newTarget;
|
|
2470
|
+
}
|
|
2471
|
+
function nodesToString(children, i18nOptions) {
|
|
2472
|
+
if (!children) return '';
|
|
2473
|
+
let stringNode = '';
|
|
2474
|
+
const childrenArray = getAsArray(children);
|
|
2475
|
+
const keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
|
|
2476
|
+
childrenArray.forEach((child, childIndex) => {
|
|
2477
|
+
if (typeof child === 'string') {
|
|
2478
|
+
stringNode += `${child}`;
|
|
2479
|
+
} else if (isValidElement(child)) {
|
|
2480
|
+
const childPropsCount = Object.keys(child.props).length;
|
|
2481
|
+
const shouldKeepChild = keepArray.indexOf(child.type) > -1;
|
|
2482
|
+
const childChildren = child.props.children;
|
|
2483
|
+
if (!childChildren && shouldKeepChild && childPropsCount === 0) {
|
|
2484
|
+
stringNode += `<${child.type}/>`;
|
|
2485
|
+
} else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
|
|
2486
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2487
|
+
} else if (child.props.i18nIsDynamicList) {
|
|
2488
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2489
|
+
} else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
|
|
2490
|
+
stringNode += `<${child.type}>${childChildren}</${child.type}>`;
|
|
2491
|
+
} else {
|
|
2492
|
+
const content = nodesToString(childChildren, i18nOptions);
|
|
2493
|
+
stringNode += `<${childIndex}>${content}</${childIndex}>`;
|
|
2494
|
+
}
|
|
2495
|
+
} else if (child === null) {
|
|
2496
|
+
warn(`Trans: the passed in value is invalid - seems you passed in a null child.`);
|
|
2497
|
+
} else if (typeof child === 'object') {
|
|
2498
|
+
const {
|
|
2499
|
+
format,
|
|
2500
|
+
...clone
|
|
2501
|
+
} = child;
|
|
2502
|
+
const keys = Object.keys(clone);
|
|
2503
|
+
if (keys.length === 1) {
|
|
2504
|
+
const value = format ? `${keys[0]}, ${format}` : keys[0];
|
|
2505
|
+
stringNode += `{{${value}}}`;
|
|
2506
|
+
} else {
|
|
2507
|
+
warn(`react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.`, child);
|
|
2508
|
+
}
|
|
2509
|
+
} else {
|
|
2510
|
+
warn(`Trans: the passed in value is invalid - seems you passed in a variable like {number} - please pass in variables for interpolation as full objects like {{number}}.`, child);
|
|
2511
|
+
}
|
|
2512
|
+
});
|
|
2513
|
+
return stringNode;
|
|
2514
|
+
}
|
|
2515
|
+
function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
|
|
2516
|
+
if (targetString === '') return [];
|
|
2517
|
+
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
2518
|
+
const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
|
|
2519
|
+
if (!children && !emptyChildrenButNeedsHandling) return [targetString];
|
|
2520
|
+
const data = {};
|
|
2521
|
+
function getData(childs) {
|
|
2522
|
+
const childrenArray = getAsArray(childs);
|
|
2523
|
+
childrenArray.forEach(child => {
|
|
2524
|
+
if (typeof child === 'string') return;
|
|
2525
|
+
if (hasChildren(child)) getData(getChildren(child));else if (typeof child === 'object' && !isValidElement(child)) Object.assign(data, child);
|
|
2526
|
+
});
|
|
2527
|
+
}
|
|
2528
|
+
getData(children);
|
|
2529
|
+
const ast = c.parse(`<0>${targetString}</0>`);
|
|
2530
|
+
const opts = {
|
|
2531
|
+
...data,
|
|
2532
|
+
...combinedTOpts
|
|
2533
|
+
};
|
|
2534
|
+
function renderInner(child, node, rootReactNode) {
|
|
2535
|
+
const childs = getChildren(child);
|
|
2536
|
+
const mappedChildren = mapAST(childs, node.children, rootReactNode);
|
|
2537
|
+
return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
|
|
2538
|
+
}
|
|
2539
|
+
function pushTranslatedJSX(child, inner, mem, i, isVoid) {
|
|
2540
|
+
if (child.dummy) child.children = inner;
|
|
2541
|
+
mem.push(cloneElement(child, {
|
|
2542
|
+
...child.props,
|
|
2543
|
+
key: i
|
|
2544
|
+
}, isVoid ? undefined : inner));
|
|
2545
|
+
}
|
|
2546
|
+
function mapAST(reactNode, astNode, rootReactNode) {
|
|
2547
|
+
const reactNodes = getAsArray(reactNode);
|
|
2548
|
+
const astNodes = getAsArray(astNode);
|
|
2549
|
+
return astNodes.reduce((mem, node, i) => {
|
|
2550
|
+
const translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
|
|
2551
|
+
if (node.type === 'tag') {
|
|
2552
|
+
let tmp = reactNodes[parseInt(node.name, 10)];
|
|
2553
|
+
if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
|
|
2554
|
+
if (!tmp) tmp = {};
|
|
2555
|
+
const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
|
|
2556
|
+
props: node.attrs
|
|
2557
|
+
}, tmp) : tmp;
|
|
2558
|
+
const isElement = isValidElement(child);
|
|
2559
|
+
const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
|
|
2560
|
+
const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && typeof child === 'object' && child.dummy && !isElement;
|
|
2561
|
+
const isKnownComponent = typeof children === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
|
|
2562
|
+
if (typeof child === 'string') {
|
|
2563
|
+
const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
|
|
2564
|
+
mem.push(value);
|
|
2565
|
+
} else if (hasChildren(child) || isValidTranslationWithChildren) {
|
|
2566
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2567
|
+
pushTranslatedJSX(child, inner, mem, i);
|
|
2568
|
+
} else if (isEmptyTransWithHTML) {
|
|
2569
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2570
|
+
mem.push(cloneElement(child, {
|
|
2571
|
+
...child.props,
|
|
2572
|
+
key: i
|
|
2573
|
+
}, inner));
|
|
2574
|
+
} else if (Number.isNaN(parseFloat(node.name))) {
|
|
2575
|
+
if (isKnownComponent) {
|
|
2576
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2577
|
+
pushTranslatedJSX(child, inner, mem, i, node.voidElement);
|
|
2578
|
+
} else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
|
|
2579
|
+
if (node.voidElement) {
|
|
2580
|
+
mem.push(createElement(node.name, {
|
|
2581
|
+
key: `${node.name}-${i}`
|
|
2582
|
+
}));
|
|
2583
|
+
} else {
|
|
2584
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2585
|
+
mem.push(createElement(node.name, {
|
|
2586
|
+
key: `${node.name}-${i}`
|
|
2587
|
+
}, inner));
|
|
2588
|
+
}
|
|
2589
|
+
} else if (node.voidElement) {
|
|
2590
|
+
mem.push(`<${node.name} />`);
|
|
2591
|
+
} else {
|
|
2592
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2593
|
+
mem.push(`<${node.name}>${inner}</${node.name}>`);
|
|
2594
|
+
}
|
|
2595
|
+
} else if (typeof child === 'object' && !isElement) {
|
|
2596
|
+
const content = node.children[0] ? translationContent : null;
|
|
2597
|
+
if (content) mem.push(content);
|
|
2598
|
+
} else if (node.children.length === 1 && translationContent) {
|
|
2599
|
+
mem.push(cloneElement(child, {
|
|
2600
|
+
...child.props,
|
|
2601
|
+
key: i
|
|
2602
|
+
}, translationContent));
|
|
2603
|
+
} else {
|
|
2604
|
+
mem.push(cloneElement(child, {
|
|
2605
|
+
...child.props,
|
|
2606
|
+
key: i
|
|
2607
|
+
}));
|
|
2608
|
+
}
|
|
2609
|
+
} else if (node.type === 'text') {
|
|
2610
|
+
const wrapTextNodes = i18nOptions.transWrapTextNodes;
|
|
2611
|
+
const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
|
|
2612
|
+
if (wrapTextNodes) {
|
|
2613
|
+
mem.push(createElement(wrapTextNodes, {
|
|
2614
|
+
key: `${node.name}-${i}`
|
|
2615
|
+
}, content));
|
|
2616
|
+
} else {
|
|
2617
|
+
mem.push(content);
|
|
2618
|
+
}
|
|
2619
|
+
}
|
|
2620
|
+
return mem;
|
|
2621
|
+
}, []);
|
|
2622
|
+
}
|
|
2623
|
+
const result = mapAST([{
|
|
2624
|
+
dummy: true,
|
|
2625
|
+
children: children || []
|
|
2626
|
+
}], ast, getAsArray(children || []));
|
|
2627
|
+
return getChildren(result[0]);
|
|
2628
|
+
}
|
|
2629
|
+
function Trans$1(_ref) {
|
|
2630
|
+
let {
|
|
2631
|
+
children,
|
|
2632
|
+
count,
|
|
2633
|
+
parent,
|
|
2634
|
+
i18nKey,
|
|
2635
|
+
context,
|
|
2636
|
+
tOptions = {},
|
|
2637
|
+
values,
|
|
2638
|
+
defaults,
|
|
2639
|
+
components,
|
|
2640
|
+
ns,
|
|
2641
|
+
i18n: i18nFromProps,
|
|
2642
|
+
t: tFromProps,
|
|
2643
|
+
shouldUnescape,
|
|
2644
|
+
...additionalProps
|
|
2645
|
+
} = _ref;
|
|
2646
|
+
const i18n = i18nFromProps || getI18n();
|
|
2647
|
+
if (!i18n) {
|
|
2648
|
+
warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
|
|
2649
|
+
return children;
|
|
2650
|
+
}
|
|
2651
|
+
const t = tFromProps || i18n.t.bind(i18n) || (k => k);
|
|
2652
|
+
if (context) tOptions.context = context;
|
|
2653
|
+
const reactI18nextOptions = {
|
|
2654
|
+
...getDefaults(),
|
|
2655
|
+
...(i18n.options && i18n.options.react)
|
|
2656
|
+
};
|
|
2657
|
+
let namespaces = ns || t.ns || i18n.options && i18n.options.defaultNS;
|
|
2658
|
+
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
|
|
2659
|
+
const defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
|
|
2660
|
+
const {
|
|
2661
|
+
hashTransKey
|
|
2662
|
+
} = reactI18nextOptions;
|
|
2663
|
+
const key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
|
|
2664
|
+
const interpolationOverride = values ? tOptions.interpolation : {
|
|
2665
|
+
interpolation: {
|
|
2666
|
+
...tOptions.interpolation,
|
|
2667
|
+
prefix: '#$?',
|
|
2668
|
+
suffix: '?$#'
|
|
2669
|
+
}
|
|
2670
|
+
};
|
|
2671
|
+
const combinedTOpts = {
|
|
2672
|
+
...tOptions,
|
|
2673
|
+
count,
|
|
2674
|
+
...values,
|
|
2675
|
+
...interpolationOverride,
|
|
2676
|
+
defaultValue,
|
|
2677
|
+
ns: namespaces
|
|
2678
|
+
};
|
|
2679
|
+
const translation = key ? t(key, combinedTOpts) : defaultValue;
|
|
2680
|
+
const content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
|
|
2681
|
+
const useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
|
|
2682
|
+
return useAsParent ? createElement(useAsParent, additionalProps, content) : content;
|
|
2683
|
+
}
|
|
2684
|
+
|
|
2421
2685
|
const initReactI18next = {
|
|
2422
2686
|
type: '3rdParty',
|
|
2423
2687
|
init(instance) {
|
|
@@ -2441,6 +2705,47 @@ class ReportNamespaces {
|
|
|
2441
2705
|
}
|
|
2442
2706
|
}
|
|
2443
2707
|
|
|
2708
|
+
function Trans(_ref) {
|
|
2709
|
+
let {
|
|
2710
|
+
children,
|
|
2711
|
+
count,
|
|
2712
|
+
parent,
|
|
2713
|
+
i18nKey,
|
|
2714
|
+
context,
|
|
2715
|
+
tOptions = {},
|
|
2716
|
+
values,
|
|
2717
|
+
defaults,
|
|
2718
|
+
components,
|
|
2719
|
+
ns,
|
|
2720
|
+
i18n: i18nFromProps,
|
|
2721
|
+
t: tFromProps,
|
|
2722
|
+
shouldUnescape,
|
|
2723
|
+
...additionalProps
|
|
2724
|
+
} = _ref;
|
|
2725
|
+
const {
|
|
2726
|
+
i18n: i18nFromContext,
|
|
2727
|
+
defaultNS: defaultNSFromContext
|
|
2728
|
+
} = useContext(I18nContext) || {};
|
|
2729
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
2730
|
+
const t = tFromProps || i18n && i18n.t.bind(i18n);
|
|
2731
|
+
return Trans$1({
|
|
2732
|
+
children,
|
|
2733
|
+
count,
|
|
2734
|
+
parent,
|
|
2735
|
+
i18nKey,
|
|
2736
|
+
context,
|
|
2737
|
+
tOptions,
|
|
2738
|
+
values,
|
|
2739
|
+
defaults,
|
|
2740
|
+
components,
|
|
2741
|
+
ns: ns || t && t.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
|
|
2742
|
+
i18n,
|
|
2743
|
+
t: tFromProps,
|
|
2744
|
+
shouldUnescape,
|
|
2745
|
+
...additionalProps
|
|
2746
|
+
});
|
|
2747
|
+
}
|
|
2748
|
+
|
|
2444
2749
|
const usePrevious = (value, ignore) => {
|
|
2445
2750
|
const ref = useRef();
|
|
2446
2751
|
useEffect(() => {
|
|
@@ -2585,7 +2890,7 @@ var webhook = {
|
|
|
2585
2890
|
add: "Add new webhook",
|
|
2586
2891
|
endpoint: "Endpoint",
|
|
2587
2892
|
endpointPlaceholder: "Enter endpoint URL",
|
|
2588
|
-
secret: "Secret key",
|
|
2893
|
+
secret: "Secret key (optional) <helpLink><info></helpLink>",
|
|
2589
2894
|
secretPlaceholder: "Enter secret key",
|
|
2590
2895
|
edit: "Edit Webhook"
|
|
2591
2896
|
};
|
|
@@ -3221,14 +3526,12 @@ var DeliveryItem = function DeliveryItem(_ref) {
|
|
|
3221
3526
|
};
|
|
3222
3527
|
|
|
3223
3528
|
var Deliveries = function Deliveries(_ref) {
|
|
3224
|
-
var
|
|
3529
|
+
var webhooksUrl = _ref.webhooksUrl,
|
|
3225
3530
|
hostBreadcrumbs = _ref.breadcrumbs;
|
|
3226
3531
|
var _useTranslation = useTranslation(),
|
|
3227
3532
|
t = _useTranslation.t;
|
|
3228
3533
|
var _useParams = useParams(),
|
|
3229
|
-
webhookId = _useParams.webhookId
|
|
3230
|
-
id = _useParams.id,
|
|
3231
|
-
formId = _useParams.formId;
|
|
3534
|
+
webhookId = _useParams.webhookId;
|
|
3232
3535
|
var _useFetchDeliveries = useFetchDeliveries(webhookId),
|
|
3233
3536
|
isLoading = _useFetchDeliveries.isLoading,
|
|
3234
3537
|
_useFetchDeliveries$d = _useFetchDeliveries.data,
|
|
@@ -3256,11 +3559,11 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
3256
3559
|
return _ref2.apply(this, arguments);
|
|
3257
3560
|
};
|
|
3258
3561
|
}();
|
|
3259
|
-
var
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3562
|
+
var breadcrumbsWithoutWebhooksTitle = removeBy({
|
|
3563
|
+
text: t("webhook.title")
|
|
3564
|
+
}, hostBreadcrumbs);
|
|
3565
|
+
var breadcrumbs = [].concat(_toConsumableArray(breadcrumbsWithoutWebhooksTitle), [{
|
|
3566
|
+
link: webhooksUrl,
|
|
3264
3567
|
text: t("webhook.title")
|
|
3265
3568
|
}, {
|
|
3266
3569
|
link: window.location.pathname,
|
|
@@ -3451,12 +3754,12 @@ function _defineProperty(obj, key, value) {
|
|
|
3451
3754
|
|
|
3452
3755
|
var WEBHOOK_HELP_URL = "https://help.neetocal.com/articles/webhook";
|
|
3453
3756
|
|
|
3454
|
-
var
|
|
3757
|
+
var getValidationSchema = function getValidationSchema(webhooks) {
|
|
3455
3758
|
return yup.object().shape({
|
|
3456
|
-
endpoint: yup.string().trim().matches(/^(https?):\/\//i, t$
|
|
3759
|
+
endpoint: yup.string().trim().matches(/^(https?):\/\//i, t$2("errors.webhook.invalidUrlProtocol")).url(t$2("errors.webhook.invalidUrl")).required(t$2("errors.webhook.required")).test("Is endpoint unique", t$2("errors.webhook.urlNotUnique"), function (endpoint, ctx) {
|
|
3457
3760
|
return !pluck("endpoint", removeById(ctx.parent.id, webhooks)).includes(endpoint === null || endpoint === void 0 ? void 0 : endpoint.trim());
|
|
3458
3761
|
}),
|
|
3459
|
-
secret: yup.string().trim()
|
|
3762
|
+
secret: yup.string().trim().nullable()
|
|
3460
3763
|
});
|
|
3461
3764
|
};
|
|
3462
3765
|
|
|
@@ -3522,10 +3825,10 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
3522
3825
|
}))), /*#__PURE__*/React.createElement(Form, {
|
|
3523
3826
|
formikProps: {
|
|
3524
3827
|
enableReinitialize: true,
|
|
3525
|
-
validationSchema:
|
|
3828
|
+
validationSchema: getValidationSchema(webhooks),
|
|
3526
3829
|
initialValues: initialValues,
|
|
3527
3830
|
onSubmit: function onSubmit(values) {
|
|
3528
|
-
return handleSubmit(
|
|
3831
|
+
return handleSubmit(getValidationSchema().cast(values));
|
|
3529
3832
|
}
|
|
3530
3833
|
}
|
|
3531
3834
|
}, function (_ref2) {
|
|
@@ -3542,9 +3845,22 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
3542
3845
|
ref: endpointRef
|
|
3543
3846
|
}), /*#__PURE__*/React.createElement(Input, {
|
|
3544
3847
|
"data-cy": "secret-key-input-field",
|
|
3545
|
-
label: t("webhook.secret"),
|
|
3546
3848
|
name: "secret",
|
|
3547
|
-
placeholder: t("webhook.secretPlaceholder")
|
|
3849
|
+
placeholder: t("webhook.secretPlaceholder"),
|
|
3850
|
+
label: /*#__PURE__*/React.createElement(Trans, {
|
|
3851
|
+
i18nKey: "webhook.secret",
|
|
3852
|
+
components: {
|
|
3853
|
+
helpLink: /*#__PURE__*/React.createElement("a", {
|
|
3854
|
+
href: WEBHOOK_HELP_URL,
|
|
3855
|
+
rel: "noreferrer",
|
|
3856
|
+
target: "_blank"
|
|
3857
|
+
}),
|
|
3858
|
+
info: /*#__PURE__*/React.createElement(Info, {
|
|
3859
|
+
className: "neeto-ui-text-primary-800 mt-0.5 cursor-pointer",
|
|
3860
|
+
size: 20
|
|
3861
|
+
})
|
|
3862
|
+
}
|
|
3863
|
+
})
|
|
3548
3864
|
}))), /*#__PURE__*/React.createElement(Pane.Footer, {
|
|
3549
3865
|
className: "flex gap-2"
|
|
3550
3866
|
}, /*#__PURE__*/React.createElement(ActionBlock, {
|
|
@@ -3594,16 +3910,11 @@ var WebhookItem = function WebhookItem(_ref) {
|
|
|
3594
3910
|
onDeleteClick = _ref.onDeleteClick,
|
|
3595
3911
|
onEditClick = _ref.onEditClick,
|
|
3596
3912
|
deliveriesPath = _ref.deliveriesPath;
|
|
3597
|
-
var _useParams = useParams(),
|
|
3598
|
-
id = _useParams.id,
|
|
3599
|
-
formId = _useParams.formId;
|
|
3600
3913
|
var _useTranslation = useTranslation(),
|
|
3601
3914
|
t = _useTranslation.t;
|
|
3602
3915
|
return /*#__PURE__*/React.createElement(Link, {
|
|
3603
3916
|
className: "neeto-ui-rounded-lg neeto-ui-border-gray-300 flex cursor-pointer items-center justify-between gap-4 border px-4 py-2",
|
|
3604
3917
|
to: buildUrl(deliveriesPath, {
|
|
3605
|
-
id: id,
|
|
3606
|
-
formId: formId,
|
|
3607
3918
|
webhookId: webhook.id
|
|
3608
3919
|
})
|
|
3609
3920
|
}, /*#__PURE__*/React.createElement(Typography, {
|
|
@@ -3631,7 +3942,6 @@ var WebhookItem = function WebhookItem(_ref) {
|
|
|
3631
3942
|
var WebhookItem$1 = /*#__PURE__*/React.memo(WebhookItem);
|
|
3632
3943
|
|
|
3633
3944
|
var Webhooks = function Webhooks(_ref) {
|
|
3634
|
-
var _ref2;
|
|
3635
3945
|
var deliveriesPath = _ref.deliveriesPath,
|
|
3636
3946
|
entityType = _ref.entityType,
|
|
3637
3947
|
breadcrumbs = _ref.breadcrumbs,
|
|
@@ -3654,11 +3964,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
3654
3964
|
setIsDeleteAlertOpen = _useState8[1];
|
|
3655
3965
|
var _useTranslation = useTranslation(),
|
|
3656
3966
|
t = _useTranslation.t;
|
|
3657
|
-
var
|
|
3658
|
-
id = _useParams.id,
|
|
3659
|
-
formId = _useParams.formId;
|
|
3660
|
-
var backwardCompatibleEntityId = (_ref2 = entityId !== null && entityId !== void 0 ? entityId : id) !== null && _ref2 !== void 0 ? _ref2 : formId;
|
|
3661
|
-
var _useFetchWebhooks = useFetchWebhooks(backwardCompatibleEntityId),
|
|
3967
|
+
var _useFetchWebhooks = useFetchWebhooks(entityId),
|
|
3662
3968
|
isLoading = _useFetchWebhooks.isLoading,
|
|
3663
3969
|
_useFetchWebhooks$dat = _useFetchWebhooks.data,
|
|
3664
3970
|
_useFetchWebhooks$dat2 = _useFetchWebhooks$dat === void 0 ? {} : _useFetchWebhooks$dat,
|
|
@@ -3709,7 +4015,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
3709
4015
|
title: t("webhook.empty")
|
|
3710
4016
|
}))), /*#__PURE__*/React.createElement(AddWebhookPane, {
|
|
3711
4017
|
editingWebhookId: editingWebhookId,
|
|
3712
|
-
entityId:
|
|
4018
|
+
entityId: entityId,
|
|
3713
4019
|
entityType: entityType,
|
|
3714
4020
|
isOpen: isAddWebhookPaneOpen,
|
|
3715
4021
|
webhooks: webhooks,
|
|
@@ -3740,8 +4046,9 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
3740
4046
|
_ref$breadcrumbs = _ref.breadcrumbs,
|
|
3741
4047
|
breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs;
|
|
3742
4048
|
var _useRouteMatch = useRouteMatch(),
|
|
3743
|
-
webhooksPath = _useRouteMatch.path
|
|
3744
|
-
|
|
4049
|
+
webhooksPath = _useRouteMatch.path,
|
|
4050
|
+
webhooksUrl = _useRouteMatch.url;
|
|
4051
|
+
var deliveriesPath = getDeliveriesPath(webhooksUrl);
|
|
3745
4052
|
return /*#__PURE__*/React.createElement(Switch, null, /*#__PURE__*/React.createElement(Route, {
|
|
3746
4053
|
exact: true,
|
|
3747
4054
|
path: webhooksPath,
|
|
@@ -3758,7 +4065,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
3758
4065
|
component: function component() {
|
|
3759
4066
|
return /*#__PURE__*/React.createElement(Deliveries$1, {
|
|
3760
4067
|
breadcrumbs: breadcrumbs,
|
|
3761
|
-
|
|
4068
|
+
webhooksUrl: webhooksUrl
|
|
3762
4069
|
});
|
|
3763
4070
|
}
|
|
3764
4071
|
}));
|