@bikdotai/bik-component-library 0.0.710 → 0.0.711-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/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/cjs/components/QueryBuilder/helpers/MetaCustomProcessor.d.ts +1 -1
- package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
- package/dist/cjs/components/feature-announcements/FeatureAnnouncement.types.d.ts +27 -0
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.d.ts +14 -0
- package/dist/cjs/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.d.ts +13 -0
- package/dist/cjs/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/cjs/components/feature-announcements/VideoModal.d.ts +8 -0
- package/dist/cjs/components/feature-announcements/VideoModal.js +1 -0
- package/dist/cjs/components/feature-announcements/index.d.ts +6 -0
- package/dist/cjs/components/feature-announcements/useFeatureAnnouncements.d.ts +24 -0
- package/dist/cjs/components/feature-announcements/useFeatureAnnouncements.js +1 -0
- package/dist/cjs/components/template-preview/WhatsApp/ChatBtn.d.ts +0 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatBtn.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.d.ts +0 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
- package/dist/cjs/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +5 -15
- package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +0 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +3 -13
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.js +1 -1
- package/dist/cjs/components/template-preview/models/WhatsappCarouselTemplate.d.ts +3 -3
- package/dist/cjs/components/whats-new/WhatsNew.d.ts +23 -0
- package/dist/cjs/components/whats-new/WhatsNew.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNew.styles.d.ts +11 -0
- package/dist/cjs/components/whats-new/WhatsNew.styles.js +185 -0
- package/dist/cjs/components/whats-new/WhatsNew.types.d.ts +58 -0
- package/dist/cjs/components/whats-new/WhatsNewButton.d.ts +3 -0
- package/dist/cjs/components/whats-new/WhatsNewButton.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNewPanel.d.ts +3 -0
- package/dist/cjs/components/whats-new/WhatsNewPanel.js +1 -0
- package/dist/cjs/components/whats-new/WhatsNewProvider.d.ts +4 -0
- package/dist/cjs/components/whats-new/WhatsNewProvider.js +1 -0
- package/dist/cjs/components/whats-new/index.d.ts +7 -0
- package/dist/cjs/components/whats-new/useWhatsNew.d.ts +9 -0
- package/dist/cjs/components/whats-new/useWhatsNew.js +1 -0
- package/dist/cjs/index.d.ts +2 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/components/EventsTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/EVENTS/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/components/IGTrigger.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts +1 -1
- package/dist/esm/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts +2 -2
- package/dist/esm/components/QueryBuilder/helpers/MetaCustomProcessor.d.ts +1 -1
- package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
- package/dist/esm/components/feature-announcements/FeatureAnnouncement.types.d.ts +27 -0
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.d.ts +14 -0
- package/dist/esm/components/feature-announcements/FeatureAnnouncementProvider.js +1 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.d.ts +13 -0
- package/dist/esm/components/feature-announcements/MajorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.d.ts +13 -0
- package/dist/esm/components/feature-announcements/MinorUpdatePopup.js +1 -0
- package/dist/esm/components/feature-announcements/VideoModal.d.ts +8 -0
- package/dist/esm/components/feature-announcements/VideoModal.js +1 -0
- package/dist/esm/components/feature-announcements/index.d.ts +6 -0
- package/dist/esm/components/feature-announcements/useFeatureAnnouncements.d.ts +24 -0
- package/dist/esm/components/feature-announcements/useFeatureAnnouncements.js +1 -0
- package/dist/esm/components/template-preview/WhatsApp/ChatBtn.d.ts +0 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatBtn.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.d.ts +0 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUiV2.js +5 -5
- package/dist/esm/components/template-preview/WhatsApp/WhatsAppLikePreviewV2.js +5 -15
- package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +0 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +3 -13
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.js +1 -1
- package/dist/esm/components/template-preview/models/WhatsappCarouselTemplate.d.ts +3 -3
- package/dist/esm/components/whats-new/WhatsNew.d.ts +23 -0
- package/dist/esm/components/whats-new/WhatsNew.js +1 -0
- package/dist/esm/components/whats-new/WhatsNew.styles.d.ts +11 -0
- package/dist/esm/components/whats-new/WhatsNew.styles.js +185 -0
- package/dist/esm/components/whats-new/WhatsNew.types.d.ts +58 -0
- package/dist/esm/components/whats-new/WhatsNewButton.d.ts +3 -0
- package/dist/esm/components/whats-new/WhatsNewButton.js +1 -0
- package/dist/esm/components/whats-new/WhatsNewPanel.d.ts +3 -0
- package/dist/esm/components/whats-new/WhatsNewPanel.js +1 -0
- package/dist/esm/components/whats-new/WhatsNewProvider.d.ts +4 -0
- package/dist/esm/components/whats-new/WhatsNewProvider.js +1 -0
- package/dist/esm/components/whats-new/index.d.ts +7 -0
- package/dist/esm/components/whats-new/useWhatsNew.d.ts +9 -0
- package/dist/esm/components/whats-new/useWhatsNew.js +1 -0
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/assets/icons/phone_round.svg.js +0 -1
- package/dist/cjs/components/banner/Banner.d.ts +0 -4
- package/dist/cjs/components/banner/Banner.js +0 -1
- package/dist/cjs/components/banner/Banner.stories.d.ts +0 -9
- package/dist/cjs/components/banner/Banner.styled.d.ts +0 -87
- package/dist/cjs/components/banner/Banner.styled.js +0 -1
- package/dist/cjs/components/banner/BannerInline.d.ts +0 -6
- package/dist/cjs/components/banner/BannerInline.js +0 -1
- package/dist/cjs/components/banner/BannerWithImage.d.ts +0 -6
- package/dist/cjs/components/banner/BannerWithImage.js +0 -1
- package/dist/cjs/components/banner/CardBanner.d.ts +0 -6
- package/dist/cjs/components/banner/CardBanner.js +0 -1
- package/dist/cjs/components/banner/CardBannerWithImage.d.ts +0 -6
- package/dist/cjs/components/banner/CardBannerWithImage.js +0 -1
- package/dist/cjs/components/banner/index.d.ts +0 -2
- package/dist/cjs/components/banner/model.d.ts +0 -77
- package/dist/cjs/components/banner/model.js +0 -1
- package/dist/esm/assets/icons/phone_round.svg.js +0 -1
- package/dist/esm/components/banner/Banner.d.ts +0 -4
- package/dist/esm/components/banner/Banner.js +0 -1
- package/dist/esm/components/banner/Banner.stories.d.ts +0 -9
- package/dist/esm/components/banner/Banner.styled.d.ts +0 -87
- package/dist/esm/components/banner/Banner.styled.js +0 -1
- package/dist/esm/components/banner/BannerInline.d.ts +0 -6
- package/dist/esm/components/banner/BannerInline.js +0 -1
- package/dist/esm/components/banner/BannerWithImage.d.ts +0 -6
- package/dist/esm/components/banner/BannerWithImage.js +0 -1
- package/dist/esm/components/banner/CardBanner.d.ts +0 -6
- package/dist/esm/components/banner/CardBanner.js +0 -1
- package/dist/esm/components/banner/CardBannerWithImage.d.ts +0 -6
- package/dist/esm/components/banner/CardBannerWithImage.js +0 -1
- package/dist/esm/components/banner/index.d.ts +0 -2
- package/dist/esm/components/banner/model.d.ts +0 -77
- package/dist/esm/components/banner/model.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const EventsTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default EventsTrigger;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { QueryBuilderNodeProps } from "../../../
|
|
2
|
+
import { QueryBuilderNodeProps } from "../../../Types/QueryBuilderNodeProps.type";
|
|
3
3
|
declare const IGTrigger: React.FC<QueryBuilderNodeProps>;
|
|
4
4
|
export default IGTrigger;
|
package/dist/cjs/components/QueryBuilder/Triggers/IG/selectors/useIGTriggerNameCacheSelector.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { QueryBuilderAPIData } from "../../../
|
|
1
|
+
import { QueryBuilderAPIData } from "../../../Types/QueryBuilderAPI.type";
|
|
2
2
|
export declare const useIGTriggerNameCacheSelector: () => QueryBuilderAPIData[];
|
package/dist/cjs/components/QueryBuilder/Triggers/components/BaseTriggerQueryBuilderNode.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { DropdownOption } from "../../../dropdown/type";
|
|
3
|
-
import { QueryBuilderProperty } from "../../
|
|
4
|
-
import { QueryBuilderNodeProps } from "../../
|
|
3
|
+
import { QueryBuilderProperty } from "../../Types/QueryBuilder.type";
|
|
4
|
+
import { QueryBuilderNodeProps } from "../../Types/QueryBuilderNodeProps.type";
|
|
5
5
|
declare const BaseTriggerQueryBuilderNode: React.FC<QueryBuilderNodeProps & {
|
|
6
6
|
cacheKey: string;
|
|
7
7
|
propertyAddBtnText: string;
|
|
@@ -36,7 +36,7 @@ export declare class MetaCustomProcessor {
|
|
|
36
36
|
value: {
|
|
37
37
|
operator: string;
|
|
38
38
|
dataType: import("../types").QueryBuilderConnectorType;
|
|
39
|
-
value?: string | number | string[] | number[] | Date
|
|
39
|
+
value?: string | number | string[] | Date | number[] | Date[] | undefined;
|
|
40
40
|
};
|
|
41
41
|
key: string;
|
|
42
42
|
refresh?: boolean | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),i=require("../../assets/icons/Bik_logo.svg.js"),t=require("../../assets/icons/locked.svg.js"),n=require("react"),s=require("../progress-bar/CircularProgressBar.js"),o=require("../../constants/Theme.js"),r=require("../navigation-hyperlink/NavigationHyperlink.js"),u=require("./SidebarPopup.js"),l=require("./SidebarStyles.js"),a=require("./SimpleSidebar.js");const d=i=>{const{icon:t,isActive:n,activeStateIcon:s,hoverStateIcon:r,isHovered:u}=i,l=t,a=s,d=r;return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n?e.jsxRuntimeExports.jsx(a,{width:20,height:20}):u?e.jsxRuntimeExports.jsx(d,{width:20,height:20,color:o.COLORS.surface.standard}):e.jsxRuntimeExports.jsx(l,{width:20,height:20,color:o.COLORS.surface.standard})})},c=i=>{let{option:n,index:s,onClickMainMenuLogic:o,setHandleHoverForFullLayout:r,isDisabled:u,setHoveredComp:a,setPopupMenu:c,mainActiveMenu:v,hoveredComp:p,popupMenu:m}=i;var x,j,g,h,y,k;return e.jsxRuntimeExports.jsx(l.SibeBarMenuItem,{children:e.jsxRuntimeExports.jsxs("div",Object.assign({id:(null===(j=null===(x=n.displayName)||void 0===x?void 0:x.split(" "))||void 0===j?void 0:j.join(""))||n.key.toString(),className:"main--sidebar",onClick:()=>o(n),onMouseEnter:()=>{!u&&r(n)},onMouseOver:()=>{!u&&r(n)},onMouseLeave:()=>{var e;(null===(e=null==n?void 0:n.children)||void 0===e?void 0:e.length)||(a(void 0),c(void 0))},onFocus:()=>{},"aria-hidden":"true"},{children:[n.isNew&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"new-tag "+(n.isLastSticky?"tag-sticky":"")},{children:"NEW"})),n.isLocked&&e.jsxRuntimeExports.jsx("div",Object.assign({className:`locked--channel ${n.isLastSticky?"tag-sticky":""} ${n.is2ndLastSticky?"tag-sticky-2":""}`},{children:e.jsxRuntimeExports.jsx(t.default,{height:16,width:16})})),e.jsxRuntimeExports.jsxs("div",Object.assign({id:(null===(h=null===(g=n.displayName)||void 0===g?void 0:g.split(" "))||void 0===h?void 0:h.join(""))+"_sub"||n.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==v?void 0:v.key)===n.key?"main-menu-active-class":""} \n\t\t\t\t\t${n.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${n.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${n.key===(null==p?void 0:p.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${n.isNew?"new-menu-item":""}`},{children:[e.jsxRuntimeExports.jsx(d,{icon:n.icon,isActive:n.key==(null==v?void 0:v.key),activeStateIcon:null!==(y=n.activeIcon)&&void 0!==y?y:{},hoverStateIcon:null!==(k=n.hoverIcon)&&void 0!==k?k:{},isHovered:n.key==(null==p?void 0:p.key)||n.key==(null==m?void 0:m.key)}),e.jsxRuntimeExports.jsx("div",Object.assign({className:"menu-item-container"},{children:e.jsxRuntimeExports.jsx("p",Object.assign({className:"menu-item-text "+((null==n?void 0:n.key)===(null==v?void 0:v.key)?"active-menu-item-text":"")},{children:n.displayName}))}))]}),s)]}),s)})};exports.BikSidebar=t=>{const{logoSvg:o,allMenuList:d,activeMainMenu:v,activeSubMenu:p,router:m,onClickingMainMenu:x,onClickingSubMenu:j,onClickingAccessUpgradePanel:g,onClickingPopupMenuItem:h,popupMinHeight:y,isNewSidebar:k,menuStyle:b}=t,[S,E]=n.useState(v),[M,R]=n.useState(),[w,C]=n.useState(p),[f,L]=n.useState(!1),[N,O]=n.useState(),[H,P]=n.useState(),[B,I]=n.useState(),[q,_]=n.useState(null),F=n.useMemo((()=>d.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length),[d]);n.useEffect((()=>{E(v)}),[v]),n.useEffect((()=>{C(p)}),[p]);const A=n.useCallback((e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(O(void 0),R(void 0),L(!0),E(e),e.path||x(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?C(null==e?void 0:e.children[0]):C({}),R(void 0),setTimeout((()=>{L(!1)}),1e3))}),[x]),$=n.useCallback((e=>{var i,t;if(W(),R(void 0),O(void 0),"popup"==(null==e?void 0:e.layout)){const i=U();i&&P(i),O(e)}else{const n=document.getElementById((null===(t=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===t?void 0:t.join(""))||e.key.toString());if(n){const e=D(n);I(e)}R(e),z()}}),[]),D=e=>{const i=e.getBoundingClientRect();let t=i.top;const n=e.querySelectorAll("div");let s=null;if(window.innerHeight<=768)return t;if(n.forEach((e=>{e.className.includes("sticky")&&(s=e)})),s){const e=window.innerHeight-i.bottom;t=i.top+e-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),i=require("../../assets/icons/Bik_logo.svg.js"),t=require("../../assets/icons/locked.svg.js"),n=require("react"),s=require("../progress-bar/CircularProgressBar.js"),o=require("../../constants/Theme.js"),r=require("../navigation-hyperlink/NavigationHyperlink.js"),u=require("./SidebarPopup.js"),l=require("./SidebarStyles.js"),a=require("./SimpleSidebar.js");const d=i=>{const{icon:t,isActive:n,activeStateIcon:s,hoverStateIcon:r,isHovered:u}=i,l=t,a=s,d=r;return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:n?e.jsxRuntimeExports.jsx(a,{width:20,height:20}):u?e.jsxRuntimeExports.jsx(d,{width:20,height:20,color:o.COLORS.surface.standard}):e.jsxRuntimeExports.jsx(l,{width:20,height:20,color:o.COLORS.surface.standard})})},c=i=>{let{option:n,index:s,onClickMainMenuLogic:o,setHandleHoverForFullLayout:r,isDisabled:u,setHoveredComp:a,setPopupMenu:c,mainActiveMenu:v,hoveredComp:p,popupMenu:m}=i;var x,j,g,h,y,k;return e.jsxRuntimeExports.jsx(l.SibeBarMenuItem,{children:e.jsxRuntimeExports.jsxs("div",Object.assign({id:(null===(j=null===(x=n.displayName)||void 0===x?void 0:x.split(" "))||void 0===j?void 0:j.join(""))||n.key.toString(),className:"main--sidebar",onClick:()=>o(n),onMouseEnter:()=>{!u&&r(n)},onMouseOver:()=>{!u&&r(n)},onMouseLeave:()=>{var e;(null===(e=null==n?void 0:n.children)||void 0===e?void 0:e.length)||(a(void 0),c(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:[n.isNew&&e.jsxRuntimeExports.jsx("div",Object.assign({className:"new-tag "+(n.isLastSticky?"tag-sticky":"")},{children:"NEW"})),n.isLocked&&e.jsxRuntimeExports.jsx("div",Object.assign({className:`locked--channel ${n.isLastSticky?"tag-sticky":""} ${n.is2ndLastSticky?"tag-sticky-2":""}`},{children:e.jsxRuntimeExports.jsx(t.default,{height:16,width:16})})),e.jsxRuntimeExports.jsxs("div",Object.assign({id:(null===(h=null===(g=n.displayName)||void 0===g?void 0:g.split(" "))||void 0===h?void 0:h.join(""))+"_sub"||n.key.toString()+"_sub",className:`sidebar-menu-item \n\t\t\t\t\t${(null==v?void 0:v.key)===n.key?"main-menu-active-class":""} \n\t\t\t\t\t${n.isLastSticky?"sticky-menu-int":""} \n\t\t\t\t\t${n.is2ndLastSticky?"sticky-menu":""} \n\t\t\t\t\t${n.key===(null==p?void 0:p.key)?"sidebar-menu-item-hover":""} \n\t\t\t\t\t${n.isNew?"new-menu-item":""}`},{children:[e.jsxRuntimeExports.jsx(d,{icon:n.icon,isActive:n.key==(null==v?void 0:v.key),activeStateIcon:null!==(y=n.activeIcon)&&void 0!==y?y:{},hoverStateIcon:null!==(k=n.hoverIcon)&&void 0!==k?k:{},isHovered:n.key==(null==p?void 0:p.key)||n.key==(null==m?void 0:m.key)}),e.jsxRuntimeExports.jsx("div",Object.assign({className:"menu-item-container"},{children:e.jsxRuntimeExports.jsx("p",Object.assign({className:"menu-item-text "+((null==n?void 0:n.key)===(null==v?void 0:v.key)?"active-menu-item-text":"")},{children:n.displayName}))}))]}),s)]}),s)})};exports.BikSidebar=t=>{const{logoSvg:o,allMenuList:d,activeMainMenu:v,activeSubMenu:p,router:m,onClickingMainMenu:x,onClickingSubMenu:j,onClickingAccessUpgradePanel:g,onClickingPopupMenuItem:h,popupMinHeight:y,isNewSidebar:k,menuStyle:b}=t,[S,E]=n.useState(v),[M,R]=n.useState(),[w,C]=n.useState(p),[f,L]=n.useState(!1),[N,O]=n.useState(),[H,P]=n.useState(),[B,I]=n.useState(),[q,_]=n.useState(null),F=n.useMemo((()=>d.filter((e=>e.is2ndLastSticky||e.isLastSticky)).length),[d]);n.useEffect((()=>{E(v)}),[v]),n.useEffect((()=>{C(p)}),[p]);const A=n.useCallback((e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(O(void 0),R(void 0),L(!0),E(e),e.path||x(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?C(null==e?void 0:e.children[0]):C({}),R(void 0),setTimeout((()=>{L(!1)}),1e3))}),[x]),$=n.useCallback((e=>{var i,t;if(W(),R(void 0),O(void 0),"popup"==(null==e?void 0:e.layout)){const i=U();i&&P(i),O(e)}else{const n=document.getElementById((null===(t=null===(i=e.displayName)||void 0===i?void 0:i.split(" "))||void 0===t?void 0:t.join(""))||e.key.toString());if(n){const e=D(n);I(e)}R(e),z()}}),[]),D=e=>{const i=e.getBoundingClientRect();let t=i.top;const n=e.querySelectorAll("div");let s=null;if(window.innerHeight<=768)return t;if(n.forEach((e=>{e.className.includes("sticky")&&(s=e)})),s){const e=window.innerHeight-i.bottom;t=i.top+e-140}return t};n.useEffect((()=>{const e=()=>{const e=U();e&&P(e),T()};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const T=()=>{const e=document.getElementById("_sub-menu"),i=null==e?void 0:e.getBoundingClientRect().height;i&&I(window.innerHeight-i)},U=()=>{var e,i;if(N){const t=(null===(i=null===(e=N.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||N.key.toString()+"_sub",n=document.getElementById(t);if(n){const e=n.getBoundingClientRect();let i=e.top;const t=null!=y?y:320;return e.bottom+t>window.innerHeight&&(i-=e.bottom+t-window.innerHeight),i}return null}},z=()=>{W();const e=setTimeout((()=>R(void 0)),1e4);_(e)},W=()=>{clearTimeout(q)};return e.jsxRuntimeExports.jsxs(l.SideBarContainer,{children:[e.jsxRuntimeExports.jsx("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:o||e.jsxRuntimeExports.jsx(i.default,{})})),e.jsxRuntimeExports.jsxs(l.MainSideBarMenuWrapper,Object.assign({style:b},{children:[null==d?void 0:d.map(((i,t)=>{var s,o;return e.jsxRuntimeExports.jsxs(n.Fragment,{children:[i.path?e.jsxRuntimeExports.jsx(r.NavigationHyperlink,Object.assign({href:i.path,router:m},{children:e.jsxRuntimeExports.jsx(c,{option:i,index:t,onClickMainMenuLogic:A,setHandleHoverForFullLayout:$,isDisabled:f,setHoveredComp:R,setPopupMenu:O,mainActiveMenu:S,hoveredComp:M,popupMenu:N})})):e.jsxRuntimeExports.jsx(c,{option:i,index:t,onClickMainMenuLogic:A,setHandleHoverForFullLayout:$,isDisabled:f,setHoveredComp:R,setPopupMenu:O,mainActiveMenu:S,hoveredComp:M,popupMenu:N}),e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:["popup"===i.layout&&(null===(s=null==N?void 0:N.children)||void 0===s?void 0:s.length)&&e.jsxRuntimeExports.jsx(u.SidebarPopup,{top:null!=H?H:void 0,menuList:null==N?void 0:N.children,onClickingPopupMenu:e=>{h&&h(e),O(void 0)},onMouseLeaveOnMenu:()=>O(void 0)}),(null===(o=null==M?void 0:M.children)||void 0===o?void 0:o.length)&&e.jsxRuntimeExports.jsx(a.SimpleSidebar,{menuList:null==M?void 0:M.children,activeMenu:w,onMouseEnterOnMenu:()=>W(),onMouseLeaveOnMenu:()=>{W(),R(void 0)},left:k?92:88,postion:"fixed",header:M.displayName,theme:"brand",router:m,showAccessUpgradePanel:M.showAccessUpgradePanel,onMenuClick:(e,i)=>{C(e),E(M),R(void 0),O(void 0),i&&j(e)},onUpgrade:g,top:k&&B||0,isNewSidebar:k})]})]},t)})),"number"==typeof t.onboardingPercentage&&e.jsxRuntimeExports.jsx(l.SibeBarMenuItem,{children:e.jsxRuntimeExports.jsx("div",Object.assign({className:"main--sidebar"},{children:e.jsxRuntimeExports.jsx("div",Object.assign({id:"bik-onboarding__checklist",className:"sidebar-menu-item "+(0===F?"sticky-menu":1===F?"sticky-menu-int":"sticky-menu-three")},{children:e.jsxRuntimeExports.jsx(s.default,{percentage:t.onboardingPercentage,width:48})}))}))})]}))]})};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export interface FeatureAnnouncement {
|
|
2
|
+
id: string;
|
|
3
|
+
title: string;
|
|
4
|
+
body: string;
|
|
5
|
+
content: string;
|
|
6
|
+
buttonText: string;
|
|
7
|
+
displayImage: string;
|
|
8
|
+
featureTag: string;
|
|
9
|
+
featureUpdateType: 'Major' | 'Minor';
|
|
10
|
+
image: string;
|
|
11
|
+
module: string[];
|
|
12
|
+
pageUrls: string[];
|
|
13
|
+
productVideo: string;
|
|
14
|
+
redirectUrl: string;
|
|
15
|
+
updates: string;
|
|
16
|
+
visibility: boolean;
|
|
17
|
+
createdAt: any;
|
|
18
|
+
expirationDate?: {
|
|
19
|
+
seconds: number;
|
|
20
|
+
} | string | Date;
|
|
21
|
+
}
|
|
22
|
+
export interface StoreFeatureProgress {
|
|
23
|
+
storeId: string;
|
|
24
|
+
viewedFeatures: {
|
|
25
|
+
[featureId: string]: boolean;
|
|
26
|
+
};
|
|
27
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureAnnouncementRepoInjected, RouterProps } from './useFeatureAnnouncements';
|
|
3
|
+
interface FeatureAnnouncementProviderProps {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
fetchVisibleFeatures: FeatureAnnouncementRepoInjected['fetchVisibleFeatures'];
|
|
6
|
+
getStoreFeatureProgress: FeatureAnnouncementRepoInjected['getStoreFeatureProgress'];
|
|
7
|
+
fetchFeatureById: FeatureAnnouncementRepoInjected['fetchFeatureById'];
|
|
8
|
+
markFeatureAsViewedForStore: FeatureAnnouncementRepoInjected['markFeatureAsViewedForStore'];
|
|
9
|
+
isFeatureApplicableToCurrentPage: FeatureAnnouncementRepoInjected['isFeatureApplicableToCurrentPage'];
|
|
10
|
+
module?: string;
|
|
11
|
+
router?: RouterProps;
|
|
12
|
+
}
|
|
13
|
+
declare const FeatureAnnouncementProvider: React.FC<FeatureAnnouncementProviderProps>;
|
|
14
|
+
export default FeatureAnnouncementProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),t=require("react"),o=require("react-joyride"),n=require("./MajorUpdatePopup.js"),a=require("./MinorUpdatePopup.js"),r=require("./useFeatureAnnouncements.js"),s=require("./VideoModal.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var l=i(o);const u="#007bff";exports.default=i=>{let{children:d,fetchVisibleFeatures:p,getStoreFeatureProgress:c,fetchFeatureById:f,markFeatureAsViewedForStore:b,isFeatureApplicableToCurrentPage:g,module:x,router:h}=i;var m;const{majorUpdateFeatures:k,minorUpdateFeatures:C,isLoading:y,markFeatureAsViewed:S}=r.useFeatureAnnouncements({fetchVisibleFeatures:p,getStoreFeatureProgress:c,fetchFeatureById:f,markFeatureAsViewedForStore:b,isFeatureApplicableToCurrentPage:g,module:x,router:h}),[T,w]=t.useState(null),[B,j]=t.useState(null),[E,v]=t.useState(!1),[F,I]=t.useState([]),[N,R]=t.useState(!1),[P,M]=t.useState([]),[W,q]=t.useState(!1),[O,V]=t.useState(!1),[A,L]=t.useState([]),[U,$]=t.useState(!1),[z,_]=t.useState(!1),[D,G]=t.useState(!1),[H,J]=t.useState(""),[K,Q]=t.useState(!1);t.useEffect((()=>{if(!(k.length>0)||T||y||W||K)0!==k.length||y||_(!0);else{_(!1),$(!1),v(!1),I([]),j(null),L([]);const e=()=>{document.querySelector('[data-testid="whats-new-button"]')?X(k[0]):setTimeout(e,1e3)};e()}}),[k,T,y,W,K]),t.useEffect((()=>{var e;const t=null===(e=null==h?void 0:h.query)||void 0===e?void 0:e.featureId;if(!t||y||0===C.length)return;const o=C.find((e=>e.id===t));if(!o||!o.featureTag)return;$(!0);let n=0;const a=setInterval((()=>{n++;const e=o.featureTag.startsWith("#")||o.featureTag.startsWith(".")||o.featureTag.startsWith("[")?o.featureTag:`#${o.featureTag}`;document.querySelector(e)?(re(o),clearInterval(a)):n>=25&&(console.warn(`FeatureAnnouncements: Timed out waiting for element with selector: ${e}`),clearInterval(a))}),200);return()=>{clearInterval(a)}}),[C,null===(m=null==h?void 0:h.query)||void 0===m?void 0:m.featureId,y]),t.useEffect((()=>{if(C.length>0&&!y&&!E&&!O&&!B&&!U&&z&&!K){let e=null,t=null,o=null,n=!1;const a=()=>{if(n||O||B||U||!z)return;const a=C.filter((e=>{if(!e.featureTag||""===e.featureTag.trim())return!1;const t=e.featureTag.startsWith("#")||e.featureTag.startsWith(".")||e.featureTag.startsWith("[")?e.featureTag:`#${e.featureTag}`;return null!==document.querySelector(t)}));a.length>0&&(L(a),re(a[0]),e&&(e.disconnect(),e=null),t&&(window.removeEventListener("scroll",t),t=null),o&&(clearTimeout(o),o=null))};return e=new MutationObserver((e=>{let t=!1;for(const o of e){if("childList"===o.type&&o.addedNodes.length>0)for(let e=0;e<o.addedNodes.length;e++){const n=o.addedNodes[e];if(n.nodeType===Node.ELEMENT_NODE){const e=n;if(e.id||e.querySelector("[id]")){t=!0;break}}}if(t)break}E||n||O||B||U||!z||!t||(o&&clearTimeout(o),o=setTimeout((()=>{n||O||B||U||!z||a()}),200))})),t=()=>{E||n||O||B||U||!z||(o&&clearTimeout(o),o=setTimeout((()=>{n||O||B||U||!z||a()}),300))},e&&e.observe(document.body,{childList:!0,subtree:!0}),t&&window.addEventListener("scroll",t,{passive:!0}),a(),setTimeout((()=>{n||O||B||U||!z||a()}),100),setTimeout((()=>{n||O||B||U||!z||a()}),1e3),setTimeout((()=>{n||O||B||U||!z||a()}),500),()=>{n=!0,e&&e.disconnect(),t&&window.removeEventListener("scroll",t),o&&clearTimeout(o)}}(0===C.length||y)&&(v(!1),I([]),j(null),L([]),$(!1))}),[C,y,E,O,B,U,z,S,K]);const X=t=>{w(t);const o=k.findIndex((e=>e.id===t.id)),a=k.length,r=[{target:'[data-testid="whats-new-button"]',content:e.jsxRuntimeExports.jsx(n.default,{feature:t,currentIndex:o,totalFeatures:a,onSkip:()=>Y(t),onExplore:()=>Z(t),onPrevious:()=>ee(t),onNext:()=>te(t)}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];M(r),R(!0)},Y=t.useCallback((e=>{(e||T)&&(q(!0),k.forEach((e=>{S(e.id)})),R(!1),w(null),M([]),_(!0),setTimeout((()=>{q(!1)}),500))}),[T,k,S]),Z=t.useCallback((e=>{q(!0),S(e.id),e.productVideo&&(J(e.productVideo),G(!0),Q(!0)),R(!1),w(null),M([]);k.findIndex((t=>t.id===e.id))===k.length-1&&_(!0),setTimeout((()=>{q(!1)}),500)}),[k,S]),ee=t.useCallback((t=>{const o=t||T;if(!o)return;const a=k.findIndex((e=>e.id===o.id));if(a>0){const t=k[a-1];w(t);const o=a-1,r=k.length,s=[{target:'[data-testid="whats-new-button"]',content:e.jsxRuntimeExports.jsx(n.default,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>Y(t),onExplore:()=>Z(t),onPrevious:()=>ee(t),onNext:()=>te(t)}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];M(s)}}),[T,k]),te=t.useCallback((t=>{const o=t||T;if(!o)return;const a=k.findIndex((e=>e.id===o.id));if(a<k.length-1){const t=k[a+1];w(t);const o=a+1,r=k.length,s=[{target:'[data-testid="whats-new-button"]',content:e.jsxRuntimeExports.jsx(n.default,{feature:t,currentIndex:o,totalFeatures:r,onSkip:()=>Y(t),onExplore:()=>Z(t),onPrevious:()=>ee(t),onNext:()=>te(t)}),placement:"bottom-start",placementBeacon:"top-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMajor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"16px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];M(s)}else q(!0),S(o.id),R(!1),w(null),M([]),_(!0),setTimeout((()=>{q(!1)}),500)}),[T,k,S]),oe=()=>{if(k.length>0&&!T){document.querySelector('[data-testid="whats-new-button"]')&&X(k[0])}};t.useEffect((()=>(window.showMajorUpdatePopup=oe,()=>{delete window.showMajorUpdatePopup})),[k,T]);const ne=t.useCallback((e=>{const{action:t}=e;t===o.ACTIONS.CLOSE&&(T&&(q(!0),k.forEach((e=>{S(e.id)})),_(!0),setTimeout((()=>{q(!1)}),500)),R(!1),w(null),M([]))}),[T,k,S]),ae=t.useCallback((e=>{const{action:t}=e;t===o.ACTIONS.CLOSE&&(B&&(V(!0),$(!0),C.forEach((e=>{S(e.id)})),setTimeout((()=>{V(!1)}),500)),v(!1),j(null),I([]))}),[B,C,S]),re=t=>{j(t);const o=A.findIndex((e=>e.id===t.id)),n=A.length,r=[{target:t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,content:e.jsxRuntimeExports.jsx(a.default,{feature:t,currentIndex:o,totalFeatures:n,onSkip:()=>se(t),onExplore:()=>ie(t),onPrevious:()=>le(t),onNext:()=>ue(t)}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];I(r),v(!0)},se=t.useCallback((e=>{(e||B)&&(V(!0),$(!0),C.forEach((e=>{S(e.id)})),v(!1),j(null),I([]),setTimeout((()=>{V(!1)}),500))}),[B,C,S]),ie=t.useCallback((e=>{V(!0),$(!0),S(e.id),e.productVideo&&(J(e.productVideo),G(!0),Q(!0)),v(!1),j(null),I([]),setTimeout((()=>{V(!1)}),500)}),[S]),le=t.useCallback((t=>{const o=t||B;if(!o)return;const n=A.findIndex((e=>e.id===o.id));if(n>0){const t=A[n-1];j(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=n-1,s=A.length,i=[{target:o,content:e.jsxRuntimeExports.jsx(a.default,{feature:t,currentIndex:r,totalFeatures:s,onSkip:()=>se(t),onExplore:()=>ie(t),onPrevious:()=>le(t),onNext:()=>ue(t)}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];I(i)}}),[B,A]),ue=t.useCallback((t=>{const o=t||B;if(!o)return;const n=A.findIndex((e=>e.id===o.id));if(n<A.length-1){const t=A[n+1];j(t);const o=t.featureTag.startsWith("#")||t.featureTag.startsWith(".")||t.featureTag.startsWith("[")?t.featureTag:`#${t.featureTag}`,r=n+1,s=A.length,i=[{target:o,content:e.jsxRuntimeExports.jsx(a.default,{feature:t,currentIndex:r,totalFeatures:s,onSkip:()=>se(t),onExplore:()=>ie(t),onPrevious:()=>le(t),onNext:()=>ue(t)}),placement:"bottom",placementBeacon:"bottom-end",disableBeacon:!0,hideCloseButton:!0,hideSkipButton:!0,hideFooter:!0,offset:0,data:{feature:t,isMinor:!0},styles:{tooltip:{padding:0,backgroundColor:"transparent",borderRadius:"4px",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}}}];I(i)}else V(!0),$(!0),S(o.id),v(!1),j(null),I([]),setTimeout((()=>{V(!1)}),500)}),[B,A,S]);return e.jsxRuntimeExports.jsxs(e.jsxRuntimeExports.Fragment,{children:[d,P.length>0&&e.jsxRuntimeExports.jsx(l.default,{steps:P,run:N,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ne,disableOverlayClose:!0,disableCloseOnEsc:!0,disableOverlay:!0,spotlightClicks:!1,styles:{options:{primaryColor:u,zIndex:1e4,width:"auto",arrowColor:"#212121"},overlay:{backgroundColor:"transparent"},spotlight:{backgroundColor:"transparent",border:"none"},tooltip:{borderRadius:"16px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonClose:{display:"none"},buttonSkip:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}}),F.length>0&&e.jsxRuntimeExports.jsx(l.default,{steps:F,run:E,continuous:!1,showProgress:!1,showSkipButton:!1,callback:ae,disableOverlayClose:!0,disableCloseOnEsc:!0,styles:{options:{primaryColor:u,zIndex:1e4,width:"auto",arrowColor:"#ffffff"},tooltip:{borderRadius:"4px",fontSize:"14px",padding:0,backgroundColor:"transparent",border:"none",filter:"none",boxShadow:"none"},tooltipContent:{padding:0},buttonNext:{display:"none"},buttonBack:{display:"none"},buttonSkip:{display:"none"},buttonClose:{display:"none"}},locale:{back:"Back",close:"Close",last:"Close",next:"Next",skip:"Skip"}}),e.jsxRuntimeExports.jsx(s.VideoModal,{isOpen:D,videoUrl:H,onClose:()=>{G(!1),J(""),Q(!1)}})]})};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureAnnouncement } from './FeatureAnnouncement.types';
|
|
3
|
+
interface MajorUpdatePopupProps {
|
|
4
|
+
feature: FeatureAnnouncement;
|
|
5
|
+
currentIndex: number;
|
|
6
|
+
totalFeatures: number;
|
|
7
|
+
onSkip: () => void;
|
|
8
|
+
onExplore: () => void;
|
|
9
|
+
onPrevious: () => void;
|
|
10
|
+
onNext: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const MajorUpdatePopup: React.FC<MajorUpdatePopupProps>;
|
|
13
|
+
export default MajorUpdatePopup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js");const t=e=>{if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value};exports.default=n=>{let{feature:r,currentIndex:o,totalFeatures:s,onSkip:i,onExplore:l,onPrevious:a,onNext:x}=n;return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:{width:"959px",height:"274px",display:"flex",backgroundColor:"#212121",borderRadius:"4px",overflow:"hidden",position:"relative"}},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),i()},style:{position:"absolute",top:"10px",right:"10px",background:"transparent",border:"none",color:"#BDBDBD",fontSize:"14px",fontWeight:"500",cursor:"pointer",zIndex:10,transition:"all 0.2s"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="#f3f4f6",e.currentTarget.style.color="#374151"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent",e.currentTarget.style.color="#6b7280"}},{children:"Skip"})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:"#212121",width:"480px",height:"274px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",padding:"8px"}},{children:r.displayImage?e.jsxRuntimeExports.jsx("img",{src:r.displayImage,alt:r.title,style:{width:"464px",height:"258px",objectFit:"cover"},onError:e=>{r.image&&(e.target.src=r.image)}}):e.jsxRuntimeExports.jsx("div",Object.assign({style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",width:"290px",height:"258px",display:"flex",alignItems:"center",justifyContent:"center"}},{children:"Feature Preview"}))})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{flex:1,display:"flex",margin:"0 8px 0 0",flexDirection:"column",justifyContent:"space-between",background:"transparent"}},{children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",Object.assign({style:{fontSize:"16px",fontWeight:"600",padding:"36px 0 0 0",color:"#fff",lineHeight:"1.25",textAlign:"left"}},{children:r.title})),e.jsxRuntimeExports.jsx("div",{style:{fontSize:"14px",lineHeight:"1.5",color:"rgba(255, 255, 255, 0.8)",textAlign:"left"},dangerouslySetInnerHTML:{__html:t(r.content||r.body||"")}}),e.jsxRuntimeExports.jsx("div",{children:e.jsxRuntimeExports.jsx("button",Object.assign({onClick:()=>{l()},style:{backgroundColor:"transparent",border:"1px solid #FEC02D",color:"#FEC02D",borderRadius:"4px",fontSize:"14px",fontWeight:"500",cursor:"pointer",width:"154px",height:"32px",transition:"all 0.2s",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center",marginTop:"16px"},onMouseEnter:e=>{e.currentTarget.style.backgroundColor="rgba(254, 192, 45, 0.1)"},onMouseLeave:e=>{e.currentTarget.style.backgroundColor="transparent"}},{children:r.buttonText||"Explore the feature"}))})]}),s>1&&e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"absolute",bottom:"16px",right:"16px",display:"flex",gap:"8px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),a()},disabled:0===o,style:{width:"24px",height:"24px",backgroundColor:"transparent",border:"none",color:0===o?"#666":"#fff",fontSize:"20px",cursor:0===o?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},onMouseEnter:e=>{0!==o&&(e.currentTarget.style.color="#FEC02D")},onMouseLeave:e=>{0!==o&&(e.currentTarget.style.color="#fff")}},{children:"‹"})),e.jsxRuntimeExports.jsx("button",Object.assign({onClick:e=>{e.preventDefault(),e.stopPropagation(),x()},disabled:o===s-1,style:{width:"24px",height:"24px",backgroundColor:"transparent",border:"none",color:o===s-1?"#666":"#fff",fontSize:"20px",cursor:o===s-1?"not-allowed":"pointer",display:"flex",alignItems:"center",justifyContent:"center",transition:"all 0.2s"},onMouseEnter:e=>{o!==s-1&&(e.currentTarget.style.color="#FEC02D")},onMouseLeave:e=>{o!==s-1&&(e.currentTarget.style.color="#fff")}},{children:"›"}))]}))]}))]}))})};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { FeatureAnnouncement } from './FeatureAnnouncement.types';
|
|
3
|
+
interface MinorUpdatePopupProps {
|
|
4
|
+
feature: FeatureAnnouncement;
|
|
5
|
+
currentIndex: number;
|
|
6
|
+
totalFeatures: number;
|
|
7
|
+
onSkip: () => void;
|
|
8
|
+
onExplore: () => void;
|
|
9
|
+
onPrevious: () => void;
|
|
10
|
+
onNext: () => void;
|
|
11
|
+
}
|
|
12
|
+
declare const MinorUpdatePopup: React.FC<MinorUpdatePopupProps>;
|
|
13
|
+
export default MinorUpdatePopup;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js");const t=e=>{if(!e)return"";const t=document.createElement("textarea");return t.innerHTML=e,t.value};exports.default=i=>{let{feature:n,currentIndex:s,totalFeatures:r,onSkip:o,onExplore:x,onPrevious:l,onNext:p}=i;return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:{width:"519px",height:"160px",display:"flex",backgroundColor:"#ffffff",borderRadius:"4px",overflow:"hidden",position:"relative",boxShadow:"0 20px 25px rgba(0, 0, 0, 0.1), 0 10px 10px rgba(0, 0, 0, 0.04)"}},{children:[e.jsxRuntimeExports.jsx("div",Object.assign({style:{backgroundColor:"#f9fafb",borderRadius:"4px",position:"relative",display:"flex",alignItems:"center",justifyContent:"center",margin:"13px 10px 13px 10px",width:"235px",minWidth:"235px",maxWidth:"235px",height:"134px"}},{children:n.displayImage?e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"relative",width:"235px",height:"134px"}},{children:[e.jsxRuntimeExports.jsx("img",{src:n.displayImage,alt:n.title,style:{width:"235px",height:"134px",objectFit:"cover",borderRadius:"4px",display:"block"},onError:e=>{n.image&&(e.target.src=n.image)}}),e.jsxRuntimeExports.jsx("div",Object.assign({style:{position:"absolute",top:"0px",left:"0px",right:"0px",height:"27px",backgroundColor:"rgba(0, 0, 0, 0.26)",borderRadius:"4px 4px 4px 4px",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10}},{children:e.jsxRuntimeExports.jsx("span",Object.assign({style:{color:"#ffffff",fontWeight:"400",fontSize:"14px"}},{children:"New feature"}))}))]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:{color:"#9ca3af",fontSize:"14px",textAlign:"center",width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center",backgroundColor:"#f3f4f6",borderRadius:"4px"}},{children:"Feature Preview"}))})),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{flex:1,display:"flex",margin:"13px 13px 13px 3px",flexDirection:"column",justifyContent:"space-between",background:"transparent"}},{children:[e.jsxRuntimeExports.jsxs("div",{children:[e.jsxRuntimeExports.jsx("h3",Object.assign({style:{fontSize:"16px",fontWeight:"600",padding:"0 0 0 0",color:"#212121",lineHeight:"1.25",textAlign:"left"}},{children:n.title})),e.jsxRuntimeExports.jsx("div",{style:{fontSize:"12px",fontWeight:"400",lineHeight:"1.2",color:"#616161",textAlign:"left",maxHeight:"48px",overflow:"hidden",display:"-webkit-box",WebkitLineClamp:3,WebkitBoxOrient:"vertical"},dangerouslySetInnerHTML:{__html:t(n.content||n.body||"")}})]}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"absolute",bottom:"13px",right:"10px",display:"flex",gap:"16px",alignItems:"center"}},{children:[e.jsxRuntimeExports.jsx("span",Object.assign({onClick:o,style:{color:"#4B1583",fontSize:"14px",fontWeight:"500",cursor:"pointer",transition:"all 0.2s"}},{children:"Understood"})),n.productVideo&&e.jsxRuntimeExports.jsx("button",Object.assign({onClick:()=>{x()},style:{backgroundColor:"#4B1583",border:"none",color:"#ffffff",borderRadius:"4px",fontSize:"14px",fontWeight:"500",cursor:"pointer",width:"154px",height:"32px",transition:"all 0.2s",textAlign:"center",display:"flex",alignItems:"center",justifyContent:"center"}},{children:n.buttonText||"Explore the feature"}))]}))]}))]}))})};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js");exports.VideoModal=t=>{let{isOpen:o,videoUrl:r,onClose:i}=t;if(!o)return null;const s=r.includes("youtube.com")||r.includes("youtu.be")?r.replace("watch?v=","embed/").replace("youtu.be/","youtube.com/embed/"):r,n=r.includes("youtube.com")||r.includes("youtu.be");return e.jsxRuntimeExports.jsx("div",Object.assign({style:{position:"fixed",top:0,left:0,right:0,bottom:0,backgroundColor:"rgba(0, 0, 0, 0.9)",zIndex:2e3,display:"flex",justifyContent:"center",alignItems:"center",padding:"20px"},onClick:e=>{e.target===e.currentTarget&&i()}},{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:{position:"relative",width:"90vw",height:"90vh",maxWidth:"1200px",maxHeight:"800px",backgroundColor:"black",borderRadius:"12px",overflow:"hidden",boxShadow:"0 25px 50px rgba(0, 0, 0, 0.8)"},onClick:e=>e.stopPropagation()},{children:[e.jsxRuntimeExports.jsx("button",Object.assign({onClick:i,style:{position:"absolute",top:"20px",right:"20px",background:"rgba(0, 0, 0, 0.7)",border:"none",color:"white",fontSize:"24px",width:"40px",height:"40px",borderRadius:"50%",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",zIndex:10,transition:"background-color 0.2s"},onMouseOver:e=>{e.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.9)"},onMouseOut:e=>{e.currentTarget.style.backgroundColor="rgba(0, 0, 0, 0.7)"}},{children:"×"})),e.jsxRuntimeExports.jsx("div",Object.assign({style:{width:"100%",height:"100%",display:"flex",alignItems:"center",justifyContent:"center"}},{children:r?n?e.jsxRuntimeExports.jsx("iframe",{width:"100%",height:"100%",src:s,title:"Product Video",frameBorder:"0",allow:"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share",allowFullScreen:!0,style:{borderRadius:"12px"}}):e.jsxRuntimeExports.jsxs("video",Object.assign({controls:!0,autoPlay:!0,style:{width:"100%",height:"100%",objectFit:"contain",borderRadius:"12px"}},{children:[e.jsxRuntimeExports.jsx("source",{src:r,type:"video/mp4"}),e.jsxRuntimeExports.jsx("source",{src:r,type:"video/webm"}),e.jsxRuntimeExports.jsx("source",{src:r,type:"video/ogg"}),"Your browser does not support the video tag."]})):e.jsxRuntimeExports.jsx("div",Object.assign({style:{color:"white",fontSize:"18px",textAlign:"center"}},{children:"No video available"}))}))]}))}))};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as FeatureAnnouncementProvider } from './FeatureAnnouncementProvider';
|
|
2
|
+
export { default as MajorUpdatePopup } from './MajorUpdatePopup';
|
|
3
|
+
export { default as MinorUpdatePopup } from './MinorUpdatePopup';
|
|
4
|
+
export { VideoModal } from './VideoModal';
|
|
5
|
+
export * from './useFeatureAnnouncements';
|
|
6
|
+
export * from './FeatureAnnouncement.types';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { FeatureAnnouncement } from './FeatureAnnouncement.types';
|
|
2
|
+
export interface FeatureAnnouncementRepoInjected {
|
|
3
|
+
fetchVisibleFeatures: (module?: string) => Promise<[any, FeatureAnnouncement[] | null]>;
|
|
4
|
+
getStoreFeatureProgress: (storeId: string) => Promise<[any, any | null]>;
|
|
5
|
+
fetchFeatureById: (featureId: string) => Promise<[any, FeatureAnnouncement | null]>;
|
|
6
|
+
markFeatureAsViewedForStore: (storeId: string, featureId: string) => Promise<[any]>;
|
|
7
|
+
isFeatureApplicableToCurrentPage: (feature: FeatureAnnouncement) => boolean;
|
|
8
|
+
module?: string;
|
|
9
|
+
}
|
|
10
|
+
export interface RouterProps {
|
|
11
|
+
pathname: string;
|
|
12
|
+
query: Record<string, string | string[] | undefined>;
|
|
13
|
+
}
|
|
14
|
+
export declare const useFeatureAnnouncements: ({ fetchVisibleFeatures, getStoreFeatureProgress, fetchFeatureById, markFeatureAsViewedForStore, isFeatureApplicableToCurrentPage, module, router, }: FeatureAnnouncementRepoInjected & {
|
|
15
|
+
router?: RouterProps | undefined;
|
|
16
|
+
}) => {
|
|
17
|
+
features: FeatureAnnouncement[];
|
|
18
|
+
majorUpdateFeatures: FeatureAnnouncement[];
|
|
19
|
+
minorUpdateFeatures: FeatureAnnouncement[];
|
|
20
|
+
isLoading: boolean;
|
|
21
|
+
error: string | null;
|
|
22
|
+
markFeatureAsViewed: (featureId: string) => Promise<void>;
|
|
23
|
+
refetch: () => Promise<void>;
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../_virtual/_tslib.js"),t=require("react");exports.useFeatureAnnouncements=r=>{let{fetchVisibleFeatures:a,getStoreFeatureProgress:o,fetchFeatureById:n,markFeatureAsViewedForStore:i,isFeatureApplicableToCurrentPage:l,module:u,router:s}=r;const c=(()=>{const[e,r]=t.useState(null);return t.useEffect((()=>{if("undefined"!=typeof window){let e=null;try{if(e=localStorage.getItem("storeId")||localStorage.getItem("Bik/StoreId")||localStorage.getItem("currentStore")||localStorage.getItem("store"),!e){const t=localStorage.getItem("Bik/CurrentUser");t&&(e=JSON.parse(t).storeId)}e||(e=new URLSearchParams(window.location.search).get("storeId"))}catch(e){console.error("FeatureAnnouncements: Failed to get store ID",e)}r(e)}}),[]),e})(),[d,f]=t.useState([]),[p,g]=t.useState([]),[y,m]=t.useState([]),[w,v]=t.useState(!1),[F,h]=t.useState(null),D=t.useCallback((()=>e.__awaiter(void 0,void 0,void 0,(function*(){if(c){v(!0),h(null);try{const[e,t]=yield a(u);if(e||!t)return console.error("FeatureAnnouncements: Failed to fetch features",e),void h("Failed to fetch features");const[r,n]=yield o(c);r&&console.warn("FeatureAnnouncements: Progress fetch failed, treating all features as new",r);const i=new Date,s="undefined"!=typeof window?window.location.pathname:"",d=e=>{if(!e.expirationDate)return!0;let t;return"object"==typeof e.expirationDate&&null!==e.expirationDate&&("seconds"in e.expirationDate||"nanoseconds"in e.expirationDate)?t=new Date(1e3*e.expirationDate.seconds):"string"==typeof e.expirationDate?t=new Date(e.expirationDate):e.expirationDate instanceof Date&&(t=e.expirationDate),!(!t||isNaN(t.getTime()))&&i<t},p=e=>{if("Major"===e.featureUpdateType){let t=[];return Array.isArray(e.pageUrls)?t=e.pageUrls:"object"==typeof e.pageUrls&&null!==e.pageUrls&&"length"in e.pageUrls&&(t=Array.from(e.pageUrls)),t.includes(s)}return!0},y=t.filter((e=>{var t;return!((null===(t=null==n?void 0:n.viewedFeatures)||void 0===t?void 0:t[e.id])||!1)&&l(e)&&d(e)&&p(e)})),w=y.filter((e=>"Major"===e.featureUpdateType)),v=y.filter((e=>"Minor"===e.featureUpdateType));f(y),g(w),setTimeout((()=>{m(v)}),2e3)}catch(e){console.error("FeatureAnnouncements: Unexpected error in fetchFeatures",e),h("An unexpected error occurred")}finally{v(!1)}}}))),[c,a,o,l,u]),S=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){v(!0),h(null);try{const[e,r]=yield n(t);if(e||!r)return void h("Failed to fetch feature by ID");"Major"===r.featureUpdateType?g([r]):m([r]),f([r])}catch(e){h("An unexpected error occurred while fetching by ID")}finally{v(!1)}}))),[n]),x=t.useCallback((t=>e.__awaiter(void 0,void 0,void 0,(function*(){if(!c)return;const[e]=yield i(c,t);e?(console.warn("FeatureAnnouncements: Failed to mark feature as viewed, removing from local state anyway",e),f((e=>e.filter((e=>e.id!==t)))),g((e=>e.filter((e=>e.id!==t)))),m((e=>e.filter((e=>e.id!==t))))):(f((e=>e.filter((e=>e.id!==t)))),g((e=>e.filter((e=>e.id!==t)))),m((e=>e.filter((e=>e.id!==t)))))}))),[c,i]);return t.useEffect((()=>{if(!s)return void D();const e=s.query.featureId;e?S(e):D()}),[null==s?void 0:s.query,D,S]),{features:d,majorUpdateFeatures:p,minorUpdateFeatures:y,isLoading:w,error:F,markFeatureAsViewed:x,refetch:D}};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),s=require("./ChatUI.style.js");exports.ChatBtn=n=>{let{Icon:i,text:o,extraContent:l,placeholder:a,textTypography:c,size:p
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("../../TypographyStyle.js"),r=require("../../../constants/Theme.js"),s=require("./ChatUI.style.js");exports.ChatBtn=n=>{let{Icon:i,text:o,extraContent:l,placeholder:a,textTypography:c,size:p}=n;const x=c||t.BodySecondary;return e.jsxRuntimeExports.jsx(s.ChatBtnContainer,{children:e.jsxRuntimeExports.jsxs("div",Object.assign({style:{textAlign:"center",maxWidth:"100%"}},{children:[e.jsxRuntimeExports.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"}},{children:[i&&e.jsxRuntimeExports.jsx(i,{color:r.COLORS.special.brand.facebook,height:16,width:16,style:{marginRight:8}}),e.jsxRuntimeExports.jsx(x,Object.assign({style:{color:r.COLORS.special.brand.facebook,textAlign:"center",fontSize:"small"===p?12:14,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},{children:o}))]})),!!l&&e.jsxRuntimeExports.jsx(t.Caption,Object.assign({style:{marginTop:2,color:r.COLORS.content.placeholder,textOverflow:"ellipsis",whiteSpace:"nowrap",overflow:"hidden"}},{children:a?function(e){return e.replace("[[","").replace("]]","").replace(/([A-Z])/g," $1").replace(/^./,(function(e){return e.toUpperCase()}))}(a):l}))]}))})};
|
|
@@ -1,3 +1,2 @@
|
|
|
1
1
|
import { WhatsappLikePreviewTypes } from '../models/WhatsAppTemplate';
|
|
2
|
-
export declare const HtmlContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
2
|
export declare const ChatUIV2: (props: WhatsappLikePreviewTypes) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("../../../assets/icons/
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("../../../assets/icons/copy-code-icon.svg.js"),s=require("../../../assets/icons/halfRectangle.svg.js"),r=require("../../../assets/icons/phone.svg.js"),i=require("../../../assets/icons/qrb.svg.js"),o=require("../../../assets/icons/RedirectToNew.svg.js"),n=require("styled-components"),a=require("../../template-context-mapper/context/templateModalContext.js"),l=require("../../tooltips/Tooltip.js"),x=require("../../TypographyStyle.js"),d=require("../../../constants/Theme.js"),p=require("../helpers/VariableEditorHelper.js"),u=require("../models/TemplateMeta.js"),m=require("./ChatBtn.js"),j=require("./ChatUI.style.js"),c=require("./LimitedTimeOffer/LimitedTimeOffer.index.js"),h=require("./MediaCard.js");function E(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var T=E(n);const f=T.default.div`
|
|
2
2
|
position: absolute;
|
|
3
3
|
width: 8px;
|
|
4
4
|
height: 8px;
|
|
5
5
|
left: -7.7px;
|
|
6
6
|
top: -8px;
|
|
7
|
-
`,R=
|
|
7
|
+
`,R=T.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: ${d.COLORS.content.primary};
|
|
15
15
|
word-wrap: break-word;
|
|
16
|
-
`,
|
|
16
|
+
`,g=T.default(R)`
|
|
17
17
|
font-weight: 600;
|
|
18
18
|
margin-bottom: 8px;
|
|
19
|
-
`,
|
|
19
|
+
`,y=new p.VariableEditorHelper;exports.ChatUIV2=n=>{const{bodyText:d,footerText:p,headerMediaType:E,headerText:T,headerAssetLink:C,headerAssetName:v,quickReplybtn:b,ctaBtn:q,actionTypes:O,extras:_,showHeader:w,imagePreviewStyles:P,size:I,bodyVariableList:S,headerVariableList:L,buttons:A,limitedTimeOfferComponent:M,carouselCardIndex:N,isWhatsappCarousel:B,isPreview:H}=n,Y=y.format(null==d?void 0:d.replace(/</g,"<").replace(/>/g,">"),S),D=y.format(null==T?void 0:T.replace(/</g,"<").replace(/>/g,">"),L),{selectedCarouselIndex:F,isProductCarouselType:U,errorIndexes:V,isCarouselHovered:k}=a.useTemplateModalContext(),z={COPY_CODE:t.default,PHONE_NUMBER:r.default,URL:o.default,QUICK_REPLY:i.default};return e.jsxRuntimeExports.jsxs(j.Container,Object.assign({isCarouselCard:null!=N&&N>-1,showBorder:null!=N&&N===F||U&&null!=N&&N>-1&&null!=F&&F>-1,hasError:null==V?void 0:V.includes(null!=N?N:-2),isWhatsappCarousel:B,isPreview:H,showDashedBorder:U&&k&&(null!=F?F:-1)<0&&(null!=N?N:-1)>-1},{children:[!B&&e.jsxRuntimeExports.jsx(f,{children:e.jsxRuntimeExports.jsx(s.default,{color:"white",height:8,width:8})}),E===u.HEADER_TYPES.TEXT?e.jsxRuntimeExports.jsx(g,{dangerouslySetInnerHTML:{__html:D}}):E!==u.HEADER_TYPES.NONE?e.jsxRuntimeExports.jsx(h.MediaCard,{headerAssetLink:C,headerAssetName:v,mediaType:E,imagePreviewStyles:E===u.HEADER_TYPES.IMAGE?P:{}}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),(null==M?void 0:M.dateTime)?e.jsxRuntimeExports.jsx(c.LimitedTimeOffer,{text:M.text,dateTime:M.dateTime,code:M.code}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),!!d&&e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsx(R,{dangerouslySetInnerHTML:{__html:Y},style:{flex:1}})}),e.jsxRuntimeExports.jsxs(j.FooterWrapper,{children:[e.jsxRuntimeExports.jsx(l.Tooltip,Object.assign({body:null!=p?p:"",placement:"top"},{children:e.jsxRuntimeExports.jsx(j.FooterText,Object.assign({style:{flex:1}},{children:p}))})),e.jsxRuntimeExports.jsx(j.TimeStamp,{children:"16:48"})]}),A&&A.length>0?A.map(((t,s)=>e.jsxRuntimeExports.jsx(m.ChatBtn,{text:"COPY_CODE"===t.type?"Copy code":t.text,Icon:z[t.type],size:I},s))):O===u.ACTIONS_TYPES.QUICK_REPLY?e.jsxRuntimeExports.jsx("div",{children:null==b?void 0:b.map(((t,s)=>e.jsxRuntimeExports.jsx(m.ChatBtn,{text:t.text},s)))}):O===u.ACTIONS_TYPES.CTA_BTN?e.jsxRuntimeExports.jsx("div",{children:null==q?void 0:q.map(((t,s)=>e.jsxRuntimeExports.jsx(m.ChatBtn,{textTypography:w?x.Caption:x.BodySecondary,extraContent:_?t.extra:void 0,placeholder:t.placeholder,text:t.text,Icon:"phoneNumber"===t.type?r.default:o.default,size:I},s)))}):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{})]}))};
|
|
@@ -1,21 +1,11 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("
|
|
2
|
-
background-image: ${e=>e.isWhatsappCarousel?"none":`url(${
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../node_modules/react/jsx-runtime.js"),t=require("styled-components"),s=require("../../template-context-mapper/context/templateModalContext.js"),r=require("../../template-context-mapper/utils/constants.js"),a=require("../../TypographyStyle.js"),i=require("../../../constants/Theme.js"),o=require("../utils/getPreviewPropLen.js"),n=require("./ChatHeader.js"),p=require("./ChatUiV2.js");function u(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var x=u(t);const l=x.default.div`
|
|
2
|
+
background-image: ${e=>e.isWhatsappCarousel?"none":`url(${r.BACKGROUND_PREVIEW_IMAGE})`};
|
|
3
3
|
border-radius: 4px;
|
|
4
4
|
background-repeat: no-repeat;
|
|
5
5
|
background-position: center;
|
|
6
6
|
background-size: cover;
|
|
7
7
|
position: relative;
|
|
8
8
|
height: ${e=>e.isWhatsappCarousel?"100%":"auto"};
|
|
9
|
-
`,
|
|
10
|
-
color: ${
|
|
11
|
-
|
|
12
|
-
margin: 4px;
|
|
13
|
-
margin-top: -4px;
|
|
14
|
-
background-color: ${o.BASE_COLORS.grayscale[50]};
|
|
15
|
-
border-radius: 6px;
|
|
16
|
-
.flex-align-center-gap {
|
|
17
|
-
display: flex;
|
|
18
|
-
align-items: center;
|
|
19
|
-
gap: 8px;
|
|
20
|
-
}
|
|
21
|
-
`;exports.WhatsappLikePreviewV2=s=>{const{hideDeviceContainerInPreview:i}=r.useTemplateModalContext();return 3===x.getPreviewPropLen(s)?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:s.zeroStateComponent}):i?e.jsxRuntimeExports.jsx(u.ChatUIV2,Object.assign({showHeader:s.showHeader},s)):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(m,Object.assign({style:s.containerStyle,showHeader:s.showHeader,isWhatsappCarousel:s.isWhatsappCarousel},{children:[s.showHeader&&e.jsxRuntimeExports.jsx(p.default,{}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{padding:"small"===s.size?"12px 32px 12px 12px":`16px ${s.isWhatsappCarousel?"0px":"56px"} ${s.isWhatsappCarousel?"2px":"16px"} 16px`,height:"100%",overflowY:"auto"}},{children:[!s.hidePreviewText&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginBottom:16}},{children:e.jsxRuntimeExports.jsx(c,{children:"Preview"})})),e.jsxRuntimeExports.jsx(u.ChatUIV2,Object.assign({showHeader:s.showHeader},s)),s.showCallPermissionCard&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginTop:16}},{children:e.jsxRuntimeExports.jsx(u.ChatUIV2,Object.assign({hideFooter:!0,headerMediaType:n.HEADER_TYPES.NONE,textType:"html",isPreview:s.isPreview,zeroStateComponent:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{}),buttons:[{text:"Choose preference",type:"CALL_PERMISSION",flowId:"",flowName:""}]},{children:e.jsxRuntimeExports.jsxs(h,{children:[e.jsxRuntimeExports.jsxs(u.HtmlContainer,Object.assign({className:"flex-align-center-gap"},{children:[e.jsxRuntimeExports.jsx(t.default,{width:30,height:30}),e.jsxRuntimeExports.jsx(a.TitleSmall,{children:s.callPermissionText?`${s.callPermissionText}`:'Can Make "Merchant Name" call you?'})]})),e.jsxRuntimeExports.jsxs(l.FooterWrapper,{children:[e.jsxRuntimeExports.jsx(l.FooterText,{style:{flex:1}}),e.jsxRuntimeExports.jsx(l.TimeStamp,{children:"16:48"})]})]})}))}))]}))]}))})};
|
|
9
|
+
`,d=x.default(a.TitleRegular)`
|
|
10
|
+
color: ${i.COLORS.content.primary};
|
|
11
|
+
`;exports.WhatsappLikePreviewV2=t=>{const{hideDeviceContainerInPreview:r}=s.useTemplateModalContext();return 3===o.getPreviewPropLen(t)?e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:t.zeroStateComponent}):r?e.jsxRuntimeExports.jsx(p.ChatUIV2,Object.assign({showHeader:t.showHeader},t)):e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:e.jsxRuntimeExports.jsxs(l,Object.assign({style:t.containerStyle,showHeader:t.showHeader,isWhatsappCarousel:t.isWhatsappCarousel},{children:[t.showHeader&&e.jsxRuntimeExports.jsx(n.default,{}),e.jsxRuntimeExports.jsxs("div",Object.assign({style:{padding:"small"===t.size?"12px 32px 12px 12px":`16px ${t.isWhatsappCarousel?"0px":"56px"} ${t.isWhatsappCarousel?"2px":"16px"} 16px`,height:"100%",overflowY:"auto"}},{children:[!t.hidePreviewText&&e.jsxRuntimeExports.jsx("div",Object.assign({style:{marginBottom:16}},{children:e.jsxRuntimeExports.jsx(d,{children:"Preview"})})),e.jsxRuntimeExports.jsx(p.ChatUIV2,Object.assign({showHeader:t.showHeader},t))]}))]}))})};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),l=require("react"),t=require("../template-context-mapper/context/templateModalContext.js"),a=require("./helpers/TemplateCreatorHelper.js"),i=require("./helpers/templateMiscHelper.js"),r=require("./models/TemplateMeta.js"),o=require("./RCS/RCSTemplateLikePreview.js"),n=require("./utils/TemplateHelperUtils.js"),d=require("./WhatsApp/WhatsAppLikePreview.js"),s=require("./WhatsApp/WhatsAppLikePreviewV2.js");exports.default=u=>{let{template:p,extras:v,containerStyle:x,usePlaceHolderName:m,showHeader:h,zeroStateComponent:c,size:b,showSampleValues:T,carouselCardIndex:y,isWhatsappCarousel:j,isPreview:w,channel:C}=u;var N,
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../node_modules/react/jsx-runtime.js"),l=require("react"),t=require("../template-context-mapper/context/templateModalContext.js"),a=require("./helpers/TemplateCreatorHelper.js"),i=require("./helpers/templateMiscHelper.js"),r=require("./models/TemplateMeta.js"),o=require("./RCS/RCSTemplateLikePreview.js"),n=require("./utils/TemplateHelperUtils.js"),d=require("./WhatsApp/WhatsAppLikePreview.js"),s=require("./WhatsApp/WhatsAppLikePreviewV2.js");exports.default=u=>{let{template:p,extras:v,containerStyle:x,usePlaceHolderName:m,showHeader:h,zeroStateComponent:c,size:b,showSampleValues:T,carouselCardIndex:y,isWhatsappCarousel:j,isPreview:w,channel:C}=u;var N,V,k,E,P,R,S,f,L,B,A,g,q,F,H,O,W,I,M,D,U,_,z,Y,G,J,K,Q,X,Z;const{selectedCarouselIndex:$,pod:ee}=t.useTemplateModalContext(),[le,te]=l.useState(),ae=new a.TemplateCreatorHelper,ie=new n.TemplateHelperUtils,re=[];if((null===(V=null===(N=null==le?void 0:le.ctaBtn)||void 0===N?void 0:N.phoneNumber)||void 0===V?void 0:V.isChecked)&&re.push({type:"phoneNumber",text:null!==(k=le.ctaBtn.phoneNumber.btnText)&&void 0!==k?k:"",extra:null!==(E=le.ctaBtn.phoneNumber.phoneNumber)&&void 0!==E?E:""}),(null===(R=null===(P=null==le?void 0:le.ctaBtn)||void 0===P?void 0:P.websiteLinkBtn)||void 0===R?void 0:R.isChecked)&&re.push({type:"website",text:null!==(S=le.ctaBtn.websiteLinkBtn.btnText)&&void 0!==S?S:"",extra:null!==(L=null===(f=le.ctaBtn.websiteLinkBtn)||void 0===f?void 0:f.linkOpens)&&void 0!==L?L:"",placeholder:null!==(B=le.ctaBtn.websiteLinkBtn.placeholder)&&void 0!==B?B:""}),l.useEffect((()=>{p&&ae.parseUITemplateFromDBFormat({dbFormattedTemplate:p,isDuplicate:!1,showSampleValues:T,isV2:!p.htmlContentUrl,pod:ee}).then((e=>{te(Object.assign({},e))}))}),[p,T]),l.useEffect((()=>{p&&ae.parseUITemplateFromDBFormat({dbFormattedTemplate:p,isDuplicate:!1,showSampleValues:T,isV2:!p.htmlContentUrl,pod:ee}).then((e=>{te(Object.assign({},e))}))}),[$]),!p)return e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:c});if(i.isRCSChannel(C||(null==p?void 0:p.channel))){const l=ae.parseTemplateConfiguration(p);return e.jsxRuntimeExports.jsx(o.RCSTemplateLikePreview,{showHeader:h,containerPadding:"large"===b?"16px 36px 12px 16px":"12px 36px 12px 12px",containerStyle:x,textType:"html",bodyText:null==le?void 0:le.bodyText,titleText:null==le?void 0:le.titleText,footerText:null==le?void 0:le.footerText,headerMediaType:(null==le?void 0:le.headerType)||r.HEADER_TYPES.NONE,headerText:null==le?void 0:le.headerText,headerAssetLink:null!==(A=null==le?void 0:le.headerAssetLink)&&void 0!==A?A:"",headerAssetName:null!==(g=null==le?void 0:le.headerAssetName)&&void 0!==g?g:"",quickReplybtn:null==le?void 0:le.quickReply,ctaBtn:re,actionTypes:null==le?void 0:le.actionsType,extras:v,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},carouselCardIndex:y,zeroStateComponent:null!=c?c:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:" "}),bodyVariableList:null!==(F=null===(q=null==le?void 0:le.bodyVariables)||void 0===q?void 0:q.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==F?F:[],headerVariableList:null!==(O=null===(H=null==le?void 0:le.headerVariables)||void 0===H?void 0:H.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==O?O:[],titleVariableList:null!==(I=null===(W=null==le?void 0:le.titleVariables)||void 0===W?void 0:W.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==I?I:[],buttons:null==le?void 0:le.allButtons,isWhatsappCarousel:j,isPreview:w,templateConfiguration:l})}return p.htmlContentUrl?e.jsxRuntimeExports.jsx(d.WhatsappLikePreview,{showHeader:h,containerPadding:"large"===b?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:x,textType:"html",bodyText:ie.whatsappOnlyFillVariablesValueInBodyText(null!==(G=null==le?void 0:le.bodyText)&&void 0!==G?G:"",null!==(J=null==le?void 0:le.bodyVariables)&&void 0!==J?J:[],m),footerText:null==le?void 0:le.footerText,headerMediaType:(null==le?void 0:le.headerType)||r.HEADER_TYPES.NONE,headerText:ie.fillVariablesValInBodyText(null!==(K=null==le?void 0:le.headerText)&&void 0!==K?K:"",null!==(Q=null==le?void 0:le.headerVariables)&&void 0!==Q?Q:[],m),headerAssetLink:null!==(X=null==le?void 0:le.headerAssetLink)&&void 0!==X?X:"",headerAssetName:null!==(Z=null==le?void 0:le.headerAssetName)&&void 0!==Z?Z:"",quickReplybtn:null==le?void 0:le.quickReply,ctaBtn:re,actionTypes:null==le?void 0:le.actionsType,extras:v,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},zeroStateComponent:null!=c?c:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:" "}),isPreview:w}):e.jsxRuntimeExports.jsx(s.WhatsappLikePreviewV2,{showHeader:h,containerPadding:"large"===b?"16px 56px 12px 16px":"12px 56px 12px 12px",containerStyle:x,textType:"html",bodyText:null==le?void 0:le.bodyText,footerText:null==le?void 0:le.footerText,headerMediaType:(null==le?void 0:le.headerType)||r.HEADER_TYPES.NONE,headerText:null==le?void 0:le.headerText,headerAssetLink:null!==(M=null==le?void 0:le.headerAssetLink)&&void 0!==M?M:"",headerAssetName:null!==(D=null==le?void 0:le.headerAssetName)&&void 0!==D?D:"",quickReplybtn:null==le?void 0:le.quickReply,ctaBtn:re,actionTypes:null==le?void 0:le.actionsType,extras:v,hidePreviewText:!0,imagePreviewStyles:{objectFit:"cover"},carouselCardIndex:y,zeroStateComponent:null!=c?c:e.jsxRuntimeExports.jsx(e.jsxRuntimeExports.Fragment,{children:" "}),bodyVariableList:null!==(_=null===(U=null==le?void 0:le.bodyVariables)||void 0===U?void 0:U.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==_?_:[],headerVariableList:null!==(Y=null===(z=null==le?void 0:le.headerVariables)||void 0===z?void 0:z.map((e=>{var l;return{placeholder:e.variableName,value:null!==(l=e.variableVal)&&void 0!==l?l:e.variableName}})))&&void 0!==Y?Y:[],buttons:null==le?void 0:le.allButtons,limitedTimeOfferComponent:null==le?void 0:le.limitedTimeOfferComponent,isWhatsappCarousel:j,isPreview:w})};
|
|
@@ -21,7 +21,6 @@ export declare class TemplateCreatorHelper {
|
|
|
21
21
|
* 2. LTO component does not have a dateTime expiry by default. Hence, while sending template to ContextMapper, send with a date or current Date and Time is picked here.
|
|
22
22
|
*/
|
|
23
23
|
private parseLimitedTimeOfferComponent;
|
|
24
|
-
private parseCallPermissionComponent;
|
|
25
24
|
parseUITemplateFromDBFormat(data: {
|
|
26
25
|
dbFormattedTemplate: WhatsAppTemplate;
|
|
27
26
|
isDuplicate?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("date-fns"),i=require("../../../constants/Theme.js"),n=require("../constants/regexPatterns.js"),l=require("../constants/TemplateConstants.js"),o=require("../models/TemplateMeta.js"),a=require("../models/WhatsAppTemplate.js"),d=require("../utils/TemplateHelperUtils.js");exports.TemplateCreatorHelper=class{parseDataFromHeaderComponent(e,t,i){var n,l,d,r,s,v,u,p,E,T;const c={headerType:o.HEADER_TYPES.NONE,headerVariables:[]},m=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.find((e=>"HEADER"===e.type));if(m){c.headerType=m.format,c.headerText=m.text,c.headerAssetLink=null===(d=null===(l=m.example)||void 0===l?void 0:l.header_handle)||void 0===d?void 0:d[0];const n=null===(s=null===(r=m.example)||void 0===r?void 0:r.header_text)||void 0===s?void 0:s[0],o=null===(u=null===(v=e.mapping)||void 0===v?void 0:v.header)||void 0===u?void 0:u[0],_=o;if(o){const e=null==o?void 0:o.replace("[[","").replace("]]","").replace("{{","").replace("}}","").replace("((","").replace("))",""),l=/\(\(/.test(o),d=i===a.POD.CHATBOT&&_&&(null==_?void 0:_.startsWith("(("))&&(null==_?void 0:_.endsWith("))")),r={idx:0,variableVal:t||d?n:_,editable:l,editableDefaultValues:l?void 0:n,variableName:e};c.headerVariables=[r],(null===(E=null===(p=m.example)||void 0===p?void 0:p.header_text)||void 0===E?void 0:E.length)&&(c.headerText=null===(T=c.headerText)||void 0===T?void 0:T.replace("{{1}}",`{{${e}}}`))}}return c}validateState(e){var t,i,a,r,s,v,u,p,E,T,c,m,_,h,b,R,C,y,I,L,N,O,x;const B=/\p{Extended_Pictographic}/u;let f="valid";const A={meta:{},ctaBtn:{phoneNumber:{btnText:"",link:""},websiteLink:{btnText:"",link:""}},quickReply:[null,null,null]},D=new d.TemplateHelperUtils;let P=!1;const S=e=>{var t;null===(t=document.getElementById(e))||void 0===t||t.scrollIntoView({behavior:"smooth",block:"nearest"})};if((null===(t=e.meta)||void 0===t?void 0:t.name)?(null===(i=e.meta.name)||void 0===i?void 0:i.trim().length)>l.NAME_LEN_LIMIT?(A.meta.name=l.NAME_LEN_ERROR,f="invalid"):n.specialCharPattern.test(null===(a=e.meta.name)||void 0===a?void 0:a.trim())&&(A.meta.name=l.NO_SPECIAL_CHAR,f="invalid"):(A.meta.name=l.REQUIRED_FIELD,f="invalid"),A.meta.name&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.name),P=!0),e.headerType===o.HEADER_TYPES.TEXT){const t=null!==(s=null===(r=e.headerText)||void 0===r?void 0:r.trim())&&void 0!==s?s:"";if(t)if(t.length>l.HEADER_TEXT_LEN_LIMIT)A.header=l.HEADER_LEN_ERROR,f="invalid";else{const e=D.getTemplateVariablesFromState(t);e&&e.length>1&&(A.header=l.ONE_VAR_ALLOWED,f="invalid")}else A.header=l.REQUIRED_FIELD,f="invalid"}else e.headerType===o.HEADER_TYPES.DOCUMENT||e.headerType===o.HEADER_TYPES.IMAGE||(e.headerType,o.HEADER_TYPES.VIDEO);if(e.headerType!==o.HEADER_TYPES.DOCUMENT&&e.headerType!==o.HEADER_TYPES.IMAGE&&e.headerType!==o.HEADER_TYPES.VIDEO||e.headerAssetLink||(A.header=l.HEADER_ASSET_LINK_ERROR,f="invalid"),A.header&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.header),P=!0),e.bodyText?e.bodyTextRaw&&(null===(v=e.bodyTextRaw)||void 0===v?void 0:v.trim().length)>l.BODY_TEXT_LEN_LIMIT&&(A.body=l.BODY_LEN_ERROR,f="invalid"):(A.body=l.REQUIRED_FIELD,f="invalid"),A.body&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.body),P=!0),e.footerText&&e.footerText.length>l.HEADER_TEXT_LEN_LIMIT&&(A.footer=l.HEADER_LEN_ERROR,f="invalid"),(null==A?void 0:A.footer)&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.footer),P=!0),e.actionsType===o.ACTIONS_TYPES.CTA_BTN){if(null===(p=null===(u=e.ctaBtn)||void 0===u?void 0:u.phoneNumber)||void 0===p?void 0:p.isChecked){const t=null===(E=e.ctaBtn.phoneNumber.btnText)||void 0===E?void 0:E.trim(),i=e.ctaBtn.phoneNumber.phoneNumber;A.ctaBtn&&!t?(A.ctaBtn.phoneNumber.btnText=l.REQUIRED_FIELD,f="invalid"):A.ctaBtn&&t&&t.length>l.QUICK_REPLY_BTN_TEXT_LIMIT?(A.ctaBtn.phoneNumber.btnText=l.QUICK_REPLY_LEN_ERROR,f="invalid"):A.ctaBtn&&t&&B.test(t)&&(A.ctaBtn.phoneNumber.btnText=l.BUTTON_EMOJI_ERROR,f="invalid"),A.ctaBtn&&!i?(A.ctaBtn.phoneNumber.link=l.REQUIRED_FIELD,f="invalid"):A.ctaBtn&&i&&i.length<10&&(A.ctaBtn.phoneNumber.link=l.VALID_PHONE_NUMBER,f="invalid")}if(null===(c=null===(T=e.ctaBtn)||void 0===T?void 0:T.websiteLinkBtn)||void 0===c?void 0:c.isChecked){const t=null===(m=e.ctaBtn.websiteLinkBtn.btnText)||void 0===m?void 0:m.trim(),i=null===(_=e.ctaBtn.websiteLinkBtn.linkOpens)||void 0===_?void 0:_.trim(),n=null===(h=e.ctaBtn.websiteLinkBtn.placeholder)||void 0===h?void 0:h.trim();A.ctaBtn&&!t?(A.ctaBtn.websiteLink.btnText=l.REQUIRED_FIELD,f="invalid"):A.ctaBtn&&t&&t.length>l.QUICK_REPLY_BTN_TEXT_LIMIT?(A.ctaBtn.websiteLink.btnText=l.QUICK_REPLY_LEN_ERROR,f="invalid"):A.ctaBtn&&t&&B.test(t)&&(A.ctaBtn.websiteLink.btnText=l.BUTTON_EMOJI_ERROR,f="invalid"),!A.ctaBtn||i||n||(A.ctaBtn.websiteLink.link=l.REQUIRED_FIELD,f="invalid")}}else if(e.actionsType===o.ACTIONS_TYPES.QUICK_REPLY){const t=["","",""];e.quickReply.forEach(((i,n)=>{var o;const a=null===(o=i.text)||void 0===o?void 0:o.trim();if(a)if(a.length>l.QUICK_REPLY_NAME_LEN_LIMIT)t[n]=l.QUICK_REPLY_LEN_ERROR,f="invalid";else if(B.test(a))t[n]=l.BUTTON_EMOJI_ERROR,f="invalid";else{const i=[...e.quickReply];i.splice(n,1);i.find((e=>e.text===a))&&(t[n]=l.QUICK_REPLY_NAME_ERROR,f="invalid")}else t[n]=l.REQUIRED_FIELD,f="invalid"})),A.quickReply=t}if(e.actionsType===o.ACTIONS_TYPES.CTA_BTN||e.actionsType===o.ACTIONS_TYPES.QUICK_REPLY){const e=null===(b=A.quickReply)||void 0===b?void 0:b.reduce(((e,t)=>e||!!t),!1);((null===(C=null===(R=null==A?void 0:A.ctaBtn)||void 0===R?void 0:R.websiteLink)||void 0===C?void 0:C.link)||(null===(I=null===(y=A.ctaBtn)||void 0===y?void 0:y.websiteLink)||void 0===I?void 0:I.btnText)||(null===(N=null===(L=A.ctaBtn)||void 0===L?void 0:L.phoneNumber)||void 0===N?void 0:N.link)||(null===(x=null===(O=A.ctaBtn)||void 0===O?void 0:O.phoneNumber)||void 0===x?void 0:x.btnText)||e)&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.actionButtons),P=!0)}return{status:f,errors:A}}parseBodyComponent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;var d,r,s,v,u,p;const E=[];let T="";const c=null===(d=e.components)||void 0===d?void 0:d.find((e=>"BODY"===e.type));return c&&(null===(v=null===(s=null===(r=c.example)||void 0===r?void 0:r.body_text)||void 0===s?void 0:s[0])||void 0===v||v.forEach(((t,i)=>{var d,r;let s=null===(r=null===(d=e.mapping)||void 0===d?void 0:d.body)||void 0===r?void 0:r[i];const v=s,u=s&&/\(\(/.test(s),p=null==s?void 0:s.match(n.placeHolderNamePattern);(null==p?void 0:p[2])&&(s=null==p?void 0:p[2]);const T=o===a.POD.CHATBOT&&v&&(null==v?void 0:v.startsWith("(("))&&(null==v?void 0:v.endsWith("))"));E.push({idx:i,variableVal:l||T?t:v,editable:!!u,editableDefaultValues:u?void 0:t,variableName:null!=s?s:""})})),T=e.htmlContentUrl?e.htmlContentUrl:(null===(u=c.text)||void 0===u?void 0:u.split(/\{\{[0-9]+\}\}/).length)?null===(p=c.text)||void 0===p?void 0:p.split(/\{\{[0-9]+\}\}/).map(((e,n)=>{if(null==E?void 0:E[n]){const l=E[n].variableName;return t?`${e}{{${l}}}`:`${e} <span> </span><span style="color: ${i.COLORS.content.brand}; text-decoration: underline;">{{${l}}}</span><span> </span>`}return e})).join(""):""),{bodyVariable:E,bodyText:T}}parseTitleComponent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0;var o,a,d,r,s,v;const u=[];let p="";const E=null===(o=e.components)||void 0===o?void 0:o.find((e=>"TITLE"===e.type));return E&&(null===(r=null===(d=null===(a=E.example)||void 0===a?void 0:a.title_text)||void 0===d?void 0:d[0])||void 0===r||r.forEach(((t,i)=>{var o,a;let d=null===(a=null===(o=e.mapping)||void 0===o?void 0:o.body)||void 0===a?void 0:a[i];const r=d,s=d&&/\(\(/.test(d),v=null==d?void 0:d.match(n.placeHolderNamePattern);(null==v?void 0:v[2])&&(d=null==v?void 0:v[2]),u.push({idx:i,variableVal:l?t:r,editable:!!s,editableDefaultValues:s?void 0:t,variableName:null!=d?d:""})})),p=e.htmlContentUrl?e.htmlContentUrl:(null===(s=E.text)||void 0===s?void 0:s.split(/\{\{[0-9]+\}\}/).length)?null===(v=E.text)||void 0===v?void 0:v.split(/\{\{[0-9]+\}\}/).map(((e,n)=>{if(null==u?void 0:u[n]){const l=u[n].variableName;return t?`${e}{{${l}}}`:`${e} <span> </span><span style="color: ${i.COLORS.content.brand}; text-decoration: underline;">{{${l}}}</span><span> </span>`}return e})).join(""):""),{titleText:p,titleVariables:u}}parseFooterComponent(e){var t;const i=null===(t=e.components)||void 0===t?void 0:t.find((e=>"FOOTER"===e.type));return null==i?void 0:i.text}parseButtonComponent(e){var t,i,l,a,d,r,s;const v={actionsType:o.ACTIONS_TYPES.NONE,quickReply:[],ctaBtn:{phoneNumber:void 0,websiteLinkBtn:void 0},allButtons:[]},u=null===(t=e.components)||void 0===t?void 0:t.find((e=>"BUTTONS"===e.type));if(u&&(null===(i=null==u?void 0:u.buttons)||void 0===i?void 0:i.length)){const t="QUICK_REPLY"===(null===(l=null==u?void 0:u.buttons)||void 0===l?void 0:l[0].type)?o.ACTIONS_TYPES.QUICK_REPLY:o.ACTIONS_TYPES.CTA_BTN;if(v.actionsType=t,t===o.ACTIONS_TYPES.QUICK_REPLY){const e=null!==(d=null===(a=null==u?void 0:u.buttons)||void 0===a?void 0:a.map((e=>e)))&&void 0!==d?d:[];v.quickReply=e}else t===o.ACTIONS_TYPES.CTA_BTN&&(null===(r=null==u?void 0:u.buttons)||void 0===r||r.forEach((t=>{var i,l,o,a;if(t.phone_number&&(v.ctaBtn.phoneNumber={isChecked:!0,btnText:t.text,phoneNumber:t.phone_number}),t.url){const d=null!==(o=null===(l=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.buttons)||void 0===l?void 0:l[0])&&void 0!==o?o:void 0;let r=!1;d&&n.editableVarPattern.test(d)&&(r=!0),v.ctaBtn.websiteLinkBtn={isChecked:!0,btnText:t.text,linkOpens:r?null===(a=t.example)||void 0===a?void 0:a[0]:t.url,placeholder:r?void 0:d}}})));v.allButtons=null===(s=u.buttons)||void 0===s?void 0:s.map((e=>"COPY_CODE"===e.type?Object.assign(Object.assign({},e),{placeholder:Array.isArray(e.example)?e.example[0]:(null==e?void 0:e.example)||""}):e))}return v}parseLimitedTimeOfferComponent(e,i){const n={text:"",dateTime:"",code:""};return e.components.forEach((e=>{var l,o,a;if("limited_time_offer"===e.type){n.text=null!==(o=null===(l=e.limited_time_offer)||void 0===l?void 0:l.text)&&void 0!==o?o:"";const i=null===(a=e.example)||void 0===a?void 0:a.limited_time_offer;i&&i.startsWith("{{")&&i.endsWith("}}")?n.dateTime=i:n.dateTime=t.format(i?new Date(i):new Date,"MMM dd")}i.forEach((e=>{var t;"COPY_CODE"===e.type&&(n.code=null!==(t=e.placeholder)&&void 0!==t?t:"")}))})),n}parseCallPermissionComponent(e){var t;const i=null===(t=e.components)||void 0===t?void 0:t.find((e=>"CALL_PERMISSION_REQUEST"===e.type));return{showCallPermissionCard:Boolean(i),callPermissionText:null==i?void 0:i.text}}parseUITemplateFromDBFormat(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){const{dbFormattedTemplate:e,isDuplicate:n,isV2:l=!1,showSampleValues:o,pod:a}=t,{headerType:d,headerAssetLink:r,headerAssetName:s,headerText:v,headerVariables:u}=yield this.parseDataFromHeaderComponent(e,void 0,a),{bodyText:p,bodyVariable:E}=yield this.parseBodyComponent(e,l,o,a),{titleText:T,titleVariables:c}=yield this.parseTitleComponent(e,l,o),{actionsType:m,quickReply:_,ctaBtn:h,allButtons:b}=yield this.parseButtonComponent(e),R=this.parseLimitedTimeOfferComponent(e,b),{showCallPermissionCard:C,callPermissionText:y}=this.parseCallPermissionComponent(e),I={quickReply:_,ctaBtn:h,allButtons:b,meta:{name:n?`${e.label} Copy`:e.label,category:null===(i=e.category)||void 0===i?void 0:i.toUpperCase(),subCategory:e.templateCategory,language:e.language,templateId:e.templateId},error:{header:void 0,body:void 0,footer:void 0,quickReply:void 0,meta:void 0,ctaBtn:void 0},actionsType:m,footerText:this.parseFooterComponent(e),bodyVariables:E,bodyText:p,headerType:d,headerAssetLink:r,headerAssetName:s,headerText:v,headerVariables:u,alreadyAsADraft:e.isDraft,mode:"edit",initialLoading:!1,limitedTimeOfferComponent:R,titleText:T,titleVariables:c,showCallPermissionCard:C,callPermissionText:y},{errors:L}=this.validateState(I);return I.error=L,I}))}parseTemplateConfiguration(e){let t;const i=(null==e?void 0:e.content)||{};if("string"==typeof i)try{t=JSON.parse(i)}catch(e){console.error("Error parsing rcsTemplate component JSON:",e),t={orientation:"VERTICAL"}}else t=i;return Object.assign(Object.assign({},t),{templateType:null==e?void 0:e.templateType})}};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../_virtual/_tslib.js"),t=require("date-fns"),i=require("../../../constants/Theme.js"),n=require("../constants/regexPatterns.js"),l=require("../constants/TemplateConstants.js"),o=require("../models/TemplateMeta.js"),a=require("../models/WhatsAppTemplate.js"),d=require("../utils/TemplateHelperUtils.js");exports.TemplateCreatorHelper=class{parseDataFromHeaderComponent(e,t,i){var n,l,d,r,s,v,u,p,E,T;const c={headerType:o.HEADER_TYPES.NONE,headerVariables:[]},m=null===(n=null==e?void 0:e.components)||void 0===n?void 0:n.find((e=>"HEADER"===e.type));if(m){c.headerType=m.format,c.headerText=m.text,c.headerAssetLink=null===(d=null===(l=m.example)||void 0===l?void 0:l.header_handle)||void 0===d?void 0:d[0];const n=null===(s=null===(r=m.example)||void 0===r?void 0:r.header_text)||void 0===s?void 0:s[0],o=null===(u=null===(v=e.mapping)||void 0===v?void 0:v.header)||void 0===u?void 0:u[0],_=o;if(o){const e=null==o?void 0:o.replace("[[","").replace("]]","").replace("{{","").replace("}}","").replace("((","").replace("))",""),l=/\(\(/.test(o),d=i===a.POD.CHATBOT&&_&&(null==_?void 0:_.startsWith("(("))&&(null==_?void 0:_.endsWith("))")),r={idx:0,variableVal:t||d?n:_,editable:l,editableDefaultValues:l?void 0:n,variableName:e};c.headerVariables=[r],(null===(E=null===(p=m.example)||void 0===p?void 0:p.header_text)||void 0===E?void 0:E.length)&&(c.headerText=null===(T=c.headerText)||void 0===T?void 0:T.replace("{{1}}",`{{${e}}}`))}}return c}validateState(e){var t,i,a,r,s,v,u,p,E,T,c,m,_,h,b,R,y,I,L,C,N,O,B;const x=/\p{Extended_Pictographic}/u;let D="valid";const f={meta:{},ctaBtn:{phoneNumber:{btnText:"",link:""},websiteLink:{btnText:"",link:""}},quickReply:[null,null,null]},A=new d.TemplateHelperUtils;let P=!1;const S=e=>{var t;null===(t=document.getElementById(e))||void 0===t||t.scrollIntoView({behavior:"smooth",block:"nearest"})};if((null===(t=e.meta)||void 0===t?void 0:t.name)?(null===(i=e.meta.name)||void 0===i?void 0:i.trim().length)>l.NAME_LEN_LIMIT?(f.meta.name=l.NAME_LEN_ERROR,D="invalid"):n.specialCharPattern.test(null===(a=e.meta.name)||void 0===a?void 0:a.trim())&&(f.meta.name=l.NO_SPECIAL_CHAR,D="invalid"):(f.meta.name=l.REQUIRED_FIELD,D="invalid"),f.meta.name&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.name),P=!0),e.headerType===o.HEADER_TYPES.TEXT){const t=null!==(s=null===(r=e.headerText)||void 0===r?void 0:r.trim())&&void 0!==s?s:"";if(t)if(t.length>l.HEADER_TEXT_LEN_LIMIT)f.header=l.HEADER_LEN_ERROR,D="invalid";else{const e=A.getTemplateVariablesFromState(t);e&&e.length>1&&(f.header=l.ONE_VAR_ALLOWED,D="invalid")}else f.header=l.REQUIRED_FIELD,D="invalid"}else e.headerType===o.HEADER_TYPES.DOCUMENT||e.headerType===o.HEADER_TYPES.IMAGE||(e.headerType,o.HEADER_TYPES.VIDEO);if(e.headerType!==o.HEADER_TYPES.DOCUMENT&&e.headerType!==o.HEADER_TYPES.IMAGE&&e.headerType!==o.HEADER_TYPES.VIDEO||e.headerAssetLink||(f.header=l.HEADER_ASSET_LINK_ERROR,D="invalid"),f.header&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.header),P=!0),e.bodyText?e.bodyTextRaw&&(null===(v=e.bodyTextRaw)||void 0===v?void 0:v.trim().length)>l.BODY_TEXT_LEN_LIMIT&&(f.body=l.BODY_LEN_ERROR,D="invalid"):(f.body=l.REQUIRED_FIELD,D="invalid"),f.body&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.body),P=!0),e.footerText&&e.footerText.length>l.HEADER_TEXT_LEN_LIMIT&&(f.footer=l.HEADER_LEN_ERROR,D="invalid"),(null==f?void 0:f.footer)&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.footer),P=!0),e.actionsType===o.ACTIONS_TYPES.CTA_BTN){if(null===(p=null===(u=e.ctaBtn)||void 0===u?void 0:u.phoneNumber)||void 0===p?void 0:p.isChecked){const t=null===(E=e.ctaBtn.phoneNumber.btnText)||void 0===E?void 0:E.trim(),i=e.ctaBtn.phoneNumber.phoneNumber;f.ctaBtn&&!t?(f.ctaBtn.phoneNumber.btnText=l.REQUIRED_FIELD,D="invalid"):f.ctaBtn&&t&&t.length>l.QUICK_REPLY_BTN_TEXT_LIMIT?(f.ctaBtn.phoneNumber.btnText=l.QUICK_REPLY_LEN_ERROR,D="invalid"):f.ctaBtn&&t&&x.test(t)&&(f.ctaBtn.phoneNumber.btnText=l.BUTTON_EMOJI_ERROR,D="invalid"),f.ctaBtn&&!i?(f.ctaBtn.phoneNumber.link=l.REQUIRED_FIELD,D="invalid"):f.ctaBtn&&i&&i.length<10&&(f.ctaBtn.phoneNumber.link=l.VALID_PHONE_NUMBER,D="invalid")}if(null===(c=null===(T=e.ctaBtn)||void 0===T?void 0:T.websiteLinkBtn)||void 0===c?void 0:c.isChecked){const t=null===(m=e.ctaBtn.websiteLinkBtn.btnText)||void 0===m?void 0:m.trim(),i=null===(_=e.ctaBtn.websiteLinkBtn.linkOpens)||void 0===_?void 0:_.trim(),n=null===(h=e.ctaBtn.websiteLinkBtn.placeholder)||void 0===h?void 0:h.trim();f.ctaBtn&&!t?(f.ctaBtn.websiteLink.btnText=l.REQUIRED_FIELD,D="invalid"):f.ctaBtn&&t&&t.length>l.QUICK_REPLY_BTN_TEXT_LIMIT?(f.ctaBtn.websiteLink.btnText=l.QUICK_REPLY_LEN_ERROR,D="invalid"):f.ctaBtn&&t&&x.test(t)&&(f.ctaBtn.websiteLink.btnText=l.BUTTON_EMOJI_ERROR,D="invalid"),!f.ctaBtn||i||n||(f.ctaBtn.websiteLink.link=l.REQUIRED_FIELD,D="invalid")}}else if(e.actionsType===o.ACTIONS_TYPES.QUICK_REPLY){const t=["","",""];e.quickReply.forEach(((i,n)=>{var o;const a=null===(o=i.text)||void 0===o?void 0:o.trim();if(a)if(a.length>l.QUICK_REPLY_NAME_LEN_LIMIT)t[n]=l.QUICK_REPLY_LEN_ERROR,D="invalid";else if(x.test(a))t[n]=l.BUTTON_EMOJI_ERROR,D="invalid";else{const i=[...e.quickReply];i.splice(n,1);i.find((e=>e.text===a))&&(t[n]=l.QUICK_REPLY_NAME_ERROR,D="invalid")}else t[n]=l.REQUIRED_FIELD,D="invalid"})),f.quickReply=t}if(e.actionsType===o.ACTIONS_TYPES.CTA_BTN||e.actionsType===o.ACTIONS_TYPES.QUICK_REPLY){const e=null===(b=f.quickReply)||void 0===b?void 0:b.reduce(((e,t)=>e||!!t),!1);((null===(y=null===(R=null==f?void 0:f.ctaBtn)||void 0===R?void 0:R.websiteLink)||void 0===y?void 0:y.link)||(null===(L=null===(I=f.ctaBtn)||void 0===I?void 0:I.websiteLink)||void 0===L?void 0:L.btnText)||(null===(N=null===(C=f.ctaBtn)||void 0===C?void 0:C.phoneNumber)||void 0===N?void 0:N.link)||(null===(B=null===(O=f.ctaBtn)||void 0===O?void 0:O.phoneNumber)||void 0===B?void 0:B.btnText)||e)&&!P&&(S(l.CREATE_TEMPLATE_DOM_IDS.actionButtons),P=!0)}return{status:D,errors:f}}parseBodyComponent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0,o=arguments.length>3?arguments[3]:void 0;var d,r,s,v,u,p;const E=[];let T="";const c=null===(d=e.components)||void 0===d?void 0:d.find((e=>"BODY"===e.type));return c&&(null===(v=null===(s=null===(r=c.example)||void 0===r?void 0:r.body_text)||void 0===s?void 0:s[0])||void 0===v||v.forEach(((t,i)=>{var d,r;let s=null===(r=null===(d=e.mapping)||void 0===d?void 0:d.body)||void 0===r?void 0:r[i];const v=s,u=s&&/\(\(/.test(s),p=null==s?void 0:s.match(n.placeHolderNamePattern);(null==p?void 0:p[2])&&(s=null==p?void 0:p[2]);const T=o===a.POD.CHATBOT&&v&&(null==v?void 0:v.startsWith("(("))&&(null==v?void 0:v.endsWith("))"));E.push({idx:i,variableVal:l||T?t:v,editable:!!u,editableDefaultValues:u?void 0:t,variableName:null!=s?s:""})})),T=e.htmlContentUrl?e.htmlContentUrl:(null===(u=c.text)||void 0===u?void 0:u.split(/\{\{[0-9]+\}\}/).length)?null===(p=c.text)||void 0===p?void 0:p.split(/\{\{[0-9]+\}\}/).map(((e,n)=>{if(null==E?void 0:E[n]){const l=E[n].variableName;return t?`${e}{{${l}}}`:`${e} <span> </span><span style="color: ${i.COLORS.content.brand}; text-decoration: underline;">{{${l}}}</span><span> </span>`}return e})).join(""):""),{bodyVariable:E,bodyText:T}}parseTitleComponent(e){let t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],l=arguments.length>2?arguments[2]:void 0;var o,a,d,r,s,v;const u=[];let p="";const E=null===(o=e.components)||void 0===o?void 0:o.find((e=>"TITLE"===e.type));return E&&(null===(r=null===(d=null===(a=E.example)||void 0===a?void 0:a.title_text)||void 0===d?void 0:d[0])||void 0===r||r.forEach(((t,i)=>{var o,a;let d=null===(a=null===(o=e.mapping)||void 0===o?void 0:o.body)||void 0===a?void 0:a[i];const r=d,s=d&&/\(\(/.test(d),v=null==d?void 0:d.match(n.placeHolderNamePattern);(null==v?void 0:v[2])&&(d=null==v?void 0:v[2]),u.push({idx:i,variableVal:l?t:r,editable:!!s,editableDefaultValues:s?void 0:t,variableName:null!=d?d:""})})),p=e.htmlContentUrl?e.htmlContentUrl:(null===(s=E.text)||void 0===s?void 0:s.split(/\{\{[0-9]+\}\}/).length)?null===(v=E.text)||void 0===v?void 0:v.split(/\{\{[0-9]+\}\}/).map(((e,n)=>{if(null==u?void 0:u[n]){const l=u[n].variableName;return t?`${e}{{${l}}}`:`${e} <span> </span><span style="color: ${i.COLORS.content.brand}; text-decoration: underline;">{{${l}}}</span><span> </span>`}return e})).join(""):""),{titleText:p,titleVariables:u}}parseFooterComponent(e){var t;const i=null===(t=e.components)||void 0===t?void 0:t.find((e=>"FOOTER"===e.type));return null==i?void 0:i.text}parseButtonComponent(e){var t,i,l,a,d,r,s;const v={actionsType:o.ACTIONS_TYPES.NONE,quickReply:[],ctaBtn:{phoneNumber:void 0,websiteLinkBtn:void 0},allButtons:[]},u=null===(t=e.components)||void 0===t?void 0:t.find((e=>"BUTTONS"===e.type));if(u&&(null===(i=null==u?void 0:u.buttons)||void 0===i?void 0:i.length)){const t="QUICK_REPLY"===(null===(l=null==u?void 0:u.buttons)||void 0===l?void 0:l[0].type)?o.ACTIONS_TYPES.QUICK_REPLY:o.ACTIONS_TYPES.CTA_BTN;if(v.actionsType=t,t===o.ACTIONS_TYPES.QUICK_REPLY){const e=null!==(d=null===(a=null==u?void 0:u.buttons)||void 0===a?void 0:a.map((e=>e)))&&void 0!==d?d:[];v.quickReply=e}else t===o.ACTIONS_TYPES.CTA_BTN&&(null===(r=null==u?void 0:u.buttons)||void 0===r||r.forEach((t=>{var i,l,o,a;if(t.phone_number&&(v.ctaBtn.phoneNumber={isChecked:!0,btnText:t.text,phoneNumber:t.phone_number}),t.url){const d=null!==(o=null===(l=null===(i=null==e?void 0:e.mapping)||void 0===i?void 0:i.buttons)||void 0===l?void 0:l[0])&&void 0!==o?o:void 0;let r=!1;d&&n.editableVarPattern.test(d)&&(r=!0),v.ctaBtn.websiteLinkBtn={isChecked:!0,btnText:t.text,linkOpens:r?null===(a=t.example)||void 0===a?void 0:a[0]:t.url,placeholder:r?void 0:d}}})));v.allButtons=null===(s=u.buttons)||void 0===s?void 0:s.map((e=>"COPY_CODE"===e.type?Object.assign(Object.assign({},e),{placeholder:Array.isArray(e.example)?e.example[0]:(null==e?void 0:e.example)||""}):e))}return v}parseLimitedTimeOfferComponent(e,i){const n={text:"",dateTime:"",code:""};return e.components.forEach((e=>{var l,o,a;if("limited_time_offer"===e.type){n.text=null!==(o=null===(l=e.limited_time_offer)||void 0===l?void 0:l.text)&&void 0!==o?o:"";const i=null===(a=e.example)||void 0===a?void 0:a.limited_time_offer;i&&i.startsWith("{{")&&i.endsWith("}}")?n.dateTime=i:n.dateTime=t.format(i?new Date(i):new Date,"MMM dd")}i.forEach((e=>{var t;"COPY_CODE"===e.type&&(n.code=null!==(t=e.placeholder)&&void 0!==t?t:"")}))})),n}parseUITemplateFromDBFormat(t){var i;return e.__awaiter(this,void 0,void 0,(function*(){const{dbFormattedTemplate:e,isDuplicate:n,isV2:l=!1,showSampleValues:o,pod:a}=t,{headerType:d,headerAssetLink:r,headerAssetName:s,headerText:v,headerVariables:u}=yield this.parseDataFromHeaderComponent(e,void 0,a),{bodyText:p,bodyVariable:E}=yield this.parseBodyComponent(e,l,o,a),{titleText:T,titleVariables:c}=yield this.parseTitleComponent(e,l,o),{actionsType:m,quickReply:_,ctaBtn:h,allButtons:b}=yield this.parseButtonComponent(e),R=this.parseLimitedTimeOfferComponent(e,b),y={quickReply:_,ctaBtn:h,allButtons:b,meta:{name:n?`${e.label} Copy`:e.label,category:null===(i=e.category)||void 0===i?void 0:i.toUpperCase(),subCategory:e.templateCategory,language:e.language,templateId:e.templateId},error:{header:void 0,body:void 0,footer:void 0,quickReply:void 0,meta:void 0,ctaBtn:void 0},actionsType:m,footerText:this.parseFooterComponent(e),bodyVariables:E,bodyText:p,headerType:d,headerAssetLink:r,headerAssetName:s,headerText:v,headerVariables:u,alreadyAsADraft:e.isDraft,mode:"edit",initialLoading:!1,limitedTimeOfferComponent:R,titleText:T,titleVariables:c},{errors:I}=this.validateState(y);return y.error=I,y}))}parseTemplateConfiguration(e){let t;const i=(null==e?void 0:e.content)||{};if("string"==typeof i)try{t=JSON.parse(i)}catch(e){console.error("Error parsing rcsTemplate component JSON:",e),t={orientation:"VERTICAL"}}else t=i;return Object.assign(Object.assign({},t),{templateType:null==e?void 0:e.templateType})}};
|
|
@@ -19,7 +19,7 @@ export type WhatsAppTemplate = {
|
|
|
19
19
|
has_expiration: boolean;
|
|
20
20
|
};
|
|
21
21
|
buttons?: {
|
|
22
|
-
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE'
|
|
22
|
+
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE';
|
|
23
23
|
text?: string;
|
|
24
24
|
url?: string;
|
|
25
25
|
example?: string[];
|
|
@@ -55,10 +55,8 @@ export type WhatsAppTemplate = {
|
|
|
55
55
|
newQualityScore?: TEMPLATE_QUALITY;
|
|
56
56
|
previousQualityScore?: TEMPLATE_QUALITY;
|
|
57
57
|
aiContentConfigId?: string;
|
|
58
|
-
showCallPermissionCard?: boolean;
|
|
59
|
-
callPermissionText?: string;
|
|
60
58
|
};
|
|
61
|
-
export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE'
|
|
59
|
+
export type WhatsappTemplateButtonTypes = 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER' | 'COPY_CODE';
|
|
62
60
|
export type CreateTemplateType = {
|
|
63
61
|
/** Data */
|
|
64
62
|
headerType: HEADER_TYPES;
|
|
@@ -104,8 +102,6 @@ export type CreateTemplateType = {
|
|
|
104
102
|
dateTime: string;
|
|
105
103
|
code: string;
|
|
106
104
|
};
|
|
107
|
-
showCallPermissionCard?: boolean;
|
|
108
|
-
callPermissionText?: string;
|
|
109
105
|
error: {
|
|
110
106
|
modalError?: string;
|
|
111
107
|
header?: string;
|
|
@@ -203,9 +199,6 @@ export type WhatsappLikePreviewTypes = {
|
|
|
203
199
|
isPreview?: boolean;
|
|
204
200
|
titleText?: string;
|
|
205
201
|
titleVariableList?: variableType[];
|
|
206
|
-
showCallPermissionCard?: boolean;
|
|
207
|
-
callPermissionText?: string;
|
|
208
|
-
hideFooter?: boolean;
|
|
209
202
|
};
|
|
210
203
|
export type WhatsappPreviewButtonType = {
|
|
211
204
|
type: WhatsappTemplateButtonTypes;
|
|
@@ -227,8 +220,6 @@ export type WhatsappMeta = {
|
|
|
227
220
|
whatsAppExtras?: boolean;
|
|
228
221
|
zeroStateComponent?: ReactElement;
|
|
229
222
|
usePlaceHolderName?: boolean;
|
|
230
|
-
showCallPermissionCard?: boolean;
|
|
231
|
-
callPermissionText?: string;
|
|
232
223
|
};
|
|
233
224
|
export interface IMimeTypeResponse {
|
|
234
225
|
isValid: boolean;
|
|
@@ -288,8 +279,7 @@ export declare enum BUTTON_TYPE {
|
|
|
288
279
|
QUICK_REPLY = "QUICK_REPLY",
|
|
289
280
|
URL = "URL",
|
|
290
281
|
PHONE_NUMBER = "PHONE_NUMBER",
|
|
291
|
-
COPY_CODE = "COPY_CODE"
|
|
292
|
-
VOICE_CALL = "VOICE_CALL"
|
|
282
|
+
COPY_CODE = "COPY_CODE"
|
|
293
283
|
}
|
|
294
284
|
export declare enum POD {
|
|
295
285
|
CHATBOT = "CHATBOT",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var E,T,O;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATE_QUALITY=void 0,(E=exports.TEMPLATE_QUALITY||(exports.TEMPLATE_QUALITY={})).GREEN="GREEN",E.YELLOW="YELLOW",E.RED="RED",exports.BUTTON_TYPE=void 0,(T=exports.BUTTON_TYPE||(exports.BUTTON_TYPE={})).QUICK_REPLY="QUICK_REPLY",T.URL="URL",T.PHONE_NUMBER="PHONE_NUMBER",T.COPY_CODE="COPY_CODE",
|
|
1
|
+
"use strict";var E,T,O;Object.defineProperty(exports,"__esModule",{value:!0}),exports.TEMPLATE_QUALITY=void 0,(E=exports.TEMPLATE_QUALITY||(exports.TEMPLATE_QUALITY={})).GREEN="GREEN",E.YELLOW="YELLOW",E.RED="RED",exports.BUTTON_TYPE=void 0,(T=exports.BUTTON_TYPE||(exports.BUTTON_TYPE={})).QUICK_REPLY="QUICK_REPLY",T.URL="URL",T.PHONE_NUMBER="PHONE_NUMBER",T.COPY_CODE="COPY_CODE",exports.POD=void 0,(O=exports.POD||(exports.POD={})).CHATBOT="CHATBOT",O.GROWTH="GROWTH",O.CAMPAIGN="CAMPAIGN",O.CRM="CRM",O.INTEGRATIONS="INTEGRATIONS",O.OPENAI="OPENAI",O.DM="DM",O.FRONTEND="FRONTEND";
|
|
@@ -10,7 +10,7 @@ export type WhatsAppCarouselTemplate = {
|
|
|
10
10
|
templateCategory: string;
|
|
11
11
|
type?: 'email' | 'whatsapp';
|
|
12
12
|
components: {
|
|
13
|
-
type: 'BODY' | 'CAROUSEL'
|
|
13
|
+
type: 'BODY' | 'CAROUSEL';
|
|
14
14
|
format?: HEADER_TYPES;
|
|
15
15
|
text?: string;
|
|
16
16
|
example?: {
|
|
@@ -24,7 +24,7 @@ export type WhatsAppCarouselTemplate = {
|
|
|
24
24
|
format?: HEADER_TYPES;
|
|
25
25
|
text?: string;
|
|
26
26
|
buttons?: {
|
|
27
|
-
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER'
|
|
27
|
+
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER';
|
|
28
28
|
text?: string;
|
|
29
29
|
url?: string;
|
|
30
30
|
example?: string[];
|
|
@@ -90,7 +90,7 @@ export interface WhatsAppCarouselTemplateCards {
|
|
|
90
90
|
format?: HEADER_TYPES;
|
|
91
91
|
text?: string;
|
|
92
92
|
buttons?: {
|
|
93
|
-
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER'
|
|
93
|
+
type: 'QUICK_REPLY' | 'URL' | 'PHONE_NUMBER';
|
|
94
94
|
text?: string;
|
|
95
95
|
url?: string;
|
|
96
96
|
example?: string[];
|