@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.
Files changed (121) hide show
  1. package/dist/cjs/components/add-variableV2/AddVariableV2.d.ts +1 -0
  2. package/dist/cjs/components/bik-layout/BikSidebar.js +1 -1
  3. package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
  4. package/dist/cjs/components/input-with-vars/InputWithVariables.d.ts +14 -6
  5. package/dist/cjs/components/input-with-vars/InputWithVariables.js +3 -3
  6. package/dist/cjs/components/product-picker-v2/collectionScreen.d.ts +2 -0
  7. package/dist/cjs/components/product-picker-v2/collectionScreen.js +1 -1
  8. package/dist/cjs/components/product-picker-v2/modal.d.ts +5 -1
  9. package/dist/cjs/components/product-picker-v2/modal.js +1 -1
  10. package/dist/cjs/components/product-picker-v2/productScreen.d.ts +7 -0
  11. package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
  12. package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +4 -0
  13. package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
  14. package/dist/cjs/components/product-picker-v2/style.d.ts +2 -0
  15. package/dist/cjs/components/product-picker-v2/style.js +24 -16
  16. package/dist/cjs/components/shimmer-image/ShimmerImage.d.ts +1 -0
  17. package/dist/cjs/components/shimmer-image/ShimmerImage.js +1 -1
  18. package/dist/cjs/components/side-modal/SideModal.d.ts +4 -2
  19. package/dist/cjs/components/side-modal/SideModal.js +1 -1
  20. package/dist/cjs/components/side-modal/SideModal.style.d.ts +4 -1
  21. package/dist/cjs/components/side-modal/SideModal.style.js +4 -1
  22. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.d.ts +7 -3
  23. package/dist/cjs/components/template-context-mapper/TemplateContextMapper.js +1 -1
  24. package/dist/cjs/components/template-context-mapper/context/templateModalContext.d.ts +5 -1
  25. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.d.ts +4 -0
  26. package/dist/cjs/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -0
  27. package/dist/cjs/components/template-context-mapper/modalElements/Body.d.ts +2 -0
  28. package/dist/cjs/components/template-context-mapper/modalElements/Body.js +5 -5
  29. package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.d.ts +1 -0
  30. package/dist/cjs/components/template-context-mapper/modalElements/DesktopPreview.js +2 -2
  31. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +6 -0
  32. package/dist/cjs/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -0
  33. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.d.ts +11 -0
  34. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaModal.js +1 -0
  35. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.d.ts +3 -0
  36. package/dist/cjs/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  37. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +2 -0
  38. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  39. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +4 -1
  40. package/dist/cjs/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  41. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.d.ts +1 -0
  42. package/dist/cjs/components/template-context-mapper/modalElements/MobilePreview.js +3 -3
  43. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
  44. package/dist/cjs/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  45. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.d.ts +3 -1
  46. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnector.js +3 -3
  47. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  48. package/dist/cjs/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +4 -3
  49. package/dist/cjs/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  50. package/dist/cjs/components/template-preview/TemplatePreview.d.ts +2 -1
  51. package/dist/cjs/components/template-preview/TemplatePreview.js +1 -1
  52. package/dist/cjs/components/template-preview/WhatsApp/ChatUI.style.js +5 -5
  53. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.d.ts +1 -0
  54. package/dist/cjs/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  55. package/dist/cjs/components/template-preview/constants/regexPatterns.js +1 -1
  56. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.d.ts +6 -1
  57. package/dist/cjs/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  58. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.d.ts +21 -0
  59. package/dist/cjs/components/template-preview/models/WhatsAppTemplate.js +1 -1
  60. package/dist/cjs/index.js +1 -1
  61. package/dist/esm/components/add-variableV2/AddVariableV2.d.ts +1 -0
  62. package/dist/esm/components/bik-layout/BikSidebar.js +1 -1
  63. package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
  64. package/dist/esm/components/input-with-vars/InputWithVariables.d.ts +14 -6
  65. package/dist/esm/components/input-with-vars/InputWithVariables.js +3 -3
  66. package/dist/esm/components/product-picker-v2/collectionScreen.d.ts +2 -0
  67. package/dist/esm/components/product-picker-v2/collectionScreen.js +1 -1
  68. package/dist/esm/components/product-picker-v2/modal.d.ts +5 -1
  69. package/dist/esm/components/product-picker-v2/modal.js +1 -1
  70. package/dist/esm/components/product-picker-v2/productScreen.d.ts +7 -0
  71. package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
  72. package/dist/esm/components/product-picker-v2/searchScreen.d.ts +4 -0
  73. package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
  74. package/dist/esm/components/product-picker-v2/style.d.ts +2 -0
  75. package/dist/esm/components/product-picker-v2/style.js +20 -12
  76. package/dist/esm/components/shimmer-image/ShimmerImage.d.ts +1 -0
  77. package/dist/esm/components/shimmer-image/ShimmerImage.js +1 -1
  78. package/dist/esm/components/side-modal/SideModal.d.ts +4 -2
  79. package/dist/esm/components/side-modal/SideModal.js +1 -1
  80. package/dist/esm/components/side-modal/SideModal.style.d.ts +4 -1
  81. package/dist/esm/components/side-modal/SideModal.style.js +15 -12
  82. package/dist/esm/components/template-context-mapper/TemplateContextMapper.d.ts +7 -3
  83. package/dist/esm/components/template-context-mapper/TemplateContextMapper.js +1 -1
  84. package/dist/esm/components/template-context-mapper/context/templateModalContext.d.ts +5 -1
  85. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.d.ts +4 -0
  86. package/dist/esm/components/template-context-mapper/modalElements/BackTrackComponent.js +1 -0
  87. package/dist/esm/components/template-context-mapper/modalElements/Body.d.ts +2 -0
  88. package/dist/esm/components/template-context-mapper/modalElements/Body.js +4 -4
  89. package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.d.ts +1 -0
  90. package/dist/esm/components/template-context-mapper/modalElements/DesktopPreview.js +4 -4
  91. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.d.ts +6 -0
  92. package/dist/esm/components/template-context-mapper/modalElements/DiscountCodeComponent.js +1 -0
  93. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.d.ts +11 -0
  94. package/dist/esm/components/template-context-mapper/modalElements/EditMediaModal.js +1 -0
  95. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.d.ts +3 -0
  96. package/dist/esm/components/template-context-mapper/modalElements/EditMediaV2.js +2 -2
  97. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.d.ts +2 -0
  98. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateMediaV2.js +1 -1
  99. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.d.ts +4 -1
  100. package/dist/esm/components/template-context-mapper/modalElements/EditWhatsAppTemplateV2.js +1 -1
  101. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.d.ts +1 -0
  102. package/dist/esm/components/template-context-mapper/modalElements/MobilePreview.js +4 -4
  103. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.d.ts +3 -1
  104. package/dist/esm/components/template-context-mapper/modalElements/TemplateSelectModalContent.js +1 -1
  105. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.d.ts +3 -1
  106. package/dist/esm/components/template-context-mapper/modalElements/VariableConnector.js +2 -2
  107. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorWhatsApp.js +1 -1
  108. package/dist/esm/components/template-context-mapper/modalElements/VariableConnectorsPanel.js +4 -3
  109. package/dist/esm/components/template-context-mapper/modalElements/WhatsAppTemplateCardButtonV2.js +1 -1
  110. package/dist/esm/components/template-preview/TemplatePreview.d.ts +2 -1
  111. package/dist/esm/components/template-preview/TemplatePreview.js +1 -1
  112. package/dist/esm/components/template-preview/WhatsApp/ChatUI.style.js +1 -1
  113. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.d.ts +1 -0
  114. package/dist/esm/components/template-preview/WhatsAppTemplatePreview.js +1 -1
  115. package/dist/esm/components/template-preview/constants/regexPatterns.js +1 -1
  116. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.d.ts +6 -1
  117. package/dist/esm/components/template-preview/helpers/TemplateCreatorHelper.js +1 -1
  118. package/dist/esm/components/template-preview/models/WhatsAppTemplate.d.ts +21 -0
  119. package/dist/esm/components/template-preview/models/WhatsAppTemplate.js +1 -1
  120. package/dist/esm/index.js +1 -1
  121. package/package.json +1 -1
@@ -7,6 +7,7 @@ export interface VariableListInterfaceV2 {
7
7
  }
8
8
  export interface Variable {
9
9
  description?: string;
10
+ defaultValue?: string;
10
11
  displayName: string;
11
12
  actualValue: string;
12
13
  variableType: string;
@@ -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+350>window.innerHeight&&(i-=e.bottom+350-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
+ "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,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  export declare const Menus: ({
3
2
  displayName: string;
4
3
  key: number;
@@ -1,12 +1,20 @@
1
+ /// <reference types="react" />
2
+ import { Variable } from '../add-variableV2/AddVariableV2';
1
3
  import { SelectedVariable } from '../add-variableV2/types';
2
- export declare const InputWithVariables: (props: {
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 | undefined;
9
- onlyVariables?: boolean | undefined;
10
- showSideModal?: boolean | undefined;
11
- errorMessage?: string | undefined;
12
- }) => import("react/jsx-runtime").JSX.Element;
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"),d=require("../add-variableV2/AddVariableV2SideModal.js"),t=require("../add-variableV2/AddVariableV2.js"),s=require("../../constants/Theme.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`
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?s.COLORS.stroke.brand:"black"};
4
+ color: ${e=>e.isVar?t.COLORS.stroke.brand:"black"};
5
5
  }
6
- `;exports.InputWithVariables=r=>{var s;const c=l.useRef(null),[b,g]=l.useState(!1),[V]=l.useState(i.v4()),[p,h]=l.useState(),[T,j]=l.useState(r.prevVariable),[x,y]=l.useState(!1),[f,S]=l.useState(!1),[m,q]=l.useState("");return l.useEffect((()=>{p&&p.actualValue&&(r.allowMix?j((e=>({actualValue:e.actualValue+p.actualValue,variableType:"string"}))):j((e=>({actualValue:p.actualValue,variableType:p.variableType,needsFetching:p.needsFetching}))))}),[p]),l.useEffect((()=>{r.onChange(T)}),[T]),l.useEffect((()=>{(null==r?void 0:r.errorMessage)&&q(null==r?void 0:r.errorMessage)}),[null==r?void 0:r.errorMessage]),e.jsxs(v,Object.assign({isVar:/^{{.*}}$/.test(T.actualValue)},{children:[e.jsx(o.Input,{id:V,ref:c,skipFocus:!0,textControl:!0,isActive:b,value:T.actualValue,validate:e=>[!0,""],errorMessage:m,placeholder:"Add a value",onChangeText:function(e,a){if(q(""),r.onlyVariables){const e=(null==a?void 0:a.keyCode)||(null==a?void 0:a.charCode);8!=e&&46!=e||j({actualValue:"",variableType:"string"})}else r.allowMix?j({actualValue:e,variableType:"string"}):j({actualValue:e.replace(/{{.*}}/,""),variableType:"string"})},onReferenceInit:()=>{},onFocus:e=>{var a;g(!0),S(!0),"Search..."!==(null===(a=e.relatedTarget)||void 0===a?void 0:a.placeholder)||x||y(!0)},onBlur:e=>{var a,l,r,i,d,t,s;"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===(t=null===(d=e.relatedTarget)||void 0===d?void 0:d.className)||void 0===t?void 0:t.includes("sc-dZoequ "))?(c.current&&c.current.focus(),g(!0)):"Search..."===(null===(s=e.relatedTarget)||void 0===s?void 0:s.placeholder)?g(!0):(g(!1),y(!1),S(!1))}}),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"row",justifyContent:"space-between"}},{children:[T.actualValue&&r.showHelp?e.jsx("div",Object.assign({style:{marginTop:4}},{children:e.jsx(n.BodyCaption,{children:`This value is of type ${T.variableType}`})})):e.jsx("div",{}),f&&e.jsx("div",Object.assign({style:{marginTop:m?"-24px":"0px"}},{children:e.jsx(u.AddVariableStyled,Object.assign({right:r.addVarBoxRight,id:"addVar",onClick:()=>{y(!x)}},{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"}))]}))}))}))]})),x&&!r.showSideModal&&e.jsx(t.AddVariableV2,{data:r.variablesList,showVariable:!0,setShowVariable:()=>{y(!1)},variableValue:p,setVariableValue:h,placeholder:"",pickerSize:"large",enableVariable:!0,selectWithTypes:!0,onSearchBlur:e=>{var a,l,r,i,d,t;"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===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?c.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==V&&(y(!1),S(!1),g(!1)):(y(!1),S(!1),g(!1))}}),x&&r.showSideModal&&e.jsx(d.AddVariableV2SideModal,{zIndex:2e3,data:null!==(s=r.variablesList)&&void 0!==s?s:[],showVariable:x,setShowVariable:()=>{y(!1)},placeholder:"Add a variable",customTrigger:e=>{h({actualValue:e.actualValue,variableType:"string"})},onSearchBlur:e=>{var a,l,r,i,d,t;"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===(d=null===(i=e.relatedTarget)||void 0===i?void 0:i.className)||void 0===d?void 0:d.includes("sc-dZoequ "))?c.current.focus():"Enter here"===(null===(t=e.relatedTarget)||void 0===t?void 0:t.placeholder)?e.relatedTarget.id!==V&&(y(!1),S(!1),g(!1)):(y(!1),S(!1),g(!1))}})]}))};
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"),s=require("react"),i=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,s)=>{if(e.length<=t)return e;const i=e.slice(0,t-1);return(s?i.slice(0,i.lastIndexOf(" ")):i)+"..."},u=s=>{const{customCollectionRestriction:c,data:n,selectedCollectionsDispatch:u,setCollectionId:h,isPartiallyChecked:C,setScreen:x,id:j,isChecked:p,isDisabled:g,hideCollectionCheckbox:m}=s;return e.jsxs(a.CollectionCardStyle,Object.assign({isDisabled:g,onClick:()=>{g||(h(j),x("products"))}},{children:[e.jsxs(a.CollectionCardInfoStyle,{children:[!m&&e.jsx(i.CheckBox,{isDisabled:g,isChecked:p,isPartiallyChecked:C,onValueChange:function(e,t,s){null==s||s.stopPropagation(),u(e?{type:"selected",data:{id:j,val:n,isRestricted:c}}:{type:"unselected",data:{id:j}}),h(e?j:"")}}),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,{})]})})]}),e.jsx(o.IconButton,{height:12,width:12,disabled:g,Icon:t.default})]}))};exports.CollectionsScreen=t=>{const{customCollectionRestriction:i,dataLoading:o,collections:r,selectedCollectionsDispatch:l,setCollectionId:a,selectedCollections:d,setScreen:h,collectionFetcher:C,collectionsDispatch:x,pagingControls:j,storeId:p,setSaveDisabled:g,hideCollectionCheckbox:m}=t,v=s.useRef(null),b=s.useRef(j.curPage),y=!!i&&(null==d?void 0:d.isCustom),[k,f]=s.useState(!1);s.useEffect((()=>{b.current=j.curPage}),[j.curPage]),s.useEffect((()=>{const e=new IntersectionObserver((e=>{e[0].isIntersecting&&b.current>0&&(g(!0),f(!0),C(b.current,p).then((e=>{x({type:"paged",data:(null==e?void 0:e.collections)||{}}),j.setCurPage(b.current+1),f(!1),g(!1)})).catch())}),{threshold:1});return v.current&&e.observe(v.current),()=>{v.current&&e.unobserve(v.current)}}),[v]);const S=e=>{var t,s;let i=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 s=null===(t=c[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>i+=1))}));const l=null===(s=d[e])||void 0===s?void 0:s.products;return l&&Object.keys(l).forEach((e=>{var t;const s=null===(t=l[e])||void 0===t?void 0:t.variants;s&&Object.keys(s).forEach((e=>o+=1))})),!(i<=0&&o>0)&&(o>0&&i!==o)}return!1};return e.jsxs("div",{children:[Object.keys(r).length?Object.keys(r).map((t=>e.jsx(u,{customCollectionRestriction:i,data:r[t],isDisabled:y&&!(null==d?void 0:d[t]),isChecked:!!(null==d?void 0:d[t]),isPartiallyChecked:S(t),selectedCollectionsDispatch:l,setCollectionId:a,setScreen:h,id:t,hideCollectionCheckbox:m},t))):o?[1,2,3,4,5,6,7,8,9,10].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(c.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s))):e.jsx(n.EmptyState,{title:"No collections to show",subtitle:"We couldn’t find any collection."}),e.jsx("div",{ref:v}),k&&[1,2,3,4,5].map(((t,s)=>e.jsx("div",Object.assign({style:{borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(c.BikShimmer,{boxes:[{height:"64px",width:"100%",marginTop:"0px"}]})}),s)))]})},exports.truncate=d;
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: () => void;
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"),c=require("react"),o=require("../../constants/Theme.js"),s=require("../button/Button.js"),n=require("../input/Input.js"),l=require("../modals/styledModal.js"),i=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"),g=require("./style.js"),x=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:v,visible:b,zIndex:y,limit:P,hideCollectionCheckbox:f,hideProductCheckbox:O,outOfStockAction:R=x.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:k,selectProductsFromCustomCollection:I,hideSelectionCount:q,title:F,width:T,startupScreen:E=exports.ScreenName.Collections,rearrangeEnabled:D}=e,[N,w]=c.useReducer(p.collectionsReducer,{}),[B,A]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(E)?E:exports.ScreenName.Collections),[L,_]=c.useState("grid"),[M,z]=c.useState(""),[G,H]=c.useState(0),[V,$]=c.useState(!1),[K,U]=c.useState(0),[Y,J]=c.useState(""),[Q,W]=c.useState(!1),[X,Z]=c.useState(!1),[ee,te]=c.useState(),[re,ce]=c.useReducer(p.selectedColectionsReducer,Object.keys(m).length>0?m:{});c.useEffect((()=>{$(!0),Z(!0),e.collectionFetcher(G,j).then((e=>{w({type:"fetched",data:(null==e?void 0:e.collections)||{}}),$(!1),H((e=>e+1)),Z(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;Object.keys(re||[]).forEach((t=>{var r;Object.keys((null===(r=re[t])||void 0===r?void 0:r.products)||[]).forEach((r=>{var c,o;Object.keys((null===(o=null===(c=re[t].products)||void 0===c?void 0:c[r])||void 0===o?void 0:o.variants)||[]).forEach((()=>{e+=1}))}))})),U(e)})),c.useEffect((()=>{var t;M&&!(null===(t=null==N?void 0:N[M])||void 0===t?void 0:t.products)&&($(!0),e.productFetcher(M,j).then((e=>{Object.keys(e).length&&w({type:"productsFetched",data:{collectionId:M,products:e}}),$(!1)})).catch())}),[M]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==B&&(Y.length?(W(!0),e.searchFetcher(j,Y).then((e=>{te(Object.assign({},e)),A("searchProducts"),$(!1),W(!1)}))):A("collections"))}),800);return()=>clearTimeout(t)}),[Y]);const oe=()=>{ce({type:"reset",data:{}})};return t.jsx(l.StyledModal,Object.assign({zIndex:y,open:b,onClose:()=>{v(),oe()},headingTitle:F||("collections"===B||"products"===B?"Select Products":"view"===B?"Selected Products":"searchProducts"===B?"Searched Products":"rearrange"===B?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:T||"480px"},headerRightCustomElement:"rearrange"===B?(console.log("ignore:",_),t.jsx(t.Fragment,{})):t.jsx(t.Fragment,{}),primaryButton:{buttonText:V?"Loading...":B===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:V||K<1||P&&K>P||!1,onClick:()=>{e.onAdd(re,K),oe()}},footerLeftCustomElement:q?t.jsx(t.Fragment,{}):P&&K>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):K>0?t.jsx(s.Button,{onClick:()=>{A(D?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:`${K} products selected`,buttonType:["rearrange","view"].includes(B)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(B)}):t.jsx(s.Button,{disabled:!0,buttonText:`${K} products selected`,buttonType:"tertiaryGray"})},{children:t.jsxs(g.ContainerStyle,{children:[e.postHeader&&t.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.postHeader})),!e.hideGlobalSearch&&t.jsx(t.Fragment,{children:("collections"===B||"searchProducts"===B)&&t.jsx("div",Object.assign({style:{padding:"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>Q?t.jsx(i.Spinner,{size:"small",color:o.COLORS.content.primary}):t.jsx(r.default,{})},id:"listInput",height:"24px",type:"text",value:Y,onChangeText:e=>{e.length&&e.trim().length?J(e):J("")}})}))}),t.jsxs(g.ScrollContainerStyle,{children:["collections"===B&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:X,collections:N,selectedCollectionsDispatch:ce,setCollectionId:z,setScreen:A,selectedCollections:re,collectionFetcher:e.collectionFetcher,storeId:j,collectionsDispatch:w,setSaveDisabled:$,pagingControls:{curPage:G,setCurPage:H},hideCollectionCheckbox:f}),"products"===B&&M&&t.jsx(p.CollectionIdContext.Provider,Object.assign({value:M},{children:t.jsx(u.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:A,storeId:j,data:N[M],collectionsDispatch:w,selectedCollectionsDispatch:ce,selectedData:re,setSaveDisabled:$,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:O,outOfStockAction:R,hideVariantCheckbox:k,selectProductsFromCustomCollection:I})})),"view"===B&&t.jsx(C.SelectedScreen,{selectedCollections:re||{},selectedCollectionsDispatch:ce,setScreen:A,collections:N}),"rearrange"===B&&t.jsx(h.RearrangeScreen,{selectedCollections:re||{},selectedCollectionsDispatch:ce,setScreen:A,outOfStockAction:R,rearrangeViewType:"grid"===L?"list":"grid"}),"searchProducts"===B&&t.jsx(S.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:re||{},searchedCollections:ee||{},selectedCollectionsDispatch:ce,setScreen:A,collections:N,onBackPress:()=>{J(""),te({})}})]})]})}))};
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"),s=require("react"),r=require("../tag/Tag.js"),d=require("../../constants/Theme.js"),l=require("../checkBox/CheckBox.js"),n=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"),m=require("./type.js"),b=require("./utility.js");const k=t=>{const{collectionId:i,productId:o,data:c,selectedData:s,selectedCollectionsDispatch:r,viewOnly:d,upliftAdditions:l,isProductPartiallyChecked:n,hideProductCheckbox:a,outOfStockAction:u,hideVariantCheckbox:h}=t,p=e=>{var t,c,r,d,l,n;if(!(null===(c=null===(t=null==s?void 0:s[i])||void 0===t?void 0:t.products)||void 0===c?void 0:c[o]))return!1;return!!(null===(n=null===(l=null===(d=null===(r=null==s?void 0:s[i])||void 0===r?void 0:r.products)||void 0===d?void 0:d[o])||void 0===l?void 0:l.variants)||void 0===n?void 0:n[e])};return e.jsxs("div",{children:[e.jsx(O,{isVariant:!1,data:c,productId:o,collectionId:i,isSelected:!!(null===(j=null===(v=null==s?void 0:s[i])||void 0===v?void 0:v.products)||void 0===j?void 0:j[o]),isPartiallyChecked:n,selectedCollectionsDispatch:r,upliftAdditions:l,viewOnly:d,hideProductCheckbox:a,hideVariantCheckbox:h},o),Object.keys(c.variants||[]).map((t=>e.jsx(O,{isVariant:!0,hideVariantCheckbox:h,data:c.variants[t],variantId:t,productId:o,viewOnly:d,upliftAdditions:l,collectionId:i,isSelected:p(t),selectedCollectionsDispatch:r,outOfStockAction:u},t)))]});var v,j},O=t=>{const{isVariant:i,data:o,productId:c,collectionId:s,variantId:d,isSelected:n,selectedCollectionsDispatch:a,viewOnly:u,upliftAdditions:p,isPartiallyChecked:x,hideProductCheckbox:g,outOfStockAction:m,hideVariantCheckbox:b}=t,k=y.ProductHelper.getProductLabels(o,m);return e.jsxs(C.ProductCardStyle,Object.assign({isVariant:i},{children:[i&&!u&&!b||!i&&!u&&!g?e.jsx(l.CheckBox,{isChecked:n,isPartiallyChecked:x||!1,onValueChange:function(e){i?e?p("variantSelected",{productId:c,variantId:d,collectionId:s,variant:o}):a({type:"variantUnselected",data:{productId:c,variantId:d,collectionId:s}}):e?p("productSelected",{productId:c,collectionId:s,product:o}):a({type:"productUnselected",data:{productId:c,collectionId:s}})}}):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)}),k?e.jsx("div",Object.assign({style:{width:90,display:"flex"}},{children:e.jsx(r.Tag,{tagText:k,type:"warning",theme:"light"})})):e.jsx(e.Fragment,{})]}))]}))};exports.ProductCard=O,exports.ProductGroup=k,exports.ProductsScreen=r=>{const h=s.useContext(g.CollectionIdContext),{data:j,collectionsDispatch:y,selectedData:O,selectedCollectionsDispatch:f,productFetcher:I,storeId:S,setScreen:P,setSaveDisabled:q,hideInCollectionSearch:E,customCollectionRestriction:T,hideProductCheckbox:w,outOfStockAction:D=m.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:A=!1,selectProductsFromCustomCollection:B=!1}=r,[V,R]=s.useState(""),[F,U]=s.useState(!1),[_,H]=s.useState(j);s.useEffect((()=>{const e=setTimeout((()=>{V.length?(U(!0),r.searchInCollectionFetcher(S,h,V).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]);H(i),q(!1),U(!1)}))):H(j)}),800);return()=>clearTimeout(e)}),[V]);const L=!!T&&j.isSmartCollection,K=e=>{var t,i,o,c,s,r,d,l;let n=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===(s=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===s||s.forEach((()=>a++)),Object.keys((null===(l=null===(d=null===(r=null==O?void 0:O[h])||void 0===r?void 0:r.products)||void 0===d?void 0:d[e])||void 0===l?void 0:l.variants)||[]).forEach((()=>n++)),n>0&&a!==n))};s.useEffect((()=>{(null==j?void 0:j.products)||N()}),[]);const N=()=>{q(!0),U(!0),I(h,S).then((e=>{Object.keys(e).length&&(y({type:"productsFetched",data:{collectionId:h,products:e}}),H(Object.assign(Object.assign({},_),{products:e}))),q(!1),U(!1)})).catch()},W=(e,t)=>{const i=b.liftTheStateUp(t,j);f({type:e,data:Object.assign(Object.assign({},i),{isRestricted:T})})};return e.jsxs("div",{children:[e.jsxs(C.ProductScreenHeader,{children:[e.jsx(n.IconButton,{Icon:t.default,height:16,onClick:()=>{P("collections")}}),e.jsx(v.BodyCaption,Object.assign({style:{color:d.COLORS.content.secondary}},{children:j.name}))]}),!E&&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&&V.length?e.jsx(p.Spinner,{size:"small",color:d.COLORS.content.primary}):e.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:V,onChangeText:e=>{e.length&&e.trim().length?R(e):R("")},placeholder:"Search products in this collection..."})})),e.jsxs("div",{children:[Object.keys((null==_?void 0:_.products)||[]).length>0&&!L&&!V.length&&!w&&e.jsxs(C.ProductScreenCollectionCardStyle,{children:[e.jsx(l.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 s=null===(t=O[e])||void 0===t?void 0:t.products;return s&&Object.keys(s).forEach((e=>{var t;const i=null===(t=s[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){f(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==_?void 0:_.products)||[]).length?Object.keys(_.products||[]).map((t=>e.jsx(k,{outOfStockAction:D,collectionId:h,isProductPartiallyChecked:K(t),productId:t,data:_.products[t],selectedData:O,selectedCollectionsDispatch:f,viewOnly:!B&&!!L,upliftAdditions:W,hideProductCheckbox:w,hideVariantCheckbox:A},t))):F?[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:V.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]})]})};
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"),l=require("./emptyState.js"),s=require("./productScreen.js"),r=require("./style.js"),c=require("./utility.js");exports.SearchScreen=d=>{const{customCollectionRestriction:n,selectedCollections:u,searchedCollections:a,selectedCollectionsDispatch:v,setScreen:j,collections:p,onBackPress:h}=d,y=(e,t)=>{var o,i,l,s,r,c,d,n,a;let v=0,j=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===(c=Object.keys((null===(r=null===(s=null===(l=null==p?void 0:p[e])||void 0===l?void 0:l.products)||void 0===s?void 0:s[t])||void 0===r?void 0:r.variants)||[]))||void 0===c||c.forEach((()=>j++)),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&&j!==v))};return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(o.IconButton,{Icon:t.default,onClick:()=>{j("collections"),h()}}),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(s.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{const i=c.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:y(t,o),selectedData:u,selectedCollectionsDispatch:v,viewOnly:i},o)}))}))}):e.jsx(l.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
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 l=i(e);const o=l.default.div`
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
- `,r=l.default.div`
7
+ `,l=o.default.div`
8
8
  overflow-y: scroll;
9
9
  overflow-x: hidden;
10
- `,d=l.default.div`
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
- `,n=l.default.div`
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=l.default.div`
30
+ `,a=o.default.div`
27
31
  display: flex;
28
32
  flex-direction: column;
29
33
  justify-content: center;
30
- `,p=l.default.div`
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
- `,x=l.default.div`
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
- `,c=l.default.div`
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
- `,s=l.default.div`
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=l.default.div`
75
+ `,f=o.default.div`
68
76
  display: flex;
69
77
  flex-direction: column;
70
- `,u=l.default.div`
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=l.default.div`
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
- `;l.default.div`
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=o,exports.ProductCardStyle=c,exports.ProductScreenCollectionCardStyle=x,exports.ProductScreenHeader=p,exports.ScrollContainerStyle=r,exports.SelectedScreenHeader=s,exports.VariantCardGridStyle=g,exports.VariantCardListStyle=u;
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: ButtonProps;
11
- cancelButtonProps: ButtonProps;
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}),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);
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, {}, never>;
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:c,closeDialog:u,showVariableMapping:p,channel:m,htmlContent:b,templateVariables:h,onTemplateSelect:C,globalPlaceholders:g,showOnlyContent:S,whatsappSpecificPickerMeta:T,zIndex:v,showVariableModal:E,variableList:j,discountCode:x,setDiscountCode:M,onBackPress:P,enabledCustomText:L,disableEditVariable:f}=d;var w,q;t.useEffect((()=>{V(b)}),[b]);const[y,A]=t.useState(m===s.CHANNEL_TYPE.EMAIL?"desktop":"mobile"),[N,V]=t.useState(b),[k,D]=t.useState(!1),[_,H]=t.useState(c),[I,O]=t.useState(null!=h?h:[]),[B,Y]=t.useState(!1);const z=t.useMemo((()=>n.convertPlaceholdersToBikDropdown(g)),[g]);return e.jsx(i.TemplateModalContext.Provider,Object.assign({value:{template:_,setTemplate:H,device:y,setDevice:A,display_content:N,setDisplayContent:V,originalVariableList:I,setOriginalVariableList:O,isError:k,setIsError:D,channel:m,globalNormalizedPlaceholders:z,templateSelectionTriggered:B,setTemplateSelectionTriggered:Y,enabledCustomText:L,disableEditVariable:f}},{children:S?e.jsx(r.default,{channel:s.CHANNEL_TYPE.EMAIL,hideHeader:!0}):e.jsxs(a.StyledModal,Object.assign({zIndex:v,centralContainerStyles:{width:m===s.CHANNEL_TYPE.EMAIL&&p?1e3:650},open:!0,onClose:()=>{null==u||u()},headingTitle:null==_?void 0:_.label,headingSubtitle:m===s.CHANNEL_TYPE.WHATSAPP?`${l.default.capitaliseFirstLetterOfString(null!==(w=null==_?void 0:_.category)&&void 0!==w?w:"")} • ${null!==(q=null==_?void 0:_.templateCategory)&&void 0!==q?q:""}`:"",onBackPress:()=>{null==P||P()}},{children:[e.jsx(r.default,{showVariableMapping:p,channel:m,whatsappSpecificPickerMeta:T,showVariableModal:E,variableList:j,discountCode:x,setDiscountCode:M}),C?e.jsx(o.default,{onSelect:function(){const e=null==C?void 0:C(_,I,null!=N?N:"");e?D(!!e):Y(!0)}}):e.jsx(e.Fragment,{})]}))}))};
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,4 @@
1
+ export declare const BackTrackComponent: (props: {
2
+ backTrackMessage?: string | undefined;
3
+ setBackTrackMessage?: ((backTrackMessage: string) => void) | undefined;
4
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -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;