@bikdotai/bik-component-library 0.0.570-beta-2 → 0.0.570-beta-4
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-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/models/TemplateMeta.d.ts +2 -1
- package/dist/cjs/components/template-preview/models/WebpushTemplate.d.ts +1 -0
- package/dist/cjs/components/template-preview/webpush/WebpushPreview.d.ts +2 -0
- package/dist/cjs/components/template-preview/webpush/WebpushPreview.js +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/models/TemplateMeta.d.ts +2 -1
- package/dist/esm/components/template-preview/models/WebpushTemplate.d.ts +1 -0
- package/dist/esm/components/template-preview/webpush/WebpushPreview.d.ts +2 -0
- package/dist/esm/components/template-preview/webpush/WebpushPreview.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("../template-context-mapper/context/templateModalContext.js"),l=require("../../utils/StringUtils.js"),i=require("../../constants/Theme.js"),a=require("../TypographyStyle.js"),n=require("./EmailTemplateThumbnailPreview.js"),s=require("./models/Channels.js"),r=require("./SmsTemplatePreview.js"),o=require("./webpush/WebpushPreview.js"),d=require("./WhatsAppTemplatePreview.js");const u={WhatsAppWrapper:{backgroundColor:i.COLORS.surface.standard,borderRadius:4,border:`1px solid ${i.COLORS.background.inactive}`,marginTop:16}};exports.TemplatePreview=p=>{let{template:m,channel:c,whatsAppSpecificMeta:v,templateCreationsInfo:h,hideHeader:j,size:C,onlyTemplateContent:b,emailSpecificMeta:S,smsSpecificMeta:g,showSampleValues:x,carouselCardIndex:y,isWhatsappCarousel:T,isPreview:P,applyBorderBottom:w,webPushSpecificMeta:O,hidePointerEvents:E}=p;var H,f;const{setSelectedCarouselIndex:A}=t.useTemplateModalContext();return c===s.CHANNEL_TYPE.SMS?e.jsx("div",Object.assign({style:Object.assign({marginTop:h?16:0,border:h?`1px solid ${i.COLORS.stroke.primary}`:"none",borderRadius:4},null==g?void 0:g.templateContainerStyles)},{children:e.jsx(r.default,{template:m,hideHeader:j,onlyTemplateContent:b,size:null!=C?C:"large",variableStore:null==g?void 0:g.smsVariableStore,display_content:null==g?void 0:g.smsDisplayContent,uniqueId:null==g?void 0:g.uniqueId})})):c===s.CHANNEL_TYPE.EMAIL?e.jsx("div",Object.assign({style:Object.assign({marginTop:h?16:0},null==S?void 0:S.templateContainerStyles)},{children:e.jsx(n.default,{template:m,handleViewTemplate:()=>{var e;null===(e=null==S?void 0:S.handleViewTemplate)||void 0===e||e.call(S)},hideHeader:j,hideViewButton:null==S?void 0:S.hideViewButtonForEmail,containerStyle:null==S?void 0:S.containerStyle,emailDisplayContent:null==S?void 0:S.emailDisplayContent,emailHtmlContainerId:null==S?void 0:S.emailHtmlContainerId,applyBorderBottom:w,hidePointerEvents:E})})):c===s.CHANNEL_TYPE.WHATSAPP?e.jsxs("div",Object.assign({style:Object.assign(Object.assign({},null==v?void 0:v.templateContainerStyles),h?u.WhatsAppWrapper:{}),onClick:()=>{var e,t;if(A&&T){if(-1===y&&!(null===(t=null===(e=null==m?void 0:m.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;A(null!=y?y:-1)}}},{children:[h?e.jsx("div",Object.assign({style:{padding:16}},{children:e.jsx(a.TitleRegular,{children:l.default.convertToTitleCase(null!==(H=null==m?void 0:m.label)&&void 0!==H?H:"")})})):e.jsx(e.Fragment,{}),e.jsx(d.default,{showSampleValues:x,showHeader:null==v?void 0:v.showWhatsAppHeader,extras:null==v?void 0:v.whatsAppExtras,template:m,size:h?"small":null!=C?C:"large",containerStyle:Object.assign(Object.assign({borderWidth:h?0:1,borderTopWidth:1},null!==(f=null==v?void 0:v.containerStyle)&&void 0!==f?f:{}),{height:"100%"}),zeroStateComponent:null==v?void 0:v.zeroStateComponent,usePlaceHolderName:null==v?void 0:v.usePlaceHolderName,carouselCardIndex:y,isWhatsappCarousel:T,isPreview:P})]})):c==s.CHANNEL_TYPE.WEBPUSH?e.jsx("div",Object.assign({style:Object.assign({},null==O?void 0:O.containerStyle)},{children:e.jsx(o.default,{template:m,extraContainerCss:null==O?void 0:O.extraContainerCss})})):e.jsx(e.Fragment,{})};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SingleOption } from "../../dropdown/type";
|
|
2
2
|
export type CUSTOM_VARIABLE = {
|
|
3
3
|
variableName: string;
|
|
4
|
-
type:
|
|
4
|
+
type: CustomVariableType;
|
|
5
5
|
isEditableVariable: boolean;
|
|
6
6
|
updatedValue: string;
|
|
7
7
|
index?: number;
|
|
@@ -11,6 +11,7 @@ export type CUSTOM_VARIABLE = {
|
|
|
11
11
|
value: string;
|
|
12
12
|
}[];
|
|
13
13
|
};
|
|
14
|
+
export type CustomVariableType = 'string' | 'link' | 'image' | 'button' | 'date_time';
|
|
14
15
|
export type QueryParamtype = {
|
|
15
16
|
key: string;
|
|
16
17
|
value: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { WebpushTemplateType } from '../models/WebpushTemplate';
|
|
2
3
|
interface WebpushPreviewProps {
|
|
3
4
|
template: WebpushTemplateType;
|
|
5
|
+
extraContainerCss?: React.CSSProperties;
|
|
4
6
|
}
|
|
5
7
|
declare const WebpushPreview: (props: WebpushPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export default WebpushPreview;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../models/WebpushTemplate.js"),t=require("../utils/TemplateHelperUtils.js"),i=require("./WebpushPreview.styled.js");exports.default=n=>{var l,a,r,E,c,O;const{components:P,webpushBroadcastConfig:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("../models/WebpushTemplate.js"),t=require("../utils/TemplateHelperUtils.js"),i=require("./WebpushPreview.styled.js");exports.default=n=>{var l,a,r,E,c,O;const{components:P,webpushBroadcastConfig:o}=n.template;let _=(new t.TemplateHelperUtils).parseJsonString(P);const T="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F4daae031-3902-4e58-a57c-32f29ea90812?alt=media&token=a7655ba9-6843-47df-91ba-422345e925c3",N=(e,s)=>{let t=0;return e?e.replace(/{{(.*?)}}/g,((e,i)=>{const n=i.trim();if(s&&s.length&&t<s.length){const e=s[t];return t++,e}return`{{${n}}}`})):""},d=N(_[s.WEB_PUSH_COMPONENT_TYPE.TITLE],null==o?void 0:o.title),g=N(null!==(r=null!==(a=null===(l=_[s.WEB_PUSH_COMPONENT_TYPE.BODY])||void 0===l?void 0:l.text)&&void 0!==a?a:_[s.WEB_PUSH_COMPONENT_TYPE.BODY])&&void 0!==r?r:"",null==o?void 0:o.body);return e.jsxs(i.WebpushPreviewContainer,Object.assign({style:Object.assign({},n.extraContainerCss)},{children:[e.jsxs("div",Object.assign({className:"icon--header"},{children:[e.jsx("div",Object.assign({className:"icon-img-container"},{children:e.jsx("img",{src:(null===(E=null==o?void 0:o[s.WEB_PUSH_COMPONENT_TYPE.ICON])||void 0===E?void 0:E.length)?o[s.WEB_PUSH_COMPONENT_TYPE.ICON][0]:_[s.WEB_PUSH_COMPONENT_TYPE.ICON]||T,alt:"icon-image"})})),e.jsxs("div",Object.assign({className:"text--container"},{children:[e.jsx("div",{children:d}),e.jsx("div",Object.assign({style:{marginTop:3}},{children:g}))]}))]})),_[s.WEB_PUSH_COMPONENT_TYPE.IMAGE]&&_[s.WEB_PUSH_COMPONENT_TYPE.IMAGE].length&&e.jsx("div",Object.assign({className:"banner-img-container"},{children:e.jsx("img",{src:(null===(c=null==o?void 0:o[s.WEB_PUSH_COMPONENT_TYPE.IMAGE])||void 0===c?void 0:c.length)?o[s.WEB_PUSH_COMPONENT_TYPE.IMAGE][0]:null!==(O=_[s.WEB_PUSH_COMPONENT_TYPE.IMAGE])&&void 0!==O?O:T,alt:"icon-image"})})),_[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS]&&_[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].length&&e.jsx("div",Object.assign({className:"button-container "+(1===_[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].length?"single-button":"")},{children:_[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].map(((t,i)=>e.jsx("div",Object.assign({className:"each--btn",style:{flex:1===_[s.WEB_PUSH_COMPONENT_TYPE.BUTTONS].length?"0 0 50%":"1"}},{children:e.jsx("div",Object.assign({className:"text-btn"},{children:t.text}))}),`webpush-buttons-${i}`)))}))]}))};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useTemplateModalContext as i}from"../template-context-mapper/context/templateModalContext.js";import a from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import{TitleRegular as o}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as s}from"./models/Channels.js";import d from"./SmsTemplatePreview.js";import p from"./webpush/WebpushPreview.js";import m from"./WhatsAppTemplatePreview.js";const u=u=>{let{template:v,channel:h,whatsAppSpecificMeta:b,templateCreationsInfo:
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as l}from"react/jsx-runtime";import{useTemplateModalContext as i}from"../template-context-mapper/context/templateModalContext.js";import a from"../../utils/StringUtils.js";import{COLORS as n}from"../../constants/Theme.js";import{TitleRegular as o}from"../TypographyStyle.js";import r from"./EmailTemplateThumbnailPreview.js";import{CHANNEL_TYPE as s}from"./models/Channels.js";import d from"./SmsTemplatePreview.js";import p from"./webpush/WebpushPreview.js";import m from"./WhatsAppTemplatePreview.js";const u=u=>{let{template:v,channel:h,whatsAppSpecificMeta:b,templateCreationsInfo:C,hideHeader:y,size:S,onlyTemplateContent:g,emailSpecificMeta:j,smsSpecificMeta:f,showSampleValues:w,carouselCardIndex:T,isWhatsappCarousel:x,isPreview:P,applyBorderBottom:W,webPushSpecificMeta:O,hidePointerEvents:H}=u;var A,I;const{setSelectedCarouselIndex:B}=i();return h===s.SMS?e("div",Object.assign({style:Object.assign({marginTop:C?16:0,border:C?`1px solid ${n.stroke.primary}`:"none",borderRadius:4},null==f?void 0:f.templateContainerStyles)},{children:e(d,{template:v,hideHeader:y,onlyTemplateContent:g,size:null!=S?S:"large",variableStore:null==f?void 0:f.smsVariableStore,display_content:null==f?void 0:f.smsDisplayContent,uniqueId:null==f?void 0:f.uniqueId})})):h===s.EMAIL?e("div",Object.assign({style:Object.assign({marginTop:C?16:0},null==j?void 0:j.templateContainerStyles)},{children:e(r,{template:v,handleViewTemplate:()=>{var e;null===(e=null==j?void 0:j.handleViewTemplate)||void 0===e||e.call(j)},hideHeader:y,hideViewButton:null==j?void 0:j.hideViewButtonForEmail,containerStyle:null==j?void 0:j.containerStyle,emailDisplayContent:null==j?void 0:j.emailDisplayContent,emailHtmlContainerId:null==j?void 0:j.emailHtmlContainerId,applyBorderBottom:W,hidePointerEvents:H})})):h===s.WHATSAPP?t("div",Object.assign({style:Object.assign(Object.assign({},null==b?void 0:b.templateContainerStyles),C?c.WhatsAppWrapper:{}),onClick:()=>{var e,t;if(B&&x){if(-1===T&&!(null===(t=null===(e=null==v?void 0:v.mapping)||void 0===e?void 0:e.body)||void 0===t?void 0:t.length))return;B(null!=T?T:-1)}}},{children:[C?e("div",Object.assign({style:{padding:16}},{children:e(o,{children:a.convertToTitleCase(null!==(A=null==v?void 0:v.label)&&void 0!==A?A:"")})})):e(l,{}),e(m,{showSampleValues:w,showHeader:null==b?void 0:b.showWhatsAppHeader,extras:null==b?void 0:b.whatsAppExtras,template:v,size:C?"small":null!=S?S:"large",containerStyle:Object.assign(Object.assign({borderWidth:C?0:1,borderTopWidth:1},null!==(I=null==b?void 0:b.containerStyle)&&void 0!==I?I:{}),{height:"100%"}),zeroStateComponent:null==b?void 0:b.zeroStateComponent,usePlaceHolderName:null==b?void 0:b.usePlaceHolderName,carouselCardIndex:T,isWhatsappCarousel:x,isPreview:P})]})):h==s.WEBPUSH?e("div",Object.assign({style:Object.assign({},null==O?void 0:O.containerStyle)},{children:e(p,{template:v,extraContainerCss:null==O?void 0:O.extraContainerCss})})):e(l,{})},c={WhatsAppWrapper:{backgroundColor:n.surface.standard,borderRadius:4,border:`1px solid ${n.background.inactive}`,marginTop:16}};export{u as TemplatePreview};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { SingleOption } from "../../dropdown/type";
|
|
2
2
|
export type CUSTOM_VARIABLE = {
|
|
3
3
|
variableName: string;
|
|
4
|
-
type:
|
|
4
|
+
type: CustomVariableType;
|
|
5
5
|
isEditableVariable: boolean;
|
|
6
6
|
updatedValue: string;
|
|
7
7
|
index?: number;
|
|
@@ -11,6 +11,7 @@ export type CUSTOM_VARIABLE = {
|
|
|
11
11
|
value: string;
|
|
12
12
|
}[];
|
|
13
13
|
};
|
|
14
|
+
export type CustomVariableType = 'string' | 'link' | 'image' | 'button' | 'date_time';
|
|
14
15
|
export type QueryParamtype = {
|
|
15
16
|
key: string;
|
|
16
17
|
value: string;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
1
2
|
import { WebpushTemplateType } from '../models/WebpushTemplate';
|
|
2
3
|
interface WebpushPreviewProps {
|
|
3
4
|
template: WebpushTemplateType;
|
|
5
|
+
extraContainerCss?: React.CSSProperties;
|
|
4
6
|
}
|
|
5
7
|
declare const WebpushPreview: (props: WebpushPreviewProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export default WebpushPreview;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{WEB_PUSH_COMPONENT_TYPE as i}from"../models/WebpushTemplate.js";import{TemplateHelperUtils as n}from"../utils/TemplateHelperUtils.js";import{WebpushPreviewContainer as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{WEB_PUSH_COMPONENT_TYPE as i}from"../models/WebpushTemplate.js";import{TemplateHelperUtils as n}from"../utils/TemplateHelperUtils.js";import{WebpushPreviewContainer as s}from"./WebpushPreview.styled.js";const l=l=>{var a,o,c,r,d,m;const{components:g,webpushBroadcastConfig:b}=l.template;let h=(new n).parseJsonString(g);const u="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F4daae031-3902-4e58-a57c-32f29ea90812?alt=media&token=a7655ba9-6843-47df-91ba-422345e925c3",v=(e,t)=>{let i=0;return e?e.replace(/{{(.*?)}}/g,((e,n)=>{const s=n.trim();if(t&&t.length&&i<t.length){const e=t[i];return i++,e}return`{{${s}}}`})):""},p=v(h[i.TITLE],null==b?void 0:b.title),O=v(null!==(c=null!==(o=null===(a=h[i.BODY])||void 0===a?void 0:a.text)&&void 0!==o?o:h[i.BODY])&&void 0!==c?c:"",null==b?void 0:b.body);return e(s,Object.assign({style:Object.assign({},l.extraContainerCss)},{children:[e("div",Object.assign({className:"icon--header"},{children:[t("div",Object.assign({className:"icon-img-container"},{children:t("img",{src:(null===(r=null==b?void 0:b[i.ICON])||void 0===r?void 0:r.length)?b[i.ICON][0]:h[i.ICON]||u,alt:"icon-image"})})),e("div",Object.assign({className:"text--container"},{children:[t("div",{children:p}),t("div",Object.assign({style:{marginTop:3}},{children:O}))]}))]})),h[i.IMAGE]&&h[i.IMAGE].length&&t("div",Object.assign({className:"banner-img-container"},{children:t("img",{src:(null===(d=null==b?void 0:b[i.IMAGE])||void 0===d?void 0:d.length)?b[i.IMAGE][0]:null!==(m=h[i.IMAGE])&&void 0!==m?m:u,alt:"icon-image"})})),h[i.BUTTONS]&&h[i.BUTTONS].length&&t("div",Object.assign({className:"button-container "+(1===h[i.BUTTONS].length?"single-button":"")},{children:h[i.BUTTONS].map(((e,n)=>t("div",Object.assign({className:"each--btn",style:{flex:1===h[i.BUTTONS].length?"0 0 50%":"1"}},{children:t("div",Object.assign({className:"text-btn"},{children:e.text}))}),`webpush-buttons-${n}`)))}))]}))};export{l as default};
|