@bikdotai/bik-component-library 0.0.433-beta.11 → 0.0.433-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/components/template-context-mapper/TemplateContextMapper.d.ts +4 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +4 -0
- package/dist/cjs/components/template-context-mapper/modalElements/Footer.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.d.ts +1 -0
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +5 -5
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +4 -1
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +4 -0
- package/dist/esm/components/template-context-mapper/modalElements/Footer.js +4 -4
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.d.ts +1 -0
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +11 -11
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
- package/package.json +1 -1
|
@@ -17,7 +17,10 @@ export interface TemplateContextMapperProps {
|
|
|
17
17
|
/** Only for initial-UI-purpose for the modal */
|
|
18
18
|
htmlContent: string;
|
|
19
19
|
showOnlyContent?: boolean;
|
|
20
|
-
onTemplateSelect?(template: EmailTemplateType | SMSTemplateType | WhatsAppTemplate | WhatsAppCarouselTemplate, variables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables, display_content?: string):
|
|
20
|
+
onTemplateSelect?(template: EmailTemplateType | SMSTemplateType | WhatsAppTemplate | WhatsAppCarouselTemplate, variables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables, display_content?: string): {
|
|
21
|
+
error: string;
|
|
22
|
+
errorIndexes: number[];
|
|
23
|
+
} | void;
|
|
21
24
|
whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
|
|
22
25
|
zIndex?: number;
|
|
23
26
|
showVariableModal?: boolean;
|
|
@@ -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"),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"),r=require("./modalElements/Footer.js"),i=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:m,htmlContent:v,templateVariables:C,onTemplateSelect:h,globalPlaceholders:S,showOnlyContent:b,whatsappSpecificPickerMeta:g,zIndex:x,showVariableModal:T,variableList:E,discountCode:P,setDiscountCode:j,onBackPress:M,enabledCustomText:L,variableListForImage:I,showSampleValues:f,disableEditVariable:w,pod:A,extras:y,pickerConf:N}=d;var V,k,q,H,_,D;l.useEffect((()=>{W(v)}),[v]);const O=m===o.CHANNEL_TYPE.WHATSAPP&&"CAROUSEL"===(null===(k=null===(V=u.components)||void 0===V?void 0:V[1])||void 0===k?void 0:k.type),[F,Y]=l.useState(m===o.CHANNEL_TYPE.EMAIL||O?"desktop":"mobile"),[B,W]=l.useState(v),[z,U]=l.useState(!1),[$,R]=l.useState([]),[G,J]=l.useState(u),[K,Q]=l.useState(null!=C?C:[]),[X,Z]=l.useState(!1),[ee,le]=l.useState(-1);const te=l.useMemo((()=>n.convertPlaceholdersToBikDropdown(S)),[S]);return e.jsx(s.TemplateModalContext.Provider,Object.assign({value:{template:G,setTemplate:J,device:F,setDevice:Y,display_content:B,setDisplayContent:W,originalVariableList:K,setOriginalVariableList:Q,isError:z,setIsError:U,channel:m,globalNormalizedPlaceholders:te,templateSelectionTriggered:X,setTemplateSelectionTriggered:Z,enabledCustomText:L,disableEditVariable:w,pod:A,extras:y,isWhatsappCarousel:O,selectedCarouselIndex:ee,setSelectedCarouselIndex:le,isProductCarouselType:u.isProductCarouselType,cardCount:null===(H=null===(q=u.components)||void 0===q?void 0:q[1].cards)||void 0===H?void 0:H.length,errorIndexes:$,setErrorIndexes:R,pickerConf:N}},{children:b?e.jsx(i.default,{channel:o.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:x,centralContainerStyles:{width:O?900:m===o.CHANNEL_TYPE.EMAIL&&p?1e3:800},open:!0,onClose:()=>{null==c||c()},headingTitle:null==G?void 0:G.label,headingSubtitle:m===o.CHANNEL_TYPE.WHATSAPP?`${t.default.capitaliseFirstLetterOfString(null!==(_=null==G?void 0:G.category)&&void 0!==_?_:"")} • ${null!==(D=null==G?void 0:G.templateCategory)&&void 0!==D?D:""}`:"",onBackPress:()=>{null==M||M()}},{children:[e.jsx(i.default,{showSampleValues:f,showVariableMapping:p,channel:m,whatsappSpecificPickerMeta:g,showVariableModal:T,variableList:E,discountCode:P,setDiscountCode:j,variableListForImage:I&&(null==I?void 0:I.length)>0?I:E}),h?e.jsx(r.default,{isWhatsappCarousel:null!=O&&O,onSelect:function(){const e=null==h?void 0:h(G,K,null!=B?B:"");console.log("error: ",e),R([-1,2]),(null==e?void 0:e.errorIndexes)?R(e.errorIndexes):(null==e?void 0:e.error)?U(!!(null==e?void 0:e.error)):Z(!0)}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -31,6 +31,8 @@ export declare const TemplateModalContext: React.Context<{
|
|
|
31
31
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
32
32
|
isProductCarouselType?: boolean | undefined;
|
|
33
33
|
cardCount?: number | undefined;
|
|
34
|
+
errorIndexes?: number[] | undefined;
|
|
35
|
+
setErrorIndexes?: React.Dispatch<React.SetStateAction<number[]>> | undefined;
|
|
34
36
|
pickerConf?: {
|
|
35
37
|
searchInCollection: any;
|
|
36
38
|
searchProducts: any;
|
|
@@ -64,6 +66,8 @@ export declare const useTemplateModalContext: () => {
|
|
|
64
66
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
65
67
|
isProductCarouselType?: boolean | undefined;
|
|
66
68
|
cardCount?: number | undefined;
|
|
69
|
+
errorIndexes?: number[] | undefined;
|
|
70
|
+
setErrorIndexes?: React.Dispatch<React.SetStateAction<number[]>> | undefined;
|
|
67
71
|
pickerConf?: {
|
|
68
72
|
searchInCollection: any;
|
|
69
73
|
searchProducts: any;
|
|
@@ -10,4 +10,4 @@
|
|
|
10
10
|
gap: 12;
|
|
11
11
|
border-bottom-left-radius: 4px;
|
|
12
12
|
border-bottom-right-radius: 4px;
|
|
13
|
-
`;exports.default=r=>{let{isWhatsappCarousel:s,onSelect:l}=r;const{isError:d,selectedCarouselIndex:i,setSelectedCarouselIndex:c}=n.useTemplateModalContext(),[
|
|
13
|
+
`;exports.default=r=>{let{isWhatsappCarousel:s,onSelect:l}=r;const{isError:d,selectedCarouselIndex:i,setSelectedCarouselIndex:c,setErrorIndexes:p}=n.useTemplateModalContext(),[x,b]=t.useState(s?"Next":"Select template");return t.useEffect((()=>{s&&-1===i?b("Next"):s&&null!=i&&i>-1&&b("Save & Select Template")}),[i]),e.jsxs(u,{children:[d&&e.jsx(a.Badge,{errorText:"Some inputs are missing or incorrect. Please check"}),e.jsx(o.Button,{id:"select-template-btn",buttonText:x,size:s?"small":"large",onClick:function(){s&&-1===i&&c?c(0):(null==p||p([]),l())}})]})};
|
|
@@ -2,6 +2,7 @@ export declare const Container: import("styled-components").StyledComponent<"div
|
|
|
2
2
|
isCarouselCard?: boolean | undefined;
|
|
3
3
|
showBorder?: boolean | undefined;
|
|
4
4
|
isWhatsappCarousel?: boolean | undefined;
|
|
5
|
+
hasError?: boolean | undefined;
|
|
5
6
|
}, never>;
|
|
6
7
|
export declare const TimeStamp: import("styled-components").StyledComponent<"div", any, {
|
|
7
8
|
numberOfLines?: number | undefined;
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
position: relative;
|
|
9
9
|
padding: 8px 0px;
|
|
10
10
|
border-width: 2px;
|
|
11
|
-
border-color: ${r.COLORS.stroke.brand};
|
|
11
|
+
border-color: ${e=>e.hasError?`${r.COLORS.content.negative}`:`${r.COLORS.stroke.brand}`};
|
|
12
12
|
border-style: ${e=>e.showBorder?"solid":"none"};
|
|
13
13
|
:hover {
|
|
14
14
|
border: 2px
|
|
15
|
-
${e=>e.isWhatsappCarousel?e.showBorder?"solid":"dashed":"none"}
|
|
15
|
+
${e=>e.isWhatsappCarousel?e.hasError?"dashed":e.showBorder?"solid":"dashed":"none"}
|
|
16
16
|
${r.COLORS.stroke.brand};
|
|
17
17
|
}
|
|
18
18
|
`,a=i.default(t.Caption)`
|
|
@@ -31,14 +31,14 @@
|
|
|
31
31
|
min-height: 152px;
|
|
32
32
|
margin-bottom: 4px;
|
|
33
33
|
margin: 0px 8px;
|
|
34
|
-
`,
|
|
34
|
+
`,s=i.default.div`
|
|
35
35
|
padding: 12px;
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: row;
|
|
38
38
|
justify-content: center;
|
|
39
39
|
align-items: center;
|
|
40
40
|
border-top: 1px solid ${r.COLORS.stroke.primary};
|
|
41
|
-
`,
|
|
41
|
+
`,p=i.default.div`
|
|
42
42
|
display: flex;
|
|
43
43
|
flex-direction: row;
|
|
44
44
|
justify-content: space-between;
|
|
@@ -61,4 +61,4 @@
|
|
|
61
61
|
position: absolute;
|
|
62
62
|
top: 16px;
|
|
63
63
|
right: 16px;
|
|
64
|
-
`,exports.ChatBtnContainer=
|
|
64
|
+
`,exports.ChatBtnContainer=s,exports.Container=d,exports.FooterWrapper=p,exports.MediaContainer=n,exports.TimeStamp=a;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/copy-code-icon.svg.js"),r=require("../../../assets/icons/halfRectangle.svg.js"),s=require("../../../assets/icons/phone.svg.js"),a=require("../../../assets/icons/qrb.svg.js"),i=require("../../../assets/icons/RedirectToNew.svg.js"),o=require("styled-components"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/copy-code-icon.svg.js"),r=require("../../../assets/icons/halfRectangle.svg.js"),s=require("../../../assets/icons/phone.svg.js"),a=require("../../../assets/icons/qrb.svg.js"),i=require("../../../assets/icons/RedirectToNew.svg.js"),o=require("react"),n=require("styled-components"),l=require("../../template-context-mapper/context/templateModalContext.js"),d=require("../../tooltips/Tooltip.js"),p=require("../../TypographyStyle.js"),u=require("../../../constants/Theme.js"),x=require("../helpers/VariableEditorHelper.js"),c=require("../models/TemplateMeta.js"),h=require("./ChatBtn.js"),m=require("./ChatUI.style.js"),j=require("./LimitedTimeOffer/LimitedTimeOffer.index.js"),f=require("./MediaCard.js");function T(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var y=T(n);const C=y.default.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -8px;
|
|
6
6
|
top: -9px;
|
|
7
|
-
`,
|
|
7
|
+
`,g=y.default.div`
|
|
8
8
|
font-family: 'Inter';
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
11
11
|
font-size: 14px;
|
|
12
12
|
line-height: 20px;
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
|
-
color: ${
|
|
14
|
+
color: ${u.COLORS.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,
|
|
16
|
+
`,E=y.default(g)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,q=new x.VariableEditorHelper;exports.ChatUIV2=n=>{const{bodyText:u,footerText:x,headerMediaType:T,headerText:y,headerAssetLink:b,headerAssetName:v,quickReplybtn:O,ctaBtn:_,actionTypes:I,extras:S,showHeader:w,imagePreviewStyles:P,size:L,bodyVariableList:A,headerVariableList:M,buttons:N,limitedTimeOfferComponent:R,carouselCardIndex:B}=n,H=q.format(u,A),Y=q.format(y,M),{isWhatsappCarousel:U,selectedCarouselIndex:D,isProductCarouselType:F,errorIndexes:V}=l.useTemplateModalContext(),k={COPY_CODE:t.default,PHONE_NUMBER:s.default,URL:i.default,QUICK_REPLY:a.default};return o.useEffect((()=>{console.log("errorIndexes: ",V)}),[V]),e.jsxs(m.Container,Object.assign({isCarouselCard:null!=B&&B>-1,showBorder:null!=B&&B===D||F&&null!=B&&B>-1&&null!=D&&D>-1,hasError:!!(null==V?void 0:V.find((e=>e===D))),isWhatsappCarousel:U},{children:[!U&&e.jsx(C,{children:e.jsx(r.default,{color:"white",height:8,width:8})}),T===c.HEADER_TYPES.TEXT?e.jsx(E,{dangerouslySetInnerHTML:{__html:Y}}):T!==c.HEADER_TYPES.NONE?e.jsx(f.MediaCard,{headerAssetLink:b,headerAssetName:v,mediaType:T,imagePreviewStyles:T===c.HEADER_TYPES.IMAGE?P:{}}):e.jsx(e.Fragment,{}),(null==R?void 0:R.dateTime)?e.jsx(j.LimitedTimeOffer,{text:R.text,dateTime:R.dateTime,code:R.code}):e.jsx(e.Fragment,{}),!!u&&e.jsx(e.Fragment,{children:e.jsx(g,{dangerouslySetInnerHTML:{__html:H}})}),e.jsxs(m.FooterWrapper,{children:[e.jsx(d.Tooltip,Object.assign({body:null!=x?x:"",placement:"top"},{children:e.jsx(m.TimeStamp,Object.assign({style:{flex:1}},{children:x}))})),e.jsx(m.TimeStamp,{children:"16:48"})]}),N&&N.length>0?N.map(((t,r)=>e.jsx(h.ChatBtn,{text:"COPY_CODE"===t.type?"Copy code":t.text,Icon:k[t.type],size:L},r))):I===c.ACTIONS_TYPES.QUICK_REPLY?e.jsx("div",{children:null==O?void 0:O.map(((t,r)=>e.jsx(h.ChatBtn,{text:t.text},r)))}):I===c.ACTIONS_TYPES.CTA_BTN?e.jsx("div",{children:null==_?void 0:_.map(((t,r)=>e.jsx(h.ChatBtn,{textTypography:w?p.Caption:p.BodySecondary,extraContent:S?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?s.default:i.default,size:L},r)))}):e.jsx(e.Fragment,{})]}))};
|
|
@@ -17,7 +17,10 @@ export interface TemplateContextMapperProps {
|
|
|
17
17
|
/** Only for initial-UI-purpose for the modal */
|
|
18
18
|
htmlContent: string;
|
|
19
19
|
showOnlyContent?: boolean;
|
|
20
|
-
onTemplateSelect?(template: EmailTemplateType | SMSTemplateType | WhatsAppTemplate | WhatsAppCarouselTemplate, variables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables, display_content?: string):
|
|
20
|
+
onTemplateSelect?(template: EmailTemplateType | SMSTemplateType | WhatsAppTemplate | WhatsAppCarouselTemplate, variables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables | WhatsAppCarouselTemplateVariables, display_content?: string): {
|
|
21
|
+
error: string;
|
|
22
|
+
errorIndexes: number[];
|
|
23
|
+
} | void;
|
|
21
24
|
whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
|
|
22
25
|
zIndex?: number;
|
|
23
26
|
showVariableModal?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as l,Fragment as
|
|
1
|
+
import{jsx as e,jsxs as l,Fragment as o}from"react/jsx-runtime";import{useEffect as t,useState as r,useMemo as a}from"react";import i from"../../utils/StringUtils.js";import{StyledModal as s}from"../modals/styledModal.js";import{CHANNEL_TYPE as n}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:v,closeDialog:h,showVariableMapping:C,channel:b,htmlContent:g,templateVariables:S,onTemplateSelect:x,globalPlaceholders:f,showOnlyContent:T,whatsappSpecificPickerMeta:I,zIndex:P,showVariableModal:w,variableList:M,discountCode:E,setDiscountCode:L,onBackPress:V,enabledCustomText:j,variableListForImage:y,showSampleValues:k,disableEditVariable:A,pod:D,extras:O,pickerConf:F}=u;var W,z,B,H,U,$;t((()=>{G(g)}),[g]);const N=b===n.WHATSAPP&&"CAROUSEL"===(null===(z=null===(W=v.components)||void 0===W?void 0:W[1])||void 0===z?void 0:z.type),[R,_]=r(b===n.EMAIL||N?"desktop":"mobile"),[q,G]=r(g),[J,K]=r(!1),[Q,X]=r([]),[Y,Z]=r(v),[ee,le]=r(null!=S?S:[]),[oe,te]=r(!1),[re,ae]=r(-1);const ie=a((()=>m(f)),[f]);return e(d.Provider,Object.assign({value:{template:Y,setTemplate:Z,device:R,setDevice:_,display_content:q,setDisplayContent:G,originalVariableList:ee,setOriginalVariableList:le,isError:J,setIsError:K,channel:b,globalNormalizedPlaceholders:ie,templateSelectionTriggered:oe,setTemplateSelectionTriggered:te,enabledCustomText:j,disableEditVariable:A,pod:D,extras:O,isWhatsappCarousel:N,selectedCarouselIndex:re,setSelectedCarouselIndex:ae,isProductCarouselType:v.isProductCarouselType,cardCount:null===(H=null===(B=v.components)||void 0===B?void 0:B[1].cards)||void 0===H?void 0:H.length,errorIndexes:Q,setErrorIndexes:X,pickerConf:F}},{children:T?e(p,{channel:n.EMAIL,hideHeader:!0}):l(s,Object.assign({zIndex:P,centralContainerStyles:{width:N?900:b===n.EMAIL&&C?1e3:800},open:!0,onClose:()=>{null==h||h()},headingTitle:null==Y?void 0:Y.label,headingSubtitle:b===n.WHATSAPP?`${i.capitaliseFirstLetterOfString(null!==(U=null==Y?void 0:Y.category)&&void 0!==U?U:"")} • ${null!==($=null==Y?void 0:Y.templateCategory)&&void 0!==$?$:""}`:"",onBackPress:()=>{null==V||V()}},{children:[e(p,{showSampleValues:k,showVariableMapping:C,channel:b,whatsappSpecificPickerMeta:I,showVariableModal:w,variableList:M,discountCode:E,setDiscountCode:L,variableListForImage:y&&(null==y?void 0:y.length)>0?y:M}),x?e(c,{isWhatsappCarousel:null!=N&&N,onSelect:function(){const e=null==x?void 0:x(Y,ee,null!=q?q:"");console.log("error: ",e),X([-1,2]),(null==e?void 0:e.errorIndexes)?X(e.errorIndexes):(null==e?void 0:e.error)?K(!!(null==e?void 0:e.error)):te(!0)}}):e(o,{})]}))}))};export{u as TemplateContextMapper};
|
|
@@ -31,6 +31,8 @@ export declare const TemplateModalContext: React.Context<{
|
|
|
31
31
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
32
32
|
isProductCarouselType?: boolean | undefined;
|
|
33
33
|
cardCount?: number | undefined;
|
|
34
|
+
errorIndexes?: number[] | undefined;
|
|
35
|
+
setErrorIndexes?: React.Dispatch<React.SetStateAction<number[]>> | undefined;
|
|
34
36
|
pickerConf?: {
|
|
35
37
|
searchInCollection: any;
|
|
36
38
|
searchProducts: any;
|
|
@@ -64,6 +66,8 @@ export declare const useTemplateModalContext: () => {
|
|
|
64
66
|
setSelectedCarouselIndex?: React.Dispatch<React.SetStateAction<number>> | undefined;
|
|
65
67
|
isProductCarouselType?: boolean | undefined;
|
|
66
68
|
cardCount?: number | undefined;
|
|
69
|
+
errorIndexes?: number[] | undefined;
|
|
70
|
+
setErrorIndexes?: React.Dispatch<React.SetStateAction<number[]>> | undefined;
|
|
67
71
|
pickerConf?: {
|
|
68
72
|
searchInCollection: any;
|
|
69
73
|
searchProducts: any;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as
|
|
2
|
-
background: ${
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r,useEffect as o}from"react";import s from"styled-components";import{Button as n}from"../../button/Button.js";import{COLORS as a}from"../../../constants/Theme.js";import{Badge as l}from"../Badge/index.js";import{useTemplateModalContext as i}from"../context/templateModalContext.js";const p=s.div`
|
|
2
|
+
background: ${a.surface.standard};
|
|
3
3
|
border-top-width: 1px;
|
|
4
|
-
border-top-color: ${
|
|
4
|
+
border-top-color: ${a.stroke.primary};
|
|
5
5
|
box-shadow: 0px -4px 12px rgba(0, 0, 0, 0.12);
|
|
6
6
|
width: 100%;
|
|
7
7
|
padding: 16px 24px;
|
|
@@ -10,4 +10,4 @@ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as o,useEffect
|
|
|
10
10
|
gap: 12;
|
|
11
11
|
border-bottom-left-radius: 4px;
|
|
12
12
|
border-bottom-right-radius: 4px;
|
|
13
|
-
`,d=s=>{let{isWhatsappCarousel:
|
|
13
|
+
`,d=s=>{let{isWhatsappCarousel:a,onSelect:d}=s;const{isError:m,selectedCarouselIndex:c,setSelectedCarouselIndex:x,setErrorIndexes:u}=i(),[f,b]=r(a?"Next":"Select template");return o((()=>{a&&-1===c?b("Next"):a&&null!=c&&c>-1&&b("Save & Select Template")}),[c]),e(p,{children:[m&&t(l,{errorText:"Some inputs are missing or incorrect. Please check"}),t(n,{id:"select-template-btn",buttonText:f,size:a?"small":"large",onClick:function(){a&&-1===c&&x?x(0):(null==u||u([]),d())}})]})};export{d as default};
|
|
@@ -2,6 +2,7 @@ export declare const Container: import("styled-components").StyledComponent<"div
|
|
|
2
2
|
isCarouselCard?: boolean | undefined;
|
|
3
3
|
showBorder?: boolean | undefined;
|
|
4
4
|
isWhatsappCarousel?: boolean | undefined;
|
|
5
|
+
hasError?: boolean | undefined;
|
|
5
6
|
}, never>;
|
|
6
7
|
export declare const TimeStamp: import("styled-components").StyledComponent<"div", any, {
|
|
7
8
|
numberOfLines?: number | undefined;
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import
|
|
1
|
+
import r from"styled-components";import{Caption as o}from"../../TypographyStyle.js";import{COLORS as e}from"../../../constants/Theme.js";const t=r.div`
|
|
2
2
|
background: ${e.surface.standard};
|
|
3
3
|
box-shadow: 0px 2px 8px rgba(0, 0, 0, 0.12);
|
|
4
|
-
border-top-left-radius: ${
|
|
4
|
+
border-top-left-radius: ${r=>r.isCarouselCard?"12px":"0px"};
|
|
5
5
|
border-top-right-radius: 12px;
|
|
6
6
|
border-bottom-right-radius: 12px;
|
|
7
7
|
border-bottom-left-radius: 12px;
|
|
8
8
|
position: relative;
|
|
9
9
|
padding: 8px 0px;
|
|
10
10
|
border-width: 2px;
|
|
11
|
-
border-color: ${e.stroke.brand};
|
|
12
|
-
border-style: ${
|
|
11
|
+
border-color: ${r=>r.hasError?`${e.content.negative}`:`${e.stroke.brand}`};
|
|
12
|
+
border-style: ${r=>r.showBorder?"solid":"none"};
|
|
13
13
|
:hover {
|
|
14
14
|
border: 2px
|
|
15
|
-
${
|
|
15
|
+
${r=>r.isWhatsappCarousel?r.hasError?"dashed":r.showBorder?"solid":"dashed":"none"}
|
|
16
16
|
${e.stroke.brand};
|
|
17
17
|
}
|
|
18
|
-
`,i=o
|
|
18
|
+
`,i=r(o)`
|
|
19
19
|
color: ${e.content.secondary};
|
|
20
20
|
max-width: 80px;
|
|
21
21
|
text-overflow: ellipsis;
|
|
22
22
|
white-space: nowrap;
|
|
23
23
|
overflow: hidden;
|
|
24
24
|
text-wrap: wrap;
|
|
25
|
-
`,d=
|
|
25
|
+
`,d=r.div`
|
|
26
26
|
border-radius: 8px;
|
|
27
27
|
display: flex;
|
|
28
28
|
flex-direction: column;
|
|
@@ -31,19 +31,19 @@ import o from"styled-components";import{Caption as r}from"../../TypographyStyle.
|
|
|
31
31
|
min-height: 152px;
|
|
32
32
|
margin-bottom: 4px;
|
|
33
33
|
margin: 0px 8px;
|
|
34
|
-
`,p=
|
|
34
|
+
`,p=r.div`
|
|
35
35
|
padding: 12px;
|
|
36
36
|
display: flex;
|
|
37
37
|
flex-direction: row;
|
|
38
38
|
justify-content: center;
|
|
39
39
|
align-items: center;
|
|
40
40
|
border-top: 1px solid ${e.stroke.primary};
|
|
41
|
-
`,s=
|
|
41
|
+
`,s=r.div`
|
|
42
42
|
display: flex;
|
|
43
43
|
flex-direction: row;
|
|
44
44
|
justify-content: space-between;
|
|
45
45
|
margin: 8px 12px;
|
|
46
|
-
`;
|
|
46
|
+
`;r.div`
|
|
47
47
|
position: absolute;
|
|
48
48
|
bottom: -1px;
|
|
49
49
|
left: 0;
|
|
@@ -57,7 +57,7 @@ import o from"styled-components";import{Caption as r}from"../../TypographyStyle.
|
|
|
57
57
|
background: ${e.surface.hovered};
|
|
58
58
|
border-bottom-right-radius: 8px;
|
|
59
59
|
border-bottom-left-radius: 8px;
|
|
60
|
-
`,
|
|
60
|
+
`,r.div`
|
|
61
61
|
position: absolute;
|
|
62
62
|
top: 16px;
|
|
63
63
|
right: 16px;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import l from"styled-components";import{useTemplateModalContext as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import r from"../../../assets/icons/copy-code-icon.svg.js";import i from"../../../assets/icons/halfRectangle.svg.js";import s from"../../../assets/icons/phone.svg.js";import a from"../../../assets/icons/qrb.svg.js";import n from"../../../assets/icons/RedirectToNew.svg.js";import{useEffect as l}from"react";import m from"styled-components";import{useTemplateModalContext as p}from"../../template-context-mapper/context/templateModalContext.js";import{Tooltip as d}from"../../tooltips/Tooltip.js";import{Caption as c,BodySecondary as h}from"../../TypographyStyle.js";import{COLORS as f}from"../../../constants/Theme.js";import{VariableEditorHelper as x}from"../helpers/VariableEditorHelper.js";import{HEADER_TYPES as y,ACTIONS_TYPES as T}from"../models/TemplateMeta.js";import{ChatBtn as g}from"./ChatBtn.js";import{Container as u,FooterWrapper as C,TimeStamp as j}from"./ChatUI.style.js";import{LimitedTimeOffer as b}from"./LimitedTimeOffer/LimitedTimeOffer.index.js";import{MediaCard as v}from"./MediaCard.js";const w=m.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -8px;
|
|
6
6
|
top: -9px;
|
|
7
|
-
`,
|
|
7
|
+
`,I=m.div`
|
|
8
8
|
font-family: 'Inter';
|
|
9
9
|
font-style: normal;
|
|
10
10
|
font-weight: 400;
|
|
11
11
|
font-size: 14px;
|
|
12
12
|
line-height: 20px;
|
|
13
13
|
padding: 8px 12px 0px;
|
|
14
|
-
color: ${
|
|
14
|
+
color: ${f.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,O=
|
|
16
|
+
`,O=m(I)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,E=new x,L=m=>{const{bodyText:f,footerText:x,headerMediaType:L,headerText:_,headerAssetLink:N,headerAssetName:M,quickReplybtn:P,ctaBtn:R,actionTypes:A,extras:B,showHeader:H,imagePreviewStyles:S,size:U,bodyVariableList:k,headerVariableList:z,buttons:Y,limitedTimeOfferComponent:V,carouselCardIndex:q}=m,D=E.format(f,k),K=E.format(_,z),{isWhatsappCarousel:Q,selectedCarouselIndex:W,isProductCarouselType:G,errorIndexes:X}=p(),$={COPY_CODE:r,PHONE_NUMBER:s,URL:n,QUICK_REPLY:a};return l((()=>{console.log("errorIndexes: ",X)}),[X]),e(u,Object.assign({isCarouselCard:null!=q&&q>-1,showBorder:null!=q&&q===W||G&&null!=q&&q>-1&&null!=W&&W>-1,hasError:!!(null==X?void 0:X.find((e=>e===W))),isWhatsappCarousel:Q},{children:[!Q&&t(w,{children:t(i,{color:"white",height:8,width:8})}),L===y.TEXT?t(O,{dangerouslySetInnerHTML:{__html:K}}):L!==y.NONE?t(v,{headerAssetLink:N,headerAssetName:M,mediaType:L,imagePreviewStyles:L===y.IMAGE?S:{}}):t(o,{}),(null==V?void 0:V.dateTime)?t(b,{text:V.text,dateTime:V.dateTime,code:V.code}):t(o,{}),!!f&&t(o,{children:t(I,{dangerouslySetInnerHTML:{__html:D}})}),e(C,{children:[t(d,Object.assign({body:null!=x?x:"",placement:"top"},{children:t(j,Object.assign({style:{flex:1}},{children:x}))})),t(j,{children:"16:48"})]}),Y&&Y.length>0?Y.map(((e,o)=>t(g,{text:"COPY_CODE"===e.type?"Copy code":e.text,Icon:$[e.type],size:U},o))):A===T.QUICK_REPLY?t("div",{children:null==P?void 0:P.map(((e,o)=>t(g,{text:e.text},o)))}):A===T.CTA_BTN?t("div",{children:null==R?void 0:R.map(((e,o)=>t(g,{textTypography:H?c:h,extraContent:B?e.extra:void 0,placeholder:e.placeholder,text:e.text,Icon:"phoneNumber"===e.type?s:n,size:U},o)))}):t(o,{})]}))};export{L as ChatUIV2};
|