@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260708070033 → 0.8.1-dev.20260708102516
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/{InputControlClient-OQDLYA4S.mjs → InputControlClient-AZRPSTUZ.mjs} +80 -7
- package/dist/{InputControlClient-O4HBEUP4.mjs → InputControlClient-CS4JM7UY.mjs} +1 -1
- package/dist/{InputControlClient-646PQPKQ.mjs → InputControlClient-XS52LLEE.mjs} +1 -1
- package/dist/{LinkNodeButton-WA5N3CBJ.mjs → LinkNodeButton-LX3KKGZY.mjs} +3 -4
- package/dist/{LinkNodeButton-GVOICN34.mjs → LinkNodeButton-U7T2NP22.mjs} +29 -16
- package/dist/{LinkNodeButton-66LEXGVY.mjs → LinkNodeButton-XA7Z5IDR.mjs} +3 -4
- package/dist/{chunk-67IG5NBU.mjs → chunk-JKP4XOZB.mjs} +27 -13
- package/dist/{chunk-IKIXEQPV.mjs → chunk-YL6E76X2.mjs} +27 -13
- package/dist/index.d.mts +0 -2
- package/dist/index.d.ts +0 -2
- package/dist/index.js +57 -51
- package/dist/index.mjs +52 -61
- package/dist/server.js +30 -17
- package/dist/server.mjs +1 -1
- package/package.json +1 -1
- package/dist/Pagination-YCD5CU2L.mjs +0 -183
- package/dist/chunk-2GSYECIS.mjs +0 -109
- package/dist/chunk-R2HV35IB.mjs +0 -201
|
@@ -22,15 +22,15 @@ import {
|
|
|
22
22
|
Hyperlink,
|
|
23
23
|
Icon_default,
|
|
24
24
|
InputControlType_default
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-FI2KJBK2.mjs";
|
|
26
26
|
import {
|
|
27
27
|
Button_default,
|
|
28
28
|
ClientButton_default
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-JKP4XOZB.mjs";
|
|
30
30
|
import "./chunk-IMNQO57B.mjs";
|
|
31
31
|
|
|
32
32
|
// src/components/controls/edit/InputControlClient.tsx
|
|
33
|
-
import
|
|
33
|
+
import React5 from "react";
|
|
34
34
|
|
|
35
35
|
// src/components/controls/edit/Select.tsx
|
|
36
36
|
import { useState, useEffect } from "react";
|
|
@@ -570,9 +570,81 @@ var AssetUpload = (props) => {
|
|
|
570
570
|
};
|
|
571
571
|
var AssetUpload_default = AssetUpload;
|
|
572
572
|
|
|
573
|
+
// src/components/controls/edit/SwitchInput.tsx
|
|
574
|
+
import React4 from "react";
|
|
575
|
+
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
576
|
+
var SwitchInput = (props) => {
|
|
577
|
+
const textChangeHandler = (event) => {
|
|
578
|
+
let text = event.target.checked;
|
|
579
|
+
if (props.callback !== void 0) {
|
|
580
|
+
props.callback({
|
|
581
|
+
name: props.name,
|
|
582
|
+
value: text,
|
|
583
|
+
index: props.index,
|
|
584
|
+
groupKey: props.groupKey
|
|
585
|
+
});
|
|
586
|
+
}
|
|
587
|
+
};
|
|
588
|
+
let value = false;
|
|
589
|
+
if (props.value != void 0 && props.value != null && props.value != "" && (props.value == "true" || props.value.toString() == "true")) {
|
|
590
|
+
value = true;
|
|
591
|
+
}
|
|
592
|
+
return /* @__PURE__ */ jsx4(React4.Fragment, { children: /* @__PURE__ */ jsxs4("div", { className: "flex items-start justify-between gap-4 py-3", children: [
|
|
593
|
+
/* @__PURE__ */ jsxs4("div", { className: "min-w-0", children: [
|
|
594
|
+
props?.attributes?.label && /* @__PURE__ */ jsxs4(
|
|
595
|
+
"label",
|
|
596
|
+
{
|
|
597
|
+
htmlFor: props.name,
|
|
598
|
+
className: "inline-block text-sm font-semibold text-slate-800",
|
|
599
|
+
children: [
|
|
600
|
+
props.attributes.label,
|
|
601
|
+
props?.attributes?.required && /* @__PURE__ */ jsx4("span", { className: "bg-error-weak", children: "*" })
|
|
602
|
+
]
|
|
603
|
+
}
|
|
604
|
+
),
|
|
605
|
+
/* @__PURE__ */ jsx4("p", { className: "hidden group-[.validated]:peer-invalid:block mt-1 bg-error-weak text-sm", children: props?.attributes?.errorMessage || "" })
|
|
606
|
+
] }),
|
|
607
|
+
/* @__PURE__ */ jsxs4(
|
|
608
|
+
"label",
|
|
609
|
+
{
|
|
610
|
+
htmlFor: props.name,
|
|
611
|
+
className: "relative inline-flex shrink-0 cursor-pointer items-center peer-disabled:cursor-not-allowed",
|
|
612
|
+
children: [
|
|
613
|
+
/* @__PURE__ */ jsx4(
|
|
614
|
+
"input",
|
|
615
|
+
{
|
|
616
|
+
type: "checkbox",
|
|
617
|
+
name: props.name,
|
|
618
|
+
id: props.name,
|
|
619
|
+
checked: value,
|
|
620
|
+
onChange: textChangeHandler,
|
|
621
|
+
required: props?.attributes?.required,
|
|
622
|
+
disabled: props?.attributes?.readOnly,
|
|
623
|
+
className: "peer sr-only"
|
|
624
|
+
}
|
|
625
|
+
),
|
|
626
|
+
/* @__PURE__ */ jsx4(
|
|
627
|
+
"div",
|
|
628
|
+
{
|
|
629
|
+
className: "h-6 w-11 rounded-full bg-slate-200 shadow-inner\r\n transition-colors duration-200 ease-in-out\r\n peer-checked:bg-blue-600\r\n peer-focus-visible:ring-2 peer-focus-visible:ring-blue-300 peer-focus-visible:ring-offset-2\r\n peer-disabled:bg-slate-100"
|
|
630
|
+
}
|
|
631
|
+
),
|
|
632
|
+
/* @__PURE__ */ jsx4(
|
|
633
|
+
"div",
|
|
634
|
+
{
|
|
635
|
+
className: "absolute left-0.5 top-0.5 h-5 w-5 rounded-full bg-default shadow\r\n transition-transform duration-200 ease-in-out\r\n peer-checked:translate-x-5\r\n peer-disabled:bg-slate-50"
|
|
636
|
+
}
|
|
637
|
+
)
|
|
638
|
+
]
|
|
639
|
+
}
|
|
640
|
+
)
|
|
641
|
+
] }) });
|
|
642
|
+
};
|
|
643
|
+
var SwitchInput_default = SwitchInput;
|
|
644
|
+
|
|
573
645
|
// src/components/controls/edit/InputControlClient.tsx
|
|
574
|
-
import { jsx as
|
|
575
|
-
var InputControl =
|
|
646
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
647
|
+
var InputControl = React5.forwardRef(
|
|
576
648
|
(props, ref) => {
|
|
577
649
|
const ControlComponents = {
|
|
578
650
|
[InputControlType_default.lineTextInput]: LineTextInput_default,
|
|
@@ -591,10 +663,11 @@ var InputControl = React4.forwardRef(
|
|
|
591
663
|
[InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
|
|
592
664
|
[InputControlType_default.booleanSelect]: BooleanSelect_default,
|
|
593
665
|
[InputControlType_default.timeInput]: TimeInput_default,
|
|
594
|
-
[InputControlType_default.asset]: AssetUpload_default
|
|
666
|
+
[InputControlType_default.asset]: AssetUpload_default,
|
|
667
|
+
[InputControlType_default.switchInput]: SwitchInput_default
|
|
595
668
|
};
|
|
596
669
|
const SelectedControlComponent = ControlComponents[props.controlType];
|
|
597
|
-
return /* @__PURE__ */
|
|
670
|
+
return /* @__PURE__ */ jsx5(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx5(SelectedControlComponent, { ...props }) : "Control not found" });
|
|
598
671
|
}
|
|
599
672
|
);
|
|
600
673
|
InputControl.displayName = "InputControl";
|
|
@@ -7,7 +7,7 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
Button_default,
|
|
9
9
|
ToastService_default
|
|
10
|
-
} from "./chunk-
|
|
10
|
+
} from "./chunk-JKP4XOZB.mjs";
|
|
11
11
|
import "./chunk-IMNQO57B.mjs";
|
|
12
12
|
|
|
13
13
|
// src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
|
|
@@ -67,10 +67,9 @@ var LinkNodeButton = (props) => {
|
|
|
67
67
|
}
|
|
68
68
|
return current;
|
|
69
69
|
}, []);
|
|
70
|
-
const onClick = useCallback(async (
|
|
70
|
+
const onClick = useCallback(async () => {
|
|
71
71
|
if (!node.postUrl) {
|
|
72
|
-
|
|
73
|
-
return;
|
|
72
|
+
return { isSuccessful: false, message: "No POST URL configured for this button" };
|
|
74
73
|
}
|
|
75
74
|
setIsLoading(true);
|
|
76
75
|
try {
|
|
@@ -14,34 +14,48 @@ import { useCallback, useState as useState3 } from "react";
|
|
|
14
14
|
import React3, { useState as useState2 } from "react";
|
|
15
15
|
|
|
16
16
|
// src/components/ToastService.tsx
|
|
17
|
-
var
|
|
17
|
+
var toastHandlersKey = "__digitalStoreToastHandlers";
|
|
18
|
+
var getToastHandlers = () => {
|
|
19
|
+
const globalScope = globalThis;
|
|
20
|
+
if (!globalScope[toastHandlersKey]) {
|
|
21
|
+
globalScope[toastHandlersKey] = {};
|
|
22
|
+
}
|
|
23
|
+
return globalScope[toastHandlersKey];
|
|
24
|
+
};
|
|
25
|
+
var ToastService = class {
|
|
18
26
|
static initialize(showToast, closeToast) {
|
|
19
|
-
|
|
20
|
-
|
|
27
|
+
const handlers = getToastHandlers();
|
|
28
|
+
handlers.showToast = showToast;
|
|
29
|
+
handlers.closeToast = closeToast;
|
|
21
30
|
}
|
|
22
31
|
static showError(message) {
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
const handlers = getToastHandlers();
|
|
33
|
+
if (handlers.showToast) {
|
|
34
|
+
handlers.showToast(message, "error");
|
|
25
35
|
}
|
|
26
36
|
}
|
|
27
37
|
static showInfo(message) {
|
|
28
|
-
|
|
29
|
-
|
|
38
|
+
const handlers = getToastHandlers();
|
|
39
|
+
if (handlers.showToast) {
|
|
40
|
+
handlers.showToast(message, "info");
|
|
30
41
|
}
|
|
31
42
|
}
|
|
32
43
|
static showWarning(message) {
|
|
33
|
-
|
|
34
|
-
|
|
44
|
+
const handlers = getToastHandlers();
|
|
45
|
+
if (handlers.showToast) {
|
|
46
|
+
handlers.showToast(message, "warning");
|
|
35
47
|
}
|
|
36
48
|
}
|
|
37
49
|
static showSuccess(message) {
|
|
38
|
-
|
|
39
|
-
|
|
50
|
+
const handlers = getToastHandlers();
|
|
51
|
+
if (handlers.showToast) {
|
|
52
|
+
handlers.showToast(message, "success");
|
|
40
53
|
}
|
|
41
54
|
}
|
|
42
55
|
static close() {
|
|
43
|
-
|
|
44
|
-
|
|
56
|
+
const handlers = getToastHandlers();
|
|
57
|
+
if (handlers.closeToast) {
|
|
58
|
+
handlers.closeToast();
|
|
45
59
|
}
|
|
46
60
|
}
|
|
47
61
|
};
|
|
@@ -254,10 +268,9 @@ var LinkNodeButton = (props) => {
|
|
|
254
268
|
}
|
|
255
269
|
return current;
|
|
256
270
|
}, []);
|
|
257
|
-
const onClick = useCallback(async (
|
|
271
|
+
const onClick = useCallback(async () => {
|
|
258
272
|
if (!node.postUrl) {
|
|
259
|
-
|
|
260
|
-
return;
|
|
273
|
+
return { isSuccessful: false, message: "No POST URL configured for this button" };
|
|
261
274
|
}
|
|
262
275
|
setIsLoading(true);
|
|
263
276
|
try {
|
|
@@ -5,7 +5,7 @@ import {
|
|
|
5
5
|
import {
|
|
6
6
|
Button_default,
|
|
7
7
|
ToastService_default
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-YL6E76X2.mjs";
|
|
9
9
|
import "./chunk-56HSDML5.mjs";
|
|
10
10
|
|
|
11
11
|
// src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
|
|
@@ -65,10 +65,9 @@ var LinkNodeButton = (props) => {
|
|
|
65
65
|
}
|
|
66
66
|
return current;
|
|
67
67
|
}, []);
|
|
68
|
-
const onClick = useCallback(async (
|
|
68
|
+
const onClick = useCallback(async () => {
|
|
69
69
|
if (!node.postUrl) {
|
|
70
|
-
|
|
71
|
-
return;
|
|
70
|
+
return { isSuccessful: false, message: "No POST URL configured for this button" };
|
|
72
71
|
}
|
|
73
72
|
setIsLoading(true);
|
|
74
73
|
try {
|
|
@@ -6,34 +6,48 @@ import {
|
|
|
6
6
|
} from "./chunk-IMNQO57B.mjs";
|
|
7
7
|
|
|
8
8
|
// src/components/ToastService.tsx
|
|
9
|
-
var
|
|
9
|
+
var toastHandlersKey = "__digitalStoreToastHandlers";
|
|
10
|
+
var getToastHandlers = () => {
|
|
11
|
+
const globalScope = globalThis;
|
|
12
|
+
if (!globalScope[toastHandlersKey]) {
|
|
13
|
+
globalScope[toastHandlersKey] = {};
|
|
14
|
+
}
|
|
15
|
+
return globalScope[toastHandlersKey];
|
|
16
|
+
};
|
|
17
|
+
var ToastService = class {
|
|
10
18
|
static initialize(showToast, closeToast) {
|
|
11
|
-
|
|
12
|
-
|
|
19
|
+
const handlers = getToastHandlers();
|
|
20
|
+
handlers.showToast = showToast;
|
|
21
|
+
handlers.closeToast = closeToast;
|
|
13
22
|
}
|
|
14
23
|
static showError(message) {
|
|
15
|
-
|
|
16
|
-
|
|
24
|
+
const handlers = getToastHandlers();
|
|
25
|
+
if (handlers.showToast) {
|
|
26
|
+
handlers.showToast(message, "error");
|
|
17
27
|
}
|
|
18
28
|
}
|
|
19
29
|
static showInfo(message) {
|
|
20
|
-
|
|
21
|
-
|
|
30
|
+
const handlers = getToastHandlers();
|
|
31
|
+
if (handlers.showToast) {
|
|
32
|
+
handlers.showToast(message, "info");
|
|
22
33
|
}
|
|
23
34
|
}
|
|
24
35
|
static showWarning(message) {
|
|
25
|
-
|
|
26
|
-
|
|
36
|
+
const handlers = getToastHandlers();
|
|
37
|
+
if (handlers.showToast) {
|
|
38
|
+
handlers.showToast(message, "warning");
|
|
27
39
|
}
|
|
28
40
|
}
|
|
29
41
|
static showSuccess(message) {
|
|
30
|
-
|
|
31
|
-
|
|
42
|
+
const handlers = getToastHandlers();
|
|
43
|
+
if (handlers.showToast) {
|
|
44
|
+
handlers.showToast(message, "success");
|
|
32
45
|
}
|
|
33
46
|
}
|
|
34
47
|
static close() {
|
|
35
|
-
|
|
36
|
-
|
|
48
|
+
const handlers = getToastHandlers();
|
|
49
|
+
if (handlers.closeToast) {
|
|
50
|
+
handlers.closeToast();
|
|
37
51
|
}
|
|
38
52
|
}
|
|
39
53
|
};
|
|
@@ -4,34 +4,48 @@ import {
|
|
|
4
4
|
} from "./chunk-56HSDML5.mjs";
|
|
5
5
|
|
|
6
6
|
// src/components/ToastService.tsx
|
|
7
|
-
var
|
|
7
|
+
var toastHandlersKey = "__digitalStoreToastHandlers";
|
|
8
|
+
var getToastHandlers = () => {
|
|
9
|
+
const globalScope = globalThis;
|
|
10
|
+
if (!globalScope[toastHandlersKey]) {
|
|
11
|
+
globalScope[toastHandlersKey] = {};
|
|
12
|
+
}
|
|
13
|
+
return globalScope[toastHandlersKey];
|
|
14
|
+
};
|
|
15
|
+
var ToastService = class {
|
|
8
16
|
static initialize(showToast, closeToast) {
|
|
9
|
-
|
|
10
|
-
|
|
17
|
+
const handlers = getToastHandlers();
|
|
18
|
+
handlers.showToast = showToast;
|
|
19
|
+
handlers.closeToast = closeToast;
|
|
11
20
|
}
|
|
12
21
|
static showError(message) {
|
|
13
|
-
|
|
14
|
-
|
|
22
|
+
const handlers = getToastHandlers();
|
|
23
|
+
if (handlers.showToast) {
|
|
24
|
+
handlers.showToast(message, "error");
|
|
15
25
|
}
|
|
16
26
|
}
|
|
17
27
|
static showInfo(message) {
|
|
18
|
-
|
|
19
|
-
|
|
28
|
+
const handlers = getToastHandlers();
|
|
29
|
+
if (handlers.showToast) {
|
|
30
|
+
handlers.showToast(message, "info");
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
33
|
static showWarning(message) {
|
|
23
|
-
|
|
24
|
-
|
|
34
|
+
const handlers = getToastHandlers();
|
|
35
|
+
if (handlers.showToast) {
|
|
36
|
+
handlers.showToast(message, "warning");
|
|
25
37
|
}
|
|
26
38
|
}
|
|
27
39
|
static showSuccess(message) {
|
|
28
|
-
|
|
29
|
-
|
|
40
|
+
const handlers = getToastHandlers();
|
|
41
|
+
if (handlers.showToast) {
|
|
42
|
+
handlers.showToast(message, "success");
|
|
30
43
|
}
|
|
31
44
|
}
|
|
32
45
|
static close() {
|
|
33
|
-
|
|
34
|
-
|
|
46
|
+
const handlers = getToastHandlers();
|
|
47
|
+
if (handlers.closeToast) {
|
|
48
|
+
handlers.closeToast();
|
|
35
49
|
}
|
|
36
50
|
}
|
|
37
51
|
};
|
package/dist/index.d.mts
CHANGED
|
@@ -192,8 +192,6 @@ declare const PageBodyRenderer: (props: PageBodyRendererProps) => React__default
|
|
|
192
192
|
declare const Toast: () => React__default.JSX.Element;
|
|
193
193
|
|
|
194
194
|
declare class ToastService {
|
|
195
|
-
private static showToast;
|
|
196
|
-
private static closeToast;
|
|
197
195
|
static initialize(showToast: (message: string, messageType: string) => void, closeToast: () => void): void;
|
|
198
196
|
static showError(message: string): void;
|
|
199
197
|
static showInfo(message: string): void;
|
package/dist/index.d.ts
CHANGED
|
@@ -192,8 +192,6 @@ declare const PageBodyRenderer: (props: PageBodyRendererProps) => React__default
|
|
|
192
192
|
declare const Toast: () => React__default.JSX.Element;
|
|
193
193
|
|
|
194
194
|
declare class ToastService {
|
|
195
|
-
private static showToast;
|
|
196
|
-
private static closeToast;
|
|
197
195
|
static initialize(showToast: (message: string, messageType: string) => void, closeToast: () => void): void;
|
|
198
196
|
static showError(message: string): void;
|
|
199
197
|
static showInfo(message: string): void;
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
"use strict";
|
|
2
4
|
var __create = Object.create;
|
|
3
5
|
var __defProp = Object.defineProperty;
|
|
@@ -1683,38 +1685,52 @@ var init_SelectWithSearchInput = __esm({
|
|
|
1683
1685
|
});
|
|
1684
1686
|
|
|
1685
1687
|
// src/components/ToastService.tsx
|
|
1686
|
-
var ToastService, ToastService_default;
|
|
1688
|
+
var toastHandlersKey, getToastHandlers, ToastService, ToastService_default;
|
|
1687
1689
|
var init_ToastService = __esm({
|
|
1688
1690
|
"src/components/ToastService.tsx"() {
|
|
1689
1691
|
"use strict";
|
|
1690
|
-
|
|
1692
|
+
toastHandlersKey = "__digitalStoreToastHandlers";
|
|
1693
|
+
getToastHandlers = () => {
|
|
1694
|
+
const globalScope = globalThis;
|
|
1695
|
+
if (!globalScope[toastHandlersKey]) {
|
|
1696
|
+
globalScope[toastHandlersKey] = {};
|
|
1697
|
+
}
|
|
1698
|
+
return globalScope[toastHandlersKey];
|
|
1699
|
+
};
|
|
1700
|
+
ToastService = class {
|
|
1691
1701
|
static initialize(showToast, closeToast) {
|
|
1692
|
-
|
|
1693
|
-
|
|
1702
|
+
const handlers = getToastHandlers();
|
|
1703
|
+
handlers.showToast = showToast;
|
|
1704
|
+
handlers.closeToast = closeToast;
|
|
1694
1705
|
}
|
|
1695
1706
|
static showError(message) {
|
|
1696
|
-
|
|
1697
|
-
|
|
1707
|
+
const handlers = getToastHandlers();
|
|
1708
|
+
if (handlers.showToast) {
|
|
1709
|
+
handlers.showToast(message, "error");
|
|
1698
1710
|
}
|
|
1699
1711
|
}
|
|
1700
1712
|
static showInfo(message) {
|
|
1701
|
-
|
|
1702
|
-
|
|
1713
|
+
const handlers = getToastHandlers();
|
|
1714
|
+
if (handlers.showToast) {
|
|
1715
|
+
handlers.showToast(message, "info");
|
|
1703
1716
|
}
|
|
1704
1717
|
}
|
|
1705
1718
|
static showWarning(message) {
|
|
1706
|
-
|
|
1707
|
-
|
|
1719
|
+
const handlers = getToastHandlers();
|
|
1720
|
+
if (handlers.showToast) {
|
|
1721
|
+
handlers.showToast(message, "warning");
|
|
1708
1722
|
}
|
|
1709
1723
|
}
|
|
1710
1724
|
static showSuccess(message) {
|
|
1711
|
-
|
|
1712
|
-
|
|
1725
|
+
const handlers = getToastHandlers();
|
|
1726
|
+
if (handlers.showToast) {
|
|
1727
|
+
handlers.showToast(message, "success");
|
|
1713
1728
|
}
|
|
1714
1729
|
}
|
|
1715
1730
|
static close() {
|
|
1716
|
-
|
|
1717
|
-
|
|
1731
|
+
const handlers = getToastHandlers();
|
|
1732
|
+
if (handlers.closeToast) {
|
|
1733
|
+
handlers.closeToast();
|
|
1718
1734
|
}
|
|
1719
1735
|
}
|
|
1720
1736
|
};
|
|
@@ -3126,10 +3142,9 @@ var init_LinkNodeButton = __esm({
|
|
|
3126
3142
|
}
|
|
3127
3143
|
return current;
|
|
3128
3144
|
}, []);
|
|
3129
|
-
const onClick = (0, import_react38.useCallback)(async (
|
|
3145
|
+
const onClick = (0, import_react38.useCallback)(async () => {
|
|
3130
3146
|
if (!node.postUrl) {
|
|
3131
|
-
|
|
3132
|
-
return;
|
|
3147
|
+
return { isSuccessful: false, message: "No POST URL configured for this button" };
|
|
3133
3148
|
}
|
|
3134
3149
|
setIsLoading(true);
|
|
3135
3150
|
try {
|
|
@@ -6875,44 +6890,35 @@ var Toast = () => {
|
|
|
6875
6890
|
const [showToast, setShowToast] = (0, import_react54.useState)(false);
|
|
6876
6891
|
const [message, setMessage] = (0, import_react54.useState)("");
|
|
6877
6892
|
const [messageType, setMessageType] = (0, import_react54.useState)("error");
|
|
6878
|
-
|
|
6879
|
-
|
|
6880
|
-
|
|
6881
|
-
|
|
6882
|
-
|
|
6883
|
-
|
|
6884
|
-
|
|
6885
|
-
};
|
|
6886
|
-
|
|
6887
|
-
|
|
6888
|
-
|
|
6889
|
-
|
|
6890
|
-
setTimeout(() => {
|
|
6891
|
-
setShowToast(false);
|
|
6892
|
-
}, 4e3);
|
|
6893
|
-
};
|
|
6894
|
-
ToastService_default.showWarning = function(message2) {
|
|
6895
|
-
setShowToast(true);
|
|
6896
|
-
setMessage(message2);
|
|
6897
|
-
setMessageType("warning");
|
|
6898
|
-
setTimeout(() => {
|
|
6899
|
-
setShowToast(false);
|
|
6900
|
-
}, 4e3);
|
|
6901
|
-
};
|
|
6902
|
-
ToastService_default.showInfo = function(message2) {
|
|
6893
|
+
const timeoutRef = (0, import_react54.useRef)(null);
|
|
6894
|
+
const closeToast = (0, import_react54.useCallback)(() => {
|
|
6895
|
+
if (timeoutRef.current) {
|
|
6896
|
+
clearTimeout(timeoutRef.current);
|
|
6897
|
+
timeoutRef.current = null;
|
|
6898
|
+
}
|
|
6899
|
+
setShowToast(false);
|
|
6900
|
+
}, []);
|
|
6901
|
+
const showMessage = (0, import_react54.useCallback)((message2, messageType2) => {
|
|
6902
|
+
if (timeoutRef.current) {
|
|
6903
|
+
clearTimeout(timeoutRef.current);
|
|
6904
|
+
}
|
|
6903
6905
|
setShowToast(true);
|
|
6904
6906
|
setMessage(message2);
|
|
6905
|
-
setMessageType(
|
|
6906
|
-
setTimeout(() => {
|
|
6907
|
+
setMessageType(messageType2);
|
|
6908
|
+
timeoutRef.current = setTimeout(() => {
|
|
6907
6909
|
setShowToast(false);
|
|
6910
|
+
timeoutRef.current = null;
|
|
6908
6911
|
}, 4e3);
|
|
6909
|
-
};
|
|
6910
|
-
|
|
6911
|
-
|
|
6912
|
-
|
|
6913
|
-
|
|
6914
|
-
|
|
6915
|
-
|
|
6912
|
+
}, []);
|
|
6913
|
+
(0, import_react54.useEffect)(() => {
|
|
6914
|
+
ToastService_default.initialize(showMessage, closeToast);
|
|
6915
|
+
return () => {
|
|
6916
|
+
closeToast();
|
|
6917
|
+
ToastService_default.initialize(() => {
|
|
6918
|
+
}, () => {
|
|
6919
|
+
});
|
|
6920
|
+
};
|
|
6921
|
+
}, [closeToast, showMessage]);
|
|
6916
6922
|
return /* @__PURE__ */ (0, import_jsx_runtime74.jsx)(import_jsx_runtime74.Fragment, { children: showToast && /* @__PURE__ */ (0, import_jsx_runtime74.jsx)("div", { className: "fixed top-2 flex justify-center w-1/2 max-w-xl left-1/2 -translate-x-1/2", style: { zIndex: 1e3 }, children: /* @__PURE__ */ (0, import_jsx_runtime74.jsxs)("div", { className: `w-full items-center flex justify-between p-3 rounded-md relative shadow border bg-${messageType}-soft`, children: [
|
|
6917
6923
|
/* @__PURE__ */ (0, import_jsx_runtime74.jsx)(
|
|
6918
6924
|
"span",
|