@bikdotai/bik-component-library 0.0.466-beta.1 → 0.0.466-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 +1 -0
- package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +1 -0
- package/dist/esm/components/shimmer-image/ShimmerImage.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("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),r=require("../shimmer/ShimmerComponent/BikShimmer.js");const i="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=i,exports.ShimmerImage=s=>{let{imageUrl:o,width:a,height:l,borderRadius:d,alt:c,defaultImageUrl:n=i}=s;const[m,u]=t.useState(!0),[h,b]=t.useState(!1);return t.useEffect((()=>{const e=new Image;return e.src=o,e.onload=()=>{b(!1),u(!1)},e.onerror=()=>{b(!0),u(!1)},()=>{e.onload=null,e.onerror=null}}),[o]),e.jsxs("div",Object.assign({style:{position:"relative",width:a,height:l,borderRadius:d}},{children:[m&&e.jsx(r.BikShimmer,{boxes:[{height:`${l}px`,width:`${a}px`,marginTop:"0px"}]}),h?e.jsx("img",{src:n,alt:null!=c?c:"Image",style:{borderRadius:null!=d?d:0,display:"block",width:"100%",height:"100%",objectFit:"cover"}}):e.jsx("img",{src:o,alt:null!=c?c:"Image",style:{borderRadius:null!=d?d:0,display:m?"none":"block",width:"100%",height:"100%",objectFit:"cover"}})]}))};
|
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 n=require("../../../constants/Theme.js");require("../../modals/modal.styled.js"),require("../../switch/Switch.js");var s=require("../../TypographyStyle.js"),o=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:x,discountCode:y,setDiscountCode:b}=m;var f,C;const{selectedCarouselIndex:O,setTemplate:q,pickerConf:I,isProductCarouselType:w,pod:P,cardCount:S,carouselProducts:T,setCarouselProducts:L,isError:k,cardImages:B,disableEditVariable:V,onDeleteSelectedProducts:A}=d.useTemplateModalContext(),[E,M]=a.useState(-1==O?"First Message (Step 1/2)":"Product Carousel (Step 2/2)"),[R,F]=a.useState(!1),[D,W]=a.useState(!1),[_,N]=a.useState(!1);a.useEffect((()=>{M(-1==O?"First Message (Step 1/2)":"Product Carousel (Step 2/2)")}),[O]);return e.jsxs("div",{children:[e.jsx(s.TitleMedium,Object.assign({style:{marginLeft:10,marginBottom:24}},{children:E})),w&&(null!==(f=null==T?void 0:T.length)&&void 0!==f?f:0)>0&&null!=O&&O>=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==T?void 0:T.length)&&"variable"===T[0].name?N(!0):F(!R)},cardBody:1===(null==T?void 0:T.length)&&"variable"===T[0].name?`${T[0].productName}`:`${null==T?void 0:T.length} Products Selected`,hideIcon:1===(null==T?void 0:T.length)&&"variable"===T[0].name,deleteItem:()=>{var e;if(1===(null==T?void 0:T.length)&&"variable"===T[0].name)return void(null==L||L([]));const t=r.cloneDeep(Object.assign({},h));t&&(B&&B.length>0?null==B||B.forEach(((e,r)=>{var a;t.components[1].cards[r].components[0].example.header_handle=[null!==(a=B[r])&&void 0!==a?a:""]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,r)=>{t.components[1].cards[r].components[0].example.header_handle=[""]})),null==q||q(t)),null==L||L([]),null==A||A()}}),T&&(null==T?void 0:T.length)>0&&"variable"!=T[0].name&&e.jsx(i.Button,{disabled:(null!==(C=null==T?void 0:T.length)&&void 0!==C?C:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{W(!0),F(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!V&&w&&0===(null==T?void 0:T.length)&&null!=O&&O>=0&&e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{marginLeft:12}},{children:[e.jsx(s.TitleRegular,{children:"Product(s)"}),e.jsx(s.BodySecondary,{children:`Select ${null!=S?S: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:k?`2px dashed ${n.COLORS.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(t.default,{width:18,height:18,color:n.COLORS.content.secondary})})),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(s.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%",border:k?`2px dashed ${n.COLORS.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(t.default,{width:18,height:18,color:n.COLORS.content.secondary})})),onClick:e=>{N(!0)}})]})]}))]}),e.jsx(c.default,{whatsappSpecificPickerMeta:g,template:h,onTemplateChange:e=>{null==q||q(e)},showVariableModal:v,variableList:j,variableListForImage:x,discountCode:y,setDiscountCode:b}),R&&I&&e.jsx(o.ProductPickerModal,{zIndex:200,startupScreen:D?o.ScreenName.RearrangeProducts:o.ScreenName.Collections,rearrangeEnabled:!0,storeId:I.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!=T?T:[]),collectionFetcher:I.fetchCollections,productFetcher:I.fetchProducts,onAdd:(e,t)=>{var a;W(!1);const l=[];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 n of Object.keys(i)){const{name:s,image:o,quantity:d,displayOrder:c}=i[n],u={name:s,image:null!==(a=null!=o?o:r[e].image)&&void 0!==a?a:"",quantity:d,variantId:n,productId:e,displayOrder:c,collectionId:t,productName:r[e].name,productImage:r[e].image};l.push(u)}}}const i=l.sort(((e,t)=>e.displayOrder-t.displayOrder)),n=l.map((e=>e.image)),s=r.cloneDeep(Object.assign({},h));s&&(n.forEach(((e,t)=>{var r;s.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(r=null==B?void 0:B[t])&&void 0!==r?r:""]})),null==q||q(s)),null==L||L(i),F(!1)},searchInCollectionFetcher:I.searchInCollection,searchFetcher:I.searchProducts,visible:R,onClose:()=>{F(!1)},exactLimit:null!=S?S:1}),_&&e.jsx(l.AddVariableV2SideModal,{zIndex:2e3,data:null!=j?j:[],showVariable:_,setShowVariable:N,placeholder:"Add a variable",customTrigger:e=>{null==L||L([{name:"variable",productName:e.actualValue}])}})]})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect as r}from"react";import{BikShimmer as i}from"../shimmer/ShimmerComponent/BikShimmer.js";const a="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c",l=l=>{let{imageUrl:s,width:d,height:n,borderRadius:m,alt:c,defaultImageUrl:h=a}=l;const[b,g]=o(!0),[p,u]=o(!1);return r((()=>{const e=new Image;return e.src=s,e.onload=()=>{u(!1),g(!1)},e.onerror=()=>{u(!0),g(!1)},()=>{e.onload=null,e.onerror=null}}),[s]),e("div",Object.assign({style:{position:"relative",width:d,height:n,borderRadius:m}},{children:[b&&t(i,{boxes:[{height:`${n}px`,width:`${d}px`,marginTop:"0px"}]}),t("img",p?{src:h,alt:null!=c?c:"Image",style:{borderRadius:null!=m?m:0,display:"block",width:"100%",height:"100%",objectFit:"cover"}}:{src:s,alt:null!=c?c:"Image",style:{borderRadius:null!=m?m:0,display:b?"none":"block",width:"100%",height:"100%",objectFit:"cover"}})]}))};export{a as DEFAULT_IMAGE,l as ShimmerImage};
|
package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment 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,ScreenName as g}from"../../product-picker-v2/modal.js";import{useTemplateModalContext as v}from"../context/templateModalContext.js";import f from"./EditWhatsAppTemplateV2.js";import{ProductBox as b}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 y}from"../../template-preview/models/WhatsAppTemplate.js";const j=j=>{let{template:x,whatsappSpecificPickerMeta:I,showVariableModal:w,variableList:C,variableListForImage:O,discountCode:P,setDiscountCode:T}=j;var k,S;const{selectedCarouselIndex:V,setTemplate:L,pickerConf:A,isProductCarouselType:E,pod:B,cardCount:M,carouselProducts:F,setCarouselProducts:W,isError:D,cardImages:R,disableEditVariable:$,onDeleteSelectedProducts:_}=v(),[q,z]=a(-1==V?"First Message (Step 1/2)":"Product Carousel (Step 2/2)"),[N,G]=a(!1),[H,J]=a(!1),[K,Q]=a(!1);r((()=>{z(-1==V?"First Message (Step 1/2)":"Product Carousel (Step 2/2)")}),[V]);return e("div",{children:[t(c,Object.assign({style:{marginLeft:10,marginBottom:24}},{children:q})),E&&(null!==(k=null==F?void 0:F.length)&&void 0!==k?k:0)>0&&null!=V&&V>=0&&e("div",Object.assign({style:{display:"flex",rowGap:16,marginBottom:16,marginLeft:10,marginRight:10,flexDirection:"column"}},{children:[t(b,{editItem:()=>{1===(null==F?void 0:F.length)&&"variable"===F[0].name?Q(!0):G(!N)},cardBody:1===(null==F?void 0:F.length)&&"variable"===F[0].name?`${F[0].productName}`:`${null==F?void 0:F.length} Products Selected`,hideIcon:1===(null==F?void 0:F.length)&&"variable"===F[0].name,deleteItem:()=>{var e;if(1===(null==F?void 0:F.length)&&"variable"===F[0].name)return void(null==W||W([]));const t=l(Object.assign({},x));t&&(R&&R.length>0?null==R||R.forEach(((e,o)=>{var i;t.components[1].cards[o].components[0].example.header_handle=[null!==(i=R[o])&&void 0!==i?i:""]})):null===(e=null==t?void 0:t.components[1].cards)||void 0===e||e.forEach(((e,o)=>{t.components[1].cards[o].components[0].example.header_handle=[""]})),null==L||L(t)),null==W||W([]),null==_||_()}}),F&&(null==F?void 0:F.length)>0&&"variable"!=F[0].name&&t(s,{disabled:(null!==(S=null==F?void 0:F.length)&&void 0!==S?S:0)<=1,style:{alignSelf:"flex-end"},onClick:()=>{J(!0),G(!0)},buttonText:"Rearrange Products",buttonType:"tertiary"})]})),!$&&E&&0===(null==F?void 0:F.length)&&null!=V&&V>=0&&e(o,{children:[e("div",Object.assign({style:{marginLeft:12}},{children:[t(m,{children:"Product(s)"}),t(p,{children:`Select ${null!=M?M: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:D?`2px dashed ${d.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s)",buttonType:D?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex",width:18,height:18}},{children:t(i,{width:18,height:18,color:d.content.secondary})})),onClick:e=>{G(!0)}}),B===y.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%",border:D?`2px dashed ${d.content.negative}`:void 0},size:"medium",buttonText:"Add Product(s) Variable",buttonType:D?"tertiaryGray":"dashBold",LeadingIcon:()=>t("div",Object.assign({style:{display:"flex"}},{children:t(i,{width:18,height:18,color:d.content.secondary})})),onClick:e=>{Q(!0)}})]})]}))]}),t(f,{whatsappSpecificPickerMeta:I,template:x,onTemplateChange:e=>{null==L||L(e)},showVariableModal:w,variableList:C,variableListForImage:O,discountCode:P,setDiscountCode:T}),N&&A&&t(h,{zIndex:200,startupScreen:H?g.RearrangeProducts:g.Collections,rearrangeEnabled:!0,storeId:A.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!=F?F:[]),collectionFetcher:A.fetchCollections,productFetcher:A.fetchProducts,onAdd:(e,t)=>{var o;J(!1);const i=[];delete e.isCustom;for(const t of Object.keys(e)){const l=e[t].products;if(void 0!==l&&Object.keys(l).length)for(const e of Object.keys(l)){const a=l[e].variants;if(void 0!==a&&Object.keys(a).length)for(const r of Object.keys(a)){const{name:n,image:s,quantity:d,displayOrder:c}=a[r],m={name:n,image:null!==(o=null!=s?s:l[e].image)&&void 0!==o?o:"",quantity:d,variantId:r,productId:e,displayOrder:c,collectionId:t,productName:l[e].name,productImage:l[e].image};i.push(m)}}}const a=i.sort(((e,t)=>e.displayOrder-t.displayOrder)),r=i.map((e=>e.image)),n=l(Object.assign({},x));n&&(r.forEach(((e,t)=>{var o;n.components[1].cards[t].components[0].example.header_handle=e?[e]:[null!==(o=null==R?void 0:R[t])&&void 0!==o?o:""]})),null==L||L(n)),null==W||W(a),G(!1)},searchInCollectionFetcher:A.searchInCollection,searchFetcher:A.searchProducts,visible:N,onClose:()=>{G(!1)},exactLimit:null!=M?M:1}),K&&t(n,{zIndex:2e3,data:null!=C?C:[],showVariable:K,setShowVariable:Q,placeholder:"Add a variable",customTrigger:e=>{null==W||W([{name:"variable",productName:e.actualValue}])}})]})};export{j as default};
|