@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260708060703 → 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-ZONM74OO.mjs → LinkNodeButton-LX3KKGZY.mjs} +14 -15
- package/dist/{LinkNodeButton-IGJOGOKI.mjs → LinkNodeButton-U7T2NP22.mjs} +38 -26
- package/dist/{LinkNodeButton-FUL3J5HR.mjs → LinkNodeButton-XA7Z5IDR.mjs} +14 -15
- 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 +67 -61
- package/dist/index.mjs +52 -61
- package/dist/server.js +40 -27
- package/dist/server.mjs +1 -1
- package/package.json +2 -2
- 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";
|
|
@@ -5,8 +5,9 @@ import {
|
|
|
5
5
|
ServiceClient_default
|
|
6
6
|
} from "./chunk-WEV5U33G.mjs";
|
|
7
7
|
import {
|
|
8
|
-
Button_default
|
|
9
|
-
|
|
8
|
+
Button_default,
|
|
9
|
+
ToastService_default
|
|
10
|
+
} from "./chunk-JKP4XOZB.mjs";
|
|
10
11
|
import "./chunk-IMNQO57B.mjs";
|
|
11
12
|
|
|
12
13
|
// src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
|
|
@@ -15,7 +16,6 @@ import { jsx } from "react/jsx-runtime";
|
|
|
15
16
|
var LinkNodeButton = (props) => {
|
|
16
17
|
const { node, dataitem, children, linkText, linkType, linkUrl } = props;
|
|
17
18
|
const [isLoading, setIsLoading] = useState(false);
|
|
18
|
-
const [error, setError] = useState(null);
|
|
19
19
|
const extractFieldNames = useCallback((template) => {
|
|
20
20
|
if (!template) return [];
|
|
21
21
|
const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
|
|
@@ -67,13 +67,11 @@ 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
|
-
setError(null);
|
|
77
75
|
try {
|
|
78
76
|
const resolvedPostUrl = replaceTemplateVariables(node.postUrl);
|
|
79
77
|
let parsedPayload = {};
|
|
@@ -92,10 +90,12 @@ var LinkNodeButton = (props) => {
|
|
|
92
90
|
console.log("API Response:", response);
|
|
93
91
|
if (response && !response.isSuccessful) {
|
|
94
92
|
const errorMessage = response.message || "API request failed";
|
|
95
|
-
setError(errorMessage);
|
|
96
93
|
setIsLoading(false);
|
|
97
94
|
return { isSuccessful: false, message: errorMessage };
|
|
98
95
|
}
|
|
96
|
+
if (response?.message) {
|
|
97
|
+
ToastService_default.showSuccess(response.message);
|
|
98
|
+
}
|
|
99
99
|
if (response && node.redirectUrl) {
|
|
100
100
|
const fieldNames = extractFieldNames(node.redirectUrl);
|
|
101
101
|
console.log("Field names in redirect URL:", fieldNames);
|
|
@@ -133,19 +133,18 @@ var LinkNodeButton = (props) => {
|
|
|
133
133
|
if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
|
|
134
134
|
window.location.href = resolvedRedirectUrl;
|
|
135
135
|
}
|
|
136
|
-
} else if (response && !response.result && response.message) {
|
|
137
|
-
setError(response.message);
|
|
138
|
-
throw new Error(response.message);
|
|
139
136
|
} else if (!response) {
|
|
140
|
-
|
|
137
|
+
const errorMessage = "No response from server";
|
|
138
|
+
setIsLoading(false);
|
|
139
|
+
return { isSuccessful: false, message: errorMessage };
|
|
141
140
|
}
|
|
142
141
|
setIsLoading(false);
|
|
143
|
-
return { isSuccessful: true, response };
|
|
142
|
+
return { isSuccessful: true, message: response?.message, result: response };
|
|
144
143
|
} catch (err) {
|
|
145
144
|
console.error("Button API call failed:", err);
|
|
146
|
-
|
|
145
|
+
const errorMessage = err.message || "An unexpected error occurred";
|
|
147
146
|
setIsLoading(false);
|
|
148
|
-
return { isSuccessful: false, message:
|
|
147
|
+
return { isSuccessful: false, message: errorMessage };
|
|
149
148
|
}
|
|
150
149
|
}, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue, props.apiBaseUrl, props.session]);
|
|
151
150
|
const renderButtonContent = () => {
|
|
@@ -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
|
};
|
|
@@ -203,7 +217,6 @@ import { jsx as jsx4 } from "react/jsx-runtime";
|
|
|
203
217
|
var LinkNodeButton = (props) => {
|
|
204
218
|
const { node, dataitem, children, linkText, linkType, linkUrl } = props;
|
|
205
219
|
const [isLoading, setIsLoading] = useState3(false);
|
|
206
|
-
const [error, setError] = useState3(null);
|
|
207
220
|
const extractFieldNames = useCallback((template) => {
|
|
208
221
|
if (!template) return [];
|
|
209
222
|
const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
|
|
@@ -255,13 +268,11 @@ var LinkNodeButton = (props) => {
|
|
|
255
268
|
}
|
|
256
269
|
return current;
|
|
257
270
|
}, []);
|
|
258
|
-
const onClick = useCallback(async (
|
|
271
|
+
const onClick = useCallback(async () => {
|
|
259
272
|
if (!node.postUrl) {
|
|
260
|
-
|
|
261
|
-
return;
|
|
273
|
+
return { isSuccessful: false, message: "No POST URL configured for this button" };
|
|
262
274
|
}
|
|
263
275
|
setIsLoading(true);
|
|
264
|
-
setError(null);
|
|
265
276
|
try {
|
|
266
277
|
const resolvedPostUrl = replaceTemplateVariables(node.postUrl);
|
|
267
278
|
let parsedPayload = {};
|
|
@@ -280,10 +291,12 @@ var LinkNodeButton = (props) => {
|
|
|
280
291
|
console.log("API Response:", response);
|
|
281
292
|
if (response && !response.isSuccessful) {
|
|
282
293
|
const errorMessage = response.message || "API request failed";
|
|
283
|
-
setError(errorMessage);
|
|
284
294
|
setIsLoading(false);
|
|
285
295
|
return { isSuccessful: false, message: errorMessage };
|
|
286
296
|
}
|
|
297
|
+
if (response?.message) {
|
|
298
|
+
ToastService_default.showSuccess(response.message);
|
|
299
|
+
}
|
|
287
300
|
if (response && node.redirectUrl) {
|
|
288
301
|
const fieldNames = extractFieldNames(node.redirectUrl);
|
|
289
302
|
console.log("Field names in redirect URL:", fieldNames);
|
|
@@ -321,19 +334,18 @@ var LinkNodeButton = (props) => {
|
|
|
321
334
|
if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
|
|
322
335
|
window.location.href = resolvedRedirectUrl;
|
|
323
336
|
}
|
|
324
|
-
} else if (response && !response.result && response.message) {
|
|
325
|
-
setError(response.message);
|
|
326
|
-
throw new Error(response.message);
|
|
327
337
|
} else if (!response) {
|
|
328
|
-
|
|
338
|
+
const errorMessage = "No response from server";
|
|
339
|
+
setIsLoading(false);
|
|
340
|
+
return { isSuccessful: false, message: errorMessage };
|
|
329
341
|
}
|
|
330
342
|
setIsLoading(false);
|
|
331
|
-
return { isSuccessful: true, response };
|
|
343
|
+
return { isSuccessful: true, message: response?.message, result: response };
|
|
332
344
|
} catch (err) {
|
|
333
345
|
console.error("Button API call failed:", err);
|
|
334
|
-
|
|
346
|
+
const errorMessage = err.message || "An unexpected error occurred";
|
|
335
347
|
setIsLoading(false);
|
|
336
|
-
return { isSuccessful: false, message:
|
|
348
|
+
return { isSuccessful: false, message: errorMessage };
|
|
337
349
|
}
|
|
338
350
|
}, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue, props.apiBaseUrl, props.session]);
|
|
339
351
|
const renderButtonContent = () => {
|
|
@@ -3,8 +3,9 @@ import {
|
|
|
3
3
|
ServiceClient_default
|
|
4
4
|
} from "./chunk-3GWLDT7C.mjs";
|
|
5
5
|
import {
|
|
6
|
-
Button_default
|
|
7
|
-
|
|
6
|
+
Button_default,
|
|
7
|
+
ToastService_default
|
|
8
|
+
} from "./chunk-YL6E76X2.mjs";
|
|
8
9
|
import "./chunk-56HSDML5.mjs";
|
|
9
10
|
|
|
10
11
|
// src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
|
|
@@ -13,7 +14,6 @@ import { jsx } from "react/jsx-runtime";
|
|
|
13
14
|
var LinkNodeButton = (props) => {
|
|
14
15
|
const { node, dataitem, children, linkText, linkType, linkUrl } = props;
|
|
15
16
|
const [isLoading, setIsLoading] = useState(false);
|
|
16
|
-
const [error, setError] = useState(null);
|
|
17
17
|
const extractFieldNames = useCallback((template) => {
|
|
18
18
|
if (!template) return [];
|
|
19
19
|
const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
|
|
@@ -65,13 +65,11 @@ 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
|
-
setError(null);
|
|
75
73
|
try {
|
|
76
74
|
const resolvedPostUrl = replaceTemplateVariables(node.postUrl);
|
|
77
75
|
let parsedPayload = {};
|
|
@@ -90,10 +88,12 @@ var LinkNodeButton = (props) => {
|
|
|
90
88
|
console.log("API Response:", response);
|
|
91
89
|
if (response && !response.isSuccessful) {
|
|
92
90
|
const errorMessage = response.message || "API request failed";
|
|
93
|
-
setError(errorMessage);
|
|
94
91
|
setIsLoading(false);
|
|
95
92
|
return { isSuccessful: false, message: errorMessage };
|
|
96
93
|
}
|
|
94
|
+
if (response?.message) {
|
|
95
|
+
ToastService_default.showSuccess(response.message);
|
|
96
|
+
}
|
|
97
97
|
if (response && node.redirectUrl) {
|
|
98
98
|
const fieldNames = extractFieldNames(node.redirectUrl);
|
|
99
99
|
console.log("Field names in redirect URL:", fieldNames);
|
|
@@ -131,19 +131,18 @@ var LinkNodeButton = (props) => {
|
|
|
131
131
|
if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
|
|
132
132
|
window.location.href = resolvedRedirectUrl;
|
|
133
133
|
}
|
|
134
|
-
} else if (response && !response.result && response.message) {
|
|
135
|
-
setError(response.message);
|
|
136
|
-
throw new Error(response.message);
|
|
137
134
|
} else if (!response) {
|
|
138
|
-
|
|
135
|
+
const errorMessage = "No response from server";
|
|
136
|
+
setIsLoading(false);
|
|
137
|
+
return { isSuccessful: false, message: errorMessage };
|
|
139
138
|
}
|
|
140
139
|
setIsLoading(false);
|
|
141
|
-
return { isSuccessful: true, response };
|
|
140
|
+
return { isSuccessful: true, message: response?.message, result: response };
|
|
142
141
|
} catch (err) {
|
|
143
142
|
console.error("Button API call failed:", err);
|
|
144
|
-
|
|
143
|
+
const errorMessage = err.message || "An unexpected error occurred";
|
|
145
144
|
setIsLoading(false);
|
|
146
|
-
return { isSuccessful: false, message:
|
|
145
|
+
return { isSuccessful: false, message: errorMessage };
|
|
147
146
|
}
|
|
148
147
|
}, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue, props.apiBaseUrl, props.session]);
|
|
149
148
|
const renderButtonContent = () => {
|
|
@@ -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;
|