@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260704091052 → 0.8.1-dev.20260706110649
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/CopyButton-UPJPMJUB.mjs +57 -0
- package/dist/DateTimeViewClient-R3M6ISVK.mjs +16 -0
- package/dist/DateViewClient-VLTRN47D.mjs +9 -0
- package/dist/{chunk-SDNYBQSI.mjs → HlsPlayer-57543DTW.mjs} +3 -2
- package/dist/HlsPlayer-5AWFZ2P6.mjs +601 -0
- package/dist/IframeClient-RGJFZ5P2.mjs +98 -0
- package/dist/InputControlClient-NJV6B65M.mjs +604 -0
- package/dist/InputControlClient-OQDLYA4S.mjs +604 -0
- package/dist/InputControlClient-TW664WIJ.mjs +602 -0
- package/dist/{LinkNodeButton-WDDPNYWI.mjs → LinkNodeButton-FUL3J5HR.mjs} +6 -5
- package/dist/LinkNodeButton-IGJOGOKI.mjs +362 -0
- package/dist/LinkNodeButton-ZONM74OO.mjs +174 -0
- package/dist/Pagination-6OFACRMQ.mjs +229 -0
- package/dist/Pagination-FSYLYKUA.mjs +181 -0
- package/dist/Pagination-YCD5CU2L.mjs +183 -0
- package/dist/Slider-554BKC7N.mjs +322 -0
- package/dist/Slider-PEIVH6A5.mjs +320 -0
- package/dist/chunk-2GSYECIS.mjs +109 -0
- package/dist/chunk-3GWLDT7C.mjs +204 -0
- package/dist/chunk-3R4VVVNK.mjs +903 -0
- package/dist/chunk-47HD7QP7.mjs +199 -0
- package/dist/chunk-56HSDML5.mjs +22 -0
- package/dist/chunk-67IG5NBU.mjs +200 -0
- package/dist/chunk-7ZFZLN56.mjs +903 -0
- package/dist/chunk-CM7LUGCH.mjs +107 -0
- package/dist/chunk-IKIXEQPV.mjs +198 -0
- package/dist/chunk-IMNQO57B.mjs +25 -0
- package/dist/chunk-R2HV35IB.mjs +201 -0
- package/dist/chunk-SPRVN5IM.mjs +118 -0
- package/dist/chunk-TVL6KVD5.mjs +229 -0
- package/dist/chunk-WEV5U33G.mjs +207 -0
- package/dist/chunk-YG6FKKQJ.mjs +900 -0
- package/dist/index.d.mts +57 -170
- package/dist/index.d.ts +57 -170
- package/dist/index.js +3938 -3807
- package/dist/index.mjs +588 -2922
- package/dist/server.d.mts +72 -0
- package/dist/server.d.ts +72 -0
- package/dist/server.js +5126 -0
- package/dist/server.mjs +2698 -0
- package/package.json +18 -4
- package/dist/HlsPlayer-DZNDKG2P.mjs +0 -7
- package/dist/chunk-DOKQUUH3.mjs +0 -414
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import {
|
|
4
|
+
buttonClasses
|
|
5
|
+
} from "./chunk-IMNQO57B.mjs";
|
|
6
|
+
|
|
7
|
+
// src/components/controls/edit/InputControlType.tsx
|
|
8
|
+
var Constants = {
|
|
9
|
+
pagesize: 10
|
|
10
|
+
};
|
|
11
|
+
var InputControlType = {
|
|
12
|
+
lineTextInput: "text",
|
|
13
|
+
multilineTextInput: "multilinetext",
|
|
14
|
+
emailInput: "email",
|
|
15
|
+
moneyInput: "money",
|
|
16
|
+
select: "select",
|
|
17
|
+
percentageInput: "percentage",
|
|
18
|
+
asset: "asset",
|
|
19
|
+
phoneInput: "phone",
|
|
20
|
+
numberInput: "number",
|
|
21
|
+
checkboxInput: "boolean",
|
|
22
|
+
otpInput: "otp",
|
|
23
|
+
datetimeInput: "datetime",
|
|
24
|
+
timeInput: "time",
|
|
25
|
+
colorInput: "colorInput",
|
|
26
|
+
selectWithSearchInput: "selectWithSearchInput",
|
|
27
|
+
selectWithSearchPanel: "selectWithSearchPanel",
|
|
28
|
+
booleanSelect: "booleanSelect"
|
|
29
|
+
};
|
|
30
|
+
var InputControlType_default = InputControlType;
|
|
31
|
+
|
|
32
|
+
// src/components/dataForm/Hyperlink.tsx
|
|
33
|
+
import Link from "next/link";
|
|
34
|
+
import { Fragment, jsx } from "react/jsx-runtime";
|
|
35
|
+
function Hyperlink(props) {
|
|
36
|
+
let linkClass = props.linkType ? buttonClasses.get(props.linkType) : buttonClasses.get("Link" /* Link */);
|
|
37
|
+
const target = props?.href?.startsWith("http") ? "_blank" : "_self";
|
|
38
|
+
const additionalProps = {};
|
|
39
|
+
if (target == "_blank") {
|
|
40
|
+
additionalProps.rel = "noopener noreferrer";
|
|
41
|
+
}
|
|
42
|
+
return /* @__PURE__ */ jsx(Fragment, { children: props.href ? /* @__PURE__ */ jsx(
|
|
43
|
+
Link,
|
|
44
|
+
{
|
|
45
|
+
href: props.href,
|
|
46
|
+
prefetch: false,
|
|
47
|
+
className: [linkClass, props.className].filter(Boolean).join(" "),
|
|
48
|
+
...additionalProps,
|
|
49
|
+
target,
|
|
50
|
+
children: props.children
|
|
51
|
+
}
|
|
52
|
+
) : props.isHeading ? /* @__PURE__ */ jsx("h5", { className: props.className + "inline-block", children: props.children }) : /* @__PURE__ */ jsx("span", { className: props.className, children: props.children }) });
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// src/svg/chevron-updown.tsx
|
|
56
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
57
|
+
var ChevronUpDown = (props) => {
|
|
58
|
+
return /* @__PURE__ */ jsx2("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx2("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M8.25 15L12 18.75 15.75 15m-7.5-6L12 5.25 15.75 9" }) });
|
|
59
|
+
};
|
|
60
|
+
var chevron_updown_default = ChevronUpDown;
|
|
61
|
+
|
|
62
|
+
// src/svg/chevron-down.tsx
|
|
63
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
64
|
+
var ChevronDown = (props) => {
|
|
65
|
+
return /* @__PURE__ */ jsx3("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx3("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 8.25l-7.5 7.5-7.5-7.5" }) });
|
|
66
|
+
};
|
|
67
|
+
var chevron_down_default = ChevronDown;
|
|
68
|
+
|
|
69
|
+
// src/svg/chevron-up.tsx
|
|
70
|
+
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
71
|
+
var ChevronUp = (props) => {
|
|
72
|
+
return /* @__PURE__ */ jsx4("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx4("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M4.5 15.75l7.5-7.5 7.5 7.5" }) });
|
|
73
|
+
};
|
|
74
|
+
var chevron_up_default = ChevronUp;
|
|
75
|
+
|
|
76
|
+
// src/svg/plus.tsx
|
|
77
|
+
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
78
|
+
var Plus = (props) => {
|
|
79
|
+
return /* @__PURE__ */ jsx5("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", className: props.className, children: /* @__PURE__ */ jsx5("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M12 4.5v15m7.5-7.5h-15" }) });
|
|
80
|
+
};
|
|
81
|
+
var plus_default = Plus;
|
|
82
|
+
|
|
83
|
+
// src/svg/Icons.tsx
|
|
84
|
+
var Icons = {
|
|
85
|
+
chevronUpDown: chevron_updown_default,
|
|
86
|
+
chevronDown: chevron_down_default,
|
|
87
|
+
chevronUp: chevron_up_default,
|
|
88
|
+
plus: plus_default
|
|
89
|
+
};
|
|
90
|
+
var Icons_default = Icons;
|
|
91
|
+
|
|
92
|
+
// src/svg/Icon.tsx
|
|
93
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
94
|
+
var Icon = ({ name, className, ...props }) => {
|
|
95
|
+
const IconComponent = Icons_default[name];
|
|
96
|
+
if (!IconComponent) {
|
|
97
|
+
console.error(`Icon "${name}" not found.`);
|
|
98
|
+
return null;
|
|
99
|
+
}
|
|
100
|
+
return /* @__PURE__ */ jsx6(IconComponent, { ...props, className });
|
|
101
|
+
};
|
|
102
|
+
var Icon_default = Icon;
|
|
103
|
+
|
|
104
|
+
export {
|
|
105
|
+
Constants,
|
|
106
|
+
InputControlType_default,
|
|
107
|
+
Hyperlink,
|
|
108
|
+
Icon_default
|
|
109
|
+
};
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
// src/clients/CacheManage.tsx
|
|
2
|
+
import NodeCache from "node-cache";
|
|
3
|
+
var CacheManager = class _CacheManager {
|
|
4
|
+
constructor() {
|
|
5
|
+
this.maxCacheSize = 1e3;
|
|
6
|
+
this.cache = new NodeCache({ stdTTL: 0, checkperiod: 300 });
|
|
7
|
+
}
|
|
8
|
+
static getInstance() {
|
|
9
|
+
if (!_CacheManager.instance) {
|
|
10
|
+
_CacheManager.instance = new _CacheManager();
|
|
11
|
+
}
|
|
12
|
+
return _CacheManager.instance;
|
|
13
|
+
}
|
|
14
|
+
get(key) {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
set(key, data, ttl) {
|
|
18
|
+
}
|
|
19
|
+
clear() {
|
|
20
|
+
this.cache.flushAll();
|
|
21
|
+
}
|
|
22
|
+
size() {
|
|
23
|
+
return this.cache.keys().length;
|
|
24
|
+
}
|
|
25
|
+
destroy() {
|
|
26
|
+
this.cache.close();
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
// src/clients/ServiceClient.tsx
|
|
31
|
+
var ServerApiError = class extends Error {
|
|
32
|
+
constructor(data, status) {
|
|
33
|
+
super(data.message || "---");
|
|
34
|
+
this.status = status;
|
|
35
|
+
this.data = data;
|
|
36
|
+
this.data.isSuccessful = false;
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
var ServiceClient = class {
|
|
40
|
+
constructor(apiBaseUrl, session) {
|
|
41
|
+
this.cacheManager = CacheManager.getInstance();
|
|
42
|
+
this.baseUrl = apiBaseUrl;
|
|
43
|
+
this.session = session;
|
|
44
|
+
}
|
|
45
|
+
buildFullPath(path, params) {
|
|
46
|
+
let updatedPath = path;
|
|
47
|
+
if (params) {
|
|
48
|
+
Object.keys(params).forEach((key) => {
|
|
49
|
+
updatedPath = updatedPath.replace(
|
|
50
|
+
`{${key}}`,
|
|
51
|
+
String(params[key])
|
|
52
|
+
);
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return this.baseUrl + updatedPath;
|
|
56
|
+
}
|
|
57
|
+
getConfig() {
|
|
58
|
+
const config = { headers: {} };
|
|
59
|
+
if (this.session) {
|
|
60
|
+
if (this.session.oAuthToken) {
|
|
61
|
+
config.headers["Authorization"] = "Bearer " + this.session.oAuthToken;
|
|
62
|
+
}
|
|
63
|
+
config.headers["cid"] = this.session.cid || "";
|
|
64
|
+
config.headers["UserCurrencyCode"] = this.session.userCurrencyCode || "INR";
|
|
65
|
+
config.headers["MarketCode"] = this.session?.marketCode || "IND";
|
|
66
|
+
}
|
|
67
|
+
return config;
|
|
68
|
+
}
|
|
69
|
+
handleFetchError(error) {
|
|
70
|
+
console.log(error);
|
|
71
|
+
return {
|
|
72
|
+
message: error.message || "There is some error. Please try after sometime.",
|
|
73
|
+
isSuccessful: false
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
async fetchJsonWithCache(fullPath, config) {
|
|
77
|
+
const cacheKey = fullPath + "--" + (this.session?.marketCode || "IND");
|
|
78
|
+
const cachedData = this.cacheManager.get(cacheKey);
|
|
79
|
+
if (cachedData) {
|
|
80
|
+
return cachedData;
|
|
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);
|
|
87
|
+
}
|
|
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;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
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
|
+
}
|
|
105
|
+
// private async refreshToken(): Promise<void> {
|
|
106
|
+
// console.log("*******************calling refresh token***********************");
|
|
107
|
+
// try {
|
|
108
|
+
// const response = await fetch(this.baseUrl + "/auth/storefront/login/refreshToken", {
|
|
109
|
+
// method: 'POST',
|
|
110
|
+
// headers: {
|
|
111
|
+
// 'Content-Type': 'application/json'
|
|
112
|
+
// },
|
|
113
|
+
// body: JSON.stringify({ refreshToken: this.session.refreshToken })
|
|
114
|
+
// });
|
|
115
|
+
// if (!response.ok) {
|
|
116
|
+
// throw new Error("Failed to refresh token");
|
|
117
|
+
// }
|
|
118
|
+
// const responseData = await response.json();
|
|
119
|
+
// this.session.oAuthToken = responseData.result.accessToken;
|
|
120
|
+
// if (typeof window === "undefined") {
|
|
121
|
+
// // Running on the server
|
|
122
|
+
// } else {
|
|
123
|
+
// await fetch("/api/login", {
|
|
124
|
+
// method: "post",
|
|
125
|
+
// headers: {
|
|
126
|
+
// "Content-Type": "application/json",
|
|
127
|
+
// },
|
|
128
|
+
// body: JSON.stringify({ session: this.session }),
|
|
129
|
+
// });
|
|
130
|
+
// }
|
|
131
|
+
// } catch (error: any) {
|
|
132
|
+
// throw new Error("Failed to refresh token");
|
|
133
|
+
// }
|
|
134
|
+
// }
|
|
135
|
+
async handleRequest(request) {
|
|
136
|
+
try {
|
|
137
|
+
return await request();
|
|
138
|
+
} catch (error) {
|
|
139
|
+
throw error;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
async post(path, data) {
|
|
143
|
+
const request = async () => {
|
|
144
|
+
const fullPath = this.baseUrl + path;
|
|
145
|
+
const config = this.getConfig();
|
|
146
|
+
const response = await fetch(fullPath, {
|
|
147
|
+
method: "POST",
|
|
148
|
+
headers: {
|
|
149
|
+
...config.headers,
|
|
150
|
+
"Content-Type": "application/json"
|
|
151
|
+
},
|
|
152
|
+
body: JSON.stringify(data)
|
|
153
|
+
});
|
|
154
|
+
if (!response.ok) {
|
|
155
|
+
const apiErrorData = await response.json();
|
|
156
|
+
throw new ServerApiError(apiErrorData, response.status);
|
|
157
|
+
}
|
|
158
|
+
const responseData = await response.json();
|
|
159
|
+
responseData.isSuccessful = true;
|
|
160
|
+
return responseData;
|
|
161
|
+
};
|
|
162
|
+
try {
|
|
163
|
+
return await this.handleRequest(request);
|
|
164
|
+
} catch (error) {
|
|
165
|
+
return this.handleFetchError(error);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async getSingle(path, params) {
|
|
169
|
+
const request = async () => {
|
|
170
|
+
const sanitizedParams = params ? Object.fromEntries(
|
|
171
|
+
Object.entries(params).map(([k, v]) => [k, String(v)])
|
|
172
|
+
) : void 0;
|
|
173
|
+
const fullPath = this.buildFullPath(path, sanitizedParams);
|
|
174
|
+
const config = this.getConfig();
|
|
175
|
+
return await this.fetchJsonWithCache(fullPath, config);
|
|
176
|
+
};
|
|
177
|
+
try {
|
|
178
|
+
return await this.handleRequest(request);
|
|
179
|
+
} catch (error) {
|
|
180
|
+
return this.handleFetchError(error);
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
async get(path, params) {
|
|
184
|
+
const request = async () => {
|
|
185
|
+
const sanitizedParams = params ? Object.fromEntries(
|
|
186
|
+
Object.entries(params).map(([k, v]) => [k, String(v)])
|
|
187
|
+
) : void 0;
|
|
188
|
+
const fullPath = this.buildFullPath(path, sanitizedParams);
|
|
189
|
+
const config = this.getConfig();
|
|
190
|
+
console.log(fullPath);
|
|
191
|
+
return await this.fetchJsonWithCache(fullPath, config);
|
|
192
|
+
};
|
|
193
|
+
try {
|
|
194
|
+
return await this.handleRequest(request);
|
|
195
|
+
} catch (error) {
|
|
196
|
+
return this.handleFetchError(error);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
};
|
|
200
|
+
var ServiceClient_default = ServiceClient;
|
|
201
|
+
|
|
202
|
+
export {
|
|
203
|
+
ServiceClient_default
|
|
204
|
+
};
|