@bikdotai/bik-component-library 0.0.772-beta.8 → 0.0.772-test.10

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.
@@ -18,6 +18,5 @@ export type DropdownProps = OpenDropdownProps & {
18
18
  showLabelsOnMoreHover?: boolean;
19
19
  backgroundColor?: string;
20
20
  value?: string;
21
- resizeable?: boolean;
22
21
  };
23
22
  export declare const Dropdown: React.FC<DropdownProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react/jsx-runtime"),n=require("react"),o=require("../../constants/Theme.js"),i=require("../../assets/icons/chevronDown.svg.js"),l=require("../input/Input.js"),r=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function c(){}const u=u=>{var p,h,v,x,{placeHolder:f,size:g,onSelect:j,defaultOptions:b,disabled:w,noErrorHint:O,placeHolderHeight:m,showPlaceholderWhenSelected:S=!1,inputStyle:y={},inputType:I="default",onDeleteChip:E,truncatedText:H,showLeadingIconInPlaceholder:C=!1,showTrailingIconPlaceholder:D=!1,showLabelsOnMoreHover:P=!1,value:T,resizeable:q=!1}=u,L=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[M,W]=n.useState(!1),[z,_]=n.useState(!1),k=null!=g?g:"default",A=n.useRef(null),[R,F]=n.useState(0),N=n.useRef(),[U,V]=n.useState(null!=b?b:[]);n.useEffect((()=>{var e;const t=[];null===(e=null==L?void 0:L.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&t.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&t.push(e)})),V([...t])}),[L.options]),n.useEffect((()=>{b&&V([...b])}),[b]);const B=d.getSelectedOptionsAsText(U),G=S?f:null!==(p=null!=B?B:f)&&void 0!==p?p:"Select an option";n.useLayoutEffect((()=>{q&&A.current&&F(A.current.offsetWidth)}),[q,G]);const J=L.buttonWidth,K=q?R+("x-small"===k?16:"small"===k?20:24)+("default"===k?8:0)+16+8+4:void 0,Q=null!==(h=L.dropdownWidth)&&void 0!==h?h:"212px";return t.jsxs(t.Fragment,{children:[t.jsx(r.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:m||("x-small"===k?24:"small"===k?32:48),width:void 0!==K?K:null!=J?J:"100%"},J?{maxWidth:J}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===k?"4px 8px":"6px 8px",backgroundColor:void 0!==T?"#C3E4C4":z?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),y),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==T?"#00580E":"inherit"}}},{children:t.jsx("div",Object.assign({onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),style:L.width?{width:L.width}:void 0},{children:t.jsxs(a.DropdownPopover,Object.assign({"data-test":L["data-test"],ref:N,onSelect:function(e){Array.isArray(e)?V([...e]):V([e]),null==j||j(e)},disabled:w,onDropdownVisbilityChange:e=>W(e)},L,{width:Q},{children:["default"==I&&t.jsx(l.Input,{version:L.version,noErrorHint:O,state:w?"disabled":"none",value:void 0===T?G:T,errorMessage:L.error,variant:k,placeholder:null!=f?f:"Select an option",onChangeText:c,leftIcon:C&&(null===(v=U[0])||void 0===v?void 0:v.leadingIcon)?{icon:()=>{var e;return t.jsx(t.Fragment,{children:null===(e=U[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t.jsxs("div",Object.assign({style:{display:"flex"}},{children:[D&&(null===(e=U[0])||void 0===e?void 0:e.trailingIcon),t.jsx(i.default,{style:{transform:M?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"x-small"===k?16:"small"===k?20:24,height:"x-small"===k?16:"small"===k?20:24,color:o.COLORS.content.primary})]}))}},truncateText:null==H||H}),"chip"==I&&t.jsx(s.default,{placeholder:null!=f?f:"Select options",chips:U,onDeleteChip:e=>{null==E||E(e)},errorMessage:L.error,isDropdownOpened:M,sizeToUse:k,containerStyle:{width:null!==(x=L.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:P})]}))}))})),q&&t.jsx("span",Object.assign({ref:A,"aria-hidden":!0,style:{position:"fixed",top:"-9999px",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===k?"12px":"small"===k?"14px":"16px"}},{children:G}))]})};u.displayName="Dropdown",exports.Dropdown=u;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),n=require("react/jsx-runtime"),o=require("react"),t=require("../../constants/Theme.js"),r=require("../../assets/icons/chevronDown.svg.js"),l=require("../input/Input.js"),i=require("../input/context/InputStyleProvider.js"),s=require("./ChipInput.js"),a=require("./DropdownPopover/index.js"),d=require("./OpenedDropdown/utils/iterationOnOptions.js");function c(){}const u=u=>{var p,h,v,g,x,{placeHolder:j,size:f,onSelect:b,defaultOptions:w,disabled:O,noErrorHint:I,placeHolderHeight:S,showPlaceholderWhenSelected:m=!1,inputStyle:y={},inputType:E="default",onDeleteChip:H,truncatedText:C,showLeadingIconInPlaceholder:D=!1,showTrailingIconPlaceholder:P=!1,showLabelsOnMoreHover:T=!1,value:q}=u,M=e.__rest(u,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[L,W]=o.useState(!1),[_,z]=o.useState(!1),k=null!=f?f:"default",A=o.useRef(),[F,R]=o.useState(null!=w?w:[]);o.useEffect((()=>{var e;const n=[];null===(e=null==M?void 0:M.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&n.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&n.push(e)})),R([...n])}),[M.options]),o.useEffect((()=>{w&&R([...w])}),[w]);const N=d.getSelectedOptionsAsText(F),U=m?j:null!==(p=null!=N?N:j)&&void 0!==p?p:"Select an option",V=null!==(h=M.width)&&void 0!==h?h:M.buttonWidth,B=null!=V?V:"100%",G=null!==(v=M.dropdownWidth)&&void 0!==v?v:B;return n.jsx(n.Fragment,{children:n.jsx(i.InputStyleContext.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:S||("x-small"===k?24:"small"===k?32:48),width:B},V?{maxWidth:V}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===k?"4px 8px":"6px 8px",backgroundColor:void 0!==q?"#C3E4C4":_?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),y),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==q?"#00580E":"inherit"}}},{children:n.jsx("div",Object.assign({onMouseEnter:()=>z(!0),onMouseLeave:()=>z(!1)},{children:n.jsxs(a.DropdownPopover,Object.assign({"data-test":M["data-test"],ref:A,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==b||b(e)},disabled:O,onDropdownVisbilityChange:e=>W(e)},M,{width:G},{children:["default"==E&&n.jsx(l.Input,{version:M.version,noErrorHint:I,state:O?"disabled":"none",value:void 0===q?U:q,errorMessage:M.error,variant:k,placeholder:null!=j?j:"Select an option",onChangeText:c,leftIcon:D&&(null===(g=F[0])||void 0===g?void 0:g.leadingIcon)?{icon:()=>{var e;return n.jsx(n.Fragment,{children:null===(e=F[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return n.jsxs("div",Object.assign({style:{display:"flex"}},{children:[P&&(null===(e=F[0])||void 0===e?void 0:e.trailingIcon),n.jsx(r.default,{style:{transform:L?"rotate(180deg)":"rotate(0deg)"},onClick:c,width:"x-small"===k?16:"small"===k?20:24,height:"x-small"===k?16:"small"===k?20:24,color:t.COLORS.content.primary})]}))}},truncateText:null==C||C}),"chip"==E&&n.jsx(s.default,{placeholder:null!=j?j:"Select options",chips:F,onDeleteChip:e=>{null==H||H(e)},errorMessage:M.error,isDropdownOpened:L,sizeToUse:k,containerStyle:{width:null!==(x=M.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:T})]}))}))}))})};u.displayName="Dropdown",exports.Dropdown=u;
@@ -1 +1,6 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../constants/zindex.js"),s=require("../../assets/icons/errorIcon.svg.js"),o=require("../../assets/icons/successIcon.svg.js"),i=require("../../assets/icons/warningIcon.svg.js"),a=require("../modals/styledModal.js"),r=require("../spinner/Spinner.js"),c=require("../states/StateComponent.js");exports.StateModalComponent=d=>{const l=()=>u==c.StateInterface.SUCCESS?e.jsx(o.default,{}):u==c.StateInterface.WARNING?e.jsx(i.default,{}):u==c.StateInterface.ERROR?e.jsx(s.default,{}):u===c.StateInterface.LOADING?e.jsx(r.Spinner,{size:"large"}):void 0,{states:u,heading:I,subline:j,icon:x=l(),isButtonEnabled:S,type:g,buttonText:p,onButtonClick:h,leadingIcon:C,width:f,zIndex:y,headerImage:O,iconHeight:b,iconWidth:m,closeButtonType:q,secondaryButtonText:B}=d,[T,v]=t.useState(!0);return e.jsx(a.StyledModal,Object.assign({"data-test":d["data-test"],open:T,onClose:function(){d.onClose&&d.onClose(),v(!1)},closeOnOutsideClick:!(u===c.StateInterface.LOADING),centralContainerStyles:{display:"flex",alignItems:"center",justifyContent:"center",width:f},hideCrossButton:u===c.StateInterface.LOADING,zIndex:y||n.ComponentZindex.STATE_MODAL},{children:e.jsx(c.StateComponent,Object.assign({states:u,heading:I,subline:j,isButtonEnabled:S,leadingIcon:C,type:g,buttonText:p,onButtonClick:h,icon:x,width:f||400,headerImage:O,iconHeight:b,iconWidth:m,closeButtonType:q,secondaryButtonText:B},{children:d.children}))}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),n=require("../../constants/zindex.js"),s=require("../../assets/icons/errorIcon.svg.js"),r=require("../../assets/icons/successIcon.svg.js"),o=require("../../assets/icons/warningIcon.svg.js"),a=require("../modals/styledModal.js"),i=require("../spinner/Spinner.js"),c=require("../../constants/Theme.js"),u=require("../states/StateComponent.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const l=d(require("styled-components")).default.div`
2
+ width: 64px;
3
+ height: 64px;
4
+ background-color: ${c.COLORS.background.base};
5
+ border-radius: 32px;
6
+ `;exports.StateModalComponent=c=>{const d=()=>{switch(x){case u.StateInterface.SUCCESS:return e.jsx(r.default,{});case u.StateInterface.WARNING:return e.jsx(o.default,{});case u.StateInterface.ERROR:return e.jsx(s.default,{});case u.StateInterface.LOADING:return e.jsx(i.Spinner,{size:"large"});default:return e.jsx(l,{children:p})}},{states:x,heading:h,subline:j,icon:p=d(),isButtonEnabled:I,type:f,buttonText:g,onButtonClick:S,leadingIcon:C,width:b,zIndex:y,headerImage:O,iconHeight:m,iconWidth:q,closeButtonType:B,secondaryButtonText:T}=c,[v,w]=t.useState(!0);return e.jsx(a.StyledModal,Object.assign({"data-test":c["data-test"],open:v,onClose:function(){c.onClose&&c.onClose(),w(!1)},closeOnOutsideClick:!(x===u.StateInterface.LOADING),centralContainerStyles:{display:"flex",alignItems:"center",justifyContent:"center",width:b},hideCrossButton:x===u.StateInterface.LOADING,zIndex:y||n.ComponentZindex.STATE_MODAL},{children:e.jsx(u.StateComponent,Object.assign({states:x,heading:h,subline:j,isButtonEnabled:I,leadingIcon:C,type:f,buttonText:g,onButtonClick:S,icon:p,width:b||400,headerImage:O,iconHeight:m,iconWidth:q,closeButtonType:B,secondaryButtonText:T},{children:c.children}))}))};
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/arrow_back.svg.js"),i=require("../../../assets/icons/info.svg.js");require("../../curtain/CurtainHelper.js");var s=require("../../variable-picker-v3/model.js"),a=require("react"),r=require("../../button/Button.js"),o=require("../../image-cropper/BikImageCropper.js");require("../../image-compress/ImageCompress.js"),require("../../states/StateComponent.js"),require("../../../_virtual/_tslib.js"),require("../../../constants/zindex.js"),require("../../modals/styledModal.js");var l=require("../../spinner/Spinner.js"),n=require("../../input-with-vars/InputWithVariables.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var d=require("../../../constants/Theme.js"),p=require("../../template-preview/models/TemplateMeta.js"),c=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var u=require("../../TypographyStyle.js"),g=require("../../../utils/validator.js"),m=require("../../../assets/icons/file.svg.js"),j=require("../../../assets/icons/filePdf.svg.js"),h=require("../../../assets/icons/image.svg.js"),x=require("../../../assets/icons/upload.svg.js"),E=require("../context/templateModalContext.js"),v=require("../utils/validateIsUrl.js");exports.default=b=>{let{setOpenEditMedia:f,mediaComponentFormat:y,variableListForImage:T,openEditMedia:C,uploadMedia:M,fileRef:A,useEditWhatsappTemplateMediaResponse:q,skipAddVariable:I}=b;const{pod:D,setHideCrossButton:O,setHideFooterButton:S}=E.useTemplateModalContext(),[P,R]=a.useState(""),[w,k]=a.useState(void 0),[H,L]=a.useState(!1),[_,B]=a.useState("");let V;if(a.useEffect((()=>(S(!0),()=>{S(!1)})),[]),a.useEffect((()=>{const e=document.querySelector('[class*="ModalWrapper"]');e&&k(e)}),[q.loading]),V=y===p.HEADER_TYPES.IMAGE?"image/png, image/jpeg":y===p.HEADER_TYPES.VIDEO?"video/mp4":"application/pdf",!C)return e.jsx(e.Fragment,{});const U=()=>y===p.HEADER_TYPES.IMAGE?"Image":y===p.HEADER_TYPES.VIDEO?"Video":"Document";return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:"10px",alignItems:"center",marginBottom:"16px"}},{children:[e.jsx(t.default,{onClick:e=>{e.stopPropagation(),f(!1),R("")},style:{cursor:"pointer"},width:16,height:16}),e.jsx(u.TitleRegular,{children:"Update Media"})]})),e.jsxs("div",Object.assign({style:{position:"relative",padding:16,borderRadius:4,border:H?`1px dashed ${d.DEFAULT_THEME.colorsV2.stroke.negative.vibrant}`:`1px dashed ${d.DEFAULT_THEME.colorsV2.stroke.primary}`,backgroundColor:d.DEFAULT_THEME.colorsV2.surface.subdued,width:"100%",height:"100%",alignItems:"center",display:q.loading?"flex":"initial"}},{children:[e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[q.loading?e.jsx(l.PureSpinner,{width:"40px",height:"40px",color:d.COLORS.content.brand}):e.jsx("div",Object.assign({style:{height:64,width:64,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:d.DEFAULT_THEME.colorsV2.background.base}},{children:y===p.HEADER_TYPES.IMAGE?e.jsx(h.default,{width:40,height:40}):y===p.HEADER_TYPES.VIDEO?e.jsx(m.default,{width:40,height:40}):e.jsx(j.default,{width:40,height:40})})),e.jsx(u.TitleMedium,{children:q.loading?"Upload in progress...":y===p.HEADER_TYPES.IMAGE?"Upload an image":y===p.HEADER_TYPES.VIDEO?"Upload a video":"Upload a document"}),e.jsx(u.BodySecondary,Object.assign({color:d.COLORS.content.secondary},{children:q.loading?`Your ${y.toLowerCase()} is getting loaded. This may take a couple of minutes.`:y===p.HEADER_TYPES.IMAGE?"JPEG/ PNG format • Max 5MB":y===p.HEADER_TYPES.VIDEO?"MP4 format video • Max 16MB":"PDF format document • Max 100MB"}))]})),!q.loading&&e.jsxs(e.Fragment,{children:[e.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:e.jsx(n.InputWithVariables,{labelText:`${U()} URL`,onPickerToggle:e=>{O(!!e)},pickerType:s.PickerType.EMBEDDED,portalElement:null!=w?w:document.body,noMaxCharCheck:!0,allowMix:!1,onChange:e=>{B(e.actualValue),L(!1)},showVarHeader:!0,varHeaderText:"Select variable",errorMessage:P,prevVariable:{actualValue:"",variableType:"string"},variablesList:T,placeHolder:I?"Enter URL":"Enter URL/Add variable",showAddButton:D!==c.POD.CAMPAIGN||!I&&y===p.HEADER_TYPES.IMAGE})})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px",marginBottom:"12px"}},{children:[e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e.jsx(u.BodyCaption,{children:"Or upload media from device"}),e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(r.Button,{matchParentWidth:!0,buttonText:"Upload",buttonType:"dashBold",LeadingIcon:x.default,onClick:()=>{M(),L(!1)},size:"medium"})}))]}),H&&e.jsxs("div",Object.assign({style:{position:"absolute",display:"flex",alignItems:"center",bottom:-24,left:0,gap:4}},{children:[e.jsx(i.default,{width:16,height:16,color:d.COLORS.content.negative}),e.jsx(u.BodyCaption,Object.assign({style:{color:d.COLORS.content.negative}},{children:`Select ${U()}`}))]}))]})),!q.loading&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"flex-end",marginTop:8}},{children:e.jsx(r.Button,{buttonText:`Add ${U()}`,onClick:()=>{_?g.validateURL(_)||v.isVariable(_)?(M(_),f(!1),R(""),L(!1)):R("Enter valid URL"):L(!0)}})})),e.jsx("input",{ref:A,style:{display:"none"},type:"file",onChange:q.handleImageUpload,accept:V}),!!q.selectedImage&&e.jsx(o.BikImageCropper,{aspectRatio:15/8,src:q.selectedImage,onCropComplete:q.onCropComplete,onCancel:()=>{q.setLoading(!1),q.setSelectedImage(""),A.current&&(A.current.value="")}})]})};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/arrow_back.svg.js"),a=require("../../../assets/icons/info.svg.js");require("../../curtain/CurtainHelper.js");var s=require("../../variable-picker-v3/model.js"),i=require("react"),r=require("../../button/Button.js"),o=require("../../image-cropper/BikImageCropper.js");require("../../image-compress/ImageCompress.js"),require("../../states/StateComponent.js"),require("../../../_virtual/_tslib.js"),require("../../states-modal/StateModalComponent.js"),require("../../modals/styledModal.js");var l=require("../../input-with-vars/InputWithVariables.js"),n=require("../../spinner/Spinner.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var d=require("../../../constants/Theme.js"),p=require("../../template-preview/models/TemplateMeta.js"),c=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var u=require("../../TypographyStyle.js"),g=require("../../../utils/validator.js"),m=require("../../../assets/icons/file.svg.js"),j=require("../../../assets/icons/filePdf.svg.js"),h=require("../../../assets/icons/image.svg.js"),x=require("../../../assets/icons/upload.svg.js"),E=require("../context/templateModalContext.js"),v=require("../utils/validateIsUrl.js");exports.default=b=>{let{setOpenEditMedia:f,mediaComponentFormat:y,variableListForImage:C,openEditMedia:T,uploadMedia:M,fileRef:A,useEditWhatsappTemplateMediaResponse:q,skipAddVariable:I}=b;const{pod:S,setHideCrossButton:D,setHideFooterButton:O}=E.useTemplateModalContext(),[P,R]=i.useState(""),[w,k]=i.useState(void 0),[H,L]=i.useState(!1),[_,B]=i.useState("");let V;if(i.useEffect((()=>(O(!0),()=>{O(!1)})),[]),i.useEffect((()=>{const e=document.querySelector('[class*="ModalWrapper"]');e&&k(e)}),[q.loading]),V=y===p.HEADER_TYPES.IMAGE?"image/png, image/jpeg":y===p.HEADER_TYPES.VIDEO?"video/mp4":"application/pdf",!T)return e.jsx(e.Fragment,{});const U=()=>y===p.HEADER_TYPES.IMAGE?"Image":y===p.HEADER_TYPES.VIDEO?"Video":"Document";return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",gap:"10px",alignItems:"center",marginBottom:"16px"}},{children:[e.jsx(t.default,{onClick:e=>{e.stopPropagation(),f(!1),R("")},style:{cursor:"pointer"},width:16,height:16}),e.jsx(u.TitleRegular,{children:"Update Media"})]})),e.jsxs("div",Object.assign({style:{position:"relative",padding:16,borderRadius:4,border:H?`1px dashed ${d.DEFAULT_THEME.colorsV2.stroke.negative.vibrant}`:`1px dashed ${d.DEFAULT_THEME.colorsV2.stroke.primary}`,backgroundColor:d.DEFAULT_THEME.colorsV2.surface.subdued,width:"100%",height:"100%",alignItems:"center",display:q.loading?"flex":"initial"}},{children:[e.jsxs("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[q.loading?e.jsx(n.PureSpinner,{width:"40px",height:"40px",color:d.COLORS.content.brand}):e.jsx("div",Object.assign({style:{height:64,width:64,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:d.DEFAULT_THEME.colorsV2.background.base}},{children:y===p.HEADER_TYPES.IMAGE?e.jsx(h.default,{width:40,height:40}):y===p.HEADER_TYPES.VIDEO?e.jsx(m.default,{width:40,height:40}):e.jsx(j.default,{width:40,height:40})})),e.jsx(u.TitleMedium,{children:q.loading?"Upload in progress...":y===p.HEADER_TYPES.IMAGE?"Upload an image":y===p.HEADER_TYPES.VIDEO?"Upload a video":"Upload a document"}),e.jsx(u.BodySecondary,Object.assign({color:d.COLORS.content.secondary},{children:q.loading?`Your ${y.toLowerCase()} is getting loaded. This may take a couple of minutes.`:y===p.HEADER_TYPES.IMAGE?"JPEG/ PNG format • Max 5MB":y===p.HEADER_TYPES.VIDEO?"MP4 format video • Max 16MB":"PDF format document • Max 100MB"}))]})),!q.loading&&e.jsxs(e.Fragment,{children:[e.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:e.jsx(l.InputWithVariables,{labelText:`${U()} URL`,onPickerToggle:e=>{D(!!e)},pickerType:s.PickerType.EMBEDDED,portalElement:null!=w?w:document.body,noMaxCharCheck:!0,allowMix:!1,onChange:e=>{B(e.actualValue),L(!1)},showVarHeader:!0,varHeaderText:"Select variable",errorMessage:P,prevVariable:{actualValue:"",variableType:"string"},variablesList:C,placeHolder:I?"Enter URL":"Enter URL/Add variable",showAddButton:S!==c.POD.CAMPAIGN||!I&&y===p.HEADER_TYPES.IMAGE})})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px",marginBottom:"12px"}},{children:[e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e.jsx(u.BodyCaption,{children:"Or upload media from device"}),e.jsx("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e.jsx("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e.jsx(r.Button,{matchParentWidth:!0,buttonText:"Upload",buttonType:"dashBold",LeadingIcon:x.default,onClick:()=>{M(),L(!1)},size:"medium"})}))]}),H&&e.jsxs("div",Object.assign({style:{position:"absolute",display:"flex",alignItems:"center",bottom:-24,left:0,gap:4}},{children:[e.jsx(a.default,{width:16,height:16,color:d.COLORS.content.negative}),e.jsx(u.BodyCaption,Object.assign({style:{color:d.COLORS.content.negative}},{children:`Select ${U()}`}))]}))]})),!q.loading&&e.jsx("div",Object.assign({style:{display:"flex",justifyContent:"flex-end",marginTop:8}},{children:e.jsx(r.Button,{buttonText:`Add ${U()}`,onClick:()=>{_?g.validateURL(_)||v.isVariable(_)?(M(_),f(!1),R(""),L(!1)):R("Enter valid URL"):L(!0)}})})),e.jsx("input",{ref:A,style:{display:"none"},type:"file",onChange:q.handleImageUpload,accept:V}),!!q.selectedImage&&e.jsx(o.BikImageCropper,{aspectRatio:15/8,src:q.selectedImage,onCropComplete:q.onCropComplete,onCancel:()=>{q.setLoading(!1),q.setSelectedImage(""),A.current&&(A.current.value="")}})]})};
@@ -18,6 +18,5 @@ export type DropdownProps = OpenDropdownProps & {
18
18
  showLabelsOnMoreHover?: boolean;
19
19
  backgroundColor?: string;
20
20
  value?: string;
21
- resizeable?: boolean;
22
21
  };
23
22
  export declare const Dropdown: React.FC<DropdownProps>;
@@ -1 +1 @@
1
- import{__rest as e}from"../../_virtual/_tslib.js";import{jsxs as o,Fragment as n,jsx as t}from"react/jsx-runtime";import{useState as i,useRef as l,useEffect as r,useLayoutEffect as s}from"react";import{COLORS as a}from"../../constants/Theme.js";import d from"../../assets/icons/chevronDown.svg.js";import{Input as c}from"../input/Input.js";import{InputStyleContext as p}from"../input/context/InputStyleProvider.js";import h from"./ChipInput.js";import{DropdownPopover as u}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as v}from"./OpenedDropdown/utils/iterationOnOptions.js";function m(){}const f=f=>{var g,x,b,w,{placeHolder:j,size:O,onSelect:y,defaultOptions:I,disabled:S,noErrorHint:H,placeHolderHeight:E,showPlaceholderWhenSelected:C=!1,inputStyle:T={},inputType:D="default",onDeleteChip:P,truncatedText:W,showLeadingIconInPlaceholder:z=!1,showTrailingIconPlaceholder:M=!1,showLabelsOnMoreHover:L=!1,value:k,resizeable:A=!1}=f,_=e(f,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value","resizeable"]);const[N,U]=i(!1),[V,q]=i(!1),B=null!=O?O:"default",F=l(null),[G,J]=i(0),K=l(),[Q,R]=i(null!=I?I:[]);r((()=>{var e;const o=[];null===(e=null==_?void 0:_.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),R([...o])}),[_.options]),r((()=>{I&&R([...I])}),[I]);const X=v(Q),Y=C?j:null!==(g=null!=X?X:j)&&void 0!==g?g:"Select an option";s((()=>{A&&F.current&&J(F.current.offsetWidth)}),[A,Y]);const Z=_.buttonWidth,$=A?G+("x-small"===B?16:"small"===B?20:24)+("default"===B?8:0)+16+8+4:void 0,ee=null!==(x=_.dropdownWidth)&&void 0!==x?x:"212px";return o(n,{children:[t(p.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:E||("x-small"===B?24:"small"===B?32:48),width:void 0!==$?$:null!=Z?Z:"100%"},Z?{maxWidth:Z}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===B?"4px 8px":"6px 8px",backgroundColor:void 0!==k?"#C3E4C4":V?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),T),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==k?"#00580E":"inherit"}}},{children:t("div",Object.assign({onMouseEnter:()=>q(!0),onMouseLeave:()=>q(!1),style:_.width?{width:_.width}:void 0},{children:o(u,Object.assign({"data-test":_["data-test"],ref:K,onSelect:function(e){Array.isArray(e)?R([...e]):R([e]),null==y||y(e)},disabled:S,onDropdownVisbilityChange:e=>U(e)},_,{width:ee},{children:["default"==D&&t(c,{version:_.version,noErrorHint:H,state:S?"disabled":"none",value:void 0===k?Y:k,errorMessage:_.error,variant:B,placeholder:null!=j?j:"Select an option",onChangeText:m,leftIcon:z&&(null===(b=Q[0])||void 0===b?void 0:b.leadingIcon)?{icon:()=>{var e;return t(n,{children:null===(e=Q[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return o("div",Object.assign({style:{display:"flex"}},{children:[M&&(null===(e=Q[0])||void 0===e?void 0:e.trailingIcon),t(d,{style:{transform:N?"rotate(180deg)":"rotate(0deg)"},onClick:m,width:"x-small"===B?16:"small"===B?20:24,height:"x-small"===B?16:"small"===B?20:24,color:a.content.primary})]}))}},truncateText:null==W||W}),"chip"==D&&t(h,{placeholder:null!=j?j:"Select options",chips:Q,onDeleteChip:e=>{null==P||P(e)},errorMessage:_.error,isDropdownOpened:N,sizeToUse:B,containerStyle:{width:null!==(w=_.width)&&void 0!==w?w:"100%",cursor:"pointer"},showLabelsOnMoreHover:L})]}))}))})),A&&t("span",Object.assign({ref:F,"aria-hidden":!0,style:{position:"fixed",top:"-9999px",left:"-9999px",visibility:"hidden",whiteSpace:"nowrap",pointerEvents:"none",fontSize:"x-small"===B?"12px":"small"===B?"14px":"16px"}},{children:Y}))]})};f.displayName="Dropdown";export{f as Dropdown};
1
+ import{__rest as e}from"../../_virtual/_tslib.js";import{jsx as o,Fragment as n,jsxs as t}from"react/jsx-runtime";import{useState as i,useRef as l,useEffect as r}from"react";import{COLORS as s}from"../../constants/Theme.js";import a from"../../assets/icons/chevronDown.svg.js";import{Input as d}from"../input/Input.js";import{InputStyleContext as c}from"../input/context/InputStyleProvider.js";import p from"./ChipInput.js";import{DropdownPopover as h}from"./DropdownPopover/index.js";import{getSelectedOptionsAsText as u}from"./OpenedDropdown/utils/iterationOnOptions.js";function v(){}const m=m=>{var g,f,b,w,x,{placeHolder:j,size:O,onSelect:I,defaultOptions:y,disabled:H,noErrorHint:S,placeHolderHeight:E,showPlaceholderWhenSelected:C=!1,inputStyle:T={},inputType:D="default",onDeleteChip:P,truncatedText:M,showLeadingIconInPlaceholder:W=!1,showTrailingIconPlaceholder:L=!1,showLabelsOnMoreHover:z=!1,value:k}=m,A=e(m,["placeHolder","size","onSelect","defaultOptions","disabled","noErrorHint","placeHolderHeight","showPlaceholderWhenSelected","inputStyle","inputType","onDeleteChip","truncatedText","showLeadingIconInPlaceholder","showTrailingIconPlaceholder","showLabelsOnMoreHover","value"]);const[_,N]=i(!1),[U,V]=i(!1),q=null!=O?O:"default",B=l(),[F,G]=i(null!=y?y:[]);r((()=>{var e;const o=[];null===(e=null==A?void 0:A.options)||void 0===e||e.forEach((e=>{e.options?e.options.forEach((e=>{e.selected&&o.push(Object.assign(Object.assign({},e),{label:e.label}))})):e.selected&&o.push(e)})),G([...o])}),[A.options]),r((()=>{y&&G([...y])}),[y]);const J=u(F),K=C?j:null!==(g=null!=J?J:j)&&void 0!==g?g:"Select an option",Q=null!==(f=A.width)&&void 0!==f?f:A.buttonWidth,R=null!=Q?Q:"100%",X=null!==(b=A.dropdownWidth)&&void 0!==b?b:R;return o(n,{children:o(c.Provider,Object.assign({value:{InputWrapper:Object.assign(Object.assign(Object.assign({height:E||("x-small"===q?24:"small"===q?32:48),width:R},Q?{maxWidth:Q}:{}),{zIndex:1,cursor:"pointer",padding:"x-small"===q?"4px 8px":"6px 8px",backgroundColor:void 0!==k?"#C3E4C4":U?"#E0E0E0":"#ffffff",transition:"background-color 0.3s ease"}),T),input:{minHeight:"100%",maxWidth:"100%",color:void 0!==k?"#00580E":"inherit"}}},{children:o("div",Object.assign({onMouseEnter:()=>V(!0),onMouseLeave:()=>V(!1)},{children:t(h,Object.assign({"data-test":A["data-test"],ref:B,onSelect:function(e){Array.isArray(e)?G([...e]):G([e]),null==I||I(e)},disabled:H,onDropdownVisbilityChange:e=>N(e)},A,{width:X},{children:["default"==D&&o(d,{version:A.version,noErrorHint:S,state:H?"disabled":"none",value:void 0===k?K:k,errorMessage:A.error,variant:q,placeholder:null!=j?j:"Select an option",onChangeText:v,leftIcon:W&&(null===(w=F[0])||void 0===w?void 0:w.leadingIcon)?{icon:()=>{var e;return o(n,{children:null===(e=F[0])||void 0===e?void 0:e.leadingIcon})}}:void 0,rightIcon:{icon:()=>{var e;return t("div",Object.assign({style:{display:"flex"}},{children:[L&&(null===(e=F[0])||void 0===e?void 0:e.trailingIcon),o(a,{style:{transform:_?"rotate(180deg)":"rotate(0deg)"},onClick:v,width:"x-small"===q?16:"small"===q?20:24,height:"x-small"===q?16:"small"===q?20:24,color:s.content.primary})]}))}},truncateText:null==M||M}),"chip"==D&&o(p,{placeholder:null!=j?j:"Select options",chips:F,onDeleteChip:e=>{null==P||P(e)},errorMessage:A.error,isDropdownOpened:_,sizeToUse:q,containerStyle:{width:null!==(x=A.width)&&void 0!==x?x:"100%",cursor:"pointer"},showLabelsOnMoreHover:z})]}))}))}))})};m.displayName="Dropdown";export{m as Dropdown};
@@ -1 +1,6 @@
1
- import{jsx as t}from"react/jsx-runtime";import{useState as e}from"react";import{ComponentZindex as n}from"../../constants/zindex.js";import o from"../../assets/icons/errorIcon.svg.js";import s from"../../assets/icons/successIcon.svg.js";import i from"../../assets/icons/warningIcon.svg.js";import{StyledModal as r}from"../modals/styledModal.js";import{Spinner as c}from"../spinner/Spinner.js";import{StateInterface as a,StateComponent as d}from"../states/StateComponent.js";const l=l=>{const m=()=>p==a.SUCCESS?t(s,{}):p==a.WARNING?t(i,{}):p==a.ERROR?t(o,{}):p===a.LOADING?t(c,{size:"large"}):void 0,{states:p,heading:u,subline:g,icon:h=m(),isButtonEnabled:I,type:f,buttonText:C,onButtonClick:j,leadingIcon:x,width:y,zIndex:B,headerImage:O,iconHeight:b,iconWidth:T,closeButtonType:S,secondaryButtonText:A}=l,[E,N]=e(!0);return t(r,Object.assign({"data-test":l["data-test"],open:E,onClose:function(){l.onClose&&l.onClose(),N(!1)},closeOnOutsideClick:!(p===a.LOADING),centralContainerStyles:{display:"flex",alignItems:"center",justifyContent:"center",width:y},hideCrossButton:p===a.LOADING,zIndex:B||n.STATE_MODAL},{children:t(d,Object.assign({states:p,heading:u,subline:g,isButtonEnabled:I,leadingIcon:x,type:f,buttonText:C,onButtonClick:j,icon:h,width:y||400,headerImage:O,iconHeight:b,iconWidth:T,closeButtonType:S,secondaryButtonText:A},{children:l.children}))}))};export{l as StateModalComponent};
1
+ import{jsx as t}from"react/jsx-runtime";import{useState as e}from"react";import{ComponentZindex as n}from"../../constants/zindex.js";import o from"../../assets/icons/errorIcon.svg.js";import s from"../../assets/icons/successIcon.svg.js";import r from"../../assets/icons/warningIcon.svg.js";import{StyledModal as i}from"../modals/styledModal.js";import{Spinner as c}from"../spinner/Spinner.js";import{COLORS as a}from"../../constants/Theme.js";import{StateInterface as d,StateComponent as l}from"../states/StateComponent.js";import m from"styled-components";const u=a=>{const m=()=>{switch(u){case d.SUCCESS:return t(s,{});case d.WARNING:return t(r,{});case d.ERROR:return t(o,{});case d.LOADING:return t(c,{size:"large"});default:return t(p,{children:f})}},{states:u,heading:h,subline:g,icon:f=m(),isButtonEnabled:I,type:x,buttonText:b,onButtonClick:j,leadingIcon:C,width:y,zIndex:B,headerImage:O,iconHeight:T,iconWidth:S,closeButtonType:w,secondaryButtonText:A}=a,[k,E]=e(!0);return t(i,Object.assign({"data-test":a["data-test"],open:k,onClose:function(){a.onClose&&a.onClose(),E(!1)},closeOnOutsideClick:!(u===d.LOADING),centralContainerStyles:{display:"flex",alignItems:"center",justifyContent:"center",width:y},hideCrossButton:u===d.LOADING,zIndex:B||n.STATE_MODAL},{children:t(l,Object.assign({states:u,heading:h,subline:g,isButtonEnabled:I,leadingIcon:C,type:x,buttonText:b,onButtonClick:j,icon:f,width:y||400,headerImage:O,iconHeight:T,iconWidth:S,closeButtonType:w,secondaryButtonText:A},{children:a.children}))}))},p=m.div`
2
+ width: 64px;
3
+ height: 64px;
4
+ background-color: ${a.background.base};
5
+ border-radius: 32px;
6
+ `;export{u as StateModalComponent};
@@ -1 +1 @@
1
- import{jsx as e,Fragment as t,jsxs as i}from"react/jsx-runtime";import o from"../../../assets/icons/arrow_back.svg.js";import a from"../../../assets/icons/info.svg.js";import"../../curtain/CurtainHelper.js";import{PickerType as r}from"../../variable-picker-v3/model.js";import{useState as s,useEffect as l}from"react";import{Button as n}from"../../button/Button.js";import{BikImageCropper as p}from"../../image-cropper/BikImageCropper.js";import"../../image-compress/ImageCompress.js";import"../../states/StateComponent.js";import"../../../_virtual/_tslib.js";import"../../../constants/zindex.js";import"../../modals/styledModal.js";import{PureSpinner as d}from"../../spinner/Spinner.js";import{InputWithVariables as m}from"../../input-with-vars/InputWithVariables.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as c,COLORS as g}from"../../../constants/Theme.js";import{HEADER_TYPES as h}from"../../template-preview/models/TemplateMeta.js";import{POD as u}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{TitleRegular as f,TitleMedium as v,BodySecondary as b,BodyCaption as j}from"../../TypographyStyle.js";import{validateURL as y}from"../../../utils/validator.js";import x from"../../../assets/icons/file.svg.js";import C from"../../../assets/icons/filePdf.svg.js";import I from"../../../assets/icons/image.svg.js";import M from"../../../assets/icons/upload.svg.js";import{useTemplateModalContext as w}from"../context/templateModalContext.js";import{isVariable as k}from"../utils/validateIsUrl.js";const E=E=>{let{setOpenEditMedia:O,mediaComponentFormat:A,variableListForImage:V,openEditMedia:T,uploadMedia:B,fileRef:D,useEditWhatsappTemplateMediaResponse:P,skipAddVariable:U}=E;const{pod:L,setHideCrossButton:G,setHideFooterButton:R}=w(),[W,S]=s(""),[H,$]=s(void 0),[F,_]=s(!1),[z,N]=s("");let q;if(l((()=>(R(!0),()=>{R(!1)})),[]),l((()=>{const e=document.querySelector('[class*="ModalWrapper"]');e&&$(e)}),[P.loading]),q=A===h.IMAGE?"image/png, image/jpeg":A===h.VIDEO?"video/mp4":"application/pdf",!T)return e(t,{});const J=()=>A===h.IMAGE?"Image":A===h.VIDEO?"Video":"Document";return i(t,{children:[i("div",Object.assign({style:{display:"flex",gap:"10px",alignItems:"center",marginBottom:"16px"}},{children:[e(o,{onClick:e=>{e.stopPropagation(),O(!1),S("")},style:{cursor:"pointer"},width:16,height:16}),e(f,{children:"Update Media"})]})),i("div",Object.assign({style:{position:"relative",padding:16,borderRadius:4,border:F?`1px dashed ${c.colorsV2.stroke.negative.vibrant}`:`1px dashed ${c.colorsV2.stroke.primary}`,backgroundColor:c.colorsV2.surface.subdued,width:"100%",height:"100%",alignItems:"center",display:P.loading?"flex":"initial"}},{children:[i("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[P.loading?e(d,{width:"40px",height:"40px",color:g.content.brand}):e("div",Object.assign({style:{height:64,width:64,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:c.colorsV2.background.base}},{children:A===h.IMAGE?e(I,{width:40,height:40}):A===h.VIDEO?e(x,{width:40,height:40}):e(C,{width:40,height:40})})),e(v,{children:P.loading?"Upload in progress...":A===h.IMAGE?"Upload an image":A===h.VIDEO?"Upload a video":"Upload a document"}),e(b,Object.assign({color:g.content.secondary},{children:P.loading?`Your ${A.toLowerCase()} is getting loaded. This may take a couple of minutes.`:A===h.IMAGE?"JPEG/ PNG format • Max 5MB":A===h.VIDEO?"MP4 format video • Max 16MB":"PDF format document • Max 100MB"}))]})),!P.loading&&i(t,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:e(m,{labelText:`${J()} URL`,onPickerToggle:e=>{G(!!e)},pickerType:r.EMBEDDED,portalElement:null!=H?H:document.body,noMaxCharCheck:!0,allowMix:!1,onChange:e=>{N(e.actualValue),_(!1)},showVarHeader:!0,varHeaderText:"Select variable",errorMessage:W,prevVariable:{actualValue:"",variableType:"string"},variablesList:V,placeHolder:U?"Enter URL":"Enter URL/Add variable",showAddButton:L!==u.CAMPAIGN||!U&&A===h.IMAGE})})),i("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px",marginBottom:"12px"}},{children:[e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e(j,{children:"Or upload media from device"}),e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(n,{matchParentWidth:!0,buttonText:"Upload",buttonType:"dashBold",LeadingIcon:M,onClick:()=>{B(),_(!1)},size:"medium"})}))]}),F&&i("div",Object.assign({style:{position:"absolute",display:"flex",alignItems:"center",bottom:-24,left:0,gap:4}},{children:[e(a,{width:16,height:16,color:g.content.negative}),e(j,Object.assign({style:{color:g.content.negative}},{children:`Select ${J()}`}))]}))]})),!P.loading&&e("div",Object.assign({style:{display:"flex",justifyContent:"flex-end",marginTop:8}},{children:e(n,{buttonText:`Add ${J()}`,onClick:()=>{z?y(z)||k(z)?(B(z),O(!1),S(""),_(!1)):S("Enter valid URL"):_(!0)}})})),e("input",{ref:D,style:{display:"none"},type:"file",onChange:P.handleImageUpload,accept:q}),!!P.selectedImage&&e(p,{aspectRatio:15/8,src:P.selectedImage,onCropComplete:P.onCropComplete,onCancel:()=>{P.setLoading(!1),P.setSelectedImage(""),D.current&&(D.current.value="")}})]})};export{E as default};
1
+ import{jsx as e,Fragment as t,jsxs as o}from"react/jsx-runtime";import i from"../../../assets/icons/arrow_back.svg.js";import a from"../../../assets/icons/info.svg.js";import"../../curtain/CurtainHelper.js";import{PickerType as r}from"../../variable-picker-v3/model.js";import{useState as s,useEffect as l}from"react";import{Button as n}from"../../button/Button.js";import{BikImageCropper as p}from"../../image-cropper/BikImageCropper.js";import"../../image-compress/ImageCompress.js";import"../../states/StateComponent.js";import"../../../_virtual/_tslib.js";import"../../states-modal/StateModalComponent.js";import"../../modals/styledModal.js";import{InputWithVariables as d}from"../../input-with-vars/InputWithVariables.js";import{PureSpinner as m}from"../../spinner/Spinner.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{DEFAULT_THEME as c,COLORS as g}from"../../../constants/Theme.js";import{HEADER_TYPES as h}from"../../template-preview/models/TemplateMeta.js";import{POD as u}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{TitleRegular as f,TitleMedium as v,BodySecondary as b,BodyCaption as j}from"../../TypographyStyle.js";import{validateURL as y}from"../../../utils/validator.js";import x from"../../../assets/icons/file.svg.js";import C from"../../../assets/icons/filePdf.svg.js";import I from"../../../assets/icons/image.svg.js";import M from"../../../assets/icons/upload.svg.js";import{useTemplateModalContext as w}from"../context/templateModalContext.js";import{isVariable as k}from"../utils/validateIsUrl.js";const E=E=>{let{setOpenEditMedia:O,mediaComponentFormat:A,variableListForImage:V,openEditMedia:T,uploadMedia:B,fileRef:D,useEditWhatsappTemplateMediaResponse:P,skipAddVariable:U}=E;const{pod:L,setHideCrossButton:G,setHideFooterButton:R}=w(),[W,S]=s(""),[H,$]=s(void 0),[F,_]=s(!1),[N,q]=s("");let z;if(l((()=>(R(!0),()=>{R(!1)})),[]),l((()=>{const e=document.querySelector('[class*="ModalWrapper"]');e&&$(e)}),[P.loading]),z=A===h.IMAGE?"image/png, image/jpeg":A===h.VIDEO?"video/mp4":"application/pdf",!T)return e(t,{});const J=()=>A===h.IMAGE?"Image":A===h.VIDEO?"Video":"Document";return o(t,{children:[o("div",Object.assign({style:{display:"flex",gap:"10px",alignItems:"center",marginBottom:"16px"}},{children:[e(i,{onClick:e=>{e.stopPropagation(),O(!1),S("")},style:{cursor:"pointer"},width:16,height:16}),e(f,{children:"Update Media"})]})),o("div",Object.assign({style:{position:"relative",padding:16,borderRadius:4,border:F?`1px dashed ${c.colorsV2.stroke.negative.vibrant}`:`1px dashed ${c.colorsV2.stroke.primary}`,backgroundColor:c.colorsV2.surface.subdued,width:"100%",height:"100%",alignItems:"center",display:P.loading?"flex":"initial"}},{children:[o("div",Object.assign({style:{marginBottom:24,display:"flex",justifyContent:"center",flexDirection:"column",alignItems:"center",gap:16}},{children:[P.loading?e(m,{width:"40px",height:"40px",color:g.content.brand}):e("div",Object.assign({style:{height:64,width:64,borderRadius:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:c.colorsV2.background.base}},{children:A===h.IMAGE?e(I,{width:40,height:40}):A===h.VIDEO?e(x,{width:40,height:40}):e(C,{width:40,height:40})})),e(v,{children:P.loading?"Upload in progress...":A===h.IMAGE?"Upload an image":A===h.VIDEO?"Upload a video":"Upload a document"}),e(b,Object.assign({color:g.content.secondary},{children:P.loading?`Your ${A.toLowerCase()} is getting loaded. This may take a couple of minutes.`:A===h.IMAGE?"JPEG/ PNG format • Max 5MB":A===h.VIDEO?"MP4 format video • Max 16MB":"PDF format document • Max 100MB"}))]})),!P.loading&&o(t,{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"6px"}},{children:e(d,{labelText:`${J()} URL`,onPickerToggle:e=>{G(!!e)},pickerType:r.EMBEDDED,portalElement:null!=H?H:document.body,noMaxCharCheck:!0,allowMix:!1,onChange:e=>{q(e.actualValue),_(!1)},showVarHeader:!0,varHeaderText:"Select variable",errorMessage:W,prevVariable:{actualValue:"",variableType:"string"},variablesList:V,placeHolder:U?"Enter URL":"Enter URL/Add variable",showAddButton:L!==u.CAMPAIGN||!U&&A===h.IMAGE})})),o("div",Object.assign({style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:"4px",marginBottom:"12px"}},{children:[e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}}),e(j,{children:"Or upload media from device"}),e("hr",{style:{height:"2px",flex:.5,backgroundColor:"black"}})]})),e("div",Object.assign({style:{display:"flex",width:"100%"}},{children:e(n,{matchParentWidth:!0,buttonText:"Upload",buttonType:"dashBold",LeadingIcon:M,onClick:()=>{B(),_(!1)},size:"medium"})}))]}),F&&o("div",Object.assign({style:{position:"absolute",display:"flex",alignItems:"center",bottom:-24,left:0,gap:4}},{children:[e(a,{width:16,height:16,color:g.content.negative}),e(j,Object.assign({style:{color:g.content.negative}},{children:`Select ${J()}`}))]}))]})),!P.loading&&e("div",Object.assign({style:{display:"flex",justifyContent:"flex-end",marginTop:8}},{children:e(n,{buttonText:`Add ${J()}`,onClick:()=>{N?y(N)||k(N)?(B(N),O(!1),S(""),_(!1)):S("Enter valid URL"):_(!0)}})})),e("input",{ref:D,style:{display:"none"},type:"file",onChange:P.handleImageUpload,accept:z}),!!P.selectedImage&&e(p,{aspectRatio:15/8,src:P.selectedImage,onCropComplete:P.onCropComplete,onCancel:()=>{P.setLoading(!1),P.setSelectedImage(""),D.current&&(D.current.value="")}})]})};export{E as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.772-beta.8",
3
+ "version": "0.0.772-test.10",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",