@bikdotai/bik-component-library 0.0.740-beta.5 → 0.0.740-beta.7

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.
Files changed (29) hide show
  1. package/dist/cjs/components/QueryBuilder/helpers/MetaCustomProcessor.d.ts +1 -1
  2. package/dist/cjs/components/carousel-preview/CarouselPreview.js +1 -1
  3. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  4. package/dist/esm/components/QueryBuilder/helpers/MetaCustomProcessor.d.ts +1 -1
  5. package/dist/esm/components/carousel-preview/CarouselPreview.js +1 -1
  6. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
  7. package/package.json +1 -1
  8. package/dist/cjs/components/BikGiftedChat/Bubble/Bubble.d.ts +0 -5
  9. package/dist/cjs/components/BikGiftedChat/Bubble/types.d.ts +0 -25
  10. package/dist/cjs/components/BikGiftedChat/GiftedChat/Day.d.ts +0 -15
  11. package/dist/cjs/components/BikGiftedChat/GiftedChat/GiftedChat.d.ts +0 -5
  12. package/dist/cjs/components/BikGiftedChat/GiftedChat/messageHelpers.d.ts +0 -6
  13. package/dist/cjs/components/BikGiftedChat/GiftedChat/scrollHooks.d.ts +0 -10
  14. package/dist/cjs/components/BikGiftedChat/GiftedChat/types.d.ts +0 -95
  15. package/dist/cjs/components/BikGiftedChat/GiftedChat/utils.d.ts +0 -22
  16. package/dist/cjs/components/BikGiftedChat/index.d.ts +0 -5
  17. package/dist/cjs/components/BikGiftedChat/types.d.ts +0 -24
  18. package/dist/cjs/hooks/useWindowSize.d.ts +0 -2
  19. package/dist/esm/components/BikGiftedChat/Bubble/Bubble.d.ts +0 -5
  20. package/dist/esm/components/BikGiftedChat/Bubble/types.d.ts +0 -25
  21. package/dist/esm/components/BikGiftedChat/GiftedChat/Day.d.ts +0 -15
  22. package/dist/esm/components/BikGiftedChat/GiftedChat/GiftedChat.d.ts +0 -5
  23. package/dist/esm/components/BikGiftedChat/GiftedChat/messageHelpers.d.ts +0 -6
  24. package/dist/esm/components/BikGiftedChat/GiftedChat/scrollHooks.d.ts +0 -10
  25. package/dist/esm/components/BikGiftedChat/GiftedChat/types.d.ts +0 -95
  26. package/dist/esm/components/BikGiftedChat/GiftedChat/utils.d.ts +0 -22
  27. package/dist/esm/components/BikGiftedChat/index.d.ts +0 -5
  28. package/dist/esm/components/BikGiftedChat/types.d.ts +0 -24
  29. package/dist/esm/hooks/useWindowSize.d.ts +0 -2
@@ -36,7 +36,7 @@ export declare class MetaCustomProcessor {
36
36
  value: {
37
37
  operator: string;
38
38
  dataType: import("../types").QueryBuilderConnectorType;
39
- value?: string | number | string[] | Date | number[] | Date[] | undefined;
39
+ value?: string | number | string[] | number[] | Date | Date[] | undefined;
40
40
  };
41
41
  key: string;
42
42
  refresh?: boolean | undefined;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),l=require("react-slick"),s=require("./CarouselPreview.style.js"),t=require("./CarouselPreviewCard.js"),o=require("../template-context-mapper/context/templateModalContext.js"),a=require("../template-preview/helpers/templateMiscHelper.js"),n=require("../template-preview/RCS/RCSPreview.styled.js"),i=require("./CustomCarouselArrows.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(r),c=d(l);const v=u.default.forwardRef((r=>{let{channel:l,template:i,isPreview:d,removeBottomBorder:u,borderRadius:c,showArrows:v,hideBorder:C,showSampleValues:w}=r;var m,h;const{sliderRef:x,selectedCarouselIndex:j,cardCount:f,setIsCarouselHovered:P,cardIndex:R}=o.useTemplateModalContext(),g=-1==R?a.determineCardIndex(l):R,I=null===(h=null===(m=null==i?void 0:i.components)||void 0===m?void 0:m[g])||void 0===h?void 0:h.cards,S=(null==I?void 0:I.length)?e.jsx(p,{cards:I,cardCount:null!=f?f:0,selectedCarouselIndex:null!=j?j:-1,sliderRef:x,isPreview:d,showArrows:v,channel:l,template:i,setIsCarouselHovered:P,showSampleValues:!!w}):null;return a.isRCSChannel(l)?e.jsx(n.RCSCarousalContainer,Object.assign({borderRadius:c},{children:S})):e.jsxs(s.Container,Object.assign({removeBottomBorder:u,borderRadius:c,hideBorder:C},{children:[e.jsx(t.default,{channel:l,currentTemplate:i,carouselCardIndex:-1,isPreview:d,width:"77%"}),S]}))})),p=r=>{let{cards:l,cardCount:o,selectedCarouselIndex:a,sliderRef:n,isPreview:d,showArrows:u,channel:v,template:p,setIsCarouselHovered:C,showSampleValues:w}=r;return e.jsx(s.CarouselSlickContainer,Object.assign({cardCount:o,selectedCarouselIndex:a,onMouseEnter:()=>null==C?void 0:C(!0),onMouseLeave:()=>null==C?void 0:C(!1)},{children:e.jsx(c.default,Object.assign({ref:n,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!d,centerMode:!0,arrows:u,adaptiveHeight:!0,nextArrow:e.jsx(i.CustomCarouselRightArrow,{isPreview:null!=d&&d}),prevArrow:e.jsx(i.CustomCarouselLeftArrow,{isPreview:null!=d&&d})},{children:null==l?void 0:l.map(((r,l)=>{var s,o;const a={components:r.components,mapping:null===(o=null===(s=null==p?void 0:p.mapping)||void 0===s?void 0:s.cards)||void 0===o?void 0:o[l],content:null==p?void 0:p.content,templateType:null==p?void 0:p.templateType};return e.jsx(t.default,{channel:v,currentTemplate:a,carouselCardIndex:l,isPreview:d,width:"100%",showSampleValues:w},l)}))}))}))};exports.CarouselPreview=v;
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),l=require("react-slick"),s=require("./CarouselPreview.style.js"),o=require("./CarouselPreviewCard.js"),t=require("../template-context-mapper/context/templateModalContext.js"),a=require("../template-preview/helpers/templateMiscHelper.js"),n=require("../template-preview/RCS/RCSPreview.styled.js"),i=require("./CustomCarouselArrows.js");function d(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var u=d(r),c=d(l);const v=u.default.forwardRef((r=>{let{channel:l,template:i,isPreview:d,removeBottomBorder:u,borderRadius:c,showArrows:v,hideBorder:w,showSampleValues:C}=r;var m,h;const{sliderRef:x,selectedCarouselIndex:j,cardCount:f,setIsCarouselHovered:P,cardIndex:b,showVariablePicker:R}=t.useTemplateModalContext(),g=-1==b?a.determineCardIndex(l):b,I=null===(h=null===(m=null==i?void 0:i.components)||void 0===m?void 0:m[g])||void 0===h?void 0:h.cards,S=(null==I?void 0:I.length)?e.jsx(p,{cards:I,cardCount:null!=f?f:0,selectedCarouselIndex:null!=j?j:-1,sliderRef:x,isPreview:d,showArrows:v,channel:l,template:i,setIsCarouselHovered:P,showSampleValues:!!C,showVariablePicker:R}):null;return a.isRCSChannel(l)?e.jsx(n.RCSCarousalContainer,Object.assign({borderRadius:c},{children:S})):e.jsxs(s.Container,Object.assign({removeBottomBorder:u,borderRadius:c,hideBorder:w},{children:[e.jsx(o.default,{channel:l,currentTemplate:i,carouselCardIndex:-1,isPreview:d,width:"77%"}),S]}))})),p=r=>{let{cards:l,cardCount:t,selectedCarouselIndex:a,sliderRef:n,isPreview:d,showArrows:u,channel:v,template:p,setIsCarouselHovered:w,showSampleValues:C,showVariablePicker:m}=r;return e.jsx(s.CarouselSlickContainer,Object.assign({cardCount:t,selectedCarouselIndex:a,onMouseEnter:()=>!m&&(null==w?void 0:w(!0)),onMouseLeave:()=>!m&&(null==w?void 0:w(!1))},{children:e.jsx(c.default,Object.assign({ref:n,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!d,centerMode:!0,arrows:u,adaptiveHeight:!0,nextArrow:e.jsx(i.CustomCarouselRightArrow,{isPreview:null!=d&&d}),prevArrow:e.jsx(i.CustomCarouselLeftArrow,{isPreview:null!=d&&d})},{children:null==l?void 0:l.map(((r,l)=>{var s,t;const a={components:r.components,mapping:null===(t=null===(s=null==p?void 0:p.mapping)||void 0===s?void 0:s.cards)||void 0===t?void 0:t[l],content:null==p?void 0:p.content,templateType:null==p?void 0:p.templateType};return e.jsx(o.default,{channel:v,currentTemplate:a,carouselCardIndex:l,isPreview:d,width:"100%",showSampleValues:C},l)}))}))}))};exports.CarouselPreview=v;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@bikdotai/bik-models/growth/models/bik-store"),l=require("../../../assets/icons/arrow_back.svg.js"),n=require("../../../assets/icons/chevronLeft.svg.js"),i=require("../../../assets/icons/chevronRight.svg.js"),o=require("../../../assets/icons/PlusIcon.js"),r=require("lodash"),a=require("react"),s=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),c=require("../../product-picker-v2/modal.js"),u=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),v=require("../context/templateModalContext.js"),h=require("./EditWhatsAppTemplateV2.js"),m=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var g=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var y=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var j=require("../../template-preview/helpers/templateMiscHelper.js"),x=require("../../TypographyStyle.js");exports.default=f=>{let{template:b,whatsappSpecificPickerMeta:C,showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}=f;var q,w,P,T,B,L,R,E;const{selectedCarouselIndex:M,setTemplate:A,pickerConf:D,isProductCarouselType:F,pod:V,cardCount:W,carouselProducts:N,setCarouselProducts:$,isError:_,cardImages:z,disableEditVariable:G,onDeleteSelectedProducts:H,setSelectedCarouselIndex:K,setVariableCallback:J,setShowVariablePicker:Q,sliderRef:U}=v.useTemplateModalContext(),[X,Y]=a.useState(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(w=null===(q=null==b?void 0:b.mapping)||void 0===q?void 0:q.body)||void 0===w?void 0:w.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(T=null===(P=null==b?void 0:b.mapping)||void 0===P?void 0:P.body)||void 0===T?void 0:T.length)?"(Step 2/2)":"")),[Z,ee]=a.useState(!1),[te,le]=a.useState(!1),ne=M===(null!=W?W:-1)-1,ie=(null!=M?M:-1)<1;a.useEffect((()=>{var e,t,l,n;Y(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(t=null===(e=null==b?void 0:b.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==b?void 0:b.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[M]);const oe=e=>{null==$||$([{name:"variable",productName:e.actualValue}])};return a.useEffect((()=>{-1===M&&j.isRCSChannel(null==b?void 0:b.channel)&&(null==K||K(0))}),[M,null==b?void 0:b.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!j.isRCSChannel(null==b?void 0:b.channel)&&null!=M&&M>=0&&!!(null===(L=null===(B=null==b?void 0:b.mapping)||void 0===B?void 0:B.body)||void 0===L?void 0:L.length)&&e.jsx(d.IconButton,{Icon:l.default,onClick:()=>{null==K||K(-1)}}),e.jsx(x.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),F&&(null!==(R=null==N?void 0:N.length)&&void 0!==R?R:0)>0&&null!=M&&M>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(m.ProductBox,{editItem:()=>{1===(null==N?void 0:N.length)&&"variable"===N[0].name?(J((()=>oe)),Q(!0)):ee(!Z)},cardBody:1===(null==N?void 0:N.length)&&"variable"===N[0].name?`${N[0].productName}`:`${null==N?void 0:N.length} Products Selected`,hideIcon:1===(null==N?void 0:N.length)&&"variable"===N[0].name,deleteItem:()=>{var e;if(1===(null==N?void 0:N.length)&&"variable"===N[0].name)return void(null==$||$([]));const t=r.cloneDeep(Object.assign({},b));t&&(z&&z.length>0?null==z||z.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=z[l])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==A||A(t)),null==$||$([]),null==H||H()}}),N&&(null==N?void 0:N.length)>0&&"variable"!=N[0].name&&e.jsx(s.Button,{disabled:(null!==(E=null==N?void 0:N.length)&&void 0!==E?E:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{le(!0),ee(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!G&&F&&0===(null==N?void 0:N.length)&&null!=M&&M>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(x.TitleRegular,{children:"Product(s)"}),e.jsx(x.BodySecondary,{children:`Select ${null!=W?W:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:_?16:12,marginRight:_?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:_?`2px dashed ${g.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(o.default,{width:18,height:18,color:g.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),V===y.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsx(x.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:_?`2px dashed ${g.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(o.default,{width:18,height:18,color:g.COLORS.content.secondary})})),onClick:e=>{J((()=>oe)),Q(!0)}})]})]})),_&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!F&&(null!=M?M:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:g.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(d.IconButton,{Icon:n.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:g.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickPrev(),(null!=M?M:-1)<1||null==K||K((e=>e-1))}}),e.jsx(x.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:g.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${W}`})),e.jsx(d.IconButton,{Icon:i.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:g.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickNext(),(null!=M?M:-1)>=(null!=W?W:-1)-1||null==K||K((e=>e+1))}})]})),e.jsx(h.default,{whatsappSpecificPickerMeta:C,template:b,onTemplateChange:e=>{null==A||A(e)},showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}),Z&&D&&e.jsx(c.ProductPickerModal,{zIndex:200,startupScreen:te?u.ScreenName.RearrangeProducts:u.ScreenName.Collections,rearrangeEnabled:!0,storeId:D.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=N?N:[]),collectionFetcher:D.fetchCollections,productFetcher:D.fetchProducts,onAdd:(e,t)=>{var l,n,i,o,a,s;le(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const r=e[t].products;if(void 0!==r&&Object.keys(r).length)for(const e of Object.keys(r)){const c=r[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:h,displayOrder:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(l=r[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:t,productName:null!==(o=null===(i=r[e])||void 0===i?void 0:i.name)&&void 0!==o?o:"",productImage:null!==(s=null===(a=r[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=r.cloneDeep(Object.assign({},b));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==z?void 0:z[t])&&void 0!==l?l:""]})),null==A||A(p)),null==$||$(c),ee(!1)},searchInCollectionFetcher:D.searchInCollection,searchFetcher:D.searchProducts,visible:Z,onClose:()=>{ee(!1)},exactLimit:null!=W?W:1,appType:D.appType||t.ApplicationType.BIK})]}))};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("@bikdotai/bik-models/growth/models/bik-store"),l=require("../../../assets/icons/arrow_back.svg.js"),n=require("../../../assets/icons/chevronLeft.svg.js"),i=require("../../../assets/icons/chevronRight.svg.js"),o=require("../../../assets/icons/PlusIcon.js"),r=require("lodash"),a=require("react"),s=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),c=require("../../product-picker-v2/modal.js"),u=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),v=require("../context/templateModalContext.js"),h=require("./EditWhatsAppTemplateV2.js"),m=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var g=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var y=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var x=require("../../template-preview/helpers/templateMiscHelper.js"),j=require("../../TypographyStyle.js");exports.default=f=>{let{template:b,whatsappSpecificPickerMeta:C,showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}=f;var q,w,P,T,B,L,R,E;const{selectedCarouselIndex:M,setTemplate:A,pickerConf:D,isProductCarouselType:F,pod:V,cardCount:W,carouselProducts:N,setCarouselProducts:$,isError:_,cardImages:z,disableEditVariable:G,onDeleteSelectedProducts:H,setSelectedCarouselIndex:K,setVariableCallback:J,setShowVariablePicker:Q,sliderRef:U}=v.useTemplateModalContext(),[X,Y]=a.useState(x.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(w=null===(q=null==b?void 0:b.mapping)||void 0===q?void 0:q.body)||void 0===w?void 0:w.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(T=null===(P=null==b?void 0:b.mapping)||void 0===P?void 0:P.body)||void 0===T?void 0:T.length)?"(Step 2/2)":"")),[Z,ee]=a.useState(!1),[te,le]=a.useState(!1),ne=M===(null!=W?W:-1)-1,ie=(null!=M?M:-1)<1;a.useEffect((()=>{var e,t,l,n;Y(x.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(t=null===(e=null==b?void 0:b.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(n=null===(l=null==b?void 0:b.mapping)||void 0===l?void 0:l.body)||void 0===n?void 0:n.length)?"(Step 2/2)":""))}),[M]),a.useEffect((()=>{Q(!1)}),[M]);const oe=e=>{null==$||$([{name:"variable",productName:e.actualValue}])};return a.useEffect((()=>{-1===M&&x.isRCSChannel(null==b?void 0:b.channel)&&(null==K||K(0))}),[M,null==b?void 0:b.channel]),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!x.isRCSChannel(null==b?void 0:b.channel)&&null!=M&&M>=0&&!!(null===(L=null===(B=null==b?void 0:b.mapping)||void 0===B?void 0:B.body)||void 0===L?void 0:L.length)&&e.jsx(d.IconButton,{Icon:l.default,onClick:()=>{null==K||K(-1)}}),e.jsx(j.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),F&&(null!==(R=null==N?void 0:N.length)&&void 0!==R?R:0)>0&&null!=M&&M>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(m.ProductBox,{editItem:()=>{1===(null==N?void 0:N.length)&&"variable"===N[0].name?(J((()=>oe)),Q(!0)):ee(!Z)},cardBody:1===(null==N?void 0:N.length)&&"variable"===N[0].name?`${N[0].productName}`:`${null==N?void 0:N.length} Products Selected`,hideIcon:1===(null==N?void 0:N.length)&&"variable"===N[0].name,deleteItem:()=>{var e;if(1===(null==N?void 0:N.length)&&"variable"===N[0].name)return void(null==$||$([]));const t=r.cloneDeep(Object.assign({},b));t&&(z&&z.length>0?null==z||z.forEach(((e,l)=>{var n;t.components[1].cards[l].components[0].example.header_handle=[null!==(n=z[l])&&void 0!==n?n:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==A||A(t)),null==$||$([]),null==H||H()}}),N&&(null==N?void 0:N.length)>0&&"variable"!=N[0].name&&e.jsx(s.Button,{disabled:(null!==(E=null==N?void 0:N.length)&&void 0!==E?E:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{le(!0),ee(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!G&&F&&0===(null==N?void 0:N.length)&&null!=M&&M>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(j.TitleRegular,{children:"Product(s)"}),e.jsx(j.BodySecondary,{children:`Select ${null!=W?W:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:_?16:12,marginRight:_?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:_?`2px dashed ${g.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(o.default,{width:18,height:18,color:g.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),V===y.POD.CHATBOT&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8,flex:1}}),e.jsx(j.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8,flex:1}})]})),e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:_?`2px dashed ${g.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(o.default,{width:18,height:18,color:g.COLORS.content.secondary})})),onClick:e=>{J((()=>oe)),Q(!0)}})]})]})),_&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!F&&(null!=M?M:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:g.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsx(d.IconButton,{Icon:n.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:g.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickPrev(),(null!=M?M:-1)<1||null==K||K((e=>e-1))}}),e.jsx(j.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:g.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${W}`})),e.jsx(d.IconButton,{Icon:i.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:g.COLORS.content.secondary},onClick:()=>{var e;null===(e=null==U?void 0:U.current)||void 0===e||e.slickNext(),(null!=M?M:-1)>=(null!=W?W:-1)-1||null==K||K((e=>e+1))}})]})),e.jsx(h.default,{whatsappSpecificPickerMeta:C,template:b,onTemplateChange:e=>{null==A||A(e)},showVariableModal:O,variableListForImage:I,discountCode:S,setDiscountCode:k}),Z&&D&&e.jsx(c.ProductPickerModal,{zIndex:200,startupScreen:te?u.ScreenName.RearrangeProducts:u.ScreenName.Collections,rearrangeEnabled:!0,storeId:D.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,n=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),n in t[e].products||(t[e].products[n]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[n].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=N?N:[]),collectionFetcher:D.fetchCollections,productFetcher:D.fetchProducts,onAdd:(e,t)=>{var l,n,i,o,a,s;le(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const r=e[t].products;if(void 0!==r&&Object.keys(r).length)for(const e of Object.keys(r)){const c=r[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:v,quantity:h,displayOrder:m}=c[u],g={name:p,image:null!==(n=null!=v?v:null===(l=r[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:h,variantId:u,productId:e,displayOrder:m,collectionId:t,productName:null!==(o=null===(i=r[e])||void 0===i?void 0:i.name)&&void 0!==o?o:"",productImage:null!==(s=null===(a=r[e])||void 0===a?void 0:a.image)&&void 0!==s?s:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=r.cloneDeep(Object.assign({},b));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==z?void 0:z[t])&&void 0!==l?l:""]})),null==A||A(p)),null==$||$(c),ee(!1)},searchInCollectionFetcher:D.searchInCollection,searchFetcher:D.searchProducts,visible:Z,onClose:()=>{ee(!1)},exactLimit:null!=W?W:1,appType:D.appType||t.ApplicationType.BIK})]}))};
@@ -36,7 +36,7 @@ export declare class MetaCustomProcessor {
36
36
  value: {
37
37
  operator: string;
38
38
  dataType: import("../types").QueryBuilderConnectorType;
39
- value?: string | number | string[] | Date | number[] | Date[] | undefined;
39
+ value?: string | number | string[] | number[] | Date | Date[] | undefined;
40
40
  };
41
41
  key: string;
42
42
  refresh?: boolean | undefined;
@@ -1 +1 @@
1
- import{jsx as e,jsxs as r}from"react/jsx-runtime";import o from"react";import l from"react-slick";import{Container as t,CarouselSlickContainer as s}from"./CarouselPreview.style.js";import n from"./CarouselPreviewCard.js";import{useTemplateModalContext as i}from"../template-context-mapper/context/templateModalContext.js";import{determineCardIndex as a,isRCSChannel as d}from"../template-preview/helpers/templateMiscHelper.js";import{RCSCarousalContainer as u}from"../template-preview/RCS/RCSPreview.styled.js";import{CustomCarouselRightArrow as c,CustomCarouselLeftArrow as m}from"./CustomCarouselArrows.js";const p=o.forwardRef((o=>{let{channel:l,template:s,isPreview:c,removeBottomBorder:m,borderRadius:p,showArrows:w,hideBorder:h,showSampleValues:C}=o;var f,x;const{sliderRef:j,selectedCarouselIndex:g,cardCount:I,setIsCarouselHovered:P,cardIndex:R}=i(),b=-1==R?a(l):R,S=null===(x=null===(f=null==s?void 0:s.components)||void 0===f?void 0:f[b])||void 0===x?void 0:x.cards,A=(null==S?void 0:S.length)?e(v,{cards:S,cardCount:null!=I?I:0,selectedCarouselIndex:null!=g?g:-1,sliderRef:j,isPreview:c,showArrows:w,channel:l,template:s,setIsCarouselHovered:P,showSampleValues:!!C}):null;return d(l)?e(u,Object.assign({borderRadius:p},{children:A})):r(t,Object.assign({removeBottomBorder:m,borderRadius:p,hideBorder:h},{children:[e(n,{channel:l,currentTemplate:s,carouselCardIndex:-1,isPreview:c,width:"77%"}),A]}))})),v=r=>{let{cards:o,cardCount:t,selectedCarouselIndex:i,sliderRef:a,isPreview:d,showArrows:u,channel:p,template:v,setIsCarouselHovered:w,showSampleValues:h}=r;return e(s,Object.assign({cardCount:t,selectedCarouselIndex:i,onMouseEnter:()=>null==w?void 0:w(!0),onMouseLeave:()=>null==w?void 0:w(!1)},{children:e(l,Object.assign({ref:a,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!d,centerMode:!0,arrows:u,adaptiveHeight:!0,nextArrow:e(c,{isPreview:null!=d&&d}),prevArrow:e(m,{isPreview:null!=d&&d})},{children:null==o?void 0:o.map(((r,o)=>{var l,t;const s={components:r.components,mapping:null===(t=null===(l=null==v?void 0:v.mapping)||void 0===l?void 0:l.cards)||void 0===t?void 0:t[o],content:null==v?void 0:v.content,templateType:null==v?void 0:v.templateType};return e(n,{channel:p,currentTemplate:s,carouselCardIndex:o,isPreview:d,width:"100%",showSampleValues:h},o)}))}))}))};export{p as CarouselPreview};
1
+ import{jsx as e,jsxs as r}from"react/jsx-runtime";import o from"react";import l from"react-slick";import{Container as t,CarouselSlickContainer as s}from"./CarouselPreview.style.js";import i from"./CarouselPreviewCard.js";import{useTemplateModalContext as a}from"../template-context-mapper/context/templateModalContext.js";import{determineCardIndex as n,isRCSChannel as d}from"../template-preview/helpers/templateMiscHelper.js";import{RCSCarousalContainer as c}from"../template-preview/RCS/RCSPreview.styled.js";import{CustomCarouselRightArrow as u,CustomCarouselLeftArrow as m}from"./CustomCarouselArrows.js";const p=o.forwardRef((o=>{let{channel:l,template:s,isPreview:u,removeBottomBorder:m,borderRadius:p,showArrows:w,hideBorder:h,showSampleValues:C}=o;var f,x;const{sliderRef:P,selectedCarouselIndex:b,cardCount:j,setIsCarouselHovered:g,cardIndex:I,showVariablePicker:R}=a(),S=-1==I?n(l):I,V=null===(x=null===(f=null==s?void 0:s.components)||void 0===f?void 0:f[S])||void 0===x?void 0:x.cards,A=(null==V?void 0:V.length)?e(v,{cards:V,cardCount:null!=j?j:0,selectedCarouselIndex:null!=b?b:-1,sliderRef:P,isPreview:u,showArrows:w,channel:l,template:s,setIsCarouselHovered:g,showSampleValues:!!C,showVariablePicker:R}):null;return d(l)?e(c,Object.assign({borderRadius:p},{children:A})):r(t,Object.assign({removeBottomBorder:m,borderRadius:p,hideBorder:h},{children:[e(i,{channel:l,currentTemplate:s,carouselCardIndex:-1,isPreview:u,width:"77%"}),A]}))})),v=r=>{let{cards:o,cardCount:t,selectedCarouselIndex:a,sliderRef:n,isPreview:d,showArrows:c,channel:p,template:v,setIsCarouselHovered:w,showSampleValues:h,showVariablePicker:C}=r;return e(s,Object.assign({cardCount:t,selectedCarouselIndex:a,onMouseEnter:()=>!C&&(null==w?void 0:w(!0)),onMouseLeave:()=>!C&&(null==w?void 0:w(!1))},{children:e(l,Object.assign({ref:n,swipeToSlide:!0,draggable:!0,swipe:!0,infinite:!1,focusOnSelect:!d,centerMode:!0,arrows:c,adaptiveHeight:!0,nextArrow:e(u,{isPreview:null!=d&&d}),prevArrow:e(m,{isPreview:null!=d&&d})},{children:null==o?void 0:o.map(((r,o)=>{var l,t;const s={components:r.components,mapping:null===(t=null===(l=null==v?void 0:v.mapping)||void 0===l?void 0:l.cards)||void 0===t?void 0:t[o],content:null==v?void 0:v.content,templateType:null==v?void 0:v.templateType};return e(i,{channel:p,currentTemplate:s,carouselCardIndex:o,isPreview:d,width:"100%",showSampleValues:h},o)}))}))}))};export{p as CarouselPreview};
@@ -1 +1 @@
1
- import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import i from"../../../assets/icons/arrow_back.svg.js";import n from"../../../assets/icons/chevronLeft.svg.js";import r from"../../../assets/icons/chevronRight.svg.js";import a from"../../../assets/icons/PlusIcon.js";import{cloneDeep as d}from"lodash";import{useState as s,useEffect as c}from"react";import{Button as u}from"../../button/Button.js";import{IconButton as p}from"../../icon-button/IconButton.js";import{ProductPickerModal as m}from"../../product-picker-v2/modal.js";import{ScreenName as v}from"../../product-picker-v2/type.js";import{Badge as h}from"../Badge/index.js";import{useTemplateModalContext as g}from"../context/templateModalContext.js";import f from"./EditWhatsAppTemplateV2.js";import{ProductBox as y}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as b}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as j}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{isRCSChannel as C}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as x,TitleRegular as I,BodySecondary as k,BodyCaption as w}from"../../TypographyStyle.js";const O=O=>{let{template:P,whatsappSpecificPickerMeta:T,showVariableModal:S,variableListForImage:L,discountCode:B,setDiscountCode:E}=O;var A,M,V,D,F,R,W,$;const{selectedCarouselIndex:q,setTemplate:N,pickerConf:_,isProductCarouselType:z,pod:G,cardCount:H,carouselProducts:K,setCarouselProducts:J,isError:Q,cardImages:U,disableEditVariable:X,onDeleteSelectedProducts:Y,setSelectedCarouselIndex:Z,setVariableCallback:ee,setShowVariablePicker:te,sliderRef:le}=g(),[oe,ie]=s(C(null==P?void 0:P.channel)?"Carousel Cards":-1==q?"First Message (Step 1/2)":z?"Product Carousel "+((null===(M=null===(A=null==P?void 0:P.mapping)||void 0===A?void 0:A.body)||void 0===M?void 0:M.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(D=null===(V=null==P?void 0:P.mapping)||void 0===V?void 0:V.body)||void 0===D?void 0:D.length)?"(Step 2/2)":"")),[ne,re]=s(!1),[ae,de]=s(!1),se=q===(null!=H?H:-1)-1,ce=(null!=q?q:-1)<1;c((()=>{var e,t,l,o;ie(C(null==P?void 0:P.channel)?"Carousel Cards":-1==q?"First Message (Step 1/2)":z?"Product Carousel "+((null===(t=null===(e=null==P?void 0:P.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(l=null==P?void 0:P.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[q]);const ue=e=>{null==J||J([{name:"variable",productName:e.actualValue}])};return c((()=>{-1===q&&C(null==P?void 0:P.channel)&&(null==Z||Z(0))}),[q,null==P?void 0:P.channel]),e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!C(null==P?void 0:P.channel)&&null!=q&&q>=0&&!!(null===(R=null===(F=null==P?void 0:P.mapping)||void 0===F?void 0:F.body)||void 0===R?void 0:R.length)&&t(p,{Icon:i,onClick:()=>{null==Z||Z(-1)}}),t(x,Object.assign({style:{marginLeft:10}},{children:oe}))]})),z&&(null!==(W=null==K?void 0:K.length)&&void 0!==W?W:0)>0&&null!=q&&q>=0&&e("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(y,{editItem:()=>{1===(null==K?void 0:K.length)&&"variable"===K[0].name?(ee((()=>ue)),te(!0)):re(!ne)},cardBody:1===(null==K?void 0:K.length)&&"variable"===K[0].name?`${K[0].productName}`:`${null==K?void 0:K.length} Products Selected`,hideIcon:1===(null==K?void 0:K.length)&&"variable"===K[0].name,deleteItem:()=>{var e;if(1===(null==K?void 0:K.length)&&"variable"===K[0].name)return void(null==J||J([]));const t=d(Object.assign({},P));t&&(U&&U.length>0?null==U||U.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=U[l])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==N||N(t)),null==J||J([]),null==Y||Y()}}),K&&(null==K?void 0:K.length)>0&&"variable"!=K[0].name&&t(u,{disabled:(null!==($=null==K?void 0:K.length)&&void 0!==$?$:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{de(!0),re(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!X&&z&&0===(null==K?void 0:K.length)&&null!=q&&q>=0&&e(l,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(I,{children:"Product(s)"}),t(k,{children:`Select ${null!=H?H:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:Q?16:12,marginRight:Q?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(u,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:Q?`2px dashed ${b.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(a,{width:18,height:18,color:b.content.secondary})})),onClick:e=>{re(!0)}}),G===j.CHATBOT&&e(l,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),t(w,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(u,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:Q?`2px dashed ${b.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(a,{width:18,height:18,color:b.content.secondary})})),onClick:e=>{ee((()=>ue)),te(!0)}})]})]})),Q&&t("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:t(h,{padding:"8px",errorText:"Please add products"})}))]}),!z&&(null!=q?q:-1)>-1&&e("div",Object.assign({style:{display:"flex",background:b.surface.hovered,alignItems:"center"}},{children:[t(p,{Icon:n,disabled:ce,width:8,height:14,svgStyle:ce?{}:{color:b.content.secondary},onClick:()=>{var e;null===(e=null==le?void 0:le.current)||void 0===e||e.slickPrev(),(null!=q?q:-1)<1||null==Z||Z((e=>e-1))}}),t(I,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:b.content.secondary},{children:`Card ${(null!=q?q:0)+1}/${H}`})),t(p,{Icon:r,width:8,height:14,disabled:se,svgStyle:se?{}:{color:b.content.secondary},onClick:()=>{var e;null===(e=null==le?void 0:le.current)||void 0===e||e.slickNext(),(null!=q?q:-1)>=(null!=H?H:-1)-1||null==Z||Z((e=>e+1))}})]})),t(f,{whatsappSpecificPickerMeta:T,template:P,onTemplateChange:e=>{null==N||N(e)},showVariableModal:S,variableListForImage:L,discountCode:B,setDiscountCode:E}),ne&&_&&t(m,{zIndex:200,startupScreen:ae?v.RearrangeProducts:v.Collections,rearrangeEnabled:!0,storeId:_.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,o=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in t[e].products||(t[e].products[o]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[o].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=K?K:[]),collectionFetcher:_.fetchCollections,productFetcher:_.fetchProducts,onAdd:(e,t)=>{var l,o,i,n,r,a;de(!1);const s=[];delete e.isCustom;for(const t of Object.keys(e)){const d=e[t].products;if(void 0!==d&&Object.keys(d).length)for(const e of Object.keys(d)){const c=d[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=d[e])||void 0===l?void 0:l.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(n=null===(i=d[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(a=null===(r=d[e])||void 0===r?void 0:r.image)&&void 0!==a?a:""};s.push(g)}}}const c=s.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=s.map((e=>e.image)),p=d(Object.assign({},P));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==U?void 0:U[t])&&void 0!==l?l:""]})),null==N||N(p)),null==J||J(c),re(!1)},searchInCollectionFetcher:_.searchInCollection,searchFetcher:_.searchProducts,visible:ne,onClose:()=>{re(!1)},exactLimit:null!=H?H:1,appType:_.appType||o.BIK})]}))};export{O as default};
1
+ import{jsxs as e,jsx as t,Fragment as l}from"react/jsx-runtime";import{ApplicationType as o}from"@bikdotai/bik-models/growth/models/bik-store";import i from"../../../assets/icons/arrow_back.svg.js";import n from"../../../assets/icons/chevronLeft.svg.js";import r from"../../../assets/icons/chevronRight.svg.js";import a from"../../../assets/icons/PlusIcon.js";import{cloneDeep as d}from"lodash";import{useState as s,useEffect as c}from"react";import{Button as u}from"../../button/Button.js";import{IconButton as p}from"../../icon-button/IconButton.js";import{ProductPickerModal as m}from"../../product-picker-v2/modal.js";import{ScreenName as v}from"../../product-picker-v2/type.js";import{Badge as h}from"../Badge/index.js";import{useTemplateModalContext as g}from"../context/templateModalContext.js";import f from"./EditWhatsAppTemplateV2.js";import{ProductBox as y}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as b}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as j}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{isRCSChannel as x}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as C,TitleRegular as I,BodySecondary as k,BodyCaption as w}from"../../TypographyStyle.js";const O=O=>{let{template:P,whatsappSpecificPickerMeta:T,showVariableModal:S,variableListForImage:L,discountCode:B,setDiscountCode:E}=O;var A,M,V,D,F,R,W,$;const{selectedCarouselIndex:q,setTemplate:N,pickerConf:_,isProductCarouselType:z,pod:G,cardCount:H,carouselProducts:K,setCarouselProducts:J,isError:Q,cardImages:U,disableEditVariable:X,onDeleteSelectedProducts:Y,setSelectedCarouselIndex:Z,setVariableCallback:ee,setShowVariablePicker:te,sliderRef:le}=g(),[oe,ie]=s(x(null==P?void 0:P.channel)?"Carousel Cards":-1==q?"First Message (Step 1/2)":z?"Product Carousel "+((null===(M=null===(A=null==P?void 0:P.mapping)||void 0===A?void 0:A.body)||void 0===M?void 0:M.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(D=null===(V=null==P?void 0:P.mapping)||void 0===V?void 0:V.body)||void 0===D?void 0:D.length)?"(Step 2/2)":"")),[ne,re]=s(!1),[ae,de]=s(!1),se=q===(null!=H?H:-1)-1,ce=(null!=q?q:-1)<1;c((()=>{var e,t,l,o;ie(x(null==P?void 0:P.channel)?"Carousel Cards":-1==q?"First Message (Step 1/2)":z?"Product Carousel "+((null===(t=null===(e=null==P?void 0:P.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(o=null===(l=null==P?void 0:P.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[q]),c((()=>{te(!1)}),[q]);const ue=e=>{null==J||J([{name:"variable",productName:e.actualValue}])};return c((()=>{-1===q&&x(null==P?void 0:P.channel)&&(null==Z||Z(0))}),[q,null==P?void 0:P.channel]),e("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"row",alignItems:"center"}},{children:[!x(null==P?void 0:P.channel)&&null!=q&&q>=0&&!!(null===(R=null===(F=null==P?void 0:P.mapping)||void 0===F?void 0:F.body)||void 0===R?void 0:R.length)&&t(p,{Icon:i,onClick:()=>{null==Z||Z(-1)}}),t(C,Object.assign({style:{marginLeft:10}},{children:oe}))]})),z&&(null!==(W=null==K?void 0:K.length)&&void 0!==W?W:0)>0&&null!=q&&q>=0&&e("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(y,{editItem:()=>{1===(null==K?void 0:K.length)&&"variable"===K[0].name?(ee((()=>ue)),te(!0)):re(!ne)},cardBody:1===(null==K?void 0:K.length)&&"variable"===K[0].name?`${K[0].productName}`:`${null==K?void 0:K.length} Products Selected`,hideIcon:1===(null==K?void 0:K.length)&&"variable"===K[0].name,deleteItem:()=>{var e;if(1===(null==K?void 0:K.length)&&"variable"===K[0].name)return void(null==J||J([]));const t=d(Object.assign({},P));t&&(U&&U.length>0?null==U||U.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=U[l])&&void 0!==o?o:"https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,l)=>{t.components[1].cards[l].components[0].example.header_handle=["https://res.cloudinary.com/drqhot9ot/image/upload/v1708753454/fake-product.png"]})),null==N||N(t)),null==J||J([]),null==Y||Y()}}),K&&(null==K?void 0:K.length)>0&&"variable"!=K[0].name&&t(u,{disabled:(null!==($=null==K?void 0:K.length)&&void 0!==$?$:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{de(!0),re(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!X&&z&&0===(null==K?void 0:K.length)&&null!=q&&q>=0&&e(l,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(I,{children:"Product(s)"}),t(k,{children:`Select ${null!=H?H:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:Q?16:12,marginRight:Q?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(u,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:Q?`2px dashed ${b.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(a,{width:18,height:18,color:b.content.secondary})})),onClick:e=>{re(!0)}}),G===j.CHATBOT&&e(l,{children:[e("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8,flex:1}}),t(w,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8,flex:1}})]})),t(u,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:Q?`2px dashed ${b.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:Q?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(a,{width:18,height:18,color:b.content.secondary})})),onClick:e=>{ee((()=>ue)),te(!0)}})]})]})),Q&&t("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:t(h,{padding:"8px",errorText:"Please add products"})}))]}),!z&&(null!=q?q:-1)>-1&&e("div",Object.assign({style:{display:"flex",background:b.surface.hovered,alignItems:"center"}},{children:[t(p,{Icon:n,disabled:ce,width:8,height:14,svgStyle:ce?{}:{color:b.content.secondary},onClick:()=>{var e;null===(e=null==le?void 0:le.current)||void 0===e||e.slickPrev(),(null!=q?q:-1)<1||null==Z||Z((e=>e-1))}}),t(I,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:b.content.secondary},{children:`Card ${(null!=q?q:0)+1}/${H}`})),t(p,{Icon:r,width:8,height:14,disabled:se,svgStyle:se?{}:{color:b.content.secondary},onClick:()=>{var e;null===(e=null==le?void 0:le.current)||void 0===e||e.slickNext(),(null!=q?q:-1)>=(null!=H?H:-1)-1||null==Z||Z((e=>e+1))}})]})),t(f,{whatsappSpecificPickerMeta:T,template:P,onTemplateChange:e=>{null==N||N(e)},showVariableModal:S,variableListForImage:L,discountCode:B,setDiscountCode:E}),ne&&_&&t(m,{zIndex:200,startupScreen:ae?v.RearrangeProducts:v.Collections,rearrangeEnabled:!0,storeId:_.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const l of e){const e=null==l?void 0:l.collectionId,o=l.productId,i=l.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),o in t[e].products||(t[e].products[o]={variants:{},name:(null==l?void 0:l.productName)||"",image:(null==l?void 0:l.productImage)||""}),t[e].products[o].variants[i]={name:(null==l?void 0:l.name)||"",price:"",image:(null==l?void 0:l.image)||"",quantity:l.quantity||0,displayOrder:l.displayOrder}}return t}return{}})(null!=K?K:[]),collectionFetcher:_.fetchCollections,productFetcher:_.fetchProducts,onAdd:(e,t)=>{var l,o,i,n,r,a;de(!1);const s=[];delete e.isCustom;for(const t of Object.keys(e)){const d=e[t].products;if(void 0!==d&&Object.keys(d).length)for(const e of Object.keys(d)){const c=d[e].variants;if(void 0!==c&&Object.keys(c).length)for(const u of Object.keys(c)){const{name:p,image:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=d[e])||void 0===l?void 0:l.image)&&void 0!==o?o:"",quantity:v,variantId:u,productId:e,displayOrder:h,collectionId:t,productName:null!==(n=null===(i=d[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(a=null===(r=d[e])||void 0===r?void 0:r.image)&&void 0!==a?a:""};s.push(g)}}}const c=s.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=s.map((e=>e.image)),p=d(Object.assign({},P));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==U?void 0:U[t])&&void 0!==l?l:""]})),null==N||N(p)),null==J||J(c),re(!1)},searchInCollectionFetcher:_.searchInCollection,searchFetcher:_.searchProducts,visible:ne,onClose:()=>{re(!1)},exactLimit:null!=H?H:1,appType:_.appType||o.BIK})]}))};export{O as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.740-beta.5",
3
+ "version": "0.0.740-beta.7",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { IMessage } from '../types';
3
- import { BubbleProps } from './types';
4
- export declare const Bubble: <TMessage extends IMessage<import("../types").User> = IMessage<import("../types").User>>(props: BubbleProps<TMessage>) => React.ReactElement;
5
- export default Bubble;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { IMessage, User } from '../types';
3
- export interface BubbleProps<TMessage extends IMessage = IMessage> {
4
- currentMessage: TMessage;
5
- previousMessage?: TMessage;
6
- nextMessage?: TMessage;
7
- position: 'left' | 'right';
8
- user: User;
9
- tickStyle?: React.CSSProperties;
10
- usernameStyle?: React.CSSProperties;
11
- renderMessageText?: (props: BubbleProps<TMessage>) => React.ReactNode;
12
- renderTicks?: (currentMessage: TMessage) => React.ReactNode;
13
- renderTime?: (props: BubbleProps<TMessage>) => React.ReactNode;
14
- renderCustomView?: (props: BubbleProps<TMessage>) => React.ReactNode;
15
- renderUsername?: (props: BubbleProps<TMessage>) => React.ReactNode;
16
- onPress?: (context?: any, message?: TMessage) => void;
17
- onLongPress?: (context?: any, message?: TMessage) => void;
18
- isCustomViewBottom?: boolean;
19
- renderUsernameOnMessage?: boolean;
20
- isUnsatisfactoryMessageFn?: (params: {
21
- aiTraceId?: string;
22
- messagesGroupedByAiTraceId?: any;
23
- }) => boolean;
24
- messagesGroupedByAiTraceId?: any;
25
- }
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- export interface DayProps {
3
- createdAt?: Date | number | string;
4
- dateFormat?: string;
5
- dateFormatCalendar?: {
6
- sameDay?: string;
7
- nextDay?: string;
8
- nextWeek?: string;
9
- lastDay?: string;
10
- lastWeek?: string;
11
- sameElse?: string;
12
- };
13
- }
14
- export declare const Day: React.NamedExoticComponent<DayProps>;
15
- export default Day;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { IMessage } from '../types';
3
- import { GiftedChatProps } from './types';
4
- declare const _default: React.ForwardRefExoticComponent<Omit<GiftedChatProps<IMessage<import("../types").User>>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
- export default _default;
@@ -1,6 +0,0 @@
1
- import { IMessage } from '../types';
2
- export declare const isChatActivity: (message: IMessage) => boolean;
3
- export declare const isPrivateNote: (message: IMessage) => boolean;
4
- export declare const isCallBubble: (message: IMessage) => boolean;
5
- export declare const shouldCenterAlign: (message: IMessage) => boolean;
6
- export declare const getMessagePlacement: (message: IMessage, defaultPosition: 'left' | 'right') => 'left' | 'right' | 'center';
@@ -1,10 +0,0 @@
1
- import { IMessage } from '../types';
2
- import { ScrollState } from './types';
3
- export declare const useScrollToBottom: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>) => () => void;
4
- export declare const useInitialMountScroll: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
5
- export declare const useScrollCleanup: (scrollState: React.MutableRefObject<ScrollState>) => void;
6
- export declare const useRestoreScrollPosition: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number) => void;
7
- export declare const useAutoScrollOnNewMessages: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
8
- export declare const useResizeObserverForFirstMessage: (firstMessage: IMessage | undefined, scrollState: React.MutableRefObject<ScrollState>, scrollToBottom: () => void, messageIdGenerator?: ((message?: IMessage) => string) | undefined) => void;
9
- export declare const handleInfiniteScroll: (scrollTop: number, scrollHeight: number, state: ScrollState, onEndReached?: () => void, topThreshold?: number) => void;
10
- export declare const useScrollHandler: (scrollState: React.MutableRefObject<ScrollState>, onEndReached?: () => void, onScroll?: ((event: React.UIEvent<HTMLDivElement>) => void) | undefined, topThreshold?: number) => (event: React.UIEvent<HTMLDivElement>) => void;
@@ -1,95 +0,0 @@
1
- import React from 'react';
2
- import { BubbleProps } from '../Bubble/types';
3
- import { IMessage, LeftRightStyle, User } from '../types';
4
- export interface ListViewProps {
5
- style?: React.CSSProperties;
6
- onEndReached?: () => void;
7
- onEndReachedThreshold?: number;
8
- onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
9
- ref?: React.RefObject<HTMLDivElement> | React.MutableRefObject<HTMLDivElement | null>;
10
- }
11
- export interface AvatarProps<TMessage extends IMessage = IMessage> {
12
- currentMessage: TMessage;
13
- previousMessage?: TMessage;
14
- nextMessage?: TMessage;
15
- position: 'left' | 'right';
16
- user: User;
17
- renderAvatarOnTop?: boolean;
18
- showUserAvatar?: boolean;
19
- showAvatarForEveryMessage?: boolean;
20
- imageStyle?: LeftRightStyle<React.CSSProperties>;
21
- containerStyle?: LeftRightStyle<React.CSSProperties>;
22
- [key: string]: any;
23
- }
24
- export interface DayProps {
25
- createdAt?: Date | number | string;
26
- dateFormat?: string;
27
- dateFormatCalendar?: {
28
- sameDay?: string;
29
- nextDay?: string;
30
- nextWeek?: string;
31
- lastDay?: string;
32
- lastWeek?: string;
33
- sameElse?: string;
34
- };
35
- }
36
- export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
37
- messages: TMessage[];
38
- user: User;
39
- renderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;
40
- renderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;
41
- renderDay?: (props: DayProps) => React.ReactNode;
42
- renderLoading?: () => React.ReactNode;
43
- renderChatEmpty?: () => React.ReactNode;
44
- listViewProps?: ListViewProps;
45
- topThreshold?: number;
46
- renderAvatarOnTop?: boolean;
47
- showUserAvatar?: boolean;
48
- showAvatarForEveryMessage?: boolean;
49
- inverted?: boolean;
50
- onLongPress?: (context?: any, message?: TMessage) => void;
51
- onPress?: (context?: any, message?: TMessage) => void;
52
- messageIdGenerator?: (message?: TMessage) => string;
53
- [key: string]: any;
54
- }
55
- export interface ScrollState {
56
- isInitialMount: boolean;
57
- isUserScrolling: boolean;
58
- isLoadingOldMessages: boolean;
59
- isAtBottom: boolean;
60
- hasTriggeredEndReached: boolean;
61
- lastMessagesLength: number;
62
- previousScrollHeight: number;
63
- previousScrollTop: number;
64
- scrollTimeout: number | null;
65
- }
66
- export declare enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {
67
- CALLING_CALL = "CALLING_CALL",
68
- RINGING_CALL = "RINGING_CALL",
69
- ONGOING_CALL = "ONGOING_CALL",
70
- COMPLETED_CALL = "COMPLETED_CALL",
71
- MISSED_CALL = "MISSED_CALL",
72
- REQUESTED_CALLBACK = "REQUESTED_CALLBACK",
73
- DECLINED_CALL = "DECLINED_CALL",
74
- DISCONNECTED_CALL = "DISCONNECTED_CALL",
75
- UNANSWERED_CALL = "UNANSWERED_CALL"
76
- }
77
- export declare const enum MESSAGE_CHANNELS {
78
- INSTAGRAM = "instagram",
79
- MESSENGER = "messenger",
80
- WHATSAPP = "whatsapp",
81
- GMAIL = "gmail",
82
- LIVECHAT = "livechat",
83
- GOOGLE_BUSINESS_CHAT = "gbm",
84
- SHOPIFY = "shopify",
85
- FACEBOOK = "facebook",
86
- EMAIL = "email",
87
- SMTP = "smtp",
88
- FACEBOOK_CATALOG = "facebook-catalog",
89
- WHATSAPP_VOICE_CALL = "whatsapp-voice-call",
90
- CREATE_SIGNATURE = "create-signature",
91
- EDIT_SIGNATURE = "edit-signature",
92
- WEBPUSH = "webpush",
93
- TASKS = "tasks",
94
- RCS = "rcs"
95
- }
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- import { IMessage } from '../types';
3
- export declare const BOTTOM_THRESHOLD = 100;
4
- export declare const TOP_THRESHOLD = 600;
5
- export declare const SCROLL_IDLE_MS = 300;
6
- export declare const Constants: {
7
- readonly ChatActivity: {
8
- readonly Category: {
9
- readonly ACTIVITY: "ACTIVITY";
10
- readonly MESSAGE: "MESSAGE";
11
- };
12
- readonly Type: {
13
- readonly PRIVATE_NOTE: "PRIVATE_NOTE";
14
- readonly CALL: "CALL";
15
- readonly AUTOMATION: "AUTOMATION";
16
- };
17
- };
18
- };
19
- export declare const isSameDay: (a?: IMessage, b?: IMessage) => boolean;
20
- export declare const normalizeRef: <T>(ref: import("react").Ref<T> | undefined, fallback: import("react").RefObject<T>) => import("react").MutableRefObject<T | null>;
21
- export declare const isScrollAtBottom: (el: HTMLDivElement | null) => boolean;
22
- export declare const isStringifiedArray: (value: any) => [boolean, [] | null];
@@ -1,5 +0,0 @@
1
- export type { IMessage, User, LeftRightStyle } from './types';
2
- export { default as BikGiftedChat } from './GiftedChat/GiftedChat';
3
- export { Bubble } from './Bubble/Bubble';
4
- export type { BubbleProps } from './Bubble/types';
5
- export type { GiftedChatProps, DayProps, AvatarProps, ListViewProps, ScrollState, } from './GiftedChat/types';
@@ -1,24 +0,0 @@
1
- export interface User {
2
- _id: string | number;
3
- name?: string;
4
- avatar?: string | number;
5
- [key: string]: any;
6
- }
7
- export interface IMessage<TUser extends User = User> {
8
- _id: string | number;
9
- text: string;
10
- createdAt: Date | number | string;
11
- user: TUser;
12
- image?: string;
13
- video?: string;
14
- audio?: string;
15
- system?: boolean;
16
- sent?: boolean;
17
- received?: boolean;
18
- pending?: boolean;
19
- [key: string]: any;
20
- }
21
- export interface LeftRightStyle<T> {
22
- left?: T;
23
- right?: T;
24
- }
@@ -1,2 +0,0 @@
1
- export declare const useWindowSize: () => boolean;
2
- export declare const useWindowWidth: () => number;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { IMessage } from '../types';
3
- import { BubbleProps } from './types';
4
- export declare const Bubble: <TMessage extends IMessage<import("../types").User> = IMessage<import("../types").User>>(props: BubbleProps<TMessage>) => React.ReactElement;
5
- export default Bubble;
@@ -1,25 +0,0 @@
1
- import React from 'react';
2
- import { IMessage, User } from '../types';
3
- export interface BubbleProps<TMessage extends IMessage = IMessage> {
4
- currentMessage: TMessage;
5
- previousMessage?: TMessage;
6
- nextMessage?: TMessage;
7
- position: 'left' | 'right';
8
- user: User;
9
- tickStyle?: React.CSSProperties;
10
- usernameStyle?: React.CSSProperties;
11
- renderMessageText?: (props: BubbleProps<TMessage>) => React.ReactNode;
12
- renderTicks?: (currentMessage: TMessage) => React.ReactNode;
13
- renderTime?: (props: BubbleProps<TMessage>) => React.ReactNode;
14
- renderCustomView?: (props: BubbleProps<TMessage>) => React.ReactNode;
15
- renderUsername?: (props: BubbleProps<TMessage>) => React.ReactNode;
16
- onPress?: (context?: any, message?: TMessage) => void;
17
- onLongPress?: (context?: any, message?: TMessage) => void;
18
- isCustomViewBottom?: boolean;
19
- renderUsernameOnMessage?: boolean;
20
- isUnsatisfactoryMessageFn?: (params: {
21
- aiTraceId?: string;
22
- messagesGroupedByAiTraceId?: any;
23
- }) => boolean;
24
- messagesGroupedByAiTraceId?: any;
25
- }
@@ -1,15 +0,0 @@
1
- import React from 'react';
2
- export interface DayProps {
3
- createdAt?: Date | number | string;
4
- dateFormat?: string;
5
- dateFormatCalendar?: {
6
- sameDay?: string;
7
- nextDay?: string;
8
- nextWeek?: string;
9
- lastDay?: string;
10
- lastWeek?: string;
11
- sameElse?: string;
12
- };
13
- }
14
- export declare const Day: React.NamedExoticComponent<DayProps>;
15
- export default Day;
@@ -1,5 +0,0 @@
1
- import React from 'react';
2
- import { IMessage } from '../types';
3
- import { GiftedChatProps } from './types';
4
- declare const _default: React.ForwardRefExoticComponent<Omit<GiftedChatProps<IMessage<import("../types").User>>, "ref"> & React.RefAttributes<HTMLDivElement>>;
5
- export default _default;
@@ -1,6 +0,0 @@
1
- import { IMessage } from '../types';
2
- export declare const isChatActivity: (message: IMessage) => boolean;
3
- export declare const isPrivateNote: (message: IMessage) => boolean;
4
- export declare const isCallBubble: (message: IMessage) => boolean;
5
- export declare const shouldCenterAlign: (message: IMessage) => boolean;
6
- export declare const getMessagePlacement: (message: IMessage, defaultPosition: 'left' | 'right') => 'left' | 'right' | 'center';
@@ -1,10 +0,0 @@
1
- import { IMessage } from '../types';
2
- import { ScrollState } from './types';
3
- export declare const useScrollToBottom: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>) => () => void;
4
- export declare const useInitialMountScroll: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
5
- export declare const useScrollCleanup: (scrollState: React.MutableRefObject<ScrollState>) => void;
6
- export declare const useRestoreScrollPosition: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number) => void;
7
- export declare const useAutoScrollOnNewMessages: (scrollRef: React.MutableRefObject<HTMLDivElement | null>, scrollState: React.MutableRefObject<ScrollState>, messagesLength: number, scrollToBottom: () => void) => void;
8
- export declare const useResizeObserverForFirstMessage: (firstMessage: IMessage | undefined, scrollState: React.MutableRefObject<ScrollState>, scrollToBottom: () => void, messageIdGenerator?: ((message?: IMessage) => string) | undefined) => void;
9
- export declare const handleInfiniteScroll: (scrollTop: number, scrollHeight: number, state: ScrollState, onEndReached?: () => void, topThreshold?: number) => void;
10
- export declare const useScrollHandler: (scrollState: React.MutableRefObject<ScrollState>, onEndReached?: () => void, onScroll?: ((event: React.UIEvent<HTMLDivElement>) => void) | undefined, topThreshold?: number) => (event: React.UIEvent<HTMLDivElement>) => void;
@@ -1,95 +0,0 @@
1
- import React from 'react';
2
- import { BubbleProps } from '../Bubble/types';
3
- import { IMessage, LeftRightStyle, User } from '../types';
4
- export interface ListViewProps {
5
- style?: React.CSSProperties;
6
- onEndReached?: () => void;
7
- onEndReachedThreshold?: number;
8
- onScroll?: (event: React.UIEvent<HTMLDivElement>) => void;
9
- ref?: React.RefObject<HTMLDivElement> | React.MutableRefObject<HTMLDivElement | null>;
10
- }
11
- export interface AvatarProps<TMessage extends IMessage = IMessage> {
12
- currentMessage: TMessage;
13
- previousMessage?: TMessage;
14
- nextMessage?: TMessage;
15
- position: 'left' | 'right';
16
- user: User;
17
- renderAvatarOnTop?: boolean;
18
- showUserAvatar?: boolean;
19
- showAvatarForEveryMessage?: boolean;
20
- imageStyle?: LeftRightStyle<React.CSSProperties>;
21
- containerStyle?: LeftRightStyle<React.CSSProperties>;
22
- [key: string]: any;
23
- }
24
- export interface DayProps {
25
- createdAt?: Date | number | string;
26
- dateFormat?: string;
27
- dateFormatCalendar?: {
28
- sameDay?: string;
29
- nextDay?: string;
30
- nextWeek?: string;
31
- lastDay?: string;
32
- lastWeek?: string;
33
- sameElse?: string;
34
- };
35
- }
36
- export interface GiftedChatProps<TMessage extends IMessage = IMessage> {
37
- messages: TMessage[];
38
- user: User;
39
- renderBubble?: (props: BubbleProps<TMessage>) => React.ReactNode;
40
- renderAvatar?: (props: AvatarProps<TMessage>) => React.ReactNode;
41
- renderDay?: (props: DayProps) => React.ReactNode;
42
- renderLoading?: () => React.ReactNode;
43
- renderChatEmpty?: () => React.ReactNode;
44
- listViewProps?: ListViewProps;
45
- topThreshold?: number;
46
- renderAvatarOnTop?: boolean;
47
- showUserAvatar?: boolean;
48
- showAvatarForEveryMessage?: boolean;
49
- inverted?: boolean;
50
- onLongPress?: (context?: any, message?: TMessage) => void;
51
- onPress?: (context?: any, message?: TMessage) => void;
52
- messageIdGenerator?: (message?: TMessage) => string;
53
- [key: string]: any;
54
- }
55
- export interface ScrollState {
56
- isInitialMount: boolean;
57
- isUserScrolling: boolean;
58
- isLoadingOldMessages: boolean;
59
- isAtBottom: boolean;
60
- hasTriggeredEndReached: boolean;
61
- lastMessagesLength: number;
62
- previousScrollHeight: number;
63
- previousScrollTop: number;
64
- scrollTimeout: number | null;
65
- }
66
- export declare enum CHAT_ACTIVITY_TYPES_FOR_CALL_BUBBLE {
67
- CALLING_CALL = "CALLING_CALL",
68
- RINGING_CALL = "RINGING_CALL",
69
- ONGOING_CALL = "ONGOING_CALL",
70
- COMPLETED_CALL = "COMPLETED_CALL",
71
- MISSED_CALL = "MISSED_CALL",
72
- REQUESTED_CALLBACK = "REQUESTED_CALLBACK",
73
- DECLINED_CALL = "DECLINED_CALL",
74
- DISCONNECTED_CALL = "DISCONNECTED_CALL",
75
- UNANSWERED_CALL = "UNANSWERED_CALL"
76
- }
77
- export declare const enum MESSAGE_CHANNELS {
78
- INSTAGRAM = "instagram",
79
- MESSENGER = "messenger",
80
- WHATSAPP = "whatsapp",
81
- GMAIL = "gmail",
82
- LIVECHAT = "livechat",
83
- GOOGLE_BUSINESS_CHAT = "gbm",
84
- SHOPIFY = "shopify",
85
- FACEBOOK = "facebook",
86
- EMAIL = "email",
87
- SMTP = "smtp",
88
- FACEBOOK_CATALOG = "facebook-catalog",
89
- WHATSAPP_VOICE_CALL = "whatsapp-voice-call",
90
- CREATE_SIGNATURE = "create-signature",
91
- EDIT_SIGNATURE = "edit-signature",
92
- WEBPUSH = "webpush",
93
- TASKS = "tasks",
94
- RCS = "rcs"
95
- }
@@ -1,22 +0,0 @@
1
- /// <reference types="react" />
2
- import { IMessage } from '../types';
3
- export declare const BOTTOM_THRESHOLD = 100;
4
- export declare const TOP_THRESHOLD = 600;
5
- export declare const SCROLL_IDLE_MS = 300;
6
- export declare const Constants: {
7
- readonly ChatActivity: {
8
- readonly Category: {
9
- readonly ACTIVITY: "ACTIVITY";
10
- readonly MESSAGE: "MESSAGE";
11
- };
12
- readonly Type: {
13
- readonly PRIVATE_NOTE: "PRIVATE_NOTE";
14
- readonly CALL: "CALL";
15
- readonly AUTOMATION: "AUTOMATION";
16
- };
17
- };
18
- };
19
- export declare const isSameDay: (a?: IMessage, b?: IMessage) => boolean;
20
- export declare const normalizeRef: <T>(ref: import("react").Ref<T> | undefined, fallback: import("react").RefObject<T>) => import("react").MutableRefObject<T | null>;
21
- export declare const isScrollAtBottom: (el: HTMLDivElement | null) => boolean;
22
- export declare const isStringifiedArray: (value: any) => [boolean, [] | null];
@@ -1,5 +0,0 @@
1
- export type { IMessage, User, LeftRightStyle } from './types';
2
- export { default as BikGiftedChat } from './GiftedChat/GiftedChat';
3
- export { Bubble } from './Bubble/Bubble';
4
- export type { BubbleProps } from './Bubble/types';
5
- export type { GiftedChatProps, DayProps, AvatarProps, ListViewProps, ScrollState, } from './GiftedChat/types';
@@ -1,24 +0,0 @@
1
- export interface User {
2
- _id: string | number;
3
- name?: string;
4
- avatar?: string | number;
5
- [key: string]: any;
6
- }
7
- export interface IMessage<TUser extends User = User> {
8
- _id: string | number;
9
- text: string;
10
- createdAt: Date | number | string;
11
- user: TUser;
12
- image?: string;
13
- video?: string;
14
- audio?: string;
15
- system?: boolean;
16
- sent?: boolean;
17
- received?: boolean;
18
- pending?: boolean;
19
- [key: string]: any;
20
- }
21
- export interface LeftRightStyle<T> {
22
- left?: T;
23
- right?: T;
24
- }
@@ -1,2 +0,0 @@
1
- export declare const useWindowSize: () => boolean;
2
- export declare const useWindowWidth: () => number;