@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
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
|
};
|
|
@@ -3070,11 +3086,11 @@ var init_LinkNodeButton = __esm({
|
|
|
3070
3086
|
import_react38 = require("react");
|
|
3071
3087
|
init_Button();
|
|
3072
3088
|
init_ServiceClient();
|
|
3089
|
+
init_ToastService();
|
|
3073
3090
|
import_jsx_runtime50 = require("react/jsx-runtime");
|
|
3074
3091
|
LinkNodeButton = (props) => {
|
|
3075
3092
|
const { node, dataitem, children, linkText, linkType, linkUrl } = props;
|
|
3076
3093
|
const [isLoading, setIsLoading] = (0, import_react38.useState)(false);
|
|
3077
|
-
const [error, setError] = (0, import_react38.useState)(null);
|
|
3078
3094
|
const extractFieldNames = (0, import_react38.useCallback)((template) => {
|
|
3079
3095
|
if (!template) return [];
|
|
3080
3096
|
const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
|
|
@@ -3126,13 +3142,11 @@ 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
|
-
setError(null);
|
|
3136
3150
|
try {
|
|
3137
3151
|
const resolvedPostUrl = replaceTemplateVariables(node.postUrl);
|
|
3138
3152
|
let parsedPayload = {};
|
|
@@ -3151,10 +3165,12 @@ var init_LinkNodeButton = __esm({
|
|
|
3151
3165
|
console.log("API Response:", response);
|
|
3152
3166
|
if (response && !response.isSuccessful) {
|
|
3153
3167
|
const errorMessage = response.message || "API request failed";
|
|
3154
|
-
setError(errorMessage);
|
|
3155
3168
|
setIsLoading(false);
|
|
3156
3169
|
return { isSuccessful: false, message: errorMessage };
|
|
3157
3170
|
}
|
|
3171
|
+
if (response?.message) {
|
|
3172
|
+
ToastService_default.showSuccess(response.message);
|
|
3173
|
+
}
|
|
3158
3174
|
if (response && node.redirectUrl) {
|
|
3159
3175
|
const fieldNames = extractFieldNames(node.redirectUrl);
|
|
3160
3176
|
console.log("Field names in redirect URL:", fieldNames);
|
|
@@ -3192,19 +3208,18 @@ var init_LinkNodeButton = __esm({
|
|
|
3192
3208
|
if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
|
|
3193
3209
|
window.location.href = resolvedRedirectUrl;
|
|
3194
3210
|
}
|
|
3195
|
-
} else if (response && !response.result && response.message) {
|
|
3196
|
-
setError(response.message);
|
|
3197
|
-
throw new Error(response.message);
|
|
3198
3211
|
} else if (!response) {
|
|
3199
|
-
|
|
3212
|
+
const errorMessage = "No response from server";
|
|
3213
|
+
setIsLoading(false);
|
|
3214
|
+
return { isSuccessful: false, message: errorMessage };
|
|
3200
3215
|
}
|
|
3201
3216
|
setIsLoading(false);
|
|
3202
|
-
return { isSuccessful: true, response };
|
|
3217
|
+
return { isSuccessful: true, message: response?.message, result: response };
|
|
3203
3218
|
} catch (err) {
|
|
3204
3219
|
console.error("Button API call failed:", err);
|
|
3205
|
-
|
|
3220
|
+
const errorMessage = err.message || "An unexpected error occurred";
|
|
3206
3221
|
setIsLoading(false);
|
|
3207
|
-
return { isSuccessful: false, message:
|
|
3222
|
+
return { isSuccessful: false, message: errorMessage };
|
|
3208
3223
|
}
|
|
3209
3224
|
}, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue7, props.apiBaseUrl, props.session]);
|
|
3210
3225
|
const renderButtonContent = () => {
|
|
@@ -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",
|
package/dist/index.mjs
CHANGED
|
@@ -33,7 +33,7 @@ import {
|
|
|
33
33
|
Button_default,
|
|
34
34
|
ClientButton_default,
|
|
35
35
|
ToastService_default
|
|
36
|
-
} from "./chunk-
|
|
36
|
+
} from "./chunk-JKP4XOZB.mjs";
|
|
37
37
|
import "./chunk-IMNQO57B.mjs";
|
|
38
38
|
|
|
39
39
|
// src/components/controls/view/ViewControl.tsx
|
|
@@ -408,7 +408,7 @@ var ViewControl_default = ViewControl;
|
|
|
408
408
|
|
|
409
409
|
// src/components/controls/edit/InputControl.tsx
|
|
410
410
|
import dynamic4 from "next/dynamic";
|
|
411
|
-
var InputControl = dynamic4(() => import("./InputControlClient-
|
|
411
|
+
var InputControl = dynamic4(() => import("./InputControlClient-XS52LLEE.mjs"), {
|
|
412
412
|
ssr: false
|
|
413
413
|
});
|
|
414
414
|
var InputControl_default = InputControl;
|
|
@@ -612,7 +612,7 @@ var ImageNode_default = ImageNode;
|
|
|
612
612
|
// src/components/pageRenderingEngine/nodes/LinkNode.tsx
|
|
613
613
|
import dynamic6 from "next/dynamic";
|
|
614
614
|
import { Fragment, jsx as jsx18, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
615
|
-
var LinkNodeButton = dynamic6(() => import("./LinkNodeButton-
|
|
615
|
+
var LinkNodeButton = dynamic6(() => import("./LinkNodeButton-LX3KKGZY.mjs"), {
|
|
616
616
|
ssr: false
|
|
617
617
|
});
|
|
618
618
|
function getNestedValue2(obj, path) {
|
|
@@ -2746,50 +2746,41 @@ var PageBodyRenderer = (props) => {
|
|
|
2746
2746
|
var PageBodyRenderer_default = PageBodyRenderer;
|
|
2747
2747
|
|
|
2748
2748
|
// src/components/Toast.tsx
|
|
2749
|
-
import { useState } from "react";
|
|
2749
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2750
2750
|
import { Fragment as Fragment7, jsx as jsx36, jsxs as jsxs14 } from "react/jsx-runtime";
|
|
2751
2751
|
var Toast = () => {
|
|
2752
2752
|
const [showToast, setShowToast] = useState(false);
|
|
2753
2753
|
const [message, setMessage] = useState("");
|
|
2754
2754
|
const [messageType, setMessageType] = useState("error");
|
|
2755
|
-
|
|
2756
|
-
|
|
2757
|
-
|
|
2758
|
-
|
|
2759
|
-
|
|
2760
|
-
|
|
2761
|
-
|
|
2762
|
-
};
|
|
2763
|
-
|
|
2764
|
-
|
|
2765
|
-
|
|
2766
|
-
|
|
2767
|
-
setTimeout(() => {
|
|
2768
|
-
setShowToast(false);
|
|
2769
|
-
}, 4e3);
|
|
2770
|
-
};
|
|
2771
|
-
ToastService_default.showWarning = function(message2) {
|
|
2772
|
-
setShowToast(true);
|
|
2773
|
-
setMessage(message2);
|
|
2774
|
-
setMessageType("warning");
|
|
2775
|
-
setTimeout(() => {
|
|
2776
|
-
setShowToast(false);
|
|
2777
|
-
}, 4e3);
|
|
2778
|
-
};
|
|
2779
|
-
ToastService_default.showInfo = function(message2) {
|
|
2755
|
+
const timeoutRef = useRef(null);
|
|
2756
|
+
const closeToast = useCallback(() => {
|
|
2757
|
+
if (timeoutRef.current) {
|
|
2758
|
+
clearTimeout(timeoutRef.current);
|
|
2759
|
+
timeoutRef.current = null;
|
|
2760
|
+
}
|
|
2761
|
+
setShowToast(false);
|
|
2762
|
+
}, []);
|
|
2763
|
+
const showMessage = useCallback((message2, messageType2) => {
|
|
2764
|
+
if (timeoutRef.current) {
|
|
2765
|
+
clearTimeout(timeoutRef.current);
|
|
2766
|
+
}
|
|
2780
2767
|
setShowToast(true);
|
|
2781
2768
|
setMessage(message2);
|
|
2782
|
-
setMessageType(
|
|
2783
|
-
setTimeout(() => {
|
|
2769
|
+
setMessageType(messageType2);
|
|
2770
|
+
timeoutRef.current = setTimeout(() => {
|
|
2784
2771
|
setShowToast(false);
|
|
2772
|
+
timeoutRef.current = null;
|
|
2785
2773
|
}, 4e3);
|
|
2786
|
-
};
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
|
|
2774
|
+
}, []);
|
|
2775
|
+
useEffect(() => {
|
|
2776
|
+
ToastService_default.initialize(showMessage, closeToast);
|
|
2777
|
+
return () => {
|
|
2778
|
+
closeToast();
|
|
2779
|
+
ToastService_default.initialize(() => {
|
|
2780
|
+
}, () => {
|
|
2781
|
+
});
|
|
2782
|
+
};
|
|
2783
|
+
}, [closeToast, showMessage]);
|
|
2793
2784
|
return /* @__PURE__ */ jsx36(Fragment7, { children: showToast && /* @__PURE__ */ jsx36("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__ */ jsxs14("div", { className: `w-full items-center flex justify-between p-3 rounded-md relative shadow border bg-${messageType}-soft`, children: [
|
|
2794
2785
|
/* @__PURE__ */ jsx36(
|
|
2795
2786
|
"span",
|
|
@@ -2856,7 +2847,7 @@ var NavigationTabsV2 = ({ tabs, params = {} }) => {
|
|
|
2856
2847
|
var NavigationTabsV2_default = NavigationTabsV2;
|
|
2857
2848
|
|
|
2858
2849
|
// src/components/dataForm/DataList.tsx
|
|
2859
|
-
import React27, { useEffect, useState as useState2, useCallback, useReducer } from "react";
|
|
2850
|
+
import React27, { useEffect as useEffect2, useState as useState2, useCallback as useCallback2, useReducer } from "react";
|
|
2860
2851
|
import { useRouter } from "next/navigation";
|
|
2861
2852
|
|
|
2862
2853
|
// src/components/dataForm/NoContentView.tsx
|
|
@@ -2964,7 +2955,7 @@ var DataList = (props) => {
|
|
|
2964
2955
|
console.log(props.addLinkText);
|
|
2965
2956
|
const [isDataFound, setIsDataFound] = useState2(null);
|
|
2966
2957
|
const [searchTerm, setSearchTerm] = useState2(props.query?.searchTerm ?? "");
|
|
2967
|
-
|
|
2958
|
+
useEffect2(() => {
|
|
2968
2959
|
if (props?.dataset) {
|
|
2969
2960
|
if (props?.dataset.result && props.dataset.result.length > 0) {
|
|
2970
2961
|
setIsDataFound(true);
|
|
@@ -2973,7 +2964,7 @@ var DataList = (props) => {
|
|
|
2973
2964
|
}
|
|
2974
2965
|
}
|
|
2975
2966
|
}, [props.dataset]);
|
|
2976
|
-
|
|
2967
|
+
useEffect2(() => {
|
|
2977
2968
|
if (!props.query?.["$filter"] || !props.filters) return;
|
|
2978
2969
|
const filterQuery = props.query["$filter"];
|
|
2979
2970
|
props.filters.forEach((filter) => {
|
|
@@ -3005,7 +2996,7 @@ var DataList = (props) => {
|
|
|
3005
2996
|
const getSearchableColumns = () => {
|
|
3006
2997
|
return props.columns?.filter((c) => c.isSearchable)?.map((c) => c.name)?.join(",");
|
|
3007
2998
|
};
|
|
3008
|
-
const handleFilterChange =
|
|
2999
|
+
const handleFilterChange = useCallback2(
|
|
3009
3000
|
(updatedValues) => {
|
|
3010
3001
|
dispatch({
|
|
3011
3002
|
type: FORM_INPUT_UPDATE,
|
|
@@ -3036,7 +3027,7 @@ var DataList = (props) => {
|
|
|
3036
3027
|
},
|
|
3037
3028
|
[dispatch, props, router]
|
|
3038
3029
|
);
|
|
3039
|
-
|
|
3030
|
+
useEffect2(() => {
|
|
3040
3031
|
if (!props.columns.some((col) => col.isSearchable)) {
|
|
3041
3032
|
return;
|
|
3042
3033
|
}
|
|
@@ -3483,7 +3474,7 @@ var DataList = (props) => {
|
|
|
3483
3474
|
var DataList_default = DataList;
|
|
3484
3475
|
|
|
3485
3476
|
// src/components/dataForm/DataListRenderer.tsx
|
|
3486
|
-
import React28, { useState as useState3, useEffect as
|
|
3477
|
+
import React28, { useState as useState3, useEffect as useEffect3 } from "react";
|
|
3487
3478
|
import { usePathname as usePathname2 } from "next/navigation";
|
|
3488
3479
|
import { jsx as jsx41, jsxs as jsxs17 } from "react/jsx-runtime";
|
|
3489
3480
|
var viewControlMap = {
|
|
@@ -3547,7 +3538,7 @@ var DataListRenderer = ({
|
|
|
3547
3538
|
const [addLinkText, setAddLinkText] = useState3("");
|
|
3548
3539
|
const [serviceRoute, setServiceRoute] = useState3("");
|
|
3549
3540
|
const pathname = usePathname2();
|
|
3550
|
-
|
|
3541
|
+
useEffect3(() => {
|
|
3551
3542
|
if (!formDefinition) return;
|
|
3552
3543
|
setColumns(mapApiToColumns(formDefinition));
|
|
3553
3544
|
setFilters(mapApiToFilters(formDefinition));
|
|
@@ -3560,7 +3551,7 @@ var DataListRenderer = ({
|
|
|
3560
3551
|
setAddLinkHref(resolvedAddLinkHref);
|
|
3561
3552
|
setAddLinkText(formDefinition?.siteFormDataList?.addLinkText ?? "");
|
|
3562
3553
|
}, [formDefinition, params]);
|
|
3563
|
-
|
|
3554
|
+
useEffect3(() => {
|
|
3564
3555
|
const fetchData = async () => {
|
|
3565
3556
|
if (!serviceRoute) return;
|
|
3566
3557
|
const resolvedRoute = resolveRoutePlaceholders2(serviceRoute, params);
|
|
@@ -3607,10 +3598,10 @@ var DataListRenderer = ({
|
|
|
3607
3598
|
var DataListRenderer_default = DataListRenderer;
|
|
3608
3599
|
|
|
3609
3600
|
// src/components/dataForm/DataForm.tsx
|
|
3610
|
-
import React30, { useCallback as
|
|
3601
|
+
import React30, { useCallback as useCallback4, useEffect as useEffect4, useReducer as useReducer2, useRef as useRef2 } from "react";
|
|
3611
3602
|
|
|
3612
3603
|
// src/components/dataForm/DataFormChildSection.tsx
|
|
3613
|
-
import React29, { useCallback as
|
|
3604
|
+
import React29, { useCallback as useCallback3 } from "react";
|
|
3614
3605
|
|
|
3615
3606
|
// src/components/dataForm/StyleTypes.tsx
|
|
3616
3607
|
var StyleTypes2 = /* @__PURE__ */ ((StyleTypes3) => {
|
|
@@ -3645,7 +3636,7 @@ var DataFormChildSection = (props) => {
|
|
|
3645
3636
|
return childItems.map((item, originalIndex) => ({ item, originalIndex })).filter((x) => !x.item.isDeleted) || [];
|
|
3646
3637
|
};
|
|
3647
3638
|
const childItemsToRender = getChildItemsForRendering();
|
|
3648
|
-
const handleChildInputChange =
|
|
3639
|
+
const handleChildInputChange = useCallback3(
|
|
3649
3640
|
(updatedValues) => {
|
|
3650
3641
|
if (isOneToOne) {
|
|
3651
3642
|
props.callback({
|
|
@@ -3672,7 +3663,7 @@ var DataFormChildSection = (props) => {
|
|
|
3672
3663
|
},
|
|
3673
3664
|
[props, isOneToOne, childItemsToRender]
|
|
3674
3665
|
);
|
|
3675
|
-
const onAddRow =
|
|
3666
|
+
const onAddRow = useCallback3(() => {
|
|
3676
3667
|
props.callback({
|
|
3677
3668
|
sectionName: props.section.name,
|
|
3678
3669
|
actionType: FORM_CHILD_ROW_ADD,
|
|
@@ -3681,7 +3672,7 @@ var DataFormChildSection = (props) => {
|
|
|
3681
3672
|
rowIndex: -1
|
|
3682
3673
|
});
|
|
3683
3674
|
}, [props]);
|
|
3684
|
-
const onDeleteRow =
|
|
3675
|
+
const onDeleteRow = useCallback3(
|
|
3685
3676
|
(filteredIndex) => {
|
|
3686
3677
|
const visibleItem = childItemsToRender[filteredIndex];
|
|
3687
3678
|
if (visibleItem) {
|
|
@@ -3794,7 +3785,7 @@ var DataFormChildSection_default = DataFormChildSection;
|
|
|
3794
3785
|
// src/components/dataForm/DataForm.tsx
|
|
3795
3786
|
import { jsx as jsx43, jsxs as jsxs19 } from "react/jsx-runtime";
|
|
3796
3787
|
var DataForm = (props) => {
|
|
3797
|
-
const formRef =
|
|
3788
|
+
const formRef = useRef2(null);
|
|
3798
3789
|
console.log(props.dataItem, "dssads");
|
|
3799
3790
|
const initialState = {
|
|
3800
3791
|
inputValues: {},
|
|
@@ -3805,7 +3796,7 @@ var DataForm = (props) => {
|
|
|
3805
3796
|
};
|
|
3806
3797
|
const [formState, dispatch] = useReducer2(FormReducer_default, initialState);
|
|
3807
3798
|
console.log(props.sections, "sections");
|
|
3808
|
-
const clearHiddenChildSections =
|
|
3799
|
+
const clearHiddenChildSections = useCallback4(
|
|
3809
3800
|
(changedProperty, newValues) => {
|
|
3810
3801
|
if (!props.sections) return;
|
|
3811
3802
|
const allChildSections = [];
|
|
@@ -3843,7 +3834,7 @@ var DataForm = (props) => {
|
|
|
3843
3834
|
},
|
|
3844
3835
|
[props.sections, formState.inputValues]
|
|
3845
3836
|
);
|
|
3846
|
-
const handleInputChange =
|
|
3837
|
+
const handleInputChange = useCallback4(
|
|
3847
3838
|
async (updatedValues) => {
|
|
3848
3839
|
dispatch({
|
|
3849
3840
|
type: FORM_INPUT_UPDATE,
|
|
@@ -3858,7 +3849,7 @@ var DataForm = (props) => {
|
|
|
3858
3849
|
},
|
|
3859
3850
|
[dispatch, formState.inputValues, clearHiddenChildSections]
|
|
3860
3851
|
);
|
|
3861
|
-
const fetchData =
|
|
3852
|
+
const fetchData = useCallback4(async () => {
|
|
3862
3853
|
if (!props.rules) return;
|
|
3863
3854
|
if (Object.keys(formState.inputValues).length === 0) {
|
|
3864
3855
|
return;
|
|
@@ -3889,7 +3880,7 @@ var DataForm = (props) => {
|
|
|
3889
3880
|
console.error("Error fetching data:", error);
|
|
3890
3881
|
}
|
|
3891
3882
|
}, [formState.lastPropertyChanged, formState.inputValues]);
|
|
3892
|
-
|
|
3883
|
+
useEffect4(() => {
|
|
3893
3884
|
fetchData();
|
|
3894
3885
|
}, [formState.inputValues, formState.lastPropertyChanged]);
|
|
3895
3886
|
function replacePlaceholders(template, context, params) {
|
|
@@ -3909,7 +3900,7 @@ var DataForm = (props) => {
|
|
|
3909
3900
|
}
|
|
3910
3901
|
);
|
|
3911
3902
|
}
|
|
3912
|
-
const handleChildSectionChangeCallback =
|
|
3903
|
+
const handleChildSectionChangeCallback = useCallback4(
|
|
3913
3904
|
(params) => {
|
|
3914
3905
|
dispatch({
|
|
3915
3906
|
type: params.actionType,
|
|
@@ -3954,7 +3945,7 @@ var DataForm = (props) => {
|
|
|
3954
3945
|
});
|
|
3955
3946
|
return cloned;
|
|
3956
3947
|
}
|
|
3957
|
-
const onClick =
|
|
3948
|
+
const onClick = useCallback4(async () => {
|
|
3958
3949
|
if (props.onClick) {
|
|
3959
3950
|
const isEdit = props.dataItem && Object.keys(props.dataItem).length > 0;
|
|
3960
3951
|
const normalizedValues = normalizeChildSections(
|
|
@@ -3970,21 +3961,21 @@ var DataForm = (props) => {
|
|
|
3970
3961
|
return { isSuccessful: true };
|
|
3971
3962
|
}
|
|
3972
3963
|
}, [formState, props]);
|
|
3973
|
-
const handleAdditionalOnClick =
|
|
3964
|
+
const handleAdditionalOnClick = useCallback4(async () => {
|
|
3974
3965
|
if (props.additionalActions?.onClick) {
|
|
3975
3966
|
return await props.additionalActions.onClick(formState);
|
|
3976
3967
|
} else {
|
|
3977
3968
|
return { isSuccessful: true, message: "Action completed successfully" };
|
|
3978
3969
|
}
|
|
3979
3970
|
}, [formState, props]);
|
|
3980
|
-
const onDelete =
|
|
3971
|
+
const onDelete = useCallback4(async () => {
|
|
3981
3972
|
if (props.onDelete) {
|
|
3982
3973
|
return await props.onDelete(formState);
|
|
3983
3974
|
} else {
|
|
3984
3975
|
return { isSuccessful: true };
|
|
3985
3976
|
}
|
|
3986
3977
|
}, [formState, props]);
|
|
3987
|
-
|
|
3978
|
+
useEffect4(() => {
|
|
3988
3979
|
if (props.dataItem) {
|
|
3989
3980
|
dispatch({
|
|
3990
3981
|
type: FORM_INITIAL_UPDATE,
|
package/dist/server.js
CHANGED
|
@@ -691,38 +691,52 @@ var init_Hyperlink = __esm({
|
|
|
691
691
|
});
|
|
692
692
|
|
|
693
693
|
// src/components/ToastService.tsx
|
|
694
|
-
var ToastService, ToastService_default;
|
|
694
|
+
var toastHandlersKey, getToastHandlers, ToastService, ToastService_default;
|
|
695
695
|
var init_ToastService = __esm({
|
|
696
696
|
"src/components/ToastService.tsx"() {
|
|
697
697
|
"use strict";
|
|
698
|
-
|
|
698
|
+
toastHandlersKey = "__digitalStoreToastHandlers";
|
|
699
|
+
getToastHandlers = () => {
|
|
700
|
+
const globalScope = globalThis;
|
|
701
|
+
if (!globalScope[toastHandlersKey]) {
|
|
702
|
+
globalScope[toastHandlersKey] = {};
|
|
703
|
+
}
|
|
704
|
+
return globalScope[toastHandlersKey];
|
|
705
|
+
};
|
|
706
|
+
ToastService = class {
|
|
699
707
|
static initialize(showToast, closeToast) {
|
|
700
|
-
|
|
701
|
-
|
|
708
|
+
const handlers = getToastHandlers();
|
|
709
|
+
handlers.showToast = showToast;
|
|
710
|
+
handlers.closeToast = closeToast;
|
|
702
711
|
}
|
|
703
712
|
static showError(message) {
|
|
704
|
-
|
|
705
|
-
|
|
713
|
+
const handlers = getToastHandlers();
|
|
714
|
+
if (handlers.showToast) {
|
|
715
|
+
handlers.showToast(message, "error");
|
|
706
716
|
}
|
|
707
717
|
}
|
|
708
718
|
static showInfo(message) {
|
|
709
|
-
|
|
710
|
-
|
|
719
|
+
const handlers = getToastHandlers();
|
|
720
|
+
if (handlers.showToast) {
|
|
721
|
+
handlers.showToast(message, "info");
|
|
711
722
|
}
|
|
712
723
|
}
|
|
713
724
|
static showWarning(message) {
|
|
714
|
-
|
|
715
|
-
|
|
725
|
+
const handlers = getToastHandlers();
|
|
726
|
+
if (handlers.showToast) {
|
|
727
|
+
handlers.showToast(message, "warning");
|
|
716
728
|
}
|
|
717
729
|
}
|
|
718
730
|
static showSuccess(message) {
|
|
719
|
-
|
|
720
|
-
|
|
731
|
+
const handlers = getToastHandlers();
|
|
732
|
+
if (handlers.showToast) {
|
|
733
|
+
handlers.showToast(message, "success");
|
|
721
734
|
}
|
|
722
735
|
}
|
|
723
736
|
static close() {
|
|
724
|
-
|
|
725
|
-
|
|
737
|
+
const handlers = getToastHandlers();
|
|
738
|
+
if (handlers.closeToast) {
|
|
739
|
+
handlers.closeToast();
|
|
726
740
|
}
|
|
727
741
|
}
|
|
728
742
|
};
|
|
@@ -1135,11 +1149,11 @@ var init_LinkNodeButton = __esm({
|
|
|
1135
1149
|
import_react5 = require("react");
|
|
1136
1150
|
init_Button();
|
|
1137
1151
|
init_ServiceClient();
|
|
1152
|
+
init_ToastService();
|
|
1138
1153
|
import_jsx_runtime10 = require("react/jsx-runtime");
|
|
1139
1154
|
LinkNodeButton = (props) => {
|
|
1140
1155
|
const { node, dataitem, children, linkText, linkType, linkUrl } = props;
|
|
1141
1156
|
const [isLoading, setIsLoading] = (0, import_react5.useState)(false);
|
|
1142
|
-
const [error, setError] = (0, import_react5.useState)(null);
|
|
1143
1157
|
const extractFieldNames = (0, import_react5.useCallback)((template) => {
|
|
1144
1158
|
if (!template) return [];
|
|
1145
1159
|
const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
|
|
@@ -1191,13 +1205,11 @@ var init_LinkNodeButton = __esm({
|
|
|
1191
1205
|
}
|
|
1192
1206
|
return current;
|
|
1193
1207
|
}, []);
|
|
1194
|
-
const onClick = (0, import_react5.useCallback)(async (
|
|
1208
|
+
const onClick = (0, import_react5.useCallback)(async () => {
|
|
1195
1209
|
if (!node.postUrl) {
|
|
1196
|
-
|
|
1197
|
-
return;
|
|
1210
|
+
return { isSuccessful: false, message: "No POST URL configured for this button" };
|
|
1198
1211
|
}
|
|
1199
1212
|
setIsLoading(true);
|
|
1200
|
-
setError(null);
|
|
1201
1213
|
try {
|
|
1202
1214
|
const resolvedPostUrl = replaceTemplateVariables(node.postUrl);
|
|
1203
1215
|
let parsedPayload = {};
|
|
@@ -1216,10 +1228,12 @@ var init_LinkNodeButton = __esm({
|
|
|
1216
1228
|
console.log("API Response:", response);
|
|
1217
1229
|
if (response && !response.isSuccessful) {
|
|
1218
1230
|
const errorMessage = response.message || "API request failed";
|
|
1219
|
-
setError(errorMessage);
|
|
1220
1231
|
setIsLoading(false);
|
|
1221
1232
|
return { isSuccessful: false, message: errorMessage };
|
|
1222
1233
|
}
|
|
1234
|
+
if (response?.message) {
|
|
1235
|
+
ToastService_default.showSuccess(response.message);
|
|
1236
|
+
}
|
|
1223
1237
|
if (response && node.redirectUrl) {
|
|
1224
1238
|
const fieldNames = extractFieldNames(node.redirectUrl);
|
|
1225
1239
|
console.log("Field names in redirect URL:", fieldNames);
|
|
@@ -1257,19 +1271,18 @@ var init_LinkNodeButton = __esm({
|
|
|
1257
1271
|
if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
|
|
1258
1272
|
window.location.href = resolvedRedirectUrl;
|
|
1259
1273
|
}
|
|
1260
|
-
} else if (response && !response.result && response.message) {
|
|
1261
|
-
setError(response.message);
|
|
1262
|
-
throw new Error(response.message);
|
|
1263
1274
|
} else if (!response) {
|
|
1264
|
-
|
|
1275
|
+
const errorMessage = "No response from server";
|
|
1276
|
+
setIsLoading(false);
|
|
1277
|
+
return { isSuccessful: false, message: errorMessage };
|
|
1265
1278
|
}
|
|
1266
1279
|
setIsLoading(false);
|
|
1267
|
-
return { isSuccessful: true, response };
|
|
1280
|
+
return { isSuccessful: true, message: response?.message, result: response };
|
|
1268
1281
|
} catch (err) {
|
|
1269
1282
|
console.error("Button API call failed:", err);
|
|
1270
|
-
|
|
1283
|
+
const errorMessage = err.message || "An unexpected error occurred";
|
|
1271
1284
|
setIsLoading(false);
|
|
1272
|
-
return { isSuccessful: false, message:
|
|
1285
|
+
return { isSuccessful: false, message: errorMessage };
|
|
1273
1286
|
}
|
|
1274
1287
|
}, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue7, props.apiBaseUrl, props.session]);
|
|
1275
1288
|
const renderButtonContent = () => {
|
package/dist/server.mjs
CHANGED
|
@@ -305,7 +305,7 @@ var ImageNode_default = ImageNode;
|
|
|
305
305
|
// src/components/pageRenderingEngine/nodes/LinkNode.tsx
|
|
306
306
|
import dynamic3 from "next/dynamic";
|
|
307
307
|
import { Fragment, jsx as jsx5, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
308
|
-
var LinkNodeButton = dynamic3(() => import("./LinkNodeButton-
|
|
308
|
+
var LinkNodeButton = dynamic3(() => import("./LinkNodeButton-U7T2NP22.mjs"), {
|
|
309
309
|
ssr: false
|
|
310
310
|
});
|
|
311
311
|
function getNestedValue2(obj, path) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@acoustte-digital-services/digitalstore-controls-dev",
|
|
3
|
-
"version": "0.8.1-dev.
|
|
3
|
+
"version": "0.8.1-dev.20260708102516",
|
|
4
4
|
"description": "Reusable React components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@types/node": "^26.1.
|
|
39
|
+
"@types/node": "^26.1.1",
|
|
40
40
|
"@types/react": "^19.2.17",
|
|
41
41
|
"@types/react-dom": "^19.2.3",
|
|
42
42
|
"tsup": "^8.5.1",
|