@bikdotai/bik-component-library 0.0.732-beta.0 → 0.0.732-beta.2
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/dropdown/OpenedDropdown/components/OpennedDropdown.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/dropdown/OpenedDropdown/components/OpennedDropdown.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("react"),n=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),o=require("../../hooks/useDropdown.js"),r=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,x=290;exports.OpenedDropdown=j=>{let{options:f,isSearchable:S,isMultiSelect:b,maxSelections:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../node_modules/react/jsx-runtime.js"),t=require("react"),n=require("../../../zeroState/ZeroState.js"),s=require("../../../../hooks/useOutside.js"),o=require("../../hooks/useDropdown.js"),r=require("./description/Description.js"),i=require("./menu/FreeFormMenu.js"),l=require("./menu/MenuList.js"),u=require("./menu/SelectAllMenu.js"),c=require("./multiSelect/MultiSelectDropdownBottomBar.js"),a=require("./OpennedDropdown.styled.js"),d=require("./searchbox/SearchBox.js"),p=require("./searchbox/SearchZeroState.js");const h=304,x=290;exports.OpenedDropdown=j=>{let{options:f,isSearchable:S,isMultiSelect:b,maxSelections:g,width:m,allowFreeForm:v,height:O,onClose:w,onSelect:y,onSearch:E,version:D,skipSorting:C,headerRef:R,hideSelectAll:q,primaryButtonText:M,onInfiniteScroll:k,onMultiSelectClear:L,onDropdownItemClick:A,buttonOptions:I,isSearchLoading:F,disableSearchOptions:T,disableSearchedOptionExcept:B,useDefaultCursor:H,containerStyle:Z={},zeroState:_}=j;const{dropdownOptions:z,search:P,searchedString:V,searchedOptions:W,onApplyHandler:$,selectAllHandler:K,onMultiSelectClear:N,onFreeFormSelect:U,onMultiSelectApply:G,latestDropdownOptionsRef:J,getSelectedOptions:Q,getCurrentSelectionCount:X}=o.useDropdown(D,f,y,C,b,E,T,B,g),[Y,ee]=t.useState(null!=m?m:x),[te,ne]=t.useState(null),[se,oe]=t.useState(-1),re=t.useRef(null),ie=t.useRef([]),le=t.useRef(null);s.useOutside(re,(()=>{if(ne(null),b&&"2.0"===D){const e=Q(J.current);null==w||w(e)}else null==w||w(z)}),[R,ie]),t.useEffect((()=>{re.current&&re.current.focus()}),[]);t.useEffect((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const n=e;n.disabled||t.push(n)}})),t})(V&&E?W:z);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),oe((e=>{const n=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("ArrowUp"===e.key)e.preventDefault(),oe((e=>{const n=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=le.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${n}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),n}));else if("Enter"===e.key&&se>=0){e.preventDefault();const n=t[se];n&&($(Object.assign(Object.assign({},n),{selected:!n.selected})),A&&A(n))}},t=re.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[se,V,W,z,E,$,A]);const ue=null!=O?O:h,ce="number"==typeof ue?S&&b?ue-96:S&&!b||!S&&b?ue-48:ue:ue;t.useEffect((()=>{const e=null!=m?m:x;if(null===te)ee(e);else if("number"==typeof e)ee(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ee(t)}}),[te]);const ae=[],de=(e=>{if(!b||!g&&0!==g)return e;const t=X(e)>=g;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const n=e;return Object.assign(Object.assign({},n),{disabled:n.disabled||!n.selected&&t})}})):e})((V&&E?W:z).map((e=>{var t,n;if(V&&!E){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(V.toLowerCase()))&&(ae.push(!V||e.label===V),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(V.toLowerCase()))||(null===(n=e.searchKey)||void 0===n?void 0:n.toLowerCase().includes(V.toLowerCase()))?(ae.push(!V||e.label===V),e):null}return e})).filter((e=>null!==e))),pe=!!S&&V&&0===de.length;return e.jsxRuntimeExports.jsxs(a.OpennedDropdownContainer,Object.assign({version:D,ref:re,tabIndex:-1,style:Object.assign(Object.assign({width:Y},Z),{outline:"none"})},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{width:te?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!S&&e.jsxRuntimeExports.jsx(d.SearchBox,{onSearch:P,version:D}),de.length||V?e.jsxRuntimeExports.jsxs(a.MenuListContainer,Object.assign({minHeight:ue,maxHeight:ce,ref:le},{children:[!!b&&!pe&&!q&&e.jsxRuntimeExports.jsx(u.SelectAllMenu,{version:D,options:V&&E?W:z,onSelect:K}),!v&&pe&&e.jsxRuntimeExports.jsx(p.SearchZeroState,{isLoading:F,height:ce,searchedString:V,containerWidth:m}),v&&(pe||!!ae.length&&ae.every((e=>!1===e)))&&e.jsxRuntimeExports.jsx(i.FreeFormMenu,{version:D,isMultiSelect:b,onSelect:U,searchedString:V}),e.jsxRuntimeExports.jsx(l.MenuList,{onInfiniteScroll:k,onDropdownItemClick:A,version:D,onSelect:$,showDescription:function(e,t){ne(e&&t?{title:e,description:t}:null)},isMultiSelect:b,options:de,useDefaultCursor:H,ref:ie,focusedIndex:se})]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:{height:ue,display:"flex"}},{children:e.jsxRuntimeExports.jsx(n.ZeroState,Object.assign({},_,{title:(null==_?void 0:_.title)||"No results found",subTitle:(null==_?void 0:_.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!b&&!(!de.length&&!V)&&"2.0"!==D&&e.jsxRuntimeExports.jsx(c.default,{onClear:()=>{N(),null==L||L()},onApply:G,list:V&&E?W:z,buttonText:M,buttonOptions:I})]})),!!te&&e.jsxRuntimeExports.jsx(r.Description,{title:te.title,description:te.description,version:D})]}))};
|
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)":""))}),[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
|
+
"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",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 +1 @@
|
|
|
1
|
-
import{j as e}from"../../../../node_modules/react/jsx-runtime.js";import{useState as t,useRef as o,useEffect as n}from"react";import{ZeroState as s}from"../../../zeroState/ZeroState.js";import{useOutside as r}from"../../../../hooks/useOutside.js";import{useDropdown as i}from"../../hooks/useDropdown.js";import{Description as l}from"./description/Description.js";import{FreeFormMenu as c}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as p,MenuListContainer as h}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as m}from"./searchbox/SearchZeroState.js";const b=304,j=290,g=g=>{let{options:S,isSearchable:v,isMultiSelect:x,maxSelections:w,width:O,allowFreeForm:y,height:C,onClose:D,onSelect:k,onSearch:L,version:M,skipSorting:I,headerRef:A,hideSelectAll:
|
|
1
|
+
import{j as e}from"../../../../node_modules/react/jsx-runtime.js";import{useState as t,useRef as o,useEffect as n}from"react";import{ZeroState as s}from"../../../zeroState/ZeroState.js";import{useOutside as r}from"../../../../hooks/useOutside.js";import{useDropdown as i}from"../../hooks/useDropdown.js";import{Description as l}from"./description/Description.js";import{FreeFormMenu as c}from"./menu/FreeFormMenu.js";import{MenuList as a}from"./menu/MenuList.js";import{SelectAllMenu as u}from"./menu/SelectAllMenu.js";import d from"./multiSelect/MultiSelectDropdownBottomBar.js";import{OpennedDropdownContainer as p,MenuListContainer as h}from"./OpennedDropdown.styled.js";import{SearchBox as f}from"./searchbox/SearchBox.js";import{SearchZeroState as m}from"./searchbox/SearchZeroState.js";const b=304,j=290,g=g=>{let{options:S,isSearchable:v,isMultiSelect:x,maxSelections:w,width:O,allowFreeForm:y,height:C,onClose:D,onSelect:k,onSearch:L,version:M,skipSorting:I,headerRef:A,hideSelectAll:E,primaryButtonText:F,onInfiniteScroll:T,onMultiSelectClear:B,onDropdownItemClick:H,buttonOptions:q,isSearchLoading:z,disableSearchOptions:R,disableSearchedOptionExcept:V,useDefaultCursor:W,containerStyle:Z={},zeroState:$}=g;const{dropdownOptions:K,search:N,searchedString:P,searchedOptions:U,onApplyHandler:_,selectAllHandler:G,onMultiSelectClear:J,onFreeFormSelect:Q,onMultiSelectApply:X,latestDropdownOptionsRef:Y,getSelectedOptions:ee,getCurrentSelectionCount:te}=i(M,S,k,I,x,L,R,V,w),[oe,ne]=t(null!=O?O:j),[se,re]=t(null),[ie,le]=t(-1),ce=o(null),ae=o([]),ue=o(null);r(ce,(()=>{if(re(null),x&&"2.0"===M){const e=ee(Y.current);null==D||D(e)}else null==D||D(K)}),[A,ae]),n((()=>{ce.current&&ce.current.focus()}),[]);n((()=>{const e=e=>{const t=(e=>{const t=[];return e.forEach((e=>{if(e.options)e.options.forEach((e=>{e.disabled||t.push(e)}));else{const o=e;o.disabled||t.push(o)}})),t})(P&&L?U:K);if(0!==t.length)if("ArrowDown"===e.key)e.preventDefault(),le((e=>{const o=e<t.length-1?e+1:0;return setTimeout((()=>{var e;const t=null===(e=ue.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("ArrowUp"===e.key)e.preventDefault(),le((e=>{const o=e>0?e-1:t.length-1;return setTimeout((()=>{var e;const t=null===(e=ue.current)||void 0===e?void 0:e.querySelector(`[data-option-index="${o}"]`);t&&t.scrollIntoView({block:"nearest",behavior:"smooth"})}),0),o}));else if("Enter"===e.key&&ie>=0){e.preventDefault();const o=t[ie];o&&(_(Object.assign(Object.assign({},o),{selected:!o.selected})),H&&H(o))}},t=ce.current;if(t)return t.addEventListener("keydown",e),()=>{t.removeEventListener("keydown",e)}}),[ie,P,U,K,L,_,H]);const de=null!=C?C:b,pe="number"==typeof de?v&&x?de-96:v&&!x||!v&&x?de-48:de:de;n((()=>{const e=null!=O?O:j;if(null===se)ne(e);else if("number"==typeof e)ne(2*e);else if("string"==typeof e&&e.endsWith("px")){const t=2*parseInt(e.replace("px",""));ne(t)}}),[se]);const he=[],fe=(e=>{if(!x||!w&&0!==w)return e;const t=te(e)>=w;return t?e.map((e=>{if(e.options)return Object.assign(Object.assign({},e),{options:e.options.map((e=>Object.assign(Object.assign({},e),{disabled:e.disabled||!e.selected&&t})))});{const o=e;return Object.assign(Object.assign({},o),{disabled:o.disabled||!o.selected&&t})}})):e})((P&&L?U:K).map((e=>{var t,o;if(P&&!L){if(e.options){const t=Object.assign({},e);return t.options=t.options.filter((e=>{var t;return!!(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(P.toLowerCase()))&&(he.push(!P||e.label===P),!0)})),t.options.length>0?t:null}return(null===(t=e.label)||void 0===t?void 0:t.toLowerCase().includes(P.toLowerCase()))||(null===(o=e.searchKey)||void 0===o?void 0:o.toLowerCase().includes(P.toLowerCase()))?(he.push(!P||e.label===P),e):null}return e})).filter((e=>null!==e))),me=!!v&&P&&0===fe.length;return e.jsxs(p,Object.assign({version:M,ref:ce,tabIndex:-1,style:Object.assign(Object.assign({width:oe},Z),{outline:"none"})},{children:[e.jsxs("div",Object.assign({style:{width:se?"50%":"100%",display:"flex",flexDirection:"column",background:"white"}},{children:[!!v&&e.jsx(f,{onSearch:N,version:M}),fe.length||P?e.jsxs(h,Object.assign({minHeight:de,maxHeight:pe,ref:ue},{children:[!!x&&!me&&!E&&e.jsx(u,{version:M,options:P&&L?U:K,onSelect:G}),!y&&me&&e.jsx(m,{isLoading:z,height:pe,searchedString:P,containerWidth:O}),y&&(me||!!he.length&&he.every((e=>!1===e)))&&e.jsx(c,{version:M,isMultiSelect:x,onSelect:Q,searchedString:P}),e.jsx(a,{onInfiniteScroll:T,onDropdownItemClick:H,version:M,onSelect:_,showDescription:function(e,t){re(e&&t?{title:e,description:t}:null)},isMultiSelect:x,options:fe,useDefaultCursor:W,ref:ae,focusedIndex:ie})]})):e.jsx("div",Object.assign({style:{height:de,display:"flex"}},{children:e.jsx(s,Object.assign({},$,{title:(null==$?void 0:$.title)||"No results found",subTitle:(null==$?void 0:$.subTitle)||"Please try again later or contact us at support@bik.ai if you require further assistance."}))})),!!x&&!(!fe.length&&!P)&&"2.0"!==M&&e.jsx(d,{onClear:()=>{J(),null==B||B()},onApply:X,list:P&&L?U:K,buttonText:F,buttonOptions:q})]})),!!se&&e.jsx(l,{title:se.title,description:se.description,version:M})]}))};export{g as OpenedDropdown};
|
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 n from"../../../assets/icons/chevronRight.svg.js";import i 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 x}from"../../template-preview/helpers/templateMiscHelper.js";import{TitleMedium as y,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:B}=k;var E,L,A,F,M,V,D,W;const{selectedCarouselIndex:R,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(x(null==w?void 0:w.channel)?"Carousel Cards":-1==R?"First Message (Step 1/2)":N?"Product Carousel "+((null===(L=null===(E=null==w?void 0:w.mapping)||void 0===E?void 0:E.body)||void 0===L?void 0:L.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,ne]=s(!1),[ie,re]=s(!1),se=R===(null!=z?z:-1)-1,ae=(null!=R?R:-1)<1;a((()=>{var e,t,l,o;le(x(null==w?void 0:w.channel)?"Carousel Cards":-1==R?"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)":""))}),[R]);const de=e=>{null==H||H([{name:"variable",productName:e.actualValue}])};return a((()=>{-1===R&&x(null==w?void 0:w.channel)&&(null==X||X(0))}),[R,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:[!x(null==w?void 0:w.channel)&&null!=R&&R>=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(y,Object.assign({style:{marginLeft:10}},{children:te}))]})),N&&(null!==(D=null==G?void 0:G.length)&&void 0!==D?D:0)>0&&null!=R&&R>=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)):ne(!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!==(W=null==G?void 0:G.length)&&void 0!==W?W:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{re(!0),ne(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!Q&&N&&0===(null==G?void 0:G.length)&&null!=R&&R>=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(i,{width:18,height:18,color:j.content.secondary})})),onClick:e=>{ne(!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",flex:1}}),e.jsx(I,Object.assign({style:{color:"#616161",overflow:"unset",margin:"0 8px"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",flex:1}})]})),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(i,{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!=R?R:-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!=R?R:-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!=R?R:0)+1}/${z}`})),e.jsx(c,{Icon:n,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!=R?R:-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:B}),oe&&q&&e.jsx(u,{zIndex:200,startupScreen:ie?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,n=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[n]={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,n,i,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!==(i=null===(n=r[e])||void 0===n?void 0:n.name)&&void 0!==i?i:"",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),ne(!1)},searchInCollectionFetcher:q.searchInCollection,searchFetcher:q.searchProducts,visible:oe,onClose:()=>{ne(!1)},exactLimit:null!=z?z:1,appType:q.appType||t.BIK})]}))};export{k as default};
|