@bikdotai/bik-component-library 0.0.457-bata.3 → 0.0.457-beta0.1
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/SearchFilter/index.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/ProductBox.d.ts +1 -0
- package/dist/cjs/components/template-context-mapper/modalElements/ProductBox.js +2 -2
- package/dist/esm/components/SearchFilter/index.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/ProductBox.d.ts +1 -0
- package/dist/esm/components/template-context-mapper/modalElements/ProductBox.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react/jsx-runtime"),r=require("../searchBar/searchBar.js"),i=require("./components/FilterChipListRenderer.js"),l=require("./components/SearchFilterItem.js"),n=require("./types/SearchFilter.type.js");exports.SearchFilter=a=>{let{direction:s="row",schema:c,variant:d,onChange:u,showSelectedChips:p}=a;var o,f,v;const h=e.useRef(null!==(o=null==c?void 0:c.filter((e=>e.defaultValue)).map((e=>({id:e.id,value:e.defaultValue,type:e.type,text:e.text}))))&&void 0!==o?o:[]),[x,y]=e.useState([]),g=c.find((e=>e.type===n.FilterType.Search)),j=e=>{g&&e&&m(g.id,e)},m=(e,t)=>{const r=c.find((t=>t.id===e)),i=[...x];if(r){const l=i.findIndex((t=>t.id===e));-1!==l?i[l]={id:r.id,value:t}:i.push({id:r.id,value:t});const n=h.current.find((t=>t.id===e));h.current=n?h.current.map((r=>r.id===e?{id:r.id,value:t,type:r.type,text:r.text}:r)):[...h.current,{id:e,value:t,type:r.type,text:r.text}],u(r.id,h.current,t),y([...i])}};return t.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:8}},{children:[t.jsxs("div",Object.assign({style:{display:"flex",flexDirection:s,gap:8,flexWrap:"wrap",alignItems:"row"===s?"center":"self-start"}},{children:[g&&t.jsx(r.SearchBar,{width:null!==(v=null===(f=g.width)||void 0===f?void 0:f.toString())&&void 0!==v?v:"100%",isEnabled:!0,onChange:j,onEnter:j,placeholder:g.text,variant:"small"}),t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8,flexWrap:"wrap",alignItems:"row"===s?"center":"self-start"}},{children:c.filter((e=>e.type!==n.FilterType.Search)).map(((t,r)=>e.createElement(l.SearchFilterItem,Object.assign({},t,{key:r,variant:d,onChange:e=>{m(t.id,e)}}))))}))]})),p&&t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8}},{children:t.jsx(i.FilterChipListRenderer,{selectedState:h.current,onDeSelect:(e,t)=>{const r=c.find((t=>t.id===e));let i=[...x];r&&(r.type===n.FilterType.Multiple?(i=i.map((r=>{if(r.id===e){const e=r.value.filter((e=>e.value!==t.value));return e.length?Object.assign(Object.assign({},r),{value:e}):null}return r})).filter((e=>!!e)),h.current=h.current.map((r=>{var i;if(r.id===e){const e=null===(i=r.value)||void 0===i?void 0:i.filter((e=>e.value!==t.value));return e.length?Object.assign(Object.assign({},r),{value:e}):null}return r})).filter((e=>!!e))):(i=i.filter((t=>t.id!==e)),h.current=h.current.filter((t=>t.id!==e))),u(r.id,h.current,t),y([...i]))}})}))]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("react/jsx-runtime"),r=require("../searchBar/searchBar.js"),i=require("./components/FilterChipListRenderer.js"),l=require("./components/SearchFilterItem.js"),n=require("./types/SearchFilter.type.js");exports.SearchFilter=a=>{let{direction:s="row",schema:c,variant:d,onChange:u,showSelectedChips:p}=a;var o,f,v;const h=e.useRef(null!==(o=null==c?void 0:c.filter((e=>e.defaultValue)).map((e=>({id:e.id,value:e.defaultValue,type:e.type,text:e.text}))))&&void 0!==o?o:[]),[x,y]=e.useState([]),g=c.find((e=>e.type===n.FilterType.Search)),j=e=>{g&&"string"==typeof e&&m(g.id,e)},m=(e,t)=>{const r=c.find((t=>t.id===e)),i=[...x];if(r){const l=i.findIndex((t=>t.id===e));-1!==l?i[l]={id:r.id,value:t}:i.push({id:r.id,value:t});const n=h.current.find((t=>t.id===e));h.current=n?h.current.map((r=>r.id===e?{id:r.id,value:t,type:r.type,text:r.text}:r)):[...h.current,{id:e,value:t,type:r.type,text:r.text}],u(r.id,h.current,t),y([...i])}};return t.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:8}},{children:[t.jsxs("div",Object.assign({style:{display:"flex",flexDirection:s,gap:8,flexWrap:"wrap",alignItems:"row"===s?"center":"self-start"}},{children:[g&&t.jsx(r.SearchBar,{width:null!==(v=null===(f=g.width)||void 0===f?void 0:f.toString())&&void 0!==v?v:"100%",isEnabled:!0,onChange:j,onEnter:j,placeholder:g.text,variant:"small"}),t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8,flexWrap:"wrap",alignItems:"row"===s?"center":"self-start"}},{children:c.filter((e=>e.type!==n.FilterType.Search)).map(((t,r)=>e.createElement(l.SearchFilterItem,Object.assign({},t,{key:r,variant:d,onChange:e=>{m(t.id,e)}}))))}))]})),p&&t.jsx("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8}},{children:t.jsx(i.FilterChipListRenderer,{selectedState:h.current,onDeSelect:(e,t)=>{const r=c.find((t=>t.id===e));let i=[...x];r&&(r.type===n.FilterType.Multiple?(i=i.map((r=>{if(r.id===e){const e=r.value.filter((e=>e.value!==t.value));return e.length?Object.assign(Object.assign({},r),{value:e}):null}return r})).filter((e=>!!e)),h.current=h.current.map((r=>{var i;if(r.id===e){const e=null===(i=r.value)||void 0===i?void 0:i.filter((e=>e.value!==t.value));return e.length?Object.assign(Object.assign({},r),{value:e}):null}return r})).filter((e=>!!e))):(i=i.filter((t=>t.id!==e)),h.current=h.current.filter((t=>t.id!==e))),u(r.id,h.current,t),y([...i]))}})}))]}))};
|
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("react/jsx-runtime"),t=require("../../../assets/icons/PlusIcon.js"),r=require("lodash"),a=require("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/PlusIcon.js"),r=require("lodash"),a=require("react"),l=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js"),require("../../add-variableV2/AddVariableV2.styled.js");var i=require("../../button/Button.js");require("../../icon-button/IconButton.js"),require("../../input/Input.js"),require("../../tooltips/Tooltip.js");var s=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var o=require("../../TypographyStyle.js"),n=require("../../product-picker-v2/modal.js"),d=require("../context/templateModalContext.js"),c=require("./EditWhatsAppTemplateV2.js"),u=require("./ProductBox.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js"),require("../../curtain/CurtainHelper.js"),require("../../template-preview/models/TemplateMeta.js");var p=require("../../template-preview/models/WhatsAppTemplate.js");exports.default=m=>{let{template:h,whatsappSpecificPickerMeta:g,showVariableModal:v,variableList:j,variableListForImage:b,discountCode:x,setDiscountCode:y}=m;var f,C;const{selectedCarouselIndex:q,setTemplate:I,pickerConf:O,isProductCarouselType:w,pod:P,cardCount:T,carouselProducts:S,setCarouselProducts:k,isError:B,cardImages:V,disableEditVariable:L,onDeleteSelectedProducts:A}=d.useTemplateModalContext(),[M,E]=a.useState(-1==q?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)"),[F,D]=a.useState(!1),[R,W]=a.useState(!1),[_,z]=a.useState(!1);a.useEffect((()=>{E(-1==q?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)")}),[q]);return e.jsxs("div",{children:[e.jsx(o.TitleMedium,Object.assign({style:{marginLeft:10,marginBottom:10}},{children:M})),w&&(null!==(f=null==S?void 0:S.length)&&void 0!==f?f:0)>0&&null!=q&&q>=0&&e.jsxs("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[e.jsx(u.ProductBox,{editItem:()=>{1===(null==S?void 0:S.length)&&"variable"===S[0].name?z(!0):D(!F)},cardBody:1===(null==S?void 0:S.length)&&"variable"===S[0].name?`${S[0].productName}`:`${null==S?void 0:S.length} Products Selected`,hideIcon:1===(null==S?void 0:S.length)&&"variable"===S[0].name,deleteItem:()=>{if(1===(null==S?void 0:S.length)&&"variable"===S[0].name)return void(null==k||k([]));const e=r.cloneDeep(Object.assign({},h));e&&(null==V||V.forEach(((t,r)=>{var a;e.components[1].cards[r].components[0].example.header_handle=[null!==(a=V[r])&&void 0!==a?a:""]})),null==I||I(e)),null==k||k([]),null==A||A()}}),S&&(null==S?void 0:S.length)>0&&"variable"!=S[0].name&&e.jsx(i.Button,{disabled:(null!==(C=null==S?void 0:S.length)&&void 0!==C?C:0)<=1,style:{alignSelf:"flex-end",background:s.COLORS.surface.subdued},onClick:()=>{W(!0),D(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!L&&w&&0===(null==S?void 0:S.length)&&null!=q&&q>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(o.TitleRegular,{children:"Product(s)"}),e.jsx(o.BodySecondary,{children:`Select ${null!=T?T:1} products`})]})),e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(i.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:B?`2px dashed ${s.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:B?"tertiaryGray":"dashBold",LeadingIcon:t.default,onClick:e=>{D(!0)}}),P===p.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(o.BodyCaption,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),e.jsx("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),e.jsx(i.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%"},size:"medium",buttonText:"Add Product(s) Variable",buttonType:"dashBold",LeadingIcon:t.default,onClick:e=>{z(!0)}})]})]}))]}),e.jsx(c.default,{whatsappSpecificPickerMeta:g,template:h,onTemplateChange:e=>{null==I||I(e)},showVariableModal:v,variableList:j,variableListForImage:b,discountCode:x,setDiscountCode:y}),F&&O&&e.jsx(n.ProductPickerModal,{zIndex:200,rearrangeEnabled:R,storeId:O.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const r of e){const e=null==r?void 0:r.collectionId,a=r.productId,l=r.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),a in t[e].products||(t[e].products[a]={variants:{},name:(null==r?void 0:r.productName)||"",image:(null==r?void 0:r.productImage)||""}),t[e].products[a].variants[l]={name:(null==r?void 0:r.name)||"",price:"",image:(null==r?void 0:r.image)||"",quantity:r.quantity||0,displayOrder:r.displayOrder}}return t}return{}})(null!=S?S:[]),collectionFetcher:O.fetchCollections,productFetcher:O.fetchProducts,onAdd:(e,t)=>{W(!1);const a=[];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 l=r[e].variants;if(void 0!==l&&Object.keys(l).length)for(const i of Object.keys(l)){const{name:s,image:o,quantity:n,displayOrder:d}=l[i],c={name:s,image:o,quantity:n,variantId:i,productId:e,displayOrder:d,collectionId:t,productName:r[e].name,productImage:r[e].image};a.push(c)}}}const l=a.sort(((e,t)=>e.displayOrder-t.displayOrder)),i=a.map((e=>e.image)),s=r.cloneDeep(Object.assign({},h));s&&(i.forEach(((e,t)=>{var r;s.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(r=null==V?void 0:V[t])&&void 0!==r?r:""]})),null==I||I(s)),null==k||k(l),D(!1)},searchInCollectionFetcher:O.searchInCollection,searchFetcher:O.searchProducts,visible:F,onClose:()=>{D(!1)},exactLimit:null!=T?T:1}),_&&e.jsx(l.AddVariableV2SideModal,{zIndex:2e3,data:null!=j?j:[],showVariable:_,setShowVariable:z,placeholder:"Add a variable",customTrigger:e=>{null==k||k([{name:"variable",productName:e.actualValue}])}})]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/box.svg.js"),i=require("../../../assets/icons/delete.svg.js"),n=require("../../../assets/icons/edit.svg.js"),s=require("styled-components"),o=require("../../icon-button/IconButton.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/box.svg.js"),i=require("../../../assets/icons/delete.svg.js"),n=require("../../../assets/icons/edit.svg.js"),s=require("styled-components"),o=require("../../icon-button/IconButton.js"),l=require("../../TypographyStyle.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const c=r(s).default.div`
|
|
2
2
|
width: ${e=>e.width};
|
|
3
3
|
padding: 12px;
|
|
4
4
|
display: flex;
|
|
@@ -44,4 +44,4 @@
|
|
|
44
44
|
color: #000000;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`;exports.ProductBox=s=>{const{cardBody:
|
|
47
|
+
`;exports.ProductBox=s=>{const{cardBody:r,deleteItem:d,editItem:a,hideIcon:f}=s;return e.jsxs(c,Object.assign({width:"100%"},{children:[!f&&e.jsx("div",Object.assign({style:{width:36,height:36}},{children:e.jsx(t.default,{})})),e.jsx("div",Object.assign({className:"card-body"},{children:e.jsx(l.TitleSmall,{children:r})})),e.jsxs("div",Object.assign({style:{display:"flex",alignItems:"center"}},{children:[a&&e.jsx(o.IconButton,{style:{display:"flex"},Icon:n.default,onClick:e=>{a(),e.stopPropagation()}}),e.jsx(o.IconButton,{style:{display:"flex",color:"#919191"},Icon:i.default,onClick:e=>{d(),e.stopPropagation()}})]}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{useRef as e,useState as t,createElement as i}from"react";import{jsxs as r,jsx as l}from"react/jsx-runtime";import{SearchBar as n}from"../searchBar/searchBar.js";import{FilterChipListRenderer as a}from"./components/FilterChipListRenderer.js";import{SearchFilterItem as s}from"./components/SearchFilterItem.js";import{FilterType as d}from"./types/SearchFilter.type.js";const c=c=>{let{direction:o="row",schema:u,variant:p,onChange:f,showSelectedChips:v}=c;var m,h,g;const
|
|
1
|
+
import{useRef as e,useState as t,createElement as i}from"react";import{jsxs as r,jsx as l}from"react/jsx-runtime";import{SearchBar as n}from"../searchBar/searchBar.js";import{FilterChipListRenderer as a}from"./components/FilterChipListRenderer.js";import{SearchFilterItem as s}from"./components/SearchFilterItem.js";import{FilterType as d}from"./types/SearchFilter.type.js";const c=c=>{let{direction:o="row",schema:u,variant:p,onChange:f,showSelectedChips:v}=c;var m,h,g;const y=e(null!==(m=null==u?void 0:u.filter((e=>e.defaultValue)).map((e=>({id:e.id,value:e.defaultValue,type:e.type,text:e.text}))))&&void 0!==m?m:[]),[x,j]=t([]),b=u.find((e=>e.type===d.Search)),w=e=>{b&&"string"==typeof e&&O(b.id,e)},O=(e,t)=>{const i=u.find((t=>t.id===e)),r=[...x];if(i){const l=r.findIndex((t=>t.id===e));-1!==l?r[l]={id:i.id,value:t}:r.push({id:i.id,value:t});const n=y.current.find((t=>t.id===e));y.current=n?y.current.map((i=>i.id===e?{id:i.id,value:t,type:i.type,text:i.text}:i)):[...y.current,{id:e,value:t,type:i.type,text:i.text}],f(i.id,y.current,t),j([...r])}};return r("div",Object.assign({style:{display:"flex",flexDirection:"column",gap:8}},{children:[r("div",Object.assign({style:{display:"flex",flexDirection:o,gap:8,flexWrap:"wrap",alignItems:"row"===o?"center":"self-start"}},{children:[b&&l(n,{width:null!==(g=null===(h=b.width)||void 0===h?void 0:h.toString())&&void 0!==g?g:"100%",isEnabled:!0,onChange:w,onEnter:w,placeholder:b.text,variant:"small"}),l("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8,flexWrap:"wrap",alignItems:"row"===o?"center":"self-start"}},{children:u.filter((e=>e.type!==d.Search)).map(((e,t)=>i(s,Object.assign({},e,{key:t,variant:p,onChange:t=>{O(e.id,t)}}))))}))]})),v&&l("div",Object.assign({style:{display:"flex",flexDirection:"row",gap:8}},{children:l(a,{selectedState:y.current,onDeSelect:(e,t)=>{const i=u.find((t=>t.id===e));let r=[...x];i&&(i.type===d.Multiple?(r=r.map((i=>{if(i.id===e){const e=i.value.filter((e=>e.value!==t.value));return e.length?Object.assign(Object.assign({},i),{value:e}):null}return i})).filter((e=>!!e)),y.current=y.current.map((i=>{var r;if(i.id===e){const e=null===(r=i.value)||void 0===r?void 0:r.filter((e=>e.value!==t.value));return e.length?Object.assign(Object.assign({},i),{value:e}):null}return i})).filter((e=>!!e))):(r=r.filter((t=>t.id!==e)),y.current=y.current.filter((t=>t.id!==e))),f(i.id,y.current,t),j([...r]))}})}))]}))};export{c as SearchFilter};
|
package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../../assets/icons/PlusIcon.js";import{cloneDeep as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../../assets/icons/PlusIcon.js";import{cloneDeep as l}from"lodash";import{useState as a,useEffect as r}from"react";import{AddVariableV2SideModal as n}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import"../../add-variableV2/AddVariableV2.styled.js";import{Button as s}from"../../button/Button.js";import"../../icon-button/IconButton.js";import"../../input/Input.js";import"../../tooltips/Tooltip.js";import{COLORS as d}from"../../../constants/Theme.js";import"../../modals/modal.styled.js";import"../../switch/Switch.js";import{TitleMedium as c,TitleRegular as m,BodySecondary as p,BodyCaption as u}from"../../TypographyStyle.js";import{ProductPickerModal as h}from"../../product-picker-v2/modal.js";import{useTemplateModalContext as g}from"../context/templateModalContext.js";import v from"./EditWhatsAppTemplateV2.js";import{ProductBox as f}from"./ProductBox.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../curtain/CurtainHelper.js";import"../../template-preview/models/TemplateMeta.js";import{POD as b}from"../../template-preview/models/WhatsAppTemplate.js";const y=y=>{let{template:j,whatsappSpecificPickerMeta:C,showVariableModal:I,variableList:x,variableListForImage:w,discountCode:O,setDiscountCode:T}=y;var P,k;const{selectedCarouselIndex:S,setTemplate:V,pickerConf:L,isProductCarouselType:A,pod:E,cardCount:B,carouselProducts:M,setCarouselProducts:F,isError:W,cardImages:D,disableEditVariable:R,onDeleteSelectedProducts:q}=g(),[z,N]=a(-1==S?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)"),[$,_]=a(!1),[G,H]=a(!1),[J,K]=a(!1);r((()=>{N(-1==S?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)")}),[S]);return e("div",{children:[t(c,Object.assign({style:{marginLeft:10,marginBottom:10}},{children:z})),A&&(null!==(P=null==M?void 0:M.length)&&void 0!==P?P:0)>0&&null!=S&&S>=0&&e("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(f,{editItem:()=>{1===(null==M?void 0:M.length)&&"variable"===M[0].name?K(!0):_(!$)},cardBody:1===(null==M?void 0:M.length)&&"variable"===M[0].name?`${M[0].productName}`:`${null==M?void 0:M.length} Products Selected`,hideIcon:1===(null==M?void 0:M.length)&&"variable"===M[0].name,deleteItem:()=>{if(1===(null==M?void 0:M.length)&&"variable"===M[0].name)return void(null==F||F([]));const e=l(Object.assign({},j));e&&(null==D||D.forEach(((t,o)=>{var i;e.components[1].cards[o].components[0].example.header_handle=[null!==(i=D[o])&&void 0!==i?i:""]})),null==V||V(e)),null==F||F([]),null==q||q()}}),M&&(null==M?void 0:M.length)>0&&"variable"!=M[0].name&&t(s,{disabled:(null!==(k=null==M?void 0:M.length)&&void 0!==k?k:0)<=1,style:{alignSelf:"flex-end",background:d.surface.subdued},onClick:()=>{H(!0),_(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!R&&A&&0===(null==M?void 0:M.length)&&null!=S&&S>=0&&e(o,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(m,{children:"Product(s)"}),t(p,{children:`Select ${null!=B?B:1} products`})]})),e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(s,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:W?`2px dashed ${d.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:W?"tertiaryGray":"dashBold",LeadingIcon:i,onClick:e=>{_(!0)}}),E===b.CHATBOT&&e(o,{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(u,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(s,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%"},size:"medium",buttonText:"Add Product(s) Variable",buttonType:"dashBold",LeadingIcon:i,onClick:e=>{K(!0)}})]})]}))]}),t(v,{whatsappSpecificPickerMeta:C,template:j,onTemplateChange:e=>{null==V||V(e)},showVariableModal:I,variableList:x,variableListForImage:w,discountCode:O,setDiscountCode:T}),$&&L&&t(h,{zIndex:200,rearrangeEnabled:G,storeId:L.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const o of e){const e=null==o?void 0:o.collectionId,i=o.productId,l=o.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),i in t[e].products||(t[e].products[i]={variants:{},name:(null==o?void 0:o.productName)||"",image:(null==o?void 0:o.productImage)||""}),t[e].products[i].variants[l]={name:(null==o?void 0:o.name)||"",price:"",image:(null==o?void 0:o.image)||"",quantity:o.quantity||0,displayOrder:o.displayOrder}}return t}return{}})(null!=M?M:[]),collectionFetcher:L.fetchCollections,productFetcher:L.fetchProducts,onAdd:(e,t)=>{H(!1);const o=[];delete e.isCustom;for(const t of Object.keys(e)){const i=e[t].products;if(void 0!==i&&Object.keys(i).length)for(const e of Object.keys(i)){const l=i[e].variants;if(void 0!==l&&Object.keys(l).length)for(const a of Object.keys(l)){const{name:r,image:n,quantity:s,displayOrder:d}=l[a],c={name:r,image:n,quantity:s,variantId:a,productId:e,displayOrder:d,collectionId:t,productName:i[e].name,productImage:i[e].image};o.push(c)}}}const i=o.sort(((e,t)=>e.displayOrder-t.displayOrder)),a=o.map((e=>e.image)),r=l(Object.assign({},j));r&&(a.forEach(((e,t)=>{var o;r.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(o=null==D?void 0:D[t])&&void 0!==o?o:""]})),null==V||V(r)),null==F||F(i),_(!1)},searchInCollectionFetcher:L.searchInCollection,searchFetcher:L.searchProducts,visible:$,onClose:()=>{_(!1)},exactLimit:null!=B?B:1}),J&&t(n,{zIndex:2e3,data:null!=x?x:[],showVariable:J,setShowVariable:K,placeholder:"Add a variable",customTrigger:e=>{null==F||F([{name:"variable",productName:e.actualValue}])}})]})};export{y as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../../assets/icons/box.svg.js";import i from"../../../assets/icons/delete.svg.js";import n from"../../../assets/icons/edit.svg.js";import s from"styled-components";import{IconButton as r}from"../../icon-button/IconButton.js";import{
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../../assets/icons/box.svg.js";import i from"../../../assets/icons/delete.svg.js";import n from"../../../assets/icons/edit.svg.js";import s from"styled-components";import{IconButton as r}from"../../icon-button/IconButton.js";import{TitleSmall as l}from"../../TypographyStyle.js";const c=s.div`
|
|
2
2
|
width: ${t=>t.width};
|
|
3
3
|
padding: 12px;
|
|
4
4
|
display: flex;
|
|
@@ -44,4 +44,4 @@ import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../../assets/
|
|
|
44
44
|
color: #000000;
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
|
-
`,d=s=>{const{cardBody:d,deleteItem:f,editItem:a}=s;return t(c,Object.assign({width:"100%"},{children:[e("div",Object.assign({style:{width:36,height:36}},{children:e(o,{})})),e("div",Object.assign({className:"card-body"},{children:e(l,{children:d})})),t("div",Object.assign({style:{display:"flex",alignItems:"center"}},{children:[a&&e(r,{style:{display:"flex"},Icon:n,onClick:t=>{a(),t.stopPropagation()}}),e(r,{style:{display:"flex",color:"#919191"},Icon:i,onClick:t=>{f(),t.stopPropagation()}})]}))]}))};export{d as ProductBox};
|
|
47
|
+
`,d=s=>{const{cardBody:d,deleteItem:f,editItem:a,hideIcon:p}=s;return t(c,Object.assign({width:"100%"},{children:[!p&&e("div",Object.assign({style:{width:36,height:36}},{children:e(o,{})})),e("div",Object.assign({className:"card-body"},{children:e(l,{children:d})})),t("div",Object.assign({style:{display:"flex",alignItems:"center"}},{children:[a&&e(r,{style:{display:"flex"},Icon:n,onClick:t=>{a(),t.stopPropagation()}}),e(r,{style:{display:"flex",color:"#919191"},Icon:i,onClick:t=>{f(),t.stopPropagation()}})]}))]}))};export{d as ProductBox};
|