@acoustte-digital-services/digitalstore-controls-dev 0.8.1-dev.20260713054521 → 0.8.1-dev.20260713054732

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.
@@ -16,9 +16,8 @@ import {
16
16
  PercentageInput_default,
17
17
  PhoneInput_default,
18
18
  SelectWithSearchInput_default,
19
- TimeInput_default,
20
- VideoView_default
21
- } from "./chunk-6NCGSAPP.mjs";
19
+ TimeInput_default
20
+ } from "./chunk-7ZFZLN56.mjs";
22
21
  import {
23
22
  Hyperlink,
24
23
  Icon_default,
@@ -643,97 +642,8 @@ var SwitchInput = (props) => {
643
642
  };
644
643
  var SwitchInput_default = SwitchInput;
645
644
 
646
- // src/components/controls/edit/VideoInput.tsx
647
- import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
648
- var normalizeVideoValue = (value) => {
649
- if (typeof value === "string") {
650
- const trimmed = value.trim();
651
- if (!trimmed) return void 0;
652
- try {
653
- const parsed = JSON.parse(trimmed);
654
- if (typeof parsed === "string") {
655
- return parsed;
656
- }
657
- if (parsed && typeof parsed === "object") {
658
- const candidate = parsed;
659
- if (typeof candidate.assetUrl === "string") return candidate.assetUrl;
660
- if (typeof candidate.url === "string") return candidate.url;
661
- if (typeof candidate.src === "string") return candidate.src;
662
- }
663
- } catch {
664
- return trimmed;
665
- }
666
- return trimmed;
667
- }
668
- if (value && typeof value === "object") {
669
- const candidate = value;
670
- if (typeof candidate.assetUrl === "string") return candidate.assetUrl;
671
- if (typeof candidate.url === "string") return candidate.url;
672
- if (typeof candidate.src === "string") return candidate.src;
673
- }
674
- return void 0;
675
- };
676
- var VideoInput = (props) => {
677
- const isReadOnly = Boolean(
678
- props.attributes?.readOnly || props.disable || props.attributes?.disable
679
- );
680
- const videoUrl = normalizeVideoValue(props.value ?? props.defaultValue);
681
- const handleChange = (event) => {
682
- const text = event.target.value;
683
- props.callback?.({
684
- name: props.name,
685
- value: text,
686
- index: props.index,
687
- groupKey: props.groupKey
688
- });
689
- };
690
- return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
691
- "ayush testing",
692
- props.attributes?.label ? /* @__PURE__ */ jsxs5("label", { className: "text-sm font-medium", children: [
693
- props.attributes.label,
694
- props.attributes?.required ? /* @__PURE__ */ jsx5("span", { className: "ml-1 text-red-500", children: "*" }) : null
695
- ] }) : null,
696
- isReadOnly ? /* @__PURE__ */ jsxs5(Fragment, { children: [
697
- "called video view",
698
- console.log(props.value, "vkjbvbvbvsdjkvdfn"),
699
- /* @__PURE__ */ jsx5(
700
- VideoView_default,
701
- {
702
- ...props,
703
- value: props.value ?? props.defaultValue,
704
- assetBaseUrl: props.serviceClient?.baseUrl
705
- }
706
- )
707
- ] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
708
- /* @__PURE__ */ jsx5(
709
- "input",
710
- {
711
- type: "text",
712
- name: props.name,
713
- id: props.name,
714
- value: videoUrl ?? "",
715
- onChange: handleChange,
716
- onBlur: props.onBlur,
717
- placeholder: props.attributes?.placeholder || "Paste a video URL or blob URL",
718
- disabled: isReadOnly,
719
- className: "peer input mt-1 block w-full rounded shadow-sm"
720
- }
721
- ),
722
- videoUrl ? /* @__PURE__ */ jsx5(
723
- VideoView_default,
724
- {
725
- ...props,
726
- value: props.value ?? props.defaultValue,
727
- assetBaseUrl: props.serviceClient?.baseUrl
728
- }
729
- ) : null
730
- ] })
731
- ] });
732
- };
733
- var VideoInput_default = VideoInput;
734
-
735
645
  // src/components/controls/edit/InputControlClient.tsx
736
- import { jsx as jsx6 } from "react/jsx-runtime";
646
+ import { jsx as jsx5 } from "react/jsx-runtime";
737
647
  var InputControl = React5.forwardRef(
738
648
  (props, ref) => {
739
649
  const ControlComponents = {
@@ -754,11 +664,10 @@ var InputControl = React5.forwardRef(
754
664
  [InputControlType_default.booleanSelect]: BooleanSelect_default,
755
665
  [InputControlType_default.timeInput]: TimeInput_default,
756
666
  [InputControlType_default.asset]: AssetUpload_default,
757
- [InputControlType_default.switchInput]: SwitchInput_default,
758
- [InputControlType_default.videoInput]: VideoInput_default
667
+ [InputControlType_default.switchInput]: SwitchInput_default
759
668
  };
760
669
  const SelectedControlComponent = ControlComponents[props.controlType];
761
- return /* @__PURE__ */ jsx6(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx6(SelectedControlComponent, { ...props }) : "Control not found" });
670
+ return /* @__PURE__ */ jsx5(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx5(SelectedControlComponent, { ...props }) : "Control not found" });
762
671
  }
763
672
  );
764
673
  InputControl.displayName = "InputControl";
@@ -14,9 +14,8 @@ import {
14
14
  PercentageInput_default,
15
15
  PhoneInput_default,
16
16
  SelectWithSearchInput_default,
17
- TimeInput_default,
18
- VideoView_default
19
- } from "./chunk-NT56SZOV.mjs";
17
+ TimeInput_default
18
+ } from "./chunk-YG6FKKQJ.mjs";
20
19
  import {
21
20
  Hyperlink,
22
21
  Icon_default,
@@ -641,97 +640,8 @@ var SwitchInput = (props) => {
641
640
  };
642
641
  var SwitchInput_default = SwitchInput;
643
642
 
644
- // src/components/controls/edit/VideoInput.tsx
645
- import { Fragment, jsx as jsx5, jsxs as jsxs5 } from "react/jsx-runtime";
646
- var normalizeVideoValue = (value) => {
647
- if (typeof value === "string") {
648
- const trimmed = value.trim();
649
- if (!trimmed) return void 0;
650
- try {
651
- const parsed = JSON.parse(trimmed);
652
- if (typeof parsed === "string") {
653
- return parsed;
654
- }
655
- if (parsed && typeof parsed === "object") {
656
- const candidate = parsed;
657
- if (typeof candidate.assetUrl === "string") return candidate.assetUrl;
658
- if (typeof candidate.url === "string") return candidate.url;
659
- if (typeof candidate.src === "string") return candidate.src;
660
- }
661
- } catch {
662
- return trimmed;
663
- }
664
- return trimmed;
665
- }
666
- if (value && typeof value === "object") {
667
- const candidate = value;
668
- if (typeof candidate.assetUrl === "string") return candidate.assetUrl;
669
- if (typeof candidate.url === "string") return candidate.url;
670
- if (typeof candidate.src === "string") return candidate.src;
671
- }
672
- return void 0;
673
- };
674
- var VideoInput = (props) => {
675
- const isReadOnly = Boolean(
676
- props.attributes?.readOnly || props.disable || props.attributes?.disable
677
- );
678
- const videoUrl = normalizeVideoValue(props.value ?? props.defaultValue);
679
- const handleChange = (event) => {
680
- const text = event.target.value;
681
- props.callback?.({
682
- name: props.name,
683
- value: text,
684
- index: props.index,
685
- groupKey: props.groupKey
686
- });
687
- };
688
- return /* @__PURE__ */ jsxs5("div", { className: "flex flex-col gap-2", children: [
689
- "ayush testing",
690
- props.attributes?.label ? /* @__PURE__ */ jsxs5("label", { className: "text-sm font-medium", children: [
691
- props.attributes.label,
692
- props.attributes?.required ? /* @__PURE__ */ jsx5("span", { className: "ml-1 text-red-500", children: "*" }) : null
693
- ] }) : null,
694
- isReadOnly ? /* @__PURE__ */ jsxs5(Fragment, { children: [
695
- "called video view",
696
- console.log(props.value, "vkjbvbvbvsdjkvdfn"),
697
- /* @__PURE__ */ jsx5(
698
- VideoView_default,
699
- {
700
- ...props,
701
- value: props.value ?? props.defaultValue,
702
- assetBaseUrl: props.serviceClient?.baseUrl
703
- }
704
- )
705
- ] }) : /* @__PURE__ */ jsxs5(Fragment, { children: [
706
- /* @__PURE__ */ jsx5(
707
- "input",
708
- {
709
- type: "text",
710
- name: props.name,
711
- id: props.name,
712
- value: videoUrl ?? "",
713
- onChange: handleChange,
714
- onBlur: props.onBlur,
715
- placeholder: props.attributes?.placeholder || "Paste a video URL or blob URL",
716
- disabled: isReadOnly,
717
- className: "peer input mt-1 block w-full rounded shadow-sm"
718
- }
719
- ),
720
- videoUrl ? /* @__PURE__ */ jsx5(
721
- VideoView_default,
722
- {
723
- ...props,
724
- value: props.value ?? props.defaultValue,
725
- assetBaseUrl: props.serviceClient?.baseUrl
726
- }
727
- ) : null
728
- ] })
729
- ] });
730
- };
731
- var VideoInput_default = VideoInput;
732
-
733
643
  // src/components/controls/edit/InputControlClient.tsx
734
- import { jsx as jsx6 } from "react/jsx-runtime";
644
+ import { jsx as jsx5 } from "react/jsx-runtime";
735
645
  var InputControl = React5.forwardRef(
736
646
  (props, ref) => {
737
647
  const ControlComponents = {
@@ -752,11 +662,10 @@ var InputControl = React5.forwardRef(
752
662
  [InputControlType_default.booleanSelect]: BooleanSelect_default,
753
663
  [InputControlType_default.timeInput]: TimeInput_default,
754
664
  [InputControlType_default.asset]: AssetUpload_default,
755
- [InputControlType_default.switchInput]: SwitchInput_default,
756
- [InputControlType_default.videoInput]: VideoInput_default
665
+ [InputControlType_default.switchInput]: SwitchInput_default
757
666
  };
758
667
  const SelectedControlComponent = ControlComponents[props.controlType];
759
- return /* @__PURE__ */ jsx6(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx6(SelectedControlComponent, { ...props }) : "Control not found" });
668
+ return /* @__PURE__ */ jsx5(React5.Fragment, { children: SelectedControlComponent ? /* @__PURE__ */ jsx5(SelectedControlComponent, { ...props }) : "Control not found" });
760
669
  }
761
670
  );
762
671
  InputControl.displayName = "InputControl";
@@ -884,90 +884,8 @@ var AssetUtility = class {
884
884
  };
885
885
  var AssetUtility_default = AssetUtility;
886
886
 
887
- // src/components/controls/view/VideoView.tsx
888
- import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
889
- var parseAssets = (value) => {
890
- if (!value) return [];
891
- if (Array.isArray(value)) {
892
- return value;
893
- }
894
- if (typeof value === "string") {
895
- const trimmed = value.trim();
896
- if (!trimmed) return [];
897
- try {
898
- const parsed = JSON.parse(trimmed);
899
- if (Array.isArray(parsed)) {
900
- return parsed;
901
- }
902
- if (parsed && typeof parsed === "object") {
903
- return [parsed];
904
- }
905
- } catch {
906
- return [{ assetUrl: trimmed }];
907
- }
908
- return [{ assetUrl: trimmed }];
909
- }
910
- if (typeof value === "object") {
911
- return [value];
912
- }
913
- return [];
914
- };
915
- var VideoView = (props) => {
916
- const assets = parseAssets(props.value);
917
- const asset = assets.find((item) => item.type?.toLowerCase() === "video") ?? assets[0];
918
- if (!asset?.assetUrl) {
919
- return null;
920
- }
921
- const resolvedAssetUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl ?? props.apiBaseUrl, asset.assetUrl);
922
- const resolvedPosterUrl = asset.posterUrl ? AssetUtility_default.resolveUrl(props.assetBaseUrl ?? props.apiBaseUrl, asset.posterUrl) : void 0;
923
- const isHls = resolvedAssetUrl?.endsWith(".m3u8");
924
- const isVideoFile = /\.(mp4|webm|ogg|mov)$/i.test(resolvedAssetUrl ?? "");
925
- const titleText = typeof asset.title === "string" ? asset.title : typeof props.customProps?.title === "string" ? props.customProps.title : "Video";
926
- const fileName = typeof asset.title === "string" ? asset.title : asset.assetUrl?.split("/").pop() || "video";
927
- const containerStyle = {
928
- width: props.width || "100%"
929
- };
930
- const renderMedia = () => {
931
- if (resolvedAssetUrl && isVideoFile) {
932
- return /* @__PURE__ */ jsx15("div", { className: "w-full overflow-hidden rounded-lg bg-black", children: /* @__PURE__ */ jsxs15(
933
- "video",
934
- {
935
- controls: true,
936
- playsInline: true,
937
- preload: "metadata",
938
- poster: resolvedPosterUrl,
939
- className: "w-full h-auto max-h-[70vh] object-contain bg-black",
940
- style: { width: "100%" },
941
- children: [
942
- /* @__PURE__ */ jsx15("source", { src: resolvedAssetUrl }),
943
- "Your browser does not support the video tag."
944
- ]
945
- }
946
- ) });
947
- }
948
- return null;
949
- };
950
- return /* @__PURE__ */ jsxs15("div", { style: containerStyle, className: "flex flex-col gap-2", children: [
951
- titleText ? /* @__PURE__ */ jsx15("div", { className: "font-medium text-sm", children: titleText }) : null,
952
- renderMedia(),
953
- resolvedAssetUrl ? /* @__PURE__ */ jsx15(
954
- "a",
955
- {
956
- href: resolvedAssetUrl,
957
- download: fileName,
958
- target: "_blank",
959
- rel: "noreferrer",
960
- className: "inline-flex w-fit items-center rounded-md border border-slate-300 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
961
- children: "Download video"
962
- }
963
- ) : null
964
- ] });
965
- };
966
- var VideoView_default = VideoView;
967
-
968
887
  export {
969
888
  AssetUtility_default,
970
- VideoView_default,
971
889
  MultilineTextInput_default,
972
890
  LineTextInput_default,
973
891
  MoneyInput_default,
@@ -881,90 +881,8 @@ var AssetUtility = class {
881
881
  };
882
882
  var AssetUtility_default = AssetUtility;
883
883
 
884
- // src/components/controls/view/VideoView.tsx
885
- import { jsx as jsx15, jsxs as jsxs15 } from "react/jsx-runtime";
886
- var parseAssets = (value) => {
887
- if (!value) return [];
888
- if (Array.isArray(value)) {
889
- return value;
890
- }
891
- if (typeof value === "string") {
892
- const trimmed = value.trim();
893
- if (!trimmed) return [];
894
- try {
895
- const parsed = JSON.parse(trimmed);
896
- if (Array.isArray(parsed)) {
897
- return parsed;
898
- }
899
- if (parsed && typeof parsed === "object") {
900
- return [parsed];
901
- }
902
- } catch {
903
- return [{ assetUrl: trimmed }];
904
- }
905
- return [{ assetUrl: trimmed }];
906
- }
907
- if (typeof value === "object") {
908
- return [value];
909
- }
910
- return [];
911
- };
912
- var VideoView = (props) => {
913
- const assets = parseAssets(props.value);
914
- const asset = assets.find((item) => item.type?.toLowerCase() === "video") ?? assets[0];
915
- if (!asset?.assetUrl) {
916
- return null;
917
- }
918
- const resolvedAssetUrl = AssetUtility_default.resolveUrl(props.assetBaseUrl ?? props.apiBaseUrl, asset.assetUrl);
919
- const resolvedPosterUrl = asset.posterUrl ? AssetUtility_default.resolveUrl(props.assetBaseUrl ?? props.apiBaseUrl, asset.posterUrl) : void 0;
920
- const isHls = resolvedAssetUrl?.endsWith(".m3u8");
921
- const isVideoFile = /\.(mp4|webm|ogg|mov)$/i.test(resolvedAssetUrl ?? "");
922
- const titleText = typeof asset.title === "string" ? asset.title : typeof props.customProps?.title === "string" ? props.customProps.title : "Video";
923
- const fileName = typeof asset.title === "string" ? asset.title : asset.assetUrl?.split("/").pop() || "video";
924
- const containerStyle = {
925
- width: props.width || "100%"
926
- };
927
- const renderMedia = () => {
928
- if (resolvedAssetUrl && isVideoFile) {
929
- return /* @__PURE__ */ jsx15("div", { className: "w-full overflow-hidden rounded-lg bg-black", children: /* @__PURE__ */ jsxs15(
930
- "video",
931
- {
932
- controls: true,
933
- playsInline: true,
934
- preload: "metadata",
935
- poster: resolvedPosterUrl,
936
- className: "w-full h-auto max-h-[70vh] object-contain bg-black",
937
- style: { width: "100%" },
938
- children: [
939
- /* @__PURE__ */ jsx15("source", { src: resolvedAssetUrl }),
940
- "Your browser does not support the video tag."
941
- ]
942
- }
943
- ) });
944
- }
945
- return null;
946
- };
947
- return /* @__PURE__ */ jsxs15("div", { style: containerStyle, className: "flex flex-col gap-2", children: [
948
- titleText ? /* @__PURE__ */ jsx15("div", { className: "font-medium text-sm", children: titleText }) : null,
949
- renderMedia(),
950
- resolvedAssetUrl ? /* @__PURE__ */ jsx15(
951
- "a",
952
- {
953
- href: resolvedAssetUrl,
954
- download: fileName,
955
- target: "_blank",
956
- rel: "noreferrer",
957
- className: "inline-flex w-fit items-center rounded-md border border-slate-300 px-3 py-2 text-sm font-medium text-slate-700 hover:bg-slate-50",
958
- children: "Download video"
959
- }
960
- ) : null
961
- ] });
962
- };
963
- var VideoView_default = VideoView;
964
-
965
884
  export {
966
885
  AssetUtility_default,
967
- VideoView_default,
968
886
  MultilineTextInput_default,
969
887
  LineTextInput_default,
970
888
  MoneyInput_default,