@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260519071902 → 0.8.1-dev.20260521120239
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.
|
@@ -53,6 +53,7 @@ var HlsPlayer = React.memo(
|
|
|
53
53
|
const wasManuallyPausedRef = useRef(false);
|
|
54
54
|
const inactivityTimerRef = useRef(null);
|
|
55
55
|
const clickTimerRef = useRef(null);
|
|
56
|
+
const hlsInitializedRef = useRef(false);
|
|
56
57
|
const INACTIVITY_DELAY = 2500;
|
|
57
58
|
const CLICK_DEBOUNCE = 220;
|
|
58
59
|
const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl, posterUrl }] : [];
|
|
@@ -110,7 +111,7 @@ var HlsPlayer = React.memo(
|
|
|
110
111
|
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
111
112
|
};
|
|
112
113
|
}, []);
|
|
113
|
-
|
|
114
|
+
const initHls = useCallback((autoPlayAfterLoad) => {
|
|
114
115
|
const v = videoRef.current;
|
|
115
116
|
if (!v || resolvedSources.length === 0) return;
|
|
116
117
|
if (hlsRef.current) {
|
|
@@ -119,25 +120,39 @@ var HlsPlayer = React.memo(
|
|
|
119
120
|
}
|
|
120
121
|
const chosenSrc = pickSource(resolvedSources);
|
|
121
122
|
if (!chosenSrc) return;
|
|
123
|
+
hlsInitializedRef.current = true;
|
|
122
124
|
if (Hls.isSupported()) {
|
|
123
125
|
const hls = new Hls();
|
|
124
126
|
hls.loadSource(chosenSrc);
|
|
125
127
|
hls.attachMedia(v);
|
|
126
128
|
hls.on(Hls.Events.MANIFEST_PARSED, () => {
|
|
127
|
-
if (
|
|
128
|
-
v.play().catch(console.error);
|
|
129
|
+
if (autoPlayAfterLoad && !wasManuallyPausedRef.current) {
|
|
130
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
129
131
|
}
|
|
130
132
|
});
|
|
131
133
|
hlsRef.current = hls;
|
|
132
|
-
return () => {
|
|
133
|
-
hls.destroy();
|
|
134
|
-
hlsRef.current = null;
|
|
135
|
-
};
|
|
136
134
|
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
137
135
|
v.src = chosenSrc;
|
|
138
136
|
v.load();
|
|
137
|
+
if (autoPlayAfterLoad) {
|
|
138
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
139
|
+
}
|
|
139
140
|
}
|
|
140
141
|
}, [JSON.stringify(resolvedSources)]);
|
|
142
|
+
useEffect(() => {
|
|
143
|
+
if (isPlayOnHover) return;
|
|
144
|
+
initHls(
|
|
145
|
+
/* autoPlayAfterLoad */
|
|
146
|
+
playOptions === "autoplay"
|
|
147
|
+
);
|
|
148
|
+
return () => {
|
|
149
|
+
if (hlsRef.current) {
|
|
150
|
+
hlsRef.current.destroy();
|
|
151
|
+
hlsRef.current = null;
|
|
152
|
+
}
|
|
153
|
+
hlsInitializedRef.current = false;
|
|
154
|
+
};
|
|
155
|
+
}, [JSON.stringify(resolvedSources), isPlayOnHover]);
|
|
141
156
|
const handlePlayPause = useCallback(() => {
|
|
142
157
|
const v = videoRef.current;
|
|
143
158
|
if (!v) return;
|
|
@@ -182,10 +197,17 @@ var HlsPlayer = React.memo(
|
|
|
182
197
|
if (isMobile) return;
|
|
183
198
|
setIsHovered(true);
|
|
184
199
|
resetInactivityTimer();
|
|
185
|
-
if (isPlayOnHover &&
|
|
186
|
-
|
|
200
|
+
if (isPlayOnHover && !wasManuallyPausedRef.current) {
|
|
201
|
+
if (!hlsInitializedRef.current) {
|
|
202
|
+
initHls(
|
|
203
|
+
/* autoPlayAfterLoad */
|
|
204
|
+
true
|
|
205
|
+
);
|
|
206
|
+
} else if (videoRef.current) {
|
|
207
|
+
videoRef.current.play().then(() => setIsPlaying(true)).catch(console.error);
|
|
208
|
+
}
|
|
187
209
|
}
|
|
188
|
-
}, [isPlayOnHover, isMobile, resetInactivityTimer]);
|
|
210
|
+
}, [isPlayOnHover, isMobile, resetInactivityTimer, initHls]);
|
|
189
211
|
const handleMouseLeave = useCallback(() => {
|
|
190
212
|
if (isMobile) return;
|
|
191
213
|
setIsHovered(false);
|
|
@@ -247,9 +269,10 @@ var HlsPlayer = React.memo(
|
|
|
247
269
|
autoPlay: playOptions === "autoplay",
|
|
248
270
|
loop,
|
|
249
271
|
playsInline: true,
|
|
272
|
+
preload: isPlayOnHover ? "none" : "auto",
|
|
250
273
|
onClick: handleVideoClick,
|
|
251
274
|
onDoubleClick: handleVideoDoubleClick,
|
|
252
|
-
children: resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ jsx(
|
|
275
|
+
children: !isPlayOnHover && resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ jsx(
|
|
253
276
|
"source",
|
|
254
277
|
{
|
|
255
278
|
src,
|
package/dist/index.d.mts
CHANGED
|
@@ -5,9 +5,11 @@ interface ViewControlProps {
|
|
|
5
5
|
value?: any;
|
|
6
6
|
controlType?: string;
|
|
7
7
|
format?: string;
|
|
8
|
+
unit?: string;
|
|
8
9
|
width?: string;
|
|
9
10
|
apiBaseUrl?: string;
|
|
10
11
|
customProps?: Record<string, unknown>;
|
|
12
|
+
session?: any;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
declare const ViewControl: React.FC<ViewControlProps>;
|
package/dist/index.d.ts
CHANGED
|
@@ -5,9 +5,11 @@ interface ViewControlProps {
|
|
|
5
5
|
value?: any;
|
|
6
6
|
controlType?: string;
|
|
7
7
|
format?: string;
|
|
8
|
+
unit?: string;
|
|
8
9
|
width?: string;
|
|
9
10
|
apiBaseUrl?: string;
|
|
10
11
|
customProps?: Record<string, unknown>;
|
|
12
|
+
session?: any;
|
|
11
13
|
}
|
|
12
14
|
|
|
13
15
|
declare const ViewControl: React.FC<ViewControlProps>;
|
package/dist/index.js
CHANGED
|
@@ -478,6 +478,7 @@ var init_HlsPlayer = __esm({
|
|
|
478
478
|
const wasManuallyPausedRef = (0, import_react32.useRef)(false);
|
|
479
479
|
const inactivityTimerRef = (0, import_react32.useRef)(null);
|
|
480
480
|
const clickTimerRef = (0, import_react32.useRef)(null);
|
|
481
|
+
const hlsInitializedRef = (0, import_react32.useRef)(false);
|
|
481
482
|
const INACTIVITY_DELAY = 2500;
|
|
482
483
|
const CLICK_DEBOUNCE = 220;
|
|
483
484
|
const resolvedSources = sources && sources.length > 0 ? sources : assetUrl ? [{ src: assetUrl, posterUrl }] : [];
|
|
@@ -535,7 +536,7 @@ var init_HlsPlayer = __esm({
|
|
|
535
536
|
if (clickTimerRef.current) clearTimeout(clickTimerRef.current);
|
|
536
537
|
};
|
|
537
538
|
}, []);
|
|
538
|
-
(0, import_react32.
|
|
539
|
+
const initHls = (0, import_react32.useCallback)((autoPlayAfterLoad) => {
|
|
539
540
|
const v = videoRef.current;
|
|
540
541
|
if (!v || resolvedSources.length === 0) return;
|
|
541
542
|
if (hlsRef.current) {
|
|
@@ -544,25 +545,39 @@ var init_HlsPlayer = __esm({
|
|
|
544
545
|
}
|
|
545
546
|
const chosenSrc = pickSource(resolvedSources);
|
|
546
547
|
if (!chosenSrc) return;
|
|
548
|
+
hlsInitializedRef.current = true;
|
|
547
549
|
if (import_hls.default.isSupported()) {
|
|
548
550
|
const hls = new import_hls.default();
|
|
549
551
|
hls.loadSource(chosenSrc);
|
|
550
552
|
hls.attachMedia(v);
|
|
551
553
|
hls.on(import_hls.default.Events.MANIFEST_PARSED, () => {
|
|
552
|
-
if (
|
|
553
|
-
v.play().catch(console.error);
|
|
554
|
+
if (autoPlayAfterLoad && !wasManuallyPausedRef.current) {
|
|
555
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
554
556
|
}
|
|
555
557
|
});
|
|
556
558
|
hlsRef.current = hls;
|
|
557
|
-
return () => {
|
|
558
|
-
hls.destroy();
|
|
559
|
-
hlsRef.current = null;
|
|
560
|
-
};
|
|
561
559
|
} else if (v.canPlayType("application/vnd.apple.mpegurl")) {
|
|
562
560
|
v.src = chosenSrc;
|
|
563
561
|
v.load();
|
|
562
|
+
if (autoPlayAfterLoad) {
|
|
563
|
+
v.play().catch(console.error).then(() => setIsPlaying(true));
|
|
564
|
+
}
|
|
564
565
|
}
|
|
565
566
|
}, [JSON.stringify(resolvedSources)]);
|
|
567
|
+
(0, import_react32.useEffect)(() => {
|
|
568
|
+
if (isPlayOnHover) return;
|
|
569
|
+
initHls(
|
|
570
|
+
/* autoPlayAfterLoad */
|
|
571
|
+
playOptions === "autoplay"
|
|
572
|
+
);
|
|
573
|
+
return () => {
|
|
574
|
+
if (hlsRef.current) {
|
|
575
|
+
hlsRef.current.destroy();
|
|
576
|
+
hlsRef.current = null;
|
|
577
|
+
}
|
|
578
|
+
hlsInitializedRef.current = false;
|
|
579
|
+
};
|
|
580
|
+
}, [JSON.stringify(resolvedSources), isPlayOnHover]);
|
|
566
581
|
const handlePlayPause = (0, import_react32.useCallback)(() => {
|
|
567
582
|
const v = videoRef.current;
|
|
568
583
|
if (!v) return;
|
|
@@ -607,10 +622,17 @@ var init_HlsPlayer = __esm({
|
|
|
607
622
|
if (isMobile) return;
|
|
608
623
|
setIsHovered(true);
|
|
609
624
|
resetInactivityTimer();
|
|
610
|
-
if (isPlayOnHover &&
|
|
611
|
-
|
|
625
|
+
if (isPlayOnHover && !wasManuallyPausedRef.current) {
|
|
626
|
+
if (!hlsInitializedRef.current) {
|
|
627
|
+
initHls(
|
|
628
|
+
/* autoPlayAfterLoad */
|
|
629
|
+
true
|
|
630
|
+
);
|
|
631
|
+
} else if (videoRef.current) {
|
|
632
|
+
videoRef.current.play().then(() => setIsPlaying(true)).catch(console.error);
|
|
633
|
+
}
|
|
612
634
|
}
|
|
613
|
-
}, [isPlayOnHover, isMobile, resetInactivityTimer]);
|
|
635
|
+
}, [isPlayOnHover, isMobile, resetInactivityTimer, initHls]);
|
|
614
636
|
const handleMouseLeave = (0, import_react32.useCallback)(() => {
|
|
615
637
|
if (isMobile) return;
|
|
616
638
|
setIsHovered(false);
|
|
@@ -672,9 +694,10 @@ var init_HlsPlayer = __esm({
|
|
|
672
694
|
autoPlay: playOptions === "autoplay",
|
|
673
695
|
loop,
|
|
674
696
|
playsInline: true,
|
|
697
|
+
preload: isPlayOnHover ? "none" : "auto",
|
|
675
698
|
onClick: handleVideoClick,
|
|
676
699
|
onDoubleClick: handleVideoDoubleClick,
|
|
677
|
-
children: resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
700
|
+
children: !isPlayOnHover && resolvedSources.map(({ src, media }, i) => /* @__PURE__ */ (0, import_jsx_runtime42.jsx)(
|
|
678
701
|
"source",
|
|
679
702
|
{
|
|
680
703
|
src,
|
|
@@ -1566,11 +1589,31 @@ var LineTextView_default = LineText;
|
|
|
1566
1589
|
|
|
1567
1590
|
// src/components/controls/view/MoneyView.tsx
|
|
1568
1591
|
var import_react5 = __toESM(require("react"));
|
|
1592
|
+
|
|
1593
|
+
// src/components/utilities/CurrencyUtility.tsx
|
|
1594
|
+
var CurrencyUtility = class {
|
|
1595
|
+
static getCurrencySymbol(currencyCode) {
|
|
1596
|
+
switch (currencyCode) {
|
|
1597
|
+
case "USD":
|
|
1598
|
+
return "$";
|
|
1599
|
+
case "INR":
|
|
1600
|
+
return "\u20B9";
|
|
1601
|
+
case "EUR":
|
|
1602
|
+
return "\u20AC";
|
|
1603
|
+
// Add more cases for other currency codes as needed
|
|
1604
|
+
default:
|
|
1605
|
+
return currencyCode;
|
|
1606
|
+
}
|
|
1607
|
+
}
|
|
1608
|
+
};
|
|
1609
|
+
var CurrencyUtility_default = CurrencyUtility;
|
|
1610
|
+
|
|
1611
|
+
// src/components/controls/view/MoneyView.tsx
|
|
1569
1612
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1570
1613
|
var Money = (props) => {
|
|
1571
1614
|
const parsedNumber = parseFloat(props.value);
|
|
1572
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react5.default.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
|
|
1573
|
-
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mr-0.5", children:
|
|
1615
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_react5.default.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_react5.default.Fragment, { children: [
|
|
1616
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("span", { className: "mr-0.5", children: CurrencyUtility_default.getCurrencySymbol(props.unit) }),
|
|
1574
1617
|
parsedNumber.toLocaleString()
|
|
1575
1618
|
] }) });
|
|
1576
1619
|
};
|
package/dist/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
HlsPlayer_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-72PHGKW4.mjs";
|
|
4
4
|
import {
|
|
5
5
|
Button_default,
|
|
6
6
|
ClientButton_default,
|
|
@@ -103,11 +103,31 @@ var LineTextView_default = LineText;
|
|
|
103
103
|
|
|
104
104
|
// src/components/controls/view/MoneyView.tsx
|
|
105
105
|
import React4 from "react";
|
|
106
|
+
|
|
107
|
+
// src/components/utilities/CurrencyUtility.tsx
|
|
108
|
+
var CurrencyUtility = class {
|
|
109
|
+
static getCurrencySymbol(currencyCode) {
|
|
110
|
+
switch (currencyCode) {
|
|
111
|
+
case "USD":
|
|
112
|
+
return "$";
|
|
113
|
+
case "INR":
|
|
114
|
+
return "\u20B9";
|
|
115
|
+
case "EUR":
|
|
116
|
+
return "\u20AC";
|
|
117
|
+
// Add more cases for other currency codes as needed
|
|
118
|
+
default:
|
|
119
|
+
return currencyCode;
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
};
|
|
123
|
+
var CurrencyUtility_default = CurrencyUtility;
|
|
124
|
+
|
|
125
|
+
// src/components/controls/view/MoneyView.tsx
|
|
106
126
|
import { jsx as jsx4, jsxs } from "react/jsx-runtime";
|
|
107
127
|
var Money = (props) => {
|
|
108
128
|
const parsedNumber = parseFloat(props.value);
|
|
109
|
-
return /* @__PURE__ */ jsx4(React4.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ jsxs(
|
|
110
|
-
/* @__PURE__ */ jsx4("span", { className: "mr-0.5", children:
|
|
129
|
+
return /* @__PURE__ */ jsx4(React4.Fragment, { children: !Number.isNaN(parsedNumber) && /* @__PURE__ */ jsxs(React4.Fragment, { children: [
|
|
130
|
+
/* @__PURE__ */ jsx4("span", { className: "mr-0.5", children: CurrencyUtility_default.getCurrencySymbol(props.unit) }),
|
|
111
131
|
parsedNumber.toLocaleString()
|
|
112
132
|
] }) });
|
|
113
133
|
};
|
|
@@ -1969,7 +1989,7 @@ var DeviceAssetSelector_default = DeviceAssetSelector;
|
|
|
1969
1989
|
|
|
1970
1990
|
// src/components/pageRenderingEngine/nodes/ImageNode.tsx
|
|
1971
1991
|
import { Fragment as Fragment2, jsx as jsx37 } from "react/jsx-runtime";
|
|
1972
|
-
var HlsPlayer = dynamic3(() => import("./HlsPlayer-
|
|
1992
|
+
var HlsPlayer = dynamic3(() => import("./HlsPlayer-GZR4QXJY.mjs"), {
|
|
1973
1993
|
ssr: false
|
|
1974
1994
|
});
|
|
1975
1995
|
var getNestedValue = (obj, path) => {
|
|
@@ -3651,7 +3671,7 @@ var Pagination_default = Pagination;
|
|
|
3651
3671
|
// src/components/pageRenderingEngine/nodes/ImageGalleryNode.tsx
|
|
3652
3672
|
import dynamic7 from "next/dynamic";
|
|
3653
3673
|
import { Fragment as Fragment8, jsx as jsx56, jsxs as jsxs31 } from "react/jsx-runtime";
|
|
3654
|
-
var HlsPlayer2 = dynamic7(() => import("./HlsPlayer-
|
|
3674
|
+
var HlsPlayer2 = dynamic7(() => import("./HlsPlayer-GZR4QXJY.mjs"), { ssr: false });
|
|
3655
3675
|
var deviceToMediaQuery = (device) => {
|
|
3656
3676
|
switch (device) {
|
|
3657
3677
|
case "sm":
|
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.20260521120239",
|
|
4
4
|
"description": "Reusable React components",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"devDependencies": {
|
|
25
|
-
"@types/node": "^25.9.
|
|
25
|
+
"@types/node": "^25.9.1",
|
|
26
26
|
"@types/react": "^19",
|
|
27
27
|
"@types/react-dom": "^19",
|
|
28
28
|
"tsup": "^8.5.1",
|