@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.cjs.js
CHANGED
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
5
5
|
var React = require('react');
|
|
6
6
|
var reactRouterDom = require('react-router-dom');
|
|
7
7
|
var classNames = require('classnames');
|
|
8
|
+
var pure = require('@bigbinary/neeto-commons-frontend/pure');
|
|
8
9
|
var utils = require('@bigbinary/neeto-commons-frontend/utils');
|
|
9
10
|
var neetoIcons = require('@bigbinary/neeto-icons');
|
|
10
11
|
var Header$2 = require('@bigbinary/neeto-molecules/Header');
|
|
@@ -15,7 +16,6 @@ var reactQuery = require('react-query');
|
|
|
15
16
|
var devtools = require('react-query/devtools');
|
|
16
17
|
var axios = require('axios');
|
|
17
18
|
var formik = require('@bigbinary/neetoui/formik');
|
|
18
|
-
var pure = require('@bigbinary/neeto-commons-frontend/pure');
|
|
19
19
|
var yup = require('yup');
|
|
20
20
|
|
|
21
21
|
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
|
|
@@ -2308,7 +2308,7 @@ instance.reloadResources;
|
|
|
2308
2308
|
instance.use;
|
|
2309
2309
|
instance.changeLanguage;
|
|
2310
2310
|
instance.getFixedT;
|
|
2311
|
-
const t$
|
|
2311
|
+
const t$2 = instance.t;
|
|
2312
2312
|
instance.exists;
|
|
2313
2313
|
instance.setDefaultNamespace;
|
|
2314
2314
|
instance.hasLoadedNamespace;
|
|
@@ -2319,6 +2319,32 @@ function getDefaultExportFromCjs (x) {
|
|
|
2319
2319
|
return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
|
|
2320
2320
|
}
|
|
2321
2321
|
|
|
2322
|
+
/**
|
|
2323
|
+
* This file automatically generated from `pre-publish.js`.
|
|
2324
|
+
* Do not manually edit.
|
|
2325
|
+
*/
|
|
2326
|
+
|
|
2327
|
+
var voidElements = {
|
|
2328
|
+
"area": true,
|
|
2329
|
+
"base": true,
|
|
2330
|
+
"br": true,
|
|
2331
|
+
"col": true,
|
|
2332
|
+
"embed": true,
|
|
2333
|
+
"hr": true,
|
|
2334
|
+
"img": true,
|
|
2335
|
+
"input": true,
|
|
2336
|
+
"link": true,
|
|
2337
|
+
"meta": true,
|
|
2338
|
+
"param": true,
|
|
2339
|
+
"source": true,
|
|
2340
|
+
"track": true,
|
|
2341
|
+
"wbr": true
|
|
2342
|
+
};
|
|
2343
|
+
|
|
2344
|
+
var e$1 = /*@__PURE__*/getDefaultExportFromCjs(voidElements);
|
|
2345
|
+
|
|
2346
|
+
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)},"")}};
|
|
2347
|
+
|
|
2322
2348
|
function warn() {
|
|
2323
2349
|
if (console && console.warn) {
|
|
2324
2350
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
@@ -2449,6 +2475,244 @@ function getI18n() {
|
|
|
2449
2475
|
return i18nInstance;
|
|
2450
2476
|
}
|
|
2451
2477
|
|
|
2478
|
+
function hasChildren(node, checkLength) {
|
|
2479
|
+
if (!node) return false;
|
|
2480
|
+
const base = node.props ? node.props.children : node.children;
|
|
2481
|
+
if (checkLength) return base.length > 0;
|
|
2482
|
+
return !!base;
|
|
2483
|
+
}
|
|
2484
|
+
function getChildren(node) {
|
|
2485
|
+
if (!node) return [];
|
|
2486
|
+
return node.props ? node.props.children : node.children;
|
|
2487
|
+
}
|
|
2488
|
+
function hasValidReactChildren(children) {
|
|
2489
|
+
if (Object.prototype.toString.call(children) !== '[object Array]') return false;
|
|
2490
|
+
return children.every(child => React.isValidElement(child));
|
|
2491
|
+
}
|
|
2492
|
+
function getAsArray(data) {
|
|
2493
|
+
return Array.isArray(data) ? data : [data];
|
|
2494
|
+
}
|
|
2495
|
+
function mergeProps(source, target) {
|
|
2496
|
+
const newTarget = {
|
|
2497
|
+
...target
|
|
2498
|
+
};
|
|
2499
|
+
newTarget.props = Object.assign(source.props, target.props);
|
|
2500
|
+
return newTarget;
|
|
2501
|
+
}
|
|
2502
|
+
function nodesToString(children, i18nOptions) {
|
|
2503
|
+
if (!children) return '';
|
|
2504
|
+
let stringNode = '';
|
|
2505
|
+
const childrenArray = getAsArray(children);
|
|
2506
|
+
const keepArray = i18nOptions.transSupportBasicHtmlNodes && i18nOptions.transKeepBasicHtmlNodesFor ? i18nOptions.transKeepBasicHtmlNodesFor : [];
|
|
2507
|
+
childrenArray.forEach((child, childIndex) => {
|
|
2508
|
+
if (typeof child === 'string') {
|
|
2509
|
+
stringNode += `${child}`;
|
|
2510
|
+
} else if (React.isValidElement(child)) {
|
|
2511
|
+
const childPropsCount = Object.keys(child.props).length;
|
|
2512
|
+
const shouldKeepChild = keepArray.indexOf(child.type) > -1;
|
|
2513
|
+
const childChildren = child.props.children;
|
|
2514
|
+
if (!childChildren && shouldKeepChild && childPropsCount === 0) {
|
|
2515
|
+
stringNode += `<${child.type}/>`;
|
|
2516
|
+
} else if (!childChildren && (!shouldKeepChild || childPropsCount !== 0)) {
|
|
2517
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2518
|
+
} else if (child.props.i18nIsDynamicList) {
|
|
2519
|
+
stringNode += `<${childIndex}></${childIndex}>`;
|
|
2520
|
+
} else if (shouldKeepChild && childPropsCount === 1 && typeof childChildren === 'string') {
|
|
2521
|
+
stringNode += `<${child.type}>${childChildren}</${child.type}>`;
|
|
2522
|
+
} else {
|
|
2523
|
+
const content = nodesToString(childChildren, i18nOptions);
|
|
2524
|
+
stringNode += `<${childIndex}>${content}</${childIndex}>`;
|
|
2525
|
+
}
|
|
2526
|
+
} else if (child === null) {
|
|
2527
|
+
warn(`Trans: the passed in value is invalid - seems you passed in a null child.`);
|
|
2528
|
+
} else if (typeof child === 'object') {
|
|
2529
|
+
const {
|
|
2530
|
+
format,
|
|
2531
|
+
...clone
|
|
2532
|
+
} = child;
|
|
2533
|
+
const keys = Object.keys(clone);
|
|
2534
|
+
if (keys.length === 1) {
|
|
2535
|
+
const value = format ? `${keys[0]}, ${format}` : keys[0];
|
|
2536
|
+
stringNode += `{{${value}}}`;
|
|
2537
|
+
} else {
|
|
2538
|
+
warn(`react-i18next: the passed in object contained more than one variable - the object should look like {{ value, format }} where format is optional.`, child);
|
|
2539
|
+
}
|
|
2540
|
+
} else {
|
|
2541
|
+
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);
|
|
2542
|
+
}
|
|
2543
|
+
});
|
|
2544
|
+
return stringNode;
|
|
2545
|
+
}
|
|
2546
|
+
function renderNodes(children, targetString, i18n, i18nOptions, combinedTOpts, shouldUnescape) {
|
|
2547
|
+
if (targetString === '') return [];
|
|
2548
|
+
const keepArray = i18nOptions.transKeepBasicHtmlNodesFor || [];
|
|
2549
|
+
const emptyChildrenButNeedsHandling = targetString && new RegExp(keepArray.join('|')).test(targetString);
|
|
2550
|
+
if (!children && !emptyChildrenButNeedsHandling) return [targetString];
|
|
2551
|
+
const data = {};
|
|
2552
|
+
function getData(childs) {
|
|
2553
|
+
const childrenArray = getAsArray(childs);
|
|
2554
|
+
childrenArray.forEach(child => {
|
|
2555
|
+
if (typeof child === 'string') return;
|
|
2556
|
+
if (hasChildren(child)) getData(getChildren(child));else if (typeof child === 'object' && !React.isValidElement(child)) Object.assign(data, child);
|
|
2557
|
+
});
|
|
2558
|
+
}
|
|
2559
|
+
getData(children);
|
|
2560
|
+
const ast = c.parse(`<0>${targetString}</0>`);
|
|
2561
|
+
const opts = {
|
|
2562
|
+
...data,
|
|
2563
|
+
...combinedTOpts
|
|
2564
|
+
};
|
|
2565
|
+
function renderInner(child, node, rootReactNode) {
|
|
2566
|
+
const childs = getChildren(child);
|
|
2567
|
+
const mappedChildren = mapAST(childs, node.children, rootReactNode);
|
|
2568
|
+
return hasValidReactChildren(childs) && mappedChildren.length === 0 ? childs : mappedChildren;
|
|
2569
|
+
}
|
|
2570
|
+
function pushTranslatedJSX(child, inner, mem, i, isVoid) {
|
|
2571
|
+
if (child.dummy) child.children = inner;
|
|
2572
|
+
mem.push(React.cloneElement(child, {
|
|
2573
|
+
...child.props,
|
|
2574
|
+
key: i
|
|
2575
|
+
}, isVoid ? undefined : inner));
|
|
2576
|
+
}
|
|
2577
|
+
function mapAST(reactNode, astNode, rootReactNode) {
|
|
2578
|
+
const reactNodes = getAsArray(reactNode);
|
|
2579
|
+
const astNodes = getAsArray(astNode);
|
|
2580
|
+
return astNodes.reduce((mem, node, i) => {
|
|
2581
|
+
const translationContent = node.children && node.children[0] && node.children[0].content && i18n.services.interpolator.interpolate(node.children[0].content, opts, i18n.language);
|
|
2582
|
+
if (node.type === 'tag') {
|
|
2583
|
+
let tmp = reactNodes[parseInt(node.name, 10)];
|
|
2584
|
+
if (!tmp && rootReactNode.length === 1 && rootReactNode[0][node.name]) tmp = rootReactNode[0][node.name];
|
|
2585
|
+
if (!tmp) tmp = {};
|
|
2586
|
+
const child = Object.keys(node.attrs).length !== 0 ? mergeProps({
|
|
2587
|
+
props: node.attrs
|
|
2588
|
+
}, tmp) : tmp;
|
|
2589
|
+
const isElement = React.isValidElement(child);
|
|
2590
|
+
const isValidTranslationWithChildren = isElement && hasChildren(node, true) && !node.voidElement;
|
|
2591
|
+
const isEmptyTransWithHTML = emptyChildrenButNeedsHandling && typeof child === 'object' && child.dummy && !isElement;
|
|
2592
|
+
const isKnownComponent = typeof children === 'object' && children !== null && Object.hasOwnProperty.call(children, node.name);
|
|
2593
|
+
if (typeof child === 'string') {
|
|
2594
|
+
const value = i18n.services.interpolator.interpolate(child, opts, i18n.language);
|
|
2595
|
+
mem.push(value);
|
|
2596
|
+
} else if (hasChildren(child) || isValidTranslationWithChildren) {
|
|
2597
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2598
|
+
pushTranslatedJSX(child, inner, mem, i);
|
|
2599
|
+
} else if (isEmptyTransWithHTML) {
|
|
2600
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2601
|
+
mem.push(React.cloneElement(child, {
|
|
2602
|
+
...child.props,
|
|
2603
|
+
key: i
|
|
2604
|
+
}, inner));
|
|
2605
|
+
} else if (Number.isNaN(parseFloat(node.name))) {
|
|
2606
|
+
if (isKnownComponent) {
|
|
2607
|
+
const inner = renderInner(child, node, rootReactNode);
|
|
2608
|
+
pushTranslatedJSX(child, inner, mem, i, node.voidElement);
|
|
2609
|
+
} else if (i18nOptions.transSupportBasicHtmlNodes && keepArray.indexOf(node.name) > -1) {
|
|
2610
|
+
if (node.voidElement) {
|
|
2611
|
+
mem.push(React.createElement(node.name, {
|
|
2612
|
+
key: `${node.name}-${i}`
|
|
2613
|
+
}));
|
|
2614
|
+
} else {
|
|
2615
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2616
|
+
mem.push(React.createElement(node.name, {
|
|
2617
|
+
key: `${node.name}-${i}`
|
|
2618
|
+
}, inner));
|
|
2619
|
+
}
|
|
2620
|
+
} else if (node.voidElement) {
|
|
2621
|
+
mem.push(`<${node.name} />`);
|
|
2622
|
+
} else {
|
|
2623
|
+
const inner = mapAST(reactNodes, node.children, rootReactNode);
|
|
2624
|
+
mem.push(`<${node.name}>${inner}</${node.name}>`);
|
|
2625
|
+
}
|
|
2626
|
+
} else if (typeof child === 'object' && !isElement) {
|
|
2627
|
+
const content = node.children[0] ? translationContent : null;
|
|
2628
|
+
if (content) mem.push(content);
|
|
2629
|
+
} else if (node.children.length === 1 && translationContent) {
|
|
2630
|
+
mem.push(React.cloneElement(child, {
|
|
2631
|
+
...child.props,
|
|
2632
|
+
key: i
|
|
2633
|
+
}, translationContent));
|
|
2634
|
+
} else {
|
|
2635
|
+
mem.push(React.cloneElement(child, {
|
|
2636
|
+
...child.props,
|
|
2637
|
+
key: i
|
|
2638
|
+
}));
|
|
2639
|
+
}
|
|
2640
|
+
} else if (node.type === 'text') {
|
|
2641
|
+
const wrapTextNodes = i18nOptions.transWrapTextNodes;
|
|
2642
|
+
const content = shouldUnescape ? i18nOptions.unescape(i18n.services.interpolator.interpolate(node.content, opts, i18n.language)) : i18n.services.interpolator.interpolate(node.content, opts, i18n.language);
|
|
2643
|
+
if (wrapTextNodes) {
|
|
2644
|
+
mem.push(React.createElement(wrapTextNodes, {
|
|
2645
|
+
key: `${node.name}-${i}`
|
|
2646
|
+
}, content));
|
|
2647
|
+
} else {
|
|
2648
|
+
mem.push(content);
|
|
2649
|
+
}
|
|
2650
|
+
}
|
|
2651
|
+
return mem;
|
|
2652
|
+
}, []);
|
|
2653
|
+
}
|
|
2654
|
+
const result = mapAST([{
|
|
2655
|
+
dummy: true,
|
|
2656
|
+
children: children || []
|
|
2657
|
+
}], ast, getAsArray(children || []));
|
|
2658
|
+
return getChildren(result[0]);
|
|
2659
|
+
}
|
|
2660
|
+
function Trans$1(_ref) {
|
|
2661
|
+
let {
|
|
2662
|
+
children,
|
|
2663
|
+
count,
|
|
2664
|
+
parent,
|
|
2665
|
+
i18nKey,
|
|
2666
|
+
context,
|
|
2667
|
+
tOptions = {},
|
|
2668
|
+
values,
|
|
2669
|
+
defaults,
|
|
2670
|
+
components,
|
|
2671
|
+
ns,
|
|
2672
|
+
i18n: i18nFromProps,
|
|
2673
|
+
t: tFromProps,
|
|
2674
|
+
shouldUnescape,
|
|
2675
|
+
...additionalProps
|
|
2676
|
+
} = _ref;
|
|
2677
|
+
const i18n = i18nFromProps || getI18n();
|
|
2678
|
+
if (!i18n) {
|
|
2679
|
+
warnOnce('You will need to pass in an i18next instance by using i18nextReactModule');
|
|
2680
|
+
return children;
|
|
2681
|
+
}
|
|
2682
|
+
const t = tFromProps || i18n.t.bind(i18n) || (k => k);
|
|
2683
|
+
if (context) tOptions.context = context;
|
|
2684
|
+
const reactI18nextOptions = {
|
|
2685
|
+
...getDefaults(),
|
|
2686
|
+
...(i18n.options && i18n.options.react)
|
|
2687
|
+
};
|
|
2688
|
+
let namespaces = ns || t.ns || i18n.options && i18n.options.defaultNS;
|
|
2689
|
+
namespaces = typeof namespaces === 'string' ? [namespaces] : namespaces || ['translation'];
|
|
2690
|
+
const defaultValue = defaults || nodesToString(children, reactI18nextOptions) || reactI18nextOptions.transEmptyNodeValue || i18nKey;
|
|
2691
|
+
const {
|
|
2692
|
+
hashTransKey
|
|
2693
|
+
} = reactI18nextOptions;
|
|
2694
|
+
const key = i18nKey || (hashTransKey ? hashTransKey(defaultValue) : defaultValue);
|
|
2695
|
+
const interpolationOverride = values ? tOptions.interpolation : {
|
|
2696
|
+
interpolation: {
|
|
2697
|
+
...tOptions.interpolation,
|
|
2698
|
+
prefix: '#$?',
|
|
2699
|
+
suffix: '?$#'
|
|
2700
|
+
}
|
|
2701
|
+
};
|
|
2702
|
+
const combinedTOpts = {
|
|
2703
|
+
...tOptions,
|
|
2704
|
+
count,
|
|
2705
|
+
...values,
|
|
2706
|
+
...interpolationOverride,
|
|
2707
|
+
defaultValue,
|
|
2708
|
+
ns: namespaces
|
|
2709
|
+
};
|
|
2710
|
+
const translation = key ? t(key, combinedTOpts) : defaultValue;
|
|
2711
|
+
const content = renderNodes(components || children, translation, i18n, reactI18nextOptions, combinedTOpts, shouldUnescape);
|
|
2712
|
+
const useAsParent = parent !== undefined ? parent : reactI18nextOptions.defaultTransParent;
|
|
2713
|
+
return useAsParent ? React.createElement(useAsParent, additionalProps, content) : content;
|
|
2714
|
+
}
|
|
2715
|
+
|
|
2452
2716
|
const initReactI18next = {
|
|
2453
2717
|
type: '3rdParty',
|
|
2454
2718
|
init(instance) {
|
|
@@ -2472,6 +2736,47 @@ class ReportNamespaces {
|
|
|
2472
2736
|
}
|
|
2473
2737
|
}
|
|
2474
2738
|
|
|
2739
|
+
function Trans(_ref) {
|
|
2740
|
+
let {
|
|
2741
|
+
children,
|
|
2742
|
+
count,
|
|
2743
|
+
parent,
|
|
2744
|
+
i18nKey,
|
|
2745
|
+
context,
|
|
2746
|
+
tOptions = {},
|
|
2747
|
+
values,
|
|
2748
|
+
defaults,
|
|
2749
|
+
components,
|
|
2750
|
+
ns,
|
|
2751
|
+
i18n: i18nFromProps,
|
|
2752
|
+
t: tFromProps,
|
|
2753
|
+
shouldUnescape,
|
|
2754
|
+
...additionalProps
|
|
2755
|
+
} = _ref;
|
|
2756
|
+
const {
|
|
2757
|
+
i18n: i18nFromContext,
|
|
2758
|
+
defaultNS: defaultNSFromContext
|
|
2759
|
+
} = React.useContext(I18nContext) || {};
|
|
2760
|
+
const i18n = i18nFromProps || i18nFromContext || getI18n();
|
|
2761
|
+
const t = tFromProps || i18n && i18n.t.bind(i18n);
|
|
2762
|
+
return Trans$1({
|
|
2763
|
+
children,
|
|
2764
|
+
count,
|
|
2765
|
+
parent,
|
|
2766
|
+
i18nKey,
|
|
2767
|
+
context,
|
|
2768
|
+
tOptions,
|
|
2769
|
+
values,
|
|
2770
|
+
defaults,
|
|
2771
|
+
components,
|
|
2772
|
+
ns: ns || t && t.ns || defaultNSFromContext || i18n && i18n.options && i18n.options.defaultNS,
|
|
2773
|
+
i18n,
|
|
2774
|
+
t: tFromProps,
|
|
2775
|
+
shouldUnescape,
|
|
2776
|
+
...additionalProps
|
|
2777
|
+
});
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2475
2780
|
const usePrevious = (value, ignore) => {
|
|
2476
2781
|
const ref = React.useRef();
|
|
2477
2782
|
React.useEffect(() => {
|
|
@@ -2616,7 +2921,7 @@ var webhook = {
|
|
|
2616
2921
|
add: "Add new webhook",
|
|
2617
2922
|
endpoint: "Endpoint",
|
|
2618
2923
|
endpointPlaceholder: "Enter endpoint URL",
|
|
2619
|
-
secret: "Secret key",
|
|
2924
|
+
secret: "Secret key (optional) <helpLink><info></helpLink>",
|
|
2620
2925
|
secretPlaceholder: "Enter secret key",
|
|
2621
2926
|
edit: "Edit Webhook"
|
|
2622
2927
|
};
|
|
@@ -3252,14 +3557,12 @@ var DeliveryItem = function DeliveryItem(_ref) {
|
|
|
3252
3557
|
};
|
|
3253
3558
|
|
|
3254
3559
|
var Deliveries = function Deliveries(_ref) {
|
|
3255
|
-
var
|
|
3560
|
+
var webhooksUrl = _ref.webhooksUrl,
|
|
3256
3561
|
hostBreadcrumbs = _ref.breadcrumbs;
|
|
3257
3562
|
var _useTranslation = useTranslation(),
|
|
3258
3563
|
t = _useTranslation.t;
|
|
3259
3564
|
var _useParams = reactRouterDom.useParams(),
|
|
3260
|
-
webhookId = _useParams.webhookId
|
|
3261
|
-
id = _useParams.id,
|
|
3262
|
-
formId = _useParams.formId;
|
|
3565
|
+
webhookId = _useParams.webhookId;
|
|
3263
3566
|
var _useFetchDeliveries = useFetchDeliveries(webhookId),
|
|
3264
3567
|
isLoading = _useFetchDeliveries.isLoading,
|
|
3265
3568
|
_useFetchDeliveries$d = _useFetchDeliveries.data,
|
|
@@ -3287,11 +3590,11 @@ var Deliveries = function Deliveries(_ref) {
|
|
|
3287
3590
|
return _ref2.apply(this, arguments);
|
|
3288
3591
|
};
|
|
3289
3592
|
}();
|
|
3290
|
-
var
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3593
|
+
var breadcrumbsWithoutWebhooksTitle = pure.removeBy({
|
|
3594
|
+
text: t("webhook.title")
|
|
3595
|
+
}, hostBreadcrumbs);
|
|
3596
|
+
var breadcrumbs = [].concat(_toConsumableArray(breadcrumbsWithoutWebhooksTitle), [{
|
|
3597
|
+
link: webhooksUrl,
|
|
3295
3598
|
text: t("webhook.title")
|
|
3296
3599
|
}, {
|
|
3297
3600
|
link: window.location.pathname,
|
|
@@ -3482,12 +3785,12 @@ function _defineProperty(obj, key, value) {
|
|
|
3482
3785
|
|
|
3483
3786
|
var WEBHOOK_HELP_URL = "https://help.neetocal.com/articles/webhook";
|
|
3484
3787
|
|
|
3485
|
-
var
|
|
3788
|
+
var getValidationSchema = function getValidationSchema(webhooks) {
|
|
3486
3789
|
return yup__namespace.object().shape({
|
|
3487
|
-
endpoint: yup__namespace.string().trim().matches(/^(https?):\/\//i, t$
|
|
3790
|
+
endpoint: yup__namespace.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) {
|
|
3488
3791
|
return !ramda.pluck("endpoint", pure.removeById(ctx.parent.id, webhooks)).includes(endpoint === null || endpoint === void 0 ? void 0 : endpoint.trim());
|
|
3489
3792
|
}),
|
|
3490
|
-
secret: yup__namespace.string().trim()
|
|
3793
|
+
secret: yup__namespace.string().trim().nullable()
|
|
3491
3794
|
});
|
|
3492
3795
|
};
|
|
3493
3796
|
|
|
@@ -3553,10 +3856,10 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
3553
3856
|
}))), /*#__PURE__*/React__default["default"].createElement(formik.Form, {
|
|
3554
3857
|
formikProps: {
|
|
3555
3858
|
enableReinitialize: true,
|
|
3556
|
-
validationSchema:
|
|
3859
|
+
validationSchema: getValidationSchema(webhooks),
|
|
3557
3860
|
initialValues: initialValues,
|
|
3558
3861
|
onSubmit: function onSubmit(values) {
|
|
3559
|
-
return handleSubmit(
|
|
3862
|
+
return handleSubmit(getValidationSchema().cast(values));
|
|
3560
3863
|
}
|
|
3561
3864
|
}
|
|
3562
3865
|
}, function (_ref2) {
|
|
@@ -3573,9 +3876,22 @@ var AddWebhookPane = function AddWebhookPane(_ref) {
|
|
|
3573
3876
|
ref: endpointRef
|
|
3574
3877
|
}), /*#__PURE__*/React__default["default"].createElement(formik.Input, {
|
|
3575
3878
|
"data-cy": "secret-key-input-field",
|
|
3576
|
-
label: t("webhook.secret"),
|
|
3577
3879
|
name: "secret",
|
|
3578
|
-
placeholder: t("webhook.secretPlaceholder")
|
|
3880
|
+
placeholder: t("webhook.secretPlaceholder"),
|
|
3881
|
+
label: /*#__PURE__*/React__default["default"].createElement(Trans, {
|
|
3882
|
+
i18nKey: "webhook.secret",
|
|
3883
|
+
components: {
|
|
3884
|
+
helpLink: /*#__PURE__*/React__default["default"].createElement("a", {
|
|
3885
|
+
href: WEBHOOK_HELP_URL,
|
|
3886
|
+
rel: "noreferrer",
|
|
3887
|
+
target: "_blank"
|
|
3888
|
+
}),
|
|
3889
|
+
info: /*#__PURE__*/React__default["default"].createElement(neetoIcons.Info, {
|
|
3890
|
+
className: "neeto-ui-text-primary-800 mt-0.5 cursor-pointer",
|
|
3891
|
+
size: 20
|
|
3892
|
+
})
|
|
3893
|
+
}
|
|
3894
|
+
})
|
|
3579
3895
|
}))), /*#__PURE__*/React__default["default"].createElement(neetoui.Pane.Footer, {
|
|
3580
3896
|
className: "flex gap-2"
|
|
3581
3897
|
}, /*#__PURE__*/React__default["default"].createElement(formik.ActionBlock, {
|
|
@@ -3625,16 +3941,11 @@ var WebhookItem = function WebhookItem(_ref) {
|
|
|
3625
3941
|
onDeleteClick = _ref.onDeleteClick,
|
|
3626
3942
|
onEditClick = _ref.onEditClick,
|
|
3627
3943
|
deliveriesPath = _ref.deliveriesPath;
|
|
3628
|
-
var _useParams = reactRouterDom.useParams(),
|
|
3629
|
-
id = _useParams.id,
|
|
3630
|
-
formId = _useParams.formId;
|
|
3631
3944
|
var _useTranslation = useTranslation(),
|
|
3632
3945
|
t = _useTranslation.t;
|
|
3633
3946
|
return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Link, {
|
|
3634
3947
|
className: "neeto-ui-rounded-lg neeto-ui-border-gray-300 flex cursor-pointer items-center justify-between gap-4 border px-4 py-2",
|
|
3635
3948
|
to: utils.buildUrl(deliveriesPath, {
|
|
3636
|
-
id: id,
|
|
3637
|
-
formId: formId,
|
|
3638
3949
|
webhookId: webhook.id
|
|
3639
3950
|
})
|
|
3640
3951
|
}, /*#__PURE__*/React__default["default"].createElement(neetoui.Typography, {
|
|
@@ -3662,7 +3973,6 @@ var WebhookItem = function WebhookItem(_ref) {
|
|
|
3662
3973
|
var WebhookItem$1 = /*#__PURE__*/React__default["default"].memo(WebhookItem);
|
|
3663
3974
|
|
|
3664
3975
|
var Webhooks = function Webhooks(_ref) {
|
|
3665
|
-
var _ref2;
|
|
3666
3976
|
var deliveriesPath = _ref.deliveriesPath,
|
|
3667
3977
|
entityType = _ref.entityType,
|
|
3668
3978
|
breadcrumbs = _ref.breadcrumbs,
|
|
@@ -3685,11 +3995,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
3685
3995
|
setIsDeleteAlertOpen = _useState8[1];
|
|
3686
3996
|
var _useTranslation = useTranslation(),
|
|
3687
3997
|
t = _useTranslation.t;
|
|
3688
|
-
var
|
|
3689
|
-
id = _useParams.id,
|
|
3690
|
-
formId = _useParams.formId;
|
|
3691
|
-
var backwardCompatibleEntityId = (_ref2 = entityId !== null && entityId !== void 0 ? entityId : id) !== null && _ref2 !== void 0 ? _ref2 : formId;
|
|
3692
|
-
var _useFetchWebhooks = useFetchWebhooks(backwardCompatibleEntityId),
|
|
3998
|
+
var _useFetchWebhooks = useFetchWebhooks(entityId),
|
|
3693
3999
|
isLoading = _useFetchWebhooks.isLoading,
|
|
3694
4000
|
_useFetchWebhooks$dat = _useFetchWebhooks.data,
|
|
3695
4001
|
_useFetchWebhooks$dat2 = _useFetchWebhooks$dat === void 0 ? {} : _useFetchWebhooks$dat,
|
|
@@ -3740,7 +4046,7 @@ var Webhooks = function Webhooks(_ref) {
|
|
|
3740
4046
|
title: t("webhook.empty")
|
|
3741
4047
|
}))), /*#__PURE__*/React__default["default"].createElement(AddWebhookPane, {
|
|
3742
4048
|
editingWebhookId: editingWebhookId,
|
|
3743
|
-
entityId:
|
|
4049
|
+
entityId: entityId,
|
|
3744
4050
|
entityType: entityType,
|
|
3745
4051
|
isOpen: isAddWebhookPaneOpen,
|
|
3746
4052
|
webhooks: webhooks,
|
|
@@ -3771,8 +4077,9 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
3771
4077
|
_ref$breadcrumbs = _ref.breadcrumbs,
|
|
3772
4078
|
breadcrumbs = _ref$breadcrumbs === void 0 ? [] : _ref$breadcrumbs;
|
|
3773
4079
|
var _useRouteMatch = reactRouterDom.useRouteMatch(),
|
|
3774
|
-
webhooksPath = _useRouteMatch.path
|
|
3775
|
-
|
|
4080
|
+
webhooksPath = _useRouteMatch.path,
|
|
4081
|
+
webhooksUrl = _useRouteMatch.url;
|
|
4082
|
+
var deliveriesPath = getDeliveriesPath(webhooksUrl);
|
|
3776
4083
|
return /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Switch, null, /*#__PURE__*/React__default["default"].createElement(reactRouterDom.Route, {
|
|
3777
4084
|
exact: true,
|
|
3778
4085
|
path: webhooksPath,
|
|
@@ -3789,7 +4096,7 @@ var NeetoWebhooks = function NeetoWebhooks(_ref) {
|
|
|
3789
4096
|
component: function component() {
|
|
3790
4097
|
return /*#__PURE__*/React__default["default"].createElement(Deliveries$1, {
|
|
3791
4098
|
breadcrumbs: breadcrumbs,
|
|
3792
|
-
|
|
4099
|
+
webhooksUrl: webhooksUrl
|
|
3793
4100
|
});
|
|
3794
4101
|
}
|
|
3795
4102
|
}));
|