@clyrex-digital/clyrex-controls-dev 0.8.1-dev.20260818060820 → 0.8.1-dev.20260824072352

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.
Files changed (31) hide show
  1. package/dist/DataBindingControls-QZ7ES2AS.mjs +205 -0
  2. package/dist/DataBindingControls-XCAIDMDC.mjs +209 -0
  3. package/dist/{InputControlClient-XR37ZIQ2.mjs → InputControlClient-4M2BZXQO.mjs} +5 -3
  4. package/dist/InputControlClient-AORN4DRF.mjs +1921 -0
  5. package/dist/{LinkNodeButton-AOEDCCL7.mjs → LinkNodeButton-BEAX4I4C.mjs} +1 -1
  6. package/dist/LinkNodeButton-IT2CELKO.mjs +225 -0
  7. package/dist/{Pagination-YKNCYVXV.mjs → Pagination-GL6B4MNO.mjs} +5 -3
  8. package/dist/{Pagination-6OFACRMQ.mjs → Pagination-ZQO3EUKB.mjs} +27 -71
  9. package/dist/chunk-2R26M6CK.mjs +30 -0
  10. package/dist/{chunk-KL2YKXXS.mjs → chunk-4P4HO663.mjs} +30 -6
  11. package/dist/chunk-4R7F7LBL.mjs +36 -0
  12. package/dist/chunk-6PW2RLUJ.mjs +52 -0
  13. package/dist/chunk-E4VOFO5Q.mjs +39 -0
  14. package/dist/{chunk-YDPISYMP.mjs → chunk-GCG4OYDJ.mjs} +0 -34
  15. package/dist/{chunk-65QPOTZ4.mjs → chunk-GJOJX2O3.mjs} +1 -1
  16. package/dist/chunk-GKI42H4B.mjs +13 -0
  17. package/dist/{chunk-TVL6KVD5.mjs → chunk-Q46GMD3P.mjs} +31 -37
  18. package/dist/chunk-RHVNJMS4.mjs +251 -0
  19. package/dist/{chunk-WEV5U33G.mjs → chunk-TKDSRAM6.mjs} +36 -20
  20. package/dist/chunk-TQ6BXQ3A.mjs +24 -0
  21. package/dist/{chunk-3GWLDT7C.mjs → chunk-WXZMRMRS.mjs} +36 -20
  22. package/dist/index.d.mts +17 -6
  23. package/dist/index.d.ts +17 -6
  24. package/dist/index.js +616 -311
  25. package/dist/index.mjs +101 -54
  26. package/dist/server.d.mts +17 -6
  27. package/dist/server.d.ts +17 -6
  28. package/dist/server.js +2717 -298
  29. package/dist/server.mjs +86 -52
  30. package/package.json +1 -1
  31. package/dist/LinkNodeButton-KZRNRJRI.mjs +0 -467
@@ -0,0 +1,39 @@
1
+ "use client";
2
+
3
+
4
+ // src/components/controls/edit/InputControlType.tsx
5
+ var Constants = {
6
+ pagesize: 10
7
+ };
8
+ var InputControlType = {
9
+ lineTextInput: "lineTextInput",
10
+ multilineTextInput: "multilineTextInput",
11
+ emailInput: "emailInput",
12
+ moneyInput: "money",
13
+ select: "select",
14
+ percentageInput: "percentage",
15
+ asset: "asset",
16
+ assetUpload: "assetUpload",
17
+ phoneInput: "phone",
18
+ numberInput: "numberInput",
19
+ checkboxInput: "checkboxInput",
20
+ otpInput: "otp",
21
+ datetimeInput: "datetimeInput",
22
+ timeInput: "time",
23
+ colorInput: "colorInput",
24
+ selectWithSearchInput: "selectWithSearchInput",
25
+ selectWithSearchPanel: "selectWithSearchPanel",
26
+ booleanSelect: "booleanSelect",
27
+ switchInput: "switchInput",
28
+ dateInput: "dateInput",
29
+ radioInput: "radioInput",
30
+ switcher: "switcher",
31
+ videoInput: "videoInput",
32
+ referenceInput: "referenceInput"
33
+ };
34
+ var InputControlType_default = InputControlType;
35
+
36
+ export {
37
+ Constants,
38
+ InputControlType_default
39
+ };
@@ -4,38 +4,6 @@ import {
4
4
  buttonClasses
5
5
  } from "./chunk-IMNQO57B.mjs";
6
6
 
7
- // src/components/controls/edit/InputControlType.tsx
8
- var Constants = {
9
- pagesize: 10
10
- };
11
- var InputControlType = {
12
- lineTextInput: "lineTextInput",
13
- multilineTextInput: "multilineTextInput",
14
- emailInput: "emailInput",
15
- moneyInput: "money",
16
- select: "select",
17
- percentageInput: "percentage",
18
- asset: "asset",
19
- assetUpload: "assetUpload",
20
- phoneInput: "phone",
21
- numberInput: "numberInput",
22
- checkboxInput: "checkboxInput",
23
- otpInput: "otp",
24
- datetimeInput: "datetimeInput",
25
- timeInput: "time",
26
- colorInput: "colorInput",
27
- selectWithSearchInput: "selectWithSearchInput",
28
- selectWithSearchPanel: "selectWithSearchPanel",
29
- booleanSelect: "booleanSelect",
30
- switchInput: "switchInput",
31
- dateInput: "dateInput",
32
- radioInput: "radioInput",
33
- switcher: "switcher",
34
- videoInput: "videoInput",
35
- referenceInput: "referenceInput"
36
- };
37
- var InputControlType_default = InputControlType;
38
-
39
7
  // src/components/dataForm/Hyperlink.tsx
40
8
  import Link from "next/link";
41
9
  import { Fragment, jsx } from "react/jsx-runtime";
@@ -109,8 +77,6 @@ var Icon = ({ name, className, ...props }) => {
109
77
  var Icon_default = Icon;
110
78
 
111
79
  export {
112
- Constants,
113
- InputControlType_default,
114
80
  Hyperlink,
115
81
  Icon_default
116
82
  };
@@ -2,7 +2,7 @@
2
2
 
3
3
  import {
4
4
  Icon_default
5
- } from "./chunk-YDPISYMP.mjs";
5
+ } from "./chunk-GCG4OYDJ.mjs";
6
6
 
7
7
  // src/components/controls/edit/MultilineTextInput.tsx
8
8
  import React from "react";
@@ -0,0 +1,13 @@
1
+ "use client";
2
+
3
+
4
+ // src/components/controls/edit/InputControl.tsx
5
+ import dynamic from "next/dynamic";
6
+ var InputControl = dynamic(() => import("./InputControlClient-4M2BZXQO.mjs"), {
7
+ ssr: false
8
+ });
9
+ var InputControl_default = InputControl;
10
+
11
+ export {
12
+ InputControl_default
13
+ };
@@ -1,34 +1,6 @@
1
1
  import {
2
- buttonClasses
3
- } from "./chunk-56HSDML5.mjs";
4
-
5
- // src/components/dataForm/Hyperlink.tsx
6
- import Link from "next/link";
7
- import { Fragment, jsx } from "react/jsx-runtime";
8
- function Hyperlink(props) {
9
- let linkClass = props.linkType ? buttonClasses.get(props.linkType) : buttonClasses.get("Link" /* Link */);
10
- const target = props?.href?.startsWith("http") ? "_blank" : "_self";
11
- const additionalProps = {};
12
- if (target == "_blank") {
13
- additionalProps.rel = "noopener noreferrer";
14
- }
15
- return /* @__PURE__ */ jsx(Fragment, { children: props.href ? /* @__PURE__ */ jsx(
16
- Link,
17
- {
18
- href: props.href,
19
- prefetch: false,
20
- className: [linkClass, props.className].filter(Boolean).join(" "),
21
- ...additionalProps,
22
- target,
23
- children: props.children
24
- }
25
- ) : props.isHeading ? /* @__PURE__ */ jsx("h5", { className: props.className + "inline-block", children: props.children }) : /* @__PURE__ */ jsx("span", { className: props.className, children: props.children }) });
26
- }
27
-
28
- // src/components/controls/edit/InputControlType.tsx
29
- var Constants = {
30
- pagesize: 10
31
- };
2
+ Constants
3
+ } from "./chunk-4R7F7LBL.mjs";
32
4
 
33
5
  // src/clients/OdataBuilder.tsx
34
6
  var OdataBuilder = class {
@@ -66,6 +38,12 @@ var OdataBuilder = class {
66
38
  if (key == "searchCols") {
67
39
  this.searchCols = odata[key];
68
40
  }
41
+ if (key == "filter") {
42
+ this.apiFilter = odata[key];
43
+ }
44
+ if (key == "orderBy") {
45
+ this.apiOrderBy = odata[key];
46
+ }
69
47
  }
70
48
  }
71
49
  }
@@ -92,6 +70,12 @@ var OdataBuilder = class {
92
70
  if (obj?.["searchCols"] && obj["searchCols"].trim() !== "") {
93
71
  queryString += `&searchCols=${encodeURIComponent(obj["searchCols"])}`;
94
72
  }
73
+ if (obj?.["filter"] && obj["filter"].trim() !== "") {
74
+ queryString += `&filter=${encodeURIComponent(obj["filter"])}`;
75
+ }
76
+ if (obj?.["orderBy"] && obj["orderBy"].trim() !== "") {
77
+ queryString += `&orderBy=${encodeURIComponent(obj["orderBy"])}`;
78
+ }
95
79
  if (obj) {
96
80
  if (obj["$filter"] && obj["$filter"] !== null && obj["$filter"] !== "") {
97
81
  queryString = queryString + `&$filter=${encodeURIComponent(obj["$filter"])}`;
@@ -139,6 +123,18 @@ var OdataBuilder = class {
139
123
  }
140
124
  return pageNumber;
141
125
  }
126
+ appendApiQueryParameters(url) {
127
+ if (this.searchTerm) {
128
+ url += `&searchTerm=${encodeURIComponent(this.searchTerm)}`;
129
+ }
130
+ if (this.apiFilter) {
131
+ url += `&filter=${encodeURIComponent(this.apiFilter)}`;
132
+ }
133
+ if (this.apiOrderBy) {
134
+ url += `&orderBy=${encodeURIComponent(this.apiOrderBy)}`;
135
+ }
136
+ return url;
137
+ }
142
138
  getUrl() {
143
139
  let url = `${this.baseUrl}?$skip=${this.skip}&$top=${this.top}&$count=true`;
144
140
  if (this.filterBy !== null && this.filterBy !== "") {
@@ -154,7 +150,7 @@ var OdataBuilder = class {
154
150
  url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
155
151
  }
156
152
  console.log(url);
157
- return url;
153
+ return this.appendApiQueryParameters(url);
158
154
  }
159
155
  getNewOrderByUrl(orderBy) {
160
156
  let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
@@ -168,7 +164,7 @@ var OdataBuilder = class {
168
164
  url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
169
165
  }
170
166
  url = url + `&$orderby=${encodeURIComponent(orderBy)}`;
171
- return url;
167
+ return this.appendApiQueryParameters(url);
172
168
  }
173
169
  getNewFilterUrl(filterBy) {
174
170
  let url = `${this.baseUrl}?$skip=${0}&$top=${this.top}&$count=true`;
@@ -184,7 +180,7 @@ var OdataBuilder = class {
184
180
  if (this.searchCols) {
185
181
  url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
186
182
  }
187
- return url;
183
+ return this.appendApiQueryParameters(url);
188
184
  }
189
185
  getNewPageUrl(page) {
190
186
  let skip = page * Constants.pagesize - Constants.pagesize;
@@ -201,7 +197,7 @@ var OdataBuilder = class {
201
197
  if (this.searchCols) {
202
198
  url += `&searchCols=${encodeURIComponent(this.searchCols)}`;
203
199
  }
204
- return url;
200
+ return this.appendApiQueryParameters(url);
205
201
  }
206
202
  getNewPageSizeUrl(pageSize) {
207
203
  const currentPage = this.getPageNumber(
@@ -215,7 +211,7 @@ var OdataBuilder = class {
215
211
  if (this.orderBy !== null && this.orderBy !== "") {
216
212
  url = url + `&$orderby=${encodeURIComponent(this.orderBy)}`;
217
213
  }
218
- return url;
214
+ return this.appendApiQueryParameters(url);
219
215
  }
220
216
  getOrderBy() {
221
217
  return this.orderBy;
@@ -223,7 +219,5 @@ var OdataBuilder = class {
223
219
  };
224
220
 
225
221
  export {
226
- Hyperlink,
227
- Constants,
228
222
  OdataBuilder
229
223
  };
@@ -0,0 +1,251 @@
1
+ import {
2
+ buttonClasses,
3
+ progressClasses
4
+ } from "./chunk-56HSDML5.mjs";
5
+
6
+ // src/components/ToastService.tsx
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 {
16
+ static initialize(showToast, closeToast) {
17
+ const handlers = getToastHandlers();
18
+ handlers.showToast = showToast;
19
+ handlers.closeToast = closeToast;
20
+ }
21
+ static showError(message) {
22
+ const handlers = getToastHandlers();
23
+ if (handlers.showToast) {
24
+ handlers.showToast(message, "error");
25
+ }
26
+ }
27
+ static showInfo(message) {
28
+ const handlers = getToastHandlers();
29
+ if (handlers.showToast) {
30
+ handlers.showToast(message, "info");
31
+ }
32
+ }
33
+ static showWarning(message) {
34
+ const handlers = getToastHandlers();
35
+ if (handlers.showToast) {
36
+ handlers.showToast(message, "warning");
37
+ }
38
+ }
39
+ static showSuccess(message) {
40
+ const handlers = getToastHandlers();
41
+ if (handlers.showToast) {
42
+ handlers.showToast(message, "success");
43
+ }
44
+ }
45
+ static close() {
46
+ const handlers = getToastHandlers();
47
+ if (handlers.closeToast) {
48
+ handlers.closeToast();
49
+ }
50
+ }
51
+ };
52
+ var ToastService_default = ToastService;
53
+
54
+ // src/components/Button.tsx
55
+ import React3, { useState as useState2 } from "react";
56
+
57
+ // src/components/Confirm.tsx
58
+ import { useState } from "react";
59
+
60
+ // src/components/ClientButton.tsx
61
+ import React from "react";
62
+ import { jsx } from "react/jsx-runtime";
63
+ var ClientButton = (props) => {
64
+ const execute = async (event) => {
65
+ if (props.onClick !== void 0) {
66
+ props.onClick();
67
+ } else {
68
+ ToastService_default.showError("No action defined.");
69
+ }
70
+ };
71
+ let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
72
+ return /* @__PURE__ */ jsx(React.Fragment, { children: /* @__PURE__ */ jsx(
73
+ "button",
74
+ {
75
+ type: "button",
76
+ onClick: execute,
77
+ className: buttonClass + " " + props.className,
78
+ children: props.children
79
+ }
80
+ ) });
81
+ };
82
+ var ClientButton_default = ClientButton;
83
+
84
+ // src/components/Confirm.tsx
85
+ import { Fragment, jsx as jsx2, jsxs } from "react/jsx-runtime";
86
+ var Confirm = ({ message, onConfirm, onCancel }) => {
87
+ const [showModal, setShowModal] = useState(true);
88
+ const handleConfirmAction = () => {
89
+ setShowModal(false);
90
+ if (onConfirm) {
91
+ onConfirm();
92
+ }
93
+ };
94
+ const handleCancelAction = () => {
95
+ setShowModal(false);
96
+ if (onCancel) {
97
+ onCancel();
98
+ }
99
+ };
100
+ return /* @__PURE__ */ jsx2(Fragment, { children: showModal && /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 flex items-center justify-center z-50", children: [
101
+ /* @__PURE__ */ jsx2("div", { className: "absolute inset-0 bg-black opacity-70" }),
102
+ /* @__PURE__ */ jsxs("div", { className: "bg-white rounded-md p-6 w-2/6 shadow border z-50", children: [
103
+ /* @__PURE__ */ jsx2("p", { className: "text-xl font-medium mb-4", children: "Confirmation" }),
104
+ /* @__PURE__ */ jsx2("p", { className: "mb-4", children: message }),
105
+ /* @__PURE__ */ jsxs("div", { className: "flex justify-end gap-8", children: [
106
+ /* @__PURE__ */ jsx2(
107
+ ClientButton_default,
108
+ {
109
+ onClick: handleCancelAction,
110
+ ButtonType: "PrimaryHollow" /* Hollow */,
111
+ children: "Cancel"
112
+ }
113
+ ),
114
+ /* @__PURE__ */ jsx2(
115
+ ClientButton_default,
116
+ {
117
+ onClick: handleConfirmAction,
118
+ children: "Confirm"
119
+ }
120
+ )
121
+ ] })
122
+ ] })
123
+ ] }) });
124
+ };
125
+ var Confirm_default = Confirm;
126
+ {
127
+ }
128
+
129
+ // src/components/Button.tsx
130
+ import { Fragment as Fragment2, jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
131
+ var Button = (props) => {
132
+ const [inProgress, setInProgress] = useState2(false);
133
+ const [isActionPerformed, setIsActionPerformed] = useState2(false);
134
+ const [responseMessage, setResponseMessage] = useState2(null);
135
+ const [showModal, setShowModal] = useState2(null);
136
+ const execute = async (event) => {
137
+ event.preventDefault();
138
+ event.stopPropagation();
139
+ if (props.confirm) {
140
+ const confirmed = await showConfirmation(
141
+ "Are you sure you want to delete this item?"
142
+ );
143
+ setShowModal(null);
144
+ if (!confirmed) {
145
+ return;
146
+ }
147
+ }
148
+ if (props.oneTimeAction && isActionPerformed) {
149
+ return;
150
+ }
151
+ setInProgress(true);
152
+ let isValid = true;
153
+ if (props.onValidate !== void 0) {
154
+ isValid = await props.onValidate();
155
+ if (!isValid) {
156
+ setInProgress(false);
157
+ ToastService_default.showError(
158
+ "There are errors in the form. Please fix them before proceeding."
159
+ );
160
+ return;
161
+ }
162
+ }
163
+ if (props.onClick !== void 0) {
164
+ let response = await props.onClick();
165
+ if (response.isSuccessful) {
166
+ setIsActionPerformed(true);
167
+ setResponseMessage(response.message);
168
+ if (props.showToast) {
169
+ ToastService_default.showInfo(response.message || "");
170
+ }
171
+ } else {
172
+ ToastService_default.showError(response.message || "");
173
+ }
174
+ } else {
175
+ ToastService_default.showError("No action defined.");
176
+ }
177
+ setInProgress(false);
178
+ };
179
+ const showConfirmation = (message) => {
180
+ return new Promise((resolve) => {
181
+ const onConfirm = () => resolve(true);
182
+ const onCancel = () => resolve(false);
183
+ setShowModal(
184
+ /* @__PURE__ */ jsx3(
185
+ Confirm_default,
186
+ {
187
+ message: props.confirmationMessage,
188
+ onConfirm,
189
+ onCancel
190
+ }
191
+ )
192
+ );
193
+ });
194
+ };
195
+ let buttonClass = props.ButtonType ? buttonClasses.get(props.ButtonType) : buttonClasses.get("Primary" /* Solid */);
196
+ let progressClass = props.ButtonType ? progressClasses.get(props.ButtonType) : progressClasses.get("Primary" /* Solid */);
197
+ const isDisabled = inProgress || isActionPerformed && props.oneTimeAction;
198
+ return /* @__PURE__ */ jsxs2(React3.Fragment, { children: [
199
+ /* @__PURE__ */ jsxs2(
200
+ "button",
201
+ {
202
+ type: "submit",
203
+ onClick: execute,
204
+ disabled: props.disabled,
205
+ title: isDisabled ? "The button is disabled to prevent any action" : "",
206
+ className: `${buttonClass} relative inline-flex items-center justify-center gap-2 ${props.className ?? ""}`,
207
+ children: [
208
+ isActionPerformed && props.oneTimeAction && responseMessage ? responseMessage : props.children,
209
+ 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(
210
+ "svg",
211
+ {
212
+ className: `animate-spin h-5 w-5 flex-shrink-0 ${progressClass}`,
213
+ xmlns: "http://www.w3.org/2000/svg",
214
+ fill: "none",
215
+ viewBox: "0 0 24 24",
216
+ children: [
217
+ /* @__PURE__ */ jsx3(
218
+ "circle",
219
+ {
220
+ className: "opacity-25",
221
+ cx: "12",
222
+ cy: "12",
223
+ r: "10",
224
+ stroke: "currentColor",
225
+ strokeWidth: "4"
226
+ }
227
+ ),
228
+ /* @__PURE__ */ jsx3(
229
+ "path",
230
+ {
231
+ className: "opacity-75",
232
+ fill: "currentColor",
233
+ 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"
234
+ }
235
+ )
236
+ ]
237
+ }
238
+ ) })
239
+ ]
240
+ }
241
+ ),
242
+ showModal
243
+ ] });
244
+ };
245
+ var Button_default = Button;
246
+
247
+ export {
248
+ ToastService_default,
249
+ ClientButton_default,
250
+ Button_default
251
+ };
@@ -39,7 +39,7 @@ var ServerApiError = class extends Error {
39
39
  this.data.isSuccessful = false;
40
40
  }
41
41
  };
42
- var ServiceClient = class {
42
+ var _ServiceClient = class _ServiceClient {
43
43
  constructor(apiBaseUrl, session) {
44
44
  this.cacheManager = CacheManager.getInstance();
45
45
  this.baseUrl = apiBaseUrl;
@@ -82,28 +82,42 @@ var ServiceClient = class {
82
82
  if (cachedData) {
83
83
  return cachedData;
84
84
  }
85
- console.log("*****************CALLING API:", cacheKey, (/* @__PURE__ */ new Date()).toISOString());
86
- const response = await fetch(fullPath, { headers: config.headers });
87
- if (!response.ok) {
88
- const apiErrorData = await response.json();
89
- throw new ServerApiError(apiErrorData, response.status);
85
+ const existingRequest = _ServiceClient.inFlightGetRequests.get(cacheKey);
86
+ if (existingRequest) {
87
+ return existingRequest;
90
88
  }
91
- const cacheControl = response.headers.get("Cache-Control");
92
- let revalidate = null;
93
- if (cacheControl) {
94
- const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
95
- if (maxAgeMatch && maxAgeMatch[1]) {
96
- const maxAge = parseInt(maxAgeMatch[1], 10);
97
- revalidate = maxAge * 1e3;
89
+ const request = (async () => {
90
+ console.log("*****************CALLING API:", cacheKey, (/* @__PURE__ */ new Date()).toISOString());
91
+ const response = await fetch(fullPath, { headers: config.headers });
92
+ if (!response.ok) {
93
+ const apiErrorData = await response.json();
94
+ throw new ServerApiError(apiErrorData, response.status);
95
+ }
96
+ const cacheControl = response.headers.get("Cache-Control");
97
+ let revalidate = null;
98
+ if (cacheControl) {
99
+ const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
100
+ if (maxAgeMatch && maxAgeMatch[1]) {
101
+ const maxAge = parseInt(maxAgeMatch[1], 10);
102
+ revalidate = maxAge * 1e3;
103
+ }
104
+ }
105
+ const data = await response.json();
106
+ data.isSuccessful = true;
107
+ if (revalidate !== null && revalidate > 0) {
108
+ console.log("revalidate............I am caching:" + revalidate);
109
+ this.cacheManager.set(cacheKey, data, revalidate);
110
+ }
111
+ return data;
112
+ })();
113
+ _ServiceClient.inFlightGetRequests.set(cacheKey, request);
114
+ try {
115
+ return await request;
116
+ } finally {
117
+ if (_ServiceClient.inFlightGetRequests.get(cacheKey) === request) {
118
+ _ServiceClient.inFlightGetRequests.delete(cacheKey);
98
119
  }
99
120
  }
100
- const data = await response.json();
101
- data.isSuccessful = true;
102
- if (revalidate !== null && revalidate > 0) {
103
- console.log("revalidate............I am caching:" + revalidate);
104
- this.cacheManager.set(cacheKey, data, revalidate);
105
- }
106
- return data;
107
121
  }
108
122
  // private async refreshToken(): Promise<void> {
109
123
  // console.log("*******************calling refresh token***********************");
@@ -200,6 +214,8 @@ var ServiceClient = class {
200
214
  }
201
215
  }
202
216
  };
217
+ _ServiceClient.inFlightGetRequests = /* @__PURE__ */ new Map();
218
+ var ServiceClient = _ServiceClient;
203
219
  var ServiceClient_default = ServiceClient;
204
220
 
205
221
  export {
@@ -0,0 +1,24 @@
1
+ // src/components/utilities/AssetUtility.tsx
2
+ var AssetUtility = class {
3
+ constructor() {
4
+ }
5
+ static resolveUrl(assetBaseUrl, url) {
6
+ if (!url) return void 0;
7
+ if (url.startsWith("http")) return url;
8
+ if (!assetBaseUrl) return url;
9
+ return `${assetBaseUrl}/${url}`;
10
+ }
11
+ // // static getAssetUrl(apiBaseUrl: string) {
12
+ // // let domainName = apiBaseUrl.replace("https://", "");
13
+ // // return `https://cdn.g-assets.com/${domainName}`;
14
+ // // }
15
+ // static getAssetFullPath(apiBaseUrl: string, relativePath: string) {
16
+ // const domainName = apiBaseUrl.replace("https://", "");
17
+ // return `https://cdn.g-assets.com/${domainName}/${relativePath}`;
18
+ // }
19
+ };
20
+ var AssetUtility_default = AssetUtility;
21
+
22
+ export {
23
+ AssetUtility_default
24
+ };
@@ -36,7 +36,7 @@ var ServerApiError = class extends Error {
36
36
  this.data.isSuccessful = false;
37
37
  }
38
38
  };
39
- var ServiceClient = class {
39
+ var _ServiceClient = class _ServiceClient {
40
40
  constructor(apiBaseUrl, session) {
41
41
  this.cacheManager = CacheManager.getInstance();
42
42
  this.baseUrl = apiBaseUrl;
@@ -79,28 +79,42 @@ var ServiceClient = class {
79
79
  if (cachedData) {
80
80
  return cachedData;
81
81
  }
82
- console.log("*****************CALLING API:", cacheKey, (/* @__PURE__ */ new Date()).toISOString());
83
- const response = await fetch(fullPath, { headers: config.headers });
84
- if (!response.ok) {
85
- const apiErrorData = await response.json();
86
- throw new ServerApiError(apiErrorData, response.status);
82
+ const existingRequest = _ServiceClient.inFlightGetRequests.get(cacheKey);
83
+ if (existingRequest) {
84
+ return existingRequest;
87
85
  }
88
- const cacheControl = response.headers.get("Cache-Control");
89
- let revalidate = null;
90
- if (cacheControl) {
91
- const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
92
- if (maxAgeMatch && maxAgeMatch[1]) {
93
- const maxAge = parseInt(maxAgeMatch[1], 10);
94
- revalidate = maxAge * 1e3;
86
+ const request = (async () => {
87
+ console.log("*****************CALLING API:", cacheKey, (/* @__PURE__ */ new Date()).toISOString());
88
+ const response = await fetch(fullPath, { headers: config.headers });
89
+ if (!response.ok) {
90
+ const apiErrorData = await response.json();
91
+ throw new ServerApiError(apiErrorData, response.status);
92
+ }
93
+ const cacheControl = response.headers.get("Cache-Control");
94
+ let revalidate = null;
95
+ if (cacheControl) {
96
+ const maxAgeMatch = cacheControl.match(/max-age=(\d+)/);
97
+ if (maxAgeMatch && maxAgeMatch[1]) {
98
+ const maxAge = parseInt(maxAgeMatch[1], 10);
99
+ revalidate = maxAge * 1e3;
100
+ }
101
+ }
102
+ const data = await response.json();
103
+ data.isSuccessful = true;
104
+ if (revalidate !== null && revalidate > 0) {
105
+ console.log("revalidate............I am caching:" + revalidate);
106
+ this.cacheManager.set(cacheKey, data, revalidate);
107
+ }
108
+ return data;
109
+ })();
110
+ _ServiceClient.inFlightGetRequests.set(cacheKey, request);
111
+ try {
112
+ return await request;
113
+ } finally {
114
+ if (_ServiceClient.inFlightGetRequests.get(cacheKey) === request) {
115
+ _ServiceClient.inFlightGetRequests.delete(cacheKey);
95
116
  }
96
117
  }
97
- const data = await response.json();
98
- data.isSuccessful = true;
99
- if (revalidate !== null && revalidate > 0) {
100
- console.log("revalidate............I am caching:" + revalidate);
101
- this.cacheManager.set(cacheKey, data, revalidate);
102
- }
103
- return data;
104
118
  }
105
119
  // private async refreshToken(): Promise<void> {
106
120
  // console.log("*******************calling refresh token***********************");
@@ -197,6 +211,8 @@ var ServiceClient = class {
197
211
  }
198
212
  }
199
213
  };
214
+ _ServiceClient.inFlightGetRequests = /* @__PURE__ */ new Map();
215
+ var ServiceClient = _ServiceClient;
200
216
  var ServiceClient_default = ServiceClient;
201
217
 
202
218
  export {