@bikdotai/bik-component-library 0.0.639--beta1.3 → 0.0.639--beta--0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.js +1 -1
- package/dist/cjs/components/template-context-mapper/utils/TemplateConstants.d.ts +15 -0
- package/dist/cjs/components/template-context-mapper/utils/TemplateConstants.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.js +1 -1
- package/dist/esm/components/template-context-mapper/utils/TemplateConstants.d.ts +15 -0
- package/dist/esm/components/template-context-mapper/utils/TemplateConstants.js +1 -1
- package/package.json +1 -1
package/dist/cjs/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/alert_triangle.svg.js"),n=require("../../../assets/icons/click.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../../assets/icons/alert_triangle.svg.js"),n=require("../../../assets/icons/click.svg.js"),l=require("react"),s=require("../../modals/styledModal.js"),a=require("../../tag/Tag.js"),i=require("../../template-preview/models/WhatsAppTemplate.js"),c=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),o=require("../styles/TemplateAnalyticsStyles.js"),d=require("../utils/TemplateConstants.js"),u=require("./TemplateAnalyticsSkeleton.js");const y=t=>{const{analyticsData:l,skipTitle:s}=t;return e.jsxs(o.RightPanelContainer,{children:[s?e.jsx(e.Fragment,{}):e.jsx(c.TitleSmall,{children:"Here are your template's delivery & engagement stats for the last 30 days"}),e.jsx("div",Object.assign({className:"mt-3"},{children:d.ANALYTICS_ENGAGEMENT_MAP.map(((t,n)=>e.jsx(j,{icon:t.icon,title:t.title,value:l[t.valName]||0,percentValue:t.percentValName?l[t.percentValName]:null},n)))})),(null==l?void 0:l.clickAnalytics)&&Object.keys(null==l?void 0:l.clickAnalytics)&&Object.keys(null==l?void 0:l.clickAnalytics).length?e.jsxs(e.Fragment,{children:[e.jsx(c.TitleSmall,Object.assign({color:r.COLORS.content.secondary},{children:"Clicked"})),e.jsx("div",Object.assign({className:"mt-3"},{children:Object.entries(l.clickAnalytics).map(((t,l)=>{let[s,a]=t;return e.jsx(j,{icon:n.default,title:s,value:a.totalClicks||0,percentValue:a.clickPercentage},l)}))}))]}):e.jsx(e.Fragment,{})]})},j=t=>{const{icon:n,title:l,value:s,percentValue:i}=t;return e.jsxs("div",Object.assign({className:"each--analytics--container"},{children:[e.jsxs("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[e.jsx("div",Object.assign({className:"each--icon--container"},{children:e.jsx(n,{width:"16px",height:"16px",color:r.COLORS.background.brand})})),e.jsx(c.Caption,{children:l})]})),e.jsxs("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[i?e.jsx(a.Tag,{tagText:`${i}%`||0,theme:"light",type:"neutral"}):e.jsx(e.Fragment,{}),e.jsx(o.CustomTitleMedium,{children:s})]}))]}))};exports.AnalyticsItem=j,exports.RightPanelTemplateAnalytics=y,exports.TemplateAnalyticsComponent=n=>{const{templateAnalytics:a,onClose:j,onProceed:p,onCancel:m,headingTitle:T,headingSubtitle:g,templateId:x}=n,{templateQuality:h=i.TEMPLATE_QUALITY.GREEN,fetchAnalytics:b}=a||{},{icon:A,title:C,subline:O,sublineTextType:E,sublineColor:k}=d.TEMPLATE_QUALITY_MAP[h||i.TEMPLATE_QUALITY.GREEN],[v,S]=l.useState({}),[N,L]=l.useState(!0);l.useEffect((()=>{null==b||b(x||"").then((e=>{e.analytics&&S(e.analytics),L(!1)}))}),[]);const P=l.useMemo((()=>h===i.TEMPLATE_QUALITY.GREEN?{primaryButton:{buttonText:"Proceed with selection",buttonType:"primary",onClick:p,disabled:N},secondaryButton:{buttonText:"Cancel",buttonType:"tertiaryGray",onClick:()=>{null==j||j(),null==m||m()},disabled:N}}:{primaryButton:{buttonText:"Cancel",buttonType:"primary",onClick:()=>{null==j||j(),null==m||m()},disabled:N},secondaryButton:{buttonText:"Proceed with selection",buttonType:"secondary",onClick:p,disabled:N}}),[h,N]),M=E||c.Caption;return e.jsx(s.StyledModal,Object.assign({open:!0,headingTitle:T,tintedHeader:!0,modalHeaderStyles:{backgroundColor:r.COLORS.surface.subdued},onBackPress:()=>{null==j||j()},headingSubtitle:g,footerShadow:!0,primaryButton:P.primaryButton,secondaryButton:P.secondaryButton,onClose:()=>{null==j||j()},width:"700px"},{children:e.jsxs(o.TemplateContainer,{children:[e.jsx(o.LeftPanelContainer,{children:e.jsxs("div",Object.assign({className:"inside--container"},{children:[A&&e.jsx("div",Object.assign({className:"icon--container"},{children:e.jsx(t.default,{width:40,height:40,color:r.COLORS.content.warning})})),C&&e.jsx(c.TitleRegular,Object.assign({style:{textAlign:"center"}},{children:C})),e.jsx(M,Object.assign({style:{textAlign:"center",color:k||r.COLORS.content.primary}},{children:O}))]}))}),N?e.jsx(u.TemplateAnalyticsSkeleton,{}):e.jsx(y,{analyticsData:v,skipTitle:h==i.TEMPLATE_QUALITY.GREEN})]})}))};
|
|
@@ -3,16 +3,31 @@ export declare const TEMPLATE_QUALITY_MAP: {
|
|
|
3
3
|
YELLOW: {
|
|
4
4
|
icon: import("react").FunctionComponent<import("react").SVGAttributes<SVGElement>>;
|
|
5
5
|
title: string;
|
|
6
|
+
sublineTextType: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
numberOfLines?: number | undefined;
|
|
8
|
+
color?: string | undefined;
|
|
9
|
+
}, never>;
|
|
10
|
+
sublineColor: string;
|
|
6
11
|
subline: string;
|
|
7
12
|
};
|
|
8
13
|
RED: {
|
|
9
14
|
icon: import("react").FunctionComponent<import("react").SVGAttributes<SVGElement>>;
|
|
10
15
|
title: string;
|
|
16
|
+
sublineTextType: import("styled-components").StyledComponent<"div", any, {
|
|
17
|
+
numberOfLines?: number | undefined;
|
|
18
|
+
color?: string | undefined;
|
|
19
|
+
}, never>;
|
|
20
|
+
sublineColor: string;
|
|
11
21
|
subline: string;
|
|
12
22
|
};
|
|
13
23
|
GREEN: {
|
|
14
24
|
icon: string;
|
|
15
25
|
title: string;
|
|
26
|
+
sublineTextType: import("styled-components").StyledComponent<"div", any, {
|
|
27
|
+
numberOfLines?: number | undefined;
|
|
28
|
+
color?: string | undefined;
|
|
29
|
+
}, never>;
|
|
30
|
+
sublineColor: string;
|
|
16
31
|
subline: string;
|
|
17
32
|
};
|
|
18
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../assets/icons/alert_triangle.svg.js"),t=require("../../../assets/icons/send_template.svg.js"),a=require("../../../assets/icons/tick.svg.js"),r=require("../../../assets/icons/tick_double.svg.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js")
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../assets/icons/alert_triangle.svg.js"),t=require("../../../assets/icons/send_template.svg.js"),a=require("../../../assets/icons/tick.svg.js"),r=require("../../../assets/icons/tick_double.svg.js");require("../../template-preview/TemplatePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreview.js"),require("../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js");var i=require("../../../constants/Theme.js");require("../../curtain/CurtainHelper.js"),require("../../variable-picker-v3/model.js"),require("../../template-preview/models/TemplateMeta.js");var s=require("../../template-preview/models/WhatsAppTemplate.js");require("../../template-preview/models/Channels.js");var l=require("../../TypographyStyle.js");const n={[s.TEMPLATE_QUALITY.YELLOW]:{icon:e.default,title:"Medium quality template",sublineTextType:l.Caption,sublineColor:i.COLORS.content.secondary,subline:"Meta has downgraded this template to a medium-quality rating due to negative feedback from multiple customers or low read rates. We recommend improving its content or choosing a different template to enhance delivery and engagement in your next campaign"},[s.TEMPLATE_QUALITY.RED]:{icon:e.default,title:"Low quality template",sublineTextType:l.Caption,sublineColor:i.COLORS.content.secondary,subline:"Meta has downgraded this template to a low-quality rating due to negative feedback from multiple customers or low read rates. We recommend improving its content or choosing a different template to enhance delivery and engagement in your next campaign"},[s.TEMPLATE_QUALITY.GREEN]:{icon:"",title:"",sublineTextType:l.TitleSmall,sublineColor:"",subline:"Here is your template's delivery and engagement stats from the last 30 days. Higher engagement today can lead to better delivery rates in the future."}},o=[{title:"Sent",icon:t.default,valName:"totalSent"},{title:"Delivered",icon:a.default,valName:"totalDelivered",percentValName:"deliveredPercentage"},{title:"Read",icon:r.default,valName:"totalReads",percentValName:"readPercentage"}];exports.ANALYTICS_ENGAGEMENT_MAP=o,exports.TEMPLATE_QUALITY_MAP=n;
|
package/dist/esm/components/template-context-mapper/modalElements/TemplateAnalyticsComponent.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as n}from"react/jsx-runtime";import l from"../../../assets/icons/alert_triangle.svg.js";import i from"../../../assets/icons/click.svg.js";import{useState as a,useEffect as c,useMemo as s}from"react";import{StyledModal as r}from"../../modals/styledModal.js";import{Tag as o}from"../../tag/Tag.js";import{TEMPLATE_QUALITY as d}from"../../template-preview/models/WhatsAppTemplate.js";import{TitleRegular as m,TitleSmall as p,Caption as u}from"../../TypographyStyle.js";import{COLORS as y}from"../../../constants/Theme.js";import{TemplateContainer as h,LeftPanelContainer as g,RightPanelContainer as b,CustomTitleMedium as j}from"../styles/TemplateAnalyticsStyles.js";import{TEMPLATE_QUALITY_MAP as T,ANALYTICS_ENGAGEMENT_MAP as k}from"../utils/TemplateConstants.js";import{TemplateAnalyticsSkeleton as v}from"./TemplateAnalyticsSkeleton.js";const f=n=>{const{templateAnalytics:i,onClose:o,onProceed:p,onCancel:b,headingTitle:j,headingSubtitle:k,templateId:f}=n,{templateQuality:N=d.GREEN,fetchAnalytics:O}=i||{},{icon:C,title:A,subline:B,sublineTextType:w,sublineColor:E}=T[N||d.GREEN],[S,G]=a({}),[P,V]=a(!0);c((()=>{null==O||O(f||"").then((e=>{e.analytics&&G(e.analytics),V(!1)}))}),[]);const R=s((()=>N===d.GREEN?{primaryButton:{buttonText:"Proceed with selection",buttonType:"primary",onClick:p,disabled:P},secondaryButton:{buttonText:"Cancel",buttonType:"tertiaryGray",onClick:()=>{null==o||o(),null==b||b()},disabled:P}}:{primaryButton:{buttonText:"Cancel",buttonType:"primary",onClick:()=>{null==o||o(),null==b||b()},disabled:P},secondaryButton:{buttonText:"Proceed with selection",buttonType:"secondary",onClick:p,disabled:P}}),[N,P]),H=w||u;return e(r,Object.assign({open:!0,headingTitle:j,tintedHeader:!0,modalHeaderStyles:{backgroundColor:y.surface.subdued},onBackPress:()=>{null==o||o()},headingSubtitle:k,footerShadow:!0,primaryButton:R.primaryButton,secondaryButton:R.secondaryButton,onClose:()=>{null==o||o()},width:"700px"},{children:t(h,{children:[e(g,{children:t("div",Object.assign({className:"inside--container"},{children:[C&&e("div",Object.assign({className:"icon--container"},{children:e(l,{width:40,height:40,color:y.content.warning})})),A&&e(m,Object.assign({style:{textAlign:"center"}},{children:A})),e(H,Object.assign({style:{textAlign:"center",color:E||y.content.primary}},{children:B}))]}))}),P?e(v,{}):e(x,{analyticsData:S,skipTitle:N==d.GREEN})]})}))},x=l=>{const{analyticsData:a,skipTitle:c}=l;return t(b,{children:[c?e(n,{}):e(p,{children:"Here are your template's delivery & engagement stats for the last 30 days"}),e("div",Object.assign({className:"mt-3"},{children:k.map(((t,n)=>e(N,{icon:t.icon,title:t.title,value:a[t.valName]||0,percentValue:t.percentValName?a[t.percentValName]:null},n)))})),(null==a?void 0:a.clickAnalytics)&&Object.keys(null==a?void 0:a.clickAnalytics)&&Object.keys(null==a?void 0:a.clickAnalytics).length?t(n,{children:[e(p,Object.assign({color:y.content.secondary},{children:"Clicked"})),e("div",Object.assign({className:"mt-3"},{children:Object.entries(a.clickAnalytics).map(((t,n)=>{let[l,a]=t;return e(N,{icon:i,title:l,value:a.totalClicks||0,percentValue:a.clickPercentage},n)}))}))]}):e(n,{})]})},N=l=>{const{icon:i,title:a,value:c,percentValue:s}=l;return t("div",Object.assign({className:"each--analytics--container"},{children:[t("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[e("div",Object.assign({className:"each--icon--container"},{children:e(i,{width:"16px",height:"16px",color:y.background.brand})})),e(u,{children:a})]})),t("div",Object.assign({className:"d-flex align--center",style:{gap:8}},{children:[s?e(o,{tagText:`${s}%`||0,theme:"light",type:"neutral"}):e(n,{}),e(j,{children:c})]}))]}))};export{N as AnalyticsItem,x as RightPanelTemplateAnalytics,f as TemplateAnalyticsComponent};
|
|
@@ -3,16 +3,31 @@ export declare const TEMPLATE_QUALITY_MAP: {
|
|
|
3
3
|
YELLOW: {
|
|
4
4
|
icon: import("react").FunctionComponent<import("react").SVGAttributes<SVGElement>>;
|
|
5
5
|
title: string;
|
|
6
|
+
sublineTextType: import("styled-components").StyledComponent<"div", any, {
|
|
7
|
+
numberOfLines?: number | undefined;
|
|
8
|
+
color?: string | undefined;
|
|
9
|
+
}, never>;
|
|
10
|
+
sublineColor: string;
|
|
6
11
|
subline: string;
|
|
7
12
|
};
|
|
8
13
|
RED: {
|
|
9
14
|
icon: import("react").FunctionComponent<import("react").SVGAttributes<SVGElement>>;
|
|
10
15
|
title: string;
|
|
16
|
+
sublineTextType: import("styled-components").StyledComponent<"div", any, {
|
|
17
|
+
numberOfLines?: number | undefined;
|
|
18
|
+
color?: string | undefined;
|
|
19
|
+
}, never>;
|
|
20
|
+
sublineColor: string;
|
|
11
21
|
subline: string;
|
|
12
22
|
};
|
|
13
23
|
GREEN: {
|
|
14
24
|
icon: string;
|
|
15
25
|
title: string;
|
|
26
|
+
sublineTextType: import("styled-components").StyledComponent<"div", any, {
|
|
27
|
+
numberOfLines?: number | undefined;
|
|
28
|
+
color?: string | undefined;
|
|
29
|
+
}, never>;
|
|
30
|
+
sublineColor: string;
|
|
16
31
|
subline: string;
|
|
17
32
|
};
|
|
18
33
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"../../../assets/icons/alert_triangle.svg.js";import t from"../../../assets/icons/send_template.svg.js";import a from"../../../assets/icons/tick.svg.js";import i from"../../../assets/icons/tick_double.svg.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{TEMPLATE_QUALITY as r}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";const
|
|
1
|
+
import e from"../../../assets/icons/alert_triangle.svg.js";import t from"../../../assets/icons/send_template.svg.js";import a from"../../../assets/icons/tick.svg.js";import i from"../../../assets/icons/tick_double.svg.js";import"../../template-preview/TemplatePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreview.js";import"../../template-preview/WhatsApp/WhatsAppLikePreviewV2.js";import{COLORS as o}from"../../../constants/Theme.js";import"../../curtain/CurtainHelper.js";import"../../variable-picker-v3/model.js";import"../../template-preview/models/TemplateMeta.js";import{TEMPLATE_QUALITY as r}from"../../template-preview/models/WhatsAppTemplate.js";import"../../template-preview/models/Channels.js";import{Caption as n,TitleSmall as s}from"../../TypographyStyle.js";const l={[r.YELLOW]:{icon:e,title:"Medium quality template",sublineTextType:n,sublineColor:o.content.secondary,subline:"Meta has downgraded this template to a medium-quality rating due to negative feedback from multiple customers or low read rates. We recommend improving its content or choosing a different template to enhance delivery and engagement in your next campaign"},[r.RED]:{icon:e,title:"Low quality template",sublineTextType:n,sublineColor:o.content.secondary,subline:"Meta has downgraded this template to a low-quality rating due to negative feedback from multiple customers or low read rates. We recommend improving its content or choosing a different template to enhance delivery and engagement in your next campaign"},[r.GREEN]:{icon:"",title:"",sublineTextType:s,sublineColor:"",subline:"Here is your template's delivery and engagement stats from the last 30 days. Higher engagement today can lead to better delivery rates in the future."}},m=[{title:"Sent",icon:t,valName:"totalSent"},{title:"Delivered",icon:a,valName:"totalDelivered",percentValName:"deliveredPercentage"},{title:"Read",icon:i,valName:"totalReads",percentValName:"readPercentage"}];export{m as ANALYTICS_ENGAGEMENT_MAP,l as TEMPLATE_QUALITY_MAP};
|