@bikdotai/bik-component-library 0.0.478 → 0.0.480-1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +1 -0
- package/dist/cjs/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/cjs/components/avatar/Avatar.d.ts +1 -0
- package/dist/cjs/components/avatar/Avatar.js +1 -1
- package/dist/cjs/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/cjs/components/postPicker/postPicker.js +1 -1
- package/dist/cjs/components/product-picker-v2/modal.js +1 -1
- package/dist/cjs/components/product-picker-v2/productScreen.d.ts +1 -0
- package/dist/cjs/components/product-picker-v2/productScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/searchScreen.d.ts +2 -0
- package/dist/cjs/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/cjs/components/product-picker-v2/style.js +1 -1
- package/dist/cjs/components/template-preview/EmailTemplateThumbnailPreview.d.ts +1 -0
- package/dist/cjs/components/template-preview/EmailTemplateThumbnailPreview.js +1 -1
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.d.ts +1 -0
- package/dist/esm/components/analytics-chips-and-dropdowns/AnalyticsDropdown.js +1 -1
- package/dist/esm/components/avatar/Avatar.d.ts +1 -0
- package/dist/esm/components/avatar/Avatar.js +1 -1
- package/dist/esm/components/bik-layout/MockMenus.d.ts +0 -1
- package/dist/esm/components/postPicker/postPicker.js +1 -1
- package/dist/esm/components/product-picker-v2/modal.js +1 -1
- package/dist/esm/components/product-picker-v2/productScreen.d.ts +1 -0
- package/dist/esm/components/product-picker-v2/productScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/searchScreen.d.ts +2 -0
- package/dist/esm/components/product-picker-v2/searchScreen.js +1 -1
- package/dist/esm/components/product-picker-v2/style.js +1 -1
- package/dist/esm/components/template-preview/EmailTemplateThumbnailPreview.d.ts +1 -0
- package/dist/esm/components/template-preview/EmailTemplateThumbnailPreview.js +1 -1
- package/package.json +1 -1
|
@@ -31,6 +31,7 @@ export interface AnalyticsDropdownInterface {
|
|
|
31
31
|
};
|
|
32
32
|
variant?: 'small' | 'default';
|
|
33
33
|
datePickerPlacement?: DropDirection;
|
|
34
|
+
closeDropdown?: boolean;
|
|
34
35
|
}
|
|
35
36
|
export declare const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface>;
|
|
36
37
|
export declare const EachItem: React.FC<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("react-bootstrap"),n=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js"),i=require("../TypographyStyle.js"),l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:c,rangeSelection:r}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>c(t),isSelected:t.isCustom?t.key==(null==s?void 0:s.key)&&!!a:t.key==(null==s?void 0:s.key)},{children:[e.jsx(i.BodySecondary,Object.assign({color:t.key==(null==s?void 0:s.key)?n.BASE_COLORS.positive[900]:n.BASE_COLORS.grayscale[900]},{children:t.label})),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:r?`${d(a[0])} to ${d(a[1])}`:`${d(a[0])}`})]}),t.key)},d=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});exports.AnalyticsDropdown=c=>{let{options:r,placeholder:u="Select an option",selected:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),o=require("react"),t=require("react-bootstrap"),n=require("../../constants/Theme.js"),s=require("../datePicker/DatePicker.js"),i=require("../TypographyStyle.js"),l=require("./CommonStyles.js");const a=o=>{let{eachOption:t,selectedOption:s,selectedDate:a,onClickingEachItem:c,rangeSelection:r}=o;return e.jsxs(l.ItemMenuContainer,Object.assign({onClick:()=>c(t),isSelected:t.isCustom?t.key==(null==s?void 0:s.key)&&!!a:t.key==(null==s?void 0:s.key)},{children:[e.jsx(i.BodySecondary,Object.assign({color:t.key==(null==s?void 0:s.key)?n.BASE_COLORS.positive[900]:n.BASE_COLORS.grayscale[900]},{children:t.label})),a&&(null==s?void 0:s.isCustom)&&t.key==(null==s?void 0:s.key)&&e.jsx(i.BodyCaption,{children:r?`${d(a[0])} to ${d(a[1])}`:`${d(a[0])}`})]}),t.key)},d=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});exports.AnalyticsDropdown=c=>{let{options:r,placeholder:u="Select an option",selected:p,onOptionSelected:g,resetDropdown:v,maxHeight:m,backgroundColor:O,calendarPopperConfig:j,variant:D="default",datePickerPlacement:y,closeDropdown:S}=c;var b,h,x;const[f,k]=o.useState(!1),[w,C]=o.useState(p),[R,E]=o.useState(),[T,A]=o.useState(!1),M=()=>{!f&&A(!T)},[q,P]=o.useState(p),$="small"===D?i.Caption:i.BodySecondary;return o.useEffect((()=>{v&&C(void 0)}),[v]),o.useEffect((()=>{var e;(null==p?void 0:p.isCustom)&&(null===(e=p.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?E(p.dateRangeSelectionOptions.selectedDates):E(void 0),C(p)}),[p]),o.useEffect((()=>{A(!1),k(!1)}),[S]),e.jsx(e.Fragment,{children:e.jsxs(l.MainDropdown,Object.assign({drop:"down",show:T,onToggle:M,backgroundColor:O,id:"analytic-dropdown"},{children:[e.jsx(t.Dropdown.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===D?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${n.DEFAULT_THEME.colorsV2.stroke.primary}`}:void 0},{children:e.jsx($,Object.assign({style:"small"===D?{color:n.DEFAULT_THEME.colorsV2.content.secondary}:void 0},{children:(null==w?void 0:w.isCustom)?R?d(R[0])===d(R[1])?`${d(R[0])}`:`${d(R[0])} to ${d(R[1])}`:null==q?void 0:q.label:w?null==w?void 0:w.label:u}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"main--dropdown"},{children:e.jsxs(l.MainDropdown,Object.assign({drop:null!=y?y:"end",id:"sub--dropdown",show:f,onToggle:e=>{!e&&A(!1),k(!f)}},{children:[e.jsx("div",Object.assign({style:{maxHeight:m||"auto",overflowY:"scroll"}},{children:r.map((o=>{var n;return e.jsx("div",{children:(null==o?void 0:o.isCustom)?e.jsx(t.Dropdown.Toggle,Object.assign({className:"sub--dropdown"},{children:e.jsx(a,{eachOption:o,selectedOption:w,selectedDate:R,onClickingEachItem:e=>{C(e),k(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e.jsx(a,{eachOption:o,selectedOption:w,selectedDate:R,onClickingEachItem:e=>{if(E(void 0),C(e),P(e),M(),!e.noOfDays)return void g(e);const o=new Date,t=new Date;t.setDate(o.getDate()-e.noOfDays),g(Object.assign(Object.assign({},e),{selectedRange:[t,o]}))}})},null==o?void 0:o.key)}))})),e.jsx(t.Dropdown.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==j?void 0:j.offsetSkid)||0,(null==j?void 0:j.offsetDistance)||0]}}]}},{children:e.jsx(s.DatePicker,{selectRange:(null===(b=null==w?void 0:w.dateRangeSelectionOptions)||void 0===b?void 0:b.selectRange)||!1,maxDate:null===(h=null==w?void 0:w.dateRangeSelectionOptions)||void 0===h?void 0:h.maxDate,minDate:null===(x=null==w?void 0:w.dateRangeSelectionOptions)||void 0===x?void 0:x.minDate,selectedDates:R,onSelectRange:(e,o)=>{const t=[e,o];(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=t,g(Object.assign(Object.assign({},w),{selectedRange:[e,o]}))),P(w),k(!1),E(t),A(!T)},onSelectDate:e=>{(null==w?void 0:w.dateRangeSelectionOptions)&&(w.dateRangeSelectionOptions.selectedDates=[e,e],g(Object.assign(Object.assign({},w),{selectedRange:[e,e]}))),P(w),k(!1),E([e,e]),A(!T)}})}))]}))}))]}))})},exports.EachItem=a,exports.formatDate=d;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("./Avatar.styled.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),s=require("react"),t=require("./Avatar.styled.js"),r=require("./AvatarHelper.js"),i=require("../TypographyStyle.js"),A=require("../../constants/Theme.js");const a={[r.SIZE.SMALL]:16,[r.SIZE.MEDIUM]:20,[r.SIZE.LARGE]:32},o={[r.AVATAR_BACKGROUND.LIGHT]:A.COLORS.content.secondary,[r.AVATAR_BACKGROUND.DARK]:A.COLORS.surface.standard};exports.AVATAR_SIZE_VS_ICON_SIZE_MAP=a,exports.Avatar=A=>{const[c,n]=s.useState(!1),l=()=>{const s=(A.name||"").split(".").join(" ").split(" ").map((e=>e.charAt(0).toUpperCase())).slice(0,2).join("");return A.size===r.SIZE.SMALL?e.jsx(i.BodyTiny,Object.assign({style:{color:o[A.background]}},{children:s})):A.size===r.SIZE.MEDIUM?e.jsx(i.TitleSmall,Object.assign({style:{color:o[A.background]}},{children:s})):A.size===r.SIZE.LARGE?e.jsx(i.TitleMedium,Object.assign({style:{color:o[A.background]}},{children:s})):void 0};return e.jsxs(t.AvatarStyle,Object.assign({type:A.type,size:A.size,background:A.background},{children:[A.type===r.AVATAR_TYPES.IMAGE&&(A.useNameFallback&&!c?e.jsx("img",{alt:"",width:r.AVATAR_SIZE_MAP[A.size],height:r.AVATAR_SIZE_MAP[A.size],style:{borderRadius:"50%",objectFit:"contain"},src:A.photoUrl,onError:()=>{n(!0)}}):A.useNameFallback&&c&&A.name?e.jsx("div",{children:l()}):e.jsx("img",{alt:"",width:r.AVATAR_SIZE_MAP[A.size],height:r.AVATAR_SIZE_MAP[A.size],style:{borderRadius:"50%",objectFit:"contain"},src:A.photoUrl})),A.type===r.AVATAR_TYPES.INITIALS&&e.jsx("div",{children:l()}),A.type===r.AVATAR_TYPES.ICON&&A.icon&&e.jsx(A.icon,{width:a[A.size],height:a[A.size],color:o[A.background]})]}))},exports.BACKGROUND_VS_TEXT_COLOR_MAP=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/searchIcon.js"),a=require("react"),s=require("./PostPicker.styled.js"),r=require("../tag/Tag.js"),i=require("../TypographyStyle.js"),n=require("../../utils/unCamelCase.js"),o=require("../../constants/colors.js"),l=require("../../constants/Theme.js"),d=require("../../assets/icons/instagram.svg.js"),c=require("../../assets/icons/warning.svg.js");require("../tooltips/Tooltip.js"),require("../analytics-chips-and-dropdowns/CommonStyles.js");var p=require("../analytics-chips-and-dropdowns/AnalyticsDropdown.js");require("../analytics-chips-and-dropdowns/AnalyticsMetric.js"),require("../../utils/DateUtils.js"),require("../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js"),require("react-bootstrap"),require("../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js"),require("../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js"),require("../analytics-chips-and-dropdowns/chart/Pie/PieChart.js"),require("../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js"),require("../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js"),require("../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarDistributionChart.js"),require("../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js"),require("../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js"),require("../analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js"),require("../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js");var u,h,y=require("../modals/styledModal.js"),m=require("../shimmer/ShimmerComponent/BikShimmer.js"),g=require("../shimmer-image/ShimmerImage.js"),j=require("../states/StateComponent.js");require("../../_virtual/_tslib.js"),exports.MEDIA_TYPES=void 0,(u=exports.MEDIA_TYPES||(exports.MEDIA_TYPES={})).STORY="story",u.POST="post",u.REEL="reel",exports.DateKeys=void 0,(h=exports.DateKeys||(exports.DateKeys={})).Today="Today",h["7_Days"]="7",h["30_Days"]="30",h.custom="custom",h.Yesterday="Yesterday";const x=[{label:"Today",value:"today",key:exports.DateKeys.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:exports.DateKeys["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:exports.DateKeys["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:exports.DateKeys.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}];exports.PostPicker=u=>{var h,v;const[D,S]=a.useState(null!==(h=u.previouslySelected)&&void 0!==h?h:[]),[w,C]=a.useState(""),[T,b]=a.useState(!1),[f,O]=a.useState(u.media),[q,E]=a.useState(!1),[P,k]=a.useState(!1),[I,B]=a.useState(!1),_=a.useRef(null);a.useEffect((()=>{u.media.length||(b(!0),setTimeout((()=>{b(!1)}),2e3)),S(u.selected||[])}),[]),a.useEffect((()=>{u.media.length>0&&(O(u.media),b(!1))}),[null===(v=null==u?void 0:u.media)||void 0===v?void 0:v.length]),a.useEffect((()=>{D.length>0&&C("")}),[D.length]),a.useEffect((()=>{q&&(O(u.media),k(!1))}),[q]),a.useEffect((()=>{const e=e=>{document.getElementById("analytic-dropdown").contains(e.target)||B(!I)},t=document.getElementById("post-picker");return t&&t.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e)}}));return e.jsx("div",Object.assign({ref:_},{children:e.jsxs(y.StyledModal,Object.assign({zIndex:201,open:u.showModal,headingTitle:u.title,onClose:u.onClose,centralContainerStyles:{width:1071,height:u.showFilter?650:564},primaryButton:{disabled:!f.length,buttonType:"primary",buttonText:`Select ${n.unCamelCase(u.mediaType)}`,onClick:()=>{D.length?u.onSelect(D):C(`Please select a ${u.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>u.onClose()},footerLeftCustomElement:w?e.jsx(r.Tag,{tagText:w,type:"negative",LeadingIcon:c.default}):D.length?e.jsxs(i.BodySecondary,{children:[D.length," selected"]}):null,id:"post-picker"},{children:[u.showFilter&&e.jsxs("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e.jsx(p.AnalyticsDropdown,{options:x,placeholder:"posted on",resetDropdown:q,onOptionSelected:e=>{var t,a;let s=null,r=null;"Custom range"===e.label?(s=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,r=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(s=e.typeValue[0],r=e.typeValue[1]);const i=u.media.filter((e=>function(e,t,a){const s=new Date(e),r=new Date(t),i=new Date(a);return s>=r&&s<=i}(e.timestamp,s,r)));O(i),k(!0),E(!1)},closeDropdown:I}),P&&e.jsx(i.ButtonRegular,Object.assign({color:l.COLORS.content.secondary,onClick:()=>E(!0)},{children:"Clear"}))]})),T?e.jsx("div",Object.assign({style:{padding:"0 24px"}},{children:e.jsx(m.BikShimmer,{boxes:[{width:(u.mediaType==exports.MEDIA_TYPES.POST?148:104)+"px",height:(u.mediaType==exports.MEDIA_TYPES.POST?148:172)+"px"}]})})):e.jsx(e.Fragment,{children:f&&f.length?e.jsx(s.StyledProductGrid,Object.assign({mediaType:u.mediaType},{children:f.map((t=>{return e.jsxs(s.StyledProduct,Object.assign({mediaType:u.mediaType,className:""+(a=t,r=D,r.some((e=>e.id===a.id))?"selected":""),onClick:()=>{return e=t,void S((()=>D.find((t=>t.id===e.id))?D.filter((t=>t.id!==e.id)):!u.limit||D.length<u.limit?[...D,e]:(C(`Only ${u.limit} ${u.mediaType}s can be selected`),D)));var e}},{children:[e.jsx(g.ShimmerImage,{imageUrl:t.imageUrl,width:u.mediaType==exports.MEDIA_TYPES.POST?148:104,height:u.mediaType==exports.MEDIA_TYPES.POST?148:172,alt:t.overlayCaption}),e.jsxs("div",Object.assign({className:"overlay"},{children:[e.jsx("a",Object.assign({target:"_blank",rel:"noreferrer",href:t.redirectionUrl},{children:e.jsxs("div",Object.assign({className:"overlay__redirection"},{children:[e.jsx(d.default,{height:22,width:22}),e.jsx(i.BodyPrimary,Object.assign({color:o.PRIMARY,style:{fontWeight:500}},{children:"View"}))]}))})),e.jsx("div",Object.assign({className:"overlay__caption"},{children:e.jsx(i.BodyCaption,Object.assign({color:l.COLORS.content.placeholder},{children:t.overlayCaption}))}))]}))]}),t.id);var a,r}))})):e.jsx("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:u.media.length?f.length?e.jsx(e.Fragment,{}):e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e.jsx("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${l.COLORS.background.inverse}`,borderRadius:"50%"}},{children:e.jsx(t.SearchIcon,{color:l.COLORS.content.primaryInverse})})),e.jsxs("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e.jsx(i.TitleMedium,{children:"No results found"}),e.jsx(i.BodyPrimary,{children:"Sorry we could not find any results for the selected filter"})]})),e.jsx("div",Object.assign({onClick:()=>{E(!0)}},{children:e.jsx(i.ButtonLarge,Object.assign({color:`${l.COLORS.content.brand}`},{children:"Clear Filter"}))}))]})):e.jsx(j.StateComponent,{states:j.StateInterface.WARNING,heading:`No ${u.mediaType}s on your account`,subline:`There seems to be no ${u.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))}))},exports.dateOptions=x;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=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("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=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:y,selectedItems:b,onClose:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e,t=require("react/jsx-runtime"),o=require("../../assets/icons/search.svg.js"),c=require("react"),r=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("./productInfoOverlay.js"),h=require("./productScreen.js"),p=require("./rearrangeScreen.js"),S=require("./reducers.js"),C=require("./searchScreen.js"),x=require("./selectedScreen.js"),g=require("./style.js"),j=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:y,selectedItems:b,onClose:f,visible:m,zIndex:v,exactLimit:P,limit:k,hideCollectionCheckbox:I,hideProductCheckbox:O,outOfStockAction:F=j.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,hideSelectionCount:q,title:E,width:D,renderWithoutModal:w,onClickSave:N,pickerType:A,hideProductVariants:B=!1,startupScreen:M=exports.ScreenName.Collections,rearrangeEnabled:V,selectSingleItem:$=!1,showProductDetails:L}=e,[_,z]=c.useReducer(S.collectionsReducer,{}),[W,G]=c.useState([exports.ScreenName.Collections,exports.ScreenName.RearrangeProducts].includes(M)?M:exports.ScreenName.Collections),[H,K]=c.useState("grid"),[U,Y]=c.useState(""),[J,Q]=c.useState(""),[X,Z]=c.useState(0),[ee,te]=c.useState(!1),[oe,ce]=c.useState(0),[re,se]=c.useState(""),[ne,le]=c.useState(!1),[ie,ae]=c.useState(!1),[de,ue]=c.useReducer(S.searchReducer,{collections:{},products:{}}),[he,pe]=c.useReducer(S.selectedColectionsReducer,Object.keys(b).length>0?b:{}),Se=c.useRef(null),[Ce,xe]=c.useState(!1),[ge,je]=c.useState();c.useEffect((()=>{te(!0),ae(!0),e.collectionFetcher(X,y).then((e=>{z({type:"fetched",data:(null==e?void 0:e.collections)||{}}),te(!1),Z((e=>e+1)),ae(!1)})).catch()}),[]),c.useEffect((()=>{let e=0;B?Object.keys(he||[]).forEach((t=>{var o;Object.keys((null===(o=he[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&he[-1]&&(null===(c=he[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(he||[]).forEach((t=>{var o;Object.keys((null===(o=he[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=he[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),ce(e)}),[_,he,B]),c.useEffect((()=>{J&&(te(!0),e.productFetcher(J,y).then((e=>{Object.keys(e).length&&z({type:"productsFetched",data:{collectionId:J,products:e}}),te(!1)})).catch())}),[J]),c.useEffect((()=>{const t=setTimeout((()=>{"rearrange"!==W&&(re.length||"collections"!==W)&&(re.length?(le(!0),e.searchFetcher(y,re).then((e=>{"collections"in e&&"products"in e?(ue({type:"set",data:e}),z({type:"searched",data:e.collections})):(ue({type:"set",data:{collections:{},products:e}}),z({type:"searched",data:e})),G("searchProducts"),te(!1),le(!1)}))):G("collections"))}),800);return()=>clearTimeout(t)}),[re]),c.useEffect((()=>{N&&(e.onAdd(he,oe),ye())}),[N]),c.useEffect((()=>{$&&Object.keys(he||{}).length&&oe&&(e.onAdd(he,oe),ye())}),[$,he,oe]);const ye=()=>{pe({type:"reset",data:{}})},be=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"===W||"searchProducts"===W)&&t.jsx("div",Object.assign({style:{padding:w?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t.jsx(n.Input,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ne?t.jsx(i.Spinner,{size:"small",color:r.COLORS.content.primary}):t.jsx(o.default,{})},id:"listInput",height:"24px",type:"text",value:re,onChangeText:e=>{e.length&&e.trim().length?se(e):se("")}})}))}),t.jsxs(g.ScrollContainerStyle,Object.assign({ref:Se,screenName:W},{children:["collections"===W&&t.jsx(d.CollectionsScreen,{customCollectionRestriction:e.customCollectionRestriction,dataLoading:ie,collections:_,selectedCollectionsDispatch:pe,setCollectionId:Y,setSelectedCollectionId:Q,setScreen:G,selectedCollections:he,collectionFetcher:e.collectionFetcher,storeId:y,collectionsDispatch:z,setSaveDisabled:te,pagingControls:{curPage:X,setCurPage:Z},hideCollectionCheckbox:I,renderWithoutModal:w,pickerType:A}),"products"===W&&U&&t.jsx(S.CollectionIdContext.Provider,Object.assign({value:U},{children:t.jsx(h.ProductsScreen,{hideInCollectionSearch:e.hideInCollectionSearch,customCollectionRestriction:e.customCollectionRestriction,productFetcher:e.productFetcher,setScreen:G,storeId:y,data:_[U],collectionsDispatch:z,selectedCollectionsDispatch:pe,selectedData:he,setSaveDisabled:te,searchInCollectionFetcher:e.searchInCollectionFetcher,hideProductCheckbox:O,outOfStockAction:F,hideVariantCheckbox:R,selectProductsFromCustomCollection:T,renderWithoutModal:w,pickerType:A,hideProductVariants:B,fbStatusFetcher:e.fbStatusFetcher,onProductDetailClick:e=>{xe(!0),je(e)},showProductDetailInfoIcon:L,scrollContainerRef:Se})})),"view"===W&&t.jsx(x.SelectedScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,collections:_,hideProductVariants:B,outOfStockAction:F,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"rearrange"===W&&t.jsx(p.RearrangeScreen,{selectedCollections:he||{},selectedCollectionsDispatch:pe,setScreen:G,outOfStockAction:F,rearrangeViewType:"grid"===H?"list":"grid",scrollContainerRef:Se,storeId:y,fbStatusFetcher:e.fbStatusFetcher}),"searchProducts"===W&&t.jsx(C.SearchScreen,{customCollectionRestriction:e.customCollectionRestriction,selectedCollections:he||{},searchedCollections:de||{},searchedCollectionsDispatch:ue,selectedCollectionsDispatch:pe,setScreen:G,collections:_,onBackPress:()=>{se(""),ue({type:"set",data:{collections:{},products:{}}})},pickerType:A,hideProductCheckbox:O,hideProductVariants:B,hideVariantCheckbox:R,storeId:y,fbStatusFetcher:e.fbStatusFetcher,setCollectionId:Y,setSelectedCollectionId:Q,renderWithoutModal:w,hideCollectionCheckbox:I,outOfStockAction:F})]}))]});return t.jsx(t.Fragment,{children:w?be:t.jsxs(l.StyledModal,Object.assign({zIndex:v,open:m,onClose:()=>{null==f||f(),ye()},headingTitle:E||("collections"===W||"products"===W?"Select Products":"view"===W?"Selected Products":"searchProducts"===W?"Searched Results":"rearrange"===W?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:D||"600px"},headerRightCustomElement:"rearrange"===W?(console.log("ignore:",K),t.jsx(t.Fragment,{})):t.jsx(t.Fragment,{}),footerContainerStyle:e.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:r.COLORS.surface.standard}:void 0,primaryButton:{buttonText:ee?"Loading...":W===exports.ScreenName.RearrangeProducts?"Done":"Add",disabled:ee||oe<1||P&&oe<P||!P&&k&&oe>k||!1,onClick:()=>{e.onAdd(he,oe),ye()}},wrapperStyle:e.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:q?t.jsx(t.Fragment,{}):P&&oe>P?t.jsx(a.Tag,{tagText:`You can only select ${P} products`,type:"negative"}):k&&oe>k?t.jsx(a.Tag,{tagText:`You can only select ${k} products`,type:"negative"}):oe>0?t.jsx(s.Button,{onClick:()=>{G(V?exports.ScreenName.RearrangeProducts:exports.ScreenName.SelectedProducts)},buttonText:P?`${oe}/${P} products selected`:`${oe} products selected`,buttonType:["rearrange","view"].includes(W)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(W)}):t.jsx(s.Button,{disabled:!0,buttonText:P?`${oe}/${P} products selected`:`${oe} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:Ce},{children:[be,Ce&&ge?t.jsx(u.ProductInfoOverlay,{productData:ge,outOfStockAction:F,onClose:()=>{xe(!1)}}):t.jsx(t.Fragment,{})]}))})};
|
|
@@ -24,6 +24,7 @@ interface ProductsScreenInterface {
|
|
|
24
24
|
showProductDetailInfoIcon?: boolean;
|
|
25
25
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
26
26
|
onProductDetailClick: (productData: Product | ProductVariant) => void;
|
|
27
|
+
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
27
28
|
}
|
|
28
29
|
export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
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"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),r=require("../../assets/icons/box.svg.js"),c=require("../../assets/icons/search.svg.js"),o=require("lodash"),s=require("react"),n=require("../../constants/Theme.js"),i=require("../checkBox/CheckBox.js"),l=require("../icon-button/IconButton.js"),u=require("../input/Input.js"),d=require("../spinner/Spinner.js"),a=require("../TypographyStyle.js"),h=require("./emptyState.js"),p=require("./product.js"),v=require("./ProductPickerShimmer.js"),j=require("./reducers.js"),g=require("./style.js"),y=require("./type.js"),P=require("./utility.js");exports.ProductsScreen=C=>{const{data:k,collectionsDispatch:O,selectedData:b,selectedCollectionsDispatch:f,productFetcher:x,storeId:S,setScreen:m,setSaveDisabled:I,hideInCollectionSearch:E,customCollectionRestriction:q,hideProductCheckbox:A,outOfStockAction:T=y.OUT_OF_STOCK_ACTION.BLUR,hideVariantCheckbox:D=!1,selectProductsFromCustomCollection:V=!1,pickerType:R,hideProductVariants:L,fbStatusFetcher:F,onProductDetailClick:w,showProductDetailInfoIcon:B,scrollContainerRef:_}=C,H=s.useContext(j.CollectionIdContext),U=s.useRef(0),J=s.useRef(!1),[K,M]=s.useState(!1),[N,W]=s.useState(""),[z,G]=s.useState(!1),[Q,X]=s.useState(k),Y=s.useRef(!1);s.useEffect((()=>{const e=setTimeout((()=>{N.length?(G(!0),C.searchInCollectionFetcher(S,H,N).then((e=>{const t=o.cloneDeep(k);t.products=e,X(t);const r=P.getVariantIdsToFetchAtProductLevel(null!=e?e:{});ee(r,null!=e?e:{},!0),I(!1),G(!1)}))):X(k)}),800);return()=>clearTimeout(e)}),[N]);const Z=()=>{if(!_||!(null==_?void 0:_.current))return;const{scrollTop:e,clientHeight:t,scrollHeight:r}=_.current;e+t>=r-20&&!Y.current&&!J.current&&(I(!0),M(!0),J.current=!0,x(H,S,10,U.current).then((e=>{if(Object.keys(e).length||(Y.current=!0),Object.keys(e).length){const t=Q;t.products=Object.assign(Object.assign({},Q.products),e),X(t);const r=P.getVariantIdsToFetchAtProductLevel(e);ee(r,e),U.current+=1}J.current=!1,M(!1),I(!1)})).catch())};s.useEffect((()=>{var e;return null===(e=null==_?void 0:_.current)||void 0===e||e.addEventListener("scroll",Z),()=>{var e;null===(e=null==_?void 0:_.current)||void 0===e||e.removeEventListener("scroll",Z)}}),[]),s.useEffect((()=>{var e,t,r,c;Y.current=!1,U.current=Math.floor((null===(t=Object.keys(null!==(e=k.products)&&void 0!==e?e:{}))||void 0===t?void 0:t.length)/10);const o=P.getVariantIdsToFetchAtProductLevel(null!==(r=k.products)&&void 0!==r?r:{});ee(o,null!==(c=k.products)&&void 0!==c?c:{})}),[H]);const $=!!q&&k.isSmartCollection;s.useEffect((()=>{(null==k?void 0:k.products)||te(10)}),[]);const ee=(e,t,r)=>{F||(r?P.markVariantsAsApprovedProductsLevel(t,O,H,Q,X):P.markVariantsAsApprovedProductsLevel(t,O,H)),e.length>0&&F&&F(S,e).then((e=>{const c=Object.assign({},t);Object.keys(t).forEach((r=>{var o,s;Object.keys(null!==(s=null===(o=null==t?void 0:t[r])||void 0===o?void 0:o.variants)&&void 0!==s?s:{}).forEach((o=>{var s,n;const i=null===(s=null==t?void 0:t[r].variants)||void 0===s?void 0:s[o];i&&"REJECTED"===e[o]?i.fbStatus="REJECTED":i&&"APPROVED"===e[o]&&(i.fbStatus="APPROVED");const l=null===(n=null==c?void 0:c[r])||void 0===n?void 0:n.variants;l&&l[o]&&(l[o]=i)}))})),r?(X((e=>{const t=Object.assign({},e);return t.products=c,t})),O({type:"productsPaged",data:{collectionId:H,products:c}})):O({type:"productsPaged",data:{collectionId:H,products:c}})})).catch((e=>{r?P.markVariantsAsApprovedProductsLevel(t,O,H,Q,X):P.markVariantsAsApprovedProductsLevel(t,O,H)}))},te=e=>{I(!0),G(!0),x(H,S,e,0).then((t=>{if(Object.keys(t).length||(Y.current=!0),Object.keys(t).length){X(Object.assign(Object.assign({},Q),{products:t}));const e=P.getVariantIdsToFetchAtProductLevel(t);ee(e,t),U.current=1}e||f({type:"selected",data:{id:H,val:Object.assign(Object.assign({},k),{products:t})}}),I(!1),G(!1)})).catch()},re=(e,t)=>{const r=P.liftTheStateUp(t,k);f({type:e,data:Object.assign(Object.assign({},r),{isRestricted:q})})};return e.jsxs("div",{children:[e.jsxs(g.ProductScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,height:16,onClick:()=>{m("collections")}}),e.jsx(a.BodyCaption,Object.assign({style:{color:n.COLORS.content.secondary}},{children:k.name}))]}),!E&&e.jsx("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e.jsx(u.Input,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>z&&N.length?e.jsx(d.Spinner,{size:"small",color:n.COLORS.content.primary}):e.jsx(c.default,{})},id:"listInput",height:"24px",type:"text",value:N,onChangeText:e=>{e.length&&e.trim().length?W(e):W("")},placeholder:"Search products in this collection..."})})),e.jsxs("div",{children:[Object.keys((null==Q?void 0:Q.products)||[]).length>0&&!$&&!N.length&&!A&&"-1"!==H&&e.jsxs(g.ProductScreenCollectionCardStyle,{children:[e.jsx(i.CheckBox,{isChecked:!!(null==b?void 0:b[H]),isPartiallyChecked:P.isCollectionPartiallyChecked(H,Q,b,L),onValueChange:function(e){e?te():f({type:"unselected",data:{id:H}})}}),e.jsx("div",Object.assign({style:{width:40,height:40}},{children:e.jsx(r.default,{})})),e.jsx(a.TitleRegular,{children:"All Products"})]}),Object.keys((null==Q?void 0:Q.products)||[]).length?Object.keys(Q.products||[]).map((t=>e.jsx(p.ProductGroup,{outOfStockAction:T,collectionId:H,isProductPartiallyChecked:P.isProductPartiallyChecked(H,t,b,Q,L),productId:t,data:Q.products[t],selectedData:b,selectedCollectionsDispatch:f,viewOnly:!V&&!!$,upliftAdditions:re,hideProductCheckbox:A,hideVariantCheckbox:D,hideProductVariants:L,pickerType:R,onProductDetailClick:w,showProductDetailInfoIcon:B},t))):z?e.jsx(v.ProductPickerShimmer,{limit:10}):e.jsx(h.EmptyState,{title:"No products to show",subtitle:N.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),K&&e.jsx(v.ProductPickerShimmer,{})]})};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Collection, FbStatusFetcherReturn, SearchedItems, SelectedItems } from '.';
|
|
3
3
|
import { SearchReducerActions, SelectedCollectionsActions } from './reducers';
|
|
4
|
+
import { OUT_OF_STOCK_ACTION } from './type';
|
|
4
5
|
interface SearchScreenInterface {
|
|
5
6
|
customCollectionRestriction?: boolean;
|
|
6
7
|
selectedCollections: SelectedItems;
|
|
@@ -22,6 +23,7 @@ interface SearchScreenInterface {
|
|
|
22
23
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
23
24
|
hideCollectionCheckbox?: boolean;
|
|
24
25
|
renderWithoutModal?: boolean;
|
|
26
|
+
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
25
27
|
}
|
|
26
28
|
export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
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("react"),l=require("../icon-button/IconButton.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../../assets/icons/arrow_left.svg.js"),o=require("react"),l=require("../icon-button/IconButton.js"),c=require("../TypographyStyle.js"),i=require("./collectionScreen.js"),s=require("./emptyState.js"),d=require("./product.js"),r=require("./style.js"),n=require("./utility.js");exports.SearchScreen=u=>{var a;const{customCollectionRestriction:h,selectedCollections:v,searchedCollections:p,searchedCollectionsDispatch:C,selectedCollectionsDispatch:j,setScreen:k,collections:y,onBackPress:b,hideVariantCheckbox:x,pickerType:S,hideProductVariants:P,hideProductCheckbox:f,storeId:m,fbStatusFetcher:O,setCollectionId:g,setSelectedCollectionId:I,hideCollectionCheckbox:q,renderWithoutModal:D,outOfStockAction:F}=u;o.useEffect((()=>{var e;n.fetchFbStatusCollection(null!==(e=p.products)&&void 0!==e?e:{},m,C,O,"setProducts")}),[null==p?void 0:p.products]);const T=!!h&&(null==v?void 0:v.isCustom);return e.jsxs("div",{children:[e.jsxs(r.SelectedScreenHeader,{children:[e.jsx(l.IconButton,{Icon:t.default,onClick:()=>{k("collections"),b()}}),e.jsx(c.BodyCaption,{children:(null===(a=Object.keys(null==p?void 0:p.collections))||void 0===a?void 0:a.length)?"Searched Collections & Products":"Searched Products"})]}),e.jsx("div",{children:Object.keys(null==p?void 0:p.products).length||Object.keys(null==p?void 0:p.collections).length?e.jsxs(e.Fragment,{children:[e.jsx(e.Fragment,{children:Object.keys(null==p?void 0:p.collections).map((t=>e.jsx(i.CollectionCard,{customCollectionRestriction:h,data:null==y?void 0:y[t],isDisabled:T&&!(null==v?void 0:v[t]),isChecked:!!(null==v?void 0:v[t]),isPartiallyChecked:n.isCollectionPartiallyChecked(t,null==y?void 0:y[t],v,P),selectedCollectionsDispatch:j,setCollectionId:g,setSelectedCollectionId:I,setScreen:k,id:t,hideCollectionCheckbox:q||"-1"===t,selectedCollections:v,renderWithoutModal:D,pickerType:S,usedInSearch:!0},t)))}),e.jsx(e.Fragment,{children:Object.keys(null==p?void 0:p.products).map((t=>{var o,l;return Object.keys((null===(l=null===(o=null==p?void 0:p.products)||void 0===o?void 0:o[t])||void 0===l?void 0:l.products)||[]).map((o=>{var l,c,i;let s=!1;return(null===(l=null==p?void 0:p.products)||void 0===l?void 0:l.isCustom)&&(s=!0),e.jsx(d.ProductGroup,{collectionId:t,upliftAdditions:(e,o)=>((e,t,o)=>{var l;const c=n.liftTheStateUp(o,null===(l=null==p?void 0:p.products)||void 0===l?void 0:l[e]);j({type:t,data:Object.assign(Object.assign({},c),{isRestricted:h})})})(t,e,o),productId:o,data:(null===(c=null==p?void 0:p.products)||void 0===c?void 0:c[t].products)[o],isProductPartiallyChecked:n.isProductPartiallyChecked(t,o,v,null===(i=p.products)||void 0===i?void 0:i[t],P),selectedData:v,selectedCollectionsDispatch:j,viewOnly:s,hideProductCheckbox:f,hideVariantCheckbox:x,hideProductVariants:P,pickerType:S,outOfStockAction:F},o)}))}))})]}):e.jsx(s.EmptyState,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("styled-components"),t=require("../../constants/Theme.js"),i=require("./modal.js");function o(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var r=o(e);const l=r.default.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
|
-
height:
|
|
4
|
+
height: 75vh;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
`,n=r.default.div`
|
|
7
7
|
overflow-y: scroll;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CSSProperties } from 'styled-components';
|
|
3
3
|
import { EmailTemplateType } from './models/EmailTemplate';
|
|
4
|
+
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";
|
|
4
5
|
declare const EmailTemplateThumbnailPreview: React.FC<{
|
|
5
6
|
template: EmailTemplateType;
|
|
6
7
|
hideHeader?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../button/Button.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),t=require("../button/Button.js"),a=require("../TypographyStyle.js"),n=require("./EmailTemplatePreview.styled.js");const s="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=s,exports.default=r=>{let{template:i,handleViewTemplate:o,hideHeader:l,hideViewButton:p,containerStyle:d,emailHtmlContainerId:c,emailDisplayContent:u}=r;return e.jsxs(n.EmailContainer,Object.assign({hideHeader:l,style:Object.assign({},null!=d?d:{})},{children:[!l&&e.jsx(n.Header,{children:e.jsx(a.TitleRegular,Object.assign({style:{maxWidth:"100%"}},{children:i.name}))}),e.jsx(n.IframeContainer,{children:u?e.jsx("iframe",{title:"Email template preview",id:null!=c?c:"",width:"100%",srcDoc:(m=u,m.replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/src="<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{product.photoUrl}}<\/span><span> <\/span>"/g,`src=${s}`).replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"")),height:"100%",style:{pointerEvents:"none"}}):e.jsx(n.ImageContainer,Object.assign({hideHeader:l},{children:e.jsx(n.CardLoadingContainer,{})}))}),!p&&e.jsx(n.ViewButton,{children:e.jsx(t.Button,{buttonType:"tertiary",buttonText:"View",onClick:()=>{o&&o()}})})]}));var m};
|
|
@@ -31,6 +31,7 @@ export interface AnalyticsDropdownInterface {
|
|
|
31
31
|
};
|
|
32
32
|
variant?: 'small' | 'default';
|
|
33
33
|
datePickerPlacement?: DropDirection;
|
|
34
|
+
closeDropdown?: boolean;
|
|
34
35
|
}
|
|
35
36
|
export declare const AnalyticsDropdown: React.FC<AnalyticsDropdownInterface>;
|
|
36
37
|
export declare const EachItem: React.FC<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,Fragment as o,jsxs as n}from"react/jsx-runtime";import{useState as t,useEffect as l}from"react";import{Dropdown as i}from"react-bootstrap";import{DEFAULT_THEME as s,BASE_COLORS as a}from"../../constants/Theme.js";import{DatePicker as d}from"../datePicker/DatePicker.js";import{BodySecondary as c,BodyCaption as r,Caption as g}from"../TypographyStyle.js";import{MainDropdown as p,ItemMenuContainer as u}from"./CommonStyles.js";const m=a=>{let{options:r,placeholder:u="Select an option",selected:m,onOptionSelected:b,resetDropdown:h,maxHeight:
|
|
1
|
+
import{jsx as e,Fragment as o,jsxs as n}from"react/jsx-runtime";import{useState as t,useEffect as l}from"react";import{Dropdown as i}from"react-bootstrap";import{DEFAULT_THEME as s,BASE_COLORS as a}from"../../constants/Theme.js";import{DatePicker as d}from"../datePicker/DatePicker.js";import{BodySecondary as c,BodyCaption as r,Caption as g}from"../TypographyStyle.js";import{MainDropdown as p,ItemMenuContainer as u}from"./CommonStyles.js";const m=a=>{let{options:r,placeholder:u="Select an option",selected:m,onOptionSelected:b,resetDropdown:h,maxHeight:y,backgroundColor:f,calendarPopperConfig:D,variant:k="default",datePickerPlacement:j,closeDropdown:S}=a;var R,w,C;const[x,$]=t(!1),[T,P]=t(m),[I,N]=t(),[A,E]=t(!1),F=()=>{!x&&E(!A)},[H,M]=t(m),V="small"===k?g:c;return l((()=>{h&&P(void 0)}),[h]),l((()=>{var e;(null==m?void 0:m.isCustom)&&(null===(e=m.dateRangeSelectionOptions)||void 0===e?void 0:e.selectedDates)?N(m.dateRangeSelectionOptions.selectedDates):N(void 0),P(m)}),[m]),l((()=>{E(!1),$(!1)}),[S]),e(o,{children:n(p,Object.assign({drop:"down",show:A,onToggle:F,backgroundColor:f,id:"analytic-dropdown"},{children:[e(i.Toggle,Object.assign({id:"dropdown-autoclose-outside",className:"main--dropdown",style:"small"===k?{display:"flex",alignItems:"center",gap:6,padding:"4px 8px",backgroundColor:"#FAFAFA",borderRadius:4,border:`1px solid ${s.colorsV2.stroke.primary}`}:void 0},{children:e(V,Object.assign({style:"small"===k?{color:s.colorsV2.content.secondary}:void 0},{children:(null==T?void 0:T.isCustom)?I?O(I[0])===O(I[1])?`${O(I[0])}`:`${O(I[0])} to ${O(I[1])}`:null==H?void 0:H.label:T?null==T?void 0:T.label:u}))})),e(i.Menu,Object.assign({className:"main--dropdown"},{children:n(p,Object.assign({drop:null!=j?j:"end",id:"sub--dropdown",show:x,onToggle:e=>{!e&&E(!1),$(!x)}},{children:[e("div",Object.assign({style:{maxHeight:y||"auto",overflowY:"scroll"}},{children:r.map((o=>{var n;return e("div",{children:(null==o?void 0:o.isCustom)?e(i.Toggle,Object.assign({className:"sub--dropdown"},{children:e(v,{eachOption:o,selectedOption:T,selectedDate:I,onClickingEachItem:e=>{P(e),$(!0)},rangeSelection:!!(null===(n=null==o?void 0:o.dateRangeSelectionOptions)||void 0===n?void 0:n.selectRange)})})):e(v,{eachOption:o,selectedOption:T,selectedDate:I,onClickingEachItem:e=>{if(N(void 0),P(e),M(e),F(),!e.noOfDays)return void b(e);const o=new Date,n=new Date;n.setDate(o.getDate()-e.noOfDays),b(Object.assign(Object.assign({},e),{selectedRange:[n,o]}))}})},null==o?void 0:o.key)}))})),e(i.Menu,Object.assign({className:"sub--dropdown",popperConfig:{modifiers:[{name:"offset",options:{offset:[(null==D?void 0:D.offsetSkid)||0,(null==D?void 0:D.offsetDistance)||0]}}]}},{children:e(d,{selectRange:(null===(R=null==T?void 0:T.dateRangeSelectionOptions)||void 0===R?void 0:R.selectRange)||!1,maxDate:null===(w=null==T?void 0:T.dateRangeSelectionOptions)||void 0===w?void 0:w.maxDate,minDate:null===(C=null==T?void 0:T.dateRangeSelectionOptions)||void 0===C?void 0:C.minDate,selectedDates:I,onSelectRange:(e,o)=>{const n=[e,o];(null==T?void 0:T.dateRangeSelectionOptions)&&(T.dateRangeSelectionOptions.selectedDates=n,b(Object.assign(Object.assign({},T),{selectedRange:[e,o]}))),M(T),$(!1),N(n),E(!A)},onSelectDate:e=>{(null==T?void 0:T.dateRangeSelectionOptions)&&(T.dateRangeSelectionOptions.selectedDates=[e,e],b(Object.assign(Object.assign({},T),{selectedRange:[e,e]}))),M(T),$(!1),N([e,e]),E(!A)}})}))]}))}))]}))})},v=o=>{let{eachOption:t,selectedOption:l,selectedDate:i,onClickingEachItem:s,rangeSelection:d}=o;return n(u,Object.assign({onClick:()=>s(t),isSelected:t.isCustom?t.key==(null==l?void 0:l.key)&&!!i:t.key==(null==l?void 0:l.key)},{children:[e(c,Object.assign({color:t.key==(null==l?void 0:l.key)?a.positive[900]:a.grayscale[900]},{children:t.label})),i&&(null==l?void 0:l.isCustom)&&t.key==(null==l?void 0:l.key)&&e(r,{children:d?`${O(i[0])} to ${O(i[1])}`:`${O(i[0])}`})]}),t.key)},O=e=>e.toLocaleString("default",{day:"numeric",month:"short",year:"numeric"});export{m as AnalyticsDropdown,v as EachItem,O as formatDate};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useState as r}from"react";import{AvatarStyle as i}from"./Avatar.styled.js";import{SIZE as o,AVATAR_BACKGROUND as s,AVATAR_TYPES as c,AVATAR_SIZE_MAP as a}from"./AvatarHelper.js";import{BodyTiny as n,TitleSmall as l,TitleMedium as d}from"../TypographyStyle.js";import{COLORS as p}from"../../constants/Theme.js";const m={[o.SMALL]:16,[o.MEDIUM]:20,[o.LARGE]:32},h={[s.LIGHT]:p.content.secondary,[s.DARK]:p.surface.standard},b=s=>{const[p,b]=r(!1),g=()=>{const e=(s.name||"").split(".").join(" ").split(" ").map((e=>e.charAt(0).toUpperCase())).slice(0,2).join("");return s.size===o.SMALL?t(n,Object.assign({style:{color:h[s.background]}},{children:e})):s.size===o.MEDIUM?t(l,Object.assign({style:{color:h[s.background]}},{children:e})):s.size===o.LARGE?t(d,Object.assign({style:{color:h[s.background]}},{children:e})):void 0};return e(i,Object.assign({type:s.type,size:s.size,background:s.background},{children:[s.type===c.IMAGE&&(s.useNameFallback&&!p?t("img",{alt:"",width:a[s.size],height:a[s.size],style:{borderRadius:"50%",objectFit:"contain"},src:s.photoUrl,onError:()=>{b(!0)}}):s.useNameFallback&&p&&s.name?t("div",{children:g()}):t("img",{alt:"",width:a[s.size],height:a[s.size],style:{borderRadius:"50%",objectFit:"contain"},src:s.photoUrl})),s.type===c.INITIALS&&t("div",{children:g()}),s.type===c.ICON&&s.icon&&t(s.icon,{width:m[s.size],height:m[s.size],color:h[s.background]})]}))};export{m as AVATAR_SIZE_VS_ICON_SIZE_MAP,b as Avatar,h as BACKGROUND_VS_TEXT_COLOR_MAP};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,
|
|
1
|
+
import{jsx as e,jsxs as t,Fragment as a}from"react/jsx-runtime";import{SearchIcon as i}from"../../assets/icons/searchIcon.js";import{useState as n,useRef as r,useEffect as o}from"react";import{StyledProductGrid as s,StyledProduct as l}from"./PostPicker.styled.js";import{Tag as d}from"../tag/Tag.js";import{ButtonRegular as c,BodyPrimary as p,BodyCaption as m,TitleMedium as h,ButtonLarge as y,BodySecondary as g}from"../TypographyStyle.js";import{unCamelCase as u}from"../../utils/unCamelCase.js";import{PRIMARY as j}from"../../constants/colors.js";import{COLORS as w}from"../../constants/Theme.js";import v from"../../assets/icons/instagram.svg.js";import f from"../../assets/icons/warning.svg.js";import"../tooltips/Tooltip.js";import"../analytics-chips-and-dropdowns/CommonStyles.js";import{AnalyticsDropdown as b}from"../analytics-chips-and-dropdowns/AnalyticsDropdown.js";import"../analytics-chips-and-dropdowns/AnalyticsMetric.js";import"../../utils/DateUtils.js";import"../analytics-chips-and-dropdowns/chart/LineChart/LineChart.js";import"react-bootstrap";import"../analytics-chips-and-dropdowns/chart/linearChipGroupedChart/LinearChipGroupedChart.styled.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChartAnalytics.js";import"../analytics-chips-and-dropdowns/chart/Pie/PieChart.js";import"../analytics-chips-and-dropdowns/chart/HorizontalBarGraph/HorizontalGraph.js";import"../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarChart.js";import"../analytics-chips-and-dropdowns/chart/StackedBarChart/StackedBarDistributionChart.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarGraph/VerticalGraph.js";import"../analytics-chips-and-dropdowns/chart/heatmap/HeatMap.js";import"../analytics-chips-and-dropdowns/chart/heatmap/HeatMapVertical.js";import"../analytics-chips-and-dropdowns/chart/VerticalBarAndLinearGraph/VerticalBarAndLinearGraph.js";import{StyledModal as C}from"../modals/styledModal.js";import{BikShimmer as D}from"../shimmer/ShimmerComponent/BikShimmer.js";import{ShimmerImage as T}from"../shimmer-image/ShimmerImage.js";import{StateComponent as O,StateInterface as x}from"../states/StateComponent.js";import"../../_virtual/_tslib.js";var k,S;!function(e){e.STORY="story",e.POST="post",e.REEL="reel"}(k||(k={})),function(e){e.Today="Today",e["7_Days"]="7",e["30_Days"]="30",e.custom="custom",e.Yesterday="Yesterday"}(S||(S={}));const B=[{label:"Today",value:"today",key:S.Today,typeValue:[new Date,new Date]},{label:"Last 7 days",value:"7 days",key:S["7_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-6)),new Date]},{label:"Last 30 days",value:"30 days",key:S["30_Days"],typeValue:[new Date((new Date).setDate((new Date).getDate()-29)),new Date]},{label:"Custom range",value:"calender",key:S.custom,isCustom:!0,dateRangeSelectionOptions:{selectRange:!0,maxDate:new Date((new Date).setMonth((new Date).getMonth()+3))}}],I=S=>{var I,L;const[P,V]=n(null!==(I=S.previouslySelected)&&void 0!==I?I:[]),[_,G]=n(""),[E,N]=n(!1),[R,$]=n(S.media),[M,A]=n(!1),[H,U]=n(!1),[z,F]=n(!1),Y=r(null);o((()=>{S.media.length||(N(!0),setTimeout((()=>{N(!1)}),2e3)),V(S.selected||[])}),[]),o((()=>{S.media.length>0&&($(S.media),N(!1))}),[null===(L=null==S?void 0:S.media)||void 0===L?void 0:L.length]),o((()=>{P.length>0&&G("")}),[P.length]),o((()=>{M&&($(S.media),U(!1))}),[M]),o((()=>{const e=e=>{document.getElementById("analytic-dropdown").contains(e.target)||F(!z)},t=document.getElementById("post-picker");return t&&t.addEventListener("click",e),()=>{t&&t.removeEventListener("click",e)}}));return e("div",Object.assign({ref:Y},{children:t(C,Object.assign({zIndex:201,open:S.showModal,headingTitle:S.title,onClose:S.onClose,centralContainerStyles:{width:1071,height:S.showFilter?650:564},primaryButton:{disabled:!R.length,buttonType:"primary",buttonText:`Select ${u(S.mediaType)}`,onClick:()=>{P.length?S.onSelect(P):G(`Please select a ${S.mediaType} to proceed`)}},secondaryButton:{buttonType:"secondary",buttonText:"Back",onClick:()=>S.onClose()},footerLeftCustomElement:_?e(d,{tagText:_,type:"negative",LeadingIcon:f}):P.length?t(g,{children:[P.length," selected"]}):null,id:"post-picker"},{children:[S.showFilter&&t("div",Object.assign({style:{marginTop:24,marginBottom:24,padding:"0 24px",display:"flex",flexDirection:"row",gap:8,alignItems:"center"}},{children:[e(b,{options:B,placeholder:"posted on",resetDropdown:M,onOptionSelected:e=>{var t,a;let i=null,n=null;"Custom range"===e.label?(i=(null===(t=null==e?void 0:e.selectedRange)||void 0===t?void 0:t[0])||new Date,n=(null===(a=null==e?void 0:e.selectedRange)||void 0===a?void 0:a[1])||new Date):(i=e.typeValue[0],n=e.typeValue[1]);const r=S.media.filter((e=>function(e,t,a){const i=new Date(e),n=new Date(t),r=new Date(a);return i>=n&&i<=r}(e.timestamp,i,n)));$(r),U(!0),A(!1)},closeDropdown:z}),H&&e(c,Object.assign({color:w.content.secondary,onClick:()=>A(!0)},{children:"Clear"}))]})),E?e("div",Object.assign({style:{padding:"0 24px"}},{children:e(D,{boxes:[{width:(S.mediaType==k.POST?148:104)+"px",height:(S.mediaType==k.POST?148:172)+"px"}]})})):e(a,{children:R&&R.length?e(s,Object.assign({mediaType:S.mediaType},{children:R.map((a=>{return t(l,Object.assign({mediaType:S.mediaType,className:""+(i=a,n=P,n.some((e=>e.id===i.id))?"selected":""),onClick:()=>{return e=a,void V((()=>P.find((t=>t.id===e.id))?P.filter((t=>t.id!==e.id)):!S.limit||P.length<S.limit?[...P,e]:(G(`Only ${S.limit} ${S.mediaType}s can be selected`),P)));var e}},{children:[e(T,{imageUrl:a.imageUrl,width:S.mediaType==k.POST?148:104,height:S.mediaType==k.POST?148:172,alt:a.overlayCaption}),t("div",Object.assign({className:"overlay"},{children:[e("a",Object.assign({target:"_blank",rel:"noreferrer",href:a.redirectionUrl},{children:t("div",Object.assign({className:"overlay__redirection"},{children:[e(v,{height:22,width:22}),e(p,Object.assign({color:j,style:{fontWeight:500}},{children:"View"}))]}))})),e("div",Object.assign({className:"overlay__caption"},{children:e(m,Object.assign({color:w.content.placeholder},{children:a.overlayCaption}))}))]}))]}),a.id);var i,n}))})):e("div",Object.assign({style:{justifyContent:"center",alignItems:"center",display:"flex",height:422}},{children:S.media.length?R.length?e(a,{}):t("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",gap:"16px"}},{children:[e("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",width:"48px",height:"48px",backgroundColor:`${w.background.inverse}`,borderRadius:"50%"}},{children:e(i,{color:w.content.primaryInverse})})),t("div",Object.assign({style:{display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",gap:"8px"}},{children:[e(h,{children:"No results found"}),e(p,{children:"Sorry we could not find any results for the selected filter"})]})),e("div",Object.assign({onClick:()=>{A(!0)}},{children:e(y,Object.assign({color:`${w.content.brand}`},{children:"Clear Filter"}))}))]})):e(O,{states:x.WARNING,heading:`No ${S.mediaType}s on your account`,subline:`There seems to be no ${S.mediaType}s on your account`,isButtonEnabled:!1,width:400})}))})]}))}))};export{S as DateKeys,k as MEDIA_TYPES,I as PostPicker,B as dateOptions};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as l}from"react";import{COLORS as n}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as
|
|
1
|
+
import{jsxs as e,jsx as t,Fragment as o}from"react/jsx-runtime";import c from"../../assets/icons/search.svg.js";import{useReducer as r,useState as s,useRef as i,useEffect as l}from"react";import{COLORS as n}from"../../constants/Theme.js";import{Button as d}from"../button/Button.js";import{Input as a}from"../input/Input.js";import{StyledModal as u}from"../modals/styledModal.js";import{Spinner as h}from"../spinner/Spinner.js";import{Tag as p}from"../tag/Tag.js";import{CollectionsScreen as m}from"./collectionScreen.js";import{ProductInfoOverlay as C}from"./productInfoOverlay.js";import{ProductsScreen as g}from"./productScreen.js";import{RearrangeScreen as f}from"./rearrangeScreen.js";import{collectionsReducer as b,searchReducer as y,selectedColectionsReducer as S,CollectionIdContext as v}from"./reducers.js";import{SearchScreen as k}from"./searchScreen.js";import{SelectedScreen as P}from"./selectedScreen.js";import{ContainerStyle as x,ScrollContainerStyle as j}from"./style.js";import{OUT_OF_STOCK_ACTION as I}from"./type.js";var F;!function(e){e.Collections="collections",e.RearrangeProducts="rearrange",e.SelectedProducts="view",e.SearchProducts="searchProducts",e.Products="products"}(F||(F={}));const O=O=>{const{storeId:T,selectedItems:D,onClose:R,visible:w,zIndex:E,exactLimit:A,limit:V,hideCollectionCheckbox:$,hideProductCheckbox:B,outOfStockAction:L=I.BLUR,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,hideSelectionCount:W,title:G,width:H,renderWithoutModal:Y,onClickSave:K,pickerType:N,hideProductVariants:U=!1,startupScreen:q=F.Collections,rearrangeEnabled:J,selectSingleItem:Q=!1,showProductDetails:X}=O,[Z,_]=r(b,{}),[ee,te]=s([F.Collections,F.RearrangeProducts].includes(q)?q:F.Collections),[oe,ce]=s("grid"),[re,se]=s(""),[ie,le]=s(""),[ne,de]=s(0),[ae,ue]=s(!1),[he,pe]=s(0),[me,Ce]=s(""),[ge,fe]=s(!1),[be,ye]=s(!1),[Se,ve]=r(y,{collections:{},products:{}}),[ke,Pe]=r(S,Object.keys(D).length>0?D:{}),xe=i(null),[je,Ie]=s(!1),[Fe,Oe]=s();l((()=>{ue(!0),ye(!0),O.collectionFetcher(ne,T).then((e=>{_({type:"fetched",data:(null==e?void 0:e.collections)||{}}),ue(!1),de((e=>e+1)),ye(!1)})).catch()}),[]),l((()=>{let e=0;U?Object.keys(ke||[]).forEach((t=>{var o;Object.keys((null===(o=ke[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c;"-1"!==t&&ke[-1]&&(null===(c=ke[-1].products)||void 0===c?void 0:c[o])||(e+=1)}))})):Object.keys(ke||[]).forEach((t=>{var o;Object.keys((null===(o=ke[t])||void 0===o?void 0:o.products)||[]).forEach((o=>{var c,r;Object.keys((null===(r=null===(c=ke[t].products)||void 0===c?void 0:c[o])||void 0===r?void 0:r.variants)||[]).forEach((()=>{e+=1}))}))})),pe(e)}),[Z,ke,U]),l((()=>{ie&&(ue(!0),O.productFetcher(ie,T).then((e=>{Object.keys(e).length&&_({type:"productsFetched",data:{collectionId:ie,products:e}}),ue(!1)})).catch())}),[ie]),l((()=>{const e=setTimeout((()=>{"rearrange"!==ee&&(me.length||"collections"!==ee)&&(me.length?(fe(!0),O.searchFetcher(T,me).then((e=>{"collections"in e&&"products"in e?(ve({type:"set",data:e}),_({type:"searched",data:e.collections})):(ve({type:"set",data:{collections:{},products:e}}),_({type:"searched",data:e})),te("searchProducts"),ue(!1),fe(!1)}))):te("collections"))}),800);return()=>clearTimeout(e)}),[me]),l((()=>{K&&(O.onAdd(ke,he),Te())}),[K]),l((()=>{Q&&Object.keys(ke||{}).length&&he&&(O.onAdd(ke,he),Te())}),[Q,ke,he]);const Te=()=>{Pe({type:"reset",data:{}})},De=e(x,{children:[O.postHeader&&t("div",Object.assign({style:{padding:"0 24px"}},{children:O.postHeader})),!O.hideGlobalSearch&&t(o,{children:("collections"===ee||"searchProducts"===ee)&&t("div",Object.assign({style:{padding:Y?"8px 16px":"12px 24px",borderBottom:"1px solid #E0E0E0"}},{children:t(a,{placeholder:"Search Collections or Products",noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ge?t(h,{size:"small",color:n.content.primary}):t(c,{})},id:"listInput",height:"24px",type:"text",value:me,onChangeText:e=>{e.length&&e.trim().length?Ce(e):Ce("")}})}))}),e(j,Object.assign({ref:xe,screenName:ee},{children:["collections"===ee&&t(m,{customCollectionRestriction:O.customCollectionRestriction,dataLoading:be,collections:Z,selectedCollectionsDispatch:Pe,setCollectionId:se,setSelectedCollectionId:le,setScreen:te,selectedCollections:ke,collectionFetcher:O.collectionFetcher,storeId:T,collectionsDispatch:_,setSaveDisabled:ue,pagingControls:{curPage:ne,setCurPage:de},hideCollectionCheckbox:$,renderWithoutModal:Y,pickerType:N}),"products"===ee&&re&&t(v.Provider,Object.assign({value:re},{children:t(g,{hideInCollectionSearch:O.hideInCollectionSearch,customCollectionRestriction:O.customCollectionRestriction,productFetcher:O.productFetcher,setScreen:te,storeId:T,data:Z[re],collectionsDispatch:_,selectedCollectionsDispatch:Pe,selectedData:ke,setSaveDisabled:ue,searchInCollectionFetcher:O.searchInCollectionFetcher,hideProductCheckbox:B,outOfStockAction:L,hideVariantCheckbox:M,selectProductsFromCustomCollection:z,renderWithoutModal:Y,pickerType:N,hideProductVariants:U,fbStatusFetcher:O.fbStatusFetcher,onProductDetailClick:e=>{Ie(!0),Oe(e)},showProductDetailInfoIcon:X,scrollContainerRef:xe})})),"view"===ee&&t(P,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,hideProductVariants:U,outOfStockAction:L,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"rearrange"===ee&&t(f,{selectedCollections:ke||{},selectedCollectionsDispatch:Pe,setScreen:te,outOfStockAction:L,rearrangeViewType:"grid"===oe?"list":"grid",scrollContainerRef:xe,storeId:T,fbStatusFetcher:O.fbStatusFetcher}),"searchProducts"===ee&&t(k,{customCollectionRestriction:O.customCollectionRestriction,selectedCollections:ke||{},searchedCollections:Se||{},searchedCollectionsDispatch:ve,selectedCollectionsDispatch:Pe,setScreen:te,collections:Z,onBackPress:()=>{Ce(""),ve({type:"set",data:{collections:{},products:{}}})},pickerType:N,hideProductCheckbox:B,hideProductVariants:U,hideVariantCheckbox:M,storeId:T,fbStatusFetcher:O.fbStatusFetcher,setCollectionId:se,setSelectedCollectionId:le,renderWithoutModal:Y,hideCollectionCheckbox:$,outOfStockAction:L})]}))]});return t(o,{children:Y?De:e(u,Object.assign({zIndex:E,open:w,onClose:()=>{null==R||R(),Te()},headingTitle:G||("collections"===ee||"products"===ee?"Select Products":"view"===ee?"Selected Products":"searchProducts"===ee?"Searched Results":"rearrange"===ee?"Rearrange Products":void 0),footerShadow:!0,centralContainerStyles:{width:H||"600px"},headerRightCustomElement:"rearrange"===ee?(console.log("ignore:",ce),t(o,{})):t(o,{}),footerContainerStyle:O.stickyFooter?{position:"absolute",bottom:0,left:0,width:"100%",zIndex:9,background:n.surface.standard}:void 0,primaryButton:{buttonText:ae?"Loading...":ee===F.RearrangeProducts?"Done":"Add",disabled:ae||he<1||A&&he<A||!A&&V&&he>V||!1,onClick:()=>{O.onAdd(ke,he),Te()}},wrapperStyle:O.stickyFooter?{height:"calc(100vh - 168px)"}:void 0,footerLeftCustomElement:W?t(o,{}):A&&he>A?t(p,{tagText:`You can only select ${A} products`,type:"negative"}):V&&he>V?t(p,{tagText:`You can only select ${V} products`,type:"negative"}):t(d,he>0?{onClick:()=>{te(J?F.RearrangeProducts:F.SelectedProducts)},buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:["rearrange","view"].includes(ee)?"tertiaryGray":"tertiary",disabled:["rearrange","view"].includes(ee)}:{disabled:!0,buttonText:A?`${he}/${A} products selected`:`${he} products selected`,buttonType:"tertiaryGray"}),hideCrossButton:je},{children:[De,je&&Fe?t(C,{productData:Fe,outOfStockAction:L,onClose:()=>{Ie(!1)}}):t(o,{})]}))})};export{O as ProductPickerModal,F as ScreenName};
|
|
@@ -24,6 +24,7 @@ interface ProductsScreenInterface {
|
|
|
24
24
|
showProductDetailInfoIcon?: boolean;
|
|
25
25
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
26
26
|
onProductDetailClick: (productData: Product | ProductVariant) => void;
|
|
27
|
+
scrollContainerRef: React.RefObject<HTMLDivElement>;
|
|
27
28
|
}
|
|
28
29
|
export declare const ProductsScreen: (props: ProductsScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
29
30
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import r from"../../assets/icons/search.svg.js";import{cloneDeep as n}from"lodash";import{useContext as
|
|
1
|
+
import{jsxs as t,jsx as e}from"react/jsx-runtime";import o from"../../assets/icons/arrow_left.svg.js";import c from"../../assets/icons/box.svg.js";import r from"../../assets/icons/search.svg.js";import{cloneDeep as n}from"lodash";import{useContext as i,useRef as s,useState as l,useEffect as d}from"react";import{COLORS as a}from"../../constants/Theme.js";import{CheckBox as u}from"../checkBox/CheckBox.js";import{IconButton as h}from"../icon-button/IconButton.js";import{Input as p}from"../input/Input.js";import{Spinner as m}from"../spinner/Spinner.js";import{BodyCaption as v,TitleRegular as g}from"../TypographyStyle.js";import{EmptyState as j}from"./emptyState.js";import{ProductGroup as f}from"./product.js";import{ProductPickerShimmer as y}from"./ProductPickerShimmer.js";import{CollectionIdContext as b}from"./reducers.js";import{ProductScreenHeader as k,ProductScreenCollectionCardStyle as O}from"./style.js";import{OUT_OF_STOCK_ACTION as C}from"./type.js";import{getVariantIdsToFetchAtProductLevel as P,markVariantsAsApprovedProductsLevel as E,isCollectionPartiallyChecked as I,isProductPartiallyChecked as D,liftTheStateUp as x}from"./utility.js";const S=S=>{const{data:T,collectionsDispatch:w,selectedData:R,selectedCollectionsDispatch:V,productFetcher:A,storeId:B,setScreen:F,setSaveDisabled:H,hideInCollectionSearch:L,customCollectionRestriction:J,hideProductCheckbox:W,outOfStockAction:z=C.BLUR,hideVariantCheckbox:K=!1,selectProductsFromCustomCollection:M=!1,pickerType:N,hideProductVariants:U,fbStatusFetcher:_,onProductDetailClick:q,showProductDetailInfoIcon:G,scrollContainerRef:Q}=S,X=i(b),Y=s(0),Z=s(!1),[$,tt]=l(!1),[et,ot]=l(""),[ct,rt]=l(!1),[nt,it]=l(T),st=s(!1);d((()=>{const t=setTimeout((()=>{et.length?(rt(!0),S.searchInCollectionFetcher(B,X,et).then((t=>{const e=n(T);e.products=t,it(e);const o=P(null!=t?t:{});at(o,null!=t?t:{},!0),H(!1),rt(!1)}))):it(T)}),800);return()=>clearTimeout(t)}),[et]);const lt=()=>{if(!Q||!(null==Q?void 0:Q.current))return;const{scrollTop:t,clientHeight:e,scrollHeight:o}=Q.current;t+e>=o-20&&!st.current&&!Z.current&&(H(!0),tt(!0),Z.current=!0,A(X,B,10,Y.current).then((t=>{if(Object.keys(t).length||(st.current=!0),Object.keys(t).length){const e=nt;e.products=Object.assign(Object.assign({},nt.products),t),it(e);const o=P(t);at(o,t),Y.current+=1}Z.current=!1,tt(!1),H(!1)})).catch())};d((()=>{var t;return null===(t=null==Q?void 0:Q.current)||void 0===t||t.addEventListener("scroll",lt),()=>{var t;null===(t=null==Q?void 0:Q.current)||void 0===t||t.removeEventListener("scroll",lt)}}),[]),d((()=>{var t,e,o,c;st.current=!1,Y.current=Math.floor((null===(e=Object.keys(null!==(t=T.products)&&void 0!==t?t:{}))||void 0===e?void 0:e.length)/10);const r=P(null!==(o=T.products)&&void 0!==o?o:{});at(r,null!==(c=T.products)&&void 0!==c?c:{})}),[X]);const dt=!!J&&T.isSmartCollection;d((()=>{(null==T?void 0:T.products)||ut(10)}),[]);const at=(t,e,o)=>{_||(o?E(e,w,X,nt,it):E(e,w,X)),t.length>0&&_&&_(B,t).then((t=>{const c=Object.assign({},e);Object.keys(e).forEach((o=>{var r,n;Object.keys(null!==(n=null===(r=null==e?void 0:e[o])||void 0===r?void 0:r.variants)&&void 0!==n?n:{}).forEach((r=>{var n,i;const s=null===(n=null==e?void 0:e[o].variants)||void 0===n?void 0:n[r];s&&"REJECTED"===t[r]?s.fbStatus="REJECTED":s&&"APPROVED"===t[r]&&(s.fbStatus="APPROVED");const l=null===(i=null==c?void 0:c[o])||void 0===i?void 0:i.variants;l&&l[r]&&(l[r]=s)}))})),o?(it((t=>{const e=Object.assign({},t);return e.products=c,e})),w({type:"productsPaged",data:{collectionId:X,products:c}})):w({type:"productsPaged",data:{collectionId:X,products:c}})})).catch((t=>{o?E(e,w,X,nt,it):E(e,w,X)}))},ut=t=>{H(!0),rt(!0),A(X,B,t,0).then((e=>{if(Object.keys(e).length||(st.current=!0),Object.keys(e).length){it(Object.assign(Object.assign({},nt),{products:e}));const t=P(e);at(t,e),Y.current=1}t||V({type:"selected",data:{id:X,val:Object.assign(Object.assign({},T),{products:e})}}),H(!1),rt(!1)})).catch()},ht=(t,e)=>{const o=x(e,T);V({type:t,data:Object.assign(Object.assign({},o),{isRestricted:J})})};return t("div",{children:[t(k,{children:[e(h,{Icon:o,height:16,onClick:()=>{F("collections")}}),e(v,Object.assign({style:{color:a.content.secondary}},{children:T.name}))]}),!L&&e("div",Object.assign({style:{padding:16,height:"76px",borderBottom:"1px solid #E0E0E0"}},{children:e(p,{noKeyDownChange:!0,noErrorHint:!0,rightIcon:{icon:()=>ct&&et.length?e(m,{size:"small",color:a.content.primary}):e(r,{})},id:"listInput",height:"24px",type:"text",value:et,onChangeText:t=>{t.length&&t.trim().length?ot(t):ot("")},placeholder:"Search products in this collection..."})})),t("div",{children:[Object.keys((null==nt?void 0:nt.products)||[]).length>0&&!dt&&!et.length&&!W&&"-1"!==X&&t(O,{children:[e(u,{isChecked:!!(null==R?void 0:R[X]),isPartiallyChecked:I(X,nt,R,U),onValueChange:function(t){t?ut():V({type:"unselected",data:{id:X}})}}),e("div",Object.assign({style:{width:40,height:40}},{children:e(c,{})})),e(g,{children:"All Products"})]}),Object.keys((null==nt?void 0:nt.products)||[]).length?Object.keys(nt.products||[]).map((t=>e(f,{outOfStockAction:z,collectionId:X,isProductPartiallyChecked:D(X,t,R,nt,U),productId:t,data:nt.products[t],selectedData:R,selectedCollectionsDispatch:V,viewOnly:!M&&!!dt,upliftAdditions:ht,hideProductCheckbox:W,hideVariantCheckbox:K,hideProductVariants:U,pickerType:N,onProductDetailClick:q,showProductDetailInfoIcon:G},t))):ct?e(y,{limit:10}):e(j,{title:"No products to show",subtitle:et.length?"We couldn't find the product you were looking for":"We couldn’t find any product in this collection."})]}),$&&e(y,{})]})};export{S as ProductsScreen};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import { Collection, FbStatusFetcherReturn, SearchedItems, SelectedItems } from '.';
|
|
3
3
|
import { SearchReducerActions, SelectedCollectionsActions } from './reducers';
|
|
4
|
+
import { OUT_OF_STOCK_ACTION } from './type';
|
|
4
5
|
interface SearchScreenInterface {
|
|
5
6
|
customCollectionRestriction?: boolean;
|
|
6
7
|
selectedCollections: SelectedItems;
|
|
@@ -22,6 +23,7 @@ interface SearchScreenInterface {
|
|
|
22
23
|
fbStatusFetcher?: (storeId: string, variantIds: string[]) => FbStatusFetcherReturn;
|
|
23
24
|
hideCollectionCheckbox?: boolean;
|
|
24
25
|
renderWithoutModal?: boolean;
|
|
26
|
+
outOfStockAction?: OUT_OF_STOCK_ACTION;
|
|
25
27
|
}
|
|
26
28
|
export declare const SearchScreen: (props: SearchScreenInterface) => import("react/jsx-runtime").JSX.Element;
|
|
27
29
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as r}from"./emptyState.js";import{ProductGroup as n}from"./product.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,isCollectionPartiallyChecked as p,isProductPartiallyChecked as h,liftTheStateUp as v}from"./utility.js";const m=m=>{var C;const{customCollectionRestriction:k,selectedCollections:y,searchedCollections:b,searchedCollectionsDispatch:
|
|
1
|
+
import{jsxs as o,jsx as e,Fragment as t}from"react/jsx-runtime";import l from"../../assets/icons/arrow_left.svg.js";import{useEffect as i}from"react";import{IconButton as c}from"../icon-button/IconButton.js";import{BodyCaption as d}from"../TypographyStyle.js";import{CollectionCard as s}from"./collectionScreen.js";import{EmptyState as r}from"./emptyState.js";import{ProductGroup as n}from"./product.js";import{SelectedScreenHeader as u}from"./style.js";import{fetchFbStatusCollection as a,isCollectionPartiallyChecked as p,isProductPartiallyChecked as h,liftTheStateUp as v}from"./utility.js";const m=m=>{var C;const{customCollectionRestriction:k,selectedCollections:y,searchedCollections:b,searchedCollectionsDispatch:f,selectedCollectionsDispatch:j,setScreen:S,collections:O,onBackPress:P,hideVariantCheckbox:I,pickerType:g,hideProductVariants:x,hideProductCheckbox:D,storeId:T,fbStatusFetcher:V,setCollectionId:w,setSelectedCollectionId:A,hideCollectionCheckbox:R,renderWithoutModal:W,outOfStockAction:B}=m;i((()=>{var o;a(null!==(o=b.products)&&void 0!==o?o:{},T,f,V,"setProducts")}),[null==b?void 0:b.products]);const M=!!k&&(null==y?void 0:y.isCustom);return o("div",{children:[o(u,{children:[e(c,{Icon:l,onClick:()=>{S("collections"),P()}}),e(d,{children:(null===(C=Object.keys(null==b?void 0:b.collections))||void 0===C?void 0:C.length)?"Searched Collections & Products":"Searched Products"})]}),e("div",{children:Object.keys(null==b?void 0:b.products).length||Object.keys(null==b?void 0:b.collections).length?o(t,{children:[e(t,{children:Object.keys(null==b?void 0:b.collections).map((o=>e(s,{customCollectionRestriction:k,data:null==O?void 0:O[o],isDisabled:M&&!(null==y?void 0:y[o]),isChecked:!!(null==y?void 0:y[o]),isPartiallyChecked:p(o,null==O?void 0:O[o],y,x),selectedCollectionsDispatch:j,setCollectionId:w,setSelectedCollectionId:A,setScreen:S,id:o,hideCollectionCheckbox:R||"-1"===o,selectedCollections:y,renderWithoutModal:W,pickerType:g,usedInSearch:!0},o)))}),e(t,{children:Object.keys(null==b?void 0:b.products).map((o=>{var t,l;return Object.keys((null===(l=null===(t=null==b?void 0:b.products)||void 0===t?void 0:t[o])||void 0===l?void 0:l.products)||[]).map((t=>{var l,i,c;let d=!1;return(null===(l=null==b?void 0:b.products)||void 0===l?void 0:l.isCustom)&&(d=!0),e(n,{collectionId:o,upliftAdditions:(e,t)=>((o,e,t)=>{var l;const i=v(t,null===(l=null==b?void 0:b.products)||void 0===l?void 0:l[o]);j({type:e,data:Object.assign(Object.assign({},i),{isRestricted:k})})})(o,e,t),productId:t,data:(null===(i=null==b?void 0:b.products)||void 0===i?void 0:i[o].products)[t],isProductPartiallyChecked:h(o,t,y,null===(c=b.products)||void 0===c?void 0:c[o],x),selectedData:y,selectedCollectionsDispatch:j,viewOnly:d,hideProductCheckbox:D,hideVariantCheckbox:I,hideProductVariants:x,pickerType:g,outOfStockAction:B},t)}))}))})]}):e(r,{title:"No search results found",subtitle:"We couldn’t find the product you were looking for."})})]})};export{m as SearchScreen};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import e from"styled-components";import{COLORS as i}from"../../constants/Theme.js";import{ScreenName as t}from"./modal.js";const o=e.div`
|
|
2
2
|
display: flex;
|
|
3
3
|
background-color: white;
|
|
4
|
-
height:
|
|
4
|
+
height: 75vh;
|
|
5
5
|
flex-direction: column;
|
|
6
6
|
`,n=e.div`
|
|
7
7
|
overflow-y: scroll;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { CSSProperties } from 'styled-components';
|
|
3
3
|
import { EmailTemplateType } from './models/EmailTemplate';
|
|
4
|
+
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";
|
|
4
5
|
declare const EmailTemplateThumbnailPreview: React.FC<{
|
|
5
6
|
template: EmailTemplateType;
|
|
6
7
|
hideHeader?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Button as
|
|
1
|
+
import{jsxs as e,jsx as t}from"react/jsx-runtime";import{Button as a}from"../button/Button.js";import{TitleRegular as n}from"../TypographyStyle.js";import{EmailContainer as s,Header as r,IframeContainer as o,ImageContainer as i,CardLoadingContainer as p,ViewButton as l}from"./EmailTemplatePreview.styled.js";const d="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",c=c=>{let{template:m,handleViewTemplate:u,hideHeader:h,hideViewButton:b,containerStyle:y,emailHtmlContainerId:g,emailDisplayContent:f}=c;return e(s,Object.assign({hideHeader:h,style:Object.assign({},null!=y?y:{})},{children:[!h&&t(r,{children:t(n,Object.assign({style:{maxWidth:"100%"}},{children:m.name}))}),t(o,{children:f?t("iframe",{title:"Email template preview",id:null!=g?g:"",width:"100%",srcDoc:(C=f,C.replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/src="<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{product.photoUrl}}<\/span><span> <\/span>"/g,`src=${d}`).replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/orderProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{##abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"").replace(/<span><\/span><span style="color: #731DCF; text-decoration: underline;">{{\/\/abandonedCartProducts}}<\/span><span>\s*<\/span>/g,"")),height:"100%",style:{pointerEvents:"none"}}):t(i,Object.assign({hideHeader:h},{children:t(p,{})}))}),!b&&t(l,{children:t(a,{buttonType:"tertiary",buttonText:"View",onClick:()=>{u&&u()}})})]}));var C};export{d as DEFAULT_IMAGE,c as default};
|