@arquimedes.co/eureka-forms 2.0.123 → 2.0.125

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.
@@ -51,11 +51,11 @@ export var IntegrationsApi = RootApi.injectEndpoints({
51
51
  idOrganization = getState().forms[idForm]
52
52
  .global.idOrganization;
53
53
  if (!idOrganization) return [3 /*break*/, 2];
54
- return [4 /*yield*/, widgetInstance.post("/form/integrations/".concat(idIntegration, "?idOrganization=").concat(idOrganization), payload)];
54
+ return [4 /*yield*/, widgetInstance.post("/form/integrations/".concat(idIntegration, "?idOrganization=").concat(idOrganization), payload, { timeout: 120000 })];
55
55
  case 1:
56
56
  response = _c.sent();
57
57
  return [3 /*break*/, 4];
58
- case 2: return [4 /*yield*/, axiosInstance.post("/form/integrations/".concat(idIntegration), payload)];
58
+ case 2: return [4 /*yield*/, axiosInstance.post("/form/integrations/".concat(idIntegration), payload, { timeout: 120000 })];
59
59
  case 3:
60
60
  response = _c.sent();
61
61
  _c.label = 4;
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { ContentBlock, ContentState } from 'draft-js';
3
+ export interface LinkComponentProps {
4
+ children: React.ReactNode;
5
+ contentState: ContentState;
6
+ entityKey?: string;
7
+ decoratedText: string;
8
+ }
9
+ export declare function LinkComponent({ children, decoratedText, }: LinkComponentProps): JSX.Element;
10
+ export declare function findLinkEntities(contentBlock: ContentBlock, callback: (start: number, end: number) => void): void;
11
+ export declare const linkDecorator: {
12
+ strategy: typeof findLinkEntities;
13
+ component: typeof LinkComponent;
14
+ };
@@ -0,0 +1,60 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx } from "react/jsx-runtime";
13
+ export function LinkComponent(_a) {
14
+ var children = _a.children, decoratedText = _a.decoratedText;
15
+ // Add protocol if missing
16
+ var getHref = function (url) {
17
+ if (url.startsWith('http://') || url.startsWith('https://')) {
18
+ return url;
19
+ }
20
+ return "https://".concat(url);
21
+ };
22
+ var handleClick = function (e) {
23
+ e.preventDefault();
24
+ window.open(getHref(decoratedText), '_blank', 'noopener,noreferrer');
25
+ };
26
+ return (_jsx("a", __assign({ href: getHref(decoratedText), onClick: handleClick, style: {
27
+ color: '#1976d2',
28
+ textDecoration: 'underline',
29
+ cursor: 'pointer',
30
+ }, target: "_blank", rel: "noopener noreferrer" }, { children: children })));
31
+ }
32
+ export function findLinkEntities(contentBlock, callback) {
33
+ try {
34
+ var text = contentBlock.getText();
35
+ // Return early if no text
36
+ if (!text)
37
+ return;
38
+ // Create a new regex instance for each call to avoid state issues
39
+ var urlRegex = /(https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|www\.[a-zA-Z0-9][a-zA-Z0-9-]+[a-zA-Z0-9]\.[^\s]{2,}|https?:\/\/(?:www\.|(?!www))[a-zA-Z0-9]+\.[^\s]{2,}|www\.[a-zA-Z0-9]+\.[^\s]{2,})/g;
40
+ var matchArr = void 0;
41
+ var start = void 0;
42
+ while ((matchArr = urlRegex.exec(text)) !== null) {
43
+ start = matchArr.index;
44
+ callback(start, start + matchArr[0].length);
45
+ // Prevent infinite loop if regex doesn't advance
46
+ if (matchArr.index === urlRegex.lastIndex) {
47
+ urlRegex.lastIndex++;
48
+ }
49
+ }
50
+ }
51
+ catch (error) {
52
+ // Fail silently to avoid breaking the editor
53
+ // eslint-disable-next-line no-console
54
+ console.warn('LinkDecorator: Error finding link entities:', error);
55
+ }
56
+ }
57
+ export var linkDecorator = {
58
+ strategy: findLinkEntities,
59
+ component: LinkComponent,
60
+ };
@@ -18,6 +18,7 @@ import { Editor } from 'react-draft-wysiwyg';
18
18
  import { produce } from 'immer';
19
19
  import CustomContext from '../../Contexts/CustomContext';
20
20
  import { FormDecoratorsStrategy, FormDecorator } from './FormDecorator';
21
+ import { linkDecorator } from './LinkDecorator';
21
22
  import { skipToken } from '@reduxjs/toolkit/query';
22
23
  import { useAppSelector } from '../../hooks';
23
24
  export var DraftLoadingContext = createContext(true);
@@ -65,6 +66,7 @@ function cleanUpDraftParams(draft) {
65
66
  });
66
67
  }
67
68
  var customDecorators = [
69
+ linkDecorator,
68
70
  {
69
71
  strategy: FormDecoratorsStrategy,
70
72
  component: FormDecorator,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@arquimedes.co/eureka-forms",
3
3
  "repository": "git://github.com/Arquimede5/Eureka-Forms.git",
4
- "version": "2.0.123",
4
+ "version": "2.0.125",
5
5
  "scripts": {
6
6
  "start": "react-scripts start",
7
7
  "build": "react-scripts build",