@bikdotai/bik-component-library 0.0.419-beta.10 → 0.0.419-beta.12
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/assets/icons/PlusIcon.d.ts +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/carousel-preview/CarouselPreview.js +14 -8
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +9 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +16 -0
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/dist/esm/assets/icons/PlusIcon.d.ts +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/carousel-preview/CarouselPreview.js +14 -8
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +9 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +16 -0
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js +1 -1
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronLeft.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronLeft.svg.js"),r=require("../../assets/icons/chevronRight.svg.js"),i=require("pure-react-carousel"),o=require("react"),n=require("styled-components"),s=require("./CarouselPreviewCard.js"),a=require("../../constants/Theme.js");function l(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=l(o),c=l(n);const u=c.default.div`
|
|
2
2
|
background-image: url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f');
|
|
3
|
-
border-color: ${
|
|
3
|
+
border-color: ${a.COLORS.stroke.primary};
|
|
4
4
|
border-top-style: solid;
|
|
5
5
|
border-bottom-style: solid;
|
|
6
6
|
border-top-width: 1px;
|
|
@@ -17,8 +17,8 @@
|
|
|
17
17
|
align-items: center;
|
|
18
18
|
.left_button {
|
|
19
19
|
border-radius: 50%;
|
|
20
|
-
width:
|
|
21
|
-
height:
|
|
20
|
+
width: 24px;
|
|
21
|
+
height: 24px;
|
|
22
22
|
align-items: center;
|
|
23
23
|
justify-content: center;
|
|
24
24
|
display: flex;
|
|
@@ -26,11 +26,14 @@
|
|
|
26
26
|
left: 0;
|
|
27
27
|
z-index: 10;
|
|
28
28
|
margin-left: 4px;
|
|
29
|
+
border: none;
|
|
30
|
+
background-color: white;
|
|
31
|
+
box-shadow: 0px 1.5px 6px 0px #0000001f;
|
|
29
32
|
}
|
|
30
33
|
.right_button {
|
|
31
34
|
border-radius: 50%;
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
35
|
+
width: 24px;
|
|
36
|
+
height: 24px;
|
|
34
37
|
align-items: center;
|
|
35
38
|
justify-content: center;
|
|
36
39
|
display: flex;
|
|
@@ -38,9 +41,12 @@
|
|
|
38
41
|
right: 0;
|
|
39
42
|
z-index: 10;
|
|
40
43
|
margin-right: 4px;
|
|
44
|
+
border: none;
|
|
45
|
+
background-color: white;
|
|
46
|
+
box-shadow: 0px 1.5px 6px 0px #0000001f;
|
|
41
47
|
}
|
|
42
48
|
.slider {
|
|
43
|
-
width:
|
|
49
|
+
width: 800px;
|
|
44
50
|
height: 480px;
|
|
45
51
|
}
|
|
46
|
-
`,h=d.default.forwardRef(((
|
|
52
|
+
`,h=d.default.forwardRef(((o,n)=>{let{channel:l,template:d,showSampleValues:c}=o;var h,b,x,g,v;return e.jsxs(u,{children:[e.jsx(s.default,{channel:l,template:d,isHeader:!0,carouselCardIndex:-1}),e.jsx(i.CarouselProvider,Object.assign({naturalSlideWidth:100,naturalSlideHeight:125,totalSlides:null!==(x=null===(b=null===(h=null==d?void 0:d.components)||void 0===h?void 0:h[1].cards)||void 0===b?void 0:b.length)&&void 0!==x?x:1,orientation:"horizontal",visibleSlides:1.6},{children:e.jsxs(p,{children:[e.jsx(i.ButtonBack,Object.assign({className:"left_button"},{children:e.jsx(t.default,{height:10,width:10,color:a.COLORS.content.primary})})),e.jsx(i.Slider,Object.assign({className:"slider"},{children:null===(v=null===(g=null==d?void 0:d.components)||void 0===g?void 0:g[1].cards)||void 0===v?void 0:v.map(((t,r)=>{var o,n;const a={components:t.components,mapping:null===(n=null===(o=null==d?void 0:d.mapping)||void 0===o?void 0:o.cards)||void 0===n?void 0:n[r]};return e.jsx(i.Slide,Object.assign({index:r},{children:e.jsx(s.default,{channel:l,template:a,isHeader:!1,carouselCardIndex:r},r)}),r)}))})),e.jsx(i.ButtonNext,Object.assign({className:"right_button"},{children:e.jsx(r.default,{height:10,width:10,color:a.COLORS.content.primary})}))]})}))]})}));exports.CarouselPreview=h;
|
|
@@ -31,5 +31,13 @@ export interface TemplateContextMapperProps {
|
|
|
31
31
|
disableEditVariable?: boolean;
|
|
32
32
|
pod?: POD;
|
|
33
33
|
extras?: ExtrasWhatsapp;
|
|
34
|
+
isProductCarouselTemplate?: boolean;
|
|
35
|
+
pickerConf?: {
|
|
36
|
+
searchInCollection: any;
|
|
37
|
+
searchProducts: any;
|
|
38
|
+
fetchCollections: any;
|
|
39
|
+
fetchProducts: any;
|
|
40
|
+
storeId: string;
|
|
41
|
+
};
|
|
34
42
|
}
|
|
35
|
-
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, isProductCarouselTemplate, pickerConf, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),o=require("../template-preview/models/Channels.js"),s=require("./context/templateModalContext.js"),i=require("./modalElements/Footer.js"),n=require("./modalElements/TemplateSelectModalContent.js"),r=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:c,closeDialog:u,showVariableMapping:p,channel:m,htmlContent:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),l=require("react"),t=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),o=require("../template-preview/models/Channels.js"),s=require("./context/templateModalContext.js"),i=require("./modalElements/Footer.js"),n=require("./modalElements/TemplateSelectModalContent.js"),r=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:c,closeDialog:u,showVariableMapping:p,channel:m,htmlContent:C,templateVariables:h,onTemplateSelect:v,globalPlaceholders:g,showOnlyContent:S,whatsappSpecificPickerMeta:b,zIndex:T,showVariableModal:E,variableList:x,discountCode:P,setDiscountCode:j,onBackPress:L,enabledCustomText:M,variableListForImage:A,showSampleValues:f,disableEditVariable:w,pod:y,extras:N,isProductCarouselTemplate:V,pickerConf:I}=d;var k,q,H,O,_,D;l.useEffect((()=>{z(C)}),[C]);const F=m===o.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(q=null===(k=c.components)||void 0===k?void 0:k[1])||void 0===q?void 0:q.type);console.log("isWhatsappCarousel: ",F),console.log("channel: ",m),console.log("is carousel: ","CAROUSEL"===(null===(O=null===(H=c.components)||void 0===H?void 0:H[1])||void 0===O?void 0:O.type)),console.log("selectedTemplate: ",c.components);const[W,Y]=l.useState(m===o.CHANNEL_TYPE.EMAIL||F?"desktop":"mobile"),[B,z]=l.useState(C),[U,R]=l.useState(!1),[$,G]=l.useState(c),[J,K]=l.useState(null!=h?h:[]),[Q,X]=l.useState(!1),[Z,ee]=l.useState(-1);const le=l.useMemo((()=>r.convertPlaceholdersToBikDropdown(g)),[g]);return e.jsx(s.TemplateModalContext.Provider,Object.assign({value:{template:$,setTemplate:G,device:W,setDevice:Y,display_content:B,setDisplayContent:z,originalVariableList:J,setOriginalVariableList:K,isError:U,setIsError:R,channel:m,globalNormalizedPlaceholders:le,templateSelectionTriggered:Q,setTemplateSelectionTriggered:X,enabledCustomText:M,disableEditVariable:w,pod:y,extras:N,isWhatsappCarousel:F,selectedCarouselIndex:Z,setSelectedCarouselIndex:ee,isProductCarouselTemplate:V,pickerConf:I}},{children:S?e.jsx(n.default,{channel:o.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:T,centralContainerStyles:{width:F?900:m===o.CHANNEL_TYPE.EMAIL&&p?1e3:800},open:!0,onClose:()=>{null==u||u()},headingTitle:null==$?void 0:$.label,headingSubtitle:m===o.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(_=null==$?void 0:$.category)&&void 0!==_?_:"")} • ${null!==(D=null==$?void 0:$.templateCategory)&&void 0!==D?D:""}`:"",onBackPress:()=>{null==L||L()}},{children:[e.jsx(n.default,{showSampleValues:f,showVariableMapping:p,channel:m,whatsappSpecificPickerMeta:b,showVariableModal:E,variableList:x,discountCode:P,setDiscountCode:j,variableListForImage:A&&(null==A?void 0:A.length)>0?A:x}),v?e.jsx(i.default,{isWhatsappCarousel:null!=F&&F,onSelect:function(){const e=null==v?void 0:v($,J,null!=B?B:"");e?R(!!e):X(!0)}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -29,6 +29,14 @@ export declare const TemplateModalContext: React.Context<{
|
|
|
29
29
|
isWhatsappCarousel?: boolean | undefined;
|
|
30
30
|
selectedCarouselIndex?: number | undefined;
|
|
31
31
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
32
|
+
isProductCarouselTemplate?: boolean | undefined;
|
|
33
|
+
pickerConf?: {
|
|
34
|
+
searchInCollection: any;
|
|
35
|
+
searchProducts: any;
|
|
36
|
+
fetchCollections: any;
|
|
37
|
+
fetchProducts: any;
|
|
38
|
+
storeId: string;
|
|
39
|
+
} | undefined;
|
|
32
40
|
}>;
|
|
33
41
|
export declare const useTemplateModalContext: () => {
|
|
34
42
|
device: DEVICE_TYPES;
|
|
@@ -53,4 +61,12 @@ export declare const useTemplateModalContext: () => {
|
|
|
53
61
|
isWhatsappCarousel?: boolean | undefined;
|
|
54
62
|
selectedCarouselIndex?: number | undefined;
|
|
55
63
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
64
|
+
isProductCarouselTemplate?: boolean | undefined;
|
|
65
|
+
pickerConf?: {
|
|
66
|
+
searchInCollection: any;
|
|
67
|
+
searchProducts: any;
|
|
68
|
+
fetchCollections: any;
|
|
69
|
+
fetchProducts: any;
|
|
70
|
+
storeId: string;
|
|
71
|
+
} | undefined;
|
|
56
72
|
};
|
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("react"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/PlusIcon.js"),s=require("react"),i=require("../../button/Button.js"),o=require("../../product-picker-v2/modal.js"),r=require("../context/templateModalContext.js"),a=require("./EditWhatsAppTemplateV2.js"),n=require("../../TypographyStyle.js");exports.default=l=>{let{template:d,whatsappSpecificPickerMeta:c,showVariableModal:u,variableList:p,variableListForImage:m,discountCode:h,setDiscountCode:g}=l;const{selectedCarouselIndex:f,setTemplate:y,pickerConf:x,isProductCarouselTemplate:j}=r.useTemplateModalContext(),[b,v]=s.useState(-1==f?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)"),[C,I]=s.useState(!1),[O,k]=s.useState([]);s.useEffect((()=>{v(-1==f?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)")}),[f]);return e.jsxs("div",{children:[e.jsx(n.TitleMedium,Object.assign({style:{marginLeft:10,marginBottom:10}},{children:b})),j&&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},size:"medium",buttonText:"Add Product(s)",buttonType:"dashBold",LeadingIcon:t.default,onClick:e=>{I(!0)}}),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(n.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=>{}})]})),e.jsx(a.default,{whatsappSpecificPickerMeta:c,template:d,onTemplateChange:e=>{null==y||y(e)},showVariableModal:u,variableList:p,variableListForImage:m,discountCode:h,setDiscountCode:g}),C&&x&&e.jsx(o.ProductPickerModal,{zIndex:200,limit:1,storeId:x.storeId,selectedItems:(e=>{if(e.length>0){const t={};for(const s of e){const e=null==s?void 0:s.collectionId,i=s.productId,o=s.variantId;e in t||(t[e]={products:{},name:"",image:"",isSmartCollection:!1}),i in t[e].products||(t[e].products[i]={variants:{},name:(null==s?void 0:s.productName)||"",image:(null==s?void 0:s.productImage)||""}),t[e].products[i].variants[o]={name:(null==s?void 0:s.name)||"",price:"",image:(null==s?void 0:s.image)||"",quantity:s.quantity||0,displayOrder:s.displayOrder}}return t}return{}})(O),collectionFetcher:x.fetchCollections,productFetcher:x.fetchProducts,onAdd:(e,t)=>{const s=[];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 o=i[e].variants;if(void 0!==o&&Object.keys(o).length)for(const r of Object.keys(o)){const{name:a,image:n,quantity:l,displayOrder:d}=o[r],c={name:a,image:n,quantity:l,variantId:r,productId:e,displayOrder:d,collectionId:t,productName:i[e].name,productImage:i[e].image};s.push(c)}}}const i=s.sort(((e,t)=>e.displayOrder-t.displayOrder));k(i)},searchInCollectionFetcher:x.searchInCollection,searchFetcher:x.searchProducts,visible:C,onClose:()=>{I(!1)}})]})};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{jsxs as e,jsx as
|
|
1
|
+
import{jsxs as e,jsx as o}from"react/jsx-runtime";import t from"../../assets/icons/chevronLeft.svg.js";import i from"../../assets/icons/chevronRight.svg.js";import{CarouselProvider as r,ButtonBack as n,Slider as a,Slide as s,ButtonNext as d}from"pure-react-carousel";import l from"react";import c from"styled-components";import p from"./CarouselPreviewCard.js";import{COLORS as h}from"../../constants/Theme.js";const m=c.div`
|
|
2
2
|
background-image: url('https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F341dba50-e84e-4457-b5b5-d9d8a0b95a73?alt=media&token=6fd32f23-8bb2-4980-bbee-bef39b38fd9f');
|
|
3
3
|
border-color: ${h.stroke.primary};
|
|
4
4
|
border-top-style: solid;
|
|
@@ -11,14 +11,14 @@ import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../assets/ico
|
|
|
11
11
|
position: relative;
|
|
12
12
|
height: 500px;
|
|
13
13
|
overflow-y: auto;
|
|
14
|
-
`,b=
|
|
14
|
+
`,b=c.div`
|
|
15
15
|
flex-direction: row;
|
|
16
16
|
display: flex;
|
|
17
17
|
align-items: center;
|
|
18
18
|
.left_button {
|
|
19
19
|
border-radius: 50%;
|
|
20
|
-
width:
|
|
21
|
-
height:
|
|
20
|
+
width: 24px;
|
|
21
|
+
height: 24px;
|
|
22
22
|
align-items: center;
|
|
23
23
|
justify-content: center;
|
|
24
24
|
display: flex;
|
|
@@ -26,11 +26,14 @@ import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../assets/ico
|
|
|
26
26
|
left: 0;
|
|
27
27
|
z-index: 10;
|
|
28
28
|
margin-left: 4px;
|
|
29
|
+
border: none;
|
|
30
|
+
background-color: white;
|
|
31
|
+
box-shadow: 0px 1.5px 6px 0px #0000001f;
|
|
29
32
|
}
|
|
30
33
|
.right_button {
|
|
31
34
|
border-radius: 50%;
|
|
32
|
-
width:
|
|
33
|
-
height:
|
|
35
|
+
width: 24px;
|
|
36
|
+
height: 24px;
|
|
34
37
|
align-items: center;
|
|
35
38
|
justify-content: center;
|
|
36
39
|
display: flex;
|
|
@@ -38,9 +41,12 @@ import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../assets/ico
|
|
|
38
41
|
right: 0;
|
|
39
42
|
z-index: 10;
|
|
40
43
|
margin-right: 4px;
|
|
44
|
+
border: none;
|
|
45
|
+
background-color: white;
|
|
46
|
+
box-shadow: 0px 1.5px 6px 0px #0000001f;
|
|
41
47
|
}
|
|
42
48
|
.slider {
|
|
43
|
-
width:
|
|
49
|
+
width: 800px;
|
|
44
50
|
height: 480px;
|
|
45
51
|
}
|
|
46
|
-
`,
|
|
52
|
+
`,u=l.forwardRef(((l,c)=>{let{channel:u,template:g,showSampleValues:x}=l;var f,v,w,y,j;return e(m,{children:[o(p,{channel:u,template:g,isHeader:!0,carouselCardIndex:-1}),o(r,Object.assign({naturalSlideWidth:100,naturalSlideHeight:125,totalSlides:null!==(w=null===(v=null===(f=null==g?void 0:g.components)||void 0===f?void 0:f[1].cards)||void 0===v?void 0:v.length)&&void 0!==w?w:1,orientation:"horizontal",visibleSlides:1.6},{children:e(b,{children:[o(n,Object.assign({className:"left_button"},{children:o(t,{height:10,width:10,color:h.content.primary})})),o(a,Object.assign({className:"slider"},{children:null===(j=null===(y=null==g?void 0:g.components)||void 0===y?void 0:y[1].cards)||void 0===j?void 0:j.map(((e,t)=>{var i,r;const n={components:e.components,mapping:null===(r=null===(i=null==g?void 0:g.mapping)||void 0===i?void 0:i.cards)||void 0===r?void 0:r[t]};return o(s,Object.assign({index:t},{children:o(p,{channel:u,template:n,isHeader:!1,carouselCardIndex:t},t)}),t)}))})),o(d,Object.assign({className:"right_button"},{children:o(i,{height:10,width:10,color:h.content.primary})}))]})}))]})}));export{u as CarouselPreview};
|
|
@@ -31,5 +31,13 @@ export interface TemplateContextMapperProps {
|
|
|
31
31
|
disableEditVariable?: boolean;
|
|
32
32
|
pod?: POD;
|
|
33
33
|
extras?: ExtrasWhatsapp;
|
|
34
|
+
isProductCarouselTemplate?: boolean;
|
|
35
|
+
pickerConf?: {
|
|
36
|
+
searchInCollection: any;
|
|
37
|
+
searchProducts: any;
|
|
38
|
+
fetchCollections: any;
|
|
39
|
+
fetchProducts: any;
|
|
40
|
+
storeId: string;
|
|
41
|
+
};
|
|
34
42
|
}
|
|
35
|
-
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
43
|
+
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, isProductCarouselTemplate, pickerConf, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as a,useMemo as i}from"react";import s from"../../utils/StringUtils.js";import{StyledModal as n}from"../modals/styledModal.js";import{CHANNEL_TYPE as r}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import p from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as m}from"./utils/convertPlaceholdersToBikDropdown.js";const u=u=>{let{selectedTemplate:h,closeDialog:g,showVariableMapping:v,channel:
|
|
1
|
+
import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as a,useMemo as i}from"react";import s from"../../utils/StringUtils.js";import{StyledModal as n}from"../modals/styledModal.js";import{CHANNEL_TYPE as r}from"../template-preview/models/Channels.js";import{TemplateModalContext as d}from"./context/templateModalContext.js";import c from"./modalElements/Footer.js";import p from"./modalElements/TemplateSelectModalContent.js";import{convertPlaceholdersToBikDropdown as m}from"./utils/convertPlaceholdersToBikDropdown.js";const u=u=>{let{selectedTemplate:h,closeDialog:g,showVariableMapping:v,channel:C,htmlContent:b,templateVariables:S,onTemplateSelect:T,globalPlaceholders:f,showOnlyContent:P,whatsappSpecificPickerMeta:w,zIndex:x,showVariableModal:L,variableList:M,discountCode:E,setDiscountCode:V,onBackPress:j,enabledCustomText:I,variableListForImage:y,showSampleValues:A,disableEditVariable:k,pod:O,extras:D,isProductCarouselTemplate:W,pickerConf:F}=u;var z,B,H,U,R,$;t((()=>{J(b)}),[b]);const N=C===r.WHATSAPP&&"CAROUSEL"===(null===(B=null===(z=h.components)||void 0===z?void 0:z[1])||void 0===B?void 0:B.type);console.log("isWhatsappCarousel: ",N),console.log("channel: ",C),console.log("is carousel: ","CAROUSEL"===(null===(U=null===(H=h.components)||void 0===H?void 0:H[1])||void 0===U?void 0:U.type)),console.log("selectedTemplate: ",h.components);const[_,q]=a(C===r.EMAIL||N?"desktop":"mobile"),[G,J]=a(b),[K,Q]=a(!1),[X,Y]=a(h),[Z,ee]=a(null!=S?S:[]),[le,oe]=a(!1),[te,ae]=a(-1);const ie=i((()=>m(f)),[f]);return e(d.Provider,Object.assign({value:{template:X,setTemplate:Y,device:_,setDevice:q,display_content:G,setDisplayContent:J,originalVariableList:Z,setOriginalVariableList:ee,isError:K,setIsError:Q,channel:C,globalNormalizedPlaceholders:ie,templateSelectionTriggered:le,setTemplateSelectionTriggered:oe,enabledCustomText:I,disableEditVariable:k,pod:O,extras:D,isWhatsappCarousel:N,selectedCarouselIndex:te,setSelectedCarouselIndex:ae,isProductCarouselTemplate:W,pickerConf:F}},{children:P?e(p,{channel:r.EMAIL,hideHeader:!0}):l(n,Object.assign({zIndex:x,centralContainerStyles:{width:N?900:C===r.EMAIL&&v?1e3:800},open:!0,onClose:()=>{null==g||g()},headingTitle:null==X?void 0:X.label,headingSubtitle:C===r.WHATSAPP?`${s.capitaliseFirstLetterOfString(null!==(R=null==X?void 0:X.category)&&void 0!==R?R:"")} • ${null!==($=null==X?void 0:X.templateCategory)&&void 0!==$?$:""}`:"",onBackPress:()=>{null==j||j()}},{children:[e(p,{showSampleValues:A,showVariableMapping:v,channel:C,whatsappSpecificPickerMeta:w,showVariableModal:L,variableList:M,discountCode:E,setDiscountCode:V,variableListForImage:y&&(null==y?void 0:y.length)>0?y:M}),T?e(c,{isWhatsappCarousel:null!=N&&N,onSelect:function(){const e=null==T?void 0:T(X,Z,null!=G?G:"");e?Q(!!e):oe(!0)}}):e(o,{})]}))}))};export{u as TemplateContextMapper};
|
|
@@ -29,6 +29,14 @@ export declare const TemplateModalContext: React.Context<{
|
|
|
29
29
|
isWhatsappCarousel?: boolean | undefined;
|
|
30
30
|
selectedCarouselIndex?: number | undefined;
|
|
31
31
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
32
|
+
isProductCarouselTemplate?: boolean | undefined;
|
|
33
|
+
pickerConf?: {
|
|
34
|
+
searchInCollection: any;
|
|
35
|
+
searchProducts: any;
|
|
36
|
+
fetchCollections: any;
|
|
37
|
+
fetchProducts: any;
|
|
38
|
+
storeId: string;
|
|
39
|
+
} | undefined;
|
|
32
40
|
}>;
|
|
33
41
|
export declare const useTemplateModalContext: () => {
|
|
34
42
|
device: DEVICE_TYPES;
|
|
@@ -53,4 +61,12 @@ export declare const useTemplateModalContext: () => {
|
|
|
53
61
|
isWhatsappCarousel?: boolean | undefined;
|
|
54
62
|
selectedCarouselIndex?: number | undefined;
|
|
55
63
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
64
|
+
isProductCarouselTemplate?: boolean | undefined;
|
|
65
|
+
pickerConf?: {
|
|
66
|
+
searchInCollection: any;
|
|
67
|
+
searchProducts: any;
|
|
68
|
+
fetchCollections: any;
|
|
69
|
+
fetchProducts: any;
|
|
70
|
+
storeId: string;
|
|
71
|
+
} | undefined;
|
|
56
72
|
};
|
package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppCarouselTemplateV2.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import o from"../../../assets/icons/PlusIcon.js";import{useState as i,useEffect as r}from"react";import{Button as s}from"../../button/Button.js";import{ProductPickerModal as a}from"../../product-picker-v2/modal.js";import{useTemplateModalContext as n}from"../context/templateModalContext.js";import l from"./EditWhatsAppTemplateV2.js";import{TitleMedium as d,BodyCaption as c}from"../../TypographyStyle.js";const m=m=>{let{template:p,whatsappSpecificPickerMeta:u,showVariableModal:h,variableList:g,variableListForImage:f,discountCode:y,setDiscountCode:b}=m;const{selectedCarouselIndex:v,setTemplate:C,pickerConf:I,isProductCarouselTemplate:j}=n(),[x,O]=i(-1==v?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)"),[k,w]=i(!1),[T,P]=i([]);r((()=>{O(-1==v?"First Message (Step 1/2)":"Carousel Cards (Step 2/2)")}),[v]);return e("div",{children:[t(d,Object.assign({style:{marginLeft:10,marginBottom:10}},{children:x})),j&&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},size:"medium",buttonText:"Add Product(s)",buttonType:"dashBold",LeadingIcon:o,onClick:e=>{w(!0)}}),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(c,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:o,onClick:e=>{}})]})),t(l,{whatsappSpecificPickerMeta:u,template:p,onTemplateChange:e=>{null==C||C(e)},showVariableModal:h,variableList:g,variableListForImage:f,discountCode:y,setDiscountCode:b}),k&&I&&t(a,{zIndex:200,limit:1,storeId:I.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{}})(T),collectionFetcher:I.fetchCollections,productFetcher:I.fetchProducts,onAdd:(e,t)=>{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 s of Object.keys(r)){const{name:a,image:n,quantity:l,displayOrder:d}=r[s],c={name:a,image:n,quantity:l,variantId:s,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));P(i)},searchInCollectionFetcher:I.searchInCollection,searchFetcher:I.searchProducts,visible:k,onClose:()=>{w(!1)}})]})};export{m as default};
|