@bikdotai/bik-component-library 0.0.398-beta-styles → 0.0.398
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/add-variableV2/AddVariableV2.d.ts +1 -0
- package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +14 -6
- package/dist/cjs/components/input-with-vars/InputWithVariables.js +3 -3
- package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +2 -0
- package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.d.ts +5 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +7 -0
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +4 -0
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.d.ts +2 -0
- package/dist/cjs/components/product-picker-v2/style.js +24 -16
- package/dist/cjs/components/shimmer-image/ShimmerImage.d.ts +1 -0
- package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
- package/dist/cjs/components/side-modal/SideModal.d.ts +4 -2
- package/dist/cjs/components/side-modal/SideModal.js +1 -1
- package/dist/cjs/components/side-modal/SideModal.style.d.ts +4 -1
- package/dist/cjs/components/side-modal/SideModal.style.js +4 -1
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +7 -3
- package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +5 -1
- package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.d.ts +4 -0
- package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -0
- package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +2 -0
- package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
- package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.d.ts +1 -0
- package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +6 -0
- package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -0
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.d.ts +11 -0
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -0
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.d.ts +3 -0
- package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +2 -0
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +4 -1
- package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.d.ts +1 -0
- package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
- package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +3 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +4 -3
- package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/cjs/components/template-preview/TemplatePreview.d.ts +2 -1
- package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +5 -5
- package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.d.ts +1 -0
- package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/cjs/components/template-preview/constants/regexPatterns.js +1 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +6 -1
- package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +21 -0
- package/dist/cjs/components/template-preview/models/WhatsAppTemplate.js +1 -1
- package/dist/cjs/index.js +1 -1
- package/dist/esm/components/add-variableV2/AddVariableV2.d.ts +1 -0
- package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +14 -6
- package/dist/esm/components/input-with-vars/InputWithVariables.js +3 -3
- package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +2 -0
- package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.d.ts +5 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +7 -0
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +4 -0
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/style.d.ts +2 -0
- package/dist/esm/components/product-picker-v2/style.js +20 -12
- package/dist/esm/components/shimmer-image/ShimmerImage.d.ts +1 -0
- package/dist/esm/components/shimmer-image/ShimmerImage.js +1 -1
- package/dist/esm/components/side-modal/SideModal.d.ts +4 -2
- package/dist/esm/components/side-modal/SideModal.js +1 -1
- package/dist/esm/components/side-modal/SideModal.style.d.ts +4 -1
- package/dist/esm/components/side-modal/SideModal.style.js +15 -12
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +7 -3
- package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
- package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +5 -1
- package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.d.ts +4 -0
- package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -0
- package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +2 -0
- package/dist/esm/components/template-context-mapper/modalElements/Body.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.d.ts +1 -0
- package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +6 -0
- package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -0
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.d.ts +11 -0
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -0
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.d.ts +3 -0
- package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +2 -0
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +4 -1
- package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.d.ts +1 -0
- package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +4 -4
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
- package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +3 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +2 -2
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
- package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +4 -3
- package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
- package/dist/esm/components/template-preview/TemplatePreview.d.ts +2 -1
- package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +1 -1
- package/dist/esm/components/template-preview/WhatsAppTemplatePreview.d.ts +1 -0
- package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
- package/dist/esm/components/template-preview/constants/regexPatterns.js +1 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +6 -1
- package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +21 -0
- package/dist/esm/components/template-preview/models/WhatsAppTemplate.js +1 -1
- package/dist/esm/index.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("../../assets/icons/Bik_logo.svg.js"),n=require("react"),o=require("../../constants/Theme.js"),t=require("../navigation-hyperlink/NavigationHyperlink.js"),s=require("./SidebarPopup.js"),l=require("./SidebarStyles.js"),d=require("./SimpleSidebar.js");const r=i=>{const{icon:n,isActive:t,activeStateIcon:s,hoverStateIcon:l,isHovered:d}=i,r=n,a=s,u=l;return e.jsx(e.Fragment,{children:t?e.jsx(a,{width:20,height:20}):d?e.jsx(u,{width:20,height:20,color:o.COLORS.surface.standard}):e.jsx(r,{width:20,height:20,color:o.COLORS.surface.standard})})};exports.BikSidebar=o=>{const{logoSvg:a,allMenuList:u,activeMainMenu:c,activeSubMenu:v,router:h,onClickingMainMenu:p,onClickingSubMenu:m,onClickingAccessUpgradePanel:g,onClickingPopupMenuItem:j}=o,[y,k]=n.useState(c),[S,b]=n.useState(),[x,M]=n.useState(v),[f,w]=n.useState(!1),[O,C]=n.useState(),[L,N]=n.useState();n.useEffect((()=>{k(c)}),[c]),n.useEffect((()=>{M(v)}),[v]);const I=e=>{if(b(void 0),C(void 0),"popup"==(null==e?void 0:e.layout)){const i=P();i&&N(i),C(e)}else b(e)},q=(i,n)=>{var o,t,s,l,d,a;return e.jsx("div",Object.assign({id:(null===(t=null===(o=i.displayName)||void 0===o?void 0:o.split(" "))||void 0===t?void 0:t.join(""))||i.key.toString(),className:"main--sidebar",onClick:()=>(e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(C(void 0),b(void 0),w(!0),k(e),!e.path&&p(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?M(null==e?void 0:e.children[0]):M({}),b(void 0),setTimeout((()=>{w(!1)}),1e3))})(i),onMouseEnter:()=>{!f&&I(i)},onMouseOver:()=>{!f&&I(i)},onMouseLeave:()=>{var e;(null===(e=null==i?void 0:i.children)||void 0===e?void 0:e.length)||(b(void 0),C(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:e.jsxs("div",Object.assign({id:(null===(l=null===(s=i.displayName)||void 0===s?void 0:s.split(" "))||void 0===l?void 0:l.join(""))+"_sub"||i.key.toString()+"_sub",className:`sidebar-menu-item ${(null==y?void 0:y.key)==i.key?" main-menu-active-class":""} ${i.isLastSticky?"sticky-menu-int":""} ${i.is2ndLastSticky?"sticky-menu":""}\n\t\t\t${i.key==(null==S?void 0:S.key)?"sidebar-menu-item-hover":""}`},{children:[e.jsx(r,{icon:i.icon,isActive:i.key==(null==y?void 0:y.key),activeStateIcon:null!==(d=i.activeIcon)&&void 0!==d?d:{},hoverStateIcon:null!==(a=i.hoverIcon)&&void 0!==a?a:{},isHovered:i.key==(null==S?void 0:S.key)}),e.jsx("div",Object.assign({className:"menu-item-container"},{children:e.jsx("p",Object.assign({className:"menu-item-text "+((null==i?void 0:i.key)===(null==y?void 0:y.key)?"active-menu-item-text":"")},{children:i.displayName}))}))]}),n)}),n)};n.useEffect((()=>{const e=()=>{const e=P();e&&N(e)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const P=()=>{var e,i;if(O){const n=(null===(i=null===(e=O.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||O.key.toString()+"_sub",o=document.getElementById(n);if(o){const e=o.getBoundingClientRect();let i=e.top;return e.bottom+
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("../../assets/icons/Bik_logo.svg.js"),n=require("react"),o=require("../../constants/Theme.js"),t=require("../navigation-hyperlink/NavigationHyperlink.js"),s=require("./SidebarPopup.js"),l=require("./SidebarStyles.js"),d=require("./SimpleSidebar.js");const r=i=>{const{icon:n,isActive:t,activeStateIcon:s,hoverStateIcon:l,isHovered:d}=i,r=n,a=s,u=l;return e.jsx(e.Fragment,{children:t?e.jsx(a,{width:20,height:20}):d?e.jsx(u,{width:20,height:20,color:o.COLORS.surface.standard}):e.jsx(r,{width:20,height:20,color:o.COLORS.surface.standard})})};exports.BikSidebar=o=>{const{logoSvg:a,allMenuList:u,activeMainMenu:c,activeSubMenu:v,router:h,onClickingMainMenu:p,onClickingSubMenu:m,onClickingAccessUpgradePanel:g,onClickingPopupMenuItem:j}=o,[y,k]=n.useState(c),[S,b]=n.useState(),[x,M]=n.useState(v),[f,w]=n.useState(!1),[O,C]=n.useState(),[L,N]=n.useState();n.useEffect((()=>{k(c)}),[c]),n.useEffect((()=>{M(v)}),[v]);const I=e=>{if(b(void 0),C(void 0),"popup"==(null==e?void 0:e.layout)){const i=P();i&&N(i),C(e)}else b(e)},q=(i,n)=>{var o,t,s,l,d,a;return e.jsx("div",Object.assign({id:(null===(t=null===(o=i.displayName)||void 0===o?void 0:o.split(" "))||void 0===t?void 0:t.join(""))||i.key.toString(),className:"main--sidebar",onClick:()=>(e=>{var i;"popup"!==(null==e?void 0:e.layout)&&(C(void 0),b(void 0),w(!0),k(e),!e.path&&p(e),(null===(i=null==e?void 0:e.children)||void 0===i?void 0:i.length)?M(null==e?void 0:e.children[0]):M({}),b(void 0),setTimeout((()=>{w(!1)}),1e3))})(i),onMouseEnter:()=>{!f&&I(i)},onMouseOver:()=>{!f&&I(i)},onMouseLeave:()=>{var e;(null===(e=null==i?void 0:i.children)||void 0===e?void 0:e.length)||(b(void 0),C(void 0))},onFocus:()=>{console.log(";")},"aria-hidden":"true"},{children:e.jsxs("div",Object.assign({id:(null===(l=null===(s=i.displayName)||void 0===s?void 0:s.split(" "))||void 0===l?void 0:l.join(""))+"_sub"||i.key.toString()+"_sub",className:`sidebar-menu-item ${(null==y?void 0:y.key)==i.key?" main-menu-active-class":""} ${i.isLastSticky?"sticky-menu-int":""} ${i.is2ndLastSticky?"sticky-menu":""}\n\t\t\t${i.key==(null==S?void 0:S.key)?"sidebar-menu-item-hover":""}`},{children:[e.jsx(r,{icon:i.icon,isActive:i.key==(null==y?void 0:y.key),activeStateIcon:null!==(d=i.activeIcon)&&void 0!==d?d:{},hoverStateIcon:null!==(a=i.hoverIcon)&&void 0!==a?a:{},isHovered:i.key==(null==S?void 0:S.key)}),e.jsx("div",Object.assign({className:"menu-item-container"},{children:e.jsx("p",Object.assign({className:"menu-item-text "+((null==i?void 0:i.key)===(null==y?void 0:y.key)?"active-menu-item-text":"")},{children:i.displayName}))}))]}),n)}),n)};n.useEffect((()=>{const e=()=>{const e=P();e&&N(e)};return window.addEventListener("resize",e),()=>{window.removeEventListener("resize",e)}}),[]);const P=()=>{var e,i;if(O){const n=(null===(i=null===(e=O.displayName)||void 0===e?void 0:e.split(" "))||void 0===i?void 0:i.join(""))+"_sub"||O.key.toString()+"_sub",o=document.getElementById(n);if(o){const e=o.getBoundingClientRect();let i=e.top;return e.bottom+320>window.innerHeight&&(i-=e.bottom+320-window.innerHeight),i}return null}};return e.jsxs(l.SideBarContainer,{children:[e.jsx("div",Object.assign({className:"bik-header-logo",onClick:()=>{},onKeyDown:()=>{},"aria-hidden":"true"},{children:a||e.jsx(i.default,{})})),e.jsx(l.SibeBarMenuItem,{children:null==u?void 0:u.map(((i,o)=>{var l,r;return e.jsxs(n.Fragment,{children:[i.path?e.jsx(t.NavigationHyperlink,Object.assign({href:i.path,router:h},{children:q(i,o)})):q(i,o),e.jsxs(e.Fragment,{children:["popup"===i.layout&&(null===(l=null==O?void 0:O.children)||void 0===l?void 0:l.length)&&e.jsx(s.SidebarPopup,{top:null!=L?L:void 0,menuList:null==O?void 0:O.children,onClickingPopupMenu:e=>{j&&j(e),C(void 0)},onMouseLeaveOnMenu:()=>C(void 0)}),(null===(r=null==S?void 0:S.children)||void 0===r?void 0:r.length)&&e.jsx(d.SimpleSidebar,{menuList:null==S?void 0:S.children,activeMenu:x,onMouseLeaveOnMenu:()=>b(void 0),left:88,postion:"fixed",header:S.displayName,theme:"brand",router:h,showAccessUpgradePanel:S.showAccessUpgradePanel,onMenuClick:(e,i)=>{M(e),k(S),b(void 0),C(void 0),i&&m(e)},onUpgrade:g})]})]},o)}))})]})};
|
|
@@ -1,12 +1,20 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { Variable } from '../add-variableV2/AddVariableV2';
|
|
1
3
|
import { SelectedVariable } from '../add-variableV2/types';
|
|
2
|
-
|
|
4
|
+
interface InputWithVariablesProps {
|
|
3
5
|
variablesList: any;
|
|
4
6
|
onChange: (val: SelectedVariable) => void;
|
|
7
|
+
onBlur?: (e: Event, val?: SelectedVariable | Variable) => void;
|
|
5
8
|
addVarBoxRight: string;
|
|
6
9
|
allowMix: boolean;
|
|
7
10
|
prevVariable: SelectedVariable;
|
|
8
|
-
showHelp?: boolean
|
|
9
|
-
onlyVariables?: boolean
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
11
|
+
showHelp?: boolean;
|
|
12
|
+
onlyVariables?: boolean;
|
|
13
|
+
showSideVariablePanel?: boolean;
|
|
14
|
+
placeHolder?: string;
|
|
15
|
+
showAddButton?: boolean;
|
|
16
|
+
errorMessage?: string;
|
|
17
|
+
showSideModal?: boolean;
|
|
18
|
+
}
|
|
19
|
+
export declare const InputWithVariables: React.FC<InputWithVariablesProps>;
|
|
20
|
+
export {};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),i=require("uuid"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),a=require("../../assets/icons/PlusIcon.js"),l=require("react"),r=require("styled-components"),i=require("uuid"),t=require("../../constants/Theme.js"),d=require("../add-variableV2/AddVariableV2SideModal.js"),s=require("../add-variableV2/AddVariableV2.js"),u=require("../add-variableV2/AddVariableBox.styled.js"),o=require("../input/Input.js"),n=require("../TypographyStyle.js");function c(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}const v=c(r).default.div`
|
|
2
2
|
margin-bottom: 16px;
|
|
3
3
|
input {
|
|
4
|
-
color: ${e=>e.isVar?
|
|
4
|
+
color: ${e=>e.isVar?t.COLORS.stroke.brand:"black"};
|
|
5
5
|
}
|
|
6
|
-
`;exports.InputWithVariables=r=>{
|
|
6
|
+
`;exports.InputWithVariables=r=>{let{addVarBoxRight:t,allowMix:c,onChange:b,prevVariable:g,variablesList:V,onBlur:p,onlyVariables:h,placeHolder:j,showAddButton:x=!0,showHelp:T,showSideVariablePanel:y,errorMessage:f,showSideModal:m}=r;const S=l.useRef(null),[q,w]=l.useState(!1),[A]=l.useState(i.v4()),[B,O]=l.useState(),[C,I]=l.useState(g),[N,L]=l.useState(!1),[M,k]=l.useState(!1),[E,F]=l.useState(f||"");return l.useEffect((()=>{B&&B.actualValue&&I(c?e=>({actualValue:e.actualValue+B.actualValue,variableType:"string"}):e=>({actualValue:B.actualValue,variableType:B.variableType,needsFetching:B.needsFetching}))}),[B]),l.useEffect((()=>{b(C)}),[C]),e.jsxs(e.Fragment,{children:[e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(C.actualValue)},{children:[e.jsx(o.Input,{id:A,ref:S,skipFocus:!0,textControl:!0,isActive:q,value:C.actualValue,validate:e=>[!0,""],errorMessage:E,placeholder:j||"Add a value",onChangeText:(e,a)=>{if(F(""),h){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!==e&&46!==e||I({actualValue:"",variableType:"string"})}else I(c?{actualValue:e,variableType:"string"}:{actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{w(!0),k(!0),document.getElementById("varList")&&!N&&L(!0)},onBlur:e=>{var a,l,r,i,t,d;null==p||p(e,C),"addVar"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||"varList"===(null===(l=e.relatedTarget)||void 0===l?void 0:l.id)||(null===(i=null===(r=e.relatedTarget)||void 0===r?void 0:r.className)||void 0===i?void 0:i.includes("exlualr0"))||(null===(d=null===(t=e.relatedTarget)||void 0===t?void 0:t.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?(S.current&&S.current.focus(),w(!0)):document.getElementById("varList")?w(!0):(w(!1),L(!1),k(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[C.actualValue&&T&&e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(n.BodyCaption,{children:`This value is of type ${C.variableType}`})})),x&&M&&e.jsx("div",Object.assign({style:{marginTop:f?"-24px":"0px"}},{children:e.jsx(u.AddVariableStyled,Object.assign({right:t,id:"addVar",onClick:()=>{L(!N)}},{children:e.jsxs("div",Object.assign({className:"add"},{children:[e.jsx(a.default,{color:"white"}),e.jsx("div",Object.assign({className:"variable"},{children:"Add variable"}))]}))}))}))]})),!y&&N&&e.jsx(s.AddVariableV2,{data:V,showVariable:!0,setShowVariable:()=>{L(!1)},variableValue:B,setVariableValue:O,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?S.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==A&&(L(!1),k(!1),w(!1)):(L(!1),k(!1),w(!1))}})]})),y&&N&&e.jsx(d.AddVariableV2SideModal,{zIndex:2e3,data:null!=V?V:[],showVariable:N,setShowVariable:()=>{L(!1)},placeholder:"Add a variable",customTrigger:e=>{O({actualValue:e.actualValue,variableType:"string"}),I(e)},onSearchBlur:e=>{var a,l,r,i,t,d;"varList"===(null===(a=e.relatedTarget)||void 0===a?void 0:a.id)||(null===(r=null===(l=e.relatedTarget)||void 0===l?void 0:l.className)||void 0===r?void 0:r.includes("exlualr0"))||(null===(t=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?S.current.focus():"Enter here"===(null===(d=e.relatedTarget)||void 0===d?void 0:d.placeholder)?e.relatedTarget.id!==A&&(L(!1),k(!1),w(!1)):(L(!1),k(!1),w(!1))}})]})};
|
|
@@ -21,6 +21,8 @@ interface CollectionsScreenInterface {
|
|
|
21
21
|
setCurPage: React.Dispatch<React.SetStateAction<number>>;
|
|
22
22
|
};
|
|
23
23
|
hideCollectionCheckbox?: boolean;
|
|
24
|
+
renderWithoutModal?: boolean;
|
|
25
|
+
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
24
26
|
}
|
|
25
27
|
export declare const CollectionsScreen: (props: CollectionsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
26
28
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/chevronRight.svg.js"),i=require("react"),s=require("../checkBox/CheckBox.js"),o=require("../icon-button/IconButton.js"),c=require("../shimmer/ShimmerComponent/BikShimmer.js"),r=require("../tag/Tag.js"),l=require("../TypographyStyle.js"),n=require("./emptyState.js"),a=require("./style.js");const d=(e,t,i)=>{if(e.length<=t)return e;const s=e.slice(0,t-1);return(i?s.slice(0,s.lastIndexOf(" ")):s)+"..."},u=i=>{const{customCollectionRestriction:c,data:n,selectedCollectionsDispatch:u,setCollectionId:h,isPartiallyChecked:C,setScreen:p,id:x,isChecked:j,isDisabled:v,hideCollectionCheckbox:g,pickerType:y,selectedCollections:m}=i;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:v,onClick:e=>{if(!v){if("COLLECTION"===y)return e.stopPropagation(),u({type:"reset",data:{}}),u({type:"selected",data:{id:x,val:n,isRestricted:c}}),void h(x);h(x),p("products")}},isActive:!!m[x]},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[!g&&e.jsx(s.CheckBox,{isDisabled:v,isChecked:j,isPartiallyChecked:C,onValueChange:function(e,t,i){null==i||i.stopPropagation(),u(e?{type:"selected",data:{id:x,val:n,isRestricted:c}}:{type:"unselected",data:{id:x}}),h(e?x:"")}}),e.jsx(a.CollectionCardDetailStyle,{children:e.jsxs(a.CollectionNameHolder,{children:[e.jsx(l.TitleRegular,{children:d(n.name,40,!0)}),n.isSmartCollection?e.jsx(r.Tag,{tagText:"Smart Collection",type:"warning"}):e.jsx(e.Fragment,{})]})})]}),"COLLECTION"!==y&&e.jsx(o.IconButton,{height:12,width:12,disabled:v,Icon:t.default})]}))};exports.CollectionsScreen=t=>{const{customCollectionRestriction:s,dataLoading:o,collections:r,selectedCollectionsDispatch:l,setCollectionId:a,selectedCollections:d,setScreen:h,collectionFetcher:C,collectionsDispatch:p,pagingControls:x,storeId:j,setSaveDisabled:v,hideCollectionCheckbox:g,renderWithoutModal:y,pickerType:m}=t,b=i.useRef(null),k=i.useRef(x.curPage),f=!!s&&(null==d?void 0:d.isCustom),[S,O]=i.useState(!1);i.useEffect((()=>{k.current=x.curPage}),[x.curPage]),i.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&k.current>0&&(v(!0),O(!0),C(k.current,j).then((e=>{p({type:"paged",data:(null==e?void 0:e.collections)||{}}),x.setCurPage(k.current+1),O(!1),v(!1)})).catch())}),{threshold:1});return b.current&&e.observe(b.current),()=>{b.current&&e.unobserve(b.current)}}),[b]);const E=e=>{var t,i;let s=0,o=0;if(d[e]){const c=null===(t=r[e])||void 0===t?void 0:t.products;c&&Object.keys(c).forEach((e=>{var t;const i=null===(t=c[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>s+=1))}));const l=null===(i=d[e])||void 0===i?void 0:i.products;return l&&Object.keys(l).forEach((e=>{var t;const i=null===(t=l[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((e=>o+=1))})),!(s<=0&&o>0)&&(o>0&&s!==o)}return!1};return e.jsxs("div",{children:[Object.keys(r).length?Object.keys(r).map((t=>e.jsx(u,{customCollectionRestriction:s,data:r[t],isDisabled:f&&!(null==d?void 0:d[t]),isChecked:!!(null==d?void 0:d[t]),isPartiallyChecked:E(t),selectedCollectionsDispatch:l,setCollectionId:a,setScreen:h,id:t,hideCollectionCheckbox:g,selectedCollections:d,renderWithoutModal:y,pickerType:m},t))):o?[1,2,3,4,5,6,7,8,9,10].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(c.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i))):e.jsx(n.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:b}),S&&[1,2,3,4,5].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(c.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i)))]})},exports.truncate=d;
|
|
@@ -56,7 +56,7 @@ export type ProductPickerInterface = {
|
|
|
56
56
|
storeId: string;
|
|
57
57
|
selectedItems: SelectedItems;
|
|
58
58
|
onAdd: (items: SelectedItems, total: number) => void;
|
|
59
|
-
onClose
|
|
59
|
+
onClose?: () => void;
|
|
60
60
|
visible: boolean;
|
|
61
61
|
zIndex?: number;
|
|
62
62
|
limit?: number;
|
|
@@ -69,6 +69,10 @@ export type ProductPickerInterface = {
|
|
|
69
69
|
title?: string;
|
|
70
70
|
postHeader?: React.ReactNode;
|
|
71
71
|
width?: string;
|
|
72
|
+
renderWithoutModal?: boolean;
|
|
73
|
+
onClickSave?: number;
|
|
74
|
+
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
75
|
+
hideProductVariants?: boolean;
|
|
72
76
|
rearrangeEnabled?: boolean;
|
|
73
77
|
} & ({
|
|
74
78
|
startupScreen: ScreenName.RearrangeProducts;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),r=require("../../assets/icons/search.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),r=require("../../assets/icons/search.svg.js"),o=require("react"),c=require("../../constants/Theme.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),i=require("../modals/styledModal.js"),l=require("../spinner/Spinner.js"),a=require("../tag/Tag.js"),d=require("./collectionScreen.js"),u=require("./productScreen.js"),h=require("./rearrangeScreen.js"),p=require("./reducers.js"),S=require("./searchScreen.js"),C=require("./selectedScreen.js"),x=require("./style.js"),g=require("./type.js");exports.ScreenName=void 0,(e=exports.ScreenName||(exports.ScreenName={})).Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products";exports.ProductPickerModal=e=>{const{storeId:j,selectedItems:m,onClose:y,visible:b,zIndex:v,limit:P,hideCollectionCheckbox:k,hideProductCheckbox:f,outOfStockAction:T=g.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:O,selectProductsFromCustomCollection:R,hideSelectionCount:F,title:I,width:q,renderWithoutModal:E,onClickSave:D,pickerType:N,hideProductVariants:w=!1,startupScreen:A=exports.ScreenName.Collections,rearrangeEnabled:B}=e,[M,V]=o.useReducer(p.collectionsReducer,{}),[L,_]=o.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(A)?A:exports.ScreenName.Collections),[z,G]=o.useState("grid"),[H,W]=o.useState(""),[$,K]=o.useState(0),[U,Y]=o.useState(!1),[J,Q]=o.useState(0),[X,Z]=o.useState(""),[ee,te]=o.useState(!1),[re,oe]=o.useState(!1),[ce,se]=o.useState(),[ne,ie]=o.useReducer(p.selectedColectionsReducer,Object.keys(m).length>0?m:{});o.useEffect((()=>{Y(!0),oe(!0),e.collectionFetcher($,j).then((e=>{V({type:"fetched",data:(null==e?void 0:e.collections)||{}}),Y(!1),K((e=>e+1)),oe(!1)})).catch()}),[]),o.useEffect((()=>{let e=0;Object.keys(ne||[]).forEach((t=>{var r;Object.keys((null===(r=ne[t])||void 0===r?void 0:r.products)||[]).forEach((r=>{var o,c;Object.keys((null===(c=null===(o=ne[t].products)||void 0===o?void 0:o[r])||void 0===c?void 0:c.variants)||[]).forEach((()=>{e+=1}))}))})),Q(e)})),o.useEffect((()=>{var t;H&&!(null===(t=null==M?void 0:M[H])||void 0===t?void 0:t.products)&&(Y(!0),e.productFetcher(H,j).then((e=>{Object.keys(e).length&&V({type:"productsFetched",data:{collectionId:H,products:e}}),Y(!1)})).catch())}),[H]),o.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==L&&(X.length?(te(!0),e.searchFetcher(j,X).then((e=>{se(Object.assign({},e)),_("searchProducts"),Y(!1),te(!1)}))):_("collections"))}),800);return()=>clearTimeout(t)}),[X]),o.useEffect((()=>{D&&(e.onAdd(ne,J),le())}),[D]);const le=()=>{ie({type:"reset",data:{}})},ae=t.jsxs(x.ContainerStyle,{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===L||"searchProducts"===L)&&t.jsx("div",Object.assign({style:{padding:E?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ee?t.jsx(l.Spinner,{size:"small",color:c.COLORS.content.primary}):t.jsx(r.default,{})},id:"listInput",height:"24px",type:"text",value:X,onChangeText:e=>{e.length&&e.trim().length?Z(e):Z("")}})}))}),t.jsxs(x.ScrollContainerStyle,{children:["collections"===L&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:re,collections:M,selectedCollectionsDispatch:ie,setCollectionId:W,setScreen:_,selectedCollections:ne,collectionFetcher:e.collectionFetcher,storeId:j,collectionsDispatch:V,setSaveDisabled:Y,pagingControls:{curPage:$,setCurPage:K},hideCollectionCheckbox:k,renderWithoutModal:E,pickerType:N}),"products"===L&&H&&t.jsx(p.CollectionIdContext.Provider,Object.assign({value:H},{children:t.jsx(u.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:_,storeId:j,data:M[H],collectionsDispatch:V,selectedCollectionsDispatch:ie,selectedData:ne,setSaveDisabled:Y,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:f,outOfStockAction:T,hideVariantCheckbox:O,selectProductsFromCustomCollection:R,renderWithoutModal:E,pickerType:N,hideProductVariants:w})})),"view"===L&&t.jsx(C.SelectedScreen,{selectedCollections:ne||{},selectedCollectionsDispatch:ie,setScreen:_,collections:M}),"rearrange"===L&&t.jsx(h.RearrangeScreen,{selectedCollections:ne||{},selectedCollectionsDispatch:ie,setScreen:_,outOfStockAction:T,rearrangeViewType:"grid"===z?"list":"grid"}),"searchProducts"===L&&t.jsx(S.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:ne||{},searchedCollections:ce||{},selectedCollectionsDispatch:ie,setScreen:_,collections:M,onBackPress:()=>{Z(""),se({})},pickerType:N,hideProductCheckbox:f,hideProductVariants:w,hideVariantCheckbox:O})]})]});return t.jsx(t.Fragment,{children:E?ae:t.jsx(i.StyledModal,Object.assign({zIndex:v,open:b,onClose:()=>{null==y||y(),le()},headingTitle:I||("collections"===L||"products"===L?"Select Products":"view"===L?"Selected Products":"searchProducts"===L?"Searched Products":"rearrange"===L?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:q||"480px"},headerRightCustomElement:"rearrange"===L?(console.log("ignore:",G),t.jsx(t.Fragment,{})):t.jsx(t.Fragment,{}),primaryButton:{buttonText:U?"Loading...":L===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:U||J<1||P&&J>P||!1,onClick:()=>{e.onAdd(ne,J),le()}},footerLeftCustomElement:F?t.jsx(t.Fragment,{}):P&&J>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):J>0?t.jsx(s.Button,{onClick:()=>{_(B?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:`${J} products selected`,buttonType:["rearrange","view"].includes(L)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(L)}):t.jsx(s.Button,{disabled:!0,buttonText:`${J} products selected`,buttonType:"tertiaryGray"})},{children:ae}))})};
|
|
@@ -18,6 +18,9 @@ interface ProductsScreenInterface {
|
|
|
18
18
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
19
19
|
hideVariantCheckbox?: boolean;
|
|
20
20
|
selectProductsFromCustomCollection?: boolean;
|
|
21
|
+
renderWithoutModal?: boolean;
|
|
22
|
+
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
23
|
+
hideProductVariants?: boolean;
|
|
21
24
|
}
|
|
22
25
|
export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
23
26
|
interface ProductGroupInterface {
|
|
@@ -32,6 +35,8 @@ interface ProductGroupInterface {
|
|
|
32
35
|
hideProductCheckbox?: boolean;
|
|
33
36
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
34
37
|
hideVariantCheckbox?: boolean;
|
|
38
|
+
hideProductVariants?: boolean;
|
|
39
|
+
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
35
40
|
}
|
|
36
41
|
export declare const ProductGroup: (props: ProductGroupInterface) => import("react/jsx-runtime").JSX.Element;
|
|
37
42
|
interface ProductCardInterface {
|
|
@@ -48,6 +53,8 @@ interface ProductCardInterface {
|
|
|
48
53
|
hideProductCheckbox?: boolean;
|
|
49
54
|
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
50
55
|
hideVariantCheckbox?: boolean;
|
|
56
|
+
hideProductVariants?: boolean;
|
|
57
|
+
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
51
58
|
}
|
|
52
59
|
export declare const ProductCard: (props: ProductCardInterface) => import("react/jsx-runtime").JSX.Element;
|
|
53
60
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),i=require("../../assets/icons/box.svg.js"),o=require("../../assets/icons/search.svg.js"),c=require("lodash"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),i=require("../../assets/icons/box.svg.js"),o=require("../../assets/icons/search.svg.js"),c=require("lodash"),r=require("react"),d=require("../tag/Tag.js"),s=require("../../constants/Theme.js"),n=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),a=require("../input/Input.js"),u=require("../shimmer/ShimmerComponent/BikShimmer.js"),h=require("../shimmer-image/ShimmerImage.js"),p=require("../spinner/Spinner.js"),v=require("../TypographyStyle.js"),j=require("./collectionScreen.js"),x=require("./emptyState.js"),y=require("./helpers/ProductHelper.js"),g=require("./reducers.js"),C=require("./style.js"),k=require("./type.js"),m=require("./utility.js");const b=t=>{const{collectionId:i,productId:o,data:c,selectedData:r,selectedCollectionsDispatch:d,viewOnly:s,upliftAdditions:n,isProductPartiallyChecked:l,hideProductCheckbox:a,outOfStockAction:u,hideVariantCheckbox:h,hideProductVariants:p,pickerType:v}=t,j=e=>{var t,c,d,s,n,l;if(!(null===(c=null===(t=null==r?void 0:r[i])||void 0===t?void 0:t.products)||void 0===c?void 0:c[o]))return!1;return!!(null===(l=null===(n=null===(s=null===(d=null==r?void 0:r[i])||void 0===d?void 0:d.products)||void 0===s?void 0:s[o])||void 0===n?void 0:n.variants)||void 0===l?void 0:l[e])};return e.jsxs("div",{children:[e.jsx(O,{isVariant:!1,data:c,productId:o,collectionId:i,isSelected:!!(null===(y=null===(x=null==r?void 0:r[i])||void 0===x?void 0:x.products)||void 0===y?void 0:y[o]),isPartiallyChecked:l,selectedCollectionsDispatch:d,upliftAdditions:n,viewOnly:s,hideProductCheckbox:a,hideVariantCheckbox:h,hideProductVariants:p,pickerType:v},o),p?null:Object.keys(c.variants||[]).map((t=>e.jsx(O,{isVariant:!0,hideVariantCheckbox:h,data:c.variants[t],variantId:t,productId:o,viewOnly:s,upliftAdditions:n,collectionId:i,isSelected:j(t),selectedCollectionsDispatch:d,outOfStockAction:u},t)))]});var x,y},O=t=>{const{isVariant:i,data:o,productId:c,collectionId:r,variantId:s,isSelected:l,selectedCollectionsDispatch:a,viewOnly:u,upliftAdditions:p,isPartiallyChecked:x,hideProductCheckbox:g,outOfStockAction:k,hideVariantCheckbox:m,hideProductVariants:b,pickerType:O}=t,I=y.ProductHelper.getProductLabels(o,k);return e.jsxs(C.ProductCardStyle,Object.assign({isVariant:i,onClick:e=>{"PRODUCT"===O&&b&&(e.stopPropagation(),a({type:"reset",data:{}}),p("variantSelected",{productId:c,variantId:s||Object.keys(o.variants)[0],collectionId:r,variant:o}))},isActive:l},{children:[i&&!u&&!m||!i&&!u&&!g?e.jsx(n.CheckBox,{isChecked:l,isPartiallyChecked:x||!1,onValueChange:function(e){i?e?p("variantSelected",{productId:c,variantId:s,collectionId:r,variant:o}):a({type:"variantUnselected",data:{productId:c,variantId:s,collectionId:r}}):e?p("productSelected",{productId:c,collectionId:r,product:o}):a({type:"productUnselected",data:{productId:c,collectionId:r}})}}):e.jsx(e.Fragment,{}),e.jsx("div",{children:e.jsx(h.ShimmerImage,{width:40,height:40,imageUrl:o.image,alt:"Item",borderRadius:4})}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column"}},{children:[e.jsx(v.TitleRegular,{children:j.truncate(o.name,40,!0)}),I?e.jsx("div",Object.assign({style:{width:90,display:"flex"}},{children:e.jsx(d.Tag,{tagText:I,type:"warning",theme:"light"})})):e.jsx(e.Fragment,{})]}))]}))};exports.ProductCard=O,exports.ProductGroup=b,exports.ProductsScreen=d=>{const h=r.useContext(g.CollectionIdContext),{data:j,collectionsDispatch:y,selectedData:O,selectedCollectionsDispatch:I,productFetcher:S,storeId:f,setScreen:P,setSaveDisabled:q,hideInCollectionSearch:T,customCollectionRestriction:V,hideProductCheckbox:E,outOfStockAction:D=k.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:w=!1,selectProductsFromCustomCollection:A=!1,pickerType:B,hideProductVariants:R}=d,[F,U]=r.useState(""),[_,H]=r.useState(!1),[L,K]=r.useState(j);r.useEffect((()=>{const e=setTimeout((()=>{F.length?(H(!0),d.searchInCollectionFetcher(f,h,F).then((e=>{var t;const i=c.cloneDeep(j);i.products={};for(const o of e)(null===(t=null==j?void 0:j.products)||void 0===t?void 0:t[o])&&(i.products[o]=j.products[o]);K(i),q(!1),H(!1)}))):K(j)}),800);return()=>clearTimeout(e)}),[F]);const N=!!V&&j.isSmartCollection,W=e=>{var t,i,o,c,r,d,s,n;let l=0,a=0;return!!((null===(i=null===(t=null==O?void 0:O[h])||void 0===t?void 0:t.products)||void 0===i?void 0:i[e])&&(null===(r=Object.keys((null===(c=null===(o=null==j?void 0:j.products)||void 0===o?void 0:o[e])||void 0===c?void 0:c.variants)||[]))||void 0===r||r.forEach((()=>a++)),Object.keys((null===(n=null===(s=null===(d=null==O?void 0:O[h])||void 0===d?void 0:d.products)||void 0===s?void 0:s[e])||void 0===n?void 0:n.variants)||[]).forEach((()=>l++)),l>0&&a!==l))};r.useEffect((()=>{(null==j?void 0:j.products)||z()}),[]);const z=()=>{q(!0),H(!0),S(h,f).then((e=>{Object.keys(e).length&&(y({type:"productsFetched",data:{collectionId:h,products:e}}),K(Object.assign(Object.assign({},L),{products:e}))),q(!1),H(!1)})).catch()},G=(e,t)=>{const i=m.liftTheStateUp(t,j);I({type:e,data:Object.assign(Object.assign({},i),{isRestricted:V})})};return e.jsxs("div",{children:[e.jsxs(C.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{P("collections")}}),e.jsx(v.BodyCaption,Object.assign({style:{color:s.COLORS.content.secondary}},{children:j.name}))]}),!T&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(a.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>_&&F.length?e.jsx(p.Spinner,{size:"small",color:s.COLORS.content.primary}):e.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:F,onChangeText:e=>{e.length&&e.trim().length?U(e):U("")},placeholder:"Search products in this collection..."})})),e.jsxs("div",{children:[Object.keys((null==L?void 0:L.products)||[]).length>0&&!N&&!F.length&&!E&&e.jsxs(C.ProductScreenCollectionCardStyle,{children:[e.jsx(n.CheckBox,{isChecked:!!(null==O?void 0:O[h]),isPartiallyChecked:(e=>{var t;let i=0,o=0;if(O[e]){const c=null==j?void 0:j.products;c&&Object.keys(c).forEach((e=>{var t;const o=null===(t=c[e])||void 0===t?void 0:t.variants;o&&Object.keys(o).forEach((e=>i+=1))}));const r=null===(t=O[e])||void 0===t?void 0:t.products;return r&&Object.keys(r).forEach((e=>{var t;const i=null===(t=r[e])||void 0===t?void 0:t.variants;i&&Object.keys(i).forEach((()=>o+=1))})),o>0&&i!==o}return!1})(h),onValueChange:function(e){I(e?{type:"selected",data:{id:h,val:j}}:{type:"unselected",data:{id:h}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(i.default,{})})),e.jsx(v.TitleRegular,{children:"All Products"})]}),Object.keys((null==L?void 0:L.products)||[]).length?Object.keys(L.products||[]).map((t=>e.jsx(b,{outOfStockAction:D,collectionId:h,isProductPartiallyChecked:W(t),productId:t,data:L.products[t],selectedData:O,selectedCollectionsDispatch:I,viewOnly:!A&&!!N,upliftAdditions:G,hideProductCheckbox:E,hideVariantCheckbox:w,hideProductVariants:R,pickerType:B},t))):_?[1,2,3,4,5,6,7,8,9,10].map(((t,i)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),i))):e.jsx(x.EmptyState,{title:"No products to show",subtitle:F.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]})]})};
|
|
@@ -11,6 +11,10 @@ interface SearchScreenInterface {
|
|
|
11
11
|
[key: string]: Collection;
|
|
12
12
|
};
|
|
13
13
|
onBackPress: () => void;
|
|
14
|
+
hideVariantCheckbox?: boolean;
|
|
15
|
+
pickerType?: 'COLLECTION' | 'PRODUCT';
|
|
16
|
+
hideProductVariants?: boolean;
|
|
17
|
+
hideProductCheckbox?: boolean;
|
|
14
18
|
}
|
|
15
19
|
export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
16
20
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("../icon-button/IconButton.js"),i=require("../TypographyStyle.js"),r=require("./emptyState.js"),c=require("./productScreen.js"),s=require("./style.js"),l=require("./utility.js");exports.SearchScreen=d=>{const{customCollectionRestriction:n,selectedCollections:u,searchedCollections:a,selectedCollectionsDispatch:v,setScreen:h,collections:p,onBackPress:j,hideVariantCheckbox:y,pickerType:k,hideProductVariants:x,hideProductCheckbox:b}=d,C=(e,t)=>{var o,i,r,c,s,l,d,n,a;let v=0,h=0;return!!((null===(i=null===(o=null==u?void 0:u[e])||void 0===o?void 0:o.products)||void 0===i?void 0:i[t])&&(null===(l=Object.keys((null===(s=null===(c=null===(r=null==p?void 0:p[e])||void 0===r?void 0:r.products)||void 0===c?void 0:c[t])||void 0===s?void 0:s.variants)||[]))||void 0===l||l.forEach((()=>h++)),Object.keys((null===(a=null===(n=null===(d=null==u?void 0:u[e])||void 0===d?void 0:d.products)||void 0===n?void 0:n[t])||void 0===a?void 0:a.variants)||[]).forEach((()=>v++)),v>0&&h!==v))};return e.jsxs("div",{children:[e.jsxs(s.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{h("collections"),j()}}),e.jsx(i.BodyCaption,{children:"Searched Products"})]}),e.jsx("div",{children:Object.keys(a).length?e.jsx(e.Fragment,{children:Object.keys(a).map((t=>{var o;return Object.keys((null===(o=null==a?void 0:a[t])||void 0===o?void 0:o.products)||[]).map((o=>{let i=!1;return(null==a?void 0:a.isCustom)&&(i=!0),e.jsx(c.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{const i=l.liftTheStateUp(o,a[e]);v({type:t,data:Object.assign(Object.assign({},i),{isRestricted:n})})})(t,e,o),productId:o,data:a[t].products[o],isProductPartiallyChecked:C(t,o),selectedData:u,selectedCollectionsDispatch:v,viewOnly:i,hideProductCheckbox:b,hideVariantCheckbox:y,hideProductVariants:x,pickerType:k},o)}))}))}):e.jsx(r.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -2,6 +2,7 @@ export declare const ContainerStyle: import("styled-components").StyledComponent
|
|
|
2
2
|
export declare const ScrollContainerStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
3
3
|
export declare const CollectionCardStyle: import("styled-components").StyledComponent<"div", any, {
|
|
4
4
|
isDisabled: boolean;
|
|
5
|
+
isActive: boolean;
|
|
5
6
|
}, never>;
|
|
6
7
|
export declare const CollectionCardInfoStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
8
|
export declare const CollectionCardDetailStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -9,6 +10,7 @@ export declare const ProductScreenHeader: import("styled-components").StyledComp
|
|
|
9
10
|
export declare const ProductScreenCollectionCardStyle: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
10
11
|
export declare const ProductCardStyle: import("styled-components").StyledComponent<"div", any, {
|
|
11
12
|
isVariant: boolean;
|
|
13
|
+
isActive: boolean;
|
|
12
14
|
}, never>;
|
|
13
15
|
export declare const SelectedScreenHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
14
16
|
export declare const CollectionNameHolder: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js");function i(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var o=i(e);const r=o.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
4
|
max-height: 600px;
|
|
5
5
|
min-height: 600px;
|
|
6
6
|
flex-direction: column;
|
|
7
|
-
`,
|
|
7
|
+
`,l=o.default.div`
|
|
8
8
|
overflow-y: scroll;
|
|
9
9
|
overflow-x: hidden;
|
|
10
|
-
`,d=
|
|
10
|
+
`,d=o.default.div`
|
|
11
11
|
height: 64px;
|
|
12
|
-
background-color: ${e=>e.isDisabled?"#F0F0F0":"white"};
|
|
12
|
+
background-color: ${e=>e.isDisabled?"#F0F0F0":e.isActive?t.COLORS.background.positive.light:"white"};
|
|
13
13
|
border-bottom: 1px solid #e0e0e0;
|
|
14
14
|
padding: 12px 24px;
|
|
15
15
|
display: flex;
|
|
@@ -17,17 +17,21 @@
|
|
|
17
17
|
column-gap: 16px;
|
|
18
18
|
justify-content: space-between;
|
|
19
19
|
align-items: center;
|
|
20
|
-
|
|
20
|
+
:hover {
|
|
21
|
+
cursor: pointer;
|
|
22
|
+
background-color: ${t.COLORS.surface.hovered};
|
|
23
|
+
}
|
|
24
|
+
`,n=o.default.div`
|
|
21
25
|
display: flex;
|
|
22
26
|
flex-direction: row;
|
|
23
27
|
justify-content: center;
|
|
24
28
|
align-items: center;
|
|
25
29
|
column-gap: 18px;
|
|
26
|
-
`,a=
|
|
30
|
+
`,a=o.default.div`
|
|
27
31
|
display: flex;
|
|
28
32
|
flex-direction: column;
|
|
29
33
|
justify-content: center;
|
|
30
|
-
`,p=
|
|
34
|
+
`,p=o.default.div`
|
|
31
35
|
display: flex;
|
|
32
36
|
flex-direction: row;
|
|
33
37
|
max-height: 32px;
|
|
@@ -37,16 +41,16 @@
|
|
|
37
41
|
align-items: center;
|
|
38
42
|
padding: 8px 16px;
|
|
39
43
|
margin-top: 16px;
|
|
40
|
-
`,
|
|
44
|
+
`,c=o.default.div`
|
|
41
45
|
display: flex;
|
|
42
46
|
flex-direction: row;
|
|
43
47
|
column-gap: 16px;
|
|
44
48
|
padding: 12px 16px;
|
|
45
49
|
border-bottom: 1px solid #e0e0e0;
|
|
46
50
|
align-items: center;
|
|
47
|
-
`,
|
|
51
|
+
`,x=o.default.div`
|
|
48
52
|
height: 64px;
|
|
49
|
-
background-color: white;
|
|
53
|
+
background-color: ${e=>e.isActive?t.COLORS.background.positive.light:"white"};
|
|
50
54
|
border-bottom: 1px solid #e0e0e0;
|
|
51
55
|
padding: 12px 16px;
|
|
52
56
|
display: flex;
|
|
@@ -55,7 +59,11 @@
|
|
|
55
59
|
justify-content: flex-start;
|
|
56
60
|
align-items: center;
|
|
57
61
|
padding-left: ${e=>e.isVariant?"42px":"16px"};
|
|
58
|
-
|
|
62
|
+
:hover {
|
|
63
|
+
cursor: pointer;
|
|
64
|
+
background-color: ${t.COLORS.surface.hovered};
|
|
65
|
+
}
|
|
66
|
+
`,s=o.default.div`
|
|
59
67
|
display: flex;
|
|
60
68
|
flex-direction: row;
|
|
61
69
|
max-height: 32px;
|
|
@@ -64,10 +72,10 @@
|
|
|
64
72
|
justify-content: flex-start;
|
|
65
73
|
align-items: center;
|
|
66
74
|
padding: 8px 16px;
|
|
67
|
-
`,f=
|
|
75
|
+
`,f=o.default.div`
|
|
68
76
|
display: flex;
|
|
69
77
|
flex-direction: column;
|
|
70
|
-
`,u=
|
|
78
|
+
`,u=o.default.div`
|
|
71
79
|
height: 72px;
|
|
72
80
|
background: white;
|
|
73
81
|
padding: 12px 16px;
|
|
@@ -83,14 +91,14 @@
|
|
|
83
91
|
flex-direction: column;
|
|
84
92
|
gap: 2px;
|
|
85
93
|
}
|
|
86
|
-
`,g=
|
|
94
|
+
`,g=o.default.div`
|
|
87
95
|
height: 72px;
|
|
88
96
|
width: 72px;
|
|
89
97
|
display: flex;
|
|
90
98
|
align-items: center;
|
|
91
99
|
justify-content: center;
|
|
92
100
|
margin: 16px;
|
|
93
|
-
`;
|
|
101
|
+
`;o.default.div`
|
|
94
102
|
display: flex;
|
|
95
103
|
width: 32px;
|
|
96
104
|
height: 32px;
|
|
@@ -99,4 +107,4 @@
|
|
|
99
107
|
align-items: center;
|
|
100
108
|
border: 1px solid ${t.COLORS.stroke.primary};
|
|
101
109
|
border-radius: 4px;
|
|
102
|
-
`,exports.CollectionCardDetailStyle=a,exports.CollectionCardInfoStyle=n,exports.CollectionCardStyle=d,exports.CollectionNameHolder=f,exports.ContainerStyle=
|
|
110
|
+
`,exports.CollectionCardDetailStyle=a,exports.CollectionCardInfoStyle=n,exports.CollectionCardStyle=d,exports.CollectionNameHolder=f,exports.ContainerStyle=r,exports.ProductCardStyle=x,exports.ProductScreenCollectionCardStyle=c,exports.ProductScreenHeader=p,exports.ScrollContainerStyle=l,exports.SelectedScreenHeader=s,exports.VariantCardGridStyle=g,exports.VariantCardListStyle=u;
|
|
@@ -7,4 +7,5 @@ export type ShimmerImageProps = {
|
|
|
7
7
|
borderRadius?: number;
|
|
8
8
|
defaultImageUrl?: string;
|
|
9
9
|
};
|
|
10
|
+
export declare const DEFAULT_IMAGE = "https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";
|
|
10
11
|
export declare const ShimmerImage: React.FC<ShimmerImageProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../shimmer/ShimmerComponent/BikShimmer.js");const i="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.ShimmerImage=s=>{let{imageUrl:a,width:o,height:l,borderRadius:d,alt:n,defaultImageUrl:m=i}=s;const[u,c]=r.useState(!0),[h,g]=r.useState(!1);return r.useEffect((()=>{const e=new Image;return e.src=a,e.onload=()=>{g(!1),c(!1)},e.onerror=()=>{g(!0),c(!1)},()=>{e.onload=null,e.onerror=null}}),[a]),e.jsxs("div",Object.assign({style:{position:"relative",width:o,height:l,borderRadius:d}},{children:[u&&e.jsx(t.BikShimmer,{boxes:[{height:`${l}px`,width:`${o}px`,marginTop:"0px"}]}),h?e.jsx("img",{src:m,alt:null!=n?n:"Image",style:{borderRadius:null!=d?d:0,display:"block",width:"100%",height:"100%"}}):e.jsx("img",{src:a,alt:null!=n?n:"Image",style:{borderRadius:null!=d?d:0,display:u?"none":"block",width:"100%",height:"100%"}})]}))};
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../shimmer/ShimmerComponent/BikShimmer.js");const i="https://firebasestorage.googleapis.com/v0/b/bikayi-chat.appspot.com/o/images-uid%2F9034204a-cbf9-4b93-8b28-ccf880d273f9?alt=media&token=318529b5-8df0-4644-85b0-40fff1dc1d5c";exports.DEFAULT_IMAGE=i,exports.ShimmerImage=s=>{let{imageUrl:a,width:o,height:l,borderRadius:d,alt:n,defaultImageUrl:m=i}=s;const[u,c]=r.useState(!0),[h,g]=r.useState(!1);return r.useEffect((()=>{const e=new Image;return e.src=a,e.onload=()=>{g(!1),c(!1)},e.onerror=()=>{g(!0),c(!1)},()=>{e.onload=null,e.onerror=null}}),[a]),e.jsxs("div",Object.assign({style:{position:"relative",width:o,height:l,borderRadius:d}},{children:[u&&e.jsx(t.BikShimmer,{boxes:[{height:`${l}px`,width:`${o}px`,marginTop:"0px"}]}),h?e.jsx("img",{src:m,alt:null!=n?n:"Image",style:{borderRadius:null!=d?d:0,display:"block",width:"100%",height:"100%"}}):e.jsx("img",{src:a,alt:null!=n?n:"Image",style:{borderRadius:null!=d?d:0,display:u?"none":"block",width:"100%",height:"100%"}})]}))};
|
|
@@ -7,9 +7,11 @@ export interface SideModalProps {
|
|
|
7
7
|
footerDirection?: 'row' | 'row-reverse';
|
|
8
8
|
hideCrossButton?: boolean;
|
|
9
9
|
width?: string;
|
|
10
|
-
saveButtonProps
|
|
11
|
-
cancelButtonProps
|
|
10
|
+
saveButtonProps?: ButtonProps;
|
|
11
|
+
cancelButtonProps?: ButtonProps;
|
|
12
12
|
onClose: () => void;
|
|
13
13
|
zIndex?: number;
|
|
14
|
+
hideFooter?: boolean;
|
|
15
|
+
bodyStyle?: React.CSSProperties;
|
|
14
16
|
}
|
|
15
17
|
export declare const SideModal: React.FC<SideModalProps>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react-dom"),o=require("../../assets/icons/cross.svg.js"),r=require("../button/Button.js"),s=require("../TypographyStyle.js"),i=require("./SideModal.style.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=n(t);exports.SideModal=t=>d.default.createPortal(e.jsx(i.SideModalStyle,Object.assign({zIndex:t.zIndex},{children:e.jsxs(i.SideModalContainer,Object.assign({width:t.width},{children:[e.jsxs(i.SideModalHeader,{children:[e.jsx(s.TitleMedium,{children:t.header}),!t.hideCrossButton&&e.jsx(o.default,{width:24,height:24,onClick:t.onClose})]}),e.jsx(i.SideModalBody,{children:t.children})
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react-dom"),o=require("../../assets/icons/cross.svg.js"),r=require("../button/Button.js"),s=require("../TypographyStyle.js"),i=require("./SideModal.style.js");function n(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var d=n(t);exports.SideModal=t=>d.default.createPortal(e.jsx(i.SideModalStyle,Object.assign({zIndex:t.zIndex},{children:e.jsxs(i.SideModalContainer,Object.assign({width:t.width},{children:[e.jsxs(i.SideModalHeader,{children:[e.jsx(s.TitleMedium,{children:t.header}),!t.hideCrossButton&&e.jsx(o.default,{width:24,height:24,onClick:t.onClose})]}),e.jsx(i.SideModalBody,Object.assign({hideFooter:t.hideFooter,bodyStyle:Object.assign({},t.bodyStyle)},{children:t.children})),!0===t.hideFooter?null:e.jsxs(i.SideModalFooter,Object.assign({footerDirection:t.footerDirection},{children:[e.jsxs(i.FooterButtonWrapper,Object.assign({footerDirection:t.footerDirection},{children:[e.jsx(r.Button,Object.assign({},t.saveButtonProps)),e.jsx(r.Button,Object.assign({},t.cancelButtonProps))]})),t.footerCustomComponent?t.footerCustomComponent:e.jsx(e.Fragment,{})]}))]}))})),document.body);
|
|
@@ -5,7 +5,10 @@ export declare const SideModalContainer: import("styled-components").StyledCompo
|
|
|
5
5
|
width?: string | undefined;
|
|
6
6
|
}, never>;
|
|
7
7
|
export declare const SideModalHeader: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
8
|
-
export declare const SideModalBody: import("styled-components").StyledComponent<"div", any, {
|
|
8
|
+
export declare const SideModalBody: import("styled-components").StyledComponent<"div", any, {
|
|
9
|
+
hideFooter?: boolean | undefined;
|
|
10
|
+
bodyStyle: React.CSSProperties;
|
|
11
|
+
}, never>;
|
|
9
12
|
export declare const SideModalFooter: import("styled-components").StyledComponent<"div", any, {
|
|
10
13
|
footerDirection?: "row" | "row-reverse" | undefined;
|
|
11
14
|
}, never>;
|
|
@@ -34,7 +34,10 @@
|
|
|
34
34
|
`,s=d.default.div`
|
|
35
35
|
overflow-y: auto;
|
|
36
36
|
padding: 24px;
|
|
37
|
-
height: calc(100% - 120px);
|
|
37
|
+
height: ${e=>e.hideFooter?"calc(100% - 60px)":"calc(100% - 120px)"};
|
|
38
|
+
${t=>{let{bodyStyle:o}=t;return e.css`
|
|
39
|
+
${Object.keys(o).map((e=>`${e}: ${o[e]};`)).join("\n")}
|
|
40
|
+
`}}
|
|
38
41
|
`,p=d.default.div`
|
|
39
42
|
height: 60px;
|
|
40
43
|
width: 100%;
|
|
@@ -3,7 +3,7 @@ import { CHANNEL_TYPE } from '../template-preview/models/Channels';
|
|
|
3
3
|
import { EmailTemplateType } from '../template-preview/models/EmailTemplate';
|
|
4
4
|
import { SMSTemplateType } from '../template-preview/models/SmsTemplate';
|
|
5
5
|
import { CUSTOM_VARIABLE, GlobalPlaceholderType } from '../template-preview/models/TemplateMeta';
|
|
6
|
-
import { WhatsAppPickerMeta, WhatsAppTemplate, WhatsAppTemplateVariables } from '../template-preview/models/WhatsAppTemplate';
|
|
6
|
+
import { Extras, POD, WhatsAppPickerMeta, WhatsAppTemplate, WhatsAppTemplateVariables } from '../template-preview/models/WhatsAppTemplate';
|
|
7
7
|
export interface TemplateContextMapperProps {
|
|
8
8
|
selectedTemplate: WhatsAppTemplate | EmailTemplateType | SMSTemplateType;
|
|
9
9
|
closeDialog?: () => void;
|
|
@@ -11,7 +11,7 @@ export interface TemplateContextMapperProps {
|
|
|
11
11
|
channel: CHANNEL_TYPE;
|
|
12
12
|
globalPlaceholders: GlobalPlaceholderType;
|
|
13
13
|
/** List of variables being used in this template */
|
|
14
|
-
templateVariables: CUSTOM_VARIABLE[];
|
|
14
|
+
templateVariables: CUSTOM_VARIABLE[] | WhatsAppTemplateVariables;
|
|
15
15
|
/** Only for initial-UI-purpose for the modal */
|
|
16
16
|
htmlContent: string;
|
|
17
17
|
showOnlyContent?: boolean;
|
|
@@ -20,10 +20,14 @@ export interface TemplateContextMapperProps {
|
|
|
20
20
|
zIndex?: number;
|
|
21
21
|
showVariableModal?: boolean;
|
|
22
22
|
variableList?: VariableListInterfaceV2[];
|
|
23
|
+
variableListForImage?: VariableListInterfaceV2[];
|
|
23
24
|
onBackPress?: () => void;
|
|
24
25
|
discountCode?: string;
|
|
25
26
|
setDiscountCode?: (code: string) => void;
|
|
26
27
|
enabledCustomText?: boolean;
|
|
28
|
+
showSampleValues?: boolean;
|
|
27
29
|
disableEditVariable?: boolean;
|
|
30
|
+
pod?: POD;
|
|
31
|
+
extras?: Extras;
|
|
28
32
|
}
|
|
29
|
-
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, disableEditVariable, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
33
|
+
export declare const TemplateContextMapper: ({ selectedTemplate, closeDialog, showVariableMapping, channel, htmlContent, templateVariables, onTemplateSelect, globalPlaceholders, showOnlyContent, whatsappSpecificPickerMeta, zIndex, showVariableModal, variableList, discountCode, setDiscountCode, onBackPress, enabledCustomText, variableListForImage, showSampleValues, disableEditVariable, pod, extras, }: TemplateContextMapperProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("./context/templateModalContext.js"),o=require("./modalElements/Footer.js"),r=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("react"),l=require("../../utils/StringUtils.js"),a=require("../modals/styledModal.js"),s=require("../template-preview/models/Channels.js"),i=require("./context/templateModalContext.js"),o=require("./modalElements/Footer.js"),r=require("./modalElements/TemplateSelectModalContent.js"),n=require("./utils/convertPlaceholdersToBikDropdown.js");exports.TemplateContextMapper=d=>{let{selectedTemplate:u,closeDialog:c,showVariableMapping:p,channel:m,htmlContent:h,templateVariables:b,onTemplateSelect:g,globalPlaceholders:v,showOnlyContent:C,whatsappSpecificPickerMeta:S,zIndex:x,showVariableModal:T,variableList:E,discountCode:j,setDiscountCode:M,onBackPress:P,enabledCustomText:L,variableListForImage:w,showSampleValues:f,disableEditVariable:V,pod:q,extras:y}=d;var A,N;t.useEffect((()=>{_(h)}),[h]);const[I,k]=t.useState(m===s.CHANNEL_TYPE.EMAIL?"desktop":"mobile"),[D,_]=t.useState(h),[H,O]=t.useState(!1),[F,B]=t.useState(u),[Y,z]=t.useState(null!=b?b:[]),[$,U]=t.useState(!1);const W=t.useMemo((()=>n.convertPlaceholdersToBikDropdown(v)),[v]);return e.jsx(i.TemplateModalContext.Provider,Object.assign({value:{template:F,setTemplate:B,device:I,setDevice:k,display_content:D,setDisplayContent:_,originalVariableList:Y,setOriginalVariableList:z,isError:H,setIsError:O,channel:m,globalNormalizedPlaceholders:W,templateSelectionTriggered:$,setTemplateSelectionTriggered:U,enabledCustomText:L,disableEditVariable:V,pod:q,extras:y}},{children:C?e.jsx(r.default,{channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:x,centralContainerStyles:{width:m===s.CHANNEL_TYPE.EMAIL&&p?1e3:700},open:!0,onClose:()=>{null==c||c()},headingTitle:null==F?void 0:F.label,headingSubtitle:m===s.CHANNEL_TYPE.WHATSAPP?`${l.default.capitaliseFirstLetterOfString(null!==(A=null==F?void 0:F.category)&&void 0!==A?A:"")} • ${null!==(N=null==F?void 0:F.templateCategory)&&void 0!==N?N:""}`:"",onBackPress:()=>{null==P||P()}},{children:[e.jsx(r.default,{showSampleValues:f,showVariableMapping:p,channel:m,whatsappSpecificPickerMeta:S,showVariableModal:T,variableList:E,discountCode:j,setDiscountCode:M,variableListForImage:w&&(null==w?void 0:w.length)>0?w:E}),g?e.jsx(o.default,{onSelect:function(){const e=null==g?void 0:g(F,Y,null!=D?D:"");e?O(!!e):U(!0)}}):e.jsx(e.Fragment,{})]}))}))};
|
|
@@ -3,7 +3,7 @@ import { CHANNEL_TYPE } from "../../template-preview/models/Channels";
|
|
|
3
3
|
import { EmailTemplateType } from "../../template-preview/models/EmailTemplate";
|
|
4
4
|
import { SMSTemplateType } from "../../template-preview/models/SmsTemplate";
|
|
5
5
|
import { CUSTOM_VARIABLE, globalNormalizedPlaceholdersType } from "../../template-preview/models/TemplateMeta";
|
|
6
|
-
import { WhatsAppTemplate, WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
|
|
6
|
+
import { Extras, WhatsAppTemplate, WhatsAppTemplateVariables } from "../../template-preview/models/WhatsAppTemplate";
|
|
7
7
|
export type DEVICE_TYPES = 'desktop' | 'mobile';
|
|
8
8
|
export declare const TemplateModalContext: React.Context<{
|
|
9
9
|
device: DEVICE_TYPES;
|
|
@@ -23,6 +23,8 @@ export declare const TemplateModalContext: React.Context<{
|
|
|
23
23
|
setTemplateSelectionTriggered?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
|
24
24
|
enabledCustomText?: boolean | undefined;
|
|
25
25
|
disableEditVariable?: boolean | undefined;
|
|
26
|
+
pod?: string | undefined;
|
|
27
|
+
extras?: Extras | undefined;
|
|
26
28
|
}>;
|
|
27
29
|
export declare const useTemplateModalContext: () => {
|
|
28
30
|
device: DEVICE_TYPES;
|
|
@@ -42,4 +44,6 @@ export declare const useTemplateModalContext: () => {
|
|
|
42
44
|
setTemplateSelectionTriggered?: React.Dispatch<React.SetStateAction<boolean>> | undefined;
|
|
43
45
|
enabledCustomText?: boolean | undefined;
|
|
44
46
|
disableEditVariable?: boolean | undefined;
|
|
47
|
+
pod?: string | undefined;
|
|
48
|
+
extras?: Extras | undefined;
|
|
45
49
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),r=require("react"),t=require("../../checkBox/CheckBox.js"),a=require("../../TypographyStyle.js"),i=require("../../input/Input.js");exports.BackTrackComponent=s=>{const{backTrackMessage:n,setBackTrackMessage:c}=s,[l,o]=r.useState(!!n);return e.jsxs(e.Fragment,{children:[e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",marginLeft:10,marginTop:8,width:"300px"}},{children:[e.jsx(t.CheckBox,{isChecked:l,onValueChange:()=>{l&&c&&c(""),o(!l)}}),e.jsx(a.TitleSmall,Object.assign({style:{marginLeft:8}},{children:"Prevent BackTracking"}))]})),l&&e.jsx("div",Object.assign({style:{margin:10}},{children:e.jsx(i.Input,{type:"multiline",placeholder:"Enter your text here",labelText:"Message if user tries backtracking",onChangeText:e=>{c&&c(e)},height:"120px",maxCharLimit:1024,value:n,noErrorHint:!0,validate:e=>[!0,""]})}))]})};
|
|
@@ -6,8 +6,10 @@ export interface BodyProps {
|
|
|
6
6
|
whatsappSpecificPickerMeta?: WhatsAppPickerMeta;
|
|
7
7
|
showVariableModal?: boolean;
|
|
8
8
|
variableList?: VariableListInterfaceV2[];
|
|
9
|
+
variableListForImage?: VariableListInterfaceV2[];
|
|
9
10
|
discountCode?: string;
|
|
10
11
|
setDiscountCode?: (code: string) => void;
|
|
12
|
+
showSampleValues?: boolean;
|
|
11
13
|
}
|
|
12
14
|
declare const Body: (props: BodyProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export default Body;
|