@bikdotai/bik-component-library 0.0.456-beta.1 → 0.0.456-beta.ppi-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.
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),s=require("../TypographyStyle.js"),d=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t);const c=t=>{var o;const r=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(s.TitleSmall,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(s.BodyCaption,{style:{display:"flex",flexDirection:"column"},dangerouslySetInnerHTML:{__html:null!==(o=t.productData.description)&&void 0!==o?o:""}}),e.jsx(d.ProductPickerTag,{isVariant:r,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},u=l.default.div`
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("styled-components"),o=require("../../constants/Theme.js"),r=require("../../assets/icons/cross.svg.js"),i=require("../icon-button/IconButton.js"),a=require("../shimmer-image/ShimmerImage.js"),s=require("../TypographyStyle.js"),d=require("./ProductPickerTag.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=n(t);const u=t=>{var o;const r=void 0===t.productData.variants;return e.jsxs(f,{children:[e.jsx(g,{children:e.jsx(a.ShimmerImage,{imageUrl:t.productData.image,width:"200px",height:200,borderRadius:4})}),e.jsxs(h,{children:[e.jsx(s.TitleSmall,Object.assign({style:{display:"flex"}},{children:t.productData.name})),e.jsx(s.BodyCaption,{style:{display:"flex",flexDirection:"column",maxHeight:"300px",overflow:"auto"},dangerouslySetInnerHTML:{__html:null!==(o=t.productData.description)&&void 0!==o?o:""}}),e.jsx(d.ProductPickerTag,{isVariant:r,data:t.productData,outOfStockAction:t.outOfStockAction})]})]})},c=l.default.div`
2
2
  display: flex;
3
3
  flex: 1;
4
4
  background: rgba(0, 0, 0, 0.5);
@@ -36,4 +36,4 @@
36
36
  flex: 1;
37
37
  flex-direction: column;
38
38
  gap: 10px;
39
- `;exports.ProductInfoCard=c,exports.ProductInfoOverlay=t=>e.jsxs(u,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(c,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
39
+ `;exports.ProductInfoCard=u,exports.ProductInfoOverlay=t=>e.jsxs(c,{children:[e.jsx(p,{}),e.jsx(x,{children:e.jsx(i.IconButton,{className:"close-button",onClick:t.onClose,Icon:r.default,width:20,height:20})}),e.jsx(u,{productData:t.productData,outOfStockAction:t.outOfStockAction})]});
@@ -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"),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
+ "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"),i=require("../../add-variableV2/AddVariableV2SideModal.js");require("../../../_virtual/_tslib.js"),require("../../add-variableV2/AddVariableV2.styled.js");var s=require("../../button/Button.js");require("../../icon-button/IconButton.js"),require("../../input/Input.js"),require("../../tooltips/Tooltip.js");var l=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:A,onDeleteSelectedProducts:L}=d.useTemplateModalContext(),[M,E]=a.useState(-1==q?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)"),[D,F]=a.useState(!1),[W,R]=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,flexDirection:"column"}},{children:[e.jsx(u.ProductBox,{editItem:()=>F(!D),cardBody:`${null==S?void 0:S.length} Products Selected`,deleteItem:()=>{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==L||L()}}),e.jsx(s.Button,{disabled:(null!==(C=null==S?void 0:S.length)&&void 0!==C?C:0)<=1,style:{alignSelf:"flex-end",background:l.COLORS.surface.subdued},onClick:()=>{R(!0),F(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!A&&w&&0===(null==S?void 0:S.length)&&null!=q&&q>=0&&e.jsxs("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[e.jsx(s.Button,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:B?`2px dashed ${l.COLORS.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:B?"tertiaryGray":"dashBold",LeadingIcon:t.default,onClick:e=>{F(!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(s.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}),D&&O&&e.jsx(n.ProductPickerModal,{zIndex:200,rearrangeEnabled:W,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,i=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[i]={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)=>{R(!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 i=r[e].variants;if(void 0!==i&&Object.keys(i).length)for(const s of Object.keys(i)){const{name:l,image:o,quantity:n,displayOrder:d}=i[s],c={name:l,image:o,quantity:n,variantId:s,productId:e,displayOrder:d,collectionId:t,productName:r[e].name,productImage:r[e].image};a.push(c)}}}const i=a.sort(((e,t)=>e.displayOrder-t.displayOrder)),s=a.map((e=>e.image)),l=r.cloneDeep(Object.assign({},h));l&&(s.forEach(((e,t)=>{var r;l.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(l)),null==k||k(i),F(!1)},searchInCollectionFetcher:O.searchInCollection,searchFetcher:O.searchProducts,visible:D,onClose:()=>{F(!1)},exactLimit:null!=T?T:1}),_&&e.jsx(i.AddVariableV2SideModal,{zIndex:2e3,data:null!=j?j:[],showVariable:_,setShowVariable:z,placeholder:"Add a variable",customTrigger:e=>{}})]})};
@@ -2,7 +2,6 @@ interface ProductBoxProps {
2
2
  cardBody: string;
3
3
  deleteItem: any;
4
4
  editItem?: any;
5
- hideIcon?: boolean;
6
5
  }
7
6
  export declare const ProductBox: (props: ProductBoxProps) => import("react/jsx-runtime").JSX.Element;
8
7
  export {};
@@ -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"),l=require("../../TypographyStyle.js");function r(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const c=r(s).default.div`
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"),r=require("../../TypographyStyle.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const c=l(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: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()}})]}))]}))};
47
+ `;exports.ProductBox=s=>{const{cardBody:l,deleteItem:d,editItem:a}=s;return e.jsxs(c,Object.assign({width:"100%"},{children:[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(r.TitleRegular,{children:l})})),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,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const Menus: ({
2
3
  displayName: string;
3
4
  key: number;
@@ -1,4 +1,4 @@
1
- import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as r}from"../../constants/Theme.js";import e from"../../assets/icons/cross.svg.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as d,BodyCaption as s}from"../TypographyStyle.js";import{ProductPickerTag as c}from"./ProductPickerTag.js";const l=i=>o(m,{children:[t(u,{}),t(x,{children:t(a,{className:"close-button",onClick:i.onClose,Icon:e,width:20,height:20})}),t(p,{productData:i.productData,outOfStockAction:i.outOfStockAction})]}),p=i=>{var r;const e=void 0===i.productData.variants;return o(f,{children:[t(g,{children:t(n,{imageUrl:i.productData.image,width:"200px",height:200,borderRadius:4})}),o(h,{children:[t(d,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(s,{style:{display:"flex",flexDirection:"column"},dangerouslySetInnerHTML:{__html:null!==(r=i.productData.description)&&void 0!==r?r:""}}),t(c,{isVariant:e,data:i.productData,outOfStockAction:i.outOfStockAction})]})]})},m=i.div`
1
+ import{jsxs as o,jsx as t}from"react/jsx-runtime";import i from"styled-components";import{COLORS as r}from"../../constants/Theme.js";import e from"../../assets/icons/cross.svg.js";import{IconButton as a}from"../icon-button/IconButton.js";import{ShimmerImage as n}from"../shimmer-image/ShimmerImage.js";import{TitleSmall as d,BodyCaption as s}from"../TypographyStyle.js";import{ProductPickerTag as c}from"./ProductPickerTag.js";const l=i=>o(m,{children:[t(u,{}),t(x,{children:t(a,{className:"close-button",onClick:i.onClose,Icon:e,width:20,height:20})}),t(p,{productData:i.productData,outOfStockAction:i.outOfStockAction})]}),p=i=>{var r;const e=void 0===i.productData.variants;return o(f,{children:[t(g,{children:t(n,{imageUrl:i.productData.image,width:"200px",height:200,borderRadius:4})}),o(h,{children:[t(d,Object.assign({style:{display:"flex"}},{children:i.productData.name})),t(s,{style:{display:"flex",flexDirection:"column",maxHeight:"300px",overflow:"auto"},dangerouslySetInnerHTML:{__html:null!==(r=i.productData.description)&&void 0!==r?r:""}}),t(c,{isVariant:e,data:i.productData,outOfStockAction:i.outOfStockAction})]})]})},m=i.div`
2
2
  display: flex;
3
3
  flex: 1;
4
4
  background: rgba(0, 0, 0, 0.5);
@@ -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 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
+ import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import i from"../../../assets/icons/PlusIcon.js";import{cloneDeep as r}from"lodash";import{useState as a,useEffect as l}from"react";import{AddVariableV2SideModal as s}from"../../add-variableV2/AddVariableV2SideModal.js";import"../../../_virtual/_tslib.js";import"../../add-variableV2/AddVariableV2.styled.js";import{Button as n}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,BodyCaption as m}from"../../TypographyStyle.js";import{ProductPickerModal as p}from"../../product-picker-v2/modal.js";import{useTemplateModalContext as u}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"../../curtain/CurtainHelper.js";import"../../template-preview/models/TemplateMeta.js";import{POD as f}from"../../template-preview/models/WhatsAppTemplate.js";const v=v=>{let{template:b,whatsappSpecificPickerMeta:y,showVariableModal:j,variableList:C,variableListForImage:I,discountCode:x,setDiscountCode:w}=v;var T,O;const{selectedCarouselIndex:P,setTemplate:k,pickerConf:S,isProductCarouselType:V,pod:A,cardCount:E,carouselProducts:L,setCarouselProducts:B,isError:M,cardImages:F,disableEditVariable:W,onDeleteSelectedProducts:D}=u(),[q,z]=a(-1==P?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)"),[R,_]=a(!1),[G,H]=a(!1),[N,$]=a(!1);l((()=>{z(-1==P?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)")}),[P]);return e("div",{children:[t(c,Object.assign({style:{marginLeft:10,marginBottom:10}},{children:q})),V&&(null!==(T=null==L?void 0:L.length)&&void 0!==T?T:0)>0&&null!=P&&P>=0&&e("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,flexDirection:"column"}},{children:[t(g,{editItem:()=>_(!R),cardBody:`${null==L?void 0:L.length} Products Selected`,deleteItem:()=>{const e=r(Object.assign({},b));e&&(null==F||F.forEach(((t,o)=>{var i;e.components[1].cards[o].components[0].example.header_handle=[null!==(i=F[o])&&void 0!==i?i:""]})),null==k||k(e)),null==B||B([]),null==D||D()}}),t(n,{disabled:(null!==(O=null==L?void 0:L.length)&&void 0!==O?O:0)<=1,style:{alignSelf:"flex-end",background:d.surface.subdued},onClick:()=>{H(!0),_(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!W&&V&&0===(null==L?void 0:L.length)&&null!=P&&P>=0&&e("div",Object.assign({style:{marginTop:16,marginBottom:16,marginLeft:12,marginRight:12,flexDirection:"column",display:"flex",alignItems:"center"}},{children:[t(n,{matchParentWidth:!0,style:{flex:1,display:"flex",width:"100%",marginBottom:12,border:M?`2px dashed ${d.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:M?"tertiaryGray":"dashBold",LeadingIcon:i,onClick:e=>{_(!0)}}),A===f.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(m,Object.assign({style:{color:"#616161",overflow:"unset"}},{children:"OR"})),t("div",{style:{width:"100%",height:1,backgroundColor:"#E0E0E0",marginLeft:8}})]})),t(n,{matchParentWidth:!0,style:{flex:1,display:"flex",marginTop:12,width:"100%"},size:"medium",buttonText:"Add Product(s) Variable",buttonType:"dashBold",LeadingIcon:i,onClick:e=>{$(!0)}})]})]})),t(h,{whatsappSpecificPickerMeta:y,template:b,onTemplateChange:e=>{null==k||k(e)},showVariableModal:j,variableList:C,variableListForImage:I,discountCode:x,setDiscountCode:w}),R&&S&&t(p,{zIndex:200,rearrangeEnabled:G,storeId:S.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,r=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[r]={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!=L?L:[]),collectionFetcher:S.fetchCollections,productFetcher:S.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 r=i[e].variants;if(void 0!==r&&Object.keys(r).length)for(const a of Object.keys(r)){const{name:l,image:s,quantity:n,displayOrder:d}=r[a],c={name:l,image:s,quantity:n,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)),l=r(Object.assign({},b));l&&(a.forEach(((e,t)=>{var o;l.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(o=null==F?void 0:F[t])&&void 0!==o?o:""]})),null==k||k(l)),null==B||B(i),_(!1)},searchInCollectionFetcher:S.searchInCollection,searchFetcher:S.searchProducts,visible:R,onClose:()=>{_(!1)},exactLimit:null!=E?E:1}),N&&t(s,{zIndex:2e3,data:null!=C?C:[],showVariable:N,setShowVariable:$,placeholder:"Add a variable",customTrigger:e=>{}})]})};export{v as default};
@@ -2,7 +2,6 @@ interface ProductBoxProps {
2
2
  cardBody: string;
3
3
  deleteItem: any;
4
4
  editItem?: any;
5
- hideIcon?: boolean;
6
5
  }
7
6
  export declare const ProductBox: (props: ProductBoxProps) => import("react/jsx-runtime").JSX.Element;
8
7
  export {};
@@ -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{TitleSmall as l}from"../../TypographyStyle.js";const c=s.div`
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{TitleRegular 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,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};
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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bikdotai/bik-component-library",
3
- "version": "0.0.456-beta.1",
3
+ "version": "0.0.456-beta.ppi-2",
4
4
  "description": "Bik Component Library",
5
5
  "repository": {
6
6
  "type": "git",