@bikdotai/bik-component-library 0.0.509-beta.pp-3 → 0.0.510-beta-001

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.
@@ -0,0 +1 @@
1
+ export declare const ActionButtonContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface ActionButtonInterface {
3
+ configuredState: 'CONFIGURED' | 'NOT-CONFIGURED';
4
+ buttonText: string;
5
+ icon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
6
+ }
7
+ declare const ActionButton: React.FC<ActionButtonInterface>;
8
+ export default ActionButton;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),l=require("react"),o=require("../checkBox/CheckBox.js"),c=require("../icon-button/IconButton.js"),i=require("../tag/Tag.js"),r=require("../tooltips/Tooltip.js"),n=require("../TypographyStyle.js"),s=require("./emptyState.js"),d=require("./ProductPickerShimmer.js"),a=require("./style.js"),u=require("./utility.js");const h=l=>{const{customCollectionRestriction:s,data:d,selectedCollectionsDispatch:u,setCollectionId:h,setSelectedCollectionId:C,isPartiallyChecked:g,setScreen:p,id:v,isChecked:j,isDisabled:y,hideCollectionCheckbox:x,pickerType:b,usedInSearch:f}=l;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:y,onClick:e=>{if(!y){if("COLLECTION"===b)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:v,val:d,isRestricted:s}}),h(v),void C(v);h(v),C(v),p("products")}},isActive:j,usedInSearch:null!=f&&f},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[!x&&e.jsx(o.CheckBox,{isDisabled:y,isChecked:j,isPartiallyChecked:g,onValueChange:function(e,t,l){null==l||l.stopPropagation(),u(e?{type:"selected",data:{id:v,val:d,isRestricted:s}}:{type:"unselected",data:{id:v}}),C(e?v:"")}}),e.jsx(a.CollectionCardDetailStyle,{children:e.jsx(r.Tooltip,Object.assign({body:d.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(a.CollectionNameHolder,{children:[f?e.jsx(n.BodyPrimary,Object.assign({numberOfLines:1},{children:d.name})):e.jsx(n.TitleRegular,Object.assign({numberOfLines:1},{children:d.name})),d.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(i.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==b&&e.jsx(c.IconButton,{height:12,width:12,disabled:y,Icon:t.default})]}))};exports.CollectionCard=h,exports.CollectionsScreen=t=>{var o;const{customCollectionRestriction:c,dataLoading:i,collections:r,selectedCollectionsDispatch:n,setCollectionId:a,setSelectedCollectionId:C,selectedCollections:g,setScreen:p,collectionFetcher:v,collectionsDispatch:j,pagingControls:y,storeId:x,setSaveDisabled:b,hideCollectionCheckbox:f,renderWithoutModal:m,pickerType:k,scrollContainerRef:S}=t,P=l.useRef(null),O=l.useRef(y.curPage),I=!!c&&(null==g?void 0:g.isCustom),[R,T]=l.useState(!1),q=l.useRef(!1),D=l.useRef(!1),L=()=>{if(console.log("handleScroll called"),!S||!(null==S?void 0:S.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:l}=S.current;console.log("handleScroll check",{hasAllCollectionsLoaded:q,isFetchingRef:D}),e+t>=l-20&&!q.current&&!D.current&&(b(!0),T(!0),D.current=!0,b(!0),T(!0),v(O.current,x).then((e=>{j({type:"paged",data:(null==e?void 0:e.collections)||{}}),y.setCurPage(O.current+1),T(!1),b(!1),D.current=!1,console.log("handleScroll collectionsParsed",{collectionsParsed:e}),Object.keys(null==e?void 0:e.collections).length||(console.log("handleScroll setting hasCollections",{hasAllCollectionsLoaded:q,isFetchingRef:D}),q.current=!0)})).catch())};return l.useEffect((()=>{var e;return null===(e=null==S?void 0:S.current)||void 0===e||e.addEventListener("scroll",L),()=>{var e;null===(e=null==S?void 0:S.current)||void 0===e||e.removeEventListener("scroll",L)}}),[]),l.useEffect((()=>{O.current=y.curPage}),[y.curPage]),l.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&O.current>0&&!q.current&&(b(!0),T(!0),v(O.current,x).then((e=>{j({type:"paged",data:(null==e?void 0:e.collections)||{}}),y.setCurPage(O.current+1),T(!1),b(!1),Object.keys(e).length||(q.current=!0)})).catch())}),{threshold:1});return P.current&&e.observe(P.current),()=>{P.current&&e.unobserve(P.current)}}),[P]),e.jsxs("div",{children:[(null===(o=Object.keys(null!=r?r:{}))||void 0===o?void 0:o.length)?Object.keys(r).map((t=>{var l,o;const i=!!(null==g?void 0:g[t])&&("PRODUCT"!==k||!!Object.keys(null!==(o=null===(l=null==g?void 0:g[t])||void 0===l?void 0:l.products)&&void 0!==o?o:{}).length);return e.jsx(h,{customCollectionRestriction:c,data:r[t],isDisabled:I&&!(null==g?void 0:g[t]),isChecked:i,isPartiallyChecked:u.isCollectionPartiallyChecked(t,null==r?void 0:r[t],g),selectedCollectionsDispatch:n,setCollectionId:a,setSelectedCollectionId:C,setScreen:p,id:t,hideCollectionCheckbox:f||"-1"===t,selectedCollections:g,renderWithoutModal:m,pickerType:k},t)})):i?e.jsx(d.ProductPickerShimmer,{}):e.jsx(s.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:P}),R&&e.jsx(d.ProductPickerShimmer,{})]})},exports.truncate=(e,t,l)=>{if(!e)return"";if(e.length<=t)return e;const o=e.slice(0,t-1);return(l?o.slice(0,o.lastIndexOf(" ")):o)+"..."};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),l=require("react"),r=require("../checkBox/CheckBox.js"),i=require("../icon-button/IconButton.js"),c=require("../tag/Tag.js"),n=require("../tooltips/Tooltip.js"),s=require("../TypographyStyle.js"),o=require("./emptyState.js"),d=require("./ProductPickerShimmer.js"),a=require("./style.js"),u=require("./utility.js");const h=l=>{const{customCollectionRestriction:o,data:d,selectedCollectionsDispatch:u,setCollectionId:h,setSelectedCollectionId:C,isPartiallyChecked:p,setScreen:v,id:j,isChecked:g,isDisabled:y,hideCollectionCheckbox:x,pickerType:b,usedInSearch:m}=l;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:y,onClick:e=>{if(!y){if("COLLECTION"===b)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:j,val:d,isRestricted:o}}),h(j),void C(j);h(j),C(j),v("products")}},isActive:g,usedInSearch:null!=m&&m},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[!x&&e.jsx(r.CheckBox,{isDisabled:y,isChecked:g,isPartiallyChecked:p,onValueChange:function(e,t,l){null==l||l.stopPropagation(),u(e?{type:"selected",data:{id:j,val:d,isRestricted:o}}:{type:"unselected",data:{id:j}}),C(e?j:"")}}),e.jsx(a.CollectionCardDetailStyle,{children:e.jsx(n.Tooltip,Object.assign({body:d.name,placement:"bottom",delay:400,variant:"light"},{children:e.jsxs(a.CollectionNameHolder,{children:[m?e.jsx(s.BodyPrimary,Object.assign({numberOfLines:1},{children:d.name})):e.jsx(s.TitleRegular,Object.assign({numberOfLines:1},{children:d.name})),d.isSmartCollection?e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(c.Tag,{tagText:"Smart Collection",type:"warning"})})):e.jsx(e.Fragment,{})]})}))})]}),"COLLECTION"!==b&&e.jsx(i.IconButton,{height:12,width:12,disabled:y,Icon:t.default})]}))};exports.CollectionCard=h,exports.CollectionsScreen=t=>{var r;const{customCollectionRestriction:i,dataLoading:c,collections:n,selectedCollectionsDispatch:s,setCollectionId:a,setSelectedCollectionId:C,selectedCollections:p,setScreen:v,collectionFetcher:j,collectionsDispatch:g,pagingControls:y,storeId:x,setSaveDisabled:b,hideCollectionCheckbox:m,renderWithoutModal:f,pickerType:k,scrollContainerRef:S}=t,O=l.useRef(null),P=l.useRef(y.curPage),I=!!i&&(null==p?void 0:p.isCustom),[T,R]=l.useState(!1),q=l.useRef(!1),D=l.useRef(!1),L=()=>{if(!S||!(null==S?void 0:S.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:l}=S.current;e+t>=l-20&&!q.current&&!D.current&&(b(!0),R(!0),D.current=!0,b(!0),R(!0),j(P.current,x).then((e=>{g({type:"paged",data:(null==e?void 0:e.collections)||{}}),y.setCurPage(P.current+1),R(!1),b(!1),D.current=!1,Object.keys(null==e?void 0:e.collections).length||(q.current=!0)})).catch())};return l.useEffect((()=>{var e;return null===(e=null==S?void 0:S.current)||void 0===e||e.addEventListener("scroll",L),()=>{var e;null===(e=null==S?void 0:S.current)||void 0===e||e.removeEventListener("scroll",L)}}),[]),l.useEffect((()=>{P.current=y.curPage}),[y.curPage]),l.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&P.current>0&&!q.current&&(b(!0),R(!0),j(P.current,x).then((e=>{g({type:"paged",data:(null==e?void 0:e.collections)||{}}),y.setCurPage(P.current+1),R(!1),b(!1),Object.keys(e).length||(q.current=!0)})).catch())}),{threshold:1});return O.current&&e.observe(O.current),()=>{O.current&&e.unobserve(O.current)}}),[O]),e.jsxs("div",{children:[(null===(r=Object.keys(null!=n?n:{}))||void 0===r?void 0:r.length)?Object.keys(n).map((t=>{var l,r;const c=!!(null==p?void 0:p[t])&&("PRODUCT"!==k||!!Object.keys(null!==(r=null===(l=null==p?void 0:p[t])||void 0===l?void 0:l.products)&&void 0!==r?r:{}).length);return e.jsx(h,{customCollectionRestriction:i,data:n[t],isDisabled:I&&!(null==p?void 0:p[t]),isChecked:c,isPartiallyChecked:u.isCollectionPartiallyChecked(t,null==n?void 0:n[t],p),selectedCollectionsDispatch:s,setCollectionId:a,setSelectedCollectionId:C,setScreen:v,id:t,hideCollectionCheckbox:m||"-1"===t,selectedCollections:p,renderWithoutModal:f,pickerType:k},t)})):c?e.jsx(d.ProductPickerShimmer,{}):e.jsx(o.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:O}),T&&e.jsx(d.ProductPickerShimmer,{})]})},exports.truncate=(e,t,l)=>{if(!e)return"";if(e.length<=t)return e;const r=e.slice(0,t-1);return(l?r.slice(0,r.lastIndexOf(" ")):r)+"..."};
@@ -7,5 +7,6 @@ export type RadioButtonProps = {
7
7
  onValueChange: (checked: boolean, value?: string) => void;
8
8
  skipHoverState?: boolean;
9
9
  size?: 'DEFAULT' | 'SMALL';
10
+ skipSelectingOff?: boolean;
10
11
  };
11
12
  export declare const RadioButton: React.FC<RadioButtonProps>;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=i=>{const s=i.isDisabled?l.COLORS.content.inactive:i.isActive?l.COLORS.background.positive.vibrant:l.COLORS.content.primary;return e.jsxs("svg",Object.assign({width:i.isSmall?"16":"20",height:i.isSmall?"16":"20",viewBox:i.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?6:9,stroke:s,strokeWidth:i.isSmall?1.5:2}),i.isActive&&e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?3:5,fill:i.isDisabled?l.COLORS.content.inactive:l.COLORS.background.positive.vibrant})]}))};exports.RadioButton=r=>{const[o,n]=i.useState(r.isActive||!1),[c,d]=i.useState(!1),[S,u]=i.useState(!1);return i.useEffect((()=>{n(r.isActive)}),[r.isActive]),e.jsxs(s.RadioButtonContainer,Object.assign({onClick:()=>{var e;if(!r.isDisabled){const i=!o;n(i),null===(e=r.onValueChange)||void 0===e||e.call(r,i,r.value)}},onMouseEnter:()=>d(!r.skipHoverState),onMouseLeave:()=>d(!1),onMouseDown:()=>u(!r.skipHoverState),onMouseUp:()=>u(!1)},{children:[e.jsx(s.RadioButtonIcon,Object.assign({checked:o,hovered:c,clicked:S,isDisabled:r.isDisabled||!1,size:r.size},{children:e.jsx(a,{isSmall:"SMALL"===r.size,isActive:o,isDisabled:r.isDisabled||!1})})),r.label&&"SMALL"!==r.size&&e.jsx(t.BodyPrimary,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label})),r.label&&"SMALL"===r.size&&e.jsx(t.BodyCaption,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label}))]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),s=require("./RadioButton.styled.js"),t=require("../TypographyStyle.js"),l=require("../../constants/Theme.js");const a=i=>{const s=i.isDisabled?l.COLORS.content.inactive:i.isActive?l.COLORS.background.positive.vibrant:l.COLORS.content.primary;return e.jsxs("svg",Object.assign({width:i.isSmall?"16":"20",height:i.isSmall?"16":"20",viewBox:i.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?6:9,stroke:s,strokeWidth:i.isSmall?1.5:2}),i.isActive&&e.jsx("circle",{cx:i.isSmall?"8":"10",cy:i.isSmall?"8":"10",r:i.isSmall?3:5,fill:i.isDisabled?l.COLORS.content.inactive:l.COLORS.background.positive.vibrant})]}))};exports.RadioButton=r=>{const[n,o]=i.useState(r.isActive||!1),[c,d]=i.useState(!1),[S,u]=i.useState(!1);return i.useEffect((()=>{o(r.isActive)}),[r.isActive]),e.jsxs(s.RadioButtonContainer,Object.assign({onClick:()=>{var e;if(!r.skipSelectingOff&&!r.isDisabled){const i=!n;o(i),null===(e=r.onValueChange)||void 0===e||e.call(r,i,r.value)}},onMouseEnter:()=>d(!r.skipHoverState),onMouseLeave:()=>d(!1),onMouseDown:()=>u(!r.skipHoverState),onMouseUp:()=>u(!1)},{children:[e.jsx(s.RadioButtonIcon,Object.assign({checked:n,hovered:c,clicked:S,isDisabled:r.isDisabled||!1,size:r.size},{children:e.jsx(a,{isSmall:"SMALL"===r.size,isActive:n,isDisabled:r.isDisabled||!1})})),r.label&&"SMALL"!==r.size&&e.jsx(t.BodyPrimary,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label})),r.label&&"SMALL"===r.size&&e.jsx(t.BodyCaption,Object.assign({color:r.isDisabled?l.COLORS.text.disabled:l.COLORS.text.primary},{children:r.label}))]}))};
@@ -4,4 +4,4 @@
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `;exports.default=a=>{const{bodyText:j,footerText:m,headerMediaType:y,headerText:S,headerAssetLink:g,headerAssetName:f,quickReplybtn:v,ctaBtn:q,actionTypes:E,textType:b,extras:w,showHeader:C,imagePreviewStyles:A,size:N,children:O,isPreview:F}=a,M=new l.WhatsAppFormatToHTML,P=i.useMemo((()=>({color:d.COLORS.content.primary,margin:12,fontSize:C?d.FONTS.caption.fontSize:d.FONTS.bodySecondary.fontSize,fontWeight:d.FONTS.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e.jsxs(p.Container,Object.assign({isPreview:F},{children:[e.jsx(u,{children:e.jsx(t.default,{color:"white",height:8,width:8})}),y===c.HEADER_TYPES.TEXT?e.jsx(T.default,{bold:!0,text:S}):y!==c.HEADER_TYPES.NONE?e.jsx(x.MediaCard,{headerAssetLink:g,headerAssetName:f,mediaType:y,imagePreviewStyles:y===c.HEADER_TYPES.IMAGE?A:{}}):e.jsx(e.Fragment,{}),!!j&&e.jsx(e.Fragment,{children:O?e.jsx(e.Fragment,{children:O}):e.jsx(e.Fragment,{children:"html"===b?e.jsx("div",{className:"richTextEditor",style:P,dangerouslySetInnerHTML:{__html:M.convertToHTML(j)}}):e.jsx(n.BodySecondary,{children:j})})}),e.jsxs(p.FooterWrapper,{children:[e.jsx(o.Tooltip,Object.assign({body:null!=m?m:"",placement:"top"},{children:e.jsx(p.TimeStamp,Object.assign({style:{flex:1}},{children:m}))})),e.jsx(p.TimeStamp,{children:"16:48"})]}),E===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(h.ChatBtn,{text:t.text},r)))}):E===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==q?void 0:q.map(((t,i)=>e.jsx(h.ChatBtn,{textTypography:C?n.Caption:n.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:s.default,size:N},i)))}):e.jsx(e.Fragment,{})]}))};
7
+ `;exports.default=a=>{const{bodyText:j,footerText:m,headerMediaType:y,headerText:g,headerAssetLink:S,headerAssetName:f,quickReplybtn:v,ctaBtn:q,actionTypes:E,textType:b,extras:w,showHeader:C,imagePreviewStyles:A,size:N,children:F,isPreview:O}=a,M=new l.WhatsAppFormatToHTML,P=i.useMemo((()=>({color:d.COLORS.content.primary,margin:12,fontSize:C?d.FONTS.caption.fontSize:d.FONTS.bodySecondary.fontSize,fontWeight:d.FONTS.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e.jsxs(p.Container,Object.assign({isPreview:O},{children:[e.jsx(u,{children:e.jsx(t.default,{color:"white",height:8,width:8})}),y===c.HEADER_TYPES.TEXT?e.jsx(T.default,{bold:!0,text:g}):y!==c.HEADER_TYPES.NONE?e.jsx(x.MediaCard,{headerAssetLink:S,headerAssetName:f,mediaType:y,imagePreviewStyles:y===c.HEADER_TYPES.IMAGE?A:{}}):e.jsx(e.Fragment,{}),!!j&&e.jsx(e.Fragment,{children:F?e.jsx(e.Fragment,{children:F}):e.jsx(e.Fragment,{children:"html"===b?e.jsx("div",{className:"richTextEditor",style:P,dangerouslySetInnerHTML:{__html:M.convertToHTML(j)}}):e.jsx(n.BodySecondary,{children:j})})}),e.jsxs(p.FooterWrapper,{children:[e.jsx(o.Tooltip,Object.assign({body:null!=m?m:"",placement:"top"},{children:e.jsx(p.FooterText,Object.assign({style:{flex:1}},{children:m}))})),e.jsx(p.TimeStamp,{children:"16:48"})]}),E===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==v?void 0:v.map(((t,r)=>e.jsx(h.ChatBtn,{text:t.text},r)))}):E===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==q?void 0:q.map(((t,i)=>e.jsx(h.ChatBtn,{textTypography:C?n.Caption:n.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:s.default,size:N},i)))}):e.jsx(e.Fragment,{})]}))};
@@ -9,6 +9,10 @@ export declare const TimeStamp: import("styled-components").StyledComponent<"div
9
9
  numberOfLines?: number | undefined;
10
10
  color?: string | undefined;
11
11
  }, never>;
12
+ export declare const FooterText: import("styled-components").StyledComponent<"div", any, {
13
+ numberOfLines?: number | undefined;
14
+ color?: string | undefined;
15
+ }, never>;
12
16
  export declare const MediaContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
13
17
  export declare const ChatBtnContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
14
18
  export declare const FooterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -21,7 +21,9 @@
21
21
  white-space: nowrap;
22
22
  overflow: hidden;
23
23
  text-wrap: wrap;
24
- `,s=i.default.div`
24
+ `,s=i.default(d)`
25
+ max-width: 200px;
26
+ `,p=i.default.div`
25
27
  border-radius: 8px;
26
28
  display: flex;
27
29
  flex-direction: column;
@@ -37,7 +39,7 @@
37
39
  justify-content: center;
38
40
  align-items: center;
39
41
  border-top: 1px solid ${r.COLORS.stroke.primary};
40
- `,p=i.default.div`
42
+ `,x=i.default.div`
41
43
  display: flex;
42
44
  flex-direction: row;
43
45
  justify-content: space-between;
@@ -60,4 +62,4 @@
60
62
  position: absolute;
61
63
  top: 16px;
62
64
  right: 16px;
63
- `,exports.ChatBtnContainer=n,exports.Container=a,exports.FooterWrapper=p,exports.MediaContainer=s,exports.TimeStamp=d;
65
+ `,exports.ChatBtnContainer=n,exports.Container=a,exports.FooterText=s,exports.FooterWrapper=x,exports.MediaContainer=p,exports.TimeStamp=d;
@@ -16,4 +16,4 @@
16
16
  `,g=f.default(C)`
17
17
  font-weight: 600;
18
18
  margin-bottom: 8px;
19
- `,E=new u.VariableEditorHelper;exports.ChatUIV2=o=>{const{bodyText:p,footerText:u,headerMediaType:T,headerText:f,headerAssetLink:v,headerAssetName:b,quickReplybtn:q,ctaBtn:O,actionTypes:_,extras:w,showHeader:P,imagePreviewStyles:S,size:I,bodyVariableList:L,headerVariableList:A,buttons:M,limitedTimeOfferComponent:N,carouselCardIndex:R,isWhatsappCarousel:B,isPreview:H}=o,Y=E.format(p,L),U=E.format(f,A),{selectedCarouselIndex:D,isProductCarouselType:F,errorIndexes:V}=n.useTemplateModalContext(),k={COPY_CODE:t.default,PHONE_NUMBER:s.default,URL:a.default,QUICK_REPLY:i.default};return e.jsxs(h.Container,Object.assign({isCarouselCard:null!=R&&R>-1,showBorder:null!=R&&R===D||F&&null!=R&&R>-1&&null!=D&&D>-1,hasError:null==V?void 0:V.includes(null!=R?R:-2),isWhatsappCarousel:B,isPreview:H},{children:[!B&&e.jsx(y,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),T===x.HEADER_TYPES.TEXT?e.jsx(g,{dangerouslySetInnerHTML:{__html:U}}):T!==x.HEADER_TYPES.NONE?e.jsx(j.MediaCard,{headerAssetLink:v,headerAssetName:b,mediaType:T,imagePreviewStyles:T===x.HEADER_TYPES.IMAGE?S:{}}):e.jsx(e.Fragment,{}),(null==N?void 0:N.dateTime)?e.jsx(m.LimitedTimeOffer,{text:N.text,dateTime:N.dateTime,code:N.code}):e.jsx(e.Fragment,{}),!!p&&e.jsx(e.Fragment,{children:e.jsx(C,{dangerouslySetInnerHTML:{__html:Y}})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(l.Tooltip,Object.assign({body:null!=u?u:"",placement:"top"},{children:e.jsx(h.TimeStamp,Object.assign({style:{flex:1}},{children:u}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),M&&M.length>0?M.map(((t,r)=>e.jsx(c.ChatBtn,{text:"COPY_CODE"===t.type?"Copy code":t.text,Icon:k[t.type],size:I},r))):_===x.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==q?void 0:q.map(((t,r)=>e.jsx(c.ChatBtn,{text:t.text},r)))}):_===x.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==O?void 0:O.map(((t,r)=>e.jsx(c.ChatBtn,{textTypography:P?d.Caption:d.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?s.default:a.default,size:I},r)))}):e.jsx(e.Fragment,{})]}))};
19
+ `,E=new u.VariableEditorHelper;exports.ChatUIV2=o=>{const{bodyText:p,footerText:u,headerMediaType:T,headerText:f,headerAssetLink:v,headerAssetName:b,quickReplybtn:q,ctaBtn:O,actionTypes:_,extras:w,showHeader:P,imagePreviewStyles:I,size:S,bodyVariableList:L,headerVariableList:A,buttons:M,limitedTimeOfferComponent:N,carouselCardIndex:R,isWhatsappCarousel:B,isPreview:H}=o,Y=E.format(p,L),F=E.format(f,A),{selectedCarouselIndex:U,isProductCarouselType:D,errorIndexes:V}=n.useTemplateModalContext(),k={COPY_CODE:t.default,PHONE_NUMBER:s.default,URL:a.default,QUICK_REPLY:i.default};return e.jsxs(h.Container,Object.assign({isCarouselCard:null!=R&&R>-1,showBorder:null!=R&&R===U||D&&null!=R&&R>-1&&null!=U&&U>-1,hasError:null==V?void 0:V.includes(null!=R?R:-2),isWhatsappCarousel:B,isPreview:H},{children:[!B&&e.jsx(y,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),T===x.HEADER_TYPES.TEXT?e.jsx(g,{dangerouslySetInnerHTML:{__html:F}}):T!==x.HEADER_TYPES.NONE?e.jsx(j.MediaCard,{headerAssetLink:v,headerAssetName:b,mediaType:T,imagePreviewStyles:T===x.HEADER_TYPES.IMAGE?I:{}}):e.jsx(e.Fragment,{}),(null==N?void 0:N.dateTime)?e.jsx(m.LimitedTimeOffer,{text:N.text,dateTime:N.dateTime,code:N.code}):e.jsx(e.Fragment,{}),!!p&&e.jsx(e.Fragment,{children:e.jsx(C,{dangerouslySetInnerHTML:{__html:Y}})}),e.jsxs(h.FooterWrapper,{children:[e.jsx(l.Tooltip,Object.assign({body:null!=u?u:"",placement:"top"},{children:e.jsx(h.FooterText,Object.assign({style:{flex:1}},{children:u}))})),e.jsx(h.TimeStamp,{children:"16:48"})]}),M&&M.length>0?M.map(((t,r)=>e.jsx(c.ChatBtn,{text:"COPY_CODE"===t.type?"Copy code":t.text,Icon:k[t.type],size:S},r))):_===x.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==q?void 0:q.map(((t,r)=>e.jsx(c.ChatBtn,{text:t.text},r)))}):_===x.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==O?void 0:O.map(((t,r)=>e.jsx(c.ChatBtn,{textTypography:P?d.Caption:d.BodySecondary,extraContent:w?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?s.default:a.default,size:S},r)))}):e.jsx(e.Fragment,{})]}))};
@@ -0,0 +1 @@
1
+ export declare const ActionButtonContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -0,0 +1,8 @@
1
+ import React from 'react';
2
+ export interface ActionButtonInterface {
3
+ configuredState: 'CONFIGURED' | 'NOT-CONFIGURED';
4
+ buttonText: string;
5
+ icon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
6
+ }
7
+ declare const ActionButton: React.FC<ActionButtonInterface>;
8
+ export default ActionButton;
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import o from"../../assets/icons/chevronRight.svg.js";import{useRef as c,useState as i,useEffect as n}from"react";import{CheckBox as r}from"../checkBox/CheckBox.js";import{IconButton as s}from"../icon-button/IconButton.js";import{Tag as d}from"../tag/Tag.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{TitleRegular as u,BodyPrimary as h}from"../TypographyStyle.js";import{EmptyState as p}from"./emptyState.js";import{ProductPickerShimmer as C}from"./ProductPickerShimmer.js";import{CollectionCardStyle as g,CollectionCardInfoStyle as m,CollectionCardDetailStyle as v,CollectionNameHolder as y}from"./style.js";import{isCollectionPartiallyChecked as b}from"./utility.js";const f=(e,t,l)=>{if(!e)return"";if(e.length<=t)return e;const o=e.slice(0,t-1);return(l?o.slice(0,o.lastIndexOf(" ")):o)+"..."},k=l=>{var o;const{customCollectionRestriction:r,dataLoading:s,collections:d,selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,selectedCollections:g,setScreen:m,collectionFetcher:v,collectionsDispatch:y,pagingControls:f,storeId:k,setSaveDisabled:S,hideCollectionCheckbox:O,renderWithoutModal:I,pickerType:P,scrollContainerRef:T}=l,x=c(null),D=c(f.curPage),L=!!r&&(null==g?void 0:g.isCustom),[R,w]=i(!1),E=c(!1),A=c(!1),B=()=>{if(console.log("handleScroll called"),!T||!(null==T?void 0:T.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:l}=T.current;console.log("handleScroll check",{hasAllCollectionsLoaded:E,isFetchingRef:A}),e+t>=l-20&&!E.current&&!A.current&&(S(!0),w(!0),A.current=!0,S(!0),w(!0),v(D.current,k).then((e=>{y({type:"paged",data:(null==e?void 0:e.collections)||{}}),f.setCurPage(D.current+1),w(!1),S(!1),A.current=!1,console.log("handleScroll collectionsParsed",{collectionsParsed:e}),Object.keys(null==e?void 0:e.collections).length||(console.log("handleScroll setting hasCollections",{hasAllCollectionsLoaded:E,isFetchingRef:A}),E.current=!0)})).catch())};return n((()=>{var e;return null===(e=null==T?void 0:T.current)||void 0===e||e.addEventListener("scroll",B),()=>{var e;null===(e=null==T?void 0:T.current)||void 0===e||e.removeEventListener("scroll",B)}}),[]),n((()=>{D.current=f.curPage}),[f.curPage]),n((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&D.current>0&&!E.current&&(S(!0),w(!0),v(D.current,k).then((e=>{y({type:"paged",data:(null==e?void 0:e.collections)||{}}),f.setCurPage(D.current+1),w(!1),S(!1),Object.keys(e).length||(E.current=!0)})).catch())}),{threshold:1});return x.current&&e.observe(x.current),()=>{x.current&&e.unobserve(x.current)}}),[x]),e("div",{children:[(null===(o=Object.keys(null!=d?d:{}))||void 0===o?void 0:o.length)?Object.keys(d).map((e=>{var l,o;const c=!!(null==g?void 0:g[e])&&("PRODUCT"!==P||!!Object.keys(null!==(o=null===(l=null==g?void 0:g[e])||void 0===l?void 0:l.products)&&void 0!==o?o:{}).length);return t(j,{customCollectionRestriction:r,data:d[e],isDisabled:L&&!(null==g?void 0:g[e]),isChecked:c,isPartiallyChecked:b(e,null==d?void 0:d[e],g),selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,setScreen:m,id:e,hideCollectionCheckbox:O||"-1"===e,selectedCollections:g,renderWithoutModal:I,pickerType:P},e)})):s?t(C,{}):t(p,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),t("div",{ref:x}),R&&t(C,{})]})},j=c=>{const{customCollectionRestriction:i,data:n,selectedCollectionsDispatch:p,setCollectionId:C,setSelectedCollectionId:b,isPartiallyChecked:f,setScreen:k,id:j,isChecked:S,isDisabled:O,hideCollectionCheckbox:I,pickerType:P,usedInSearch:T}=c;return e(g,Object.assign({isDisabled:O,onClick:e=>{if(!O){if("COLLECTION"===P)return e.stopPropagation(),p({type:"reset",data:{}}),p({type:"selected",data:{id:j,val:n,isRestricted:i}}),C(j),void b(j);C(j),b(j),k("products")}},isActive:S,usedInSearch:null!=T&&T},{children:[e(m,{children:[!I&&t(r,{isDisabled:O,isChecked:S,isPartiallyChecked:f,onValueChange:function(e,t,l){null==l||l.stopPropagation(),p(e?{type:"selected",data:{id:j,val:n,isRestricted:i}}:{type:"unselected",data:{id:j}}),b(e?j:"")}}),t(v,{children:t(a,Object.assign({body:n.name,placement:"bottom",delay:400,variant:"light"},{children:e(y,{children:[t(T?h:u,Object.assign({numberOfLines:1},{children:n.name})),n.isSmartCollection?t("div",Object.assign({style:{display:"flex"}},{children:t(d,{tagText:"Smart Collection",type:"warning"})})):t(l,{})]})}))})]}),"COLLECTION"!==P&&t(s,{height:12,width:12,disabled:O,Icon:o})]}))};export{j as CollectionCard,k as CollectionsScreen,f as truncate};
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import l from"../../assets/icons/chevronRight.svg.js";import{useRef as i,useState as r,useEffect as n}from"react";import{CheckBox as c}from"../checkBox/CheckBox.js";import{IconButton as s}from"../icon-button/IconButton.js";import{Tag as d}from"../tag/Tag.js";import{Tooltip as a}from"../tooltips/Tooltip.js";import{TitleRegular as u,BodyPrimary as h}from"../TypographyStyle.js";import{EmptyState as p}from"./emptyState.js";import{ProductPickerShimmer as m}from"./ProductPickerShimmer.js";import{CollectionCardStyle as C,CollectionCardInfoStyle as v,CollectionCardDetailStyle as g,CollectionNameHolder as y}from"./style.js";import{isCollectionPartiallyChecked as b}from"./utility.js";const f=(e,t,o)=>{if(!e)return"";if(e.length<=t)return e;const l=e.slice(0,t-1);return(o?l.slice(0,l.lastIndexOf(" ")):l)+"..."},k=o=>{var l;const{customCollectionRestriction:c,dataLoading:s,collections:d,selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,selectedCollections:C,setScreen:v,collectionFetcher:g,collectionsDispatch:y,pagingControls:f,storeId:k,setSaveDisabled:O,hideCollectionCheckbox:I,renderWithoutModal:S,pickerType:P,scrollContainerRef:T}=o,x=i(null),D=i(f.curPage),L=!!c&&(null==C?void 0:C.isCustom),[R,w]=r(!1),E=i(!1),B=i(!1),N=()=>{if(!T||!(null==T?void 0:T.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:o}=T.current;e+t>=o-20&&!E.current&&!B.current&&(O(!0),w(!0),B.current=!0,O(!0),w(!0),g(D.current,k).then((e=>{y({type:"paged",data:(null==e?void 0:e.collections)||{}}),f.setCurPage(D.current+1),w(!1),O(!1),B.current=!1,Object.keys(null==e?void 0:e.collections).length||(E.current=!0)})).catch())};return n((()=>{var e;return null===(e=null==T?void 0:T.current)||void 0===e||e.addEventListener("scroll",N),()=>{var e;null===(e=null==T?void 0:T.current)||void 0===e||e.removeEventListener("scroll",N)}}),[]),n((()=>{D.current=f.curPage}),[f.curPage]),n((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&D.current>0&&!E.current&&(O(!0),w(!0),g(D.current,k).then((e=>{y({type:"paged",data:(null==e?void 0:e.collections)||{}}),f.setCurPage(D.current+1),w(!1),O(!1),Object.keys(e).length||(E.current=!0)})).catch())}),{threshold:1});return x.current&&e.observe(x.current),()=>{x.current&&e.unobserve(x.current)}}),[x]),e("div",{children:[(null===(l=Object.keys(null!=d?d:{}))||void 0===l?void 0:l.length)?Object.keys(d).map((e=>{var o,l;const i=!!(null==C?void 0:C[e])&&("PRODUCT"!==P||!!Object.keys(null!==(l=null===(o=null==C?void 0:C[e])||void 0===o?void 0:o.products)&&void 0!==l?l:{}).length);return t(j,{customCollectionRestriction:c,data:d[e],isDisabled:L&&!(null==C?void 0:C[e]),isChecked:i,isPartiallyChecked:b(e,null==d?void 0:d[e],C),selectedCollectionsDispatch:a,setCollectionId:u,setSelectedCollectionId:h,setScreen:v,id:e,hideCollectionCheckbox:I||"-1"===e,selectedCollections:C,renderWithoutModal:S,pickerType:P},e)})):s?t(m,{}):t(p,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),t("div",{ref:x}),R&&t(m,{})]})},j=i=>{const{customCollectionRestriction:r,data:n,selectedCollectionsDispatch:p,setCollectionId:m,setSelectedCollectionId:b,isPartiallyChecked:f,setScreen:k,id:j,isChecked:O,isDisabled:I,hideCollectionCheckbox:S,pickerType:P,usedInSearch:T}=i;return e(C,Object.assign({isDisabled:I,onClick:e=>{if(!I){if("COLLECTION"===P)return e.stopPropagation(),p({type:"reset",data:{}}),p({type:"selected",data:{id:j,val:n,isRestricted:r}}),m(j),void b(j);m(j),b(j),k("products")}},isActive:O,usedInSearch:null!=T&&T},{children:[e(v,{children:[!S&&t(c,{isDisabled:I,isChecked:O,isPartiallyChecked:f,onValueChange:function(e,t,o){null==o||o.stopPropagation(),p(e?{type:"selected",data:{id:j,val:n,isRestricted:r}}:{type:"unselected",data:{id:j}}),b(e?j:"")}}),t(g,{children:t(a,Object.assign({body:n.name,placement:"bottom",delay:400,variant:"light"},{children:e(y,{children:[t(T?h:u,Object.assign({numberOfLines:1},{children:n.name})),n.isSmartCollection?t("div",Object.assign({style:{display:"flex"}},{children:t(d,{tagText:"Smart Collection",type:"warning"})})):t(o,{})]})}))})]}),"COLLECTION"!==P&&t(s,{height:12,width:12,disabled:I,Icon:l})]}))};export{j as CollectionCard,k as CollectionsScreen,f as truncate};
@@ -7,5 +7,6 @@ export type RadioButtonProps = {
7
7
  onValueChange: (checked: boolean, value?: string) => void;
8
8
  skipHoverState?: boolean;
9
9
  size?: 'DEFAULT' | 'SMALL';
10
+ skipSelectingOff?: boolean;
10
11
  };
11
12
  export declare const RadioButton: React.FC<RadioButtonProps>;
@@ -1 +1 @@
1
- import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useState as s,useEffect as l}from"react";import{RadioButtonContainer as t,RadioButtonIcon as a}from"./RadioButton.styled.js";import{BodyPrimary as o,BodyCaption as r}from"../TypographyStyle.js";import{COLORS as c}from"../../constants/Theme.js";const n=s=>{const l=s.isDisabled?c.content.inactive:s.isActive?c.background.positive.vibrant:c.content.primary;return i("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:l,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?c.content.inactive:c.background.positive.vibrant})]}))},d=d=>{const[m,b]=s(d.isActive||!1),[v,p]=s(!1),[S,h]=s(!1);return l((()=>{b(d.isActive)}),[d.isActive]),i(t,Object.assign({onClick:()=>{var i;if(!d.isDisabled){const e=!m;b(e),null===(i=d.onValueChange)||void 0===i||i.call(d,e,d.value)}},onMouseEnter:()=>p(!d.skipHoverState),onMouseLeave:()=>p(!1),onMouseDown:()=>h(!d.skipHoverState),onMouseUp:()=>h(!1)},{children:[e(a,Object.assign({checked:m,hovered:v,clicked:S,isDisabled:d.isDisabled||!1,size:d.size},{children:e(n,{isSmall:"SMALL"===d.size,isActive:m,isDisabled:d.isDisabled||!1})})),d.label&&"SMALL"!==d.size&&e(o,Object.assign({color:d.isDisabled?c.text.disabled:c.text.primary},{children:d.label})),d.label&&"SMALL"===d.size&&e(r,Object.assign({color:d.isDisabled?c.text.disabled:c.text.primary},{children:d.label}))]}))};export{d as RadioButton};
1
+ import{jsxs as i,jsx as e}from"react/jsx-runtime";import{useState as s,useEffect as l}from"react";import{RadioButtonContainer as t,RadioButtonIcon as a}from"./RadioButton.styled.js";import{BodyPrimary as o,BodyCaption as r}from"../TypographyStyle.js";import{COLORS as c}from"../../constants/Theme.js";const n=s=>{const l=s.isDisabled?c.content.inactive:s.isActive?c.background.positive.vibrant:c.content.primary;return i("svg",Object.assign({width:s.isSmall?"16":"20",height:s.isSmall?"16":"20",viewBox:s.isSmall?"0 0 16 16":"0 0 20 20",fill:"none",xmlns:"http://www.w3.org/2000/svg"},{children:[e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?6:9,stroke:l,strokeWidth:s.isSmall?1.5:2}),s.isActive&&e("circle",{cx:s.isSmall?"8":"10",cy:s.isSmall?"8":"10",r:s.isSmall?3:5,fill:s.isDisabled?c.content.inactive:c.background.positive.vibrant})]}))},d=d=>{const[m,b]=s(d.isActive||!1),[v,p]=s(!1),[S,h]=s(!1);return l((()=>{b(d.isActive)}),[d.isActive]),i(t,Object.assign({onClick:()=>{var i;if(!d.skipSelectingOff&&!d.isDisabled){const e=!m;b(e),null===(i=d.onValueChange)||void 0===i||i.call(d,e,d.value)}},onMouseEnter:()=>p(!d.skipHoverState),onMouseLeave:()=>p(!1),onMouseDown:()=>h(!d.skipHoverState),onMouseUp:()=>h(!1)},{children:[e(a,Object.assign({checked:m,hovered:v,clicked:S,isDisabled:d.isDisabled||!1,size:d.size},{children:e(n,{isSmall:"SMALL"===d.size,isActive:m,isDisabled:d.isDisabled||!1})})),d.label&&"SMALL"!==d.size&&e(o,Object.assign({color:d.isDisabled?c.text.disabled:c.text.primary},{children:d.label})),d.label&&"SMALL"===d.size&&e(r,Object.assign({color:d.isDisabled?c.text.disabled:c.text.primary},{children:d.label}))]}))};export{d as RadioButton};
@@ -1,7 +1,7 @@
1
- import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,TimeStamp as j}from"./ChatUI.style.js";import{MediaCard as v}from"./MediaCard.js";import w from"./RenderTemplateWithVariable.js";const b=n.div`
1
+ import{jsxs as e,jsx as t,Fragment as r}from"react/jsx-runtime";import o from"../../../assets/icons/halfRectangle.svg.js";import i from"../../../assets/icons/phone.svg.js";import s from"../../../assets/icons/RedirectToNew.svg.js";import{useMemo as a}from"react";import n from"styled-components";import{Tooltip as m}from"../../tooltips/Tooltip.js";import{BodySecondary as p,Caption as d}from"../../TypographyStyle.js";import{COLORS as l,FONTS as h}from"../../../constants/Theme.js";import{WhatsAppFormatToHTML as c}from"../helpers/WhatsAppFormatToHTML.js";import{HEADER_TYPES as f,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as T}from"./ChatBtn.js";import{Container as x,FooterWrapper as g,FooterText as j,TimeStamp as v}from"./ChatUI.style.js";import{MediaCard as w}from"./MediaCard.js";import b from"./RenderTemplateWithVariable.js";const u=n.div`
2
2
  position: absolute;
3
3
  width: 8px;
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `,u=n=>{const{bodyText:u,footerText:S,headerMediaType:N,headerText:A,headerAssetLink:M,headerAssetName:C,quickReplybtn:L,ctaBtn:k,actionTypes:z,textType:B,extras:E,showHeader:I,imagePreviewStyles:P,size:R,children:W,isPreview:H}=n,O=new c,_=a((()=>({color:l.content.primary,margin:12,fontSize:I?h.caption.fontSize:h.bodySecondary.fontSize,fontWeight:h.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e(x,Object.assign({isPreview:H},{children:[t(b,{children:t(o,{color:"white",height:8,width:8})}),N===f.TEXT?t(w,{bold:!0,text:A}):N!==f.NONE?t(v,{headerAssetLink:M,headerAssetName:C,mediaType:N,imagePreviewStyles:N===f.IMAGE?P:{}}):t(r,{}),!!u&&t(r,{children:t(r,W?{children:W}:{children:"html"===B?t("div",{className:"richTextEditor",style:_,dangerouslySetInnerHTML:{__html:O.convertToHTML(u)}}):t(p,{children:u})})}),e(g,{children:[t(m,Object.assign({body:null!=S?S:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:S}))})),t(j,{children:"16:48"})]}),z===y.QUICK_REPLY?t("div",{children:null==L?void 0:L.map(((e,r)=>t(T,{text:e.text},r)))}):z===y.CTA_BTN?t("div",{children:null==k?void 0:k.map(((e,r)=>t(T,{textTypography:I?d:p,extraContent:E?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?i:s,size:R},r)))}):t(r,{})]}))};export{u as default};
7
+ `,S=n=>{const{bodyText:S,footerText:N,headerMediaType:A,headerText:M,headerAssetLink:C,headerAssetName:L,quickReplybtn:k,ctaBtn:z,actionTypes:B,textType:E,extras:I,showHeader:P,imagePreviewStyles:R,size:W,children:H,isPreview:O}=n,_=new c,U=a((()=>({color:l.content.primary,margin:12,fontSize:P?h.caption.fontSize:h.bodySecondary.fontSize,fontWeight:h.bodySecondary.fontWeight,maxWidth:"100%",whiteSpace:"pre-wrap",marginBottom:0,marginTop:8,wordBreak:"break-word"})),[]);return e(x,Object.assign({isPreview:O},{children:[t(u,{children:t(o,{color:"white",height:8,width:8})}),A===f.TEXT?t(b,{bold:!0,text:M}):A!==f.NONE?t(w,{headerAssetLink:C,headerAssetName:L,mediaType:A,imagePreviewStyles:A===f.IMAGE?R:{}}):t(r,{}),!!S&&t(r,{children:t(r,H?{children:H}:{children:"html"===E?t("div",{className:"richTextEditor",style:U,dangerouslySetInnerHTML:{__html:_.convertToHTML(S)}}):t(p,{children:S})})}),e(g,{children:[t(m,Object.assign({body:null!=N?N:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:N}))})),t(v,{children:"16:48"})]}),B===y.QUICK_REPLY?t("div",{children:null==k?void 0:k.map(((e,r)=>t(T,{text:e.text},r)))}):B===y.CTA_BTN?t("div",{children:null==z?void 0:z.map(((e,r)=>t(T,{textTypography:P?d:p,extraContent:I?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?i:s,size:W},r)))}):t(r,{})]}))};export{S as default};
@@ -9,6 +9,10 @@ export declare const TimeStamp: import("styled-components").StyledComponent<"div
9
9
  numberOfLines?: number | undefined;
10
10
  color?: string | undefined;
11
11
  }, never>;
12
+ export declare const FooterText: import("styled-components").StyledComponent<"div", any, {
13
+ numberOfLines?: number | undefined;
14
+ color?: string | undefined;
15
+ }, never>;
12
16
  export declare const MediaContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
13
17
  export declare const ChatBtnContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
14
18
  export declare const FooterWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
@@ -21,7 +21,9 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
21
21
  white-space: nowrap;
22
22
  overflow: hidden;
23
23
  text-wrap: wrap;
24
- `,d=e.div`
24
+ `,d=e(i)`
25
+ max-width: 200px;
26
+ `,s=e.div`
25
27
  border-radius: 8px;
26
28
  display: flex;
27
29
  flex-direction: column;
@@ -30,14 +32,14 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
30
32
  min-height: 152px;
31
33
  margin-bottom: 4px;
32
34
  margin: 0px 8px;
33
- `,s=e.div`
35
+ `,p=e.div`
34
36
  padding: 12px;
35
37
  display: flex;
36
38
  flex-direction: row;
37
39
  justify-content: center;
38
40
  align-items: center;
39
41
  border-top: 1px solid ${t.stroke.primary};
40
- `,p=e.div`
42
+ `,a=e.div`
41
43
  display: flex;
42
44
  flex-direction: row;
43
45
  justify-content: space-between;
@@ -60,4 +62,4 @@ import e from"styled-components";import{Caption as r}from"../../TypographyStyle.
60
62
  position: absolute;
61
63
  top: 16px;
62
64
  right: 16px;
63
- `;export{s as ChatBtnContainer,o as Container,p as FooterWrapper,d as MediaContainer,i as TimeStamp};
65
+ `;export{p as ChatBtnContainer,o as Container,d as FooterText,a as FooterWrapper,s as MediaContainer,i as TimeStamp};
@@ -1,10 +1,10 @@
1
- import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as u}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,TimeStamp as C}from"./ChatUI.style.js";import{LimitedTimeOffer as j}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as v}from"./MediaCard.js";const b=l.div`
1
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as m}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as p}from"../../tooltips/Tooltip.js";import{Caption as d,BodySecondary as c}from"../../TypographyStyle.js";import{COLORS as h}from"../../../constants/Theme.js";import{VariableEditorHelper as f}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as x,ACTIONS_TYPES as y}from"../models/TemplateMeta.js";import{ChatBtn as u}from"./ChatBtn.js";import{Container as T,FooterWrapper as g,FooterText as C,TimeStamp as j}from"./ChatUI.style.js";import{LimitedTimeOffer as v}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as b}from"./MediaCard.js";const w=l.div`
2
2
  position: absolute;
3
3
  width: 8px;
4
4
  height: 8px;
5
5
  left: -8px;
6
6
  top: -9px;
7
- `,w=l.div`
7
+ `,I=l.div`
8
8
  font-family: 'Inter';
9
9
  font-style: normal;
10
10
  font-weight: 400;
@@ -13,7 +13,7 @@ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"..
13
13
  padding: 8px 12px 0px;
14
14
  color: ${h.content.primary};
15
15
  word-wrap: break-word;
16
- `,I=l(w)`
16
+ `,O=l(I)`
17
17
  font-weight: 600;
18
18
  margin-bottom: 8px;
19
- `,O=new f,E=l=>{const{bodyText:h,footerText:f,headerMediaType:E,headerText:L,headerAssetLink:P,headerAssetName:_,quickReplybtn:N,ctaBtn:M,actionTypes:R,extras:A,showHeader:B,imagePreviewStyles:H,size:S,bodyVariableList:U,headerVariableList:k,buttons:z,limitedTimeOfferComponent:Y,carouselCardIndex:V,isWhatsappCarousel:q,isPreview:D}=l,K=O.format(h,U),Q=O.format(L,k),{selectedCarouselIndex:W,isProductCarouselType:G,errorIndexes:X}=m(),$={COPY_CODE:r,PHONE_NUMBER:s,URL:n,QUICK_REPLY:a};return e(T,Object.assign({isCarouselCard:null!=V&&V>-1,showBorder:null!=V&&V===W||G&&null!=V&&V>-1&&null!=W&&W>-1,hasError:null==X?void 0:X.includes(null!=V?V:-2),isWhatsappCarousel:q,isPreview:D},{children:[!q&&t(b,{children:t(i,{color:"white",height:8,width:8})}),E===x.TEXT?t(I,{dangerouslySetInnerHTML:{__html:Q}}):E!==x.NONE?t(v,{headerAssetLink:P,headerAssetName:_,mediaType:E,imagePreviewStyles:E===x.IMAGE?H:{}}):t(o,{}),(null==Y?void 0:Y.dateTime)?t(j,{text:Y.text,dateTime:Y.dateTime,code:Y.code}):t(o,{}),!!h&&t(o,{children:t(w,{dangerouslySetInnerHTML:{__html:K}})}),e(g,{children:[t(p,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(C,Object.assign({style:{flex:1}},{children:f}))})),t(C,{children:"16:48"})]}),z&&z.length>0?z.map(((e,o)=>t(u,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:$[e.type],size:S},o))):R===y.QUICK_REPLY?t("div",{children:null==N?void 0:N.map(((e,o)=>t(u,{text:e.text},o)))}):R===y.CTA_BTN?t("div",{children:null==M?void 0:M.map(((e,o)=>t(u,{textTypography:B?d:c,extraContent:A?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:n,size:S},o)))}):t(o,{})]}))};export{E as ChatUIV2};
19
+ `,E=new f,L=l=>{const{bodyText:h,footerText:f,headerMediaType:L,headerText:P,headerAssetLink:_,headerAssetName:N,quickReplybtn:M,ctaBtn:R,actionTypes:A,extras:B,showHeader:H,imagePreviewStyles:S,size:U,bodyVariableList:k,headerVariableList:z,buttons:Y,limitedTimeOfferComponent:V,carouselCardIndex:q,isWhatsappCarousel:D,isPreview:K}=l,Q=E.format(h,k),W=E.format(P,z),{selectedCarouselIndex:G,isProductCarouselType:X,errorIndexes:$}=m(),F={COPY_CODE:r,PHONE_NUMBER:s,URL:n,QUICK_REPLY:a};return e(T,Object.assign({isCarouselCard:null!=q&&q>-1,showBorder:null!=q&&q===G||X&&null!=q&&q>-1&&null!=G&&G>-1,hasError:null==$?void 0:$.includes(null!=q?q:-2),isWhatsappCarousel:D,isPreview:K},{children:[!D&&t(w,{children:t(i,{color:"white",height:8,width:8})}),L===x.TEXT?t(O,{dangerouslySetInnerHTML:{__html:W}}):L!==x.NONE?t(b,{headerAssetLink:_,headerAssetName:N,mediaType:L,imagePreviewStyles:L===x.IMAGE?S:{}}):t(o,{}),(null==V?void 0:V.dateTime)?t(v,{text:V.text,dateTime:V.dateTime,code:V.code}):t(o,{}),!!h&&t(o,{children:t(I,{dangerouslySetInnerHTML:{__html:Q}})}),e(g,{children:[t(p,Object.assign({body:null!=f?f:"",placement:"top"},{children:t(C,Object.assign({style:{flex:1}},{children:f}))})),t(j,{children:"16:48"})]}),Y&&Y.length>0?Y.map(((e,o)=>t(u,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:F[e.type],size:U},o))):A===y.QUICK_REPLY?t("div",{children:null==M?void 0:M.map(((e,o)=>t(u,{text:e.text},o)))}):A===y.CTA_BTN?t("div",{children:null==R?void 0:R.map(((e,o)=>t(u,{textTypography:H?d:c,extraContent:B?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:n,size:U},o)))}):t(o,{})]}))};export{L as ChatUIV2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.509-beta.pp-3",
3
+ "version": "0.0.510-beta-001",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",