@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260722072521 → 0.8.1-dev.20260722072620

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.
@@ -24,7 +24,7 @@ import {
24
24
  import {
25
25
  Button_default,
26
26
  ClientButton_default
27
- } from "./chunk-YL6E76X2.mjs";
27
+ } from "./chunk-RHVNJMS4.mjs";
28
28
  import "./chunk-56HSDML5.mjs";
29
29
 
30
30
  // src/components/controls/edit/InputControlClient.tsx
@@ -642,32 +642,32 @@ var SwitchInput_default = SwitchInput;
642
642
 
643
643
  // src/components/controls/edit/InputControlClient.tsx
644
644
  import { jsx as jsx5 } from "react/jsx-runtime";
645
- var InputControl = React5.forwardRef(
645
+ var ControlComponents = {
646
+ [InputControlType_default.lineTextInput]: LineTextInput_default,
647
+ [InputControlType_default.emailInput]: EmailInput_default,
648
+ [InputControlType_default.multilineTextInput]: MultilineTextInput_default,
649
+ [InputControlType_default.moneyInput]: MoneyInput_default,
650
+ [InputControlType_default.select]: Select_default,
651
+ [InputControlType_default.percentageInput]: PercentageInput_default,
652
+ [InputControlType_default.phoneInput]: PhoneInput_default,
653
+ [InputControlType_default.numberInput]: NumberInput_default,
654
+ [InputControlType_default.checkboxInput]: CheckboxInput_default,
655
+ [InputControlType_default.otpInput]: OtpInput_default,
656
+ [InputControlType_default.datetimeInput]: DateTimeInput_default,
657
+ [InputControlType_default.colorInput]: ColorInput_default,
658
+ [InputControlType_default.selectWithSearchInput]: SelectWithSearchInput_default,
659
+ [InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
660
+ [InputControlType_default.booleanSelect]: BooleanSelect_default,
661
+ [InputControlType_default.timeInput]: TimeInput_default,
662
+ [InputControlType_default.asset]: AssetUpload_default,
663
+ [InputControlType_default.switchInput]: SwitchInput_default
664
+ };
665
+ var InputControl = React5.memo(React5.forwardRef(
646
666
  (props, ref) => {
647
- const ControlComponents = {
648
- [InputControlType_default.lineTextInput]: LineTextInput_default,
649
- [InputControlType_default.emailInput]: EmailInput_default,
650
- [InputControlType_default.multilineTextInput]: MultilineTextInput_default,
651
- [InputControlType_default.moneyInput]: MoneyInput_default,
652
- [InputControlType_default.select]: Select_default,
653
- [InputControlType_default.percentageInput]: PercentageInput_default,
654
- [InputControlType_default.phoneInput]: PhoneInput_default,
655
- [InputControlType_default.numberInput]: NumberInput_default,
656
- [InputControlType_default.checkboxInput]: CheckboxInput_default,
657
- [InputControlType_default.otpInput]: OtpInput_default,
658
- [InputControlType_default.datetimeInput]: DateTimeInput_default,
659
- [InputControlType_default.colorInput]: ColorInput_default,
660
- [InputControlType_default.selectWithSearchInput]: SelectWithSearchInput_default,
661
- [InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
662
- [InputControlType_default.booleanSelect]: BooleanSelect_default,
663
- [InputControlType_default.timeInput]: TimeInput_default,
664
- [InputControlType_default.asset]: AssetUpload_default,
665
- [InputControlType_default.switchInput]: SwitchInput_default
666
- };
667
667
  const SelectedControlComponent = ControlComponents[props.controlType];
668
668
  return /* @__PURE__ */ jsx5(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx5(SelectedControlComponent, { ...props }) : "Control not found" });
669
669
  }
670
- );
670
+ ));
671
671
  InputControl.displayName = "InputControl";
672
672
  var InputControlClient_default = InputControl;
673
673
  export {
@@ -26,7 +26,7 @@ import {
26
26
  import {
27
27
  Button_default,
28
28
  ClientButton_default
29
- } from "./chunk-JKP4XOZB.mjs";
29
+ } from "./chunk-23WJE3YB.mjs";
30
30
  import "./chunk-IMNQO57B.mjs";
31
31
 
32
32
  // src/components/controls/edit/InputControlClient.tsx
@@ -644,32 +644,32 @@ var SwitchInput_default = SwitchInput;
644
644
 
645
645
  // src/components/controls/edit/InputControlClient.tsx
646
646
  import { jsx as jsx5 } from "react/jsx-runtime";
647
- var InputControl = React5.forwardRef(
647
+ var ControlComponents = {
648
+ [InputControlType_default.lineTextInput]: LineTextInput_default,
649
+ [InputControlType_default.emailInput]: EmailInput_default,
650
+ [InputControlType_default.multilineTextInput]: MultilineTextInput_default,
651
+ [InputControlType_default.moneyInput]: MoneyInput_default,
652
+ [InputControlType_default.select]: Select_default,
653
+ [InputControlType_default.percentageInput]: PercentageInput_default,
654
+ [InputControlType_default.phoneInput]: PhoneInput_default,
655
+ [InputControlType_default.numberInput]: NumberInput_default,
656
+ [InputControlType_default.checkboxInput]: CheckboxInput_default,
657
+ [InputControlType_default.otpInput]: OtpInput_default,
658
+ [InputControlType_default.datetimeInput]: DateTimeInput_default,
659
+ [InputControlType_default.colorInput]: ColorInput_default,
660
+ [InputControlType_default.selectWithSearchInput]: SelectWithSearchInput_default,
661
+ [InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
662
+ [InputControlType_default.booleanSelect]: BooleanSelect_default,
663
+ [InputControlType_default.timeInput]: TimeInput_default,
664
+ [InputControlType_default.asset]: AssetUpload_default,
665
+ [InputControlType_default.switchInput]: SwitchInput_default
666
+ };
667
+ var InputControl = React5.memo(React5.forwardRef(
648
668
  (props, ref) => {
649
- const ControlComponents = {
650
- [InputControlType_default.lineTextInput]: LineTextInput_default,
651
- [InputControlType_default.emailInput]: EmailInput_default,
652
- [InputControlType_default.multilineTextInput]: MultilineTextInput_default,
653
- [InputControlType_default.moneyInput]: MoneyInput_default,
654
- [InputControlType_default.select]: Select_default,
655
- [InputControlType_default.percentageInput]: PercentageInput_default,
656
- [InputControlType_default.phoneInput]: PhoneInput_default,
657
- [InputControlType_default.numberInput]: NumberInput_default,
658
- [InputControlType_default.checkboxInput]: CheckboxInput_default,
659
- [InputControlType_default.otpInput]: OtpInput_default,
660
- [InputControlType_default.datetimeInput]: DateTimeInput_default,
661
- [InputControlType_default.colorInput]: ColorInput_default,
662
- [InputControlType_default.selectWithSearchInput]: SelectWithSearchInput_default,
663
- [InputControlType_default.selectWithSearchPanel]: SelectWithSearchPanel_default,
664
- [InputControlType_default.booleanSelect]: BooleanSelect_default,
665
- [InputControlType_default.timeInput]: TimeInput_default,
666
- [InputControlType_default.asset]: AssetUpload_default,
667
- [InputControlType_default.switchInput]: SwitchInput_default
668
- };
669
669
  const SelectedControlComponent = ControlComponents[props.controlType];
670
670
  return /* @__PURE__ */ jsx5(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx5(SelectedControlComponent, { ...props }) : "Control not found" });
671
671
  }
672
- );
672
+ ));
673
673
  InputControl.displayName = "InputControl";
674
674
  var InputControlClient_default = InputControl;
675
675
  export {
@@ -7,15 +7,17 @@ import {
7
7
  import {
8
8
  Button_default,
9
9
  ToastService_default
10
- } from "./chunk-JKP4XOZB.mjs";
10
+ } from "./chunk-23WJE3YB.mjs";
11
11
  import "./chunk-IMNQO57B.mjs";
12
12
 
13
13
  // src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
14
14
  import { useCallback, useState } from "react";
15
- import { jsx } from "react/jsx-runtime";
15
+ import { jsx, jsxs } from "react/jsx-runtime";
16
16
  var LinkNodeButton = (props) => {
17
17
  const { node, dataitem, children, linkText, linkType, linkUrl } = props;
18
18
  const [isLoading, setIsLoading] = useState(false);
19
+ const [successMessage, setSuccessMessage] = useState(null);
20
+ console.log("LinkNodeButton props:", props);
19
21
  const extractFieldNames = useCallback((template) => {
20
22
  if (!template) return [];
21
23
  const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
@@ -23,35 +25,38 @@ var LinkNodeButton = (props) => {
23
25
  const fieldNames = matches.map((match) => match[2] || match[1]).filter((name, index, self) => self.indexOf(name) === index);
24
26
  return fieldNames;
25
27
  }, []);
26
- const replaceTemplateVariables = useCallback((template, responseData) => {
27
- if (!template) return template;
28
- let result = template;
29
- const fieldNames = extractFieldNames(template);
30
- if (responseData) {
31
- fieldNames.forEach((fieldName) => {
32
- const value = getNestedValue(responseData, fieldName);
33
- if (value !== void 0) {
34
- const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
35
- const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
36
- result = result.replace(regex1, String(value));
37
- result = result.replace(regex2, String(value));
38
- }
39
- });
40
- }
41
- if (props.routeParameters) {
42
- Object.entries(props.routeParameters).forEach(([key, value]) => {
43
- const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
44
- result = result.replace(regex, String(value));
45
- });
46
- }
47
- if (dataitem) {
48
- Object.entries(dataitem).forEach(([key, value]) => {
49
- const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
50
- result = result.replace(regex, String(value));
51
- });
52
- }
53
- return result;
54
- }, [props.routeParameters, dataitem, extractFieldNames]);
28
+ const replaceTemplateVariables = useCallback(
29
+ (template, responseData) => {
30
+ if (!template) return template;
31
+ let result = template;
32
+ const fieldNames = extractFieldNames(template);
33
+ if (responseData) {
34
+ fieldNames.forEach((fieldName) => {
35
+ const value = getNestedValue(responseData, fieldName);
36
+ if (value !== void 0) {
37
+ const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
38
+ const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
39
+ result = result.replace(regex1, String(value));
40
+ result = result.replace(regex2, String(value));
41
+ }
42
+ });
43
+ }
44
+ if (props.routeParameters) {
45
+ Object.entries(props.routeParameters).forEach(([key, value]) => {
46
+ const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
47
+ result = result.replace(regex, String(value));
48
+ });
49
+ }
50
+ if (dataitem) {
51
+ Object.entries(dataitem).forEach(([key, value]) => {
52
+ const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
53
+ result = result.replace(regex, String(value));
54
+ });
55
+ }
56
+ return result;
57
+ },
58
+ [props.routeParameters, dataitem, extractFieldNames]
59
+ );
55
60
  const getNestedValue = useCallback((obj, path) => {
56
61
  if (!obj || !path) return void 0;
57
62
  if (obj[path] !== void 0) {
@@ -69,7 +74,10 @@ var LinkNodeButton = (props) => {
69
74
  }, []);
70
75
  const onClick = useCallback(async () => {
71
76
  if (!node.postUrl) {
72
- return { isSuccessful: false, message: "No POST URL configured for this button" };
77
+ return {
78
+ isSuccessful: false,
79
+ message: "No POST URL configured for this button"
80
+ };
73
81
  }
74
82
  setIsLoading(true);
75
83
  try {
@@ -95,6 +103,7 @@ var LinkNodeButton = (props) => {
95
103
  }
96
104
  if (response?.message) {
97
105
  ToastService_default.showSuccess(response.message);
106
+ setSuccessMessage(response.message);
98
107
  }
99
108
  if (response && node.redirectUrl) {
100
109
  const fieldNames = extractFieldNames(node.redirectUrl);
@@ -117,7 +126,9 @@ var LinkNodeButton = (props) => {
117
126
  }
118
127
  });
119
128
  console.log("Field value map:", fieldValueMap);
120
- const missingFields = fieldNames.filter((fieldName) => !fieldValueMap[fieldName]);
129
+ const missingFields = fieldNames.filter(
130
+ (fieldName) => !fieldValueMap[fieldName]
131
+ );
121
132
  if (missingFields.length > 0) {
122
133
  console.warn(`Missing field values for: ${missingFields.join(", ")}`);
123
134
  }
@@ -128,7 +139,10 @@ var LinkNodeButton = (props) => {
128
139
  resolvedRedirectUrl = resolvedRedirectUrl.replace(regex1, value);
129
140
  resolvedRedirectUrl = resolvedRedirectUrl.replace(regex2, value);
130
141
  });
131
- resolvedRedirectUrl = replaceTemplateVariables(resolvedRedirectUrl, response);
142
+ resolvedRedirectUrl = replaceTemplateVariables(
143
+ resolvedRedirectUrl,
144
+ response
145
+ );
132
146
  console.log("Final redirect URL:", resolvedRedirectUrl);
133
147
  if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
134
148
  window.location.href = resolvedRedirectUrl;
@@ -139,14 +153,27 @@ var LinkNodeButton = (props) => {
139
153
  return { isSuccessful: false, message: errorMessage };
140
154
  }
141
155
  setIsLoading(false);
142
- return { isSuccessful: true, message: response?.message, result: response };
156
+ return {
157
+ isSuccessful: true,
158
+ message: response?.message,
159
+ result: response
160
+ };
143
161
  } catch (err) {
144
162
  console.error("Button API call failed:", err);
145
163
  const errorMessage = err.message || "An unexpected error occurred";
146
164
  setIsLoading(false);
147
165
  return { isSuccessful: false, message: errorMessage };
148
166
  }
149
- }, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue, props.apiBaseUrl, props.session]);
167
+ }, [
168
+ node.postUrl,
169
+ node.payload,
170
+ node.redirectUrl,
171
+ replaceTemplateVariables,
172
+ extractFieldNames,
173
+ getNestedValue,
174
+ props.apiBaseUrl,
175
+ props.session
176
+ ]);
150
177
  const renderButtonContent = () => {
151
178
  if (children) {
152
179
  return children;
@@ -156,14 +183,41 @@ var LinkNodeButton = (props) => {
156
183
  }
157
184
  return node.title || "Button";
158
185
  };
186
+ const fontSize = node.children?.[0]?.style?.match(/font-size:\s*([^;]+)/)?.[1];
159
187
  return /* @__PURE__ */ jsx("div", { className: "link-button-wrapper", children: /* @__PURE__ */ jsx(
160
188
  Button_default,
161
189
  {
162
190
  ButtonType: linkType,
163
191
  onClick,
164
- disabled: isLoading,
192
+ disabled: isLoading || !!successMessage,
165
193
  className: "w-full",
166
- children: renderButtonContent()
194
+ children: successMessage ? /* @__PURE__ */ jsxs(
195
+ "span",
196
+ {
197
+ style: fontSize ? { fontSize } : void 0,
198
+ className: "inline-flex items-center gap-2",
199
+ children: [
200
+ /* @__PURE__ */ jsx(
201
+ "svg",
202
+ {
203
+ xmlns: "http://www.w3.org/2000/svg",
204
+ viewBox: "0 0 20 20",
205
+ fill: "currentColor",
206
+ className: "w-5 h-5",
207
+ children: /* @__PURE__ */ jsx(
208
+ "path",
209
+ {
210
+ fillRule: "evenodd",
211
+ d: "M16.704 5.29a1 1 0 010 1.42l-7.25 7.25a1 1 0 01-1.415 0L3.29 9.21a1 1 0 111.415-1.414l4.042 4.042 6.543-6.543a1 1 0 011.414 0z",
212
+ clipRule: "evenodd"
213
+ }
214
+ )
215
+ }
216
+ ),
217
+ /* @__PURE__ */ jsx("span", { children: successMessage })
218
+ ]
219
+ }
220
+ ) : renderButtonContent()
167
221
  }
168
222
  ) });
169
223
  };
@@ -5,15 +5,17 @@ import {
5
5
  import {
6
6
  Button_default,
7
7
  ToastService_default
8
- } from "./chunk-YL6E76X2.mjs";
8
+ } from "./chunk-RHVNJMS4.mjs";
9
9
  import "./chunk-56HSDML5.mjs";
10
10
 
11
11
  // src/components/pageRenderingEngine/nodes/LinkNodeButton.tsx
12
12
  import { useCallback, useState } from "react";
13
- import { jsx } from "react/jsx-runtime";
13
+ import { jsx, jsxs } from "react/jsx-runtime";
14
14
  var LinkNodeButton = (props) => {
15
15
  const { node, dataitem, children, linkText, linkType, linkUrl } = props;
16
16
  const [isLoading, setIsLoading] = useState(false);
17
+ const [successMessage, setSuccessMessage] = useState(null);
18
+ console.log("LinkNodeButton props:", props);
17
19
  const extractFieldNames = useCallback((template) => {
18
20
  if (!template) return [];
19
21
  const regex = /\{(\{\})?([a-zA-Z_$][a-zA-Z0-9_$]*)(?:\}\})?\}/g;
@@ -21,35 +23,38 @@ var LinkNodeButton = (props) => {
21
23
  const fieldNames = matches.map((match) => match[2] || match[1]).filter((name, index, self) => self.indexOf(name) === index);
22
24
  return fieldNames;
23
25
  }, []);
24
- const replaceTemplateVariables = useCallback((template, responseData) => {
25
- if (!template) return template;
26
- let result = template;
27
- const fieldNames = extractFieldNames(template);
28
- if (responseData) {
29
- fieldNames.forEach((fieldName) => {
30
- const value = getNestedValue(responseData, fieldName);
31
- if (value !== void 0) {
32
- const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
33
- const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
34
- result = result.replace(regex1, String(value));
35
- result = result.replace(regex2, String(value));
36
- }
37
- });
38
- }
39
- if (props.routeParameters) {
40
- Object.entries(props.routeParameters).forEach(([key, value]) => {
41
- const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
42
- result = result.replace(regex, String(value));
43
- });
44
- }
45
- if (dataitem) {
46
- Object.entries(dataitem).forEach(([key, value]) => {
47
- const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
48
- result = result.replace(regex, String(value));
49
- });
50
- }
51
- return result;
52
- }, [props.routeParameters, dataitem, extractFieldNames]);
26
+ const replaceTemplateVariables = useCallback(
27
+ (template, responseData) => {
28
+ if (!template) return template;
29
+ let result = template;
30
+ const fieldNames = extractFieldNames(template);
31
+ if (responseData) {
32
+ fieldNames.forEach((fieldName) => {
33
+ const value = getNestedValue(responseData, fieldName);
34
+ if (value !== void 0) {
35
+ const regex1 = new RegExp(`\\{${fieldName}\\}`, "g");
36
+ const regex2 = new RegExp(`\\{\\{${fieldName}\\}\\}`, "g");
37
+ result = result.replace(regex1, String(value));
38
+ result = result.replace(regex2, String(value));
39
+ }
40
+ });
41
+ }
42
+ if (props.routeParameters) {
43
+ Object.entries(props.routeParameters).forEach(([key, value]) => {
44
+ const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
45
+ result = result.replace(regex, String(value));
46
+ });
47
+ }
48
+ if (dataitem) {
49
+ Object.entries(dataitem).forEach(([key, value]) => {
50
+ const regex = new RegExp(`\\{\\{${key}\\}\\}`, "g");
51
+ result = result.replace(regex, String(value));
52
+ });
53
+ }
54
+ return result;
55
+ },
56
+ [props.routeParameters, dataitem, extractFieldNames]
57
+ );
53
58
  const getNestedValue = useCallback((obj, path) => {
54
59
  if (!obj || !path) return void 0;
55
60
  if (obj[path] !== void 0) {
@@ -67,7 +72,10 @@ var LinkNodeButton = (props) => {
67
72
  }, []);
68
73
  const onClick = useCallback(async () => {
69
74
  if (!node.postUrl) {
70
- return { isSuccessful: false, message: "No POST URL configured for this button" };
75
+ return {
76
+ isSuccessful: false,
77
+ message: "No POST URL configured for this button"
78
+ };
71
79
  }
72
80
  setIsLoading(true);
73
81
  try {
@@ -93,6 +101,7 @@ var LinkNodeButton = (props) => {
93
101
  }
94
102
  if (response?.message) {
95
103
  ToastService_default.showSuccess(response.message);
104
+ setSuccessMessage(response.message);
96
105
  }
97
106
  if (response && node.redirectUrl) {
98
107
  const fieldNames = extractFieldNames(node.redirectUrl);
@@ -115,7 +124,9 @@ var LinkNodeButton = (props) => {
115
124
  }
116
125
  });
117
126
  console.log("Field value map:", fieldValueMap);
118
- const missingFields = fieldNames.filter((fieldName) => !fieldValueMap[fieldName]);
127
+ const missingFields = fieldNames.filter(
128
+ (fieldName) => !fieldValueMap[fieldName]
129
+ );
119
130
  if (missingFields.length > 0) {
120
131
  console.warn(`Missing field values for: ${missingFields.join(", ")}`);
121
132
  }
@@ -126,7 +137,10 @@ var LinkNodeButton = (props) => {
126
137
  resolvedRedirectUrl = resolvedRedirectUrl.replace(regex1, value);
127
138
  resolvedRedirectUrl = resolvedRedirectUrl.replace(regex2, value);
128
139
  });
129
- resolvedRedirectUrl = replaceTemplateVariables(resolvedRedirectUrl, response);
140
+ resolvedRedirectUrl = replaceTemplateVariables(
141
+ resolvedRedirectUrl,
142
+ response
143
+ );
130
144
  console.log("Final redirect URL:", resolvedRedirectUrl);
131
145
  if (resolvedRedirectUrl && !resolvedRedirectUrl.includes("{")) {
132
146
  window.location.href = resolvedRedirectUrl;
@@ -137,14 +151,27 @@ var LinkNodeButton = (props) => {
137
151
  return { isSuccessful: false, message: errorMessage };
138
152
  }
139
153
  setIsLoading(false);
140
- return { isSuccessful: true, message: response?.message, result: response };
154
+ return {
155
+ isSuccessful: true,
156
+ message: response?.message,
157
+ result: response
158
+ };
141
159
  } catch (err) {
142
160
  console.error("Button API call failed:", err);
143
161
  const errorMessage = err.message || "An unexpected error occurred";
144
162
  setIsLoading(false);
145
163
  return { isSuccessful: false, message: errorMessage };
146
164
  }
147
- }, [node.postUrl, node.payload, node.redirectUrl, replaceTemplateVariables, extractFieldNames, getNestedValue, props.apiBaseUrl, props.session]);
165
+ }, [
166
+ node.postUrl,
167
+ node.payload,
168
+ node.redirectUrl,
169
+ replaceTemplateVariables,
170
+ extractFieldNames,
171
+ getNestedValue,
172
+ props.apiBaseUrl,
173
+ props.session
174
+ ]);
148
175
  const renderButtonContent = () => {
149
176
  if (children) {
150
177
  return children;
@@ -154,14 +181,41 @@ var LinkNodeButton = (props) => {
154
181
  }
155
182
  return node.title || "Button";
156
183
  };
184
+ const fontSize = node.children?.[0]?.style?.match(/font-size:\s*([^;]+)/)?.[1];
157
185
  return /* @__PURE__ */ jsx("div", { className: "link-button-wrapper", children: /* @__PURE__ */ jsx(
158
186
  Button_default,
159
187
  {
160
188
  ButtonType: linkType,
161
189
  onClick,
162
- disabled: isLoading,
190
+ disabled: isLoading || !!successMessage,
163
191
  className: "w-full",
164
- children: renderButtonContent()
192
+ children: successMessage ? /* @__PURE__ */ jsxs(
193
+ "span",
194
+ {
195
+ style: fontSize ? { fontSize } : void 0,
196
+ className: "inline-flex items-center gap-2",
197
+ children: [
198
+ /* @__PURE__ */ jsx(
199
+ "svg",
200
+ {
201
+ xmlns: "http://www.w3.org/2000/svg",
202
+ viewBox: "0 0 20 20",
203
+ fill: "currentColor",
204
+ className: "w-5 h-5",
205
+ children: /* @__PURE__ */ jsx(
206
+ "path",
207
+ {
208
+ fillRule: "evenodd",
209
+ d: "M16.704 5.29a1 1 0 010 1.42l-7.25 7.25a1 1 0 01-1.415 0L3.29 9.21a1 1 0 111.415-1.414l4.042 4.042 6.543-6.543a1 1 0 011.414 0z",
210
+ clipRule: "evenodd"
211
+ }
212
+ )
213
+ }
214
+ ),
215
+ /* @__PURE__ */ jsx("span", { children: successMessage })
216
+ ]
217
+ }
218
+ ) : renderButtonContent()
165
219
  }
166
220
  ) });
167
221
  };
@@ -129,7 +129,7 @@ var Confirm_default = Confirm;
129
129
  }
130
130
 
131
131
  // src/components/Button.tsx
132
- import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
132
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
133
133
  var Button = (props) => {
134
134
  const [inProgress, setInProgress] = useState2(false);
135
135
  const [isActionPerformed, setIsActionPerformed] = useState2(false);
@@ -139,7 +139,9 @@ var Button = (props) => {
139
139
  event.preventDefault();
140
140
  event.stopPropagation();
141
141
  if (props.confirm) {
142
- const confirmed = await showConfirmation("Are you sure you want to delete this item?");
142
+ const confirmed = await showConfirmation(
143
+ "Are you sure you want to delete this item?"
144
+ );
143
145
  setShowModal(null);
144
146
  if (!confirmed) {
145
147
  return;
@@ -154,7 +156,9 @@ var Button = (props) => {
154
156
  isValid = await props.onValidate();
155
157
  if (!isValid) {
156
158
  setInProgress(false);
157
- ToastService_default.showError("There are errors in the form. Please fix them before proceeding.");
159
+ ToastService_default.showError(
160
+ "There are errors in the form. Please fix them before proceeding."
161
+ );
158
162
  return;
159
163
  }
160
164
  }
@@ -178,7 +182,16 @@ var Button = (props) => {
178
182
  return new Promise((resolve) => {
179
183
  const onConfirm = () => resolve(true);
180
184
  const onCancel = () => resolve(false);
181
- setShowModal(/* @__PURE__ */ jsx3(Confirm_default, { message: props.confirmationMessage, onConfirm, onCancel }));
185
+ setShowModal(
186
+ /* @__PURE__ */ jsx3(
187
+ Confirm_default,
188
+ {
189
+ message: props.confirmationMessage,
190
+ onConfirm,
191
+ onCancel
192
+ }
193
+ )
194
+ );
182
195
  });
183
196
  };
184
197
  let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
@@ -192,13 +205,39 @@ var Button = (props) => {
192
205
  onClick: execute,
193
206
  disabled: props.disabled,
194
207
  title: isDisabled ? "The button is disabled to prevent any action" : "",
195
- className: buttonClass + " relative " + props.className,
208
+ className: `${buttonClass} relative inline-flex items-center justify-center gap-2 ${props.className ?? ""}`,
196
209
  children: [
197
210
  isActionPerformed && props.oneTimeAction && responseMessage ? responseMessage : props.children,
198
- inProgress && /* @__PURE__ */ jsx3(React3.Fragment, { children: props.hideProgressIndicator === true ? /* @__PURE__ */ jsx3("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ jsxs2("svg", { className: "animate-spin ml-2 mr-3 h-5 w-5 " + progressClass, xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", children: [
199
- /* @__PURE__ */ jsx3("circle", { className: "opacity-25", cx: "12", cy: "12", r: "10", stroke: "currentColor", strokeWidth: "4" }),
200
- /* @__PURE__ */ jsx3("path", { className: "opacity-75", fill: "currentColor", d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z" })
201
- ] }) })
211
+ inProgress && /* @__PURE__ */ jsx3(Fragment2, { children: props.hideProgressIndicator ? /* @__PURE__ */ jsx3("div", { className: "absolute bottom-0 left-0 h-0.5 bg-gray-400 rounded animate-progress" }) : /* @__PURE__ */ jsxs2(
212
+ "svg",
213
+ {
214
+ className: `animate-spin h-5 w-5 flex-shrink-0 ${progressClass}`,
215
+ xmlns: "http://www.w3.org/2000/svg",
216
+ fill: "none",
217
+ viewBox: "0 0 24 24",
218
+ children: [
219
+ /* @__PURE__ */ jsx3(
220
+ "circle",
221
+ {
222
+ className: "opacity-25",
223
+ cx: "12",
224
+ cy: "12",
225
+ r: "10",
226
+ stroke: "currentColor",
227
+ strokeWidth: "4"
228
+ }
229
+ ),
230
+ /* @__PURE__ */ jsx3(
231
+ "path",
232
+ {
233
+ className: "opacity-75",
234
+ fill: "currentColor",
235
+ d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
236
+ }
237
+ )
238
+ ]
239
+ }
240
+ ) })
202
241
  ]
203
242
  }
204
243
  ),