@bikdotai/bik-component-library 0.0.732-beta.3 → 0.0.732-beta.5
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.
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/product-picker/ProductPickerModal.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/product-picker/ProductPickerModal.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../node_modules/lodash.debounce/index.js"),s=require("react"),o=require("../bik-layout/PageLoader.js"),r=require("../checkBox/CheckBox.js"),n=require("../input/Input.js"),i=require("../modals/styledModal.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("../../node_modules/lodash.debounce/index.js"),s=require("react"),o=require("../bik-layout/PageLoader.js"),r=require("../checkBox/CheckBox.js"),n=require("../input/Input.js"),i=require("../modals/styledModal.js"),c=require("./ProductPicker.styled.js"),l=require("../TypographyStyle.js"),a=require("../../utils/DateUtils.js"),d=require("../../constants/Theme.js"),u=require("../../assets/icons/alert_triangle.svg.js"),x=require("../../assets/icons/search.svg.js");const p="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",j=t=>{let{text:s,styleProps:o}=t;return e.jsxRuntimeExports.jsxs(c.StyledZeroState,{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"icon__container",style:Object.assign({},o)},{children:e.jsxRuntimeExports.jsx(u.default,{width:24,height:24,color:d.DEFAULT_THEME.colorsV2.content.secondary})})),e.jsxRuntimeExports.jsx(l.TitleSmall,{children:"No results found"}),e.jsxRuntimeExports.jsx(l.BodySecondary,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.secondary,textAlign:"center"}},{children:`Sorry we could not find any results for "${s}"`}))]})},m=i=>{var u,m,h,E;const g=i.instaPost?a.default.dateFormat(new Date(i.instaPost.timestamp),"•",!0):"",[P,y]=s.useState(i.products),[v,_]=s.useState(!1),[b,f]=s.useState("");s.useEffect((()=>{i.show&&(f(""),y(i.products),_(!1))}),[i.show]);const R=s.useCallback(t.default((e=>{e?(y([]),i.onSearchKeyChange(e).then((e=>{y(e),_(!1)}))):(y(i.products),_(!1))}),700),[]);return e.jsxRuntimeExports.jsxs(c.StyledProductPickerContainer,{children:[i.instaPost&&e.jsxRuntimeExports.jsxs("div",Object.assign({className:"post__wrapper"},{children:[e.jsxRuntimeExports.jsx("img",{alt:"Ig Media",onError:e=>{e.target.onerror=null,e.target.src=p},src:null===(u=i.instaPost)||void 0===u?void 0:u.media_url,className:"post__thumbnail"}),e.jsxRuntimeExports.jsxs("div",Object.assign({className:"post__info-wrapper"},{children:[e.jsxRuntimeExports.jsx(l.BodyPrimary,Object.assign({style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:i.instaPost.caption?d.DEFAULT_THEME.colorsV2.content.primary:d.DEFAULT_THEME.colorsV2.content.secondary}},{children:(null===(m=i.instaPost)||void 0===m?void 0:m.caption)?null===(h=i.instaPost)||void 0===h?void 0:h.caption:"No caption"})),e.jsxRuntimeExports.jsx(l.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.placeholder}},{children:g}))]}))]})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{borderTop:i.instaPost?`1px solid ${d.DEFAULT_THEME.colorsV2.stroke.primary}`:"none",borderBottom:`1px solid ${d.DEFAULT_THEME.colorsV2.stroke.primary}`,padding:i.instaPost?"16px 24px":"0px 24px 16px 24px"}},{children:e.jsxRuntimeExports.jsx(n.Input,{value:b,placeholder:null!==(E=i.searchPlaceholder)&&void 0!==E?E:"Search products..",onChangeText:e=>{var t;f(e),(null===(t=e.trim())||void 0===t?void 0:t.length)>0?(_(!0),R(e)):(_(!1),y(i.products))},rightIcon:{icon:x.default}})})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{maxHeight:350,overflowY:"scroll"}},{children:[v&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"loader__wrapper"},{children:e.jsxRuntimeExports.jsx(o.PageLoader,{})})),0!==P.length||v?P.map((t=>{var s;const o=i.selectedProducts.find((e=>e.id===t.id));return e.jsxRuntimeExports.jsxs("div",Object.assign({className:"product__wrapper"},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({className:"product__info-wrapper"},{children:[e.jsxRuntimeExports.jsx("img",{alt:"Product",onError:e=>{e.target.onerror=null,e.target.src=p},src:null!==(s=t.image)&&void 0!==s?s:p,className:"product__image"}),e.jsxRuntimeExports.jsx(l.TitleSmall,{children:t.name})]})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{order:1}},{children:e.jsxRuntimeExports.jsx(r.CheckBox,{isChecked:void 0!==o,onValueChange:e=>{((e,t)=>{const s=i.selectedProducts.find((e=>e.id===t.id));if(e&&!s){const e=[...i.selectedProducts,t];i.setSelectedProducts(e)}else if(s){const e=[...i.selectedProducts];let s=-1;i.selectedProducts.forEach(((e,o)=>{e.id===t.id&&(s=o)})),e.splice(s,1),i.setSelectedProducts(e)}})(e,t)}})}))]}),t.id)})):e.jsxRuntimeExports.jsx(j,{text:b})]}))]})};exports.PricePleaseProductPicker=t=>{var o;const[r,n]=s.useState([]);return s.useEffect((()=>{var e;n(null!==(e=t.selectedProducts)&&void 0!==e?e:[])}),[null===(o=t.selectedProducts)||void 0===o?void 0:o.length]),e.jsxRuntimeExports.jsx(i.StyledModal,Object.assign({open:t.show,onClose:()=>{t.onClose()},footerLeftCustomElement:r.length>10?e.jsxRuntimeExports.jsx(l.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.negative}},{children:"Can't add more than 10 products"})):e.jsxRuntimeExports.jsx(l.Caption,Object.assign({style:{color:d.DEFAULT_THEME.colorsV2.content.placeholder}},{children:r?`${r.length} selected`:""})),headingTitle:t.title,primaryButton:{disabled:r.length>10||0===r.length,buttonType:"primary",buttonText:"Select",size:"small",onClick:()=>{t.setSelectedProducts(r),t.onClose()}},secondaryButton:t.secondaryButtonProps,footerShadow:!0},{children:e.jsxRuntimeExports.jsx(m,Object.assign({},t,{selectedProducts:r,setSelectedProducts:n}))}))},exports.ProductPickerContent=m;
|
package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),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"),s=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),u=require("../../product-picker-v2/modal.js"),c=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),m=require("../context/templateModalContext.js"),x=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var g=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var j=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../TypographyStyle.js");exports.default=f=>{let{template:b,whatsappSpecificPickerMeta:C,showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}=f;var S,k,q,w,P,T,B,L;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}=m.useTemplateModalContext(),[X,Y]=r.useState(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(k=null===(S=null==b?void 0:b.mapping)||void 0===S?void 0:S.body)||void 0===k?void 0:k.length)?"(Step 2/2)":""):"Carousel Cards "+((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)":"")),[Z,ee]=r.useState(!1),[te,le]=r.useState(!1),ne=M===(null!=W?W:-1)-1,ie=(null!=M?M:-1)<1;r.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)":"")),Q(!1)}),[M]);const se=e=>{null==$||$([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===M&&j.isRCSChannel(null==b?void 0:b.channel)&&(null==K||K(0))}),[M,null==b?void 0:b.channel]),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxRuntimeExports.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===(T=null===(P=null==b?void 0:b.mapping)||void 0===P?void 0:P.body)||void 0===T?void 0:T.length)&&e.jsxRuntimeExports.jsx(d.IconButton,{Icon:l.default,onClick:()=>{null==K||K(-1)}}),e.jsxRuntimeExports.jsx(y.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),F&&(null!==(B=null==N?void 0:N.length)&&void 0!==B?B:0)>0&&null!=M&&M>=0&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsxRuntimeExports.jsx(v.ProductBox,{editItem:()=>{1===(null==N?void 0:N.length)&&"variable"===N[0].name?(J((()=>se)),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=o.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.jsxRuntimeExports.jsx(a.Button,{disabled:(null!==(L=null==N?void 0:N.length)&&void 0!==L?L: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.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsxRuntimeExports.jsx(y.TitleRegular,{children:"Product(s)"}),e.jsxRuntimeExports.jsx(y.BodySecondary,{children:`Select ${null!=W?W:1} products`})]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:_?16:12,marginRight:_?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),V===g.POD.CHATBOT&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",flex:1}}),e.jsxRuntimeExports.jsx(y.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset",margin:"0 8px"}},{children:"OR"})),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",flex:1}})]})),e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{J((()=>se)),Q(!0)}})]})]})),_&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsxRuntimeExports.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!F&&(null!=M?M:-1)>-1&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(d.IconButton,{Icon:n.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:h.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.jsxRuntimeExports.jsx(y.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${W}`})),e.jsxRuntimeExports.jsx(d.IconButton,{Icon:i.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:h.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.jsxRuntimeExports.jsx(x.default,{whatsappSpecificPickerMeta:C,template:b,onTemplateChange:e=>{null==A||A(e)},showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}),Z&&D&&e.jsxRuntimeExports.jsx(u.ProductPickerModal,{zIndex:200,startupScreen:te?c.ScreenName.RearrangeProducts:c.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,s,r,a;le(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const u=o[e].variants;if(void 0!==u&&Object.keys(u).length)for(const c of Object.keys(u)){const{name:p,image:m,quantity:x,displayOrder:v}=u[c],h={name:p,image:null!==(n=null!=m?m:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:x,variantId:c,productId:e,displayOrder:v,collectionId:t,productName:null!==(s=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==s?s:"",productImage:null!==(a=null===(r=o[e])||void 0===r?void 0:r.image)&&void 0!==a?a:""};d.push(h)}}}const u=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),c=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},b));p&&(c.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==$||$(u),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("../../../node_modules/react/jsx-runtime.js"),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"),s=require("../../../assets/icons/PlusIcon.js"),o=require("lodash"),r=require("react"),a=require("../../button/Button.js"),d=require("../../icon-button/IconButton.js"),u=require("../../product-picker-v2/modal.js"),c=require("../../product-picker-v2/type.js"),p=require("../Badge/index.js"),m=require("../context/templateModalContext.js"),x=require("./EditWhatsAppTemplateV2.js"),v=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var h=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var g=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var j=require("../../template-preview/helpers/templateMiscHelper.js"),y=require("../../TypographyStyle.js");exports.default=f=>{let{template:b,whatsappSpecificPickerMeta:C,showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}=f;var S,k,q,w,P,T,B,L;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}=m.useTemplateModalContext(),[X,Y]=r.useState(j.isRCSChannel(null==b?void 0:b.channel)?"Carousel Cards":-1==M?"First Message (Step 1/2)":F?"Product Carousel "+((null===(k=null===(S=null==b?void 0:b.mapping)||void 0===S?void 0:S.body)||void 0===k?void 0:k.length)?"(Step 2/2)":""):"Carousel Cards "+((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)":"")),[Z,ee]=r.useState(!1),[te,le]=r.useState(!1),ne=M===(null!=W?W:-1)-1,ie=(null!=M?M:-1)<1;r.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 se=e=>{null==$||$([{name:"variable",productName:e.actualValue}])};return r.useEffect((()=>{-1===M&&j.isRCSChannel(null==b?void 0:b.channel)&&(null==K||K(0))}),[M,null==b?void 0:b.channel]),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:"16px"}},{children:[e.jsxRuntimeExports.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===(T=null===(P=null==b?void 0:b.mapping)||void 0===P?void 0:P.body)||void 0===T?void 0:T.length)&&e.jsxRuntimeExports.jsx(d.IconButton,{Icon:l.default,onClick:()=>{null==K||K(-1)}}),e.jsxRuntimeExports.jsx(y.TitleMedium,Object.assign({style:{marginLeft:10}},{children:X}))]})),F&&(null!==(B=null==N?void 0:N.length)&&void 0!==B?B:0)>0&&null!=M&&M>=0&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsxRuntimeExports.jsx(v.ProductBox,{editItem:()=>{1===(null==N?void 0:N.length)&&"variable"===N[0].name?(J((()=>se)),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=o.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.jsxRuntimeExports.jsx(a.Button,{disabled:(null!==(L=null==N?void 0:N.length)&&void 0!==L?L: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.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsxRuntimeExports.jsx(y.TitleRegular,{children:"Product(s)"}),e.jsxRuntimeExports.jsx(y.BodySecondary,{children:`Select ${null!=W?W:1} products`})]})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:_?16:12,marginRight:_?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{ee(!0)}}),V===g.POD.CHATBOT&&e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flex:1,alignItems:"center",justifyContent:"space-between",flexDirection:"row",width:"100%"}},{children:[e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginRight:8}}),e.jsxRuntimeExports.jsx(y.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsxRuntimeExports.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsxRuntimeExports.jsx(a.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:_?`2px dashed ${h.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:_?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsxRuntimeExports.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsxRuntimeExports.jsx(s.default,{width:18,height:18,color:h.COLORS.content.secondary})})),onClick:e=>{J((()=>se)),Q(!0)}})]})]})),_&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsxRuntimeExports.jsx(p.Badge,{padding:"8px",errorText:"Please add products"})}))]}),!F&&(null!=M?M:-1)>-1&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",background:h.COLORS.surface.hovered,alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx(d.IconButton,{Icon:n.default,disabled:ie,width:8,height:14,svgStyle:ie?{}:{color:h.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.jsxRuntimeExports.jsx(y.TitleRegular,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:h.COLORS.content.secondary},{children:`Card ${(null!=M?M:0)+1}/${W}`})),e.jsxRuntimeExports.jsx(d.IconButton,{Icon:i.default,width:8,height:14,disabled:ne,svgStyle:ne?{}:{color:h.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.jsxRuntimeExports.jsx(x.default,{whatsappSpecificPickerMeta:C,template:b,onTemplateChange:e=>{null==A||A(e)},showVariableModal:R,variableListForImage:E,discountCode:O,setDiscountCode:I}),Z&&D&&e.jsxRuntimeExports.jsx(u.ProductPickerModal,{zIndex:200,startupScreen:te?c.ScreenName.RearrangeProducts:c.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,s,r,a;le(!1);const d=[];delete e.isCustom;for(const t of Object.keys(e)){const o=e[t].products;if(void 0!==o&&Object.keys(o).length)for(const e of Object.keys(o)){const u=o[e].variants;if(void 0!==u&&Object.keys(u).length)for(const c of Object.keys(u)){const{name:p,image:m,quantity:x,displayOrder:v}=u[c],h={name:p,image:null!==(n=null!=m?m:null===(l=o[e])||void 0===l?void 0:l.image)&&void 0!==n?n:"",quantity:x,variantId:c,productId:e,displayOrder:v,collectionId:t,productName:null!==(s=null===(i=o[e])||void 0===i?void 0:i.name)&&void 0!==s?s:"",productImage:null!==(a=null===(r=o[e])||void 0===r?void 0:r.image)&&void 0!==a?a:""};d.push(h)}}}const u=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),c=d.map((e=>e.image)),p=o.cloneDeep(Object.assign({},b));p&&(c.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==$||$(u),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 +1 @@
|
|
|
1
|
-
import{j as e}from"../../node_modules/react/jsx-runtime.js";import s from"../../node_modules/lodash.debounce/index.js";import{useState as t,
|
|
1
|
+
import{j as e}from"../../node_modules/react/jsx-runtime.js";import s from"../../node_modules/lodash.debounce/index.js";import{useState as t,useEffect as o,useCallback as r}from"react";import{PageLoader as n}from"../bik-layout/PageLoader.js";import{CheckBox as c}from"../checkBox/CheckBox.js";import{Input as l}from"../input/Input.js";import{StyledModal as i}from"../modals/styledModal.js";import{StyledProductPickerContainer as d,StyledZeroState as a}from"./ProductPicker.styled.js";import{BodyPrimary as p,Caption as m,TitleSmall as u,BodySecondary as h}from"../TypographyStyle.js";import j from"../../utils/DateUtils.js";import{DEFAULT_THEME as g}from"../../constants/Theme.js";import x from"../../assets/icons/alert_triangle.svg.js";import v from"../../assets/icons/search.svg.js";const f="https://jkfenner.com/wp-content/uploads/2019/11/default.jpg",y=s=>{let{text:t,styleProps:o}=s;return e.jsxs(a,{children:[e.jsx("div",Object.assign({className:"icon__container",style:Object.assign({},o)},{children:e.jsx(x,{width:24,height:24,color:g.colorsV2.content.secondary})})),e.jsx(u,{children:"No results found"}),e.jsx(h,Object.assign({style:{color:g.colorsV2.content.secondary,textAlign:"center"}},{children:`Sorry we could not find any results for "${t}"`}))]})},P=i=>{var a,h,x,P;const b=i.instaPost?j.dateFormat(new Date(i.instaPost.timestamp),"•",!0):"",[_,w]=t(i.products),[O,C]=t(!1),[S,N]=t("");o((()=>{i.show&&(N(""),w(i.products),C(!1))}),[i.show]);const V=r(s((e=>{e?(w([]),i.onSearchKeyChange(e).then((e=>{w(e),C(!1)}))):(w(i.products),C(!1))}),700),[]);return e.jsxs(d,{children:[i.instaPost&&e.jsxs("div",Object.assign({className:"post__wrapper"},{children:[e.jsx("img",{alt:"Ig Media",onError:e=>{e.target.onerror=null,e.target.src=f},src:null===(a=i.instaPost)||void 0===a?void 0:a.media_url,className:"post__thumbnail"}),e.jsxs("div",Object.assign({className:"post__info-wrapper"},{children:[e.jsx(p,Object.assign({style:{textOverflow:"ellipsis",overflow:"hidden",whiteSpace:"nowrap",color:i.instaPost.caption?g.colorsV2.content.primary:g.colorsV2.content.secondary}},{children:(null===(h=i.instaPost)||void 0===h?void 0:h.caption)?null===(x=i.instaPost)||void 0===x?void 0:x.caption:"No caption"})),e.jsx(m,Object.assign({style:{color:g.colorsV2.content.placeholder}},{children:b}))]}))]})),e.jsx("div",Object.assign({style:{borderTop:i.instaPost?`1px solid ${g.colorsV2.stroke.primary}`:"none",borderBottom:`1px solid ${g.colorsV2.stroke.primary}`,padding:i.instaPost?"16px 24px":"0px 24px 16px 24px"}},{children:e.jsx(l,{value:S,placeholder:null!==(P=i.searchPlaceholder)&&void 0!==P?P:"Search products..",onChangeText:e=>{var s;N(e),(null===(s=e.trim())||void 0===s?void 0:s.length)>0?(C(!0),V(e)):(C(!1),w(i.products))},rightIcon:{icon:v}})})),e.jsxs("div",Object.assign({style:{maxHeight:350,overflowY:"scroll"}},{children:[O&&e.jsx("div",Object.assign({className:"loader__wrapper"},{children:e.jsx(n,{})})),0!==_.length||O?_.map((s=>{var t;const o=i.selectedProducts.find((e=>e.id===s.id));return e.jsxs("div",Object.assign({className:"product__wrapper"},{children:[e.jsxs("div",Object.assign({className:"product__info-wrapper"},{children:[e.jsx("img",{alt:"Product",onError:e=>{e.target.onerror=null,e.target.src=f},src:null!==(t=s.image)&&void 0!==t?t:f,className:"product__image"}),e.jsx(u,{children:s.name})]})),e.jsx("div",Object.assign({style:{order:1}},{children:e.jsx(c,{isChecked:void 0!==o,onValueChange:e=>{((e,s)=>{const t=i.selectedProducts.find((e=>e.id===s.id));if(e&&!t){const e=[...i.selectedProducts,s];i.setSelectedProducts(e)}else if(t){const e=[...i.selectedProducts];let t=-1;i.selectedProducts.forEach(((e,o)=>{e.id===s.id&&(t=o)})),e.splice(t,1),i.setSelectedProducts(e)}})(e,s)}})}))]}),s.id)})):e.jsx(y,{text:S})]}))]})},b=s=>{var r;const[n,c]=t([]);return o((()=>{var e;c(null!==(e=s.selectedProducts)&&void 0!==e?e:[])}),[null===(r=s.selectedProducts)||void 0===r?void 0:r.length]),e.jsx(i,Object.assign({open:s.show,onClose:()=>{s.onClose()},footerLeftCustomElement:n.length>10?e.jsx(m,Object.assign({style:{color:g.colorsV2.content.negative}},{children:"Can't add more than 10 products"})):e.jsx(m,Object.assign({style:{color:g.colorsV2.content.placeholder}},{children:n?`${n.length} selected`:""})),headingTitle:s.title,primaryButton:{disabled:n.length>10||0===n.length,buttonType:"primary",buttonText:"Select",size:"small",onClick:()=>{s.setSelectedProducts(n),s.onClose()}},secondaryButton:s.secondaryButtonProps,footerShadow:!0},{children:e.jsx(P,Object.assign({},s,{selectedProducts:n,setSelectedProducts:c}))}))};export{b as PricePleaseProductPicker,P as ProductPickerContent};
|
package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as e}from"../../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import l from"../../../assets/icons/arrow_back.svg.js";import o from"../../../assets/icons/chevronLeft.svg.js";import
|
|
1
|
+
import{j as e}from"../../../node_modules/react/jsx-runtime.js";import{ApplicationType as t}from"@bikdotai/bik-models/growth/models/bik-store";import l from"../../../assets/icons/arrow_back.svg.js";import o from"../../../assets/icons/chevronLeft.svg.js";import i from"../../../assets/icons/chevronRight.svg.js";import n from"../../../assets/icons/PlusIcon.js";import{cloneDeep as r}from"lodash";import{useState as s,useEffect as a}from"react";import{Button as d}from"../../button/Button.js";import{IconButton as c}from"../../icon-button/IconButton.js";import{ProductPickerModal as u}from"../../product-picker-v2/modal.js";import{ScreenName as p}from"../../product-picker-v2/type.js";import{Badge as m}from"../Badge/index.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import h from"./EditWhatsAppTemplateV2.js";import{ProductBox as g}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as j}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{POD as f}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{isRCSChannel as y}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as x,TitleRegular as b,BodySecondary as C,BodyCaption as I}from"../../TypographyStyle.js";const k=k=>{let{template:w,whatsappSpecificPickerMeta:O,showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}=k;var B,E,A,F,M,V,D,R;const{selectedCarouselIndex:W,setTemplate:$,pickerConf:q,isProductCarouselType:N,pod:_,cardCount:z,carouselProducts:G,setCarouselProducts:H,isError:K,cardImages:J,disableEditVariable:Q,onDeleteSelectedProducts:U,setSelectedCarouselIndex:X,setVariableCallback:Y,setShowVariablePicker:Z,sliderRef:ee}=v(),[te,le]=s(y(null==w?void 0:w.channel)?"Carousel Cards":-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(E=null===(B=null==w?void 0:w.mapping)||void 0===B?void 0:B.body)||void 0===E?void 0:E.length)?"(Step 2/2)":""):"Carousel Cards "+((null===(F=null===(A=null==w?void 0:w.mapping)||void 0===A?void 0:A.body)||void 0===F?void 0:F.length)?"(Step 2/2)":"")),[oe,ie]=s(!1),[ne,re]=s(!1),se=W===(null!=z?z:-1)-1,ae=(null!=W?W:-1)<1;a((()=>{var e,t,l,o;le(y(null==w?void 0:w.channel)?"Carousel Cards":-1==W?"First Message (Step 1/2)":N?"Product Carousel "+((null===(t=null===(e=null==w?void 0:w.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==w?void 0:w.mapping)||void 0===l?void 0:l.body)||void 0===o?void 0:o.length)?"(Step 2/2)":""))}),[W]);const de=e=>{null==H||H([{name:"variable",productName:e.actualValue}])};return a((()=>{-1===W&&y(null==w?void 0:w.channel)&&(null==X||X(0))}),[W,null==w?void 0:w.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:[!y(null==w?void 0:w.channel)&&null!=W&&W>=0&&!!(null===(V=null===(M=null==w?void 0:w.mapping)||void 0===M?void 0:M.body)||void 0===V?void 0:V.length)&&e.jsx(c,{Icon:l,onClick:()=>{null==X||X(-1)}}),e.jsx(x,Object.assign({style:{marginLeft:10}},{children:te}))]})),N&&(null!==(D=null==G?void 0:G.length)&&void 0!==D?D:0)>0&&null!=W&&W>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:8,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(g,{editItem:()=>{1===(null==G?void 0:G.length)&&"variable"===G[0].name?(Y((()=>de)),Z(!0)):ie(!oe)},cardBody:1===(null==G?void 0:G.length)&&"variable"===G[0].name?`${G[0].productName}`:`${null==G?void 0:G.length} Products Selected`,hideIcon:1===(null==G?void 0:G.length)&&"variable"===G[0].name,deleteItem:()=>{var e;if(1===(null==G?void 0:G.length)&&"variable"===G[0].name)return void(null==H||H([]));const t=r(Object.assign({},w));t&&(J&&J.length>0?null==J||J.forEach(((e,l)=>{var o;t.components[1].cards[l].components[0].example.header_handle=[null!==(o=J[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==$||$(t)),null==H||H([]),null==U||U()}}),G&&(null==G?void 0:G.length)>0&&"variable"!=G[0].name&&e.jsx(d,{disabled:(null!==(R=null==G?void 0:G.length)&&void 0!==R?R:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{re(!0),ie(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!Q&&N&&0===(null==G?void 0:G.length)&&null!=W&&W>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(b,{children:"Product(s)"}),e.jsx(C,{children:`Select ${null!=z?z:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:K?16:12,marginRight:K?16:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(d,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:K?`2px dashed ${j.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:e.jsx(n,{width:18,height:18,color:j.content.secondary})})),onClick:e=>{ie(!0)}}),_===f.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(I,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(d,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%",border:K?`2px dashed ${j.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:K?"tertiaryGray":"dashBold",LeadingIcon:()=>e.jsx("div",Object.assign({style:{display:"flex"}},{children:e.jsx(n,{width:18,height:18,color:j.content.secondary})})),onClick:e=>{Y((()=>de)),Z(!0)}})]})]})),K&&e.jsx("div",Object.assign({style:{marginLeft:10,marginBottom:16}},{children:e.jsx(m,{padding:"8px",errorText:"Please add products"})}))]}),!N&&(null!=W?W:-1)>-1&&e.jsxs("div",Object.assign({style:{display:"flex",background:j.surface.hovered,alignItems:"center"}},{children:[e.jsx(c,{Icon:o,disabled:ae,width:8,height:14,svgStyle:ae?{}:{color:j.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickPrev(),(null!=W?W:-1)<1||null==X||X((e=>e-1))}}),e.jsx(b,Object.assign({style:{flex:1,display:"flex",justifyContent:"center"},color:j.content.secondary},{children:`Card ${(null!=W?W:0)+1}/${z}`})),e.jsx(c,{Icon:i,width:8,height:14,disabled:se,svgStyle:se?{}:{color:j.content.secondary},onClick:()=>{var e;null===(e=null==ee?void 0:ee.current)||void 0===e||e.slickNext(),(null!=W?W:-1)>=(null!=z?z:-1)-1||null==X||X((e=>e+1))}})]})),e.jsx(h,{whatsappSpecificPickerMeta:O,template:w,onTemplateChange:e=>{null==$||$(e)},showVariableModal:P,variableListForImage:T,discountCode:S,setDiscountCode:L}),oe&&q&&e.jsx(u,{zIndex:200,startupScreen:ne?p.RearrangeProducts:p.Collections,rearrangeEnabled:!0,storeId:q.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!=G?G:[]),collectionFetcher:q.fetchCollections,productFetcher:q.fetchProducts,onAdd:(e,t)=>{var l,o,i,n,s,a;re(!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:m,quantity:v,displayOrder:h}=c[u],g={name:p,image:null!==(o=null!=m?m:null===(l=r[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=r[e])||void 0===i?void 0:i.name)&&void 0!==n?n:"",productImage:null!==(a=null===(s=r[e])||void 0===s?void 0:s.image)&&void 0!==a?a:""};d.push(g)}}}const c=d.sort(((e,t)=>e.displayOrder-t.displayOrder)),u=d.map((e=>e.image)),p=r(Object.assign({},w));p&&(u.forEach(((e,t)=>{var l;p.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(l=null==J?void 0:J[t])&&void 0!==l?l:""]})),null==$||$(p)),null==H||H(c),ie(!1)},searchInCollectionFetcher:q.searchInCollection,searchFetcher:q.searchProducts,visible:oe,onClose:()=>{ie(!1)},exactLimit:null!=z?z:1,appType:q.appType||t.BIK})]}))};export{k as default};
|